mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
1、新增部门校验问题修复;2、自定义板编号跨单导入问题修复;
This commit is contained in:
+8
-8
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.framework.organ.core.security;
|
package com.cf.imes.framework.organ.core.security;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
@@ -93,14 +94,14 @@ public class OrganSecurityWebFilter extends ApiRequestFilter {
|
|||||||
try {
|
try {
|
||||||
// 校验组织
|
// 校验组织
|
||||||
organFrameworkService.validOrgan(organId);
|
organFrameworkService.validOrgan(organId);
|
||||||
// 校验部门
|
if (ObjectUtil.isNotNull(deptId)) {
|
||||||
organFrameworkService.validDept(deptId);
|
// 校验部门
|
||||||
|
organFrameworkService.validDept(deptId);
|
||||||
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
CommonResult<?> result = globalExceptionHandler.allExceptionHandler(request, ex);
|
CommonResult<?> result = globalExceptionHandler.allExceptionHandler(request, ex);
|
||||||
// 组织失效返回401踢出系统
|
// 组织失效返回401踢出系统
|
||||||
if (needUnauthorizedWhenOrgExpired(ex)) {
|
needUnauthorizedWhenOrgExpired(ex, result);
|
||||||
result.setCode(GlobalErrorCodeConstants.UNAUTHORIZED.getCode());
|
|
||||||
}
|
|
||||||
ServletUtils.writeJSON(response, result);
|
ServletUtils.writeJSON(response, result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,15 +135,14 @@ public class OrganSecurityWebFilter extends ApiRequestFilter {
|
|||||||
* @param ex
|
* @param ex
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean needUnauthorizedWhenOrgExpired(Throwable ex) {
|
private void needUnauthorizedWhenOrgExpired(Throwable ex, CommonResult<?> result) {
|
||||||
if (ex instanceof ServiceException) {
|
if (ex instanceof ServiceException) {
|
||||||
ServiceException serviceException = (ServiceException) ex;
|
ServiceException serviceException = (ServiceException) ex;
|
||||||
if (Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_EXPIRE.getCode())
|
if (Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_EXPIRE.getCode())
|
||||||
|| Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_DISABLE.getCode())
|
|| Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_DISABLE.getCode())
|
||||||
|| Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_NOT_EXISTS.getCode())) {
|
|| Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_NOT_EXISTS.getCode())) {
|
||||||
return true;
|
result.setCode(GlobalErrorCodeConstants.UNAUTHORIZED.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,6 +51,6 @@ public class OrganFrameworkServiceImpl implements OrganFrameworkService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validDept(Long id) {
|
public void validDept(Long id) {
|
||||||
deptApi.validateDept(id);
|
deptApi.validateDept(id).checkError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-2
@@ -3,10 +3,13 @@ package com.cf.imes.module.executor.service.customplateno;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||||
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
import com.cf.imes.module.executor.enums.ErrorCodeConstants;
|
||||||
import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
||||||
import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoRuleVO;
|
import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoRuleVO;
|
||||||
@@ -49,6 +52,9 @@ public class CustomPlateNoGenerateServiceImpl implements CustomPlateNoGenerateSe
|
|||||||
@Resource
|
@Resource
|
||||||
private List<CustomPlateNoGenerateRuleService> ruleServices;
|
private List<CustomPlateNoGenerateRuleService> ruleServices;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderMapper orderMapper;
|
||||||
|
|
||||||
private static final DateTimeFormatter YEAR_FORMATTER = DateTimeFormatter.ofPattern("yyyy");
|
private static final DateTimeFormatter YEAR_FORMATTER = DateTimeFormatter.ofPattern("yyyy");
|
||||||
private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyyMM");
|
private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyyMM");
|
||||||
private static final DateTimeFormatter DAY_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
private static final DateTimeFormatter DAY_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
@@ -77,8 +83,14 @@ public class CustomPlateNoGenerateServiceImpl implements CustomPlateNoGenerateSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3、保存生产单序号json、设置生产单所用配置id
|
// 3、保存生产单序号json、设置生产单所用配置id
|
||||||
orderDO.setCustomPlatenoSeq(JSON.toJSONString(generateConfig.getOrderCustomPlateNoSeqVO()));
|
OrderCustomPlateNoSeqVO orderCustomPlateNoSeqVO = generateConfig.getOrderCustomPlateNoSeqVO();
|
||||||
orderDO.setCustomPlatenoConfigId(orgCustomPlateNoConfigId);
|
if (ObjectUtil.isNotNull(orderDO)) {
|
||||||
|
// 已有生产单更新序号
|
||||||
|
orderMapper.update(new LambdaUpdateWrapper<OrderDO>().eq(OrderDO::getId, orderId).set(OrderDO::getCustomPlatenoSeq, JsonUtils.zipString(JSON.toJSONString(orderCustomPlateNoSeqVO))));
|
||||||
|
} else {
|
||||||
|
orderDO.setCustomPlatenoSeq(JSON.toJSONString(orderCustomPlateNoSeqVO));
|
||||||
|
orderDO.setCustomPlatenoConfigId(orgCustomPlateNoConfigId);
|
||||||
|
}
|
||||||
// 机构下序号配置同步
|
// 机构下序号配置同步
|
||||||
CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO = generateConfig.getOrgCustomPlateNoSeqRespDTO();
|
CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO = generateConfig.getOrgCustomPlateNoSeqRespDTO();
|
||||||
orgCustomPlateNoSeqRespDTO.setLastOrderNo(orderId);
|
orgCustomPlateNoSeqRespDTO.setLastOrderNo(orderId);
|
||||||
|
|||||||
+2
-2
@@ -38,10 +38,10 @@ public interface DeptApi {
|
|||||||
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
|
@Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true)
|
||||||
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids);
|
CommonResult<Boolean> validateDeptList(@RequestParam("ids") Collection<Long> ids);
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/valid/{deptId}")
|
@GetMapping(PREFIX + "/legitimacy/{deptId}")
|
||||||
@Operation(summary = "校验部门是否合法")
|
@Operation(summary = "校验部门是否合法")
|
||||||
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
|
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
|
||||||
CommonResult<Boolean> validateDept(@PathVariable("id") Long deptId);
|
CommonResult<Boolean> validateDept(@PathVariable("deptId") Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定编号的部门 Map
|
* 获得指定编号的部门 Map
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
|||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,5 +27,5 @@ public interface SystemConfigApi {
|
|||||||
|
|
||||||
@GetMapping(PREFIX + "/organ/custom-plateno-config/{id}")
|
@GetMapping(PREFIX + "/organ/custom-plateno-config/{id}")
|
||||||
@Operation(summary = "获取组织下自定义版编号配置")
|
@Operation(summary = "获取组织下自定义版编号配置")
|
||||||
CommonResult<SystemConfigRespDTO> getById(Long id);
|
CommonResult<SystemConfigRespDTO> getById(@PathVariable("id") Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -247,7 +247,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand
|
|||||||
// 查询机构下的现有自定义板编号配置最大版本号
|
// 查询机构下的现有自定义板编号配置最大版本号
|
||||||
Integer maxCustomPlateNoSystemConfigVersion = systemConfigMapper.selectOrgMaxCustomPlateNoSystemConfigVersion(OrganContextHolder.getOrganId());
|
Integer maxCustomPlateNoSystemConfigVersion = systemConfigMapper.selectOrgMaxCustomPlateNoSystemConfigVersion(OrganContextHolder.getOrganId());
|
||||||
// 版本号 + 1
|
// 版本号 + 1
|
||||||
reqVO.setVersion(maxCustomPlateNoSystemConfigVersion + 1);
|
reqVO.setVersion((ObjectUtil.isNotNull(maxCustomPlateNoSystemConfigVersion) ? maxCustomPlateNoSystemConfigVersion : 0) + 1);
|
||||||
// 自定义板编号每次保存都创建新版本
|
// 自定义板编号每次保存都创建新版本
|
||||||
reqVO.setId(null);
|
reqVO.setId(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -534,8 +534,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
AdminUserDO adminUserDO = validateUserExists(id);
|
AdminUserDO adminUserDO = validateUserExists(id);
|
||||||
// 校验用户名唯一
|
// 校验用户名唯一
|
||||||
validateUsernameUnique(id, username, organId);
|
validateUsernameUnique(id, username, organId);
|
||||||
// 校验部门处于开启状态
|
// 组织管理员不归属部门
|
||||||
deptService.validDept(deptId);
|
if (ObjectUtil.isNotNull(deptId)) {
|
||||||
|
// 校验部门处于开启状态
|
||||||
|
deptService.validDept(deptId);
|
||||||
|
}
|
||||||
// 校验岗位处于开启状态
|
// 校验岗位处于开启状态
|
||||||
postService.validatePostList(postIds);
|
postService.validatePostList(postIds);
|
||||||
return adminUserDO;
|
return adminUserDO;
|
||||||
|
|||||||
Reference in New Issue
Block a user