Browse Source

增加汇算工作组人力成本功能,增加生产项目显示设备类型和工厂名称字段。

Cyangbin 2 năm trước cách đây
mục cha
commit
c0a563d52d
42 tập tin đã thay đổi với 1285 bổ sung254 xóa
  1. 25 0
      pom.xml
  2. 1 1
      src/main/java/com/galaxis/manatee/ManateeApplication.java
  3. 0 1
      src/main/java/com/galaxis/manatee/configuration/SpringAsyncConfiguration.java
  4. 15 0
      src/main/java/com/galaxis/manatee/constant/ChuanYunConstant.java
  5. 75 0
      src/main/java/com/galaxis/manatee/controller/ReimbursementController.java
  6. 10 0
      src/main/java/com/galaxis/manatee/dao/ChuanyunEquipmentProcessDao.java
  7. 10 0
      src/main/java/com/galaxis/manatee/dao/ChuanyunFactoryLocationDao.java
  8. 7 4
      src/main/java/com/galaxis/manatee/dao/ChuanyunImplCostDao.java
  9. 19 0
      src/main/java/com/galaxis/manatee/dao/ChuanyunMonthLaborCostWgDao.java
  10. 2 0
      src/main/java/com/galaxis/manatee/dao/ChuanyunReimbursementDao.java
  11. 3 1
      src/main/java/com/galaxis/manatee/dao/ChuanyunSelfWorkHourDao.java
  12. 16 0
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunDayLog.java
  13. 36 0
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunEquipmentProcess.java
  14. 49 0
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunFactoryLocation.java
  15. 26 2
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunImplCostDO.java
  16. 4 0
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunMemberHourDO.java
  17. 4 5
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunMonthLaborCostWgDO.java
  18. 2 1
      src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunSelfWorkHourDO.java
  19. 50 0
      src/main/java/com/galaxis/manatee/entity/chuanyun/dto/ChuanyunMonthLaborCostWgDTO.java
  20. 7 1
      src/main/java/com/galaxis/manatee/entity/chuanyun/dto/ChuanyunSelfWorkHourDTO.java
  21. 1 2
      src/main/java/com/galaxis/manatee/event/ImplCostListener.java
  22. 24 4
      src/main/java/com/galaxis/manatee/service/DingTalkScheduledTask.java
  23. 2 0
      src/main/java/com/galaxis/manatee/service/GroupProjectService.java
  24. 12 0
      src/main/java/com/galaxis/manatee/service/ImplCostService.java
  25. 0 6
      src/main/java/com/galaxis/manatee/service/LogCheckService.java
  26. 81 25
      src/main/java/com/galaxis/manatee/service/LogDownloadService.java
  27. 3 10
      src/main/java/com/galaxis/manatee/service/LogService.java
  28. 21 13
      src/main/java/com/galaxis/manatee/service/LogStandardService.java
  29. 1 1
      src/main/java/com/galaxis/manatee/service/LogUpdateService.java
  30. 98 42
      src/main/java/com/galaxis/manatee/service/ProjectMemberService.java
  31. 4 0
      src/main/java/com/galaxis/manatee/service/WorkGroupService.java
  32. 23 1
      src/main/java/com/galaxis/manatee/service/impl/GroupProjectServiceImpl.java
  33. 64 0
      src/main/java/com/galaxis/manatee/service/impl/ImplCostServiceImpl.java
  34. 380 51
      src/main/java/com/galaxis/manatee/service/impl/WorkGroupServiceImpl.java
  35. 15 5
      src/main/java/com/galaxis/manatee/task/ChuanyunBasicDataScheduledTask.java
  36. 5 0
      src/main/java/com/galaxis/manatee/task/ChuanyunFinancialScheduledTask.java
  37. 1 1
      src/main/java/com/galaxis/manatee/task/ChuanyunHumanResourceScheduledTask.java
  38. 94 9
      src/main/java/com/galaxis/manatee/task/U9InfoTask.java
  39. 1 1
      src/main/java/com/galaxis/manatee/task/WorkHourStatistics.java
  40. 26 0
      src/main/java/com/galaxis/manatee/util/CollectionsUtils.java
  41. 66 66
      src/main/java/com/galaxis/manatee/webservice/CountryEndpoint.java
  42. 2 1
      src/main/resources/application.yml

+ 25 - 0
pom.xml

@@ -19,6 +19,31 @@
         <spring-cloud.version>2021.0.1</spring-cloud.version>
     </properties>
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
     <dependencies>
         <dependency>
             <groupId>org.springframework.cloud</groupId>

+ 1 - 1
src/main/java/com/galaxis/manatee/ManateeApplication.java

@@ -14,7 +14,7 @@ import java.util.TimeZone;
  * @version 0.1
  */
 // TODO 记得放开
-//@EnableScheduling
+@EnableScheduling
 @SpringBootApplication
 @EnableFeignClients
 @MapperScan("com.galaxis.manatee.mapper")

+ 0 - 1
src/main/java/com/galaxis/manatee/configuration/SpringAsyncConfiguration.java

@@ -5,7 +5,6 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
-import java.util.concurrent.Executor;
 import java.util.concurrent.ThreadPoolExecutor;
 
 /**

+ 15 - 0
src/main/java/com/galaxis/manatee/constant/ChuanYunConstant.java

@@ -47,6 +47,16 @@ public class ChuanYunConstant {
     public static final String PRODUCTION_PROJECT_ID = "production_project";
 
     /**
+     * 默认工作组id
+     */
+    public static final String DEFAULT_WORK_GROUP = "defaultWorkgroup";
+
+    /**
+     * 默认工作组名称
+     */
+    public static final String DEFAULT_WORK_GROUP_NAME= "默认";
+
+    /**
      * 保存项目号、项目ObjectId的映射关系
      */
     public static Map<String, String> PROJECT_CODE = new HashMap<>(2048);
@@ -123,6 +133,11 @@ public class ChuanYunConstant {
     public static final String LOG_FILL_IN_WEEK = "每周填写";
 
     /**
+     * 天填写方式
+     */
+    public static final String LOG_FILL_IN_DAY = "每天填写";
+
+    /**
      * 每周工时
      */
     public static final String LOG_WEEKLY_HOURS = "每周工时";

+ 75 - 0
src/main/java/com/galaxis/manatee/controller/ReimbursementController.java

@@ -0,0 +1,75 @@
+package com.galaxis.manatee.controller;
+
+import com.galaxis.manatee.service.WorkGroupService;
+import com.galaxis.manatee.task.ChuanyunFinancialScheduledTask;
+import com.galaxis.manatee.task.U9InfoTask;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 日志工时controller
+ *
+ * @author zcj
+ * @version 0.1
+ * @date 2021/3/4 3:56 上午
+ */
+@Slf4j
+@RestController
+public class ReimbursementController {
+
+    private ChuanyunFinancialScheduledTask chuanyunFinancialScheduledTask;
+    private WorkGroupService workGroupService;
+    private U9InfoTask u9InfoTask;
+
+    @Autowired
+    public void setChuanyunFinancialScheduledTask(ChuanyunFinancialScheduledTask chuanyunFinancialScheduledTask) {
+        this.chuanyunFinancialScheduledTask = chuanyunFinancialScheduledTask;
+    }
+
+    @Autowired
+    public void setWorkGroupService(WorkGroupService workGroupService) {
+        this.workGroupService = workGroupService;
+    }
+
+    @Autowired
+    public void setU9InfoTask(U9InfoTask u9InfoTask) {
+        this.u9InfoTask = u9InfoTask;
+    }
+
+    /**
+     *
+     */
+    @GetMapping("/test/syncReimbursement")
+    public void syncReimbursement() {
+        chuanyunFinancialScheduledTask.syncReimbursement();
+    }
+
+    /**
+     * 汇算工作组人力成本
+     */
+    @GetMapping("/test/implAllCost")
+    public void implAllCost() {
+        workGroupService.implAllCost();
+    }
+
+    /**
+     * 上传工作组人力成本
+     */
+    @GetMapping("/test/pushToChuanyun")
+    public void pushCost() {
+        workGroupService.pushToChuanyun();
+    }
+
+    /**
+     * 保存工作组人力成本至数据库
+     */
+    @GetMapping("/test/saveLaborCostWg")
+    public void saveLaborCostWg() {
+        u9InfoTask.saveLaborCostWgTest();
+    }
+
+
+
+}

+ 10 - 0
src/main/java/com/galaxis/manatee/dao/ChuanyunEquipmentProcessDao.java

@@ -0,0 +1,10 @@
+package com.galaxis.manatee.dao;
+
+import com.galaxis.manatee.capsule.util.GalaxisRepository;
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunEquipmentProcess;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ChuanyunEquipmentProcessDao extends GalaxisRepository<ChuanyunEquipmentProcess, String> {
+
+}

+ 10 - 0
src/main/java/com/galaxis/manatee/dao/ChuanyunFactoryLocationDao.java

@@ -0,0 +1,10 @@
+package com.galaxis.manatee.dao;
+
+import com.galaxis.manatee.capsule.util.GalaxisRepository;
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunFactoryLocation;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ChuanyunFactoryLocationDao extends GalaxisRepository<ChuanyunFactoryLocation, String> {
+
+}

+ 7 - 4
src/main/java/com/galaxis/manatee/dao/ChuanyunImplCostDao.java

@@ -3,13 +3,10 @@ package com.galaxis.manatee.dao;
 
 import com.galaxis.manatee.capsule.util.GalaxisRepository;
 import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunImplCostDO;
-import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunWorkHourDO;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
+import javax.transaction.Transactional;
 import java.time.LocalDateTime;
-import java.util.List;
 
 /**
  * @author kxuan
@@ -19,5 +16,11 @@ public interface ChuanyunImplCostDao extends GalaxisRepository<ChuanyunImplCostD
 
     ChuanyunImplCostDO findByProjectIdAndProjectCodeAndWorkGroup(String projectId, String projectCode, String workGroup);
 
+    ChuanyunImplCostDO findByProjectIdAndProjectCodeAndWorkGroupAndLocalDate(String projectId, String projectCode, String workGroup, LocalDateTime localDate);
+
+    ChuanyunImplCostDO findByProjectCodeAndWorkGroupAndLocalDate(String projectCode, String workGroup, LocalDateTime localDate);
+
+    @Transactional
+    void deleteAllByProjectId(String projectId);
 
 }

+ 19 - 0
src/main/java/com/galaxis/manatee/dao/ChuanyunMonthLaborCostWgDao.java

@@ -0,0 +1,19 @@
+package com.galaxis.manatee.dao;
+
+import com.galaxis.manatee.capsule.util.GalaxisRepository;
+import com.galaxis.manatee.entity.chuanyun.dto.ChuanyunMonthLaborCostWgDTO;
+import org.springframework.stereotype.Repository;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Repository
+public interface ChuanyunMonthLaborCostWgDao extends GalaxisRepository<ChuanyunMonthLaborCostWgDTO, String> {
+
+    List<ChuanyunMonthLaborCostWgDTO> findAllByProjectCodeAndLogDateAndWorkGroupIdAndDepartment(String projectCode, LocalDateTime time, String workGroupId, String department);
+
+    List<ChuanyunMonthLaborCostWgDTO> findAllByProjectCodeAndLogDateAndWorkGroupId(String projectCode, LocalDateTime time, String workGroupId);
+
+    List<ChuanyunMonthLaborCostWgDTO> findAllByProjectCode(String projectCode);
+
+}

+ 2 - 0
src/main/java/com/galaxis/manatee/dao/ChuanyunReimbursementDao.java

@@ -27,6 +27,8 @@ public interface ChuanyunReimbursementDao extends GalaxisRepository<ChuanyunReim
 
     List<ChuanyunReimbursementDO> findAllByGroupProjectId(String projectId);
 
+    List<ChuanyunReimbursementDO> findAllByGroupProjectIdAndStatusIn(String projectId, List<Integer> status);
+
     /**
      * 查询项目下用户的报销单
      *

+ 3 - 1
src/main/java/com/galaxis/manatee/dao/ChuanyunSelfWorkHourDao.java

@@ -9,7 +9,6 @@ import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -219,4 +218,7 @@ public interface ChuanyunSelfWorkHourDao extends GalaxisRepository<ChuanyunSelfW
     List<ChuanyunSelfWorkHourDO> findByProjectId(String projectId);
 
     List<ChuanyunSelfWorkHourDO> findAllByProjectIdAndUserIdAndStatusIn(String projectId, String userId, List<String> status);
+
+    List<ChuanyunSelfWorkHourDO> findAllByProjectIdAndStatusIn(String projectId, List<String> status);
+
 }

+ 16 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunDayLog.java

@@ -72,11 +72,27 @@ public class ChuanyunDayLog extends BasicSubDO{
     @JsonProperty("factoryLocation")
     private String factoryLocationId;
     /**
+     * 工厂地址ID
+     */
+    private String factoryLocationName;
+    /**
+     * 设备类型
+     */
+    @JsonProperty("F0000053")
+    private String deviceType;
+    /**
      * 订单号
      */
     @JsonProperty("F0000054")
     private String ticketId;
     /**
+     * 生产项目工作内容
+     */
+    @JsonProperty("F0000055")
+    private String jobContentId;
+
+    private String jobContent;
+    /**
      * 项目类日志的项目编号,工厂类项目的工厂编号
      */
     private String projectCode;

+ 36 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunEquipmentProcess.java

@@ -0,0 +1,36 @@
+package com.galaxis.manatee.entity.chuanyun.data.object;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.persistence.Entity;
+
+/**
+ * @author zcj
+ * @version 0.1
+ * @date 2020/5/9 10:41 上午
+ */
+@Slf4j
+@Entity(name = "CHUANYUN_EQUIPMENT_PROCESS")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ChuanyunEquipmentProcess extends BasicDO{
+
+    /**
+     * 设备
+     */
+    @JsonProperty("F0000002")
+    private String device;
+
+    /**
+     * 工序
+     */
+    @JsonProperty("F0000001")
+    private String procedureInfo;
+
+
+}

+ 49 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunFactoryLocation.java

@@ -0,0 +1,49 @@
+package com.galaxis.manatee.entity.chuanyun.data.object;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.persistence.Entity;
+
+/**
+ * @author zcj
+ * @version 0.1
+ * @date 2020/5/9 10:41 上午
+ */
+@Slf4j
+@Entity(name = "CHUANYUN_FACTORY_LOCATION")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ChuanyunFactoryLocation extends BasicDO{
+
+    /**
+     * 工厂编码
+     */
+    @JsonProperty("F0000001")
+    private String factoryCode;
+
+
+    /**
+     * 工厂名称
+     */
+    @JsonProperty("F0000002")
+    private String factoryName;
+
+    /**
+     * 工厂负责人
+     */
+    @JsonProperty("F0000003")
+    private String factoryCharge;
+
+    /**
+     * 工厂二级负责人
+     */
+    @JsonProperty("F0000004")
+    private String factorySecondLevelCharge;
+
+
+}

+ 26 - 2
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunImplCostDO.java

@@ -3,8 +3,11 @@ package com.galaxis.manatee.entity.chuanyun.data.object;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.galaxis.manatee.util.ChuanyunLocalDateTimeDeserializer;
+import com.galaxis.manatee.util.ChuanyunLocalDateTimeSerializer;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
 import lombok.extern.slf4j.Slf4j;
 import org.hibernate.annotations.GenericGenerator;
 
@@ -12,6 +15,7 @@ import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 
 @Slf4j
 @Data
@@ -30,7 +34,13 @@ public class ChuanyunImplCostDO{
     private Long id;
 
     /**
-     * 项目ID、
+     * 拥有者id
+     */
+    @JsonProperty("OwnerId")
+    private String ownerId;
+
+    /**
+     * 唯一Id
      */
     @JsonProperty("ObjectId")
     private String objectId;
@@ -72,4 +82,18 @@ public class ChuanyunImplCostDO{
     @JsonProperty("F0000007")
     private BigDecimal manDay;
 
+    /**
+     * 日期
+     */
+    @JsonProperty("F0000008")
+    @JsonSerialize(using = ChuanyunLocalDateTimeSerializer.class)
+    @JsonDeserialize(using = ChuanyunLocalDateTimeDeserializer.class)
+    private LocalDateTime localDate;
+
+    /**
+     * 人力成本
+     */
+    @JsonProperty("F0000009")
+    private BigDecimal LaborCost;
+
 }

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

@@ -33,11 +33,15 @@ public class ChuanyunMemberHourDO extends BasicDO{
     @JsonProperty("F0000002")
     private String userId;
 
+    @JsonProperty("F0000005")
     private String projectType;
 
     @JsonProperty("F0000001")
     private String projectId;
 
+    @JsonProperty("F0000011")
+    private String projectCode;
+
     @JsonProperty("F0000003")
     @JsonSerialize(using = ChuanyunLocalDateTimeSerializer.class)
     @JsonDeserialize(using = ChuanyunLocalDateTimeDeserializer.class)

+ 4 - 5
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunMonthLaborCostWgDO.java

@@ -10,23 +10,20 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.extern.slf4j.Slf4j;
 
-import javax.persistence.Entity;
 import javax.persistence.Transient;
 import java.math.BigDecimal;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 @Slf4j
 @EqualsAndHashCode(callSuper = true)
 @Data
-@Entity(name = "CHUANYUN_MONTH_LABORCOST_WG")
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class ChuanyunMonthLaborCostWgDO extends BasicDO{
 
     /**
      * 表名
      */
-    public static final String SCHEMA_CODE ="D001789Sdzc3s28dpsjjdr7niay7kija3";
+    public static final String SCHEMA_CODE ="D001789Sp4nqlvhmw4uu9kcazg3xzroh2";
 
     @JsonProperty("F0000005")
     private String projectCode;
@@ -46,8 +43,10 @@ public class ChuanyunMonthLaborCostWgDO extends BasicDO{
     @JsonSerialize(using = ChuanyunLocalDateTimeSerializer.class)
     @JsonDeserialize(using = ChuanyunLocalDateTimeDeserializer.class)
     @JsonProperty("F0000002")
-    private LocalDate logDate;
+    private LocalDateTime logDate;
 
     @JsonProperty("F0000004")
     private String dataType;
+
+    private String department;
 }

+ 2 - 1
src/main/java/com/galaxis/manatee/entity/chuanyun/data/object/ChuanyunSelfWorkHourDO.java

@@ -14,7 +14,6 @@ import org.hibernate.annotations.GenericGenerator;
 import javax.persistence.*;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
-import java.util.Objects;
 
 /**
  * @author kxuan
@@ -54,6 +53,8 @@ public class ChuanyunSelfWorkHourDO {
 
     private BigDecimal standardWorkHour;
 
+    private String workGroupId;
+
     private String workGroupName;
 
     private String subWorkGroupName;

+ 50 - 0
src/main/java/com/galaxis/manatee/entity/chuanyun/dto/ChuanyunMonthLaborCostWgDTO.java

@@ -0,0 +1,50 @@
+package com.galaxis.manatee.entity.chuanyun.dto;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.galaxis.manatee.util.ChuanyunLocalDateTimeDeserializer;
+import com.galaxis.manatee.util.ChuanyunLocalDateTimeSerializer;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.extern.slf4j.Slf4j;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Transient;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Slf4j
+@EqualsAndHashCode
+@Data
+@Entity(name = "CHUANYUN_MONTH_LABORCOST_WG")
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ChuanyunMonthLaborCostWgDTO{
+
+    @Id
+    @GeneratedValue(generator = "idGeneratorChuanyunImplCos")
+    @GenericGenerator(name ="idGeneratorChuanyunImplCos" ,strategy="com.galaxis.manatee.capsule.util.GalaxisIdGenerator")
+    private Long id;
+
+    private String projectCode;
+
+    private String workGroupId;
+
+    private String workGroupName;
+
+    private BigDecimal amount;
+
+    @Transient
+    private BigDecimal totalAmount;
+
+    @JsonSerialize(using = ChuanyunLocalDateTimeSerializer.class)
+    @JsonDeserialize(using = ChuanyunLocalDateTimeDeserializer.class)
+    private LocalDateTime logDate;
+
+    private String dataType;
+
+    private String department;
+}

+ 7 - 1
src/main/java/com/galaxis/manatee/entity/chuanyun/dto/ChuanyunSelfWorkHourDTO.java

@@ -25,6 +25,12 @@ public class ChuanyunSelfWorkHourDTO {
     public static final String SCHEMA_CODE ="D0017899cae010a8a5741b5be13a1fa7f67330d";
 
     /**
+     * 拥有者id
+     */
+    @JsonProperty("OwnerId")
+    private String ownerId;
+
+    /**
      * 用户ID
      */
     @JsonProperty("F0000002")
@@ -43,7 +49,7 @@ public class ChuanyunSelfWorkHourDTO {
     private String projectType;
 
     /**
-     * 项目类型
+     * 项目编号
      */
     @JsonProperty("F0000011")
     private String projectCode;

+ 1 - 2
src/main/java/com/galaxis/manatee/event/ImplCostListener.java

@@ -4,7 +4,6 @@ import com.galaxis.manatee.service.WorkGroupService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationListener;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 @Slf4j
@@ -17,6 +16,6 @@ public class ImplCostListener implements ApplicationListener<ImplCostEvent> {
     @Override
     public void onApplicationEvent(ImplCostEvent event) {
         log.info("监听到实施费用事件");
-        workGroupService.implCost();
+        workGroupService.implAllCost();
     }
 }

+ 24 - 4
src/main/java/com/galaxis/manatee/service/DingTalkScheduledTask.java

@@ -121,7 +121,12 @@ public class DingTalkScheduledTask {
         oApiProcessInstanceListIdsRequest.setSize(20L);
         while (flag) {
             LocalDateTime start = LocalDateTime.now();
-            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = null;
+            try {
+                oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            } catch (ApiException e) {
+                e.printStackTrace();
+            }
             List<ChuanyunBusinessEntertainmentDO> chuanyunBusinessEntertainmentDOS = new ArrayList<>();
             if (oapiProcessinstanceListidsResponse.getErrcode() != 0) {
                 log.info(oapiProcessinstanceListidsResponse.getErrmsg());
@@ -176,7 +181,12 @@ public class DingTalkScheduledTask {
         oApiProcessInstanceListIdsRequest.setSize(20L);
         while (flag) {
             LocalDateTime start = LocalDateTime.now();
-            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = null;
+            try {
+                oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            } catch (ApiException e) {
+                e.printStackTrace();
+            }
             List<ChuanyunAskForLeaveDO> chuanyunAskForLeaveDoList = new ArrayList<>();
             if (oapiProcessinstanceListidsResponse.getErrcode() != 0) {
                 log.info(oapiProcessinstanceListidsResponse.getErrmsg());
@@ -228,7 +238,12 @@ public class DingTalkScheduledTask {
         oApiProcessInstanceListIdsRequest.setSize(20L);
         while (flag) {
             LocalDateTime start = LocalDateTime.now();
-            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = null;
+            try {
+                oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            } catch (ApiException e) {
+                e.printStackTrace();
+            }
             List<DingTalkProcessInstance> dingTalkProcessInstanceList = new ArrayList<>();
             if (oapiProcessinstanceListidsResponse.getErrcode() != 0) {
                 log.info(oapiProcessinstanceListidsResponse.getErrmsg());
@@ -280,7 +295,12 @@ public class DingTalkScheduledTask {
         oApiProcessInstanceListIdsRequest.setSize(20L);
         while (flag) {
             LocalDateTime start = LocalDateTime.now();
-            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            OapiProcessinstanceListidsResponse oapiProcessinstanceListidsResponse = null;
+            try {
+                oapiProcessinstanceListidsResponse = processInstanceListIdsClient.execute(oApiProcessInstanceListIdsRequest, DingTalkConstant.DING_TALK_TOKEN);
+            } catch (ApiException e) {
+                e.printStackTrace();
+            }
             List<ChuanyunProjectChangeDO> chuanyunProjectChangeDOList = new ArrayList<>();
             if (oapiProcessinstanceListidsResponse.getErrcode() != 0) {
                 log.info(oapiProcessinstanceListidsResponse.getErrmsg());

+ 2 - 0
src/main/java/com/galaxis/manatee/service/GroupProjectService.java

@@ -8,4 +8,6 @@ public interface GroupProjectService {
 
     List<ChuanyunGroupProjectDO> findAll();
 
+    List<ChuanyunGroupProjectDO> findByProjectCode(String projectCode);
+
 }

+ 12 - 0
src/main/java/com/galaxis/manatee/service/ImplCostService.java

@@ -0,0 +1,12 @@
+package com.galaxis.manatee.service;
+
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunImplCostDO;
+
+import java.util.List;
+
+public interface ImplCostService {
+
+    List<ChuanyunImplCostDO> findAllInChuanyun();
+
+
+}

+ 0 - 6
src/main/java/com/galaxis/manatee/service/LogCheckService.java

@@ -16,14 +16,11 @@ import com.galaxis.manatee.entity.chuanyun.dto.Filter;
 import com.galaxis.manatee.manager.ChuanYunManager;
 import com.galaxis.manatee.util.TimeUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.time.LocalDateTime;
 import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * @author zcj
@@ -242,7 +239,6 @@ public class LogCheckService {
      * @param allUserIdList 用户id集合
      * @param afterDay      多少天后
      */
-    @Async("threadPoolTaskExecutor")
     public void checkDayWorkHourTimeAfter(List<String> allUserIdList, Integer afterDay) {
         allUserIdList.parallelStream().forEach(userId -> {
             if (Objects.isNull(userId)){
@@ -257,7 +253,6 @@ public class LogCheckService {
         log.info("核对日工时记录完成");
     }
 
-    @Async("threadPoolTaskExecutor")
     public void checkWeekWorkHour(List<String> allUserIdList) {
         allUserIdList.parallelStream().forEach(userId -> {
             log.info("开始核对用户: {} 标准化周工时", userId);
@@ -307,7 +302,6 @@ public class LogCheckService {
         });
     }
 
-    @Async("threadPoolTaskExecutor")
     public void checkMonthWorkHour(List<String> allUserIdList) {
         long start = System.currentTimeMillis();
         log.info("开始核对标准化月工时");

+ 81 - 25
src/main/java/com/galaxis/manatee/service/LogDownloadService.java

@@ -3,10 +3,7 @@ package com.galaxis.manatee.service;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.galaxis.manatee.constant.ChuanYunConstant;
-import com.galaxis.manatee.dao.ChuanyunGroupProjectDao;
-import com.galaxis.manatee.dao.ChuanyunLogDao;
-import com.galaxis.manatee.dao.ChuanyunUserCompanyDao;
-import com.galaxis.manatee.dao.ChuanyunUserDepartmentNameDao;
+import com.galaxis.manatee.dao.*;
 import com.galaxis.manatee.entity.chuanyun.data.object.*;
 import com.galaxis.manatee.entity.chuanyun.dto.Filter;
 import com.galaxis.manatee.manager.ChuanYunManager;
@@ -36,9 +33,12 @@ import java.util.Optional;
 @Service
 public class LogDownloadService {
 
-    @Autowired
     private WorkGroupService workGroupService;
 
+    private ChuanyunProjectDao chuanyunProjectDao;
+    private ChuanyunFactoryLocationDao factoryLocationDao;
+    private ChuanyunEquipmentProcessDao equipmentProcessDao;
+
     private final ChuanYunManager chuanYunManager;
     private final ChuanyunLogDao chuanyunLogDao;
     private final ChuanyunUserCompanyDao userCompanyDao;
@@ -53,6 +53,26 @@ public class LogDownloadService {
         this.chuanyunUserDepartmentNameDao = chuanyunUserDepartmentNameDao;
     }
 
+    @Autowired
+    public void setWorkGroupService(WorkGroupService workGroupService) {
+        this.workGroupService = workGroupService;
+    }
+
+    @Autowired
+    public void setChuanyunProjectDao(ChuanyunProjectDao chuanyunProjectDao) {
+        this.chuanyunProjectDao = chuanyunProjectDao;
+    }
+
+    @Autowired
+    public void setFactoryLocationDao(ChuanyunFactoryLocationDao factoryLocationDao) {
+        this.factoryLocationDao = factoryLocationDao;
+    }
+
+    @Autowired
+    public void setEquipmentProcessDao(ChuanyunEquipmentProcessDao equipmentProcessDao) {
+        this.equipmentProcessDao = equipmentProcessDao;
+    }
+
     /**
      * 更新日志数据
      *
@@ -101,7 +121,7 @@ public class LogDownloadService {
                 //获取项目总数
                 totalCount = chuanyunFindAllResponse.getReturnData().getTotalCount();
                 //保存
-                chuanyunLogDao.saveAll(result);
+                chuanyunLogDao.saveAllAndFlush(result);
             } catch (Exception e) {
                 log.error(e.getMessage());
                 e.printStackTrace();
@@ -152,26 +172,47 @@ public class LogDownloadService {
             //针对前期测试数据,可能出现日志为空的情况,跳过不处理
             chuanyunLogDO.getDayLogList().forEach(chuanyunDayLog -> {
                 // 补全工作组
-                if (ChuanYunConstant.LOG_WEEK_TYPE.contains(chuanyunLogDO.getDayOrWeek()) && ChuanYunConstant.NEED_WORK_GROUP_PROJECT_TYPE.contains(chuanyunDayLog.getProjectType())) {
-                    List<ChuanyunWeekLogDO> weekLogList = chuanyunLogDO.getWeekLogList();
-                    for (ChuanyunWeekLogDO chuanyunWeekLogDO : weekLogList) {
-                        if (Objects.equals(chuanyunDayLog.getProjectId(), chuanyunWeekLogDO.getProjectId())) {
-                            String workGroupId = chuanyunWeekLogDO.getWorkGroupId();
-                            chuanyunDayLog.setWorkGroupId(workGroupId);
-                            ChuanyunWorkGroupDO workGroupDO = workGroupService.findByObjectId(workGroupId);
-                            if (!Objects.isNull(workGroupDO)){
-                                chuanyunDayLog.setWorkGroupName(workGroupDO.getWorkGroupName());
-                            }else {
-                                ChuanyunHistoryWorkGroupDO historyWorkGroup = workGroupService.findInHistoryByObjectId(workGroupId);
-                                if (!Objects.isNull(historyWorkGroup)){
-                                    chuanyunDayLog.setWorkGroupName(historyWorkGroup.getWorkGroupName());
+                if (ChuanYunConstant.NEED_WORK_GROUP_PROJECT_TYPE.contains(chuanyunDayLog.getProjectType())) {
+                    if (ChuanYunConstant.LOG_WEEK_TYPE.contains(chuanyunLogDO.getDayOrWeek())) {
+                        List<ChuanyunWeekLogDO> weekLogList = chuanyunLogDO.getWeekLogList();
+                        for (ChuanyunWeekLogDO chuanyunWeekLogDO : weekLogList) {
+                            if (Objects.equals(chuanyunDayLog.getProjectId(), chuanyunWeekLogDO.getProjectId())) {
+                                String workGroupId = chuanyunWeekLogDO.getWorkGroupId();
+                                if (StringUtils.hasLength(workGroupId)) {
+                                    chuanyunDayLog.setWorkGroupId(workGroupId);
+                                    ChuanyunWorkGroupDO workGroupDO = workGroupService.findByObjectId(workGroupId);
+                                    if (!Objects.isNull(workGroupDO)) {
+                                        chuanyunDayLog.setWorkGroupName(workGroupDO.getWorkGroupName());
+                                    } else {
+                                        ChuanyunHistoryWorkGroupDO historyWorkGroup = workGroupService.findInHistoryByObjectId(workGroupId);
+                                        if (!Objects.isNull(historyWorkGroup)) {
+                                            chuanyunDayLog.setWorkGroupName(historyWorkGroup.getWorkGroupName());
+                                        }
+                                    }
+                                    break;
                                 }
                             }
-                            break;
+                        }
+                    } else if (ChuanYunConstant.LOG_FILL_IN_DAY.contains(chuanyunLogDO.getDayOrWeek()) && StringUtils.hasLength(chuanyunDayLog.getWorkGroupId())) {
+                        ChuanyunWorkGroupDO workGroupDO = workGroupService.findByObjectId(chuanyunDayLog.getWorkGroupId());
+                        if (!Objects.isNull(workGroupDO)) {
+                            chuanyunDayLog.setWorkGroupName(workGroupDO.getWorkGroupName());
+                        } else {
+                            ChuanyunHistoryWorkGroupDO historyWorkGroup = workGroupService.findInHistoryByObjectId(chuanyunDayLog.getWorkGroupId());
+                            if (!Objects.isNull(historyWorkGroup)) {
+                                chuanyunDayLog.setWorkGroupName(historyWorkGroup.getWorkGroupName());
+                            }
                         }
                     }
+
+                    if (!StringUtils.hasLength(chuanyunDayLog.getWorkGroupId())) {
+                        // 赋予默认工作组
+                        chuanyunDayLog.setWorkGroupId(ChuanYunConstant.DEFAULT_WORK_GROUP);
+                        chuanyunDayLog.setWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+                    }
                 }
 
+
                 //离职人员补全用户Id及部门ID
                 if (StringUtils.isEmpty(chuanyunLogDO.getUserId())) {
                     var name = "";
@@ -190,9 +231,24 @@ public class LogDownloadService {
                     if (!ChuanYunConstant.PRODUCTION_PROJECT.equals(chuanyunDayLog.getProjectType()) && StringUtils.isEmpty(chuanyunDayLog.getProjectId())) {
                         log.info(chuanyunLogDO + "");
                     } else if (!ChuanYunConstant.PRODUCTION_PROJECT.equals(chuanyunDayLog.getProjectType())) {
-                        ChuanyunGroupProjectDO chuanyunGroupProjectDO = chuanyunGroupProjectDao.findById(chuanyunDayLog.getProjectId()).orElseThrow();
-                        chuanyunDayLog.setProjectCode(chuanyunGroupProjectDO.getProjectCode());
+                        Optional<ChuanyunGroupProjectDO> gpOptional = chuanyunGroupProjectDao.findById(chuanyunDayLog.getProjectId());
+                        if (gpOptional.isPresent()) {
+                            chuanyunDayLog.setProjectCode(gpOptional.get().getProjectCode());
+                        } else {
+                            // 查询总况表
+                            Optional<ChuanyunProjectDO> projectDO = chuanyunProjectDao.findById(chuanyunDayLog.getProjectId());
+                            projectDO.ifPresent(chuanyunProjectDO -> chuanyunDayLog.setProjectCode(chuanyunProjectDO.getProjectCode()));
+                        }
                     }
+                    if (Objects.equals(ChuanYunConstant.PRODUCTION_PROJECT, chuanyunDayLog.getProjectType())) {
+                        String factoryLocationId = chuanyunDayLog.getFactoryLocationId();
+                        Optional<ChuanyunFactoryLocation> factoryLocationOptional = factoryLocationDao.findById(factoryLocationId);
+                        factoryLocationOptional.ifPresent(chuanyunFactoryLocation -> chuanyunDayLog.setFactoryLocationName(chuanyunFactoryLocation.getFactoryName()));
+                        String jobContentId = chuanyunDayLog.getJobContentId();
+                        Optional<ChuanyunEquipmentProcess> equipmentProcessOptional = equipmentProcessDao.findById(jobContentId);
+                        equipmentProcessOptional.ifPresent(chuanyunEquipmentProcess -> chuanyunDayLog.setJobContent(chuanyunEquipmentProcess.getProcedureInfo()));
+                    }
+
                 } catch (Exception e) {
                     e.printStackTrace();
                     log.warn(chuanyunDayLog + "");
@@ -230,8 +286,8 @@ public class LogDownloadService {
         List<String> matchersString = new ArrayList<>();
         //由于需要统计流程中的日志,在日志数据同步时将状态为2的数据一并统计
         matchersString.add("Status_6,[1;2;3]");
-        LocalDateTime localDateTimeStart = LocalDateTime.of(2022, 5, 1, 0, 0, 0);
-        LocalDateTime localDateTimeEnd = LocalDateTime.of(2022, 6, 30, 23, 59, 59);
+        LocalDateTime localDateTimeStart = LocalDateTime.of(2022, 8, 1, 0, 0, 0);
+        LocalDateTime localDateTimeEnd = LocalDateTime.of(2022, 8, 30, 23, 59, 59);
         matchersString.add("logDate_1," + TimeUtil.formatDateTime(localDateTimeStart));
         matchersString.add("logDate_3," + TimeUtil.formatDateTime(localDateTimeEnd));
         while (flag) {
@@ -267,7 +323,7 @@ public class LogDownloadService {
         log.info("最近一月历史日志信息保存" + totalCount);
     }
 
-    public void saveAllLog(){
+    public void saveAllLog() {
         var objectMapper = new ObjectMapper();
         var start = 0;
         var totalCount = 0L;

+ 3 - 10
src/main/java/com/galaxis/manatee/service/LogService.java

@@ -12,7 +12,6 @@ import com.galaxis.manatee.entity.chuanyun.dto.Filter;
 import com.galaxis.manatee.manager.ChuanYunManager;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
@@ -20,9 +19,7 @@ import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.List;
-import java.util.Objects;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * @author zcj
@@ -55,7 +52,6 @@ public class LogService {
     /**
      * 标准化所有周工时信息
      */
-    @Async("threadPoolTaskExecutor")
     public void standardAllWeekMemberHour() {
         long start = Instant.now().getEpochSecond();
         List<String> userIdList = chuanyunUserCompanyDao.findAll().stream().map(ChuanyunUserCompanyDO::getUserId).filter(StringUtils::hasLength).collect(Collectors.toList());
@@ -66,7 +62,6 @@ public class LogService {
     /**
      * 标准化一年内周工时信息
      */
-    @Async("threadPoolTaskExecutor")
     public void standardOneYearWeekMemberHour() {
         long start = Instant.now().getEpochSecond();
         List<String> userIdList = chuanyunUserCompanyDao.findAll().stream().map(ChuanyunUserCompanyDO::getUserId).filter(StringUtils::hasLength).collect(Collectors.toList());
@@ -77,7 +72,6 @@ public class LogService {
     /**
      * 标准化所有月工时
      */
-    @Async("threadPoolTaskExecutor")
     public void standardAllSelfCost() {
         long start = Instant.now().getEpochSecond();
         List<String> userIdList = chuanyunUserCompanyDao.findAll().stream().map(ChuanyunUserCompanyDO::getUserId).filter(StringUtils::hasLength).collect(Collectors.toList());
@@ -88,7 +82,6 @@ public class LogService {
     /**
      * 标准化一年内月工时
      */
-    @Async("threadPoolTaskExecutor")
     public void standardOneYearSelfCost() {
         long start = Instant.now().getEpochSecond();
         List<String> userIdList = chuanyunUserCompanyDao.findAll().stream().map(ChuanyunUserCompanyDO::getUserId).filter(StringUtils::hasLength).collect(Collectors.toList());
@@ -160,9 +153,9 @@ public class LogService {
 
     public void downloadLogByUserId(String userId) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        LocalDateTime localDateTime = LocalDateTime.now().minusDays(30);
+        LocalDateTime localDateTime = LocalDateTime.now().minusDays(9999);
         List<String> m = List.of("user_2," + userId, "Status_6,[1;2;3]", "logDate_1," + df.format(localDateTime));
-        Filter filter = Filter.instance(0, 100, true, Filter.AND, m);
+        Filter filter = Filter.instance(0, 500, true, Filter.AND, m);
 
         ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = null;
         try {
@@ -174,7 +167,7 @@ public class LogService {
         List<ChuanyunLogDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
         });
         //处理日志数据
-        result.forEach(logDownloadService::updateChuanyunLogData);
+        result.parallelStream().forEach(logDownloadService::updateChuanyunLogData);
         chuanyunLogDao.saveAll(result);
 
     }

+ 21 - 13
src/main/java/com/galaxis/manatee/service/LogStandardService.java

@@ -1,15 +1,12 @@
 package com.galaxis.manatee.service;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.galaxis.manatee.constant.ChuanYunConstant;
 import com.galaxis.manatee.dao.*;
 import com.galaxis.manatee.entity.chuanyun.data.object.*;
-import com.galaxis.manatee.entity.chuanyun.dto.Filter;
 import com.galaxis.manatee.manager.ChuanYunManager;
 import com.galaxis.manatee.mapper.WorkHourMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
@@ -17,7 +14,6 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.Instant;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -70,7 +66,6 @@ public class LogStandardService {
      * @param isRecent              是否只标准化最近一个月的数据
      * @param chuanyunUserCompanyDO 员工信息
      */
-    @Async("threadPoolTaskExecutor")
     public void standardHourByUserCompanyAndIsRecent(ChuanyunUserCompanyDO chuanyunUserCompanyDO, boolean isRecent) {
         if (!StringUtils.isEmpty(chuanyunUserCompanyDO.getUserId())) {
             long start = Instant.now().getEpochSecond();
@@ -87,7 +82,6 @@ public class LogStandardService {
     /**
      * 标准化最近一个月每周工时
      */
-    @Async("threadPoolTaskExecutor")
     public void standardWeekMemberHourRecent() {
         List<ChuanyunWeekMemberHourDO> list = chuanyunWeekMemberHourDao.getWeekMemberHourRecently();
         this.generateWeekMemberHourByWeekMemberHourList(list);
@@ -98,7 +92,6 @@ public class LogStandardService {
      *
      * @param userId 用户Id
      */
-    @Async("threadPoolTaskExecutor")
     public void standardSelfWorkHourByUserId(String userId) {
         if (!Objects.isNull(userId) && !userId.isBlank()) {
             log.info("标准化用户日工时 userId: {}", userId);
@@ -237,16 +230,17 @@ public class LogStandardService {
                 ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO = this.fromChuanyunWorkHourDO(self);
                 // 设置工作组和子工作组
                 String workGroupId = self.getWorkGroupId();
-                if (!Objects.isNull(workGroupId) && !workGroupId.isBlank()) {
-
+                if (!Objects.isNull(workGroupId) && !workGroupId.isBlank() && !Objects.equals(workGroupId,ChuanYunConstant.DEFAULT_WORK_GROUP)) {
                     ChuanyunWorkGroupDO workGroupDO = workGroupService.findByObjectId(workGroupId);
                     if (!Objects.isNull(workGroupDO)) {
+                        chuanyunSelfWorkHourDO.setWorkGroupId(workGroupId);
                         chuanyunSelfWorkHourDO.setWorkGroupName(workGroupDO.getWorkGroupName());
                         chuanyunSelfWorkHourDO.setSubWorkGroupName(workGroupDO.getSubWorkGroup());
                     } else {
                         // 从历史数据中查找
                         ChuanyunHistoryWorkGroupDO historyWorkGroup = workGroupService.findInHistoryByObjectId(workGroupId);
                         if (!Objects.isNull(historyWorkGroup)) {
+                            chuanyunSelfWorkHourDO.setWorkGroupId(workGroupId);
                             chuanyunSelfWorkHourDO.setWorkGroupName(historyWorkGroup.getWorkGroupName());
                             chuanyunSelfWorkHourDO.setSubWorkGroupName(historyWorkGroup.getSubWorkGroup());
                         }
@@ -254,6 +248,12 @@ public class LogStandardService {
                     }
 
                 }
+                if (Objects.equals(workGroupId, ChuanYunConstant.DEFAULT_WORK_GROUP) || !StringUtils.hasLength(workGroupId)) {
+                    // 如果都没有值的话,赋予默认工作组
+                    chuanyunSelfWorkHourDO.setWorkGroupId(ChuanYunConstant.DEFAULT_WORK_GROUP);
+                    chuanyunSelfWorkHourDO.setWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+                    chuanyunSelfWorkHourDO.setSubWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+                }
                 //查询系统中是否有重复的标准化工时数据,如果有重复的人、天、项目数据,将原数据删除后更新为最新的数据
                 try {
                     List<ChuanyunSelfWorkHourDO> list;
@@ -323,14 +323,14 @@ public class LogStandardService {
                 log.info("没有找到该项目");
                 // 查询总况表中的数据
                 Optional<ChuanyunProjectDO> projectDO = chuanyunProjectDao.findById(chuanyunWorkHourDO.getProjectId());
-                if (projectDO.isPresent()){
+                if (projectDO.isPresent()) {
                     projectCode = projectDO.get().getProjectCode();
                     ChuanyunGroupProjectDO projectByCode = chuanyunGroupProjectDao.findByProjectCode(projectCode);
                     projectType = projectByCode.getProjectType();
-                }else {
+                } else {
                     throw new Exception("没有找到对应的项目");
                 }
-            }else {
+            } else {
                 //如果找到相应的项目,则使用项目实际的项目类型
                 projectType = chuanyunGroupProject.getProjectType();
                 projectCode = chuanyunGroupProject.getProjectCode();
@@ -433,16 +433,18 @@ public class LogStandardService {
                 ChuanyunSelfWorkHourDO chuanyunSelfWorkHourDO = this.fromChuanyunWorkHourDO(self);
                 // 设置工作组和子工作组
                 String workGroupId = self.getWorkGroupId();
-                if (!Objects.isNull(workGroupId) && !workGroupId.isBlank()) {
+                if (!Objects.isNull(workGroupId) && !workGroupId.isBlank() && !Objects.equals(workGroupId, ChuanYunConstant.DEFAULT_WORK_GROUP)) {
 
                     ChuanyunWorkGroupDO workGroupDO = workGroupService.findByObjectId(workGroupId);
                     if (!Objects.isNull(workGroupDO)) {
+                        chuanyunSelfWorkHourDO.setWorkGroupId(workGroupId);
                         chuanyunSelfWorkHourDO.setWorkGroupName(workGroupDO.getWorkGroupName());
                         chuanyunSelfWorkHourDO.setSubWorkGroupName(workGroupDO.getSubWorkGroup());
                     } else {
                         // 从历史数据中查找
                         ChuanyunHistoryWorkGroupDO historyWorkGroup = workGroupService.findInHistoryByObjectId(workGroupId);
                         if (!Objects.isNull(historyWorkGroup)) {
+                            chuanyunSelfWorkHourDO.setWorkGroupId(workGroupId);
                             chuanyunSelfWorkHourDO.setWorkGroupName(historyWorkGroup.getWorkGroupName());
                             chuanyunSelfWorkHourDO.setSubWorkGroupName(historyWorkGroup.getSubWorkGroup());
                         }
@@ -450,6 +452,12 @@ public class LogStandardService {
                     }
 
                 }
+                if (Objects.equals(workGroupId, ChuanYunConstant.DEFAULT_WORK_GROUP) || !StringUtils.hasLength(workGroupId)) {
+                    // 如果都没有值的话,赋予默认工作组
+                    chuanyunSelfWorkHourDO.setWorkGroupId(ChuanYunConstant.DEFAULT_WORK_GROUP);
+                    chuanyunSelfWorkHourDO.setWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+                    chuanyunSelfWorkHourDO.setSubWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+                }
                 //查询系统中是否有重复的标准化工时数据,如果有重复的人、天、项目数据,将原数据删除后更新为最新的数据
                 try {
                     List<ChuanyunSelfWorkHourDO> list;

+ 1 - 1
src/main/java/com/galaxis/manatee/service/LogUpdateService.java

@@ -17,7 +17,6 @@ import org.springframework.data.domain.PageRequest;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
-import java.time.DayOfWeek;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -160,6 +159,7 @@ public class LogUpdateService {
                     chuanyunSelfWorkHourDTO.setBg("IBG");
                     chuanyunSelfWorkHourDTO.setDepartmentId(chuanyunSelfWorkHourDO.getDepartmentId());
                 }
+                chuanyunSelfWorkHourDTO.setOwnerId(chuanyunSelfWorkHourDTO.getUserId());
                 chuanyunSelfWorkHourDTO.setDepartmentName(chuanyunSelfWorkHourDO.getDepartmentName());
                 //更新到氚云
                 dataArcherService.updateSelfWorkHour(chuanyunSelfWorkHourDTO);

+ 98 - 42
src/main/java/com/galaxis/manatee/service/ProjectMemberService.java

@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 
 @Service
 @Slf4j
@@ -33,28 +34,35 @@ public class ProjectMemberService {
 
     @Async("threadPoolTaskExecutor")
     public void updateManagerMember(String param) throws InterruptedException {
-        TimeUnit.SECONDS.sleep(5);
         log.info("同步管理项目组成员");
-        var objectMapper=new ObjectMapper();
-        param=param.substring(14,param.length()-2);
+        var objectMapper = new ObjectMapper();
+        param = param.substring(14, param.length() - 2);
         log.info(param);
-        boolean updateFlag=false;
-        while (!updateFlag){
-            var chuanyunFindResponse =  chuanYunManager.find(ChuanyunManagerProjectDO.SCHEMA_CODE,param);
-            ChuanyunManagerProjectDO chuanyunManagerProjectDO = objectMapper.convertValue(chuanyunFindResponse.getReturnData().getBizObject(), new TypeReference<>(){});
-            if (chuanyunManagerProjectDO!=null){
-                updateFlag=true;
+        AtomicInteger atomicInteger = new AtomicInteger();
+        boolean updateFlag = false;
+        while (!updateFlag) {
+            int atomic = atomicInteger.getAndIncrement();
+            if (atomic >= 20) {
+                updateFlag = true;
+            }
+            TimeUnit.SECONDS.sleep(5);
+            var chuanyunFindResponse = chuanYunManager.find(ChuanyunManagerProjectDO.SCHEMA_CODE, param);
+            ChuanyunManagerProjectDO chuanyunManagerProjectDO = objectMapper.convertValue(chuanyunFindResponse.getReturnData().getBizObject(), new TypeReference<>() {
+            });
+            if (chuanyunManagerProjectDO != null) {
+                updateFlag = true;
                 try {
                     List<String> matchers = new ArrayList<>();
-                    matchers.add("F0000002_2,"+chuanyunManagerProjectDO.getSeqNo());
-                    var filter= Filter.instance(0,1,true,"And",matchers);
-                    ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE,filter);
-                    if (chuanyunFindAllResponse.getReturnData()!=null){
-                        List<ChuanyunGroupProjectDO> result=objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>(){});
-                        log.info("集团项目"+result.get(0));
+                    matchers.add("F0000002_2," + chuanyunManagerProjectDO.getSeqNo());
+                    var filter = Filter.instance(0, 1, true, "And", matchers);
+                    ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE, filter);
+                    if (chuanyunFindAllResponse.getReturnData() != null) {
+                        List<ChuanyunGroupProjectDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
+                        });
+                        log.info("集团项目" + result.get(0));
                         chuanyunBasicDataScheduledTask.chuanyunUpdateProjectMemberManually(result.get(0));
                     }
-                }catch (Exception e){
+                } catch (Exception e) {
                     e.printStackTrace();
                     log.warn(e.getMessage());
                 }
@@ -65,26 +73,32 @@ public class ProjectMemberService {
 
     @Async("threadPoolTaskExecutor")
     public void updateSaleMember(String param) throws InterruptedException {
-        TimeUnit.SECONDS.sleep(5);
         log.info("同步销售项目组成员");
-        var objectMapper=new ObjectMapper();
-        param=param.substring(14,param.length()-2);
+        var objectMapper = new ObjectMapper();
+        param = param.substring(14, param.length() - 2);
         log.info(param);
-        boolean updateFlag=false;
-        while (!updateFlag){
+        AtomicInteger atomicInteger = new AtomicInteger();
+        boolean updateFlag = false;
+        while (!updateFlag) {
+            int atomic = atomicInteger.getAndIncrement();
+            if (atomic >= 20) {
+                updateFlag = true;
+            }
             try {
+                TimeUnit.SECONDS.sleep(5);
                 List<String> matchers = new ArrayList<>();
-                matchers.add("F0000002_2,"+param);
-                var filter= Filter.instance(0,1,true,"And",matchers);
-                ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE,filter);
-                if (chuanyunFindAllResponse.getReturnData()!=null){
-                    updateFlag=true;
-                    List<ChuanyunGroupProjectDO> result=objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>(){});
-                    log.info("集团项目"+result.get(0));
+                matchers.add("F0000002_2," + param);
+                var filter = Filter.instance(0, 1, true, "And", matchers);
+                ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE, filter);
+                if (chuanyunFindAllResponse.getReturnData() != null) {
+                    updateFlag = true;
+                    List<ChuanyunGroupProjectDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
+                    });
+                    log.info("集团项目" + result.get(0));
                     chuanyunBasicDataScheduledTask.chuanyunUpdateProjectMemberManually(result.get(0));
                     log.info("销售项目更新项目组成员成功");
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
                 log.warn(e.getMessage());
             }
@@ -93,26 +107,68 @@ public class ProjectMemberService {
 
     @Async("threadPoolTaskExecutor")
     public void updateDevelopMember(String param) throws InterruptedException {
-        TimeUnit.SECONDS.sleep(5);
         log.info("同步研发项目组成员");
-        var objectMapper=new ObjectMapper();
-        param=param.substring(14,param.length()-2);
+        var objectMapper = new ObjectMapper();
+        param = param.substring(14, param.length() - 2);
         log.info(param);
-        boolean updateFlag=false;
-        while (!updateFlag){
+        boolean updateFlag = false;
+        AtomicInteger atomicInteger = new AtomicInteger();
+        while (!updateFlag) {
+            int atomic = atomicInteger.getAndIncrement();
+            if (atomic >= 20) {
+                updateFlag = true;
+            }
             try {
+                TimeUnit.SECONDS.sleep(5);
                 List<String> matchers = new ArrayList<>();
-                matchers.add("F0000002_2,"+param);
-                var filter= Filter.instance(0,1,true,"And",matchers);
-                ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE,filter);
-                if (chuanyunFindAllResponse.getReturnData()!=null){
-                    updateFlag=true;
-                    List<ChuanyunGroupProjectDO> result=objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>(){});
-                    log.info("集团项目"+result.get(0));
+                matchers.add("F0000002_2," + param);
+                var filter = Filter.instance(0, 1, true, "And", matchers);
+                ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE, filter);
+                if (chuanyunFindAllResponse.getReturnData() != null) {
+                    updateFlag = true;
+                    List<ChuanyunGroupProjectDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
+                    });
+                    log.info("集团项目" + result.get(0));
                     chuanyunBasicDataScheduledTask.chuanyunUpdateProjectMemberManually(result.get(0));
                     log.info("研发项目更新项目组成员成功");
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.warn(e.getMessage());
+            }
+        }
+    }
+
+    @Async("threadPoolTaskExecutor")
+    public void updateDeliveryMember(String param) throws InterruptedException {
+        log.info("同步交付类项目组成员");
+        var objectMapper = new ObjectMapper();
+        param = param.substring(14, param.length() - 2);
+        log.info(param);
+        boolean updateFlag = false;
+        AtomicInteger atomicInteger = new AtomicInteger();
+        while (!updateFlag) {
+            int atomic = atomicInteger.getAndIncrement();
+            if (atomic >= 20) {
+                updateFlag = true;
+            }
+            try {
+                TimeUnit.SECONDS.sleep(5);
+                List<String> matchers = new ArrayList<>();
+                matchers.add("F0000002_2," + param);
+                var filter = Filter.instance(0, 1, true, "And", matchers);
+                ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE, filter);
+                if (chuanyunFindAllResponse.getReturnData() != null) {
+                    updateFlag = true;
+                    List<ChuanyunGroupProjectDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
+                    });
+                    result.forEach(chuanyunGroupProjectDO -> {
+                        log.info("集团项目: {}", chuanyunGroupProjectDO);
+                        chuanyunBasicDataScheduledTask.chuanyunUpdateProjectMemberManually(chuanyunGroupProjectDO);
+                        log.info("交付类项目更新项目组成员成功");
+                    });
+                }
+            } catch (Exception e) {
                 e.printStackTrace();
                 log.warn(e.getMessage());
             }

+ 4 - 0
src/main/java/com/galaxis/manatee/service/WorkGroupService.java

@@ -11,7 +11,9 @@ public interface WorkGroupService {
 
     /**
      * 汇算工作组级别实施费用
+     * 已弃用
      */
+    @Deprecated
     void implCost();
 
     /**
@@ -37,4 +39,6 @@ public interface WorkGroupService {
 
     ChuanyunHistoryWorkGroupDO findInHistoryByObjectId(String objectId);
 
+    void implAllCost();
+
 }

+ 23 - 1
src/main/java/com/galaxis/manatee/service/impl/GroupProjectServiceImpl.java

@@ -1,9 +1,11 @@
 package com.galaxis.manatee.service.impl;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.galaxis.manatee.dao.ChuanyunGroupProjectDao;
 import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunGroupProjectDO;
+import com.galaxis.manatee.entity.chuanyun.dto.ChuanyunFindAllBizDTO;
 import com.galaxis.manatee.entity.chuanyun.dto.Filter;
 import com.galaxis.manatee.manager.ChuanYunManager;
 import com.galaxis.manatee.service.GroupProjectService;
@@ -11,8 +13,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 @Slf4j
 @Service
@@ -28,4 +30,24 @@ public class GroupProjectServiceImpl implements GroupProjectService {
     public List<ChuanyunGroupProjectDO> findAll() {
         return null;
     }
+
+    @Override
+    public List<ChuanyunGroupProjectDO> findByProjectCode(String projectCode) {
+        List<String> m3 = List.of("F0000002_2," + projectCode);
+        Filter instance = Filter.instance(0, 20, true, Filter.AND, m3);
+        ChuanyunFindAllBizDTO<Object> groupProjectResponse = null;
+        try {
+            groupProjectResponse = chuanYunManager.findAll(ChuanyunGroupProjectDO.SCHEMA_CODE, instance);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        if (Objects.isNull(groupProjectResponse) || !groupProjectResponse.getSuccessful() || groupProjectResponse.getReturnData() == null) {
+            return null;
+        }
+        ObjectMapper objectMapper = new ObjectMapper();
+        List<Object> bizObjectArray = groupProjectResponse.getReturnData().getBizObjectArray();
+        List<ChuanyunGroupProjectDO> groupProjectDOList = objectMapper.convertValue(bizObjectArray, new TypeReference<>() {
+        });
+        return groupProjectDOList;
+    }
 }

+ 64 - 0
src/main/java/com/galaxis/manatee/service/impl/ImplCostServiceImpl.java

@@ -0,0 +1,64 @@
+package com.galaxis.manatee.service.impl;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunImplCostDO;
+import com.galaxis.manatee.entity.chuanyun.dto.Filter;
+import com.galaxis.manatee.manager.ChuanYunManager;
+import com.galaxis.manatee.service.ImplCostService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@Service
+public class ImplCostServiceImpl implements ImplCostService {
+
+    private ChuanYunManager chuanYunManager;
+
+    @Autowired
+    public void setChuanYunManager(ChuanYunManager chuanYunManager) {
+        this.chuanYunManager = chuanYunManager;
+    }
+
+    @Override
+    public List<ChuanyunImplCostDO> findAllInChuanyun() {
+        List<ChuanyunImplCostDO> implCostList = new ArrayList<>();
+        ObjectMapper objectMapper = new ObjectMapper();
+        int start = 0;
+        long totalCount = 0L;
+        boolean flag = true;
+        int pageSize = 100;
+        while (flag) {
+            try {
+                //从氚云查询数据
+                var filter = Filter.instance(start, start + pageSize, true);
+                var chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunImplCostDO.SCHEMA_CODE, filter);
+                if (chuanyunFindAllResponse.getReturnData() == null || chuanyunFindAllResponse.getReturnData().getBizObjectArray() == null) {
+                    flag = false;
+                    continue;
+                }
+                if (chuanyunFindAllResponse.getReturnData().getTotalCount() >= start + pageSize) {
+                    start += pageSize;
+                } else {
+                    flag = false;
+                }
+                //获取项目总数
+                totalCount = chuanyunFindAllResponse.getReturnData().getTotalCount();
+                //保存
+                List<Object> bizObjectArray = chuanyunFindAllResponse.getReturnData().getBizObjectArray();
+                List<ChuanyunImplCostDO> bpList = objectMapper.convertValue(bizObjectArray, new TypeReference<>() {
+                });
+                implCostList.addAll(bpList);
+            } catch (Exception e) {
+                log.error(e.getMessage());
+                e.printStackTrace();
+            }
+
+        }
+        return implCostList;
+    }
+}

+ 380 - 51
src/main/java/com/galaxis/manatee/service/impl/WorkGroupServiceImpl.java

@@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.galaxis.manatee.constant.ChuanYunConstant;
 import com.galaxis.manatee.dao.ChuanyunImplCostDao;
+import com.galaxis.manatee.dao.ChuanyunMonthLaborCostWgDao;
 import com.galaxis.manatee.dao.ChuanyunReimbursementDao;
 import com.galaxis.manatee.dao.ChuanyunSelfWorkHourDao;
 import com.galaxis.manatee.entity.chuanyun.data.object.*;
@@ -12,20 +14,23 @@ import com.galaxis.manatee.entity.chuanyun.dto.*;
 import com.galaxis.manatee.event.PushImplCostEvent;
 import com.galaxis.manatee.exception.BigSizeException;
 import com.galaxis.manatee.manager.ChuanYunManager;
+import com.galaxis.manatee.service.GroupProjectService;
 import com.galaxis.manatee.service.WorkGroupService;
+import com.galaxis.manatee.util.CollectionsUtils;
+import com.galaxis.manatee.util.TimeUtil;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 工作组相关操作
@@ -34,21 +39,49 @@ import java.util.Optional;
 @Service
 public class WorkGroupServiceImpl implements WorkGroupService {
 
-    @Autowired
     private ChuanYunManager chuanYunManager;
+    private ChuanyunImplCostDao implCostDao;
+    private ChuanyunReimbursementDao reimbursementDao;
+    private ChuanyunSelfWorkHourDao selfWorkHourDao;
+    private ApplicationContext applicationContext;
+    private ChuanyunMonthLaborCostWgDao chuanyunMonthLaborCostWgDao;
+    private GroupProjectService groupProjectService;
+
 
     @Autowired
-    private ChuanyunImplCostDao implCostDao;
+    public void setChuanYunManager(ChuanYunManager chuanYunManager) {
+        this.chuanYunManager = chuanYunManager;
+    }
 
     @Autowired
-    private ChuanyunReimbursementDao reimbursementDao;
+    public void setChuanYunManager(ChuanyunImplCostDao implCostDao) {
+        this.implCostDao = implCostDao;
+    }
 
     @Autowired
-    private ChuanyunSelfWorkHourDao selfWorkHourDao;
+    public void setReimbursementDao(ChuanyunReimbursementDao reimbursementDao) {
+        this.reimbursementDao = reimbursementDao;
+    }
 
     @Autowired
-    private ApplicationContext applicationContext;
+    public void setSelfWorkHourDao(ChuanyunSelfWorkHourDao selfWorkHourDao) {
+        this.selfWorkHourDao = selfWorkHourDao;
+    }
+
+    @Autowired
+    public void setApplicationContext(ApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+
+    @Autowired
+    public void setChuanyunMonthLaborCostWgDao(ChuanyunMonthLaborCostWgDao chuanyunMonthLaborCostWgDao) {
+        this.chuanyunMonthLaborCostWgDao = chuanyunMonthLaborCostWgDao;
+    }
 
+    @Autowired
+    public void setGroupProjectService(GroupProjectService groupProjectService) {
+        this.groupProjectService = groupProjectService;
+    }
 
     /**
      * 汇算工作组级别实施费用
@@ -61,7 +94,7 @@ public class WorkGroupServiceImpl implements WorkGroupService {
         // 查询组织架构录入
         final Object monitor = new Object();
         buildProjectList.parallelStream().forEach(chuanyunBuildProject -> {
-            synchronized (monitor){
+            synchronized (monitor) {
                 String buildProjectId = chuanyunBuildProject.getObjectId();
                 List<String> m1 = List.of("F0000001_2," + buildProjectId);
                 Filter filter = Filter.instance(0, 10, true, Filter.AND, m1);
@@ -104,7 +137,7 @@ public class WorkGroupServiceImpl implements WorkGroupService {
                         } catch (JsonProcessingException e) {
                             e.printStackTrace();
                         }
-                        if (!groupProjectResponse.getSuccessful() || groupProjectResponse.getReturnData() == null) {
+                        if (Objects.isNull(groupProjectResponse) || !groupProjectResponse.getSuccessful() || groupProjectResponse.getReturnData() == null) {
                             return;
                         }
                         List<Object> bizObjectArray = groupProjectResponse.getReturnData().getBizObjectArray();
@@ -115,49 +148,99 @@ public class WorkGroupServiceImpl implements WorkGroupService {
                             ChuanyunGroupProjectDO chuanyunGroupProjectDO = groupProjectDO.get();
                             List<String> userIdList = chuanyunWorkGroupDO.getSubWorkGroupMemberObject().stream().map(BasicSubDO::getObjectId).toList();
                             // 查询报销单
-                            BigDecimal total = new BigDecimal("0.00");
-                            BigDecimal totalManDay = new BigDecimal("0.000");
-                            // 查询项目工作组人天
+                            Map<LocalDate, List<ChuanyunReimbursementDO>> reimbursementMap = new HashMap<>();
+                            Map<LocalDate, List<ChuanyunSelfWorkHourDO>> workHoursMap = new HashMap<>();
+
                             for (String userId : userIdList) {
                                 // 查询用户在该项目的报销单
                                 List<ChuanyunReimbursementDO> reimbursements = reimbursementDao.findAllByGroupProjectIdAndReimburseUserIdAndStatusIn(chuanyunGroupProjectDO.getObjectId(), userId, List.of(1, 2));
-                                BigDecimal totalReim = reimbursements.stream().map(ChuanyunReimbursementDO::getTotalAmountNotTaxed).reduce(BigDecimal.ZERO, BigDecimal::add);
-                                total = total.add(totalReim);
+                                // 报销单按日期分组
+                                Map<LocalDate, List<ChuanyunReimbursementDO>> map1 = reimbursements.stream().collect(Collectors.groupingBy(chuanyunReimbursementDO -> LocalDate.of(chuanyunReimbursementDO.getBusinessDate().getYear(), chuanyunReimbursementDO.getBusinessDate().getMonthValue(), 1)));
+                                map1.forEach((localDate, chuanyunReimbursementDOS) -> {
+                                    boolean containsKey = reimbursementMap.containsKey(localDate);
+                                    if (containsKey) {
+                                        // 表示已经存在该key
+                                        List<ChuanyunReimbursementDO> reimbursementDOList = reimbursementMap.get(localDate);
+                                        reimbursementDOList.addAll(chuanyunReimbursementDOS);
+                                        reimbursementMap.put(localDate, reimbursementDOList);
+                                    } else {
+                                        reimbursementMap.put(localDate, chuanyunReimbursementDOS);
+                                    }
+                                });
                                 List<ChuanyunSelfWorkHourDO> workHours = selfWorkHourDao.findAllByProjectIdAndUserIdAndStatusIn(chuanyunGroupProjectDO.getObjectId(), userId, List.of("1", "2"));
-                                BigDecimal totalWorkHour = workHours.stream().map(ChuanyunSelfWorkHourDO::getStandardWorkHour).reduce(BigDecimal.ZERO, BigDecimal::add);
-                                // 人天
-                                BigDecimal manDay = totalWorkHour.divide(BigDecimal.valueOf(8), 3, RoundingMode.UP);
-                                totalManDay = totalManDay.add(manDay);
-
+                                Map<LocalDate, List<ChuanyunSelfWorkHourDO>> map2 = workHours.stream().collect(Collectors.groupingBy(chuanyunSelfWorkHourDO -> LocalDate.of(chuanyunSelfWorkHourDO.getDayLogDate().getYear(), chuanyunSelfWorkHourDO.getDayLogDate().getMonthValue(), 1)));
+                                map2.forEach((localDate, chuanyunSelfWorkHourDOS) -> {
+                                    boolean containsKey = workHoursMap.containsKey(localDate);
+                                    if (containsKey) {
+                                        // 表示已经存在该key
+                                        List<ChuanyunSelfWorkHourDO> selfWorkHours = workHoursMap.get(localDate);
+                                        selfWorkHours.addAll(chuanyunSelfWorkHourDOS);
+                                        workHoursMap.put(localDate, selfWorkHours);
+                                    } else {
+                                        workHoursMap.put(localDate, chuanyunSelfWorkHourDOS);
+                                    }
+                                });
                             }
-                            // 统计工作组所有的工时
-                            String projectObjectId = chuanyunGroupProjectDO.getObjectId();
-                            String projectCode = chuanyunGroupProjectDO.getProjectCode();
-                            String workGroupId = chuanyunWorkGroupDO.getObjectId();
-
-                            ChuanyunImplCostDO old = implCostDao.findByProjectIdAndProjectCodeAndWorkGroup(projectObjectId, projectCode, workGroupId);
-                            if (!Objects.isNull(old)) {
-                                BigDecimal oldImplCost = old.getImplCost();
-                                BigDecimal oldManDay = old.getManDay();
-                                if (Objects.isNull(oldImplCost) || Objects.isNull(oldManDay) || oldImplCost.compareTo(total) != 0 || oldManDay.compareTo(totalManDay) != 0) {
-                                    old.setImplCost(total);
-                                    old.setManDay(totalManDay);
-                                    implCostDao.save(old);
+
+                            Set<LocalDate> localDates = reimbursementMap.keySet();
+                            Set<LocalDate> localDates1 = workHoursMap.keySet();
+                            Set<LocalDate> mergeCollections = CollectionsUtils.mergeCollections(localDates, localDates1);
+
+                            mergeCollections.forEach(localDate -> {
+                                BigDecimal totalReimbursement;
+                                BigDecimal totalManDay;
+                                List<ChuanyunReimbursementDO> reimbursements = reimbursementMap.getOrDefault(localDate, Collections.emptyList());
+                                if (reimbursements.isEmpty()) {
+                                    totalReimbursement = new BigDecimal("0.00");
+                                } else {
+                                    totalReimbursement = reimbursements.stream().map(ChuanyunReimbursementDO::getTotalAmountNotTaxed).reduce(BigDecimal.ZERO, BigDecimal::add);
                                 }
-                            } else {
-                                ChuanyunImplCostDO chuanyunImplCostDO = new ChuanyunImplCostDO();
-                                chuanyunImplCostDO.setProjectId(projectObjectId);
-                                chuanyunImplCostDO.setProjectCode(projectCode);
-                                chuanyunImplCostDO.setWorkGroup(workGroupId);
-                                chuanyunImplCostDO.setWorkGroupName(chuanyunWorkGroupDO.getWorkGroupName());
-                                chuanyunImplCostDO.setImplCost(total);
-                                chuanyunImplCostDO.setManDay(totalManDay);
-                                implCostDao.saveAndFlush(chuanyunImplCostDO);
-                            }
+                                List<ChuanyunSelfWorkHourDO> selfWorkHours = workHoursMap.getOrDefault(localDate, Collections.emptyList());
+                                if (selfWorkHours.isEmpty()) {
+                                    totalManDay = new BigDecimal("0.00");
+                                } else {
+                                    BigDecimal totalWorkHours = selfWorkHours.stream().map(ChuanyunSelfWorkHourDO::getStandardWorkHour).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                    totalManDay = totalWorkHours.divide(BigDecimal.valueOf(8), 3, RoundingMode.UP);
+                                }
+                                // 统计工作组所有的工时
+                                String projectObjectId = chuanyunGroupProjectDO.getObjectId();
+                                String projectCode = chuanyunGroupProjectDO.getProjectCode();
+                                String workGroupId = chuanyunWorkGroupDO.getObjectId();
+                                // 查询人力成本
+                                List<ChuanyunMonthLaborCostWgDTO> laborCostWgs = chuanyunMonthLaborCostWgDao.findAllByProjectCodeAndLogDateAndWorkGroupId(projectCode, localDate.atStartOfDay(), workGroupId);
+                                BigDecimal totalLaborCost = laborCostWgs.stream().map(ChuanyunMonthLaborCostWgDTO::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                ChuanyunImplCostDO old = implCostDao.findByProjectIdAndProjectCodeAndWorkGroupAndLocalDate(projectObjectId, projectCode, workGroupId, localDate.atStartOfDay());
+                                if (!Objects.isNull(old)) {
+                                    BigDecimal oldImplCost = old.getImplCost();
+                                    BigDecimal oldManDay = old.getManDay();
+                                    BigDecimal oldLaborCost = old.getLaborCost();
+                                    if (Objects.isNull(old.getLocalDate()) || Objects.isNull(oldImplCost) ||
+                                            Objects.isNull(oldManDay) || Objects.isNull(oldLaborCost) || oldImplCost.compareTo(totalReimbursement) != 0 ||
+                                            oldManDay.compareTo(totalManDay) != 0 || oldLaborCost.compareTo(totalLaborCost) != 0) {
+                                        old.setImplCost(totalReimbursement);
+                                        old.setManDay(totalManDay);
+                                        old.setLaborCost(totalLaborCost);
+                                        implCostDao.saveAndFlush(old);
+                                    }
+                                } else {
+                                    ChuanyunImplCostDO chuanyunImplCostDO = new ChuanyunImplCostDO();
+                                    chuanyunImplCostDO.setProjectId(projectObjectId);
+                                    chuanyunImplCostDO.setProjectCode(projectCode);
+                                    chuanyunImplCostDO.setLocalDate(localDate.atStartOfDay());
+                                    chuanyunImplCostDO.setWorkGroup(workGroupId);
+                                    chuanyunImplCostDO.setWorkGroupName(chuanyunWorkGroupDO.getWorkGroupName());
+                                    chuanyunImplCostDO.setImplCost(totalReimbursement);
+                                    chuanyunImplCostDO.setManDay(totalManDay);
+                                    chuanyunImplCostDO.setLaborCost(totalLaborCost);
+                                    implCostDao.saveAndFlush(chuanyunImplCostDO);
+                                }
+
+                            });
                         }
                     });
 
                 });
+
             }
         });
 
@@ -170,6 +253,7 @@ public class WorkGroupServiceImpl implements WorkGroupService {
 
     private List<ChuanyunBuildProject> findAll() {
         ArrayList<ChuanyunBuildProject> buildProjects = new ArrayList<>();
+        ObjectMapper objectMapper = new ObjectMapper();
         int start = 0;
         long totalCount = 0L;
         boolean flag = true;
@@ -193,7 +277,6 @@ public class WorkGroupServiceImpl implements WorkGroupService {
                 totalCount = chuanyunFindAllResponse.getReturnData().getTotalCount();
                 //保存
                 List<Object> bizObjectArray = chuanyunFindAllResponse.getReturnData().getBizObjectArray();
-                ObjectMapper objectMapper = new ObjectMapper();
                 List<ChuanyunBuildProject> bpList = objectMapper.convertValue(bizObjectArray, new TypeReference<>() {
                 });
                 buildProjects.addAll(bpList);
@@ -215,7 +298,9 @@ public class WorkGroupServiceImpl implements WorkGroupService {
             String projectId = implCostDO.getProjectId();
             String projectCode = implCostDO.getProjectCode();
             String workGroup = implCostDO.getWorkGroup();
-            List<String> m = List.of("F0000001_2," + projectId, "F0000002_2," + projectCode, "F0000006_2," + workGroup);
+            LocalDateTime localDate = implCostDO.getLocalDate();
+            // 时间转换为氚云的格式
+            List<String> m = List.of("F0000001_2," + projectId, "F0000002_2," + projectCode, "F0000006_2," + workGroup, "F0000008_2," + TimeUtil.formatDateTime(localDate));
             Filter filter = Filter.instance(0, 10, true, Filter.AND, m);
             ChuanyunFindAllBizDTO<Object> implCostResponse = null;
             try {
@@ -233,11 +318,13 @@ public class WorkGroupServiceImpl implements WorkGroupService {
                     if (implCostOptional.isPresent()) {
                         ChuanyunImplCostDO chuanyunImplCostDO = implCostOptional.get();
                         if (Objects.isNull(chuanyunImplCostDO.getImplCost()) || Objects.isNull(chuanyunImplCostDO.getManDay()) ||
+                                Objects.isNull(chuanyunImplCostDO.getLaborCost()) ||
                                 chuanyunImplCostDO.getImplCost().compareTo(implCostDO.getImplCost()) != 0 ||
-                                chuanyunImplCostDO.getManDay().compareTo(implCostDO.getManDay()) != 0) {
+                                chuanyunImplCostDO.getManDay().compareTo(implCostDO.getManDay()) != 0 ||
+                                chuanyunImplCostDO.getLaborCost().compareTo(implCostDO.getLaborCost()) != 0) {
                             // 工作组实施费用发生变化
                             log.info("更新项目工作组实施费用");
-                            ImplCostUpdateDTO implCostUpdateDTO = new ImplCostUpdateDTO(implCostDO.getImplCost(), implCostDO.getManDay());
+                            ImplCostUpdateDTO implCostUpdateDTO = new ImplCostUpdateDTO(implCostDO.getImplCost(), implCostDO.getManDay(), implCostDO.getLaborCost());
                             try {
                                 String updateStr = objectMapper.writeValueAsString(implCostUpdateDTO);
                                 chuanYunManager.update(ChuanyunImplCostDO.SCHEMA_CODE, chuanyunImplCostDO.getObjectId(), updateStr);
@@ -274,9 +361,13 @@ public class WorkGroupServiceImpl implements WorkGroupService {
         @JsonProperty("F0000007")
         private BigDecimal manDay;
 
-        public ImplCostUpdateDTO(BigDecimal implCost, BigDecimal manDay) {
+        @JsonProperty("F0000009")
+        private BigDecimal laborCost;
+
+        public ImplCostUpdateDTO(BigDecimal implCost, BigDecimal manDay, BigDecimal laborCost) {
             this.implCost = implCost;
             this.manDay = manDay;
+            this.laborCost = laborCost;
         }
     }
 
@@ -294,6 +385,13 @@ public class WorkGroupServiceImpl implements WorkGroupService {
                 }
             }
         }
+        if (Objects.equals(ChuanYunConstant.DEFAULT_WORK_GROUP, objectId)) {
+            ChuanyunWorkGroupDO workGroupDO = new ChuanyunWorkGroupDO();
+            workGroupDO.setWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+            workGroupDO.setSubWorkGroup(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+            workGroupDO.setObjectId(objectId);
+            return workGroupDO;
+        }
         log.warn("无该工作组");
         return null;
     }
@@ -338,9 +436,240 @@ public class WorkGroupServiceImpl implements WorkGroupService {
                 }
             }
         }
-        log.warn("组织架构查询中无该工作组");
+        if (Objects.equals(ChuanYunConstant.DEFAULT_WORK_GROUP, objectId)) {
+            ChuanyunHistoryWorkGroupDO historyWorkGroupDO = new ChuanyunHistoryWorkGroupDO();
+            historyWorkGroupDO.setWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+            historyWorkGroupDO.setSubWorkGroup(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+            historyWorkGroupDO.setObjectId(objectId);
+            return historyWorkGroupDO;
+        }
+        log.warn("组织架构查询中无该工作组 workGroupId: {}", objectId);
         return null;
     }
 
 
+    @Override
+    public void implAllCost() {
+        // 查询立项表中数据
+        List<ChuanyunBuildProject> buildProjectList = findAll();
+        ObjectMapper objectMapper = new ObjectMapper();
+        // 查询组织架构录入
+        final Object monitor = new Object();
+        buildProjectList.parallelStream().forEach(chuanyunBuildProject -> {
+            log.info("汇算项目成本数据chuanyunBuildProject: {}", chuanyunBuildProject);
+            synchronized (monitor) {
+                // 查询总表中的项目id
+                // 查询该项目在总表中的记录
+                List<ChuanyunGroupProjectDO> groupProjectDOList = groupProjectService.findByProjectCode(chuanyunBuildProject.getProjectCode());
+                if (!Objects.isNull(groupProjectDOList)) {
+                    if (groupProjectDOList.isEmpty()) {
+                        log.info("集团项目总表找不到对应项目 chuanyunBuildProject: {}", chuanyunBuildProject);
+                        return;
+                    }
+
+                    groupProjectDOList.forEach(chuanyunGroupProjectDO -> {
+                        String groupProjectObjectId = chuanyunGroupProjectDO.getObjectId();
+                        String groupProjectCode = chuanyunGroupProjectDO.getProjectCode();
+                        // 查询项目报销单
+                        Map<LocalDate, List<ChuanyunReimbursementDO>> reimbursementMap = new HashMap<>();
+                        Map<LocalDate, List<ChuanyunSelfWorkHourDO>> workHoursMap = new HashMap<>();
+                        Map<LocalDate, List<ChuanyunMonthLaborCostWgDTO>> laborCostMap = new HashMap<>();
+                        List<ChuanyunReimbursementDO> reimbursements = reimbursementDao.findAllByGroupProjectIdAndStatusIn(chuanyunGroupProjectDO.getObjectId(), List.of(1, 2));
+                        // 查询用户在该项目的报销单
+                        // 报销单按日期分组
+                        Map<LocalDate, List<ChuanyunReimbursementDO>> map1 = reimbursements.stream().collect(Collectors.groupingBy(chuanyunReimbursementDO -> {
+                            if (!Objects.isNull(chuanyunReimbursementDO.getBusinessDate())) {
+                                return LocalDate.of(chuanyunReimbursementDO.getBusinessDate().getYear(), chuanyunReimbursementDO.getBusinessDate().getMonthValue(), 1);
+                            } else {
+                                return LocalDate.of(2015, 1, 1);
+                            }
+                        }));
+
+                        map1.forEach((localDate, chuanyunReimbursementDOS) -> {
+                            boolean containsKey = reimbursementMap.containsKey(localDate);
+                            if (containsKey) {
+                                // 表示已经存在该key
+                                List<ChuanyunReimbursementDO> reimbursementDOList = reimbursementMap.get(localDate);
+                                reimbursementDOList.addAll(chuanyunReimbursementDOS);
+                                reimbursementMap.put(localDate, reimbursementDOList);
+                            } else {
+                                reimbursementMap.put(localDate, chuanyunReimbursementDOS);
+                            }
+                        });
+
+                        List<ChuanyunSelfWorkHourDO> workHours = selfWorkHourDao.findAllByProjectIdAndStatusIn(groupProjectObjectId, List.of("1", "2"));
+                        Map<LocalDate, List<ChuanyunSelfWorkHourDO>> map2 = workHours.stream().collect(Collectors.groupingBy(chuanyunSelfWorkHourDO -> {
+                            if (!Objects.isNull(chuanyunSelfWorkHourDO.getDayLogDate())) {
+                                return LocalDate.of(chuanyunSelfWorkHourDO.getDayLogDate().getYear(), chuanyunSelfWorkHourDO.getDayLogDate().getMonthValue(), 1);
+                            } else {
+                                return LocalDate.of(2015, 1, 1);
+                            }
+                        }));
+                        map2.forEach((localDate, chuanyunSelfWorkHourDOS) -> {
+                            boolean containsKey = workHoursMap.containsKey(localDate);
+                            if (containsKey) {
+                                // 表示已经存在该key
+                                List<ChuanyunSelfWorkHourDO> selfWorkHours = workHoursMap.get(localDate);
+                                selfWorkHours.addAll(chuanyunSelfWorkHourDOS);
+                                workHoursMap.put(localDate, selfWorkHours);
+                            } else {
+                                workHoursMap.put(localDate, chuanyunSelfWorkHourDOS);
+                            }
+                        });
+
+                        List<ChuanyunMonthLaborCostWgDTO> laborCostWgs = chuanyunMonthLaborCostWgDao.findAllByProjectCode(groupProjectCode);
+                        Map<LocalDate, List<ChuanyunMonthLaborCostWgDTO>> map3 = laborCostWgs.stream().collect(Collectors.groupingBy(chuanyunMonthLaborCostWgDTO -> {
+                            if (!Objects.isNull(chuanyunMonthLaborCostWgDTO.getLogDate())) {
+                                return LocalDate.of(chuanyunMonthLaborCostWgDTO.getLogDate().getYear(), chuanyunMonthLaborCostWgDTO.getLogDate().getMonthValue(), 1);
+                            } else {
+                                return LocalDate.of(2015, 1, 1);
+                            }
+
+                        }));
+                        map3.forEach((localDate, chuanyunMonthLaborCostWgDTOS) -> {
+                            boolean containsKey = laborCostMap.containsKey(localDate);
+                            if (containsKey) {
+                                // 表示已经存在该key
+                                List<ChuanyunMonthLaborCostWgDTO> monthLaborCostWgs = laborCostMap.get(localDate);
+                                monthLaborCostWgs.addAll(chuanyunMonthLaborCostWgDTOS);
+                                laborCostMap.put(localDate, monthLaborCostWgs);
+                            } else {
+                                laborCostMap.put(localDate, chuanyunMonthLaborCostWgDTOS);
+                            }
+                        });
+
+                        Set<LocalDate> localDates1 = reimbursementMap.keySet();
+                        Set<LocalDate> localDates2 = workHoursMap.keySet();
+                        Set<LocalDate> localDates3 = laborCostMap.keySet();
+
+                        Set<LocalDate> collections = CollectionsUtils.mergeCollections(localDates1, localDates2);
+                        Set<LocalDate> mergeCollections = CollectionsUtils.mergeCollections(collections, localDates3);
+
+                        mergeCollections.forEach(localDate -> {
+                            List<ChuanyunReimbursementDO> reimbursementList = reimbursementMap.getOrDefault(localDate, Collections.emptyList());
+                            List<ChuanyunSelfWorkHourDO> selfWorkHourList = workHoursMap.getOrDefault(localDate, Collections.emptyList());
+                            List<ChuanyunMonthLaborCostWgDTO> laborCostWgList = laborCostMap.getOrDefault(localDate, Collections.emptyList());
+
+                            Map<String, List<ChuanyunReimbursementDO>> workGroupIdReimbursementMap = reimbursementList.stream().collect(Collectors.groupingBy(chuanyunReimbursementDO -> {
+                                if (Objects.isNull(chuanyunReimbursementDO.getWorkGroupId()) || !StringUtils.hasLength(chuanyunReimbursementDO.getWorkGroupId())) {
+                                    return ChuanYunConstant.DEFAULT_WORK_GROUP;
+                                } else {
+                                    return chuanyunReimbursementDO.getWorkGroupId();
+                                }
+                            }));
+                            Map<String, List<ChuanyunSelfWorkHourDO>> workGroupIdSelfWorkHourMap = selfWorkHourList.stream().collect(Collectors.groupingBy(chuanyunSelfWorkHourDO -> {
+                                if (Objects.isNull(chuanyunSelfWorkHourDO.getWorkGroupId()) || !StringUtils.hasLength(chuanyunSelfWorkHourDO.getWorkGroupId())) {
+                                    return ChuanYunConstant.DEFAULT_WORK_GROUP;
+                                } else {
+                                    return chuanyunSelfWorkHourDO.getWorkGroupId();
+                                }
+                            }));
+                            Map<String, List<ChuanyunMonthLaborCostWgDTO>> workGroupIdLaborCostMap = laborCostWgList.stream().collect(Collectors.groupingBy(chuanyunMonthLaborCostWgDTO -> {
+                                if (Objects.isNull(chuanyunMonthLaborCostWgDTO.getWorkGroupId()) || !StringUtils.hasLength(chuanyunMonthLaborCostWgDTO.getWorkGroupId())) {
+                                    return ChuanYunConstant.DEFAULT_WORK_GROUP;
+                                } else {
+                                    return chuanyunMonthLaborCostWgDTO.getWorkGroupId();
+                                }
+                            }));
+
+                            Set<String> workGroup1 = workGroupIdReimbursementMap.keySet();
+                            Set<String> workGroup2 = workGroupIdSelfWorkHourMap.keySet();
+                            Set<String> workGroup3 = workGroupIdLaborCostMap.keySet();
+
+
+                            Set<String> workGroupMergeCollections = CollectionsUtils.mergeStringCollections(workGroup1, workGroup2, workGroup3);
+                            // 避免默认工作与实际工作组数据重复,可能会存在历史数据没有工作组,后面标准化的时候又补充了工作组信息。
+                            workGroupMergeCollections.add(ChuanYunConstant.DEFAULT_WORK_GROUP);
+
+                            workGroupMergeCollections.forEach(workGroupId -> {
+                                List<ChuanyunReimbursementDO> reimbursementDOList = workGroupIdReimbursementMap.getOrDefault(workGroupId, Collections.emptyList());
+                                List<ChuanyunSelfWorkHourDO> selfWorkHourDOS = workGroupIdSelfWorkHourMap.getOrDefault(workGroupId, Collections.emptyList());
+                                List<ChuanyunMonthLaborCostWgDTO> monthLaborCostWgDTOS = workGroupIdLaborCostMap.getOrDefault(workGroupId, Collections.emptyList());
+
+                                BigDecimal totalReimbursement;
+                                BigDecimal totalManDay;
+                                BigDecimal totalLaborCost;
+
+                                if (reimbursementDOList.isEmpty()) {
+                                    totalReimbursement = new BigDecimal("0.00");
+                                } else {
+                                    totalReimbursement = reimbursementDOList.stream().map(ChuanyunReimbursementDO::getTotalAmountNotTaxed).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                }
+
+                                if (selfWorkHourDOS.isEmpty()) {
+                                    totalManDay = new BigDecimal("0.00");
+                                } else {
+                                    BigDecimal totalWorkHours = selfWorkHourDOS.stream().map(ChuanyunSelfWorkHourDO::getStandardWorkHour).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                    totalManDay = totalWorkHours.divide(BigDecimal.valueOf(8), 3, RoundingMode.UP);
+                                }
+
+                                if (monthLaborCostWgDTOS.isEmpty()) {
+                                    totalLaborCost = new BigDecimal("0.00");
+                                } else {
+                                    totalLaborCost = monthLaborCostWgDTOS.stream().map(ChuanyunMonthLaborCostWgDTO::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                }
+
+                                ChuanyunImplCostDO old = implCostDao.findByProjectCodeAndWorkGroupAndLocalDate(groupProjectCode, workGroupId, localDate.atStartOfDay());
+                                if (!Objects.isNull(old)) {
+                                    BigDecimal oldImplCost = old.getImplCost();
+                                    BigDecimal oldManDay = old.getManDay();
+                                    BigDecimal oldLaborCost = old.getLaborCost();
+                                    if (Objects.isNull(old.getLocalDate()) ||
+                                            Objects.isNull(oldImplCost) ||
+                                            Objects.isNull(oldManDay) ||
+                                            Objects.isNull(oldLaborCost) ||
+                                            oldImplCost.compareTo(totalReimbursement) != 0 ||
+                                            oldManDay.compareTo(totalManDay) != 0 || oldLaborCost.compareTo(totalLaborCost) != 0) {
+                                        old.setImplCost(totalReimbursement);
+                                        old.setManDay(totalManDay);
+                                        old.setLaborCost(totalLaborCost);
+                                        if (!StringUtils.hasLength(old.getOwnerId()) && !Objects.isNull(chuanyunGroupProjectDO.getEbgProjectManagerObject())) {
+                                            old.setOwnerId(chuanyunGroupProjectDO.getEbgProjectManagerObject().getObjectId());
+                                        }
+                                        implCostDao.saveAndFlush(old);
+                                    }
+                                } else {
+                                    // 判断默认工作组数据
+                                    String defaultWorkGroupName = ChuanYunConstant.DEFAULT_WORK_GROUP_NAME;
+                                    ChuanyunWorkGroupDO workGroupDO = this.findByObjectId(workGroupId);
+                                    if (!Objects.isNull(workGroupDO)) {
+                                        defaultWorkGroupName = workGroupDO.getWorkGroupName();
+                                    } else {
+                                        ChuanyunHistoryWorkGroupDO historyWorkGroupDO = this.findInHistoryByObjectId(workGroupId);
+                                        if (!Objects.isNull(historyWorkGroupDO)) {
+                                            defaultWorkGroupName = historyWorkGroupDO.getWorkGroupName();
+                                        }
+                                    }
+                                    ChuanyunImplCostDO chuanyunImplCostDO = new ChuanyunImplCostDO();
+                                    chuanyunImplCostDO.setProjectId(chuanyunGroupProjectDO.getObjectId());
+                                    chuanyunImplCostDO.setProjectCode(groupProjectCode);
+                                    chuanyunImplCostDO.setLocalDate(localDate.atStartOfDay());
+                                    chuanyunImplCostDO.setWorkGroup(workGroupId);
+                                    chuanyunImplCostDO.setWorkGroupName(defaultWorkGroupName);
+                                    chuanyunImplCostDO.setImplCost(totalReimbursement);
+                                    chuanyunImplCostDO.setManDay(totalManDay);
+                                    chuanyunImplCostDO.setLaborCost(totalLaborCost);
+                                    if (!Objects.isNull(chuanyunGroupProjectDO.getEbgProjectManagerObject())) {
+
+                                        chuanyunImplCostDO.setOwnerId(chuanyunGroupProjectDO.getEbgProjectManagerObject().getObjectId());
+                                    }
+                                    implCostDao.saveAndFlush(chuanyunImplCostDO);
+                                }
+
+                            });
+
+                        });
+
+                    });
+                }
+            }
+        });
+
+
+        // 上传至氚云数据库,发布上传事件
+        log.info("发布工作组实施费用上传事件");
+        applicationContext.publishEvent(new PushImplCostEvent(this));
+
+    }
+
 }

+ 15 - 5
src/main/java/com/galaxis/manatee/task/ChuanyunBasicDataScheduledTask.java

@@ -27,7 +27,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
 import java.math.BigDecimal;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
@@ -133,8 +132,9 @@ public class ChuanyunBasicDataScheduledTask {
     /**
      * 定时将氚云中的数据保存到manatee
      */
-    @Scheduled(fixedDelay = 3600000L)
+    @Scheduled(cron = "0 0 0 * * *")
     private void scheduledGroupProject() {
+        // 项目成员已修改为触发式,无需高频率刷成员
         //获取集团项目数据
         getGroupProject();
     }
@@ -187,10 +187,18 @@ public class ChuanyunBasicDataScheduledTask {
         getOutDepartment();
         //更新业务招待申请
         updateBusinessEntertainment();
+    }
+
+    /**
+     * 定时将氚云中的数据保存到manatee
+     */
+    @Scheduled(fixedDelay = 3600000L)
+    private void scheduledProjectChange() {
         //项目实施变更
         saveProjectChange();
     }
 
+
     /**
      * 获取用户工号
      */
@@ -230,6 +238,7 @@ public class ChuanyunBasicDataScheduledTask {
         var objectMapper = new ObjectMapper();
         var start = 0;
         var totalCount = 0L;
+        var pageSize = 100;
         var flag = true;
 
         while (flag) {
@@ -326,11 +335,12 @@ public class ChuanyunBasicDataScheduledTask {
             }
             //保证项目成员信息更新成功
             boolean updateFlag = false;
-            int count = 0;
+            AtomicInteger atomicInteger = new AtomicInteger();
             while (!updateFlag) {
                 try {
-                    count++;
-                    if (count == 20){
+                    int count = atomicInteger.getAndIncrement();
+                    if (count >= 20){
+                        log.warn("请求次数过多,取消请求");
                         updateFlag = true;
                     }
                     // 再次将项目组成员设置进去。

+ 5 - 0
src/main/java/com/galaxis/manatee/task/ChuanyunFinancialScheduledTask.java

@@ -196,6 +196,11 @@ public class ChuanyunFinancialScheduledTask {
                                     });
                                 }
                             }
+                            // 任为空,则赋予默认值
+                            if (!StringUtils.hasLength(chuanyunReimbursementDO.getWorkGroupId()) && !StringUtils.hasLength(chuanyunReimbursementDO.getWorkGroupName())) {
+                                chuanyunReimbursementDO.setWorkGroupId(ChuanYunConstant.DEFAULT_WORK_GROUP);
+                                chuanyunReimbursementDO.setWorkGroupName(ChuanYunConstant.DEFAULT_WORK_GROUP_NAME);
+                            }
                         }
                     } catch (Exception e) {
                         log.warn(e.getMessage());

+ 1 - 1
src/main/java/com/galaxis/manatee/task/ChuanyunHumanResourceScheduledTask.java

@@ -60,7 +60,7 @@ public class ChuanyunHumanResourceScheduledTask {
     /**
      * 每天16点更新日志记录
      */
-    @Scheduled(cron = "0 0 16 * * ?")
+    @Scheduled(cron = "0 0 19 * * ?")
     private void updateLog() {
         log.info("开始更新集团日志");
         logDownloadService.saveChuanyunLogDO(false);

+ 94 - 9
src/main/java/com/galaxis/manatee/task/U9InfoTask.java

@@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.galaxis.manatee.capsule.dto.PageDTO;
 import com.galaxis.manatee.dao.*;
-import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunSubLaborCostDO;
 import com.galaxis.manatee.entity.chuanyun.data.object.*;
 import com.galaxis.manatee.entity.chuanyun.dto.*;
 import com.galaxis.manatee.exception.BigSizeException;
@@ -16,8 +15,10 @@ import com.galaxis.manatee.manager.ChuanYunManager;
 import com.galaxis.manatee.manager.ClawFeign;
 import com.galaxis.manatee.util.ChuanyunLocalDateTimeDeserializer;
 import com.galaxis.manatee.util.ChuanyunLocalDateTimeSerializer;
+import com.galaxis.manatee.util.TimeUtil;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -26,7 +27,6 @@ import javax.persistence.CascadeType;
 import javax.persistence.FetchType;
 import javax.persistence.OneToMany;
 import java.math.BigDecimal;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -44,6 +44,12 @@ public class U9InfoTask {
     private final ChuanyunUserDao chuanyunUserDao;
     private final ChuanyunOutDepartmentDao chuanyunOutDepartmentDao;
     private final ChuanyunSupplierDao chuanyunSupplierDao;
+    private ChuanyunMonthLaborCostWgDao chuanyunMonthLaborCostWgDao;
+
+    @Autowired
+    public void setChuanyunMonthLaborCostWgDao(ChuanyunMonthLaborCostWgDao chuanyunMonthLaborCostWgDao) {
+        this.chuanyunMonthLaborCostWgDao = chuanyunMonthLaborCostWgDao;
+    }
 
 
     public U9InfoTask(ChuanYunManager chuanYunManager, ClawFeign clawFeign, ChuanyunBudgetStatisticsDao chuanyunBudgetStatisticsDao, ChuanyunCompanyDao chuanyunCompanyDao, ChuanyunClientDao chuanyunClientDao, ChuanyunUserDao chuanyunUserDao, ChuanyunOutDepartmentDao chuanyunOutDepartmentDao, ChuanyunSupplierDao chuanyunSupplierDao) {
@@ -71,7 +77,7 @@ public class U9InfoTask {
     @Scheduled(cron = "0 0 3 * * *")
     private void getWorkGroupCost() {
         saveLaborCost();
-        saveLaborCostWg();
+        saveDbLaborCostWg();
         saveSubLaborCost();
     }
 
@@ -591,7 +597,7 @@ public class U9InfoTask {
     }
 
     public void saveLaborCostWgTest() {
-        saveLaborCostWg();
+        saveDbLaborCostWg();
     }
 
     /**
@@ -616,7 +622,7 @@ public class U9InfoTask {
                 break;
             }
             List<ChuanyunLaborCostWgDTO> list = pageInfo.getContent();
-            pageInfo.forEach(laborCostWgDTO -> {
+            list.parallelStream().forEach(laborCostWgDTO -> {
                 try {
                     if (!Objects.isNull(laborCostWgDTO)) {
                         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
@@ -636,8 +642,10 @@ public class U9InfoTask {
                         //根据项目号判断是否存在
                         List<String> matchers = new ArrayList<>();
                         matchers.add("F0000005_2," + laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getProjectcode());
-                        matchers.add("F0000002_2," + laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getPeriod());
-                        matchers.add("F0000018_2," + laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment());
+                        matchers.add("F0000002_2," + TimeUtil.formatDateTime(laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getPeriod()));
+                        if (StringUtils.hasLength(laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment())) {
+                            matchers.add("F0000018_2," + laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment());
+                        }
                         var filter = Filter.instance(0, 1, true, "And", matchers);
                         var chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunMonthLaborCostWgDO.SCHEMA_CODE, filter);
                         if (chuanyunFindAllResponse.getReturnData() == null) {
@@ -647,13 +655,20 @@ public class U9InfoTask {
                         } else {
                             List<ChuanyunMonthLaborCostWgDO> result = objectMapper.convertValue(chuanyunFindAllResponse.getReturnData().getBizObjectArray(), new TypeReference<>() {
                             });
-                            if (result.size() > 0) {
+                            if (result.size() == 1) {
+//                                result.forEach(chuanyunMonthLaborCostWgDO -> chuanYunManager.delete(ChuanyunMonthLaborCostWgDO.SCHEMA_CODE, chuanyunMonthLaborCostWgDO.getObjectId()));
+//                                chuanyunSaveDTO = chuanYunManager.save(ChuanyunMonthLaborCostWgDO.SCHEMA_CODE, purcostString, true);
+//                                log.info("工作组人力成本删除并新增成功");
                                 ChuanyunMonthLaborCostWgDO chuanyunMonthLaborCostWgDO = result.get(0);
                                 //更新
                                 if (chuanyunMonthLaborCostWgDO.getAmount().compareTo(laborCostWgDTO.getCostamount()) != 0) {
                                     chuanyunSaveDTO = chuanYunManager.update(ChuanyunMonthLaborCostWgDO.SCHEMA_CODE, chuanyunMonthLaborCostWgDO.getObjectId(), purcostString);
                                     log.info("工作组人力成本更新成功");
                                 }
+                            } else if (result.size() > 1) {
+                                result.forEach(chuanyunMonthLaborCostWgDO -> chuanYunManager.delete(ChuanyunMonthLaborCostWgDO.SCHEMA_CODE, chuanyunMonthLaborCostWgDO.getObjectId()));
+                                chuanyunSaveDTO = chuanYunManager.save(ChuanyunMonthLaborCostWgDO.SCHEMA_CODE, purcostString, true);
+                                log.info("工作组人力成本删除并新增成功");
                             }
                         }
                     }
@@ -665,6 +680,76 @@ public class U9InfoTask {
     }
 
     /**
+     * 新增项目工作组人力成本
+     */
+    private void saveDbLaborCostWg() {
+        log.info("开始保存项目工作组人力成本");
+        var page = 33;
+        var size = 1000;
+        var flag = true;
+        while (flag) {
+            Map<String, String> map = new HashMap<>(1);
+            map.put("page", String.valueOf(page));
+            map.put("size", String.valueOf(size));
+            //获取物料成本
+            PageDTO<ChuanyunLaborCostWgDTO> pageInfo = clawFeign.findChuanyunLaborCostWg(map);
+            if (page <= pageInfo.getTotalPages()) {
+                page += 1;
+            } else {
+                flag = false;
+                break;
+            }
+            List<ChuanyunLaborCostWgDTO> list = pageInfo.getContent();
+            list.forEach(laborCostWgDTO -> {
+                if (!Objects.isNull(laborCostWgDTO)) {
+                    // 保存至数据库
+                    // 查询数据库比较数据
+                    String projectCode = laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getProjectcode();
+                    LocalDateTime time = laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getPeriod();
+                    String department = laborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment();
+                    String workGroupId = laborCostWgDTO.getWorkgroupid();
+                    List<ChuanyunMonthLaborCostWgDTO> laborCostWg = chuanyunMonthLaborCostWgDao.findAllByProjectCodeAndLogDateAndWorkGroupIdAndDepartment(projectCode, time, workGroupId, department);
+
+                    if (laborCostWg.isEmpty()) {
+                        //新增
+                        SaveMonthLaborCostWg(laborCostWgDTO, projectCode, time, workGroupId, department);
+                    } else {
+                        if (laborCostWg.size() > 1) {
+                            chuanyunMonthLaborCostWgDao.deleteAll(laborCostWg);
+                            //新增
+                            SaveMonthLaborCostWg(laborCostWgDTO, projectCode, time, workGroupId, department);
+                        } else if (laborCostWg.size() == 1) {
+                            Optional<ChuanyunMonthLaborCostWgDTO> first = laborCostWg.stream().findFirst();
+                            ChuanyunMonthLaborCostWgDTO chuanyunMonthLaborCostWgDTO = first.get();
+                            BigDecimal amount = chuanyunMonthLaborCostWgDTO.getAmount();
+                            BigDecimal costAmount = laborCostWgDTO.getCostamount();
+                            if (amount.compareTo(costAmount) != 0) {
+                                chuanyunMonthLaborCostWgDTO.setAmount(amount);
+                                chuanyunMonthLaborCostWgDao.save(chuanyunMonthLaborCostWgDTO);
+                                log.info("人力成本发生变化,更新人力成本: {}", chuanyunMonthLaborCostWgDTO);
+                            }
+                        }
+                    }
+                }
+
+            });
+        }
+        log.info("工作组人力成本保存至数据库完成");
+    }
+
+    private void SaveMonthLaborCostWg(ChuanyunLaborCostWgDTO laborCostWgDTO, String projectCode, LocalDateTime time, String workGroupId, String department) {
+        ChuanyunMonthLaborCostWgDTO monthLaborCostWgDTO = new ChuanyunMonthLaborCostWgDTO();
+        monthLaborCostWgDTO.setProjectCode(projectCode);
+        monthLaborCostWgDTO.setWorkGroupId(workGroupId);
+        monthLaborCostWgDTO.setWorkGroupName(laborCostWgDTO.getWorkgroupname());
+        monthLaborCostWgDTO.setAmount(laborCostWgDTO.getCostamount());
+        monthLaborCostWgDTO.setLogDate(time);
+        monthLaborCostWgDTO.setDepartment(department);
+        monthLaborCostWgDTO.setDataType("U9");
+        chuanyunMonthLaborCostWgDao.save(monthLaborCostWgDTO);
+    }
+
+    /**
      * 更新子项目人力成本
      */
     private void saveSubLaborCost() {
@@ -952,7 +1037,7 @@ public class U9InfoTask {
                     this.logDate = chuanyunMonthLaborCostWgDTO.getChuanyunLaborCostPrimaryKey().getPeriod();
                 }
                 if (null != chuanyunMonthLaborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment()) {
-                    this.departmentCode = chuanyunMonthLaborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment();
+                    this.departmentName = chuanyunMonthLaborCostWgDTO.getChuanyunLaborCostPrimaryKey().getDepartment();
                 }
                 if (!Objects.isNull(chuanyunMonthLaborCostWgDTO.getWorkgroupid())) {
                     this.workGroupId = chuanyunMonthLaborCostWgDTO.getWorkgroupid();

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

@@ -43,7 +43,7 @@ public class WorkHourStatistics {
     /**
      * 每天19点执行一次三个月工时数据的标准化操作。
      */
-    @Scheduled(cron = "0 0 19 * * ?")
+    @Scheduled(cron = "0 0 22 * * ?")
     public void standardDayWorkHour(){
         //每日工时标准化
         log.info("开始每日工时标准化");

+ 26 - 0
src/main/java/com/galaxis/manatee/util/CollectionsUtils.java

@@ -0,0 +1,26 @@
+package com.galaxis.manatee.util;
+
+import java.time.LocalDate;
+import java.util.HashSet;
+import java.util.Set;
+
+public class CollectionsUtils {
+
+    public static Set<LocalDate> mergeCollections(Set<LocalDate> set1, Set<LocalDate> set2){
+
+        HashSet<LocalDate> resultSet = new HashSet<>();
+        resultSet.addAll(set1);
+        resultSet.addAll(set2);
+        return resultSet;
+    }
+
+    public static Set<String> mergeStringCollections(Set<String> set1, Set<String> set2,Set<String> set3){
+
+        HashSet<String> resultSet = new HashSet<>();
+        resultSet.addAll(set1);
+        resultSet.addAll(set2);
+        resultSet.addAll(set3);
+        return resultSet;
+    }
+
+}

+ 66 - 66
src/main/java/com/galaxis/manatee/webservice/CountryEndpoint.java

@@ -15,7 +15,7 @@ import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
 import org.springframework.ws.server.endpoint.annotation.RequestPayload;
 import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
 
-import java.util.concurrent.TimeUnit;
+import java.util.Objects;
 
 /**
  * @author kxuan
@@ -24,76 +24,76 @@ import java.util.concurrent.TimeUnit;
 @Slf4j
 @Endpoint
 public class CountryEndpoint {
-	private static final String NAMESPACE_URI = "http://galaxis.com/manatee/chuanyun-web-service";
+    private static final String NAMESPACE_URI = "http://galaxis.com/manatee/chuanyun-web-service";
 
-	private final ChuanyunHumanResourceScheduledTask chuanyunHumanResourceScheduledTask;
-	private final ChuanyunBasicDataScheduledTask chuanyunBasicDataScheduledTask;
-	private final ChuanyunService chuanyunService;
-	private final ProjectMemberService projectMemberService;
+    private final ChuanyunHumanResourceScheduledTask chuanyunHumanResourceScheduledTask;
+    private final ChuanyunBasicDataScheduledTask chuanyunBasicDataScheduledTask;
+    private final ChuanyunService chuanyunService;
+    private final ProjectMemberService projectMemberService;
 
-	public CountryEndpoint(ChuanyunHumanResourceScheduledTask chuanyunHumanResourceScheduledTask, ChuanyunBasicDataScheduledTask chuanyunBasicDataScheduledTask, ChuanyunService chuanyunService, ProjectMemberService projectMemberService) {
-		this.chuanyunHumanResourceScheduledTask = chuanyunHumanResourceScheduledTask;
-		this.chuanyunBasicDataScheduledTask = chuanyunBasicDataScheduledTask;
-		this.chuanyunService = chuanyunService;
-		this.projectMemberService = projectMemberService;
-	}
+    public CountryEndpoint(ChuanyunHumanResourceScheduledTask chuanyunHumanResourceScheduledTask, ChuanyunBasicDataScheduledTask chuanyunBasicDataScheduledTask, ChuanyunService chuanyunService, ProjectMemberService projectMemberService) {
+        this.chuanyunHumanResourceScheduledTask = chuanyunHumanResourceScheduledTask;
+        this.chuanyunBasicDataScheduledTask = chuanyunBasicDataScheduledTask;
+        this.chuanyunService = chuanyunService;
+        this.projectMemberService = projectMemberService;
+    }
 
 
-	@PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetSchema")
-	@ResponsePayload
-	public GetSchemaResponse getSchema(@RequestPayload GetSchema request)
-	{
-		GetSchemaResponse getSchemaResponse=new GetSchemaResponse();
-		getSchemaResponse.setResponse("{}");
-		return getSchemaResponse;
-	}
+    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetSchema")
+    @ResponsePayload
+    public GetSchemaResponse getSchema(@RequestPayload GetSchema request) {
+        GetSchemaResponse getSchemaResponse = new GetSchemaResponse();
+        getSchemaResponse.setResponse("{}");
+        return getSchemaResponse;
+    }
 
-	@PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetSchemaList")
-	@ResponsePayload
-	public GetSchemaListResponse getSchemaList(@RequestPayload GetSchemaList request)
-	{
-		GetSchemaListResponse getSchemaListResponse=new GetSchemaListResponse();
-		getSchemaListResponse.setResponse("{}");
-		return getSchemaListResponse;
-	}
+    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetSchemaList")
+    @ResponsePayload
+    public GetSchemaListResponse getSchemaList(@RequestPayload GetSchemaList request) {
+        GetSchemaListResponse getSchemaListResponse = new GetSchemaListResponse();
+        getSchemaListResponse.setResponse("{}");
+        return getSchemaListResponse;
+    }
 
-	@PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetList")
-	@ResponsePayload
-	public GetListResponse getList(@RequestPayload GetList request) {
-		GetListResponse getListResponse=new GetListResponse();
-		getListResponse.setResponse("{}");
-		return getListResponse;
-	}
+    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetList")
+    @ResponsePayload
+    public GetListResponse getList(@RequestPayload GetList request) {
+        GetListResponse getListResponse = new GetListResponse();
+        getListResponse.setResponse("{}");
+        return getListResponse;
+    }
 
-	/**
-	 * 氚云后端调用的方法名
-	 */
-	@PayloadRoot(namespace = NAMESPACE_URI, localPart = "Invoke")
-	@ResponsePayload
-	public InvokeResponse invoke(@RequestPayload Invoke request) throws JsonProcessingException, InterruptedException {
-		var objectMapper=new ObjectMapper();
-		InvokeResponse invokeResponse=new InvokeResponse();
-		//书写调用第三方接口方法
-		log.info("开始数据同步");
-		if ("managerProject".equals(request.getMethodName())){
-			projectMemberService.updateManagerMember(request.getParam());
-		}else if ("saleProject".equals(request.getMethodName())){
-			projectMemberService.updateSaleMember(request.getParam());
-		}else if ("developProject".equals(request.getMethodName())){
-			projectMemberService.updateDevelopMember(request.getParam());
-		}else {
-			chuanyunHumanResourceScheduledTask.getPayrollManually();
-			chuanyunBasicDataScheduledTask.getUserCompanyManually();
-			chuanyunBasicDataScheduledTask.getCompanyManually();
-			chuanyunBasicDataScheduledTask.getCostCollectionManually();
-			chuanyunBasicDataScheduledTask.getReimbursementItemsManually();
-			chuanyunBasicDataScheduledTask.getGroupProjectForSynchronizationManually();
-		}
-		log.info("数据同步成功");
-		ChuanyunWebServiceDTO chuanyunWebServiceDTO = new ChuanyunWebServiceDTO();
-		chuanyunWebServiceDTO.setMessage("数据同步完成");
-		chuanyunWebServiceDTO.setResultCode("0");
-		invokeResponse.setResponse(objectMapper.writeValueAsString(chuanyunWebServiceDTO));
-		return invokeResponse;
-	}
+    /**
+     * 氚云后端调用的方法名
+     */
+    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "Invoke")
+    @ResponsePayload
+    public InvokeResponse invoke(@RequestPayload Invoke request) throws JsonProcessingException, InterruptedException {
+        var objectMapper = new ObjectMapper();
+        InvokeResponse invokeResponse = new InvokeResponse();
+        //书写调用第三方接口方法
+        log.info("开始数据同步");
+        if ("managerProject".equals(request.getMethodName())) {
+            projectMemberService.updateManagerMember(request.getParam());
+        } else if ("saleProject".equals(request.getMethodName())) {
+            projectMemberService.updateSaleMember(request.getParam());
+        } else if ("developProject".equals(request.getMethodName())) {
+            projectMemberService.updateDevelopMember(request.getParam());
+        } else if (Objects.equals("deliveryProject", request.getMethodName())) {
+            projectMemberService.updateDeliveryMember(request.getParam());
+        }else{
+            chuanyunHumanResourceScheduledTask.getPayrollManually();
+            chuanyunBasicDataScheduledTask.getUserCompanyManually();
+            chuanyunBasicDataScheduledTask.getCompanyManually();
+            chuanyunBasicDataScheduledTask.getCostCollectionManually();
+            chuanyunBasicDataScheduledTask.getReimbursementItemsManually();
+            chuanyunBasicDataScheduledTask.getGroupProjectForSynchronizationManually();
+        }
+        log.info("数据同步成功");
+        ChuanyunWebServiceDTO chuanyunWebServiceDTO = new ChuanyunWebServiceDTO();
+        chuanyunWebServiceDTO.setMessage("数据同步完成");
+        chuanyunWebServiceDTO.setResultCode("0");
+        invokeResponse.setResponse(objectMapper.writeValueAsString(chuanyunWebServiceDTO));
+        return invokeResponse;
+    }
 }

+ 2 - 1
src/main/resources/application.yml

@@ -1,3 +1,4 @@
+
 #氚云
 chuanYun:
   engine:
@@ -51,7 +52,7 @@ spring:
   datasource:
     url: jdbc:mysql://localhost:3306/manatee?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
     username: root
-    password: your_password
+    password: root@123
     hikari:
       maximum-pool-size: 128
   jpa: