Browse Source

Merge remote-tracking branch 'origin/online1' into online1

Joburgess 4 years ago
parent
commit
6f204056eb

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentActivity.java

@@ -18,6 +18,9 @@ public class ReplacementInstrumentActivity {
 	/** 合作单位置换活动表编号 */
 	private Integer replacementInstrumentCooperationId;
 
+	/** 活动标题 */
+	private String replacementInstrumentCooperationTitle;
+
 	private Integer topicId;
 
 	/** 合作单位 */
@@ -27,7 +30,7 @@ public class ReplacementInstrumentActivity {
 	private Integer userId;
 
 	/**  */
-	private Integer openFlag = 0;
+	private Integer openFlag;
 	
 	/**  */
 	private String userName;
@@ -70,6 +73,14 @@ public class ReplacementInstrumentActivity {
 	/**  */
 	private java.util.Date updateTime;
 
+	public String getReplacementInstrumentCooperationTitle() {
+		return replacementInstrumentCooperationTitle;
+	}
+
+	public void setReplacementInstrumentCooperationTitle(String replacementInstrumentCooperationTitle) {
+		this.replacementInstrumentCooperationTitle = replacementInstrumentCooperationTitle;
+	}
+
 	public Integer getReplacementInstrumentCooperationId() {
 		return replacementInstrumentCooperationId;
 	}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ReplacementInstrumentCooperation.java

@@ -24,6 +24,9 @@ public class ReplacementInstrumentCooperation {
     @ApiModelProperty(value = "合作单位id")
     private Integer cooperationOrganId;
 
+    @ApiModelProperty(value = "活动标题")
+    private String title;
+
     @ApiModelProperty(value = "问卷编号")
     private Integer topicId;
 
@@ -76,6 +79,14 @@ public class ReplacementInstrumentCooperation {
     @ApiModelProperty(value = "缴费率")
     private BigDecimal payScale = BigDecimal.ZERO;
 
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
     public String getTopicTitle() {
         return topicTitle;
     }

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

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

+ 7 - 5
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentCooperationMapper.xml

@@ -2,8 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ym.mec.biz.dal.dao.ReplacementInstrumentCooperationDao">
     <resultMap id="ReplacementInstrumentCooperation" type="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">
-        <!--@mbg.generated-->
-        <!--@Table replacement_instrument_cooperation-->
         <result column="id_" property="id"/>
         <result column="organ_id_" property="organId"/>
         <result column="cooperation_organ_id_" property="cooperationOrganId"/>
@@ -13,6 +11,7 @@
         <result column="show_question_" property="showQuestion" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="organName" property="organName"/>
         <result column="cooperationOrganName" property="cooperationOrganName"/>
+        <result column="title_" property="title"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
     </resultMap>
@@ -27,11 +26,11 @@
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         <!--@mbg.generated-->
         insert into replacement_instrument_cooperation (organ_id_, cooperation_organ_id_, open_pay_,show_question_,topic_id_, create_time_,
-        update_time_
+        update_time_,title_
         )
         values (#{organId}, #{cooperationOrganId},
         #{openPay,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{showQuestion,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{topicId}, #{createTime}, #{updateTime}
+        #{topicId}, NOW(), NOW(),#{title}
         )
     </insert>
 
@@ -43,6 +42,9 @@
         <!--@mbg.generated-->
         update replacement_instrument_cooperation
         <set>
+            <if test="title != null">
+                title_ = #{title},
+            </if>
             <if test="topicId != null">
                 topic_id_ = #{topicId},
             </if>
@@ -84,7 +86,7 @@
                 AND ric.show_question_ = #{showQuestion,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
             <if test="search != null and search != ''">
-                AND (ric.cooperation_organ_id_ = #{search} OR co.name_ LIKE CONCAT('%',#{search},'%'))
+                AND (ric.cooperation_organ_id_ = #{search} OR co.name_ LIKE CONCAT('%',#{search},'%') OR ric.title_ LIKE CONCAT('%',#{search},'%'))
             </if>
         </where>
     </sql>

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

@@ -4,7 +4,6 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
-import com.ym.mec.biz.dal.dto.StudentInstrumentExportDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
@@ -22,19 +21,16 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.json.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @RequestMapping("replacementInstrumentActivity")
 @Api(tags = "乐器置换-调查问卷服务")
@@ -52,10 +48,6 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @Autowired
     private ReplacementInstrumentCooperationService replacementInstrumentCooperationService;
     @Autowired
-    private QuestionnaireQuestionDao questionnaireQuestionDao;
-    @Autowired
-    private QuestionnaireUserResultService questionnaireUserResultService;
-    @Autowired
     private SysConfigDao sysConfigDao;
     @Autowired
     private SysMessageService sysMessageService;
@@ -132,6 +124,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')")

+ 12 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentCooperationController.java

@@ -79,4 +79,16 @@ public class ReplacementInstrumentCooperationController extends BaseController {
     public HttpResponseResult<ReplacementInstrumentCooperation> openPay(Integer id) {
         return succeed(replacementInstrumentCooperationService.openPay(id));
     }
+
+    @ApiOperation(value = "修改")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('replacementInstrumentCooperation/update')")
+    public Object update(Integer id,String title) {
+        ReplacementInstrumentCooperation cooperation = replacementInstrumentCooperationService.get(id);
+        if(cooperation == null){
+            return failed("活动不存在");
+        }
+        cooperation.setTitle(title);
+        return succeed(replacementInstrumentCooperationService.update(cooperation));
+    }
 }