浏览代码

1.优化了氚云更新步骤,数据相同时不再更新;
2.增加了更新所有工时的http调用方法

verguenza 4 年之前
父节点
当前提交
499f76e64b

+ 16 - 1
src/main/java/com/galaxis/manatee/controller/WorkHourController.java

@@ -1,6 +1,7 @@
 package com.galaxis.manatee.controller;
 
 import com.galaxis.manatee.service.LogCheckService;
+import com.galaxis.manatee.task.WorkHourStatistics;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -15,9 +16,11 @@ import org.springframework.web.bind.annotation.RestController;
 public class WorkHourController {
 
     private final LogCheckService logCheckService;
+    private final WorkHourStatistics workHourStatistics;
 
-    public WorkHourController(LogCheckService logCheckService) {
+    public WorkHourController(LogCheckService logCheckService, WorkHourStatistics workHourStatistics) {
         this.logCheckService = logCheckService;
+        this.workHourStatistics = workHourStatistics;
     }
 
     /**
@@ -32,4 +35,16 @@ public class WorkHourController {
             e.printStackTrace();
         }
     }
+
+    /**
+     * 更新全部工时信息
+     * @return  固定字符串
+     */
+    @GetMapping("/test/workHour/updateWorkHour")
+    public String updateWorkHour(){
+        workHourStatistics.updateHour();
+        return "go ahead";
+    }
+
+
 }

+ 3 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunMemberHourDO.java

@@ -15,6 +15,9 @@ import javax.persistence.Entity;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
+/**
+ * 氚云,开发-》项目每日工时统计
+ */
 @Slf4j
 @EqualsAndHashCode(callSuper = true)
 @Data

文件差异内容过多而无法显示
+ 6 - 10
src/main/java/com/galaxis/manatee/task/ChuanyunBasicDataScheduledTask.java


+ 19 - 8
src/main/java/com/galaxis/manatee/task/WorkHourStatistics.java

@@ -268,12 +268,18 @@ public class WorkHourStatistics {
                     List<ChuanyunMemberHourDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
                     });
                     ChuanyunMemberHourDO firstResult = result.get(0);
-                    chuanyunSaveDTO = chuanYunManager.update(ChuanyunMemberHourDO.SCHEMA_CODE, firstResult.getObjectId(), selfMonthString);
+                    //增加工时不相等再更新每日工时数据的
+                    if(0!=firstResult.getStandardWorkHour().compareTo(chuanyunSelfWorkHourDO.getStandardWorkHour())){
+                        chuanyunSaveDTO = chuanYunManager.update(ChuanyunMemberHourDO.SCHEMA_CODE, firstResult.getObjectId(), selfMonthString);
+                        if (!chuanyunSaveDTO.getSuccessful()) {
+                            log.warn("更新工时标准化失败");
+                        }
+                    }
                 } else {
                     chuanyunSaveDTO = chuanYunManager.save(ChuanyunMemberHourDO.SCHEMA_CODE, selfMonthString, true);
-                }
-                if (!chuanyunSaveDTO.getSuccessful()) {
-                    log.warn("新增工时标准化失败");
+                    if (!chuanyunSaveDTO.getSuccessful()) {
+                        log.warn("新增工时标准化失败");
+                    }
                 }
             } catch (Exception e) {
                 e.printStackTrace();
@@ -327,12 +333,17 @@ public class WorkHourStatistics {
                             List<ChuanyunProjectMemberWeekHourDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
                             });
                             ChuanyunProjectMemberWeekHourDO firstResult = result.get(0);
-                            chuanyunSaveDTO = chuanYunManager.update(ChuanyunProjectMemberWeekHourDO.SCHEMA_CODE, firstResult.getObjectId(), selfMonthString);
+                            if(0!=firstResult.getTotalHour().compareTo(chuanyunWeekMemberHourDO.getStandardWorkHour())){
+                                chuanyunSaveDTO = chuanYunManager.update(ChuanyunProjectMemberWeekHourDO.SCHEMA_CODE, firstResult.getObjectId(), selfMonthString);
+                                if (!chuanyunSaveDTO.getSuccessful()) {
+                                    log.warn("更新人员项目周度工时失败");
+                                }
+                            }
                         } else {
                             chuanyunSaveDTO = chuanYunManager.save(ChuanyunProjectMemberWeekHourDO.SCHEMA_CODE, selfMonthString, true);
-                        }
-                        if (!chuanyunSaveDTO.getSuccessful()) {
-                            log.warn("新增人员项目周度工时失败");
+                            if (!chuanyunSaveDTO.getSuccessful()) {
+                                log.warn("新增人员项目周度工时失败");
+                            }
                         }
                     } catch (JsonProcessingException | BigSizeException e) {
                         e.printStackTrace();