特种作业人员证件临期提醒(迁表)

隐患统计增加隐患清单排查数据
pull/4/head
wangpeng 2024-02-21 11:44:21 +08:00
parent ca5c1fb850
commit a67934c55c
3 changed files with 52 additions and 4 deletions

View File

@ -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<String,Object> map = new HashMap<String,Object>();
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<PageData> 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("<p style=\"color: red;\">以下持证人员证件临近有效期,请及时处置!<br>");
stringBuffer.append("****************************************<br></p>");
firstflag = false;
}
stringBuffer.append("<p style=\"color: black;\">").append(cnt).append(". ")
.append(varList.get(i).get("NAME"))
.append(",距到期还有" + daysBetween + "天")
.append("</p>");
cnt++;
}
}
map.put("result", errInfo);
map.put("message", stringBuffer.toString());
return map;
}
}

View File

@ -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");
}

View File

@ -203,7 +203,7 @@
<if test="pd.PTYPE != null and pd.PTYPE !=''">
and f.PTYPE = #{pd.PTYPE}
</if>
<if test="pd.CORPINFO_ID != null and pd.ORPINFO_ID != ''">
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
ORDER BY f.OPERATTIME DESC
@ -216,6 +216,9 @@
from
<include refid="tableName"></include> f
where f.ISDELETE ='0'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="UNITS_ID != null and UNITS_ID !=''">
and f.UNITS_ID = #{UNITS_ID}
</if>