feat:集团物料列表、集团物料引用

release
gongquanlin 2 years ago
parent 32f44fd483
commit c094c502cf
  1. 10
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/model/CommodityCodeEntity.java
  2. 49
      order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml
  3. 0
      order-management-base-service/src/main/resources/mybatis/mapper/GroupCommodityCodeMapper.xml
  4. 35
      order-management-consumer/src/main/java/com/dxhy/order/consumer/dao/GroupCommodityCodeMapper.java
  5. 51
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityCodeController.java
  6. 21
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/controller/GroupCommodityController.java
  7. 30
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/domain/dto/PageBaseDTO.java
  8. 21
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/domain/dto/QueryGroupCommodityDTO.java
  9. 23
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/domain/dto/QuoteGroupCommodityDTO.java
  10. 20
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/IGroupCommodityCodeService.java
  11. 116
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.java
  12. 21
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/protocol/v6/sdenergy/MdmSyncGroupTaxCodeReqBO.java
  13. 8
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/SDEnregyServiceImpl.java
  14. 1395
      order-management-consumer/src/main/resources/mybatis/mapper/GroupCommodityCodeMapper.xml

@ -189,6 +189,16 @@ public class CommodityCodeEntity implements Serializable {
*/ */
private String jdc; private String jdc;
/**
* mdm物料分类编码
*/
private String wlflbm;
/**
* mdm物料分类名称
*/
private String wlflmc;
private String UUID; private String UUID;
private Boolean success; private Boolean success;

@ -38,6 +38,8 @@
<result column="cpy" jdbcType="VARCHAR" property="cpy"/> <result column="cpy" jdbcType="VARCHAR" property="cpy"/>
<result column="bmb_bbh" jdbcType="VARCHAR" property="bmbBbh"/> <result column="bmb_bbh" jdbcType="VARCHAR" property="bmbBbh"/>
<result column="jdc" jdbcType="VARCHAR" property="jdc"/> <result column="jdc" jdbcType="VARCHAR" property="jdc"/>
<result column="wlflbm" jdbcType="VARCHAR" property="wlflbm"/>
<result column="wlflmc" jdbcType="VARCHAR" property="wlflmc"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -45,7 +47,7 @@
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,
matching_state,data_state,tax_class_abbreviation,description,collect_ident,cpy,bmb_bbh,jdc matching_state,data_state,tax_class_abbreviation,description,collect_ident,cpy,bmb_bbh,jdc,wlflbm,wlflmc
</sql> </sql>
@ -87,6 +89,8 @@
cc.jdc, cc.jdc,
cc.bmb_bbh, cc.bmb_bbh,
gc.group_name gc.group_name
cc.wlflbm,
cc.wlflmc,
FROM FROM
commodity_code cc LEFT JOIN group_commodity gc commodity_code cc LEFT JOIN group_commodity gc
ON gc.id = cc.group_id ON gc.id = cc.group_id
@ -107,6 +111,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
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}
@ -311,6 +316,12 @@
<if test="commodityCode.jdc != null"> <if test="commodityCode.jdc != null">
jdc = #{commodityCode.jdc,jdbcType=VARCHAR}, jdc = #{commodityCode.jdc,jdbcType=VARCHAR},
</if> </if>
<if test="commodityCode.wlflbm != null">
wlflbm = #{commodityCode.wlflbm,jdbcType=VARCHAR},
</if>
<if test="commodityCode.wlflmc != null">
wlflmc = #{commodityCode.wlflmc,jdbcType=VARCHAR},
</if>
</set> </set>
<where> <where>
<if test="commodityCode.id != null and commodityCode.id != ''"> <if test="commodityCode.id != null and commodityCode.id != ''">
@ -439,6 +450,12 @@
<if test="jdc != null"> <if test="jdc != null">
jdc, jdc,
</if> </if>
<if test="wlflbm != null">
wlflbm,
</if>
<if test="wlflmc != null">
wlflmc,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -545,6 +562,12 @@
<if test="jdc != null"> <if test="jdc != null">
#{jdc,jdbcType=VARCHAR}, #{jdc,jdbcType=VARCHAR},
</if> </if>
<if test="wlflbm != null">
#{wlflbm,jdbcType=VARCHAR},
</if>
<if test="wlflmc != null">
#{wlflmc,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
@ -651,6 +674,12 @@
<if test="jdc != null"> <if test="jdc != null">
jdc, jdc,
</if> </if>
<if test="wlflbm != null">
wlflbm,
</if>
<if test="wlflmc != null">
wlflmc,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -757,6 +786,12 @@
<if test="jdc != null"> <if test="jdc != null">
#{jdc,jdbcType=VARCHAR}, #{jdc,jdbcType=VARCHAR},
</if> </if>
<if test="wlflbm != null">
#{wlflbm,jdbcType=VARCHAR},
</if>
<if test="wlflmc != null">
#{wlflmc,jdbcType=VARCHAR},
</if>
</trim> </trim>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
<trim suffixOverrides=","> <trim suffixOverrides=",">
@ -858,6 +893,12 @@
<if test="jdc != null"> <if test="jdc != null">
jdc = VALUES(jdc), jdc = VALUES(jdc),
</if> </if>
<if test="wlflbm != null">
wlflbm = VALUES(wlflbm),
</if>
<if test="wlflmc != null">
wlflmc = VALUES(wlflmc),
</if>
</trim> </trim>
</insert> </insert>
@ -975,6 +1016,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and cc.xhf_nsrsbh != '-1'
</where> </where>
limit 1000 limit 1000
@ -989,6 +1031,7 @@
WHERE t.collect_ident is null WHERE t.collect_ident is null
AND t.matching_state = '0' AND t.matching_state = '0'
AND t.data_state = '0' AND t.data_state = '0'
and t.xhf_nsrsbh != '-1'
AND ( AND (
t.data_source = '1' t.data_source = '1'
OR t.data_source = '2' OR t.data_source = '2'
@ -1043,6 +1086,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and xhf_nsrsbh != '-1'
</where> </where>
</select> </select>
@ -1092,6 +1136,7 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and cc.xhf_nsrsbh != '-1'
</select> </select>
@ -1143,6 +1188,7 @@
<if test='map.jdclx == "0"'> <if test='map.jdclx == "0"'>
AND cc.jdc = 'N' AND cc.jdc = 'N'
</if> </if>
and cc.xhf_nsrsbh != '-1'
</where> </where>
<choose> <choose>
<when test="map.orderBy !=null and map.orderBy == '0' "> <when test="map.orderBy !=null and map.orderBy == '0' ">
@ -1198,6 +1244,7 @@
<if test='map.jdclx=="0"'> <if test='map.jdclx=="0"'>
AND cc.jdc = 'N' AND cc.jdc = 'N'
</if> </if>
and cc.xhf_nsrsbh != '-1'
</where> </where>
<choose> <choose>
<when test="map.orderBy !=null and map.orderBy == '0' "> <when test="map.orderBy !=null and map.orderBy == '0' ">

@ -0,0 +1,35 @@
package com.dxhy.order.consumer.dao;
import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description 集团物料库 集团物料库和
* @Author 巩权林
* @Date 2023/3/9 10:36
**/
public interface GroupCommodityCodeMapper {
/**
* 查询集团物料库
*
* @param commodityCodeEntity
* @return
*/
List<CommodityCodeEntity> queryGroupCommodityCodeList(CommodityCodeEntity commodityCodeEntity);
/**
* 根据物料编码和销方税号查询物料信息
*
* @param zxbm
* @param xhfNsrsbh
* @return
*/
CommodityCodeEntity queryCommodityCodeByZxbmAndXhfNsrsbh(@Param("zxbm") String zxbm, @Param("xhfNsrsbh") String xhfNsrsbh);
int insertCommodityCode(CommodityCodeEntity entity);
}

@ -0,0 +1,51 @@
package com.dxhy.order.consumer.modules.commodity.controller;
import cn.hutool.json.JSONObject;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QueryGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QuoteGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.service.IGroupCommodityCodeService;
import com.dxhy.order.model.PageUtils;
import com.dxhy.order.model.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @Description 集团物料库
* @Author 巩权林
* @Date 2023/3/9 08:19
**/
@RequestMapping(value = "/groupCommodity")
@RestController
@Slf4j
public class GroupCommodityCodeController {
private final static String LOGGER_MSG = "(集团物料库)";
@Autowired
private IGroupCommodityCodeService groupCommodityCodeService;
@GetMapping("/list")
public R list(QueryGroupCommodityDTO queryGroupCommodityDTO) {
try {
PageUtils pageUtil = groupCommodityCodeService.queryGroupCommodityCodeList(queryGroupCommodityDTO);
return R.ok().put("page", pageUtil);
} catch (NumberFormatException e) {
log.error("{},分页参数类型转换异常:{}", LOGGER_MSG, e.getMessage());
return R.error("商品信息列表查询异常");
}
}
/**
* 物料引用
*
* @return
*/
@PostMapping("/quote")
public R quote(@RequestBody @Validated QuoteGroupCommodityDTO dto) {
return groupCommodityCodeService.quoteGroupCommodityCode(dto);
}
}

@ -1,21 +0,0 @@
package com.dxhy.order.consumer.modules.commodity.controller;
import com.dxhy.order.model.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description 集团物料库
* @Author 巩权林
* @Date 2023/3/9 08:19
**/
@RequestMapping(value = "/groupCommodity")
@RestController
public class GroupCommodityController {
@PostMapping("/list")
public R list() {
}
}

@ -0,0 +1,30 @@
package com.dxhy.order.consumer.modules.commodity.domain.dto;
import lombok.Data;
/**
* @Description 带分页的基础dto
* @Author 巩权林
* @Date 2023/3/9 10:09
**/
public class PageBaseDTO {
private Integer currPage;
private Integer pageSize;
public Integer getCurrPage() {
return currPage == null ? 0 : currPage;
}
public void setCurrPage(Integer currPage) {
this.currPage = currPage;
}
public Integer getPageSize() {
return pageSize == null ? 0 : pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

@ -1,6 +1,11 @@
package com.dxhy.order.consumer.modules.commodity.domain.dto; package com.dxhy.order.consumer.modules.commodity.domain.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/** /**
* @Description 集团物料编码查询 * @Description 集团物料编码查询
@ -8,6 +13,20 @@ import lombok.Data;
* @Date 2023/3/9 08:22 * @Date 2023/3/9 08:22
**/ **/
@Data @Data
public class QueryGroupCommodityDTO { @NoArgsConstructor
@AllArgsConstructor
@Builder
public class QueryGroupCommodityDTO extends PageBaseDTO {
// 物料分类编码
private String wlflbm;
// 物料分类名称
private String wlflmc;
// 物料自行编码
private String zxbm;
// 物料名称
private String xmmc;
} }

@ -0,0 +1,23 @@
package com.dxhy.order.consumer.modules.commodity.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description 引用物料
* @Author 巩权林
* @Date 2023/3/9 11:01
**/
@Data
public class QuoteGroupCommodityDTO {
/**
* 自行编码
*/
@NotBlank(message = "物料编码不能为空!")
private String zxbm;
@NotBlank(message = "接收引用物料的销方纳税人识别号不能为空!")
private String xhfNsrsbh;
}

@ -0,0 +1,20 @@
package com.dxhy.order.consumer.modules.commodity.service;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QueryGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QuoteGroupCommodityDTO;
import com.dxhy.order.model.PageUtils;
import com.dxhy.order.model.R;
import java.util.List;
/**
* @Description 集团物料库
* @Author 巩权林
* @Date 2023/3/9 10:06
**/
public interface IGroupCommodityCodeService {
PageUtils queryGroupCommodityCodeList(QueryGroupCommodityDTO queryGroupCommodityDTO);
R quoteGroupCommodityCode(QuoteGroupCommodityDTO quoteGroupCommodityDTO);
}

@ -0,0 +1,116 @@
package com.dxhy.order.consumer.modules.commodity.service.impl;
import com.dxhy.order.baseservice.module.base.service.BaseService;
import com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity;
import com.dxhy.order.constant.ConfigureConstant;
import com.dxhy.order.consumer.dao.GroupCommodityCodeMapper;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QueryGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.domain.dto.QuoteGroupCommodityDTO;
import com.dxhy.order.consumer.modules.commodity.service.IGroupCommodityCodeService;
import com.dxhy.order.model.PageUtils;
import com.dxhy.order.model.R;
import com.dxhy.order.utils.CommonUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description
* @Author 巩权林
* @Date 2023/3/9 10:06
**/
@Service
@Slf4j
public class GroupCommodityCodeServiceImpl implements IGroupCommodityCodeService {
private final static String LOGGER_MSG = "(集团物料库)";
@Autowired
private GroupCommodityCodeMapper groupCommodityMapper;
@Resource
private BaseService baseService;
/**
* 查询集团物料库
*
* @param queryGroupCommodityDTO
* @param shList
* @return
*/
@Override
public PageUtils queryGroupCommodityCodeList(QueryGroupCommodityDTO queryGroupCommodityDTO) {
int pageSize = queryGroupCommodityDTO.getPageSize();
int currPage = queryGroupCommodityDTO.getCurrPage();
PageHelper.startPage(currPage, pageSize);
CommodityCodeEntity query = new CommodityCodeEntity();
query.setWlflbm(queryGroupCommodityDTO.getWlflbm());
query.setWlflmc(queryGroupCommodityDTO.getWlflmc());
query.setZxbm(queryGroupCommodityDTO.getZxbm());
query.setXmmc(queryGroupCommodityDTO.getXmmc());
List<CommodityCodeEntity> result = groupCommodityMapper.queryGroupCommodityCodeList(query);
result = result.stream().map(i -> {
if (StringUtils.isNotEmpty(i.getSl())) {
i.setSl(CommonUtils.formatSl(i.getSl()));
}
return i;
}).collect(Collectors.toList());
PageInfo<CommodityCodeEntity> pageInfo = new PageInfo<>(result);
return new PageUtils(pageInfo.getList(), (int) pageInfo.getTotal(), pageInfo.getPageSize(), pageInfo.getPageNum());
}
/**
* 引用物料
*
* @param quoteGroupCommodityDTO
* @return
*/
@Override
public R quoteGroupCommodityCode(QuoteGroupCommodityDTO quoteGroupCommodityDTO) {
// 判断销方税号是否合法,因为某些情况下可能会传递list过来
if (StringUtils.isBlank(quoteGroupCommodityDTO.getXhfNsrsbh())) {
return R.error(ConfigureConstant.STRING_0000, "销方税号不能为空");
}
if (quoteGroupCommodityDTO.getXhfNsrsbh().contains(ConfigureConstant.STRING_CHARSET_1)) {
return R.error(ConfigureConstant.STRING_0000, "销方税号非法");
}
CommodityCodeEntity commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(quoteGroupCommodityDTO.getZxbm(), quoteGroupCommodityDTO.getXhfNsrsbh());
// 根据文档4.2.1.2 (6) 若物料编码重复时,引用后不对子公司物料进行更新
if (commodityCodeEntity != null) {
return R.ok();
}
commodityCodeEntity = groupCommodityMapper.queryCommodityCodeByZxbmAndXhfNsrsbh(quoteGroupCommodityDTO.getZxbm(), "-1");
if (commodityCodeEntity == null) {
return R.error("引用失败,集团物料不存在");
}
CommodityCodeEntity newCommodityCodeEntity = new CommodityCodeEntity();
try {
BeanUtils.copyProperties(newCommodityCodeEntity, commodityCodeEntity);
} catch (IllegalAccessException e) {
log.error("{}引用物料异常", LOGGER_MSG, e);
} catch (InvocationTargetException e) {
log.error("{}引用物料异常", LOGGER_MSG, e);
}
newCommodityCodeEntity.setId(baseService.getGenerateShotKey());
newCommodityCodeEntity.setXhfNsrsbh(quoteGroupCommodityDTO.getXhfNsrsbh());
if (groupCommodityMapper.insertCommodityCode(newCommodityCodeEntity) > 0) {
return R.ok();
} else {
return R.error("引用失败");
}
}
}

@ -16,6 +16,12 @@ public class MdmSyncGroupTaxCodeReqBO {
private String DESCSHORT; private String DESCSHORT;
private String UUID; private String UUID;
// 物料分类编码
private String CATEGORYNAME;
// 物料分类名称
private String CATEGORYCODE;
public void setCODE(String CODE) { public void setCODE(String CODE) {
this.CODE = CODE; this.CODE = CODE;
} }
@ -56,4 +62,19 @@ public class MdmSyncGroupTaxCodeReqBO {
return UUID; return UUID;
} }
public String getCATEGORYNAME() {
return CATEGORYNAME;
}
public void setCATEGORYNAME(String CATEGORYNAME) {
this.CATEGORYNAME = CATEGORYNAME;
}
public String getCATEGORYCODE() {
return CATEGORYCODE;
}
public void setCATEGORYCODE(String CATEGORYCODE) {
this.CATEGORYCODE = CATEGORYCODE;
}
} }

@ -1,6 +1,7 @@
package com.dxhy.order.consumer.openapi.service.impl; package com.dxhy.order.consumer.openapi.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dxhy.order.baseservice.module.base.service.BaseService;
import com.dxhy.order.baseservice.module.buyer.dao.BuyerMapper; 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.model.BuyerEntity;
import com.dxhy.order.baseservice.module.commodity.dao.CommodityMapper; import com.dxhy.order.baseservice.module.commodity.dao.CommodityMapper;
@ -19,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -43,6 +45,9 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
@Autowired @Autowired
private UserInfoService userInfoService; private UserInfoService userInfoService;
@Resource
private BaseService baseService;
@Override @Override
public AjaxResult syncBuyerMessage(List<MdmGmfxxtbReqBO> mdmGmfxxtbReqBOS, String requestBody) { public AjaxResult syncBuyerMessage(List<MdmGmfxxtbReqBO> mdmGmfxxtbReqBOS, String requestBody) {
// 存表 // 存表
@ -156,6 +161,9 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract {
commodityCodeEntity.setCreateTime(new Date()); commodityCodeEntity.setCreateTime(new Date());
commodityCodeEntity.setBz(reqBO.getDESCSHORT()); commodityCodeEntity.setBz(reqBO.getDESCSHORT());
commodityCodeEntity.setUUID(reqBO.getUUID()); commodityCodeEntity.setUUID(reqBO.getUUID());
commodityCodeEntity.setWlflbm(reqBO.getCATEGORYCODE());
commodityCodeEntity.setWlflmc(reqBO.getCATEGORYNAME());
commodityCodeEntity.setCommodityId(baseService.getGenerateShotKey());
commodityCodeEntity.setXhfNsrsbh("-1"); commodityCodeEntity.setXhfNsrsbh("-1");
if (commodityMapper.insertCommodityOnDuplicateKey(commodityCodeEntity) > 0) { if (commodityMapper.insertCommodityOnDuplicateKey(commodityCodeEntity) > 0) {
commodityCodeEntity.setSuccess(true); commodityCodeEntity.setSuccess(true);

Loading…
Cancel
Save