feat:MDM同步物料时同步处理税收分类编码

release
gongquanlin 2 years ago
parent e7b17081f2
commit b5c6f48878
  1. 12
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/dao/CommodityMapper.java
  2. 142
      order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml
  3. 8
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/taxcodematch/dao/SdenergyTaxCodeMatchDao.java
  4. 29
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java
  5. 11
      order-management-consumer/src/main/resources/mybatis/mapper/SdenergyTaxCodeMatchDao.xml

@ -32,6 +32,18 @@ public interface CommodityMapper {
*/ */
List<CommodityCodeEntity> queryProductList(@Param("map") Map<String, String> map, @Param("shList") List<String> shList); List<CommodityCodeEntity> queryProductList(@Param("map") Map<String, String> map, @Param("shList") List<String> shList);
/**
* 根据项目名称匹配税收分类编码查找一条
*
* @param xmmc
* @param xhfNsrsbh
* @return
*/
CommodityCodeEntity queryByCommodityXmmc(@Param("xmmc") String xmmc, @Param("xhfNsrsbh") String xhfNsrsbh);
CommodityCodeEntity queryByCommodityXmmcCompany(@Param("xmmc") String xmmc);
/** /**
* 修改商品信息 * 修改商品信息
* *

@ -43,7 +43,8 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, commodity_id, sort_id, xhf_nsrsbh, merchandise_name,encoding, tax_items, brief_code, id
, commodity_id, sort_id, xhf_nsrsbh, merchandise_name,encoding, tax_items, brief_code,
tax_rate, specification_model, metering_unit, unit_price, tax_logo, hide_the_logo, tax_rate, specification_model, metering_unit, unit_price, tax_logo, hide_the_logo,
enjoy_preferential_policies, tax_class_code, tax_classification_name, preferential_policies_type,zzstsgl, enjoy_preferential_policies, tax_class_code, tax_classification_name, preferential_policies_type,zzstsgl,
user_id, create_time, modify_time, modify_user_id, group_id,enterprise_name,data_source, user_id, create_time, modify_time, modify_user_id, group_id,enterprise_name,data_source,
@ -111,7 +112,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and cc.xhf_nsrsbh != '-1' and cc.xhf_nsrsbh != '-1'
<!-- 商品编码表ID--> <!-- 商品编码表ID-->
<if test="map.id != null and map.id != ''"> <if test="map.id != null and map.id != ''">
AND cc.id = #{map.id,jdbcType=VARCHAR} AND cc.id = #{map.id,jdbcType=VARCHAR}
@ -571,7 +572,8 @@
</trim> </trim>
</insert> </insert>
<insert id="insertCommodityOnDuplicateKey" parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity"> <insert id="insertCommodityOnDuplicateKey"
parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/> <bind name="dataType" value="${dataType}"/>
insert into commodity_code insert into commodity_code
@ -948,76 +950,76 @@
</if> </if>
</delete> </delete>
<select id="queryCommodityInfoList" resultMap="commodityCodeResultMap"> <select id="queryCommodityInfoList" resultMap="commodityCodeResultMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM FROM
commodity_code cc commodity_code cc
<where> <where>
<if test="pageSpxxReq.dataStatus!=null and pageSpxxReq.dataStatus!=''"> <if test="pageSpxxReq.dataStatus!=null and pageSpxxReq.dataStatus!=''">
AND cc.data_state = #{pageSpxxReq.dataStatus,jdbcType=VARCHAR} AND cc.data_state = #{pageSpxxReq.dataStatus,jdbcType=VARCHAR}
</if> </if>
<if test="pageSpxxReq.id!=null and pageSpxxReq.id!=''"> <if test="pageSpxxReq.id!=null and pageSpxxReq.id!=''">
AND cc.id = #{pageSpxxReq.id,jdbcType=VARCHAR} AND cc.id = #{pageSpxxReq.id,jdbcType=VARCHAR}
</if> </if>
<if test="pageSpxxReq.spId!=null and pageSpxxReq.spId!=''"> <if test="pageSpxxReq.spId!=null and pageSpxxReq.spId!=''">
AND cc.commodity_id = #{pageSpxxReq.spId,jdbcType=VARCHAR} AND cc.commodity_id = #{pageSpxxReq.spId,jdbcType=VARCHAR}
</if> </if>
<if test="pageSpxxReq.spdw!=null and pageSpxxReq.spdw!=''"> <if test="pageSpxxReq.spdw!=null and pageSpxxReq.spdw!=''">
AND cc.metering_unit = #{pageSpxxReq.spdw,jdbcType=VARCHAR} AND cc.metering_unit = #{pageSpxxReq.spdw,jdbcType=VARCHAR}
</if> </if>
<if test="pageSpxxReq.spdj!=null and pageSpxxReq.spdj!=''"> <if test="pageSpxxReq.spdj!=null and pageSpxxReq.spdj!=''">
AND cc.unit_price = #{pageSpxxReq.spdj,jdbcType=VARCHAR} AND cc.unit_price = #{pageSpxxReq.spdj,jdbcType=VARCHAR}
</if> </if>
<if test="pageSpxxReq.sl!=null and pageSpxxReq.sl!=''"> <if test="pageSpxxReq.sl!=null and pageSpxxReq.sl!=''">
AND cc.tax_rate = #{pageSpxxReq.sl,jdbcType=VARCHAR} AND cc.tax_rate = #{pageSpxxReq.sl,jdbcType=VARCHAR}
</if> </if>
<if test="pageSpxxReq.spmc!=null and pageSpxxReq.spmc!=''"> <if test="pageSpxxReq.spmc!=null and pageSpxxReq.spmc!=''">
AND cc.merchandise_name LIKE CONCAT(CONCAT('%',#{pageSpxxReq.spmc}),'%') AND cc.merchandise_name LIKE CONCAT(CONCAT('%',#{pageSpxxReq.spmc}),'%')
</if> </if>
<if test="pageSpxxReq.zxbm!=null and pageSpxxReq.zxbm!=''"> <if test="pageSpxxReq.zxbm!=null and pageSpxxReq.zxbm!=''">
AND cc.encoding LIKE CONCAT(CONCAT('%',#{pageSpxxReq.zxbm}),'%') AND cc.encoding LIKE CONCAT(CONCAT('%',#{pageSpxxReq.zxbm}),'%')
</if> </if>
<if test="pageSpxxReq.ggxh!=null and pageSpxxReq.ggxh!=''"> <if test="pageSpxxReq.ggxh!=null and pageSpxxReq.ggxh!=''">
AND cc.specification_model LIKE CONCAT(CONCAT('%',#{pageSpxxReq.ggxh}),'%') AND cc.specification_model LIKE CONCAT(CONCAT('%',#{pageSpxxReq.ggxh}),'%')
</if> </if>
<!-- 成品油类型 1 成品油 --> <!-- 成品油类型 1 成品油 -->
<if test='pageSpxxReq.cpylx=="1"'> <if test='pageSpxxReq.cpylx=="1"'>
AND cc.cpy = 'Y' AND cc.cpy = 'Y'
</if> </if>
<!-- 成品油类型 0 非成品油 --> <!-- 成品油类型 0 非成品油 -->
<if test='pageSpxxReq.cpylx=="0"'> <if test='pageSpxxReq.cpylx=="0"'>
AND cc.cpy = 'N' AND cc.cpy = 'N'
</if> </if>
<!-- 机动车类型 1 机动车 --> <!-- 机动车类型 1 机动车 -->
<if test='pageSpxxReq.jdclx=="1"'> <if test='pageSpxxReq.jdclx=="1"'>
AND cc.jdc = 'Y' AND cc.jdc = 'Y'
</if> </if>
<!-- 机动车类型 0 非机动车 --> <!-- 机动车类型 0 非机动车 -->
<if test='pageSpxxReq.jdclx=="0"'> <if test='pageSpxxReq.jdclx=="0"'>
AND cc.jdc = 'N' AND cc.jdc = 'N'
</if> </if>
<if test="shList != null and shList.size() == 0"> <if test="shList != null and shList.size() == 0">
and cc.xhf_nsrsbh = '' and cc.xhf_nsrsbh = ''
</if> </if>
<if test="shList != null and shList.size() == 1"> <if test="shList != null and shList.size() == 1">
and cc.xhf_nsrsbh = and cc.xhf_nsrsbh =
<foreach collection="shList" index="index" item="item"> <foreach collection="shList" index="index" item="item">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="shList != null and shList.size() > 1"> <if test="shList != null and shList.size() > 1">
and cc.xhf_nsrsbh in and cc.xhf_nsrsbh in
<foreach collection="shList" index="index" item="item" <foreach collection="shList" index="index" item="item"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
and cc.xhf_nsrsbh != '-1' and cc.xhf_nsrsbh != '-1'
</where> </where>
limit 1000 limit 1000
</select> </select>
@ -1070,23 +1072,23 @@
and commodity_id = #{commodityId,jdbcType=VARCHAR} and commodity_id = #{commodityId,jdbcType=VARCHAR}
</if> </if>
<if test="shList != null and shList.size() == 0"> <if test="shList != null and shList.size() == 0">
and xhf_nsrsbh = '' and xhf_nsrsbh = ''
</if> </if>
<if test="shList != null and shList.size() == 1"> <if test="shList != null and shList.size() == 1">
and xhf_nsrsbh = and xhf_nsrsbh =
<foreach collection="shList" index="index" item="item"> <foreach collection="shList" index="index" item="item">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="shList != null and shList.size() > 1"> <if test="shList != null and shList.size() > 1">
and xhf_nsrsbh in and xhf_nsrsbh in
<foreach collection="shList" index="index" item="item" <foreach collection="shList" index="index" item="item"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
and xhf_nsrsbh != '-1' and xhf_nsrsbh != '-1'
</where> </where>
</select> </select>
@ -1139,6 +1141,24 @@
and cc.xhf_nsrsbh != '-1' and cc.xhf_nsrsbh != '-1'
</select> </select>
<select id="queryByCommodityXmmc" parameterType="map" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
WHERE cc.merchandise_name like concat("%",#{xmmc},"%")
and cc.xhf_nsrsbh = #{xhfNsrsbh} limit 1
</select>
<select id="queryByCommodityXmmcCompany" parameterType="map" resultMap="commodityCodeResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
commodity_code cc
WHERE cc.merchandise_name like concat("%",#{xmmc},"%")
and cc.xhf_nsrsbh != "-1" limit 1
</select>
<!-- 通用条件查询 --> <!-- 通用条件查询 -->
<select id="queryCommodityInfoListByMap" resultMap="commodityCodeResultMap"> <select id="queryCommodityInfoListByMap" resultMap="commodityCodeResultMap">

@ -21,6 +21,14 @@ public interface SdenergyTaxCodeMatchDao {
*/ */
SdenergyTaxCodeMatch queryById(Long id); SdenergyTaxCodeMatch queryById(Long id);
/**
* 通过物料分类编码查询
*
* @param wlflbm
* @return
*/
SdenergyTaxCodeMatch queryByWlflbm(String wlflbm);
/** /**
* 查询指定行数据 * 查询指定行数据
* *

@ -11,6 +11,8 @@ import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity;
import com.dxhy.order.baseservice.module.taxclass.dao.GroupTaxClassCodeMapper; import com.dxhy.order.baseservice.module.taxclass.dao.GroupTaxClassCodeMapper;
import com.dxhy.order.baseservice.module.thirdservice.user.dto.AddUserRequestDto; import com.dxhy.order.baseservice.module.thirdservice.user.dto.AddUserRequestDto;
import com.dxhy.order.baseservice.module.thirdservice.user.service.UserInfoService; import com.dxhy.order.baseservice.module.thirdservice.user.service.UserInfoService;
import com.dxhy.order.consumer.modules.taxcodematch.dao.SdenergyTaxCodeMatchDao;
import com.dxhy.order.consumer.modules.taxcodematch.entity.SdenergyTaxCodeMatch;
import com.dxhy.order.consumer.openapi.protocol.AjaxResult; import com.dxhy.order.consumer.openapi.protocol.AjaxResult;
import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.*; import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.*;
import com.dxhy.order.model.R; import com.dxhy.order.model.R;
@ -51,6 +53,9 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
@Resource @Resource
private BaseService baseService; private BaseService baseService;
@Autowired
private SdenergyTaxCodeMatchDao sdenergyTaxCodeMatchDao;
// ===========物料相关开始=========== // ===========物料相关开始===========
// 物料主动查询接口 // 物料主动查询接口
@Value("${mdm.groupTaxCode.url}") @Value("${mdm.groupTaxCode.url}")
@ -188,7 +193,20 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
// entity.setDescription(reqBO.getDESCSHORT()); // entity.setDescription(reqBO.getDESCSHORT());
// entity.setUUID(reqBO.getUUID()); // entity.setUUID(reqBO.getUUID());
// if (groupTaxClassCodeMapper.insertOnDuplicateKey(commodityCodeEntity) <= 0) { // if (groupTaxClassCodeMapper.insertOnDuplicateKey(commodityCodeEntity) <= 0) {
// TODO 先查找物料分类编码和税收分类编码对应的字段 // 先查找物料分类编码和税收分类编码对应的字段
// 1.先去所有子公司库中匹配税编,以第一条为准;如果未匹配到,再去根据物料编码匹配
CommodityCodeEntity codeEntityForMatch = commodityMapper.queryByCommodityXmmcCompany(reqBO.getDESC1());
if (codeEntityForMatch == null) {
// 2.如果未匹配到,再去根据物料编码匹配
SdenergyTaxCodeMatch taxCodeMatch = sdenergyTaxCodeMatchDao.queryByWlflbm(reqBO.getCATEGORYCODE());
if (taxCodeMatch != null) {
codeEntityForMatch = new CommodityCodeEntity();
codeEntityForMatch.setSsflMc(taxCodeMatch.getSsflmc());
codeEntityForMatch.setSpbm(taxCodeMatch.getSsflbm());
}
}
// sdenergyTaxCodeMatchDao.queryByWlflbm(requestBody.get)
commodityCodeEntity.setId(DistributedKeyMaker.generateShotKey()); commodityCodeEntity.setId(DistributedKeyMaker.generateShotKey());
commodityCodeEntity.setSortId((long) i); commodityCodeEntity.setSortId((long) i);
@ -200,6 +218,15 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
commodityCodeEntity.setUUID(reqBO.getUUID()); commodityCodeEntity.setUUID(reqBO.getUUID());
commodityCodeEntity.setWlflbm(reqBO.getCATEGORYCODE()); commodityCodeEntity.setWlflbm(reqBO.getCATEGORYCODE());
commodityCodeEntity.setWlflmc(reqBO.getCATEGORYNAME()); commodityCodeEntity.setWlflmc(reqBO.getCATEGORYNAME());
// 维护税编和商品编码
if (codeEntityForMatch != null && StringUtils.isNotBlank(codeEntityForMatch.getSsflMc())) {
commodityCodeEntity.setSsflMc(codeEntityForMatch.getSsflMc());
}
if (codeEntityForMatch != null && StringUtils.isNotBlank(codeEntityForMatch.getSpbm())) {
commodityCodeEntity.setSpbm(codeEntityForMatch.getSpbm());
}
commodityCodeEntity.setCommodityId(baseService.getGenerateShotKey()); commodityCodeEntity.setCommodityId(baseService.getGenerateShotKey());
commodityCodeEntity.setXhfNsrsbh("-1"); commodityCodeEntity.setXhfNsrsbh("-1");
if (commodityMapper.insertCommodityOnDuplicateKey(commodityCodeEntity) > 0) { if (commodityMapper.insertCommodityOnDuplicateKey(commodityCodeEntity) > 0) {

@ -22,6 +22,17 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="queryByWlflbm" resultMap="SdenergyTaxCodeMatchMap">
select id,
wlflbm,
flmc,
ssflbm,
ssflmc
from sales_order_sdenergy.sdenergy_tax_code_match
where wlflbm = #{wlflbm} limit 1
</select>
<!--查询指定行数据--> <!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SdenergyTaxCodeMatchMap"> <select id="queryAllByLimit" resultMap="SdenergyTaxCodeMatchMap">
select id, select id,

Loading…
Cancel
Save