权限标识相关功能修复
This commit is contained in:
@@ -41,14 +41,14 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建仓库工厂关系")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:create')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:create')")
|
||||
public CommonResult<WarehouseFactoryRespVO> createWarehouseFactory(@Valid @RequestBody WarehouseFactorySaveReqVO createReqVO) {
|
||||
return success(warehouseFactoryService.createWarehouseFactory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新仓库工厂关系")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:update')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:update')")
|
||||
public CommonResult<Boolean> updateWarehouseFactory(@Valid @RequestBody WarehouseFactorySaveReqVO updateReqVO) {
|
||||
warehouseFactoryService.updateWarehouseFactory(updateReqVO);
|
||||
return success(true);
|
||||
@@ -57,7 +57,7 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除仓库工厂关系")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:delete')")
|
||||
public CommonResult<Boolean> deleteWarehouseFactory(@RequestParam("id") Long id) {
|
||||
warehouseFactoryService.deleteWarehouseFactory(id);
|
||||
return success(true);
|
||||
@@ -66,7 +66,7 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除仓库工厂关系")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:delete')")
|
||||
public CommonResult<Boolean> deleteWarehouseFactoryList(@RequestBody BatchDeleteReqVO req) {
|
||||
warehouseFactoryService.deleteWarehouseFactoryListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -75,7 +75,7 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得仓库工厂关系")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:query')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:query')")
|
||||
public CommonResult<WarehouseFactoryRespVO> getWarehouseFactory(@RequestParam("id") Long id) {
|
||||
WarehouseFactoryDO warehouseFactory = warehouseFactoryService.getWarehouseFactory(id);
|
||||
return success(BeanUtils.toBean(warehouseFactory, WarehouseFactoryRespVO.class));
|
||||
@@ -83,7 +83,7 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得仓库工厂关系分页")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:query')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:query')")
|
||||
public CommonResult<PageResult<WarehouseFactoryRespVO>> getWarehouseFactoryPage(@Valid WarehouseFactoryPageReqVO pageReqVO) {
|
||||
PageResult<WarehouseFactoryDO> pageResult = warehouseFactoryService.getWarehouseFactoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, WarehouseFactoryRespVO.class));
|
||||
@@ -91,7 +91,7 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出仓库工厂关系 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:export')")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportWarehouseFactoryExcel(@Valid WarehouseFactoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -105,6 +105,7 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
//通过主库位Id查询库位
|
||||
@GetMapping("/warehouse-factory-list-mainId")
|
||||
@Operation(summary = "通过主库位Id查询库位")
|
||||
@PreAuthorize("@ss.hasPermission('base:warehouse-factory:query')")
|
||||
public CommonResult<List<WarehouseFactoryRespVO>> getWarehouseFactoryListByMainId(@RequestParam("mainId") String mainId) {
|
||||
return success(warehouseFactoryService.getWarehouseFactoryByMainId(mainId));
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建ERP库位")
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:create')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:create')")
|
||||
public CommonResult<InternalWarehouseRespVO> createInternalWarehouse(@Valid @RequestBody InternalWarehouseSaveReqVO createReqVO) {
|
||||
return success(internalWarehouseService.createInternalWarehouse(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新ERP库位")
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:update')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:update')")
|
||||
public CommonResult<Boolean> updateInternalWarehouse(@Valid @RequestBody InternalWarehouseSaveReqVO updateReqVO) {
|
||||
internalWarehouseService.updateInternalWarehouse(updateReqVO);
|
||||
return success(true);
|
||||
@@ -63,7 +63,7 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除ERP库位")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:delete')")
|
||||
public CommonResult<Boolean> deleteInternalWarehouse(@RequestParam("id") Long id) {
|
||||
internalWarehouseService.deleteInternalWarehouse(id);
|
||||
return success(true);
|
||||
@@ -72,7 +72,7 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除ERP库位")
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:delete')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:delete')")
|
||||
public CommonResult<Boolean> deleteInternalWarehouseList(@RequestBody BatchDeleteReqVO req) {
|
||||
internalWarehouseService.deleteInternalWarehouseListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -81,7 +81,7 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得ERP库位")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:query')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:query')")
|
||||
public CommonResult<InternalWarehouseRespVO> getInternalWarehouse(@RequestParam("id") Long id) {
|
||||
InternalWarehouseDO internalWarehouse = internalWarehouseService.getInternalWarehouse(id);
|
||||
return success(BeanUtils.toBean(internalWarehouse, InternalWarehouseRespVO.class));
|
||||
@@ -89,7 +89,7 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得ERP库位分页")
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:query')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:query')")
|
||||
public CommonResult<PageResult<InternalWarehouseRespVO>> getInternalWarehousePage(@Valid InternalWarehousePageReqVO pageReqVO) {
|
||||
PageResult<InternalWarehouseDO> pageResult = internalWarehouseService.getInternalWarehousePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, InternalWarehouseRespVO.class));
|
||||
@@ -97,7 +97,7 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出ERP库位 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('bse:internal-warehouse:export')")
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportInternalWarehouseExcel(@Valid InternalWarehousePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
@@ -109,10 +109,11 @@ public class InternalWarehouseController implements BusinessControllerMarker {
|
||||
}
|
||||
|
||||
//启用和停用
|
||||
@PostMapping("/enable-disable")
|
||||
@PutMapping("/enable-list")
|
||||
@Operation(summary = "启用和停用ERP库位")
|
||||
public CommonResult<Boolean> enableDisable(@Valid @RequestBody InternalWarehouseEnableDisableReqVO reqVO) {
|
||||
internalWarehouseService.enableDisable(reqVO);
|
||||
@PreAuthorize("@ss.hasPermission('basic:warehouse-config:update')")
|
||||
public CommonResult<Boolean> enableDisable(@Valid @RequestBody List<InternalWarehouseEnableDisableReqVO> reqVOS) {
|
||||
internalWarehouseService.enableDisable(reqVOS);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.internalwarehouse.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -12,8 +13,8 @@ import java.util.List;
|
||||
@Validated
|
||||
public class InternalWarehouseEnableDisableReqVO {
|
||||
@Schema(description = "主键列表")
|
||||
@NotNull(message = "主键列表不能为空")
|
||||
private List<String> ids;
|
||||
@NotEmpty(message = "主键列表不能为空")
|
||||
private String id;
|
||||
@Schema(description = "状态")
|
||||
private String isEnable;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
|
||||
//自动绑定工厂
|
||||
erpFactoryMapper.insertBatch(result.toInsert);
|
||||
//工厂绑定
|
||||
internalSupplyFactoryApi.batchCreate(BeanUtils.toBean(result.toInsert, InternalSupplyFactoryDTO.class));
|
||||
// internalSupplyFactoryApi.batchCreate(BeanUtils.toBean(result.toInsert, InternalSupplyFactoryDTO.class));
|
||||
// 批量查询刚插入数据的id,提升效率
|
||||
List<String> insertedNumbers = result.toInsert.stream()
|
||||
.map(ErpFactoryDO::getNumber)
|
||||
|
||||
@@ -63,5 +63,5 @@ public interface InternalWarehouseService {
|
||||
*/
|
||||
PageResult<InternalWarehouseDO> getInternalWarehousePage(InternalWarehousePageReqVO pageReqVO);
|
||||
|
||||
void enableDisable(InternalWarehouseEnableDisableReqVO enableDisableReqVO);
|
||||
void enableDisable(List<InternalWarehouseEnableDisableReqVO> reqVOS);
|
||||
}
|
||||
@@ -97,14 +97,14 @@ public class InternalWarehouseServiceImpl implements InternalWarehouseService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void enableDisable(InternalWarehouseEnableDisableReqVO enableDisableReqVO) {
|
||||
enableDisableReqVO.getIds().forEach(id -> {
|
||||
public void enableDisable(List<InternalWarehouseEnableDisableReqVO> reqVOS) {
|
||||
reqVOS.forEach(reqVO -> {
|
||||
// 校验存在
|
||||
validateInternalWarehouseExists(Long.valueOf(id));
|
||||
validateInternalWarehouseExists(Long.valueOf(reqVO.getId()));
|
||||
// 更新
|
||||
InternalWarehouseDO updateObj = new InternalWarehouseDO();
|
||||
updateObj.setId(Long.valueOf(id));
|
||||
updateObj.setIsEnable(enableDisableReqVO.getIsEnable());
|
||||
updateObj.setId(Long.valueOf(reqVO.getId()));
|
||||
updateObj.setIsEnable(reqVO.getIsEnable());
|
||||
internalWarehouseMapper.updateById(updateObj);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user