|
@@ -14,6 +14,7 @@ import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.slf4j.Logger;
|
|
@@ -75,6 +76,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
private StudentAttendanceDao studentAttendanceDao;
|
|
|
@Autowired
|
|
|
private TeacherSalaryComplaintsDao teacherSalaryComplaintsDao;
|
|
|
+ @Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(CourseScheduleTeacherSalaryServiceImpl.class);
|
|
@@ -830,6 +833,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void confirmTeacherMonthSalary(Integer teacherId, String month) {
|
|
|
if(Objects.isNull(month)){
|
|
|
month=DateUtil.dateToString(DateUtil.addMonths(new Date(), -1), "yyyy-MM");
|
|
@@ -882,7 +886,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
}
|
|
|
result.put("stat", teacherGroupTypeSalary);
|
|
|
if(!CollectionUtils.isEmpty(pageInfo.getRows())){
|
|
|
- if(YesOrNoEnum.YES.equals(pageInfo.getRows().get(0).getConfirmStatus())){
|
|
|
+ if(TeacherSalaryConfirmStatus.CONFIRMED.equals(pageInfo.getRows().get(0).getConfirmStatus())||
|
|
|
+ TeacherSalaryConfirmStatus.COMPLETED.equals(pageInfo.getRows().get(0).getConfirmStatus())){
|
|
|
result.put("confirmStatus",1);
|
|
|
}else{
|
|
|
result.put("confirmStatus",0);
|
|
@@ -919,12 +924,35 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void openSalaryConfirm(String month) {
|
|
|
-
|
|
|
+ if(Objects.isNull(month)){
|
|
|
+ month=DateUtil.dateToString(DateUtil.addMonths(new Date(), -1), "yyyy-MM");
|
|
|
+ }
|
|
|
+ int i = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(month);
|
|
|
+ if(i>0){
|
|
|
+ throw new BizException("课酬确认已开启");
|
|
|
+ }
|
|
|
+ List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(null, month);
|
|
|
+ if(CollectionUtils.isEmpty(teacherSalaryIds)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ courseScheduleTeacherSalaryDao.updateTeacherSalaryConfirmStatus(teacherSalaryIds,TeacherSalaryConfirmStatus.UNCONFIRMED);
|
|
|
+ String notifyUrl="8?http://mteadev.dayaedu.com/#/remuneration?month=" + month;
|
|
|
+ String monthStr = DateUtil.dateToString(DateUtil.stringToDate(month, "yyyy-MM"),"yyyy年MM月");
|
|
|
+ List<Integer> teacherIds = courseScheduleTeacherSalaryDao.findIsSettlementTeacherIdsWithMonth(month);
|
|
|
+ Map<Integer, String> userMap = teacherIds.stream().collect(Collectors.toMap(Integer::valueOf, id->String.valueOf(id)));
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.TEACHER_SALARY_CONFIRM_PUSH,
|
|
|
+ userMap, null, 0, notifyUrl, "TEACHER", monthStr);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void closeSalaryConfirm(String month) {
|
|
|
-
|
|
|
+ List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(null, month);
|
|
|
+ if(CollectionUtils.isEmpty(teacherSalaryIds)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ courseScheduleTeacherSalaryDao.updateTeacherSalaryConfirmStatusToComplied(teacherSalaryIds);
|
|
|
}
|
|
|
}
|