信用修改
This commit is contained in:
+65
-13
@@ -1665,9 +1665,6 @@ public class UserShipperApplicationService {
|
|||||||
// 根据查询结果同步数据
|
// 根据查询结果同步数据
|
||||||
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
||||||
if (dataJson != null) {
|
if (dataJson != null) {
|
||||||
// 同步额度数据(limitdatas)
|
|
||||||
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
|
||||||
if (limitdatas != null && !limitdatas.isEmpty()) {
|
|
||||||
// 解析现有的orgCode数组
|
// 解析现有的orgCode数组
|
||||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||||
@@ -1678,6 +1675,9 @@ public class UserShipperApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 同步额度数据(limitdatas)
|
||||||
|
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
||||||
|
if (limitdatas != null && !limitdatas.isEmpty()) {
|
||||||
// 将limitdatas按orgcode值合并到orgCode数组中
|
// 将limitdatas按orgcode值合并到orgCode数组中
|
||||||
for (int i = 0; i < limitdatas.size(); i++) {
|
for (int i = 0; i < limitdatas.size(); i++) {
|
||||||
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
|
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
|
||||||
@@ -1711,9 +1711,6 @@ public class UserShipperApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存更新后的orgCode数组
|
|
||||||
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
|
|
||||||
|
|
||||||
// 使用limitdatas中的数据更新额度字段
|
// 使用limitdatas中的数据更新额度字段
|
||||||
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
|
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
|
||||||
userShipperEntity1.setLimitTime(new Date());
|
userShipperEntity1.setLimitTime(new Date());
|
||||||
@@ -1737,6 +1734,32 @@ public class UserShipperApplicationService {
|
|||||||
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
|
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将agreedaydatas保存到orgCode数组中,与code同一级别
|
||||||
|
String currentOrgCodeStr = String.valueOf(orgCode);
|
||||||
|
boolean foundOrg = false;
|
||||||
|
for (int j = 0; j < orgCodeArray.size(); j++) {
|
||||||
|
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
|
||||||
|
String orgItemCode = orgItem.getString("code");
|
||||||
|
|
||||||
|
// 找到当前组织,将agreedaydatas添加到该组织对象中
|
||||||
|
if (currentOrgCodeStr.equals(orgItemCode)) {
|
||||||
|
orgItem.put("agreedaydatas", agreedaydatas);
|
||||||
|
foundOrg = true;
|
||||||
|
log.info("将agreedaydatas添加到code={}的组织中,共{}条", orgItemCode, agreedaydatas.size());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没找到,创建新组织对象
|
||||||
|
if (!foundOrg) {
|
||||||
|
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||||
|
newOrgItem.put("code", orgCode);
|
||||||
|
newOrgItem.put("agreedaydatas", agreedaydatas);
|
||||||
|
orgCodeArray.add(newOrgItem);
|
||||||
|
log.info("创建新组织并添加agreedaydatas,code={},共{}条", orgCode, agreedaydatas.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同时插入到agreement_details表
|
||||||
for (int i = 0; i < agreedaydatas.size(); i++) {
|
for (int i = 0; i < agreedaydatas.size(); i++) {
|
||||||
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||||
AgreementDetails agreementDetails = new AgreementDetails();
|
AgreementDetails agreementDetails = new AgreementDetails();
|
||||||
@@ -1754,6 +1777,9 @@ public class UserShipperApplicationService {
|
|||||||
} else {
|
} else {
|
||||||
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存更新后的orgCode数组(统一在最后保存)
|
||||||
|
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
|
||||||
} else {
|
} else {
|
||||||
log.info("赊销额度查询无data返回,跳过更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
log.info("赊销额度查询无data返回,跳过更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||||
}
|
}
|
||||||
@@ -1905,10 +1931,7 @@ public class UserShipperApplicationService {
|
|||||||
// 根据查询结果同步数据
|
// 根据查询结果同步数据
|
||||||
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
|
||||||
if (dataJson != null) {
|
if (dataJson != null) {
|
||||||
// 同步额度数据(limitdatas)
|
// 解析现有的orgCode数组(提到外面,limitdatas和agreedaydatas共用)
|
||||||
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
|
||||||
if (limitdatas != null && !limitdatas.isEmpty()) {
|
|
||||||
// 解析现有的orgCode数组
|
|
||||||
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
com.alibaba.fastjson.JSONArray orgCodeArray = new com.alibaba.fastjson.JSONArray();
|
||||||
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
|
||||||
try {
|
try {
|
||||||
@@ -1918,6 +1941,9 @@ public class UserShipperApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 同步额度数据(limitdatas)
|
||||||
|
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
|
||||||
|
if (limitdatas != null && !limitdatas.isEmpty()) {
|
||||||
// 将limitdatas按orgcode值合并到orgCode数组中
|
// 将limitdatas按orgcode值合并到orgCode数组中
|
||||||
for (int i = 0; i < limitdatas.size(); i++) {
|
for (int i = 0; i < limitdatas.size(); i++) {
|
||||||
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
|
com.alibaba.fastjson.JSONObject limitItem = limitdatas.getJSONObject(i);
|
||||||
@@ -1951,9 +1977,6 @@ public class UserShipperApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 保存更新后的orgCode数组
|
|
||||||
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
|
|
||||||
|
|
||||||
// 使用limitdatas中的数据更新额度字段
|
// 使用limitdatas中的数据更新额度字段
|
||||||
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
|
com.alibaba.fastjson.JSONObject firstLimitData = limitdatas.getJSONObject(0);
|
||||||
userShipperEntity1.setLimitTime(new Date());
|
userShipperEntity1.setLimitTime(new Date());
|
||||||
@@ -1977,6 +2000,32 @@ public class UserShipperApplicationService {
|
|||||||
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
|
log.info("第一次循环,删除货主所有协议明细,shipperId={}", userShipperEntity1.getShipperId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将agreedaydatas保存到orgCode数组中,与code同一级别
|
||||||
|
String currentOrgCodeStr = String.valueOf(orgCode);
|
||||||
|
boolean foundOrg = false;
|
||||||
|
for (int j = 0; j < orgCodeArray.size(); j++) {
|
||||||
|
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(j);
|
||||||
|
String orgItemCode = orgItem.getString("code");
|
||||||
|
|
||||||
|
// 找到当前组织,将agreedaydatas添加到该组织对象中
|
||||||
|
if (currentOrgCodeStr.equals(orgItemCode)) {
|
||||||
|
orgItem.put("agreedaydatas", agreedaydatas);
|
||||||
|
foundOrg = true;
|
||||||
|
log.info("将agreedaydatas添加到code={}的组织中,共{}条", orgItemCode, agreedaydatas.size());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没找到,创建新组织对象
|
||||||
|
if (!foundOrg) {
|
||||||
|
com.alibaba.fastjson.JSONObject newOrgItem = new com.alibaba.fastjson.JSONObject();
|
||||||
|
newOrgItem.put("code", orgCode);
|
||||||
|
newOrgItem.put("agreedaydatas", agreedaydatas);
|
||||||
|
orgCodeArray.add(newOrgItem);
|
||||||
|
log.info("创建新组织并添加agreedaydatas,code={},共{}条", orgCode, agreedaydatas.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同时插入到agreement_details表
|
||||||
for (int i = 0; i < agreedaydatas.size(); i++) {
|
for (int i = 0; i < agreedaydatas.size(); i++) {
|
||||||
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
com.alibaba.fastjson.JSONObject agreeItem = agreedaydatas.getJSONObject(i);
|
||||||
AgreementDetails agreementDetails = new AgreementDetails();
|
AgreementDetails agreementDetails = new AgreementDetails();
|
||||||
@@ -1994,6 +2043,9 @@ public class UserShipperApplicationService {
|
|||||||
} else {
|
} else {
|
||||||
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
log.info("赊销额度查询无agreedaydatas返回,跳过协议明细同步,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存更新后的orgCode数组(统一在最后保存)
|
||||||
|
userShipperEntity1.setOrgCode(orgCodeArray.toJSONString());
|
||||||
} else {
|
} else {
|
||||||
log.info("赊销额度查询无data返回,跳过更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
log.info("赊销额度查询无data返回,跳过更新,custcode={},orgcode={}", userShipperEntity1.getCustomerNcCode(), orgcode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user