erp 代码权限修改

This commit is contained in:
liss
2026-01-12 11:37:57 +08:00
parent 47fd100b44
commit 6a25cd9c2c
21 changed files with 118 additions and 36 deletions

View File

@@ -103,7 +103,7 @@ public class ErpAssetController {
@PostMapping("/getErpAssetTask") @PostMapping("/getErpAssetTask")
@Operation(summary = "定时获得erp更新资产卡片") @Operation(summary = "定时获得erp更新资产卡片")
@PreAuthorize("@ss.hasPermission('sply:erp-asset:create')") @PreAuthorize("@ss.hasPermission('sply:erp-asset:sync')")
public CommonResult<Boolean> getErpAssetTask() { public CommonResult<Boolean> getErpAssetTask() {
erpAssetService.callErpRfcInterface(); erpAssetService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpBomController {
@PostMapping("/getErpBomTask") @PostMapping("/getErpBomTask")
@Operation(summary = "定时获得erp更新物料清单(BOM)") @Operation(summary = "定时获得erp更新物料清单(BOM)")
@PreAuthorize("@ss.hasPermission('sply:erp-bom:create')") @PreAuthorize("@ss.hasPermission('sply:erp-bom:sync')")
public CommonResult<Boolean> getErpBomTask() { public CommonResult<Boolean> getErpBomTask() {
erpBomService.callErpRfcInterface(); erpBomService.callErpRfcInterface();
return CommonResult.success(true); return CommonResult.success(true);

View File

@@ -103,7 +103,7 @@ public class ErpCompanyController {
@PostMapping("/getErpCompanyTask") @PostMapping("/getErpCompanyTask")
@Operation(summary = "定时获得erp更新公司") @Operation(summary = "定时获得erp更新公司")
@PreAuthorize("@ss.hasPermission('sply:erp-company:create')") @PreAuthorize("@ss.hasPermission('sply:erp-company:sync')")
public CommonResult<Boolean> getErpCompanyTask() { public CommonResult<Boolean> getErpCompanyTask() {
erpCompanyService.callErpRfcInterface(); erpCompanyService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -40,14 +40,14 @@ public class ErpContractController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建ERP合同映射") @Operation(summary = "创建ERP合同映射")
@PreAuthorize("@ss.hasPermission('bse:erp-contract:create')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:create')")
public CommonResult<ErpContractRespVO> createErpContract(@Valid @RequestBody ErpContractSaveReqVO createReqVO) { public CommonResult<ErpContractRespVO> createErpContract(@Valid @RequestBody ErpContractSaveReqVO createReqVO) {
return success(erpContractService.createErpContract(createReqVO)); return success(erpContractService.createErpContract(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新ERP合同映射") @Operation(summary = "更新ERP合同映射")
@PreAuthorize("@ss.hasPermission('bse:erp-contract:update')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:update')")
public CommonResult<Boolean> updateErpContract(@Valid @RequestBody ErpContractSaveReqVO updateReqVO) { public CommonResult<Boolean> updateErpContract(@Valid @RequestBody ErpContractSaveReqVO updateReqVO) {
erpContractService.updateErpContract(updateReqVO); erpContractService.updateErpContract(updateReqVO);
return success(true); return success(true);
@@ -56,7 +56,7 @@ public class ErpContractController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除ERP合同映射") @Operation(summary = "删除ERP合同映射")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('bse:erp-contract:delete')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:delete')")
public CommonResult<Boolean> deleteErpContract(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteErpContract(@RequestParam("id") Long id) {
erpContractService.deleteErpContract(id); erpContractService.deleteErpContract(id);
return success(true); return success(true);
@@ -65,7 +65,7 @@ public class ErpContractController {
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除ERP合同映射") @Operation(summary = "批量删除ERP合同映射")
@PreAuthorize("@ss.hasPermission('bse:erp-contract:delete')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:delete')")
public CommonResult<Boolean> deleteErpContractList(@RequestBody BatchDeleteReqVO req) { public CommonResult<Boolean> deleteErpContractList(@RequestBody BatchDeleteReqVO req) {
erpContractService.deleteErpContractListByIds(req.getIds()); erpContractService.deleteErpContractListByIds(req.getIds());
return success(true); return success(true);
@@ -74,7 +74,7 @@ public class ErpContractController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得ERP合同映射") @Operation(summary = "获得ERP合同映射")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bse:erp-contract:query')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:query')")
public CommonResult<ErpContractRespVO> getErpContract(@RequestParam("id") Long id) { public CommonResult<ErpContractRespVO> getErpContract(@RequestParam("id") Long id) {
ErpContractDO erpContract = erpContractService.getErpContract(id); ErpContractDO erpContract = erpContractService.getErpContract(id);
return success(BeanUtils.toBean(erpContract, ErpContractRespVO.class)); return success(BeanUtils.toBean(erpContract, ErpContractRespVO.class));
@@ -82,7 +82,7 @@ public class ErpContractController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得ERP合同映射分页") @Operation(summary = "获得ERP合同映射分页")
@PreAuthorize("@ss.hasPermission('bse:erp-contract:query')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:query')")
public CommonResult<PageResult<ErpContractRespVO>> getErpContractPage(@Valid ErpContractPageReqVO pageReqVO) { public CommonResult<PageResult<ErpContractRespVO>> getErpContractPage(@Valid ErpContractPageReqVO pageReqVO) {
PageResult<ErpContractDO> pageResult = erpContractService.getErpContractPage(pageReqVO); PageResult<ErpContractDO> pageResult = erpContractService.getErpContractPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpContractRespVO.class)); return success(BeanUtils.toBean(pageResult, ErpContractRespVO.class));
@@ -90,7 +90,7 @@ public class ErpContractController {
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出ERP合同映射 Excel") @Operation(summary = "导出ERP合同映射 Excel")
@PreAuthorize("@ss.hasPermission('bse:erp-contract:export')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportErpContractExcel(@Valid ErpContractPageReqVO pageReqVO, public void exportErpContractExcel(@Valid ErpContractPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
@@ -103,7 +103,7 @@ public class ErpContractController {
@PostMapping("/getErpContractTask") @PostMapping("/getErpContractTask")
@Operation(summary = "定时获得erp更新合同") @Operation(summary = "定时获得erp更新合同")
@PreAuthorize("@ss.hasPermission('sply:erp-contract:create')") @PreAuthorize("@ss.hasPermission('sply:erp-contract:sync')")
public CommonResult<Boolean> getErpContractTask() { public CommonResult<Boolean> getErpContractTask() {
erpContractService.callErpRfcInterface(); erpContractService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpCostcenterController {
@PostMapping("/getErpCostcenterTask") @PostMapping("/getErpCostcenterTask")
@Operation(summary = "定时获得erp更新成本中心") @Operation(summary = "定时获得erp更新成本中心")
@PreAuthorize("@ss.hasPermission('sply:erp-costcenter:create')") @PreAuthorize("@ss.hasPermission('sply:erp-costcenter:sync')")
public CommonResult<Boolean> getErpCostcenterTask() { public CommonResult<Boolean> getErpCostcenterTask() {
erpCostcenterService.callErpRfcInterface(); erpCostcenterService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpCustomerController {
@PostMapping("/getErpCustomerTask") @PostMapping("/getErpCustomerTask")
@Operation(summary = "定时获得erp更新客商主数据") @Operation(summary = "定时获得erp更新客商主数据")
@PreAuthorize("@ss.hasPermission('sply:erp-customer:create')") @PreAuthorize("@ss.hasPermission('sply:erp-customer:sync')")
public CommonResult<Boolean> getErpCustomerTask() { public CommonResult<Boolean> getErpCustomerTask() {
erpCustomerService.callErpRfcInterface(); erpCustomerService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -40,14 +40,14 @@ public class ErpFactoryController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建ERP工厂") @Operation(summary = "创建ERP工厂")
@PreAuthorize("@ss.hasPermission('base:erp-factory:create')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:create')")
public CommonResult<ErpFactoryRespVO> createErpFactory(@Valid @RequestBody ErpFactorySaveReqVO createReqVO) { public CommonResult<ErpFactoryRespVO> createErpFactory(@Valid @RequestBody ErpFactorySaveReqVO createReqVO) {
return success(erpFactoryService.createErpFactory(createReqVO)); return success(erpFactoryService.createErpFactory(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新ERP工厂") @Operation(summary = "更新ERP工厂")
@PreAuthorize("@ss.hasPermission('base:erp-factory:update')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:update')")
public CommonResult<Boolean> updateErpFactory(@Valid @RequestBody ErpFactorySaveReqVO updateReqVO) { public CommonResult<Boolean> updateErpFactory(@Valid @RequestBody ErpFactorySaveReqVO updateReqVO) {
erpFactoryService.updateErpFactory(updateReqVO); erpFactoryService.updateErpFactory(updateReqVO);
return success(true); return success(true);
@@ -56,7 +56,7 @@ public class ErpFactoryController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除ERP工厂") @Operation(summary = "删除ERP工厂")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:erp-factory:delete')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:delete')")
public CommonResult<Boolean> deleteErpFactory(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteErpFactory(@RequestParam("id") Long id) {
erpFactoryService.deleteErpFactory(id); erpFactoryService.deleteErpFactory(id);
return success(true); return success(true);
@@ -65,7 +65,7 @@ public class ErpFactoryController {
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除ERP工厂") @Operation(summary = "批量删除ERP工厂")
@PreAuthorize("@ss.hasPermission('base:erp-factory:delete')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:delete')")
public CommonResult<Boolean> deleteErpFactoryList(@RequestBody BatchDeleteReqVO req) { public CommonResult<Boolean> deleteErpFactoryList(@RequestBody BatchDeleteReqVO req) {
erpFactoryService.deleteErpFactoryListByIds(req.getIds()); erpFactoryService.deleteErpFactoryListByIds(req.getIds());
return success(true); return success(true);
@@ -74,7 +74,7 @@ public class ErpFactoryController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得ERP工厂") @Operation(summary = "获得ERP工厂")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:erp-factory:query')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:query')")
public CommonResult<ErpFactoryRespVO> getErpFactory(@RequestParam("id") Long id) { public CommonResult<ErpFactoryRespVO> getErpFactory(@RequestParam("id") Long id) {
ErpFactoryDO erpFactory = erpFactoryService.getErpFactory(id); ErpFactoryDO erpFactory = erpFactoryService.getErpFactory(id);
return success(BeanUtils.toBean(erpFactory, ErpFactoryRespVO.class)); return success(BeanUtils.toBean(erpFactory, ErpFactoryRespVO.class));
@@ -82,7 +82,7 @@ public class ErpFactoryController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得ERP工厂分页") @Operation(summary = "获得ERP工厂分页")
@PreAuthorize("@ss.hasPermission('base:erp-factory:query')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:query')")
public CommonResult<PageResult<ErpFactoryRespVO>> getErpFactoryPage(@Valid ErpFactoryPageReqVO pageReqVO) { public CommonResult<PageResult<ErpFactoryRespVO>> getErpFactoryPage(@Valid ErpFactoryPageReqVO pageReqVO) {
PageResult<ErpFactoryDO> pageResult = erpFactoryService.getErpFactoryPage(pageReqVO); PageResult<ErpFactoryDO> pageResult = erpFactoryService.getErpFactoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpFactoryRespVO.class)); return success(BeanUtils.toBean(pageResult, ErpFactoryRespVO.class));
@@ -90,7 +90,7 @@ public class ErpFactoryController {
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出ERP工厂 Excel") @Operation(summary = "导出ERP工厂 Excel")
@PreAuthorize("@ss.hasPermission('base:erp-factory:export')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportErpFactoryExcel(@Valid ErpFactoryPageReqVO pageReqVO, public void exportErpFactoryExcel(@Valid ErpFactoryPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
@@ -103,7 +103,7 @@ public class ErpFactoryController {
@PutMapping("/enable-list") @PutMapping("/enable-list")
@Operation(summary = "批量更新") @Operation(summary = "批量更新")
@PreAuthorize("@ss.hasPermission('base:erp-factory:update')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:update')")
public CommonResult<Boolean> enableFactoryList(@RequestBody List<ErpFactoryRespVO> saveReqVOS) { public CommonResult<Boolean> enableFactoryList(@RequestBody List<ErpFactoryRespVO> saveReqVOS) {
erpFactoryService.enableFactoryList(saveReqVOS); erpFactoryService.enableFactoryList(saveReqVOS);
return success(true); return success(true);
@@ -111,7 +111,7 @@ public class ErpFactoryController {
@PostMapping("/getErpFactoryTask") @PostMapping("/getErpFactoryTask")
@Operation(summary = "定时获得erp工厂数据") @Operation(summary = "定时获得erp工厂数据")
@PreAuthorize("@ss.hasPermission('base:erp-factory:create')") @PreAuthorize("@ss.hasPermission('sply:erp-factory:sync')")
public CommonResult<Boolean> getErpFactoryTask() { public CommonResult<Boolean> getErpFactoryTask() {
erpFactoryService.callErpRfcInterface(); erpFactoryService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpInternalOrderController {
@PostMapping("/getErpInternalOrderTask") @PostMapping("/getErpInternalOrderTask")
@Operation(summary = "定时获得erp更新内部订单数据") @Operation(summary = "定时获得erp更新内部订单数据")
@PreAuthorize("@ss.hasPermission('sply:erp-internal-order:create')") @PreAuthorize("@ss.hasPermission('sply:erp-internal-order:sync')")
public CommonResult<Boolean> getErpInternalOrderTask() { public CommonResult<Boolean> getErpInternalOrderTask() {
erpInternalOrderService.callErpRfcInterface(); erpInternalOrderService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -105,7 +105,7 @@ public class ErpMaterialController {
@PostMapping("/getErpMaterialTask") @PostMapping("/getErpMaterialTask")
@Operation(summary = "定时获得erp更新物料") @Operation(summary = "定时获得erp更新物料")
@PreAuthorize("@ss.hasPermission('sply:erp-material:create')") @PreAuthorize("@ss.hasPermission('sply:erp-material:sync')")
public CommonResult<Boolean> getErpMaterialTask() { public CommonResult<Boolean> getErpMaterialTask() {
erpMaterialService.callErpRfcInterface(); erpMaterialService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpProcessController {
@PostMapping("/getErpProcessTask") @PostMapping("/getErpProcessTask")
@Operation(summary = "定时获得erp更新工艺路线") @Operation(summary = "定时获得erp更新工艺路线")
@PreAuthorize("@ss.hasPermission('sply:erp-process:create')") @PreAuthorize("@ss.hasPermission('sply:erp-process:sync')")
public CommonResult<Boolean> getErpProcessTask() { public CommonResult<Boolean> getErpProcessTask() {
erpProcessService.callErpRfcInterface(); erpProcessService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpProductiveOrderController {
@PostMapping("/getErpProductiveOrderTask") @PostMapping("/getErpProductiveOrderTask")
@Operation(summary = "定时获得erp更新生产订单") @Operation(summary = "定时获得erp更新生产订单")
@PreAuthorize("@ss.hasPermission('sply:erp-productive-order:create')") @PreAuthorize("@ss.hasPermission('sply:erp-productive-order:sync')")
public CommonResult<Boolean> getErpProductiveOrderTask() { public CommonResult<Boolean> getErpProductiveOrderTask() {
erpProductiveOrderService.callErpRfcInterface(); erpProductiveOrderService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpProductiveVersionController {
@PostMapping("/getErpProductiveVersionTask") @PostMapping("/getErpProductiveVersionTask")
@Operation(summary = "定时获得erp更新生产版本") @Operation(summary = "定时获得erp更新生产版本")
@PreAuthorize("@ss.hasPermission('sply:erp-productive-version:create')") @PreAuthorize("@ss.hasPermission('sply:erp-productive-version:sync')")
public CommonResult<Boolean> getErpProductiveVersionTask() { public CommonResult<Boolean> getErpProductiveVersionTask() {
erpProductiveVersionService.callErpRfcInterface(); erpProductiveVersionService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpPurchaseOrganizationController {
@PostMapping("/getErpPurchaseOrganizationTask") @PostMapping("/getErpPurchaseOrganizationTask")
@Operation(summary = "定时获得erp更新采购组织") @Operation(summary = "定时获得erp更新采购组织")
@PreAuthorize("@ss.hasPermission('sply:erp-purchase-organization:create')") @PreAuthorize("@ss.hasPermission('sply:erp-purchase-organization:sync')")
public CommonResult<Boolean> getErpPurchaseOrganizationTask() { public CommonResult<Boolean> getErpPurchaseOrganizationTask() {
erpPurchaseOrganizationService.callErpRfcInterface(); erpPurchaseOrganizationService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -103,7 +103,7 @@ public class ErpSalesOrganizationController {
@PostMapping("/getErpSalesOrganizationTask") @PostMapping("/getErpSalesOrganizationTask")
@Operation(summary = "定时获得erp更新销售组织") @Operation(summary = "定时获得erp更新销售组织")
@PreAuthorize("@ss.hasPermission('sply:erp-sales-organization:create')") @PreAuthorize("@ss.hasPermission('sply:erp-sales-organization:sync')")
public CommonResult<Boolean> getErpSalesOrganizationTask() { public CommonResult<Boolean> getErpSalesOrganizationTask() {
erpSalesOrganizationService.callErpRfcInterface(); erpSalesOrganizationService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -65,7 +65,7 @@ public class ErpWarehouseController {
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除ERP库位") @Operation(summary = "批量删除ERP库位")
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:delete')") @PreAuthorize("@ss.hasPermission('sply:erp-warehouse:delete')")
public CommonResult<Boolean> deleteErpWarehouseList(@RequestBody BatchDeleteReqVO req) { public CommonResult<Boolean> deleteErpWarehouseList(@RequestBody BatchDeleteReqVO req) {
erpWarehouseService.deleteErpWarehouseListByIds(req.getIds()); erpWarehouseService.deleteErpWarehouseListByIds(req.getIds());
return success(true); return success(true);
@@ -88,22 +88,30 @@ public class ErpWarehouseController {
return success(pageResult); return success(pageResult);
} }
@GetMapping("/page-distinct-factory")
@Operation(summary = "获得ERP库位分页根据工厂去重")
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
public CommonResult<PageResult<ErpWarehouseRespVO>> getErpWarehousePageDistinctByFactory(@Valid ErpWarehousePageReqVO pageReqVO) {
PageResult<ErpWarehouseDO> pageResult = erpWarehouseService.getErpWarehousePageDistinctByFactory(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpWarehouseRespVO.class));
}
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出ERP库位 Excel") @Operation(summary = "导出ERP库位 Excel")
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:export')") @PreAuthorize("@ss.hasPermission('sply:erp-warehouse:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportErpWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO, public void exportErpWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpWarehouseDO> list = BeanUtils.toBean(erpWarehouseService.getErpWarehousePage(pageReqVO).getList(), ErpWarehouseDO.class); List<ErpWarehouseDO> list = BeanUtils.toBean(erpWarehouseService.getErpWarehousePage(pageReqVO).getList(), ErpWarehouseDO.class);
// 导出 Excel // 导出 Excel
ExcelUtils.write(response, "ERP库位.xls", "数据", ErpWarehouseRespVO.class, ExcelUtils.write(response, "ERP库位.xls", "数据", ErpWarehouseRespVO.class,
BeanUtils.toBean(list, ErpWarehouseRespVO.class)); BeanUtils.toBean(list, ErpWarehouseRespVO.class));
} }
@PutMapping("/enable-list") @PutMapping("/enable-list")
@Operation(summary = "批量更新") @Operation(summary = "批量更新")
@PreAuthorize("@ss.hasPermission('base:warehouse:update')") @PreAuthorize("@ss.hasPermission('sply:warehouse:update')")
public CommonResult<Boolean> enableWarehouseList(@RequestBody List<ErpWarehouseSaveReqVO> saveReqVOS) { public CommonResult<Boolean> enableWarehouseList(@RequestBody List<ErpWarehouseSaveReqVO> saveReqVOS) {
erpWarehouseService.enableWarehouseList(saveReqVOS); erpWarehouseService.enableWarehouseList(saveReqVOS);
return success(true); return success(true);
@@ -111,7 +119,7 @@ public class ErpWarehouseController {
@PostMapping("/getErpWarehouseTask") @PostMapping("/getErpWarehouseTask")
@Operation(summary = "定时获得erp更新库位") @Operation(summary = "定时获得erp更新库位")
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:create')") @PreAuthorize("@ss.hasPermission('sply:erp-warehouse:sync')")
public CommonResult<Boolean> getErpWarehouseTask() { public CommonResult<Boolean> getErpWarehouseTask() {
erpWarehouseService.callErpRfcInterface(); erpWarehouseService.callErpRfcInterface();
return success(true); return success(true);

View File

@@ -31,6 +31,9 @@ public class ErpWarehouseDO extends BusinessBaseDO {
*/ */
@TableField("FACT_NUM") @TableField("FACT_NUM")
private String factoryNumber; private String factoryNumber;
@TableField("CPN_NUM")
private String companyNumber;
/** /**
* 工厂名称;将查询参数存入 * 工厂名称;将查询参数存入
*/ */

View File

@@ -3,7 +3,9 @@ package com.zt.plat.module.erp.dal.mysql.erp;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpSalesOrganizationPageReqVO;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpWarehousePageReqVO; import com.zt.plat.module.erp.controller.admin.erp.vo.ErpWarehousePageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpSalesOrganizationDO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO; import com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -17,6 +19,13 @@ import java.util.List;
@Mapper @Mapper
public interface ErpWarehouseMapper extends BaseMapperX<ErpWarehouseDO> { public interface ErpWarehouseMapper extends BaseMapperX<ErpWarehouseDO> {
default List<ErpWarehouseDO> selectList(ErpWarehousePageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ErpWarehouseDO>()
.likeIfPresent(ErpWarehouseDO::getNumber, reqVO.getNumber())
.likeIfPresent(ErpWarehouseDO::getName, reqVO.getName())
.orderByDesc(ErpWarehouseDO::getId));
}
String selectMaxCode(); String selectMaxCode();
List<ErpWarehouseDO> getPageByReq(ErpWarehousePageReqVO pageReqVO); List<ErpWarehouseDO> getPageByReq(ErpWarehousePageReqVO pageReqVO);

View File

@@ -61,6 +61,8 @@ public interface ErpFactoryService {
*/ */
PageResult<ErpFactoryDO> getErpFactoryPage(ErpFactoryPageReqVO pageReqVO); PageResult<ErpFactoryDO> getErpFactoryPage(ErpFactoryPageReqVO pageReqVO);
List<ErpFactoryDO> getErpFactoryList();
void callErpRfcInterface(); void callErpRfcInterface();
void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS); void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS);

View File

@@ -171,6 +171,11 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
return new PageResult<>(pageList, (long) total); return new PageResult<>(pageList, (long) total);
} }
@Override
public List<ErpFactoryDO> getErpFactoryList() {
return erpFactoryMapper.selectList(new LambdaQueryWrapperX<ErpFactoryDO>());
}
@Override @Override
public void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS) { public void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS) {
List<ErpFactoryDO> updateObj = BeanUtils.toBean(saveReqVOS, ErpFactoryDO.class); List<ErpFactoryDO> updateObj = BeanUtils.toBean(saveReqVOS, ErpFactoryDO.class);

View File

@@ -65,4 +65,6 @@ public interface ErpWarehouseService {
void callErpRfcInterface(); void callErpRfcInterface();
void enableWarehouseList(List<ErpWarehouseSaveReqVO> saveReqVOS); void enableWarehouseList(List<ErpWarehouseSaveReqVO> saveReqVOS);
PageResult<ErpWarehouseDO> getErpWarehousePageDistinctByFactory(ErpWarehousePageReqVO pageReqVO);
} }

View File

@@ -8,6 +8,7 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpFactoryDO; import com.zt.plat.module.erp.dal.dataobject.erp.ErpFactoryDO;
import com.zt.plat.module.erp.dal.mysql.erp.ErpFactoryMapper;
import com.zt.plat.module.erp.utils.ErpConfig; import com.zt.plat.module.erp.utils.ErpConfig;
import com.zt.plat.module.erp.utils.MyRedisConfig; import com.zt.plat.module.erp.utils.MyRedisConfig;
import com.zt.plat.module.erp.enums.OftenEnum; import com.zt.plat.module.erp.enums.OftenEnum;
@@ -40,6 +41,8 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
@Resource @Resource
private ErpWarehouseMapper erpWarehouseMapper; private ErpWarehouseMapper erpWarehouseMapper;
@Resource
private ErpFactoryService erpFactoryService;
@Resource @Resource
private MyRedisConfig myRedisConfig; private MyRedisConfig myRedisConfig;
@@ -148,6 +151,44 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
} }
} }
@Override
public PageResult<ErpWarehouseDO> getErpWarehousePageDistinctByFactory(ErpWarehousePageReqVO pageReqVO) {
// 获取所有数据
List<ErpWarehouseDO> allList = erpWarehouseMapper.selectList(pageReqVO);
if (allList == null) {
allList = Collections.emptyList();
}
// 按工厂编码去重,保留第一个出现的元素
List<ErpWarehouseDO> distinctList = allList.stream()
.collect(Collectors.toMap(
ErpWarehouseDO::getFactoryNumber,
warehouse -> warehouse,
(existing, replacement) -> existing,
LinkedHashMap::new)) // 保持原始顺序
.values()
.stream()
.collect(Collectors.toList());
// 分页处理
int pageNo = pageReqVO.getPageNo();
int pageSize = pageReqVO.getPageSize();
long total = distinctList.size();
// 计算分页起始和结束位置
int fromIndex = (pageNo - 1) * pageSize;
int toIndex = (int) Math.min((long) fromIndex + pageSize, total);
// 如果起始位置超出范围,则返回空列表
if (fromIndex >= total) {
return new PageResult<>(Collections.emptyList(), total);
}
// 截取当前页数据
List<ErpWarehouseDO> pageList = distinctList.subList(fromIndex, toIndex);
return new PageResult<>(pageList, total);
}
@Override @Override
public PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) { public PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) {
@@ -203,6 +244,15 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
JSONArray dataArrayALL = new JSONArray(); JSONArray dataArrayALL = new JSONArray();
String factKey = "erpMap" + OftenEnum.FuncnrEnum.工厂信息.getFuncnr(); String factKey = "erpMap" + OftenEnum.FuncnrEnum.工厂信息.getFuncnr();
Map<String, Long> redisCache = myRedisConfig.getRedisCacheMap(factKey); Map<String, Long> redisCache = myRedisConfig.getRedisCacheMap(factKey);
List<ErpFactoryDO> erpFactoryList = erpFactoryService.getErpFactoryList();
Map<String, String> factoryMap = new HashMap<>();
if (CollUtil.isNotEmpty(erpFactoryList)){
for (ErpFactoryDO erpFactoryDO : erpFactoryList){
factoryMap.put(erpFactoryDO.getNumber(),erpFactoryDO.getErpCompanyNumber());
}
}
if (CollUtil.isEmpty(redisCache)) { if (CollUtil.isEmpty(redisCache)) {
throw exception(ERP_FACTORY_NOT_EXISTS); throw exception(ERP_FACTORY_NOT_EXISTS);
} }
@@ -229,7 +279,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
} }
// 2. 处理公司数据,区分新增和更新 // 2. 处理公司数据,区分新增和更新
ProcessingResult result = processData(dataArrayALL, funcnrEnum); ProcessingResult result = processData(dataArrayALL, funcnrEnum,factoryMap);
// 3. 批量保存数据 // 3. 批量保存数据
saveData(result); saveData(result);
@@ -238,7 +288,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
/** /**
* 处理数据,区分新增和更新 * 处理数据,区分新增和更新
*/ */
private ProcessingResult processData(JSONArray dataArray, OftenEnum.FuncnrEnum funcnr) { private ProcessingResult processData(JSONArray dataArray, OftenEnum.FuncnrEnum funcnr,Map<String, String> factoryMap) {
String key = "erpMap" + funcnr.getFuncnr(); String key = "erpMap" + funcnr.getFuncnr();
Map<String, Long> numbers = myRedisConfig.getRedisCacheMap(key); Map<String, Long> numbers = myRedisConfig.getRedisCacheMap(key);
List<ErpWarehouseDO> toUpdate = new ArrayList<>(); List<ErpWarehouseDO> toUpdate = new ArrayList<>();
@@ -252,6 +302,9 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
DO.setName(dataJson.getString("LGOBE")); DO.setName(dataJson.getString("LGOBE"));
DO.setNumber(dataJson.getString("LGORT").trim()); DO.setNumber(dataJson.getString("LGORT").trim());
DO.setFactoryNumber(dataJson.getString("WERKS")); DO.setFactoryNumber(dataJson.getString("WERKS"));
if (DO.getFactoryNumber() != null && factoryMap != null){
DO.setCompanyNumber(factoryMap.get(DO.getFactoryNumber()));
}
DO.setType("ERP"); DO.setType("ERP");
String number = dataJson.getString("WERKS").trim() + "-" + dataJson.getString("LGORT").trim(); String number = dataJson.getString("WERKS").trim() + "-" + dataJson.getString("LGORT").trim();
if (numbers.get(number) != null) { if (numbers.get(number) != null) {