Merge remote-tracking branch 'origin/dev' into test
This commit is contained in:
@@ -46,14 +46,14 @@ public class PrchOrdDtlController implements BusinessControllerMarker {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建采购订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:create')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:create','purchase:order:list:OrderList:add')")
|
||||
public CommonResult<PrchOrdDtlRespVO> createPrchOrdDtl(@Valid @RequestBody PrchOrdDtlSaveReqVO createReqVO) {
|
||||
return success(prchOrdDtlService.createPrchOrdDtl(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新采购订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:update','purchase:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> updatePrchOrdDtl(@Valid @RequestBody PrchOrdDtlSaveReqVO updateReqVO) {
|
||||
prchOrdDtlService.updatePrchOrdDtl(updateReqVO);
|
||||
return success(true);
|
||||
@@ -62,7 +62,7 @@ public class PrchOrdDtlController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除采购订单明细")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:delete','purchase:order:list:OrderList:delete')")
|
||||
public CommonResult<Boolean> deletePrchOrdDtl(@RequestParam("id") Long id) {
|
||||
prchOrdDtlService.deletePrchOrdDtl(id);
|
||||
return success(true);
|
||||
@@ -71,7 +71,7 @@ public class PrchOrdDtlController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除采购订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:delete','purchase:order:list:OrderList:delete')")
|
||||
public CommonResult<Boolean> deletePrchOrdDtlList(@RequestBody BatchDeleteReqVO req) {
|
||||
prchOrdDtlService.deletePrchOrdDtlListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -80,7 +80,7 @@ public class PrchOrdDtlController implements BusinessControllerMarker {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得采购订单明细")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:query','purchase:order:list:OrderList:query')")
|
||||
public CommonResult<PrchOrdDtlRespVO> getPrchOrdDtl(@RequestParam("id") Long id) {
|
||||
PrchOrdDtlDO prchOrdDtl = prchOrdDtlService.getPrchOrdDtl(id);
|
||||
return success(BeanUtils.toBean(prchOrdDtl, PrchOrdDtlRespVO.class));
|
||||
@@ -88,7 +88,7 @@ public class PrchOrdDtlController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得采购订单明细分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:query','purchase:order:list:OrderList:query')")
|
||||
public CommonResult<PageResult<PrchOrdDtlRespVO>> getPrchOrdDtlPage(@Valid PrchOrdDtlPageReqVO pageReqVO) {
|
||||
PageResult<PrchOrdDtlDO> pageResult = prchOrdDtlService.getPrchOrdDtlPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PrchOrdDtlRespVO.class));
|
||||
@@ -96,7 +96,7 @@ public class PrchOrdDtlController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出采购订单明细 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('base:prch-ord-dtl:export')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:prch-ord-dtl:export','purchase:order:list:OrderList:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPrchOrdDtlExcel(@Valid PrchOrdDtlPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
@@ -55,14 +55,14 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建销售订单")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:create')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:create','sale:order:list:OrderList:add')")
|
||||
public CommonResult<SalesOrderRespVO> createSalesOrder(@Valid @RequestBody SalesOrderSaveReqVO createReqVO) {
|
||||
return success(salesOrderService.createSalesOrder(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新销售订单")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> updateSalesOrder(@Valid @RequestBody SalesOrderSaveReqVO updateReqVO) {
|
||||
salesOrderService.updateSalesOrder(updateReqVO);
|
||||
return success(true);
|
||||
@@ -71,7 +71,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除销售订单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:delete','sale:order:list:OrderList:delete')")
|
||||
public CommonResult<Boolean> deleteSalesOrder(@RequestParam("id") Long id) {
|
||||
salesOrderService.deleteSalesOrder(id);
|
||||
return success(true);
|
||||
@@ -80,7 +80,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除销售订单")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:delete','sale:order:list:OrderList:delete')")
|
||||
public CommonResult<Boolean> deleteSalesOrderList(@RequestBody BatchDeleteReqVO req) {
|
||||
salesOrderService.deleteSalesOrderListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -89,7 +89,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得销售订单")
|
||||
@Parameter(name = "id", description = "id是订单主键,splyBsnTp是订单类型销售或者是消费", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<SalesOrderRespVO> getSalesOrder(@RequestParam("id") Long id, @RequestParam(value = "splyBsnTp", required = false) String splyBsnTp) {
|
||||
SalesOrderDO purchaseOrder = salesOrderService.getSalesOrder(id, splyBsnTp);
|
||||
SalesOrderRespVO salesOrderRespVO = BeanUtils.toBean(purchaseOrder, SalesOrderRespVO.class);
|
||||
@@ -103,7 +103,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
@GetMapping("/order-no")
|
||||
@Operation(summary = "通过订单号获得销售订单")
|
||||
@Parameter(name = "orderNo", description = "订单号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<SalesOrderRespVO> getSalesOrderByNo(@RequestParam("orderNo") String orderNo) {
|
||||
SalesOrderDO purchaseOrder = salesOrderService.getSalesOrderByOrderNo(orderNo);
|
||||
SalesOrderRespVO salesOrderRespVO = BeanUtils.toBean(purchaseOrder, SalesOrderRespVO.class);
|
||||
@@ -116,7 +116,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得销售订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<PageResult<SalesOrderRespVO>> getSalesOrderPage(@Valid SalesOrderPageReqVO pageReqVO) {
|
||||
PageResult<SalesOrderDO> pageResult = salesOrderService.getSalesOrderPage(pageReqVO);
|
||||
PageResult<SalesOrderRespVO> salesOrderRespVOPageResult = BeanUtils.toBean(pageResult, SalesOrderRespVO.class);
|
||||
@@ -129,7 +129,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出销售订单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order:export')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSalesOrderExcel(@Valid SalesOrderPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -143,7 +143,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
//推送erp091
|
||||
@PostMapping("/push-erp091")
|
||||
@Operation(summary = "推送erp091")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:purchase-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> pushErp091(@RequestBody @Validated @NotEmpty(message = "销售订单id不能为空") List<String> ids) {
|
||||
ids.forEach(id -> salesOrderService.pushErp091(id));
|
||||
return success(true);
|
||||
@@ -152,14 +152,14 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
//提交审批
|
||||
@PostMapping("/submit-order")
|
||||
@Operation(summary = "提交审批")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:purchase-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<String> submitOrder(@RequestParam("id") String id) {
|
||||
return success(salesOrderService.submitOrder(id));
|
||||
}
|
||||
|
||||
@PostMapping("/submit-order-batch")
|
||||
@Operation(summary = "批量提交订单审核")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:purchase-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> submitOrder(@RequestBody @Validated @NotEmpty(message = "销售订单id不能为空") List<String> ids) {
|
||||
System.out.println("ids:" + ids);
|
||||
ids.forEach(id -> salesOrderService.submitOrder(id));
|
||||
@@ -169,7 +169,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
//提交审批
|
||||
@PostMapping("/order-pass-reject")
|
||||
@Operation(summary = "订单审核")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:purchase-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> orderPassReject(@RequestBody SalesOrderReviewReqVO reqVO) {
|
||||
return success(salesOrderService.orderPassReject(reqVO));
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
//关联订单
|
||||
@PostMapping("/link-order")
|
||||
@Operation(summary = "关联订单")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:purchase-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> linkOrder(@RequestBody @Validated LinkOrderReqVO req) {
|
||||
return success(salesOrderService.linkOrder(req));
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
//根据订单id和方式获取上或下游订单
|
||||
@PostMapping("/order-by-order-id-and-type")
|
||||
@Operation(summary = "根据订单id和方式获取上或下游订单")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<List<DownOrUpOrderRespVO>> getOrderByOrderIdAndType(@RequestBody DownOrUpOrderReqVO reqVO) {
|
||||
return success(salesOrderService.getOrderByOrderIdAndType(reqVO));
|
||||
}
|
||||
@@ -193,14 +193,14 @@ public class SalesOrderController implements BusinessControllerMarker {
|
||||
|
||||
@PostMapping("/bound-order")
|
||||
@Operation(summary = "获取已绑定的订单")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<List<PurchaseOrderRespVO>> boundOrder(@RequestBody DownOrUpOrderReqVO reqVO) {
|
||||
return success(salesOrderService.getBindOrderByOrder(reqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update-order-status")
|
||||
@Operation(summary = "批量修改订单状态", description = "sts取值于字典名称'销售订单状态',字典类型'PRCH_ORD_STS' 可以根据订单号和订单id修改")
|
||||
@PreAuthorize("@ss.hasPermission('base:purchase-order:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:purchase-order:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> updateOrderStatus(@RequestBody @Validated OrderStsReqVO req) {
|
||||
salesOrderService.updateOrderStatusByIdOrOrderNo(req);
|
||||
return success(true);
|
||||
|
||||
@@ -47,21 +47,21 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建销售订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:create')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:create','sale:order:list:OrderList:add')")
|
||||
public CommonResult<SalesOrderDetailRespVO> createSalesOrderDetail(@Valid @RequestBody SalesOrderDetailSaveReqVO createReqVO) {
|
||||
return success(salesOrderDetailService.createSalesOrderDetail(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/create-batch")
|
||||
@Operation(summary = "批量创建销售订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:create')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:create','sale:order:list:OrderList:add')")
|
||||
public CommonResult<List<SalesOrderDetailRespVO>> createSalesOrderDetail(@Valid @NotEmpty(message = "需要保存的数据为空") @RequestBody List<SalesOrderDetailSaveReqVO> createReqVOS) {
|
||||
return success(salesOrderDetailService.createSalesOrderDetail(createReqVOS));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新销售订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:update')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:update','sale:order:list:OrderList:edit')")
|
||||
public CommonResult<Boolean> updateSalesOrderDetail(@Valid @RequestBody SalesOrderDetailSaveReqVO updateReqVO) {
|
||||
salesOrderDetailService.updateSalesOrderDetail(updateReqVO);
|
||||
return success(true);
|
||||
@@ -70,7 +70,7 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除销售订单明细")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:delete','sale:order:list:OrderList:delete')")
|
||||
public CommonResult<Boolean> deleteSalesOrderDetail(@RequestParam("id") Long id) {
|
||||
salesOrderDetailService.deleteSalesOrderDetail(id);
|
||||
return success(true);
|
||||
@@ -79,7 +79,7 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除销售订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:delete')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:delete','sale:order:list:OrderList:delete')")
|
||||
public CommonResult<Boolean> deleteSalesOrderDetailList(@RequestBody BatchDeleteReqVO req) {
|
||||
salesOrderDetailService.deleteSalesOrderDetailListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -88,7 +88,7 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得销售订单明细")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<SalesOrderDetailRespVO> getSalesOrderDetail(@RequestParam("id") Long id) {
|
||||
SalesOrderDetailDO salesOrderDetail = salesOrderDetailService.getSalesOrderDetail(id);
|
||||
return success(BeanUtils.toBean(salesOrderDetail, SalesOrderDetailRespVO.class));
|
||||
@@ -96,7 +96,7 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得销售订单明细分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<PageResult<SalesOrderDetailRespVO>> getSalesOrderDetailPage(@Valid SalesOrderDetailPageReqVO pageReqVO) {
|
||||
PageResult<SalesOrderDetailDO> pageResult = salesOrderDetailService.getSalesOrderDetailPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SalesOrderDetailRespVO.class));
|
||||
@@ -104,7 +104,7 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出销售订单明细 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:export')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:export','sale:order:list:OrderList:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportSalesOrderDetailExcel(@Valid SalesOrderDetailPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -118,7 +118,7 @@ public class SalesOrderDetailController implements BusinessControllerMarker {
|
||||
//通过销售订单主键获取销售订单明细
|
||||
@GetMapping("/get-by-order-id")
|
||||
@Operation(summary = "通过销售订单主键获取销售订单明细")
|
||||
@PreAuthorize("@ss.hasPermission('base:sales-order-detail:query')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('base:sales-order-detail:query','sale:order:list:OrderList:query')")
|
||||
public CommonResult<List<SalesOrderDetailRespVO>> getSalesOrderDetailByOrderId(@RequestParam("orderId") String orderId) {
|
||||
|
||||
return success(salesOrderDetailService.getSalesOrderDetailByOrderId(Long.valueOf(orderId)));
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.*;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
||||
@@ -31,7 +33,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
@RestController
|
||||
@RequestMapping("/base/erp-material")
|
||||
@Validated
|
||||
public class ErpMaterialController {
|
||||
public class ErpMaterialController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -147,7 +149,7 @@ public class ErpMaterialController {
|
||||
@Operation(summary = "通过主物料查询子物料信息")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) {
|
||||
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
||||
List<ErpMaterialRespVO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
||||
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
||||
}
|
||||
|
||||
@@ -156,11 +158,12 @@ public class ErpMaterialController {
|
||||
@Operation(summary = "通过接口查询物料")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<PageResult<ErpMaterialRespVO>> getErpMaterialByApi(@RequestBody MaterialInfomationApiVO vo) {
|
||||
MaterialInfomationPageReqDTO material = new MaterialInfomationPageReqDTO();
|
||||
material.setCode(vo.getMaterialNumber());
|
||||
material.setName(vo.getMaterialName());
|
||||
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
||||
material.setMaterialNumber(vo.getMaterialNumber());
|
||||
material.setMaterialName(vo.getMaterialName());
|
||||
material.setPageSize(vo.getPageSize());
|
||||
material.setPageNo(vo.getPageNo());
|
||||
material.setDeptId(Long.valueOf(vo.getDeptId()));
|
||||
PageResult<ErpMaterialDO> erpMaterialByApi = erpMaterialService.getErpMaterialByApi(material);
|
||||
return success(BeanUtils.toBean(erpMaterialByApi, ErpMaterialRespVO.class));
|
||||
}
|
||||
@@ -168,16 +171,15 @@ public class ErpMaterialController {
|
||||
@GetMapping("/erpMaterial-mainMaterial-code")
|
||||
@Operation(summary = "通过主物料编号查询子物料信息")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<ErpMaterialRespVO> getErpMaterialByMainMaterialByCode(@RequestParam("materialNumber") String code) {
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByMainMaterialByCode(code), ErpMaterialRespVO.class));
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterialByCode(@RequestParam("materialNumber") String code,@RequestParam(value = "deptId",required = false) String deptId) {
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByMainMaterialByCode(code,deptId), ErpMaterialRespVO.class));
|
||||
}
|
||||
|
||||
//查询物料
|
||||
@GetMapping("/api-erp-material-code")
|
||||
@Operation(summary = "通过编号接口查询物料")
|
||||
@PreAuthorize("@ss.hasAnyPermissions({'sply:erp-material:query','basic:material-config:query'})")
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByApiByCode(@RequestParam("materialNumber")String code) {
|
||||
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByApiByCode(code), ErpMaterialRespVO.class));
|
||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByApiByCode(@RequestParam("materialNumber")String code,@RequestParam(value = "deptId",required = false) String deptId) {
|
||||
return success(BeanUtils.toBean(erpMaterialService.getErpMaterialByApiByCode(code,deptId), ErpMaterialRespVO.class));
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import java.util.List;
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ErpMaterialRespVO {
|
||||
@Schema(description = "关联表主键,删除需要使用这个", requiredMode = Schema.RequiredMode.REQUIRED, example = "2038")
|
||||
private Long corrId;
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2038")
|
||||
@ExcelProperty("主键")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialRespDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationRespDTO;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -78,7 +79,7 @@ public class MaterialAttributeUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 物料属性封装Record(Java 16+)
|
||||
* 物料属性封装Record
|
||||
* 包含所有属性的安全取值
|
||||
*/
|
||||
public record MaterialAttribute(
|
||||
@@ -117,7 +118,7 @@ public class MaterialAttributeUtils {
|
||||
* @param dto 物料信息DTO
|
||||
* @return 封装后的物料属性Record
|
||||
*/
|
||||
public static MaterialAttribute safeExtractAllAttributes(MaterialInfomationRespDTO dto) {
|
||||
public static MaterialAttribute safeExtractAllAttributes(DepartmentMaterialRespDTO dto) {
|
||||
// 1. 空值校验
|
||||
if (dto == null || dto.getFlatAttributes() == null) {
|
||||
return MaterialAttribute.empty();
|
||||
|
||||
@@ -16,5 +16,7 @@ public interface ErpErpMaterialCorrService {
|
||||
List<ErpMaterialCorrRspVO> create(@Valid ErpMaterialCorrSaveReqVO reqVO);
|
||||
void deleteBatch(BatchDeleteReqVO reqVO);
|
||||
|
||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds);
|
||||
|
||||
List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,12 @@ public class ErpErpMaterialCorrServiceImpl implements ErpErpMaterialCorrService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(Long mainMaterialId) {
|
||||
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentId, mainMaterialId), ErpMaterialCorrRspVO.class);
|
||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterial(List<Long> mainMaterialIds) {
|
||||
return BeanUtils.toBean( erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentId, mainMaterialIds), ErpMaterialCorrRspVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialCorrRspVO> getErpMaterialByMainMaterialByCode(String code) {
|
||||
return BeanUtils.toBean(erpErpMaterialCorrMapper.selectList(ErpMaterialCorrDO::getMaterialParentCode, code), ErpMaterialCorrRspVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.erp.service.erp;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialCorrSaveReqVO;
|
||||
@@ -77,11 +78,11 @@ public interface ErpMaterialService {
|
||||
|
||||
ErpMaterialDO getErpMaterialById(Long id);
|
||||
|
||||
List<ErpMaterialDO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
||||
List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterialId);
|
||||
|
||||
PageResult<ErpMaterialDO> getErpMaterialByApi( MaterialInfomationPageReqDTO material);
|
||||
PageResult<ErpMaterialDO> getErpMaterialByApi( DepartmentMaterialPageReqDTO material);
|
||||
|
||||
ErpMaterialDO getErpMaterialByMainMaterialByCode(String code);
|
||||
List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code,String deptId);
|
||||
|
||||
List <ErpMaterialDO>getErpMaterialByApiByCode(String code);
|
||||
List <ErpMaterialDO>getErpMaterialByApiByCode(String code,String deptId);
|
||||
}
|
||||
@@ -11,6 +11,9 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.api.BaseApi;
|
||||
import com.zt.plat.module.api.dto.MaterialOtherDTO;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.DepartmentMaterialApi;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialPageReqDTO;
|
||||
import com.zt.plat.module.base.api.departmentmaterial.dto.DepartmentMaterialRespDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.MaterialInfomationApi;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationPageReqDTO;
|
||||
import com.zt.plat.module.base.api.materialinfomation.dto.MaterialInfomationRespDTO;
|
||||
@@ -59,6 +62,8 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
private ErpErpMaterialCorrService erpMaterialCorrService;
|
||||
@Resource
|
||||
private MaterialInfomationApi materialInfomationApi;
|
||||
@Resource
|
||||
private DepartmentMaterialApi departmentMaterialApi;
|
||||
|
||||
@Override
|
||||
public ErpMaterialRespVO createErpMaterial(ErpMaterialSaveReqVO createReqVO) {
|
||||
@@ -120,16 +125,12 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(ERP_MATERIAL_NOT_EXISTS);
|
||||
}
|
||||
List<ErpMaterialDO> erpMaterialDOList = list.stream()
|
||||
.filter(erpMaterialDO -> erpMaterialDO.getType().equals("ERP"))
|
||||
.collect(Collectors.toList());
|
||||
List<ErpMaterialDO> erpMaterialDOList = list.stream().filter(erpMaterialDO -> erpMaterialDO.getType().equals("ERP")).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(erpMaterialDOList)) {
|
||||
throw exception(ERP_MATERIAL_NOT_ALLOW_DELETE);
|
||||
}
|
||||
// 优化成批量查询,使用IN语句
|
||||
List<String> downCenterNumbers = list.stream()
|
||||
.map(ErpMaterialDO::getDownCenterNumber)
|
||||
.collect(Collectors.toList());
|
||||
List<String> downCenterNumbers = list.stream().map(ErpMaterialDO::getDownCenterNumber).collect(Collectors.toList());
|
||||
|
||||
// 使用IN语句批量查询所有物料编码的数量
|
||||
Integer countMap = erpMaterialMapper.countByErpMNumbers(downCenterNumbers);
|
||||
@@ -145,9 +146,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
}
|
||||
|
||||
private void validateErpFactoryExistsNumber(String number) {
|
||||
List<ErpMaterialDO> list = erpMaterialMapper.selectList(new LambdaQueryWrapperX<ErpMaterialDO>()).stream()
|
||||
.filter(erpWarehouseDO -> erpWarehouseDO.getDownCenterNumber().equals(number))
|
||||
.toList();
|
||||
List<ErpMaterialDO> list = erpMaterialMapper.selectList(new LambdaQueryWrapperX<ErpMaterialDO>()).stream().filter(erpWarehouseDO -> erpWarehouseDO.getDownCenterNumber().equals(number)).toList();
|
||||
if (!list.isEmpty()) {
|
||||
throw exception(ERP_MATERIAL_EXISTS);
|
||||
}
|
||||
@@ -209,21 +208,27 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
}
|
||||
|
||||
private ErpMaterialRespVO buildErpMaterialRespDataById(Long id) {
|
||||
CommonResult<MaterialInfomationRespDTO> materialInfomation = materialInfomationApi.getMaterialInfomation(id);
|
||||
return BeanUtils.toBean(buildErpMaterialDOData(materialInfomation), ErpMaterialRespVO.class);
|
||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
||||
departmentMaterialPageReqDTO.setInfomationId(id);
|
||||
departmentMaterialPageReqDTO.setPageSize(PAGE_SIZE_NONE);
|
||||
PageResult<DepartmentMaterialRespDTO> data = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||
if (data == null || data.getList().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return BeanUtils.toBean(buildErpMaterialDOData(CommonResult.success(data.getList().get(0))), ErpMaterialRespVO.class);
|
||||
}
|
||||
|
||||
public ErpMaterialDO buildErpMaterialDOData(CommonResult<MaterialInfomationRespDTO> materialInfomation) {
|
||||
public ErpMaterialDO buildErpMaterialDOData(CommonResult<DepartmentMaterialRespDTO> materialInfomation) {
|
||||
if (materialInfomation.getData() == null) {
|
||||
return new ErpMaterialDO();
|
||||
}
|
||||
ErpMaterialDO erpMaterialDO = new ErpMaterialDO();
|
||||
MaterialInfomationRespDTO data = materialInfomation.getData();
|
||||
DepartmentMaterialRespDTO data = materialInfomation.getData();
|
||||
MaterialAttributeUtils.MaterialAttribute materialAttribute = MaterialAttributeUtils.safeExtractAllAttributes(data);
|
||||
// 有对应关系的字段赋值
|
||||
erpMaterialDO.setMaterialNumber(data.getCode());//物料编码
|
||||
erpMaterialDO.setId(data.getId()); // 主键
|
||||
erpMaterialDO.setMaterialName(data.getName()); // 物料名称
|
||||
erpMaterialDO.setMaterialNumber(data.getMaterialNumber());//物料编码
|
||||
erpMaterialDO.setId(data.getInfomationId()); // 主键
|
||||
erpMaterialDO.setMaterialName(data.getMaterialName()); // 物料名称
|
||||
erpMaterialDO.setDownCenterNumber(materialAttribute.mtrlZhongtongCode()); // 中铜物料编码
|
||||
erpMaterialDO.setCenterNumber(materialAttribute.mtrlChalcoCode()); // 中铝物料编码
|
||||
erpMaterialDO.setUnit(materialAttribute.mtrlBaseUnitCode()); // 计量单位编码
|
||||
@@ -256,75 +261,104 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
|
||||
@Override
|
||||
public ErpMaterialDO getErpMaterialById(Long id) {
|
||||
CommonResult<MaterialInfomationRespDTO> materialInfomation = materialInfomationApi.getMaterialInfomation(id);
|
||||
return buildErpMaterialDOData(materialInfomation);
|
||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
||||
departmentMaterialPageReqDTO.setInfomationId(id);
|
||||
departmentMaterialPageReqDTO.setPageSize(10000);
|
||||
PageResult<DepartmentMaterialRespDTO> data = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||
if (data == null || data.getList() == null || data.getList().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return buildErpMaterialDOData(CommonResult.success(data.getList().get(0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialDO> getErpMaterialByMainMaterial(Long mainMaterial) {
|
||||
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterial = erpMaterialCorrService.getErpMaterialByMainMaterial(mainMaterial);
|
||||
public List<ErpMaterialRespVO> getErpMaterialByMainMaterial(Long mainMaterial) {
|
||||
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterial = erpMaterialCorrService.getErpMaterialByMainMaterial(List.of(mainMaterial));
|
||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||
CommonResult<List<MaterialInfomationRespDTO>> materialInfomationListByIds = materialInfomationApi.getMaterialInfomationListByIds(erpMaterialByMainMaterial.stream().map(ErpMaterialCorrRspVO::getMaterialId).toList());
|
||||
if (materialInfomationListByIds.getData() == null || materialInfomationListByIds.getData().isEmpty()) {
|
||||
return erpMaterialDOList;
|
||||
List<ErpMaterialRespVO> erpMaterialRespVOS = new ArrayList<>();
|
||||
if (erpMaterialByMainMaterial.isEmpty()) {
|
||||
return erpMaterialRespVOS;
|
||||
}
|
||||
materialInfomationListByIds.getData().forEach(
|
||||
materialInfomation -> {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
||||
erpMaterialDOList.add(erpMaterialDO);
|
||||
List<Long> mIds = erpMaterialByMainMaterial.stream().map(ErpMaterialCorrRspVO::getMaterialId).toList();
|
||||
//构造查询条件
|
||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
||||
departmentMaterialPageReqDTO.setInfomationIds(mIds);
|
||||
departmentMaterialPageReqDTO.setPageSize(10000);
|
||||
PageResult<DepartmentMaterialRespDTO> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||
if (departmentMaterialPage == null || departmentMaterialPage.getList() == null || departmentMaterialPage.getList().isEmpty()) {
|
||||
return erpMaterialRespVOS;
|
||||
}
|
||||
|
||||
departmentMaterialPage.getList().forEach(item -> {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(item));
|
||||
erpMaterialDOList.add(erpMaterialDO);
|
||||
});
|
||||
erpMaterialRespVOS = BeanUtils.toBean(erpMaterialDOList, ErpMaterialRespVO.class);
|
||||
erpMaterialRespVOS.forEach(
|
||||
m -> {
|
||||
erpMaterialByMainMaterial.forEach(
|
||||
i -> {
|
||||
if (Objects.equals(m.getId(), i.getMaterialId())) {
|
||||
m.setCorrId(i.getId());
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
return erpMaterialDOList;
|
||||
return erpMaterialRespVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ErpMaterialDO> getErpMaterialByApi(MaterialInfomationPageReqDTO material) {
|
||||
CommonResult<PageResult<MaterialInfomationRespDTO>> materialInfomationPage = materialInfomationApi.getMaterialInfomationPage(material);
|
||||
public PageResult<ErpMaterialDO> getErpMaterialByApi(DepartmentMaterialPageReqDTO material) {
|
||||
CommonResult<PageResult<DepartmentMaterialRespDTO>> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(material);
|
||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||
if (materialInfomationPage.getData() != null && materialInfomationPage.getData().getList() != null && !materialInfomationPage.getData().getList().isEmpty()) {
|
||||
materialInfomationPage.getData().getList().forEach(
|
||||
materialInfomation -> {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
||||
erpMaterialDOList.add(erpMaterialDO);
|
||||
}
|
||||
);
|
||||
if (departmentMaterialPage.getData() != null && departmentMaterialPage.getData().getList() != null && !departmentMaterialPage.getData().getList().isEmpty()) {
|
||||
departmentMaterialPage.getData().getList().forEach(materialInfomation -> {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
||||
erpMaterialDOList.add(erpMaterialDO);
|
||||
});
|
||||
}
|
||||
return new PageResult<>(erpMaterialDOList, materialInfomationPage.getData().getTotal());
|
||||
return new PageResult<>(erpMaterialDOList, departmentMaterialPage.getData().getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErpMaterialDO getErpMaterialByMainMaterialByCode(String code) {
|
||||
MaterialInfomationPageReqDTO material = new MaterialInfomationPageReqDTO();
|
||||
material.setCode(code);
|
||||
material.setPageSize(PAGE_SIZE_NONE);
|
||||
CommonResult<PageResult<MaterialInfomationRespDTO>> materialInfomationPage = materialInfomationApi.getMaterialInfomationPage(material);
|
||||
if (materialInfomationPage.isSuccess() && materialInfomationPage.getData() != null&& !materialInfomationPage.getData().getList().isEmpty()) {
|
||||
return buildErpMaterialDOData(CommonResult.success(materialInfomationPage.getData().getList().get(0)));
|
||||
public List<ErpMaterialDO> getErpMaterialByMainMaterialByCode(String code, String deptId) {
|
||||
DepartmentMaterialPageReqDTO material = new DepartmentMaterialPageReqDTO();
|
||||
material.setMaterialNumber(code);
|
||||
material.setPageSize(10000);
|
||||
material.setDeptId(Long.valueOf(deptId));
|
||||
CommonResult<PageResult<DepartmentMaterialRespDTO>> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(material);
|
||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||
if (departmentMaterialPage.isSuccess() && departmentMaterialPage.getData() != null && !departmentMaterialPage.getData().getList().isEmpty()) {
|
||||
departmentMaterialPage.getData().getList().forEach(materialInfomation -> {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomation));
|
||||
erpMaterialDOList.add(erpMaterialDO);
|
||||
});
|
||||
return erpMaterialDOList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpMaterialDO> getErpMaterialByApiByCode(String code) {
|
||||
MaterialInfomationPageReqDTO material = new MaterialInfomationPageReqDTO();
|
||||
material.setCode(code);
|
||||
material.setPageSize(PAGE_SIZE_NONE);
|
||||
CommonResult<PageResult<MaterialInfomationRespDTO>> materialInfomationPage = materialInfomationApi.getMaterialInfomationPage(material);
|
||||
public List<ErpMaterialDO> getErpMaterialByApiByCode(String code, String deptId) {
|
||||
List<ErpMaterialDO> erpMaterialDOList = new ArrayList<>();
|
||||
if (materialInfomationPage.isSuccess() && materialInfomationPage.getData() != null&& !materialInfomationPage.getData().getList().isEmpty()) {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(materialInfomationPage.getData().getList().get(0)));
|
||||
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterial = erpMaterialCorrService.getErpMaterialByMainMaterial(erpMaterialDO.getId());
|
||||
CommonResult<List<MaterialInfomationRespDTO>> materialInfomationListByIds = materialInfomationApi.getMaterialInfomationListByIds(erpMaterialByMainMaterial.stream().map(ErpMaterialCorrRspVO::getMaterialId).toList());
|
||||
if (materialInfomationListByIds.getData() == null || materialInfomationListByIds.getData().isEmpty()) {
|
||||
return erpMaterialDOList;
|
||||
}
|
||||
materialInfomationListByIds.getData().forEach(
|
||||
materialInfomation -> {
|
||||
erpMaterialDOList.add(buildErpMaterialDOData(CommonResult.success(materialInfomation)));
|
||||
}
|
||||
);
|
||||
//获取该物料编码下的所有物料id,并根据这个ID查询子物料
|
||||
List<ErpMaterialCorrRspVO> erpMaterialByMainMaterialByCode = erpMaterialCorrService.getErpMaterialByMainMaterialByCode(code);
|
||||
if (erpMaterialByMainMaterialByCode.isEmpty()) {
|
||||
return erpMaterialDOList;
|
||||
}
|
||||
List<Long> mIds = erpMaterialByMainMaterialByCode.stream().map(ErpMaterialCorrRspVO::getId).toList();
|
||||
DepartmentMaterialPageReqDTO departmentMaterialPageReqDTO = new DepartmentMaterialPageReqDTO();
|
||||
departmentMaterialPageReqDTO.setInfomationIds(mIds);
|
||||
departmentMaterialPageReqDTO.setPageSize(10000);
|
||||
PageResult<DepartmentMaterialRespDTO> departmentMaterialPage = departmentMaterialApi.getDepartmentMaterialPage(departmentMaterialPageReqDTO).getData();
|
||||
if (departmentMaterialPage == null || departmentMaterialPage.getList() == null || departmentMaterialPage.getList().isEmpty()) {
|
||||
return erpMaterialDOList;
|
||||
}
|
||||
departmentMaterialPage.getList().forEach(item -> {
|
||||
ErpMaterialDO erpMaterialDO = buildErpMaterialDOData(CommonResult.success(item));
|
||||
erpMaterialDOList.add(erpMaterialDO);
|
||||
});
|
||||
return erpMaterialDOList;
|
||||
}
|
||||
|
||||
@@ -443,11 +477,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
}
|
||||
|
||||
private void initialize(String key) {
|
||||
List<String> existingNumbers = erpMaterialMapper.selectList(new LambdaQueryWrapperX<ErpMaterialDO>())
|
||||
.stream()
|
||||
.filter(ErpMaterialDO -> ErpMaterialDO.getType().equals("ERP"))
|
||||
.map(ErpMaterialDO::getDownCenterNumber)
|
||||
.collect(Collectors.toList());
|
||||
List<String> existingNumbers = erpMaterialMapper.selectList(new LambdaQueryWrapperX<ErpMaterialDO>()).stream().filter(ErpMaterialDO -> ErpMaterialDO.getType().equals("ERP")).map(ErpMaterialDO::getDownCenterNumber).collect(Collectors.toList());
|
||||
myRedisConfig.updateRedisCache(key, existingNumbers);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user