anderx 1 рік тому
батько
коміт
c9c653d36f

+ 5 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ProjectTaskController.java

@@ -216,7 +216,7 @@ public class ProjectTaskController extends BaseController {
     @PostMapping("/listRecord/importData")
     @ApiOperation("导入项目打卡数据")
     @Log(title = "项目日志管理", businessType = BusinessType.IMPORT)
-    public AjaxResult listRecordImportData(MultipartFile file, boolean updateSupport) throws Exception
+    public AjaxResult listRecordImportData(@RequestParam(value ="file")MultipartFile file, @RequestParam(value = "updateSupport") boolean updateSupport) throws Exception
     {
         ExcelUtil<ProjectStaffRecordOut> util = new ExcelUtil<>(ProjectStaffRecordOut.class);
         List<ProjectStaffRecordOut> list = util.importExcel(file.getInputStream());
@@ -398,8 +398,10 @@ public class ProjectTaskController extends BaseController {
      */
     @PostMapping("/mateUserRecord")
     public AjaxResult mateUserRecord(ProjectStaffRecordInput in) {
-        projectStaffRecordService.mateUserRecord(in);
-        return AjaxResult.success();
+        if (in.getClockStatus()==null||in.getClockStatus()!=2){
+            return error("请先查询需要合并的数据");
+        }
+        return projectStaffRecordService.mateUserRecord(in);
     }
 
     /**

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/ProjectStaffRecordService.java

@@ -41,7 +41,7 @@ public interface ProjectStaffRecordService {
     AjaxResult checkRecordTime(AjaxResult ajaxResult, ProjectStaffRecord in);
 
 
-    void mateUserRecord(ProjectStaffRecordInput in);
+    AjaxResult mateUserRecord(ProjectStaffRecordInput in);
 
     OutMontClockBo getMonthClock(Integer id, String yearMonth);
 

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

@@ -347,14 +347,26 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void mateUserRecord(ProjectStaffRecordInput in) {
+    public AjaxResult mateUserRecord(ProjectStaffRecordInput in) {
         in.setPageSize(999999);
         List<ProjectStaffRecordOut> projectStaffRecordOuts = listRecord(in);
         List<Long> collect = projectStaffRecordOuts.stream().map(ProjectStaffRecordOut::getId).collect(Collectors.toList());
+
         if (!collect.isEmpty()){
-            projectStaffRecordMapper.mateUserRecord(collect);
+            if (collect.size()< 50){
+                projectStaffRecordMapper.mateUserRecord(collect);
+            }else {
+                for (int i = 0; i < collect.size(); i+=50) {
+                    List<Long> subList = collect.subList(i, i + 50);
+                    projectStaffRecordMapper.mateUserRecord(subList);
+                }
+            }
+            pushProjectAndAidDuration(projectStaffRecordOuts);
+            return AjaxResult.success();
+        }else {
+            return AjaxResult.error("无需合并的数据");
         }
-        pushProjectAndAidDuration(projectStaffRecordOuts);
+
 
 
     }
@@ -833,6 +845,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
                                 BigDecimal added = projectDuration.add(BigDecimal.valueOf(e.getDuration()));
                                 BigDecimal checkDuration = BigDecimal.valueOf(e.getCheckDuration());
                                 map2.put("projectDuration", added);
+                                map2.put("checkDuration", checkDuration);
                                 map2.put("notDuration", checkDuration.subtract(added));
                                 break;
                             }