diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java index 0354151c..d1baf153 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnforcementRegistrationServiceImpl.java @@ -208,9 +208,9 @@ public class EnforcementRegistrationServiceImpl implements IEnforcementRegistrat results.add(reg); } //添加预警信息 - for (LawEnforcementWarningList lawEnforcementWarningList : lawEnforcementWarningLists) { - lawEnforcementWarningListService.insertLawEnforcementWarningList(lawEnforcementWarningList); - } +// for (LawEnforcementWarningList lawEnforcementWarningList : lawEnforcementWarningLists) { +// lawEnforcementWarningListService.insertLawEnforcementWarningList(lawEnforcementWarningList); +// } return results; } diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/task/EarlyWarningTask.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/task/EarlyWarningTask.java new file mode 100644 index 00000000..47f46bc0 --- /dev/null +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/task/EarlyWarningTask.java @@ -0,0 +1,65 @@ +package com.zdxt.code.task; + + +import cn.hutool.core.util.IdUtil; +import com.zdxt.auth.dto.UserBean; +import com.zdxt.auth.feign.UserApi; +import com.zdxt.code.domain.EnforceRegCount; +import com.zdxt.code.domain.EnforcementRegistration; +import com.zdxt.code.domain.LawEnforcementWarningList; +import com.zdxt.code.service.IEnforcementRegistrationService; +import com.zdxt.code.service.ILawEnforcementWarningListService; +import com.zdxt.common.util.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 预警任务 + */ +@Component("earlyWarningTask") +public class EarlyWarningTask { + + @Autowired private IEnforcementRegistrationService iEnforcementRegistrationService; + @Autowired private ILawEnforcementWarningListService lawEnforcementWarningListService; + + @Autowired private UserApi userApi; + + + public void run(){ + this.earlyWarning(); + } + + /** + * 预警任务 + */ + public void earlyWarning(){ + try{ + List list = iEnforcementRegistrationService.queryEarlyWarning(null); + for (EnforceRegCount warn : list) { + LawEnforcementWarningList params = new LawEnforcementWarningList(); + params.setEnterpriseNumber(warn.getEnterpriseNumber()); + params.setWarningLevel(Integer.parseInt(warn.getLevel())); + List res = lawEnforcementWarningListService.selectLawEnforcementWarningListList(params); + if (null == res || res.size() < 1) { + LawEnforcementWarningList warning = new LawEnforcementWarningList(); + warning.setWarningTime(DateUtils.getNowDate()); + warning.setWarningCause("本月对该企业已检查" + warn.getNum() + "次"); + warning.setWarningLevel(Integer.parseInt(warn.getLevel())); + warning.setEnterpriseName(warn.getLawEnforcement()); + warning.setEnterpriseNumber(warn.getEnterpriseNumber()); + warning.setEnforcementNumber(warn.getNum()); + + warning.setId(IdUtil.simpleUUID()); + warning.setCreateTime(DateUtils.getNowDate()); + lawEnforcementWarningListService.insertLawEnforcementWarningList(warning); + } + } + }catch (Exception e){ + System.out.println("预警任务异常!"); + e.printStackTrace(); + } + + } +} diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml index 9d4e3cc9..71fd38ac 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml @@ -225,7 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"