mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
Merge branch 'main' of http://192.168.1.205:9980/cf_devdept2/cf_imes_server
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ public class ReportTemplateSaveReqVO {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板名称", example = "生产单模板")
|
||||
@NotBlank
|
||||
@NotBlank(message = "模板名称不能为空")
|
||||
@Length(min = 1, max = 30, message = "模板名称长度不能超过30个字符")
|
||||
private String name;
|
||||
|
||||
|
||||
+3
@@ -9,6 +9,7 @@ import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.http.ContentType;
|
||||
import cn.hutool.http.Header;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bstek.common.exception.ReportDesignException;
|
||||
import com.bstek.designer.bean.PreviewParameters;
|
||||
@@ -524,6 +525,8 @@ public class ReportTemplateServiceImpl implements ReportTemplateService {
|
||||
template.setType(ReportTemplateTypeEnum.CUSTOM);
|
||||
}
|
||||
templateMapper.insert(template);
|
||||
} catch (JSONException je) {
|
||||
throw new ReportException("文件解析失败,请检查文件格式和内容");
|
||||
} catch (ServiceException sex) {
|
||||
throw sex;
|
||||
} catch (Exception ex) {
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode POST_NOT_FOUND = new ErrorCode(1_002_005_000, "当前岗位不存在");
|
||||
public static final ErrorCode POST_NOT_ENABLE = new ErrorCode(1_002_005_001, "岗位({}) 不处于开启状态,不允许选择");
|
||||
public static final ErrorCode POST_NAME_DUPLICATE = new ErrorCode(1_002_005_002, "已经存在该名字的岗位");
|
||||
public static final ErrorCode POST_CODE_DUPLICATE = new ErrorCode(1_002_005_003, "已经存在该标识的岗位");
|
||||
public static final ErrorCode POST_CODE_DUPLICATE = new ErrorCode(1_002_005_003, "已经存在该编码的岗位");
|
||||
|
||||
// ========== 字典类型 1-002-006-000 ==========
|
||||
public static final ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "当前字典类型不存在");
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class DeptController {
|
||||
public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
|
||||
List<DeptDO> list = deptService.getDeptList(
|
||||
new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
return success(BeanUtils.toBean(deptService.removeUnowndDept(list), DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.dept;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -33,6 +34,7 @@ public class DeptSaveReqVO {
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
@NumberValid(name = "显示顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "负责人", example = "2048")
|
||||
|
||||
+5
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.post;
|
||||
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
@@ -15,8 +16,8 @@ import java.time.LocalDateTime;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PostRespVO {
|
||||
|
||||
@Schema(description = "岗位序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@ExcelProperty("岗位序号")
|
||||
@Schema(description = "岗位编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@ExcelProperty("岗位编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小土豆")
|
||||
@@ -40,6 +41,8 @@ public class PostRespVO {
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
@ColumnWidth(20)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Long organId;
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.post;
|
||||
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -25,8 +26,9 @@ public class PostSaveReqVO {
|
||||
@Size(max = 64, message = "岗位编码长度不能超过64个字符")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
@Schema(description = "岗位顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "岗位顺序不能为空")
|
||||
@NumberValid(name = "岗位顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dict.vo.data;
|
||||
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.dict.CssClassValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -16,8 +17,9 @@ public class DictDataSaveReqVO {
|
||||
@Schema(description = "字典数据编号", example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
@Schema(description = "显示排序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示排序不能为空")
|
||||
@NumberValid(name = "显示排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "字典标签", requiredMode = Schema.RequiredMode.REQUIRED, example = "晨丰")
|
||||
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.organ;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -52,6 +53,7 @@ public class OrganSaveReqVO {
|
||||
|
||||
@Schema(description = "账号数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "账号数量不能为空")
|
||||
@NumberValid(name = "账号数量")
|
||||
private Integer accountCount;
|
||||
|
||||
// ========== 仅【创建】时,需要传递的字段 ==========
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.menu;
|
||||
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.menu.MenuTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -31,8 +32,9 @@ public class MenuSaveVO {
|
||||
@MenuTypeValid
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
@Schema(description = "显示排序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示排序不能为空")
|
||||
@NumberValid(name = "显示排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.framework.common.validation.NumberValid;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -25,8 +26,9 @@ public class RoleSaveReqVO {
|
||||
@Schema(description = "角色编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ADMIN")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
@Schema(description = "角色顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "角色顺序不能为空")
|
||||
@NumberValid(name = "角色顺序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "备注", example = "我是一个角色")
|
||||
|
||||
+8
@@ -105,4 +105,12 @@ public interface DeptService {
|
||||
* @param deptId
|
||||
*/
|
||||
void validDept(Long deptId);
|
||||
|
||||
/**
|
||||
* 移除没有归属(上级)的部门
|
||||
*
|
||||
* @param deptDOS
|
||||
* @return
|
||||
*/
|
||||
List<DeptDO> removeUnowndDept(List<DeptDO> deptDOS);
|
||||
}
|
||||
|
||||
+57
@@ -30,6 +30,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
@@ -319,4 +320,60 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> removeUnowndDept(List<DeptDO> deptDOS) {
|
||||
if (CollUtil.isEmpty(deptDOS)) {
|
||||
return deptDOS;
|
||||
}
|
||||
|
||||
Map<Long, DeptDO> deptMap = deptDOS.stream()
|
||||
.collect(Collectors.toMap(DeptDO::getId, deptDO -> deptDO));
|
||||
Map<Long, Boolean> topLevelCache = new HashMap<>();
|
||||
|
||||
Set<DeptDO> resultSet = new HashSet<>();
|
||||
|
||||
for (DeptDO deptDO : deptDOS) {
|
||||
if (isParentDeptTopLevel(deptDO, deptMap, topLevelCache)) {
|
||||
resultSet.add(deptDO);
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>(resultSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表内可以找到的父级是否最顶级部门(parentId是0)
|
||||
*
|
||||
* @param deptDO
|
||||
* @param deptMap
|
||||
* @param topLevelCache 缓存已计算过的部门是否为最顶级部门
|
||||
* @return
|
||||
*/
|
||||
private boolean isParentDeptTopLevel(DeptDO deptDO, Map<Long, DeptDO> deptMap, Map<Long, Boolean> topLevelCache) {
|
||||
Long currentId = deptDO.getId();
|
||||
|
||||
while (currentId != 0) {
|
||||
DeptDO currentDept = deptMap.get(currentId);
|
||||
if (currentDept == null) {
|
||||
return false; // 如果找不到上级部门,返回false
|
||||
}
|
||||
|
||||
// 检查缓存
|
||||
if (topLevelCache.containsKey(currentDept.getId())) {
|
||||
return topLevelCache.get(currentDept.getId());
|
||||
}
|
||||
|
||||
if (currentDept.getParentId() == 0) {
|
||||
topLevelCache.put(currentDept.getId(), true);
|
||||
return true; // 找到最顶级部门且parentId为0,返回true
|
||||
}
|
||||
|
||||
// 继续找上级
|
||||
currentId = currentDept.getParentId();
|
||||
}
|
||||
|
||||
topLevelCache.put(deptDO.getId(), false);
|
||||
return false; // 默认返回false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user