Browse Source

fix:客户特殊价异常修复

checkBack
Yen 1 year ago
parent
commit
37fd830393
  1. 30
      src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java
  2. 27
      src/main/java/com/qs/serve/modules/goods/service/impl/GoodsSkuServiceImpl.java
  3. 10
      src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderServiceImpl.java

30
src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java

@ -22,6 +22,7 @@ import com.qs.serve.modules.goods.mapper.GoodsCustomerPriceMapper;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 客户价格关系表 服务实现类 * 客户价格关系表 服务实现类
@ -44,13 +45,19 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl<GoodsCustomerPric
@Override @Override
public void saveBatch(GoodsCustomerPriceBo param) { public void saveBatch(GoodsCustomerPriceBo param) {
// 移除历史记录
this.remove(new LambdaQueryWrapper<GoodsCustomerPrice>()
.eq(GoodsCustomerPrice::getSupplierId,param.getSupplierId())
.in(GoodsCustomerPrice::getSkuCode,
param.getSkuPriceItemList().stream().map(GoodsCustomerPriceBo.SkuPriceItem::getSkuCode).collect(Collectors.toList())
)
);
BmsSupplier supplier = bmsSupplierMapper.selectById(param.getSupplierId()); BmsSupplier supplier = bmsSupplierMapper.selectById(param.getSupplierId());
SysUser sysUser = sysUserMapper.selectById(AuthContextUtils.getSysUserId()); SysUser sysUser = sysUserMapper.selectById(AuthContextUtils.getSysUserId());
LocalDateTime nowTime = LocalDateTime.now(); LocalDateTime nowTime = LocalDateTime.now();
List<Long> existIds = new ArrayList<>();
for (GoodsCustomerPriceBo.SkuPriceItem item : param.getSkuPriceItemList()) { for (GoodsCustomerPriceBo.SkuPriceItem item : param.getSkuPriceItemList()) {
GoodsCustomerPrice customerPrice = this.getBySupplierIdAndCode(param.getSupplierId(),item.getSkuCode()); GoodsCustomerPrice customerPrice = this.getBySupplierIdAndCode(param.getSupplierId(),item.getSkuCode());
if(customerPrice==null){
GoodsSku goodsSku = goodsSkuMapper.selectBySkuCode(item.getSkuCode()); GoodsSku goodsSku = goodsSkuMapper.selectBySkuCode(item.getSkuCode());
if(goodsSku==null){ if(goodsSku==null){
continue; continue;
@ -68,22 +75,8 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl<GoodsCustomerPric
customerPrice.setMakerCode(sysUser.getCode()); customerPrice.setMakerCode(sysUser.getCode());
customerPrice.setMarkTime(nowTime); customerPrice.setMarkTime(nowTime);
this.save(customerPrice); this.save(customerPrice);
existIds.add(customerPrice.getId());
}else {
existIds.add(customerPrice.getId());
customerPrice.setRealPrice(item.getPrice());
customerPrice.setMaker(sysUser.getName());
customerPrice.setMakerCode(sysUser.getCode());
customerPrice.setMarkTime(nowTime);
this.updateById(customerPrice);
} }
} }
//移除历史记录
LambdaQueryWrapper<GoodsCustomerPrice> rmLqw = new LambdaQueryWrapper<>();
rmLqw.eq(GoodsCustomerPrice::getSupplierId,supplier.getId());
rmLqw.notIn(GoodsCustomerPrice::getId,existIds);
this.remove(rmLqw);
}
@Override @Override
public GoodsCustomerPrice singleModify(GoodsCustomerPriceSingleBo param) { public GoodsCustomerPrice singleModify(GoodsCustomerPriceSingleBo param) {
@ -100,7 +93,7 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl<GoodsCustomerPric
customerPrice = new GoodsCustomerPrice(); customerPrice = new GoodsCustomerPrice();
customerPrice.setSupplierId(supplier.getId()); customerPrice.setSupplierId(supplier.getId());
customerPrice.setSupplierCode(supplier.getCode()); customerPrice.setSupplierCode(supplier.getCode());
customerPrice.setSupplierName(supplier.getSupplierName()); customerPrice.setSupplierName(supplier.getName());
customerPrice.setSkuId(goodsSku.getId()+""); customerPrice.setSkuId(goodsSku.getId()+"");
customerPrice.setSkuCode(goodsSku.getSkuCode()); customerPrice.setSkuCode(goodsSku.getSkuCode());
customerPrice.setSkuName(goodsSku.getSkuName()); customerPrice.setSkuName(goodsSku.getSkuName());
@ -112,6 +105,9 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl<GoodsCustomerPric
customerPrice.setMarkTime(nowTime); customerPrice.setMarkTime(nowTime);
this.save(customerPrice); this.save(customerPrice);
}else { }else {
customerPrice.setSupplierId(supplier.getId());
customerPrice.setSupplierCode(supplier.getCode());
customerPrice.setSupplierName(supplier.getName());
customerPrice.setRealPrice(param.getPrice()); customerPrice.setRealPrice(param.getPrice());
customerPrice.setMaker(sysUser.getName()); customerPrice.setMaker(sysUser.getName());
customerPrice.setMakerCode(sysUser.getCode()); customerPrice.setMakerCode(sysUser.getCode());

27
src/main/java/com/qs/serve/modules/goods/service/impl/GoodsSkuServiceImpl.java

@ -13,6 +13,7 @@ import com.qs.serve.modules.goods.entity.vo.GoodSkuVo;
import com.qs.serve.modules.goods.entity.vo.GoodsSkuSpecValueVo; import com.qs.serve.modules.goods.entity.vo.GoodsSkuSpecValueVo;
import com.qs.serve.modules.goods.mapper.GoodsCategoryMapper; import com.qs.serve.modules.goods.mapper.GoodsCategoryMapper;
import com.qs.serve.modules.goods.mapper.GoodsSpuMapper; import com.qs.serve.modules.goods.mapper.GoodsSpuMapper;
import com.qs.serve.modules.goods.service.GoodsCustomerPriceService;
import com.qs.serve.modules.goods.service.GoodsSkuSpecValueService; import com.qs.serve.modules.goods.service.GoodsSkuSpecValueService;
import com.qs.serve.modules.goods.service.GoodsSpecValueService; import com.qs.serve.modules.goods.service.GoodsSpecValueService;
import com.qs.serve.modules.seeyon.service.impl.SeeYonRequestBaseService; import com.qs.serve.modules.seeyon.service.impl.SeeYonRequestBaseService;
@ -90,19 +91,29 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper,GoodsSku> im
query.setCusCode(supplierCode); query.setCusCode(supplierCode);
query.setInvCodes(codes); query.setInvCodes(codes);
try { try {
R<String> res = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_PRICE,query,"查询客户特殊价"); GoodsCustomerPriceService goodsCustomerPriceService = SpringUtils.getBean(GoodsCustomerPriceService.class);
if(res.getStatus().equals(200)){ List<GoodsCustomerPrice> customerPrices = goodsCustomerPriceService.getBySupplierCodeAndCode(supplierCode,codes);
List<InventoryCusPrice> inventoryCusPrices = JsonUtil.jsonToList(res.getData(), InventoryCusPrice.class); for (GoodsCustomerPrice customerPrice : customerPrices) {
assert inventoryCusPrices != null;
for (InventoryCusPrice cusPrice : inventoryCusPrices) {
for (GoodsSku sku : skus) { for (GoodsSku sku : skus) {
if(sku.getSkuCode().equals(cusPrice.getInvCode())){ if(sku.getSkuCode().equals(customerPrice.getSkuCode())){
sku.setSalesPrice(cusPrice.getPrice()); sku.setSalesPrice(customerPrice.getRealPrice());
break; break;
} }
} }
} }
} // R<String> res = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_PRICE,query,"查询客户特殊价");
// if(res.getStatus().equals(200)){
// List<InventoryCusPrice> inventoryCusPrices = JsonUtil.jsonToList(res.getData(), InventoryCusPrice.class);
// assert inventoryCusPrices != null;
// for (InventoryCusPrice cusPrice : inventoryCusPrices) {
// for (GoodsSku sku : skus) {
// if(sku.getSkuCode().equals(cusPrice.getInvCode())){
// sku.setSalesPrice(cusPrice.getPrice());
// break;
// }
// }
// }
// }
} catch (Exception e) { } catch (Exception e) {
log.error("客户特殊价异常:{}",e.getMessage()); log.error("客户特殊价异常:{}",e.getMessage());
} }

10
src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderServiceImpl.java

@ -329,6 +329,16 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper,OmsOrder> im
List<String> skuCodes = newOrderItemList.stream().map(OmsOrderItem::getSkuCode).collect(Collectors.toList()); List<String> skuCodes = newOrderItemList.stream().map(OmsOrderItem::getSkuCode).collect(Collectors.toList());
List<GoodsCustomerPrice> customerPrices = goodsCustomerPriceService.getBySupplierCodeAndCode(supplier.getCode(),skuCodes);
for (OmsOrderItem orderItem : newOrderItemList) {
for (GoodsCustomerPrice customerPrice : customerPrices) {
if(orderItem.getSkuCode().equals(customerPrice.getSkuCode())){
orderItem.setSalesPrice(customerPrice.getRealPrice());
break;
}
}
}
//拦截商品授权维度规则 //拦截商品授权维度规则
if(supplier!=null){ if(supplier!=null){
GoodsAccrIdsDto accrIdsDto = goodsAccreditService.listIgnoreAcc2(supplier.getId(),supplier.listBizRegionIds(),supplier.listSaleRegionIds()); GoodsAccrIdsDto accrIdsDto = goodsAccreditService.listIgnoreAcc2(supplier.getId(),supplier.listBizRegionIds(),supplier.listSaleRegionIds());

Loading…
Cancel
Save