feat:修改mdm物料实体为commodity_code

gongquanlin 2 years ago committed by WangQi
parent b7e42781a1
commit a01430d5c3
  1. 2
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/dao/CommodityMapper.java
  2. 3
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/model/CommodityCodeEntity.java
  3. 313
      order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml
  4. 66
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java

@ -48,6 +48,8 @@ public interface CommodityMapper {
*/
int insertCommodity(CommodityCodeEntity codeEntity);
int insertCommodityOnDuplicateKey(CommodityCodeEntity codeEntity);
/**
* 删除商品信息
*

@ -189,5 +189,8 @@ public class CommodityCodeEntity implements Serializable {
*/
private String jdc;
private String UUID;
private Boolean success;
}

@ -548,6 +548,319 @@
</trim>
</insert>
<insert id="insertCommodityOnDuplicateKey" parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/>
insert into commodity_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="commodityId != null">
commodity_id,
</if>
<if test="sortId != null">
sort_id,
</if>
<if test="xhfNsrsbh != null">
xhf_nsrsbh,
</if>
<if test="xmmc != null">
merchandise_name,
</if>
<if test="zxbm != null">
encoding,
</if>
<if test="spsm != null">
tax_items,
</if>
<if test="spjm != null">
brief_code,
</if>
<if test="sl != null">
tax_rate,
</if>
<if test="ggxh != null">
specification_model,
</if>
<if test="xmdw != null">
metering_unit,
</if>
<if test="xmdj != null">
unit_price,
</if>
<if test="hsbz != null">
tax_logo,
</if>
<if test="ycbz != null">
hide_the_logo,
</if>
<if test="yhzcbs != null">
enjoy_preferential_policies,
</if>
<if test="spbm != null">
tax_class_code,
</if>
<if test="ssflMc != null">
tax_classification_name,
</if>
<if test="lslbs != null">
preferential_policies_type,
</if>
<if test="zzstsgl != null">
zzstsgl,
</if>
<if test="userId != null">
user_id,
</if>
create_time,
modify_time,
<if test="modifyUserId != null">
modify_user_id,
</if>
<if test="groupId != null">
group_id,
</if>
<if test="bz != null">
description,
</if>
<if test="xhfMc != null">
enterprise_name,
</if>
<if test="dataSource != null">
data_source,
</if>
<if test="matchingState != null">
matching_state,
</if>
<if test="dataState != null">
data_state,
</if>
<if test="spjc != null">
tax_class_abbreviation,
</if>
<if test="collectIdent != null">
collect_ident,
</if>
<if test="cpy != null">
cpy,
</if>
<if test="bmbBbh != null">
bmb_bbh,
</if>
<if test="jdc != null">
jdc,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="commodityId != null">
#{commodityId,jdbcType=VARCHAR},
</if>
<if test="sortId != null">
#{sortId,jdbcType=BIGINT},
</if>
<if test="xhfNsrsbh != null">
#{xhfNsrsbh,jdbcType=VARCHAR},
</if>
<if test="xmmc != null">
#{xmmc,jdbcType=VARCHAR},
</if>
<if test="zxbm != null">
#{zxbm,jdbcType=VARCHAR},
</if>
<if test="spsm != null">
#{spsm,jdbcType=VARCHAR},
</if>
<if test="spjm != null">
#{spjm,jdbcType=VARCHAR},
</if>
<if test="sl != null">
#{sl,jdbcType=VARCHAR},
</if>
<if test="ggxh != null">
#{ggxh,jdbcType=VARCHAR},
</if>
<if test="xmdw != null">
#{xmdw,jdbcType=VARCHAR},
</if>
<if test="xmdj != null">
#{xmdj,jdbcType=VARCHAR},
</if>
<if test="hsbz != null">
#{hsbz,jdbcType=VARCHAR},
</if>
<if test="ycbz != null">
#{ycbz,jdbcType=VARCHAR},
</if>
<if test="yhzcbs != null">
#{yhzcbs,jdbcType=VARCHAR},
</if>
<if test="spbm != null">
#{spbm,jdbcType=VARCHAR},
</if>
<if test="ssflMc != null">
#{ssflMc,jdbcType=VARCHAR},
</if>
<if test="lslbs != null">
#{lslbs,jdbcType=VARCHAR},
</if>
<if test="zzstsgl != null">
#{zzstsgl,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="dataType == 0">
now(),
now(),
</if>
<if test="dataType == 1">
SYSDATE,
SYSDATE,
</if>
<if test="modifyUserId != null">
#{modifyUserId,jdbcType=CHAR},
</if>
<if test="groupId != null">
#{groupId,jdbcType=VARCHAR},
</if>
<if test="bz != null">
#{bz,jdbcType=VARCHAR},
</if>
<if test="xhfMc != null">
#{xhfMc,jdbcType=VARCHAR},
</if>
<if test="dataSource != null">
#{dataSource,jdbcType=VARCHAR},
</if>
<if test="matchingState != null">
#{matchingState,jdbcType=VARCHAR},
</if>
<if test="dataState != null">
#{dataState,jdbcType=VARCHAR},
</if>
<if test="spjc != null">
#{spjc,jdbcType=VARCHAR},
</if>
<if test="collectIdent != null">
#{collectIdent,jdbcType=VARCHAR},
</if>
<if test="cpy != null">
#{cpy,jdbcType=VARCHAR},
</if>
<if test="bmbBbh != null">
#{bmbBbh,jdbcType=VARCHAR},
</if>
<if test="jdc != null">
#{jdc,jdbcType=VARCHAR},
</if>
</trim>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
<if test="id != null">
id = VALUES(id),
</if>
<if test="commodityId != null">
commodity_id = VALUES(commodity_id),
</if>
<if test="sortId != null">
sort_id = VALUES(sort_id),
</if>
<if test="xhfNsrsbh != null">
xhf_nsrsbh = VALUES(xhf_nsrsbh),
</if>
<if test="xmmc != null">
merchandise_name = VALUES(merchandise_name),
</if>
<if test="zxbm != null">
encoding = VALUES(encoding),
</if>
<if test="spsm != null">
tax_items = VALUES(tax_items),
</if>
<if test="spjm != null">
brief_code = VALUES(brief_code),
</if>
<if test="sl != null">
tax_rate = VALUES(tax_rate),
</if>
<if test="ggxh != null">
specification_model = VALUES(specification_model),
</if>
<if test="xmdw != null">
metering_unit = VALUES(metering_unit),
</if>
<if test="xmdj != null">
unit_price = VALUES(unit_price),
</if>
<if test="hsbz != null">
tax_logo = VALUES(tax_logo),
</if>
<if test="ycbz != null">
hide_the_logo = VALUES(hide_the_logo),
</if>
<if test="yhzcbs != null">
enjoy_preferential_policies = VALUES(enjoy_preferential_policies),
</if>
<if test="spbm != null">
tax_class_code = VALUES(tax_class_code),
</if>
<if test="ssflMc != null">
tax_classification_name = VALUES(tax_classification_name),
</if>
<if test="lslbs != null">
preferential_policies_type = VALUES(preferential_policies_type),
</if>
<if test="zzstsgl != null">
zzstsgl = VALUES(zzstsgl),
</if>
<if test="userId != null">
user_id = VALUES(user_id),
</if>
create_time = VALUES(create_time),
modify_time = VALUES(modify_time),
<if test="modifyUserId != null">
modify_user_id = VALUES(modify_user_id),
</if>
<if test="groupId != null">
group_id = VALUES(group_id),
</if>
<if test="bz != null">
description = VALUES(description),
</if>
<if test="xhfMc != null">
enterprise_name = VALUES(enterprise_name),
</if>
<if test="dataSource != null">
data_source = VALUES(data_source),
</if>
<if test="matchingState != null">
matching_state = VALUES(matching_state),
</if>
<if test="dataState != null">
data_state = VALUES(data_state),
</if>
<if test="spjc != null">
tax_class_abbreviation = VALUES(tax_class_abbreviation),
</if>
<if test="collectIdent != null">
collect_ident = VALUES(collect_ident),
</if>
<if test="cpy != null">
cpy = VALUES(cpy),
</if>
<if test="bmbBbh != null">
bmb_bbh = VALUES(bmb_bbh),
</if>
<if test="jdc != null">
jdc = VALUES(jdc),
</if>
</trim>
</insert>
<update id="updateByGropId" parameterType="String">
UPDATE commodity_code
SET

@ -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<MdmGmfxxtbReqBO> 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<MdmSyncGroupTaxCodeReqBO> mdmGmfxxtbReqBOS, String requestBody) {
List<GroupTaxClassCodeEntity> list = new ArrayList<>();
List<CommodityCodeEntity> 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");

Loading…
Cancel
Save