mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
1、未排单部分注释补充;2、未排单 - 房间柜体查询大板补充片数属性;3、未排单大板查询序号key可能为空修复;
This commit is contained in:
+2
-3
@@ -1,12 +1,11 @@
|
|||||||
package com.cf.imes.module.executor.controller.admin.plan.bo;
|
package com.cf.imes.module.executor.controller.admin.plan.bo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class OrderIds {
|
public class OrderIds {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-3
@@ -1,41 +1,53 @@
|
|||||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||||
|
|
||||||
|
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class OrderGoodsResp {
|
public class OrderGoodsResp {
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "订单id")
|
@Schema(description = "订单id")
|
||||||
private List<OrderIds> orderIds;
|
private List<OrderIds> orderIds = new ArrayList<>();
|
||||||
|
|
||||||
@Schema(description = "商品id-商品编号")
|
@Schema(description = "商品id-商品编号")
|
||||||
private String goodsId;
|
private String goodsId;
|
||||||
|
|
||||||
@Schema(description = "商品名称")
|
@Schema(description = "商品名称")
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
|
||||||
@Schema(description = "商品材质")
|
@Schema(description = "商品材质")
|
||||||
private String material;
|
private String material;
|
||||||
|
|
||||||
@Schema(description = "商品颜色")
|
@Schema(description = "商品颜色")
|
||||||
private String color;
|
private String color;
|
||||||
|
|
||||||
@Schema(description = "宽")
|
@Schema(description = "宽")
|
||||||
private BigDecimal width;
|
private BigDecimal width;
|
||||||
|
|
||||||
@Schema(description = "高")
|
@Schema(description = "高")
|
||||||
private BigDecimal height;
|
private BigDecimal height;
|
||||||
|
|
||||||
@Schema(description = "厚")
|
@Schema(description = "厚")
|
||||||
private BigDecimal thickness;
|
private BigDecimal thickness;
|
||||||
|
|
||||||
@Schema(description = "商品纹理")
|
@Schema(description = "商品纹理")
|
||||||
private Boolean texture;
|
private Boolean texture;
|
||||||
|
|
||||||
@Schema(description = "商品品牌")
|
@Schema(description = "商品品牌")
|
||||||
private String brand;
|
private String brand;
|
||||||
|
|
||||||
@Schema(description = "商品规格")
|
@Schema(description = "商品规格")
|
||||||
private String spec;
|
private String spec;
|
||||||
|
|
||||||
@Schema(description = "面积")
|
@Schema(description = "面积")
|
||||||
private BigDecimal area;
|
private BigDecimal area;
|
||||||
|
|
||||||
|
|||||||
+18
-3
@@ -46,10 +46,25 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
|||||||
|
|
||||||
Long selectPlateCountByPlateIds(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper);
|
Long selectPlateCountByPlateIds(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单、房间、柜体下未排单大板
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param wrapper
|
||||||
|
* @param organId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<OrderGoodsResp> selectNoPlanGoodsByRoomAndBodyIds(@Param("page") IPage<OrderGoodsResp> page, @Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("organId") Long organId);
|
||||||
|
|
||||||
IPage<OrderGoodsResp> selectNoPlanGoodsByRoomAndBodyIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("organId") Long organId);
|
/**
|
||||||
|
* 查询订单下未排单大板
|
||||||
IPage<OrderGoodsResp> selectNoPlanGoodsList(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper,@Param("organId") Long organId);
|
*
|
||||||
|
* @param page
|
||||||
|
* @param wrapper
|
||||||
|
* @param organId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<OrderGoodsResp> selectNoPlanGoodsList(@Param("page") IPage<OrderGoodsResp> page, @Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper, @Param("organId") Long organId);
|
||||||
|
|
||||||
List<OrderGoodsResp> selectNoOrderGoodsIdList(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper, @Param("organId") Long organId, @Param("type") int type);
|
List<OrderGoodsResp> selectNoOrderGoodsIdList(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper, @Param("organId") Long organId, @Param("type") int type);
|
||||||
|
|
||||||
|
|||||||
+12
@@ -55,8 +55,20 @@ public interface PlanService {
|
|||||||
|
|
||||||
List<PlanRespVO> getPlanList();
|
List<PlanRespVO> getPlanList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未排订单分页查询
|
||||||
|
*
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
PageResult<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO);
|
PageResult<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未排订单大板分页查询
|
||||||
|
*
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
PageResult<OrderGoodsResp> getOrderGoodsPage(OrderPageReqVOCopy pageReqVO);
|
PageResult<OrderGoodsResp> getOrderGoodsPage(OrderPageReqVOCopy pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+41
-22
@@ -641,7 +641,7 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
.inIfPresent("oi.order_id", pageReqVO.getOrderIds())
|
.inIfPresent("oi.order_id", pageReqVO.getOrderIds())
|
||||||
.inIfPresent("oi.room_id", pageReqVO.getRoomId())
|
.inIfPresent("oi.room_id", pageReqVO.getRoomId())
|
||||||
.inIfPresent("oi.body_id", pageReqVO.getBodyId());
|
.inIfPresent("oi.body_id", pageReqVO.getBodyId());
|
||||||
orderGoodsResps = planItemMapper.selectNoPlanGoodsByRoomAndBodyIds(page,queryWrapperX,getUserOrganId());
|
orderGoodsResps = planItemMapper.selectNoPlanGoodsByRoomAndBodyIds(page, queryWrapperX, getUserOrganId());
|
||||||
type = OrderPlanQueryTypeEnum.GOODS_ROOMBODY_QUERY.getType();
|
type = OrderPlanQueryTypeEnum.GOODS_ROOMBODY_QUERY.getType();
|
||||||
}else {
|
}else {
|
||||||
queryWrapperX
|
queryWrapperX
|
||||||
@@ -664,19 +664,24 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
return new PageResult<>();
|
return new PageResult<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 整理商品名称
|
||||||
List<String> goodsName = records.stream().map(OrderGoodsResp::getGoodsName).distinct().toList();
|
List<String> goodsName = records.stream().map(OrderGoodsResp::getGoodsName).distinct().toList();
|
||||||
|
|
||||||
|
// 整理材料
|
||||||
List<String> material = records.stream().map(OrderGoodsResp::getMaterial).distinct().toList();
|
List<String> material = records.stream().map(OrderGoodsResp::getMaterial).distinct().toList();
|
||||||
|
|
||||||
|
// 整理颜色
|
||||||
List<String> color = records.stream().map(OrderGoodsResp::getColor).distinct().toList();
|
List<String> color = records.stream().map(OrderGoodsResp::getColor).distinct().toList();
|
||||||
|
|
||||||
|
// 整理厚度
|
||||||
List<BigDecimal> thickness = records.stream().map(OrderGoodsResp::getThickness).distinct().toList();
|
List<BigDecimal> thickness = records.stream().map(OrderGoodsResp::getThickness).distinct().toList();
|
||||||
|
|
||||||
|
// 整理品牌
|
||||||
List<String> brand = records.stream().map(OrderGoodsResp::getBrand).distinct().toList();
|
List<String> brand = records.stream().map(OrderGoodsResp::getBrand).distinct().toList();
|
||||||
|
|
||||||
|
// 整理纹理
|
||||||
List<Boolean> texture = records.stream().map(OrderGoodsResp::getTexture).distinct().toList();
|
List<Boolean> texture = records.stream().map(OrderGoodsResp::getTexture).distinct().toList();
|
||||||
|
|
||||||
|
|
||||||
queryWrapperX
|
queryWrapperX
|
||||||
.inIfPresent("og.goods_name",goodsName)
|
.inIfPresent("og.goods_name",goodsName)
|
||||||
.inIfPresent("og.material",material)
|
.inIfPresent("og.material",material)
|
||||||
@@ -685,11 +690,13 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
.inIfPresent("og.brand",brand)
|
.inIfPresent("og.brand",brand)
|
||||||
.inIfPresent("og.texture", texture);
|
.inIfPresent("og.texture", texture);
|
||||||
|
|
||||||
|
// 查询带订单列表的商品分组
|
||||||
List<OrderGoodsResp> orderGoodsIdList = planItemMapper.selectNoOrderGoodsIdList(queryWrapperX, getUserOrganId(), type);
|
List<OrderGoodsResp> orderGoodsIdList = planItemMapper.selectNoOrderGoodsIdList(queryWrapperX, getUserOrganId(), type);
|
||||||
|
|
||||||
|
// 订单列表匹配到商品上
|
||||||
mergeOrderGoodsLists(records, orderGoodsIdList);
|
mergeOrderGoodsLists(records, orderGoodsIdList);
|
||||||
|
|
||||||
return new PageResult<>(orderGoodsResps.getRecords(), orderGoodsResps.getTotal());
|
return new PageResult<>(records, orderGoodsResps.getTotal());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1796,36 +1803,48 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单列表匹配到商品上
|
||||||
|
*
|
||||||
|
* @param list1 商品列表
|
||||||
|
* @param list2 带订单列表的商品分组
|
||||||
|
*/
|
||||||
|
public void mergeOrderGoodsLists(List<OrderGoodsResp> list1, List<OrderGoodsResp> list2) {
|
||||||
|
Map<String, OrderGoodsResp> list1Map = new HashMap<>(list1.size());
|
||||||
|
|
||||||
|
long sort = 1;
|
||||||
|
|
||||||
public static void mergeOrderGoodsLists(List<OrderGoodsResp> list1, List<OrderGoodsResp> list2) {
|
// list1构建key分组
|
||||||
Map<String, OrderGoodsResp> list1Map = new HashMap<>();
|
|
||||||
for (OrderGoodsResp item1 : list1) {
|
for (OrderGoodsResp item1 : list1) {
|
||||||
String key = generateKey(item1);
|
item1.setSort(String.valueOf(sort++));
|
||||||
list1Map.put(key, item1);
|
list1Map.put(generateKey(item1), item1);
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicLong sort = new AtomicLong(System.currentTimeMillis());
|
// list2按key分组
|
||||||
|
Map<String, List<OrderGoodsResp>> list2Map =
|
||||||
|
list2.stream().collect(Collectors.groupingBy(this::generateKey));
|
||||||
|
|
||||||
for (OrderGoodsResp item2 : list2) {
|
// key匹配的情况下,把list2的orderIds加到list1中
|
||||||
String key = generateKey(item2);
|
for (var entry : list2Map.entrySet()) {
|
||||||
OrderGoodsResp matchedItem = list1Map.get(key);
|
OrderGoodsResp target = list1Map.get(entry.getKey());
|
||||||
if (matchedItem != null) {
|
|
||||||
if (matchedItem.getOrderIds() == null) {
|
if (target == null) continue;
|
||||||
matchedItem.setOrderIds(new ArrayList<>());
|
|
||||||
matchedItem.setSort(String.valueOf(sort.get()));
|
for (OrderGoodsResp item : entry.getValue()) {
|
||||||
}
|
if (CollUtil.isNotEmpty(item.getOrderIds())) {
|
||||||
if (item2.getOrderIds() != null) {
|
target.getOrderIds().addAll(item.getOrderIds());
|
||||||
matchedItem.getOrderIds().addAll(item2.getOrderIds());
|
|
||||||
matchedItem.setSort(String.valueOf(sort.get()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.addAndGet(1);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String generateKey(OrderGoodsResp item) {
|
/**
|
||||||
|
* 构建key
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String generateKey(OrderGoodsResp item) {
|
||||||
return String.join("|",
|
return String.join("|",
|
||||||
Objects.toString(item.getGoodsName(), ""),
|
Objects.toString(item.getGoodsName(), ""),
|
||||||
Objects.toString(item.getMaterial(), ""),
|
Objects.toString(item.getMaterial(), ""),
|
||||||
|
|||||||
+8
-8
@@ -60,7 +60,7 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
<if test="type != null and type == @com.cf.imes.module.executor.enums.OrderPlanQueryTypeEnum@GOODS_GROUP.getType()">
|
||||||
and og.plate_num - og.planned_plate_num > 0
|
and og.plate_num - og.planned_plate_num > 0
|
||||||
group by orderId,orderDate,deliveryDate,customer,address,defineId,status
|
group by orderId, orderDate, deliveryDate, customer, address, defineId, status
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
order by o.id desc;
|
order by o.id desc;
|
||||||
@@ -233,7 +233,6 @@
|
|||||||
<result property="thickness" column="thickness"/>
|
<result property="thickness" column="thickness"/>
|
||||||
<result property="brand" column="brand"/>
|
<result property="brand" column="brand"/>
|
||||||
<result property="num" column="num"/>
|
<result property="num" column="num"/>
|
||||||
<result property="area" column="area"/>
|
|
||||||
|
|
||||||
<collection property="orderIds" ofType="com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds" resultMap="orderIdsMap"/>
|
<collection property="orderIds" ofType="com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds" resultMap="orderIdsMap"/>
|
||||||
|
|
||||||
@@ -250,14 +249,14 @@
|
|||||||
<select id="selectNoPlanGoodsByRoomAndBodyIds" resultMap="OrderGoodsMap" parameterType="java.lang.Long">
|
<select id="selectNoPlanGoodsByRoomAndBodyIds" resultMap="OrderGoodsMap" parameterType="java.lang.Long">
|
||||||
|
|
||||||
|
|
||||||
select distinct
|
select
|
||||||
|
|
||||||
og.color as color,
|
og.color as color,
|
||||||
og.goods_name as goodsName,
|
og.goods_name as goodsName,
|
||||||
og.material as material,
|
og.material as material,
|
||||||
og.thickness as thickness,
|
og.thickness as thickness,
|
||||||
og.brand as brand,
|
og.brand as brand,
|
||||||
og.texture as texture
|
og.texture as texture,
|
||||||
|
sum(og.plate_num - og.planned_plate_num) as num
|
||||||
|
|
||||||
from order_item oi
|
from order_item oi
|
||||||
join order_plate op on op.order_id = oi.order_id and op.organ_id = oi.organ_id and op.id = oi.plate_id
|
join order_plate op on op.order_id = oi.order_id and op.organ_id = oi.organ_id and op.id = oi.plate_id
|
||||||
@@ -266,6 +265,8 @@
|
|||||||
and oi.plate_id != 0
|
and oi.plate_id != 0
|
||||||
and og.plate_num - og.planned_plate_num > 0
|
and og.plate_num - og.planned_plate_num > 0
|
||||||
and og.deleted = false
|
and og.deleted = false
|
||||||
|
group by og.color, og.goods_name, og.material, og.thickness, og.brand, og.texture
|
||||||
|
order by thickness desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
@@ -281,8 +282,7 @@
|
|||||||
og.thickness as thickness,
|
og.thickness as thickness,
|
||||||
og.brand as brand,
|
og.brand as brand,
|
||||||
og.texture as texture,
|
og.texture as texture,
|
||||||
sum(og.plate_num - og.planned_plate_num) as num,
|
sum(og.plate_num - og.planned_plate_num) as num
|
||||||
sum(og.area - og.planned_plate_area) as area
|
|
||||||
|
|
||||||
from orders o
|
from orders o
|
||||||
join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
join order_goods og on o.id = og.order_id and og.organ_id = #{organId}
|
||||||
@@ -291,7 +291,7 @@
|
|||||||
and og.plate_num - og.planned_plate_num > 0
|
and og.plate_num - og.planned_plate_num > 0
|
||||||
and og.deleted = false
|
and og.deleted = false
|
||||||
group by og.color, og.goods_name, og.material, og.thickness, og.brand, og.texture
|
group by og.color, og.goods_name, og.material, og.thickness, og.brand, og.texture
|
||||||
order by thickness desc
|
order by thickness desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user