Commit dcce5378 authored by 赵啸非's avatar 赵啸非

修改考勤汇总

parent 39dda050
......@@ -17,6 +17,7 @@ import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptPerformStatService;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.hik.face.model.req.img.ImgReq;
import com.mortals.xhx.module.hik.face.service.IHikFaceService;
......@@ -26,10 +27,8 @@ import com.mortals.xhx.module.perform.model.PerformPerposeStaffStatEntity;
import com.mortals.xhx.module.perform.service.PerformPerposeDeptStatService;
import com.mortals.xhx.module.perform.service.PerformPerposeStaffService;
import com.mortals.xhx.module.perform.service.PerformPerposeStaffStatService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.model.*;
import com.mortals.xhx.module.staff.service.StaffPerformStatService;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import com.mortals.xhx.module.workman.model.WorkmanEntity;
......@@ -80,7 +79,10 @@ public class MockDataController {
private PerformPerposeDeptStatService perposeDeptStatService;
@Autowired
private StaffPerformSummaryService summaryService;
@Autowired
private StaffPerformStatService staffPerformStatService;
private DeptPerformStatService deptPerformStatService;
/**
* 生成模拟数据
......@@ -204,7 +206,7 @@ public class MockDataController {
BigDecimal otherScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal errorScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal totalScore =attendScore.add(reviewScore).add(complainScore).add(goworkScore).add(effectScore).add(otherScore).add(errorScore);
BigDecimal totalScore = attendScore.add(reviewScore).add(complainScore).add(goworkScore).add(effectScore).add(otherScore).add(errorScore);
statEntity.setAttendScore(attendScore);
statEntity.setReviewScore(reviewScore);
......@@ -228,6 +230,77 @@ public class MockDataController {
}
/**
* 生成模拟数据
* mortals_xhx_staff_perform_stat
*
* @return
*/
@GetMapping("randomStaffPerformStatData")
@UnAuth
public Rest<Void> randomStaffPerformStatData() {
List<StaffEntity> cacheList = staffService.getCacheList();
//最近两月模拟数据
DateTime beforeStartDate = DateUtil.offsetDay(new Date(), -60);
for (int i = 1; i <= 60; i++) {
DateTime curDate = DateUtil.offsetDay(beforeStartDate, i);
List<StaffPerformStatEntity> collect = cacheList.stream().map(item -> {
StaffPerformStatEntity statEntity = new StaffPerformStatEntity();
statEntity.initAttrValue();
statEntity.setStaffId(item.getId());
statEntity.setStaffName(item.getName());
BigDecimal attendScoreAdd = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal reviewScoreAdd = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal complainScoreAdd = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal goworkScoreAdd = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal effectScoreAdd = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal otherScoreAdd = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal attendScoreSub = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal reviewScoreSub = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal complainScoreSub = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal goworkScoreSub = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal effectScoreSub = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal otherScoreSub = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
statEntity.setAttendScoreAdd(attendScoreAdd);
statEntity.setAttendScoreSub(attendScoreSub);
statEntity.setReviewScoreAdd(reviewScoreAdd);
statEntity.setReviewScoreSub(reviewScoreSub);
statEntity.setComplainScoreAdd(complainScoreAdd);
statEntity.setComplainScoreSub(complainScoreSub);
statEntity.setGoworkScoreAdd(goworkScoreAdd);
statEntity.setGoworkScoreSub(goworkScoreSub);
statEntity.setEffectScoreAdd(effectScoreAdd);
statEntity.setEffectScoreSub(effectScoreSub);
statEntity.setOtherScoreAdd(otherScoreAdd);
statEntity.setOtherScoreSub(otherScoreSub);
BigDecimal totalScoreAdd = attendScoreAdd.add(reviewScoreAdd).add(complainScoreAdd)
.add(goworkScoreAdd).add(effectScoreAdd).add(otherScoreAdd);
BigDecimal totalScoreSub = attendScoreSub.add(reviewScoreSub).add(complainScoreSub)
.add(goworkScoreSub).add(effectScoreSub).add(otherScoreSub);
statEntity.setTotalAddScore(totalScoreAdd);
statEntity.setTotalSubScore(totalScoreSub);
BigDecimal subtract = statEntity.getTotalAddScore().subtract(statEntity.getTotalSubScore());
statEntity.setTotalScore(subtract.compareTo(BigDecimal.ZERO)>0?subtract:BigDecimal.ZERO);
statEntity.setYear(DateUtil.year(curDate));
statEntity.setMonth(DateUtil.month(curDate) + 1);
statEntity.setDay(DateUtil.dayOfMonth(curDate));
return statEntity;
}).collect(Collectors.toList());
staffPerformStatService.save(collect);
}
return Rest.ok();
}
public static void main(String[] args) {
System.out.println(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
}
......
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