tao.mo

监听系统,并且发送邮件&修复API进来数据规格型号model字段不是 品名:| 格式

mt
2023年4月18日18:26:20
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
30 </exclusion> 30 </exclusion>
31 </exclusions> 31 </exclusions>
32 </dependency> 32 </dependency>
33 +
33 <dependency> 34 <dependency>
34 <groupId>org.springframework.boot</groupId> 35 <groupId>org.springframework.boot</groupId>
35 <artifactId>spring-boot-devtools</artifactId> 36 <artifactId>spring-boot-devtools</artifactId>
...@@ -43,6 +44,23 @@ ...@@ -43,6 +44,23 @@
43 </dependency> 44 </dependency>
44 45
45 <dependency> 46 <dependency>
47 + <groupId>org.springframework.boot</groupId>
48 + <artifactId>spring-boot-starter-mail</artifactId>
49 + <exclusions>
50 + <exclusion>
51 + <groupId>org.springframework</groupId>
52 + <artifactId>spring-context-support</artifactId>
53 + </exclusion>
54 + </exclusions>
55 + </dependency>
56 + <!-- starter-mail 依赖包升级-->
57 + <dependency>
58 + <groupId>org.springframework</groupId>
59 + <artifactId>spring-context-support</artifactId>
60 + <version>5.2.8.RELEASE</version>
61 + </dependency>
62 +
63 + <dependency>
46 <groupId>com.microsoft.sqlserver</groupId> 64 <groupId>com.microsoft.sqlserver</groupId>
47 <artifactId>mssql-jdbc</artifactId> 65 <artifactId>mssql-jdbc</artifactId>
48 <scope>runtime</scope> 66 <scope>runtime</scope>
......
...@@ -47,4 +47,12 @@ public interface HsCodeRepository extends JpaSpecificationExecutor<HsCode>, JpaR ...@@ -47,4 +47,12 @@ public interface HsCodeRepository extends JpaSpecificationExecutor<HsCode>, JpaR
47 */ 47 */
48 @Query(nativeQuery = true,value = "select * from T_CC_HS_CODE where OUT_RATE <> 0 or MONITOR_CONDITION collate Chinese_PRC_CS_AI_WS LIKE ?1") 48 @Query(nativeQuery = true,value = "select * from T_CC_HS_CODE where OUT_RATE <> 0 or MONITOR_CONDITION collate Chinese_PRC_CS_AI_WS LIKE ?1")
49 List<HsCode> findMonitorCondition(String chinsesName); 49 List<HsCode> findMonitorCondition(String chinsesName);
50 +
51 + /**
52 + * 根据hscode查询数据
53 + * @param code
54 + * @return
55 + */
56 + @Query(nativeQuery = true,value = "select top 1 * from T_CC_HS_CODE where VALIDATE=1 AND SKU_CODE =?1 order by id desc ")
57 + public HsCode findHsCodeByCode(String code);
50 } 58 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -15,13 +15,20 @@ import com.erry.iclear.dateInterface.repository.ReceiptMessageRepository; ...@@ -15,13 +15,20 @@ import com.erry.iclear.dateInterface.repository.ReceiptMessageRepository;
15 import com.erry.iclear.dateInterface.util.DateUtils; 15 import com.erry.iclear.dateInterface.util.DateUtils;
16 import com.erry.iclear.dateInterface.util.HttpUtils; 16 import com.erry.iclear.dateInterface.util.HttpUtils;
17 import com.erry.iclear.dateInterface.util.JsonToJava; 17 import com.erry.iclear.dateInterface.util.JsonToJava;
18 +import com.erry.iclear.dateInterface.util.SSLClient;
18 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
20 +import org.apache.http.HttpResponse;
21 +import org.apache.http.client.HttpClient;
22 +import org.apache.http.client.methods.HttpGet;
23 +import org.apache.http.client.methods.HttpPost;
19 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.beans.factory.annotation.Value; 25 import org.springframework.beans.factory.annotation.Value;
21 import org.springframework.stereotype.Service; 26 import org.springframework.stereotype.Service;
22 27
23 import javax.transaction.Transactional; 28 import javax.transaction.Transactional;
24 import java.math.BigDecimal; 29 import java.math.BigDecimal;
30 +import java.net.MalformedURLException;
31 +import java.net.URL;
25 import java.util.*; 32 import java.util.*;
26 33
27 /** 34 /**
...@@ -312,6 +319,24 @@ public class ApiService { ...@@ -312,6 +319,24 @@ public class ApiService {
312 } 319 }
313 320
314 /** 321 /**
322 + * 连接iclear应用指定节点,并且判断是否正常访问
323 + * @param url
324 + * @return
325 + */
326 + public boolean connectIclearNode(String url){
327 + boolean result = false;
328 + try {
329 + Integer statusCode = HttpUtils.doProxyGet(url,this.proxyUrl,this.proxyPort);
330 + if(statusCode == 200){
331 + result = true;
332 + }
333 + } catch (Exception ex) {
334 + log.error(ex.getMessage(),ex);
335 + }
336 + return result;
337 + }
338 +
339 + /**
315 * 获取headerMap 340 * 获取headerMap
316 * @param token 341 * @param token
317 * @return 342 * @return
......
...@@ -5,6 +5,7 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail; ...@@ -5,6 +5,7 @@ import com.erry.iclear.dateInterface.api.request.MawbDetail;
5 import com.erry.iclear.dateInterface.common.Constant; 5 import com.erry.iclear.dateInterface.common.Constant;
6 import com.erry.iclear.dateInterface.entity.*; 6 import com.erry.iclear.dateInterface.entity.*;
7 import com.erry.iclear.dateInterface.repository.ChmConsignmentDetailRepository; 7 import com.erry.iclear.dateInterface.repository.ChmConsignmentDetailRepository;
8 +import com.erry.iclear.dateInterface.repository.HsCodeRepository;
8 import com.erry.iclear.dateInterface.util.NumberUtils; 9 import com.erry.iclear.dateInterface.util.NumberUtils;
9 import com.erry.iclear.dateInterface.util.StringUtil; 10 import com.erry.iclear.dateInterface.util.StringUtil;
10 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
...@@ -24,17 +25,17 @@ import java.util.Objects; ...@@ -24,17 +25,17 @@ import java.util.Objects;
24 @Slf4j 25 @Slf4j
25 public class ChmConsignmentDetailService { 26 public class ChmConsignmentDetailService {
26 27
27 -
28 @Autowired 28 @Autowired
29 private ChmConsignmentDetailRepository chmConsignmentDetailRepository; 29 private ChmConsignmentDetailRepository chmConsignmentDetailRepository;
30 - 30 + @Autowired
31 + private HsCodeRepository hsCodeRepository;
31 32
32 /** 33 /**
33 * 转换运单明细 34 * 转换运单明细
34 * @param mawbDetail 35 * @param mawbDetail
35 * @return 36 * @return
36 */ 37 */
37 - public ChmConsignmentDetail convertToChmConsignmentDetail(MawbDetail mawbDetail,ChmConsignment chmConsignment){ 38 + public ChmConsignmentDetail convertToChmConsignmentDetail(MawbDetail mawbDetail,ChmConsignment chmConsignment,boolean isCheck){
38 ChmConsignmentDetail result = new ChmConsignmentDetail(); 39 ChmConsignmentDetail result = new ChmConsignmentDetail();
39 try{ 40 try{
40 result.setChmConsignment(chmConsignment); 41 result.setChmConsignment(chmConsignment);
...@@ -70,8 +71,15 @@ public class ChmConsignmentDetailService { ...@@ -70,8 +71,15 @@ public class ChmConsignmentDetailService {
70 result.setKnockdownUnitDic(knockdownUnitEntries); 71 result.setKnockdownUnitDic(knockdownUnitEntries);
71 result.setKnockdownUnit(knockdownUnitEntries.getChineseName()); 72 result.setKnockdownUnit(knockdownUnitEntries.getChineseName());
72 } 73 }
73 - //商品规格、型号 74 + //如果为数据校验,则不进行数据转换
75 + if(isCheck){
74 result.setModel(mawbDetail.getGmodel()); 76 result.setModel(mawbDetail.getGmodel());
77 + }else{
78 + //商品规格、型号
79 + String model = this.modelConvert(mawbDetail.getCodeTS(),mawbDetail.getGname(),mawbDetail.getGmodel());
80 + result.setModel(model);
81 + }
82 +
75 //商品名称 83 //商品名称
76 result.setSkuName(mawbDetail.getGname()); 84 result.setSkuName(mawbDetail.getGname());
77 //商品序号 85 //商品序号
...@@ -137,7 +145,7 @@ public class ChmConsignmentDetailService { ...@@ -137,7 +145,7 @@ public class ChmConsignmentDetailService {
137 * @param mawbDetail 145 * @param mawbDetail
138 * @return 146 * @return
139 */ 147 */
140 - public ChmConsignmentDetail convertToChmConsignmentDetailFedex(FedexMawbDetail mawbDetail, ChmConsignment chmConsignment){ 148 + public ChmConsignmentDetail convertToChmConsignmentDetailFedex(FedexMawbDetail mawbDetail, ChmConsignment chmConsignment,boolean isCheck){
141 ChmConsignmentDetail result = new ChmConsignmentDetail(); 149 ChmConsignmentDetail result = new ChmConsignmentDetail();
142 try{ 150 try{
143 result.setChmConsignment(chmConsignment); 151 result.setChmConsignment(chmConsignment);
...@@ -160,8 +168,16 @@ public class ChmConsignmentDetailService { ...@@ -160,8 +168,16 @@ public class ChmConsignmentDetailService {
160 result.setKnockdownUnitDic(knockdownUnitEntries); 168 result.setKnockdownUnitDic(knockdownUnitEntries);
161 result.setKnockdownUnit(knockdownUnitEntries.getChineseName()); 169 result.setKnockdownUnit(knockdownUnitEntries.getChineseName());
162 } 170 }
171 + //如果为校验,则不进行转换
172 + if(isCheck){
163 //商品规格、型号 173 //商品规格、型号
164 result.setModel(mawbDetail.getGmodel()); 174 result.setModel(mawbDetail.getGmodel());
175 + }else{
176 + //商品规格、型号
177 + String model = this.modelConvert(mawbDetail.getCodeTS(),mawbDetail.getGname(),mawbDetail.getGmodel());
178 + result.setModel(model);
179 + }
180 +
165 //商品名称 181 //商品名称
166 result.setSkuName(mawbDetail.getGname()); 182 result.setSkuName(mawbDetail.getGname());
167 //成交数量 183 //成交数量
...@@ -308,29 +324,50 @@ public class ChmConsignmentDetailService { ...@@ -308,29 +324,50 @@ public class ChmConsignmentDetailService {
308 return bdForMat; 324 return bdForMat;
309 } 325 }
310 326
311 - public List<ChmConsignmentDetail> findChmConsignmentDetailListByConsignmentCode(Long consignmentId){ 327 + /**
312 - List<ChmConsignmentDetail> result = new ArrayList<>(); 328 + * 将API传的model格式转换为iclear格式类型
329 + * 0|0|表面活性剂|否是|低聚-D-吡喃葡萄糖-C10-16-烷基苷 10-20%,乙氧基化-C16-18、C18-不饱和醇 10-20%,甘油 30-40%,水 10-20%|无品牌|无型号||||
330 + * 转换成
331 + * 品名:鸦片|品牌类型:0|出口享惠情况:0|制作或保存方法[液汁、浸膏、粉末]:嗷嗷|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|
332 + * @param skuCode
333 + * @param skuName
334 + * @param model
335 + * @return
336 + */
337 + private String modelConvert(String skuCode,String skuName,String model){
338 + String resultModel = model;
313 try{ 339 try{
314 - result= chmConsignmentDetailRepository.findChmConsignmentDetailByConsignmentCode(consignmentId); 340 + HsCode hsCode = hsCodeRepository.findHsCodeByCode(skuCode);
315 - }catch (Exception e){ 341 + if (hsCode != null) {
316 - log.error("findChmConsignmentDetailListByConsignmentCode() error:"+e.getMessage()); 342 + String[] modelSplit = model.split("\\|");
343 + String[] modelSplits = new String[20];
344 + Class<? extends HsCode> hsCodeClass = hsCode.getClass();
345 + for (int j = 0; j < 20; j++) {
346 + int element = j + 1;
347 + String invoke = (String) hsCodeClass.getMethod("getElement" + element).invoke(hsCode);
348 + if (j == 0) {
349 + modelSplits[j] = invoke + ":" + skuName;
350 + continue;
317 } 351 }
318 - return result; 352 + if (!StringUtil.isEmptyWithTrim(invoke)) {
353 + if (modelSplit.length <= j - 1) {
354 + modelSplits[j] = invoke + ":";
355 + } else {
356 + modelSplits[j] = invoke + ":" + modelSplit[j - 1];
319 } 357 }
320 -
321 - public void saveDetailList(List<ChmConsignmentDetail> chmConsignmentDetailList){
322 - chmConsignmentDetailRepository.saveAll(chmConsignmentDetailList);
323 } 358 }
324 -
325 - public void saveChmConsignmentDetail(ChmConsignmentDetail consignmentDetail){
326 - chmConsignmentDetailRepository.save(consignmentDetail);
327 } 359 }
328 - 360 + StringBuffer modelSb = new StringBuffer();
329 - public void deleteChmConsignmentDetail(Long id){ 361 + for (String split : modelSplits) {
330 - chmConsignmentDetailRepository.deleteById(id); 362 + modelSb.append(split).append("|");
331 } 363 }
332 - 364 + if(modelSb.length() > 0){
333 - public void deleteChmConsignmentDetailBatch(List<Long> idList){ 365 + resultModel = modelSb.toString();
334 - chmConsignmentDetailRepository.deleteChmConsignmentDetailByChnConIdList(idList); 366 + }
367 + }
368 + }catch(Exception ex){
369 + log.error("modelConvert() error:"+ex.getMessage());
370 + }
371 + return resultModel;
335 } 372 }
336 } 373 }
......
...@@ -505,7 +505,7 @@ public class ChmConsignmentService { ...@@ -505,7 +505,7 @@ public class ChmConsignmentService {
505 } 505 }
506 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); 506 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>();
507 mawb.getMawbDetailList().forEach(detail ->{ 507 mawb.getMawbDetailList().forEach(detail ->{
508 - chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail, chmConsignment)); 508 + chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail, chmConsignment,Boolean.FALSE));
509 }); 509 });
510 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); 510 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
511 511
...@@ -592,7 +592,7 @@ public class ChmConsignmentService { ...@@ -592,7 +592,7 @@ public class ChmConsignmentService {
592 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); 592 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>();
593 593
594 fedexMawb.getMawbDetailList().forEach(detail ->{ 594 fedexMawb.getMawbDetailList().forEach(detail ->{
595 - chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetailFedex(detail, chmConsignment)); 595 + chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetailFedex(detail, chmConsignment,Boolean.FALSE));
596 }); 596 });
597 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); 597 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
598 598
......
1 +package com.erry.iclear.dateInterface.service;
2 +
3 +import org.springframework.beans.factory.annotation.Value;
4 +import org.springframework.mail.javamail.JavaMailSenderImpl;
5 +import org.springframework.mail.javamail.MimeMessageHelper;
6 +import org.springframework.stereotype.Service;
7 +import javax.mail.internet.*;
8 +import java.util.*;
9 +
10 +/**
11 + * Created on 2017-9-22.
12 + */
13 +@Service("emailSenderService")
14 +public class EmailSenderService {
15 +
16 + @Value("${smtp_server}")
17 + String smtpServer;
18 + @Value("${smtp_account}")
19 + String smtpAccount;
20 + @Value("${smtp_account_name}")
21 + String smtpAccountName;
22 + @Value("${smtp_port}")
23 + Integer smtpPort;
24 +
25 + @Value("${send_email_msg}")
26 + String sendEmailMsg;
27 + @Value("${send_email_cc}")
28 + String sendEmailCc;
29 +
30 + /**
31 + * 邮件发送
32 + *
33 + * @param bcc 暗送地址
34 + * @param subject 邮件主题
35 + * @param body 邮件正文
36 + * @throws Exception
37 + */
38 + public void sendMail(String bcc, String subject, String body) throws Exception {
39 + if (this.sendEmailMsg == null || this.sendEmailMsg.length() == 0) {
40 + return;
41 + }
42 + try {
43 + JavaMailSenderImpl senderImpl = new JavaMailSenderImpl();
44 + senderImpl.setHost(this.smtpServer);
45 + senderImpl.setUsername(null);
46 + senderImpl.setPassword(null);
47 +// senderImpl.setUsername(smtpAccount);
48 +// senderImpl.setPassword(smtpPwd);
49 + senderImpl.setPort(this.smtpPort);
50 + Properties prop = new Properties();
51 +// prop.put("mail.smtp.auth", smtpAuthType);
52 + prop.put("mail.smtp.timeout", "60000");
53 + senderImpl.setJavaMailProperties(prop);
54 + MimeMessage mailMessage = senderImpl.createMimeMessage();
55 + MimeMessageHelper messageHelper = new MimeMessageHelper(mailMessage, true, "UTF-8");
56 + InternetAddress[] internetAddressTo = InternetAddress.parse(this.sendEmailMsg);
57 + messageHelper.setTo(internetAddressTo);
58 + if (this.sendEmailCc != null && this.sendEmailCc.length() > 0) {
59 + InternetAddress[] internetAddressCc = InternetAddress.parse(this.sendEmailCc);
60 + messageHelper.setCc(internetAddressCc);
61 + }
62 + if (bcc != null && bcc.length() > 0) {
63 + InternetAddress[] internetAddressBcc = InternetAddress.parse(bcc);
64 + messageHelper.setBcc(internetAddressBcc);
65 + }
66 + messageHelper.setFrom(this.smtpAccount, this.smtpAccountName);
67 + messageHelper.setSubject(subject);
68 + messageHelper.setText(body, true);
69 + senderImpl.send(mailMessage);
70 + } catch (Throwable e) {
71 + e.printStackTrace();
72 + throw e;
73 + }
74 + }
75 +}
...@@ -127,7 +127,7 @@ public class FedexService { ...@@ -127,7 +127,7 @@ public class FedexService {
127 } 127 }
128 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); 128 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>();
129 fedexMawb.getMawbDetailList().forEach(detail ->{ 129 fedexMawb.getMawbDetailList().forEach(detail ->{
130 - chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetailFedex(detail,chmConsignment)); 130 + chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetailFedex(detail,chmConsignment,Boolean.TRUE));
131 }); 131 });
132 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); 132 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
133 133
......
...@@ -189,7 +189,7 @@ public class MawbService { ...@@ -189,7 +189,7 @@ public class MawbService {
189 } 189 }
190 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); 190 List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>();
191 mawb.getMawbDetailList().forEach(detail ->{ 191 mawb.getMawbDetailList().forEach(detail ->{
192 - chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment)); 192 + chmConsignmentDetailList.add(consignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment,Boolean.TRUE));
193 }); 193 });
194 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); 194 chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
195 //调用IClear接口进行运单数据校验 195 //调用IClear接口进行运单数据校验
......
...@@ -3,8 +3,10 @@ package com.erry.iclear.dateInterface.task; ...@@ -3,8 +3,10 @@ package com.erry.iclear.dateInterface.task;
3 import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; 3 import com.erry.iclear.dateInterface.enums.ErrorCodeEnum;
4 import com.erry.iclear.dateInterface.api.response.TokenResult; 4 import com.erry.iclear.dateInterface.api.response.TokenResult;
5 import com.erry.iclear.dateInterface.service.ApiService; 5 import com.erry.iclear.dateInterface.service.ApiService;
6 +import com.erry.iclear.dateInterface.service.EmailSenderService;
6 import lombok.extern.slf4j.Slf4j; 7 import lombok.extern.slf4j.Slf4j;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
9 +import org.springframework.beans.factory.annotation.Value;
8 import org.springframework.scheduling.annotation.Scheduled; 10 import org.springframework.scheduling.annotation.Scheduled;
9 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
10 12
...@@ -16,7 +18,13 @@ import org.springframework.stereotype.Component; ...@@ -16,7 +18,13 @@ import org.springframework.stereotype.Component;
16 public class IClearApiTask { 18 public class IClearApiTask {
17 @Autowired 19 @Autowired
18 ApiService apiService; 20 ApiService apiService;
21 + @Autowired
22 + EmailSenderService emailSenderService;
19 String token; 23 String token;
24 + @Value("${iclear.address.url42}")
25 + String iclearAddressUrl42;
26 + @Value("${iclear.address.url43}")
27 + String iclearAddressUrl43;
20 28
21 /** 29 /**
22 * TODO 定时任务:每分钟推送: 报关数据、回执 30 * TODO 定时任务:每分钟推送: 报关数据、回执
...@@ -51,6 +59,28 @@ public class IClearApiTask { ...@@ -51,6 +59,28 @@ public class IClearApiTask {
51 log.error("pushMawbTask() error:" +e.getMessage()); 59 log.error("pushMawbTask() error:" +e.getMessage());
52 } 60 }
53 } 61 }
62 +
63 + /**
64 + * TODO 定时任务:每5分钟监听: iclear应用节点是否正常
65 + */
66 + @Scheduled(cron = "${task.monitorIclearNodes}")
67 + public void monitorIclearNodesTask(){
68 + try{
69 + log.info("monitorIclearNodesTask start>>>>>>>>>>>>");
70 + boolean requestResult42 = apiService.connectIclearNode(this.iclearAddressUrl42);
71 + if(requestResult42){
72 + emailSenderService.sendMail(null,"系统访问异常提示","42机器无法正常访问");
73 + }
74 + boolean requestResult43 = apiService.connectIclearNode(this.iclearAddressUrl43);
75 + if(requestResult43){
76 + emailSenderService.sendMail(null,"系统访问异常提示","43机器无法正常访问");
77 + }
78 + log.info("monitorIclearNodesTask end>>>>>>>>>>>>");
79 + }catch (Exception e){
80 + log.error("monitorIclearNodesTask() error:" +e.getMessage());
81 + }
82 + }
83 +
54 /** 84 /**
55 * 每次请求获取最新token 85 * 每次请求获取最新token
56 * @throws Exception 86 * @throws Exception
......
...@@ -12,6 +12,7 @@ import org.apache.http.HttpResponse; ...@@ -12,6 +12,7 @@ import org.apache.http.HttpResponse;
12 import org.apache.http.NameValuePair; 12 import org.apache.http.NameValuePair;
13 import org.apache.http.client.HttpClient; 13 import org.apache.http.client.HttpClient;
14 import org.apache.http.client.entity.UrlEncodedFormEntity; 14 import org.apache.http.client.entity.UrlEncodedFormEntity;
15 +import org.apache.http.client.methods.HttpGet;
15 import org.apache.http.client.methods.HttpPost; 16 import org.apache.http.client.methods.HttpPost;
16 import org.apache.http.conn.params.ConnRoutePNames; 17 import org.apache.http.conn.params.ConnRoutePNames;
17 import org.apache.http.entity.StringEntity; 18 import org.apache.http.entity.StringEntity;
...@@ -110,6 +111,31 @@ public class HttpUtils { ...@@ -110,6 +111,31 @@ public class HttpUtils {
110 } 111 }
111 return result; 112 return result;
112 } 113 }
114 +
115 + /**
116 + * 代理模式get请求,返回请求状态
117 + * @param url
118 + * @param proxyUrl
119 + * @param port
120 + * @return
121 + * @throws Exception
122 + */
123 + public static Integer doProxyGet(String url,String proxyUrl,Integer port) throws Exception {
124 + HttpGet httpGet = null;
125 + Integer statusCode = 0;
126 + HttpClient httpClient = SSLClient.getProxyHttpsClient(proxyUrl,port);
127 + try{
128 + httpGet = new HttpGet(url);
129 + HttpResponse response = httpClient.execute(httpGet);
130 + if(response != null){
131 + statusCode = response.getStatusLine().getStatusCode();
132 + }
133 + } finally {
134 + httpClient.getConnectionManager().shutdown(); //关闭连接
135 + }
136 + return statusCode;
137 + }
138 +
113 /** 139 /**
114 * post请求 140 * post请求
115 * @param url 141 * @param url
......
...@@ -15,8 +15,10 @@ task.pushMawbTask=0 0/1 * * * ? ...@@ -15,8 +15,10 @@ task.pushMawbTask=0 0/1 * * * ?
15 task.pushErrorReturnDate=0 0/3 * * * ? 15 task.pushErrorReturnDate=0 0/3 * * * ?
16 #推送失败的申报数据 16 #推送失败的申报数据
17 task.pushErrorDeclareDate=0 0/3 * * * ? 17 task.pushErrorDeclareDate=0 0/3 * * * ?
18 +#推送失败的回执数据
19 +task.monitorIclearNodes=0 0/1 * * * ?
18 20
19 -api.base-address=https://declarationuat.fedex.com.cn/Exp 21 +api.base-address=http://localhost:8080/Exp
20 #获取token账号 22 #获取token账号
21 api.token-info.username=iclear_external_ctm 23 api.token-info.username=iclear_external_ctm
22 #获取token密码 24 #获取token密码
...@@ -35,6 +37,9 @@ api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refres ...@@ -35,6 +37,9 @@ api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refres
35 api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs 37 api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs
36 #推送完整报文地址 38 #推送完整报文地址
37 api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb 39 api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb
40 +#iclear应用节点是否能够正常访问
41 +iclear.address.url42=https://www.fedex.com/
42 +iclear.address.url43=https://www.baidu.com/
38 #代理地址(刷新token、传输海关回执地址、推送完整报文地址) 43 #代理地址(刷新token、传输海关回执地址、推送完整报文地址)
39 api.address.proxy-url=cn2-proxy.apac.fedex.com 44 api.address.proxy-url=cn2-proxy.apac.fedex.com
40 api.address.proxy-port=3128 45 api.address.proxy-port=3128
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -8,6 +8,8 @@ task.pushMawbTask=0 0/1 * * * ? ...@@ -8,6 +8,8 @@ task.pushMawbTask=0 0/1 * * * ?
8 task.pushErrorReturnDate=0 0/30 * * * ? 8 task.pushErrorReturnDate=0 0/30 * * * ?
9 #推送失败的申报数据 9 #推送失败的申报数据
10 task.pushErrorDeclareDate=0 0/30 * * * ? 10 task.pushErrorDeclareDate=0 0/30 * * * ?
11 +#推送失败的回执数据
12 +task.monitorIclearNodes=0 0/5 * * * ?
11 13
12 api.base-address=https://declaration.fedex.com.cn/Exp 14 api.base-address=https://declaration.fedex.com.cn/Exp
13 #获取token账号 15 #获取token账号
...@@ -28,6 +30,9 @@ api.address.refresh-token-url=https://apictm.iclrccd-fedex.com/admin/user/token/ ...@@ -28,6 +30,9 @@ api.address.refresh-token-url=https://apictm.iclrccd-fedex.com/admin/user/token/
28 api.address.customs-url=https://apictm.iclrccd-fedex.com/export/outbound/customs 30 api.address.customs-url=https://apictm.iclrccd-fedex.com/export/outbound/customs
29 #推送完整报文地址 31 #推送完整报文地址
30 api.address.complete-msg-url=https://apictm.iclrccd-fedex.com/export/outbound/mawb 32 api.address.complete-msg-url=https://apictm.iclrccd-fedex.com/export/outbound/mawb
33 +#iclear应用节点是否能够正常访问
34 +iclear.address.url42=https://pjec0003.cndczmd.apac.fedex.com:9002/Exp/
35 +iclear.address.url43=https://pjec0004.cndczmd.apac.fedex.com:9002/Exp/
31 #代理地址(刷新token、传输海关回执地址、推送完整报文地址) 36 #代理地址(刷新token、传输海关回执地址、推送完整报文地址)
32 api.address.proxy-url=cn2-proxy.apac.fedex.com 37 api.address.proxy-url=cn2-proxy.apac.fedex.com
33 api.address.proxy-port=3128 38 api.address.proxy-port=3128
......
...@@ -8,6 +8,8 @@ task.pushMawbTask=0 0/1 * * * ? ...@@ -8,6 +8,8 @@ task.pushMawbTask=0 0/1 * * * ?
8 task.pushErrorReturnDate=0 0/3 * * * ? 8 task.pushErrorReturnDate=0 0/3 * * * ?
9 #推送失败的申报数据 9 #推送失败的申报数据
10 task.pushErrorDeclareDate=0 0/3 * * * ? 10 task.pushErrorDeclareDate=0 0/3 * * * ?
11 +#推送失败的回执数据
12 +task.monitorIclearNodes=0 0/5 * * * ?
11 13
12 api.base-address=https://declarationuat.fedex.com.cn/Exp 14 api.base-address=https://declarationuat.fedex.com.cn/Exp
13 #获取token账号 15 #获取token账号
...@@ -28,6 +30,9 @@ api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refres ...@@ -28,6 +30,9 @@ api.address.refresh-token-url=https://apiuat.iclrccd-fedex.com/user/token/refres
28 api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs 30 api.address.customs-url=https://apiuat.iclrccd-fedex.com/export/outbound/customs
29 #推送完整报文地址 31 #推送完整报文地址
30 api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb 32 api.address.complete-msg-url=https://apiuat.iclrccd-fedex.com/export/outbound/mawb
33 +#iclear应用节点是否能够正常访问
34 +iclear.address.url42=https://pjec0003.cndczmd.apac.fedex.com:9002/Exp/
35 +iclear.address.url43=https://pjec0004.cndczmd.apac.fedex.com:9002/Exp/
31 #代理地址(刷新token、传输海关回执地址、推送完整报文地址) 36 #代理地址(刷新token、传输海关回执地址、推送完整报文地址)
32 api.address.proxy-url=cn2-proxy.apac.fedex.com 37 api.address.proxy-url=cn2-proxy.apac.fedex.com
33 api.address.proxy-port=3128 38 api.address.proxy-port=3128
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -12,3 +12,23 @@ spring.jpa.show-sql=true ...@@ -12,3 +12,23 @@ spring.jpa.show-sql=true
12 spring.jpa.hibernate.ddl-auto=none 12 spring.jpa.hibernate.ddl-auto=none
13 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 13 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
14 spring.jpa.properties.event.merge.entity_copy_observer=allow 14 spring.jpa.properties.event.merge.entity_copy_observer=allow
15 +
16 +####email properties
17 +#SMTP Server IP or Domain name
18 +smtp_server=mapper.gslb.fedex.com
19 +smtp_port=25
20 +#Account to send email
21 +smtp_account=donotreply@fedex.com
22 +#Password
23 +smtp_pwd=
24 +#Account Name to send emailis_customer
25 +smtp_account_name=й
26 +#bcc
27 +email_bcc=donotreply@fedex.com
28 +#email link
29 +#email_link=http://localhost:8080/Exp
30 +#user email
31 +send_email=hyssmt@vip.qq.com,li.chang@erry.com
32 +#return_message job email
33 +send_email_msg=hyssmt@vip.qq.com,li.chang@erry.com,yi.zhou@erry.com
34 +send_email_cc=ICE-IClear-Support@erry.com
......