sys包下中英文返回值
This commit is contained in:
@@ -19,4 +19,27 @@ public class ResultCommon {
|
||||
|
||||
public static final String RMR_SET_QUALITY_OVER_TEN = "es.rmr.setQuality.overTen"; // 请最多选择10条
|
||||
|
||||
public static final String SUCCESSFULLY_CLEARED = "successfully.cleared"; // 清除成功
|
||||
public static final String SUCCESSFULLY_DELETED_IN_BULK = "successfully.deleted.in.bulk"; // 批量删除成功
|
||||
public static final String CANNOT_DUPLICATE_FAVORITES = "cannot.duplicate.favorites"; // 不能重复收藏
|
||||
public static final String PLEASE_SELECT_DATA = "please.select.data"; // 请选择数据
|
||||
public static final String NO_CORRESPONDING_DATA_FOUND = "no.corresponding.data.found"; // 未找到对应数据
|
||||
public static final String THE_TOPLEVEL_GROUP_CANNOT_BE_DELETED = "The.toplevel.group.cannot.be.deleted"; // 最高级组别不能删除
|
||||
public static final String PLEASE_SELECT_PERSONNEL_AND_WORKGROUP = "please.select.personnel.and.workgroup"; // 请选择人员和工作组
|
||||
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 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 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}行,工号重复
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -63,7 +63,7 @@ public class LawsBrowsingHistoryController extends JeroController<LawsBrowsingHi
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsBrowsingHistory lawsBrowsingHistory) {
|
||||
lawsBrowsingHistoryService.add(lawsBrowsingHistory);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public class LawsBrowsingHistoryController extends JeroController<LawsBrowsingHi
|
||||
LambdaQueryWrapper<LawsBrowsingHistory> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsBrowsingHistory::getBrowsingUserId, sysUser.getId());
|
||||
lawsBrowsingHistoryService.remove(wrapper);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? "Successfully cleared!" : "清除成功!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_CLEARED));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,6 +91,6 @@ public class LawsBrowsingHistoryController extends JeroController<LawsBrowsingHi
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
this.lawsBrowsingHistoryService.removeByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? "Successfully deleted in bulk!" : "批量删除成功!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -65,11 +65,11 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
int count = lawsStandardCollectionService.count();
|
||||
if (count > 0){
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? "Cannot duplicate favorites" : "不能重复收藏!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.CANNOT_DUPLICATE_FAVORITES));
|
||||
}
|
||||
lawsStandardCollection.setSource("1");
|
||||
lawsStandardCollectionService.add(lawsStandardCollection);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +83,7 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
lawsStandardCollectionService.deleteById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,11 +99,11 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
int count = lawsStandardCollectionService.count();
|
||||
if (count > 0){
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? "Cannot duplicate favorites" : "不能重复收藏!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.CANNOT_DUPLICATE_FAVORITES));
|
||||
}
|
||||
lawsStandardCollection.setSource("2");
|
||||
lawsStandardCollectionService.add(lawsStandardCollection);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,10 +114,10 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
@PostMapping(value = "/overseas/delete")
|
||||
public Result<T> overseasDelete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? "Cannot duplicate favorites" : "不能重复收藏!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.CANNOT_DUPLICATE_FAVORITES));
|
||||
}
|
||||
lawsStandardCollectionService.deleteById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,11 +133,11 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
int count = lawsStandardCollectionService.count();
|
||||
if (count > 0){
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? "Cannot duplicate favorites" : "不能重复收藏!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.CANNOT_DUPLICATE_FAVORITES));
|
||||
}
|
||||
lawsStandardCollection.setSource("3");
|
||||
lawsStandardCollectionService.add(lawsStandardCollection);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +151,7 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
lawsStandardCollectionService.deleteById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
lawsStandardCollectionService.removeById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -120,7 +120,7 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
||||
sharings.add(sharing);
|
||||
}
|
||||
lawsStandardSharingService.saveBatch(sharings);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
||||
sharings.add(sharing);
|
||||
}
|
||||
lawsStandardSharingService.saveBatch(sharings);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,7 +190,7 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
||||
sharings.add(sharing);
|
||||
}
|
||||
lawsStandardSharingService.saveBatch(sharings);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,7 +204,7 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
this.lawsStandardSharingService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -75,7 +75,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
|
||||
public Result<T> add(@Validated @RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibrary.setDelFlag("0");
|
||||
lawsProjectLibraryService.add(lawsProjectLibrary);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@RequestBody LawsProjectLibrary lawsProjectLibrary) {
|
||||
lawsProjectLibraryService.editById(lawsProjectLibrary);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
}
|
||||
lawsProjectLibraryService.deleteById(map.get("id"));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,10 +111,10 @@ public class LawsProjectLibraryController extends JeroController<LawsProjectLibr
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
this.lawsProjectLibraryService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "批量删除成功!");
|
||||
return Result.error(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-6
@@ -7,6 +7,9 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.sys.entity.LawsFriendlyLinks;
|
||||
import com.jero.modules.sys.service.ILawsFriendlyLinksService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -55,7 +58,7 @@ public class LawsFriendlyLinksController extends JeroController<LawsFriendlyLink
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsFriendlyLinks lawsFriendlyLinks) {
|
||||
lawsFriendlyLinksService.add(lawsFriendlyLinks);
|
||||
return Result.OK("操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +72,7 @@ public class LawsFriendlyLinksController extends JeroController<LawsFriendlyLink
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@Validated @RequestBody LawsFriendlyLinks lawsFriendlyLinks) {
|
||||
lawsFriendlyLinksService.editById(lawsFriendlyLinks);
|
||||
return Result.OK("操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,10 +86,10 @@ public class LawsFriendlyLinksController extends JeroController<LawsFriendlyLink
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
return Result.error("请选择数据!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
lawsFriendlyLinksService.deleteById(map.get("id"));
|
||||
return Result.OK("删除成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,10 +103,10 @@ public class LawsFriendlyLinksController extends JeroController<LawsFriendlyLink
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
|
||||
return Result.error("请选择数据!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
this.lawsFriendlyLinksService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.SUCCESSFULLY_DELETED_IN_BULK));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.jero.modules.sys.controller;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.sys.entity.LawsGrade;
|
||||
import com.jero.modules.sys.service.ILawsGradeService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -51,9 +54,9 @@ public class LawsGradeController extends JeroController<LawsGrade, ILawsGradeSer
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@Validated @RequestBody LawsGrade lawsGrade) {
|
||||
if (StringUtils.isBlank(lawsGrade.getId())){
|
||||
return Result.error("请选择数据!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
lawsGradeService.edit(lawsGrade);
|
||||
return Result.OK("操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.sys.entity.LawsWorkingGroup;
|
||||
@@ -63,7 +64,7 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
public Result<LawsWorkingGroup> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
LawsWorkingGroup lawsWorkingGroup = lawsWorkingGroupService.queryById(id);
|
||||
if(lawsWorkingGroup==null) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "No corresponding data found" : "未找到对应数据");
|
||||
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
// 通过递归查找所有子节点数据
|
||||
List<LawsWorkingGroup> list = lawsWorkingGroupService.realList();
|
||||
@@ -88,7 +89,7 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
}
|
||||
lawsWorkingGroup.setDelFlag("0");
|
||||
lawsWorkingGroupService.add(lawsWorkingGroup);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +100,7 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<T> edit(@Validated @RequestBody LawsWorkingGroup lawsWorkingGroup) {
|
||||
lawsWorkingGroupService.editById(lawsWorkingGroup);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,12 +111,12 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
//不能删除根节点
|
||||
LawsWorkingGroup group = lawsWorkingGroupService.getById(map.get("id"));
|
||||
if (StringUtils.isBlank(group.getPid())){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "The top-level group cannot be deleted!" : "最高级组别不能删除!");
|
||||
throw new JeroBootException(ResultCommon.THE_TOPLEVEL_GROUP_CANNOT_BE_DELETED);
|
||||
}
|
||||
List<String> ids = new ArrayList<>();
|
||||
List<LawsWorkingGroup> list = lawsWorkingGroupService.realList();
|
||||
@@ -126,7 +127,7 @@ public class LawsWorkingGroupController extends JeroController<LawsWorkingGroup,
|
||||
wrapper.set(LawsWorkingGroup::getDelFlag, "1");
|
||||
lawsWorkingGroupService.update(wrapper);
|
||||
}
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+18
-17
@@ -15,6 +15,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.sys.entity.LawsWorkingGroupUser;
|
||||
@@ -92,7 +93,7 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
@PostMapping(value = "/add")
|
||||
public Result<T> add(@Validated @RequestBody LawsWorkingGroupUser lawsWorkingGroupUser) {
|
||||
if (StringUtils.isBlank(lawsWorkingGroupUser.getWorkingGroupId()) || StringUtils.isBlank(lawsWorkingGroupUser.getUserId())){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select personnel and workgroup" : "请选择人员和工作组!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_PERSONNEL_AND_WORKGROUP);
|
||||
}
|
||||
String userId = lawsWorkingGroupUser.getUserId();
|
||||
List<String> asList = Arrays.asList(userId.split(","));
|
||||
@@ -112,11 +113,11 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
}
|
||||
}
|
||||
workNo = joiner.toString();
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Job number" + workNo + "already exists!" : "工号" + workNo + "已存在!");
|
||||
throw new JeroBootException(ResultCommon.NUMBER_WORK_NO_ALREADY_EXISTS, workNo);
|
||||
}
|
||||
lawsWorkingGroupUser.setDelFlag("0");
|
||||
lawsWorkingGroupUserService.add(lawsWorkingGroupUser);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,12 +128,12 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<T> delete(@RequestBody Map<String, String> map) {
|
||||
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select data!" : "请选择数据!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||
}
|
||||
LawsWorkingGroupUser groupUser = lawsWorkingGroupUserService.getById(map.get("id"));
|
||||
groupUser.setDelFlag("1");
|
||||
lawsWorkingGroupUserService.updateById(groupUser);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
|
||||
@@ -146,14 +147,14 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
String fileName = file.getOriginalFilename();
|
||||
// 上传文件为空
|
||||
if (StringUtils.isEmpty(fileName)) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "No files imported" : "没有导入文件");
|
||||
throw new JeroBootException(ResultCommon.NO_FILES_IMPORTED);
|
||||
}
|
||||
if (StringUtils.isBlank(workingGroupId)) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select a workgroup to import!" : "请选择工作组进行导入!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_A_WORKGROUP_TO_IMPORT);
|
||||
}
|
||||
// 上传文件名格式不正确
|
||||
if (fileName.lastIndexOf(".") != -1 && !".xlsx".equals(fileName.substring(fileName.lastIndexOf(".")))) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "The file name format is incorrect. Please use a file with the suffix .xlsx" : "文件名格式不正确, 请使用后缀名为.xlsx的文件");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX);
|
||||
}
|
||||
InputStream inputStream = file.getInputStream();
|
||||
List<LawsWorkingGroupUser> all;
|
||||
@@ -161,15 +162,15 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream, "sheet1");
|
||||
List<Map<String, Object>> maps = excelReader.readAll();
|
||||
if (maps.size() < 1) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Import data cannot be empty!" : "导入数据不能为空!");
|
||||
throw new JeroBootException(ResultCommon.IMPORT_DATA_CANNOT_BE_EMPTY);
|
||||
}
|
||||
// 校验表头,同时映射对象字段
|
||||
if (!validateHeader(excelReader)) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Import failed, header inconsistent with template" : "导入失败,表头与模板不一致");
|
||||
throw new JeroBootException(ResultCommon.HEADER_INCONSISTENT_WITH_TEMPLATE);
|
||||
}
|
||||
all = excelReader.readAll(LawsWorkingGroupUser.class);
|
||||
} catch (Exception e) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Import failed, data format not imported according to sample specifications!" : "导入失败,数据格式未按照示例规范导入!");
|
||||
throw new JeroBootException(ResultCommon.ERROR);
|
||||
}
|
||||
//校验导入正确性,msg是错误信息
|
||||
String msg = importExcelCheck(all);
|
||||
@@ -184,7 +185,7 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
groupUser.setDelFlag("0");
|
||||
}
|
||||
lawsWorkingGroupUserService.saveBatch(all);
|
||||
return Result.OK(MessageUtils.getLanguage().equals("EN") ? ResultCommon.OK : "操作成功!");
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,10 +197,10 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
public Result<?> template(@RequestBody LawsWorkingGroupUser lawsWorkingGroupUser, HttpServletResponse response) {
|
||||
String workingGroupId = lawsWorkingGroupUser.getWorkingGroupId();
|
||||
if (StringUtils.isBlank(workingGroupId)) {
|
||||
return Result.error(MessageUtils.getLanguage().equals("EN") ? "Please select a workgroup for export" : "请选择工作组进行导出!");
|
||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_A_WORKGROUP_TO_EXPORT);
|
||||
}
|
||||
|
||||
String outFileName = MessageUtils.getLanguage().equals("EN") ? "Internal Work Group Personnel Table" + System.currentTimeMillis() + ".xlsx" : "内部工作组人员表" + System.currentTimeMillis() + ".xlsx";
|
||||
String outFileName = "内部工作组人员表" + System.currentTimeMillis() + ".xlsx";
|
||||
String ENCODING = "UTF-8";
|
||||
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
|
||||
@@ -295,13 +296,13 @@ public class LawsWorkingGroupUserController extends JeroController<LawsWorkingGr
|
||||
LawsWorkingGroupUser lawsWorkingGroupUser = all.get(i);
|
||||
String userWorkNo = lawsWorkingGroupUser.getUserWorkNo();
|
||||
if (userWorkNo == null || userWorkNo.trim().isEmpty()) {
|
||||
return MessageUtils.getLanguage().equals("EN") ? "The" + index + "line,job number cannot be empty" : "第" + index + "行,工号不能为空";
|
||||
return MessageUtils.getMessage(ResultCommon.THE_JOB_NUMBER_CANNOT_BE_EMPTY_EXPORT);
|
||||
}
|
||||
if (!isValidWorkNo(userWorkNo)) {
|
||||
return MessageUtils.getLanguage().equals("EN") ? "The" + index + "line,the job number does not exist" : "第" + index + "行," + userWorkNo + "工号不存在";
|
||||
return MessageUtils.getMessage(ResultCommon.JOB_NUMBER_DOES_NOT_EXIST_EXPORT);
|
||||
}
|
||||
if (!existingWorkNos.add(userWorkNo)) {
|
||||
return MessageUtils.getLanguage().equals("EN") ? "Line" + index + ",duplicate job number" : "第" + index + "行,工号重复";
|
||||
return MessageUtils.getMessage(ResultCommon.DUPLICATE_JOB_NUMBER_EXPORT);
|
||||
}
|
||||
return null;
|
||||
}).filter(error -> error != null).collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user