Commit 7a45e079 by 黄森林

删除更改打印异常方式

parent 0ef33f2b
...@@ -33,17 +33,17 @@ public class ImgController { ...@@ -33,17 +33,17 @@ public class ImgController {
try { try {
inputStream = new FileInputStream(file); inputStream = new FileInputStream(file);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); log.error("图片下载失败",e.getMessage());
} }
try { try {
bytes = new byte[inputStream.available()]; bytes = new byte[inputStream.available()];
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("图片下载失败",e.getMessage());
} }
try { try {
inputStream.read(bytes, 0, inputStream.available()); inputStream.read(bytes, 0, inputStream.available());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("图片下载失败",e.getMessage());
} }
return bytes; return bytes;
} }
......
...@@ -77,13 +77,13 @@ public class HttpHelper { ...@@ -77,13 +77,13 @@ public class HttpHelper {
} }
} }
} catch (IOException e) { } catch (IOException e) {
log.info( e.getMessage()); log.error("http请求异常",e.getMessage());
} finally { } finally {
if (response != null) try { if (response != null) try {
response.close(); //释放资源 response.close(); //释放资源
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("http请求异常",e.getMessage());
} }
if(httpClient!=null){ if(httpClient!=null){
httpClient.close(); httpClient.close();
...@@ -154,14 +154,14 @@ public class HttpHelper { ...@@ -154,14 +154,14 @@ public class HttpHelper {
} }
} }
} catch (IOException e) { } catch (IOException e) {
log.error(e.getMessage()); log.error("http请求异常",e.getMessage());
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (response != null) try { if (response != null) try {
response.close(); //释放资源 response.close(); //释放资源
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("http请求异常",e.getMessage());
} }
if(httpClient!=null){ if(httpClient!=null){
httpClient.close(); httpClient.close();
......
package com.winsun.utils; package com.winsun.utils;
import org.apache.commons.lang3.StringUtils; import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
...@@ -9,13 +9,13 @@ import java.util.Hashtable; ...@@ -9,13 +9,13 @@ import java.util.Hashtable;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static org.apache.commons.lang.StringUtils.isNumeric;
/** /**
* 身份证校验 * 身份证校验
* @Author: chancy * @Author: chancy
* @Date: 2020/3/2 13:03 * @Date: 2020/3/2 13:03
*/ */
@Slf4j
public class IDCardUtil { public class IDCardUtil {
/** /**
* 功能:身份证的有效验证 * 功能:身份证的有效验证
...@@ -57,10 +57,10 @@ public class IDCardUtil { ...@@ -57,10 +57,10 @@ public class IDCardUtil {
} }
} catch (NumberFormatException e) } catch (NumberFormatException e)
{ {
e.printStackTrace(); log.error("身份证验证异常",e.getMessage());
} catch (java.text.ParseException e) } catch (java.text.ParseException e)
{ {
e.printStackTrace(); log.error("身份证验证异常",e.getMessage());
} }
if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0)
{ {
......
...@@ -186,6 +186,7 @@ public class ImportExcel { ...@@ -186,6 +186,7 @@ public class ImportExcel {
} }
} }
}catch (Exception e) { }catch (Exception e) {
log.error("excel获取单元格异常",e.getMessage());
return val; return val;
} }
return val; return val;
...@@ -236,22 +237,6 @@ public class ImportExcel { ...@@ -236,22 +237,6 @@ public class ImportExcel {
,"bn","bo","bp","bq","br","bs","bt","bu","bv","bw","bx","by","bz" ,"bn","bo","bp","bq","br","bs","bt","bu","bv","bw","bx","by","bz"
,"ca","cb","cc","cd","ce","cf","cg","ch","ci","cj","ck","cl","cm" ,"ca","cb","cc","cd","ce","cf","cg","ch","ci","cj","ck","cl","cm"
,"cn","co","cp","cq","cr","cs","ct","cu","cv","cw","cx","cy","cz"}; ,"cn","co","cp","cq","cr","cs","ct","cu","cv","cw","cx","cy","cz"};
// /**
// * 导入测试
// */
// public static void main(String[] args) throws Throwable {
//
// ImportExcel ei = new ImportExcel("target/export.xlsx", 1);
//
// for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
// Row row = ei.getRow(i);
// for (int j = 0; j < ei.getLastCellNum(); j++) {
// Object val = ei.getCellValue(row, j);
// System.out.print(val+", ");
// }
// System.out.print("\n");
// }
//
// }
} }
...@@ -57,7 +57,7 @@ public class OrderManage { ...@@ -57,7 +57,7 @@ public class OrderManage {
map.put("timeStr", timeStr); map.put("timeStr", timeStr);
str = sendAitransOrder(map); str = sendAitransOrder(map);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("预实名接口发起异常",e.getMessage());
} }
return str; return str;
...@@ -266,7 +266,7 @@ public class OrderManage { ...@@ -266,7 +266,7 @@ public class OrderManage {
signMap.put("productJson", URLEncoder.encode(productJson, "UTF-8")); signMap.put("productJson", URLEncoder.encode(productJson, "UTF-8"));
} catch (UnsupportedEncodingException e1) { } catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e1.printStackTrace(); log.error(e1.getMessage());
} }
//身份证正面,选填 //身份证正面,选填
...@@ -315,7 +315,6 @@ public class OrderManage { ...@@ -315,7 +315,6 @@ public class OrderManage {
//httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); //httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setEntity(builder.build()); httpPost.setEntity(builder.build());
//System.out.println("[CREATE_ORDER]移动产品下单接口,提交参数" + EntityUtils.toString(httpPost.getEntity(), "UTF-8"));
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
HttpResponse response = httpclient.execute(httpPost); HttpResponse response = httpclient.execute(httpPost);
...@@ -560,8 +559,6 @@ public class OrderManage { ...@@ -560,8 +559,6 @@ public class OrderManage {
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8")); httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8"));
// System.out.println(
// "[CREATE_ORDER]获取销售品列表接口,提交参数:" + EntityUtils.toString(httpPost.getEntity(), "UTF-8"));
HttpResponse response = httpclient.execute(httpPost); HttpResponse response = httpclient.execute(httpPost);
...@@ -569,7 +566,6 @@ public class OrderManage { ...@@ -569,7 +566,6 @@ public class OrderManage {
String httpResult = EntityUtils.toString(entity, "UTF-8"); String httpResult = EntityUtils.toString(entity, "UTF-8");
httpclient.close(); httpclient.close();
// System.out.println("[CREATE_ORDER]获取销售品列表接口,返回信息:" + httpResult);
if (httpResult.equals("\r\n\r\nnull\r\n\r\n")) { if (httpResult.equals("\r\n\r\nnull\r\n\r\n")) {
} else { } else {
...@@ -655,8 +651,6 @@ public class OrderManage { ...@@ -655,8 +651,6 @@ public class OrderManage {
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8")); httpPost.setEntity(new UrlEncodedFormEntity(qParams, "UTF-8"));
// System.out.println(
// "[CREATE_ORDER]获取销售品列表接口,提交参数:" + EntityUtils.toString(httpPost.getEntity(), "UTF-8"));
HttpResponse response = httpclient.execute(httpPost); HttpResponse response = httpclient.execute(httpPost);
...@@ -664,7 +658,6 @@ public class OrderManage { ...@@ -664,7 +658,6 @@ public class OrderManage {
String httpResult = EntityUtils.toString(entity, "UTF-8"); String httpResult = EntityUtils.toString(entity, "UTF-8");
httpclient.close(); httpclient.close();
// System.out.println("[CREATE_ORDER]获取销售品列表接口,返回信息:" + httpResult);
if (httpResult.equals("\r\n\r\nnull\r\n\r\n")) { if (httpResult.equals("\r\n\r\nnull\r\n\r\n")) {
} else { } else {
...@@ -689,7 +682,7 @@ public class OrderManage { ...@@ -689,7 +682,7 @@ public class OrderManage {
if ("000001".equals(isSuccess)) { if ("000001".equals(isSuccess)) {
log.info("[CREATE_ORDER]获取销售品成功,list=" + resultDataJson.toString()); log.info("[CREATE_ORDER]获取销售品成功,list=" + resultDataJson.toString());
String state = resultDataJson.getString("state"); String state = resultDataJson.getString("state");
System.out.println("单宽智能平台订单返回状态码:" + state); log.info("单宽智能平台订单返回状态码:" + state);
if ("10".equals(state) || "11".equals(state)) { if ("10".equals(state) || "11".equals(state)) {
resultMap.put("type", "已完成"); resultMap.put("type", "已完成");
resultMap.put("state", state); resultMap.put("state", state);
......
...@@ -55,14 +55,14 @@ public class PicturesUtil { ...@@ -55,14 +55,14 @@ public class PicturesUtil {
fos = new FileOutputStream(filePath); fos = new FileOutputStream(filePath);
fos.write(bytes); fos.write(bytes);
} catch (IOException e) { } catch (IOException e) {
log.info("图片上传异常"); log.error("图片上传异常",e.getMessage());
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (fos != null) { if (fos != null) {
try { try {
fos.close(); fos.close();
} catch (IOException e) { } catch (IOException e) {
log.info("图片上传异常"); log.error("图片上传异常",e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -33,7 +33,7 @@ public class XbkUtil { ...@@ -33,7 +33,7 @@ public class XbkUtil {
try { try {
jsonObject = HttpHelper.doPost("http://enter.gd189.cn:9090/o2oweb/outMain/service.do", json.toString()); jsonObject = HttpHelper.doPost("http://enter.gd189.cn:9090/o2oweb/outMain/service.do", json.toString());
}catch (Exception e){ }catch (Exception e){
log.info(type+"调取接口异常",e.getMessage()); log.error(type+"调取接口异常",e.getMessage());
} }
return jsonObject; return jsonObject;
} }
......
...@@ -96,7 +96,7 @@ public class PackageNewClothes { ...@@ -96,7 +96,7 @@ public class PackageNewClothes {
try { try {
jsonObject = XbkUtil.getNumberJT0001(contNumber, xbId, netId); jsonObject = XbkUtil.getNumberJT0001(contNumber, xbId, netId);
} catch (Exception e) { } catch (Exception e) {
log.info("JT0001获取手机号码接口异常", e.getMessage()); log.error("JT0001获取手机号码接口异常", e.getMessage());
ResponseData.error("手机号码获取失败,请重新获取。"); ResponseData.error("手机号码获取失败,请重新获取。");
} }
if (!"0".equals(jsonObject.getString("code"))) { if (!"0".equals(jsonObject.getString("code"))) {
...@@ -370,7 +370,7 @@ public class PackageNewClothes { ...@@ -370,7 +370,7 @@ public class PackageNewClothes {
jsonObject = XbkUtil.xbkOrderJT0002(businessNumber, idCard, jsonObject = XbkUtil.xbkOrderJT0002(businessNumber, idCard,
customerName, contactNumber, xbId, netId); customerName, contactNumber, xbId, netId);
} catch (Exception e) { } catch (Exception e) {
log.info("小白卡下单接口调用异常", e.getMessage()); log.error("小白卡下单接口调用异常", e.getMessage());
} }
if (jsonObject == null) { if (jsonObject == null) {
return ResponseData.error("小白卡下单失败,如有疑问请联系客服,谢谢。"); return ResponseData.error("小白卡下单失败,如有疑问请联系客服,谢谢。");
...@@ -451,7 +451,7 @@ public class PackageNewClothes { ...@@ -451,7 +451,7 @@ public class PackageNewClothes {
try { try {
jsonObject1 = XbkUtil.idCardCheckJT0005(idCard, customerName); jsonObject1 = XbkUtil.idCardCheckJT0005(idCard, customerName);
} catch (Exception e) { } catch (Exception e) {
log.info("身份证验证接口调用异常", e.getMessage()); log.error("身份证验证接口调用异常", e.getMessage());
} }
if (jsonObject1 == null) { if (jsonObject1 == null) {
log.info("身份证验证接口调用异常"); log.info("身份证验证接口调用异常");
......
...@@ -146,7 +146,7 @@ public class ChooseController { ...@@ -146,7 +146,7 @@ public class ChooseController {
orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper1); orderMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper1);
log.info(order.getXbOrderId()+"订单已更新"); log.info(order.getXbOrderId()+"订单已更新");
} catch (Exception e) { } catch (Exception e) {
log.info(order.getXbOrderId()+"订单更新失败",e.getMessage()); log.error(order.getXbOrderId()+"订单更新失败",e.getMessage());
} }
}); });
} }
......
...@@ -42,18 +42,18 @@ public class ImgController { ...@@ -42,18 +42,18 @@ public class ImgController {
try { try {
inputStream = new FileInputStream(file); inputStream = new FileInputStream(file);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); log.error("图片下载失败",e.getMessage());
} }
bytes = new byte[0]; bytes = new byte[0];
try { try {
bytes = new byte[inputStream.available()]; bytes = new byte[inputStream.available()];
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("图片下载失败",e.getMessage());
} }
try { try {
inputStream.read(bytes, 0, inputStream.available()); inputStream.read(bytes, 0, inputStream.available());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("图片下载失败",e.getMessage());
} }
return bytes; return bytes;
} }
......
...@@ -74,7 +74,7 @@ public class IntelligentPlatformPushController { ...@@ -74,7 +74,7 @@ public class IntelligentPlatformPushController {
} catch (Exception e) { } catch (Exception e) {
resultMap.put("code", "12001"); resultMap.put("code", "12001");
resultMap.put("msg", "订单状态不存在"); resultMap.put("msg", "订单状态不存在");
log.error(e.getMessage(), e); log.error("智能平台推送信息接收异常",e.getMessage(), e);
return resultMap; return resultMap;
} }
Integer num = orderViewMapper.IntelligentPlatformPush(wrapper, status, orderStatus); Integer num = orderViewMapper.IntelligentPlatformPush(wrapper, status, orderStatus);
...@@ -87,7 +87,7 @@ public class IntelligentPlatformPushController { ...@@ -87,7 +87,7 @@ public class IntelligentPlatformPushController {
try { try {
orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper1); orderViewMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper1);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error("智能平台推送信息接收异常",e.getMessage(), e);
} }
} }
log.info("更新成功!!!"); log.info("更新成功!!!");
...@@ -105,7 +105,7 @@ public class IntelligentPlatformPushController { ...@@ -105,7 +105,7 @@ public class IntelligentPlatformPushController {
try { try {
orderViewMapper.insertOrderHistory(id, status, createTime); orderViewMapper.insertOrderHistory(id, status, createTime);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error("智能平台推送信息接口插入异常",e.getMessage(), e);
} }
return resultMap; return resultMap;
} else { } else {
......
...@@ -353,6 +353,7 @@ public class OrderController extends BaseController { ...@@ -353,6 +353,7 @@ public class OrderController extends BaseController {
map.put("status", "failure"); map.put("status", "failure");
map.put("message", "下载文件失败" + e.getMessage()); map.put("message", "下载文件失败" + e.getMessage());
response.getWriter().println(JSON.toJSONString(map)); response.getWriter().println(JSON.toJSONString(map));
log.error("一人一码下载文件失败",e.getMessage());
} finally { } finally {
//关闭资源 //关闭资源
if (excelWriter != null) { if (excelWriter != null) {
...@@ -472,7 +473,7 @@ public class OrderController extends BaseController { ...@@ -472,7 +473,7 @@ public class OrderController extends BaseController {
try { try {
importExcel = new ImportExcel(file, HEADER_NUM, SHEET_INDEX); importExcel = new ImportExcel(file, HEADER_NUM, SHEET_INDEX);
} catch (Exception e) { } catch (Exception e) {
log.info("受理单导入异常", e.getMessage()); log.error("受理单导入异常", e.getMessage());
return ResponseData.error("导入异常!"); return ResponseData.error("导入异常!");
} }
List<Map<String, Object>> listMap = importExcel.getDataListMap(); List<Map<String, Object>> listMap = importExcel.getDataListMap();
...@@ -537,7 +538,7 @@ public class OrderController extends BaseController { ...@@ -537,7 +538,7 @@ public class OrderController extends BaseController {
return ResponseData.error("文件中有重复的订单编号,请确认订单编号不能重复!"); return ResponseData.error("文件中有重复的订单编号,请确认订单编号不能重复!");
} }
} catch (Exception e) { } catch (Exception e) {
log.info("受理单导入异常", e.getMessage()); log.error("受理单导入异常", e.getMessage());
return ResponseData.error("导入异常!"); return ResponseData.error("导入异常!");
} }
int number = 0; int number = 0;
...@@ -601,7 +602,7 @@ public class OrderController extends BaseController { ...@@ -601,7 +602,7 @@ public class OrderController extends BaseController {
try { try {
importExcel = new ImportExcel(file, HEADER_NUM, SHEET_INDEX); importExcel = new ImportExcel(file, HEADER_NUM, SHEET_INDEX);
} catch (Exception e) { } catch (Exception e) {
log.info("快递单导入异常", e.getMessage()); log.error("快递单导入异常", e.getMessage());
return ResponseData.error("导入异常!"); return ResponseData.error("导入异常!");
} }
List<Map<String, Object>> listMap = importExcel.getDataListMap(); List<Map<String, Object>> listMap = importExcel.getDataListMap();
...@@ -667,7 +668,7 @@ public class OrderController extends BaseController { ...@@ -667,7 +668,7 @@ public class OrderController extends BaseController {
return ResponseData.error("文件中有重复的订单编号,请确认订单编号不能重复!"); return ResponseData.error("文件中有重复的订单编号,请确认订单编号不能重复!");
} }
} catch (Exception e) { } catch (Exception e) {
log.info("快递单导入异常", e.getMessage()); log.error("快递单导入异常", e.getMessage());
return ResponseData.error("导入异常!"); return ResponseData.error("导入异常!");
} }
int number = 0; int number = 0;
......
...@@ -342,7 +342,7 @@ public class supervisorController extends BaseController { ...@@ -342,7 +342,7 @@ public class supervisorController extends BaseController {
OrderManage orderManage = new OrderManage(); OrderManage orderManage = new OrderManage();
return orderManage.sendOrder(map); return orderManage.sendOrder(map);
} catch (Exception e) { } catch (Exception e) {
log.info("预制卡下单失败", e.getMessage()); log.error("预制卡下单失败", e.getMessage());
} }
return null; return null;
} }
......
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