Commit 562b1ef6 authored by 张俊's avatar 张俊

调整执行逻辑

parent 4dbb6839
...@@ -19,9 +19,8 @@ import java.sql.CallableStatement; ...@@ -19,9 +19,8 @@ import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator; import java.util.stream.Collectors;
import java.util.List;
/** /**
...@@ -153,23 +152,29 @@ public class DeptInfoUpdateService { ...@@ -153,23 +152,29 @@ public class DeptInfoUpdateService {
if (CollectionUtils.isEmpty(collDwxxbgList)) { if (CollectionUtils.isEmpty(collDwxxbgList)) {
return "0"; return "0";
} }
JSONObject jsonObject = new JSONObject(); // 根据业务id分组
jsonObject.put("state", "1"); Map<String, List<BusinessProcessing>> listMap = collDwxxbgList.stream()
jsonObject.put("timestamp", collDwxxbgList.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime()); .collect(Collectors.groupingBy(vo -> vo.getBusId(), LinkedHashMap::new, Collectors.toList()));
jsonObject.put("busId", collDwxxbgList.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getBusId()); for (Map.Entry<String, List<BusinessProcessing>> listEntry : listMap.entrySet()) {
jsonObject.put("departCode", "10"); String busId = listEntry.getKey();
jsonObject.put("nodeList", collDwxxbgList); List<BusinessProcessing> processinglist = listEntry.getValue();
String str = jsonObject.toString(); JSONObject jsonObject = new JSONObject();
log.info("单位信息变更推送单位信息请求入参:{}", str); jsonObject.put("state", "1");
//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 jsonObject.put("timestamp", processinglist.stream().max(Comparator.comparing(BusinessProcessing::getTime)).get().getTime());
String forObject = restTemplate.postForObject(businessProcessing, str, String.class); jsonObject.put("busId", busId);
log.info("单位信息变更推送单位信息请求出参:{}", forObject); jsonObject.put("departCode", "10");
JSONObject jsonObj = JSONObject.parseObject(forObject); jsonObject.put("nodeList", processinglist);
Integer value = "true".equals(jsonObj.getString("success")) ? 1 : 0; String str = jsonObject.toString();
String uscc = !CollectionUtils.isEmpty(collDwxxbgList) ? collDwxxbgList.get(0).getUscc() : ""; log.info("单位信息变更推送单位信息请求入参:{}", str);
// 回写 //(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
collDeptInfoUpdateRewrite(uscc, value); String forObject = restTemplate.postForObject(businessProcessing, str, String.class);
return forObject; log.info("单位信息变更推送单位信息请求出参:{}", forObject);
JSONObject jsonObj = JSONObject.parseObject(forObject);
Integer status = "true".equals(jsonObj.getString("success")) ? 1 : 0;
// 回写
collDeptInfoUpdateRewrite(busId, status);
}
return "1";
} }
/** /**
......
...@@ -2,7 +2,6 @@ package net.cdkj.gjj.adapter.service; ...@@ -2,7 +2,6 @@ package net.cdkj.gjj.adapter.service;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import net.cdkj.gjj.adapter.domain.BusinessProcessing; import net.cdkj.gjj.adapter.domain.BusinessProcessing;
import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation; import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation;
...@@ -20,9 +19,8 @@ import java.sql.CallableStatement; ...@@ -20,9 +19,8 @@ import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator; import java.util.stream.Collectors;
import java.util.List;
/** /**
...@@ -123,23 +121,30 @@ public class DeptLogoutService { ...@@ -123,23 +121,30 @@ public class DeptLogoutService {
if (CollectionUtils.isEmpty(collDwxhList)) { if (CollectionUtils.isEmpty(collDwxhList)) {
return "0"; return "0";
} }
JSONObject jsonObject = new JSONObject(); // 根据业务id分组
jsonObject.put("state", "1"); Map<String, List<BusinessProcessing>> listMap = collDwxhList.stream()
jsonObject.put("timestamp", collDwxhList.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime()); .collect(Collectors.groupingBy(vo -> vo.getBusId(), LinkedHashMap::new, Collectors.toList()));
jsonObject.put("busId", collDwxhList.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getBusId()); for (Map.Entry<String, List<BusinessProcessing>> listEntry : listMap.entrySet()) {
jsonObject.put("departCode", "10"); String busId = listEntry.getKey();
jsonObject.put("nodeList", collDwxhList); List<BusinessProcessing> processinglist = listEntry.getValue();
String str = jsonObject.toString();
log.info("单位开户推送单位信息请求入参:{}", str); JSONObject jsonObject = new JSONObject();
//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 jsonObject.put("state", "1");
String forObject = restTemplate.postForObject(businessProcessing, str, String.class); jsonObject.put("timestamp", processinglist.stream().max(Comparator.comparing(BusinessProcessing::getTime)).get().getTime());
log.info("单位开户推送单位信息请求出参:{}", forObject); jsonObject.put("busId", busId);
JSONObject jsonObj = JSONObject.parseObject(forObject); jsonObject.put("departCode", "10");
Integer value = "true".equals(jsonObj.getString("success")) ? 1 : 0; jsonObject.put("nodeList", processinglist);
String uscc = !CollectionUtils.isEmpty(collDwxhList) ? collDwxhList.get(0).getUscc() : ""; String str = jsonObject.toString();
// 回写 log.info("单位开户推送单位信息请求入参:{}", str);
collDeptLogoutRewrite(uscc, value); //(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
return forObject; String forObject = restTemplate.postForObject(businessProcessing, str, String.class);
log.info("单位开户推送单位信息请求出参:{}", forObject);
JSONObject jsonObj = JSONObject.parseObject(forObject);
Integer status = "true".equals(jsonObj.getString("success")) ? 1 : 0;
// 回写
collDeptLogoutRewrite(busId, status);
}
return "1";
} }
/** /**
......
...@@ -21,10 +21,8 @@ import javax.annotation.Resource; ...@@ -21,10 +21,8 @@ import javax.annotation.Resource;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator; import java.util.stream.Collectors;
import java.util.Date;
import java.util.List;
/** /**
...@@ -283,39 +281,34 @@ public class OpenAccountService { ...@@ -283,39 +281,34 @@ public class OpenAccountService {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return "0"; return "0";
} }
JSONObject jsonObject = new JSONObject(); // 根据业务id分组
jsonObject.put("state", "1"); Map<String, List<BusinessProcessing>> listMap = list.stream()
jsonObject.put("timestamp", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getTime()); .collect(Collectors.groupingBy(vo -> vo.getBusId(), LinkedHashMap::new, Collectors.toList()));
jsonObject.put("busId", list.stream().min(Comparator.comparing(BusinessProcessing::getTime)).get().getBusId()); for (Map.Entry<String, List<BusinessProcessing>> listEntry : listMap.entrySet()) {
jsonObject.put("departCode", "10"); String busId = listEntry.getKey();
jsonObject.put("nodeList", list); List<BusinessProcessing> processinglist = listEntry.getValue();
String str = jsonObject.toString(); JSONObject jsonObject = new JSONObject();
// 发起 post 请求 jsonObject.put("state", "1");
log.info("单位开户推送单位信息请求入参:{}", str); jsonObject.put("timestamp", processinglist.stream().max(Comparator.comparing(BusinessProcessing::getTime)).get().getTime());
String result = HttpUtil.sendPost(businessProcessing, str); jsonObject.put("busId", busId);
log.info("单位开户推送单位信息请求出参:{}", result); jsonObject.put("departCode", "10");
if (result != null) { jsonObject.put("nodeList", processinglist);
String uscc = ""; String str = jsonObject.toString();
if (!list.isEmpty()) { // 发起 post 请求
uscc = list.get(0).getUscc(); log.info("单位开户推送单位信息请求入参:{}", str);
} String result = HttpUtil.sendPost(businessProcessing, str);
log.info(uscc); log.info("单位开户推送单位信息请求出参:{}", result);
JSONObject jsonObj = JSONObject.parseObject(result); if (result != null) {
String success = jsonObj.getString("success"); JSONObject jsonObj = JSONObject.parseObject(result);
Integer value = 0; Integer status = "true".equals(jsonObj.getString("success")) ? 1 : 0;
if ("true".equals(success)) { try {
value = 1; collOpenAccountRewrite(busId, status);
} else if ("false".equals(success)) { } catch (Exception e) {
value = 0; log.error("{}", e);
} }
try { }
collOpenAccountRewrite(uscc, value);
} catch (Exception e) {
log.error("{}", e);
}
log.info("success:{}", value);
} }
return result; return "1";
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment