Browse Source

8.25 航通基础数据初步对接

Mechrevo 1 year ago
parent
commit
7dc7006365

+ 1 - 6
sp-core/sp-api/src/main/java/com/pj/api/dto/GroupDto.java

@@ -1,7 +1,6 @@
 package com.pj.api.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.sun.istack.internal.NotNull;
 
 import java.util.Date;
 
@@ -31,13 +30,11 @@ public class GroupDto {
     /**
      * 组名称
      */
-    @NotNull
     private String name;
 
     /**
      * 组长ID
      */
-    @NotNull
     private Long leaderId;
 
     /**
@@ -63,7 +60,6 @@ public class GroupDto {
     /**
      * 创建时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date createTime;
 
     /**
@@ -79,7 +75,6 @@ public class GroupDto {
     /**
      * 更新时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date updateTime;
 
     /**
@@ -240,7 +235,7 @@ public class GroupDto {
         this.isLock = isLock;
     }
 
-    public GroupDto( String addressIds, String address, String detailAddress, String name, Long leaderId, String leaderName, String leaderPhone, String code, Double leftPrice, Date createTime, String createBy, String createName, Date updateTime, String updateBy, String updateName, Integer deleteStatus, Integer isLock) {
+    public GroupDto(String addressIds, String address, String detailAddress, String name, Long leaderId, String leaderName, String leaderPhone, String code, Double leftPrice, Date createTime, String createBy, String createName, Date updateTime, String updateBy, String updateName, Integer deleteStatus, Integer isLock) {
         this.addressIds = addressIds;
         this.address = address;
         this.detailAddress = detailAddress;

+ 0 - 1
sp-core/sp-base/pom.xml

@@ -29,7 +29,6 @@
 		<!-- ================= 模块依赖 end ================= -->
 
 
-
         <!-- 阿里云短信服务 -->
         <dependency>
             <groupId>com.aliyun</groupId>

+ 51 - 0
sp-core/sp-base/src/main/java/com/pj/utils/MD5.java

@@ -0,0 +1,51 @@
+package com.pj.utils;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Random;
+
+public class MD5 {
+
+	public static String getMd5(String plainText,int length) {
+		try {
+			MessageDigest md = MessageDigest.getInstance("MD5");
+			md.update(plainText.getBytes());
+			byte b[] = md.digest();
+
+			int i;
+
+			StringBuffer buf = new StringBuffer("");
+			for (int offset = 0; offset < b.length; offset++) {
+				i = b[offset];
+				if (i < 0)
+					i += 256;
+				if (i < 16)
+					buf.append("0");
+				buf.append(Integer.toHexString(i));
+			}
+			// 32位
+			// return buf.toString();
+			// 16位
+			// return buf.toString().substring(0, 16);
+			
+			return buf.toString().substring(0, length);
+		} catch (NoSuchAlgorithmException e) {
+			e.printStackTrace();
+			return null;
+		}
+
+	}
+
+	public static int getRandomCode(){		
+		int max=9999;
+        int min=1111;
+        Random random = new Random();
+        return random.nextInt(max)%(max-min+1) + min;		
+	}
+
+	public static void main(String[] args) {
+		System.out.println(MD5.getMd5("msgId=123&appId=shop&dataType=001&msgTime=2023-08-24 14:00:00&data=Gkbl4xlhryQQ123tXiyDEeC4MB3HmcSrUwfpUICLC88=&12345678abcdefgh",32));
+		System.out.println(getRandomCode());
+	}
+
+}

+ 6 - 0
sp-service/async-server/pom.xml

@@ -21,6 +21,12 @@
             <artifactId>sp-base</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+<!--            <version>2.2.14.RELEASE</version>-->
+        </dependency>
     </dependencies>
 
 

+ 3 - 0
sp-service/async-server/src/main/java/com/pj/bo/PersonBO.java

@@ -6,6 +6,9 @@ import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 
+/**
+ * 边民信息
+ */
 @NoArgsConstructor
 @Data
 public class PersonBO implements Serializable {

+ 154 - 0
sp-service/async-server/src/main/java/com/pj/bo/ShopBO.java

@@ -0,0 +1,154 @@
+package com.pj.bo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 商铺信息
+ */
+@NoArgsConstructor
+@Data
+public class ShopBO implements Serializable {
+    /**
+     * 地方平台的内部业务编号
+     */
+    @JsonProperty("platSeqNo")
+    private String platSeqNo;
+    /**
+     *商铺名称
+     */
+    @JsonProperty("shopName")
+    private String shopName;
+    /**
+     *商铺编码
+     */
+    @JsonProperty("shopNo")
+    private String shopNo;
+    /**
+     *监管场所编号
+     */
+    @JsonProperty("fieldCode")
+    private String fieldCode;
+    /**
+     *监管场所名称
+     */
+    @JsonProperty("fieldName")
+    private String fieldName;
+    /**
+     *关区代码
+     */
+    @JsonProperty("customsCode")
+    private String customsCode;
+    /**
+     *营业执照号或社会信用统一代码
+     */
+    @JsonProperty("shopSccd")
+    private String shopSccd;
+    /**
+     *经营范围
+     */
+    @JsonProperty("bnsScope")
+    private String bnsScope;
+    /**
+     *铺主姓名
+     */
+    @JsonProperty("ownerName")
+    private String ownerName;
+    /**
+     *铺主证件类型 01:身份证 02 护照
+     */
+    @JsonProperty("ownerIdtype")
+    private String ownerIdtype;
+    /**
+     * 铺主联系方式
+     */
+    @JsonProperty("ownerTel")
+    private String ownerTel;
+    /**
+     * 店铺地址
+     */
+    @JsonProperty("shopAddr")
+    private String shopAddr;
+    /**
+     * 商铺类型:1-中方 商铺 2-外国商铺
+     */
+    @JsonProperty("shopType")
+    private String shopType;
+    /**
+     * 启停用状态: 1- 启用 2-停用 3-注销
+     */
+    @JsonProperty("eDStatus")
+    private String eDStatus;
+
+    /**
+     * 有 效 效 截 止 时 间
+     */
+    @JsonProperty("expiry")
+    private String expiry;
+    /**
+     * 备案编号,如果为
+     * 新增备案,传空值;
+     * 如果为变更备案,
+     * 必须传值;
+     */
+    @JsonProperty("putrecNo")
+    private String putrecNo;
+    /**
+     * 代理人姓名:商铺
+     * 类型为外方商铺时
+     * 必填
+     */
+    @JsonProperty("agentName")
+    private String agentName;
+    /**
+     * 代理人联系方式:
+     * 商铺类型为外方商
+     * 铺时必填
+     */
+    @JsonProperty("agentTel")
+    private String agentTel;
+    /**
+     * 代理人证件类型:
+     * 01-身份证,02-护
+     * 照
+     * 商铺类型为外方商
+     * 铺时必填,默认为
+     * 身份证
+     */
+    @JsonProperty("agentIdtype")
+    private String agentIdtype;
+
+    /**
+     * 代理人身份证:商
+     * 铺类型为外方商铺
+     * 时必填
+     */
+    @JsonProperty("agentCiphertextIdno")
+    private String agentCiphertextIdno;
+    /**
+     * 地方政府编号
+     */
+    @JsonProperty("localGovernmentNo")
+    private String localGovernmentNo;
+    /**
+     * 备案状态:默认 0、
+     * 待申报,1、已申报,
+     * 2、备案通过,3、
+     * 备案失败
+     */
+    @JsonProperty("filingStatus")
+    private String filingStatus;
+    /**
+     * 店铺开户行
+     */
+    @JsonProperty("bank")
+    private String bank;
+    /**
+     * 店铺开户行账号
+     */
+    @JsonProperty("bankAccount")
+    private String bankAccount;
+}

+ 52 - 0
sp-service/async-server/src/main/java/com/pj/dto/DataDto.java

@@ -0,0 +1,52 @@
+package com.pj.dto;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 08 25 13 03
+ **/
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class DataDto {
+
+    /**
+     * 报文 ID,唯一标识,每个报文的 ID 都不一样
+     */
+    @JsonProperty("msgId")
+    private String msgId;
+
+    /**
+     * 接入方 ID
+     */
+    @JsonProperty("appId")
+    private String appId;
+
+    /**
+     * 报文类型
+     */
+    @JsonProperty("dataType")
+    private String dataType;
+
+    /**
+     *  报文生成时间
+     */
+    @JsonProperty("msgTime")
+    private String msgTime;
+
+    /**
+     * 签名
+     */
+    @JsonProperty("sign")
+    private String sign;
+
+    /**
+     * 报文内容密文
+     */
+    @JsonProperty("data")
+    private String data;
+}

+ 95 - 0
sp-service/async-server/src/main/java/com/pj/ht_bytes/HtBytes.java

@@ -0,0 +1,95 @@
+package com.pj.ht_bytes;
+
+import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: ht_bytes -- ht数据备份
+ * @author yzs 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(HtBytes.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class HtBytes extends Model<HtBytes> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "ht_bytes";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "ht-bytes";
+	public static final String PERMISSION_CODE_ADD = "ht-bytes-add";
+	public static final String PERMISSION_CODE_EDIT = "ht-bytes-edit";
+	public static final String PERMISSION_CODE_DEL = "ht-bytes-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 航通数据字节表ID 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 * 报文 ID,唯一标识,每个报文的 ID 都不一样 
+	 */
+	private String msgId;	
+
+	/**
+	 * 接入方ID 
+	 */
+	private String appId;	
+
+	/**
+	 * 报文类型 
+	 */
+	private String dataType;	
+
+	/**
+	 * 报文生成时间 
+	 */
+	private String msgTime;	
+
+	/**
+	 * 签名 
+	 */
+	private String sign;	
+
+	/**
+	 * 报文内容密文 
+	 */
+	private String data;	
+
+	/**
+	 * 队列名称 
+	 */
+	private String queueName;	
+
+	/**
+	 * 创建时间 
+	 */
+	private String createTime;	
+
+
+
+
+
+	
+
+
+}

+ 85 - 0
sp-service/async-server/src/main/java/com/pj/ht_bytes/HtBytesController.java

@@ -0,0 +1,85 @@
+package com.pj.ht_bytes;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: ht_bytes -- ht数据备份
+ * @author yzs 
+ */
+@RestController
+@RequestMapping("/HtBytes/")
+public class HtBytesController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	HtBytesService htBytesService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(HtBytes.PERMISSION_CODE_ADD)
+	public AjaxJson add(HtBytes h){
+		htBytesService.add(h);
+		h = htBytesService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(h);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(HtBytes.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 htBytesService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(HtBytes.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(HtBytes.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(HtBytes.PERMISSION_CODE_EDIT)
+	public AjaxJson update(HtBytes h){
+		htBytesService.update(h);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(HtBytes.PERMISSION_CODE)
+	public AjaxJson getById(Long id){
+		HtBytes h = htBytesService.getById(id);
+		return AjaxJson.getSuccessData(h);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+		@SaCheckPermission(HtBytes.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<HtBytes> list = htBytesService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+
+	
+	
+	
+
+}

+ 30 - 0
sp-service/async-server/src/main/java/com/pj/ht_bytes/HtBytesMapper.java

@@ -0,0 +1,30 @@
+package com.pj.ht_bytes;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: ht_bytes -- ht数据备份
+ * @author yzs 
+ */
+
+@Mapper
+@Repository
+public interface HtBytesMapper extends BaseMapper <HtBytes> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<HtBytes> getList(SoMap so);
+
+
+}

+ 59 - 0
sp-service/async-server/src/main/java/com/pj/ht_bytes/HtBytesMapper.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.ht_bytes.HtBytesMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, msgId, appId, dataType, msgTime, sign, data, queue_name, create_time from ht_bytes  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.ht_bytes.HtBytes"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from ht_bytes 
+	</sql>
+
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("msgId") '> and msgId = #{msgId} </if>
+			<if test=' this.has("appId") '> and appId = #{appId} </if>
+			<if test=' this.has("dataType") '> and dataType = #{dataType} </if>
+			<if test=' this.has("msgTime") '> and msgTime = #{msgTime} </if>
+			<if test=' this.has("sign") '> and sign = #{sign} </if>
+			<if test=' this.has("data") '> and data = #{data} </if>
+			<if test=' this.has("queueName") '> and queue_name = #{queueName} </if>
+			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> msgId desc </when>
+			<when test='sortType == 3'> appId desc </when>
+			<when test='sortType == 4'> dataType desc </when>
+			<when test='sortType == 5'> msgTime desc </when>
+			<when test='sortType == 6'> sign desc </when>
+			<when test='sortType == 7'> data desc </when>
+			<when test='sortType == 8'> queue_name desc </when>
+			<when test='sortType == 9'> create_time desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 50 - 0
sp-service/async-server/src/main/java/com/pj/ht_bytes/HtBytesService.java

@@ -0,0 +1,50 @@
+package com.pj.ht_bytes;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Service: ht_bytes -- ht数据备份
+ * @author yzs 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class HtBytesService extends ServiceImpl<HtBytesMapper, HtBytes> implements IService<HtBytes>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	HtBytesMapper htBytesMapper;
+
+	/** 增 */
+	void add(HtBytes h){
+		save(h);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(HtBytes h){
+		updateById(h);
+
+	}
+
+	/** 查 */
+	HtBytes getById(Long id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<HtBytes> getList(SoMap so) { 
+		return htBytesMapper.getList(so);	
+	}
+	
+
+}

+ 58 - 0
sp-service/async-server/src/main/java/com/pj/listen/BaseInfoListen.java

@@ -0,0 +1,58 @@
+package com.pj.listen;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.pj.bo.PersonBO;
+import com.pj.ht_bytes.HtBytes;
+import com.pj.ht_bytes.HtBytesMapper;
+import com.pj.rabbitmq.RabbitMQ;
+import com.pj.service.ObjectService;
+import com.pj.utils.ht.AESUtil;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 08 25 12 30
+ **/
+@Component
+public class BaseInfoListen {
+
+    @Autowired
+    private ObjectService objectService;
+
+    /**
+     * 保存航通传过来的字节
+     */
+    @Autowired
+    private HtBytesMapper htBytesMapper;
+
+
+    /**
+     * 接收: 信息同步
+     * @param json
+     */
+    @RabbitListener(queuesToDeclare = @Queue(RabbitMQ.TEST_SEND_QUEUE))
+    public void accept(Message json){
+        System.out.println("\n发送:信息同步\n");
+        byte[] content = json.getBody();
+        //保存到数据库
+        String jsonString = new String(content);
+        //数据转换
+        HtBytes htBytes = JSONObject.parseObject(jsonString, HtBytes.class);
+        htBytes.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
+        htBytes.setQueueName(RabbitMQ.TEST_SEND_QUEUE);
+        //保存到数据库
+        htBytesMapper.insert(htBytes);
+        //匹配类型,方法调用
+        objectService.saveEntityByType(htBytes);
+
+    }
+
+
+}

+ 54 - 0
sp-service/async-server/src/main/java/com/pj/rabbitmq/RabbitMQ.java

@@ -0,0 +1,54 @@
+package com.pj.rabbitmq;
+
+/**
+ * MQ的基本配置
+ * @Author Mechrevo
+ * @Date 2023 08 25 12 14
+ **/
+public class RabbitMQ {
+
+    //todo: 注意: 站在航通考虑的,航通发数据给我们就是send , 我们发数据过去给航通就是accept
+
+    public static final String ACC_KEY = "klfksd78974s1d4f";
+
+
+    /**
+     *  发送方队列
+     */
+    public static final String TEST_SEND_QUEUE = "testSend";
+
+    /**
+     *  发送方路由键
+     */
+    public static final String TEST_SEND_ROUTING_KEY = "testSendKey";
+
+    /**
+     *  接收方队列
+     */
+    public static final String TEST_ACCEPT_QUEUE = "testAccept";
+
+    /**
+     *  接收方路由键
+     */
+    public static final String TEST_ACCEPT_ROUTING_KEY = "testAcceptKey";
+
+    /**
+     *  发送方MQ地址
+     */
+    public static final String MQ_ADDRESS = "192.168.0.23";
+
+    /**
+     *  发送方MQ账号
+     */
+    public static final String MQ_SEND_USERNAME = "hdx";
+
+    /**
+     *  发送方MQ密码
+     */
+    public static final String MQ_SEND_PASSWORD = "hdx";
+    /**
+     *  发送方MQ交换机名称
+     */
+    public static final String MQ_DIRECT_EXCHANGE = "test_exchange";
+
+}

+ 66 - 0
sp-service/async-server/src/main/java/com/pj/rabbitmq/RabbitmqConfig.java

@@ -0,0 +1,66 @@
+package com.pj.rabbitmq;
+
+import org.springframework.amqp.core.Binding;
+import org.springframework.amqp.core.BindingBuilder;
+import org.springframework.amqp.core.DirectExchange;
+import org.springframework.amqp.core.Queue;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+
+
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 08 25 12 21
+ **/
+@Configuration
+public class RabbitmqConfig {
+
+
+    /**
+     * 发送时的mq队列
+     * @return
+     */
+    @Bean
+    public Queue testSend(){
+        return new Queue(RabbitMQ.TEST_SEND_QUEUE,true);
+    }
+
+    /**
+     * 接收时的mq队列
+     * @return
+     */
+    @Bean
+    public Queue testAccept(){
+        return new Queue(RabbitMQ.TEST_ACCEPT_QUEUE,true);
+    }
+
+    /**
+     * 交换机
+     * @return
+     */
+    @Bean
+    public DirectExchange directExchange(){
+        return new DirectExchange(RabbitMQ.MQ_DIRECT_EXCHANGE,true,false);
+    }
+
+    /**
+     * 绑定
+     * 发送
+     */
+    @Bean
+    public Binding bindingSend(){
+        return BindingBuilder.bind(testSend()).to(directExchange()).with(RabbitMQ.TEST_SEND_ROUTING_KEY);
+    }
+
+    /**
+     * 绑定
+     * 接收
+     */
+    @Bean
+    public Binding bindingAccept(){
+        return BindingBuilder.bind(testAccept()).to(directExchange()).with(RabbitMQ.TEST_ACCEPT_ROUTING_KEY);
+    }
+
+}

+ 67 - 0
sp-service/async-server/src/main/java/com/pj/service/ObjectService.java

@@ -0,0 +1,67 @@
+package com.pj.service;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.pj.bo.PersonBO;
+import com.pj.ht_bytes.HtBytes;
+import com.pj.rabbitmq.RabbitMQ;
+import com.pj.utils.ht.AESUtil;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Mechrevo
+ * @Date 2023 08 25 15 48
+ **/
+@Service
+public class ObjectService {
+
+
+    /**
+     * 报文类型
+     * 001=边民备案
+     * 002=商铺备案
+     * 003=边民互助组备案
+     * 004=边民合作社备案
+     * 005=车辆
+     * 006=进境申报单
+     * 007=进口申报单
+     * @param htBytes
+     */
+    public void saveEntityByType(HtBytes htBytes){
+        //数据解析
+        String decrypt = AESUtil.decryptCBC(htBytes.getData(), RabbitMQ.ACC_KEY);
+        //身份证是唯一的,有身份证就是修改,没有就是新增
+        // 根据类型匹配对象
+        switch (htBytes.getDataType()){
+            case "001":
+                //对象转换
+                PersonBO personBO = JSONObject.parseObject(decrypt, PersonBO.class);
+                break;
+            case "002":
+                //商铺备案
+
+                break;
+            case "003":
+                //边民互助组备案
+
+                break;
+            case "004":
+                //边民合作社备案
+
+                break;
+            case "005":
+                //车辆
+
+                break;
+            case "006":
+                //进境申报单
+
+                break;
+            case "007":
+                //进口申报单
+
+                break;
+        }
+
+    }
+
+}