修复
This commit is contained in:
@@ -51,6 +51,8 @@ public class GearStockIoOrderBo extends BaseEntity {
|
||||
|
||||
private Long supplierId;
|
||||
|
||||
private Integer materialTypeSnapshot;
|
||||
|
||||
private Date planArrivalTime;
|
||||
|
||||
private Date actualArrivalTime;
|
||||
|
||||
@@ -46,6 +46,12 @@ public class GearPurchasePlanDetailVo {
|
||||
@ExcelProperty(value = "原材料名称")
|
||||
private String rawMaterialName;
|
||||
|
||||
/**
|
||||
* 厂家
|
||||
*/
|
||||
@ExcelProperty(value = "厂家")
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
|
||||
@@ -103,4 +103,6 @@ public class GearStockIoOrderVo extends BaseEntity {
|
||||
private String remark;
|
||||
|
||||
private String materialNames;
|
||||
|
||||
private String factoryNames;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gear.oa.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.oa.domain.GearPurchasePlanDetail;
|
||||
@@ -8,6 +7,8 @@ import com.gear.oa.domain.vo.GearPurchasePlanDetailVo;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购计划明细Mapper接口
|
||||
*
|
||||
@@ -17,4 +18,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface GearPurchasePlanDetailMapper extends BaseMapperPlus<GearPurchasePlanDetailMapper, GearPurchasePlanDetail, GearPurchasePlanDetailVo> {
|
||||
|
||||
Page<GearPurchasePlanDetailVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<GearPurchasePlanDetail> lqw);
|
||||
|
||||
List<GearPurchasePlanDetailVo> selectVoListPlus(@Param("ew") QueryWrapper<GearPurchasePlanDetail> lqw);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Map;
|
||||
|
||||
public interface MatMaterialSimpleMapper {
|
||||
|
||||
@Select("select material_id as materialId, material_name as materialName, material_type as materialType, unit as unit, current_stock as currentStock " +
|
||||
@Select("select material_id as materialId, material_name as materialName, material_type as materialType, unit as unit, factory as factory, current_stock as currentStock " +
|
||||
"from mat_material where material_id = #{materialId} and del_flag = 0 limit 1")
|
||||
Map<String, Object> selectSnapshot(@Param("materialId") Long materialId);
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ public class GearPurchasePlanDetailServiceImpl implements IGearPurchasePlanDetai
|
||||
*/
|
||||
@Override
|
||||
public List<GearPurchasePlanDetailVo> queryList(GearPurchasePlanDetailBo bo) {
|
||||
LambdaQueryWrapper<GearPurchasePlanDetail> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
QueryWrapper<GearPurchasePlanDetail> lqw = buildQueryWrapperPlus(bo);
|
||||
return baseMapper.selectVoListPlus(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<GearPurchasePlanDetail> buildQueryWrapper(GearPurchasePlanDetailBo bo) {
|
||||
|
||||
@@ -102,25 +102,42 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
return;
|
||||
}
|
||||
Map<Long, LinkedHashSet<String>> namesMap = new HashMap<>();
|
||||
Map<Long, LinkedHashSet<String>> factoryMap = new HashMap<>();
|
||||
Map<Long, String> materialFactoryCache = new HashMap<>();
|
||||
for (GearStockIoOrderDetail d : details) {
|
||||
if (d == null || d.getOrderId() == null) {
|
||||
continue;
|
||||
}
|
||||
String name = d.getItemName();
|
||||
if (StringUtils.isBlank(name)) {
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
namesMap.computeIfAbsent(d.getOrderId(), k -> new LinkedHashSet<>()).add(name);
|
||||
}
|
||||
if (!"material".equals(d.getItemType()) || d.getItemId() == null) {
|
||||
continue;
|
||||
}
|
||||
namesMap.computeIfAbsent(d.getOrderId(), k -> new LinkedHashSet<>()).add(name);
|
||||
String factory = materialFactoryCache.get(d.getItemId());
|
||||
if (factory == null) {
|
||||
Map<String, Object> snapshot = matMaterialMapper.selectSnapshot(d.getItemId());
|
||||
Object factoryObj = snapshot == null ? null : snapshot.get("factory");
|
||||
factory = factoryObj == null ? "" : String.valueOf(factoryObj);
|
||||
materialFactoryCache.put(d.getItemId(), factory);
|
||||
}
|
||||
if (StringUtils.isNotBlank(factory)) {
|
||||
factoryMap.computeIfAbsent(d.getOrderId(), k -> new LinkedHashSet<>()).add(factory);
|
||||
}
|
||||
}
|
||||
for (GearStockIoOrderVo o : orders) {
|
||||
if (o == null || o.getOrderId() == null) {
|
||||
continue;
|
||||
}
|
||||
LinkedHashSet<String> set = namesMap.get(o.getOrderId());
|
||||
if (set == null || set.isEmpty()) {
|
||||
continue;
|
||||
if (set != null && !set.isEmpty()) {
|
||||
o.setMaterialNames(String.join("、", set));
|
||||
}
|
||||
LinkedHashSet<String> factorySet = factoryMap.get(o.getOrderId());
|
||||
if (factorySet != null && !factorySet.isEmpty()) {
|
||||
o.setFactoryNames(String.join("、", factorySet));
|
||||
}
|
||||
o.setMaterialNames(String.join("、", set));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +165,9 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
lqw.apply(bo.getSupplierId() != null,
|
||||
"exists (select 1 from gear_stock_io_order_detail d left join gear_purchase_plan_detail ppd on d.source_detail_no = ppd.detail_code and ppd.del_flag = 0 where d.del_flag = '0' and d.order_id = gear_stock_io_order.order_id and ppd.supplier_id = {0})",
|
||||
bo.getSupplierId());
|
||||
lqw.apply(bo.getMaterialTypeSnapshot() != null,
|
||||
"exists (select 1 from gear_stock_io_order_detail d where d.del_flag = '0' and d.order_id = gear_stock_io_order.order_id and d.material_type_snapshot = {0})",
|
||||
bo.getMaterialTypeSnapshot());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDelayStatus()), GearStockIoOrder::getDelayStatus, bo.getDelayStatus());
|
||||
lqw.orderByDesc(GearStockIoOrder::getCreateTime);
|
||||
return lqw;
|
||||
@@ -168,6 +188,7 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
|
||||
bo.getItemName());
|
||||
qw.like(StringUtils.isNotBlank(bo.getFactory()), "m.factory", bo.getFactory());
|
||||
qw.eq(bo.getSupplierId() != null, "ppd.supplier_id", bo.getSupplierId());
|
||||
qw.eq(bo.getMaterialTypeSnapshot() != null, "d.material_type_snapshot", bo.getMaterialTypeSnapshot());
|
||||
return qw;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user