李俊

将e.printStackTrace修改为log.error

......@@ -57,8 +57,7 @@ public class HsCodeInterface {
return resultHsCode;
}
}catch(Exception ex){
log.error(ex.getMessage());
ex.printStackTrace();
log.error(ex.getMessage(),ex);
resultHsCode = new ResultHsCode(Boolean.FALSE,"30101","数据查询异常",null);
return resultHsCode;
}finally {
......@@ -74,4 +73,4 @@ public class HsCodeInterface {
iClearApiHsCodeLogService.saveIClearApiHsCodeLog(iclearApiHsCodeLog);
}
}
}
\ No newline at end of file
}
......
......@@ -166,7 +166,7 @@ public class ApiService {
declearTask.setResponseResults("99999");
declearTask.setResponseContent(ex.getMessage());
declearTaskList.add(declearTask);
ex.printStackTrace();
log.error("sendCustoms error",ex);
}
});
declearTaskList.forEach(declearTask -> {
......@@ -204,7 +204,7 @@ public class ApiService {
});
this.sendMawb(token,mawbList);
}catch(Exception ex){
ex.printStackTrace();
log.error("pushMawbAcc",ex);
}
}
/**
......@@ -262,7 +262,7 @@ public class ApiService {
declearTask.setResponseResults("99999");
declearTask.setResponseContent(ex.getMessage());
declearTaskList.add(declearTask);
ex.printStackTrace();
log.error("sendMawb",ex);
}
});
declearTaskList.forEach(declearTask -> {
......
......@@ -234,8 +234,7 @@ public class ChmConsignmentService {
}catch (Exception e){
result=null;
e.printStackTrace();
log.error("convertToChmConsignment() error:"+e.getMessage());
log.error("sendMawb",e);
}
return result;
}
......@@ -292,8 +291,7 @@ public class ChmConsignmentService {
}
}catch (Exception e){
result=null;
e.printStackTrace();
log.error("convertToChmConsignmentFedex() error:"+e.getMessage());
log.error("convertToChmConsignmentFedex() error:"+e.getMessage(),e);
}
return result;
}
......@@ -430,8 +428,7 @@ public class ChmConsignmentService {
result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname());
}catch (Exception e){
result=null;
e.printStackTrace();
log.error("convertToChmConsignment() error:"+e.getMessage());
log.error("convertToChmConsignment() error:"+e.getMessage(),e);
}
return result;
}
......
......@@ -45,7 +45,7 @@ public class DeclearTaskService{
declareTaskRepository.saveAll(declareTaskList);
}
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(),e);
}
}
......@@ -70,7 +70,7 @@ public class DeclearTaskService{
declareTaskRepository.saveAll(declareTaskList);
}
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(),e);
}
}
......
......@@ -27,8 +27,7 @@ public class DictionaryEntriesService {
try {
result=dictionaryEntriesRepository.findAllDictionaryEntries();
}catch (Exception e){
e.printStackTrace();
log.error("getAllDictionaryEntries() error:"+e.getMessage());
log.error(e.getMessage(),e);
}
return result;
}
......
......@@ -3,12 +3,14 @@ package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.api.request.FedexConsignment;
import com.erry.iclear.dateInterface.api.request.ConsignmentDetail;
import com.erry.iclear.dateInterface.entity.DeclaredInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
public class FedexConsignmentService {
public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){
......@@ -62,7 +64,7 @@ public class FedexConsignmentService {
fedexConsignmentList.add(fedexConsignment);
}
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(),e);
}
return fedexConsignmentList;
}
......
......@@ -61,8 +61,7 @@ public class HsCodeService {
resultHsCode.setMsg("操作成功");
resultHsCode.setHsCodeResultList(hsCodeList);
}catch(Exception ex){
log.error(ex.getMessage());
ex.printStackTrace();
log.error(ex.getMessage(),ex);
resultHsCode.setSuccess(Boolean.FALSE);
resultHsCode.setCode("30101");
resultHsCode.setMsg("数据查询异常");
......@@ -83,8 +82,8 @@ public class HsCodeService {
resultHsCode.setMsg("操作成功");
resultHsCode.setHsCodeResultList(hsCodeList);
}catch(Exception ex){
log.error(ex.getMessage());
ex.printStackTrace();
log.error(ex.getMessage(),ex);
resultHsCode.setSuccess(Boolean.FALSE);
resultHsCode.setCode("30101");
resultHsCode.setMsg("数据查询异常");
......
......@@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService {
rs = true;
}
}catch(Exception ex){
ex.printStackTrace();
log.error(ex.getMessage(),ex);
}
return rs;
}
......
......@@ -103,7 +103,8 @@ public class IClearApiTask {
this.token = tokenResult.getData().getToken();
}
}catch(Exception ex){
ex.printStackTrace();
log.error(ex.getMessage(),ex);
}
}
if(this.token == null){
......
......@@ -27,13 +27,13 @@ public class DateUtils {
private DateUtils() {
};
public static String YEAR_MONTH = "yyyyMM";
public static String SHORT_DATE = "yyyyMMdd";
/**
* 功能:计算两个日期之间相差多少天 ((date2-date1)后取整)
*
*
* @param date1 减日期
* @param date2 被减日期
* @return
......@@ -47,12 +47,12 @@ public class DateUtils {
calendar1.set(Calendar.MINUTE, 0);
calendar1.set(Calendar.SECOND, 0);
calendar1.set(Calendar.MILLISECOND, 0);
calendar2.set(Calendar.HOUR_OF_DAY, 0);
calendar2.set(Calendar.MINUTE, 0);
calendar2.set(Calendar.SECOND, 0);
calendar2.set(Calendar.MILLISECOND, 0);
long l = Math.abs(calendar2.getTimeInMillis() - calendar1.getTimeInMillis());
long increaseDate = l / 1000 / 60 / 60 / 24;
if ((l % (1000 * 60 * 60 * 24)) > 0) {
......@@ -60,10 +60,10 @@ public class DateUtils {
}
return (int) increaseDate;
}
/**
* date2 是否是date1 的下一天
*
*
* @param date1
* @param date2
* @return
......@@ -77,7 +77,7 @@ public class DateUtils {
/**
* 功能:按yyyy-MM-dd HH:mm:ss 或 yyyy-MM-dd转换为日期
*
*
* @param s
* @return
* @throws Exception
......@@ -108,7 +108,7 @@ public class DateUtils {
/**
* date1 > date2+before-->true
*
*
* @param date1
* @param date2
* @param before
......@@ -133,7 +133,7 @@ public class DateUtils {
/**
* 功能:判断时间是否是凌晨(0-6),默认当前系统时间
*
*
* @param date
* @return
* @throws Exception
......@@ -154,7 +154,7 @@ public class DateUtils {
/**
* 功能:根据传入的字符串,得到holdTime,得到的时间为1970年的HH:mm:ss
* 如果格式不对(不为例如:23:12:23或着23:56或着23),抛出异常
*
*
* @param str
* @return
*/
......@@ -188,7 +188,7 @@ public class DateUtils {
/**
* 日期转为HoldTime格式HH:mm
*
*
* @param date
* @return
*/
......@@ -202,7 +202,7 @@ public class DateUtils {
/**
* 功能:算出两个日期中所包含的月份
*
*
* @param fromDate
* @param toDate
* @return
......@@ -237,7 +237,7 @@ public class DateUtils {
/**
* 功能:获取yyyyMM的年月
*
*
* @param date
* @return
*/
......@@ -248,7 +248,7 @@ public class DateUtils {
/**
* 功能:获取yyyyMMdd的年月日
*
*
* @param date
* @return
*/
......@@ -259,7 +259,7 @@ public class DateUtils {
/**
* 功能:获取yyyyMM的年月
*
*
* @param month
* @return
*/
......@@ -274,8 +274,8 @@ public class DateUtils {
/**
* 功能:格式yyyyMMdd日期
*
*
*
*
* @param date
* @return
*/
......@@ -290,7 +290,7 @@ public class DateUtils {
/**
* 功能:根据两个日期,算出某个月份的第一天,或者最后一天
*
*
* @param dateFrom
* @param dateTo
* @param month
......@@ -334,7 +334,7 @@ public class DateUtils {
/**
* 功能:根据一个日期,算出是这个月中的第几天
*
*
* @param date
* @return
*/
......@@ -346,7 +346,7 @@ public class DateUtils {
/**
* 功能:取出一个月中某天的日期
*
*
* @param month
* @param num
* @return
......@@ -364,7 +364,7 @@ public class DateUtils {
/**
* 功能:得到本周第一天日期
*
*
* @return
*/
public static Date getCurrentWeekMonday() {
......@@ -387,7 +387,7 @@ public class DateUtils {
/**
* 功能:得到本周最后一天的日期
*
*
* @return
*/
public static Date getCurrentWeekSaturday() {
......@@ -408,7 +408,7 @@ public class DateUtils {
/**
* 功能:从指定日期移动一定的天数
*
*
* @param date
* @param day
* @return
......@@ -426,7 +426,7 @@ public class DateUtils {
/**
* 功能:从当天日期移动一定的月数
*
*
* @param month
* @return
*/
......@@ -442,7 +442,7 @@ public class DateUtils {
/**
* 功能:获取昨天
*
*
* @return
*/
public static Date getYesterday() {
......@@ -458,7 +458,7 @@ public class DateUtils {
/**
* 功能:根据某个日期,返回本月第一天
*
*
* @param date 任何一天
* @return Date 当月第一天
*/
......@@ -475,7 +475,7 @@ public class DateUtils {
/**
* 功能:根据某个日期,返回本月最后一天
*
*
* @param date 任何一天
* @return Date 当月第一天
*/
......@@ -494,7 +494,7 @@ public class DateUtils {
/**
* 功能:获取起始日期和终止日期之间的日期(包含起始和终止日期)
*
*
* @param startDate
* @param endDate
* @return
......@@ -526,7 +526,7 @@ public class DateUtils {
/**
* 功能:取得两个日期中最小的日期,如果两个日期参数都为null则返回null
*
*
* @param date1
* @param date2
* @return Date or null
......@@ -546,7 +546,7 @@ public class DateUtils {
/**
* 功能:取得两个日期中最大的日期,如果两个日期参数都为null则返回null
*
*
* @param date1
* @param date2
* @return
......@@ -566,7 +566,7 @@ public class DateUtils {
/**
* 功能:获取指定日期和天数的星期几
*
*
* @param date 指定日期
* @param day 指定天数
* @return
......@@ -584,7 +584,7 @@ public class DateUtils {
/**
* 功能:判断两个Date是否为一天
*
*
* @param date1
* @param date2
* @return
......@@ -599,7 +599,7 @@ public class DateUtils {
/**
* 功能:把date1的小时,分钟,秒换成date2的小时,分钟,秒,返回换值后的date1
*
*
* @param date1
* @param date2
* @return
......@@ -619,10 +619,10 @@ public class DateUtils {
return cl1.getTime();
}
/**
* 功能:把date1的小时,分钟,秒换成23:59:59
*
*
* @param date1
* @return yyyy-MM-dd 23:59:59
*/
......@@ -638,7 +638,7 @@ public class DateUtils {
/**
* 功能:添加天数
*
*
* @param basicDate
* @param days 正、负 整数 或0
* @return
......@@ -656,7 +656,7 @@ public class DateUtils {
/**
* 功能:对日期进行格式化输出
*
*
* @param date 日期
* @param format
* @return
......@@ -675,7 +675,7 @@ public class DateUtils {
/**
* 功能:获取两个日期之间的天数
*
*
* @param dateFrom 起始日期
* @param dateEnd 结束日期
* @return
......@@ -699,7 +699,7 @@ public class DateUtils {
/**
* 功能:把日期字符串格式化为日期类型
*
*
* @param datetext 日期字符串
* @param format 日期格式,如果不传则使用"yyyy-MM-dd HH:mm:ss"格式
* @return
......@@ -730,7 +730,7 @@ public class DateUtils {
/**
* 功能:取得两天之间的日期数组,包含开始日期与结束日期
*
*
* @param startDateStr 开始日期
* @param endDateStr 结束日期
* @return Date[] 日期数组
......@@ -748,7 +748,7 @@ public class DateUtils {
/**
* 功能:获取两日期之间的天数
*
*
* @param dateFrom 起始日期
* @param dateEnd 结束日期
* @return
......@@ -776,7 +776,7 @@ public class DateUtils {
/**
* 功能: 待确定
*
*
* @param startDateStr
* @param endDateStr
* @return
......@@ -804,7 +804,7 @@ public class DateUtils {
/**
* 功能:获取星期几 SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and
* SATURDAY
*
*
* @param date
* @return
*/
......@@ -819,7 +819,7 @@ public class DateUtils {
/**
* 功能:字符串转换为日期
*
*
* @param datetext yyyy/MM/dd
* @return
*/
......@@ -834,14 +834,14 @@ public class DateUtils {
Date date = df.parse(datetext);
return date;
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(),e);
return null;
}
}
/**
* 功能: 添加Minute
*
*
* @param cdate
* @param amount
* @return
......@@ -852,10 +852,10 @@ public class DateUtils {
cl.add(Calendar.MINUTE, amount);
return cl.getTime();
}
/**
* 功能: 添加Hour
*
*
* @param cdate
* @param amount
* @return
......@@ -866,10 +866,10 @@ public class DateUtils {
cl.add(Calendar.HOUR_OF_DAY, amount);
return cl.getTime();
}
/**
* 功能: 添加Date
*
*
* @param cdate
* @param amount
* @return
......@@ -883,7 +883,7 @@ public class DateUtils {
/**
* 功能: 添加Year
*
*
* @param basicDate
* @param year
* @return
......@@ -895,14 +895,13 @@ public class DateUtils {
cal.add(GregorianCalendar.YEAR, year);
return formatDate(cal.getTime(), "yyyy-MM-dd");
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/**
* 添加Month
*
*
* @param cdate
* @param amount
* @return
......@@ -926,7 +925,7 @@ public class DateUtils {
/**
* 功能: 日期转换为字符串
*
*
* @param dd
* @return yyyy/MM/dd
*/
......@@ -953,7 +952,7 @@ public class DateUtils {
/**
* 功能:根据某个日期,返回本月的天数
*
*
* @param date 本月任何一天
* @return 天数
*/
......@@ -965,7 +964,7 @@ public class DateUtils {
/**
* 功能:获取指定日 开始本月的之后天数
*
*
* @param stringDate yyyy-MM-dd
* @return 天数(eg:"1,2,3,")
*/
......@@ -982,7 +981,7 @@ public class DateUtils {
/**
* 功能:获取指定日 开始本月的之前天数
*
*
* @param stringDate yyyy-MM-dd
* @return 天数(eg:"1,2,3,")
*/
......@@ -997,7 +996,7 @@ public class DateUtils {
/**
* 功能:获取指定日 开始本月的所有天数
*
*
* @param stringDate yyyy-MM-dd
* @return 天数(eg:"1,2,3,")
*/
......@@ -1015,7 +1014,7 @@ public class DateUtils {
/**
* 功能:三个月的指定日期
*
*
* @param stringDate
* @return
*/
......@@ -1029,7 +1028,7 @@ public class DateUtils {
/**
* 功能:根据某个日期,返回本月的所有日期数组
*
*
* @param date 给定日期
* @return 本月的所有日期数组
*/
......@@ -1050,7 +1049,7 @@ public class DateUtils {
/**
* 功能:根据某个日期,返回monthNum个月的第一天数组
*
*
* @param date 开始日期
* @param monthNum 月份个数
* @return 每个月的第一天数组
......@@ -1069,7 +1068,7 @@ public class DateUtils {
/**
* 功能:根据1个日期,返回N天之内的日期数组
*
*
* @param startDateStr 开始日期
* @param dayTimes 天数
* @return 这段时间之间的日期数组
......@@ -1087,7 +1086,7 @@ public class DateUtils {
/**
* 功能:根据1个日期,返回N天之内的yy-MM月份数组
*
*
* @param startDateStr 开始日期
* @param dayTimes 天数
* @return 这段时间之间的日期数组
......@@ -1116,7 +1115,7 @@ public class DateUtils {
/**
* 功能:根据1个日期,返回上N个月的第一天
*
*
* @param date 日期
* @param month 上N月
* @return 上N个月的第一天
......@@ -1158,7 +1157,7 @@ public class DateUtils {
/**
* Get the date of monday in this week
*
*
* @return yyyy-MM-dd
*/
public static String getMondayOfThisWeek() {
......@@ -1186,7 +1185,7 @@ public class DateUtils {
/**
* Get the date of sunday in this week
*
*
* @return yyyy-MM-dd
*/
public static String getSundayOfThisWeek() {
......@@ -1214,7 +1213,7 @@ public class DateUtils {
/**
* Get the date of AfterDays
*
*
* @param day
* @return yyyy-MM-dd
*/
......@@ -1237,7 +1236,7 @@ public class DateUtils {
/**
* Get data time in user's specific format
*
*
* @param strFormat
* @return String strDtTime
*/
......@@ -1253,7 +1252,7 @@ public class DateUtils {
/**
* Get data time in yyyyMMddHHmmss format
*
*
* @return String strDtTime
*/
public static String getDateTimeStamp() {
......@@ -1265,7 +1264,7 @@ public class DateUtils {
/**
* Get date time in yyyyMMdd format
*
*
* @return String strDtTime
*/
public static String getDateStamp() {
......@@ -1277,7 +1276,7 @@ public class DateUtils {
/**
* Get date time in HHmmss format
*
*
* @return String strDtTime
*/
public static String getTimeStamp() {
......@@ -1289,7 +1288,7 @@ public class DateUtils {
/**
* Get date time in yyyy年MM月dd日hh:mm:ss format
*
*
* @return String sb
*/
public static String getDateTimeCN() {
......@@ -1320,7 +1319,7 @@ public class DateUtils {
/**
* Get date time in Hashmap
*
*
* @return a HashMap
*/
public static Map<String, Integer> getDateTimeToHashMap() {
......@@ -1337,7 +1336,7 @@ public class DateUtils {
/**
* Format time 2005-10-08 10:03:41.0 to 2005-10-08 10:03:41 .
*
*
* @param str the time string
* @return String
*/
......@@ -1400,7 +1399,7 @@ public class DateUtils {
/**
* 获取从start到end之间的日期(格式yyyyMM)
*
*
* @param start
* @param end
* @return
......@@ -1415,10 +1414,10 @@ public class DateUtils {
}
return months;
}
/**
* 获取从start到end之间的日期(格式yyyyMMdd)
*
*
* @param start
* @param end
* @return
......@@ -1433,10 +1432,10 @@ public class DateUtils {
}
return days;
}
/**
* 将字符串日期转换为Date
*
*
* @param s
* @return
*/
......@@ -1463,10 +1462,10 @@ public class DateUtils {
}
}
}
/**
* 获取当期日期
*
* 获取当期日期
*
* @return
*/
public static Date getCurrentDate(){
......@@ -1475,7 +1474,7 @@ public class DateUtils {
curDate.set(Calendar.MINUTE, 0);
curDate.set(Calendar.SECOND, 0);
curDate.set(Calendar.MILLISECOND, 0);
return curDate.getTime();
}
......@@ -1495,4 +1494,4 @@ public class DateUtils {
public static Date timeStampToDate(long timeStamp){
return new Date(timeStamp);
}
}
\ No newline at end of file
}
......