feature:新增物料时控制更新时间和创建时间,发票开具后更新物料逻辑

release
gaorl 2 years ago
parent 66943ad3c5
commit 018fd392f1
  1. 17
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/commodity/service/impl/CommodityServiceImpl.java
  2. 23
      order-management-base-service/src/main/resources/mybatis/mapper/CommodityMapper.xml
  3. 4
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/commodity/service/impl/GroupCommodityCodeServiceImpl.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<CommodityCodeEntity> 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){

@ -440,14 +440,11 @@
</if>
</set>
<where>
<if test="map.zxbm != null">
and encoding = #{map.zxbm,jdbcType=VARCHAR}
</if>
where
encoding = #{map.zxbm,jdbcType=VARCHAR}
<if test="map.entId != null">
and ent_id = #{map.entId,jdbcType=VARCHAR}
</if>
</where>
</update>
<update id="batchUpdateCommodity" parameterType="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeEntity">
<bind name="dataType" value="${dataType}"/>
@ -591,8 +588,12 @@
<if test="userId != null">
user_id,
</if>
create_time,
modify_time,
<if test="createTime != null">
create_time,
</if>
<if test="modifyTime != null">
modify_time,
</if>
<if test="modifyUserId != null">
modify_user_id,
</if>
@ -707,8 +708,12 @@
#{userId,jdbcType=VARCHAR},
</if>
<if test="dataType == 0">
now(),
now(),
<if test="createTime != null">
now(),
</if>
<if test="modifyTime != null">
now(),
</if>
</if>
<if test="dataType == 1">
SYSDATE,

@ -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());

Loading…
Cancel
Save