From 018fd392f1d0c9093db87abe2a84f033ebfb421b Mon Sep 17 00:00:00 2001 From: gaorl Date: Thu, 15 Jun 2023 10:33:11 +0800 Subject: [PATCH] =?UTF-8?q?feature=EF=BC=9A=E6=96=B0=E5=A2=9E=E7=89=A9?= =?UTF-8?q?=E6=96=99=E6=97=B6=E6=8E=A7=E5=88=B6=E6=9B=B4=E6=96=B0=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=92=8C=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E5=8F=91=E7=A5=A8=E5=BC=80=E5=85=B7=E5=90=8E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=A9=E6=96=99=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommodityServiceImpl.java | 17 ++++++++++---- .../mybatis/mapper/CommodityMapper.xml | 23 +++++++++++-------- .../impl/GroupCommodityCodeServiceImpl.java | 4 ++-- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java index d2689aaf..e5fbb05e 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java @@ -119,7 +119,7 @@ public class CommodityServiceImpl implements CommodityService { return R.error().put(OrderManagementConstant.DATA, "新增物料信息已存在,请检查"); } } - + codeEntity.setDataSource(CommodityCodeEnum.DATA_SOURCE_1.getKey()); if (count > 0 && ObjectUtil.isNotEmpty(commodityCodeEntities)) { log.debug("修改操作 id = {}", id); if (StringUtils.isNotEmpty(codeEntity.getSpbm())) { @@ -134,13 +134,13 @@ public class CommodityServiceImpl implements CommodityService { } codeEntity.setXhfNsrsbh(null);//不更新税号 codeEntity.setModifyTime(new Date()); + codeEntity.setCreateTime(null); + codeEntity.setUserId(null); codeEntity.setModifyUserId(userId.toString()); if(commodityMapper.updateCommodity(codeEntity, null) <= 0){ return R.error().put(OrderManagementConstant.DATA, "更新物料信息失败,请联系管理员"); } } else { - - codeEntity.setDataSource(CommodityCodeEnum.DATA_SOURCE_1.getKey()); codeEntity.setCreateTime(new Date()); codeEntity.setUserId(userId.toString()); codeEntity.setMatchingState(TaxClassCodeEnum.MATCHING_STATE_1.getKey()); @@ -626,6 +626,10 @@ public class CommodityServiceImpl implements CommodityService { map.put("zxbm",zxbm); map.put("entId",receiveSpxxReq.getEntId()); + if(StringUtils.isBlank(receiveSpxxReq.getEntId())){ + log.debug("公司代码为空不允许保存物料信息"); + return; + } log.debug("{}校验名称是否存在 参数:{}", LOGGER_MSG, map); List commodityCodeEntityList = commodityMapper.queryProductList(map, null); TaxClassCodeEntity taxClassCodeEntity = taxClassCodeService.queryTaxClassCodeFromCache(receiveSpxxReq.getSpbm()); @@ -646,9 +650,12 @@ public class CommodityServiceImpl implements CommodityService { log.debug("添加成功"); } - }else{ + }else if(commodityCodeEntityList.size() == 1){ // 简称、商品编码、规格型号、单位、优惠政策标识、零税率标识 - //todo 优先级 + if(Arrays.asList("1,2,6,8".split(",")).contains(commodityCodeEntityList.get(0).getDataSource())){ + log.info("当前物料优先级较低,不进行更新高级物料"); + return; + } commodityCodeEntity.setModifyTime(new Date()); commodityCodeEntity.setModifyUserId(userInfoService.getUser() != null && userInfoService.getUser().getUserId() != null ? userInfoService.getUser().getUserId().toString():""); if (commodityCodeEntity != null){ 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 d18dc27c..a066ab80 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 @@ -440,14 +440,11 @@ - - - and encoding = #{map.zxbm,jdbcType=VARCHAR} - + where + encoding = #{map.zxbm,jdbcType=VARCHAR} and ent_id = #{map.entId,jdbcType=VARCHAR} - @@ -591,8 +588,12 @@ user_id, - create_time, - modify_time, + + create_time, + + + modify_time, + modify_user_id, @@ -707,8 +708,12 @@ #{userId,jdbcType=VARCHAR}, - now(), - now(), + + now(), + + + now(), + SYSDATE, diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.java index 44c67c1a..8fbae283 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.java @@ -136,7 +136,6 @@ public class GroupCommodityCodeServiceImpl implements IGroupCommodityCodeService CommodityCodeEntity newCommodityCodeEntity = new CommodityCodeEntity(); try { BeanUtils.copyProperties(newCommodityCodeEntity, commodityCodeEntity); - newCommodityCodeEntity.setEntId(quoteGroupCommodityDTO.getDeptId()); newCommodityCodeEntity.setDataSource(CommodityCodeEnum.DATA_SOURCE_9.getKey()); } catch (IllegalAccessException e) { log.error("{}引用物料异常", LOGGER_MSG, e); @@ -159,9 +158,10 @@ public class GroupCommodityCodeServiceImpl implements IGroupCommodityCodeService } }else{ newCommodityCodeEntity.setId(baseService.getGenerateShotKey()); + newCommodityCodeEntity.setEntId(quoteGroupCommodityDTO.getDeptId()); newCommodityCodeEntity.setXhfNsrsbh(quoteGroupCommodityDTO.getXhfNsrsbh()); - newCommodityCodeEntity.setDataState(ConfigureConstant.STRING_0); newCommodityCodeEntity.setXhfMc(quoteGroupCommodityDTO.getXhfMc()); + newCommodityCodeEntity.setDataState(ConfigureConstant.STRING_0); newCommodityCodeEntity.setHsbz(ConfigureConstant.STRING_1); newCommodityCodeEntity.setYhzcbs(ConfigureConstant.STRING_0); newCommodityCodeEntity.setCreateTime(new Date());