Commit d6db3561 authored by 张俊's avatar 张俊

单位开户、单位变更、单位销户协议修改

parent 7a2a3da1
package net.cdkj.gjj.adapter.controller; package net.cdkj.gjj.adapter.controller;
import net.cdkj.gjj.adapter.service.DeptInfoUpdateService;
import net.cdkj.gjj.adapter.service.DeptLogoutService;
import net.cdkj.gjj.adapter.service.OpenAccountService;
import net.cdkj.gjj.adapter.utils.InternalUtils; import net.cdkj.gjj.adapter.utils.InternalUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -21,14 +24,14 @@ import javax.annotation.Resource; ...@@ -21,14 +24,14 @@ import javax.annotation.Resource;
//@Async //@Async
public class AlarmTask { public class AlarmTask {
private static final Logger log = LoggerFactory.getLogger(DeptInfoUpdateController.class); private static final Logger log = LoggerFactory.getLogger(AlarmTask.class);
@Resource @Resource
private DeptInfoUpdateController deptInfoUpdateController; private OpenAccountService openAccountService;
@Resource @Resource
private DeptLogoutController deptLogoutController; private DeptInfoUpdateService deptInfoUpdateService;
@Resource @Resource
private ProvidentFundServicesController providentFundServicesController; private DeptLogoutService deptLogoutService;
/** /**
* 第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次 * 第一次延迟(initialDelay)?秒后执行,之后按fixedDelay的规则每?秒执行一次
...@@ -37,7 +40,7 @@ public class AlarmTask { ...@@ -37,7 +40,7 @@ public class AlarmTask {
public void dwkhPullTask() { public void dwkhPullTask() {
log.debug("第一个接口开始时间:{}", InternalUtils.getCurrentTime()); log.debug("第一个接口开始时间:{}", InternalUtils.getCurrentTime());
try { try {
providentFundServicesController.gjjxtfwjk(); openAccountService.syncDeptInfo();
} catch (Exception e) { } catch (Exception e) {
log.error("{}", e); log.error("{}", e);
} }
...@@ -51,34 +54,20 @@ public class AlarmTask { ...@@ -51,34 +54,20 @@ public class AlarmTask {
@Scheduled(initialDelay = 20 * 1000, fixedDelayString = "${dwkhPushTaskDelay}") @Scheduled(initialDelay = 20 * 1000, fixedDelayString = "${dwkhPushTaskDelay}")
public void dwkhPushTask() { public void dwkhPushTask() {
log.debug("第二个接口开始时间:{}", InternalUtils.getCurrentTime()); log.debug("第二个接口开始时间:{}", InternalUtils.getCurrentTime());
providentFundServicesController.BusinessProcessing(); openAccountService.dwkhPush();
} }
@Scheduled(initialDelay = 40 * 1000, fixedDelayString = "${dwxxbgPushTaskDelay}") @Scheduled(initialDelay = 40 * 1000, fixedDelayString = "${dwxxbgPushTaskDelay}")
public void dwxxbgPushTask() { public void dwxxbgPushTask() {
log.debug("dwxxbgPushTask 开始时间:{}", InternalUtils.getCurrentTime()); log.debug("dwxxbgPushTask 开始时间:{}", InternalUtils.getCurrentTime());
deptInfoUpdateController.dwxxbgPush(); deptInfoUpdateService.deptInfoUpdatePush();
}
@Scheduled(initialDelay = 60 * 1000, fixedDelayString = "${dwxxbgPullTaskDelay}")
public void dwxxbgPullTask() {
log.debug("dwxxbgPullTask 开始时间:{}", InternalUtils.getCurrentTime());
deptInfoUpdateController.dwxxbgPull();
} }
@Scheduled(initialDelay = 80 * 1000, fixedDelayString = "${dwxhPushTaskDelay}") @Scheduled(initialDelay = 80 * 1000, fixedDelayString = "${dwxhPushTaskDelay}")
public void dwxhPushTask() { public void dwxhPushTask() {
log.debug("dwxhPushTask 开始时间:{}", InternalUtils.getCurrentTime()); log.debug("dwxhPushTask 开始时间:{}", InternalUtils.getCurrentTime());
deptLogoutController.dwxhPush(); deptLogoutService.dwxhPush();
} }
@Scheduled(initialDelay = 100 * 1000, fixedDelayString = "${dwxhPullTaskDelay}")
public void dwxhPullTask() {
log.debug("dwxhPullTask 开始时间:{}", InternalUtils.getCurrentTime());
deptLogoutController.dwxhPull();
}
} }
package net.cdkj.gjj.adapter.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "demo")
public class TestController {
@RequestMapping("test")
public String test(String name) {
System.out.println("内部业务机");
return "hello,hello" + name;
}
}
...@@ -47,15 +47,5 @@ public class Json { ...@@ -47,15 +47,5 @@ public class Json {
this.data = data; this.data = data;
} }
@Override
public String toString() {
return "Json{" +
"code=" + code +
", message='" + message + '\'' +
", fields='" + fields + '\'' +
", data=" + data +
'}';
}
} }
package net.cdkj.gjj.adapter.domain; package net.cdkj.gjj.adapter.domain;
import net.cdkj.gjj.adapter.controller.DeptInfoUpdateController;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -14,7 +13,7 @@ import java.util.Properties; ...@@ -14,7 +13,7 @@ import java.util.Properties;
*/ */
public class PropertyqUtil { public class PropertyqUtil {
private static final Logger log = LoggerFactory.getLogger(DeptInfoUpdateController.class); private static final Logger log = LoggerFactory.getLogger(PropertyqUtil.class);
/** /**
* 读取 classpath 下 指定的properties配置文件,加载到Properties并返回Properties * 读取 classpath 下 指定的properties配置文件,加载到Properties并返回Properties
......
...@@ -58,6 +58,16 @@ public class UnitAccountOpeningInformation { ...@@ -58,6 +58,16 @@ public class UnitAccountOpeningInformation {
private String errmsg; private String errmsg;
private String dataStatus;
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getBusId() { public String getBusId() {
return busId; return busId;
...@@ -250,34 +260,4 @@ public class UnitAccountOpeningInformation { ...@@ -250,34 +260,4 @@ public class UnitAccountOpeningInformation {
public void setErrmsg(String errmsg) { public void setErrmsg(String errmsg) {
this.errmsg = errmsg; this.errmsg = errmsg;
} }
@Override
public String toString() {
return "UnitAccountOpeningInformation{" +
"ywbh='" + ywbh + '\'' +
", busId='" + busId + '\'' +
", uscc='" + uscc + '\'' +
", entName='" + entName + '\'' +
", dom='" + dom + '\'' +
", estDate=" + estDate +
", lerep='" + lerep + '\'' +
", cerType='" + cerType + '\'' +
", cerNo='" + cerNo + '\'' +
", operatorName='" + operatorName + '\'' +
", operatorCerNo='" + operatorCerNo + '\'' +
", operatorPhone='" + operatorPhone + '\'' +
", oplocdistrict='" + oplocdistrict + '\'' +
", unitNature='" + unitNature + '\'' +
", economicType='" + economicType + '\'' +
", industryphy='" + industryphy + '\'' +
", unitPayDay='" + unitPayDay + '\'' +
", unitDepPro='" + unitDepPro + '\'' +
", personalDepPro='" + personalDepPro + '\'' +
", zxdqbm='" + zxdqbm + '\'' +
", lcls='" + lcls + '\'' +
", dwzh='" + dwzh + '\'' +
", errcode='" + errcode + '\'' +
", errmsg='" + errmsg + '\'' +
'}';
}
} }
package net.cdkj.gjj.adapter.controller; 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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import net.cdkj.gjj.adapter.domain.AjaxResult;
import net.cdkj.gjj.adapter.domain.BusinessProcessing; import net.cdkj.gjj.adapter.domain.BusinessProcessing;
import net.cdkj.gjj.adapter.domain.Json;
import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation; import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation;
import net.cdkj.gjj.adapter.utils.InternalUtils;
import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleTypes;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -34,80 +28,18 @@ import java.util.List; ...@@ -34,80 +28,18 @@ import java.util.List;
/** /**
* 公积金系统服务类 * 公积金系统服务类
*/ */
@RestController @Service
@RequestMapping(value = "/InternalLogic") public class DeptInfoUpdateService {
public class DeptInfoUpdateController {
private static final Logger log = LoggerFactory.getLogger(DeptInfoUpdateService.class);
private static final Logger log = LoggerFactory.getLogger(DeptInfoUpdateController.class);
@Resource @Resource
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Resource @Resource
private DruidDataSource druidDataSource; private DruidDataSource druidDataSource;
@Value("${dwxxbgPullUrl}") @Value("${businessProcessing}")
private String dwxxbgPullUrl; private String businessProcessing;
@Value("${dwxxbgPushUrl}")
private String dwxxbgPushUrl;
@Value("${timetype}")
private String timetype;
@Value("${startTime}")
private String startTime;
@Value("${endTime}")
private String endTime;
/**
* 模拟数据
*
* @return
*/
private static String mockDwxxbgHttp() {
List<UnitAccountOpeningInformation> informationList = new ArrayList<>();
UnitAccountOpeningInformation information = new UnitAccountOpeningInformation();
information.setBusId("2");
information.setUscc("91421122MAC7ANQB8C");
information.setEntName("红安县永利土石方工程有限公司");
information.setDom("湖北省黄冈市红安县高桥镇长扬路东端北侧119号");
information.setLerep("吴永利");
information.setCerType("10");
information.setCerNo("422123197810295851");
information.setOperatorName("吴永利");
information.setOperatorCerNo("422123197810295851");
information.setOperatorPhone("13872001037");
information.setOplocdistrict("421122");
information.setUnitNature("A313");
information.setEconomicType("1");
information.setIndustryphy("E");
information.setUnitPayDay("1");
informationList.add(information);
Json json = new Json();
json.setData(informationList);
String dwxxbgHttp = JSONObject.toJSONString(json);
return dwxxbgHttp;
}
/**
* 公积金系统服务接口内置机调前置机中间接口
*
* @param
* @param
*/
@ResponseBody
@PostMapping("/getDwxxbgHttp")
public String getDwxxbgHttp() {
JSONObject jsonObject = new JSONObject();
if ("1".equals(timetype)) {// 表示正式环境
jsonObject.put("startTime", InternalUtils.currentTime(0));// 正式环境
jsonObject.put("endTime", InternalUtils.currentTime(24));// 正式环境
} else if ("2".equals(timetype)) {// 表示测试环境或本地环境
jsonObject.put("startTime", startTime);// 测试环境或本地环境
jsonObject.put("endTime", endTime);// 测试环境或本地环境
}
jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186");
jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
String str = jsonObject.toString();
//(测试环境地址)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
String forObject = restTemplate.postForObject(dwxxbgPullUrl, str, String.class);
return forObject;
}
/** /**
* (第一个定时的) * (第一个定时的)
...@@ -116,23 +48,10 @@ public class DeptInfoUpdateController { ...@@ -116,23 +48,10 @@ public class DeptInfoUpdateController {
* *
* @return * @return
*/ */
@ResponseBody public void deptInfoUpdatePull(List<UnitAccountOpeningInformation> bills) {
@PostMapping("/dwxxbgPull")
public AjaxResult dwxxbgPull() {
// 1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
String dwxxbgHttp = getDwxxbgHttp();
// String dwxxbgHttp = mockDwxxbgHttp();
log.info("拿到第一个接口返回的第三方数据:{}", dwxxbgHttp);
Json jsonentity = JSONObject.parseObject(dwxxbgHttp, Json.class);
List<UnitAccountOpeningInformation> bills = null;
if (!InternalUtils.isNullOrEmpty(jsonentity)) {
bills = jsonentity.getData();
}
if (CollectionUtils.isEmpty(bills)) { if (CollectionUtils.isEmpty(bills)) {
log.info("第三方返回的报文中data数据为空!"); return;
return AjaxResult.success("第三方返回的报文中data数据为空", null);
} }
// 2.内置机处理返回的业务数据,调用oracle存储过程 // 2.内置机处理返回的业务数据,调用oracle存储过程
Connection connection = null; Connection connection = null;
CallableStatement dwxxbgImp = null; CallableStatement dwxxbgImp = null;
...@@ -143,68 +62,69 @@ public class DeptInfoUpdateController { ...@@ -143,68 +62,69 @@ public class DeptInfoUpdateController {
dwxxbgImp = connection.prepareCall("{call JGJ_KSYW_DWXXBG.DWXXBG_IMP(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}"); dwxxbgImp = connection.prepareCall("{call JGJ_KSYW_DWXXBG.DWXXBG_IMP(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}");
// 循环插入 // 循环插入
for (UnitAccountOpeningInformation uniInfom : bills) { for (UnitAccountOpeningInformation uniInfom : bills) {
if (!StringUtils.isEmpty(uniInfom.getOplocdistrict())) { if (StringUtils.isEmpty(uniInfom.getOplocdistrict())) {
// 业务标识 continue;
String busId = StringUtils.hasText(uniInfom.getBusId()) ? uniInfom.getBusId() : ""; }
dwxxbgImp.setString(1, busId); // 业务标识
// 统一社会信用 String busId = StringUtils.hasText(uniInfom.getBusId()) ? uniInfom.getBusId() : "";
String uscc = StringUtils.hasText(uniInfom.getUscc()) ? uniInfom.getUscc() : ""; dwxxbgImp.setString(1, busId);
dwxxbgImp.setString(2, uscc); // 统一社会信用
// 企业名称 String uscc = StringUtils.hasText(uniInfom.getUscc()) ? uniInfom.getUscc() : "";
String entName = StringUtils.hasText(uniInfom.getEntName()) ? uniInfom.getEntName() : ""; dwxxbgImp.setString(2, uscc);
dwxxbgImp.setString(3, entName); // 企业名称
// 单位地址 String entName = StringUtils.hasText(uniInfom.getEntName()) ? uniInfom.getEntName() : "";
String dom = StringUtils.hasText(uniInfom.getDom()) ? uniInfom.getDom() : ""; dwxxbgImp.setString(3, entName);
dwxxbgImp.setString(4, dom); // 单位地址
// 法人代表姓名 String dom = StringUtils.hasText(uniInfom.getDom()) ? uniInfom.getDom() : "";
String lerep = StringUtils.hasText(uniInfom.getLerep()) ? uniInfom.getLerep() : ""; dwxxbgImp.setString(4, dom);
dwxxbgImp.setString(5, lerep); // 法人代表姓名
// 法人证件类型 String lerep = StringUtils.hasText(uniInfom.getLerep()) ? uniInfom.getLerep() : "";
String cerType = StringUtils.hasText(uniInfom.getCerType()) ? uniInfom.getCerType() : ""; dwxxbgImp.setString(5, lerep);
dwxxbgImp.setString(6, cerType); // 法人证件类型
// 法人证件号码 String cerType = StringUtils.hasText(uniInfom.getCerType()) ? uniInfom.getCerType() : "";
String cerNo = StringUtils.hasText(uniInfom.getCerNo()) ? uniInfom.getCerNo() : ""; dwxxbgImp.setString(6, cerType);
dwxxbgImp.setString(7, cerNo); // 法人证件号码
// 经办人姓名 String cerNo = StringUtils.hasText(uniInfom.getCerNo()) ? uniInfom.getCerNo() : "";
String operatorName = StringUtils.hasText(uniInfom.getOperatorName()) ? uniInfom.getOperatorName() : ""; dwxxbgImp.setString(7, cerNo);
dwxxbgImp.setString(8, operatorName); // 经办人姓名
// 经办人身份证号 String operatorName = StringUtils.hasText(uniInfom.getOperatorName()) ? uniInfom.getOperatorName() : "";
String operatorCerNo = StringUtils.hasText(uniInfom.getOperatorCerNo()) ? uniInfom.getOperatorCerNo() : ""; dwxxbgImp.setString(8, operatorName);
dwxxbgImp.setString(9, operatorCerNo); // 经办人身份证号
// 经办人联系电话 String operatorCerNo = StringUtils.hasText(uniInfom.getOperatorCerNo()) ? uniInfom.getOperatorCerNo() : "";
String operatorPhone = StringUtils.hasText(uniInfom.getOperatorPhone()) ? uniInfom.getOperatorPhone() : ""; dwxxbgImp.setString(9, operatorCerNo);
dwxxbgImp.setString(10, operatorPhone); // 经办人联系电话
// 所属区域 String operatorPhone = StringUtils.hasText(uniInfom.getOperatorPhone()) ? uniInfom.getOperatorPhone() : "";
String oplocdistrict = StringUtils.hasText(uniInfom.getOplocdistrict()) ? uniInfom.getOplocdistrict() : ""; dwxxbgImp.setString(10, operatorPhone);
dwxxbgImp.setString(11, oplocdistrict); // 所属区域
// 单位性质 String oplocdistrict = StringUtils.hasText(uniInfom.getOplocdistrict()) ? uniInfom.getOplocdistrict() : "";
String unitNature = StringUtils.hasText(uniInfom.getUnitNature()) ? uniInfom.getUnitNature() : ""; dwxxbgImp.setString(11, oplocdistrict);
dwxxbgImp.setString(12, unitNature); // 单位性质
// 经济类型 String unitNature = StringUtils.hasText(uniInfom.getUnitNature()) ? uniInfom.getUnitNature() : "";
String economicType = StringUtils.hasText(uniInfom.getEconomicType()) ? uniInfom.getEconomicType() : ""; dwxxbgImp.setString(12, unitNature);
dwxxbgImp.setString(13, economicType); // 经济类型
// 所属行业 String economicType = StringUtils.hasText(uniInfom.getEconomicType()) ? uniInfom.getEconomicType() : "";
String industryphy = StringUtils.hasText(uniInfom.getIndustryphy()) ? uniInfom.getIndustryphy() : ""; dwxxbgImp.setString(13, economicType);
dwxxbgImp.setString(14, industryphy); // 所属行业
// 单位发薪日 String industryphy = StringUtils.hasText(uniInfom.getIndustryphy()) ? uniInfom.getIndustryphy() : "";
String unitPayDay = StringUtils.hasText(uniInfom.getUnitPayDay()) ? uniInfom.getUnitPayDay() : ""; dwxxbgImp.setString(14, industryphy);
dwxxbgImp.setString(15, unitPayDay); // 单位发薪日
// 输出结果[第二个参数] String unitPayDay = StringUtils.hasText(uniInfom.getUnitPayDay()) ? uniInfom.getUnitPayDay() : "";
dwxxbgImp.registerOutParameter(16, OracleTypes.VARCHAR); dwxxbgImp.setString(15, unitPayDay);
dwxxbgImp.registerOutParameter(17, OracleTypes.VARCHAR); // 输出结果[第二个参数]
// 执行数据库查询操作 dwxxbgImp.registerOutParameter(16, OracleTypes.VARCHAR);
dwxxbgImp.execute(); dwxxbgImp.registerOutParameter(17, OracleTypes.VARCHAR);
// 获取出参 // 执行数据库查询操作
String errcode = dwxxbgImp.getString(16); dwxxbgImp.execute();
String errmsg = dwxxbgImp.getString(17); // 获取出参
log.info("DWXXBG_IMP 执行结果 errcode:{},errmsg :{}", errcode, errmsg); String errcode = dwxxbgImp.getString(16);
if (StringUtils.isEmpty(errcode)) { String errmsg = dwxxbgImp.getString(17);
log.error("DWXXBG_IMP 执行结果 errcode:{},errmsg :{},对应数据为:{}", errcode, errmsg, JSON.toJSONString(uniInfom)); log.info("DWXXBG_IMP 执行结果 errcode:{},errmsg :{}", errcode, errmsg);
continue; if (StringUtils.isEmpty(errcode)) {
} else { log.error("DWXXBG_IMP 执行结果 errcode:{},errmsg :{},对应数据为:{}", errcode, errmsg, JSON.toJSONString(uniInfom));
// 避免批量插入高并发,此处设置每次停顿5秒 continue;
Thread.currentThread().sleep(2000); } else {
} // 避免批量插入高并发,此处设置每次停顿5秒
Thread.currentThread().sleep(2000);
} }
} }
// 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程 // 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
...@@ -223,21 +143,15 @@ public class DeptInfoUpdateController { ...@@ -223,21 +143,15 @@ public class DeptInfoUpdateController {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
return AjaxResult.success("请求成功", null);
} }
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* (第二个定时) * (第二个定时)
*
* @param
* @param
*/ */
@ResponseBody public String deptInfoUpdatePush() {
@PostMapping("/dwxxbgPush")
public String dwxxbgPush() {
// 调oracle存储过程拿到进度推进的数据集合 // 调oracle存储过程拿到进度推进的数据集合
List<BusinessProcessing> collDwxxbgList = collDwxxbg(); List<BusinessProcessing> collDwxxbgList = collDeptInfoUpdate();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("state", "1"); jsonObject.put("state", "1");
if (!CollectionUtils.isEmpty(collDwxxbgList)) { if (!CollectionUtils.isEmpty(collDwxxbgList)) {
...@@ -252,25 +166,22 @@ public class DeptInfoUpdateController { ...@@ -252,25 +166,22 @@ public class DeptInfoUpdateController {
String str = jsonObject.toString(); String str = jsonObject.toString();
//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 //(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
String forObject = restTemplate.postForObject(dwxxbgPushUrl, str, String.class); String forObject = restTemplate.postForObject(businessProcessing, str, String.class);
log.info("前置机返回第三方解压之后的进度推送结果:{}", forObject); log.info("前置机返回第三方解压之后的进度推送结果:{}", forObject);
JSONObject jsonObj = JSONObject.parseObject(forObject); JSONObject jsonObj = JSONObject.parseObject(forObject);
Integer value = "true".equals(jsonObj.getString("success")) ? 1 : 0; Integer value = "true".equals(jsonObj.getString("success")) ? 1 : 0;
String uscc = !CollectionUtils.isEmpty(collDwxxbgList) ? collDwxxbgList.get(0).getUscc() : ""; String uscc = !CollectionUtils.isEmpty(collDwxxbgList) ? collDwxxbgList.get(0).getUscc() : "";
log.info("入参 uscc:{} value:{}", uscc, value); log.info("入参 uscc:{} value:{}", uscc, value);
collDwxxbgHx(uscc, value); // 回写
collDeptInfoUpdateRewrite(uscc, value);
return forObject; return forObject;
} }
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* 调用oracle存储过程拿到进度数据,然后请求前置机,让前置机请求市监接口,将办理的进度数据推送给市监 * 调用oracle存储过程拿到进度数据,然后请求前置机,让前置机请求市监接口,将办理的进度数据推送给市监
*
* @return
*/ */
@ResponseBody public List<BusinessProcessing> collDeptInfoUpdate() {
@PostMapping("/collDwxxbg")
public List<BusinessProcessing> collDwxxbg() {
List<BusinessProcessing> list = new ArrayList<>(); List<BusinessProcessing> list = new ArrayList<>();
Connection connection = null; Connection connection = null;
CallableStatement dwxxbgCx = null; CallableStatement dwxxbgCx = null;
...@@ -338,7 +249,10 @@ public class DeptInfoUpdateController { ...@@ -338,7 +249,10 @@ public class DeptInfoUpdateController {
} }
public void collDwxxbgHx(String uscc, Integer value) { /**
* 单位变更回写
*/
public void collDeptInfoUpdateRewrite(String uscc, Integer value) {
Connection connection = null; Connection connection = null;
CallableStatement pstm = null; CallableStatement pstm = null;
// 1.调用oracle存储过程,拿到业务办理进度数据 // 1.调用oracle存储过程,拿到业务办理进度数据
...@@ -363,4 +277,5 @@ public class DeptInfoUpdateController { ...@@ -363,4 +277,5 @@ public class DeptInfoUpdateController {
} }
} }
} }
package net.cdkj.gjj.adapter.controller; 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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import net.cdkj.gjj.adapter.domain.AjaxResult;
import net.cdkj.gjj.adapter.domain.BusinessProcessing; import net.cdkj.gjj.adapter.domain.BusinessProcessing;
import net.cdkj.gjj.adapter.domain.Json;
import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation; import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation;
import net.cdkj.gjj.adapter.utils.InternalUtils;
import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleTypes;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -34,70 +28,17 @@ import java.util.List; ...@@ -34,70 +28,17 @@ import java.util.List;
/** /**
* 公积金系统服务类 * 公积金系统服务类
*/ */
@RestController @Service
@RequestMapping(value = "/InternalLogic") public class DeptLogoutService {
public class DeptLogoutController {
private static final Logger log = LoggerFactory.getLogger(DeptLogoutController.class); private static final Logger log = LoggerFactory.getLogger(DeptLogoutService.class);
@Resource @Resource
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Resource @Resource
private DruidDataSource druidDataSource; private DruidDataSource druidDataSource;
@Value("${dwxhPullUrl}") @Value("${businessProcessing}")
private String dwxhPullUrl; private String businessProcessing;
@Value("${dwxhPushUrl}")
private String dwxhPushUrl;
@Value("${timetype}")
private String timetype;
@Value("${startTime}")
private String startTime;
@Value("${endTime}")
private String endTime;
/**
* 模拟数据
*
* @return
*/
private static String mockDwxhHttp() {
List<UnitAccountOpeningInformation> informationList = new ArrayList<>();
UnitAccountOpeningInformation information = new UnitAccountOpeningInformation();
information.setBusId("2");
information.setUscc("91421122MAC7ANQB8C");
information.setEntName("红安县永利土石方工程有限公司");
information.setDom("湖北省黄冈市红安县高桥镇长扬路东端北侧119号");
information.setOplocdistrict("421122");
informationList.add(information);
Json json = new Json();
json.setData(informationList);
String dwxhHttp = JSONObject.toJSONString(json);
return dwxhHttp;
}
/**
* 公积金系统服务接口内置机调前置机中间接口
*
* @param
* @param
*/
@ResponseBody
@PostMapping("/getDwxhHttp")
public String getDwxhHttp() {
JSONObject jsonObject = new JSONObject();
if ("1".equals(timetype)) {// 表示正式环境
jsonObject.put("startTime", InternalUtils.currentTime(0));// 正式环境
jsonObject.put("endTime", InternalUtils.currentTime(24));// 正式环境
} else if ("2".equals(timetype)) {// 表示测试环境或本地环境
jsonObject.put("startTime", startTime);// 测试环境或本地环境
jsonObject.put("endTime", endTime);// 测试环境或本地环境
}
jsonObject.put("app_id", "eb453ca78b354f2c9163a703530f5186");
jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
String str = jsonObject.toString();
//(测试环境地址)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
String forObject = restTemplate.postForObject(dwxhPullUrl, str, String.class);
return forObject;
}
/** /**
* (第一个定时的) * (第一个定时的)
...@@ -106,22 +47,10 @@ public class DeptLogoutController { ...@@ -106,22 +47,10 @@ public class DeptLogoutController {
* *
* @return * @return
*/ */
@ResponseBody public void deptLogoutPull(List<UnitAccountOpeningInformation> bills) {
@PostMapping("/dwxhPull")
public AjaxResult dwxhPull() {
// 1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
String dwxhHttp = getDwxhHttp();
log.info("拿到第一个接口返回的第三方数据:{}", dwxhHttp);
Json jsonentity = JSONObject.parseObject(dwxhHttp, Json.class);
List<UnitAccountOpeningInformation> bills = null;
if (!InternalUtils.isNullOrEmpty(jsonentity)) {
bills = jsonentity.getData();
}
if (CollectionUtils.isEmpty(bills)) { if (CollectionUtils.isEmpty(bills)) {
log.info("第三方返回的报文中data数据为空!"); return;
return AjaxResult.success("第三方返回的报文中data数据为空", null);
} }
// 2.内置机处理返回的业务数据,调用oracle存储过程 // 2.内置机处理返回的业务数据,调用oracle存储过程
Connection connection = null; Connection connection = null;
CallableStatement dwxhImp = null; CallableStatement dwxhImp = null;
...@@ -132,38 +61,39 @@ public class DeptLogoutController { ...@@ -132,38 +61,39 @@ public class DeptLogoutController {
dwxhImp = connection.prepareCall("{call JGJ_KSYW_DWXH.DWXH_IMP(?, ?, ?, ?, ?, ?, ?)}"); dwxhImp = connection.prepareCall("{call JGJ_KSYW_DWXH.DWXH_IMP(?, ?, ?, ?, ?, ?, ?)}");
// 循环插入 // 循环插入
for (UnitAccountOpeningInformation uniInfom : bills) { for (UnitAccountOpeningInformation uniInfom : bills) {
if (!StringUtils.isEmpty(uniInfom.getOplocdistrict())) { if (StringUtils.isEmpty(uniInfom.getOplocdistrict())) {
// 业务标识 continue;
String busId = StringUtils.hasText(uniInfom.getBusId()) ? uniInfom.getBusId() : ""; }
dwxhImp.setString(1, busId); // 业务标识
// 统一社会信用 String busId = StringUtils.hasText(uniInfom.getBusId()) ? uniInfom.getBusId() : "";
String uscc = StringUtils.hasText(uniInfom.getUscc()) ? uniInfom.getUscc() : ""; dwxhImp.setString(1, busId);
dwxhImp.setString(2, uscc); // 统一社会信用
// 企业名称 String uscc = StringUtils.hasText(uniInfom.getUscc()) ? uniInfom.getUscc() : "";
String entName = StringUtils.hasText(uniInfom.getEntName()) ? uniInfom.getEntName() : ""; dwxhImp.setString(2, uscc);
dwxhImp.setString(3, entName); // 企业名称
// 单位地址 String entName = StringUtils.hasText(uniInfom.getEntName()) ? uniInfom.getEntName() : "";
String dom = StringUtils.hasText(uniInfom.getDom()) ? uniInfom.getDom() : ""; dwxhImp.setString(3, entName);
dwxhImp.setString(4, dom); // 单位地址
// 所属区域 String dom = StringUtils.hasText(uniInfom.getDom()) ? uniInfom.getDom() : "";
String oplocdistrict = StringUtils.hasText(uniInfom.getOplocdistrict()) ? uniInfom.getOplocdistrict() : ""; dwxhImp.setString(4, dom);
dwxhImp.setString(5, oplocdistrict); // 所属区域
// 输出结果[第二个参数] String oplocdistrict = StringUtils.hasText(uniInfom.getOplocdistrict()) ? uniInfom.getOplocdistrict() : "";
dwxhImp.registerOutParameter(6, OracleTypes.VARCHAR); dwxhImp.setString(5, oplocdistrict);
dwxhImp.registerOutParameter(7, OracleTypes.VARCHAR); // 输出结果[第二个参数]
// 执行数据库查询操作 dwxhImp.registerOutParameter(6, OracleTypes.VARCHAR);
dwxhImp.execute(); dwxhImp.registerOutParameter(7, OracleTypes.VARCHAR);
// 获取出参 // 执行数据库查询操作
String errcode = dwxhImp.getString(7); dwxhImp.execute();
String errmsg = dwxhImp.getString(7); // 获取出参
log.info("DWXH_IMP 执行结果 errcode:{},errmsg :{}", errcode, errmsg); String errcode = dwxhImp.getString(7);
if (StringUtils.isEmpty(errcode)) { String errmsg = dwxhImp.getString(7);
log.error("DWXH_IMP 执行结果 errcode:{},errmsg :{},对应数据为:{}", errcode, errmsg, JSON.toJSONString(uniInfom)); log.info("DWXH_IMP 执行结果 errcode:{},errmsg :{}", errcode, errmsg);
continue; if (StringUtils.isEmpty(errcode)) {
} else { log.error("DWXH_IMP 执行结果 errcode:{},errmsg :{},对应数据为:{}", errcode, errmsg, JSON.toJSONString(uniInfom));
// 避免批量插入高并发,此处设置每次停顿5秒 continue;
Thread.currentThread().sleep(2000); } else {
} // 避免批量插入高并发,此处设置每次停顿5秒
Thread.currentThread().sleep(2000);
} }
} }
// 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程 // 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
...@@ -182,18 +112,12 @@ public class DeptLogoutController { ...@@ -182,18 +112,12 @@ public class DeptLogoutController {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
return AjaxResult.success("请求成功", null);
} }
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* (第二个定时) * (第二个定时)
*
* @param
* @param
*/ */
@ResponseBody
@PostMapping("/dwxhPush")
public String dwxhPush() { public String dwxhPush() {
// 调oracle存储过程拿到进度推进的数据集合 // 调oracle存储过程拿到进度推进的数据集合
List<BusinessProcessing> collDwxhList = collDwxh(); List<BusinessProcessing> collDwxhList = collDwxh();
...@@ -211,12 +135,13 @@ public class DeptLogoutController { ...@@ -211,12 +135,13 @@ public class DeptLogoutController {
String str = jsonObject.toString(); String str = jsonObject.toString();
//(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口 //(测试环境)调用前置机将业务机封装的业务json数据发给前置机,让前置机去请求第三方的公积金系统服务接口
String forObject = restTemplate.postForObject(dwxhPushUrl, str, String.class); String forObject = restTemplate.postForObject(businessProcessing, str, String.class);
log.info("前置机返回第三方解压之后的进度推送结果:{}", forObject); log.info("前置机返回第三方解压之后的进度推送结果:{}", forObject);
JSONObject jsonObj = JSONObject.parseObject(forObject); JSONObject jsonObj = JSONObject.parseObject(forObject);
Integer value = "true".equals(jsonObj.getString("success")) ? 1 : 0; Integer value = "true".equals(jsonObj.getString("success")) ? 1 : 0;
String uscc = !CollectionUtils.isEmpty(collDwxhList) ? collDwxhList.get(0).getUscc() : ""; String uscc = !CollectionUtils.isEmpty(collDwxhList) ? collDwxhList.get(0).getUscc() : "";
log.info("入参 uscc:{} value:{}", uscc, value); log.info("入参 uscc:{} value:{}", uscc, value);
// 回写
collDwxhHx(uscc, value); collDwxhHx(uscc, value);
return forObject; return forObject;
} }
...@@ -224,11 +149,7 @@ public class DeptLogoutController { ...@@ -224,11 +149,7 @@ public class DeptLogoutController {
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* 调用oracle存储过程拿到进度数据,然后请求前置机,让前置机请求市监接口,将办理的进度数据推送给市监 * 调用oracle存储过程拿到进度数据,然后请求前置机,让前置机请求市监接口,将办理的进度数据推送给市监
*
* @return
*/ */
@ResponseBody
@PostMapping("/collDwxh")
public List<BusinessProcessing> collDwxh() { public List<BusinessProcessing> collDwxh() {
List<BusinessProcessing> list = new ArrayList<>(); List<BusinessProcessing> list = new ArrayList<>();
Connection connection = null; Connection connection = null;
...@@ -297,6 +218,9 @@ public class DeptLogoutController { ...@@ -297,6 +218,9 @@ public class DeptLogoutController {
} }
/**
* 回写
*/
public void collDwxhHx(String uscc, Integer value) { public void collDwxhHx(String uscc, Integer value) {
Connection connection = null; Connection connection = null;
CallableStatement pstm = null; CallableStatement pstm = null;
......
package net.cdkj.gjj.adapter.controller; package net.cdkj.gjj.adapter.service;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
...@@ -12,39 +12,43 @@ import oracle.jdbc.OracleTypes; ...@@ -12,39 +12,43 @@ import oracle.jdbc.OracleTypes;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; 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.*; import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
/** /**
* 公积金系统服务类 * 公积金系统服务类
*/ */
@RestController @Service
@RequestMapping(value = "InternalLogic") public class OpenAccountService {
public class ProvidentFundServicesController {
// sl4j // sl4j
private static final Logger logger = LoggerFactory.getLogger(ProvidentFundServicesController.class); private static final Logger logger = LoggerFactory.getLogger(OpenAccountService.class);
@Resource @Resource
private DruidDataSource dataSource; private DruidDataSource dataSource;
@Resource
private DeptLogoutService deptLogoutService;
@Resource
private DeptInfoUpdateService deptInfoUpdateService;
@Value("${providentFundServices}")
private String providentFundServices;
@Value("${dwkhPullUrl}") @Value("${businessProcessing}")
private String dwkhPullUrl; private String businessProcessing;
@Value("${dwkhPushUrl}")
private String dwkhPushUrl;
@Value("${timetype}") @Value("${timetype}")
private String timetype; private String timetype;
...@@ -55,62 +59,14 @@ public class ProvidentFundServicesController { ...@@ -55,62 +59,14 @@ public class ProvidentFundServicesController {
@Value("${endTime}") @Value("${endTime}")
private String endTime; private String endTime;
/**
* 获取当天零点零分零秒的时间戳和当天24点的时间戳
*
* @return
*/
@ResponseBody
@PostMapping("currentime")
public static String currenttime(int type) {
return InternalUtils.currentTime(type);
}
/**
* 判断一个实体对象是否为空
*
* @param obj
* @return
*/
public static boolean isNullOrEmpty(Object obj) {
if (obj == null)
return true;
if (obj instanceof CharSequence)
return ((CharSequence) obj).length() == 0;
if (obj instanceof Collection)
return ((Collection) obj).isEmpty();
if (obj instanceof Map)
return ((Map) obj).isEmpty();
if (obj instanceof Object[]) {
Object[] object = (Object[]) obj;
if (object.length == 0) {
return true;
}
boolean empty = true;
for (int i = 0; i < object.length; i++) {
if (!isNullOrEmpty(object[i])) {
empty = false;
break;
}
}
return empty;
}
return false;
}
/** /**
* 公积金系统服务接口内置机调前置机中间接口 * 公积金系统服务接口内置机调前置机中间接口
*
* @param
* @param
*/ */
@ResponseBody public void syncDeptInfo() throws Exception {
@PostMapping("ProvidentFundServices")
public String ProvidentFundServices() {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
if ("1".equals(timetype)) {// 表示正式环境 if ("1".equals(timetype)) {// 表示正式环境
jsonObject.put("startTime", currenttime(0));// 正式环境 jsonObject.put("startTime", InternalUtils.currentTime(0));// 正式环境
jsonObject.put("endTime", currenttime(24));// 正式环境 jsonObject.put("endTime", InternalUtils.currentTime(24));// 正式环境
} else if ("2".equals(timetype)) {// 表示测试环境或本地环境 } else if ("2".equals(timetype)) {// 表示测试环境或本地环境
jsonObject.put("startTime", startTime);// 测试环境或本地环境 jsonObject.put("startTime", startTime);// 测试环境或本地环境
jsonObject.put("endTime", endTime);// 测试环境或本地环境 jsonObject.put("endTime", endTime);// 测试环境或本地环境
...@@ -119,26 +75,44 @@ public class ProvidentFundServicesController { ...@@ -119,26 +75,44 @@ public class ProvidentFundServicesController {
jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186"); jsonObject.put("app_secret", "9a31b84878654a72a999e38ef55aa186");
String str = jsonObject.toString(); String str = jsonObject.toString();
// 发起 post 请求 // 发起 post 请求
return HttpUtil.sendPost(dwkhPullUrl, str); String result = HttpUtil.sendPost(providentFundServices, str);
// String result = mockDwxxHttp();
logger.info("拿到第一个接口返回的第三方数据,准备调第一个存储过程" + result);
Json jsonentity = JSONObject.parseObject(result, Json.class);
List<UnitAccountOpeningInformation> bills = new ArrayList<>();
if (!InternalUtils.isNullOrEmpty(jsonentity)) {
bills = jsonentity.getData();
}
List<UnitAccountOpeningInformation> openAccountList = new ArrayList<>();
List<UnitAccountOpeningInformation> deptInfoUpdateList = new ArrayList<>();
List<UnitAccountOpeningInformation> deptLogoutList = new ArrayList<>();
for (UnitAccountOpeningInformation bill : bills) {
String dataStatus = bill.getDataStatus();
// 开户
if (StringUtils.isEmpty(dataStatus) || dataStatus.equals("0")) {
openAccountList.add(bill);
// 变更
} else if (dataStatus.equals("1")) {
deptInfoUpdateList.add(bill);
// 注销
} else if (dataStatus.equals("2")) {
deptLogoutList.add(bill);
}
}
openAccountPull(openAccountList);
deptInfoUpdateService.deptInfoUpdatePull(deptInfoUpdateList);
deptLogoutService.deptLogoutPull(deptLogoutList);
} }
/** /**
* (第一个定时的) * (第一个定时的)
* 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口, * 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,
* 拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理 * 拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
*
* @return
*/ */
@ResponseBody public void openAccountPull(List<UnitAccountOpeningInformation> bills) throws Exception {
@PostMapping("gjjxtfwjk") if (CollectionUtils.isEmpty(bills)) {
public void gjjxtfwjk() throws Exception { return;
// 1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
String jsoninfom = ProvidentFundServices();
logger.info("拿到第一个接口返回的第三方数据,准备调第一个存储过程" + jsoninfom);
Json jsonentity = JSONObject.parseObject(jsoninfom, Json.class);
List<UnitAccountOpeningInformation> bills = new ArrayList<>();
if (!isNullOrEmpty(jsonentity)) {
bills = jsonentity.getData();
} }
// 2.内置机处理返回的业务数据,调用oracle存储过程 // 2.内置机处理返回的业务数据,调用oracle存储过程
// 加载数据库驱动 // 加载数据库驱动
...@@ -147,142 +121,140 @@ public class ProvidentFundServicesController { ...@@ -147,142 +121,140 @@ public class ProvidentFundServicesController {
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
// 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程 // 调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
CallableStatement pstm2 = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_SAVE()}"); CallableStatement pstm2 = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_SAVE()}");
if (!bills.isEmpty()) { for (UnitAccountOpeningInformation uniInfom : bills) {
for (UnitAccountOpeningInformation uniInfom : bills) { String oplocdistrict = uniInfom.getOplocdistrict();
if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) { if (StringUtils.isEmpty(oplocdistrict)) {
logger.info("oplocdistrict" + "在规定的值里面,调imp过程"); continue;
if (!"".equals(uniInfom.getBusId()) && uniInfom.getBusId() != null) { }
pstm.setString(1, uniInfom.getBusId()); logger.info("oplocdistrict" + "在规定的值里面,调imp过程");
} else { if (!"".equals(uniInfom.getBusId()) && uniInfom.getBusId() != null) {
pstm.setString(1, ""); pstm.setString(1, uniInfom.getBusId());
} } else {
pstm.setString(1, "");
if (!"".equals(uniInfom.getUscc()) && uniInfom.getUscc() != null) { }
pstm.setString(2, uniInfom.getUscc());
} else { if (!"".equals(uniInfom.getUscc()) && uniInfom.getUscc() != null) {
pstm.setString(2, ""); pstm.setString(2, uniInfom.getUscc());
} } else {
pstm.setString(2, "");
if (!"".equals(uniInfom.getEntName()) && uniInfom.getEntName() != null) { }
pstm.setString(3, uniInfom.getEntName());
} else { if (!"".equals(uniInfom.getEntName()) && uniInfom.getEntName() != null) {
pstm.setString(3, ""); pstm.setString(3, uniInfom.getEntName());
} } else {
pstm.setString(3, "");
if (!"".equals(uniInfom.getDom()) && uniInfom.getDom() != null) { }
pstm.setString(4, uniInfom.getDom());
} else {
pstm.setString(4, "");
}
if (!"".equals(uniInfom.getEstDate()) && uniInfom.getEstDate() != null) {
pstm.setDate(5, new java.sql.Date(uniInfom.getEstDate().getTime()));
} else {
pstm.setString(5, "");
}
if (!"".equals(uniInfom.getLerep()) && uniInfom.getLerep() != null) {
pstm.setString(6, uniInfom.getLerep());
} else {
pstm.setString(6, "");
}
if (!"".equals(uniInfom.getCerType()) && uniInfom.getCerType() != null) {
pstm.setString(7, uniInfom.getCerType());
} else {
pstm.setString(7, "");
}
if (!"".equals(uniInfom.getCerNo()) && uniInfom.getCerNo() != null) {
pstm.setString(8, uniInfom.getCerNo());
} else {
pstm.setString(8, "");
}
if (!"".equals(uniInfom.getOperatorName()) && uniInfom.getOperatorName() != null) {
pstm.setString(9, uniInfom.getOperatorName());
} else {
pstm.setString(9, "");
}
if (!"".equals(uniInfom.getOperatorCerNo()) && uniInfom.getOperatorCerNo() != null) {
pstm.setString(10, uniInfom.getOperatorCerNo());
} else {
pstm.setString(10, "");
}
if (!"".equals(uniInfom.getOperatorPhone()) && uniInfom.getOperatorPhone() != null) {
pstm.setString(11, uniInfom.getOperatorPhone());
} else {
pstm.setString(11, "");
}
if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) {
pstm.setString(12, uniInfom.getOplocdistrict());
} else {
pstm.setString(12, "");
}
if (!"".equals(uniInfom.getUnitNature()) && uniInfom.getUnitNature() != null) {
pstm.setString(13, uniInfom.getUnitNature());
} else {
pstm.setString(13, "");
}
if (!"".equals(uniInfom.getEconomicType()) && uniInfom.getEconomicType() != null) {
pstm.setString(14, uniInfom.getEconomicType());
} else {
pstm.setString(14, "");
}
if (!"".equals(uniInfom.getIndustryphy()) && uniInfom.getIndustryphy() != null) {
pstm.setString(15, uniInfom.getIndustryphy());
} else {
pstm.setString(15, "");
}
if (!"".equals(uniInfom.getUnitPayDay()) && uniInfom.getUnitPayDay() != null) {
pstm.setString(16, uniInfom.getUnitPayDay());
} else {
pstm.setString(16, "");
}
if (!"".equals(uniInfom.getUnitDepPro()) && uniInfom.getUnitDepPro() != null) {
pstm.setString(17, uniInfom.getUnitDepPro());
} else {
pstm.setString(17, "");
}
if (!"".equals(uniInfom.getPersonalDepPro()) && uniInfom.getPersonalDepPro() != null) {
pstm.setString(18, uniInfom.getPersonalDepPro());
} else {
pstm.setString(18, "");
}
pstm.registerOutParameter(19, oracle.jdbc.OracleTypes.VARCHAR);
pstm.registerOutParameter(20, oracle.jdbc.OracleTypes.VARCHAR);
// 执行数据库查询操作
pstm.execute();
// 输出结果[第二个参数]
logger.info(pstm.getString(19));
logger.info(pstm.getString(20));
if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) {
break;
} else {
try {
// 避免批量插入高并发,此处设置每次停顿5秒
Thread.currentThread().sleep(2000);
logger.info("间隔2秒传一条数据调一次存储过程");
} catch (InterruptedException e) {
logger.error("{}", e);
}
}
if (!"".equals(uniInfom.getDom()) && uniInfom.getDom() != null) {
pstm.setString(4, uniInfom.getDom());
} else {
pstm.setString(4, "");
}
if (!"".equals(uniInfom.getEstDate()) && uniInfom.getEstDate() != null) {
pstm.setDate(5, new java.sql.Date(uniInfom.getEstDate().getTime()));
} else {
pstm.setString(5, "");
}
if (!"".equals(uniInfom.getLerep()) && uniInfom.getLerep() != null) {
pstm.setString(6, uniInfom.getLerep());
} else {
pstm.setString(6, "");
}
if (!"".equals(uniInfom.getCerType()) && uniInfom.getCerType() != null) {
pstm.setString(7, uniInfom.getCerType());
} else {
pstm.setString(7, "");
}
if (!"".equals(uniInfom.getCerNo()) && uniInfom.getCerNo() != null) {
pstm.setString(8, uniInfom.getCerNo());
} else {
pstm.setString(8, "");
}
if (!"".equals(uniInfom.getOperatorName()) && uniInfom.getOperatorName() != null) {
pstm.setString(9, uniInfom.getOperatorName());
} else {
pstm.setString(9, "");
}
if (!"".equals(uniInfom.getOperatorCerNo()) && uniInfom.getOperatorCerNo() != null) {
pstm.setString(10, uniInfom.getOperatorCerNo());
} else {
pstm.setString(10, "");
}
if (!"".equals(uniInfom.getOperatorPhone()) && uniInfom.getOperatorPhone() != null) {
pstm.setString(11, uniInfom.getOperatorPhone());
} else {
pstm.setString(11, "");
}
if (!"".equals(oplocdistrict) && oplocdistrict != null) {
pstm.setString(12, oplocdistrict);
} else {
pstm.setString(12, "");
}
if (!"".equals(uniInfom.getUnitNature()) && uniInfom.getUnitNature() != null) {
pstm.setString(13, uniInfom.getUnitNature());
} else {
pstm.setString(13, "");
}
if (!"".equals(uniInfom.getEconomicType()) && uniInfom.getEconomicType() != null) {
pstm.setString(14, uniInfom.getEconomicType());
} else {
pstm.setString(14, "");
}
if (!"".equals(uniInfom.getIndustryphy()) && uniInfom.getIndustryphy() != null) {
pstm.setString(15, uniInfom.getIndustryphy());
} else {
pstm.setString(15, "");
}
if (!"".equals(uniInfom.getUnitPayDay()) && uniInfom.getUnitPayDay() != null) {
pstm.setString(16, uniInfom.getUnitPayDay());
} else {
pstm.setString(16, "");
}
if (!"".equals(uniInfom.getUnitDepPro()) && uniInfom.getUnitDepPro() != null) {
pstm.setString(17, uniInfom.getUnitDepPro());
} else {
pstm.setString(17, "");
}
if (!"".equals(uniInfom.getPersonalDepPro()) && uniInfom.getPersonalDepPro() != null) {
pstm.setString(18, uniInfom.getPersonalDepPro());
} else {
pstm.setString(18, "");
}
pstm.registerOutParameter(19, OracleTypes.VARCHAR);
pstm.registerOutParameter(20, OracleTypes.VARCHAR);
// 执行数据库查询操作
pstm.execute();
// 输出结果[第二个参数]
logger.info(pstm.getString(19));
logger.info(pstm.getString(20));
if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) {
break;
} else {
try {
// 避免批量插入高并发,此处设置每次停顿5秒
Thread.currentThread().sleep(2000);
logger.info("间隔2秒传一条数据调一次存储过程");
} catch (InterruptedException e) {
logger.error("{}", e);
} }
} }
pstm2.execute();
} else {
logger.info("第三方返回的报文中data数据为空!");
} }
pstm2.execute();
// 释放资源 // 释放资源
pstm.close(); pstm.close();
pstm2.close(); pstm2.close();
...@@ -292,18 +264,13 @@ public class ProvidentFundServicesController { ...@@ -292,18 +264,13 @@ public class ProvidentFundServicesController {
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* (第二个定时) * (第二个定时)
*
* @param
* @param
*/ */
@ResponseBody public String dwkhPush() {
@PostMapping("BusinessProcessing")
public String BusinessProcessing() {
logger.info("调第二个接口了"); logger.info("调第二个接口了");
// 调oracle存储过程拿到进度推进的数据集合 // 调oracle存储过程拿到进度推进的数据集合
List<BusinessProcessing> list = null; List<BusinessProcessing> list = null;
try { try {
list = zjbmfhywtosj(); list = collOpenAccount();
} catch (Exception e) { } catch (Exception e) {
logger.error("{}", e); logger.error("{}", e);
} }
...@@ -325,7 +292,7 @@ public class ProvidentFundServicesController { ...@@ -325,7 +292,7 @@ public class ProvidentFundServicesController {
jsonObject.put("nodeList", list); jsonObject.put("nodeList", list);
String str = jsonObject.toString(); String str = jsonObject.toString();
// 发起 post 请求 // 发起 post 请求
String result = HttpUtil.sendPost(dwkhPushUrl, str); String result = HttpUtil.sendPost(businessProcessing, str);
if (result != null) { if (result != null) {
String uscc = ""; String uscc = "";
if (!list.isEmpty()) { if (!list.isEmpty()) {
...@@ -341,7 +308,7 @@ public class ProvidentFundServicesController { ...@@ -341,7 +308,7 @@ public class ProvidentFundServicesController {
value = 0; value = 0;
} }
try { try {
zjbmfhywtosjHX(uscc, value); collOpenAccountRewrite(uscc, value);
} catch (Exception e) { } catch (Exception e) {
logger.error("{}", e); logger.error("{}", e);
} }
...@@ -353,18 +320,14 @@ public class ProvidentFundServicesController { ...@@ -353,18 +320,14 @@ public class ProvidentFundServicesController {
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* 调用oracle存储过程拿到进度数据,然后请求前置机,让前置机请求市监接口,将办理的进度数据推送给市监 * 调用oracle存储过程拿到进度数据,然后请求前置机,让前置机请求市监接口,将办理的进度数据推送给市监
*
* @return
*/ */
@ResponseBody public List<BusinessProcessing> collOpenAccount() throws Exception {
@PostMapping("zjbmfhywtosj")
public List<BusinessProcessing> zjbmfhywtosj() throws Exception {
// 1.调用oracle存储过程,拿到业务办理进度数据 // 1.调用oracle存储过程,拿到业务办理进度数据
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
// 得到预编译的Statement对象 // 得到预编译的Statement对象
CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}"); CallableStatement pstm = connection.prepareCall("{call JGJ_KSYW_DWKH.DWKH_CX(?)}");
// 给参数赋值 // 给参数赋值
// pstm.setString(1,"914205007146986289"); // pstm.setString(1,"914205007146986289");
pstm.registerOutParameter(1, OracleTypes.CURSOR); pstm.registerOutParameter(1, OracleTypes.CURSOR);
// 执行数据库查询操作 // 执行数据库查询操作
pstm.execute(); pstm.execute();
...@@ -413,7 +376,10 @@ public class ProvidentFundServicesController { ...@@ -413,7 +376,10 @@ public class ProvidentFundServicesController {
} }
public void zjbmfhywtosjHX(String uscc, Integer value) throws Exception { /**
* 回写
*/
public void collOpenAccountRewrite(String uscc, Integer value) throws Exception {
// 1.调用oracle存储过程,拿到业务办理进度数据 // 1.调用oracle存储过程,拿到业务办理进度数据
// 加载数据库驱动 // 加载数据库驱动
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
...@@ -431,4 +397,68 @@ public class ProvidentFundServicesController { ...@@ -431,4 +397,68 @@ public class ProvidentFundServicesController {
connection.close(); connection.close();
} }
/**
* 模拟数据
*
* @return
*/
private static String mockDwxxHttp() {
List<UnitAccountOpeningInformation> informationList = new ArrayList<>();
// 单位变更
UnitAccountOpeningInformation dwkh = new UnitAccountOpeningInformation();
dwkh.setBusId("2");
dwkh.setUscc("91421122MAC7ANQB8C");
dwkh.setEntName("红安县永利土石方工程有限公司");
dwkh.setDom("湖北省黄冈市红安县高桥镇长扬路东端北侧119号");
dwkh.setEstDate(new Date());
dwkh.setLerep("吴永利");
dwkh.setCerType("10");
dwkh.setCerNo("422123197810295851");
dwkh.setOperatorName("吴永利");
dwkh.setOperatorCerNo("422123197810295851");
dwkh.setOperatorPhone("13872001037");
dwkh.setOplocdistrict("421122");
dwkh.setUnitNature("A313");
dwkh.setEconomicType("1");
dwkh.setIndustryphy("E");
dwkh.setUnitPayDay("1");
dwkh.setUnitDepPro("12");
dwkh.setPersonalDepPro("12");
informationList.add(dwkh);
// 单位变更
UnitAccountOpeningInformation dwxxBg = new UnitAccountOpeningInformation();
dwxxBg.setBusId("2");
dwxxBg.setUscc("91421122MAC7ANQB8C");
dwxxBg.setEntName("红安县永利土石方工程有限公司");
dwxxBg.setDom("湖北省黄冈市红安县高桥镇长扬路东端北侧119号");
dwxxBg.setLerep("吴永利");
dwxxBg.setCerType("10");
dwxxBg.setCerNo("422123197810295851");
dwxxBg.setOperatorName("吴永利");
dwxxBg.setOperatorCerNo("422123197810295851");
dwxxBg.setOperatorPhone("13872001037");
dwxxBg.setOplocdistrict("421122");
dwxxBg.setUnitNature("A313");
dwxxBg.setEconomicType("1");
dwxxBg.setIndustryphy("E");
dwxxBg.setUnitPayDay("1");
dwxxBg.setDataStatus("1");
informationList.add(dwxxBg);
// 单位销户
UnitAccountOpeningInformation dwXh = new UnitAccountOpeningInformation();
dwXh.setBusId("2");
dwXh.setUscc("91421122MAC7ANQB8C");
dwXh.setEntName("红安县永利土石方工程有限公司");
dwXh.setDom("湖北省黄冈市红安县高桥镇长扬路东端北侧119号");
dwXh.setOplocdistrict("421122");
dwXh.setDataStatus("2");
informationList.add(dwXh);
Json json = new Json();
json.setData(informationList);
String dwxxbgHttp = JSONObject.toJSONString(json);
return dwxxbgHttp;
}
} }
...@@ -24,20 +24,11 @@ password:ENC(PI2/xdOsEObL0YZlfGfQnyiJeYUw/90FePU+sO4EDjU=) ...@@ -24,20 +24,11 @@ password:ENC(PI2/xdOsEObL0YZlfGfQnyiJeYUw/90FePU+sO4EDjU=)
# 前置服务URL # 前置服务URL
#单位开户拉取url #单位信息拉取url
dwkhPullUrl:http://127.0.0.1:8081/FrontEndProcessor/ProvidentFundServices providentFundServices:http://127.0.0.1:8081/FrontEndProcessor/ProvidentFundServices
#单位开户推送url #办理进度推送url
dwkhPushUrl:http://127.0.0.1:8081/FrontEndProcessor/BusinessProcessing businessProcessing:http://127.0.0.1:8081/FrontEndProcessor/BusinessProcessing
#单位信息变跟拉取url
dwxxbgPullUrl:http://127.0.0.1:8081/FrontEndProcessor/dwxxbgPull
#单位信息变跟推送url
dwxxbgPushUrl:http://127.0.0.1:8081/FrontEndProcessor/dwxxbgPush
#单位销户拉取url
dwxhPullUrl:http://127.0.0.1:8081/FrontEndProcessor/dwxhPull
#单位销户推送url
dwxhPushUrl:http://127.0.0.1:8081/FrontEndProcessor/dwxhPush
...@@ -45,9 +36,7 @@ dwxhPushUrl:http://127.0.0.1:8081/FrontEndProcessor/dwxhPush ...@@ -45,9 +36,7 @@ dwxhPushUrl:http://127.0.0.1:8081/FrontEndProcessor/dwxhPush
dwkhPullTaskDelay:60000 dwkhPullTaskDelay:60000
dwkhPushTaskDelay:60000 dwkhPushTaskDelay:60000
dwxxbgPushTaskDelay:60000 dwxxbgPushTaskDelay:60000
dwxxbgPullTaskDelay:60000
dwxhPushTaskDelay:60000 dwxhPushTaskDelay:60000
dwxhPullTaskDelay:60000
# 日志配置 # 日志配置
logging.config:classpath:logback.xml logging.config:classpath:logback.xml
......
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