Browse Source

修改开团添加是否单乐器的选项

周箭河 5 years ago
parent
commit
7856b5492e

+ 68 - 56
src/main/java/com/ym/mec/collectfee/controller/UserController.java

@@ -36,6 +36,7 @@ public class UserController extends BaseController {
 
     /**
      * 查询用户详情
+     *
      * @param phone
      * @param clazzId
      * @return
@@ -44,27 +45,27 @@ public class UserController extends BaseController {
 //    @ApiOperation(value = "根据乐团编号、用户手机,查询用户详情")
 //    @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "用户手机", required = true, dataType = "String"),
 //            @ApiImplicitParam(name = "clazzId", value = "乐团编号", required = true, dataType = "Integer")})
-    public Object getUserDetailByPhone(String phone,Integer clazzId,Integer cityId){
-        if(StringUtils.isEmpty(phone) || clazzId == null || cityId == null){
+    public Object getUserDetailByPhone(String phone, Integer clazzId, Integer cityId) {
+        if (StringUtils.isEmpty(phone) || clazzId == null || cityId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
-        
+
         ApplyInfo userByPhone = applyInfoService.findUserByPhone(phone, null);
-        
-        if(userByPhone == null && applyInfoService.mecUserIsExist(phone)){
+
+        if (userByPhone == null && applyInfoService.mecUserIsExist(phone)) {
             return failed(Constants.PARAM_EXIST_ERROR_MSG);
         }
-        if(userByPhone != null && !userByPhone.getClassId().equals(clazzId)){//如果改用户存在其他团中
-        	return failed(Constants.PARAM_EXIST_ERROR_MSG);
+        if (userByPhone != null && !userByPhone.getClassId().equals(clazzId)) {//如果改用户存在其他团中
+            return failed(Constants.PARAM_EXIST_ERROR_MSG);
         }
         School school = schoolService.get(clazzId);
-        if(school != null){
-            if(school.getCityId() == null){
+        if (school != null) {
+            if (school.getCityId() == null) {
                 school.setCityId(cityId);
                 school.setUpdateTime(new Date());
                 schoolService.update(school);
             }
-            if(userByPhone != null){
+            if (userByPhone != null) {
                 userByPhone.setPushStatus(school.getStatus());
             }
         }
@@ -73,30 +74,31 @@ public class UserController extends BaseController {
 
     /**
      * 用户报名
+     *
      * @param applyInfo
      * @return
      */
 //    @ApiOperation(value = "学生报名乐团")
     @PostMapping("/userApply")
-    public Object userApply(ApplyInfo applyInfo){
-        if(applyInfo != null){
+    public Object userApply(ApplyInfo applyInfo) {
+        if (applyInfo != null) {
             try {
                 Date date = new Date();
                 applyInfo.setCreateTime(date);
                 applyInfo.setUpdateTime(date);
                 applyInfoService.insert(applyInfo);
                 School school = schoolService.get(applyInfo.getClassId());
-                if(school == null){
+                if (school == null) {
                     return failed("乐团数据不存在");
-                }else {
+                } else {
                     school.setSchoolId(applyInfo.getSchoolId());
                     school.setUpdateTime(date);
                     schoolService.update(school);
                 }
                 return succeed(applyInfo.getId());
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
-                if(e instanceof DuplicateKeyException){
+                if (e instanceof DuplicateKeyException) {
                     return failed("该用户已存在");
                 }
                 return failed("报名失败");
@@ -107,6 +109,7 @@ public class UserController extends BaseController {
 
     /**
      * 根据乐团id获取乐团详情,查询乐团状态也通过该接口
+     *
      * @param clazzId
      * @return
      */
@@ -114,8 +117,8 @@ public class UserController extends BaseController {
     @PostMapping("/getClassDetail")
 //    @ApiImplicitParams({ @ApiImplicitParam(name = "clazzId", value = "乐团编号", required = true, dataType = "Integer"),
 //            @ApiImplicitParam(name = "schoolId", value = "学校编号", required = true, dataType = "Integer")})
-    public Object getSchoolDetail(Integer schoolId){
-        if(schoolId == null){
+    public Object getSchoolDetail(Integer schoolId) {
+        if (schoolId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         return succeed(orderService.getSchoolDetail(schoolId));
@@ -123,13 +126,14 @@ public class UserController extends BaseController {
 
     /**
      * 根据学生编号获取乐团注册页面数据
+     *
      * @param stuId
      * @return
      */
 //    @ApiOperation(value = "根据学生编号获取乐团注册页面数据")
     @PostMapping("/getUserRegisterViewDetail")
-    public Object getUserRegisterViewDetail(Integer stuId){
-        if(stuId == null){
+    public Object getUserRegisterViewDetail(Integer stuId) {
+        if (stuId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         return succeed(applyInfoService.getUserRegisterViewDetail(stuId));
@@ -146,40 +150,41 @@ public class UserController extends BaseController {
 
     /**
      * 获取乐团课程组列表
+     *
      * @return
      */
     @PostMapping("/getCourses")
 //    @ApiOperation(value = "根据乐团编号,获取乐团课程组列表")
 //    @ApiImplicitParams({ @ApiImplicitParam(name = "clazzId", value = "乐团编号", required = true, dataType = "Integer")})
-    public Object getCourses(Integer clazzId){
-        if(clazzId == null){
+    public Object getCourses(Integer clazzId) {
+        if (clazzId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         return succeed(courseGroupInfoService.getCourses(clazzId));
     }
 
-//    @ApiOperation(value = "获取所有乐团列表")
+    //    @ApiOperation(value = "获取所有乐团列表")
     @PostMapping("/getMusicTeams")
-    public Object getMusicTeams(MusicTeamsPageInfo pageInfo){
+    public Object getMusicTeams(MusicTeamsPageInfo pageInfo) {
         return succeed(schoolService.queryPage(pageInfo));
     }
 
-//    @ApiOperation(value = "根据乐团编号,获取学员列表")
+    //    @ApiOperation(value = "根据乐团编号,获取学员列表")
     @PostMapping("/getMusicTeamStu")
-    public Object getMusicTeamStu(StudentsQueryInfo queryInfo){
+    public Object getMusicTeamStu(StudentsQueryInfo queryInfo) {
         return succeed(applyInfoService.queryUserPage(queryInfo));
     }
 
-//    @ApiOperation(value = "获取所有分部列表")
+    //    @ApiOperation(value = "获取所有分部列表")
     @GetMapping("/getBranches")
-    public Object getBranches(){
+    public Object getBranches() {
         return succeed(applyInfoService.getBranches());
     }
 
-//    @ApiOperation(value = "获取学校详情")
+    //    @ApiOperation(value = "获取学校详情")
     @GetMapping("/getSchool")
-    public Object getSchool(Integer schoolId){
-        if(schoolId == null){
+    public Object getSchool(Integer schoolId) {
+        if (schoolId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         return succeed(applyInfoService.get(schoolId));
@@ -197,11 +202,12 @@ public class UserController extends BaseController {
 
     /**
      * 修改乐团信息
+     *
      * @return
      */
 //    @ApiOperation(value = "修改乐团信息")
     @PostMapping("/updateClass")
-    public Object updateClass(School school){
+    public Object updateClass(School school) {
         school.setUpdateTime(new Date());
         schoolService.update(school);
         return succeed();
@@ -209,26 +215,28 @@ public class UserController extends BaseController {
 
     /**
      * 开启乐团缴费功能
+     *
      * @return
      */
 //    @ApiOperation(value = "开启乐团缴费功能")
     @PostMapping("/openClassPay")
-    public Object openClassPay(Integer id,String smsMsg, int type){//1是线上 2 线下
-        if(id == null || (type==2 &&StringUtils.isEmpty(smsMsg))){
+    public Object openClassPay(Integer id, String smsMsg, int type, int isSingle) {//1是线上 2 线下
+        if (id == null || (isSingle > 1 || isSingle < 0) || (type == 2 && StringUtils.isEmpty(smsMsg))) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
-        schoolService.openClassPay(id,smsMsg,type);
+        schoolService.openClassPay(id, smsMsg, type, isSingle);
         return succeed();
     }
 
 
     /**
      * 修改学生信息
+     *
      * @return
      */
 //    @ApiOperation(value = "修改学生信息")
     @PostMapping("/updateUser")
-    public Object updateUser(@ModelAttribute ApplyInfo applyInfo){
+    public Object updateUser(@ModelAttribute ApplyInfo applyInfo) {
         applyInfo.setUpdateTime(new Date());
         applyInfoService.update(applyInfo);
         return succeed("修改成功");
@@ -236,37 +244,38 @@ public class UserController extends BaseController {
 
     /**
      * 修改学生信息
+     *
      * @return
      */
 //    @ApiOperation(value = "批量调剂学员专业")
     @PostMapping("/updateUserSub")
-    public Object updateUserSub(String userId,Integer subId,Integer courseId){
-        if(StringUtils.isEmpty(userId) || subId == null || courseId == null){
+    public Object updateUserSub(String userId, Integer subId, Integer courseId) {
+        if (StringUtils.isEmpty(userId) || subId == null || courseId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
-        applyInfoService.updateUserSub(userId,subId,courseId);
+        applyInfoService.updateUserSub(userId, subId, courseId);
         return succeed("修改成功");
     }
 
-//    @ApiOperation(value = "学员课程班查询,本接口用于查询指定学员报名的课程班(小课或乐团)列表")
+    //    @ApiOperation(value = "学员课程班查询,本接口用于查询指定学员报名的课程班(小课或乐团)列表")
     @PostMapping("/queryUserCourse")
 //    @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataType = "Integer")})
-    public Object queryUserCourse(Integer userId){
-        if(userId == null){
+    public Object queryUserCourse(Integer userId) {
+        if (userId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         List<Branch> branches = applyInfoService.getBranches();
         MecUser mecUser = applyInfoService.findMecUser(userId);
-        Map<String,Object> resultMap = new HashMap<>(2);
-        if(branches != null && branches.size() > 0 && mecUser != null){
-            for (Branch branch:branches) {
-                if(branch.getBranchId().equals(mecUser.getBranchId())){
-                    resultMap.put("memo",branch.getMemo());
+        Map<String, Object> resultMap = new HashMap<>(2);
+        if (branches != null && branches.size() > 0 && mecUser != null) {
+            for (Branch branch : branches) {
+                if (branch.getBranchId().equals(mecUser.getBranchId())) {
+                    resultMap.put("memo", branch.getMemo());
                     break;
                 }
             }
         }
-        resultMap.put("courses",applyInfoService.queryUserCourse(userId));
+        resultMap.put("courses", applyInfoService.queryUserCourse(userId));
         return succeed(resultMap);
     }
 
@@ -282,46 +291,49 @@ public class UserController extends BaseController {
 
     /**
      * 查询mec用户信息
+     *
      * @return
      */
     @PostMapping("/findMecUser")
-    public Object findMecUser(Integer userId){
-        if(userId == null){
+    public Object findMecUser(Integer userId) {
+        if (userId == null) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
         return succeed(applyInfoService.findMecUser(userId));
     }
 
     @PostMapping("/mecUserIsExist")
-    public Object mecUserIsExist(String phone){
+    public Object mecUserIsExist(String phone) {
         return succeed(applyInfoService.mecUserIsExist(phone));
     }
 
     /**
      * 发送短信验证码
+     *
      * @param mobile
      * @return
      */
     @GetMapping("/sendSmsCode")
     public Object sendLoginVerifyCode(String mobile, HttpSession session) {
-        if(StringUtils.isEmpty(mobile)){
+        if (StringUtils.isEmpty(mobile)) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
-        applyInfoService.sendValidCode(mobile,session);
+        applyInfoService.sendValidCode(mobile, session);
         return succeed();
     }
 
     /**
      * 验证短信验证码
+     *
      * @param smsCode
      * @return
      */
     @PostMapping("/verifySmsCode")
-    public Object verifySmsCode(String mobile,String smsCode,HttpSession session) {
-        if(StringUtils.isEmpty(smsCode)){
+    public Object verifySmsCode(String mobile, String smsCode, HttpSession session) {
+        if (StringUtils.isEmpty(smsCode)) {
             return failed(Constants.PARAM_VERIFY_ERROR_MSG);
         }
-        if(applyInfoService.verifySmsCode(mobile,smsCode,session)){
+        if (applyInfoService.verifySmsCode(mobile, smsCode, session)) {
             return succeed();
         }
         return failed("验证失败");

+ 11 - 1
src/main/java/com/ym/mec/collectfee/entity/School.java

@@ -31,8 +31,11 @@ public class School {
 	/** 学校名称 */
 	private String schoolName;
 
+	/** 是否单乐器 */
+	private Integer isSingle;
+
 	private Integer cityId;
-	
+
 	/**  */
 	private java.util.Date createTime;
 	
@@ -140,4 +143,11 @@ public class School {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public Integer getIsSingle() {
+		return isSingle;
+	}
+
+	public void setIsSingle(Integer isSingle) {
+		this.isSingle = isSingle;
+	}
 }

+ 1 - 1
src/main/java/com/ym/mec/collectfee/service/SchoolService.java

@@ -12,7 +12,7 @@ public interface SchoolService extends BaseService<Integer, School> {
      * 开启乐团缴费
      * @param classId
      */
-    void openClassPay(Integer classId,String smsMsg,int type);
+    void openClassPay(Integer classId,String smsMsg,int type,int isSingle);
 
     /**
      * 缴费成功发送短信

+ 2 - 0
src/main/java/com/ym/mec/collectfee/service/impl/CourseGroupInfoServiceImpl.java

@@ -54,10 +54,12 @@ public class CourseGroupInfoServiceImpl extends BaseServiceImpl<Integer, CourseG
 
             if (course != null && courseGroupInfo != null && !courseGroupInfo.getFeeType().equals(course.getChargeType())) {
                 courseGroupInfo.setFeeType(course.getChargeType());
+                flag = true;
             }
 
             if (course != null && courseGroupInfo != null && !courseGroupInfo.getFeeAmount().equals(course.getPrice())) {
                 courseGroupInfo.setFeeAmount(course.getPrice());
+                flag = true;
             }
 
             if(flag){

+ 2 - 1
src/main/java/com/ym/mec/collectfee/service/impl/SchoolServiceImpl.java

@@ -75,11 +75,12 @@ public class SchoolServiceImpl extends BaseServiceImpl<Integer, School> implemen
 	}
 
 	@Override
-	public void openClassPay(Integer classId,String smsMsg,int type) {
+	public void openClassPay(Integer classId,String smsMsg,int type,int isSingle) {
 		School school = schoolDao.get(classId);
 		if(school != null && school.getStatus() == 1){
 			school.setUpdateTime(new Date());
 			school.setStatus(2);
+			school.setIsSingle(isSingle);
 			schoolDao.update(school);
 			//发送短信
 			//获取所有用户手机号列表

+ 1 - 1
src/main/resources/config/mybatis/ApplyInfoMapper.xml

@@ -182,7 +182,7 @@
 	<select id="getUserRegisterVIewDetail" resultType="java.util.Map">
 		SELECT ai.sub_id_,ai.is_adjust_,ai.status_,ai.sex_,ai.name_,ai.patriarch_phone_,ai.sub_id_,
 		ai.grade_,ai.school_,ai.id_,ai.g_class_,ai.city_,ai.patriarch_name_,ai.patriarch_unit_,ai.course_id_,ai.remark,
-		cgi.sub_name_,cgi.plan_num_,cgi.fee_amount_,cgi.fee_type_,s.status_ push_status_
+		cgi.sub_name_,cgi.plan_num_,cgi.fee_amount_,cgi.fee_type_,s.is_single_,s.status_ push_status_
 		FROM apply_info ai LEFT JOIN course_group_info cgi ON ai.course_id_ = cgi.id_
 		 LEFT JOIN school s ON ai.class_id_ = s.id_ WHERE ai.id_ = #{stuId}
 	</select>

+ 4 - 0
src/main/resources/config/mybatis/SchoolMapper.xml

@@ -16,6 +16,7 @@
 		<result column="school_id_" property="schoolId" />
 		<result column="city_id_" property="cityId" />
 		<result column="school_name_" property="schoolName" />
+		<result column="is_single_" property="isSingle" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
@@ -72,6 +73,9 @@
 			<if test="name != null">
 				name_ = #{name},
 			</if>
+			<if test="isSingle != null">
+				is_single = #{isSingle},
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>