|
|
@@ -87,7 +87,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean addCheckMaxDuration(ProjectStaffRecord in) {
|
|
|
+ public AjaxResult addCheckMaxDuration(ProjectStaffRecord in) {
|
|
|
BigDecimal maxDuration= new BigDecimal(SecurityUtils.getLoginUser().getUser().getDept().getMaxDuration());
|
|
|
String maxDurationProjectFlag = configService.selectConfigByKey("maxDurationProject");
|
|
|
Boolean maxflag = Boolean.parseBoolean(maxDurationProjectFlag);
|
|
|
@@ -100,14 +100,15 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
BigDecimal mySum = new BigDecimal(myDuration).add(new BigDecimal(in.getDuration()));
|
|
|
|
|
|
if (mySum.compareTo(maxDuration)==1){
|
|
|
- log.debug(String.format("超出最大额.max=%s,my=%s",maxDuration,mySum));
|
|
|
- return true;
|
|
|
+ String errorStr=String.format("每天工时超出最大限制,最大额[%s],当前总额[%s]",maxDuration,mySum);
|
|
|
+ log.debug(errorStr);
|
|
|
+ return AjaxResult.error(errorStr);
|
|
|
}
|
|
|
- return false;
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean updateCheckMaxDuration(ProjectStaffRecord in) {
|
|
|
+ public AjaxResult updateCheckMaxDuration(ProjectStaffRecord in) {
|
|
|
BigDecimal maxDuration= new BigDecimal(SecurityUtils.getLoginUser().getUser().getDept().getMaxDuration());
|
|
|
String maxDurationProjectFlag = configService.selectConfigByKey("maxDurationProject");
|
|
|
AtomicReference<Double> aDouble = new AtomicReference<>(0d);
|
|
|
@@ -132,10 +133,12 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
aDouble.updateAndGet(v -> v + in.getDuration());
|
|
|
BigDecimal mySum= new BigDecimal(aDouble.toString());
|
|
|
if (mySum.compareTo(maxDuration)==1){
|
|
|
- log.debug(String.format("超出最大额.max=%s,my=%s",maxDuration,mySum));
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
+ String errorStr=String.format("每天工时超出最大限制,最大额[%s],当前总额[%s]",maxDuration,mySum);
|
|
|
+ log.debug(errorStr);
|
|
|
+ return AjaxResult.error(errorStr);
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|