Commit 64ece70b authored by 赵啸非's avatar 赵啸非

修改考勤汇总

parent b686ac46
......@@ -15,8 +15,12 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.base.system.user.model.UserEntity;
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.DeptService;
import com.mortals.xhx.module.hik.face.model.req.img.ImgReq;
import com.mortals.xhx.module.hik.face.service.IHikFaceService;
import com.mortals.xhx.module.perform.model.PerformPerposeDeptStatEntity;
import com.mortals.xhx.module.perform.model.PerformPerposeStaffEntity;
import com.mortals.xhx.module.perform.model.PerformPerposeStaffStatEntity;
import com.mortals.xhx.module.perform.service.PerformPerposeDeptStatService;
......@@ -64,10 +68,12 @@ public class MockDataController {
private IHikFaceService faceService;
@Autowired
private UploadService uploadService;
@Autowired
private DeptService deptService;
@Autowired
private PerformPerposeStaffStatService perposeStaffStatService;
@Autowired
private PerformPerposeDeptStatService perposeDeptStatService;
......@@ -93,18 +99,18 @@ public class MockDataController {
statEntity.setStaffName(item.getName());
statEntity.setNumber(item.getWorkNum());
statEntity.setAbsentRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setAbsenceRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setLateRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setEarlyRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setLeaveRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setTurnoverRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setSleepRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setPlayPhoneRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setExpireWorkRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setNegaReviewRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2,BigDecimal.ROUND_CEILING));
statEntity.setAbsentRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setAbsenceRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setLateRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setEarlyRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setLeaveRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setTurnoverRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setSleepRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setPlayPhoneRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setExpireWorkRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setNegaReviewRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setYear(DateUtil.year(curDate));
statEntity.setMonth(DateUtil.month(curDate)+1);
statEntity.setMonth(DateUtil.month(curDate) + 1);
statEntity.setDay(DateUtil.dayOfMonth(curDate));
......@@ -112,16 +118,57 @@ public class MockDataController {
}).collect(Collectors.toList());
perposeStaffStatService.save(collect);
}
return Rest.ok();
}
/**
* 生成模拟数据
* mortals_xhx_perform_perpose_staff_stat
*
* @return
*/
@GetMapping("randomStatPerposeDeptData")
@UnAuth
public Rest<Void> randomStatPerposeDeptData() {
List<DeptEntity> deptEntityList = deptService.find(new DeptQuery());
//最近两月模拟数据
DateTime beforeStartDate = DateUtil.offsetDay(new Date(), 60);
for (int i = 1; i <= 60; i++) {
DateTime curDate = DateUtil.offsetDay(beforeStartDate, i);
List<PerformPerposeDeptStatEntity> collect = deptEntityList.stream().map(item -> {
PerformPerposeDeptStatEntity statEntity = new PerformPerposeDeptStatEntity();
statEntity.initAttrValue();
statEntity.setDeptId(item.getId());
statEntity.setDeptName(item.getDeptName());
statEntity.setAbsentRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setAbsenceRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setLateRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setEarlyRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setLeaveRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setTurnoverRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setSleepRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setPlayPhoneRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setExpireWorkRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setNegaReviewRate(RandomUtil.randomBigDecimal(BigDecimal.ZERO, new BigDecimal("1")).setScale(2, BigDecimal.ROUND_CEILING));
statEntity.setYear(DateUtil.year(curDate));
statEntity.setMonth(DateUtil.month(curDate) + 1);
statEntity.setDay(DateUtil.dayOfMonth(curDate));
return statEntity;
}).collect(Collectors.toList());
perposeDeptStatService.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));
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