Commit ef75b2f3 by HlQ

[add] 使用 RestClient 替换 Hutool 的 http 请求工具类

[fix] 修复项目合并时,集团 id 错误的问题
1 parent f18e25ef
package vion.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestClient;
/**
* @author HlQ
* @date 2024/7/19
*/
@Configuration
@Slf4j
public class RestClientConfig {
@Bean(name = "bongRestClient")
public RestClient getBongRestClient() {
return RestClient.builder()
.baseUrl("https://proapi.xbongbong.com")
.build();
}
@Bean(name = "oDingRestClient")
public RestClient getODingRestClient() {
return RestClient.builder()
.baseUrl("https://oapi.dingtalk.com")
.build();
}
@Bean(name = "dingRestClient")
public RestClient getdingRestClient() {
return RestClient.builder()
.baseUrl("https://api.dingtalk.com")
.build();
}
}
...@@ -10,15 +10,15 @@ import org.dromara.hutool.core.math.NumberUtil; ...@@ -10,15 +10,15 @@ import org.dromara.hutool.core.math.NumberUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil; import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.crypto.SecureUtil; import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.http.client.Request;
import org.dromara.hutool.http.meta.Method;
import org.dromara.hutool.json.JSONObject; import org.dromara.hutool.json.JSONObject;
import org.dromara.hutool.json.JSONUtil; import org.dromara.hutool.json.JSONUtil;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestClient;
import vion.constant.RedisKeyEnum; import vion.constant.RedisKeyEnum;
import vion.model.Dictionary; import vion.model.Dictionary;
import vion.model.*; import vion.model.*;
...@@ -46,6 +46,7 @@ public class ContractRunner { ...@@ -46,6 +46,7 @@ public class ContractRunner {
private final IPaymentService paymentService; private final IPaymentService paymentService;
private final IRContractProductService contractProductService; private final IRContractProductService contractProductService;
private final RedissonClient redissonClient; private final RedissonClient redissonClient;
private final RestClient bongRestClient;
@Value("${xbongbong.token}") @Value("${xbongbong.token}")
private String token; private String token;
...@@ -75,12 +76,13 @@ public class ContractRunner { ...@@ -75,12 +76,13 @@ public class ContractRunner {
.set("corpid", corpId) .set("corpid", corpId)
.set("formId", 8429903) .set("formId", 8429903)
.set("pageSize", 100); .set("pageSize", 100);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobO = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobO = JSONUtil.parseObj(res.bodyStr());
if (jobO.getInt("code") != 1) { if (jobO.getInt("code") != 1) {
log.error("获取合同列表失败,错误原因:{}", jobO); log.error("获取合同列表失败,错误原因:{}", jobO);
return; return;
...@@ -115,12 +117,13 @@ public class ContractRunner { ...@@ -115,12 +117,13 @@ public class ContractRunner {
.set("formId", 8429903) .set("formId", 8429903)
.set("page", i) .set("page", i)
.set("pageSize", 100); .set("pageSize", 100);
var resR = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobR = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(jsonR.toString() + token)) .header("sign", SecureUtil.sha256(jsonR.toString() + token))
.body(jsonR.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobR = JSONUtil.parseObj(resR.bodyStr());
var jsonArrR = jobR.getJSONObject("result").getJSONArray("list"); var jsonArrR = jobR.getJSONObject("result").getJSONArray("list");
var dataIdSetR = jsonArrR.stream().map(v -> JSONUtil.parseObj(v).getInt("dataId")).collect(Collectors.toSet()); var dataIdSetR = jsonArrR.stream().map(v -> JSONUtil.parseObj(v).getInt("dataId")).collect(Collectors.toSet());
dataIdSet.addAll(dataIdSetR); dataIdSet.addAll(dataIdSetR);
...@@ -139,12 +142,13 @@ public class ContractRunner { ...@@ -139,12 +142,13 @@ public class ContractRunner {
var json1 = JSONUtil.ofObj() var json1 = JSONUtil.ofObj()
.set("corpid", corpId) .set("corpid", corpId)
.set("dataId", dataId); .set("dataId", dataId);
var res1 = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/detail") var jobj1 = bongRestClient.post()
.uri("/pro/v2/api/contract/detail")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json1.toString() + token)) .header("sign", SecureUtil.sha256(json1.toString() + token))
.body(json1.toString()) .body(json1.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobj1 = JSONUtil.parseObj(res1.bodyStr());
if (jobj1.getInt("code") != 1) { if (jobj1.getInt("code") != 1) {
log.error("获取合同详情失败,错误原因:{}", jobj1); log.error("获取合同详情失败,错误原因:{}", jobj1);
return; return;
...@@ -159,6 +163,7 @@ public class ContractRunner { ...@@ -159,6 +163,7 @@ public class ContractRunner {
contract.setMaintainSdate(Opt.ofNullable(jsonObj1.getLong("date_4")).map(sec -> DateUtil.date(sec * 1000)).orElse(null)); contract.setMaintainSdate(Opt.ofNullable(jsonObj1.getLong("date_4")).map(sec -> DateUtil.date(sec * 1000)).orElse(null));
contract.setMaintainEdate(Opt.ofNullable(jsonObj1.getLong("date_5")).map(sec -> DateUtil.date(sec * 1000)).orElse(null)); contract.setMaintainEdate(Opt.ofNullable(jsonObj1.getLong("date_5")).map(sec -> DateUtil.date(sec * 1000)).orElse(null));
String warrantyPeriod = Opt.ofNullable(jsonObj1.getJSONObject("text_23")).map(wp -> wp.getStr("text")).orElse(""); String warrantyPeriod = Opt.ofNullable(jsonObj1.getJSONObject("text_23")).map(wp -> wp.getStr("text")).orElse("");
// 23 质保 没有维保开始时间和结束时间 25 维保
if (StrUtil.isNotBlank(warrantyPeriod) && warrantyPeriod.contains("个月")) { if (StrUtil.isNotBlank(warrantyPeriod) && warrantyPeriod.contains("个月")) {
String substring = warrantyPeriod.substring(0, (warrantyPeriod.length() - 2)); String substring = warrantyPeriod.substring(0, (warrantyPeriod.length() - 2));
contract.setWarrantyPeriod(Integer.parseInt(substring)); contract.setWarrantyPeriod(Integer.parseInt(substring));
...@@ -400,13 +405,13 @@ public class ContractRunner { ...@@ -400,13 +405,13 @@ public class ContractRunner {
.set("page", 1) .set("page", 1)
.set("pageSize", 100); .set("pageSize", 100);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/product/list") var jobj = bongRestClient.post()
.uri("/pro/v2/api/product/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var body = res.bodyStr();
var jobj = JSONUtil.parseObj(body);
if (jobj.getInt("code") != 1) { if (jobj.getInt("code") != 1) {
log.error("获取CRM产品列表失败:{}", jobj); log.error("获取CRM产品列表失败:{}", jobj);
return List.of(); return List.of();
...@@ -420,13 +425,13 @@ public class ContractRunner { ...@@ -420,13 +425,13 @@ public class ContractRunner {
.set("corpid", corpId) .set("corpid", corpId)
.set("page", i) .set("page", i)
.set("pageSize", 100); .set("pageSize", 100);
var res1 = Request.of("https://proapi.xbongbong.com/pro/v2/api/product/list") var jobj1 = bongRestClient.post()
.header("sign", SecureUtil.sha256(json1 + token)) .uri("/pro/v2/api/product/list")
.body(json1.toString()) .contentType(MediaType.APPLICATION_JSON)
.method(Method.POST) .header("sign", SecureUtil.sha256(json1.toString() + token))
.send(); .body(json.toString())
var body1 = res1.bodyStr(); .retrieve()
var jobj1 = JSONUtil.parseObj(body1); .body(JSONObject.class);
if (jobj1.getInt("code") != 1) { if (jobj1.getInt("code") != 1) {
log.error("获取CRM产品列表失败:{}", jobj1); log.error("获取CRM产品列表失败:{}", jobj1);
return List.of(); return List.of();
......
...@@ -29,14 +29,14 @@ import org.dromara.hutool.core.text.StrUtil; ...@@ -29,14 +29,14 @@ import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil; import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.crypto.SecureUtil; import org.dromara.hutool.crypto.SecureUtil;
import org.dromara.hutool.http.client.HttpDownloader; import org.dromara.hutool.http.client.HttpDownloader;
import org.dromara.hutool.http.client.Request;
import org.dromara.hutool.http.meta.Method;
import org.dromara.hutool.json.JSONObject; import org.dromara.hutool.json.JSONObject;
import org.dromara.hutool.json.JSONUtil; import org.dromara.hutool.json.JSONUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestClient;
import vion.dto.ContractDTO; import vion.dto.ContractDTO;
import vion.dto.RContractTeamDTO; import vion.dto.RContractTeamDTO;
import vion.mapper.ContractMapper; import vion.mapper.ContractMapper;
...@@ -75,6 +75,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -75,6 +75,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
private final SettlementDiffMapper settlementDiffMapper; private final SettlementDiffMapper settlementDiffMapper;
private final DingMod dingMod; private final DingMod dingMod;
private final Converter converter; private final Converter converter;
private final RestClient bongRestClient;
@Value("${fileUrl:}") @Value("${fileUrl:}")
private String fileUrl; private String fileUrl;
...@@ -527,15 +528,15 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -527,15 +528,15 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
@Override @Override
public String createContract(String contractJson) { public String createContract(String contractJson) {
var sha256 = SecureUtil.sha256(contractJson + token); var sha256 = SecureUtil.sha256(contractJson + token);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobj = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", sha256) .header("sign", sha256)
.body(contractJson) .body(contractJson)
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var body = res.bodyStr();
var jobj = JSONUtil.parseObj(body);
if (jobj.getInt("code") != 1) { if (jobj.getInt("code") != 1) {
log.error("调用CRM接口创建合同失败,错误原因:{}", body); log.error("调用CRM接口创建合同失败,错误原因:{}", jobj);
return "创建合同失败"; return "创建合同失败";
} }
return "合同创建成功"; return "合同创建成功";
...@@ -559,15 +560,15 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -559,15 +560,15 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.set("pageSize", pageSize) .set("pageSize", pageSize)
.set("conditions", conditions); .set("conditions", conditions);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/product/list") var jobj = bongRestClient.post()
.uri("/pro/v2/api/product/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var body = res.bodyStr();
var jobj = JSONUtil.parseObj(body);
if (jobj.getInt("code") != 1) { if (jobj.getInt("code") != 1) {
log.error("调用CRM接口获取产品列表失败,错误原因:{}", body); log.error("调用CRM接口获取产品列表失败,错误原因:{}", jobj);
return JSONUtil.ofObj(); return JSONUtil.ofObj();
} }
return JSONUtil.ofObj().set("records", jobj.getJSONObject("result").getJSONArray("list")) return JSONUtil.ofObj().set("records", jobj.getJSONObject("result").getJSONArray("list"))
...@@ -597,12 +598,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -597,12 +598,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.set("corpid", corpId) .set("corpid", corpId)
.set("formId", 8429903) .set("formId", 8429903)
.set("pageSize", 100); .set("pageSize", 100);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobO = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobO = JSONUtil.parseObj(res.bodyStr());
if (jobO.getInt("code") != 1) { if (jobO.getInt("code") != 1) {
var errorInfo = StrUtil.format("获取合同列表失败,错误原因:{}", jobO); var errorInfo = StrUtil.format("获取合同列表失败,错误原因:{}", jobO);
log.error(errorInfo); log.error(errorInfo);
...@@ -627,12 +629,14 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -627,12 +629,14 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.set("formId", 8429903) .set("formId", 8429903)
.set("page", i) .set("page", i)
.set("pageSize", 100); .set("pageSize", 100);
var resR = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list")
var jobR = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(jsonR.toString() + token)) .header("sign", SecureUtil.sha256(jsonR.toString() + token))
.body(jsonR.toString()) .body(jsonR.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobR = JSONUtil.parseObj(resR.bodyStr());
var jsonArrR = jobR.getJSONObject("result").getJSONArray("list"); var jsonArrR = jobR.getJSONObject("result").getJSONArray("list");
var fileListR = jsonArrR.stream().map(v -> { var fileListR = jsonArrR.stream().map(v -> {
var fileArr = JSONUtil.parseObj(v).getJSONObject("data").getJSONArray("file_1"); var fileArr = JSONUtil.parseObj(v).getJSONObject("data").getJSONArray("file_1");
...@@ -649,7 +653,6 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -649,7 +653,6 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
var contractId2Sha256Map = fileInfoList.stream().collect(Collectors.groupingBy(FileInfo::getContractId, var contractId2Sha256Map = fileInfoList.stream().collect(Collectors.groupingBy(FileInfo::getContractId,
Collectors.mapping(FileInfo::getSha256, Collectors.toList()))); Collectors.mapping(FileInfo::getSha256, Collectors.toList())));
List<FileInfo> saveFileInfoList = new ArrayList<>();
for (JSONObject entries : fileList) { for (JSONObject entries : fileList) {
var contractNo = entries.getStr("contractNo"); var contractNo = entries.getStr("contractNo");
var fileArr = entries.getJSONArray("fileArr"); var fileArr = entries.getJSONArray("fileArr");
...@@ -663,6 +666,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -663,6 +666,7 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
continue; continue;
} }
List<FileInfo> saveFileInfoList = new ArrayList<>();
for (Object o : fileArr) { for (Object o : fileArr) {
var fileObj = JSONUtil.parseObj(o); var fileObj = JSONUtil.parseObj(o);
var filename = fileObj.getStr("filename"); var filename = fileObj.getStr("filename");
...@@ -688,8 +692,8 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -688,8 +692,8 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
fileInfo.setUploader("销帮帮同步"); fileInfo.setUploader("销帮帮同步");
saveFileInfoList.add(fileInfo); saveFileInfoList.add(fileInfo);
} }
}
fileService.saveBatch(saveFileInfoList); fileService.saveBatch(saveFileInfoList);
}
log.info("同步销帮帮合同文件[完成]"); log.info("同步销帮帮合同文件[完成]");
return "销帮帮合同文件同步完成,请核对已同步文件!"; return "销帮帮合同文件同步完成,请核对已同步文件!";
} }
...@@ -869,12 +873,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -869,12 +873,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.set("corpid", corpId) .set("corpid", corpId)
.set("formId", 8429903) .set("formId", 8429903)
.set("pageSize", 100); .set("pageSize", 100);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobO = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobO = JSONUtil.parseObj(res.bodyStr());
if (jobO.getInt("code") != 1) { if (jobO.getInt("code") != 1) {
log.error("获取合同列表失败,错误原因:{}", jobO); log.error("获取合同列表失败,错误原因:{}", jobO);
} }
...@@ -897,12 +902,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -897,12 +902,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.set("formId", 8429903) .set("formId", 8429903)
.set("page", i) .set("page", i)
.set("pageSize", 100); .set("pageSize", 100);
var resR = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobR = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(jsonR.toString() + token)) .header("sign", SecureUtil.sha256(jsonR.toString() + token))
.body(jsonR.toString()) .body(jsonR.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobR = JSONUtil.parseObj(resR.bodyStr());
var jsonArrR = jobR.getJSONObject("result").getJSONArray("list"); var jsonArrR = jobR.getJSONObject("result").getJSONArray("list");
var dataIdSetR = jsonArrR.stream().map(v -> JSONUtil.parseObj(v).getJSONObject("data").getStr("serialNo")).collect(Collectors.toSet()); var dataIdSetR = jsonArrR.stream().map(v -> JSONUtil.parseObj(v).getJSONObject("data").getStr("serialNo")).collect(Collectors.toSet());
dataIdSet.addAll(dataIdSetR); dataIdSet.addAll(dataIdSetR);
...@@ -988,12 +994,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -988,12 +994,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
.set("corpid", corpId) .set("corpid", corpId)
.set("formId", 8429903) .set("formId", 8429903)
.set("pageSize", 100); .set("pageSize", 100);
var res = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/list") var jobO = bongRestClient.post()
.uri("/pro/v2/api/contract/list")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json.toString() + token)) .header("sign", SecureUtil.sha256(json.toString() + token))
.body(json.toString()) .body(json.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobO = JSONUtil.parseObj(res.bodyStr());
if (jobO.getInt("code") != 1) { if (jobO.getInt("code") != 1) {
log.error("获取合同列表失败,错误原因:{}", jobO); log.error("获取合同列表失败,错误原因:{}", jobO);
} }
...@@ -1004,12 +1011,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -1004,12 +1011,13 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
var json1 = JSONUtil.ofObj() var json1 = JSONUtil.ofObj()
.set("corpid", corpId) .set("corpid", corpId)
.set("dataId", CollUtil.getFirst(dataIdSet)); .set("dataId", CollUtil.getFirst(dataIdSet));
var res1 = Request.of("https://proapi.xbongbong.com/pro/v2/api/contract/detail") var jobj1 = bongRestClient.post()
.uri("/pro/v2/api/contract/detail")
.contentType(MediaType.APPLICATION_JSON)
.header("sign", SecureUtil.sha256(json1.toString() + token)) .header("sign", SecureUtil.sha256(json1.toString() + token))
.body(json1.toString()) .body(json1.toString())
.method(Method.POST) .retrieve()
.send(); .body(JSONObject.class);
var jobj1 = JSONUtil.parseObj(res1.bodyStr());
if (jobj1.getInt("code") != 1) { if (jobj1.getInt("code") != 1) {
log.error("获取合同详情失败,错误原因:{}", jobj1); log.error("获取合同详情失败,错误原因:{}", jobj1);
} }
...@@ -1089,7 +1097,6 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont ...@@ -1089,7 +1097,6 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
var bongMap = BeanUtil.beanToMap(xbongContract, new HashMap<>(), copyOptions); var bongMap = BeanUtil.beanToMap(xbongContract, new HashMap<>(), copyOptions);
if (!mapEqual(platMap, bongMap)) { if (!mapEqual(platMap, bongMap)) {
log.info("不一致的合同:{}", contractNo); log.info("不一致的合同:{}", contractNo);
// SC 合同全部对比, CS 合同只对比金额
} }
} }
} }
......
...@@ -367,8 +367,8 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -367,8 +367,8 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
public String mergeStore(StoreDTO dto) { public String mergeStore(StoreDTO dto) {
// targetId 合并到 sourceId // targetId 合并到 sourceId
Long sourceId = dto.getSourceId(); Long sourceId = dto.getSourceId();
Store store = this.getById(sourceId);
Long targetId = dto.getTargetId(); Long targetId = dto.getTargetId();
var targetStore = this.getById(targetId);
// 项目关联合同合并 // 项目关联合同合并
Opt.ofEmptyAble(contractStoreService.lambdaQuery().select(RContractStore::getContractId).eq(RContractStore::getStoreId, targetId).list()) Opt.ofEmptyAble(contractStoreService.lambdaQuery().select(RContractStore::getContractId).eq(RContractStore::getStoreId, targetId).list())
.ifPresent(l -> { .ifPresent(l -> {
...@@ -385,13 +385,13 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -385,13 +385,13 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
}); });
// 工单相关合并 // 工单相关合并
taskMapper.update(new Task(), Wrappers.lambdaUpdate(Task.class).set(Task::getStoreId, sourceId).set(Task::getAccountId, store.getAccountId()).eq(Task::getStoreId, targetId)); taskMapper.update(new Task(), Wrappers.lambdaUpdate(Task.class).set(Task::getStoreId, sourceId).set(Task::getAccountId, targetStore.getAccountId()).eq(Task::getStoreId, targetId));
taskTempService.lambdaUpdate().set(TaskTemp::getStoreId, sourceId).eq(TaskTemp::getStoreId, targetId).update(); taskTempService.lambdaUpdate().set(TaskTemp::getStoreId, sourceId).eq(TaskTemp::getStoreId, targetId).update();
// 所有 targetId 的文件 转移到 sourceId // 所有 targetId 的文件 转移到 sourceId
fileService.lambdaUpdate().set(FileInfo::getStoreId, sourceId).eq(FileInfo::getStoreId, targetId).update(); fileService.lambdaUpdate().set(FileInfo::getStoreId, sourceId).eq(FileInfo::getStoreId, targetId).update();
faultLogService.lambdaUpdate().set(FaultLog::getStoreId, sourceId).eq(FaultLog::getStoreId, targetId).update(); faultLogService.lambdaUpdate().set(FaultLog::getStoreId, sourceId).eq(FaultLog::getStoreId, targetId).update();
formService.lambdaUpdate().set(Form::getStoreId, sourceId).set(Form::getAccountId, store.getAccountId()).eq(Form::getStoreId, targetId).update(new Form()); formService.lambdaUpdate().set(Form::getStoreId, sourceId).set(Form::getAccountId, targetStore.getAccountId()).eq(Form::getStoreId, targetId).update(new Form());
inspectService.lambdaUpdate().set(Inspect::getStoreId, sourceId).set(Inspect::getAccountId, store.getAccountId()).eq(Inspect::getStoreId, targetId).update(new Inspect()); inspectService.lambdaUpdate().set(Inspect::getStoreId, sourceId).set(Inspect::getAccountId, targetStore.getAccountId()).eq(Inspect::getStoreId, targetId).update(new Inspect());
// 删除 targetId 对应的项目 // 删除 targetId 对应的项目
this.removeById(targetId); this.removeById(targetId);
return "合并成功"; return "合并成功";
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!