فهرست منبع

Merge remote-tracking branch 'origin/master'

Joburgess 5 سال پیش
والد
کامیت
e8e9c2bf30

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

@@ -3,10 +3,10 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
+import com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
-
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
@@ -380,5 +380,12 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherCourseSalaryDetail4WebDto>
 	 */
 	List<TeacherCourseSalaryDetail4WebDto> findIsSettlementCourseSalarys(Map<String, Object> params);
+
 	int countIsSettlementCourseSalarys(Map<String, Object> params);
+
+	/**
+	 * 调整已结算的课酬
+	 * @param modifyLog
+	 */
+    void updateSalary(@Param("modifyLog") TeacherSalaryModifyLog modifyLog);
 }

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleTeacherSalary.java

@@ -2,10 +2,8 @@ package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.TeachTypeEnum;
-
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
-
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherSalaryModifyLogService.java

@@ -4,4 +4,10 @@ import com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog;
 import com.ym.mec.common.service.BaseService;
 
 public interface TeacherSalaryModifyLogService extends BaseService<Long, TeacherSalaryModifyLog> {
+    /**
+     * 新增修改记录
+     * @param modifyLog
+     * @return
+     */
+    Object add(TeacherSalaryModifyLog modifyLog);
 }

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherSalaryModifyLogServiceImpl.java

@@ -1,21 +1,39 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
 import com.ym.mec.biz.dal.dao.TeacherSalaryModifyLogDao;
+import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog;
+import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
 import com.ym.mec.biz.service.TeacherSalaryModifyLogService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 @Service
 public class TeacherSalaryModifyLogServiceImpl extends BaseServiceImpl<Long, TeacherSalaryModifyLog>  implements TeacherSalaryModifyLogService {
 	
 	@Autowired
 	private TeacherSalaryModifyLogDao teacherSalaryModifyLogDao;
+	@Autowired
+	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
 
 	@Override
 	public BaseDAO<Long, TeacherSalaryModifyLog> getDAO() {
 		return teacherSalaryModifyLogDao;
 	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public Object add(TeacherSalaryModifyLog modifyLog) {
+		//获取之前的课酬信息
+		CourseScheduleTeacherSalary salary = courseScheduleTeacherSalaryDao.queryByCourseScheduleIdAndUserId(modifyLog.getCourseScheduleId(), modifyLog.getTeacherId());
+		courseScheduleTeacherSalaryDao.updateSalary(modifyLog);
+		//修改教师课酬
+		modifyLog.setPreExpectSalary(salary.getActualSalary());
+		modifyLog.setPreReduceSalary(salary.getReduceSalary());
+		return teacherSalaryModifyLogDao.insert(modifyLog);
+	}
 }

+ 8 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -106,13 +106,13 @@
 			<if test="classGroupId != null">
 				class_group_id_ = #{classGroupId},
 			</if>
-			<if test="classGroupId != null">
+			<if test="reduceSalary != null">
 				reduce_salary = #{reduceSalary},
 			</if>
-			<if test="classGroupId != null">
+			<if test="confirmStatus != null">
 				confirm_status_ = #{confirmStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
-			<if test="classGroupId != null">
+			<if test="memo != null">
 				memo_ = #{memo},
 			</if>
 		</set> WHERE id_ = #{id} 
@@ -444,6 +444,11 @@
 		AND csts.teacher_role_ = 'BISHOP'
 	</update>
 
+    <update id="updateSalary" parameterType="com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog">
+		UPDATE course_schedule_teacher_salary SET actual_salary_ = #{modifyLog.currentExpectSalary},reduce_salary = #{modifyLog.currentReduceSalary},update_time_ = NOW()
+		WHERE course_schedule_id_ = #{modifyLog.courseScheduleId} AND user_id_ = #{modifyLog.teacherId}
+	</update>
+
     <select id="findCourseScheduleTeacherSalaryByMusicGroupId" resultMap="CourseScheduleTeacherSalary">
 		SELECT * FROM course_schedule_teacher_salary WHERE music_group_id_=#{musicGroupId} AND group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 	</select>

+ 5 - 23
mec-web/src/main/java/com/ym/mec/web/controller/TeacherSalaryModifyLogController.java

@@ -1,32 +1,14 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
-import com.ym.mec.biz.dal.dto.HighClassGroupDto;
-import com.ym.mec.biz.dal.dto.TestDto;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 import com.ym.mec.biz.dal.entity.TeacherSalaryModifyLog;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
-import com.ym.mec.biz.dal.page.EndCourseScheduleQueryInfo;
-import com.ym.mec.biz.dal.page.queryMusicGroupCourseScheduleQueryInfo;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
 import com.ym.mec.biz.service.TeacherSalaryModifyLogService;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.entity.HttpResponseResult;
-import com.ym.mec.common.page.QueryInfo;
-import io.swagger.annotations.*;
-import org.apache.commons.lang3.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Date;
-import java.util.List;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 @RequestMapping("teacherSalaryModifyLog")
 @Api(tags = "班级服务")
@@ -40,6 +22,6 @@ public class TeacherSalaryModifyLogController extends BaseController {
     @RequestMapping("/add")
     @PreAuthorize("@pcs.hasPermissions('teacherSalaryModifyLog/add')")
     public Object add(TeacherSalaryModifyLog modifyLog){
-        return succeed(teacherSalaryModifyLogService.insert(modifyLog));
+        return succeed(teacherSalaryModifyLogService.add(modifyLog));
     }
 }