权限标识相关功能修复

This commit is contained in:
潘荣晟
2026-01-13 14:08:55 +08:00
parent 1b61bd576b
commit 0627738efb
17 changed files with 121 additions and 54 deletions

View File

@@ -34,7 +34,7 @@ public interface ErrorCodeConstants {
ErrorCode TMPL_INSC_DAT_BSN_NOT_EXISTS = new ErrorCode(1_027_000_530, "业务实例字段不存在");
ErrorCode TMPL_INSC_ITM_BSN_EXISTS = new ErrorCode(1_027_000_540, "业务实例条款已存在");
ErrorCode TMPL_INSC_DAT_BSN_EXISTS = new ErrorCode(1_027_000_541, "业务实例字段已存在");
ErrorCode INTERNAL_SUPPLY_FACTORY_EXISTS=new ErrorCode(1_027_000_579, "自定义工厂编码已存在");
ErrorCode INTERNAL_SUPPLY_FACTORY_NOT_EXISTS=new ErrorCode(1_027_000_580, "自定义工厂不存在");
ErrorCode INTERNAL_SUPPLY_FACTORY_DONT_DELETE=new ErrorCode(1_027_000_581, "自定义工厂不能删除");
//Illegal operation type

View File

@@ -28,7 +28,7 @@ public class InternalSupplyFactoryImpl implements InternalSupplyFactoryApi {
factoryDO.setCompanyNameCustom(reqVO.getErpCompanyName());
factoryDOS.add(factoryDO);
}
internalSupplyFactoryService.bindFactory(factoryDOS);
//internalSupplyFactoryService.bindFactory(factoryDOS);
return null;
}
}

View File

@@ -40,14 +40,14 @@ public class ElementController {
@PostMapping("/create")
@Operation(summary = "创建金属元素")
@PreAuthorize("@ss.hasPermission('base:element:create')")
@PreAuthorize("@ss.hasPermission('basic:metal-config:create')")
public CommonResult<ElementRespVO> createElement(@Valid @RequestBody ElementSaveReqVO createReqVO) {
return success(elementService.createElement(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新金属元素")
@PreAuthorize("@ss.hasPermission('base:element:update')")
@PreAuthorize("@ss.hasPermission('basic:metal-config:update')")
public CommonResult<Boolean> updateElement(@Valid @RequestBody ElementSaveReqVO updateReqVO) {
elementService.updateElement(updateReqVO);
return success(true);
@@ -56,7 +56,7 @@ public class ElementController {
@DeleteMapping("/delete")
@Operation(summary = "删除金属元素")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:element:delete')")
@PreAuthorize("@ss.hasPermission('basic:metal-config:delete')")
public CommonResult<Boolean> deleteElement(@RequestParam("id") Long id) {
elementService.deleteElement(id);
return success(true);
@@ -65,7 +65,7 @@ public class ElementController {
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除金属元素")
@PreAuthorize("@ss.hasPermission('base:element:delete')")
@PreAuthorize("@ss.hasPermission('basic:metal-config:delete')")
public CommonResult<Boolean> deleteElementList(@RequestBody BatchDeleteReqVO req) {
elementService.deleteElementListByIds(req.getIds());
return success(true);
@@ -98,7 +98,7 @@ public class ElementController {
@GetMapping("/export-excel")
@Operation(summary = "导出金属元素 Excel")
@PreAuthorize("@ss.hasPermission('base:element:export')")
@PreAuthorize("@ss.hasPermission('basic:metal-config:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportElementExcel(@Valid ElementPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
@@ -111,7 +111,7 @@ public class ElementController {
@PutMapping("/enable-list")
@Operation(summary = "批量更新")
@PreAuthorize("@ss.hasPermission('base:element:update')")
@PreAuthorize("@ss.hasPermission('basic:metal-config:update')")
public CommonResult<Boolean> enableElementList(@RequestBody List<ElementRespVO> saveReqVOS) {
elementService.enableElementList(saveReqVOS);
return success(true);

View File

@@ -1,5 +1,7 @@
package com.zt.plat.module.base.controller.admin.internalsupplyfactory;
import com.zt.plat.module.base.controller.admin.base.vo.ElementRespVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryEnableReqVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryRespVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactorySaveReqVO;
@@ -41,7 +43,7 @@ import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@RestController
@RequestMapping("/base/internal-supply-factory")
@Validated
@FileUploadController(source = "bse.internalsupplyfactory")
@FileUploadController(source = "base.internalsupplyfactory")
public class InternalSupplyFactoryController extends AbstractFileUploadController implements BusinessControllerMarker{
static {
@@ -56,14 +58,14 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
@PostMapping("/create")
@Operation(summary = "创建供应链内部工厂")
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:create')")
@PreAuthorize("@ss.hasPermission('basic:factory-config:create')")
public CommonResult<InternalSupplyFactoryRespVO> createInternalSupplyFactory(@Valid @RequestBody InternalSupplyFactorySaveReqVO createReqVO) {
return success(internalSupplyFactoryService.createInternalSupplyFactory(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新供应链内部工厂")
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:update')")
@PreAuthorize("@ss.hasPermission('basic:factory-config:edit')")
public CommonResult<Boolean> updateInternalSupplyFactory(@Valid @RequestBody InternalSupplyFactorySaveReqVO updateReqVO) {
internalSupplyFactoryService.updateInternalSupplyFactory(updateReqVO);
return success(true);
@@ -72,7 +74,7 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
@DeleteMapping("/delete")
@Operation(summary = "删除供应链内部工厂")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:delete')")
@PreAuthorize("@ss.hasPermission('basic:factory-config:delete')")
public CommonResult<Boolean> deleteInternalSupplyFactory(@RequestParam("id") Long id) {
internalSupplyFactoryService.deleteInternalSupplyFactory(id);
return success(true);
@@ -81,7 +83,7 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除供应链内部工厂")
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:delete')")
@PreAuthorize("@ss.hasPermission('basic:factory-config:delete')")
public CommonResult<Boolean> deleteInternalSupplyFactoryList(@RequestBody BatchDeleteReqVO req) {
internalSupplyFactoryService.deleteInternalSupplyFactoryListByIds(req.getIds());
return success(true);
@@ -90,7 +92,7 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
@GetMapping("/get")
@Operation(summary = "获得供应链内部工厂")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:query')")
@PreAuthorize("@ss.hasPermission('base:internal-supply-factory:query')")
public CommonResult<InternalSupplyFactoryRespVO> getInternalSupplyFactory(@RequestParam("id") Long id) {
InternalSupplyFactoryDO internalSupplyFactory = internalSupplyFactoryService.getInternalSupplyFactory(id);
return success(BeanUtils.toBean(internalSupplyFactory, InternalSupplyFactoryRespVO.class));
@@ -98,7 +100,7 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
@GetMapping("/page")
@Operation(summary = "获得供应链内部工厂分页")
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:query')")
@PreAuthorize("@ss.hasPermission('base:internal-supply-factory:query')")
public CommonResult<PageResult<InternalSupplyFactoryRespVO>> getInternalSupplyFactoryPage(@Valid InternalSupplyFactoryPageReqVO pageReqVO) {
PageResult<InternalSupplyFactoryDO> pageResult = internalSupplyFactoryService.getInternalSupplyFactoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, InternalSupplyFactoryRespVO.class));
@@ -106,7 +108,7 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
@GetMapping("/export-excel")
@Operation(summary = "导出供应链内部工厂 Excel")
@PreAuthorize("@ss.hasPermission('bse:internal-supply-factory:export')")
@PreAuthorize("@ss.hasPermission('base:internal-supply-factory:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportInternalSupplyFactoryExcel(@Valid InternalSupplyFactoryPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
@@ -117,4 +119,11 @@ public class InternalSupplyFactoryController extends AbstractFileUploadControlle
BeanUtils.toBean(list, InternalSupplyFactoryRespVO.class));
}
@PutMapping("/enable-list")
@Operation(summary = "批量停用启用")
@PreAuthorize("@ss.hasPermission('basic:metal-config:update')")
public CommonResult<Boolean> enableElementList(@RequestBody List<InternalSupplyFactoryEnableReqVO> enableReqVOS) {
internalSupplyFactoryService.enableInternalSupplyFactoryList(enableReqVOS);
return success(true);
}
}

View File

@@ -0,0 +1,18 @@
package com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.springframework.validation.annotation.Validated;
@Data
@Schema(description = "供应链内部工厂-启用禁用 请求VO")
@Validated
public class InternalSupplyFactoryEnableReqVO {
@Schema(description = "内部工厂id")
@NotEmpty(message = "内部工厂id不能为空")
private String id;
@Schema(description = "是否启用")
@NotEmpty(message = "是否启用不能为空")
private String isEnable;
}

View File

@@ -38,4 +38,9 @@ public class InternalSupplyFactoryPageReqVO extends PageParam {
@Schema(description = "操作类型", example = "2")
private String operationType;
@Schema(description = "公司名称-业务")
private String companyNameCustom;
@Schema(description = "公司编号-业务")
private String companyIdCustom;
}

View File

@@ -20,6 +20,8 @@ public interface InternalSupplyFactoryMapper extends BaseMapperX<InternalSupplyF
default PageResult<InternalSupplyFactoryDO> selectPage(InternalSupplyFactoryPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<InternalSupplyFactoryDO>()
.likeIfPresent(InternalSupplyFactoryDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
.likeIfPresent(InternalSupplyFactoryDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
.likeIfPresent(InternalSupplyFactoryDO::getName, reqVO.getName())
.eqIfPresent(InternalSupplyFactoryDO::getNumber, reqVO.getNumber())
.eqIfPresent(InternalSupplyFactoryDO::getType, reqVO.getType())

View File

@@ -59,7 +59,7 @@ public class ElementServiceImpl implements ElementService {
// 校验存在
validateElementExists(updateReqVO.getId());
// 校验存在
validateElementCodeExists(updateReqVO.getAbbreviation());
// validateElementCodeExists(updateReqVO.getAbbreviation());
// 更新
ElementDO updateObj = BeanUtils.toBean(updateReqVO, ElementDO.class);
elementMapper.updateById(updateObj);

View File

@@ -2,6 +2,7 @@ package com.zt.plat.module.base.service.internalsupplyfactory;
import java.util.*;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryEnableReqVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryRespVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactorySaveReqVO;
@@ -72,4 +73,12 @@ public interface InternalSupplyFactoryService {
*
*/
void bindFactory(List<InternalSupplyFactoryDO> bindFactoryList);
/**
* 启用和停用
*
* @param enableReqVOS 请求参数
*
*/
void enableInternalSupplyFactoryList(List<InternalSupplyFactoryEnableReqVO> enableReqVOS);
}

View File

@@ -1,6 +1,9 @@
package com.zt.plat.module.base.service.internalsupplyfactory;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.tenant.core.aop.TenantIgnore;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryEnableReqVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryPageReqVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactoryRespVO;
import com.zt.plat.module.base.controller.admin.internalsupplyfactory.vo.InternalSupplyFactorySaveReqVO;
@@ -19,9 +22,7 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.INTERNAL_SUPPLY_FACTORY_DONT_DELETE;
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.INTERNAL_SUPPLY_FACTORY_NOT_EXISTS;
import static com.zt.plat.module.tmpltp.enums.ErrorCodeConstants.*;
/**
* 供应链内部工厂 Service 实现类
@@ -39,11 +40,20 @@ public class InternalSupplyFactoryServiceImpl implements InternalSupplyFactorySe
public InternalSupplyFactoryRespVO createInternalSupplyFactory(InternalSupplyFactorySaveReqVO createReqVO) {
// 插入
InternalSupplyFactoryDO internalSupplyFactory = BeanUtils.toBean(createReqVO, InternalSupplyFactoryDO.class);
//校验工厂编码
validateInternalSupplyFactoryExistsNumber(createReqVO.getNumber());
internalSupplyFactoryMapper.insert(internalSupplyFactory);
// 返回
return BeanUtils.toBean(internalSupplyFactory, InternalSupplyFactoryRespVO.class);
}
@TenantIgnore
public void validateInternalSupplyFactoryExistsNumber(String number) {
if (internalSupplyFactoryMapper.exists(new LambdaQueryWrapperX<InternalSupplyFactoryDO>().eq(InternalSupplyFactoryDO::getNumber, number))) {
throw exception(INTERNAL_SUPPLY_FACTORY_EXISTS);
}
}
@Override
public void updateInternalSupplyFactory(InternalSupplyFactorySaveReqVO updateReqVO) {
// 校验存在
@@ -82,7 +92,7 @@ public class InternalSupplyFactoryServiceImpl implements InternalSupplyFactorySe
List<InternalSupplyFactoryDO> list = internalSupplyFactoryMapper.selectByIds(ids);
List<InternalSupplyFactoryDO> internalSupplyFactoryDOS =
list.stream().filter(item -> item.getRelativityName() == null && item.getRelativityNumber() == null).toList();
if (CollUtil.isEmpty(internalSupplyFactoryDOS)|| internalSupplyFactoryDOS.size() != ids.size()) {
if (CollUtil.isEmpty(internalSupplyFactoryDOS) || internalSupplyFactoryDOS.size() != ids.size()) {
throw exception(INTERNAL_SUPPLY_FACTORY_DONT_DELETE);
}
}
@@ -128,4 +138,15 @@ public class InternalSupplyFactoryServiceImpl implements InternalSupplyFactorySe
internalSupplyFactoryMapper.insertBatch(internalSupplyFactoryDOS);
}
@Override
public void enableInternalSupplyFactoryList(List<InternalSupplyFactoryEnableReqVO> enableReqVOS) {
enableReqVOS.forEach(item -> {
InternalSupplyFactoryDO internalSupplyFactory = new InternalSupplyFactoryDO();
internalSupplyFactory.setId(Long.valueOf(item.getId()));
internalSupplyFactory.setIsEnable(item.getIsEnable());
internalSupplyFactoryMapper.updateById(internalSupplyFactory);
});
}
}

View File

@@ -41,14 +41,14 @@ public class ContractReceiveSendController implements BusinessControllerMarker {
@PostMapping("/create")
@Operation(summary = "创建收发货规则")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:create')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:create')")
public CommonResult<ContractReceiveSendRespVO> createContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO createReqVO) {
return success(contractReceiveSendService.createContractReceiveSend(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新收发货规则")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:update')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:update')")
public CommonResult<Boolean> updateContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO updateReqVO) {
contractReceiveSendService.updateContractReceiveSend(updateReqVO);
return success(true);
@@ -57,7 +57,7 @@ public class ContractReceiveSendController implements BusinessControllerMarker {
@DeleteMapping("/delete")
@Operation(summary = "删除收发货规则")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:delete')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:delete')")
public CommonResult<Boolean> deleteContractReceiveSend(@RequestParam("id") Long id) {
contractReceiveSendService.deleteContractReceiveSend(id);
return success(true);
@@ -66,7 +66,7 @@ public class ContractReceiveSendController implements BusinessControllerMarker {
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除收发货规则")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:delete')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:delete')")
public CommonResult<Boolean> deleteContractReceiveSendList(@RequestBody BatchDeleteReqVO req) {
contractReceiveSendService.deleteContractReceiveSendListByIds(req.getIds());
return success(true);
@@ -75,7 +75,7 @@ public class ContractReceiveSendController implements BusinessControllerMarker {
@GetMapping("/get")
@Operation(summary = "获得收发货规则")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:query')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:query')")
public CommonResult<ContractReceiveSendRespVO> getContractReceiveSend(@RequestParam("id") Long id) {
ContractReceiveSendDO contractReceiveSend = contractReceiveSendService.getContractReceiveSend(id);
return success(BeanUtils.toBean(contractReceiveSend, ContractReceiveSendRespVO.class));
@@ -83,7 +83,7 @@ public class ContractReceiveSendController implements BusinessControllerMarker {
@GetMapping("/page")
@Operation(summary = "获得收发货规则分页")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:query')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:query')")
public CommonResult<PageResult<ContractReceiveSendRespVO>> getContractReceiveSendPage(@Valid ContractReceiveSendPageReqVO pageReqVO) {
PageResult<ContractReceiveSendDO> pageResult = contractReceiveSendService.getContractReceiveSendPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ContractReceiveSendRespVO.class));
@@ -91,7 +91,7 @@ public class ContractReceiveSendController implements BusinessControllerMarker {
@GetMapping("/export-excel")
@Operation(summary = "导出收发货规则 Excel")
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:export')")
@PreAuthorize("@ss.hasPermission('base:contract-receive-send:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportContractReceiveSendExcel(@Valid ContractReceiveSendPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {

View File

@@ -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));
}

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -63,5 +63,5 @@ public interface InternalWarehouseService {
*/
PageResult<InternalWarehouseDO> getInternalWarehousePage(InternalWarehousePageReqVO pageReqVO);
void enableDisable(InternalWarehouseEnableDisableReqVO enableDisableReqVO);
void enableDisable(List<InternalWarehouseEnableDisableReqVO> reqVOS);
}

View File

@@ -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);
});
}