权限标识相关功能修复

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

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