|
@@ -3,17 +3,14 @@ package com.pj.task;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
-import com.pj.api.client.async_server.AsyncServerInterface;
|
|
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
-import com.pj.api.client.transport.TransportInterface;
|
|
|
|
import com.pj.api.dto.*;
|
|
import com.pj.api.dto.*;
|
|
import com.pj.common.core.exception.ServiceException;
|
|
import com.pj.common.core.exception.ServiceException;
|
|
import com.pj.dto.DataDto;
|
|
import com.pj.dto.DataDto;
|
|
-import com.pj.enummj.DataType;
|
|
|
|
|
|
+import com.pj.api.dto.HtGoodsDto;
|
|
import com.pj.enummj.FinishStatus;
|
|
import com.pj.enummj.FinishStatus;
|
|
-import com.pj.ht_border_buy_goods_list.HtBorderBuyGoodsList;
|
|
|
|
|
|
+import com.pj.feign.AmqpTemplateFeign;
|
|
import com.pj.ht_border_buy_goods_list.HtBorderBuyGoodsListMapper;
|
|
import com.pj.ht_border_buy_goods_list.HtBorderBuyGoodsListMapper;
|
|
-import com.pj.ht_borders_list.HtBordersList;
|
|
|
|
import com.pj.ht_borders_list.HtBordersListMapper;
|
|
import com.pj.ht_borders_list.HtBordersListMapper;
|
|
import com.pj.ht_byte.HtByte;
|
|
import com.pj.ht_byte.HtByte;
|
|
import com.pj.ht_byte.HtByteMapper;
|
|
import com.pj.ht_byte.HtByteMapper;
|
|
@@ -21,7 +18,6 @@ import com.pj.ht_import_declare_people.HtImportDeclarePeople;
|
|
import com.pj.ht_import_declare_people.HtImportDeclarePeopleMapper;
|
|
import com.pj.ht_import_declare_people.HtImportDeclarePeopleMapper;
|
|
import com.pj.ht_pass_card_record.HtPassCardRecord;
|
|
import com.pj.ht_pass_card_record.HtPassCardRecord;
|
|
import com.pj.ht_pass_card_record.HtPassCardRecordMapper;
|
|
import com.pj.ht_pass_card_record.HtPassCardRecordMapper;
|
|
-import com.pj.ht_sell_goods_list.HtSellGoodsList;
|
|
|
|
import com.pj.ht_sell_goods_list.HtSellGoodsListMapper;
|
|
import com.pj.ht_sell_goods_list.HtSellGoodsListMapper;
|
|
import com.pj.ht_trade_settlement.HtTradeSettlement;
|
|
import com.pj.ht_trade_settlement.HtTradeSettlement;
|
|
import com.pj.ht_trade_settlement.HtTradeSettlementMapper;
|
|
import com.pj.ht_trade_settlement.HtTradeSettlementMapper;
|
|
@@ -36,7 +32,6 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -95,6 +90,11 @@ public class HtByteTask {
|
|
*/
|
|
*/
|
|
@Autowired
|
|
@Autowired
|
|
private HtSellGoodsListMapper htSellGoodsListMapper;
|
|
private HtSellGoodsListMapper htSellGoodsListMapper;
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ @Autowired
|
|
|
|
+ private AmqpTemplateFeign amqpTemplateFeign;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 启动定时任务
|
|
* 启动定时任务
|
|
@@ -111,20 +111,23 @@ public class HtByteTask {
|
|
@Scheduled(cron = "*/9 * * * * ?") // 测试阶段,每9秒扫描一次
|
|
@Scheduled(cron = "*/9 * * * * ?") // 测试阶段,每9秒扫描一次
|
|
private void htByteTask(){
|
|
private void htByteTask(){
|
|
/* 测试mq */
|
|
/* 测试mq */
|
|
-// OrderDto orderDtoById = levelOneServerInterface.getOrderDtoById(8833342005355478419L);
|
|
|
|
|
|
+// OrderDto orderDtoById = levelOneServerInterface.getOrderDtoById(4L);
|
|
// asyncServerInterface.sendLevelOneOrderDto(orderDtoById, DataType.DATA_TYPE_ONE.getCode());
|
|
// asyncServerInterface.sendLevelOneOrderDto(orderDtoById, DataType.DATA_TYPE_ONE.getCode());
|
|
|
|
+
|
|
/* 测试mq */
|
|
/* 测试mq */
|
|
- //扫描表内是否有待处理任务
|
|
|
|
|
|
+// 扫描表内是否有待处理任务
|
|
List<HtByte> byteList = htByteMapper.selectList(new LambdaQueryWrapper<HtByte>().eq(HtByte::getFinishStatus, FinishStatus.FINISH_STATUS_ZERO.getCode()));
|
|
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");
|
|
System.out.println("\n --- 暂无待处理任务。" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- //执行任务处理流程
|
|
|
|
|
|
+// 执行任务处理流程
|
|
byteList.forEach(item -> {
|
|
byteList.forEach(item -> {
|
|
//对象转换
|
|
//对象转换
|
|
DataDto dataDto = JSONObject.parseObject(item.getBody(), DataDto.class);
|
|
DataDto dataDto = JSONObject.parseObject(item.getBody(), DataDto.class);
|
|
|
|
+ //todo: 届时开启该数据校验
|
|
|
|
+// amqpTemplateFeign.verifyContent(dataDto);
|
|
//数据解析
|
|
//数据解析
|
|
String body = AESUtil.decryptCBC(dataDto.getData(), RabbitMQ.ACC_KEY);
|
|
String body = AESUtil.decryptCBC(dataDto.getData(), RabbitMQ.ACC_KEY);
|
|
//数据处理完成状态
|
|
//数据处理完成状态
|
|
@@ -133,7 +136,7 @@ public class HtByteTask {
|
|
switch (dataDto.getDataType()){
|
|
switch (dataDto.getDataType()){
|
|
case "001":
|
|
case "001":
|
|
//对象转换
|
|
//对象转换
|
|
- PeopleDto peopleDto = JSONObject.parseObject(body, PeopleDto.class);
|
|
|
|
|
|
+ HtPeopleDto peopleDto = JSONObject.parseObject(body, HtPeopleDto.class);
|
|
//根据其内的身份证,有则新增,无则修改???
|
|
//根据其内的身份证,有则新增,无则修改???
|
|
flag = levelOneServerInterface.peopleDto(peopleDto);
|
|
flag = levelOneServerInterface.peopleDto(peopleDto);
|
|
methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
@@ -181,7 +184,7 @@ public class HtByteTask {
|
|
break;
|
|
break;
|
|
case "005":
|
|
case "005":
|
|
//商品基础信息
|
|
//商品基础信息
|
|
- GoodsDto goodsDto = JSONObject.parseObject(body, GoodsDto.class);
|
|
|
|
|
|
+ HtGoodsDto goodsDto = JSONObject.parseObject(body, HtGoodsDto.class);
|
|
//保存
|
|
//保存
|
|
flag = levelOneServerInterface.goodsDto(goodsDto);
|
|
flag = levelOneServerInterface.goodsDto(goodsDto);
|
|
methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
methodHtByteTask.updateHtByteInfo(flag,item,dataDto);
|
|
@@ -201,63 +204,18 @@ public class HtByteTask {
|
|
long primarykey = SP.publicMapper.getPrimarykey();
|
|
long primarykey = SP.publicMapper.getPrimarykey();
|
|
if(insert == 1){
|
|
if(insert == 1){
|
|
//购买边民列表
|
|
//购买边民列表
|
|
- List<HtBordersList> bordersLists = JSON.parseArray(importDeclarePeople.getBordersList(), HtBordersList.class);
|
|
|
|
|
|
+ List<BordersListDto> bordersLists = JSON.parseArray(importDeclarePeople.getBordersList(), BordersListDto.class);
|
|
//边民购买商品列表
|
|
//边民购买商品列表
|
|
- List<HtBorderBuyGoodsList> buyGoodsList = JSON.parseArray(importDeclarePeople.getBorderBuyGoodsList(), HtBorderBuyGoodsList.class);
|
|
|
|
|
|
+ List<BorderBuyGoodsListDto> buyGoodsList = JSON.parseArray(importDeclarePeople.getBorderBuyGoodsList(), BorderBuyGoodsListDto.class);
|
|
//商铺卖货物列表
|
|
//商铺卖货物列表
|
|
- List<HtSellGoodsList> htSellGoodsList = JSON.parseArray(importDeclarePeople.getSellGoodsList(), HtSellGoodsList.class);
|
|
|
|
- //航通关联主键
|
|
|
|
- String platSeqNo = importDeclarePeople.getPlatSeqNo();
|
|
|
|
- //保存购买边民
|
|
|
|
- List<BordersListDto> bordersListDtoList = new ArrayList<>();
|
|
|
|
- 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);
|
|
|
|
- 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){
|
|
|
|
- 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);
|
|
|
|
- borderBuyGoodsListDtoList.add(borderBuyGoodsListDto);
|
|
|
|
- });
|
|
|
|
- // ???
|
|
|
|
- }
|
|
|
|
- //保存商铺卖货物
|
|
|
|
- List<SellGoodsListDto> sellGoodsListDtoList = new ArrayList<>();
|
|
|
|
- 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);
|
|
|
|
- sellGoodsListDtoList.add(sellGoodsListDto);
|
|
|
|
- });
|
|
|
|
- // ???
|
|
|
|
- }
|
|
|
|
|
|
+// List<SellGoodsListDto> htSellGoodsList = JSON.parseArray(importDeclarePeople.getSellGoodsList(), SellGoodsListDto.class);
|
|
//保存航通监听记录
|
|
//保存航通监听记录
|
|
methodHtByteTask.updateHtByteInfo(true,item,dataDto);
|
|
methodHtByteTask.updateHtByteInfo(true,item,dataDto);
|
|
TradeSettlementDto tradeSettlementDto = new TradeSettlementDto();
|
|
TradeSettlementDto tradeSettlementDto = new TradeSettlementDto();
|
|
BeanUtils.copyProperties(importDeclarePeople,tradeSettlementDto);
|
|
BeanUtils.copyProperties(importDeclarePeople,tradeSettlementDto);
|
|
tradeSettlementDto.setId(primarykey);
|
|
tradeSettlementDto.setId(primarykey);
|
|
- tradeSettlementDto.setBordersListDtoList(bordersListDtoList);
|
|
|
|
- tradeSettlementDto.setBorderBuyGoodsListDtoList(borderBuyGoodsListDtoList);
|
|
|
|
|
|
+ tradeSettlementDto.setBordersListDtoList(bordersLists);
|
|
|
|
+ tradeSettlementDto.setBorderBuyGoodsListDtoList(buyGoodsList);
|
|
boolean b = levelOneServerInterface.tradeSettlementDto(tradeSettlementDto);
|
|
boolean b = levelOneServerInterface.tradeSettlementDto(tradeSettlementDto);
|
|
if(!b)throw new ServiceException("添加错误;");
|
|
if(!b)throw new ServiceException("添加错误;");
|
|
System.out.println("\n交易结算信息处理成功。 messageId = " + item.getMessageId() + "\n");
|
|
System.out.println("\n交易结算信息处理成功。 messageId = " + item.getMessageId() + "\n");
|