Browse Source

调查问卷

zouxuan 4 years ago
parent
commit
0a32028104

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentActivityDao.java

@@ -13,7 +13,7 @@ import com.ym.mec.common.dal.BaseDAO;
 public interface ReplacementInstrumentActivityDao extends BaseDAO<Integer, ReplacementInstrumentActivity> {
 
 
-    ReplacementInstrumentActivity findByUserId(@Param("cooperationOrganId") Integer cooperationOrganId, @Param("userId") Integer userId, @Param("topicId") Integer topicId);
+    ReplacementInstrumentActivity findByUserId(@Param("cooperationOrganId") Integer cooperationOrganId, @Param("userId") Integer userId, @Param("cooperationId") Integer cooperationId);
 
     List<ReplacementInstrumentActivityStatDto> queryReplacements(Map<String, Object> params);
 

+ 0 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ReplacementInstrumentCooperationDao.java

@@ -9,14 +9,6 @@ import java.util.List;
 public interface ReplacementInstrumentCooperationDao extends com.ym.mec.common.dal.BaseDAO<Integer, ReplacementInstrumentCooperation> {
 
     /**
-     * 获取合作单位的活动
-     *
-     * @param cooperationId
-     * @return
-     */
-    ReplacementInstrumentCooperation getByCooperationId(@Param("cooperationId") Integer cooperationId);
-
-    /**
      * 统计个合作单位的转化率
      * @return
      */

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

@@ -15,6 +15,9 @@ public class ReplacementInstrumentActivity {
 	/** 合作单位 */
 	private Integer cooperationOrganId;
 
+	/** 合作单位置换活动表编号 */
+	private Integer replacementInstrumentCooperationId;
+
 	private Integer topicId;
 
 	/** 合作单位 */
@@ -64,6 +67,14 @@ public class ReplacementInstrumentActivity {
 	/**  */
 	private java.util.Date updateTime;
 
+	public Integer getReplacementInstrumentCooperationId() {
+		return replacementInstrumentCooperationId;
+	}
+
+	public void setReplacementInstrumentCooperationId(Integer replacementInstrumentCooperationId) {
+		this.replacementInstrumentCooperationId = replacementInstrumentCooperationId;
+	}
+
 	public Integer getTopicId() {
 		return topicId;
 	}

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

@@ -57,5 +57,5 @@ public interface ReplacementInstrumentActivityService extends BaseService<Intege
 
     public void resultSync();
 
-    ReplacementInstrumentActivity queryUserInfo(Integer cooperationOrganId, SysUser user,Integer topicId);
+    ReplacementInstrumentActivity queryUserInfo(Integer cooperationOrganId, SysUser user,Integer cooperationId);
 }

+ 2 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentCooperationService.java

@@ -14,19 +14,12 @@ public interface ReplacementInstrumentCooperationService extends BaseService<Int
      */
     ReplacementInstrumentCooperation openPay(Integer id);
 
-
-    /**
-     * 获取合作单位的活动
-     * @param cooperationId
-     * @return
-     */
-    ReplacementInstrumentCooperation getByCooperationId(Integer cooperationId);
-
-
     /**
      * 获取合作单位乐器置换列表
      * @param queryInfo
      * @return
      */
     PageInfo<ReplacementInstrumentCooperation> getPageList(ReplacementInstrumentCooperationQueryInfo queryInfo);
+
+    ReplacementInstrumentCooperation findByCooperationOrganIdAndTopicId(Integer cooperationOrganId, Integer topicId);
 }

+ 15 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -96,9 +96,9 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
                 sysUserFeignService.updateSysUser(sysUser);
             }
         }
-        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.getByCooperationId(replacementInstrumentActivity.getCooperationOrganId());
+        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.get(replacementInstrumentActivity.getReplacementInstrumentCooperationId());
         //如果提交过调查问卷,那么覆盖之前的记录
-        ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(replacementInstrumentActivity.getCooperationOrganId(), sysUser.getId(),replacementInstrumentCooperation.getTopicId());
+        ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(replacementInstrumentActivity.getCooperationOrganId(), sysUser.getId(),replacementInstrumentCooperation.getId());
         if (replacementInstrumentCooperation != null && replacementInstrumentCooperation.getOpenPay().equals(YesOrNoEnum.YES)) {
             replacementInstrumentActivity.setOpenFlag(1);
         }
@@ -147,8 +147,8 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         }
         replacementInstrumentActivity.setUserId(sysUser.getId());
         //如果用户是43分部,那么修改用户信息
+        CooperationOrgan cooperationOrgan = cooperationOrganService.get(replacementInstrumentActivity.getCooperationOrganId());
         if (sysUser.getOrganId() == 43) {
-            CooperationOrgan cooperationOrgan = cooperationOrganService.get(replacementInstrumentActivity.getCooperationOrganId());
             if (cooperationOrgan != null) {
                 sysUser.setOrganId(cooperationOrgan.getOrganId());
                 sysUser.setUpdateTime(new Date());
@@ -156,9 +156,9 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
             }
         }
         Integer topicId = replacementInstrumentActivity.getTopicId();
-        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.getByCooperationId(replacementInstrumentActivity.getCooperationOrganId());
+        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.get(replacementInstrumentActivity.getReplacementInstrumentCooperationId());
         //如果提交过调查问卷,那么覆盖之前的记录
-        ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(replacementInstrumentActivity.getCooperationOrganId(), sysUser.getId(),replacementInstrumentCooperation.getTopicId());
+        ReplacementInstrumentActivity activity = replacementInstrumentActivityDao.findByUserId(replacementInstrumentActivity.getCooperationOrganId(), sysUser.getId(),replacementInstrumentCooperation.getId());
         if (replacementInstrumentCooperation != null && replacementInstrumentCooperation.getOpenPay().equals(YesOrNoEnum.YES)) {
             replacementInstrumentActivity.setOpenFlag(1);
         }
@@ -209,8 +209,8 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
     }
 
     @Override
-    public ReplacementInstrumentActivity findByUserId(Integer cooperationOrganId, Integer userId,Integer topicId) {
-        return replacementInstrumentActivityDao.findByUserId(cooperationOrganId, userId,topicId);
+    public ReplacementInstrumentActivity findByUserId(Integer cooperationOrganId, Integer userId,Integer cooperationId) {
+        return replacementInstrumentActivityDao.findByUserId(cooperationOrganId, userId,cooperationId);
     }
 
     @Override
@@ -439,7 +439,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
     public ReplacementInstrumentActivityStatDto getInfo(Integer id) {
         ReplacementInstrumentActivityStatDto info = replacementInstrumentActivityDao.getInfo(id);
         if (info != null && info.getOpenFlag().equals(0)) {
-            ReplacementInstrumentCooperation byCooperationId = replacementInstrumentCooperationDao.getByCooperationId(info.getCooperationOrganId());
+            ReplacementInstrumentCooperation byCooperationId = replacementInstrumentCooperationDao.get(info.getReplacementInstrumentCooperationId());
             if (byCooperationId != null && byCooperationId.getOpenPay().equals(YesOrNoEnum.YES)) {
                 info.setOpenFlag(1);
             }
@@ -496,11 +496,13 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
     }
 
     @Override
-    public ReplacementInstrumentActivity queryUserInfo(Integer cooperationOrganId,SysUser user,Integer topicId) {
-        ReplacementInstrumentActivity replacementInstrumentActivity = findByUserId(cooperationOrganId, user.getId(),topicId);
+    public ReplacementInstrumentActivity queryUserInfo(Integer cooperationOrganId,SysUser user,Integer cooperationId) {
+        ReplacementInstrumentActivity replacementInstrumentActivity = findByUserId(cooperationOrganId, user.getId(),cooperationId);
+        ReplacementInstrumentCooperation cooperation = replacementInstrumentCooperationDao.get(cooperationId);
         if (replacementInstrumentActivity == null) {
             Student student = studentService.get(user.getId());
             replacementInstrumentActivity = new ReplacementInstrumentActivity();
+
             replacementInstrumentActivity.setUserId(user.getId());
             replacementInstrumentActivity.setClasses(student.getCurrentClass());
             if (student.getCurrentGradeNum() != null) {
@@ -512,14 +514,15 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
             if (StringUtils.isNotEmpty(subjectIdList)) {
                 replacementInstrumentActivity.setSubjectId(Integer.parseInt(subjectIdList.split(",")[0]));
             }
+            replacementInstrumentActivity.setTopicId(cooperation.getTopicId());
+            replacementInstrumentActivity.setReplacementInstrumentCooperationId(cooperationId);
         }
         replacementInstrumentActivity.setMobileNo(user.getPhone());
         CooperationOrgan cooperationOrgan = cooperationOrganService.get(cooperationOrganId);
         if (cooperationOrgan != null) {
             replacementInstrumentActivity.setCooperationOrganName(cooperationOrgan.getName());
         }
-        ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationDao.getByCooperationId(cooperationOrganId);
-        replacementInstrumentActivity.setShowQuestion(replacementInstrumentCooperation.getShowQuestion());
+        replacementInstrumentActivity.setShowQuestion(cooperation.getShowQuestion());
         return replacementInstrumentActivity;
     }
 }

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

@@ -82,11 +82,6 @@ public class ReplacementInstrumentCooperationServiceImpl extends BaseServiceImpl
     }
 
     @Override
-    public ReplacementInstrumentCooperation getByCooperationId(Integer cooperationId) {
-        return replacementInstrumentCooperationDao.getByCooperationId(cooperationId);
-    }
-
-    @Override
     public PageInfo<ReplacementInstrumentCooperation> getPageList(ReplacementInstrumentCooperationQueryInfo queryInfo) {
         PageInfo<ReplacementInstrumentCooperation> pageInfo = queryPage(queryInfo);
         if (pageInfo.getRows().size() > 0) {
@@ -107,4 +102,9 @@ public class ReplacementInstrumentCooperationServiceImpl extends BaseServiceImpl
         }
         return pageInfo;
     }
+
+    @Override
+    public ReplacementInstrumentCooperation findByCooperationOrganIdAndTopicId(Integer cooperationOrganId, Integer topicId) {
+        return findByCooperationOrganIdAndTopicId(cooperationOrganId, topicId);
+    }
 }

+ 8 - 4
mec-biz/src/main/resources/config/mybatis/ReplacementInstrumentActivityMapper.xml

@@ -9,6 +9,7 @@
     <resultMap type="com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity" id="ReplacementInstrumentActivity">
         <result column="id_" property="id"/>
         <result column="cooperation_organ_id_" property="cooperationOrganId"/>
+        <result column="replacement_instrument_cooperation_id_" property="replacementInstrumentCooperationId"/>
         <result column="topic_id_" property="topicId"/>
         <result column="cooperationOrganName" property="cooperationOrganName"/>
         <result column="user_id_" property="userId"/>
@@ -59,9 +60,9 @@
             keyColumn="id" keyProperty="id">
         INSERT INTO replacement_instrument_activity (cooperation_organ_id_, user_id_, user_name_, grade_, classes_,
                                                      mobile_no_, subject_id_, question_result_, instruments_id_,
-                                                     other_suggestion_,topic_id_, create_time_, update_time_)
+                                                     other_suggestion_,topic_id_,replacement_instrument_cooperation_id_, create_time_, update_time_)
         VALUES (#{cooperationOrganId}, #{userId}, #{userName}, #{grade}, #{classes}, #{mobileNo}, #{subjectId},
-                #{questionResult}, #{instrumentsId}, #{otherSuggestion}, #{topicId}, NOW(), NOW())
+                #{questionResult}, #{instrumentsId}, #{otherSuggestion}, #{topicId},#{replacementInstrumentCooperationId}, NOW(), NOW())
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -86,6 +87,9 @@
             <if test="cooperationOrganId != null">
                 cooperation_organ_id_ = #{cooperationOrganId},
             </if>
+            <if test="replacementInstrumentCooperationId != null">
+                replacement_instrument_cooperation_id_ = #{replacementInstrumentCooperationId},
+            </if>
             <if test="userName != null">
                 user_name_ = #{userName},
             </if>
@@ -133,8 +137,8 @@
         FROM replacement_instrument_activity
         WHERE user_id_ = #{userId}
           AND cooperation_organ_id_ = #{cooperationOrganId}
-          <if test="topicId != null">
-              AND topic_id_ = #{topicId}
+          <if test="cooperationId != null">
+              AND replacement_instrument_cooperation_id_ = #{cooperationId}
           </if>
         LIMIT 1
     </select>

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

@@ -99,7 +99,7 @@
     <select id="getByCooperationId" resultMap="ReplacementInstrumentCooperation">
         SELECT *
         FROM replacement_instrument_cooperation
-        WHERE cooperation_organ_id_ = #{cooperationId}
+        WHERE id_ = #{cooperationId}
     </select>
 
     <select id="countAllReplacementsInfo" resultType="com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation">

+ 0 - 1
mec-student/src/main/java/com/ym/mec/student/controller/QuestionnaireTopicController.java

@@ -19,7 +19,6 @@ public class QuestionnaireTopicController extends BaseController {
 
     @ApiOperation(value = "获取题目详情详情")
     @GetMapping("/getDetail")
-    @PreAuthorize("@pcs.hasPermissions('questionnaireTopic/getDetail')")
     @AuditLogAnnotation(operateName = "获取题目详情详情")
     public Object getDetail(Integer id) {
         return succeed(questionnaireTopicService.getDetail(id));

+ 3 - 2
mec-student/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java

@@ -56,7 +56,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
         }
         ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationService.get(cooperationId);
         Integer cooperationOrganId = replacementInstrumentCooperation.getCooperationOrganId();
-        return replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,replacementInstrumentCooperation.getTopicId());
+        return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,cooperationId));
     }
 
     @ApiOperation(value = "获取学员基本信息")
@@ -66,7 +66,8 @@ public class ReplacementInstrumentActivityController extends BaseController {
         if (user == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,null));
+        ReplacementInstrumentCooperation cooperation = replacementInstrumentCooperationService.findByCooperationOrganIdAndTopicId(cooperationOrganId,null);
+        return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,cooperation.getId()));
     }
 
     @ApiOperation(value = "修改调查问卷")

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

@@ -104,7 +104,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
             return failed("支付中、已支付的乐器置换,不能修改");
         }
 
-        ReplacementInstrumentCooperation byCooperationId = replacementInstrumentCooperationService.getByCooperationId(oldReplacementInstrumentActivity.getCooperationOrganId());
+        ReplacementInstrumentCooperation byCooperationId = replacementInstrumentCooperationService.get(oldReplacementInstrumentActivity.getReplacementInstrumentCooperationId());
         if (byCooperationId.getOpenPay().equals(YesOrNoEnum.YES) && oldReplacementInstrumentActivity.getInstrumentsId() == null && replacementInstrumentActivity.getInstrumentsId() != null) {
             ReplacementInstrument replacementInstrument = replacementInstrumentDao.get(replacementInstrumentActivity.getInstrumentsId());
             Map<Integer, String> userMap = new HashMap<>();

+ 2 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ReplacementInstrumentCooperationController.java

@@ -61,7 +61,8 @@ public class ReplacementInstrumentCooperationController extends BaseController {
     @PostMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('replacementInstrumentCooperation/add')")
     public HttpResponseResult<ReplacementInstrumentCooperation> add(ReplacementInstrumentCooperation replacementInstrumentCooperation) {
-        ReplacementInstrumentCooperation hasOld = replacementInstrumentCooperationService.getByCooperationId(replacementInstrumentCooperation.getCooperationOrganId());
+        ReplacementInstrumentCooperation hasOld = replacementInstrumentCooperationService.findByCooperationOrganIdAndTopicId(replacementInstrumentCooperation.getCooperationOrganId(),
+                replacementInstrumentCooperation.getTopicId());
         if (hasOld != null) {
             return failed("合作单位链接已生成,不能重复生成");
         }