zouxuan 5 年之前
父节点
当前提交
28b5163b90

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

@@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 public interface ChargeTypeDao extends BaseDAO<Integer, ChargeType> {
 
@@ -16,5 +15,5 @@ public interface ChargeTypeDao extends BaseDAO<Integer, ChargeType> {
      * @param chargeTypeIds
      * @return
      */
-    List<Map<Integer, String>> queryNameByIds(@Param("chargeTypeIds") Set<Integer> chargeTypeIds);
+    List<Map<Integer, String>> queryNameByIds(@Param("chargeTypeIds") String chargeTypeIds);
 }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -130,11 +130,11 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     /**
      * 批量调剂学生专业
      *
-     * @param userIds
+     * @param userId
      * @param subId
      * @return
      */
-    int batchUpdateSubject(@Param("userIds") String userIds, @Param("subId") Integer subId, @Param("musicGroupId") String musicGroupId);
+    int batchUpdateSubject(@Param("userId") Integer userId, @Param("subId") Integer subId, @Param("musicGroupId") String musicGroupId);
 
     /**
      * 根据id list 查询报名学生

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

@@ -47,5 +47,5 @@ public interface MusicGroupSubjectPlanService extends BaseService<Integer, Music
      * @param musicGroupId
      * @param subjectId
      */
-    void addApplyStudentNum(String musicGroupId, Integer subjectId);
+    void addApplyStudentNum(String musicGroupId, Integer subjectId,int num);
 }

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

@@ -35,7 +35,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @param subId
 	 * @return
 	 */
-	Integer batchUpdateSubject(String userId, Integer subId,String musicGroupId);
+	Integer batchUpdateSubject(Integer userId, Integer subId,String musicGroupId) throws Exception;
 
 	/**
 	 * 学生报名缴费金额详情

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

@@ -22,6 +22,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.util.collection.MapUtil;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
@@ -86,7 +87,8 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 		sysUserCashAccountDao.insert(new SysUserCashAccount(employee.getId(),"CNY"));
 		//添加用户电子签章账户
 		contractService.register(employee.getId());
-		ImResult imResult = imFeignService.register(new ImUserModel(employee.getId().toString(), employee.getUsername(), employee.getAvatar()));
+		ImResult imResult = imFeignService.register(new ImUserModel(employee.getId().toString(), employee.getUsername(),
+				StringUtils.isEmpty(employee.getAvatar())?"https://daya-online.oss-cn-beijing.aliyuncs.com/201910/RgHwgKc.jpg":employee.getAvatar()));
 		employee.setImToken(imResult.getToken());
 		employeeDao.update(employee);
 	}

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

@@ -570,7 +570,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         // 获取收费类型编号列表
         Set<Integer> chargeTypeIds = musicGroupList.stream().map(e -> e.getChargeTypeId()).collect(Collectors.toSet());
-        List<Map<Integer, String>> chargeTypeNames = chargeTypeDao.queryNameByIds(chargeTypeIds);
+        if(chargeTypeIds == null){
+            chargeTypeIds = new HashSet<>();
+        }
+        List<Map<Integer, String>> chargeTypeNames = chargeTypeDao.queryNameByIds(StringUtils.join(chargeTypeIds,","));
         Map<Integer, String> chargeTypeNameMap = MapUtil.convertMybatisMap(chargeTypeNames);
 
         musicGroupList.forEach(e -> {

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -106,10 +106,10 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     }
 
     @Override
-    public void addApplyStudentNum(String musicGroupId, Integer subjectId) {
+    public void addApplyStudentNum(String musicGroupId, Integer subjectId,int num) {
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
         int applyNum = musicOneSubjectClassPlan.getApplyStudentNum() == null ? 0 : musicOneSubjectClassPlan.getApplyStudentNum();
-        musicOneSubjectClassPlan.setApplyStudentNum(applyNum + 1);
+        musicOneSubjectClassPlan.setApplyStudentNum(applyNum + num);
         musicOneSubjectClassPlan.setUpdateTime(new Date());
         musicGroupSubjectPlanDao.update(musicOneSubjectClassPlan);
     }

+ 15 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -88,9 +88,20 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public Integer batchUpdateSubject(String userIds, Integer subId, String musicGroupId) {
+    @Transactional(rollbackFor = Exception.class)
+    public Integer batchUpdateSubject(Integer userId, Integer subId, String musicGroupId) throws Exception {
+        //获取当前学员的当前声部
+        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if(studentRegistration == null){
+            throw new Exception("学员信息不存在");
+        }
+        //当前专业报名人数减一
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,-1);
         //批量调剂(未缴费学员)
-        return studentRegistrationDao.batchUpdateSubject(userIds, subId, musicGroupId);
+        int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
+        //修改专业已报名人数
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
+        return i;
     }
 
     @Override
@@ -164,7 +175,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setUserId(sysUser.getId());
         studentRegistrationDao.insert(studentRegistration);
         //增加报名学生数
-        musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
+        musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
         return studentRegistration;
     }
 
@@ -383,7 +394,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //学生报名表
             studentRegistrationDao.insert(studentRegistration);
             //增加报名学生数
-            musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
+            musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
             if (studentRegistration.getClassGroupId() != null) {
                 ClassGroup classGroup = classGroupDao.get(studentRegistration.getClassGroupId());
                 if (classGroup != null) {

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

@@ -79,9 +79,6 @@
 		SELECT COUNT(*) FROM charge_type WHERE del_flag_ = 0
 	</select>
     <select id="queryNameByIds" resultType="java.util.Map" parameterType="list">
-        SELECT id_ `key`,name_ `value` FROM charge_type WHERE id_ IN
-        <foreach item="item" index="index" collection="chargeTypeIds" open="(" separator="," close=")">
-            #{item}
-        </foreach>
+        SELECT id_ `key`,name_ `value` FROM charge_type WHERE FIND_IN_SET(id_,#{chargeTypeIds})
     </select>
 </mapper>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml

@@ -25,7 +25,7 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="CooperationOrgan">
-		SELECT * FROM cooperation_organ
+		SELECT * FROM cooperation_organ AND del_flag_ = 0
 		ORDER BY id_
 	</select>
 
@@ -99,6 +99,6 @@
         </where>
 	</select>
     <select id="queryByOrganId" resultMap="CooperationOrgan">
-        SELECT * FROM cooperation_organ WHERE organ_id_ = #{organId}
+        SELECT * FROM cooperation_organ WHERE organ_id_ = #{organId} AND del_flag_ = 0
     </select>
 </mapper>

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -264,9 +264,10 @@
         UPDATE student_registration SET class_group_id_ = #{studentRegistration.classGroupId} WHERE user_id_ =
         #{studentRegistration.userId} AND music_group_id_ = #{studentRegistration.musicGroupId}
     </update>
+
     <update id="batchUpdateSubject">
         UPDATE student_registration SET actual_subject_id_ = #{subId},update_time_ = now()
-        WHERE FIND_IN_SET(user_id_,#{userIds}) AND payment_status_ = 0 AND music_group_id_ = #{musicGroupId}
+        WHERE user_id_ = #{userIds} AND payment_status_ = 0 AND music_group_id_ = #{musicGroupId}
     </update>
 
     <select id="queryStudentInfo" resultMap="StudentInfo">
@@ -326,7 +327,7 @@
         <if test="actualSubjectId != null and actualSubjectId !=''">
             AND actual_subject_id_ = #{actualSubjectId}
         </if>
-        AND payment_status_ = 1 AND class_group_id_ IS NULL;
+        AND payment_status_ = 1 AND class_group_id_ IS NULL
     </select>
 
 

+ 4 - 4
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -44,14 +44,14 @@ public class StudentRegistrationController extends BaseController {
         return succeed();
     }
 
-    @ApiOperation(value = "批量调剂学生报名专业")
+    @ApiOperation(value = "调剂学生报名专业")
     @PostMapping("/batchUpdateSubject")
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/batchUpdateSubject')")
-    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "学生编号(多个逗号)", required = true, dataType = "String"),
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "学生编号(多个逗号)", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "subId", value = "声部编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer")})
-    public Object batchUpdateSubject(String userId,Integer subId,String musicGroupId) {
-        if (StringUtils.isEmpty(userId) || subId == null || StringUtils.isEmpty(musicGroupId)) {
+    public Object batchUpdateSubject(Integer userId,Integer subId,String musicGroupId) throws Exception {
+        if (null == userId || subId == null || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验异常");
         }
         return succeed(studentRegistrationService.batchUpdateSubject(userId, subId,musicGroupId));