mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
+2
-2
@@ -16,10 +16,10 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class GoodsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "生产单号")
|
||||
private Long orderNo;
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "18975")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品 ID", example = "王五")
|
||||
private String goodsName;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class GoodsRespVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18975")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@ExcelProperty("商品名称")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class GoodsSaveReqVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "18975")
|
||||
@NotNull(message = "商品 ID不能为空")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "商品名称不能为空")
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class OrderPartsPageReqVO extends PageParam {
|
||||
private Long orderNo;
|
||||
|
||||
@Schema(description = "商品ID", example = "1195")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", example = "晨丰")
|
||||
private String name;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class OrderPartsRespVO {
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
|
||||
@ExcelProperty("商品ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@ExcelProperty("配件名称")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class OrderPartsSaveReqVO {
|
||||
|
||||
@Schema(description = "商品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1195")
|
||||
@NotNull(message = "商品ID不能为空")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "配件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
@NotEmpty(message = "配件名称不能为空")
|
||||
|
||||
+23
-8
@@ -29,7 +29,7 @@ import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.service.plan.PlanService;
|
||||
|
||||
@Tag(name = "管理后台 - 生产单开料排单")
|
||||
@Tag(name = "管理后台 - 排单")
|
||||
@RestController
|
||||
@RequestMapping("/executor/plan")
|
||||
@Validated
|
||||
@@ -39,14 +39,14 @@ public class PlanController {
|
||||
private PlanService planService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产单开料排单")
|
||||
@Operation(summary = "创建排单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:create')")
|
||||
public CommonResult<Long> createPlan(@Valid @RequestBody PlanSaveReqVO createReqVO) {
|
||||
return success(planService.createPlan(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产单开料排单")
|
||||
@Operation(summary = "更新排单")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:update')")
|
||||
public CommonResult<Boolean> updatePlan(@Valid @RequestBody PlanSaveReqVO updateReqVO) {
|
||||
planService.updatePlan(updateReqVO);
|
||||
@@ -54,7 +54,7 @@ public class PlanController {
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产单开料排单")
|
||||
@Operation(summary = "删除排单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:delete')")
|
||||
public CommonResult<Boolean> deletePlan(@RequestParam("id") Long id) {
|
||||
@@ -63,7 +63,7 @@ public class PlanController {
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产单开料排单")
|
||||
@Operation(summary = "获得排单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
|
||||
public CommonResult<PlanRespVO> getPlan(@RequestParam("id") Long id) {
|
||||
@@ -72,7 +72,7 @@ public class PlanController {
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产单开料排单分页")
|
||||
@Operation(summary = "获得排单分页")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
|
||||
public CommonResult<PageResult<PlanRespVO>> getPlanPage(@Valid PlanPageReqVO pageReqVO) {
|
||||
PageResult<PlanRespVO> pageResult = planService.getPlanPage(pageReqVO);
|
||||
@@ -86,8 +86,23 @@ public class PlanController {
|
||||
return success(planService.getOrderPage(pageReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("getNotPlanPlateListPage")
|
||||
@Operation(summary = "获取未排单的板材分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:query')")
|
||||
public CommonResult<PageResult<PlatePage>> getNotPlanPlateListPage(@Valid PlateReqPageVO pageVO) {
|
||||
return success(planService.getNotPlanPlateListPage(pageVO));
|
||||
}
|
||||
|
||||
@PostMapping("addPlate")
|
||||
@Operation(summary = "添加板材")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:update')")
|
||||
public CommonResult<Boolean> addPlate(@Valid @RequestBody AddPlateReq req) {
|
||||
return success(planService.addPlate(req));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产单开料排单 Excel")
|
||||
@Operation(summary = "导出排单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('executor:plan:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportPlanExcel(@Valid PlanPageReqVO pageReqVO,
|
||||
@@ -95,7 +110,7 @@ public class PlanController {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlanRespVO> list = planService.getPlanPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产单开料排单.xls", "数据", PlanRespVO.class,
|
||||
ExcelUtils.write(response, "排单.xls", "数据", PlanRespVO.class,
|
||||
BeanUtils.toBean(list, PlanRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
public class AddPlateReq {
|
||||
|
||||
@NotNull(message = "排单id")
|
||||
@Schema(description = "排单id")
|
||||
private Long planId;
|
||||
|
||||
@NotEmpty(message = "列表不能空")
|
||||
@JsonProperty("list")
|
||||
private List<Obj> list;
|
||||
|
||||
@Valid
|
||||
@Data
|
||||
public static class Obj {
|
||||
@NotNull(message = "生产单id不能空")
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@NotNull(message = "板材id不能空")
|
||||
@Schema(description = "板材id")
|
||||
private Long plateId;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class OrderPageReqVO extends PageParam {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
@Schema(description = "自定义id")
|
||||
private String defaultId;
|
||||
@Schema(description = "客户")
|
||||
|
||||
+2
@@ -37,6 +37,8 @@ public class OrderRespVO {
|
||||
private int num;
|
||||
@Schema(description = "平方")
|
||||
private BigDecimal area = new BigDecimal("0");
|
||||
@Schema(description = "商品id")
|
||||
private String goodsId;
|
||||
@Schema(description = "商品名称")
|
||||
private String goodsName;
|
||||
@Schema(description = "颜色")
|
||||
|
||||
+5
-4
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
@@ -21,17 +22,17 @@ public class PlateInfoVO {
|
||||
private String material;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double width;
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "高度不能为空")
|
||||
private Double height;
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Double thickness;
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "面积")
|
||||
private Double area;
|
||||
private BigDecimal area;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer count;
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
public class PlatePage {
|
||||
@Schema(description = "板材id")
|
||||
private Long plateId;
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private String goodsId;
|
||||
@Schema(description = "板名称")
|
||||
private String name;
|
||||
@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 BigDecimal area;
|
||||
@Schema(description = "客户")
|
||||
private String customer;
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
@Schema(description = "自定义单号")
|
||||
private String customOrderNo;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.cf.imes.module.executor.controller.admin.plan.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
public class PlateReqPageVO extends PageParam {
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
@Schema(description = "商品id")
|
||||
private String goodsId;
|
||||
}
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class PlateRespVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28756")
|
||||
@ExcelProperty("商品 ID")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("宽度")
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public class PlateSaveReqVO {
|
||||
|
||||
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28756")
|
||||
@NotNull(message = "商品 ID不能为空")
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
|
||||
+8
-6
@@ -1,6 +1,8 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.goods;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -30,11 +32,11 @@ public class GoodsDO extends BaseDO {
|
||||
/**
|
||||
* 生产单号
|
||||
*/
|
||||
private Long orderNo;
|
||||
private Long orderId;
|
||||
/**
|
||||
* 商品 ID
|
||||
*/
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@@ -50,19 +52,19 @@ public class GoodsDO extends BaseDO {
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Double width;
|
||||
private BigDecimal width;
|
||||
/**
|
||||
* 高度
|
||||
*/
|
||||
private Double height;
|
||||
private BigDecimal height;
|
||||
/**
|
||||
* 厚度
|
||||
*/
|
||||
private Double thickness;
|
||||
private BigDecimal thickness;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private Double price;
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class OrderPartsDO extends BaseDO {
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private Long goodsId;
|
||||
private String goodsId;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
|
||||
default PageResult<GoodsDO> selectPage(GoodsPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<GoodsDO>()
|
||||
.eqIfPresent(GoodsDO::getOrderNo, reqVO.getOrderNo())
|
||||
.eqIfPresent(GoodsDO::getOrderId, reqVO.getOrderId())
|
||||
.eqIfPresent(GoodsDO::getGoodsId, reqVO.getGoodsId())
|
||||
.likeIfPresent(GoodsDO::getGoodsName, reqVO.getGoodsName())
|
||||
.eqIfPresent(GoodsDO::getMaterial, reqVO.getMaterial())
|
||||
|
||||
+7
@@ -2,12 +2,17 @@ package com.cf.imes.module.executor.dal.mysql.plate;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 生产单板件 Mapper
|
||||
@@ -55,4 +60,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
.orderByDesc(PlateDO::getId));
|
||||
}
|
||||
|
||||
IPage<PlatePage> selectPlatePage(@Param("page") IPage<PlatePage> page, @Param("orderId")Long organId, @Param("goodsId") String goodsId);
|
||||
|
||||
}
|
||||
+4
@@ -53,4 +53,8 @@ public interface PlanService {
|
||||
PageResult<PlanRespVO> getPlanPage(PlanPageReqVO pageReqVO);
|
||||
|
||||
PageResult<OrderRespVO> getOrderPage(OrderPageReqVO pageReqVO);
|
||||
|
||||
PageResult<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO);
|
||||
|
||||
Boolean addPlate(AddPlateReq req);
|
||||
}
|
||||
+55
-35
@@ -74,6 +74,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createPlan(PlanSaveReqVO createReqVO) {
|
||||
@@ -165,14 +166,22 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Override
|
||||
public PlanRespVO getPlan(Long id) {
|
||||
PlanDO planDO = planMapper.selectById(id);
|
||||
Set<Long> orderIds = planOrderMapper.selectList(new LambdaQueryWrapperX<PlanOrderDO>().eq(PlanOrderDO::getPlanId, planDO.getPlanNo()))
|
||||
.stream()
|
||||
.map(e -> e.getOrderId())
|
||||
.collect(Collectors.toSet());
|
||||
PlanRespVO respVO = BeanUtils.toBean(planDO, PlanRespVO.class);
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().eq(GoodsDO::getOrderNo, planDO.getId()));
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, orderIds));
|
||||
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>().in(PlateDO::getGoodsId, goodsDOS.stream().map(e -> e.getGoodsId()).collect(Collectors.toSet())));
|
||||
List<PlateInfoVO> plateInfoVOS = goodsDOS.stream().map(e -> PlateInfoVO.builder()
|
||||
.width(e.getWidth())
|
||||
.height(e.getHeight())
|
||||
.thickness(e.getThickness())
|
||||
.area(e.getHeight() * e.getWidth())
|
||||
.build()).collect(Collectors.toList());
|
||||
.material(e.getMaterial())
|
||||
.width(e.getWidth())
|
||||
.height(e.getHeight())
|
||||
.thickness(e.getThickness())
|
||||
.area(e.getHeight().multiply(e.getWidth()).setScale(2, RoundingMode.HALF_UP))
|
||||
.count(plateDOS.stream().filter(f -> Objects.equals(f.getGoodsId(), e.getGoodsId())).collect(Collectors.toSet()).size())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
respVO.setPlateInfoList(plateInfoVOS);
|
||||
return respVO;
|
||||
}
|
||||
@@ -180,17 +189,22 @@ public class PlanServiceImpl implements PlanService {
|
||||
@Override
|
||||
public PageResult<PlanRespVO> getPlanPage(PlanPageReqVO pageReqVO) {
|
||||
PageResult<PlanDO> planDOPageResult = planMapper.selectPage(pageReqVO);
|
||||
if (CollectionUtil.isEmpty(planDOPageResult.getList())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
Set<Long> ids = planDOPageResult.getList().stream().map(e -> e.getId()).collect(Collectors.toSet());
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderNo, ids));
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectList(new LambdaQueryWrapperX<GoodsDO>().in(GoodsDO::getOrderId, ids));
|
||||
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>().in(PlateDO::getGoodsId, goodsDOS.stream().map(e -> e.getGoodsId()).collect(Collectors.toSet())));
|
||||
PageResult<PlanRespVO> planRespVOPageResult = BeanUtils.toBean(planDOPageResult, PlanRespVO.class);
|
||||
planRespVOPageResult.getList().stream().forEach(e -> {
|
||||
e.setPlateInfoList(goodsDOS.stream()
|
||||
.filter(f -> Objects.equals(f.getOrderNo(), e.getId()))
|
||||
.filter(f -> Objects.equals(f.getOrderId(), e.getId()))
|
||||
.map(p -> PlateInfoVO.builder()
|
||||
.width(p.getWidth())
|
||||
.height(p.getHeight())
|
||||
.thickness(p.getThickness())
|
||||
.area(p.getHeight() * p.getWidth())
|
||||
.area(p.getHeight().multiply(p.getWidth()).setScale(2, RoundingMode.HALF_UP))
|
||||
.count(plateDOS.stream().filter(f -> Objects.equals(f.getGoodsId(), p.getGoodsId())).collect(Collectors.toSet()).size())
|
||||
.build())
|
||||
.collect(Collectors.toList()));
|
||||
});
|
||||
@@ -206,7 +220,7 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent("customer", pageReqVO.getConsignee())
|
||||
.eqIfPresent("address", pageReqVO.getConsigneeAddress())
|
||||
.eqIfPresent("custom_order_no", pageReqVO.getDefaultId())
|
||||
.betweenIfPresent("delivery_date" ,new Date[]{pageReqVO.getBeginDate(), pageReqVO.getEndDate()})
|
||||
.betweenIfPresent("delivery_date", new Date[]{pageReqVO.getBeginDate(), pageReqVO.getEndDate()})
|
||||
.isNull("d.order_id")
|
||||
;
|
||||
|
||||
@@ -215,37 +229,43 @@ public class PlanServiceImpl implements PlanService {
|
||||
.eqIfPresent(OrderDO::getCustomer, pageReqVO.getConsignee())
|
||||
.eqIfPresent(OrderDO::getAddress, pageReqVO.getConsigneeAddress())
|
||||
.eqIfPresent(OrderDO::getCustomOrderNo, pageReqVO.getDefaultId())
|
||||
.betweenIfPresent(OrderDO::getDeliveryDate, new Date[]{pageReqVO.getBeginDate(), pageReqVO.getEndDate()})
|
||||
;
|
||||
.betweenIfPresent(OrderDO::getDeliveryDate, new Date[]{pageReqVO.getBeginDate(), pageReqVO.getEndDate()});
|
||||
|
||||
IPage<OrderRespVO> orderDOPageResult = orderMapper.selectOrderPage(page, queryWrapperX);
|
||||
if (CollectionUtil.isEmpty(orderDOPageResult.getRecords())) {
|
||||
return new PageResult<>();
|
||||
}
|
||||
//TODO 获取面积
|
||||
/*
|
||||
Set<Long> orderIds = orderDOPageResult.getRecords().stream().map(e -> e.getOrderId()).collect(Collectors.toSet());
|
||||
|
||||
Set<Long> dataIds = orderItemMapper.selectList(new LambdaQueryWrapperX<OrderItemDO>().notIn(OrderItemDO::getOrderId, orderIds))
|
||||
.stream().map(e -> e.getDataId()).collect(Collectors.toSet());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(dataIds)) {
|
||||
List<PlateDO> plateDOS = plateMapper.selectList(new LambdaQueryWrapperX<PlateDO>().in(PlateDO::getId, dataIds));
|
||||
orderDOPageResult.getRecords().stream().forEach(e -> {
|
||||
List<PlateDO> plateDOList = plateDOS.stream().filter(f -> Objects.equals(e.getOrderId(), f.getId())).collect(Collectors.toList());
|
||||
BigDecimal area = new BigDecimal("0");
|
||||
if (CollectionUtil.isNotEmpty(plateDOList)) {
|
||||
for (PlateDO plateDO : plateDOList) {
|
||||
area.add(plateDO.getWidth().multiply(plateDO.getHeight()));
|
||||
}
|
||||
}
|
||||
area.setScale(2, RoundingMode.HALF_UP);
|
||||
e.setArea(area);
|
||||
}
|
||||
);
|
||||
}*/
|
||||
// return new PageResult<>(list, orderDOPageResult.getTotal());
|
||||
return new PageResult<>(orderDOPageResult.getRecords(), orderDOPageResult.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlatePage> getNotPlanPlateListPage(PlateReqPageVO pageVO) {
|
||||
PageDTO<PlatePage> page = new PageDTO<>(pageVO.getPageNo(), pageVO.getPageSize());
|
||||
IPage<PlatePage> pageRes = plateMapper.selectPlatePage(page, pageVO.getOrderId(), pageVO.getGoodsId());
|
||||
return new PageResult<PlatePage>(pageRes.getRecords(), pageRes.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addPlate(AddPlateReq req) {
|
||||
List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||
List<PlanItemDO> planItemDOS = new ArrayList<>();
|
||||
for (AddPlateReq.Obj obj : req.getList()) {
|
||||
orderItemDOS.add(OrderItemDO.builder()
|
||||
.planId(req.getPlanId())
|
||||
.orderId(obj.getOrderId())
|
||||
.dataId(obj.getPlateId())
|
||||
.type(1)
|
||||
.build());
|
||||
|
||||
planItemDOS.add(PlanItemDO.builder()
|
||||
.planId(req.getPlanId())
|
||||
.itemId(obj.getPlateId())
|
||||
.build());
|
||||
}
|
||||
orderItemMapper.insertBatch(orderItemDOS);
|
||||
planItemMapper.insertBatch(planItemDOS);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
<select id="selectOrderPage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderRespVO">
|
||||
select a.id as orderId, a.delivery_date, a.customer, a.address, a.custom_order_no as defineId,
|
||||
count(c.id) as num, sum(c.area) as area, p.goods_name, p.color, p.material
|
||||
count(c.id) as num, sum(c.area) as area, p.goods_name, p.color, p.material, p.goods_id
|
||||
from `order` a
|
||||
left join order_plate c ON a.id = c.order_id
|
||||
left join plate p on c.goods_id = p.goods_id
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.plate.PlateMapper">
|
||||
<select id="selectPlatePage" resultType="com.cf.imes.module.executor.controller.admin.plan.vo.PlatePage">
|
||||
select a.id as plateId, a.name, a.width, a.height, a.thickness, a.area,
|
||||
b.custom_order_no, b.customer, b.address, b.remark, b.id as orderId,
|
||||
c.goods_name, c.material, c.color, c.goods_id
|
||||
from order_plate a
|
||||
LEFT JOIN order_plan_item p on a.id = p.item_id
|
||||
LEFT JOIN `order` b on a.order_id = b.id
|
||||
LEFT JOIN order_goods c on a.order_id = c.order_id
|
||||
<where>
|
||||
p.id is null
|
||||
<if test="orderId !=null">
|
||||
and a.order_id = #{orderId}
|
||||
</if>
|
||||
<if test="goodsId !=null and goodsId != '' ">
|
||||
and c.id = #{goodsId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user