Commit 7dd5af8b authored by 赵啸非's avatar 赵啸非

修改考勤汇总

parent 64ece70b
...@@ -27,7 +27,10 @@ import com.mortals.xhx.module.perform.service.PerformPerposeDeptStatService; ...@@ -27,7 +27,10 @@ import com.mortals.xhx.module.perform.service.PerformPerposeDeptStatService;
import com.mortals.xhx.module.perform.service.PerformPerposeStaffService; import com.mortals.xhx.module.perform.service.PerformPerposeStaffService;
import com.mortals.xhx.module.perform.service.PerformPerposeStaffStatService; import com.mortals.xhx.module.perform.service.PerformPerposeStaffStatService;
import com.mortals.xhx.module.staff.model.StaffEntity; 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.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import com.mortals.xhx.module.workman.model.WorkmanEntity; import com.mortals.xhx.module.workman.model.WorkmanEntity;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -75,6 +78,8 @@ public class MockDataController { ...@@ -75,6 +78,8 @@ public class MockDataController {
private PerformPerposeStaffStatService perposeStaffStatService; private PerformPerposeStaffStatService perposeStaffStatService;
@Autowired @Autowired
private PerformPerposeDeptStatService perposeDeptStatService; private PerformPerposeDeptStatService perposeDeptStatService;
@Autowired
private StaffPerformSummaryService summaryService;
/** /**
...@@ -88,7 +93,7 @@ public class MockDataController { ...@@ -88,7 +93,7 @@ public class MockDataController {
public Rest<Void> randomStatPerposeStaffData() { public Rest<Void> randomStatPerposeStaffData() {
List<StaffEntity> cacheList = staffService.getCacheList(); List<StaffEntity> cacheList = staffService.getCacheList();
//最近两月模拟数据 //最近两月模拟数据
DateTime beforeStartDate = DateUtil.offsetDay(new Date(), 60); DateTime beforeStartDate = DateUtil.offsetDay(new Date(), -60);
for (int i = 1; i <= 60; i++) { for (int i = 1; i <= 60; i++) {
DateTime curDate = DateUtil.offsetDay(beforeStartDate, i); DateTime curDate = DateUtil.offsetDay(beforeStartDate, i);
...@@ -125,7 +130,7 @@ public class MockDataController { ...@@ -125,7 +130,7 @@ public class MockDataController {
/** /**
* 生成模拟数据 * 生成模拟数据
* mortals_xhx_perform_perpose_staff_stat * mortals_xhx_perform_perpose_dept_stat
* *
* @return * @return
*/ */
...@@ -136,7 +141,7 @@ public class MockDataController { ...@@ -136,7 +141,7 @@ public class MockDataController {
List<DeptEntity> deptEntityList = deptService.find(new DeptQuery()); List<DeptEntity> deptEntityList = deptService.find(new DeptQuery());
//最近两月模拟数据 //最近两月模拟数据
DateTime beforeStartDate = DateUtil.offsetDay(new Date(), 60); DateTime beforeStartDate = DateUtil.offsetDay(new Date(), -60);
for (int i = 1; i <= 60; i++) { for (int i = 1; i <= 60; i++) {
DateTime curDate = DateUtil.offsetDay(beforeStartDate, i); DateTime curDate = DateUtil.offsetDay(beforeStartDate, i);
...@@ -167,6 +172,62 @@ public class MockDataController { ...@@ -167,6 +172,62 @@ public class MockDataController {
} }
/**
* 生成模拟数据
* mortals_xhx_staff_perform_summary
*
* @return
*/
@GetMapping("randomStatStaffSummaryData")
@UnAuth
public Rest<Void> randomStatStaffSummaryData() {
List<StaffEntity> cacheList = staffService.getCacheList();
//最近两月模拟数据
DateTime beforeStartDate = DateUtil.offsetMonth(new Date(), -3);
for (int i = 1; i <= 3; i++) {
DateTime curDate = DateUtil.offsetMonth(beforeStartDate, i);
List<StaffPerformSummaryEntity> collect = cacheList.stream().map(item -> {
StaffPerformSummaryEntity statEntity = new StaffPerformSummaryEntity();
statEntity.initAttrValue();
statEntity.setStaffId(item.getId());
statEntity.setStaffName(item.getName());
statEntity.setWorkNum(item.getWorkNum());
statEntity.setDeptId(item.getDeptId());
statEntity.setDeptName(item.getDeptName());
BigDecimal attendScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal reviewScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal complainScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal goworkScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
BigDecimal effectScore = RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING);
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);
statEntity.setAttendScore(attendScore);
statEntity.setReviewScore(reviewScore);
statEntity.setComplainScore(complainScore);
statEntity.setGoworkScore(goworkScore);
statEntity.setEffectScore(effectScore);
statEntity.setOtherScore(otherScore);
statEntity.setErrorScore(errorScore);
statEntity.setTotalScore(totalScore);
statEntity.setYear(DateUtil.year(curDate));
statEntity.setMonth(DateUtil.month(curDate) + 1);
return statEntity;
}).collect(Collectors.toList());
summaryService.save(collect);
}
return Rest.ok();
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING)); 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