diff --git a/src/main/java/com/zcloud/controller/specialoperation/SpecialOperationsController.java b/src/main/java/com/zcloud/controller/specialoperation/SpecialOperationsController.java index b44c5e8..e86fee0 100644 --- a/src/main/java/com/zcloud/controller/specialoperation/SpecialOperationsController.java +++ b/src/main/java/com/zcloud/controller/specialoperation/SpecialOperationsController.java @@ -13,6 +13,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.*; /** @@ -331,4 +333,47 @@ public class SpecialOperationsController extends BaseController { return mv; } + /**临期预警 + * @throws Exception + */ + @RequestMapping(value="/warnAmount") + // @RequiresPermissions("specialoperations: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 = specialoperationsService.listAll(pd); //列出SpecialOperations列表 + 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/java/com/zcloud/controller/statistics/StatisticsController.java b/src/main/java/com/zcloud/controller/statistics/StatisticsController.java index 2d330b7..ad7a0ac 100644 --- a/src/main/java/com/zcloud/controller/statistics/StatisticsController.java +++ b/src/main/java/com/zcloud/controller/statistics/StatisticsController.java @@ -61,7 +61,7 @@ public class StatisticsController extends BaseController { }else { sql+="ifnull(ch"+i+".c,0) as c"+i+","; } - sql1+=" LEFT JOIN ( SELECT count(1) c,HIDDENFINDDEPT FROM bus_hidden WHERE STATE = '"+statelist.get(i).getString("id")+"'"; + sql1+=" LEFT JOIN ( SELECT count(1) c,HIDDENFINDDEPT FROM vi_hidden_all WHERE STATE = '"+statelist.get(i).getString("id")+"'"; if(null!=pd.getString("STARTTIME")&&!"".equals(pd.getString("STARTTIME"))) { sql1+="and CREATTIME >= '"+pd.getString("STARTTIME"); @@ -94,7 +94,7 @@ public class StatisticsController extends BaseController { }else { sql+="ifnull(ch"+i+".c,0) as c"+i+","; } - sql1+=" LEFT JOIN ( SELECT count(1) c,HIDDENFINDDEPT FROM bus_hidden WHERE HIDDENLEVEL = '"+levellist.get(i).getString("BIANMA")+"'"; + sql1+=" LEFT JOIN ( SELECT count(1) c,HIDDENFINDDEPT FROM vi_hidden_all WHERE HIDDENLEVEL = '"+levellist.get(i).getString("BIANMA")+"'"; if(null!=pd.getString("STARTTIME")&&!"".equals(pd.getString("STARTTIME"))) { sql1+="and CREATTIME >= '"+pd.getString("STARTTIME"); } @@ -124,7 +124,7 @@ public class StatisticsController extends BaseController { }else { sql+="ifnull(ch"+i+".c,0) as c"+i+","; } - sql1+=" LEFT JOIN ( SELECT count(1) c,HIDDENFINDDEPT FROM bus_hidden WHERE HIDDENTYPE = '"+typelist.get(i).getString("BIANMA")+"'"; + sql1+=" LEFT JOIN ( SELECT count(1) c,HIDDENFINDDEPT FROM vi_hidden_all WHERE HIDDENTYPE = '"+typelist.get(i).getString("BIANMA")+"'"; if(null!=pd.getString("STARTTIME")&&!"".equals(pd.getString("STARTTIME"))) { sql1+="and CREATTIME >= '"+pd.getString("STARTTIME"); } diff --git a/src/main/resources/mybatis/datasource/specialoperation/SpecialOperationsMapper.xml b/src/main/resources/mybatis/datasource/specialoperation/SpecialOperationsMapper.xml index d904ff6..a80be9d 100644 --- a/src/main/resources/mybatis/datasource/specialoperation/SpecialOperationsMapper.xml +++ b/src/main/resources/mybatis/datasource/specialoperation/SpecialOperationsMapper.xml @@ -203,7 +203,7 @@ and f.PTYPE = #{pd.PTYPE} - + and f.CORPINFO_ID = #{pd.CORPINFO_ID} ORDER BY f.OPERATTIME DESC @@ -216,6 +216,9 @@ from f where f.ISDELETE ='0' + + and f.CORPINFO_ID = #{CORPINFO_ID} + and f.UNITS_ID = #{UNITS_ID}