|
|
@@ -585,6 +585,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
updateQwUserKey(sopLogs,qwUser.getQwUserId(),param.getSopId(),groupUser.getChatId());
|
|
|
//域名
|
|
|
String companyUserId = qwUser.getCompanyUserId().toString();
|
|
|
+ String companyId = String.valueOf(qwUser.getCompanyId()).trim();
|
|
|
String domainName = companyUserMapper.selectDomainByUserId(Long.parseLong(companyUserId));
|
|
|
if (StringUtils.isEmpty(domainName)) {
|
|
|
domainName = config.getRealLinkDomainName();
|
|
|
@@ -705,6 +706,45 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramAppid(sysConfig.getAppId());
|
|
|
st.setMiniprogramPage(sortLiveLink);
|
|
|
break;
|
|
|
+ case "14":
|
|
|
+
|
|
|
+ linkByMiniApp = createActivityLinkByMiniApp(st,sopLogs, qwGroupChat.getCorpId(), new Date(), param.getCourseId(), param.getVideoId(),
|
|
|
+ String.valueOf(qwUser.getId()), qwUser.getCompanyUserId().toString(), qwUser.getCompanyId().toString(),null ,config, groupUser.getChatId());
|
|
|
+
|
|
|
+ miniAppId = null;
|
|
|
+ if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
+ Map<Integer, List<CompanyMiniapp>> integerListMap = miniMap.get(Long.valueOf(companyId));
|
|
|
+ if (integerListMap != null) {
|
|
|
+ int listIndexTemp = 1;
|
|
|
+ List<CompanyMiniapp> miniapps = integerListMap.get(listIndexTemp);
|
|
|
+ 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 "16":
|
|
|
+ createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
setting.setSetting(list);
|
|
|
@@ -863,6 +903,60 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramAppid(sysConfig.getAppId());
|
|
|
st.setMiniprogramPage(sortLiveLink);
|
|
|
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;
|
|
|
+ if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
+ Map<Integer, List<CompanyMiniapp>> integerListMap = miniMap.get(Long.valueOf(companyId));
|
|
|
+ if (integerListMap != null) {
|
|
|
+ int listIndexTemp = 1;
|
|
|
+ List<CompanyMiniapp> miniapps = integerListMap.get(listIndexTemp);
|
|
|
+ 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 "15":
|
|
|
+ String txt2 = StringUtil.strIsNullOrEmpty(qwUser.getWelcomeText()) ? "" : qwUser.getWelcomeText();
|
|
|
+ st.setValue(st.getValue().replaceAll("#客服称呼#", txt2).replaceAll("#销售称呼#", txt2));
|
|
|
+ try {
|
|
|
+ replaceContent(st.getContentType(), st.getValue(), st::setValue, words); // 替换 value
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "16":
|
|
|
+ if (qwUser.getCompanyUserId() != null) {
|
|
|
+ createVoiceUrl(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if (qwUser.getCompanyUserId() != null) {
|
|
|
+ createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
setting.setSetting(list);
|
|
|
@@ -1074,6 +1168,119 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
|
|
|
st.setMiniprogramAppid(sysConfig.getAppId());
|
|
|
st.setMiniprogramPage(sortLiveLink);
|
|
|
break;
|
|
|
+ case "14":
|
|
|
+ LuckyBag luckyBag = luckyBagMapper.selectLuckyBagById(st.getLuckyBagId());
|
|
|
+ if(ObjectUtil.isNotEmpty(luckyBag)&&luckyBag.getDataStatus().equals("0")){
|
|
|
+ sopLogs.setSendStatus(5L);
|
|
|
+ sopLogs.setReceivingStatus(0L);
|
|
|
+ sopLogs.setRemark("福袋配置被禁用");
|
|
|
+ }
|
|
|
+ else if (ObjectUtil.isNotEmpty(sopLogs.getFsUserId())){
|
|
|
+ //获取配置并校验
|
|
|
+ SysConfig luckyBagConfig = configService.selectConfigByConfigKey("luckyBag.config");
|
|
|
+ if (ObjectUtil.isEmpty(luckyBagConfig)) {
|
|
|
+ sopLogs.setSendStatus(5L);
|
|
|
+ sopLogs.setReceivingStatus(0L);
|
|
|
+ sopLogs.setRemark("福袋配置不存在");
|
|
|
+ }
|
|
|
+// 2. 解析配置值
|
|
|
+ JSONObject jsonObject;
|
|
|
+ try {
|
|
|
+ jsonObject = JSON.parseObject(luckyBagConfig.getConfigValue());
|
|
|
+ Integer count = jsonObject.getInteger("weekLimit");
|
|
|
+
|
|
|
+ // 查询用户记录并校验次数
|
|
|
+ LuckyBagCollectRecord queryRecord = new LuckyBagCollectRecord();
|
|
|
+ queryRecord.setUserId(sopLogs.getFsUserId());
|
|
|
+ queryRecord.setCollectType("1");
|
|
|
+ // 动态计算时间范围
|
|
|
+ LocalDate endDate = LocalDate.now();
|
|
|
+ LocalDate startDate = endDate.minusDays(6); // 包含今天
|
|
|
+
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("beginSendTime", startDate.toString());
|
|
|
+ params.put("endSendTime", endDate.toString());
|
|
|
+ queryRecord.setParams(params);
|
|
|
+ List<LuckyBagCollectRecord> luckyBagCollectRecords =
|
|
|
+ luckyBagCollectRecordMapper.selectLuckyBagCollectRecordList(queryRecord);
|
|
|
+
|
|
|
+ // 判断是否超过限制
|
|
|
+ if (luckyBagCollectRecords.size() >= count) {
|
|
|
+ sopLogs.setSendStatus(5L);
|
|
|
+ sopLogs.setReceivingStatus(0L);
|
|
|
+ sopLogs.setRemark("超过福袋发放次数");
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 处理配置解析异常
|
|
|
+ sopLogs.setSendStatus(5L);
|
|
|
+ sopLogs.setReceivingStatus(0L);
|
|
|
+ sopLogs.setRemark("福袋配置解析失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ linkByMiniApp = createActivityLinkByMiniApp(st,sopLogs, param.getCorpId(), createTime, param.getCourseId(), param.getVideoId(),
|
|
|
+ qwUserId, companyUserId, companyId, item.getExternalId(), config,null);
|
|
|
+
|
|
|
+ miniAppId = null;
|
|
|
+
|
|
|
+ if (!miniMap.isEmpty() && qwUser.getSendMsgType() == 1) {
|
|
|
+ Map<Integer, List<CompanyMiniapp>> integerListMap = miniMap.get(Long.valueOf(companyId));
|
|
|
+ if (integerListMap != null) {
|
|
|
+ int effectiveGradeTemp = (item.getGrade() == null) ? 5 : item.getGrade();
|
|
|
+ int listIndexTemp = (effectiveGradeTemp == 1 || effectiveGradeTemp == 2) ? 0 : 1;
|
|
|
+
|
|
|
+ //评级是6 S级,则走A类小程序
|
|
|
+ if (effectiveGradeTemp==6){
|
|
|
+ listIndexTemp=2;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CompanyMiniapp> miniapps = integerListMap.get(listIndexTemp);
|
|
|
+
|
|
|
+ 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 "15":
|
|
|
+ String txt = StringUtil.strIsNullOrEmpty(qwUser.getWelcomeText()) ? "" : qwUser.getWelcomeText();
|
|
|
+ st.setValue(st.getValue()
|
|
|
+ .replaceAll("#客服称呼#", txt)
|
|
|
+ .replaceAll("#销售称呼#", txt)
|
|
|
+ .replaceAll("#客户称呼#", StringUtil.strIsNullOrEmpty(contact.getStageStatus()) || "0".equals(contact.getStageStatus()) ? "同学" : contact.getStageStatus()));
|
|
|
+ try {
|
|
|
+ replaceContent(st.getContentType(), st.getValue(), st::setValue, words); // 替换 value
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "16":
|
|
|
+ createVoiceUrl(st, companyUserId, qwSop);
|
|
|
+ try {
|
|
|
+ if (qwUser.getCompanyUserId() != null) {
|
|
|
+ createVoiceUrlToIm(st, String.valueOf(qwUser.getCompanyUserId()), qwSop);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
|