Просмотр исходного кода

项目月份修改新增公司

anderx 1 год назад
Родитель
Сommit
8934d4ef4e

+ 12 - 12
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffRecordServiceImpl.java

@@ -109,14 +109,14 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
 
     @Override
     public AjaxResult addCheckMaxDuration(ProjectStaffRecord in) {
-        BigDecimal maxDuration= new BigDecimal(SecurityUtils.getLoginUser().getUser().getDept().getMaxDuration());
+        BigDecimal maxDuration= BigDecimal.valueOf(SecurityUtils.getLoginUser().getUser().getDept().getMaxDuration());
         String maxDurationProjectFlag = configService.selectConfigByKey("maxDurationProject");
-        Boolean maxflag = Boolean.parseBoolean(maxDurationProjectFlag);
-        Double myDuration=0d;
+        boolean maxflag = Boolean.parseBoolean(maxDurationProjectFlag);
+        Double myDuration;
         myDuration=getMyDuration(in,maxflag);
-        BigDecimal mySum = new BigDecimal(myDuration).add(new BigDecimal(in.getDuration()));
+        BigDecimal mySum = new BigDecimal(myDuration).add(BigDecimal.valueOf(in.getDuration()));
 
-        if (mySum.compareTo(maxDuration)==1){
+        if (mySum.compareTo(maxDuration) > 0){
             String errorStr=String.format("每天工时超出最大限制,最大额[%s],当前总额[%s]",maxDuration,mySum);
             log.debug(errorStr);
             return AjaxResult.error(errorStr);
@@ -127,11 +127,11 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
 
     @Override
     public AjaxResult updateCheckMaxDuration(ProjectStaffRecord in) {
-        BigDecimal maxDuration= new BigDecimal(SecurityUtils.getLoginUser().getUser().getDept().getMaxDuration());
+        BigDecimal maxDuration= BigDecimal.valueOf(SecurityUtils.getLoginUser().getUser().getDept().getMaxDuration());
         String maxDurationProjectFlag = configService.selectConfigByKey("maxDurationProject");
         AtomicReference<Double> aDouble = new AtomicReference<>(0d);
         String date=DateUtils.getDate();
-        Boolean maxflag = Boolean.parseBoolean(maxDurationProjectFlag);
+        boolean maxflag = Boolean.parseBoolean(maxDurationProjectFlag);
         List<ProjectStaffRecord> projectStaffRecords;
         if (maxflag){
              projectStaffRecords = projectStaffRecordMapper.selectByPidAndAid(in.getPid(),in.getAid());
@@ -139,7 +139,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
             projectStaffRecords = projectStaffRecordMapper.selectByPidAndAid(null,in.getAid());
         }
 
-        projectStaffRecords.stream().forEach(e ->{
+        projectStaffRecords.forEach(e ->{
             String eDate= DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, e.getRecordTime());
             if (!e.getId().equals(in.getId())){
                 if (date.equals(eDate)){
@@ -150,7 +150,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         });
         aDouble.updateAndGet(v -> v + in.getDuration());
         BigDecimal mySum= new BigDecimal(aDouble.toString());
-        if (mySum.compareTo(maxDuration)==1){
+        if (mySum.compareTo(maxDuration) > 0){
                 String errorStr=String.format("每天工时超出最大限制,最大额[%s],当前总额[%s]",maxDuration,mySum);
                 log.debug(errorStr);
                 return AjaxResult.error(errorStr);
@@ -164,7 +164,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         LoginUser loginUser = SecurityUtils.getLoginUser();
         ProjectTask projectTask = projectTaskMapper.selectByPrimaryKey(id);
         //获取最大打卡时间
-        BigDecimal maxDuration= new BigDecimal(loginUser.getUser().getDept().getMaxDuration());
+        BigDecimal maxDuration= BigDecimal.valueOf(loginUser.getUser().getDept().getMaxDuration());
         //获取当前时间
         String  date=DateUtils.getDate();
         //获取月第一天
@@ -269,12 +269,12 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
 
     @Override
     public void downloadFiles(String ids, HttpServletResponse response) {
-        String downloadFileName = "";
+        String downloadFileName;
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         ZipOutputStream zip = new ZipOutputStream(outputStream);
         downloadFileName="项目打卡数据_"+DateUtils.dateTimeNow()+".zip";
         String[] idList = ids.split(",");
-        Integer logx=0;
+        int logx=0;
         for (String id : idList) {
             ProjectStaffRecord psr = projectStaffRecordMapper.selectByPrimaryKey(Long.valueOf(id));
             //防止重名码