|
@@ -1,11 +1,16 @@
|
|
package com.galaxis.manatee.Test.buildProjectTest;
|
|
package com.galaxis.manatee.Test.buildProjectTest;
|
|
|
|
|
|
|
|
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
+import com.galaxis.manatee.entity.chuanyun.data.object.BasicDO;
|
|
import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunBuildProject;
|
|
import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunBuildProject;
|
|
|
|
+import com.galaxis.manatee.entity.chuanyun.data.object.ChuanyunGroupProjectDO;
|
|
import com.galaxis.manatee.entity.chuanyun.dto.ChuanyunFindAllBizDTO;
|
|
import com.galaxis.manatee.entity.chuanyun.dto.ChuanyunFindAllBizDTO;
|
|
|
|
+import com.galaxis.manatee.entity.chuanyun.dto.ChuanyunFindBizDTO;
|
|
|
|
+import com.galaxis.manatee.entity.chuanyun.dto.ChuanyunFindBizReturnData;
|
|
import com.galaxis.manatee.entity.chuanyun.dto.Filter;
|
|
import com.galaxis.manatee.entity.chuanyun.dto.Filter;
|
|
import com.galaxis.manatee.manager.ChuanYunManager;
|
|
import com.galaxis.manatee.manager.ChuanYunManager;
|
|
import com.galaxis.manatee.service.WorkGroupService;
|
|
import com.galaxis.manatee.service.WorkGroupService;
|
|
@@ -15,6 +20,7 @@ import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -125,27 +131,87 @@ public class BuildProjectTest {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- void syncBuildProjectToSubTable(){
|
|
|
|
- List<String> m = List.of("F0000016_2,实施");
|
|
|
|
|
|
+ void syncBuildProjectToSubTable() {
|
|
|
|
+// List<String> m = List.of("F0000016_2,实施");
|
|
|
|
+ List<String> m = List.of("F0000003_2,D22429");
|
|
var filter = Filter.instance(0, 400, true, Filter.AND, m);
|
|
var filter = Filter.instance(0, 400, true, Filter.AND, m);
|
|
|
|
+
|
|
ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = null;
|
|
ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = null;
|
|
try {
|
|
try {
|
|
chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunBuildProject.SCHEMA_CODE, filter);
|
|
chuanyunFindAllResponse = chuanYunManager.findAll(ChuanyunBuildProject.SCHEMA_CODE, filter);
|
|
} catch (JsonProcessingException e) {
|
|
} catch (JsonProcessingException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+
|
|
if (chuanyunFindAllResponse.getReturnData() == null || chuanyunFindAllResponse.getReturnData().getBizObjectArray() == null) {
|
|
if (chuanyunFindAllResponse.getReturnData() == null || chuanyunFindAllResponse.getReturnData().getBizObjectArray() == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //保存
|
|
|
|
|
|
+
|
|
List<Object> bizObjectArray = chuanyunFindAllResponse.getReturnData().getBizObjectArray();
|
|
List<Object> bizObjectArray = chuanyunFindAllResponse.getReturnData().getBizObjectArray();
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
List<ChuanyunBuildProject> bpList = objectMapper.convertValue(bizObjectArray, new TypeReference<>() {
|
|
List<ChuanyunBuildProject> bpList = objectMapper.convertValue(bizObjectArray, new TypeReference<>() {
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ var preSalesList = new ArrayList<>();
|
|
|
|
+ bpList.forEach(chuanyunBuildProject -> {
|
|
|
|
+ String projectCode = chuanyunBuildProject.getProjectCode();
|
|
|
|
+ //售前转实施
|
|
|
|
+ if (this.getPreSales(projectCode) != null && this.getPreSales(projectCode).size() > 0) {
|
|
|
|
+ if (this.getPreSales(projectCode).size() == 1) {
|
|
|
|
+ String projectCode1 = this.getProjectCode(this.getPreSales(projectCode).get(0).getSaleProjectObjectId());
|
|
|
|
+ preSalesList.add(projectCode1);
|
|
|
|
+ } else {
|
|
|
|
+ this.getPreSales(projectCode).forEach(SaleToImpl -> {
|
|
|
|
+ String projectCode1 = this.getProjectCode(SaleToImpl.getSaleProjectObjectId());
|
|
|
|
+ preSalesList.add(projectCode1);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ log.info("{}", preSalesList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<SaleToImpl> getPreSales(String projectCode) {
|
|
|
|
+ List<String> m = List.of("F0000064_2," + projectCode);
|
|
|
|
+ var filter = Filter.instance(0, 400, true, Filter.AND, m);
|
|
|
|
+
|
|
|
|
+ ChuanyunFindAllBizDTO<Object> chuanyunFindAllResponse = null;
|
|
|
|
+ try {
|
|
|
|
+ chuanyunFindAllResponse = chuanYunManager.findAll("D0017899897ba28eca44996a3a7cb430ed4f07d", filter);
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (chuanyunFindAllResponse.getReturnData() == null || chuanyunFindAllResponse.getReturnData().getBizObjectArray() == null) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Object> bizObjectArray = chuanyunFindAllResponse.getReturnData().getBizObjectArray();
|
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
+ List<SaleToImpl> bpList = objectMapper.convertValue(bizObjectArray, new TypeReference<>() {
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return bpList;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ String getProjectCode(String saleProjectObjectId) {
|
|
|
|
+ ChuanyunFindBizDTO<Object> objectChuanyunFindBizDTO = null;
|
|
|
|
+ try {
|
|
|
|
+ objectChuanyunFindBizDTO = chuanYunManager.find(ChuanyunGroupProjectDO.SCHEMA_CODE, saleProjectObjectId);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if (objectChuanyunFindBizDTO.getReturnData() == null || objectChuanyunFindBizDTO.getReturnData().getBizObject() == null) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
+ Object bizObject = objectChuanyunFindBizDTO.getReturnData().getBizObject();
|
|
|
|
+ ChuanyunGroupProjectDO groupProjectDO = objectMapper.convertValue(bizObject,new TypeReference<>() {
|
|
|
|
+ });
|
|
|
|
+ return groupProjectDO.getProjectCode();
|
|
}
|
|
}
|
|
|
|
|
|
@Data
|
|
@Data
|
|
@@ -174,9 +240,10 @@ public class BuildProjectTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Data
|
|
@Data
|
|
|
|
+ @JsonIgnoreProperties(ignoreUnknown = true)
|
|
static class SaleToImpl {
|
|
static class SaleToImpl {
|
|
- @JsonProperty("F0000102")
|
|
|
|
- private String SalesProjectCode;
|
|
|
|
|
|
+ @JsonProperty("F0000015")
|
|
|
|
+ private String SaleProjectObjectId; //售前转实施查出来的售前项目的ID
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|