Commit f85d5b1a authored by 廖旭伟's avatar 廖旭伟

绩效汇总数据初始化时不生成已离职员工数据

parent 7c8fa494
...@@ -4,6 +4,7 @@ import com.mortals.framework.exception.AppException; ...@@ -4,6 +4,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.common.code.StaffSatusEnum;
import com.mortals.xhx.module.holiday.model.HolidayEntity; import com.mortals.xhx.module.holiday.model.HolidayEntity;
import com.mortals.xhx.module.holiday.model.HolidayQuery; import com.mortals.xhx.module.holiday.model.HolidayQuery;
import com.mortals.xhx.module.holiday.service.HolidayService; import com.mortals.xhx.module.holiday.service.HolidayService;
...@@ -70,6 +71,17 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService { ...@@ -70,6 +71,17 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService {
if(CollectionUtils.isNotEmpty(allStaff)) { if(CollectionUtils.isNotEmpty(allStaff)) {
List<StaffPerformStatEntity> list = new ArrayList<>(); List<StaffPerformStatEntity> list = new ArrayList<>();
allStaff.stream().forEach(item -> { allStaff.stream().forEach(item -> {
boolean flag = true;
if(item.getStatus() == StaffSatusEnum.离职.getValue()) {
if(item.getLeaveDate()!=null){
String leaveDateStr = DateUtils.getStrDate(item.getLeaveDate());
if(DateUtils.StrToDate(leaveDateStr).compareTo(DateUtils.StrToDate(dateStr)) < 0){
//离职日期在统计日期之前不统计
flag = false;
}
}
}
if(flag){
StaffPerformStatEntity statEntity = new StaffPerformStatEntity(); StaffPerformStatEntity statEntity = new StaffPerformStatEntity();
statEntity.initAttrValue(); statEntity.initAttrValue();
statEntity.setStaffId(item.getId()); statEntity.setStaffId(item.getId());
...@@ -86,9 +98,10 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService { ...@@ -86,9 +98,10 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService {
tempQuery.setMonth(statEntity.getMonth()); tempQuery.setMonth(statEntity.getMonth());
tempQuery.setDay(statEntity.getDay()); tempQuery.setDay(statEntity.getDay());
StaffPerformStatEntity temp = staffPerformStatService.selectOne(tempQuery); StaffPerformStatEntity temp = staffPerformStatService.selectOne(tempQuery);
if(temp==null) { if (temp == null) {
list.add(statEntity); list.add(statEntity);
} }
}
}); });
staffPerformStatService.save(list); staffPerformStatService.save(list);
} }
...@@ -99,6 +112,17 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService { ...@@ -99,6 +112,17 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService {
if(CollectionUtils.isNotEmpty(allStaff)) { if(CollectionUtils.isNotEmpty(allStaff)) {
List<StaffPerformSummaryEntity> summaryList = new ArrayList<>(); List<StaffPerformSummaryEntity> summaryList = new ArrayList<>();
allStaff.stream().forEach(item -> { allStaff.stream().forEach(item -> {
boolean flag = true;
if(item.getStatus() == StaffSatusEnum.离职.getValue()) {
if(item.getLeaveDate()!=null){
String leaveDateStr = DateUtils.getStrDate(item.getLeaveDate());
if(DateUtils.StrToDate(leaveDateStr).compareTo(DateUtils.StrToDate(dateStr)) < 0){
//离职日期在统计日期之前不统计
flag = false;
}
}
}
if(flag) {
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity(); StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.initAttrValue(); staffPerformSummaryEntity.initAttrValue();
staffPerformSummaryEntity.setStaffId(item.getId()); staffPerformSummaryEntity.setStaffId(item.getId());
...@@ -115,9 +139,10 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService { ...@@ -115,9 +139,10 @@ public class StaffPerformInitDataTaskImpl implements ITaskExcuteService {
summaryQuery.setYear(staffPerformSummaryEntity.getYear()); summaryQuery.setYear(staffPerformSummaryEntity.getYear());
summaryQuery.setMonth(staffPerformSummaryEntity.getMonth()); summaryQuery.setMonth(staffPerformSummaryEntity.getMonth());
StaffPerformSummaryEntity tempSummary = staffPerformSummaryService.selectOne(summaryQuery); StaffPerformSummaryEntity tempSummary = staffPerformSummaryService.selectOne(summaryQuery);
if(tempSummary==null){ if (tempSummary == null) {
summaryList.add(staffPerformSummaryEntity); summaryList.add(staffPerformSummaryEntity);
} }
}
}); });
staffPerformSummaryService.save(summaryList); staffPerformSummaryService.save(summaryList);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment