diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java b/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java index 897db126..e4e1ed55 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/constant/ResultCommon.java @@ -40,6 +40,7 @@ public class ResultCommon { 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}行,工号重复 + public static final String CANNOT_CLOSE = "cannot.close"; // 不是待整改已过期的数据不能关闭 public static final String NO_CORRESPONDING_RECORD_FOUND = "no.corresponding.record.found"; // 没有找到对应的记录 diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/controller/LawsEvaluationNotMetController.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/controller/LawsEvaluationNotMetController.java index 46d7e291..dea4138a 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/controller/LawsEvaluationNotMetController.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/controller/LawsEvaluationNotMetController.java @@ -10,6 +10,7 @@ import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService; import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.extern.slf4j.Slf4j; import com.jero.common.system.base.controller.JeroController; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -19,14 +20,19 @@ import io.swagger.annotations.ApiOperation; import com.jero.common.aspect.annotation.AutoLog; import org.apache.poi.ss.formula.functions.T; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; - /** - * @Description: 评估未符合项条款 + +/** + * @Description: 未符合项 * @Author: jero-boot * @Date: 2023-09-11 * @Version: V1.0 */ -@Api(tags="评估未符合项条款") +@Api(tags="未符合项") @RestController @RequestMapping("/projectLibrary/lawsEvaluationNotMet") @Slf4j @@ -37,8 +43,8 @@ public class LawsEvaluationNotMetController extends JeroController> queryPageList(LawsEvaluationNotMet lawsEvaluationNotMet, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @@ -51,8 +57,8 @@ public class LawsEvaluationNotMetController extends JeroController add(@Validated @RequestBody LawsEvaluationNotMet lawsEvaluationNotMet) { lawsEvaluationNotMetService.add(lawsEvaluationNotMet); @@ -62,8 +68,8 @@ public class LawsEvaluationNotMetController extends JeroController edit(@Validated @RequestBody LawsEvaluationNotMet lawsEvaluationNotMet) { lawsEvaluationNotMetService.editById(lawsEvaluationNotMet); @@ -75,8 +81,8 @@ public class LawsEvaluationNotMetController extends JeroController queryById(@RequestParam(name="id",required=true) String id) { LawsEvaluationNotMet lawsEvaluationNotMet = lawsEvaluationNotMetService.queryById(id); @@ -86,12 +92,46 @@ public class LawsEvaluationNotMetController extends JeroController batchClose(@RequestBody Map map) { + if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){ + throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA); + } + List ids = Arrays.asList(map.get("ids").split(",")); + //检查所选数据是否均是待整改状态、当前时间大于预计整改完成日期 + if (this.check(ids)) { + throw new JeroBootException(ResultCommon.CANNOT_CLOSE); + } + lawsEvaluationNotMetService.batchClose(ids); + return Result.OK(MessageUtils.getMessage(ResultCommon.OK)); + } + + private boolean check(List ids) { + Date date = new Date(); + List notMets = lawsEvaluationNotMetService.listByIds(ids); + for (LawsEvaluationNotMet notMet : notMets) { + String state = notMet.getState(); + Date expectedTime = notMet.getExpectedTime(); + // 判断expectedTime是否小于今日 + boolean isLessThanToday = expectedTime.before(date); + if (!state.equals("1") || !isLessThanToday){ + return false; + } + } + return true; + } + + /** * 导出excel */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, LawsEvaluationNotMet lawsEvaluationNotMet) { - return super.exportXls(request, lawsEvaluationNotMet, LawsEvaluationNotMet.class, "评估未符合项条款"); + return super.exportXls(request, lawsEvaluationNotMet, LawsEvaluationNotMet.class, "未符合项"); } } diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/entity/LawsEvaluationNotMet.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/entity/LawsEvaluationNotMet.java index 6cc97a68..c896dc7f 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/entity/LawsEvaluationNotMet.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/entity/LawsEvaluationNotMet.java @@ -102,8 +102,8 @@ public class LawsEvaluationNotMet implements Serializable { /**整改状态(1-待整改、2-整改中、3-审批中、4-已完成)*/ @Dict(dicCode = "assess_rectification") - @Excel(name = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成)", width = 15) - @ApiModelProperty(value = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成)") + @Excel(name = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成、5-已关闭)", width = 15) + @ApiModelProperty(value = "整改状态(1-待整改、2-整改中、3-审批中、4-已完成、5-已关闭)") private String state; /**创建人*/ diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsEvaluationNotMetService.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsEvaluationNotMetService.java index 16189251..aeeac718 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsEvaluationNotMetService.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/ILawsEvaluationNotMetService.java @@ -73,4 +73,6 @@ public interface ILawsEvaluationNotMetService extends IService ids); } diff --git a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsEvaluationNotMetServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsEvaluationNotMetServiceImpl.java index 065a4e57..8970fcb1 100644 --- a/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsEvaluationNotMetServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/projectLibrary/service/impl/LawsEvaluationNotMetServiceImpl.java @@ -1,6 +1,7 @@ package com.jero.modules.projectLibrary.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet; import com.jero.modules.projectLibrary.mapper.LawsEvaluationNotMetMapper; import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService; @@ -115,4 +116,15 @@ public class LawsEvaluationNotMetServiceImpl extends ServiceImpl ids) { + if (ids == null || ids.isEmpty()){ + return; + } + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.set(LawsEvaluationNotMet::getState, "5"); + wrapper.in(LawsEvaluationNotMet::getId, ids); + update(wrapper); + } } diff --git a/laws-single-startup/src/main/resources/i18n/messages.properties b/laws-single-startup/src/main/resources/i18n/messages.properties index 0ca6bca9..fdc5e68a 100644 --- a/laws-single-startup/src/main/resources/i18n/messages.properties +++ b/laws-single-startup/src/main/resources/i18n/messages.properties @@ -35,6 +35,7 @@ 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 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 no.corresponding.record.found=\u672A\u627E\u5230\u5BF9\u5E94\u8BB0\u5F55 parameters.cannot.be.null=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A diff --git a/laws-single-startup/src/main/resources/i18n/messages_en.properties b/laws-single-startup/src/main/resources/i18n/messages_en.properties index 43f92d94..4bd2bbb1 100644 --- a/laws-single-startup/src/main/resources/i18n/messages_en.properties +++ b/laws-single-startup/src/main/resources/i18n/messages_en.properties @@ -36,10 +36,12 @@ 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 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 + no.corresponding.record.found=No corresponding record found parameters.cannot.be.null=Parameters cannot be null root.node.cannot.be.edited=Root node cannot be edited horizontal.transgression=Horizontal overstepping of authority -select.level.two.tree.node=Please select a level 2 or lower system first \ No newline at end of file +select.level.two.tree.node=Please select a level 2 or lower system first diff --git a/laws-single-startup/src/main/resources/i18n/messages_zh.properties b/laws-single-startup/src/main/resources/i18n/messages_zh.properties index 1b018c18..9650f016 100644 --- a/laws-single-startup/src/main/resources/i18n/messages_zh.properties +++ b/laws-single-startup/src/main/resources/i18n/messages_zh.properties @@ -12,10 +12,10 @@ message.empty.source=\u6765\u6E90\u4E0D\u80FD\u4E3A\u7A7A message.empty.common={0}\u4E0D\u80FD\u4E3A\u7A7A message.empty.standard.number=\u6807\u51C6\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A message.empty.standard.name=\u6807\u51C6\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A -message.exists.standard.number=标准编号已经存在 -message.no.exists.param=参数{0}不存在 -message.no.permission=没有数据操作权限 -message.select.data=请选择数据 +message.exists.standard.number=\u6807\u51C6\u7F16\u53F7\u5DF2\u7ECF\u5B58\u5728 +message.no.exists.param=\u53C2\u6570{0}\u4E0D\u5B58\u5728 +message.no.permission=\u6CA1\u6709\u6570\u636E\u64CD\u4F5C\u6743\u9650 +message.select.data=\u8BF7\u9009\u62E9\u6570\u636E successfully.cleared=\u6E05\u9664\u6210\u529F successfully.deleted.in.bulk=\u6279\u91CF\u5220\u9664\u6210\u529F @@ -35,10 +35,12 @@ please.select.a.workgroup.for.export=\u8BF7\u9009\u62E9\u5DE5\u4F5C\u7EC4\u8FDB\ the.job.number.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 + no.corresponding.record.found=\u672A\u627E\u5230\u5BF9\u5E94\u8BB0\u5F55 parameters.cannot.be.null=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A root.node.cannot.be.edited=\u6839\u8282\u70B9\u65E0\u6CD5\u7F16\u8F91 horizontal.transgression=\u6C34\u5E73\u8D8A\u6743 -select.level.two.tree.node=\u8BF7\u5148\u9009\u62E9\u4E8C\u7EA7\u53CA\u4EE5\u4E0B\u4F53\u7CFB \ No newline at end of file +select.level.two.tree.node=\u8BF7\u5148\u9009\u62E9\u4E8C\u7EA7\u53CA\u4EE5\u4E0B\u4F53\u7CFB