fix:78364
This commit is contained in:
@@ -50,11 +50,13 @@ public class ResultCommon {
|
||||
public static final String NUMBER_WORK_NO_ALREADY_EXISTS = "number.work.no.already.exists"; // 工号已存在
|
||||
public static final String NO_FILES_IMPORTED = "no.files.imported"; // 没有导入文件
|
||||
public static final String PLEASE_SELECT_A_WORKGROUP_TO_IMPORT = "Please.select.a.workgroup.to.import"; // 请选择工作组进行导入
|
||||
public static final String PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX = "please.use.a.file.with.the.suffix.xlsx"; // 文件名格式不正确, 请使用后缀名为.xlsx的文件
|
||||
public static final String PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLS = "please.use.a.file.with.the.suffix.xls"; // 文件名格式不正确, 请使用后缀名为.xls的文件
|
||||
public static final String IMPORT_DATA_CANNOT_BE_EMPTY = "import.data.cannot.be.empty"; // 导入数据不能为空
|
||||
public static final String HEADER_INCONSISTENT_WITH_TEMPLATE = "header.inconsistent.with.template"; // 表头与模板不一致
|
||||
public static final String PLEASE_SELECT_A_WORKGROUP_TO_EXPORT = "please.select.a.workgroup.for.export"; // 请选择工作组进行导出
|
||||
public static final String THE_JOB_NUMBER_CANNOT_BE_EMPTY_EXPORT = "the.job.number.cannot.be.empty.export"; // 第{0}行,工号不能为空
|
||||
public static final String THE_REAL_NAME_CANNOT_BE_EMPTY_EXPORT = "the.real.name.cannot.be.empty.export"; // 第{0}行,姓名不能为空
|
||||
public static final String THE_REAL_NAME_AND_JOB_NUMBER_MISMATCH_EXPORT = "the.real.name.and.job.number.mismatch.export"; // 第{0}行,姓名与工号不匹配
|
||||
public static final String JOB_NUMBER_DOES_NOT_EXIST_EXPORT = "job.number.does.not.exist.export"; // 第{0}行,工号不存在
|
||||
public static final String DUPLICATE_JOB_NUMBER_EXPORT = "duplicate.job.number.export"; // 第{0}行,工号重复
|
||||
public static final String CANNOT_CLOSE = "cannot.close"; // 不是待整改已过期的数据不能关闭
|
||||
|
||||
+93
-21
@@ -1,31 +1,36 @@
|
||||
package com.jero.modules.sys.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.modules.sys.entity.LawsWorkingGroup;
|
||||
import com.jero.modules.sys.service.ILawsWorkingGroupService;
|
||||
import com.jero.modules.sys.service.ILawsWorkingGroupUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: 内部工作组
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-06
|
||||
@@ -38,6 +43,10 @@ import org.apache.poi.ss.formula.functions.T;
|
||||
public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup, ILawsWorkingGroupService> {
|
||||
@Autowired
|
||||
private ILawsWorkingGroupService lawsWorkingGroupService;
|
||||
@Resource
|
||||
private ILawsWorkingGroupUserService lawsWorkingGroupUserService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
@@ -97,29 +106,66 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加工作组
|
||||
*/
|
||||
@AutoLog(value = "内部工作组-添加工作组")
|
||||
@ApiOperation(value="内部工作组-添加工作组", notes="内部工作组-添加工作组")
|
||||
@PostMapping(value = "/addWorkGroup")
|
||||
public Result<T> addWorkGroup(@Validated @RequestBody LawsWorkingGroup lawsWorkingGroup) {
|
||||
// 校验是否有权限
|
||||
lawsWorkingGroupUserService.checkAuth(lawsWorkingGroup.getPid());
|
||||
String pid = lawsWorkingGroup.getPid();
|
||||
if (StringUtils.isNotBlank(pid)){
|
||||
LawsWorkingGroup workingGroup = lawsWorkingGroupService.queryById(pid);
|
||||
if(workingGroup.getLevel() == 1 && StringUtils.isBlank(lawsWorkingGroup.getUserId())){
|
||||
throw new JeroBootException("管理权限不能为空");
|
||||
}
|
||||
lawsWorkingGroup.setLevel(workingGroup.getLevel() + 1);
|
||||
}else {
|
||||
lawsWorkingGroup.setLevel(1);
|
||||
}
|
||||
lawsWorkingGroup.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
|
||||
lawsWorkingGroupService.add(lawsWorkingGroup);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑工作组
|
||||
*/
|
||||
@AutoLog(value = "内部工作组-编辑工作组")
|
||||
@ApiOperation(value="内部工作组-编辑工作组", notes="内部工作组-编辑工作组")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@Validated @RequestBody LawsWorkingGroup lawsWorkingGroup) {
|
||||
// 校验是否有权限
|
||||
lawsWorkingGroupUserService.checkAuth(lawsWorkingGroup.getId());
|
||||
lawsWorkingGroupService.editById(lawsWorkingGroup);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
@RequiresPermissions("sys:innerWorkingGroup:tree:edit")
|
||||
@AutoLog(value = "内部工作组-编辑")
|
||||
@ApiOperation(value="内部工作组-编辑", notes="内部工作组-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@Validated @RequestBody LawsWorkingGroup lawsWorkingGroup) {
|
||||
@PostMapping(value = "/editWorkGroup")
|
||||
public Result<T> editWorkGroup(@Validated @RequestBody LawsWorkingGroup lawsWorkingGroup) {
|
||||
lawsWorkingGroupService.editById(lawsWorkingGroup);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* 通过id删除工作组
|
||||
*/
|
||||
@RequiresPermissions("sys:innerWorkingGroup:tree:delete")
|
||||
@AutoLog(value = "内部工作组-通过id删除")
|
||||
@ApiOperation(value="内部工作组-通过id删除", notes="内部工作组-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
@AutoLog(value = "内部工作组-通过id删除工作组")
|
||||
@ApiOperation(value="内部工作组-通过id删除工作组", notes="内部工作组-通过id删除工作组")
|
||||
@PostMapping(value = "/deleteWorkGroup")
|
||||
public Result<T> deleteWorkGroup(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
lawsWorkingGroupUserService.checkAuth(map.get("id"));
|
||||
//不能删除根节点
|
||||
LawsWorkingGroup group = lawsWorkingGroupService.getById(map.get("id"));
|
||||
if (StringUtils.isBlank(group.getPid())){
|
||||
@@ -137,5 +183,31 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@RequiresPermissions("sys:innerWorkingGroup:tree:delete")
|
||||
@AutoLog(value = "内部工作组-通过id删除")
|
||||
@ApiOperation(value="内部工作组-通过id删除", notes="内部工作组-通过id删除")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
//不能删除根节点
|
||||
LawsWorkingGroup group = lawsWorkingGroupService.getById(map.get("id"));
|
||||
if (StringUtils.isBlank(group.getPid())){
|
||||
throw new JeroBootException(ResultCommon.THE_TOPLEVEL_GROUP_CANNOT_BE_DELETED);
|
||||
}
|
||||
List<String> ids = new ArrayList<>();
|
||||
List<LawsWorkingGroup> list = lawsWorkingGroupService.realList();
|
||||
ids = lawsWorkingGroupService.allChildIdById(list, map.get("id"), ids);
|
||||
if (ids.size() > 0){
|
||||
LambdaUpdateWrapper<LawsWorkingGroup> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(LawsWorkingGroup::getId, ids);
|
||||
wrapper.set(LawsWorkingGroup::getDelFlag, CommonConstant.DEL_FLAG_1.toString());
|
||||
lawsWorkingGroupService.update(wrapper);
|
||||
}
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -176,15 +176,15 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
lawsWorkingGroupUserService.checkAuth(workingGroupId);
|
||||
|
||||
// 上传文件名格式不正确
|
||||
if (fileName.lastIndexOf(".") != -1 && !".xlsx".equals(fileName.substring(fileName.lastIndexOf(".")))) {
|
||||
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX);
|
||||
if (fileName.lastIndexOf(".") != -1 && !".xls".equals(fileName.substring(fileName.lastIndexOf(".")))) {
|
||||
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLS);
|
||||
}
|
||||
boolean b;
|
||||
try {
|
||||
b = ImportExcelUtil.checkTemplateTitle(file, LawsWorkingGroupUserImport.class, 0, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX);
|
||||
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLS);
|
||||
}
|
||||
// 校验excel 字段是否正确
|
||||
if (!b) {
|
||||
@@ -259,7 +259,7 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
return MessageUtils.getMessage(ResultCommon.THE_JOB_NUMBER_CANNOT_BE_EMPTY_EXPORT, (i + 2));
|
||||
}
|
||||
if (StringUtils.isBlank(realname)) {
|
||||
return "第(" + (i + 2) + ")行,姓名不能为空";
|
||||
return MessageUtils.getMessage(ResultCommon.THE_REAL_NAME_CANNOT_BE_EMPTY_EXPORT, (i + 2));
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(listSysUser)){
|
||||
String finalUsername = username;
|
||||
@@ -269,7 +269,7 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
}
|
||||
username = op.get().getId();
|
||||
if(!Objects.equals(op.get().getRealname(),realname)){
|
||||
return "第(" + (i + 2) + ")行,姓名与工号不匹配";
|
||||
return MessageUtils.getMessage(ResultCommon.THE_REAL_NAME_AND_JOB_NUMBER_MISMATCH_EXPORT, (i + 2));
|
||||
}
|
||||
}
|
||||
if (!existingWorkNos.add(username)) {
|
||||
@@ -293,8 +293,7 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
mv.addObject(FILE_NAME, title);
|
||||
mv.addObject(CLASS, LawsWorkingGroupUserImport.class);
|
||||
ExportParams exportParams = new ExportParams(null, title);
|
||||
// 导出xlsx
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
// 导出xls
|
||||
mv.addObject(PARAMS, exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, new ArrayList<T>());
|
||||
return mv;
|
||||
|
||||
+2
-6
@@ -176,15 +176,11 @@ public class LawsWorkingGroupUserServiceImpl extends ServiceImpl<LawsWorkingGrou
|
||||
if(Objects.isNull(lawsWorkingGroup)){
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
LawsWorkingGroup lawsWorkingGroupPid = lawsWorkingGroupService.queryById(lawsWorkingGroup.getPid());
|
||||
if(Objects.isNull(lawsWorkingGroupPid)){
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
if(!Objects.equals(lawsWorkingGroupPid.getLevel(),2)){
|
||||
if(!Objects.equals(lawsWorkingGroup.getLevel(),2) && !Objects.equals(lawsWorkingGroup.getLevel(),3)){
|
||||
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if(!Objects.equals(lawsWorkingGroupPid.getUserId(),loginUser.getId())){
|
||||
if(!Objects.equals(lawsWorkingGroup.getUserId(),loginUser.getId())){
|
||||
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import.data.cannot.be.empty=import data cannot be empty
|
||||
header.inconsistent.with.template=header inconsistent with template
|
||||
please.select.a.workgroup.for.export=please select a workgroup for export
|
||||
the.job.number.cannot.be.empty.export=Line {0},job number cannot be empty
|
||||
the.real.name.cannot.be.empty.export=Line {0},real name cannot be empty
|
||||
job.number.does.not.exist.export=Line {0},job number does not exist
|
||||
duplicate.job.number.export=Line {0},duplicate job number
|
||||
cannot.close=Expired data that is not pending rectification cannot be closed
|
||||
@@ -57,4 +58,5 @@ check.data.error=\u8BF7\u9009\u62E9\u6570\u636E
|
||||
import.template.error=\u5BFC\u5165\u6A21\u677F\u9519\u8BEF
|
||||
zip.charset.error=zip\u538B\u7F29\u5305\u7F16\u7801\u9519\u8BEF
|
||||
folder.only.one=\u538B\u7F29\u5305\u4E0B\u6709\u4E14\u53EA\u80FD\u6709\u4E00\u4E2A\u6587\u4EF6\u5939
|
||||
you.have.not.data.auth=\u60A8\u6CA1\u6709{0}\u7684\u6570\u636E\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
|
||||
you.have.not.data.auth=\u60A8\u6CA1\u6709{0}\u7684\u6570\u636E\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
|
||||
the.real.name.and.job.number.mismatch.export=\u7B2C{0}\u884C,\u59D3\u540D\u4E0E\u5DE5\u53F7\u4E0D\u5339\u914D
|
||||
|
||||
@@ -33,9 +33,11 @@ import.data.cannot.be.empty=import data cannot be empty
|
||||
no.files.imported=no files imported
|
||||
Please.select.a.workgroup.to.import=Please select a workgroup to import
|
||||
please.use.a.file.with.the.suffix.xlsx=please use a file with the suffix xlsx
|
||||
please.use.a.file.with.the.suffix.xls=please use a file with the suffix xls
|
||||
header.inconsistent.with.template=header inconsistent with template
|
||||
please.select.a.workgroup.for.export=please select a workgroup for export
|
||||
the.job.number.cannot.be.empty.export=Line {0},job number cannot be empty
|
||||
the.real.name.cannot.be.empty.export=Line {0},real name cannot be empty
|
||||
job.number.does.not.exist.export=Line {0},job number does not exist
|
||||
duplicate.job.number.export=Line {0},duplicate job number
|
||||
cannot.close=Expired data that is not pending rectification cannot be closed
|
||||
@@ -60,4 +62,6 @@ check.data.error=Please select data
|
||||
import.template.error=Import template error
|
||||
zip.charset.error=Zip charset error
|
||||
folder.only.one=Only one folder can be selected
|
||||
you.have.not.data.auth=You haven't data permission of {0}, please select again!
|
||||
you.have.not.data.auth=You haven't data permission of {0}, please select again!
|
||||
|
||||
the.real.name.and.job.number.mismatch.export=Line {0},real name and job number mismatch
|
||||
|
||||
@@ -32,9 +32,11 @@ no.files.imported=\u6CA1\u6709\u5BFC\u5165\u6587\u4EF6
|
||||
import.data.cannot.be.empty=\u5BFC\u5165\u6570\u636E\u4E0D\u80FD\u4E3A\u7A7A
|
||||
Please.select.a.workgroup.to.import=\u8BF7\u9009\u62E9\u5DE5\u4F5C\u7EC4\u8FDB\u884C\u5BFC\u5165
|
||||
please.use.a.file.with.the.suffix.xlsx=\u8BF7\u4F7F\u7528\u540E\u7F00\u540D\u4E3A.xlsx\u7684\u6587\u4EF6
|
||||
please.use.a.file.with.the.suffix.xls=\u8BF7\u4F7F\u7528\u540E\u7F00\u540D\u4E3A.xls\u7684\u6587\u4EF6
|
||||
header.inconsistent.with.template=\u8868\u5934\u4E0E\u6A21\u677F\u4E0D\u4E00\u81F4
|
||||
please.select.a.workgroup.for.export=\u8BF7\u9009\u62E9\u5DE5\u4F5C\u7EC4\u8FDB\u884C\u5BFC\u51FA
|
||||
the.job.number.cannot.be.empty.export=\u7B2C{0}\u884C,\u5DE5\u53F7\u4E0D\u80FD\u4E3A\u7A7A
|
||||
the.realname.cannot.be.empty.export=\u7B2C{0}\u884C,\u5DE5\u53F7\u4E0D\u80FD\u4E3A\u7A7A
|
||||
job.number.does.not.exist.export=\u7B2C{0}\u884C,\u5DE5\u53F7\u4E0D\u5B58\u5728
|
||||
duplicate.job.number.export=\u7B2C{0}\u884C,\u5DE5\u53F7\u91CD\u590D
|
||||
cannot.close=\u4E0D\u662F\u5F85\u6574\u6539\u5DF2\u8FC7\u671F\u7684\u6570\u636E\u4E0D\u80FD\u5173\u95ED
|
||||
@@ -59,4 +61,6 @@ check.data.error=\u8BF7\u9009\u62E9\u6570\u636E
|
||||
import.template.error=\u5BFC\u5165\u6A21\u677F\u9519\u8BEF
|
||||
zip.charset.error=zip\u538B\u7F29\u5305\u7F16\u7801\u9519\u8BEF
|
||||
folder.only.one=\u538B\u7F29\u5305\u4E0B\u6709\u4E14\u53EA\u80FD\u6709\u4E00\u4E2A\u6587\u4EF6\u5939
|
||||
you.have.not.data.auth=\u60A8\u6CA1\u6709{0}\u7684\u6570\u636E\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
|
||||
you.have.not.data.auth=\u60A8\u6CA1\u6709{0}\u7684\u6570\u636E\u6743\u9650\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9
|
||||
|
||||
the.real.name.and.job.number.mismatch.export=\u7B2C{0}\u884C,\u59D3\u540D\u4E0E\u5DE5\u53F7\u4E0D\u5339\u914D
|
||||
|
||||
Reference in New Issue
Block a user