Commit c548c0a6 authored by 张俊's avatar 张俊

日志文件输出优化

parent 99c177d0
...@@ -2,7 +2,6 @@ package net.cdkj.gjj.adapter; ...@@ -2,7 +2,6 @@ package net.cdkj.gjj.adapter;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@SpringBootApplication @SpringBootApplication
......
...@@ -2,13 +2,8 @@ package net.cdkj.gjj.adapter.config; ...@@ -2,13 +2,8 @@ package net.cdkj.gjj.adapter.config;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.util.Properties;
/** /**
* druid 配置多数据源 * druid 配置多数据源
......
package net.cdkj.gjj.adapter.config; package net.cdkj.gjj.adapter.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -10,8 +9,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert ...@@ -10,8 +9,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.sql.DataSource;
/** /**
* 把RestTemplate注入Spring IOC容器 * 把RestTemplate注入Spring IOC容器
* *
...@@ -26,7 +23,7 @@ public class RestTemplateConfig { ...@@ -26,7 +23,7 @@ public class RestTemplateConfig {
RestTemplate restTemplate = restTemplateBuilder.build(); RestTemplate restTemplate = restTemplateBuilder.build();
// 设置HTTP request (请求)和response (响应)的转换器 // 设置HTTP request (请求)和response (响应)的转换器
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
//错误响应处理 // 错误响应处理
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() { restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
@Override @Override
protected boolean hasError(HttpStatus statusCode) { protected boolean hasError(HttpStatus statusCode) {
...@@ -41,5 +38,4 @@ public class RestTemplateConfig { ...@@ -41,5 +38,4 @@ public class RestTemplateConfig {
} }
} }
\ No newline at end of file
...@@ -4,14 +4,11 @@ package net.cdkj.gjj.adapter.controller; ...@@ -4,14 +4,11 @@ package net.cdkj.gjj.adapter.controller;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
/** /**
...@@ -42,7 +39,7 @@ public class AlarmTask { ...@@ -42,7 +39,7 @@ public class AlarmTask {
try { try {
providentFundServicesController.gjjxtfwjk(); providentFundServicesController.gjjxtfwjk();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("{}", e);
} }
} }
......
...@@ -4,7 +4,10 @@ package net.cdkj.gjj.adapter.controller; ...@@ -4,7 +4,10 @@ package net.cdkj.gjj.adapter.controller;
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.*; import net.cdkj.gjj.adapter.domain.AjaxResult;
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.utils.InternalUtils; import net.cdkj.gjj.adapter.utils.InternalUtils;
import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleTypes;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -35,29 +38,51 @@ import java.util.List; ...@@ -35,29 +38,51 @@ import java.util.List;
@RequestMapping(value = "/InternalLogic") @RequestMapping(value = "/InternalLogic")
public class DeptInfoUpdateController { public class DeptInfoUpdateController {
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("${dwxxbgPullUrl}")
private String dwxxbgPullUrl; private String dwxxbgPullUrl;
@Value("${dwxxbgPushUrl}") @Value("${dwxxbgPushUrl}")
private String dwxxbgPushUrl; private String dwxxbgPushUrl;
@Value("${timetype}") @Value("${timetype}")
private String timetype; private String timetype;
@Value("${startTime}") @Value("${startTime}")
private String startTime; private String startTime;
@Value("${endTime}") @Value("${endTime}")
private String endTime; private String endTime;
private static final Logger log = LoggerFactory.getLogger(DeptInfoUpdateController.class); /**
* 模拟数据
*
* @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;
}
/** /**
* 公积金系统服务接口内置机调前置机中间接口 * 公积金系统服务接口内置机调前置机中间接口
...@@ -84,7 +109,6 @@ public class DeptInfoUpdateController { ...@@ -84,7 +109,6 @@ public class DeptInfoUpdateController {
return forObject; return forObject;
} }
/** /**
* (第一个定时的) * (第一个定时的)
* 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口, * 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,
...@@ -202,37 +226,6 @@ public class DeptInfoUpdateController { ...@@ -202,37 +226,6 @@ public class DeptInfoUpdateController {
return AjaxResult.success("请求成功", null); return AjaxResult.success("请求成功", null);
} }
/**
* 模拟数据
*
* @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;
}
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* (第二个定时) * (第二个定时)
......
...@@ -38,28 +38,41 @@ import java.util.List; ...@@ -38,28 +38,41 @@ import java.util.List;
@RequestMapping(value = "/InternalLogic") @RequestMapping(value = "/InternalLogic")
public class DeptLogoutController { public class DeptLogoutController {
private static final Logger log = LoggerFactory.getLogger(DeptLogoutController.class);
@Resource @Resource
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Resource @Resource
private DruidDataSource druidDataSource; private DruidDataSource druidDataSource;
@Value("${dwxhPullUrl}") @Value("${dwxhPullUrl}")
private String dwxhPullUrl; private String dwxhPullUrl;
@Value("${dwxhPushUrl}") @Value("${dwxhPushUrl}")
private String dwxhPushUrl; private String dwxhPushUrl;
@Value("${timetype}") @Value("${timetype}")
private String timetype; private String timetype;
@Value("${startTime}") @Value("${startTime}")
private String startTime; private String startTime;
@Value("${endTime}") @Value("${endTime}")
private String endTime; private String endTime;
private static final Logger log = LoggerFactory.getLogger(DeptLogoutController.class); /**
* 模拟数据
*
* @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;
}
/** /**
* 公积金系统服务接口内置机调前置机中间接口 * 公积金系统服务接口内置机调前置机中间接口
...@@ -86,7 +99,6 @@ public class DeptLogoutController { ...@@ -86,7 +99,6 @@ public class DeptLogoutController {
return forObject; return forObject;
} }
/** /**
* (第一个定时的) * (第一个定时的)
* 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口, * 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,
...@@ -173,27 +185,6 @@ public class DeptLogoutController { ...@@ -173,27 +185,6 @@ public class DeptLogoutController {
return AjaxResult.success("请求成功", null); return AjaxResult.success("请求成功", null);
} }
/**
* 模拟数据
*
* @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;
}
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* (第二个定时) * (第二个定时)
......
package net.cdkj.gjj.adapter.controller; package net.cdkj.gjj.adapter.controller;
import net.cdkj.gjj.adapter.config.JasyptConfig;
import org.jasypt.encryption.StringEncryptor; import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
......
...@@ -9,6 +9,8 @@ import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation; ...@@ -9,6 +9,8 @@ import net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation;
import net.cdkj.gjj.adapter.utils.HttpUtil; import net.cdkj.gjj.adapter.utils.HttpUtil;
import net.cdkj.gjj.adapter.utils.InternalUtils; import net.cdkj.gjj.adapter.utils.InternalUtils;
import oracle.jdbc.OracleTypes; import oracle.jdbc.OracleTypes;
import org.slf4j.Logger;
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.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -30,6 +32,10 @@ import java.util.*; ...@@ -30,6 +32,10 @@ import java.util.*;
public class ProvidentFundServicesController { public class ProvidentFundServicesController {
// sl4j
private static final Logger logger = LoggerFactory.getLogger(ProvidentFundServicesController.class);
@Resource @Resource
private DruidDataSource dataSource; private DruidDataSource dataSource;
...@@ -49,6 +55,48 @@ public class ProvidentFundServicesController { ...@@ -49,6 +55,48 @@ 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;
}
/** /**
* 公积金系统服务接口内置机调前置机中间接口 * 公积金系统服务接口内置机调前置机中间接口
...@@ -74,17 +122,6 @@ public class ProvidentFundServicesController { ...@@ -74,17 +122,6 @@ public class ProvidentFundServicesController {
return HttpUtil.sendPost(dwkhPullUrl, str); return HttpUtil.sendPost(dwkhPullUrl, str);
} }
/**
* 获取当天零点零分零秒的时间戳和当天24点的时间戳
*
* @return
*/
@ResponseBody
@PostMapping("currentime")
public static String currenttime(int type) {
return InternalUtils.currentTime(type);
}
/** /**
* (第一个定时的) * (第一个定时的)
* 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口, * 调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,
...@@ -97,7 +134,7 @@ public class ProvidentFundServicesController { ...@@ -97,7 +134,7 @@ public class ProvidentFundServicesController {
public void gjjxtfwjk() throws Exception { public void gjjxtfwjk() throws Exception {
// 1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理 // 1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
String jsoninfom = ProvidentFundServices(); String jsoninfom = ProvidentFundServices();
System.out.println("拿到第一个接口返回的第三方数据,准备调第一个存储过程" + jsoninfom); logger.info("拿到第一个接口返回的第三方数据,准备调第一个存储过程" + jsoninfom);
Json jsonentity = JSONObject.parseObject(jsoninfom, Json.class); Json jsonentity = JSONObject.parseObject(jsoninfom, Json.class);
List<UnitAccountOpeningInformation> bills = new ArrayList<>(); List<UnitAccountOpeningInformation> bills = new ArrayList<>();
if (!isNullOrEmpty(jsonentity)) { if (!isNullOrEmpty(jsonentity)) {
...@@ -113,7 +150,7 @@ public class ProvidentFundServicesController { ...@@ -113,7 +150,7 @@ public class ProvidentFundServicesController {
if (!bills.isEmpty()) { if (!bills.isEmpty()) {
for (UnitAccountOpeningInformation uniInfom : bills) { for (UnitAccountOpeningInformation uniInfom : bills) {
if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) { if (!"".equals(uniInfom.getOplocdistrict()) && uniInfom.getOplocdistrict() != null) {
System.out.println("oplocdistrict" + "在规定的值里面,调imp过程"); logger.info("oplocdistrict" + "在规定的值里面,调imp过程");
if (!"".equals(uniInfom.getBusId()) && uniInfom.getBusId() != null) { if (!"".equals(uniInfom.getBusId()) && uniInfom.getBusId() != null) {
pstm.setString(1, uniInfom.getBusId()); pstm.setString(1, uniInfom.getBusId());
} else { } else {
...@@ -226,17 +263,17 @@ public class ProvidentFundServicesController { ...@@ -226,17 +263,17 @@ public class ProvidentFundServicesController {
// 执行数据库查询操作 // 执行数据库查询操作
pstm.execute(); pstm.execute();
// 输出结果[第二个参数] // 输出结果[第二个参数]
System.out.println(pstm.getString(19)); logger.info(pstm.getString(19));
System.out.println(pstm.getString(20)); logger.info(pstm.getString(20));
if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) { if ("".equals(pstm.getString(19)) || pstm.getString(19) == null) {
break; break;
} else { } else {
try { try {
// 避免批量插入高并发,此处设置每次停顿5秒 // 避免批量插入高并发,此处设置每次停顿5秒
Thread.currentThread().sleep(2000); Thread.currentThread().sleep(2000);
System.out.println("间隔2秒传一条数据调一次存储过程"); logger.info("间隔2秒传一条数据调一次存储过程");
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); logger.error("{}", e);
} }
} }
...@@ -244,7 +281,7 @@ public class ProvidentFundServicesController { ...@@ -244,7 +281,7 @@ public class ProvidentFundServicesController {
} }
pstm2.execute(); pstm2.execute();
} else { } else {
System.out.println("第三方返回的报文中data数据为空!"); logger.info("第三方返回的报文中data数据为空!");
} }
// 释放资源 // 释放资源
pstm.close(); pstm.close();
...@@ -252,38 +289,6 @@ public class ProvidentFundServicesController { ...@@ -252,38 +289,6 @@ public class ProvidentFundServicesController {
connection.close(); connection.close();
} }
/**
* 判断一个实体对象是否为空
*
* @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;
}
/** /**
* 住建部门返回公积金办理进度数据接口方法 * 住建部门返回公积金办理进度数据接口方法
* (第二个定时) * (第二个定时)
...@@ -294,15 +299,15 @@ public class ProvidentFundServicesController { ...@@ -294,15 +299,15 @@ public class ProvidentFundServicesController {
@ResponseBody @ResponseBody
@PostMapping("BusinessProcessing") @PostMapping("BusinessProcessing")
public String BusinessProcessing() { public String BusinessProcessing() {
System.out.println("调第二个接口了"); logger.info("调第二个接口了");
// 调oracle存储过程拿到进度推进的数据集合 // 调oracle存储过程拿到进度推进的数据集合
List<BusinessProcessing> list = null; List<BusinessProcessing> list = null;
try { try {
list = zjbmfhywtosj(); list = zjbmfhywtosj();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error("{}", e);
} }
System.out.println("调第二个接口了存储过程返回的list" + list); logger.info("调第二个接口了存储过程返回的list" + list);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("state", "1"); jsonObject.put("state", "1");
if (!list.isEmpty()) { if (!list.isEmpty()) {
...@@ -326,7 +331,7 @@ public class ProvidentFundServicesController { ...@@ -326,7 +331,7 @@ public class ProvidentFundServicesController {
if (!list.isEmpty()) { if (!list.isEmpty()) {
uscc = list.get(0).getUscc(); uscc = list.get(0).getUscc();
} }
System.out.println(uscc); logger.info(uscc);
JSONObject jsonObj = JSONObject.parseObject(result); JSONObject jsonObj = JSONObject.parseObject(result);
String success = jsonObj.getString("success"); String success = jsonObj.getString("success");
Integer value = 0; Integer value = 0;
...@@ -338,9 +343,9 @@ public class ProvidentFundServicesController { ...@@ -338,9 +343,9 @@ public class ProvidentFundServicesController {
try { try {
zjbmfhywtosjHX(uscc, value); zjbmfhywtosjHX(uscc, value);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error("{}", e);
} }
System.out.println(value); logger.info("success:{}", value);
} }
return result; return result;
} }
...@@ -368,48 +373,39 @@ public class ProvidentFundServicesController { ...@@ -368,48 +373,39 @@ public class ProvidentFundServicesController {
List<BusinessProcessing> list = new ArrayList<>(); List<BusinessProcessing> list = new ArrayList<>();
while (rs.next()) { while (rs.next()) {
BusinessProcessing b = new BusinessProcessing(); BusinessProcessing b = new BusinessProcessing();
// System.out.println(rs.getString(1));//获取具体的值
if (!"".equals(rs.getString(1)) && rs.getString(1) != null) { if (!"".equals(rs.getString(1)) && rs.getString(1) != null) {
b.setBusiLink(rs.getString(1)); b.setBusiLink(rs.getString(1));
} }
// System.out.println(rs.getString(2));//获取具体的值
if (!"".equals(rs.getString(2)) && rs.getString(2) != null) { if (!"".equals(rs.getString(2)) && rs.getString(2) != null) {
b.setBusiType(rs.getString(2)); b.setBusiType(rs.getString(2));
} }
// System.out.println(rs.getString(3));//获取具体的值
if (!"".equals(rs.getString(3)) && rs.getString(3) != null) { if (!"".equals(rs.getString(3)) && rs.getString(3) != null) {
b.setOpeartor(rs.getString(3)); b.setOpeartor(rs.getString(3));
} }
// System.out.println(rs.getString(4));//获取具体的值
if (!"".equals(rs.getString(4)) && rs.getString(4) != null) { if (!"".equals(rs.getString(4)) && rs.getString(4) != null) {
b.setTel(rs.getString(4)); b.setTel(rs.getString(4));
} }
// System.out.println(rs.getString(5));//获取具体的值
if (!"".equals(rs.getString(5)) && rs.getString(5) != null) { if (!"".equals(rs.getString(5)) && rs.getString(5) != null) {
b.setOpinion(rs.getString(5)); b.setOpinion(rs.getString(5));
} }
// System.out.println(rs.getString(6));//获取具体的值
if (!"".equals(rs.getString(6)) && rs.getString(6) != null) { if (!"".equals(rs.getString(6)) && rs.getString(6) != null) {
b.setResult(rs.getString(6)); b.setResult(rs.getString(6));
} }
if (!"".equals(rs.getString(7)) && rs.getString(7) != null) { if (!"".equals(rs.getString(7)) && rs.getString(7) != null) {
b.setTime(rs.getString(7).substring(0, 19)); b.setTime(rs.getString(7).substring(0, 19));
} }
// System.out.println(rs.getString(8));//获取具体的值
if (!"".equals(rs.getString(8)) && rs.getString(8) != null) { if (!"".equals(rs.getString(8)) && rs.getString(8) != null) {
b.setUscc(rs.getString(8)); b.setUscc(rs.getString(8));
} }
// System.out.println(rs.getString(9));//获取具体的值
if (!"".equals(rs.getString(9)) && rs.getString(9) != null) { if (!"".equals(rs.getString(9)) && rs.getString(9) != null) {
b.setEntName(rs.getString(9)); b.setEntName(rs.getString(9));
} }
// System.out.println(rs.getString(10));//获取具体的值
if (!"".equals(rs.getString(10)) && rs.getString(10) != null) { if (!"".equals(rs.getString(10)) && rs.getString(10) != null) {
b.setBusId(rs.getString(10)); b.setBusId(rs.getString(10));
} }
list.add(b); list.add(b);
} }
System.out.println(list); logger.info("获取结果:{}", list);
// 释放资源 // 释放资源
pstm.close(); pstm.close();
connection.close(); connection.close();
......
...@@ -4,7 +4,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -4,7 +4,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping(value="demo") @RequestMapping(value = "demo")
public class TestController { public class TestController {
@RequestMapping("test") @RequestMapping("test")
......
...@@ -10,27 +10,23 @@ import java.util.HashMap; ...@@ -10,27 +10,23 @@ import java.util.HashMap;
* @author ruoyi * @author ruoyi
*/ */
public class AjaxResult extends HashMap<String, Object> { public class AjaxResult extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
/** /**
* 状态码 * 状态码
*/ */
public static final String CODE_TAG = "code"; public static final String CODE_TAG = "code";
/** /**
* 返回内容 * 返回内容
*/ */
public static final String MSG_TAG = "msg"; public static final String MSG_TAG = "msg";
/** /**
* 数据对象 * 数据对象
*/ */
public static final String DATA_TAG = "data"; public static final String DATA_TAG = "data";
/** /**
* 总数 * 总数
*/ */
public static final String TOTAL_TAG = "total"; public static final String TOTAL_TAG = "total";
private static final long serialVersionUID = 1L;
/** /**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
...@@ -85,7 +81,6 @@ public class AjaxResult extends HashMap<String, Object> { ...@@ -85,7 +81,6 @@ public class AjaxResult extends HashMap<String, Object> {
} }
/** /**
* 返回成功消息 * 返回成功消息
* *
......
...@@ -2,8 +2,6 @@ package net.cdkj.gjj.adapter.domain; ...@@ -2,8 +2,6 @@ package net.cdkj.gjj.adapter.domain;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.Date;
/** /**
* 业务办理进度数据对象 * 业务办理进度数据对象
*/ */
......
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.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
...@@ -8,43 +13,47 @@ import java.util.Properties; ...@@ -8,43 +13,47 @@ import java.util.Properties;
* 获取配置文件application.properties里的属性值所用到的工具类 * 获取配置文件application.properties里的属性值所用到的工具类
*/ */
public class PropertyqUtil { public class PropertyqUtil {
private static final Logger log = LoggerFactory.getLogger(DeptInfoUpdateController.class);
/** /**
* 读取 classpath 下 指定的properties配置文件,加载到Properties并返回Properties * 读取 classpath 下 指定的properties配置文件,加载到Properties并返回Properties
*
* @param name 配置文件名,如:mongo.properties * @param name 配置文件名,如:mongo.properties
* @return * @return
*/ */
public static Properties getConfig(String name){ public static Properties getConfig(String name) {
Properties props=null; Properties props = null;
try{ try {
props = new Properties(); props = new Properties();
InputStream in = PropertyqUtil.class.getClassLoader().getResourceAsStream(name); InputStream in = PropertyqUtil.class.getClassLoader().getResourceAsStream(name);
BufferedReader bf = new BufferedReader(new InputStreamReader(in)); BufferedReader bf = new BufferedReader(new InputStreamReader(in));
props.load(bf); props.load(bf);
in.close(); in.close();
}catch(Exception ex){ } catch (Exception e) {
ex.printStackTrace(); log.error("{}", e);
} }
return props; return props;
} }
public static String getPropValue(Properties prop,String key){ public static String getPropValue(Properties prop, String key) {
if(key == null || "".equals(key.trim())){ if (key == null || "".equals(key.trim())) {
return null; return null;
} }
String value = prop.getProperty(key); String value = prop.getProperty(key);
if(value == null){ if (value == null) {
return null; return null;
} }
value = value.trim(); value = value.trim();
//判断是否是环境变量配置属性,例如 server.env=${serverEnv:local} // 判断是否是环境变量配置属性,例如 server.env=${serverEnv:local}
if(value.startsWith("${") && value.endsWith("}") && value.contains(":")){ if (value.startsWith("${") && value.endsWith("}") && value.contains(":")) {
int indexOfColon = value.indexOf(":"); int indexOfColon = value.indexOf(":");
String envName = value.substring(2,indexOfColon); String envName = value.substring(2, indexOfColon);
//获取系统环境变量 envName 的内容,如果没有找到,则返回defaultValue // 获取系统环境变量 envName 的内容,如果没有找到,则返回defaultValue
String envValue = System.getenv(envName); String envValue = System.getenv(envName);
if(envValue == null){ if (envValue == null) {
//配置的默认值 // 配置的默认值
return value.substring(indexOfColon+1,value.length()-1); return value.substring(indexOfColon + 1, value.length() - 1);
} }
return envValue; return envValue;
} }
......
...@@ -199,6 +199,10 @@ public class UnitAccountOpeningInformation { ...@@ -199,6 +199,10 @@ public class UnitAccountOpeningInformation {
return personalDepPro; return personalDepPro;
} }
public void setPersonalDepPro(String personalDepPro) {
this.personalDepPro = personalDepPro;
}
public String getYwbh() { public String getYwbh() {
return ywbh; return ywbh;
} }
...@@ -247,10 +251,6 @@ public class UnitAccountOpeningInformation { ...@@ -247,10 +251,6 @@ public class UnitAccountOpeningInformation {
this.errmsg = errmsg; this.errmsg = errmsg;
} }
public void setPersonalDepPro(String personalDepPro) {
this.personalDepPro = personalDepPro;
}
@Override @Override
public String toString() { public String toString() {
return "UnitAccountOpeningInformation{" + return "UnitAccountOpeningInformation{" +
......
package net.cdkj.gjj.adapter.utils; package net.cdkj.gjj.adapter.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.zip.GZIPInputStream;
public class HttpUtil { public class HttpUtil {
private static final Logger logger = LoggerFactory.getLogger(InternalUtils.class);
/** /**
* 获取请求入参数据 * 获取请求入参数据
*/ */
...@@ -22,10 +26,10 @@ public class HttpUtil { ...@@ -22,10 +26,10 @@ public class HttpUtil {
json.append(line); json.append(line);
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); logger.error("{}", e);
} }
String str = json.toString(); String str = json.toString();
System.out.println("要发送给第三方的公积金系统服务报文:" + str); logger.info("要发送给第三方的公积金系统服务报文:" + str);
return str; return str;
} }
...@@ -75,14 +79,13 @@ public class HttpUtil { ...@@ -75,14 +79,13 @@ public class HttpUtil {
sb.append(readLine); sb.append(readLine);
} }
responseReader.close(); responseReader.close();
System.out.println("前置机返回第三方解压之后数据:" + sb); logger.info("前置机返回第三方解压之后数据:" + sb);
return sb.toString(); return sb.toString();
} else { } else {
System.out.println("请求失败!!!"); logger.info("请求失败!!!");
} }
} catch ( } catch (IOException e) {
IOException e) { logger.error("{}", e);
e.printStackTrace();
} finally { } finally {
if (out != null) { if (out != null) {
try { try {
......
package net.cdkj.gjj.adapter.utils; package net.cdkj.gjj.adapter.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
...@@ -8,6 +11,7 @@ import java.util.Map; ...@@ -8,6 +11,7 @@ import java.util.Map;
public class InternalUtils { public class InternalUtils {
private static final Logger logger = LoggerFactory.getLogger(InternalUtils.class);
/** /**
* 判断一个实体对象是否为空 * 判断一个实体对象是否为空
...@@ -57,7 +61,7 @@ public class InternalUtils { ...@@ -57,7 +61,7 @@ public class InternalUtils {
curentDay.set(Calendar.SECOND, 0); curentDay.set(Calendar.SECOND, 0);
SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
time = df2.format(curentDay.getTime().getTime()); time = df2.format(curentDay.getTime().getTime());
System.out.println(time); logger.error("type == 0 time:{}", time);
} else if (type == 24) { } else if (type == 24) {
// 获取当天24点零分零秒的时间戳,即第二天零点时间 // 获取当天24点零分零秒的时间戳,即第二天零点时间
Calendar curentDay = Calendar.getInstance(); Calendar curentDay = Calendar.getInstance();
...@@ -67,7 +71,7 @@ public class InternalUtils { ...@@ -67,7 +71,7 @@ public class InternalUtils {
curentDay.set(Calendar.SECOND, 0); curentDay.set(Calendar.SECOND, 0);
SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
time = df2.format(curentDay.getTime().getTime()); time = df2.format(curentDay.getTime().getTime());
System.out.println(time); logger.error("type == 24 time:{}", time);
} }
return time; return time;
} }
......
...@@ -50,5 +50,5 @@ dwxhPushTaskDelay:60000 ...@@ -50,5 +50,5 @@ dwxhPushTaskDelay:60000
dwxhPullTaskDelay:60000 dwxhPullTaskDelay:60000
# 日志配置 # 日志配置
logging.config:classpath:logback-spring.xml logging.config:classpath:logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="C:/logs"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-debug.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-debug.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.cdkj" level="debug"/>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file_debug"/>
<appender-ref ref="file_error"/>
</root>
</configuration>
...@@ -18,21 +18,13 @@ ...@@ -18,21 +18,13 @@
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>30</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender> </appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
...@@ -40,9 +32,9 @@ ...@@ -40,9 +32,9 @@
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>30</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
...@@ -57,38 +49,13 @@ ...@@ -57,38 +49,13 @@
</filter> </filter>
</appender> </appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<!-- 控制台输出 -->
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志--> <!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file_info"/> <appender-ref ref="file_info"/>
<appender-ref ref="file_error"/> <appender-ref ref="file_error"/>
</root> </root>
<!-- 系统模块日志级别控制 -->
<logger name="net.cdkj" level="debug"/>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration> </configuration>
\ No newline at end of file
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