|
@@ -1,5 +1,6 @@
|
|
|
package com.pj.task;
|
|
|
|
|
|
+import cn.hutool.log.StaticLog;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -95,18 +96,18 @@ public class HtByteTask {
|
|
|
|
|
|
/**
|
|
|
* 启动定时任务
|
|
|
- *
|
|
|
- * * 报文类型
|
|
|
- * * 001=边民备案
|
|
|
- * * 002=商铺备案
|
|
|
- * * 003=边民互助组备案
|
|
|
- * * 004=边民合作社备案
|
|
|
- * * 005=商品基础信息
|
|
|
- * * 006=交易结算信息
|
|
|
- * * 007=放行记录(过卡记录)
|
|
|
+ * <p>
|
|
|
+ * * 报文类型
|
|
|
+ * * 001=边民备案
|
|
|
+ * * 002=商铺备案
|
|
|
+ * * 003=边民互助组备案
|
|
|
+ * * 004=边民合作社备案
|
|
|
+ * * 005=商品基础信息
|
|
|
+ * * 006=交易结算信息
|
|
|
+ * * 007=放行记录(过卡记录)
|
|
|
*/
|
|
|
@Scheduled(cron = "*/9 * * * * ?") // 测试阶段,每9秒扫描一次
|
|
|
- private void htByteTask(){
|
|
|
+ private void htByteTask() {
|
|
|
/* 测试mq */
|
|
|
// OrderDto orderDtoById = levelOneServerInterface.getOrderDtoById(8833342005355478419L);
|
|
|
// asyncServerInterface.sendLevelOneOrderDto(orderDtoById, DataType.DATA_TYPE_ONE.getCode());
|
|
@@ -114,7 +115,7 @@ public class HtByteTask {
|
|
|
//扫描表内是否有待处理任务
|
|
|
List<HtByte> byteList = htByteMapper.selectList(new LambdaQueryWrapper<HtByte>().eq(HtByte::getFinishStatus, FinishStatus.FINISH_STATUS_ZERO.getCode()));
|
|
|
//判断是否有任务,没有则返回
|
|
|
- if(byteList.size() == 0){
|
|
|
+ if (byteList.size() == 0) {
|
|
|
System.out.println("\n --- 暂无待处理任务。" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n");
|
|
|
return;
|
|
|
}
|
|
@@ -127,16 +128,16 @@ public class HtByteTask {
|
|
|
//数据处理完成状态
|
|
|
boolean flag = false;
|
|
|
// 根据类型匹配对象
|
|
|
- switch (dataDto.getDataType()){
|
|
|
+ switch (dataDto.getDataType()) {
|
|
|
case "001":
|
|
|
//对象转换
|
|
|
PeopleDto peopleDto = JSONObject.parseObject(body, PeopleDto.class);
|
|
|
//根据其内的身份证,有则新增,无则修改???
|
|
|
flag = FeignFactory.levelOneServerInterface.peopleDto(peopleDto);
|
|
|
- methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
|
- if(!flag){
|
|
|
+ methodHtByteTask.updateHtByteInfo(flag, item, dataDto);
|
|
|
+ if (!flag) {
|
|
|
System.out.println("\n边民信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
System.out.println("\n边民信息处理成功。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|
|
@@ -145,10 +146,10 @@ public class HtByteTask {
|
|
|
ShopDto shopDto = JSONObject.parseObject(body, ShopDto.class);
|
|
|
//保存
|
|
|
flag = FeignFactory.levelOneServerInterface.shopDto(shopDto);
|
|
|
- methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
|
- if(!flag){
|
|
|
+ methodHtByteTask.updateHtByteInfo(flag, item, dataDto);
|
|
|
+ if (!flag) {
|
|
|
System.out.println("\n店铺信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
System.out.println("\n店铺信息处理完成。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|
|
@@ -157,10 +158,10 @@ public class HtByteTask {
|
|
|
GroupDto groupDto = JSONObject.parseObject(body, GroupDto.class);
|
|
|
//保存
|
|
|
flag = FeignFactory.levelOneServerInterface.groupDto(groupDto);
|
|
|
- methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
|
- if(!flag){
|
|
|
+ methodHtByteTask.updateHtByteInfo(flag, item, dataDto);
|
|
|
+ if (!flag) {
|
|
|
System.out.println("\n互助组信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
System.out.println("\n互助组信息处理完成。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|
|
@@ -169,10 +170,10 @@ public class HtByteTask {
|
|
|
CooperativeDto cooperativeDto = JSONObject.parseObject(body, CooperativeDto.class);
|
|
|
//保存
|
|
|
flag = FeignFactory.levelOneServerInterface.cooperativeDto(cooperativeDto);
|
|
|
- methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
|
- if(!flag){
|
|
|
+ methodHtByteTask.updateHtByteInfo(flag, item, dataDto);
|
|
|
+ if (!flag) {
|
|
|
System.out.println("\n边民合作社信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
System.out.println("\n边民合作社信息处理完成。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|
|
@@ -181,22 +182,26 @@ public class HtByteTask {
|
|
|
GoodsDto goodsDto = JSONObject.parseObject(body, GoodsDto.class);
|
|
|
//保存
|
|
|
flag = FeignFactory.levelOneServerInterface.goodsDto(goodsDto);
|
|
|
- methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
|
- if(!flag){
|
|
|
+ methodHtByteTask.updateHtByteInfo(flag, item, dataDto);
|
|
|
+ if (!flag) {
|
|
|
System.out.println("\n海关监管商品信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
- System.out.println("\n海关监管商品信息处理完成。 messageId = " + item.getMessageId() + "\n");
|
|
|
+ } else {
|
|
|
+ System.out.println("\n海关监管商品信息处理完成。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|
|
|
case "006":
|
|
|
//交易结算信息
|
|
|
HtTradeSettlement importDeclarePeople = JSONObject.parseObject(body, HtTradeSettlement.class);
|
|
|
+ if (importDeclarePeople==null||!importDeclarePeople.getIEFlag().toLowerCase().contains("i")) {
|
|
|
+ StaticLog.info("出口商品,暂时忽略:{}", body);
|
|
|
+ break;
|
|
|
+ }
|
|
|
importDeclarePeople.setFinishStatus(FinishStatus.FINISH_STATUS_ZERO.getCode()); // 默认待处理
|
|
|
importDeclarePeople.setCreateTime(new Date());
|
|
|
//保存
|
|
|
int insert = htTradeSettlementMapper.insert(importDeclarePeople);
|
|
|
long primarykey = SP.publicMapper.getPrimarykey();
|
|
|
- if(insert == 1){
|
|
|
+ if (insert == 1) {
|
|
|
//购买边民列表
|
|
|
List<HtBordersList> bordersLists = JSON.parseArray(importDeclarePeople.getBordersList(), HtBordersList.class);
|
|
|
//边民购买商品列表
|
|
@@ -207,61 +212,61 @@ public class HtByteTask {
|
|
|
String platSeqNo = importDeclarePeople.getPlatSeqNo();
|
|
|
//保存购买边民
|
|
|
List<BordersListDto> bordersListDtoList = new ArrayList<>();
|
|
|
- if(bordersLists.size() > 0){
|
|
|
+ if (bordersLists.size() > 0) {
|
|
|
bordersLists.forEach(t -> {
|
|
|
// t.setCreateTime(new Date());
|
|
|
// t.setFinishStatus(FinishStatus.FINISH_STATUS_ZERO.getCode());
|
|
|
// htBordersListMapper.insert(t);
|
|
|
BordersListDto bordersListDto = new BordersListDto();
|
|
|
- BeanUtils.copyProperties(t,bordersListDto);
|
|
|
+ BeanUtils.copyProperties(t, bordersListDto);
|
|
|
bordersListDtoList.add(bordersListDto);
|
|
|
});
|
|
|
- /**
|
|
|
- * 接收订单推送消息,边民进行交易确认,支付申请,刷脸认证,系统发起进行交易
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * 接收订单推送消息,边民进行交易确认,支付申请,刷脸认证,系统发起进行交易
|
|
|
+ */
|
|
|
List<HtBordersList> htBordersLists = htBordersListMapper.selectList(new LambdaQueryWrapper<HtBordersList>().eq(HtBordersList::getPlatSeqNo, platSeqNo));
|
|
|
methodHtByteTask.sendMessageToPeople(htBordersLists);
|
|
|
}
|
|
|
//保存边民购买商品
|
|
|
List<BorderBuyGoodsListDto> borderBuyGoodsListDtoList = new ArrayList<>();
|
|
|
- if(buyGoodsList.size() > 0){
|
|
|
+ if (buyGoodsList.size() > 0) {
|
|
|
buyGoodsList.forEach(t -> {
|
|
|
// t.setCreateTime(new Date());
|
|
|
// t.setFinishStatus(FinishStatus.FINISH_STATUS_ZERO.getCode());
|
|
|
// htBorderBuyGoodsListMapper.insert(t);
|
|
|
BorderBuyGoodsListDto borderBuyGoodsListDto = new BorderBuyGoodsListDto();
|
|
|
- BeanUtils.copyProperties(t,borderBuyGoodsListDto);
|
|
|
+ BeanUtils.copyProperties(t, borderBuyGoodsListDto);
|
|
|
borderBuyGoodsListDtoList.add(borderBuyGoodsListDto);
|
|
|
});
|
|
|
// ???
|
|
|
}
|
|
|
//保存商铺卖货物
|
|
|
List<SellGoodsListDto> sellGoodsListDtoList = new ArrayList<>();
|
|
|
- if(htSellGoodsList.size() > 0){
|
|
|
+ if (htSellGoodsList.size() > 0) {
|
|
|
htSellGoodsList.forEach(t -> {
|
|
|
// t.setCreateTime(new Date());
|
|
|
// t.setFinishStatus(FinishStatus.FINISH_STATUS_ZERO.getCode());
|
|
|
// htSellGoodsListMapper.insert(t);
|
|
|
SellGoodsListDto sellGoodsListDto = new SellGoodsListDto();
|
|
|
- BeanUtils.copyProperties(t,sellGoodsListDto);
|
|
|
+ BeanUtils.copyProperties(t, sellGoodsListDto);
|
|
|
sellGoodsListDtoList.add(sellGoodsListDto);
|
|
|
});
|
|
|
// ???
|
|
|
}
|
|
|
//保存航通监听记录
|
|
|
- methodHtByteTask.updateHtByteInfo(true,item,dataDto);
|
|
|
+ methodHtByteTask.updateHtByteInfo(true, item, dataDto);
|
|
|
TradeSettlementDto tradeSettlementDto = new TradeSettlementDto();
|
|
|
- BeanUtils.copyProperties(importDeclarePeople,tradeSettlementDto);
|
|
|
+ BeanUtils.copyProperties(importDeclarePeople, tradeSettlementDto);
|
|
|
tradeSettlementDto.setId(primarykey);
|
|
|
tradeSettlementDto.setBordersListDtoList(bordersListDtoList);
|
|
|
tradeSettlementDto.setBorderBuyGoodsListDtoList(borderBuyGoodsListDtoList);
|
|
|
- boolean b = levelOneServerInterface.tradeSettlementDto(tradeSettlementDto);
|
|
|
- if(!b)throw new ServiceException("添加错误;");
|
|
|
+ boolean b = FeignFactory.levelOneServerInterface.tradeSettlementDto(tradeSettlementDto);
|
|
|
+ if (!b) throw new ServiceException("添加错误;");
|
|
|
System.out.println("\n交易结算信息处理成功。 messageId = " + item.getMessageId() + "\n");
|
|
|
break;
|
|
|
}
|
|
|
//保存航通监听记录
|
|
|
- methodHtByteTask.updateHtByteInfo(false,item,dataDto);
|
|
|
+ methodHtByteTask.updateHtByteInfo(false, item, dataDto);
|
|
|
System.out.println("\n交易结算信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
break;
|
|
|
case "007":
|
|
@@ -271,10 +276,10 @@ public class HtByteTask {
|
|
|
htPassCardRecord.setCreateTime(new Date());
|
|
|
//保存
|
|
|
int insert1 = htPassCardRecordMapper.insert(htPassCardRecord);
|
|
|
- methodHtByteTask.updateHtByteInfo(true,item,dataDto);
|
|
|
- if(insert1 == 1){
|
|
|
+ methodHtByteTask.updateHtByteInfo(true, item, dataDto);
|
|
|
+ if (insert1 == 1) {
|
|
|
System.out.println("\n放行记录(过卡记录)信息处理成功。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
System.out.println("\n放行记录(过卡记录)信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|
|
@@ -284,10 +289,10 @@ public class HtByteTask {
|
|
|
htImportDeclarePeople.setFinishStatus(FinishStatus.FINISH_STATUS_ZERO.getCode());
|
|
|
htImportDeclarePeople.setCreateTime(new Date());
|
|
|
int insert2 = htImportDeclarePeopleMapper.insert(htImportDeclarePeople);
|
|
|
- methodHtByteTask.updateHtByteInfo(insert2 == 1,item,dataDto);
|
|
|
- if(insert2 == 1){
|
|
|
+ methodHtByteTask.updateHtByteInfo(insert2 == 1, item, dataDto);
|
|
|
+ if (insert2 == 1) {
|
|
|
System.out.println("\n进口申报单边民确认信息处理成功。 messageId = " + item.getMessageId() + "\n");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
System.out.println("\n进口申报单边民确认信息处理失败。 messageId = " + item.getMessageId() + "\n");
|
|
|
}
|
|
|
break;
|