Jiaqi.xu

Merge remote-tracking branch 'origin/master'

Showing 29 changed files with 448 additions and 214 deletions
1 +create table T_ICLEAR_API_CHECK_LOG
2 +(
3 +ID bigint primary key identity (1,1),
4 +request_appid varchar(200),
5 +request_appkey varchar(200),
6 +request_token varchar(200),
7 +consignment_code varchar(200),
8 +request_text text,
9 +response_text text,
10 +request_ip varchar(200),
11 +create_time datetime,
12 +success int,
13 +code varchar(200),
14 +)
...@@ -42,7 +42,7 @@ public class CustomsDataInterface { ...@@ -42,7 +42,7 @@ public class CustomsDataInterface {
42 private ChmConsignmentDetailService chmConsignmentDetailService; 42 private ChmConsignmentDetailService chmConsignmentDetailService;
43 43
44 44
45 - @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") 45 + @ApiOperation(value = "D类推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb")
46 @PostMapping("/sendMawb") 46 @PostMapping("/sendMawb")
47 @ResponseBody 47 @ResponseBody
48 public ResultRS sendMawb(HttpServletRequest request 48 public ResultRS sendMawb(HttpServletRequest request
...@@ -109,12 +109,12 @@ public class CustomsDataInterface { ...@@ -109,12 +109,12 @@ public class CustomsDataInterface {
109 sw.stop(); 109 sw.stop();
110 110
111 // //3、TODO 校验子单 111 // //3、TODO 校验子单
112 -// sw.start("checkMawbDetail"); 112 + sw.start("checkMawbDetail");
113 -// result=mawbDetailServicel.checkMawbDetail(mawb); 113 + result=mawbDetailServicel.checkMawbDetail(mawb);
114 -// if(!result.getSuccess()){ 114 + if(!result.getSuccess()){
115 -// return result; 115 + return result;
116 -// } 116 + }
117 -// sw.stop(); 117 + sw.stop();
118 118
119 119
120 //4、保存运单到iclear中 120 //4、保存运单到iclear中
......
...@@ -12,7 +12,9 @@ import com.erry.iclear.dateInterface.api.response.ResultRS; ...@@ -12,7 +12,9 @@ import com.erry.iclear.dateInterface.api.response.ResultRS;
12 import com.erry.iclear.dateInterface.entity.ChmConsignment; 12 import com.erry.iclear.dateInterface.entity.ChmConsignment;
13 import com.erry.iclear.dateInterface.entity.DeclaredInfo; 13 import com.erry.iclear.dateInterface.entity.DeclaredInfo;
14 import com.erry.iclear.dateInterface.entity.IClearApiLog; 14 import com.erry.iclear.dateInterface.entity.IClearApiLog;
15 +import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog;
15 import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; 16 import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository;
17 +import com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository;
16 import com.erry.iclear.dateInterface.service.*; 18 import com.erry.iclear.dateInterface.service.*;
17 import com.erry.iclear.dateInterface.util.JsonToJava; 19 import com.erry.iclear.dateInterface.util.JsonToJava;
18 import com.erry.iclear.dateInterface.util.StringUtil; 20 import com.erry.iclear.dateInterface.util.StringUtil;
...@@ -58,11 +60,74 @@ public class FedexDataInterface { ...@@ -58,11 +60,74 @@ public class FedexDataInterface {
58 @Autowired 60 @Autowired
59 private ChmConsignmentRepository chmConsignmentRepository; 61 private ChmConsignmentRepository chmConsignmentRepository;
60 62
63 + @Autowired
64 + private IClearApiCheckLogRepository iClearApiCheckLogRepository;
65 +
61 @Value("${api.address.iclear-submit-url}") 66 @Value("${api.address.iclear-submit-url}")
62 String iclearCSubmitUrl; 67 String iclearCSubmitUrl;
63 68
64 69
65 - @ApiOperation(value = "Fedex推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/sendMawbFedex") 70 + @ApiOperation(value = "BASF运单数据校验接口", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/checkBASFMawbFedex")
71 + @PostMapping("/checkBASFMawbFedex")
72 + @ResponseBody
73 + public ResultRS checkBASFMawbFedex(HttpServletRequest request
74 + ,@RequestBody Fedexc fedexc) throws HttpProcessException {
75 + String appId=(String) request.getHeader("Appid");
76 + String appKey=(String) request.getHeader("Appkey");
77 + String timeStamp=(String) request.getHeader("TimeStamp");
78 + String token=(String) request.getHeader("Token");
79 + String addr = request.getRemoteAddr();
80 +
81 +
82 + TIClearApiCheckLog tIclearApiCheckLog = new TIClearApiCheckLog();
83 + tIclearApiCheckLog.setRequestAppid(appId);
84 + tIclearApiCheckLog.setRequestAppkey(appKey);
85 + tIclearApiCheckLog.setRequestIp(addr);
86 + tIclearApiCheckLog.setRequestToken(token);
87 + tIclearApiCheckLog.setConsignmentCode(fedexc.getConsignmentCode());
88 + tIclearApiCheckLog.setCreateTime(new Date());
89 + tIclearApiCheckLog.setRequestText(
90 + new String("requestHeader[appId:"+appId+"," +
91 + "appKey:"+appKey+"," +
92 + "timeStamp:"+timeStamp+"," +
93 + "token:"+token) + "],"
94 + + fedexc.toString()
95 + );
96 + TIClearApiCheckLog tiClearApiCheckLogSave = iClearApiCheckLogRepository.save(tIclearApiCheckLog);
97 + log.info("checkBASFMawbFedex:"+fedexc.toString());
98 + log.info("appId:{},appKey:{},timeStamp:{},token:{}",appId,appKey,timeStamp,token);
99 +
100 + ResultRS result = fedexService.checkBasfInterfaceData(fedexc);
101 +
102 + StopWatch sw = new StopWatch("checkBASFMawbFedex");
103 + sw.start("generate FedexMawb");
104 + fedexc.setAppId(appId);
105 + FedexMawb saveMawbFedexResult = fedexService.generateFedexMawb(fedexc);
106 + sw.stop();
107 +
108 + sw.start("checkFedexMawb");
109 + String msg = result.getMsg();
110 + String iclearCheckMsg = fedexService.checkFedexMawb(saveMawbFedexResult).getMsg();
111 + result.setMsg(msg+";"+iclearCheckMsg);
112 + sw.stop();
113 +
114 + log.info(sw.prettyPrint());
115 + if(result.getSuccess()){
116 + result.setSuccess(Boolean.TRUE);
117 + result.setCode("0");
118 + }
119 + tiClearApiCheckLogSave.setResponseText(result.getMsg());
120 + tiClearApiCheckLogSave.setCode(result.getCode());
121 + tiClearApiCheckLogSave.setSuccess(result.getSuccess());
122 +
123 + iClearApiCheckLogRepository.save(tiClearApiCheckLogSave);
124 + log.info(result.toString());
125 + return result;
126 + }
127 +
128 +
129 +
130 + @ApiOperation(value = "C类Fedex推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/fedex/sendMawbFedex")
66 @PostMapping("/sendMawbFedex") 131 @PostMapping("/sendMawbFedex")
67 @ResponseBody 132 @ResponseBody
68 public ResultRS sendMawbFedex(HttpServletRequest request 133 public ResultRS sendMawbFedex(HttpServletRequest request
...@@ -283,4 +348,5 @@ public class FedexDataInterface { ...@@ -283,4 +348,5 @@ public class FedexDataInterface {
283 result.setCode("0"); 348 result.setCode("0");
284 return result; 349 return result;
285 } 350 }
351 +
286 } 352 }
......
...@@ -57,8 +57,7 @@ public class HsCodeInterface { ...@@ -57,8 +57,7 @@ public class HsCodeInterface {
57 return resultHsCode; 57 return resultHsCode;
58 } 58 }
59 }catch(Exception ex){ 59 }catch(Exception ex){
60 - log.error(ex.getMessage()); 60 + log.error(ex.getMessage(),ex);
61 - ex.printStackTrace();
62 resultHsCode = new ResultHsCode(Boolean.FALSE,"30101","数据查询异常",null); 61 resultHsCode = new ResultHsCode(Boolean.FALSE,"30101","数据查询异常",null);
63 return resultHsCode; 62 return resultHsCode;
64 }finally { 63 }finally {
...@@ -74,4 +73,4 @@ public class HsCodeInterface { ...@@ -74,4 +73,4 @@ public class HsCodeInterface {
74 iClearApiHsCodeLogService.saveIClearApiHsCodeLog(iclearApiHsCodeLog); 73 iClearApiHsCodeLogService.saveIClearApiHsCodeLog(iclearApiHsCodeLog);
75 } 74 }
76 } 75 }
77 -}
...\ No newline at end of file ...\ No newline at end of file
76 +}
......
...@@ -30,7 +30,7 @@ public class FedexDetail { ...@@ -30,7 +30,7 @@ public class FedexDetail {
30 private Long basfId; 30 private Long basfId;
31 31
32 @Column(name="CONSIGNMENTDETAILID") 32 @Column(name="CONSIGNMENTDETAILID")
33 - @NotNull(message="参数consignmentDetailId不能为空") 33 +// @NotNull(message="参数consignmentDetailId不能为空")
34 private Long consignmentDetailId; 34 private Long consignmentDetailId;
35 35
36 @ApiModelProperty(value = "商品编号") 36 @ApiModelProperty(value = "商品编号")
......
...@@ -50,7 +50,7 @@ public class Fedexc implements Serializable { ...@@ -50,7 +50,7 @@ public class Fedexc implements Serializable {
50 50
51 @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID") 51 @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID")
52 @Column(name = "CONSIGNMENTID") 52 @Column(name = "CONSIGNMENTID")
53 - @NotNull(message="参数consignmentId不能为空!") 53 +// @NotNull(message="参数consignmentId不能为空!")
54 // @NotBlank(message="参数consignmentId不能为空!") 54 // @NotBlank(message="参数consignmentId不能为空!")
55 private Long consignmentId; 55 private Long consignmentId;
56 56
......
...@@ -114,7 +114,6 @@ public class MawbDetail implements Serializable{ ...@@ -114,7 +114,6 @@ public class MawbDetail implements Serializable{
114 private String secondUnit; 114 private String secondUnit;
115 115
116 @ApiModelProperty(value = "第二法定数量") 116 @ApiModelProperty(value = "第二法定数量")
117 - @NotNull(message="参数secondQty不能为空")
118 @Column(name = "SECONDQTY") 117 @Column(name = "SECONDQTY")
119 private Integer secondQty; 118 private Integer secondQty;
120 119
......
1 +package com.erry.iclear.dateInterface.entity;
2 +
3 +
4 +import com.erry.iclear.dateInterface.common.BaseModel;
5 +import lombok.Data;
6 +
7 +import javax.persistence.*;
8 +import java.util.Date;
9 +
10 +/**
11 + * BASF校验接口日志表
12 + *
13 + * sql/BASF校验接口.sql
14 + */
15 +@Entity
16 +@Table(name = "T_ICLEAR_API_CHECK_LOG")
17 +@Data
18 +public class TIClearApiCheckLog extends BaseModel {
19 +
20 + @Id
21 + @GeneratedValue(strategy = GenerationType.IDENTITY)
22 + @Column(name = "ID" )
23 + private Long id;
24 +
25 + @Column(name = "request_appid" )
26 + private String requestAppid;
27 +
28 + @Column(name = "request_appkey" )
29 + private String requestAppkey;
30 +
31 + @Column(name = "request_token" )
32 + private String requestToken;
33 +
34 + @Column(name = "consignment_code" )
35 + private String consignmentCode;
36 +
37 + @Column(name = "request_text" )
38 + private String requestText;
39 +
40 + @Column(name = "response_text" )
41 + private String responseText;
42 +
43 + @Column(name = "request_ip" )
44 + private String requestIp;
45 +
46 + @Column(name = "create_time" )
47 + private Date createTime;
48 +
49 + @Column(name = "success" )
50 + private Boolean success;
51 +
52 + @Column(name = "code" )
53 + private String code;
54 +
55 +}
...@@ -36,22 +36,22 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter { ...@@ -36,22 +36,22 @@ public class HsCodeInterceptor extends HandlerInterceptorAdapter {
36 //String uri = request.getRequestURI(); 36 //String uri = request.getRequestURI();
37 37
38 if(StringUtils.isBlank(appId)){ 38 if(StringUtils.isBlank(appId)){
39 - this.returnJson(response,false,"10016","Appid 不能为空"); 39 + this.returnJson(response,false,"10016","Appid不能为空");
40 return false; 40 return false;
41 } 41 }
42 42
43 if(StringUtils.isBlank(appkey)){ 43 if(StringUtils.isBlank(appkey)){
44 - this.returnJson(response,false,"10017","Appkey 不能为空"); 44 + this.returnJson(response,false,"10017","Appkey不能为空");
45 return false; 45 return false;
46 } 46 }
47 47
48 if(StringUtils.isBlank(timeStamp)){ 48 if(StringUtils.isBlank(timeStamp)){
49 - this.returnJson(response,false,"10018","TimeStamp 不能为空"); 49 + this.returnJson(response,false,"10018","TimeStamp不能为空");
50 return false; 50 return false;
51 } 51 }
52 52
53 if(StringUtils.isBlank(token)){ 53 if(StringUtils.isBlank(token)){
54 - this.returnJson(response,false,"10013","token 不能为空"); 54 + this.returnJson(response,false,"10013","token不能为空");
55 return false; 55 return false;
56 } 56 }
57 57
......
...@@ -35,22 +35,22 @@ public class SignInterceptor extends HandlerInterceptorAdapter { ...@@ -35,22 +35,22 @@ public class SignInterceptor extends HandlerInterceptorAdapter {
35 35
36 36
37 if(StringUtils.isBlank(appId)){ 37 if(StringUtils.isBlank(appId)){
38 - this.returnJson(response,false,"10016","Appid 不能为空"); 38 + this.returnJson(response,false,"10016","Appid不能为空");
39 return false; 39 return false;
40 } 40 }
41 41
42 if(StringUtils.isBlank(appkey)){ 42 if(StringUtils.isBlank(appkey)){
43 - this.returnJson(response,false,"10017","Appkey 不能为空"); 43 + this.returnJson(response,false,"10017","Appkey不能为空");
44 return false; 44 return false;
45 } 45 }
46 46
47 if(StringUtils.isBlank(timeStamp)){ 47 if(StringUtils.isBlank(timeStamp)){
48 - this.returnJson(response,false,"10018","TimeStamp 不能为空"); 48 + this.returnJson(response,false,"10018","TimeStamp不能为空");
49 return false; 49 return false;
50 } 50 }
51 51
52 if(StringUtils.isBlank(token)){ 52 if(StringUtils.isBlank(token)){
53 - this.returnJson(response,false,"10013","token 不能为空"); 53 + this.returnJson(response,false,"10013","token不能为空");
54 return false; 54 return false;
55 } 55 }
56 56
...@@ -99,4 +99,4 @@ public class SignInterceptor extends HandlerInterceptorAdapter { ...@@ -99,4 +99,4 @@ public class SignInterceptor extends HandlerInterceptorAdapter {
99 } 99 }
100 } 100 }
101 101
102 -}
...\ No newline at end of file ...\ No newline at end of file
102 +}
......
1 +package com.erry.iclear.dateInterface.repository;
2 +
3 +import com.erry.iclear.dateInterface.entity.IClearApiLog;
4 +import com.erry.iclear.dateInterface.entity.TIClearApiCheckLog;
5 +import org.hibernate.annotations.DynamicInsert;
6 +import org.hibernate.annotations.DynamicUpdate;
7 +import org.springframework.data.jpa.repository.JpaRepository;
8 +import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
9 +import org.springframework.stereotype.Repository;
10 +import org.springframework.transaction.annotation.Transactional;
11 +
12 +/**
13 + * @author Administrator
14 + */
15 +@DynamicUpdate
16 +@DynamicInsert
17 +@Repository
18 +@Transactional(rollbackFor = Exception.class)
19 +public interface IClearApiCheckLogRepository extends JpaRepository<TIClearApiCheckLog, Integer>, JpaSpecificationExecutor<TIClearApiCheckLog> {
20 +
21 +
22 +}
...@@ -139,6 +139,7 @@ public class ApiService { ...@@ -139,6 +139,7 @@ public class ApiService {
139 //推送时间 139 //推送时间
140 declearTask.setPushTime(new Date()); 140 declearTask.setPushTime(new Date());
141 String objJson = JsonToJava.toJson(d); 141 String objJson = JsonToJava.toJson(d);
142 + log.info("推送海关回执json: " + objJson);
142 //推送海关回执数据 143 //推送海关回执数据
143 String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap); 144 String json = HttpUtils.doPost(this.customsUrl,objJson,headerMap);
144 //接口响应时间 145 //接口响应时间
...@@ -160,12 +161,12 @@ public class ApiService { ...@@ -160,12 +161,12 @@ public class ApiService {
160 log.info("海关回执推送失败,推送相应码为:"+tokenResult.getErrorcode() + ",推送ID为:" + d.getId()); 161 log.info("海关回执推送失败,推送相应码为:"+tokenResult.getErrorcode() + ",推送ID为:" + d.getId());
161 } 162 }
162 }catch(Exception ex){ 163 }catch(Exception ex){
164 + log.error("推送海关回执异常:" + ex.getMessage(), ex);
163 //接口响应时间 165 //接口响应时间
164 declearTask.setResponseTime(new Date()); 166 declearTask.setResponseTime(new Date());
165 declearTask.setResponseResults("99999"); 167 declearTask.setResponseResults("99999");
166 declearTask.setResponseContent(ex.getMessage()); 168 declearTask.setResponseContent(ex.getMessage());
167 declearTaskList.add(declearTask); 169 declearTaskList.add(declearTask);
168 - ex.printStackTrace();
169 } 170 }
170 }); 171 });
171 declearTaskList.forEach(declearTask -> { 172 declearTaskList.forEach(declearTask -> {
...@@ -203,7 +204,7 @@ public class ApiService { ...@@ -203,7 +204,7 @@ public class ApiService {
203 }); 204 });
204 this.sendMawb(token,mawbList); 205 this.sendMawb(token,mawbList);
205 }catch(Exception ex){ 206 }catch(Exception ex){
206 - ex.printStackTrace(); 207 + log.error("pushMawbAcc",ex);
207 } 208 }
208 } 209 }
209 /** 210 /**
...@@ -261,7 +262,7 @@ public class ApiService { ...@@ -261,7 +262,7 @@ public class ApiService {
261 declearTask.setResponseResults("99999"); 262 declearTask.setResponseResults("99999");
262 declearTask.setResponseContent(ex.getMessage()); 263 declearTask.setResponseContent(ex.getMessage());
263 declearTaskList.add(declearTask); 264 declearTaskList.add(declearTask);
264 - ex.printStackTrace(); 265 + log.error("sendMawb",ex);
265 } 266 }
266 }); 267 });
267 declearTaskList.forEach(declearTask -> { 268 declearTaskList.forEach(declearTask -> {
......
...@@ -234,8 +234,7 @@ public class ChmConsignmentService { ...@@ -234,8 +234,7 @@ public class ChmConsignmentService {
234 234
235 }catch (Exception e){ 235 }catch (Exception e){
236 result=null; 236 result=null;
237 - e.printStackTrace(); 237 + log.error("sendMawb",e);
238 - log.error("convertToChmConsignment() error:"+e.getMessage());
239 } 238 }
240 return result; 239 return result;
241 } 240 }
...@@ -292,8 +291,7 @@ public class ChmConsignmentService { ...@@ -292,8 +291,7 @@ public class ChmConsignmentService {
292 } 291 }
293 }catch (Exception e){ 292 }catch (Exception e){
294 result=null; 293 result=null;
295 - e.printStackTrace(); 294 + log.error("convertToChmConsignmentFedex() error:"+e.getMessage(),e);
296 - log.error("convertToChmConsignmentFedex() error:"+e.getMessage());
297 } 295 }
298 return result; 296 return result;
299 } 297 }
...@@ -430,8 +428,7 @@ public class ChmConsignmentService { ...@@ -430,8 +428,7 @@ public class ChmConsignmentService {
430 result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname()); 428 result.setOverseasConsigneeEname(consignment.getOverseasConsignorFnCname());
431 }catch (Exception e){ 429 }catch (Exception e){
432 result=null; 430 result=null;
433 - e.printStackTrace(); 431 + log.error("convertToChmConsignment() error:"+e.getMessage(),e);
434 - log.error("convertToChmConsignment() error:"+e.getMessage());
435 } 432 }
436 return result; 433 return result;
437 } 434 }
......
...@@ -45,7 +45,7 @@ public class DeclearTaskService{ ...@@ -45,7 +45,7 @@ public class DeclearTaskService{
45 declareTaskRepository.saveAll(declareTaskList); 45 declareTaskRepository.saveAll(declareTaskList);
46 } 46 }
47 }catch (Exception e){ 47 }catch (Exception e){
48 - e.printStackTrace(); 48 + log.error(e.getMessage(),e);
49 } 49 }
50 50
51 } 51 }
...@@ -70,7 +70,7 @@ public class DeclearTaskService{ ...@@ -70,7 +70,7 @@ public class DeclearTaskService{
70 declareTaskRepository.saveAll(declareTaskList); 70 declareTaskRepository.saveAll(declareTaskList);
71 } 71 }
72 }catch (Exception e){ 72 }catch (Exception e){
73 - e.printStackTrace(); 73 + log.error(e.getMessage(),e);
74 } 74 }
75 75
76 } 76 }
......
...@@ -27,8 +27,7 @@ public class DictionaryEntriesService { ...@@ -27,8 +27,7 @@ public class DictionaryEntriesService {
27 try { 27 try {
28 result=dictionaryEntriesRepository.findAllDictionaryEntries(); 28 result=dictionaryEntriesRepository.findAllDictionaryEntries();
29 }catch (Exception e){ 29 }catch (Exception e){
30 - e.printStackTrace(); 30 + log.error(e.getMessage(),e);
31 - log.error("getAllDictionaryEntries() error:"+e.getMessage());
32 } 31 }
33 return result; 32 return result;
34 } 33 }
......
...@@ -3,12 +3,14 @@ package com.erry.iclear.dateInterface.service; ...@@ -3,12 +3,14 @@ package com.erry.iclear.dateInterface.service;
3 import com.erry.iclear.dateInterface.api.request.FedexConsignment; 3 import com.erry.iclear.dateInterface.api.request.FedexConsignment;
4 import com.erry.iclear.dateInterface.api.request.ConsignmentDetail; 4 import com.erry.iclear.dateInterface.api.request.ConsignmentDetail;
5 import com.erry.iclear.dateInterface.entity.DeclaredInfo; 5 import com.erry.iclear.dateInterface.entity.DeclaredInfo;
6 +import lombok.extern.slf4j.Slf4j;
6 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
7 8
8 import java.util.ArrayList; 9 import java.util.ArrayList;
9 import java.util.List; 10 import java.util.List;
10 11
11 @Service 12 @Service
13 +@Slf4j
12 public class FedexConsignmentService { 14 public class FedexConsignmentService {
13 15
14 public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){ 16 public List<FedexConsignment> fedexConsignmentList(List<DeclaredInfo> consignment){
...@@ -62,7 +64,7 @@ public class FedexConsignmentService { ...@@ -62,7 +64,7 @@ public class FedexConsignmentService {
62 fedexConsignmentList.add(fedexConsignment); 64 fedexConsignmentList.add(fedexConsignment);
63 } 65 }
64 }catch (Exception e){ 66 }catch (Exception e){
65 - e.printStackTrace(); 67 + log.error(e.getMessage(),e);
66 } 68 }
67 return fedexConsignmentList; 69 return fedexConsignmentList;
68 } 70 }
......
...@@ -11,15 +11,22 @@ import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; ...@@ -11,15 +11,22 @@ import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
11 import com.erry.iclear.dateInterface.repository.FedexMawbRepository; 11 import com.erry.iclear.dateInterface.repository.FedexMawbRepository;
12 import com.erry.iclear.dateInterface.util.JsonToJava; 12 import com.erry.iclear.dateInterface.util.JsonToJava;
13 import com.google.gson.Gson; 13 import com.google.gson.Gson;
14 +import io.swagger.annotations.ApiModelProperty;
14 import lombok.extern.slf4j.Slf4j; 15 import lombok.extern.slf4j.Slf4j;
16 +import org.apache.commons.lang3.StringUtils;
15 import org.apache.http.Header; 17 import org.apache.http.Header;
16 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.beans.factory.annotation.Value; 19 import org.springframework.beans.factory.annotation.Value;
18 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
19 21
22 +import javax.persistence.*;
23 +import javax.validation.Valid;
24 +import javax.validation.constraints.NotBlank;
25 +import javax.validation.constraints.NotNull;
20 import java.util.ArrayList; 26 import java.util.ArrayList;
21 import java.util.List; 27 import java.util.List;
22 import java.util.Objects; 28 import java.util.Objects;
29 +import java.util.stream.Collectors;
23 30
24 /** 31 /**
25 * @author Administrator 32 * @author Administrator
...@@ -50,51 +57,7 @@ public class FedexService { ...@@ -50,51 +57,7 @@ public class FedexService {
50 FedexMawb result=null; 57 FedexMawb result=null;
51 try{ 58 try{
52 log.info("saveMawb start>>>>>>>>>>>"); 59 log.info("saveMawb start>>>>>>>>>>>");
53 - //运单头部信息 60 + FedexMawb fedexMawb = this.generateFedexMawb(fedexc);
54 - FedexMawb fedexMawb = new FedexMawb();
55 - fedexMawb.setAppId(fedexc.getAppId());
56 - fedexMawb.setMsgId(fedexc.getMsgId());
57 - fedexMawb.setConsignmentCodeId(fedexc.getConsignmentId());
58 - fedexMawb.setType(fedexc.getConsType());
59 - //TODO 记录时为同一张表,用 '-->' 记录具体存放字段(方便查看,以免误解)
60 - //运单号-->提单号
61 - fedexMawb.setBillNo(fedexc.getConsignmentCode());
62 - //经营单位 --> 消费使用/生产销售单位名称
63 - fedexMawb.setOwnerName(fedexc.getOperateUnitName());
64 - //经营单位海关编码 --> 消费使用/生产销售单位代码
65 - fedexMawb.setOwnerCode(fedexc.getOperateUnitCode());
66 - //经营单位社会信用证代码 --> 消费使用/生产销售单位单位统一编码
67 - fedexMawb.setOwnerCodeScc(fedexc.getOperateSCC());
68 - //发件人 --> 境内收发货人名称
69 - fedexMawb.setTradeName(fedexc.getSender());
70 - //发件人海关编码 --> 境内收发货人编号
71 - fedexMawb.setTradeCode(fedexc.getShipperCustomsCode());
72 - //发件人社会信用证代码 --> 生产核销单位统一信用代码---报关形式类型
73 - fedexMawb.setTradeCodeScc(fedexc.getShipperSCC());
74 -
75 - fedexMawb.setEanNo(fedexc.getEanNo());
76 - //明细
77 - List<FedexMawbDetail> mawbDetailList = new ArrayList<>();
78 - if (fedexc.getConsignmentList().size()>0){
79 - for (FedexDetail fedexcDetail : fedexc.getConsignmentList()){
80 - FedexMawbDetail mawbDetail = new FedexMawbDetail();
81 - mawbDetail.setDetailId(String.valueOf(fedexcDetail.getConsignmentDetailId()));
82 - mawbDetail.setGmodel(fedexcDetail.getModel());
83 - mawbDetail.setCodeTS(fedexcDetail.getSkuCode());
84 - mawbDetail.setGname(fedexcDetail.getSkuName());
85 - mawbDetail.setGqty(fedexcDetail.getKnockdownNumber());
86 - mawbDetail.setGunit(fedexcDetail.getKnockdownUnit());
87 - mawbDetail.setFirstUnit(fedexcDetail.getUnitLegalFirst());
88 - mawbDetail.setFirstQty(fedexcDetail.getQtyLegalFirst());
89 - mawbDetail.setSecondQty(fedexcDetail.getQtyLegalSecond());
90 - mawbDetail.setSecondUnit(fedexcDetail.getUnitLegalSecond());
91 - mawbDetail.setDeclTotal(fedexcDetail.getDeclaredAmount());
92 - mawbDetail.setTradeCurr(fedexcDetail.getCurrency());
93 - mawbDetail.setDeclaredWeight(fedexcDetail.getDeclaredWeight());
94 - mawbDetailList.add(mawbDetail);
95 - }
96 - }
97 - fedexMawb.setMawbDetailList(mawbDetailList);
98 result = fedexMawbRepository.save(fedexMawb); 61 result = fedexMawbRepository.save(fedexMawb);
99 log.info("saveMawb end>>>>>>>>>>>"); 62 log.info("saveMawb end>>>>>>>>>>>");
100 }catch (Exception e){ 63 }catch (Exception e){
...@@ -103,6 +66,57 @@ public class FedexService { ...@@ -103,6 +66,57 @@ public class FedexService {
103 return result; 66 return result;
104 } 67 }
105 68
69 + public FedexMawb generateFedexMawb(Fedexc fedexc){
70 + //运单头部信息
71 + FedexMawb fedexMawb = new FedexMawb();
72 + fedexMawb.setAppId(fedexc.getAppId());
73 + fedexMawb.setMsgId(fedexc.getMsgId());
74 + fedexMawb.setConsignmentCodeId(fedexc.getConsignmentId());
75 + fedexMawb.setType(fedexc.getConsType());
76 + //TODO 记录时为同一张表,用 '-->' 记录具体存放字段(方便查看,以免误解)
77 + //运单号-->提单号
78 + fedexMawb.setBillNo(fedexc.getConsignmentCode());
79 + //经营单位 --> 消费使用/生产销售单位名称
80 + fedexMawb.setOwnerName(fedexc.getOperateUnitName());
81 + //经营单位海关编码 --> 消费使用/生产销售单位代码
82 + fedexMawb.setOwnerCode(fedexc.getOperateUnitCode());
83 + //经营单位社会信用证代码 --> 消费使用/生产销售单位单位统一编码
84 + fedexMawb.setOwnerCodeScc(fedexc.getOperateSCC());
85 + //发件人 --> 境内收发货人名称
86 + fedexMawb.setTradeName(fedexc.getSender());
87 + //发件人海关编码 --> 境内收发货人编号
88 + fedexMawb.setTradeCode(fedexc.getShipperCustomsCode());
89 + //发件人社会信用证代码 --> 生产核销单位统一信用代码---报关形式类型
90 + fedexMawb.setTradeCodeScc(fedexc.getShipperSCC());
91 +
92 + fedexMawb.setEanNo(fedexc.getEanNo());
93 + //明细
94 + List<FedexMawbDetail> mawbDetailList = new ArrayList<>();
95 + List<FedexDetail> consignmentList = fedexc.getConsignmentList();
96 + if (Objects.nonNull(consignmentList) &&consignmentList.size()>0){
97 + for (FedexDetail fedexcDetail : fedexc.getConsignmentList()){
98 + FedexMawbDetail mawbDetail = new FedexMawbDetail();
99 + mawbDetail.setDetailId(String.valueOf(fedexcDetail.getConsignmentDetailId()));
100 + mawbDetail.setGmodel(fedexcDetail.getModel());
101 + mawbDetail.setCodeTS(fedexcDetail.getSkuCode());
102 + mawbDetail.setGname(fedexcDetail.getSkuName());
103 + mawbDetail.setGqty(fedexcDetail.getKnockdownNumber());
104 + mawbDetail.setGunit(fedexcDetail.getKnockdownUnit());
105 + mawbDetail.setFirstUnit(fedexcDetail.getUnitLegalFirst());
106 + mawbDetail.setFirstQty(fedexcDetail.getQtyLegalFirst());
107 + mawbDetail.setSecondQty(fedexcDetail.getQtyLegalSecond());
108 + mawbDetail.setSecondUnit(fedexcDetail.getUnitLegalSecond());
109 + mawbDetail.setDeclTotal(fedexcDetail.getDeclaredAmount());
110 + mawbDetail.setTradeCurr(fedexcDetail.getCurrency());
111 + mawbDetail.setDeclaredWeight(fedexcDetail.getDeclaredWeight());
112 + mawbDetailList.add(mawbDetail);
113 + }
114 + }
115 + fedexMawb.setMawbDetailList(mawbDetailList);
116 +
117 + return fedexMawb;
118 + }
119 +
106 /** 120 /**
107 * 校验主单 121 * 校验主单
108 * @param fedexMawb 122 * @param fedexMawb
...@@ -145,7 +159,56 @@ public class FedexService { ...@@ -145,7 +159,56 @@ public class FedexService {
145 result.setMsg(iclearCheckResponseResult.getMessage()); 159 result.setMsg(iclearCheckResponseResult.getMessage());
146 log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(fedexMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); 160 log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(fedexMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess());
147 }catch (Exception e){ 161 }catch (Exception e){
148 - log.error("checkMawb() error:" + e.getMessage()); 162 + log.error("checkMawb() error:",e);
163 + }
164 + return result;
165 + }
166 +
167 +
168 + /**
169 + * 校验BASF接口信息
170 + * @param fedexc
171 + * @return
172 + */
173 + public ResultRS checkBasfInterfaceData(Fedexc fedexc){
174 +
175 + ResultRS result = new ResultRS(Boolean.FALSE,"","");
176 +
177 + if(Objects.equals(fedexc,null)){
178 + result.setCode("-7");
179 + result.setMsg("请求信息不能为空");
180 + }else{
181 + List<String> msgList = new ArrayList<>();
182 +// 参数consignmentCode不能为空
183 + String consignmentCode = fedexc.getConsignmentCode();
184 + if(StringUtils.isEmpty(consignmentCode)){
185 + msgList.add("参数consignmentCode不能为空");
186 + }
187 +// 参数consignmentId不能为空
188 +// Long consignmentId = fedexc.getConsignmentId();
189 +// if(Objects.isNull(consignmentId)){
190 +// msgList.add("参数consignmentId不能为空");
191 +// }
192 +// 参数consType不能为空
193 + String consType = fedexc.getConsType();
194 + if(StringUtils.isEmpty(consType)){
195 + msgList.add("参数consType不能为空");
196 + }
197 +// 参数sender不能为空
198 + String sender = fedexc.getSender();
199 + if(StringUtils.isEmpty(sender)){
200 + msgList.add("参数sender不能为空");
201 + }
202 +// 参数shipperSCC不能为空
203 + String shipperSCC = fedexc.getShipperSCC();
204 + if(StringUtils.isEmpty(shipperSCC)){
205 + msgList.add("参数shipperSCC不能为空");
206 + }
207 + if(msgList.size() > 0){
208 + String join = msgList.stream().collect(Collectors.joining(";"));
209 + result.setCode("-7");
210 + result.setMsg(join);
211 + }
149 } 212 }
150 return result; 213 return result;
151 } 214 }
......
...@@ -61,8 +61,7 @@ public class HsCodeService { ...@@ -61,8 +61,7 @@ public class HsCodeService {
61 resultHsCode.setMsg("操作成功"); 61 resultHsCode.setMsg("操作成功");
62 resultHsCode.setHsCodeResultList(hsCodeList); 62 resultHsCode.setHsCodeResultList(hsCodeList);
63 }catch(Exception ex){ 63 }catch(Exception ex){
64 - log.error(ex.getMessage()); 64 + log.error(ex.getMessage(),ex);
65 - ex.printStackTrace();
66 resultHsCode.setSuccess(Boolean.FALSE); 65 resultHsCode.setSuccess(Boolean.FALSE);
67 resultHsCode.setCode("30101"); 66 resultHsCode.setCode("30101");
68 resultHsCode.setMsg("数据查询异常"); 67 resultHsCode.setMsg("数据查询异常");
...@@ -83,8 +82,8 @@ public class HsCodeService { ...@@ -83,8 +82,8 @@ public class HsCodeService {
83 resultHsCode.setMsg("操作成功"); 82 resultHsCode.setMsg("操作成功");
84 resultHsCode.setHsCodeResultList(hsCodeList); 83 resultHsCode.setHsCodeResultList(hsCodeList);
85 }catch(Exception ex){ 84 }catch(Exception ex){
86 - log.error(ex.getMessage()); 85 + log.error(ex.getMessage(),ex);
87 - ex.printStackTrace(); 86 +
88 resultHsCode.setSuccess(Boolean.FALSE); 87 resultHsCode.setSuccess(Boolean.FALSE);
89 resultHsCode.setCode("30101"); 88 resultHsCode.setCode("30101");
90 resultHsCode.setMsg("数据查询异常"); 89 resultHsCode.setMsg("数据查询异常");
......
...@@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService { ...@@ -44,7 +44,7 @@ public class IClearApiHsCodeLogService {
44 rs = true; 44 rs = true;
45 } 45 }
46 }catch(Exception ex){ 46 }catch(Exception ex){
47 - ex.printStackTrace(); 47 + log.error(ex.getMessage(),ex);
48 } 48 }
49 return rs; 49 return rs;
50 } 50 }
......
...@@ -5,10 +5,12 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail; ...@@ -5,10 +5,12 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail;
5 import com.erry.iclear.dateInterface.api.response.ResultRS; 5 import com.erry.iclear.dateInterface.api.response.ResultRS;
6 import com.erry.iclear.dateInterface.repository.MawbDetailRepository; 6 import com.erry.iclear.dateInterface.repository.MawbDetailRepository;
7 import lombok.extern.slf4j.Slf4j; 7 import lombok.extern.slf4j.Slf4j;
8 +import org.apache.commons.lang3.StringUtils;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
10 11
11 import java.util.List; 12 import java.util.List;
13 +import java.util.Objects;
12 14
13 /** 15 /**
14 * @author Administrator 16 * @author Administrator
...@@ -22,18 +24,26 @@ public class MawbDetailService { ...@@ -22,18 +24,26 @@ public class MawbDetailService {
22 24
23 public void saveMawbDetail(List<MawbDetail> mawbDetailList){ 25 public void saveMawbDetail(List<MawbDetail> mawbDetailList){
24 log.info(""); 26 log.info("");
25 - 27 +
26 log.info(""); 28 log.info("");
27 29
28 } 30 }
29 31
30 32
31 public ResultRS checkMawbDetail(Mawb mawb){ 33 public ResultRS checkMawbDetail(Mawb mawb){
32 - ResultRS result = new ResultRS(Boolean.FALSE,null,null); 34 + ResultRS result = new ResultRS(Boolean.FALSE,"30002",null);
33 try{ 35 try{
34 - 36 + for (MawbDetail detail : mawb.getMawbDetailList()) {
35 - 37 + String secondUnit = detail.getSecondUnit();
36 - 38 + if (StringUtils.isNotEmpty(secondUnit)) {
39 +
40 + Integer secondQty = detail.getSecondQty();
41 + if (Objects.isNull(secondQty)) {
42 + result.setMsg("参数secondQty不能为空");
43 + return result;
44 + }
45 + }
46 + }
37 result.setSuccess(Boolean.TRUE); 47 result.setSuccess(Boolean.TRUE);
38 }catch (Exception e){ 48 }catch (Exception e){
39 log.error("checkMawbDetail() error:"+e.getMessage()); 49 log.error("checkMawbDetail() error:"+e.getMessage());
......
...@@ -103,7 +103,8 @@ public class IClearApiTask { ...@@ -103,7 +103,8 @@ public class IClearApiTask {
103 this.token = tokenResult.getData().getToken(); 103 this.token = tokenResult.getData().getToken();
104 } 104 }
105 }catch(Exception ex){ 105 }catch(Exception ex){
106 - ex.printStackTrace(); 106 +
107 + log.error(ex.getMessage(),ex);
107 } 108 }
108 } 109 }
109 if(this.token == null){ 110 if(this.token == null){
......
...@@ -27,13 +27,13 @@ public class DateUtils { ...@@ -27,13 +27,13 @@ public class DateUtils {
27 private DateUtils() { 27 private DateUtils() {
28 }; 28 };
29 29
30 - 30 +
31 public static String YEAR_MONTH = "yyyyMM"; 31 public static String YEAR_MONTH = "yyyyMM";
32 public static String SHORT_DATE = "yyyyMMdd"; 32 public static String SHORT_DATE = "yyyyMMdd";
33 33
34 /** 34 /**
35 * 功能:计算两个日期之间相差多少天 ((date2-date1)后取整) 35 * 功能:计算两个日期之间相差多少天 ((date2-date1)后取整)
36 - * 36 + *
37 * @param date1 减日期 37 * @param date1 减日期
38 * @param date2 被减日期 38 * @param date2 被减日期
39 * @return 39 * @return
...@@ -47,12 +47,12 @@ public class DateUtils { ...@@ -47,12 +47,12 @@ public class DateUtils {
47 calendar1.set(Calendar.MINUTE, 0); 47 calendar1.set(Calendar.MINUTE, 0);
48 calendar1.set(Calendar.SECOND, 0); 48 calendar1.set(Calendar.SECOND, 0);
49 calendar1.set(Calendar.MILLISECOND, 0); 49 calendar1.set(Calendar.MILLISECOND, 0);
50 - 50 +
51 calendar2.set(Calendar.HOUR_OF_DAY, 0); 51 calendar2.set(Calendar.HOUR_OF_DAY, 0);
52 calendar2.set(Calendar.MINUTE, 0); 52 calendar2.set(Calendar.MINUTE, 0);
53 calendar2.set(Calendar.SECOND, 0); 53 calendar2.set(Calendar.SECOND, 0);
54 calendar2.set(Calendar.MILLISECOND, 0); 54 calendar2.set(Calendar.MILLISECOND, 0);
55 - 55 +
56 long l = Math.abs(calendar2.getTimeInMillis() - calendar1.getTimeInMillis()); 56 long l = Math.abs(calendar2.getTimeInMillis() - calendar1.getTimeInMillis());
57 long increaseDate = l / 1000 / 60 / 60 / 24; 57 long increaseDate = l / 1000 / 60 / 60 / 24;
58 if ((l % (1000 * 60 * 60 * 24)) > 0) { 58 if ((l % (1000 * 60 * 60 * 24)) > 0) {
...@@ -60,10 +60,10 @@ public class DateUtils { ...@@ -60,10 +60,10 @@ public class DateUtils {
60 } 60 }
61 return (int) increaseDate; 61 return (int) increaseDate;
62 } 62 }
63 - 63 +
64 /** 64 /**
65 * date2 是否是date1 的下一天 65 * date2 是否是date1 的下一天
66 - * 66 + *
67 * @param date1 67 * @param date1
68 * @param date2 68 * @param date2
69 * @return 69 * @return
...@@ -77,7 +77,7 @@ public class DateUtils { ...@@ -77,7 +77,7 @@ public class DateUtils {
77 77
78 /** 78 /**
79 * 功能:按yyyy-MM-dd HH:mm:ss 或 yyyy-MM-dd转换为日期 79 * 功能:按yyyy-MM-dd HH:mm:ss 或 yyyy-MM-dd转换为日期
80 - * 80 + *
81 * @param s 81 * @param s
82 * @return 82 * @return
83 * @throws Exception 83 * @throws Exception
...@@ -108,7 +108,7 @@ public class DateUtils { ...@@ -108,7 +108,7 @@ public class DateUtils {
108 108
109 /** 109 /**
110 * date1 > date2+before-->true 110 * date1 > date2+before-->true
111 - * 111 + *
112 * @param date1 112 * @param date1
113 * @param date2 113 * @param date2
114 * @param before 114 * @param before
...@@ -133,7 +133,7 @@ public class DateUtils { ...@@ -133,7 +133,7 @@ public class DateUtils {
133 133
134 /** 134 /**
135 * 功能:判断时间是否是凌晨(0-6),默认当前系统时间 135 * 功能:判断时间是否是凌晨(0-6),默认当前系统时间
136 - * 136 + *
137 * @param date 137 * @param date
138 * @return 138 * @return
139 * @throws Exception 139 * @throws Exception
...@@ -154,7 +154,7 @@ public class DateUtils { ...@@ -154,7 +154,7 @@ public class DateUtils {
154 /** 154 /**
155 * 功能:根据传入的字符串,得到holdTime,得到的时间为1970年的HH:mm:ss 155 * 功能:根据传入的字符串,得到holdTime,得到的时间为1970年的HH:mm:ss
156 * 如果格式不对(不为例如:23:12:23或着23:56或着23),抛出异常 156 * 如果格式不对(不为例如:23:12:23或着23:56或着23),抛出异常
157 - * 157 + *
158 * @param str 158 * @param str
159 * @return 159 * @return
160 */ 160 */
...@@ -188,7 +188,7 @@ public class DateUtils { ...@@ -188,7 +188,7 @@ public class DateUtils {
188 188
189 /** 189 /**
190 * 日期转为HoldTime格式HH:mm 190 * 日期转为HoldTime格式HH:mm
191 - * 191 + *
192 * @param date 192 * @param date
193 * @return 193 * @return
194 */ 194 */
...@@ -202,7 +202,7 @@ public class DateUtils { ...@@ -202,7 +202,7 @@ public class DateUtils {
202 202
203 /** 203 /**
204 * 功能:算出两个日期中所包含的月份 204 * 功能:算出两个日期中所包含的月份
205 - * 205 + *
206 * @param fromDate 206 * @param fromDate
207 * @param toDate 207 * @param toDate
208 * @return 208 * @return
...@@ -237,7 +237,7 @@ public class DateUtils { ...@@ -237,7 +237,7 @@ public class DateUtils {
237 237
238 /** 238 /**
239 * 功能:获取yyyyMM的年月 239 * 功能:获取yyyyMM的年月
240 - * 240 + *
241 * @param date 241 * @param date
242 * @return 242 * @return
243 */ 243 */
...@@ -248,7 +248,7 @@ public class DateUtils { ...@@ -248,7 +248,7 @@ public class DateUtils {
248 248
249 /** 249 /**
250 * 功能:获取yyyyMMdd的年月日 250 * 功能:获取yyyyMMdd的年月日
251 - * 251 + *
252 * @param date 252 * @param date
253 * @return 253 * @return
254 */ 254 */
...@@ -259,7 +259,7 @@ public class DateUtils { ...@@ -259,7 +259,7 @@ public class DateUtils {
259 259
260 /** 260 /**
261 * 功能:获取yyyyMM的年月 261 * 功能:获取yyyyMM的年月
262 - * 262 + *
263 * @param month 263 * @param month
264 * @return 264 * @return
265 */ 265 */
...@@ -274,8 +274,8 @@ public class DateUtils { ...@@ -274,8 +274,8 @@ public class DateUtils {
274 274
275 /** 275 /**
276 * 功能:格式yyyyMMdd日期 276 * 功能:格式yyyyMMdd日期
277 - * 277 + *
278 - * 278 + *
279 * @param date 279 * @param date
280 * @return 280 * @return
281 */ 281 */
...@@ -290,7 +290,7 @@ public class DateUtils { ...@@ -290,7 +290,7 @@ public class DateUtils {
290 290
291 /** 291 /**
292 * 功能:根据两个日期,算出某个月份的第一天,或者最后一天 292 * 功能:根据两个日期,算出某个月份的第一天,或者最后一天
293 - * 293 + *
294 * @param dateFrom 294 * @param dateFrom
295 * @param dateTo 295 * @param dateTo
296 * @param month 296 * @param month
...@@ -334,7 +334,7 @@ public class DateUtils { ...@@ -334,7 +334,7 @@ public class DateUtils {
334 334
335 /** 335 /**
336 * 功能:根据一个日期,算出是这个月中的第几天 336 * 功能:根据一个日期,算出是这个月中的第几天
337 - * 337 + *
338 * @param date 338 * @param date
339 * @return 339 * @return
340 */ 340 */
...@@ -346,7 +346,7 @@ public class DateUtils { ...@@ -346,7 +346,7 @@ public class DateUtils {
346 346
347 /** 347 /**
348 * 功能:取出一个月中某天的日期 348 * 功能:取出一个月中某天的日期
349 - * 349 + *
350 * @param month 350 * @param month
351 * @param num 351 * @param num
352 * @return 352 * @return
...@@ -364,7 +364,7 @@ public class DateUtils { ...@@ -364,7 +364,7 @@ public class DateUtils {
364 364
365 /** 365 /**
366 * 功能:得到本周第一天日期 366 * 功能:得到本周第一天日期
367 - * 367 + *
368 * @return 368 * @return
369 */ 369 */
370 public static Date getCurrentWeekMonday() { 370 public static Date getCurrentWeekMonday() {
...@@ -387,7 +387,7 @@ public class DateUtils { ...@@ -387,7 +387,7 @@ public class DateUtils {
387 387
388 /** 388 /**
389 * 功能:得到本周最后一天的日期 389 * 功能:得到本周最后一天的日期
390 - * 390 + *
391 * @return 391 * @return
392 */ 392 */
393 public static Date getCurrentWeekSaturday() { 393 public static Date getCurrentWeekSaturday() {
...@@ -408,7 +408,7 @@ public class DateUtils { ...@@ -408,7 +408,7 @@ public class DateUtils {
408 408
409 /** 409 /**
410 * 功能:从指定日期移动一定的天数 410 * 功能:从指定日期移动一定的天数
411 - * 411 + *
412 * @param date 412 * @param date
413 * @param day 413 * @param day
414 * @return 414 * @return
...@@ -426,7 +426,7 @@ public class DateUtils { ...@@ -426,7 +426,7 @@ public class DateUtils {
426 426
427 /** 427 /**
428 * 功能:从当天日期移动一定的月数 428 * 功能:从当天日期移动一定的月数
429 - * 429 + *
430 * @param month 430 * @param month
431 * @return 431 * @return
432 */ 432 */
...@@ -442,7 +442,7 @@ public class DateUtils { ...@@ -442,7 +442,7 @@ public class DateUtils {
442 442
443 /** 443 /**
444 * 功能:获取昨天 444 * 功能:获取昨天
445 - * 445 + *
446 * @return 446 * @return
447 */ 447 */
448 public static Date getYesterday() { 448 public static Date getYesterday() {
...@@ -458,7 +458,7 @@ public class DateUtils { ...@@ -458,7 +458,7 @@ public class DateUtils {
458 458
459 /** 459 /**
460 * 功能:根据某个日期,返回本月第一天 460 * 功能:根据某个日期,返回本月第一天
461 - * 461 + *
462 * @param date 任何一天 462 * @param date 任何一天
463 * @return Date 当月第一天 463 * @return Date 当月第一天
464 */ 464 */
...@@ -475,7 +475,7 @@ public class DateUtils { ...@@ -475,7 +475,7 @@ public class DateUtils {
475 475
476 /** 476 /**
477 * 功能:根据某个日期,返回本月最后一天 477 * 功能:根据某个日期,返回本月最后一天
478 - * 478 + *
479 * @param date 任何一天 479 * @param date 任何一天
480 * @return Date 当月第一天 480 * @return Date 当月第一天
481 */ 481 */
...@@ -494,7 +494,7 @@ public class DateUtils { ...@@ -494,7 +494,7 @@ public class DateUtils {
494 494
495 /** 495 /**
496 * 功能:获取起始日期和终止日期之间的日期(包含起始和终止日期) 496 * 功能:获取起始日期和终止日期之间的日期(包含起始和终止日期)
497 - * 497 + *
498 * @param startDate 498 * @param startDate
499 * @param endDate 499 * @param endDate
500 * @return 500 * @return
...@@ -526,7 +526,7 @@ public class DateUtils { ...@@ -526,7 +526,7 @@ public class DateUtils {
526 526
527 /** 527 /**
528 * 功能:取得两个日期中最小的日期,如果两个日期参数都为null则返回null 528 * 功能:取得两个日期中最小的日期,如果两个日期参数都为null则返回null
529 - * 529 + *
530 * @param date1 530 * @param date1
531 * @param date2 531 * @param date2
532 * @return Date or null 532 * @return Date or null
...@@ -546,7 +546,7 @@ public class DateUtils { ...@@ -546,7 +546,7 @@ public class DateUtils {
546 546
547 /** 547 /**
548 * 功能:取得两个日期中最大的日期,如果两个日期参数都为null则返回null 548 * 功能:取得两个日期中最大的日期,如果两个日期参数都为null则返回null
549 - * 549 + *
550 * @param date1 550 * @param date1
551 * @param date2 551 * @param date2
552 * @return 552 * @return
...@@ -566,7 +566,7 @@ public class DateUtils { ...@@ -566,7 +566,7 @@ public class DateUtils {
566 566
567 /** 567 /**
568 * 功能:获取指定日期和天数的星期几 568 * 功能:获取指定日期和天数的星期几
569 - * 569 + *
570 * @param date 指定日期 570 * @param date 指定日期
571 * @param day 指定天数 571 * @param day 指定天数
572 * @return 572 * @return
...@@ -584,7 +584,7 @@ public class DateUtils { ...@@ -584,7 +584,7 @@ public class DateUtils {
584 584
585 /** 585 /**
586 * 功能:判断两个Date是否为一天 586 * 功能:判断两个Date是否为一天
587 - * 587 + *
588 * @param date1 588 * @param date1
589 * @param date2 589 * @param date2
590 * @return 590 * @return
...@@ -599,7 +599,7 @@ public class DateUtils { ...@@ -599,7 +599,7 @@ public class DateUtils {
599 599
600 /** 600 /**
601 * 功能:把date1的小时,分钟,秒换成date2的小时,分钟,秒,返回换值后的date1 601 * 功能:把date1的小时,分钟,秒换成date2的小时,分钟,秒,返回换值后的date1
602 - * 602 + *
603 * @param date1 603 * @param date1
604 * @param date2 604 * @param date2
605 * @return 605 * @return
...@@ -619,10 +619,10 @@ public class DateUtils { ...@@ -619,10 +619,10 @@ public class DateUtils {
619 619
620 return cl1.getTime(); 620 return cl1.getTime();
621 } 621 }
622 - 622 +
623 /** 623 /**
624 * 功能:把date1的小时,分钟,秒换成23:59:59 624 * 功能:把date1的小时,分钟,秒换成23:59:59
625 - * 625 + *
626 * @param date1 626 * @param date1
627 * @return yyyy-MM-dd 23:59:59 627 * @return yyyy-MM-dd 23:59:59
628 */ 628 */
...@@ -638,7 +638,7 @@ public class DateUtils { ...@@ -638,7 +638,7 @@ public class DateUtils {
638 638
639 /** 639 /**
640 * 功能:添加天数 640 * 功能:添加天数
641 - * 641 + *
642 * @param basicDate 642 * @param basicDate
643 * @param days 正、负 整数 或0 643 * @param days 正、负 整数 或0
644 * @return 644 * @return
...@@ -656,7 +656,7 @@ public class DateUtils { ...@@ -656,7 +656,7 @@ public class DateUtils {
656 656
657 /** 657 /**
658 * 功能:对日期进行格式化输出 658 * 功能:对日期进行格式化输出
659 - * 659 + *
660 * @param date 日期 660 * @param date 日期
661 * @param format 661 * @param format
662 * @return 662 * @return
...@@ -675,7 +675,7 @@ public class DateUtils { ...@@ -675,7 +675,7 @@ public class DateUtils {
675 675
676 /** 676 /**
677 * 功能:获取两个日期之间的天数 677 * 功能:获取两个日期之间的天数
678 - * 678 + *
679 * @param dateFrom 起始日期 679 * @param dateFrom 起始日期
680 * @param dateEnd 结束日期 680 * @param dateEnd 结束日期
681 * @return 681 * @return
...@@ -699,7 +699,7 @@ public class DateUtils { ...@@ -699,7 +699,7 @@ public class DateUtils {
699 699
700 /** 700 /**
701 * 功能:把日期字符串格式化为日期类型 701 * 功能:把日期字符串格式化为日期类型
702 - * 702 + *
703 * @param datetext 日期字符串 703 * @param datetext 日期字符串
704 * @param format 日期格式,如果不传则使用"yyyy-MM-dd HH:mm:ss"格式 704 * @param format 日期格式,如果不传则使用"yyyy-MM-dd HH:mm:ss"格式
705 * @return 705 * @return
...@@ -730,7 +730,7 @@ public class DateUtils { ...@@ -730,7 +730,7 @@ public class DateUtils {
730 730
731 /** 731 /**
732 * 功能:取得两天之间的日期数组,包含开始日期与结束日期 732 * 功能:取得两天之间的日期数组,包含开始日期与结束日期
733 - * 733 + *
734 * @param startDateStr 开始日期 734 * @param startDateStr 开始日期
735 * @param endDateStr 结束日期 735 * @param endDateStr 结束日期
736 * @return Date[] 日期数组 736 * @return Date[] 日期数组
...@@ -748,7 +748,7 @@ public class DateUtils { ...@@ -748,7 +748,7 @@ public class DateUtils {
748 748
749 /** 749 /**
750 * 功能:获取两日期之间的天数 750 * 功能:获取两日期之间的天数
751 - * 751 + *
752 * @param dateFrom 起始日期 752 * @param dateFrom 起始日期
753 * @param dateEnd 结束日期 753 * @param dateEnd 结束日期
754 * @return 754 * @return
...@@ -776,7 +776,7 @@ public class DateUtils { ...@@ -776,7 +776,7 @@ public class DateUtils {
776 776
777 /** 777 /**
778 * 功能: 待确定 778 * 功能: 待确定
779 - * 779 + *
780 * @param startDateStr 780 * @param startDateStr
781 * @param endDateStr 781 * @param endDateStr
782 * @return 782 * @return
...@@ -804,7 +804,7 @@ public class DateUtils { ...@@ -804,7 +804,7 @@ public class DateUtils {
804 /** 804 /**
805 * 功能:获取星期几 SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and 805 * 功能:获取星期几 SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and
806 * SATURDAY 806 * SATURDAY
807 - * 807 + *
808 * @param date 808 * @param date
809 * @return 809 * @return
810 */ 810 */
...@@ -819,7 +819,7 @@ public class DateUtils { ...@@ -819,7 +819,7 @@ public class DateUtils {
819 819
820 /** 820 /**
821 * 功能:字符串转换为日期 821 * 功能:字符串转换为日期
822 - * 822 + *
823 * @param datetext yyyy/MM/dd 823 * @param datetext yyyy/MM/dd
824 * @return 824 * @return
825 */ 825 */
...@@ -834,14 +834,14 @@ public class DateUtils { ...@@ -834,14 +834,14 @@ public class DateUtils {
834 Date date = df.parse(datetext); 834 Date date = df.parse(datetext);
835 return date; 835 return date;
836 } catch (Exception e) { 836 } catch (Exception e) {
837 - e.printStackTrace(); 837 + log.error(e.getMessage(),e);
838 return null; 838 return null;
839 } 839 }
840 } 840 }
841 841
842 /** 842 /**
843 * 功能: 添加Minute 843 * 功能: 添加Minute
844 - * 844 + *
845 * @param cdate 845 * @param cdate
846 * @param amount 846 * @param amount
847 * @return 847 * @return
...@@ -852,10 +852,10 @@ public class DateUtils { ...@@ -852,10 +852,10 @@ public class DateUtils {
852 cl.add(Calendar.MINUTE, amount); 852 cl.add(Calendar.MINUTE, amount);
853 return cl.getTime(); 853 return cl.getTime();
854 } 854 }
855 - 855 +
856 /** 856 /**
857 * 功能: 添加Hour 857 * 功能: 添加Hour
858 - * 858 + *
859 * @param cdate 859 * @param cdate
860 * @param amount 860 * @param amount
861 * @return 861 * @return
...@@ -866,10 +866,10 @@ public class DateUtils { ...@@ -866,10 +866,10 @@ public class DateUtils {
866 cl.add(Calendar.HOUR_OF_DAY, amount); 866 cl.add(Calendar.HOUR_OF_DAY, amount);
867 return cl.getTime(); 867 return cl.getTime();
868 } 868 }
869 - 869 +
870 /** 870 /**
871 * 功能: 添加Date 871 * 功能: 添加Date
872 - * 872 + *
873 * @param cdate 873 * @param cdate
874 * @param amount 874 * @param amount
875 * @return 875 * @return
...@@ -883,7 +883,7 @@ public class DateUtils { ...@@ -883,7 +883,7 @@ public class DateUtils {
883 883
884 /** 884 /**
885 * 功能: 添加Year 885 * 功能: 添加Year
886 - * 886 + *
887 * @param basicDate 887 * @param basicDate
888 * @param year 888 * @param year
889 * @return 889 * @return
...@@ -895,14 +895,13 @@ public class DateUtils { ...@@ -895,14 +895,13 @@ public class DateUtils {
895 cal.add(GregorianCalendar.YEAR, year); 895 cal.add(GregorianCalendar.YEAR, year);
896 return formatDate(cal.getTime(), "yyyy-MM-dd"); 896 return formatDate(cal.getTime(), "yyyy-MM-dd");
897 } catch (Exception e) { 897 } catch (Exception e) {
898 - e.printStackTrace();
899 return ""; 898 return "";
900 } 899 }
901 } 900 }
902 901
903 /** 902 /**
904 * 添加Month 903 * 添加Month
905 - * 904 + *
906 * @param cdate 905 * @param cdate
907 * @param amount 906 * @param amount
908 * @return 907 * @return
...@@ -926,7 +925,7 @@ public class DateUtils { ...@@ -926,7 +925,7 @@ public class DateUtils {
926 925
927 /** 926 /**
928 * 功能: 日期转换为字符串 927 * 功能: 日期转换为字符串
929 - * 928 + *
930 * @param dd 929 * @param dd
931 * @return yyyy/MM/dd 930 * @return yyyy/MM/dd
932 */ 931 */
...@@ -953,7 +952,7 @@ public class DateUtils { ...@@ -953,7 +952,7 @@ public class DateUtils {
953 952
954 /** 953 /**
955 * 功能:根据某个日期,返回本月的天数 954 * 功能:根据某个日期,返回本月的天数
956 - * 955 + *
957 * @param date 本月任何一天 956 * @param date 本月任何一天
958 * @return 天数 957 * @return 天数
959 */ 958 */
...@@ -965,7 +964,7 @@ public class DateUtils { ...@@ -965,7 +964,7 @@ public class DateUtils {
965 964
966 /** 965 /**
967 * 功能:获取指定日 开始本月的之后天数 966 * 功能:获取指定日 开始本月的之后天数
968 - * 967 + *
969 * @param stringDate yyyy-MM-dd 968 * @param stringDate yyyy-MM-dd
970 * @return 天数(eg:"1,2,3,") 969 * @return 天数(eg:"1,2,3,")
971 */ 970 */
...@@ -982,7 +981,7 @@ public class DateUtils { ...@@ -982,7 +981,7 @@ public class DateUtils {
982 981
983 /** 982 /**
984 * 功能:获取指定日 开始本月的之前天数 983 * 功能:获取指定日 开始本月的之前天数
985 - * 984 + *
986 * @param stringDate yyyy-MM-dd 985 * @param stringDate yyyy-MM-dd
987 * @return 天数(eg:"1,2,3,") 986 * @return 天数(eg:"1,2,3,")
988 */ 987 */
...@@ -997,7 +996,7 @@ public class DateUtils { ...@@ -997,7 +996,7 @@ public class DateUtils {
997 996
998 /** 997 /**
999 * 功能:获取指定日 开始本月的所有天数 998 * 功能:获取指定日 开始本月的所有天数
1000 - * 999 + *
1001 * @param stringDate yyyy-MM-dd 1000 * @param stringDate yyyy-MM-dd
1002 * @return 天数(eg:"1,2,3,") 1001 * @return 天数(eg:"1,2,3,")
1003 */ 1002 */
...@@ -1015,7 +1014,7 @@ public class DateUtils { ...@@ -1015,7 +1014,7 @@ public class DateUtils {
1015 1014
1016 /** 1015 /**
1017 * 功能:三个月的指定日期 1016 * 功能:三个月的指定日期
1018 - * 1017 + *
1019 * @param stringDate 1018 * @param stringDate
1020 * @return 1019 * @return
1021 */ 1020 */
...@@ -1029,7 +1028,7 @@ public class DateUtils { ...@@ -1029,7 +1028,7 @@ public class DateUtils {
1029 1028
1030 /** 1029 /**
1031 * 功能:根据某个日期,返回本月的所有日期数组 1030 * 功能:根据某个日期,返回本月的所有日期数组
1032 - * 1031 + *
1033 * @param date 给定日期 1032 * @param date 给定日期
1034 * @return 本月的所有日期数组 1033 * @return 本月的所有日期数组
1035 */ 1034 */
...@@ -1050,7 +1049,7 @@ public class DateUtils { ...@@ -1050,7 +1049,7 @@ public class DateUtils {
1050 1049
1051 /** 1050 /**
1052 * 功能:根据某个日期,返回monthNum个月的第一天数组 1051 * 功能:根据某个日期,返回monthNum个月的第一天数组
1053 - * 1052 + *
1054 * @param date 开始日期 1053 * @param date 开始日期
1055 * @param monthNum 月份个数 1054 * @param monthNum 月份个数
1056 * @return 每个月的第一天数组 1055 * @return 每个月的第一天数组
...@@ -1069,7 +1068,7 @@ public class DateUtils { ...@@ -1069,7 +1068,7 @@ public class DateUtils {
1069 1068
1070 /** 1069 /**
1071 * 功能:根据1个日期,返回N天之内的日期数组 1070 * 功能:根据1个日期,返回N天之内的日期数组
1072 - * 1071 + *
1073 * @param startDateStr 开始日期 1072 * @param startDateStr 开始日期
1074 * @param dayTimes 天数 1073 * @param dayTimes 天数
1075 * @return 这段时间之间的日期数组 1074 * @return 这段时间之间的日期数组
...@@ -1087,7 +1086,7 @@ public class DateUtils { ...@@ -1087,7 +1086,7 @@ public class DateUtils {
1087 1086
1088 /** 1087 /**
1089 * 功能:根据1个日期,返回N天之内的yy-MM月份数组 1088 * 功能:根据1个日期,返回N天之内的yy-MM月份数组
1090 - * 1089 + *
1091 * @param startDateStr 开始日期 1090 * @param startDateStr 开始日期
1092 * @param dayTimes 天数 1091 * @param dayTimes 天数
1093 * @return 这段时间之间的日期数组 1092 * @return 这段时间之间的日期数组
...@@ -1116,7 +1115,7 @@ public class DateUtils { ...@@ -1116,7 +1115,7 @@ public class DateUtils {
1116 1115
1117 /** 1116 /**
1118 * 功能:根据1个日期,返回上N个月的第一天 1117 * 功能:根据1个日期,返回上N个月的第一天
1119 - * 1118 + *
1120 * @param date 日期 1119 * @param date 日期
1121 * @param month 上N月 1120 * @param month 上N月
1122 * @return 上N个月的第一天 1121 * @return 上N个月的第一天
...@@ -1158,7 +1157,7 @@ public class DateUtils { ...@@ -1158,7 +1157,7 @@ public class DateUtils {
1158 1157
1159 /** 1158 /**
1160 * Get the date of monday in this week 1159 * Get the date of monday in this week
1161 - * 1160 + *
1162 * @return yyyy-MM-dd 1161 * @return yyyy-MM-dd
1163 */ 1162 */
1164 public static String getMondayOfThisWeek() { 1163 public static String getMondayOfThisWeek() {
...@@ -1186,7 +1185,7 @@ public class DateUtils { ...@@ -1186,7 +1185,7 @@ public class DateUtils {
1186 1185
1187 /** 1186 /**
1188 * Get the date of sunday in this week 1187 * Get the date of sunday in this week
1189 - * 1188 + *
1190 * @return yyyy-MM-dd 1189 * @return yyyy-MM-dd
1191 */ 1190 */
1192 public static String getSundayOfThisWeek() { 1191 public static String getSundayOfThisWeek() {
...@@ -1214,7 +1213,7 @@ public class DateUtils { ...@@ -1214,7 +1213,7 @@ public class DateUtils {
1214 1213
1215 /** 1214 /**
1216 * Get the date of AfterDays 1215 * Get the date of AfterDays
1217 - * 1216 + *
1218 * @param day 1217 * @param day
1219 * @return yyyy-MM-dd 1218 * @return yyyy-MM-dd
1220 */ 1219 */
...@@ -1237,7 +1236,7 @@ public class DateUtils { ...@@ -1237,7 +1236,7 @@ public class DateUtils {
1237 1236
1238 /** 1237 /**
1239 * Get data time in user's specific format 1238 * Get data time in user's specific format
1240 - * 1239 + *
1241 * @param strFormat 1240 * @param strFormat
1242 * @return String strDtTime 1241 * @return String strDtTime
1243 */ 1242 */
...@@ -1253,7 +1252,7 @@ public class DateUtils { ...@@ -1253,7 +1252,7 @@ public class DateUtils {
1253 1252
1254 /** 1253 /**
1255 * Get data time in yyyyMMddHHmmss format 1254 * Get data time in yyyyMMddHHmmss format
1256 - * 1255 + *
1257 * @return String strDtTime 1256 * @return String strDtTime
1258 */ 1257 */
1259 public static String getDateTimeStamp() { 1258 public static String getDateTimeStamp() {
...@@ -1265,7 +1264,7 @@ public class DateUtils { ...@@ -1265,7 +1264,7 @@ public class DateUtils {
1265 1264
1266 /** 1265 /**
1267 * Get date time in yyyyMMdd format 1266 * Get date time in yyyyMMdd format
1268 - * 1267 + *
1269 * @return String strDtTime 1268 * @return String strDtTime
1270 */ 1269 */
1271 public static String getDateStamp() { 1270 public static String getDateStamp() {
...@@ -1277,7 +1276,7 @@ public class DateUtils { ...@@ -1277,7 +1276,7 @@ public class DateUtils {
1277 1276
1278 /** 1277 /**
1279 * Get date time in HHmmss format 1278 * Get date time in HHmmss format
1280 - * 1279 + *
1281 * @return String strDtTime 1280 * @return String strDtTime
1282 */ 1281 */
1283 public static String getTimeStamp() { 1282 public static String getTimeStamp() {
...@@ -1289,7 +1288,7 @@ public class DateUtils { ...@@ -1289,7 +1288,7 @@ public class DateUtils {
1289 1288
1290 /** 1289 /**
1291 * Get date time in yyyy年MM月dd日hh:mm:ss format 1290 * Get date time in yyyy年MM月dd日hh:mm:ss format
1292 - * 1291 + *
1293 * @return String sb 1292 * @return String sb
1294 */ 1293 */
1295 public static String getDateTimeCN() { 1294 public static String getDateTimeCN() {
...@@ -1320,7 +1319,7 @@ public class DateUtils { ...@@ -1320,7 +1319,7 @@ public class DateUtils {
1320 1319
1321 /** 1320 /**
1322 * Get date time in Hashmap 1321 * Get date time in Hashmap
1323 - * 1322 + *
1324 * @return a HashMap 1323 * @return a HashMap
1325 */ 1324 */
1326 public static Map<String, Integer> getDateTimeToHashMap() { 1325 public static Map<String, Integer> getDateTimeToHashMap() {
...@@ -1337,7 +1336,7 @@ public class DateUtils { ...@@ -1337,7 +1336,7 @@ public class DateUtils {
1337 1336
1338 /** 1337 /**
1339 * Format time 2005-10-08 10:03:41.0 to 2005-10-08 10:03:41 . 1338 * Format time 2005-10-08 10:03:41.0 to 2005-10-08 10:03:41 .
1340 - * 1339 + *
1341 * @param str the time string 1340 * @param str the time string
1342 * @return String 1341 * @return String
1343 */ 1342 */
...@@ -1400,7 +1399,7 @@ public class DateUtils { ...@@ -1400,7 +1399,7 @@ public class DateUtils {
1400 1399
1401 /** 1400 /**
1402 * 获取从start到end之间的日期(格式yyyyMM) 1401 * 获取从start到end之间的日期(格式yyyyMM)
1403 - * 1402 + *
1404 * @param start 1403 * @param start
1405 * @param end 1404 * @param end
1406 * @return 1405 * @return
...@@ -1415,10 +1414,10 @@ public class DateUtils { ...@@ -1415,10 +1414,10 @@ public class DateUtils {
1415 } 1414 }
1416 return months; 1415 return months;
1417 } 1416 }
1418 - 1417 +
1419 /** 1418 /**
1420 * 获取从start到end之间的日期(格式yyyyMMdd) 1419 * 获取从start到end之间的日期(格式yyyyMMdd)
1421 - * 1420 + *
1422 * @param start 1421 * @param start
1423 * @param end 1422 * @param end
1424 * @return 1423 * @return
...@@ -1433,10 +1432,10 @@ public class DateUtils { ...@@ -1433,10 +1432,10 @@ public class DateUtils {
1433 } 1432 }
1434 return days; 1433 return days;
1435 } 1434 }
1436 - 1435 +
1437 /** 1436 /**
1438 * 将字符串日期转换为Date 1437 * 将字符串日期转换为Date
1439 - * 1438 + *
1440 * @param s 1439 * @param s
1441 * @return 1440 * @return
1442 */ 1441 */
...@@ -1463,10 +1462,10 @@ public class DateUtils { ...@@ -1463,10 +1462,10 @@ public class DateUtils {
1463 } 1462 }
1464 } 1463 }
1465 } 1464 }
1466 - 1465 +
1467 /** 1466 /**
1468 - * 获取当期日期 1467 + * 获取当期日期
1469 - * 1468 + *
1470 * @return 1469 * @return
1471 */ 1470 */
1472 public static Date getCurrentDate(){ 1471 public static Date getCurrentDate(){
...@@ -1475,7 +1474,7 @@ public class DateUtils { ...@@ -1475,7 +1474,7 @@ public class DateUtils {
1475 curDate.set(Calendar.MINUTE, 0); 1474 curDate.set(Calendar.MINUTE, 0);
1476 curDate.set(Calendar.SECOND, 0); 1475 curDate.set(Calendar.SECOND, 0);
1477 curDate.set(Calendar.MILLISECOND, 0); 1476 curDate.set(Calendar.MILLISECOND, 0);
1478 - 1477 +
1479 return curDate.getTime(); 1478 return curDate.getTime();
1480 } 1479 }
1481 1480
...@@ -1495,4 +1494,4 @@ public class DateUtils { ...@@ -1495,4 +1494,4 @@ public class DateUtils {
1495 public static Date timeStampToDate(long timeStamp){ 1494 public static Date timeStampToDate(long timeStamp){
1496 return new Date(timeStamp); 1495 return new Date(timeStamp);
1497 } 1496 }
1498 -}
...\ No newline at end of file ...\ No newline at end of file
1497 +}
......
1 spring: 1 spring:
2 datasource: 2 datasource:
3 - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat 3 + url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev
4 username: sa 4 username: sa
5 password: Fedex_123 5 password: Fedex_123
6 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 6 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
...@@ -38,4 +38,4 @@ api: ...@@ -38,4 +38,4 @@ api:
38 #传输海关回执地址 38 #传输海关回执地址
39 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs 39 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
40 #推送完整报文地址 40 #推送完整报文地址
41 - complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
...\ No newline at end of file ...\ No newline at end of file
41 + complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
......
1 spring: 1 spring:
2 datasource: 2 datasource:
3 - url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev 3 + url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearUat
4 username: sa 4 username: sa
5 password: Fedex_123 5 password: Fedex_123
6 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 6 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
...@@ -35,4 +35,4 @@ api: ...@@ -35,4 +35,4 @@ api:
35 #传输海关回执地址 35 #传输海关回执地址
36 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs 36 customs-url: https://apiuat.iclrccd-fedex.com/export/outbound/customs
37 #推送完整报文地址 37 #推送完整报文地址
38 - complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
...\ No newline at end of file ...\ No newline at end of file
38 + complete-msg-url: https://apiuat.iclrccd-fedex.com/export/outbound/mawb
......
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
39 <appender-ref ref="CONSOLE"/> 39 <appender-ref ref="CONSOLE"/>
40 <appender-ref ref="FILE"/> 40 <appender-ref ref="FILE"/>
41 </root> 41 </root>
42 + <root level="error">
43 + <appender-ref ref="CONSOLE"/>
44 + <appender-ref ref="FILE"/>
45 + </root>
42 </springProfile> 46 </springProfile>
43 47
44 <springProfile name="prod"> 48 <springProfile name="prod">
...@@ -46,6 +50,10 @@ ...@@ -46,6 +50,10 @@
46 <appender-ref ref="CONSOLE"/> 50 <appender-ref ref="CONSOLE"/>
47 <appender-ref ref="FILE"/> 51 <appender-ref ref="FILE"/>
48 </root> 52 </root>
53 + <root level="error">
54 + <appender-ref ref="CONSOLE"/>
55 + <appender-ref ref="FILE"/>
56 + </root>
49 </springProfile> 57 </springProfile>
50 58
51 59
......
...@@ -24,17 +24,17 @@ public class ApiTest { ...@@ -24,17 +24,17 @@ public class ApiTest {
24 //获取HSCODE接口地址 24 //获取HSCODE接口地址
25 public static String hscodeRequest = "hscode/hscodeRequest"; 25 public static String hscodeRequest = "hscode/hscodeRequest";
26 26
27 - public static String timeStamp = "1649839249891"; 27 + public static String timeStamp = "1645153943";
28 public static String appId = "IDE"; 28 public static String appId = "IDE";
29 public static String appKey = "iClearExport"; 29 public static String appKey = "iClearExport";
30 //需要申请 30 //需要申请
31 - public static String security = "b92131f03f19a348"; 31 + public static String security = "bb348f1ba6ab7cc1";
32 32
33 public static void main(String[] args) throws Exception{ 33 public static void main(String[] args) throws Exception{
34 //D类申报的数据落地接口 34 //D类申报的数据落地接口
35 -// ApiTest.sendMawb(); 35 + ApiTest.sendMawb();
36 //C类申报的数据落地接口 36 //C类申报的数据落地接口
37 - ApiTest.sendMawbBasf(); 37 +// ApiTest.sendMawbBasf();
38 //C类EDI数据接口 38 //C类EDI数据接口
39 // ApiTest.selectDecListBasf(); 39 // ApiTest.selectDecListBasf();
40 //C类回执数据接口 40 //C类回执数据接口
...@@ -51,34 +51,34 @@ public class ApiTest { ...@@ -51,34 +51,34 @@ public class ApiTest {
51 String masbJson ="{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"202204141\",\"contrNo\":\"3006622200\",\"customMaster\":\"0208\",\"cutMode\":\"601\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"001\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0101\",\"insurCurr\":\"EUR\",\"insurMark\":\"3\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"3118962277\",\"ownerName\":\"测试核销单位\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"110\",\"tradeCode\":\"32099616DM\",\"trafMode\":\"5\",\"tradeName\":\"测试发件人\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"A74125896321456987\",\"ownerCodeScc\":\"913100007421296207\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"204\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":3365,\"declTotal\":3365,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":1,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"44079\",\"gno\":1,\"gname\":\"变频调速装置\",\"gmodel\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"gqty\":1,\"gunit\":\"007\"}]}"; 51 String masbJson ="{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"202204141\",\"contrNo\":\"3006622200\",\"customMaster\":\"0208\",\"cutMode\":\"601\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"001\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0101\",\"insurCurr\":\"EUR\",\"insurMark\":\"3\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"3118962277\",\"ownerName\":\"测试核销单位\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"110\",\"tradeCode\":\"32099616DM\",\"trafMode\":\"5\",\"tradeName\":\"测试发件人\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"A74125896321456987\",\"ownerCodeScc\":\"913100007421296207\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"204\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":3365,\"declTotal\":3365,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":1,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"44079\",\"gno\":1,\"gname\":\"变频调速装置\",\"gmodel\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"gqty\":1,\"gunit\":\"007\"}]}";
52 52
53 System.out.println(new Date(Long.valueOf(timeStamp))); 53 System.out.println(new Date(Long.valueOf(timeStamp)));
54 - String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + ApiTest.security + ApiTest.timeStamp); 54 + String token = SHA256Util.getSHA256String("DEMO1" + "iClearExportDemo1" + ApiTest.security + ApiTest.timeStamp);
55 System.out.println(token); 55 System.out.println(token);
56 56
57 - Header[] headers = HttpHeader.custom() 57 +// Header[] headers = HttpHeader.custom()
58 - .other("Content-Type", "application/json") 58 +// .other("Content-Type", "application/json")
59 - .other("Appid", ApiTest.appId) 59 +// .other("Appid", ApiTest.appId)
60 - .other("appKey", ApiTest.appKey) 60 +// .other("appKey", ApiTest.appKey)
61 - .other("TimeStamp", ApiTest.timeStamp) 61 +// .other("TimeStamp", ApiTest.timeStamp)
62 - .other("token", token) 62 +// .other("token", token)
63 - .build(); 63 +// .build();
64 - 64 +//
65 - HCB hcb = HCB.custom() 65 +// HCB hcb = HCB.custom()
66 - .timeout(20000) 66 +// .timeout(20000)
67 - .pool(100, 10) 67 +// .pool(100, 10)
68 - .sslpv(SSLs.SSLProtocolVersion.TLSv1_2) 68 +// .sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
69 - .ssl() 69 +// .ssl()
70 - .retry(3); 70 +// .retry(3);
71 - 71 +//
72 - //String url = "https://40.73.78.157:8780/customs/sendMawb"; 72 +// //String url = "https://40.73.78.157:8780/customs/sendMawb";
73 - String url = ApiTest.url + ApiTest.sendMawb; 73 +// String url = ApiTest.url + ApiTest.sendMawb;
74 - HttpConfig config = HttpConfig.custom() 74 +// HttpConfig config = HttpConfig.custom()
75 - .headers(headers) 75 +// .headers(headers)
76 - .url(url) 76 +// .url(url)
77 - .encoding("utf-8") 77 +// .encoding("utf-8")
78 - .client(hcb.build()) 78 +// .client(hcb.build())
79 -// .json(new Gson().toJson(createMawb())); 79 +//// .json(new Gson().toJson(createMawb()));
80 - .json(masbJson); 80 +// .json(masbJson);
81 - System.out.println(HttpClientUtil.post(config)); 81 +// System.out.println(HttpClientUtil.post(config));
82 } 82 }
83 83
84 /** 84 /**
......
...@@ -35,8 +35,8 @@ public class SendMawbFedex { ...@@ -35,8 +35,8 @@ public class SendMawbFedex {
35 */ 35 */
36 public static void sendMawbBasf() throws Exception{ 36 public static void sendMawbBasf() throws Exception{
37 //申报数据:consignmentCode 运单号需要修改 37 //申报数据:consignmentCode 运单号需要修改
38 - String json ="{\"consignmentCode\":\"271002102051\",\"consignmentId\":164535620,\"consType\":\"C\",\"sender\":\"巴斯夫护理化学品(上海)有限公司\",\"shipperCustomsCode\":\"3119920047\",\"shipperSCC\":\"91310000607239894U\",\"operateUnitName\":\"巴斯夫护理化学品(上海)有限公司\",\"operateUnitCode\":\"3119920047\",\"operateSCC\":\"91310000607239894U\",\"consignmentList\":[{\"consignmentDetailId\":83010676,\"skuCode\":\"2917341090\",\"skuName\":\"邻苯二甲酸二丁酯\",\"model\":\"品名:邻苯二甲酸二丁酯 |品牌类型:0|出口享惠情况:0|成分含量:100% 邻苯二甲酸二丁酯|用途:化学分析用试剂,实验用途|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":1,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":1,\"unitLegalFirst\":\"035\",\"qtyLegalSecond\":\"1.0000\",\"unitLegalSecond\":\"\",\"declaredAmount\":10,\"currency\":\"USD\",\"declaredWeight\":1}]}"; 38 + String json ="{\"consignmentCode\":\"281833508306\",\"consignmentId\":14054615,\"consType\":\"C\",\"sender\":\"鲁泰纺织股份有限公司\",\"operateUnitName\":\"鲁泰纺织股份有限公司\",\"operateUnitCode\":\"3703930116\",\"operateSCC\":\"91370302613281175K\",\"shipperCustomsCode\":\"3703930116\",\"shipperSCC\":\"91370302613281175K\",\"EANNo\":\"0000000001\",\"consignmentList\":[{\"consignmentDetailId\":15815679,\"skuCode\":\"4205001090\",\"skuName\":\"其他动物皮革制的坐具套\",\"model\":\"品名:其他动物皮革制的坐具套|品牌类型:0|出口享惠情况:0|材质[皮革或再生皮革]:皮革|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":1,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":1,\"unitLegalFirst\":\"035\",\"declaredAmount\":1,\"currency\":\"USD\",\"declaredWeight\":1}]}";
39 - 39 + System.out.println(json);
40 String token = SHA256Util.getSHA256String(SendMawbFedex.appId + SendMawbFedex.appKey + SendMawbFedex.security + SendMawbFedex.timeStamp); 40 String token = SHA256Util.getSHA256String(SendMawbFedex.appId + SendMawbFedex.appKey + SendMawbFedex.security + SendMawbFedex.timeStamp);
41 System.out.println(token); 41 System.out.println(token);
42 //消息头 42 //消息头
......