Browse Source

opt: 修改用户特殊价同步

checkBack
Yen 1 year ago
parent
commit
545a511d11
  1. 67
      src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCustomerPriceServiceImpl.java
  2. 3
      src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderPart1ServiceImpl.java
  3. 3
      src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java
  4. 12
      src/main/resources/mapper/goods/GoodsCustomerPriceMapper.xml

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

@ -12,6 +12,7 @@ import com.qs.serve.modules.goods.entity.GoodsSku;
import com.qs.serve.modules.goods.entity.bo.GoodsCustomerPriceBo; import com.qs.serve.modules.goods.entity.bo.GoodsCustomerPriceBo;
import com.qs.serve.modules.goods.entity.bo.GoodsCustomerPriceSingleBo; import com.qs.serve.modules.goods.entity.bo.GoodsCustomerPriceSingleBo;
import com.qs.serve.modules.goods.entity.dto.InventoryCusPrice; import com.qs.serve.modules.goods.entity.dto.InventoryCusPrice;
import com.qs.serve.modules.goods.entity.so.InventoryCusPriceQuery;
import com.qs.serve.modules.goods.mapper.GoodsSkuMapper; import com.qs.serve.modules.goods.mapper.GoodsSkuMapper;
import com.qs.serve.modules.seeyon.service.SeeYonRequestService; import com.qs.serve.modules.seeyon.service.SeeYonRequestService;
import com.qs.serve.modules.seeyon.service.impl.SeeYonRequestBaseService; import com.qs.serve.modules.seeyon.service.impl.SeeYonRequestBaseService;
@ -27,9 +28,11 @@ import com.qs.serve.modules.goods.entity.GoodsCustomerPrice;
import com.qs.serve.modules.goods.service.GoodsCustomerPriceService; import com.qs.serve.modules.goods.service.GoodsCustomerPriceService;
import com.qs.serve.modules.goods.mapper.GoodsCustomerPriceMapper; import com.qs.serve.modules.goods.mapper.GoodsCustomerPriceMapper;
import java.time.LocalDate;
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.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -161,24 +164,47 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl<GoodsCustomerPric
if(dictData!=null&&dictData.getKeyVal()!=null){ if(dictData!=null&&dictData.getKeyVal()!=null){
maxId = Long.parseLong(dictData.getKeyVal()); maxId = Long.parseLong(dictData.getKeyVal());
} }
List<InventoryCusPrice> cusPriceList = new ArrayList<>(); List<InventoryCusPrice> allCusPriceList = new ArrayList<>();
R<String> res = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_LAST_UPD+"/"+maxId,null,"查询最近更新的客户特殊价"); R<String> res = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_LAST_UPD+"/"+maxId,null,"查询最近更新的客户特殊价");
if(res.getStatus().equals(200)){ if(res.getStatus().equals(200)){
cusPriceList = JsonUtil.jsonToList(res.getData(), InventoryCusPrice.class); allCusPriceList = JsonUtil.jsonToList(res.getData(), InventoryCusPrice.class);
} }
assert cusPriceList != null; assert allCusPriceList != null;
for (InventoryCusPrice cusPrice : cusPriceList) { long times = System.currentTimeMillis();
if(maxId==null || cusPrice.getRowId() > maxId){
maxId = cusPrice.getRowId(); Map<String,List<InventoryCusPrice>> cusPriceMap = allCusPriceList.stream().collect(Collectors.groupingBy(InventoryCusPrice::getCusCode));
for (String cusCode : cusPriceMap.keySet()) {
List<InventoryCusPrice> cusPriceList = cusPriceMap.get(cusCode);
List<String> skuCodes = cusPriceList.stream().map(InventoryCusPrice::getInvCode).collect(Collectors.toList());
List<GoodsSku> goodsSkus = goodsSkuMapper.selectList(new LambdaQueryWrapper<GoodsSku>().in(GoodsSku::getSkuCode,skuCodes));
List<GoodsCustomerPrice> goodsCustomerPriceList = new ArrayList<>();
InventoryCusPriceQuery query = new InventoryCusPriceQuery();
query.setCusCode(cusCode);
query.setInvCodes(skuCodes);
R<String> erpRs = seeYonRequestBaseService.postBase(TbsSeeYonConst.ERP_CUS_INV_PRICE,query,"查询客户特殊价");
List<InventoryCusPrice> erpCusPriceList = new ArrayList<>();
if(erpRs.getStatus().equals(200)){
erpCusPriceList = JsonUtil.jsonToList(erpRs.getData(), InventoryCusPrice.class);
} }
GoodsCustomerPrice customerPrice = this.getByCusCodeAndSkuCode(cusPrice.getCusCode(),cusPrice.getInvCode());
if(customerPrice==null){
GoodsSku goodsSku = goodsSkuMapper.selectBySkuCode(cusPrice.getInvCode());
BmsSupplier supplier = bmsSupplierMapper.selectOne(new LambdaQueryWrapper<BmsSupplier>() BmsSupplier supplier = bmsSupplierMapper.selectOne(new LambdaQueryWrapper<BmsSupplier>()
.eq(BmsSupplier::getCode,cusPrice.getCusCode())); .eq(BmsSupplier::getCode,cusCode));
customerPrice = new GoodsCustomerPrice();
for (InventoryCusPrice cusPrice : erpCusPriceList) {
GoodsSku goodsSku = null;
for (GoodsSku skuItem : goodsSkus) {
if(skuItem.getSkuCode().equals(cusPrice.getInvCode())){
goodsSku = skuItem;
}
}
//跳过无效商品
if(goodsSku==null){
continue;
}
GoodsCustomerPrice customerPrice = new GoodsCustomerPrice();
customerPrice.setSupplierId(supplier.getId()); customerPrice.setSupplierId(supplier.getId());
customerPrice.setSupplierCode(supplier.getCode()); customerPrice.setSupplierCode(supplier.getCode());
customerPrice.setSupplierName(supplier.getName()); customerPrice.setSupplierName(supplier.getName());
@ -188,10 +214,21 @@ public class GoodsCustomerPriceServiceImpl extends ServiceImpl<GoodsCustomerPric
customerPrice.setSkuUnit(goodsSku.getUnitName()); customerPrice.setSkuUnit(goodsSku.getUnitName());
customerPrice.setInitPrice(cusPrice.getPrice()); customerPrice.setInitPrice(cusPrice.getPrice());
customerPrice.setRealPrice(cusPrice.getPrice()); customerPrice.setRealPrice(cusPrice.getPrice());
this.save(customerPrice); goodsCustomerPriceList.add(customerPrice);
}else { }
customerPrice.setRealPrice(cusPrice.getPrice()); if(goodsCustomerPriceList.size()>0){
this.updateById(customerPrice); //移除旧历史
this.remove(new LambdaQueryWrapper<GoodsCustomerPrice>()
.eq(GoodsCustomerPrice::getSupplierCode,cusCode)
.in(GoodsCustomerPrice::getSkuCode,goodsSkus)
);
this.saveBatch(goodsCustomerPriceList);
}
}
for (InventoryCusPrice cusPrice : allCusPriceList) {
if(maxId==null || cusPrice.getRowId() > maxId){
maxId = cusPrice.getRowId();
} }
} }
if(maxId!=0){ if(maxId!=0){

3
src/main/java/com/qs/serve/modules/oms/service/impl/OmsOrderPart1ServiceImpl.java

@ -140,6 +140,9 @@ public class OmsOrderPart1ServiceImpl implements OmsOrderPart1Service {
if(batch.getEndDate().isBefore(nowDate)){ if(batch.getEndDate().isBefore(nowDate)){
errorImminentIds.add(new SimpleKeyValue("临期品已过期",batch.getId())); errorImminentIds.add(new SimpleKeyValue("临期品已过期",batch.getId()));
} }
if(batch.getQuantity()-batch.getOrderQuantity()<=0){
errorImminentIds.add(new SimpleKeyValue("临期品库存不足",batch.getId()));
}
} }
} }

3
src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java

@ -52,6 +52,9 @@ public class TbsBudgetVo implements Serializable {
/** 是否允许跨年,控制停用状态 */ /** 是否允许跨年,控制停用状态 */
private Integer crossYearFlag; private Integer crossYearFlag;
/** 不活动的 0/1 用于随意关停预算 */
private Integer inactiveFlag;
/** 科目id */ /** 科目id */
@NotNull(message = "科目id不能为空") @NotNull(message = "科目id不能为空")
private Long subjectId; private Long subjectId;

12
src/main/resources/mapper/goods/GoodsCustomerPriceMapper.xml

@ -52,16 +52,16 @@
and `goods_customer_price`.`del_flag` = 0 and `goods_customer_price`.`del_flag` = 0
<if test="query.id != null"> and `goods_customer_price`.`id` = #{query.id}</if> <if test="query.id != null"> and `goods_customer_price`.`id` = #{query.id}</if>
<if test="query.supplierId != null"> and `goods_customer_price`.`supplier_id` = #{query.supplierId}</if> <if test="query.supplierId != null"> and `goods_customer_price`.`supplier_id` = #{query.supplierId}</if>
<if test="query.supplierCode != null"> and `goods_customer_price`.`supplier_code` = #{query.supplierCode}</if> <if test="query.supplierCode != null"> and `goods_customer_price`.`supplier_code` like concat('%',#{query.supplierCode},'%') </if>
<if test="query.supplierName != null and query.supplierName != ''"> and `goods_customer_price`.`supplier_name` = #{query.supplierName}</if> <if test="query.supplierName != null and query.supplierName != ''"> and `goods_customer_price`.`supplier_name` like concat('%',#{query.supplierName},'%') </if>
<if test="query.skuCode != null and query.skuCode != ''"> and `goods_customer_price`.`sku_code` = #{query.skuCode}</if> <if test="query.skuCode != null and query.skuCode != ''"> and `goods_customer_price`.`sku_code` like concat('%',#{query.skuCode},'%') </if>
<if test="query.skuId != null and query.skuId != ''"> and `goods_customer_price`.`sku_id` = #{query.skuId}</if> <if test="query.skuId != null and query.skuId != ''"> and `goods_customer_price`.`sku_id` = #{query.skuId}</if>
<if test="query.skuName != null and query.skuName != ''"> and `goods_customer_price`.`sku_name` = #{query.skuName}</if> <if test="query.skuName != null and query.skuName != ''"> and `goods_customer_price`.`sku_name` like concat('%',#{query.skuName},'%') </if>
<if test="query.skuUnit != null and query.skuUnit != ''"> and `goods_customer_price`.`sku_unit` = #{query.skuUnit}</if> <if test="query.skuUnit != null and query.skuUnit != ''"> and `goods_customer_price`.`sku_unit` = #{query.skuUnit}</if>
<if test="query.initPrice != null"> and `goods_customer_price`.`init_price` = #{query.initPrice}</if> <if test="query.initPrice != null"> and `goods_customer_price`.`init_price` = #{query.initPrice}</if>
<if test="query.realPrice != null"> and `goods_customer_price`.`real_price` = #{query.realPrice}</if> <if test="query.realPrice != null"> and `goods_customer_price`.`real_price` = #{query.realPrice}</if>
<if test="query.maker != null and query.maker != ''"> and `goods_customer_price`.`maker` = #{query.maker}</if> <if test="query.maker != null and query.maker != ''"> and `goods_customer_price`.`maker` like concat('%',#{query.maker},'%') </if>
<if test="query.makerCode != null and query.makerCode != ''"> and `goods_customer_price`.`maker_code` = #{query.makerCode}</if> <if test="query.makerCode != null and query.makerCode != ''"> and `goods_customer_price`.`maker_code` like concat('%',#{query.makerCode},'%') </if>
<if test="query.markTime != null"> and `goods_customer_price`.`mark_time` = #{query.markTime}</if> <if test="query.markTime != null"> and `goods_customer_price`.`mark_time` = #{query.markTime}</if>
<if test="query.createTime != null"> and `goods_customer_price`.`create_time` = #{query.createTime}</if> <if test="query.createTime != null"> and `goods_customer_price`.`create_time` = #{query.createTime}</if>
<if test="query.createBy != null and query.createBy != ''"> and `goods_customer_price`.`create_by` = #{query.createBy}</if> <if test="query.createBy != null and query.createBy != ''"> and `goods_customer_price`.`create_by` = #{query.createBy}</if>

Loading…
Cancel
Save