From 82f11a0dde29f69e9be923f648e3549f75118d6c Mon Sep 17 00:00:00 2001 From: gongquanlin <1025081659@qq.com> Date: Tue, 28 Feb 2023 17:24:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9mdm=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E4=B8=BAcommodity=5Fcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/commodity/dao/CommodityMapper.java | 4 +- .../commodity/model/CommodityCodeEntity.java | 3 + .../mybatis/mapper/CommodityMapper.xml | 313 ++++++++++++++++++ .../service/impl/SDEnregyServiceImpl.java | 66 ++-- 4 files changed, 353 insertions(+), 33 deletions(-) diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/dao/CommodityMapper.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/dao/CommodityMapper.java index 31fac577..d5c9e344 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/dao/CommodityMapper.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/dao/CommodityMapper.java @@ -47,7 +47,9 @@ public interface CommodityMapper { * @return */ int insertCommodity(CommodityCodeEntity codeEntity); - + + int insertCommodityOnDuplicateKey(CommodityCodeEntity codeEntity); + /** * 删除商品信息 * diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/model/CommodityCodeEntity.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/model/CommodityCodeEntity.java index b0db3bf8..101436f6 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/model/CommodityCodeEntity.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/model/CommodityCodeEntity.java @@ -188,6 +188,9 @@ public class CommodityCodeEntity implements Serializable { * 是否机动车(Y:机动车;N:非机动车) */ private String jdc; + + private String UUID; + private Boolean success; } diff --git a/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml b/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml index 704d205a..47db00a7 100644 --- a/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml +++ b/order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml @@ -548,6 +548,319 @@ + + + + insert into commodity_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, + + + enjoy_preferential_policies, + + + tax_class_code, + + + tax_classification_name, + + + preferential_policies_type, + + + zzstsgl, + + + user_id, + + create_time, + modify_time, + + modify_user_id, + + + group_id, + + + description, + + + enterprise_name, + + + data_source, + + + matching_state, + + + data_state, + + + tax_class_abbreviation, + + + collect_ident, + + + cpy, + + + bmb_bbh, + + + jdc, + + + + + #{id,jdbcType=VARCHAR}, + + + #{commodityId,jdbcType=VARCHAR}, + + + #{sortId,jdbcType=BIGINT}, + + + #{xhfNsrsbh,jdbcType=VARCHAR}, + + + #{xmmc,jdbcType=VARCHAR}, + + + #{zxbm,jdbcType=VARCHAR}, + + + #{spsm,jdbcType=VARCHAR}, + + + #{spjm,jdbcType=VARCHAR}, + + + #{sl,jdbcType=VARCHAR}, + + + #{ggxh,jdbcType=VARCHAR}, + + + #{xmdw,jdbcType=VARCHAR}, + + + #{xmdj,jdbcType=VARCHAR}, + + + #{hsbz,jdbcType=VARCHAR}, + + + #{ycbz,jdbcType=VARCHAR}, + + + #{yhzcbs,jdbcType=VARCHAR}, + + + #{spbm,jdbcType=VARCHAR}, + + + #{ssflMc,jdbcType=VARCHAR}, + + + #{lslbs,jdbcType=VARCHAR}, + + + #{zzstsgl,jdbcType=VARCHAR}, + + + #{userId,jdbcType=VARCHAR}, + + + now(), + now(), + + + SYSDATE, + SYSDATE, + + + #{modifyUserId,jdbcType=CHAR}, + + + #{groupId,jdbcType=VARCHAR}, + + + #{bz,jdbcType=VARCHAR}, + + + #{xhfMc,jdbcType=VARCHAR}, + + + #{dataSource,jdbcType=VARCHAR}, + + + #{matchingState,jdbcType=VARCHAR}, + + + #{dataState,jdbcType=VARCHAR}, + + + #{spjc,jdbcType=VARCHAR}, + + + #{collectIdent,jdbcType=VARCHAR}, + + + #{cpy,jdbcType=VARCHAR}, + + + #{bmbBbh,jdbcType=VARCHAR}, + + + #{jdc,jdbcType=VARCHAR}, + + + ON DUPLICATE KEY UPDATE + + + id = VALUES(id), + + + commodity_id = VALUES(commodity_id), + + + sort_id = VALUES(sort_id), + + + xhf_nsrsbh = VALUES(xhf_nsrsbh), + + + merchandise_name = VALUES(merchandise_name), + + + encoding = VALUES(encoding), + + + tax_items = VALUES(tax_items), + + + brief_code = VALUES(brief_code), + + + tax_rate = VALUES(tax_rate), + + + specification_model = VALUES(specification_model), + + + metering_unit = VALUES(metering_unit), + + + unit_price = VALUES(unit_price), + + + tax_logo = VALUES(tax_logo), + + + hide_the_logo = VALUES(hide_the_logo), + + + enjoy_preferential_policies = VALUES(enjoy_preferential_policies), + + + tax_class_code = VALUES(tax_class_code), + + + tax_classification_name = VALUES(tax_classification_name), + + + preferential_policies_type = VALUES(preferential_policies_type), + + + zzstsgl = VALUES(zzstsgl), + + + user_id = VALUES(user_id), + + create_time = VALUES(create_time), + modify_time = VALUES(modify_time), + + modify_user_id = VALUES(modify_user_id), + + + group_id = VALUES(group_id), + + + description = VALUES(description), + + + enterprise_name = VALUES(enterprise_name), + + + data_source = VALUES(data_source), + + + matching_state = VALUES(matching_state), + + + data_state = VALUES(data_state), + + + tax_class_abbreviation = VALUES(tax_class_abbreviation), + + + collect_ident = VALUES(collect_ident), + + + cpy = VALUES(cpy), + + + bmb_bbh = VALUES(bmb_bbh), + + + jdc = VALUES(jdc), + + + + UPDATE commodity_code SET diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java index 55092ab5..4426f78b 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java @@ -4,20 +4,16 @@ import com.alibaba.fastjson.JSONObject; import com.dxhy.order.baseservice.module.buyer.dao.BuyerMapper; import com.dxhy.order.baseservice.module.buyer.model.BuyerEntity; import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxtbRspBO; +import com.dxhy.order.baseservice.module.commodity.dao.CommodityMapper; +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.model.GroupTaxClassCodeEntity; import com.dxhy.order.constant.OrderInfoContentEnum; import com.dxhy.order.consumer.openapi.protocol.AjaxResult; import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.*; -import com.dxhy.order.consumer.openapi.service.ISDEnregyService; -import com.dxhy.order.invoice.module.invoice.dao.MdmBuyerManageInfoMapper; -import com.dxhy.order.invoice.module.invoice.dao.MdmGroupTaxClassCodeMapper; -import com.dxhy.order.model.MdmBuyerManageInfo; -import com.dxhy.order.model.MdmGroupTaxClassCode; import com.dxhy.order.utils.DistributedKeyMaker; import com.dxhy.order.utils.JsonUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -26,8 +22,6 @@ import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.Optional; -import java.util.function.Function; /** * @Description @@ -37,18 +31,15 @@ import java.util.function.Function; @Service public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { - @Autowired - private MdmGroupTaxClassCodeMapper mdmGroupTaxClassCodeMapper; - - @Autowired - private MdmBuyerManageInfoMapper mdmBuyerManageInfoMapper; - @Autowired private BuyerMapper buyerMapper; @Autowired private GroupTaxClassCodeMapper groupTaxClassCodeMapper; + @Autowired + private CommodityMapper commodityMapper; + @Override public AjaxResult syncBuyerMessage(List mdmGmfxxtbReqBOS, String requestBody) { // 存表 @@ -102,7 +93,6 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { entity.setMdmMulticodeJson(JsonUtils.getInstance().toJsonStringNullToEmpty(tempMdmGmfxxtbReqBO.getMULTICODE())); entity.setUUID(tempMdmGmfxxtbReqBO.getUUID()); - // if (mdmBuyerManageInfoMapper.insertSelectiveOnDuplicateKey(entity) > 0) { if (buyerMapper.insertBuyerOnDuplicateKey(entity) > 0) { entity.setSuccess(true); } else { @@ -139,25 +129,37 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { @Override @Transactional public AjaxResult syncMdmGroupTax(List mdmGmfxxtbReqBOS, String requestBody) { - List list = new ArrayList<>(); + List list = new ArrayList<>(); for (int i = 0; i < mdmGmfxxtbReqBOS.size(); i++) { MdmSyncGroupTaxCodeReqBO reqBO = mdmGmfxxtbReqBOS.get(i); - GroupTaxClassCodeEntity entity = new GroupTaxClassCodeEntity(); - entity.setId(DistributedKeyMaker.generateShotKey()); - entity.setSortId((long) i); - entity.setMerchandiseName(reqBO.getDESC1()); - entity.setEncoding(reqBO.getCODE()); - entity.setMeteringUnit(reqBO.getDESC5()); - entity.setCreateTime(new Date()); - entity.setDescription(reqBO.getDESCSHORT()); - entity.setUUID(reqBO.getUUID()); - // if (mdmGroupTaxClassCodeMapper.insertOneOnDuplicateKey(entity) <= 0) { - if (groupTaxClassCodeMapper.insertOnDuplicateKey(entity) <= 0) { - entity.setSuccess(false); + CommodityCodeEntity commodityCodeEntity = new CommodityCodeEntity(); + // GroupTaxClassCodeEntity entity = new GroupTaxClassCodeEntity(); + // entity.setId(DistributedKeyMaker.generateShotKey()); + // entity.setSortId((long) i); + // entity.setMerchandiseName(reqBO.getDESC1()); // 商品名称 + // entity.setEncoding(reqBO.getCODE()); // 编码 + // entity.setMeteringUnit(reqBO.getDESC5()); + // entity.setCreateTime(new Date()); + // entity.setDescription(reqBO.getDESCSHORT()); + // entity.setUUID(reqBO.getUUID()); + // if (groupTaxClassCodeMapper.insertOnDuplicateKey(commodityCodeEntity) <= 0) { + // TODO 先查找物料分类编码和税收分类编码对应的字段 + + commodityCodeEntity.setId(DistributedKeyMaker.generateShotKey()); + commodityCodeEntity.setSortId((long) i); + commodityCodeEntity.setXmmc(reqBO.getDESC1()); // 商品名称 + commodityCodeEntity.setZxbm(reqBO.getCODE()); // 编码 + commodityCodeEntity.setXmdw(reqBO.getDESC5()); + commodityCodeEntity.setCreateTime(new Date()); + commodityCodeEntity.setBz(reqBO.getDESCSHORT()); + commodityCodeEntity.setUUID(reqBO.getUUID()); + commodityCodeEntity.setXhfNsrsbh("-1"); + if (commodityMapper.insertCommodityOnDuplicateKey(commodityCodeEntity) > 0) { + commodityCodeEntity.setSuccess(true); } else { - entity.setSuccess(true); + commodityCodeEntity.setSuccess(false); } - list.add(entity); + list.add(commodityCodeEntity); } SDEnergyMdmBaseBO baseBO = JSONObject.parseObject(requestBody, SDEnergyMdmBaseBO.class); @@ -165,9 +167,9 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { baseBO, list, i -> { - GroupTaxClassCodeEntity t = (GroupTaxClassCodeEntity) i; + CommodityCodeEntity t = (CommodityCodeEntity) i; SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); - resp.setCODE(t.getEncoding()); + resp.setCODE(t.getZxbm()); resp.setUUID(t.getUUID()); resp.setSYNSTATUS(t.getSuccess() ? "1" : "0"); resp.setSYNRESULT(t.getSuccess() ? "success" : "failed");