Bladeren bron

Merge branch 'online1' of http://git.dayaedu.com/yonge/mec

zouxuan 4 jaren geleden
bovenliggende
commit
e7ce09ed82

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentActivity.java

@@ -20,6 +20,8 @@ public class ReplacementInstrumentActivity {
 
 	private Integer topicId;
 
+	private String topicName;
+
 	/** 合作单位 */
 	private String cooperationOrganName;
 	
@@ -70,6 +72,14 @@ public class ReplacementInstrumentActivity {
 	/**  */
 	private java.util.Date updateTime;
 
+	public String getTopicName() {
+		return topicName;
+	}
+
+	public void setTopicName(String topicName) {
+		this.topicName = topicName;
+	}
+
 	public Integer getReplacementInstrumentCooperationId() {
 		return replacementInstrumentCooperationId;
 	}

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

@@ -603,6 +603,11 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
             replacementInstrumentActivity.setTopicId(cooperation.getTopicId());
             replacementInstrumentActivity.setReplacementInstrumentCooperationId(cooperationId);
         }
+        QuestionnaireTopic topic = questionnaireTopicDao.get(cooperation.getTopicId());
+        if(topic != null){
+            replacementInstrumentActivity.setTopicName(topic.getTitle());
+        }
+
         replacementInstrumentActivity.setMobileNo(user.getPhone());
         CooperationOrgan cooperationOrgan = cooperationOrganService.get(cooperationOrganId);
         if (cooperationOrgan != null) {

+ 34 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentActivityController.java

@@ -132,6 +132,40 @@ public class ReplacementInstrumentActivityController extends BaseController {
         return succeed(replacementInstrumentActivity);
     }
 
+    @ApiOperation(value = "开启/关闭缴费")
+    @PostMapping("/updateOpenFlag")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/updateOpenFlag')")
+    public HttpResponseResult<ReplacementInstrumentActivity> updateOpenFlag(Integer Id,Integer openFlag) {
+        ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(Id);
+        if (!replacementInstrumentActivity.getPayStatus().equals(0)) {
+            return failed("支付中、已支付的乐器置换,不能修改");
+        }
+
+        if(replacementInstrumentActivity.getInstrumentsId() == null){
+            return failed("修改失败:用户没有可置换商品");
+        }
+        if (openFlag == 1) {
+            Goods goods = goodsService.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", goods.getBrand(), "");
+
+            userPhoneMap.put(userId, replacementInstrumentActivity.getMobileNo());
+            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.REPLACEMENT_PAY_PUSH,
+                    userPhoneMap, null, 0, null, "STUDENT", goods.getBrand(), HttpUtil.getSortUrl(pushUrl + replacementInstrumentActivity.getId()));
+        }
+
+        replacementInstrumentActivity.setOpenFlag(openFlag);
+        replacementInstrumentActivity.setUpdateTime(new Date());
+        replacementInstrumentActivityService.update(replacementInstrumentActivity);
+        return succeed(replacementInstrumentActivity);
+    }
+
     @ApiOperation(value = "导出")
     @RequestMapping("/export")
     @PreAuthorize("@pcs.hasPermissions('replacementInstrumentActivity/export')")