|
|
@@ -614,6 +614,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
replaceContent(st.getContentType(), st.getLinkDescribe(), st::setLinkDescribe, words); // 替换 linkTitle
|
|
|
}
|
|
|
|
|
|
+ String miniAppId = null;
|
|
|
switch (st.getContentType()) {
|
|
|
//文字和短链一起
|
|
|
case "1":
|
|
|
@@ -664,7 +665,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
String linkByMiniApp = createLinkByMiniApp(st, param.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
qwUser.getId(), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(), null, config, qwGroupChat.getChatId());
|
|
|
|
|
|
- String miniAppId = null;
|
|
|
+
|
|
|
|
|
|
int listIndex = 1;
|
|
|
if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
@@ -718,6 +719,47 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramAppid(sysConfig.getAppId());
|
|
|
st.setMiniprogramPage(sortLiveLink);
|
|
|
break;
|
|
|
+ // 注册
|
|
|
+ case "13":
|
|
|
+ try{
|
|
|
+
|
|
|
+ linkByMiniApp = createGroupRegisteredLinkByMiniApp(st, qwGroupChat.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
+ qwUser.getId(), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(), config, groupUser.getChatId());
|
|
|
+
|
|
|
+// String luckyjson = configService.selectConfigByKey("luckyBag.config");
|
|
|
+// Map<String, Object> luckyBagConfig = JSON.parseObject(luckyjson, Map.class);
|
|
|
+// miniAppId = String.valueOf(luckyBagConfig.get("appId"));
|
|
|
+
|
|
|
+
|
|
|
+ if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
+ Map<Integer, List<CompanyMiniapp>> integerListMap = miniMap.get(Long.valueOf(companyId));
|
|
|
+ if (integerListMap != null) {
|
|
|
+ int listIndexNum = 1;
|
|
|
+ List<CompanyMiniapp> miniapps = integerListMap.get(listIndexNum);
|
|
|
+ if (miniapps != null && !miniapps.isEmpty()) {
|
|
|
+ CompanyMiniapp companyMiniapp = miniapps.get(0);
|
|
|
+ if (companyMiniapp != null && !StringUtil.strIsNullOrEmpty(companyMiniapp.getAppId())) {
|
|
|
+ miniAppId = companyMiniapp.getAppId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!StringUtil.strIsNullOrEmpty(miniAppId) && !StringUtil.strIsNullOrEmpty(qwCompany.getMiniAppId())) {
|
|
|
+ miniAppId = qwCompany.getMiniAppId();
|
|
|
+ }
|
|
|
+ if (!StringUtil.strIsNullOrEmpty(miniAppId)) {
|
|
|
+ st.setMiniprogramAppid(miniAppId);
|
|
|
+ } else {
|
|
|
+ log.error("公司的小程序id为空:采用了前端传的固定值" + sopLogs.getSopId());
|
|
|
+ }
|
|
|
+
|
|
|
+ st.setMiniprogramTitle("点击注册");
|
|
|
+ st.setMiniprogramPage(linkByMiniApp);
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
+ log.error("注册链接发送异常:"+e.getMessage());
|
|
|
+ }
|
|
|
+ break;
|
|
|
case "14":
|
|
|
|
|
|
linkByMiniApp = createActivityLinkByMiniApp(st,sopLogs, qwGroupChat.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
@@ -814,6 +856,8 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
replaceContent(st.getContentType(), st.getLinkTitle(), st::setLinkTitle, words); // 替换 linkTitle
|
|
|
replaceContent(st.getContentType(), st.getLinkDescribe(), st::setLinkDescribe, words); // 替换 linkTitle
|
|
|
}
|
|
|
+ String miniAppId = null;
|
|
|
+ String companyId = String.valueOf(qwUser.getCompanyId()).trim();
|
|
|
switch (st.getContentType()) {
|
|
|
//文字和短链一起
|
|
|
case "1":
|
|
|
@@ -860,7 +904,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
String linkByMiniApp = createLinkByMiniApp(st, param.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
qwUser.getId(), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(), null, config, groupChat.getChatId());
|
|
|
|
|
|
- String miniAppId = null;
|
|
|
+
|
|
|
|
|
|
int listIndex = 1;
|
|
|
if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
@@ -921,8 +965,38 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramAppid(sysConfig.getAppId());
|
|
|
st.setMiniprogramPage(sortLiveLink);
|
|
|
break;
|
|
|
+ case "13":
|
|
|
+
|
|
|
+ linkByMiniApp = createGroupRegisteredLinkByMiniApp(st, qwUser.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
+ qwUser.getId(), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(), config, groupChat.getChatId());
|
|
|
+// String luckyjson = configService.selectConfigByKey("luckyBag.config");
|
|
|
+// Map<String, Object> luckyBagConfig = JSON.parseObject(luckyjson, Map.class);
|
|
|
+// miniAppId = String.valueOf(luckyBagConfig.get("appId"));
|
|
|
+ if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
+ Map<Integer, List<CompanyMiniapp>> integerListMap = miniMap.get(Long.valueOf(companyId));
|
|
|
+ if (integerListMap != null) {
|
|
|
+ int listIndexNum = 1;
|
|
|
+ List<CompanyMiniapp> miniapps = integerListMap.get(listIndexNum);
|
|
|
+ if (miniapps != null && !miniapps.isEmpty()) {
|
|
|
+ CompanyMiniapp companyMiniapp = miniapps.get(0);
|
|
|
+ if (companyMiniapp != null && !StringUtil.strIsNullOrEmpty(companyMiniapp.getAppId())) {
|
|
|
+ miniAppId = companyMiniapp.getAppId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtil.strIsNullOrEmpty(miniAppId) && !StringUtil.strIsNullOrEmpty(qwCompany.getMiniAppId())) {
|
|
|
+ miniAppId = qwCompany.getMiniAppId();
|
|
|
+ }
|
|
|
+ if (!StringUtil.strIsNullOrEmpty(miniAppId)) {
|
|
|
+ st.setMiniprogramAppid(miniAppId);
|
|
|
+ } else {
|
|
|
+ log.error("公司的小程序id为空:采用了前端传的固定值" + sopLogs.getSopId());
|
|
|
+ }
|
|
|
+ st.setMiniprogramTitle("点击注册");
|
|
|
+ st.setMiniprogramPage(linkByMiniApp);
|
|
|
+ break;
|
|
|
case "14":
|
|
|
- String companyId = String.valueOf(qwUser.getCompanyId()).trim();
|
|
|
linkByMiniApp = createActivityLinkByMiniApp(st,sopLogs, qwUser.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
String.valueOf(qwUser.getId()), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(),null, config, groupChat.getChatId());
|
|
|
miniAppId = null;
|
|
|
@@ -1063,6 +1137,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
replaceContent(st.getContentType(), st.getLinkDescribe(), st::setLinkDescribe, words); // 替换 linkTitle
|
|
|
}
|
|
|
|
|
|
+ String miniAppId = null;
|
|
|
switch (st.getContentType()){
|
|
|
//文字和短链一起
|
|
|
case "1":
|
|
|
@@ -1111,7 +1186,6 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
String linkByMiniApp = createLinkByMiniApp(st, param.getCorpId(), createTime, param.getCourseId(), param.getVideoId(),
|
|
|
Long.valueOf(qwUserId), companyUserId, companyId, item.getExternalId(), config, null);
|
|
|
|
|
|
- String miniAppId = null;
|
|
|
|
|
|
int effectiveGrade = (item.getGrade() == null) ? 5 : item.getGrade();
|
|
|
int listIndex = (effectiveGrade == 1 || effectiveGrade == 2) ? 0 : 1;
|
|
|
@@ -1192,6 +1266,56 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramAppid(sysConfig.getAppId());
|
|
|
st.setMiniprogramPage(sortLiveLink);
|
|
|
break;
|
|
|
+ case "13":
|
|
|
+
|
|
|
+ if (sopLogs.getFsUserId() != null && !Objects.equals(0L, sopLogs.getFsUserId())) {
|
|
|
+ sopLogs.setSendStatus(5L);
|
|
|
+ sopLogs.setReceivingStatus(0L);
|
|
|
+ sopLogs.setRemark("已经注册过的客户不发送");
|
|
|
+ }
|
|
|
+
|
|
|
+ linkByMiniApp = createRegisteredLinkByMiniApp(st, param.getCorpId(), createTime, param.getCourseId(), param.getVideoId(),
|
|
|
+ Long.valueOf(qwUserId), companyUserId, companyId, item.getExternalId(), config);
|
|
|
+// String luckyjson1 = configService.selectConfigByKey("luckyBag.config");
|
|
|
+// Map<String, Object> luckyBagConfig1 = JSON.parseObject(luckyjson1, Map.class);
|
|
|
+// miniAppId = String.valueOf(luckyBagConfig1.get("appId"));
|
|
|
+
|
|
|
+ if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
+ Map<Integer, List<CompanyMiniapp>> integerListMap = miniMap.get(Long.valueOf(companyId));
|
|
|
+ if (integerListMap != null) {
|
|
|
+ int effectiveGradeNum = (item.getGrade() == null) ? 5 : item.getGrade();
|
|
|
+ int listIndexNum = (effectiveGradeNum == 1 || effectiveGradeNum == 2) ? 0 : 1;
|
|
|
+
|
|
|
+ //评级是6 S级,则走A类小程序
|
|
|
+ if (effectiveGradeNum==6){
|
|
|
+ listIndexNum=2;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CompanyMiniapp> miniapps = integerListMap.get(listIndexNum);
|
|
|
+
|
|
|
+ if (miniapps != null && !miniapps.isEmpty()) {
|
|
|
+ CompanyMiniapp companyMiniapp = miniapps.get(0);
|
|
|
+ if (companyMiniapp != null && !StringUtil.strIsNullOrEmpty(companyMiniapp.getAppId())) {
|
|
|
+ miniAppId = companyMiniapp.getAppId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.strIsNullOrEmpty(miniAppId) && !StringUtil.strIsNullOrEmpty(qwCompany.getMiniAppId())) {
|
|
|
+ miniAppId = qwCompany.getMiniAppId();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtil.strIsNullOrEmpty(miniAppId)) {
|
|
|
+ st.setMiniprogramAppid(miniAppId);
|
|
|
+ } else {
|
|
|
+ log.error("公司的小程序id为空:采用了前端传的固定值" + sopLogs.getSopId());
|
|
|
+ }
|
|
|
+
|
|
|
+ st.setMiniprogramTitle("点击注册");
|
|
|
+
|
|
|
+ st.setMiniprogramPage(linkByMiniApp);
|
|
|
+ break;
|
|
|
case "14":
|
|
|
LuckyBag luckyBag = luckyBagMapper.selectLuckyBagById(st.getLuckyBagId());
|
|
|
if(ObjectUtil.isNotEmpty(luckyBag)&&luckyBag.getDataStatus().equals("0")){
|
|
|
@@ -2384,4 +2508,64 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
return record;
|
|
|
}
|
|
|
|
|
|
+ private String createGroupRegisteredLinkByMiniApp(QwSopCourseFinishTempSetting.Setting setting, String corpId, Date sendTime,
|
|
|
+ Integer courseId, Integer videoId, Long qwUserId,
|
|
|
+ String companyUserId, String companyId, CourseConfig config, String chatId) {
|
|
|
+
|
|
|
+ FsCourseLink link = createFsCourseLink(corpId, sendTime, courseId, videoId, qwUserId,
|
|
|
+ companyUserId, companyId, null, 3, chatId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ FsCourseRealLink courseMap = new FsCourseRealLink();
|
|
|
+ BeanUtils.copyProperties(link, courseMap);
|
|
|
+
|
|
|
+ String realLinkFull = registeredRealLink + JSON.toJSONString(courseMap);
|
|
|
+ link.setRealLink(realLinkFull);
|
|
|
+
|
|
|
+ Date updateTime = createUpdateTime(setting, sendTime, config);
|
|
|
+
|
|
|
+ link.setUpdateTime(updateTime);
|
|
|
+ //存短链-
|
|
|
+ fsCourseLinkMapper.insertFsCourseLink(link);
|
|
|
+ return link.getRealLink();
|
|
|
+ }
|
|
|
+
|
|
|
+ private String createRegisteredLinkByMiniApp(QwSopCourseFinishTempSetting.Setting setting, String corpId, Date sendTime,
|
|
|
+ Integer courseId, Integer videoId, Long qwUserId,
|
|
|
+ String companyUserId, String companyId, Long externalId, CourseConfig config) {
|
|
|
+
|
|
|
+ FsCourseLink link = new FsCourseLink();
|
|
|
+ link.setCompanyId(Long.parseLong(companyId));
|
|
|
+ link.setQwUserId(qwUserId);
|
|
|
+ link.setCompanyUserId(Long.parseLong(companyUserId));
|
|
|
+ link.setVideoId(videoId.longValue());
|
|
|
+ link.setCorpId(corpId);
|
|
|
+ link.setCourseId(courseId.longValue());
|
|
|
+ link.setQwExternalId(externalId);
|
|
|
+ link.setLinkType(3); //小程序
|
|
|
+ link.setUNo(UUID.randomUUID().toString());
|
|
|
+ String randomString = generateRandomStringWithLock();
|
|
|
+ if (StringUtil.strIsNullOrEmpty(randomString)) {
|
|
|
+ link.setLink(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ } else {
|
|
|
+ link.setLink(randomString);
|
|
|
+ }
|
|
|
+ link.setCreateTime(sendTime);;
|
|
|
+ Date updateTime = createUpdateTime(setting, sendTime, config);
|
|
|
+ link.setUpdateTime(updateTime);
|
|
|
+
|
|
|
+
|
|
|
+ FsCourseRealLink courseMap = new FsCourseRealLink();
|
|
|
+ BeanUtils.copyProperties(link, courseMap);
|
|
|
+
|
|
|
+ String realLinkFull = registeredRealLink + JSON.toJSONString(courseMap);
|
|
|
+ link.setRealLink(realLinkFull);
|
|
|
+
|
|
|
+ log.error("存入fs_course_link:" + registeredRealLink );
|
|
|
+ //存短链-
|
|
|
+ fsCourseLinkMapper.insertFsCourseLink(link);
|
|
|
+ return link.getRealLink();
|
|
|
+ }
|
|
|
+
|
|
|
}
|