...
|
...
|
@@ -32,67 +32,71 @@ public class CustomsLockController { |
|
|
|
|
|
@PostMapping("response")
|
|
|
public ResultJson lockResponse(@RequestBody LockFeedBack feedBack){
|
|
|
|
|
|
if (StringUtils.isEmpty(feedBack.barcode)){
|
|
|
return new ResultJson("400","缺少二维码信息","缺少二维码信息");
|
|
|
}
|
|
|
|
|
|
log.info("收到关锁通知:{}",feedBack.toString());
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
try{
|
|
|
log.info("收到关锁通知:{}",feedBack.toString());
|
|
|
if (StringUtils.isEmpty(feedBack.barcode)){
|
|
|
return new ResultJson("400","缺少二维码信息","缺少二维码信息");
|
|
|
}
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
// sb.append("施解封时间:").append(feedBack.locktime).append("\n")
|
|
|
// .append("关锁秘钥:").append(feedBack.secret).append("\n")
|
|
|
// .append("施解封内容:").append(feedBack.feedbackconten).append("\n")
|
|
|
sb.append("施解封内容:").append(feedBack.feedbackconten).append("\n");
|
|
|
// .append("施解封状态:").append(feedBack.feedbackcode).append("\n");
|
|
|
|
|
|
String LOCK_TYPE_UNLOCK = "2";
|
|
|
/**
|
|
|
* 关锁施解封类型
|
|
|
* 1 施封
|
|
|
* 2 解封
|
|
|
*/
|
|
|
String LOCK_TYPE_LOCK = "1";
|
|
|
if (LOCK_TYPE_LOCK.equals(feedBack.type)){
|
|
|
sb.append("施解封类型:").append("施封").append("\n");
|
|
|
}else if (LOCK_TYPE_UNLOCK.equals(feedBack.type)){
|
|
|
sb.append("施解封类型:").append("解封").append("\n");
|
|
|
}else {
|
|
|
sb.append("施解封类型:").append("未知").append("\n");
|
|
|
sb.append("施解封类型:").append(feedBack.type).append("\n");
|
|
|
}
|
|
|
String LOCK_TYPE_UNLOCK = "2";
|
|
|
/**
|
|
|
* 关锁施解封类型
|
|
|
* 1 施封
|
|
|
* 2 解封
|
|
|
*/
|
|
|
String LOCK_TYPE_LOCK = "1";
|
|
|
if (LOCK_TYPE_LOCK.equals(feedBack.type)){
|
|
|
sb.append("施解封类型:").append("施封").append("\n");
|
|
|
}else if (LOCK_TYPE_UNLOCK.equals(feedBack.type)){
|
|
|
sb.append("施解封类型:").append("解封").append("\n");
|
|
|
}else {
|
|
|
sb.append("施解封类型:").append("未知").append("\n");
|
|
|
sb.append("施解封类型:").append(feedBack.type).append("\n");
|
|
|
}
|
|
|
|
|
|
|
|
|
//判定关锁返回结果,结果正常,继续走抬杆指令,结果异常 不走抬杆指令,转人工抬杆
|
|
|
/**
|
|
|
* 关锁通知施解封状态
|
|
|
* 01 成功
|
|
|
* 02 失败
|
|
|
*/
|
|
|
String LOCK_SUCCESS = "01";
|
|
|
if(LOCK_SUCCESS.equals(feedBack.feedbackcode)){
|
|
|
//读取缓存
|
|
|
GatherInfo gatherInfo = customsLockService.cacheRead(feedBack.barcode);
|
|
|
sb.append("成功");
|
|
|
if (gatherInfo!=null){
|
|
|
commandLogService.commandlog(gatherInfo,true,sb.toString(),null,null,0.0,0.0,0.0,0.0);
|
|
|
customsLockService.localGatherInfoHandle(gatherInfo);
|
|
|
//判定关锁返回结果,结果正常,继续走抬杆指令,结果异常 不走抬杆指令,转人工抬杆
|
|
|
/**
|
|
|
* 关锁通知施解封状态
|
|
|
* 01 成功
|
|
|
* 02 失败
|
|
|
*/
|
|
|
String LOCK_SUCCESS = "01";
|
|
|
if(LOCK_SUCCESS.equals(feedBack.feedbackcode)){
|
|
|
//读取缓存
|
|
|
GatherInfo gatherInfo = customsLockService.cacheRead(feedBack.barcode);
|
|
|
sb.append("成功");
|
|
|
if (gatherInfo!=null){
|
|
|
commandLogService.commandlog(gatherInfo,true,sb.toString(),null,null,0.0,0.0,0.0,0.0);
|
|
|
customsLockService.localGatherInfoHandle(gatherInfo);
|
|
|
}else {
|
|
|
sb.append("关锁缓存信息读取失败");
|
|
|
gatherInfo = new GatherInfo();
|
|
|
gatherInfo.setBarcode(feedBack.barcode);
|
|
|
gatherInfo.setGrosswt(new BigDecimal(0));
|
|
|
commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0);
|
|
|
log.info("[LOCK-RSP]-关锁缓存信息读取失败");
|
|
|
return new ResultJson("400","关锁缓存信息读取失败");
|
|
|
}
|
|
|
}else {
|
|
|
sb.append("关锁缓存信息读取失败");
|
|
|
gatherInfo = new GatherInfo();
|
|
|
sb.append("关锁施解封失败");
|
|
|
GatherInfo gatherInfo = new GatherInfo();
|
|
|
gatherInfo.setBarcode(feedBack.barcode);
|
|
|
gatherInfo.setGrosswt(new BigDecimal(0));
|
|
|
|
|
|
commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0);
|
|
|
log.info("[LOCK-RSP]-关锁缓存信息读取失败");
|
|
|
}
|
|
|
}else {
|
|
|
sb.append("关锁施解封失败");
|
|
|
GatherInfo gatherInfo = new GatherInfo();
|
|
|
gatherInfo.setBarcode(feedBack.barcode);
|
|
|
gatherInfo.setGrosswt(new BigDecimal(0));
|
|
|
log.info("[LOCK-RSP]-关锁施解封失败");
|
|
|
|
|
|
commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0);
|
|
|
log.info("[LOCK-RSP]-关锁施解封失败");
|
|
|
}
|
|
|
return new ResultJson("200","success");
|
|
|
}catch (Exception e){
|
|
|
return new ResultJson("500",e.toString());
|
|
|
}
|
|
|
return new ResultJson("200","success");
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|