소스 검색

Merge remote-tracking branch 'origin/master'

zouxuan 4 년 전
부모
커밋
b0c1ea2b27

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

@@ -269,8 +269,10 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      * @return
      */
     int updateUser(@Param("id") Integer id,
+                   @Param("name") String name,
                    @Param("realName") String realName,
                    @Param("idCardNo") String idCardNo,
+                   @Param("gender") Integer gender,
                    @Param("certificateType") String certificateType);
 
     /**

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java

@@ -67,6 +67,17 @@ public class ClassGroup4MixDto implements Cloneable{
     @ApiModelProperty(value = "班级", required = true)
     private ClassGroup classGroup;
 
+    @ApiModelProperty(value = "是否允许0课酬")
+    private Boolean allowZeroSalary = false;
+
+    public Boolean getAllowZeroSalary() {
+        return allowZeroSalary;
+    }
+
+    public void setAllowZeroSalary(Boolean allowZeroSalary) {
+        this.allowZeroSalary = allowZeroSalary;
+    }
+
     public Boolean getOnlyCreateClassGroup() {
         return onlyCreateClassGroup;
     }

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

@@ -291,7 +291,7 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @param classGroup4MixDtos
      * @return
      */
-    ClassGroup classGroupUpdate(List<ClassGroup4MixDto> classGroup4MixDtos) throws Exception;
+    HttpResponseResult classGroupUpdate(List<ClassGroup4MixDto> classGroup4MixDtos) throws Exception;
 
     /**
      * 班级调整(增加临时班级)

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

@@ -18,7 +18,7 @@ public interface DegreeRegistrationService extends BaseService<Integer, DegreeRe
 
     Set<String> FREE_PRICE_LEVEL = new HashSet<>(Arrays.asList(new String[]{"一级", "二级", "三级"}));
 
-    Date ACTIVITY_END_TIME = DateUtil.stringToDate("2021-01-31 23:59:59", "yyyy-MM-dd HH:mm:ss");
+    Date ACTIVITY_END_TIME = DateUtil.stringToDate("2021-02-15 23:59:59", "yyyy-MM-dd HH:mm:ss");
 
     HttpResponseResult pay(DegreeRegistrationActivityDto degreeRegistration) throws Exception;
 

+ 10 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -36,14 +36,17 @@ import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.util.collection.ListUtil;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.util.CollectionUtils;
 
 import com.alibaba.fastjson.JSON;
@@ -2251,7 +2254,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup classGroupUpdate(List<ClassGroup4MixDto> classGroup4MixDtos) {
+    public HttpResponseResult classGroupUpdate(List<ClassGroup4MixDto> classGroup4MixDtos) {
         Date date = new Date();
         Integer classGroupId = classGroup4MixDtos.get(0).getClassGroupId();
         String musicGroupId = classGroup4MixDtos.get(0).getMusicGroupId();
@@ -2307,7 +2310,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 classGroupTeacherMapperDao.insert(tm);
             }
             imUserFriendService.refreshClassImUserFriend(classGroupId);
-            return classGroup;
+            return BaseController.succeed(classGroup);
         }
         if (classGroup4MixDtos.get(0).getCourseTimes().compareTo(0) <= 0) {
             throw new BizException("排课次数必须大于0");
@@ -2450,6 +2453,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                         courseScheduleTeacherSalary.setUpdateTime(date);
                         courseScheduleTeacherSalaryService.createMusicGroupCourseTeacherSalary(musicGroup, courseSchedule, courseScheduleTeacherSalary);
                         courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
+                        if(!classGroup4MixDto.getAllowZeroSalary()&&BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getExpectSalary())==0){
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程课酬预计为0,是否继续");
+                        }
                     }
                 }
 
@@ -2473,7 +2480,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if(musicGroup.getStatus() == PROGRESS){
             imUserFriendService.refreshClassImUserFriend(classGroupId);
         }
-        return classGroup;
+        return BaseController.succeed(classGroup);
     }
 
     @Override

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -722,12 +722,21 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 									salary = courseScheduleTeacherSalary.getTeacherRole().equals(TeachTypeEnum.BISHOP) ? tdms.getMainTeacher90MinSalary() : tdms.getAssistantTeacher90MinSalary();
 								}
 								int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(courseSchedule.getId());
+								if(studentNum<=0){
+									studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(courseSchedule.getClassGroupId());
+								}
 								courseScheduleTeacherSalary.setExpectSalary(salary.multiply(new BigDecimal(studentNum)));
 							}
 							//线上小班课
 							if(type == CourseScheduleType.HIGH_ONLINE){
 								int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(courseSchedule.getId());
+								if(studentNum<=0){
+									studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(courseSchedule.getClassGroupId());
+								}
 								BigDecimal salary = JSON.parseObject(tdms.getSalaryRuleJson()).getBigDecimal(studentNum+"");
+								if(studentNum<=0){
+									salary = new BigDecimal(0);
+								}
 								courseScheduleTeacherSalary.setExpectSalary(salary);
 							}
 

+ 13 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -252,7 +252,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
 
             boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.isNull(teacher.getFormalStaffDate())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
 
             //如果上课日期在转正日期之前的按80%结算
             if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
@@ -369,7 +369,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
 
             boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.isNull(teacher.getFormalStaffDate())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
 
             if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
                 expectSalary = expectSalary.multiply(new BigDecimal("0.8"));
@@ -560,7 +560,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 //未转正
                 boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
                 //试用期
-                boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.isNull(teacher.getFormalStaffDate())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+                boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
 
                 //如果上课日期在转正日期之前的按80%结算
                 if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
@@ -644,7 +644,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             }
 
             boolean notPositive = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getFormalStaffDate())&&courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0;
-            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.isNull(teacher.getFormalStaffDate())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
+            boolean isProbationPeriod = Objects.nonNull(teacher)&&Objects.nonNull(teacher.getIsProbationPeriod())&&ProbationPeriodEnum.TRY.equals(teacher.getIsProbationPeriod());
 
             if(Objects.isNull(teacher)||notPositive||isProbationPeriod){
                 teacherSalary = teacherSalary.multiply(new BigDecimal("0.8"));
@@ -1200,15 +1200,24 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     throw new BizException("课酬设置异常");
                 }
                 int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(courseSchedule.getId());
+                if(studentNum<=0){
+                    studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(courseSchedule.getClassGroupId());
+                }
                 salary = salary.multiply(new BigDecimal(studentNum));
             }
             //线上小班课
             if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE)) {
                 int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(courseSchedule.getId());
+                if(studentNum<=0){
+                    studentNum = classGroupStudentMapperDao.countClassGroupNormalStudentNum(courseSchedule.getClassGroupId());
+                }
                 if(studentNum>5){
                     studentNum=5;
                 }
                 salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum+"");
+                if(studentNum<=0){
+                    salary = new BigDecimal(0);
+                }
             }
 
             if (courseSchedule.getType().equals(CourseSchedule.CourseScheduleType.MUSIC_NETWORK)) {

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

@@ -667,7 +667,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }*/
         Date date = new Date();
         String musicGroupId = studentRegistration.getMusicGroupId();
-        
+
         studentRegistration.setCreateTime(date);
         studentRegistration.setUpdateTime(date);
 
@@ -793,7 +793,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
             studentPaymentOrder.setExpectAmount(reduce);
             studentPaymentOrderService.insert(studentPaymentOrder);
-            
+
             //当前学员是否以前存在过当前乐团
             if (phoneAndMusicGroupId != null) {
                 studentRegistration.setId(phoneAndMusicGroupId.getId());
@@ -1406,10 +1406,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (student == null) {
             throw new BizException("用户注册信息不存在,无法更新");
         }
+        student.setName(studentRegistration.getName());
         student.setParentsName(studentRegistration.getParentsName());
         student.setIdCardNo(studentRegistration.getIdCardNo());
-        update(student);
-        studentRegistrationDao.updateUser(student.getUserId(), student.getParentsName(), student.getIdCardNo(), studentRegistration.getCertificateType());
+        student.setGender(studentRegistration.getGender());
+        update(studentRegistration);
+        studentRegistrationDao.updateUser(student.getUserId(),student.getName(), student.getParentsName(), student.getIdCardNo(), student.getGender(),studentRegistration.getCertificateType());
         // 添加用户电子签章账户
         if(CertificateTypeEnum.IDENTITY.getCode().equals(studentRegistration.getCertificateType())){
             contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());

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

@@ -90,10 +90,10 @@
         SELECT sar.*,spo.expect_amount_,spo.actual_amount_,u.username_ FROM student_apply_refunds sar left join student_payment_order spo on sar.orig_payment_order_id_ = spo.id_ left join sys_user u on sar.user_id_ = u.id_
         where 1=1 
         <if test="startTime != null">
-            and sar.create_time_ &gt;= #{startTime}
+            and DATE_FORMAT(sar.create_time_,"%Y-%m-%d") &gt;= DATE_FORMAT(#{startTime},"%Y-%m-%d")
         </if>
         <if test="endTime != null">
-            and sar.create_time_ &lt;= #{endTime}
+            and DATE_FORMAT(sar.create_time_,"%Y-%m-%d") &lt;= DATE_FORMAT(#{endTime},"%Y-%m-%d")
         </if>
         <if test="status!=null and status!=''">
             and sar.status_=#{status}
@@ -109,10 +109,10 @@
 		SELECT count(1) FROM student_apply_refunds sar left join student_payment_order spo on sar.orig_payment_order_id_ = spo.id_ left join sys_user u on sar.user_id_ = u.id_
 		where 1=1 
         <if test="startTime != null">
-            and sar.create_time_ &gt;= #{startTime}
+            and DATE_FORMAT(sar.create_time_,"%Y-%m-%d") &gt;= DATE_FORMAT(#{startTime},"%Y-%m-%d")
         </if>
         <if test="endTime != null">
-            and sar.create_time_ &lt;= #{endTime}
+            and DATE_FORMAT(sar.create_time_,"%Y-%m-%d") &lt;= DATE_FORMAT(#{endTime},"%Y-%m-%d")
         </if>
         <if test="status!=null and status!=''">
             and sar.status_=#{status}

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

@@ -619,7 +619,26 @@
     </select>
 
     <update id="updateUser">
-        UPDATE sys_user SET real_name_ = #{realName},id_card_no_=#{idCardNo},certificate_type_=#{certificateType},update_time_=NOW() WHERE id_=#{id}
+        UPDATE sys_user
+        <set>
+            <if test="name != null">
+                username_ = #{name},
+            </if>
+            <if test="realName != null">
+                real_name_ = #{realName},
+            </if>
+            <if test="idCardNo != null">
+                id_card_no_ = #{idCardNo},
+            </if>
+            <if test="certificateType != null">
+                certificate_type_ = #{certificateType},
+            </if>
+            <if test="gender != null">
+                gender_ = #{gender},
+            </if>
+            update_time_=NOW()
+            WHERE id_=#{id}
+        </set>
     </update>
     <update id="updateCurrentClass" parameterType="com.ym.mec.biz.dal.entity.StudentRegistration">
         UPDATE student_registration sr SET sr.current_grade_ = #{currentGrade},sr.current_class_ = #{currentClass},sr.current_grade_date_= NOW(),sr.update_time_ = NOW()

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/config/WebMvcConfig.java

@@ -46,7 +46,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 
 		registry.addInterceptor(mdcInterceptor).addPathPatterns(includePathPatterns).excludePathPatterns(excludePathPatterns);
 
-//		registry.addInterceptor(operationLogInterceptor).addPathPatterns(includePathPatterns).excludePathPatterns(excludePathPatterns);
+//		registry.addInterceptor(operationLogInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
 	}
 
 	@Bean

+ 13 - 13
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -42,36 +42,36 @@ public class MusicGroupRegisterController extends BaseController {
     @ApiOperation(value = "新增学生报名信息")
     @PostMapping("/add")
     public HttpResponseResult add(@RequestBody StudentRegistration studentRegistration) throws Exception {
-    	
-    	SysUser sysUser = sysUserFeignService.queryUserInfo();
+
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        
+
         Date date = new Date();
         MusicGroup musicGroup = musicGroupService.get(studentRegistration.getMusicGroupId());
         if (musicGroup == null) {
             return failed("乐团信息不存在");
         }
-        
-        if (DateUtil.daysBetween(musicGroup.getApplyExpireDate(),date) > 1) {
+
+        if (DateUtil.daysBetween(musicGroup.getApplyExpireDate(), date) > 1 && studentRegistration.getId() == null) {
             return failed("乐团已截止报名");
         }
-        
-        if(studentRegistration.getId() != null){
-            return  succeed(studentRegistrationService.updateStudent(studentRegistration));
+
+        if (studentRegistration.getId() != null) {
+            return succeed(studentRegistrationService.updateStudent(studentRegistration));
         }
 
         if (musicGroup.getStatus().equals(MusicGroupStatusEnum.PAY)) {
             studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
-        }else{
+        } else {
             studentRegistration.setPaymentStatus(PaymentStatusEnum.NO);
         }
-        
-        if(studentRegistration.getUserId() == null){
-        	studentRegistration.setUserId(sysUser.getId());
+
+        if (studentRegistration.getUserId() == null) {
+            studentRegistration.setUserId(sysUser.getId());
         }
-        
+
         studentRegistration.setOrganId(musicGroup.getOrganId());
         return succeed(studentRegistrationService.addStudent(studentRegistration));
     }

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/config/WebMvcConfig.java

@@ -61,7 +61,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 		excludePathPatterns.add("/login");
 		registry.addInterceptor(mdcInterceptor).addPathPatterns(includePathPatterns).excludePathPatterns(excludePathPatterns);
 
-//		registry.addInterceptor(operationLogInterceptor).addPathPatterns(includePathPatterns).excludePathPatterns(excludePathPatterns);
+//		registry.addInterceptor(operationLogInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
 	}
 
 	/**

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

@@ -266,7 +266,7 @@ public class ClassGroupController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('classGroup/classGroupUpdate')")
     @ApiImplicitParams({@ApiImplicitParam(name = "ClassGroup4MixDto", value = "添加班级结构", required = true, dataType = "String")})
     public HttpResponseResult classGroupUpdate(@RequestBody List<ClassGroup4MixDto> classGroup4MixDtos) throws Exception {
-        return succeed(classGroupService.classGroupUpdate(classGroup4MixDtos));
+        return classGroupService.classGroupUpdate(classGroup4MixDtos);
     }
 
     @ApiOperation(value = "小班报名详情")

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

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 @RequestMapping("school")
 @Api(tags = "学校(教学点)服务")
@@ -125,7 +126,10 @@ public class SchoolController extends BaseController {
         if (teacher == null) {
             return failed("用户信息获取失败");
         }
-        String organId = teacher.getTeacherOrganId().toString();
+        String organId = new String();
+        if(Objects.nonNull(teacher.getTeacherOrganId())){
+            organId = teacher.getTeacherOrganId().toString();
+        }
         if(StringUtils.isEmpty(teacher.getFlowOrganRange())){
             organId += "," + teacher.getFlowOrganRange();
         }