mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +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;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class OrderIds {
|
||||
|
||||
|
||||
|
||||
+15
-3
@@ -1,41 +1,53 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
|
||||
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 lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class OrderGoodsResp {
|
||||
|
||||
|
||||
@Schema(description = "订单id")
|
||||
private List<OrderIds> orderIds;
|
||||
private List<OrderIds> orderIds = new ArrayList<>();
|
||||
|
||||
@Schema(description = "商品id-商品编号")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
|
||||
@Schema(description = "商品材质")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "商品颜色")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "宽")
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "高")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "厚")
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "商品纹理")
|
||||
private Boolean texture;
|
||||
|
||||
@Schema(description = "商品品牌")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "商品规格")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "面积")
|
||||
private BigDecimal area;
|
||||
|
||||
|
||||
+18
-3
@@ -46,10 +46,25 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
|
||||
|
||||
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);
|
||||
|
||||
|
||||
+12
@@ -55,8 +55,20 @@ public interface PlanService {
|
||||
|
||||
List<PlanRespVO> getPlanList();
|
||||
|
||||
/**
|
||||
* 未排订单分页查询
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
PageResult<OrderRespVOCopy> getOrderPage(OrderPageReqVOCopy pageReqVO);
|
||||
|
||||
/**
|
||||
* 未排订单大板分页查询
|
||||
*
|
||||
* @param pageReqVO
|
||||
* @return
|
||||
*/
|
||||
PageResult<OrderGoodsResp> getOrderGoodsPage(OrderPageReqVOCopy pageReqVO);
|
||||
|
||||
|
||||
|
||||
+41
-22
@@ -641,7 +641,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.inIfPresent("oi.order_id", pageReqVO.getOrderIds())
|
||||
.inIfPresent("oi.room_id", pageReqVO.getRoomId())
|
||||
.inIfPresent("oi.body_id", pageReqVO.getBodyId());
|
||||
orderGoodsResps = planItemMapper.selectNoPlanGoodsByRoomAndBodyIds(page,queryWrapperX,getUserOrganId());
|
||||
orderGoodsResps = planItemMapper.selectNoPlanGoodsByRoomAndBodyIds(page, queryWrapperX, getUserOrganId());
|
||||
type = OrderPlanQueryTypeEnum.GOODS_ROOMBODY_QUERY.getType();
|
||||
}else {
|
||||
queryWrapperX
|
||||
@@ -664,19 +664,24 @@ public class PlanServiceImpl implements PlanService {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
// 整理商品名称
|
||||
List<String> goodsName = records.stream().map(OrderGoodsResp::getGoodsName).distinct().toList();
|
||||
|
||||
// 整理材料
|
||||
List<String> material = records.stream().map(OrderGoodsResp::getMaterial).distinct().toList();
|
||||
|
||||
// 整理颜色
|
||||
List<String> color = records.stream().map(OrderGoodsResp::getColor).distinct().toList();
|
||||
|
||||
// 整理厚度
|
||||
List<BigDecimal> thickness = records.stream().map(OrderGoodsResp::getThickness).distinct().toList();
|
||||
|
||||
// 整理品牌
|
||||
List<String> brand = records.stream().map(OrderGoodsResp::getBrand).distinct().toList();
|
||||
|
||||
// 整理纹理
|
||||
List<Boolean> texture = records.stream().map(OrderGoodsResp::getTexture).distinct().toList();
|
||||
|
||||
|
||||
queryWrapperX
|
||||
.inIfPresent("og.goods_name",goodsName)
|
||||
.inIfPresent("og.material",material)
|
||||
@@ -685,11 +690,13 @@ public class PlanServiceImpl implements PlanService {
|
||||
.inIfPresent("og.brand",brand)
|
||||
.inIfPresent("og.texture", texture);
|
||||
|
||||
// 查询带订单列表的商品分组
|
||||
List<OrderGoodsResp> orderGoodsIdList = planItemMapper.selectNoOrderGoodsIdList(queryWrapperX, getUserOrganId(), type);
|
||||
|
||||
// 订单列表匹配到商品上
|
||||
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) {
|
||||
Map<String, OrderGoodsResp> list1Map = new HashMap<>();
|
||||
// list1构建key分组
|
||||
for (OrderGoodsResp item1 : list1) {
|
||||
String key = generateKey(item1);
|
||||
list1Map.put(key, item1);
|
||||
item1.setSort(String.valueOf(sort++));
|
||||
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) {
|
||||
String key = generateKey(item2);
|
||||
OrderGoodsResp matchedItem = list1Map.get(key);
|
||||
if (matchedItem != null) {
|
||||
if (matchedItem.getOrderIds() == null) {
|
||||
matchedItem.setOrderIds(new ArrayList<>());
|
||||
matchedItem.setSort(String.valueOf(sort.get()));
|
||||
}
|
||||
if (item2.getOrderIds() != null) {
|
||||
matchedItem.getOrderIds().addAll(item2.getOrderIds());
|
||||
matchedItem.setSort(String.valueOf(sort.get()));
|
||||
// key匹配的情况下,把list2的orderIds加到list1中
|
||||
for (var entry : list2Map.entrySet()) {
|
||||
OrderGoodsResp target = list1Map.get(entry.getKey());
|
||||
|
||||
if (target == null) continue;
|
||||
|
||||
for (OrderGoodsResp item : entry.getValue()) {
|
||||
if (CollUtil.isNotEmpty(item.getOrderIds())) {
|
||||
target.getOrderIds().addAll(item.getOrderIds());
|
||||
}
|
||||
}
|
||||
sort.addAndGet(1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static String generateKey(OrderGoodsResp item) {
|
||||
/**
|
||||
* 构建key
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
private String generateKey(OrderGoodsResp item) {
|
||||
return String.join("|",
|
||||
Objects.toString(item.getGoodsName(), ""),
|
||||
Objects.toString(item.getMaterial(), ""),
|
||||
|
||||
+8
-8
@@ -60,7 +60,7 @@
|
||||
</if>
|
||||
<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
|
||||
group by orderId,orderDate,deliveryDate,customer,address,defineId,status
|
||||
group by orderId, orderDate, deliveryDate, customer, address, defineId, status
|
||||
</if>
|
||||
|
||||
order by o.id desc;
|
||||
@@ -233,7 +233,6 @@
|
||||
<result property="thickness" column="thickness"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<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"/>
|
||||
|
||||
@@ -250,14 +249,14 @@
|
||||
<select id="selectNoPlanGoodsByRoomAndBodyIds" resultMap="OrderGoodsMap" parameterType="java.lang.Long">
|
||||
|
||||
|
||||
select distinct
|
||||
|
||||
select
|
||||
og.color as color,
|
||||
og.goods_name as goodsName,
|
||||
og.material as material,
|
||||
og.thickness as thickness,
|
||||
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
|
||||
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 og.plate_num - og.planned_plate_num > 0
|
||||
and og.deleted = false
|
||||
group by og.color, og.goods_name, og.material, og.thickness, og.brand, og.texture
|
||||
order by thickness desc
|
||||
</select>
|
||||
|
||||
|
||||
@@ -281,8 +282,7 @@
|
||||
og.thickness as thickness,
|
||||
og.brand as brand,
|
||||
og.texture as texture,
|
||||
sum(og.plate_num - og.planned_plate_num) as num,
|
||||
sum(og.area - og.planned_plate_area) as area
|
||||
sum(og.plate_num - og.planned_plate_num) as num
|
||||
|
||||
from orders o
|
||||
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.deleted = false
|
||||
group by og.color, og.goods_name, og.material, og.thickness, og.brand, og.texture
|
||||
order by thickness desc
|
||||
order by thickness desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user