Forráskód Böngészése

新增基础表功能

wangqian 1 hete
szülő
commit
22b319fee7

+ 128 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/controller/BaseCodeController.java

@@ -0,0 +1,128 @@
+package cn.gov.customs.wxjy.base.controller;
+
+
+import cn.gov.customs.cacp.sdks.core.result.Result;
+import cn.gov.customs.wxjy.base.pojo.*;
+import cn.gov.customs.wxjy.base.service.BaseCodeService;
+import com.alibaba.fastjson2.JSONObject;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @author wq
+ * @since 2025/11/5 17:16
+ */
+@RestController
+@RequestMapping("/baseCode")
+@RequiredArgsConstructor
+public class BaseCodeController {
+	private final BaseCodeService service;
+
+	/** 国家地区 */
+	private static final String WORLD = "world";
+	/** 机构信息 6位机构代码 */
+	private static final String ORGANIZE = "organize";
+	/** 机构信息 8位或10位机构代码 */
+	private static final String ORGANIZE_8 = "organize8";
+	/** 运输方式 */
+	private static final String TRANSIT_MODE = "TransitMode";
+	/** eciq人员信息 */
+	private static final String USER = "user";
+	/** 世界主要海运贸易港口代码表 */
+	private static final String WORLD_PORT = "worldPort";
+	/** 重量单位信息 */
+	private static final String UNIT = "unit";
+	/** 口岸代码 */
+	private static final String DESP_PORT_CODE = "domesticPort";
+	/** 运输工具 */
+	private static final String TRN_VE_TYPE_REL = "trnVeTypeRel";
+	/** 包装种类 */
+	private static final String WRAP_CODE = "wrapCode";
+	/** 贸易方式 */
+	private static final String TRADE_MODE = "TradeMode";
+	/** 监管方式 */
+	private static final String TRADE_CODE = "tradeCode";
+	/** H2018国家地区代码 */
+	private static final String COUNTRY_ISO_E = "countryIsoE";
+	/** H2018国家地区代码 */
+	private static final String COUNTRY_CODE = "countryCode";
+	/** 全国关区代码 */
+	private static final String CUSTOMS_CODE = "customsCode";
+	/** H2018流程环节代码 */
+	private static final String STEP_CODE = "stepCode";
+	/** 行业种类代码代码 */
+	private static final String BUS_TYPE = "busType";
+
+	/**
+	 * 下拉数据源
+	 */
+	@GetMapping("/appBase")
+	public Result<List<JSONObject>> getList(@RequestParam String code) {
+		List<JSONObject> options = new ArrayList<>();
+		if(UNIT.equals(code)){
+			// 计量单位
+			List<Unit> list = service.getUnitList();
+			for ( Unit u: list) {
+				JSONObject json = new JSONObject();
+				json.put("value", u.getUnitCode());
+				json.put("label", u.getUnitName());
+				options.add(json);
+			}
+		} else if(TRADE_CODE.equals(code)){
+			// 监管方式
+			List<Trade> list = service.getTradeList();
+			for ( Trade  u: list) {
+				JSONObject json = new JSONObject();
+				json.put("value", u.getTradeMode());
+				json.put("label", u.getAbbrTrade());
+				options.add(json);
+			}
+		} else if(TRANSIT_MODE.equals(code)){
+			// 运输方式
+			List<Transf> list = service.getTransfList();
+			for ( Transf  u: list) {
+				JSONObject json = new JSONObject();
+				json.put("value", u.getTrafCode());
+				json.put("label", u.getTrafSpec());
+				options.add(json);
+			}
+		} else if(COUNTRY_ISO_E.equals(code)){
+			// H2018国家地区,编码为英文简称
+			List<Country> list = service.getCountryList();
+			for ( Country  u: list) {
+				JSONObject json = new JSONObject();
+				json.put("value", u.getIsoE());
+				json.put("label", u.getCounCName());
+				options.add(json);
+			}
+		} else if(COUNTRY_CODE.equals(code)){
+			// H2018国家地区,编码为数字
+			List<Country> list = service.getCountryList();
+			for ( Country  u: list) {
+				JSONObject json = new JSONObject();
+				json.put("value", u.getCountryCode());
+				json.put("label", u.getCounCName());
+				options.add(json);
+			}
+		} else if(CUSTOMS_CODE.equals(code)){
+			// 全国关区代码
+			List<Customs> list = service.getCustomsList();
+			for ( Customs  u: list) {
+				JSONObject json = new JSONObject();
+				json.put("value", u.getCustomsCode());
+				json.put("label", u.getCustomsName());
+				options.add(json);
+			}
+		}
+		return Result.success(options);
+	}
+
+}

+ 31 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/dao/BaseCodeDao.java

@@ -0,0 +1,31 @@
+package cn.gov.customs.wxjy.base.dao;
+
+import cn.gov.customs.wxjy.base.pojo.*;
+import org.apache.ibatis.annotations.Mapper;
+import java.util.List;
+
+/**
+ * @description TODO
+ * @author wq
+ * @since 2025/11/5 上午10:23
+ */
+@Mapper
+public interface BaseCodeDao {
+
+  List<Country> getCountryList();
+
+  List<Customs> getCustomsList();
+
+  List<Trade> getTradeList();
+
+  List<Transf> getTransfList();
+
+  List<Unit> getUnitList();
+
+  Country getCountryByIso(String isoE);
+  Country getCountryByCode(String countryCode);
+  Customs getCustomsByCode(String customsCode);
+  Trade getTradeByCode(String tradeMode);
+  Transf getTransByCode(String trafCode);
+  Unit getUnitByCode(String unitCode);
+}

+ 43 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/pojo/Country.java

@@ -0,0 +1,43 @@
+package cn.gov.customs.wxjy.base.pojo;
+
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * APP国别(地区)代码表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-18
+ */
+@Data
+public class Country implements Serializable {
+
+	/**
+	* 国家(地区)代码
+	*/
+	private String countryCode;
+	/**
+	* 国际标准英文简称
+	*/
+	private String isoE;
+	/**
+	* 中文国家(地区)名称
+	*/
+	private String counCName;
+	/**
+	* 英文国家(地区)名称
+	*/
+	private String counEName;
+	/**
+	* 中文简称
+	*/
+	private String abbrC;
+	/**
+	* 查验标记
+	*/
+	private String examMark;
+	/**
+	* 优惠/普通税率标记
+	*/
+	private String highLow;
+}

+ 26 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/pojo/Customs.java

@@ -0,0 +1,26 @@
+package cn.gov.customs.wxjy.base.pojo;
+
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * APP关区代码表
+ *
+ * @author BladeX
+ * @since 2021-11-04
+ */
+@Data
+public class Customs implements Serializable {
+	/**
+	 *关区代码
+	 */
+	private String customsCode;
+	/**
+	 *关区名称
+	 */
+	private String customsName;
+	/**
+	 *关区简称
+	 */
+	private String abbrCust;
+}

+ 26 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/pojo/Trade.java

@@ -0,0 +1,26 @@
+package cn.gov.customs.wxjy.base.pojo;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * APP监管方式代码表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-18
+ */
+@Data
+public class Trade implements Serializable {
+
+	/**
+	* 监管方式代码
+	*/
+	private String tradeMode;
+	/**
+	* 监管方式简称
+	*/
+	private String abbrTrade;
+	/**
+	* 监管方式全称
+	*/
+	private String fullTrade;
+}

+ 22 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/pojo/Transf.java

@@ -0,0 +1,22 @@
+package cn.gov.customs.wxjy.base.pojo;
+import lombok.Data;
+import java.io.Serializable;
+
+/**
+ * APP运输方式代码表实体类
+ *
+ * @author BladeX
+ * @since 2021-11-18
+ */
+@Data
+public class Transf implements Serializable {
+
+	/**
+	* 运输方式代码
+	*/
+	private String trafCode;
+	/**
+	* 运输方式名称
+	*/
+	private String trafSpec;
+}

+ 33 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/pojo/Unit.java

@@ -0,0 +1,33 @@
+package cn.gov.customs.wxjy.base.pojo;
+import lombok.Data;
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * APP计量单位代码表实体类
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+@Data
+public class Unit implements Serializable {
+
+	/**
+	* 计量单位代码
+	*/
+	private String unitCode;
+	/**
+	* 计量单位名称
+	*/
+	private String unitName;
+	/**
+	* 对应统计计量单位代码
+	*/
+	private String convCode;
+	/**
+	* 换算率
+	*/
+	private BigDecimal convRatio;
+
+
+}

+ 30 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/service/BaseCodeService.java

@@ -0,0 +1,30 @@
+package cn.gov.customs.wxjy.base.service;
+
+import cn.gov.customs.wxjy.base.pojo.*;
+
+import java.util.List;
+
+/**
+ * @description TODO
+ * @author wq
+ * @since 2025/11/5 上午10:23
+ */
+public interface BaseCodeService {
+
+  List<Country> getCountryList();
+
+  List<Customs> getCustomsList();
+
+  List<Trade> getTradeList();
+
+  List<Transf> getTransfList();
+
+  List<Unit> getUnitList();
+
+  Country getCountryByIso(String isoE);
+  Country getCountryByCode(String countryCode);
+  Customs getCustomsByCode(String customsCode);
+  Trade getTradeByCode(String tradeMode);
+  Transf getTransByCode(String trafCode);
+  Unit getUnitByCode(String unitCode);
+}

+ 75 - 0
wxjy-wxjy-service/src/main/java/cn/gov/customs/wxjy/base/service/impl/BaseCodeServiceImpl.java

@@ -0,0 +1,75 @@
+package cn.gov.customs.wxjy.base.service.impl;
+
+import cn.gov.customs.wxjy.base.dao.BaseCodeDao;
+import cn.gov.customs.wxjy.base.pojo.*;
+import cn.gov.customs.wxjy.base.service.BaseCodeService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import java.util.List;
+
+/**
+ * @description TODO
+ * @author wq
+ * @since 2025/11/5 上午10:23
+ */
+@Service
+@RequiredArgsConstructor
+public class BaseCodeServiceImpl implements BaseCodeService {
+
+  private final BaseCodeDao mapper;
+
+  @Override
+  public List<Country> getCountryList() {
+    return this.mapper.getCountryList();
+  }
+
+  @Override
+  public List<Customs> getCustomsList() {
+    return this.mapper.getCustomsList();
+  }
+
+  @Override
+  public List<Trade> getTradeList() {
+    return this.mapper.getTradeList();
+  }
+
+  @Override
+  public List<Transf> getTransfList() {
+    return this.mapper.getTransfList();
+  }
+
+  @Override
+  public List<Unit> getUnitList() {
+    return this.mapper.getUnitList();
+  }
+
+  @Override
+  public Country getCountryByIso(String isoE) {
+    return this.mapper.getCountryByIso(isoE);
+  }
+
+  @Override
+  public Country getCountryByCode(String countryCode) {
+    return this.mapper.getCountryByCode(countryCode);
+  }
+
+  @Override
+  public Customs getCustomsByCode(String customsCode) {
+    return this.mapper.getCustomsByCode(customsCode);
+  }
+
+  @Override
+  public Trade getTradeByCode(String tradeMode) {
+    return this.mapper.getTradeByCode(tradeMode);
+  }
+
+  @Override
+  public Transf getTransByCode(String trafCode) {
+    return this.mapper.getTransByCode(trafCode);
+  }
+
+  @Override
+  public Unit getUnitByCode(String unitCode) {
+    return this.mapper.getUnitByCode(unitCode);
+  }
+}

+ 81 - 0
wxjy-wxjy-service/src/main/resources/mapper/base/BaseCodeMapper.xml

@@ -0,0 +1,81 @@
+<?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="cn.gov.customs.wxjy.base.dao.BaseCodeDao">
+    <resultMap id="CountryResultMap" type="cn.gov.customs.wxjy.base.pojo.Country">
+        <id column="COUNTRY_CODE" jdbcType="VARCHAR" property="countryCode"/>
+        <result column="ISO_E" jdbcType="VARCHAR" property="isoE"/>
+        <result column="COUN_C_NAME" jdbcType="VARCHAR" property="counCName"/>
+        <result column="COUN_E_NAME" jdbcType="VARCHAR" property="counEName"/>
+        <result column="ABBR_C" jdbcType="VARCHAR" property="abbrC"/>
+        <result column="EXAM_MARK" jdbcType="VARCHAR" property="examMark"/>
+        <result column="HIGH_LOW" jdbcType="VARCHAR" property="highLow"/>
+    </resultMap>
+
+    <resultMap id="CustomsResultMap" type="cn.gov.customs.wxjy.base.pojo.Customs">
+        <id column="CUSTOMS_CODE" jdbcType="VARCHAR" property="customsCode"/>
+        <result column="CUSTOMS_NAME" jdbcType="VARCHAR" property="customsName"/>
+        <result column="ABBR_CUST" jdbcType="VARCHAR" property="abbrCust"/>
+    </resultMap>
+
+    <resultMap id="TradeResultMap" type="cn.gov.customs.wxjy.base.pojo.Trade">
+        <id column="TRADE_MODE" jdbcType="VARCHAR" property="tradeMode"/>
+        <result column="ABBR_TRADE" jdbcType="VARCHAR" property="abbrTrade"/>
+        <result column="FULL_TRADE" jdbcType="VARCHAR" property="fullTrade"/>
+    </resultMap>
+
+    <resultMap id="TransfResultMap" type="cn.gov.customs.wxjy.base.pojo.Transf">
+        <id column="TRAF_CODE" jdbcType="VARCHAR" property="trafCode"/>
+        <result column="TRAF_SPEC" jdbcType="VARCHAR" property="trafSpec"/>
+    </resultMap>
+
+    <resultMap id="UnitResultMap" type="cn.gov.customs.wxjy.base.pojo.Unit">
+        <id column="UNIT_CODE" jdbcType="VARCHAR" property="unitCode"/>
+        <result column="UNIT_NAME" jdbcType="VARCHAR" property="unitName"/>
+        <result column="CONV_CODE" jdbcType="VARCHAR" property="convCode"/>
+        <result column="CONV_RATIO" jdbcType="NUMERIC" property="convRatio"/>
+    </resultMap>
+
+    <select id="getCountryList" resultMap="CountryResultMap">
+        SELECT * FROM WXJY_APP_COUNTRY
+    </select>
+
+    <select id="getCountryByIso"  resultType="cn.gov.customs.wxjy.base.pojo.Country">
+        SELECT * FROM WXJY_APP_COUNTRY where ISO_E = #{isoE}
+    </select>
+
+    <select id="getCountryByCode"  resultType="cn.gov.customs.wxjy.base.pojo.Country">
+        SELECT * FROM WXJY_APP_COUNTRY where COUNTRY_CODE = #{countryCode}
+    </select>
+
+    <select id="getCustomsList" resultMap="CustomsResultMap">
+        SELECT * FROM WXJY_APP_CUSTOMS
+    </select>
+
+    <select id="getCustomsByCode"  resultType="cn.gov.customs.wxjy.base.pojo.Customs">
+        SELECT * FROM WXJY_APP_CUSTOMS where CUSTOMS_CODE = #{customsCode}
+    </select>
+
+    <select id="getTradeList" resultMap="TradeResultMap">
+        SELECT * FROM WXJY_APP_TRADE
+    </select>
+
+    <select id="getTradeByCode"  resultType="cn.gov.customs.wxjy.base.pojo.Trade">
+        SELECT * FROM WXJY_APP_TRADE where TRADE_MODE = #{tradeMode}
+    </select>
+
+    <select id="getTransfList" resultMap="TransfResultMap">
+        SELECT * FROM WXJY_APP_TRANSF
+    </select>
+
+    <select id="getTransByCode"  resultType="cn.gov.customs.wxjy.base.pojo.Transf">
+        SELECT * FROM WXJY_APP_TRANSF where TRAF_CODE = #{trafCode}
+    </select>
+
+    <select id="getUnitList" resultMap="UnitResultMap">
+        SELECT * FROM WXJY_APP_UNIT
+    </select>
+
+    <select id="getUnitByCode"  resultType="cn.gov.customs.wxjy.base.pojo.Unit">
+        SELECT * FROM WXJY_APP_UNIT where UNIT_CODE = #{unitCode}
+    </select>
+</mapper>