Showing
37 changed files
with
1599 additions
and
62 deletions
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | + | ||
| 4 | +CREATE TABLE T_ICLEAR_API_APPINFO( | ||
| 5 | + ID INT primary key | ||
| 6 | + ,APPID VARCHAR(40) | ||
| 7 | + ,APPKEY VARCHAR(40) | ||
| 8 | + ,SECURITY VARCHAR(16) | ||
| 9 | + ,CREATE_TIME DATE | ||
| 10 | + ,IS_ENABLE VARCHAR(1) | ||
| 11 | +) | ||
| 12 | +INSERT INTO T_ICLEAR_API_APPINFO VALUES(1,'CTM','iClearExport','b92131f03f19a348',GETDATE(),'1'); | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 3 | CREATE TABLE T_ICLEAR_API_LOG( | 30 | CREATE TABLE T_ICLEAR_API_LOG( |
| 4 | MSGID int identity(1,1) primary key --PK | 31 | MSGID int identity(1,1) primary key --PK |
| 5 | ,MSG_TYPE VARCHAR(20) --类型 | 32 | ,MSG_TYPE VARCHAR(20) --类型 | ... | ... |
No preview for this file type
| ... | @@ -3,24 +3,22 @@ package com.erry.iclear.dateInterface.api; | ... | @@ -3,24 +3,22 @@ package com.erry.iclear.dateInterface.api; |
| 3 | import com.erry.iclear.dateInterface.api.request.Mawb; | 3 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 5 | import com.erry.iclear.dateInterface.common.Constant; | 5 | import com.erry.iclear.dateInterface.common.Constant; |
| 6 | +import com.erry.iclear.dateInterface.entity.ChmConsignment; | ||
| 7 | +import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | ||
| 6 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 8 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| 7 | -import com.erry.iclear.dateInterface.service.IClearApiLogService; | 9 | +import com.erry.iclear.dateInterface.service.*; |
| 8 | -import com.erry.iclear.dateInterface.service.MawbDetailService; | ||
| 9 | -import com.erry.iclear.dateInterface.service.MawbService; | ||
| 10 | import com.erry.iclear.dateInterface.util.MD5Util; | 10 | import com.erry.iclear.dateInterface.util.MD5Util; |
| 11 | +import com.erry.iclear.dateInterface.util.SHA256Util; | ||
| 11 | import com.google.gson.Gson; | 12 | import com.google.gson.Gson; |
| 12 | -import io.swagger.annotations.Api; | ||
| 13 | import io.swagger.annotations.ApiOperation; | 13 | import io.swagger.annotations.ApiOperation; |
| 14 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | import org.apache.commons.lang3.StringUtils; | 15 | import org.apache.commons.lang3.StringUtils; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | -import org.springframework.http.HttpRequest; | 17 | +import org.springframework.util.StopWatch; |
| 18 | -import org.springframework.util.Assert; | ||
| 19 | import org.springframework.web.bind.annotation.*; | 18 | import org.springframework.web.bind.annotation.*; |
| 20 | 19 | ||
| 21 | import javax.servlet.http.HttpServletRequest; | 20 | import javax.servlet.http.HttpServletRequest; |
| 22 | -import java.util.HashMap; | 21 | +import java.util.*; |
| 23 | -import java.util.Objects; | ||
| 24 | 22 | ||
| 25 | /** | 23 | /** |
| 26 | * @author Administrator | 24 | * @author Administrator |
| ... | @@ -41,64 +39,113 @@ public class CustomsDataInterface { | ... | @@ -41,64 +39,113 @@ public class CustomsDataInterface { |
| 41 | @Autowired | 39 | @Autowired |
| 42 | private IClearApiLogService iClearApiLogService; | 40 | private IClearApiLogService iClearApiLogService; |
| 43 | 41 | ||
| 42 | + @Autowired | ||
| 43 | + private ChmConsignmentService chmConsignmentService; | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + private ChmConsignmentDetailService chmConsignmentDetailService; | ||
| 47 | + | ||
| 44 | 48 | ||
| 45 | @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") | 49 | @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") |
| 46 | @PostMapping("/sendMawb") | 50 | @PostMapping("/sendMawb") |
| 47 | @ResponseBody | 51 | @ResponseBody |
| 48 | public ResultRS sendMawb(HttpServletRequest request | 52 | public ResultRS sendMawb(HttpServletRequest request |
| 49 | , @RequestBody Mawb mawb) { | 53 | , @RequestBody Mawb mawb) { |
| 50 | - log.info("接收到主单数据:" + gson.toJson(mawb)); | 54 | + log.info("接收到请求数据billNo:"+mawb.getBillNo()+" data:" + gson.toJson(mawb)); |
| 51 | ResultRS result = new ResultRS(); | 55 | ResultRS result = new ResultRS(); |
| 52 | result.setSuccess(Boolean.FALSE); | 56 | result.setSuccess(Boolean.FALSE); |
| 53 | 57 | ||
| 54 | if(Objects.equals(mawb,null)){ | 58 | if(Objects.equals(mawb,null)){ |
| 55 | result.setCode("-7"); | 59 | result.setCode("-7"); |
| 56 | - result.setMsg("主单信息不能为空"); | 60 | + result.setMsg("请求信息不能为空"); |
| 57 | return result; | 61 | return result; |
| 58 | } | 62 | } |
| 59 | //0、保存请求信息,保存到iClear的 SQLServer | 63 | //0、保存请求信息,保存到iClear的 SQLServer |
| 64 | + StopWatch sw = new StopWatch("receice mawb"); | ||
| 65 | + sw.start("save log"); | ||
| 66 | + | ||
| 60 | String appId=(String) request.getHeader("Appid"); | 67 | String appId=(String) request.getHeader("Appid"); |
| 61 | String appkey=(String) request.getHeader("Appkey"); | 68 | String appkey=(String) request.getHeader("Appkey"); |
| 62 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appkey)); | 69 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appkey)); |
| 63 | 70 | ||
| 71 | + | ||
| 64 | if(!Objects.equals(saveIClearApiLogResult,null)){ | 72 | if(!Objects.equals(saveIClearApiLogResult,null)){ |
| 65 | log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); | 73 | log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); |
| 66 | mawb.setMsgId(saveIClearApiLogResult.getMsgId()); | 74 | mawb.setMsgId(saveIClearApiLogResult.getMsgId()); |
| 67 | -// mawb.getMawbDetailList().forEach(d->{ | 75 | + mawb.getMawbDetailList().forEach(d->{ |
| 68 | -// d.setMsgId(saveIClearApiLogResult.getMsgId()); | 76 | + d.setMsgId(saveIClearApiLogResult.getMsgId()); |
| 69 | -// }); | 77 | + }); |
| 70 | Mawb saveMawbResult= mawbService.saveMawb(mawb); | 78 | Mawb saveMawbResult= mawbService.saveMawb(mawb); |
| 71 | if(!Objects.equals(saveMawbResult,null)){ | 79 | if(!Objects.equals(saveMawbResult,null)){ |
| 72 | - log.info("请求主单数据保存成功,msgId:"+saveMawbResult.getMsgId()); | 80 | + log.info("请求数据主单号"+mawb.getBillNo()+"保存成功,msgId:"+saveMawbResult.getMsgId()); |
| 73 | }else{ | 81 | }else{ |
| 74 | - log.info("请求主单数据保存失败,msgId:"+saveMawbResult.getMsgId()); | 82 | + log.info("请求数据主单号"+mawb.getBillNo()+"保存失败,msgId:"+saveMawbResult.getMsgId()); |
| 75 | } | 83 | } |
| 76 | }else{ | 84 | }else{ |
| 77 | - log.info("请求保存失败,msgId:"+saveIClearApiLogResult.getMsgId()); | 85 | + log.info("请求日志保存失败,BillNo:"+mawb.getBillNo()); |
| 78 | } | 86 | } |
| 87 | + sw.stop(); | ||
| 79 | 88 | ||
| 80 | 89 | ||
| 81 | 90 | ||
| 82 | - | 91 | + //1、校验用户名密码 |
| 83 | - //1、TODO 校验用户名密码 | 92 | + sw.start("checkAppSecret"); |
| 84 | result=this.checkAppSecret(request, result); | 93 | result=this.checkAppSecret(request, result); |
| 85 | - | 94 | + sw.stop(); |
| 86 | 95 | ||
| 87 | 96 | ||
| 88 | //2、TODO 校验主单 | 97 | //2、TODO 校验主单 |
| 98 | + sw.start("checkMawb"); | ||
| 89 | if(result.getSuccess()==true){ | 99 | if(result.getSuccess()==true){ |
| 90 | - result.setSuccess(mawbService.checkMawb(mawb)); | 100 | + //result.setSuccess(mawbService.checkMawb(mawb)); |
| 91 | } | 101 | } |
| 102 | + sw.stop(); | ||
| 103 | + | ||
| 92 | //3、TODO 校验子单 | 104 | //3、TODO 校验子单 |
| 105 | + sw.start("checkMawbDetail"); | ||
| 93 | if(result.getSuccess()==true){ | 106 | if(result.getSuccess()==true){ |
| 94 | 107 | ||
| 95 | } | 108 | } |
| 96 | - //4、TODO 保存主单 | 109 | + sw.stop(); |
| 110 | + | ||
| 111 | + | ||
| 112 | + //4、保存运单到iclear中 | ||
| 113 | + sw.start("saveToIClear"); | ||
| 97 | if(result.getSuccess()==true){ | 114 | if(result.getSuccess()==true){ |
| 115 | + ChmConsignment chmConsignment=chmConsignmentService.convertToChmConsignment(mawb); | ||
| 116 | + List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | ||
| 117 | + mawb.getMawbDetailList().forEach(detail ->{ | ||
| 118 | + chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail)); | ||
| 119 | + }); | ||
| 120 | + chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); | ||
| 121 | + | ||
| 122 | + ChmConsignment chmConsignmentSaveResult = chmConsignmentService.saveChmConsignment(chmConsignment); | ||
| 98 | 123 | ||
| 124 | + if(!Objects.equals(chmConsignmentSaveResult,null)){ | ||
| 125 | + log.info("主单"+mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); | ||
| 126 | + }else{ | ||
| 127 | + log.info("主单"+mawb.getBillNo()+" 保存失败"); | ||
| 99 | } | 128 | } |
| 129 | + } | ||
| 130 | + sw.stop(); | ||
| 100 | 131 | ||
| 101 | 132 | ||
| 133 | + //5、更新日志 | ||
| 134 | + sw.start("updateIClearApiLog"); | ||
| 135 | + if(!Objects.equals(saveIClearApiLogResult,null)){ | ||
| 136 | + saveIClearApiLogResult.setReceiveResult(result.getSuccess().toString()); | ||
| 137 | + saveIClearApiLogResult.setResponseTime(new Date()); | ||
| 138 | + saveIClearApiLogResult.setSpendTime(sw.getTotalTimeMillis()); | ||
| 139 | + | ||
| 140 | + iClearApiLogService.updateIClearApiLog(saveIClearApiLogResult); | ||
| 141 | + } | ||
| 142 | + log.info("请求数据billNo:"+mawb.getBillNo() +" 接收结束"); | ||
| 143 | + sw.stop(); | ||
| 144 | + log.info(sw.prettyPrint()); | ||
| 145 | + | ||
| 146 | + //6、return result | ||
| 147 | + result.setSuccess(Boolean.TRUE); | ||
| 148 | + result.setCode("0"); | ||
| 102 | return result; | 149 | return result; |
| 103 | } | 150 | } |
| 104 | 151 | ||
| ... | @@ -146,7 +193,7 @@ public class CustomsDataInterface { | ... | @@ -146,7 +193,7 @@ public class CustomsDataInterface { |
| 146 | } | 193 | } |
| 147 | 194 | ||
| 148 | 195 | ||
| 149 | - HashMap<String,String> secretMap = Constant.appIdSecurity.get(appId); | 196 | + HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId); |
| 150 | if(secretMap==null){ | 197 | if(secretMap==null){ |
| 151 | result.setCode("-100"); | 198 | result.setCode("-100"); |
| 152 | result.setMsg("系统异常,该appId没有注册"); | 199 | result.setMsg("系统异常,该appId没有注册"); |
| ... | @@ -160,8 +207,9 @@ public class CustomsDataInterface { | ... | @@ -160,8 +207,9 @@ public class CustomsDataInterface { |
| 160 | return result; | 207 | return result; |
| 161 | } | 208 | } |
| 162 | 209 | ||
| 163 | - String md5Str= MD5Util.md5(appId+appkey+secretInSys+timeStamp); | 210 | + |
| 164 | - if(!token.equals(md5Str)){ | 211 | + String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp); |
| 212 | + if(!token.equals(sha256Str)){ | ||
| 165 | result.setCode("-4"); | 213 | result.setCode("-4"); |
| 166 | result.setMsg("Token验证失败"); | 214 | result.setMsg("Token验证失败"); |
| 167 | return result; | 215 | return result; | ... | ... |
| ... | @@ -23,13 +23,14 @@ import java.util.List; | ... | @@ -23,13 +23,14 @@ import java.util.List; |
| 23 | @Data | 23 | @Data |
| 24 | public class Mawb implements Serializable { | 24 | public class Mawb implements Serializable { |
| 25 | 25 | ||
| 26 | + private static final long serialVersionUID = -7092144710653831972L; | ||
| 26 | @Id | 27 | @Id |
| 27 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 28 | @Column(name = "Id", insertable = false, nullable = false) | 29 | @Column(name = "Id", insertable = false, nullable = false) |
| 29 | - private Integer id; | 30 | + private Long id; |
| 30 | 31 | ||
| 31 | @Column(name = "MSGID") | 32 | @Column(name = "MSGID") |
| 32 | - private Integer msgId; | 33 | + private Long msgId; |
| 33 | 34 | ||
| 34 | @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") | 35 | @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") |
| 35 | @Column(name = "IEFLAG") | 36 | @Column(name = "IEFLAG") | ... | ... |
| ... | @@ -18,16 +18,17 @@ import java.math.BigDecimal; | ... | @@ -18,16 +18,17 @@ import java.math.BigDecimal; |
| 18 | @Data | 18 | @Data |
| 19 | public class MawbDetail implements Serializable { | 19 | public class MawbDetail implements Serializable { |
| 20 | 20 | ||
| 21 | + private static final long serialVersionUID = -6706944312498119267L; | ||
| 21 | @Id | 22 | @Id |
| 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 23 | @Column(name = "Id", insertable = false, nullable = false) | 24 | @Column(name = "Id", insertable = false, nullable = false) |
| 24 | - private Integer id; | 25 | + private Long id; |
| 25 | 26 | ||
| 26 | @Column(name = "MSGID") | 27 | @Column(name = "MSGID") |
| 27 | - private Integer msgId; | 28 | + private Long msgId; |
| 28 | 29 | ||
| 29 | @Column(name="MAWBID") | 30 | @Column(name="MAWBID") |
| 30 | - private Integer MAWBID; | 31 | + private Long MAWBID; |
| 31 | 32 | ||
| 32 | @ApiModelProperty(value = "商品编号", example = "空值") | 33 | @ApiModelProperty(value = "商品编号", example = "空值") |
| 33 | @Column(name = "CLASSMARK") | 34 | @Column(name = "CLASSMARK") | ... | ... |
| 1 | package com.erry.iclear.dateInterface.common; | 1 | package com.erry.iclear.dateInterface.common; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.entity.ChmCarryPort; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 5 | +import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping; | ||
| 6 | +import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping; | ||
| 3 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 4 | 8 | ||
| 5 | import java.util.HashMap; | 9 | import java.util.HashMap; |
| ... | @@ -11,12 +15,37 @@ import java.util.Map; | ... | @@ -11,12 +15,37 @@ import java.util.Map; |
| 11 | @Component | 15 | @Component |
| 12 | public class Constant { | 16 | public class Constant { |
| 13 | 17 | ||
| 14 | - public static Map<String,HashMap<String,String>> appIdSecurity = new HashMap<>(); | 18 | + public static Map<String,HashMap<String,String>> appIdSecurityCache = new HashMap<>(); |
| 19 | + | ||
| 20 | + //字典表 | ||
| 21 | + public static Map<String , DictionaryEntries> dictionaryEntriesCache = new HashMap<>(); | ||
| 22 | + | ||
| 23 | + //货源地 | ||
| 24 | + public static Map<String,DomesticDestinationMapping> domesticDestinationMappingCache = new HashMap(); | ||
| 25 | + | ||
| 26 | + //目的港口 | ||
| 27 | + public static Map<String, OrigplacecodeMapping> origplacecodeMappingCache = new HashMap<>(); | ||
| 28 | + | ||
| 29 | + //港口表 | ||
| 30 | + public static Map<String, ChmCarryPort> chmCarryPortCache = new HashMap<>(); | ||
| 15 | 31 | ||
| 16 | public static String MSG_TYPE_C="C"; | 32 | public static String MSG_TYPE_C="C"; |
| 17 | 33 | ||
| 18 | public static String MSG_TYPE_D="D"; | 34 | public static String MSG_TYPE_D="D"; |
| 19 | 35 | ||
| 36 | + public static String LEVY_TYPE="levyType_"; | ||
| 37 | + | ||
| 38 | + public static String TRANSACTION_UNIT="transactionUnit_"; | ||
| 39 | + | ||
| 40 | + public static String COUNTRY = "Country_"; | ||
| 41 | + | ||
| 42 | + public static String CURRENCY_SYSTEM = "currencySystem_"; | ||
| 43 | + | ||
| 44 | + public static String VEHICLE_WAY_CODE = "VehicleWayCode_"; | ||
| 45 | + | ||
| 46 | + public static String CLINCH_TYPE = "ClinchType_"; | ||
| 47 | + | ||
| 48 | + public static String NEW_PACKAGE_TYPE = "NewPackageType_"; | ||
| 20 | 49 | ||
| 21 | 50 | ||
| 22 | } | 51 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.controller; | 1 | package com.erry.iclear.dateInterface.controller; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.service.IClearApiSystemService; | ||
| 3 | import io.swagger.annotations.ApiOperation; | 4 | import io.swagger.annotations.ApiOperation; |
| 5 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | import org.springframework.web.bind.annotation.GetMapping; | 7 | import org.springframework.web.bind.annotation.GetMapping; |
| 5 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 6 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| ... | @@ -10,22 +13,30 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -10,22 +13,30 @@ import org.springframework.web.bind.annotation.RestController; |
| 10 | */ | 13 | */ |
| 11 | @RestController | 14 | @RestController |
| 12 | @RequestMapping("/system") | 15 | @RequestMapping("/system") |
| 13 | - | 16 | +@Slf4j |
| 14 | public class IClearExportInterface { | 17 | public class IClearExportInterface { |
| 15 | 18 | ||
| 16 | - @ApiOperation(value = "IClear 健康检查" ,httpMethod ="GET" ,notes="ex: http://localhost:8080/system/healthCheck") | 19 | + @Autowired |
| 20 | + private IClearApiSystemService iClearApiSystemService; | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + @ApiOperation(value = "IClear 健康检查", httpMethod = "GET", notes = "ex: http://localhost:8080/system/healthCheck") | ||
| 17 | @GetMapping("/healthCheck") | 24 | @GetMapping("/healthCheck") |
| 18 | public String healthCheck() { | 25 | public String healthCheck() { |
| 19 | - return "iClearApi 当前时间:"+System.currentTimeMillis(); | 26 | + return "iClearApi 当前时间:" + System.currentTimeMillis(); |
| 20 | } | 27 | } |
| 21 | 28 | ||
| 22 | 29 | ||
| 23 | - @ApiOperation(value = "IClear 刷新缓存" ,httpMethod ="GET" ,notes="ex: http://192.168.0.75:8080/system/refreshCache") | 30 | + @ApiOperation(value = "IClear 刷新缓存", httpMethod = "GET", notes = "ex: http://192.168.1.75:8080/system/refreshAppInfoCache") |
| 24 | - @GetMapping("/refreshCache") | 31 | + @GetMapping("/refreshAppInfoCache") |
| 25 | public String refreshCache() { | 32 | public String refreshCache() { |
| 26 | - | 33 | + try{ |
| 27 | - | 34 | + iClearApiSystemService.refreshAppInfoCache(); |
| 28 | return "Success"; | 35 | return "Success"; |
| 36 | + }catch (Exception e){ | ||
| 37 | + log.error("refreshCache() error:"+e.getMessage()); | ||
| 38 | + } | ||
| 39 | + return "Faile"; | ||
| 29 | } | 40 | } |
| 30 | 41 | ||
| 31 | } | 42 | } | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import javax.persistence.*; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author Administrator | ||
| 11 | + */ | ||
| 12 | +@Entity | ||
| 13 | +@Table(name = "T_ICLEAR_API_APPINFO") | ||
| 14 | +@Data | ||
| 15 | +public class AppInfo implements Serializable { | ||
| 16 | + | ||
| 17 | + private static final long serialVersionUID = 1023722733043865770L; | ||
| 18 | + @Id | ||
| 19 | + @Column(name = "ID") | ||
| 20 | + private Integer id; | ||
| 21 | + | ||
| 22 | + @Column(name = "APPID") | ||
| 23 | + private String appId; | ||
| 24 | + | ||
| 25 | + @Column(name = "APPKEY") | ||
| 26 | + private String appKey; | ||
| 27 | + | ||
| 28 | + @Column(name = "SECURITY") | ||
| 29 | + private String security; | ||
| 30 | + | ||
| 31 | + @Column(name = "CREATE_TIME") | ||
| 32 | + private Date createTime; | ||
| 33 | + | ||
| 34 | + @Column(name = "IS_ENABLE") | ||
| 35 | + private String isEnable; | ||
| 36 | + | ||
| 37 | + | ||
| 38 | +} |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import javax.persistence.*; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 港口表 | ||
| 10 | + * Created by Erry 2019/6/15. | ||
| 11 | + * @author Administrator | ||
| 12 | + */ | ||
| 13 | +@Entity | ||
| 14 | +@Table(name = "T_CHM_CARRY_PORT") | ||
| 15 | +@Data | ||
| 16 | +public class ChmCarryPort implements Serializable { | ||
| 17 | + | ||
| 18 | + private static final long serialVersionUID = 2693103610036977383L; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 运单表ID,自动增加 | ||
| 22 | + */ | ||
| 23 | + @Id | ||
| 24 | + @GeneratedValue | ||
| 25 | + @Column(name = "ID") | ||
| 26 | + private Long id; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * | ||
| 30 | + */ | ||
| 31 | + @Column(name = "PORT_NAME") | ||
| 32 | + private String portName; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * | ||
| 36 | + */ | ||
| 37 | + @Column(name = "PORT_NO") | ||
| 38 | + private String portNo; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 创建人 | ||
| 42 | + */ | ||
| 43 | + @Column(name = "CREATE_BY") | ||
| 44 | + private String createName; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * | ||
| 48 | + */ | ||
| 49 | + @Column(name = "CREATE_TIME") | ||
| 50 | + private String createTime; | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 代码 | ||
| 55 | + */ | ||
| 56 | + @Column(name = "P_CODE") | ||
| 57 | + private String pcCode; | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 英文名称 | ||
| 62 | + */ | ||
| 63 | + @Column(name = "PORT_ENG_NAME") | ||
| 64 | + private String portEngName; | ||
| 65 | + | ||
| 66 | +} |
This diff is collapsed. Click to expand it.
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.persistence.*; | ||
| 7 | +import java.io.Serializable; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 明细表 | ||
| 12 | + * Created by Erry 2019/5/30. | ||
| 13 | + * | ||
| 14 | + * @author Administrator | ||
| 15 | + */ | ||
| 16 | +@Entity | ||
| 17 | +@Table(name = "T_CHM_CONSIGNMENT_DETAIL") | ||
| 18 | +@Data | ||
| 19 | +public class ChmConsignmentDetail implements Serializable { | ||
| 20 | + | ||
| 21 | + private static final long serialVersionUID = 2693103610036977383L; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 运单明细表ID,自动增加 | ||
| 25 | + */ | ||
| 26 | + @Id | ||
| 27 | + @GeneratedValue | ||
| 28 | + @Column(name = "ID") | ||
| 29 | + private Long id; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 运单 | ||
| 33 | + @ManyToOne(targetEntity = ChmConsignment.class) | ||
| 34 | + @JoinColumn(name = "CONSIGNMENT_ID") | ||
| 35 | + private ChmConsignment chmConsignment; | ||
| 36 | + */ | ||
| 37 | + | ||
| 38 | + @Column(name = "CONSIGNMENT_ID") | ||
| 39 | + private Integer consignmentId; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 商品编号CodeTS | ||
| 43 | + */ | ||
| 44 | + @Column(name = "SKU_CODE") | ||
| 45 | + private String skuCode; | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 原产国(地区)单价 | ||
| 50 | + */ | ||
| 51 | + @Column(name = "ORI_REGION") | ||
| 52 | + private BigDecimal oriRegion; | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 总价 | ||
| 56 | + */ | ||
| 57 | + @Column(name = "AMOUNT") | ||
| 58 | + private BigDecimal amount; | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 征免ID | ||
| 63 | + */ | ||
| 64 | + @JsonIgnore | ||
| 65 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 66 | + @JoinColumn(name = "LEVY_TYPE_ID") | ||
| 67 | + private DictionaryEntries levyTypeDic; | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 征免 | ||
| 71 | + */ | ||
| 72 | + @Column(name = "LEVY_TYPE") | ||
| 73 | + private String levyType; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 数量及单位(第一(法定)计量单位)ID | ||
| 77 | + * lwz | ||
| 78 | + */ | ||
| 79 | + @JsonIgnore | ||
| 80 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 81 | + @JoinColumn(name = "UNIT_LEGAL_FIRST_ID") | ||
| 82 | + private DictionaryEntries unitLegalFirstId; | ||
| 83 | + /** | ||
| 84 | + * 数量及单位(第一(法定)计量单位) | ||
| 85 | + */ | ||
| 86 | + @Column(name = "UNIT_LEGAL_FIRST") | ||
| 87 | + private String unitLegalFirst; | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 数量及单位(第一(法定)数量) | ||
| 92 | + */ | ||
| 93 | + @Column(name = "QTY_LEGAL_FIRST") | ||
| 94 | + private BigDecimal qtyLegalFirst; | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 数量及单位(成交数量) | ||
| 99 | + */ | ||
| 100 | + @Column(name = "KNOCKDOWN_NUMBER") | ||
| 101 | + private BigDecimal knockdownNumber; | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 成交单位ID | ||
| 105 | + */ | ||
| 106 | + @JsonIgnore | ||
| 107 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 108 | + @JoinColumn(name = "KNOCKDOWN_UNIT_ID") | ||
| 109 | + private DictionaryEntries knockdownUnitDic; | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 数量及单位(成交单位) | ||
| 113 | + */ | ||
| 114 | + @Column(name = "KNOCKDOWN_UNIT") | ||
| 115 | + private String knockdownUnit; | ||
| 116 | + | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * 商品名称及规格型号 | ||
| 120 | + */ | ||
| 121 | + @Column(name = "MODEL") | ||
| 122 | + private String model; | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * 商品名称 | ||
| 126 | + */ | ||
| 127 | + @Column(name = "SKUNAME") | ||
| 128 | + private String skuName; | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 原产地ID | ||
| 133 | + */ | ||
| 134 | + @JsonIgnore | ||
| 135 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 136 | + @JoinColumn(name = "HABITAT_ID") | ||
| 137 | + private DictionaryEntries habitatDic; | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * 原产地 | ||
| 141 | + */ | ||
| 142 | + @Column(name = "HABITAT") | ||
| 143 | + private String habitat; | ||
| 144 | + | ||
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * 数量及单位(第二(法定)数量) | ||
| 148 | + */ | ||
| 149 | + @Column(name = "QTY_LEGAL_SECOND") | ||
| 150 | + private BigDecimal qtyLegalSecond; | ||
| 151 | + | ||
| 152 | + /** | ||
| 153 | + * 数量及单位(第二(法定)计量单位)ID | ||
| 154 | + * lwz | ||
| 155 | + */ | ||
| 156 | + @JsonIgnore | ||
| 157 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 158 | + @JoinColumn(name = "UNIT_LEGAL_SECOND_ID") | ||
| 159 | + private DictionaryEntries unitLegalSecondId; | ||
| 160 | + /** | ||
| 161 | + * 数量及单位(第二(法定)计量单位) | ||
| 162 | + */ | ||
| 163 | + @Column(name = "UNIT_LEGAL_SECOND") | ||
| 164 | + private String unitLegalSecond; | ||
| 165 | + | ||
| 166 | + | ||
| 167 | + /** | ||
| 168 | + * 币制ID | ||
| 169 | + */ | ||
| 170 | + @JsonIgnore | ||
| 171 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 172 | + @JoinColumn(name = "CURRENCY_ID") | ||
| 173 | + private DictionaryEntries currencyDic; | ||
| 174 | + | ||
| 175 | + /** | ||
| 176 | + * 币制(货币代码) | ||
| 177 | + */ | ||
| 178 | + @Column(name = "CURRENCY") | ||
| 179 | + private String currency; | ||
| 180 | + | ||
| 181 | + | ||
| 182 | + /** | ||
| 183 | + * 最终目的国(地区)ID | ||
| 184 | + */ | ||
| 185 | + @JsonIgnore | ||
| 186 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 187 | + @JoinColumn(name = "DESTINATION_COUNTRY_ID") | ||
| 188 | + private DictionaryEntries destinationCountryDic; | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * 最终目的国(地区) | ||
| 192 | + */ | ||
| 193 | + @Column(name = "DESTINATION_COUNTRY") | ||
| 194 | + private String destinationCountry; | ||
| 195 | + | ||
| 196 | + | ||
| 197 | + /** | ||
| 198 | + * 境内货源地ID | ||
| 199 | + */ | ||
| 200 | + @JsonIgnore | ||
| 201 | + @ManyToOne(targetEntity = DomesticDestinationMapping.class) | ||
| 202 | + @JoinColumn(name = "DOMESTIC_DESTINATION_ID") | ||
| 203 | + private DomesticDestinationMapping domesticDestinationMapping; | ||
| 204 | + | ||
| 205 | + /** | ||
| 206 | + * 境内货源地 | ||
| 207 | + */ | ||
| 208 | + @Column(name = "DOMESTIC_DESTINATION") | ||
| 209 | + private String domesticDestination; | ||
| 210 | + | ||
| 211 | + | ||
| 212 | + /** | ||
| 213 | + * 货源地(目的地)ID | ||
| 214 | + */ | ||
| 215 | + @JsonIgnore | ||
| 216 | + @ManyToOne(targetEntity = OrigplacecodeMapping.class) | ||
| 217 | + @JoinColumn(name = "ORIGPLACECODE_ID") | ||
| 218 | + private OrigplacecodeMapping origplacecodeMapping; | ||
| 219 | + | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * 货源地(目的地) | ||
| 223 | + */ | ||
| 224 | + @Column(name = "ORIGPLACECODE") | ||
| 225 | + private String origplacecode; | ||
| 226 | + | ||
| 227 | + | ||
| 228 | + /** | ||
| 229 | + * author : wy on 2021/01/12 新增“英文品名” | ||
| 230 | + */ | ||
| 231 | + @Column(name = "CONTENTDESCRIPTION") | ||
| 232 | + private String contentDescription; | ||
| 233 | + | ||
| 234 | + | ||
| 235 | +//------------------------------------------------------------------------------------ | ||
| 236 | + /** | ||
| 237 | + * 备注 | ||
| 238 | + * */ | ||
| 239 | +// @Column(name = "REMARK") | ||
| 240 | +// private String remark; | ||
| 241 | + /** | ||
| 242 | + * 申报重量 | ||
| 243 | + * */ | ||
| 244 | +// @Column(name = "DECLARED_WEIGHT") | ||
| 245 | +// private BigDecimal declaredWeight; | ||
| 246 | + /** | ||
| 247 | + * 录入品名 | ||
| 248 | + */ | ||
| 249 | +// @Column(name = "INPUT_ITEM") | ||
| 250 | +// private String inputItem; | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + @Override | ||
| 254 | + public String toString() { | ||
| 255 | + return "ChmConsignmentDetail{" + | ||
| 256 | + "id=" + id + | ||
| 257 | + ", consignmentId=" + consignmentId + | ||
| 258 | + ", skuCode='" + skuCode + '\'' + | ||
| 259 | + ", skuName='" + skuName + '\'' + | ||
| 260 | + ", model='" + model + '\'' + | ||
| 261 | + ", knockdownNumber=" + knockdownNumber + | ||
| 262 | + ", knockdownUnitDic=" + knockdownUnitDic + | ||
| 263 | + ", knockdownUnit='" + knockdownUnit + '\'' + | ||
| 264 | + ", qtyLegalFirst=" + qtyLegalFirst + | ||
| 265 | + ", unitLegalFirst='" + unitLegalFirst + '\'' + | ||
| 266 | + ", qtyLegalSecond=" + qtyLegalSecond + | ||
| 267 | + ", unitLegalSecond='" + unitLegalSecond + '\'' + | ||
| 268 | + ", habitatDic=" + habitatDic + | ||
| 269 | + ", habitat='" + habitat + '\'' + | ||
| 270 | + ", oriRegion=" + oriRegion + | ||
| 271 | + ", amount=" + amount + | ||
| 272 | + ", levyTypeDic=" + levyTypeDic + | ||
| 273 | + ", levyType='" + levyType + '\'' + | ||
| 274 | + ", currency='" + currency + '\'' + | ||
| 275 | + ", destinationCountry='" + destinationCountry + '\'' + | ||
| 276 | + ", domesticDestination='" + domesticDestination + '\'' + | ||
| 277 | + ", origplacecodeDic=" + origplacecodeMapping + | ||
| 278 | + ", origplacecode='" + origplacecode + '\'' + | ||
| 279 | + //", remark='" + remark + '\'' + | ||
| 280 | + //", declaredWeight='" + declaredWeight + '\'' + | ||
| 281 | + ", contentDescription='" + contentDescription + '\'' + | ||
| 282 | + '}'; | ||
| 283 | + } | ||
| 284 | +} |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.persistence.*; | ||
| 7 | +import java.io.Serializable; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.util.ArrayList; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @author ligang | ||
| 14 | + * @date 2017/3/13 | ||
| 15 | + */ | ||
| 16 | +@Entity | ||
| 17 | +@Table(name = "T_BI_DICTIONARY_ENTRIES") | ||
| 18 | +@Data | ||
| 19 | +public class DictionaryEntries implements Serializable { | ||
| 20 | + | ||
| 21 | + private static final long serialVersionUID = -8423170334642989557L; | ||
| 22 | + @Id | ||
| 23 | + @Column(name = "ID") | ||
| 24 | + private Long id; | ||
| 25 | + | ||
| 26 | + @Column(name = "CODE") | ||
| 27 | + private String code; | ||
| 28 | + | ||
| 29 | + @Column(name = "DICT_CODE") | ||
| 30 | + private String dictCode; | ||
| 31 | + | ||
| 32 | + @Column(name = "CHINESE_NAME") | ||
| 33 | + private String chineseName; | ||
| 34 | + | ||
| 35 | + @Column(name = "ENGLISH_NAME") | ||
| 36 | + private String englishName; | ||
| 37 | + | ||
| 38 | + @Column(name = "DESCRIPTION") | ||
| 39 | + private String description; | ||
| 40 | + | ||
| 41 | + @Column(name = "STATUS") | ||
| 42 | + private Integer status; | ||
| 43 | + | ||
| 44 | + @Column(name = "EXT1") | ||
| 45 | + private Integer ext1; | ||
| 46 | + | ||
| 47 | + @Column(name = "EXT2") | ||
| 48 | + private String ext2; | ||
| 49 | + | ||
| 50 | + @Column(name = "EXT3") | ||
| 51 | + private String ext3; | ||
| 52 | + | ||
| 53 | + @Column(name = "EXT4") | ||
| 54 | + private BigDecimal ext4; | ||
| 55 | + | ||
| 56 | + @Column(name = "EXT5") | ||
| 57 | + private Integer ext5; | ||
| 58 | + | ||
| 59 | + @Column(name = "ORDINAL") | ||
| 60 | + private Integer ordinal; | ||
| 61 | + | ||
| 62 | + @Column(name = "EXT6") | ||
| 63 | + private String ext6; | ||
| 64 | + | ||
| 65 | + | ||
| 66 | +} |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import javax.persistence.*; | ||
| 6 | +import java.io.Serializable; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 国内目的地表 | ||
| 10 | + * Created by Erry 2019/6/15. | ||
| 11 | + * @author Administrator | ||
| 12 | + */ | ||
| 13 | +@Entity | ||
| 14 | +@Table(name = "T_DOMESTIC_DESTINATION_MAPPING") | ||
| 15 | +@Data | ||
| 16 | +public class DomesticDestinationMapping implements Serializable { | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + private static final long serialVersionUID = 1183214016253488527L; | ||
| 20 | + /** | ||
| 21 | + * 运单表ID,自动增加 | ||
| 22 | + */ | ||
| 23 | + @Id | ||
| 24 | + @GeneratedValue | ||
| 25 | + @Column(name = "ID") | ||
| 26 | + private Long id; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + *国内地区代码 | ||
| 31 | + */ | ||
| 32 | + @Column(name = "DISTRICTCODE") | ||
| 33 | + private String districtCode; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + *国内地区名称 | ||
| 37 | + */ | ||
| 38 | + @Column(name = "DISTRICTNAME") | ||
| 39 | + private String districtName; | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +} |
| ... | @@ -14,12 +14,11 @@ import java.util.Date; | ... | @@ -14,12 +14,11 @@ import java.util.Date; |
| 14 | @Data | 14 | @Data |
| 15 | public class IClearApiLog implements Serializable { | 15 | public class IClearApiLog implements Serializable { |
| 16 | 16 | ||
| 17 | - private static final long serialVersionUID = 1L; | 17 | + private static final long serialVersionUID = 8299265671871200609L; |
| 18 | - | ||
| 19 | @Id | 18 | @Id |
| 20 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 21 | @Column(name = "MSGID", insertable = false, nullable = false) | 20 | @Column(name = "MSGID", insertable = false, nullable = false) |
| 22 | - private Integer msgId; | 21 | + private Long msgId; |
| 23 | 22 | ||
| 24 | @Column(name = "MSG_TYPE") | 23 | @Column(name = "MSG_TYPE") |
| 25 | private String msgType; | 24 | private String msgType; | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | +import javax.persistence.*; | ||
| 5 | +import java.io.Serializable; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 目的地 | ||
| 9 | + * Created by Erry 2019/6/15. | ||
| 10 | + * | ||
| 11 | + * @author Administrator | ||
| 12 | + */ | ||
| 13 | +@Entity | ||
| 14 | +@Table(name = "T_ORIGPLACECODE_MAPPING") | ||
| 15 | +@Data | ||
| 16 | +public class OrigplacecodeMapping implements Serializable { | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + private static final long serialVersionUID = -1205560923546470604L; | ||
| 20 | + /** | ||
| 21 | + * 运单表ID,自动增加 | ||
| 22 | + */ | ||
| 23 | + @Id | ||
| 24 | + @Column(name = "ID") | ||
| 25 | + private Long id; | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 国内口岸代码 | ||
| 30 | + */ | ||
| 31 | + @Column(name = "ORIGPLACECODE") | ||
| 32 | + private String origplaceCode; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 国内口岸名称 | ||
| 36 | + */ | ||
| 37 | + @Column(name = "ORIGPLACENAME") | ||
| 38 | + private String origplaceName; | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +} |
| 1 | package com.erry.iclear.dateInterface.init; | 1 | package com.erry.iclear.dateInterface.init; |
| 2 | 2 | ||
| 3 | import com.erry.iclear.dateInterface.common.Constant; | 3 | import com.erry.iclear.dateInterface.common.Constant; |
| 4 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 5 | +import com.erry.iclear.dateInterface.service.*; | ||
| 4 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
| 5 | import org.springframework.beans.BeansException; | 7 | import org.springframework.beans.BeansException; |
| 6 | import org.springframework.beans.factory.InitializingBean; | 8 | import org.springframework.beans.factory.InitializingBean; |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | import org.springframework.context.ApplicationContext; | 10 | import org.springframework.context.ApplicationContext; |
| 8 | import org.springframework.context.ApplicationContextAware; | 11 | import org.springframework.context.ApplicationContextAware; |
| 9 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 10 | 13 | ||
| 11 | import java.util.HashMap; | 14 | import java.util.HashMap; |
| 15 | +import java.util.List; | ||
| 12 | 16 | ||
| 13 | /** | 17 | /** |
| 14 | * @author Administrator | 18 | * @author Administrator |
| ... | @@ -19,6 +23,22 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext | ... | @@ -19,6 +23,22 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext |
| 19 | 23 | ||
| 20 | private ApplicationContext applicationContext; | 24 | private ApplicationContext applicationContext; |
| 21 | 25 | ||
| 26 | + @Autowired | ||
| 27 | + private AppInfoService appInfoService; | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + private DomesticDestinationMappingService domesticDestinationMappingService; | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + private DictionaryEntriesService dictionaryEntriesService; | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + private OrigplacecodeMappingService origplacecodeMappingService; | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + private ChmCarryPortService chmCarryPortService; | ||
| 40 | + | ||
| 41 | + | ||
| 22 | @Override | 42 | @Override |
| 23 | public void setApplicationContext(ApplicationContext applicationContext)throws BeansException { | 43 | public void setApplicationContext(ApplicationContext applicationContext)throws BeansException { |
| 24 | this.applicationContext = applicationContext; | 44 | this.applicationContext = applicationContext; |
| ... | @@ -28,19 +48,46 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext | ... | @@ -28,19 +48,46 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext |
| 28 | @Override | 48 | @Override |
| 29 | public void afterPropertiesSet() throws Exception { | 49 | public void afterPropertiesSet() throws Exception { |
| 30 | try{ | 50 | try{ |
| 31 | - log.info("init appIdSecurity start>>>>>>>>>"); | 51 | + log.info("init initAppInfo start>>>>>>>>>"); |
| 32 | - //TODO 需要从数据库中读取,然后加载到map中 | 52 | + appInfoService.initAppInfo(); |
| 33 | - String appId="CTM"; | 53 | + log.info("init initAppInfo end>>>>>>>>>"); |
| 34 | - String appKey="iClearExport"; | 54 | + |
| 35 | - String security="b92131f03f19a348"; | 55 | + log.info("init initDictionaryEntries start>>>>>>>>>"); |
| 36 | - | 56 | + dictionaryEntriesService.initDictionaryEntries(); |
| 37 | - HashMap<String,String> appkeyMap = new HashMap<>(); | 57 | + log.info("init initDictionaryEntries end>>>>>>>>>"); |
| 38 | - appkeyMap.put(appKey,security); | 58 | + |
| 39 | - Constant.appIdSecurity.put(appId,appkeyMap); | 59 | + log.info("init initDomesticDestinationMapping start>>>>>>>>>"); |
| 40 | - log.info("init appIdSecurity end>>>>>>>>>"); | 60 | + domesticDestinationMappingService.initDomesticDestinationMapping(); |
| 61 | + log.info("init initDomesticDestinationMapping end>>>>>>>>>"); | ||
| 62 | + | ||
| 63 | + log.info("init initOrigplacecodeMapping start>>>>>>>>>"); | ||
| 64 | + origplacecodeMappingService.initOrigplacecodeMapping(); | ||
| 65 | + log.info("init initOrigplacecodeMapping end>>>>>>>>>"); | ||
| 66 | + | ||
| 67 | + log.info("init initChmCarryPort start>>>>>>>>>"); | ||
| 68 | + chmCarryPortService.initChmCarryPort(); | ||
| 69 | + log.info("init initChmCarryPort start>>>>>>>>>"); | ||
| 70 | + | ||
| 71 | + | ||
| 41 | }catch (Exception e){ | 72 | }catch (Exception e){ |
| 42 | - log.error("init appIdSecurity error:" + e.getMessage()); | 73 | + log.error("init afterPropertiesSet error:" + e.getMessage()); |
| 43 | } | 74 | } |
| 44 | } | 75 | } |
| 45 | 76 | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + | ||
| 46 | } | 93 | } | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.IClearApiLog; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | +import org.springframework.data.jpa.repository.Query; | ||
| 8 | +import org.springframework.stereotype.Repository; | ||
| 9 | +import org.springframework.transaction.annotation.Transactional; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @author Administrator | ||
| 15 | + */ | ||
| 16 | +@Repository | ||
| 17 | +@Transactional(rollbackFor = Exception.class) | ||
| 18 | +public interface AppInfoRepository extends JpaRepository<AppInfo, Integer>, JpaSpecificationExecutor<AppInfo> { | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 查找所有有效的appInfo | ||
| 22 | + * @return | ||
| 23 | + */ | ||
| 24 | + @Query(nativeQuery = true, value = "select * from T_ICLEAR_API_APPINFO where IS_ENABLE = '1' ") | ||
| 25 | + public List<AppInfo> getAllEnableAppInfo(); | ||
| 26 | + | ||
| 27 | +} |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.ChmCarryPort; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 港口表 Repository | ||
| 13 | + * Created by Erry 2019/6/15. | ||
| 14 | + * @author Administrator | ||
| 15 | + */ | ||
| 16 | +@Repository | ||
| 17 | +public interface ChmCarryPortRepository extends JpaSpecificationExecutor<ChmCarryPort>, JpaRepository<ChmCarryPort, Long> { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 查找所有港口表数据 | ||
| 21 | + * @param | ||
| 22 | + * @return | ||
| 23 | + */ | ||
| 24 | + @Query(nativeQuery = true, value = "SELECT * FROM T_CHM_CARRY_PORT") | ||
| 25 | + public List<ChmCarryPort> findAllChmCarryPort(); | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 模糊查询所有港口表数据 | ||
| 30 | + * @param | ||
| 31 | + * @return | ||
| 32 | + */ | ||
| 33 | + @Query(nativeQuery = true, value = "SELECT * FROM T_CHM_CARRY_PORT WHERE PORT_NAME LIKE ?1") | ||
| 34 | + public List<ChmCarryPort> findAllChmCarryPortLikePortName(String portName); | ||
| 35 | + | ||
| 36 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.ChmConsignment; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.util.Date; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @author Administrator | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmConsignment>, JpaRepository<ChmConsignment, Long> { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 根据运单号集合+创建时间 运单 | ||
| 20 | + * @return | ||
| 21 | + */ | ||
| 22 | + @Query( nativeQuery = true,value ="select * from T_CHM_CONSIGNMENT where CONSIGNMENT_CODE IN ?1 and CREATE_TIME > ?2 " ) | ||
| 23 | + public List<ChmConsignment> findChmByCodeListAndCreateTime(List chmConCodeList, Date createTime); | ||
| 24 | + | ||
| 25 | +} |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.IClearApiLog; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | +import org.springframework.data.jpa.repository.Query; | ||
| 8 | +import org.springframework.stereotype.Repository; | ||
| 9 | +import org.springframework.transaction.annotation.Transactional; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @author Administrator | ||
| 15 | + */ | ||
| 16 | +@Repository | ||
| 17 | +@Transactional(rollbackFor = Exception.class) | ||
| 18 | +public interface DictionaryEntriesRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> { | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 根据code查找 | ||
| 22 | + * @param code | ||
| 23 | + * @return | ||
| 24 | + */ | ||
| 25 | + @Query(nativeQuery = true, value = "select * from T_BI_DICTIONARY_ENTRIES where CODE = ?1 AND STATUS=1 order by ORDINAL, ID") | ||
| 26 | + public DictionaryEntries findDictionaryEntriesByCode(String code); | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 查找全部DictionaryEntries | ||
| 31 | + * @return | ||
| 32 | + */ | ||
| 33 | + @Query(nativeQuery = true, value = "select * from T_BI_DICTIONARY_ENTRIES where STATUS=1") | ||
| 34 | + public List<DictionaryEntries> findAllDictionaryEntries(); | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +} |
src/main/java/com/erry/iclear/dateInterface/repository/DomesticDestinationMappingRepository.java
0 → 100644
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @author Administrator | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +@Transactional(rollbackFor = Exception.class) | ||
| 17 | +public interface DomesticDestinationMappingRepository extends JpaSpecificationExecutor<DomesticDestinationMapping>, JpaRepository<DomesticDestinationMapping, Long> { | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 查找所有国内目的地表数据 | ||
| 22 | + * @param | ||
| 23 | + * @return | ||
| 24 | + */ | ||
| 25 | + @Query(nativeQuery = true, value = "SELECT * FROM T_DOMESTIC_DESTINATION_MAPPING") | ||
| 26 | + public List<DomesticDestinationMapping> findAllDomesticDestinationMapping(); | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 根据name查找国内目的地 | ||
| 30 | + * @param districtName | ||
| 31 | + * @return | ||
| 32 | + */ | ||
| 33 | + @Query(nativeQuery = true, value = "SELECT * FROM T_DOMESTIC_DESTINATION_MAPPING WHERE DISTRICTNAME =?1") | ||
| 34 | + public DomesticDestinationMapping findDomesticDestinationMappingByName(String districtName); | ||
| 35 | + | ||
| 36 | +} |
| ... | @@ -5,9 +5,14 @@ import org.hibernate.annotations.DynamicInsert; | ... | @@ -5,9 +5,14 @@ import org.hibernate.annotations.DynamicInsert; |
| 5 | import org.hibernate.annotations.DynamicUpdate; | 5 | import org.hibernate.annotations.DynamicUpdate; |
| 6 | import org.springframework.data.jpa.repository.JpaRepository; | 6 | import org.springframework.data.jpa.repository.JpaRepository; |
| 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 8 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 9 | +import org.springframework.data.jpa.repository.Query; | ||
| 10 | +import org.springframework.data.repository.query.Param; | ||
| 8 | import org.springframework.stereotype.Repository; | 11 | import org.springframework.stereotype.Repository; |
| 9 | import org.springframework.transaction.annotation.Transactional; | 12 | import org.springframework.transaction.annotation.Transactional; |
| 10 | 13 | ||
| 14 | +import java.util.Date; | ||
| 15 | + | ||
| 11 | /** | 16 | /** |
| 12 | * @author Administrator | 17 | * @author Administrator |
| 13 | */ | 18 | */ |
| ... | @@ -16,4 +21,11 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -16,4 +21,11 @@ import org.springframework.transaction.annotation.Transactional; |
| 16 | @Repository | 21 | @Repository |
| 17 | @Transactional(rollbackFor = Exception.class) | 22 | @Transactional(rollbackFor = Exception.class) |
| 18 | public interface IClearApiLogRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> { | 23 | public interface IClearApiLogRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> { |
| 24 | + | ||
| 25 | + //执行更新 | ||
| 26 | + @Modifying(clearAutomatically = false) | ||
| 27 | + @Query("update IClearApiLog u set u.spendTime =:spendTime , u.responseTime =:responseTime , u.receiveResult =:receiveResult where u.msgId =:msgId") | ||
| 28 | + public void updateIClearApiLog(@Param("msgId") Long msgId,@Param("spendTime") Long spendTime, @Param("responseTime") Date responseTime, @Param("receiveResult") String receiveResult); | ||
| 29 | + | ||
| 30 | + | ||
| 19 | } | 31 | } | ... | ... |
src/main/java/com/erry/iclear/dateInterface/repository/OrigplacecodeMappingRepository.java
0 → 100644
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Mawb; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | +import org.springframework.data.jpa.repository.Query; | ||
| 8 | +import org.springframework.stereotype.Repository; | ||
| 9 | +import org.springframework.transaction.annotation.Transactional; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @author Administrator | ||
| 15 | + */ | ||
| 16 | +@Repository | ||
| 17 | +@Transactional(rollbackFor = Exception.class) | ||
| 18 | +public interface OrigplacecodeMappingRepository extends JpaRepository<OrigplacecodeMapping, Integer>, JpaSpecificationExecutor<OrigplacecodeMapping> { | ||
| 19 | + /** | ||
| 20 | + * 查找所有目的地 | ||
| 21 | + * | ||
| 22 | + * @param | ||
| 23 | + * @return | ||
| 24 | + */ | ||
| 25 | + @Query(nativeQuery = true, value = "SELECT * FROM T_ORIGPLACECODE_MAPPING") | ||
| 26 | + public List<OrigplacecodeMapping> findAllOrigplacecodeMappingList(); | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 根据oriName查找目的地 | ||
| 30 | + * | ||
| 31 | + * @param oriName | ||
| 32 | + * @return | ||
| 33 | + */ | ||
| 34 | + @Query(nativeQuery = true, value = "SELECT * FROM T_ORIGPLACECODE_MAPPING WHERE ORIGPLACENAME =?1") | ||
| 35 | + public OrigplacecodeMapping findOrigplacecodeMappingByOriName(String oriName); | ||
| 36 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 5 | +import com.erry.iclear.dateInterface.repository.AppInfoRepository; | ||
| 6 | +import lombok.extern.slf4j.Slf4j; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @author Administrator | ||
| 16 | + */ | ||
| 17 | +@Service | ||
| 18 | +@Slf4j | ||
| 19 | +public class AppInfoService { | ||
| 20 | + | ||
| 21 | + @Autowired | ||
| 22 | + private AppInfoRepository appInfoRepository; | ||
| 23 | + | ||
| 24 | + public List<AppInfo> getAllEnableAppInfo() { | ||
| 25 | + List<AppInfo> result = new ArrayList<AppInfo>(); | ||
| 26 | + try { | ||
| 27 | + result = appInfoRepository.getAllEnableAppInfo(); | ||
| 28 | + } catch (Exception e) { | ||
| 29 | + log.error("getAllEnableAppInfo() error:" + e.getMessage()); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + return result; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 初始化AppInfo | ||
| 37 | + */ | ||
| 38 | + public void initAppInfo() { | ||
| 39 | + try { | ||
| 40 | + List<AppInfo> appInfoList = this.getAllEnableAppInfo(); | ||
| 41 | + for (AppInfo appInfo : appInfoList) { | ||
| 42 | + HashMap<String, String> appkeyMap = new HashMap<String, String>(); | ||
| 43 | + appkeyMap.put(appInfo.getAppKey(), appInfo.getSecurity()); | ||
| 44 | + Constant.appIdSecurityCache.put(appInfo.getAppId(), appkeyMap); | ||
| 45 | + } | ||
| 46 | + } catch (Exception e) { | ||
| 47 | + log.error("initAppInfo() error" + e.getMessage()); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + | ||
| 52 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 5 | +import com.erry.iclear.dateInterface.entity.ChmCarryPort; | ||
| 6 | +import com.erry.iclear.dateInterface.repository.ChmCarryPortRepository; | ||
| 7 | +import lombok.extern.slf4j.Slf4j; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | + | ||
| 11 | +import java.util.ArrayList; | ||
| 12 | +import java.util.HashMap; | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +@Service | ||
| 16 | +@Slf4j | ||
| 17 | +public class ChmCarryPortService { | ||
| 18 | + | ||
| 19 | + @Autowired | ||
| 20 | + private ChmCarryPortRepository chmCarryPortRepository; | ||
| 21 | + | ||
| 22 | + public List<ChmCarryPort> findAllChmCarryPort(){ | ||
| 23 | + List<ChmCarryPort> result = new ArrayList<>(); | ||
| 24 | + try{ | ||
| 25 | + result=chmCarryPortRepository.findAllChmCarryPort(); | ||
| 26 | + }catch (Exception e){ | ||
| 27 | + log.error("findAllChmCarryPort() error"+e.getMessage()); | ||
| 28 | + } | ||
| 29 | + return result; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 初始化AppInfo | ||
| 34 | + */ | ||
| 35 | + public void initChmCarryPort() { | ||
| 36 | + try { | ||
| 37 | + List<ChmCarryPort> appInfoList = this.findAllChmCarryPort(); | ||
| 38 | + for (ChmCarryPort chmCarryPort : appInfoList) { | ||
| 39 | + | ||
| 40 | + Constant.chmCarryPortCache.put(chmCarryPort.getPcCode(), chmCarryPort); | ||
| 41 | + } | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + log.error("initAppInfo() error" + e.getMessage()); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.MawbDetail; | ||
| 4 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 5 | +import com.erry.iclear.dateInterface.entity.*; | ||
| 6 | +import lombok.extern.slf4j.Slf4j; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @author Administrator | ||
| 13 | + */ | ||
| 14 | +@Service | ||
| 15 | +@Slf4j | ||
| 16 | +public class ChmConsignmentDetailService { | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 转换运单明细 | ||
| 21 | + * @param mawbDetail | ||
| 22 | + * @return | ||
| 23 | + */ | ||
| 24 | + public ChmConsignmentDetail convertToChmConsignmentDetail(MawbDetail mawbDetail){ | ||
| 25 | + ChmConsignmentDetail result = new ChmConsignmentDetail(); | ||
| 26 | + try{ | ||
| 27 | + //归类标志 | ||
| 28 | + | ||
| 29 | + //商品编号 | ||
| 30 | + result.setSkuCode(mawbDetail.getCodeTS()); | ||
| 31 | + //申报单价 | ||
| 32 | + result.setOriRegion(mawbDetail.getDeclPrice()); | ||
| 33 | + //申报总价 | ||
| 34 | + result.setAmount(mawbDetail.getDeclTotal()); | ||
| 35 | + //征免方式 | ||
| 36 | + DictionaryEntries levyTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.LEVY_TYPE+mawbDetail.getDutyMode()); | ||
| 37 | + result.setLevyTypeDic(levyTypeDictionaryEntries); | ||
| 38 | + result.setLevyType(levyTypeDictionaryEntries.getChineseName()); | ||
| 39 | + //货号 | ||
| 40 | + //版本号 | ||
| 41 | + //第一计量单位(法定单位) | ||
| 42 | + DictionaryEntries firstUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit()); | ||
| 43 | + result.setUnitLegalFirstId(firstUnitDictionaryEntries); | ||
| 44 | + result.setKnockdownUnit(firstUnitDictionaryEntries.getChineseName()); | ||
| 45 | + | ||
| 46 | + //第一法定数量 | ||
| 47 | + result.setQtyLegalFirst(BigDecimal.valueOf(mawbDetail.getFirstQty().doubleValue())); | ||
| 48 | + //成交计量单位 | ||
| 49 | + DictionaryEntries knockdownUnitEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit()); | ||
| 50 | + result.setKnockdownUnitDic(knockdownUnitEntries); | ||
| 51 | + result.setKnockdownUnit(knockdownUnitEntries.getChineseName()); | ||
| 52 | + //商品规格、型号 | ||
| 53 | + result.setModel(mawbDetail.getGModel()); | ||
| 54 | + //商品名称 | ||
| 55 | + result.setSkuName(mawbDetail.getGName()); | ||
| 56 | + //商品序号 | ||
| 57 | + //成交数量 | ||
| 58 | + result.setKnockdownNumber(BigDecimal.valueOf(mawbDetail.getGQty().doubleValue())); | ||
| 59 | + //原产国 | ||
| 60 | + DictionaryEntries habitatDictonaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getOriginCountry()); | ||
| 61 | + result.setHabitatDic(habitatDictonaryEntries); | ||
| 62 | + result.setHabitat(habitatDictonaryEntries.getChineseName()); | ||
| 63 | + | ||
| 64 | + //第二计量单位 | ||
| 65 | + DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit()); | ||
| 66 | + result.setUnitLegalSecondId(secondUnitDictionaryEntries); | ||
| 67 | + result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName()); | ||
| 68 | + //第二法定数量 | ||
| 69 | + result.setQtyLegalSecond(BigDecimal.valueOf(mawbDetail.getSecondQty().doubleValue())); | ||
| 70 | + //成交币制 | ||
| 71 | + DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr()); | ||
| 72 | + result.setCurrencyDic(currencyDictionaryEntries); | ||
| 73 | + result.setCurrency(currencyDictionaryEntries.getChineseName()); | ||
| 74 | + | ||
| 75 | + //用途/生产厂家 | ||
| 76 | + //工缴费 | ||
| 77 | + //最终目的国 | ||
| 78 | + DictionaryEntries destinationCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getDestinationCountry()); | ||
| 79 | + result.setDestinationCountryDic(destinationCountryDictionaryEntries); | ||
| 80 | + result.setDestinationCountry(destinationCountryDictionaryEntries.getChineseName()); | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + //检验检疫编码 | ||
| 84 | + //申报货物英文名称 | ||
| 85 | + result.setContentDescription(mawbDetail.getDeclGoodsEname()); | ||
| 86 | + //目的地代码 | ||
| 87 | + OrigplacecodeMapping origplacecodeMapping = Constant.origplacecodeMappingCache.get(mawbDetail.getDestCode()); | ||
| 88 | + result.setOrigplacecodeMapping(origplacecodeMapping); | ||
| 89 | + result.setOrigplacecode(origplacecodeMapping.getOrigplaceName()); | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + //境内目的地/境内货源地 | ||
| 93 | + DomesticDestinationMapping domesticDestinationDictionaryEntries = Constant.domesticDestinationMappingCache.get(mawbDetail.getDistrictCode()); | ||
| 94 | + result.setDomesticDestinationMapping(domesticDestinationDictionaryEntries); | ||
| 95 | + result.setDomesticDestination(destinationCountryDictionaryEntries.getChineseName()); | ||
| 96 | + | ||
| 97 | + | ||
| 98 | + }catch (Exception e){ | ||
| 99 | + log.error("convertToChmConsignmentDetail() error:"+e.getMessage()); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + return result; | ||
| 103 | + } | ||
| 104 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Mawb; | ||
| 4 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 5 | +import com.erry.iclear.dateInterface.entity.ChmCarryPort; | ||
| 6 | +import com.erry.iclear.dateInterface.entity.ChmConsignment; | ||
| 7 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 8 | +import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; | ||
| 9 | +import lombok.extern.slf4j.Slf4j; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | + | ||
| 13 | +import java.math.BigDecimal; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * @author Administrator | ||
| 17 | + */ | ||
| 18 | +@Service | ||
| 19 | +@Slf4j | ||
| 20 | +public class ChmConsignmentService { | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + private ChmConsignmentRepository chmConsignmentRepository; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 转换主单 | ||
| 27 | + * @return | ||
| 28 | + */ | ||
| 29 | + public ChmConsignment convertToChmConsignment(Mawb mawb){ | ||
| 30 | + ChmConsignment result = new ChmConsignment(); | ||
| 31 | + try{ | ||
| 32 | + //进出口标志:固定值 E | ||
| 33 | + //报关类型:填写固定值EX,但字典表里没有这个值 | ||
| 34 | +// result.setDeclaredDocTypeDic(); | ||
| 35 | +// result.setDeclaredCode(); | ||
| 36 | + //申报单位代码:固定值 1111980005 | ||
| 37 | + result.setDeclaredUnitName(mawb.getAgentName()); | ||
| 38 | + //申报单位名称:固定值 联邦快递(中国)有限公司 | ||
| 39 | + //提单号:有总单号则取值“总单号_运单号”,没有总单号则取值“运单号” | ||
| 40 | + String billNo[]=mawb.getBillNo().split("_"); | ||
| 41 | + result.setConsignmentHeadCode(billNo[0]); | ||
| 42 | + result.setConsignmentCode(billNo[1]); | ||
| 43 | + //合同号 | ||
| 44 | + result.setContractCode(mawb.getContrNo()); | ||
| 45 | + //主管海关(申报地海关) | ||
| 46 | + result.setCustomsNo(mawb.getCustomMaster()); | ||
| 47 | + //征免性质 | ||
| 48 | + DictionaryEntries levyTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.LEVY_TYPE+mawb.getCutMode()); | ||
| 49 | + result.setTaxNatureDic(levyTypeDictionaryEntries); | ||
| 50 | + result.setTaxNature(levyTypeDictionaryEntries.getChineseName()); | ||
| 51 | + //报关/转关关系标志:固定值0 ,但数据字典里没有0 | ||
| 52 | + | ||
| 53 | + //经停港/指运港 | ||
| 54 | + ChmCarryPort chmCarryPort =Constant.chmCarryPortCache.get(mawb.getDistinatePort()); | ||
| 55 | + result.setThroughStopPortDic(chmCarryPort); | ||
| 56 | + result.setThroughStopPort(chmCarryPort.getPortNo()); | ||
| 57 | + | ||
| 58 | + //报关标志 | ||
| 59 | + | ||
| 60 | + //海关编号 | ||
| 61 | + result.setCustomsNo(mawb.getEntryId()); | ||
| 62 | + //运费币制 | ||
| 63 | + DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+mawb.getFeeCurr()); | ||
| 64 | + result.setTransCurrencyDic(currencyDictionaryEntries); | ||
| 65 | + result.setTransCurrency(currencyDictionaryEntries.getChineseName()); | ||
| 66 | + | ||
| 67 | + //运费标记:固定值 3 | ||
| 68 | + //运费总价 | ||
| 69 | + result.setTransCost(mawb.getFeeRate()); | ||
| 70 | + //毛重 | ||
| 71 | + result.setGrossWeight(BigDecimal.valueOf(mawb.getGrossWet())); | ||
| 72 | + //出入境关闭:固定值 0101 | ||
| 73 | + //录入人名称:固定值 必填项,但填的值是空值 | ||
| 74 | + //保险费币制 | ||
| 75 | + DictionaryEntries insuranceDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+mawb.getInsurCurr()); | ||
| 76 | + result.setInsuranceCostCurrencyDic(insuranceDictionaryEntries); | ||
| 77 | + result.setInsuranceCostCurrency(insuranceDictionaryEntries.getChineseName()); | ||
| 78 | + //保险费标记 | ||
| 79 | + //保险费/率 | ||
| 80 | + result.setInsuranceCost(mawb.getInsurRate()); | ||
| 81 | + //备案号 | ||
| 82 | + result.setRecordCode(mawb.getManualNo()); | ||
| 83 | + //净重 | ||
| 84 | + result.setNetWeight(mawb.getNetWt()); | ||
| 85 | + //杂费币制 | ||
| 86 | + DictionaryEntries otherDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+mawb.getOtherCurr()); | ||
| 87 | + result.setInsuranceCostCurrencyDic(otherDictionaryEntries); | ||
| 88 | + result.setInsuranceCostCurrency(otherDictionaryEntries.getChineseName()); | ||
| 89 | + //杂费/率 | ||
| 90 | + result.setOtherCost(mawb.getOtherRate()); | ||
| 91 | + //杂费标志 | ||
| 92 | + //消费使用/生产销售单位代码 | ||
| 93 | + | ||
| 94 | + //消费使用/生产销售单位名称 | ||
| 95 | + //件数 | ||
| 96 | + result.setCounts(mawb.getPackNo().longValue()); | ||
| 97 | + //预录入编号 | ||
| 98 | + result.setEnteringNo(mawb.getPreEntryId()); | ||
| 99 | + //启运国/运抵国 | ||
| 100 | + DictionaryEntries fromCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getOtherCurr()); | ||
| 101 | + result.setFromCountryDic(fromCountryDictionaryEntries); | ||
| 102 | + result.setFromCountry(fromCountryDictionaryEntries.getChineseName()); | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + //监管方式 | ||
| 106 | + DictionaryEntries tradeModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getOtherCurr()); | ||
| 107 | + result.setTradeModeDic(tradeModeDictionaryEntries); | ||
| 108 | + result.setTradeMode(tradeModeDictionaryEntries.getChineseName()); | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + //境内收发货人编号 | ||
| 112 | + result.setTradeCoSCC(mawb.getTradeCode()); | ||
| 113 | + //运输方式代码 | ||
| 114 | + DictionaryEntries vehicleWayDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.VEHICLE_WAY_CODE+mawb.getTrafMode()); | ||
| 115 | + result.setVehicleWay(vehicleWayDictionaryEntries); | ||
| 116 | + result.setVehicleWayCode(vehicleWayDictionaryEntries.getCode()); | ||
| 117 | + | ||
| 118 | + //境内收发货人名称 | ||
| 119 | + result.setOperateUnitName(mawb.getTradeName()); | ||
| 120 | + //成交方式 | ||
| 121 | + DictionaryEntries dealModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CLINCH_TYPE+mawb.getTransMode()); | ||
| 122 | + result.setDealModeDic(dealModeDictionaryEntries); | ||
| 123 | + result.setDealMode(dealModeDictionaryEntries.getChineseName()); | ||
| 124 | + | ||
| 125 | + //包装种类 | ||
| 126 | + DictionaryEntries packageTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.NEW_PACKAGE_TYPE+mawb.getWrapType()); | ||
| 127 | + result.setPackageTypeDic(packageTypeDictionaryEntries); | ||
| 128 | + result.setPackageType(packageTypeDictionaryEntries.getChineseName()); | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + //生产核销单位统一信用代码---报关形式类型 | ||
| 132 | + //消费使用/生产销售单位单位统一编码 | ||
| 133 | + //贸易国别 | ||
| 134 | + DictionaryEntries tradeAreaCodeDictionaryEntries=Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getTradeAreaCode()); | ||
| 135 | + result.setTradeAreaCodeDic(tradeAreaCodeDictionaryEntries); | ||
| 136 | + result.setTradeAreaCode(tradeAreaCodeDictionaryEntries.getChineseName()); | ||
| 137 | + | ||
| 138 | + | ||
| 139 | + | ||
| 140 | + //标记及号码 | ||
| 141 | + result.setDeclaredRemark(mawb.getMarkNo()); | ||
| 142 | + //入境口岸代码:固定值 310302 | ||
| 143 | + //存放地点:固定值 空值 | ||
| 144 | + //申报人员姓名---报关员证号 | ||
| 145 | + result.setDeclaredUnitName(mawb.getDeclareName()); | ||
| 146 | + //境外发货人代码 | ||
| 147 | + | ||
| 148 | + //境外收货人编码 | ||
| 149 | + result.setOverseasConsignorCode(mawb.getOverseasConsigneeCode()); | ||
| 150 | + //境外收货人名称(外文) | ||
| 151 | + result.setOverseasConsignorFnCname(mawb.getOverseasConsigneeEname()); | ||
| 152 | + | ||
| 153 | + | ||
| 154 | + }catch (Exception e){ | ||
| 155 | + log.error("convertToChmConsignment() error:"+e.getMessage()); | ||
| 156 | + } | ||
| 157 | + return result; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + | ||
| 161 | + /** | ||
| 162 | + * 保存主单 | ||
| 163 | + * @param chmConsignment | ||
| 164 | + * @return | ||
| 165 | + */ | ||
| 166 | + public ChmConsignment saveChmConsignment(ChmConsignment chmConsignment){ | ||
| 167 | + try{ | ||
| 168 | + return chmConsignmentRepository.save(chmConsignment); | ||
| 169 | + }catch (Exception e){ | ||
| 170 | + log.error("saveChmConsignment() error:"+e.getMessage()); | ||
| 171 | + } | ||
| 172 | + return null; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + | ||
| 176 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 5 | +import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | ||
| 6 | +import lombok.extern.slf4j.Slf4j; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @author Administrator | ||
| 16 | + */ | ||
| 17 | +@Service | ||
| 18 | +@Slf4j | ||
| 19 | +public class DictionaryEntriesService { | ||
| 20 | + | ||
| 21 | + @Autowired | ||
| 22 | + private DictionaryEntriesRepository dictionaryEntriesRepository; | ||
| 23 | + | ||
| 24 | + public List<DictionaryEntries> getAllDictionaryEntries(){ | ||
| 25 | + List<DictionaryEntries> result = new ArrayList<DictionaryEntries>(); | ||
| 26 | + try { | ||
| 27 | + result=dictionaryEntriesRepository.findAllDictionaryEntries(); | ||
| 28 | + }catch (Exception e){ | ||
| 29 | + log.error("getAllDictionaryEntries() error:"+e.getMessage()); | ||
| 30 | + } | ||
| 31 | + return result; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 初始化AppInfo | ||
| 37 | + */ | ||
| 38 | + public void initDictionaryEntries() { | ||
| 39 | + try { | ||
| 40 | + List<DictionaryEntries> dictionaryEntriesList = this.getAllDictionaryEntries(); | ||
| 41 | + for (DictionaryEntries dictionaryEntries : dictionaryEntriesList) { | ||
| 42 | + Constant.dictionaryEntriesCache.put(dictionaryEntries.getCode(),dictionaryEntries); | ||
| 43 | + } | ||
| 44 | + } catch (Exception e) { | ||
| 45 | + log.error("initAppInfo() error" + e.getMessage()); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + | ||
| 51 | +} |
src/main/java/com/erry/iclear/dateInterface/service/DomesticDestinationMappingService.java
0 → 100644
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 5 | +import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping; | ||
| 6 | +import com.erry.iclear.dateInterface.repository.DomesticDestinationMappingRepository; | ||
| 7 | +import lombok.extern.slf4j.Slf4j; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | + | ||
| 11 | +import java.util.ArrayList; | ||
| 12 | +import java.util.HashMap; | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * @author Administrator | ||
| 17 | + */ | ||
| 18 | +@Service | ||
| 19 | +@Slf4j | ||
| 20 | +public class DomesticDestinationMappingService { | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + private DomesticDestinationMappingRepository domesticDestinationMappingRepository; | ||
| 24 | + | ||
| 25 | + public List<DomesticDestinationMapping> findAllDomesticDestinationMapping(){ | ||
| 26 | + List<DomesticDestinationMapping> result = new ArrayList<>(); | ||
| 27 | + try{ | ||
| 28 | + result=domesticDestinationMappingRepository.findAllDomesticDestinationMapping(); | ||
| 29 | + }catch (Exception e){ | ||
| 30 | + log.error("findAllDomesticDestinationMapping() error:" + e.getMessage()); | ||
| 31 | + } | ||
| 32 | + return result; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 初始化DomesticDestinationMapping | ||
| 38 | + */ | ||
| 39 | + public void initDomesticDestinationMapping() { | ||
| 40 | + try { | ||
| 41 | + List<DomesticDestinationMapping> domList = this.findAllDomesticDestinationMapping(); | ||
| 42 | + for (DomesticDestinationMapping dom : domList) { | ||
| 43 | + Constant.domesticDestinationMappingCache.put(dom.getDistrictCode(), dom); | ||
| 44 | + } | ||
| 45 | + } catch (Exception e) { | ||
| 46 | + log.error("initDomesticDestinationMapping() error" + e.getMessage()); | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | +} |
| ... | @@ -59,4 +59,14 @@ public class IClearApiLogService { | ... | @@ -59,4 +59,14 @@ public class IClearApiLogService { |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | + | ||
| 63 | + public void updateIClearApiLog(IClearApiLog iClearApiLog){ | ||
| 64 | + try{ | ||
| 65 | + iClearApiLogRepository.updateIClearApiLog(iClearApiLog.getMsgId(),iClearApiLog.getSpendTime(),iClearApiLog.getResponseTime(),iClearApiLog.getReceiveResult()); | ||
| 66 | + }catch (Exception e){ | ||
| 67 | + log.error("updateIClearApiLog() error:"+e.getMessage()); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + | ||
| 62 | } | 72 | } | ... | ... |
| ... | @@ -2,6 +2,7 @@ package com.erry.iclear.dateInterface.service; | ... | @@ -2,6 +2,7 @@ package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import lombok.extern.slf4j.Slf4j; | 4 | import lombok.extern.slf4j.Slf4j; |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| ... | @@ -11,11 +12,14 @@ import org.springframework.stereotype.Service; | ... | @@ -11,11 +12,14 @@ import org.springframework.stereotype.Service; |
| 11 | @Slf4j | 12 | @Slf4j |
| 12 | public class IClearApiSystemService { | 13 | public class IClearApiSystemService { |
| 13 | 14 | ||
| 15 | + @Autowired | ||
| 16 | + private AppInfoService appInfoService; | ||
| 17 | + | ||
| 14 | /** | 18 | /** |
| 15 | - * TODO 刷新缓存 | 19 | + * 刷新缓存 |
| 16 | */ | 20 | */ |
| 17 | - public void refreshCache(){ | 21 | + public void refreshAppInfoCache(){ |
| 18 | - | 22 | + appInfoService.initAppInfo(); |
| 19 | } | 23 | } |
| 20 | 24 | ||
| 21 | 25 | ... | ... |
| ... | @@ -52,9 +52,7 @@ public class MawbService { | ... | @@ -52,9 +52,7 @@ public class MawbService { |
| 52 | 52 | ||
| 53 | 53 | ||
| 54 | //checkResult= | 54 | //checkResult= |
| 55 | - log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb) | 55 | + log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb) +" result :" +checkResult ); |
| 56 | - +" result :" +checkResult | ||
| 57 | - ); | ||
| 58 | 56 | ||
| 59 | return checkResult; | 57 | return checkResult; |
| 60 | 58 | ||
| ... | @@ -64,6 +62,4 @@ public class MawbService { | ... | @@ -64,6 +62,4 @@ public class MawbService { |
| 64 | return Boolean.FALSE; | 62 | return Boolean.FALSE; |
| 65 | } | 63 | } |
| 66 | 64 | ||
| 67 | - | ||
| 68 | - | ||
| 69 | } | 65 | } | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 5 | +import com.erry.iclear.dateInterface.entity.AppInfo; | ||
| 6 | +import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping; | ||
| 7 | +import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping; | ||
| 8 | +import com.erry.iclear.dateInterface.repository.OrigplacecodeMappingRepository; | ||
| 9 | +import lombok.extern.slf4j.Slf4j; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | + | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.List; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @author Administrator | ||
| 19 | + */ | ||
| 20 | +@Service | ||
| 21 | +@Slf4j | ||
| 22 | +public class OrigplacecodeMappingService { | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + private OrigplacecodeMappingRepository origplacecodeMappingRepository; | ||
| 26 | + | ||
| 27 | + public List<OrigplacecodeMapping> findAllOrigplacecodeMapping(){ | ||
| 28 | + List<OrigplacecodeMapping> result = new ArrayList<>(); | ||
| 29 | + try{ | ||
| 30 | + result=origplacecodeMappingRepository.findAllOrigplacecodeMappingList(); | ||
| 31 | + }catch (Exception e){ | ||
| 32 | + log.error("findAllOrigplacecodeMapping() error:"+e.getMessage()); | ||
| 33 | + } | ||
| 34 | + return result; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 初始化DomesticDestinationMapping | ||
| 41 | + */ | ||
| 42 | + public void initOrigplacecodeMapping() { | ||
| 43 | + try { | ||
| 44 | + List<OrigplacecodeMapping> domList = this.findAllOrigplacecodeMapping(); | ||
| 45 | + for (OrigplacecodeMapping dom : domList) { | ||
| 46 | + Constant.origplacecodeMappingCache.put(dom.getOrigplaceCode(), dom); | ||
| 47 | + } | ||
| 48 | + } catch (Exception e) { | ||
| 49 | + log.error("initDomesticDestinationMapping() error" + e.getMessage()); | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + | ||
| 61 | +} |
| ... | @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; | ... | @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; |
| 12 | public class IClearApiTask { | 12 | public class IClearApiTask { |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | - * TODO 定时任务:每分钟推送 | 15 | + * TODO 定时任务:每分钟推送: 报关数据、回执 |
| 16 | */ | 16 | */ |
| 17 | @Scheduled(cron = "${task.pushMawbToIClear}") | 17 | @Scheduled(cron = "${task.pushMawbToIClear}") |
| 18 | public void pushMawbToIClear(){ | 18 | public void pushMawbToIClear(){ | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.util; | ||
| 2 | + | ||
| 3 | +import java.io.UnsupportedEncodingException; | ||
| 4 | +import java.security.MessageDigest; | ||
| 5 | +import java.security.NoSuchAlgorithmException; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author Administrator | ||
| 9 | + */ | ||
| 10 | +public class SHA256Util { | ||
| 11 | + | ||
| 12 | + /** | ||
| 13 | + * 用java原生的摘要实现SHA256加密 | ||
| 14 | + * @param str 加密前的报文 | ||
| 15 | + * @return | ||
| 16 | + */ | ||
| 17 | + public static String getSHA256String(String str) { | ||
| 18 | + String encodeStr = ""; | ||
| 19 | + try { | ||
| 20 | + MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); | ||
| 21 | + messageDigest.update(str.getBytes("UTF-8")); | ||
| 22 | + encodeStr = byte2Hex(messageDigest.digest()); | ||
| 23 | + } catch (NoSuchAlgorithmException e) { | ||
| 24 | + e.printStackTrace(); | ||
| 25 | + } catch (UnsupportedEncodingException e) { | ||
| 26 | + e.printStackTrace(); | ||
| 27 | + throw new RuntimeException("SHA256签名过程中出现错误"); | ||
| 28 | + } | ||
| 29 | + return encodeStr; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * byte[]转为16进制 | ||
| 34 | + * | ||
| 35 | + * @param bytes | ||
| 36 | + * @return | ||
| 37 | + */ | ||
| 38 | + private static String byte2Hex(byte[] bytes) { | ||
| 39 | + StringBuffer stringBuffer = new StringBuffer(); | ||
| 40 | + for (int i = 0; i < bytes.length; i++) { | ||
| 41 | + String temp = Integer.toHexString(bytes[i] & 0xFF); | ||
| 42 | + if (temp.length() == 1) { | ||
| 43 | + stringBuffer.append("0"); | ||
| 44 | + } | ||
| 45 | + stringBuffer.append(temp); | ||
| 46 | + } | ||
| 47 | + return stringBuffer.toString(); | ||
| 48 | + } | ||
| 49 | +} |
| ... | @@ -13,7 +13,7 @@ public class ApiTest { | ... | @@ -13,7 +13,7 @@ public class ApiTest { |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | public static void main(String[] args) { | 15 | public static void main(String[] args) { |
| 16 | - | 16 | + //{"IEFlag":"E","type":"EX","agentCode":"1111980005","agentName":"联邦快递(中国)有限公司","billNo":"202105210784","contrNo":"NO.565733","customMaster":"0101","cutMode":"101","declTrnRel":"0","distinatePort":"ASM000","ediId":"001","entryId":"25512456","feeCurr":"USD","feeMark":"3","feeRate":100.58,"grossWet":500,"IEPort":"0101","inputerName":"","insurCurr":"MOP","insurMark":"3","insurRate":23.44,"manualNo":"备案号","netWt":80,"otherCurr":"001","otherRate":10,"otherMark":"","ownerCode":"Z321654987","ownerName":"上海保险","packNo":1,"preEntryId":"","tradeCountry":"USA","tradeMode":"0200","tradeCode":"Z321654987","trafMode":"1","tradeName":"上海铢怡国际货物运输代理有限公司","transMode":"3","wrapType":"22","tradeCodeScc":"A74125896321456987","ownerCodeScc":"A74125896321456987","tradeAreaCode":"USA","markNo":"N/M","entyPortCode":"310302","goodsPlace":"","declareName":"张安","overseasConsignorCode":"Z785421","overseasConsigneeCode":"Z785421","overseasConsigneeEname":"出口时必填收件人公司名(原)","mawbDetailList":[{"classMark":"","codeTS":"69125472","declPrice":111.123,"declTotal":788,"dutyMode":"1","exgNo":"","exgVersion":"","firstUnit":"","firstQty":11,"GUnit":"007","GModel":"商品规格、型号","GName":"餐桌","GNo":"1","GQty":1,"originCountry":"USA","secondUnit":"007","secondQty":2,"tradeCurr":"USA","useTo":"","ciqCode":"","destinationCountry":"CHN","declGoodsEname":"","destCode":"","districtCode":"4408W"},{"classMark":"","codeTS":"69125472","declPrice":45.72,"declTotal":33,"dutyMode":"1","exgNo":"","exgVersion":"","firstUnit":"","firstQty":11,"GUnit":"007","GModel":"商品规格、型号","GName":"餐桌","GNo":"2","GQty":22,"originCountry":"USA","secondUnit":"007","secondQty":3,"tradeCurr":"USA","useTo":"","ciqCode":"","destinationCountry":"CHN","declGoodsEname":"","destCode":"","districtCode":"4408W"}]} |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | MawbDetail d1 = new MawbDetail(); | 19 | MawbDetail d1 = new MawbDetail(); |
| ... | @@ -128,7 +128,7 @@ public class ApiTest { | ... | @@ -128,7 +128,7 @@ public class ApiTest { |
| 128 | mawb.setOverseasConsignorCode("Z785421"); | 128 | mawb.setOverseasConsignorCode("Z785421"); |
| 129 | mawb.setOverseasConsigneeCode("Z785421"); | 129 | mawb.setOverseasConsigneeCode("Z785421"); |
| 130 | mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)"); | 130 | mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)"); |
| 131 | - //mawb.setMawbDetailList(mawbDetailList); | 131 | + mawb.setMawbDetailList(mawbDetailList); |
| 132 | 132 | ||
| 133 | 133 | ||
| 134 | 134 | ... | ... |
| 1 | +package com.erry.iclear.dateInterface; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.util.SHA256Util; | ||
| 4 | + | ||
| 5 | +public class SHA256Test { | ||
| 6 | + | ||
| 7 | + public static void main(String[] args) { | ||
| 8 | + long time =System.currentTimeMillis(); | ||
| 9 | + System.out.println(time); | ||
| 10 | + String str = "CTM"+"iClearExport"+"b92131f03f19a348"+time; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + System.out.println(SHA256Util.getSHA256String(str)); | ||
| 14 | + | ||
| 15 | +// | ||
| 16 | +// 1623920478192 | ||
| 17 | +// eaf279997145f440ab5064e43f1a9cfdac15322886936801d57e022cde29919b | ||
| 18 | + } | ||
| 19 | +} |
-
Please register or login to post a comment