Pārlūkot izejas kodu

add 调查问卷已开启缴费,推送缴费链接

周箭河 4 gadi atpakaļ
vecāks
revīzija
7d5a4fa99c

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -21,6 +21,7 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 
+import com.ym.mec.util.http.HttpUtil;
 import org.apache.poi.ss.formula.functions.T;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -93,15 +94,38 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
                 sysUserFeignService.updateSysUser(sysUser);
             }
         }
+        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.getByCooperationId(replacementInstrumentActivity.getCooperationOrganId());
         //如果提交过调查问卷,那么覆盖之前的记录
         ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(replacementInstrumentActivity.getCooperationOrganId(), sysUser.getId());
+        if (replacementInstrumentCooperation != null && replacementInstrumentCooperation.getOpenPay().equals(YesOrNoEnum.YES)) {
+            replacementInstrumentActivity.setOpenFlag(1);
+        }
         if (activity != null) {
+            if (!activity.getPayStatus().equals(0)) {
+                throw new BizException("您已参与调查,谢谢参与!");
+            }
             //覆盖之前的数据
             replacementInstrumentActivity.setId(activity.getId());
             replacementInstrumentActivityDao.update(replacementInstrumentActivity);
         } else {
             replacementInstrumentActivityDao.insert(replacementInstrumentActivity);
         }
+        //已开启缴费推送购买链接
+        if (replacementInstrumentActivity.getOpenFlag().equals(1) && replacementInstrumentActivity.getInstrumentsId() != null) {
+            ReplacementInstrument replacementInstrument = replacementInstrumentDao.get(replacementInstrumentActivity.getInstrumentsId());
+            Map<Integer, String> userMap = new HashMap<>();
+            Map<Integer, String> userPhoneMap = new HashMap<>();
+            Integer userId = replacementInstrumentActivity.getUserId();
+            String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+            String pushUrl = baseApiUrl + "/#/questionGoodsSale?id=";
+            userMap.put(userId, userId.toString());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
+                    userMap, null, 0, "5?" + pushUrl + replacementInstrumentActivity.getId(), "STUDENT", replacementInstrument.getBrand(), "");
+
+            userPhoneMap.put(replacementInstrumentActivity.getUserId(), replacementInstrumentActivity.getMobileNo());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
+                    userPhoneMap, null, 0, null, "STUDENT", replacementInstrument.getBrand(), HttpUtil.getSortUrl(pushUrl + replacementInstrumentActivity.getId()));
+        }
         return replacementInstrumentActivity;
     }
 

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentCooperationServiceImpl.java

@@ -67,7 +67,7 @@ public class ReplacementInstrumentCooperationServiceImpl extends BaseServiceImpl
         Map<Integer, String> userPhoneMap = new HashMap<>();
 
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
-        String pushUrl = baseApiUrl + "/#/auditionActive/1?id=";
+        String pushUrl = baseApiUrl + "/#/questionGoodsSale?id=";
         for (ReplacementInstrumentActivityStatDto pushUser : pushUsers) {
             userMap.clear();
             userPhoneMap.clear();