diff --git a/src/main/java/com/cm/inspection/InspectionApplication.java b/src/main/java/com/cm/inspection/InspectionApplication.java index 532c839..9882c6c 100644 --- a/src/main/java/com/cm/inspection/InspectionApplication.java +++ b/src/main/java/com/cm/inspection/InspectionApplication.java @@ -1,37 +1,14 @@ package com.cm.inspection; -import com.alibaba.fastjson.JSONArray; -import com.cm.common.config.properties.ApiPathProperties; -import com.cm.common.constants.ISystemConstant; -import com.cm.common.exception.AccessTokenException; -import com.cm.common.exception.SearchException; -import com.cm.common.plugin.IApiConsts; -import com.cm.common.plugin.oauth.service.user.IUserService; -import com.cm.common.plugin.oauth.token.ClientTokenManager; -import com.cm.common.plugin.pojo.bos.UserResourceBO; -import com.cm.common.plugin.utils.RestTemplateUtil; -import com.cm.inspection.pojo.dtos.check.CheckDTO; -import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO; -import com.cm.inspection.service.check.ICheckService; -import com.cm.inspection.service.gridpersonnel.IGridPersonnelService; -import org.activiti.engine.*; -import org.activiti.engine.runtime.ProcessInstance; -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormat; +import com.cm.inspection.service.count.ICountService; import org.mybatis.spring.annotation.MapperScan; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.security.core.parameters.P; import springfox.documentation.swagger2.annotations.EnableSwagger2; -import java.util.*; - /** * 隐患排查系统 * @@ -48,4 +25,6 @@ public class InspectionApplication { SpringApplication.run(InspectionApplication.class, args); } + + } diff --git a/src/main/java/com/cm/inspection/startup/StartUp.java b/src/main/java/com/cm/inspection/startup/StartUp.java index 8c25e4c..447446f 100644 --- a/src/main/java/com/cm/inspection/startup/StartUp.java +++ b/src/main/java/com/cm/inspection/startup/StartUp.java @@ -1,8 +1,11 @@ package com.cm.inspection.startup; +import com.cm.common.utils.DateUtil; +import com.cm.inspection.service.count.ICountService; import com.cm.inspection.service.dingding.IDingDingMsgService; import com.cm.inspection.service.dischargepermit.IDischargePermitService; import com.cm.inspection.service.eiareport.IEiaReportService; +import com.cm.inspection.service.enterprise.IEnterpriseService; import com.cm.inspection.service.process.IProcessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -11,6 +14,9 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.util.HashMap; +import java.util.Map; + /** * When you feel like quitting. Think about why you started * 当你想要放弃的时候,想想当初你为何开始 @@ -34,17 +40,40 @@ public class StartUp implements ApplicationRunner { private IDischargePermitService dischargePermitService; @Value("${version:1}") private Integer version; + @Autowired + private ICountService countService; + @Autowired + private IEnterpriseService enterpriseService; + @Override public void run(ApplicationArguments args) throws Exception { + int startYear = 2020; + int currentYear = Integer.parseInt(DateUtil.getYear()); // 部署流程 processService.deployProcess("check-self", "网格员检查上报流程"); + + // 初始化统计,防止第一次打开慢 + Map params = new HashMap<>(); + enterpriseService.countEnterpriseByNature(params); + for (int year = currentYear; year >= startYear; year--) { + final String yearStr = String.valueOf(year); + new Thread(() -> { + try { + countService.countCheckDetailTable("", 3, yearStr); + countService.countHiddenDangerReportDetail("", 3, yearStr); + } catch (Exception e) { + e.printStackTrace(); + } + }).start(); + + } } /** * 每天10点统计环评报告、排污许可证 */ - @Scheduled(cron = "0 0/1 * * * ?") + @Scheduled(cron = "0 0 10 * * ?") public void noticeReport() { if (version == 1) { return; diff --git a/src/main/resources/mybatis/mapper/check/check-mapper.xml b/src/main/resources/mybatis/mapper/check/check-mapper.xml index fe2d445..42c705a 100644 --- a/src/main/resources/mybatis/mapper/check/check-mapper.xml +++ b/src/main/resources/mybatis/mapper/check/check-mapper.xml @@ -1,7 +1,8 @@ - + + diff --git a/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml b/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml index 47d2624..3ea6bf0 100644 --- a/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml +++ b/src/main/resources/mybatis/mapper/checkplan/checkplan-mapper.xml @@ -2,6 +2,8 @@ + + @@ -12,7 +14,7 @@ - + INSERT INTO gen_check_plan( check_plan_id, check_plan_type, @@ -41,7 +43,7 @@ - + UPDATE gen_check_plan SET @@ -56,7 +58,7 @@ - + UPDATE gen_check_plan SET @@ -82,7 +84,7 @@ - SELECT t1.check_plan_type, t1.check_plan_year, @@ -112,7 +114,7 @@ - SELECT t1.check_plan_type, t1.check_plan_year, @@ -151,7 +153,7 @@ - SELECT COUNT(*) FROM @@ -184,7 +186,7 @@ - SELECT SUM(check_plan_count) FROM diff --git a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml index c941fb9..1cb5e9a 100644 --- a/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml +++ b/src/main/resources/mybatis/mapper/enterpriseofgridoperator/enterpriseofgridoperator-mapper.xml @@ -2,6 +2,8 @@ + + @@ -156,7 +158,7 @@ - SELECT t1.user_id, t1.enterprise_id, @@ -244,7 +246,7 @@ - SELECT t1.enterprise_id, t1.name name_join_by_enterprise_id, @@ -322,7 +324,7 @@ - SELECT t1.enterprise_id, t1.name name_join_by_enterprise_id, @@ -416,7 +418,7 @@ - SELECT user_id enterprise_id @@ -429,7 +431,7 @@ - SELECT COUNT(*) FROM @@ -449,7 +451,7 @@ - SELECT jt1.user_id, jt1.area1, @@ -478,7 +480,7 @@ - SELECT t1.enterprise_id, t1.name name_join_by_enterprise_id, @@ -550,7 +552,7 @@ - SELECT COUNT(*) FROM @@ -597,7 +599,7 @@ - SELECT COUNT(*) FROM @@ -644,7 +646,7 @@ - SELECT COUNT(*) FROM @@ -666,7 +668,7 @@ - SELECT enterprise_of_grid_operator_id, user_id, @@ -685,7 +687,7 @@ - SELECT enterprise_id FROM diff --git a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml index 9199cd7..608ddff 100644 --- a/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml +++ b/src/main/resources/mybatis/mapper/gridpersonnel/gridpersonnel-mapper.xml @@ -2,6 +2,8 @@ + + @@ -32,7 +34,7 @@ - + INSERT INTO gen_grid_personnel( grid_personnel_id, user_id, @@ -69,7 +71,7 @@ - + UPDATE gen_grid_personnel SET @@ -84,7 +86,7 @@ - + UPDATE gen_grid_personnel SET @@ -154,7 +156,7 @@ - SELECT t1.user_id, t1.area1, @@ -278,7 +280,7 @@ - SELECT COUNT(*) FROM @@ -292,7 +294,7 @@ - SELECT t1.user_id, t1.area1, @@ -370,7 +372,7 @@ - + UPDATE gen_grid_personnel SET diff --git a/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml b/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml index 8a570ae..9caa48b 100644 --- a/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml +++ b/src/main/resources/mybatis/mapper/hiddendangerreport/hiddendangerreport-mapper.xml @@ -2,6 +2,8 @@ + + @@ -27,7 +29,7 @@ - + INSERT INTO gen_hidden_danger_report( hidden_danger_report_id, check_id, @@ -60,7 +62,7 @@ - + UPDATE gen_hidden_danger_report SET @@ -75,7 +77,7 @@ - + UPDATE gen_hidden_danger_report SET @@ -107,7 +109,7 @@ - SELECT t1.check_id, t1.check_item_id, @@ -137,7 +139,7 @@ - SELECT t1.check_id, t1.check_item_id, @@ -189,7 +191,7 @@ - SELECT jt1.name, jt1.summary, @@ -231,7 +233,7 @@ - SELECT jt1.name, jt1.summary, @@ -265,7 +267,7 @@ - SELECT * FROM