erp 代码权限修改
This commit is contained in:
@@ -103,7 +103,7 @@ public class ErpAssetController {
|
||||
|
||||
@PostMapping("/getErpAssetTask")
|
||||
@Operation(summary = "定时获得erp更新资产卡片")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-asset:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-asset:sync')")
|
||||
public CommonResult<Boolean> getErpAssetTask() {
|
||||
erpAssetService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpBomController {
|
||||
|
||||
@PostMapping("/getErpBomTask")
|
||||
@Operation(summary = "定时获得erp更新物料清单(BOM)")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-bom:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-bom:sync')")
|
||||
public CommonResult<Boolean> getErpBomTask() {
|
||||
erpBomService.callErpRfcInterface();
|
||||
return CommonResult.success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpCompanyController {
|
||||
|
||||
@PostMapping("/getErpCompanyTask")
|
||||
@Operation(summary = "定时获得erp更新公司")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-company:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-company:sync')")
|
||||
public CommonResult<Boolean> getErpCompanyTask() {
|
||||
erpCompanyService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -40,14 +40,14 @@ public class ErpContractController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@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) {
|
||||
return success(erpContractService.createErpContract(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@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) {
|
||||
erpContractService.updateErpContract(updateReqVO);
|
||||
return success(true);
|
||||
@@ -56,7 +56,7 @@ public class ErpContractController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除ERP合同映射")
|
||||
@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) {
|
||||
erpContractService.deleteErpContract(id);
|
||||
return success(true);
|
||||
@@ -65,7 +65,7 @@ public class ErpContractController {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除ERP合同映射")
|
||||
@PreAuthorize("@ss.hasPermission('bse:erp-contract:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-contract:delete')")
|
||||
public CommonResult<Boolean> deleteErpContractList(@RequestBody BatchDeleteReqVO req) {
|
||||
erpContractService.deleteErpContractListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -74,7 +74,7 @@ public class ErpContractController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得ERP合同映射")
|
||||
@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) {
|
||||
ErpContractDO erpContract = erpContractService.getErpContract(id);
|
||||
return success(BeanUtils.toBean(erpContract, ErpContractRespVO.class));
|
||||
@@ -82,7 +82,7 @@ public class ErpContractController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@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) {
|
||||
PageResult<ErpContractDO> pageResult = erpContractService.getErpContractPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ErpContractRespVO.class));
|
||||
@@ -90,7 +90,7 @@ public class ErpContractController {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出ERP合同映射 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('bse:erp-contract:export')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-contract:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportErpContractExcel(@Valid ErpContractPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -103,7 +103,7 @@ public class ErpContractController {
|
||||
|
||||
@PostMapping("/getErpContractTask")
|
||||
@Operation(summary = "定时获得erp更新合同")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-contract:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-contract:sync')")
|
||||
public CommonResult<Boolean> getErpContractTask() {
|
||||
erpContractService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpCostcenterController {
|
||||
|
||||
@PostMapping("/getErpCostcenterTask")
|
||||
@Operation(summary = "定时获得erp更新成本中心")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-costcenter:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-costcenter:sync')")
|
||||
public CommonResult<Boolean> getErpCostcenterTask() {
|
||||
erpCostcenterService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpCustomerController {
|
||||
|
||||
@PostMapping("/getErpCustomerTask")
|
||||
@Operation(summary = "定时获得erp更新客商主数据")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-customer:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-customer:sync')")
|
||||
public CommonResult<Boolean> getErpCustomerTask() {
|
||||
erpCustomerService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -40,14 +40,14 @@ public class ErpFactoryController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@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) {
|
||||
return success(erpFactoryService.createErpFactory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@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) {
|
||||
erpFactoryService.updateErpFactory(updateReqVO);
|
||||
return success(true);
|
||||
@@ -56,7 +56,7 @@ public class ErpFactoryController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除ERP工厂")
|
||||
@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) {
|
||||
erpFactoryService.deleteErpFactory(id);
|
||||
return success(true);
|
||||
@@ -65,7 +65,7 @@ public class ErpFactoryController {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除ERP工厂")
|
||||
@PreAuthorize("@ss.hasPermission('base:erp-factory:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-factory:delete')")
|
||||
public CommonResult<Boolean> deleteErpFactoryList(@RequestBody BatchDeleteReqVO req) {
|
||||
erpFactoryService.deleteErpFactoryListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -74,7 +74,7 @@ public class ErpFactoryController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得ERP工厂")
|
||||
@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) {
|
||||
ErpFactoryDO erpFactory = erpFactoryService.getErpFactory(id);
|
||||
return success(BeanUtils.toBean(erpFactory, ErpFactoryRespVO.class));
|
||||
@@ -82,7 +82,7 @@ public class ErpFactoryController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@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) {
|
||||
PageResult<ErpFactoryDO> pageResult = erpFactoryService.getErpFactoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ErpFactoryRespVO.class));
|
||||
@@ -90,7 +90,7 @@ public class ErpFactoryController {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出ERP工厂 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('base:erp-factory:export')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-factory:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportErpFactoryExcel(@Valid ErpFactoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -103,7 +103,7 @@ public class ErpFactoryController {
|
||||
|
||||
@PutMapping("/enable-list")
|
||||
@Operation(summary = "批量更新")
|
||||
@PreAuthorize("@ss.hasPermission('base:erp-factory:update')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-factory:update')")
|
||||
public CommonResult<Boolean> enableFactoryList(@RequestBody List<ErpFactoryRespVO> saveReqVOS) {
|
||||
erpFactoryService.enableFactoryList(saveReqVOS);
|
||||
return success(true);
|
||||
@@ -111,7 +111,7 @@ public class ErpFactoryController {
|
||||
|
||||
@PostMapping("/getErpFactoryTask")
|
||||
@Operation(summary = "定时获得erp工厂数据")
|
||||
@PreAuthorize("@ss.hasPermission('base:erp-factory:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-factory:sync')")
|
||||
public CommonResult<Boolean> getErpFactoryTask() {
|
||||
erpFactoryService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpInternalOrderController {
|
||||
|
||||
@PostMapping("/getErpInternalOrderTask")
|
||||
@Operation(summary = "定时获得erp更新内部订单数据")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-internal-order:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-internal-order:sync')")
|
||||
public CommonResult<Boolean> getErpInternalOrderTask() {
|
||||
erpInternalOrderService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ErpMaterialController {
|
||||
|
||||
@PostMapping("/getErpMaterialTask")
|
||||
@Operation(summary = "定时获得erp更新物料")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:sync')")
|
||||
public CommonResult<Boolean> getErpMaterialTask() {
|
||||
erpMaterialService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpProcessController {
|
||||
|
||||
@PostMapping("/getErpProcessTask")
|
||||
@Operation(summary = "定时获得erp更新工艺路线")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-process:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-process:sync')")
|
||||
public CommonResult<Boolean> getErpProcessTask() {
|
||||
erpProcessService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpProductiveOrderController {
|
||||
|
||||
@PostMapping("/getErpProductiveOrderTask")
|
||||
@Operation(summary = "定时获得erp更新生产订单")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-productive-order:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-productive-order:sync')")
|
||||
public CommonResult<Boolean> getErpProductiveOrderTask() {
|
||||
erpProductiveOrderService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpProductiveVersionController {
|
||||
|
||||
@PostMapping("/getErpProductiveVersionTask")
|
||||
@Operation(summary = "定时获得erp更新生产版本")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-productive-version:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-productive-version:sync')")
|
||||
public CommonResult<Boolean> getErpProductiveVersionTask() {
|
||||
erpProductiveVersionService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpPurchaseOrganizationController {
|
||||
|
||||
@PostMapping("/getErpPurchaseOrganizationTask")
|
||||
@Operation(summary = "定时获得erp更新采购组织")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-purchase-organization:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-purchase-organization:sync')")
|
||||
public CommonResult<Boolean> getErpPurchaseOrganizationTask() {
|
||||
erpPurchaseOrganizationService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ErpSalesOrganizationController {
|
||||
|
||||
@PostMapping("/getErpSalesOrganizationTask")
|
||||
@Operation(summary = "定时获得erp更新销售组织")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-sales-organization:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-sales-organization:sync')")
|
||||
public CommonResult<Boolean> getErpSalesOrganizationTask() {
|
||||
erpSalesOrganizationService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ErpWarehouseController {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除ERP库位")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:delete')")
|
||||
public CommonResult<Boolean> deleteErpWarehouseList(@RequestBody BatchDeleteReqVO req) {
|
||||
erpWarehouseService.deleteErpWarehouseListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -88,22 +88,30 @@ public class ErpWarehouseController {
|
||||
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")
|
||||
@Operation(summary = "导出ERP库位 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportErpWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ErpWarehouseDO> list = BeanUtils.toBean(erpWarehouseService.getErpWarehousePage(pageReqVO).getList(), ErpWarehouseDO.class);
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "ERP库位.xls", "数据", ErpWarehouseRespVO.class,
|
||||
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
|
||||
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
|
||||
}
|
||||
|
||||
@PutMapping("/enable-list")
|
||||
@Operation(summary = "批量更新")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse:update')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:warehouse:update')")
|
||||
public CommonResult<Boolean> enableWarehouseList(@RequestBody List<ErpWarehouseSaveReqVO> saveReqVOS) {
|
||||
erpWarehouseService.enableWarehouseList(saveReqVOS);
|
||||
return success(true);
|
||||
@@ -111,7 +119,7 @@ public class ErpWarehouseController {
|
||||
|
||||
@PostMapping("/getErpWarehouseTask")
|
||||
@Operation(summary = "定时获得erp更新库位")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:create')")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:sync')")
|
||||
public CommonResult<Boolean> getErpWarehouseTask() {
|
||||
erpWarehouseService.callErpRfcInterface();
|
||||
return success(true);
|
||||
|
||||
@@ -31,6 +31,9 @@ public class ErpWarehouseDO extends BusinessBaseDO {
|
||||
*/
|
||||
@TableField("FACT_NUM")
|
||||
private String factoryNumber;
|
||||
|
||||
@TableField("CPN_NUM")
|
||||
private String companyNumber;
|
||||
/**
|
||||
* 工厂名称;将查询参数存入
|
||||
*/
|
||||
|
||||
@@ -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.mybatis.core.mapper.BaseMapperX;
|
||||
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.dal.dataobject.erp.ErpSalesOrganizationDO;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -17,6 +19,13 @@ import java.util.List;
|
||||
@Mapper
|
||||
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();
|
||||
|
||||
List<ErpWarehouseDO> getPageByReq(ErpWarehousePageReqVO pageReqVO);
|
||||
|
||||
@@ -61,6 +61,8 @@ public interface ErpFactoryService {
|
||||
*/
|
||||
PageResult<ErpFactoryDO> getErpFactoryPage(ErpFactoryPageReqVO pageReqVO);
|
||||
|
||||
List<ErpFactoryDO> getErpFactoryList();
|
||||
|
||||
void callErpRfcInterface();
|
||||
|
||||
void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS);
|
||||
|
||||
@@ -171,6 +171,11 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
|
||||
return new PageResult<>(pageList, (long) total);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpFactoryDO> getErpFactoryList() {
|
||||
return erpFactoryMapper.selectList(new LambdaQueryWrapperX<ErpFactoryDO>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableFactoryList(List<ErpFactoryRespVO> saveReqVOS) {
|
||||
List<ErpFactoryDO> updateObj = BeanUtils.toBean(saveReqVOS, ErpFactoryDO.class);
|
||||
|
||||
@@ -65,4 +65,6 @@ public interface ErpWarehouseService {
|
||||
void callErpRfcInterface();
|
||||
|
||||
void enableWarehouseList(List<ErpWarehouseSaveReqVO> saveReqVOS);
|
||||
|
||||
PageResult<ErpWarehouseDO> getErpWarehousePageDistinctByFactory(ErpWarehousePageReqVO pageReqVO);
|
||||
}
|
||||
@@ -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.mybatis.core.query.LambdaQueryWrapperX;
|
||||
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.MyRedisConfig;
|
||||
import com.zt.plat.module.erp.enums.OftenEnum;
|
||||
@@ -40,6 +41,8 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
|
||||
@Resource
|
||||
private ErpWarehouseMapper erpWarehouseMapper;
|
||||
@Resource
|
||||
private ErpFactoryService erpFactoryService;
|
||||
|
||||
@Resource
|
||||
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
|
||||
public PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) {
|
||||
@@ -203,6 +244,15 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
JSONArray dataArrayALL = new JSONArray();
|
||||
String factKey = "erpMap" + OftenEnum.FuncnrEnum.工厂信息.getFuncnr();
|
||||
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)) {
|
||||
throw exception(ERP_FACTORY_NOT_EXISTS);
|
||||
}
|
||||
@@ -229,7 +279,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
}
|
||||
|
||||
// 2. 处理公司数据,区分新增和更新
|
||||
ProcessingResult result = processData(dataArrayALL, funcnrEnum);
|
||||
ProcessingResult result = processData(dataArrayALL, funcnrEnum,factoryMap);
|
||||
|
||||
// 3. 批量保存数据
|
||||
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();
|
||||
Map<String, Long> numbers = myRedisConfig.getRedisCacheMap(key);
|
||||
List<ErpWarehouseDO> toUpdate = new ArrayList<>();
|
||||
@@ -252,6 +302,9 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
DO.setName(dataJson.getString("LGOBE"));
|
||||
DO.setNumber(dataJson.getString("LGORT").trim());
|
||||
DO.setFactoryNumber(dataJson.getString("WERKS"));
|
||||
if (DO.getFactoryNumber() != null && factoryMap != null){
|
||||
DO.setCompanyNumber(factoryMap.get(DO.getFactoryNumber()));
|
||||
}
|
||||
DO.setType("ERP");
|
||||
String number = dataJson.getString("WERKS").trim() + "-" + dataJson.getString("LGORT").trim();
|
||||
if (numbers.get(number) != null) {
|
||||
|
||||
Reference in New Issue
Block a user