forked from integrated_whb/integrated_whb
特种作业人员证件临期提醒
parent
488ed3f01e
commit
d6bb1fd3fe
|
@ -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<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 = 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("<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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -220,6 +220,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>
|
||||
|
|
Loading…
Reference in New Issue