From d6bb1fd3fe13c48b3806861507eb3a4510ce2849 Mon Sep 17 00:00:00 2001 From: wangpeng Date: Wed, 21 Feb 2024 08:41:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E7=A7=8D=E4=BD=9C=E4=B8=9A=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E8=AF=81=E4=BB=B6=E4=B8=B4=E6=9C=9F=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PersonnelManagementController.java | 45 +++++++++++++++++++ .../PersonnelManagementMapper.xml | 3 ++ 2 files changed, 48 insertions(+) diff --git a/src/main/java/com/zcloud/controller/specialoperation/PersonnelManagementController.java b/src/main/java/com/zcloud/controller/specialoperation/PersonnelManagementController.java index 3c835df..e719484 100644 --- a/src/main/java/com/zcloud/controller/specialoperation/PersonnelManagementController.java +++ b/src/main/java/com/zcloud/controller/specialoperation/PersonnelManagementController.java @@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; import java.util.*; /** @@ -332,4 +334,47 @@ public class PersonnelManagementController extends BaseController { return mv; } + /**临期预警 + * @throws Exception + */ + @RequestMapping(value="/warnAmount") + // @RequiresPermissions("personnelmanagement:list") + @ResponseBody + @LogAnno(menuType= "综合管理",menuServer= "特种作业",instructionsOperate = "特种作业人员管理",instructionsType = "临期预警") + public Object warnAmount() throws Exception{ + Map map = new HashMap(); + String errInfo = "success"; + StringBuffer stringBuffer = new StringBuffer(); + PageData pd = new PageData(); + pd = this.getPageData(); + String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 + if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID + List varList = personnelmanagementService.listAll(pd); //列出PersonnelManagement列表 + int cnt = 1; + boolean firstflag = true; + for (int i = 0; i < varList.size(); i++) { + String validDateEnd = varList.get(i).getString("VALID_ETIME"); + LocalDate date1 = LocalDate.now(); // 第一个时间点 + LocalDate date2 = LocalDate.parse(validDateEnd); // 当前时间点 + long daysBetween = ChronoUnit.DAYS.between(date1, date2); // 计算两个时间之间相隔的天数 + // 临期界限45天 + if (daysBetween <= 45 && daysBetween > 0) { + if (firstflag) { + stringBuffer.append("

以下持证人员证件临近有效期,请及时处置!
"); + stringBuffer.append("****************************************

"); + firstflag = false; + } + stringBuffer.append("

").append(cnt).append(". ") + .append(varList.get(i).get("NAME")) + .append(",距到期还有" + daysBetween + "天") + .append("

"); + cnt++; + } + } + map.put("result", errInfo); + map.put("message", stringBuffer.toString()); + return map; + } + } diff --git a/src/main/resources/mybatis/datasource/specialoperation/PersonnelManagementMapper.xml b/src/main/resources/mybatis/datasource/specialoperation/PersonnelManagementMapper.xml index 32a6bb6..41ada3d 100644 --- a/src/main/resources/mybatis/datasource/specialoperation/PersonnelManagementMapper.xml +++ b/src/main/resources/mybatis/datasource/specialoperation/PersonnelManagementMapper.xml @@ -220,6 +220,9 @@ from f where f.ISDELETE ='0' + + and f.CORPINFO_ID = #{CORPINFO_ID} + and f.UNITS_ID = #{UNITS_ID}