Browse Source

#定时任务抽离

zhongwei
yang_shj 1 year ago
parent
commit
089c487e1c
  1. 75
      hzims-service/hzims-scheduled/pom.xml
  2. 17
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java
  3. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  4. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java
  5. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java
  6. 19
      hzims-service/hzims-scheduled/src/main/resources/banner.txt
  7. 2
      hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml

75
hzims-service/hzims-scheduled/pom.xml

@ -25,24 +25,11 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
<exclusions>
<exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId>
<exclusions>
<exclusion>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId>
@ -52,11 +39,6 @@
<artifactId>blade-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-operational-api</artifactId>
</dependency>
@ -87,26 +69,48 @@
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.24</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.hikvision.ga</groupId>
<artifactId>artemis-http-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>equipment-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>message-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>ticket-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>assets-api</artifactId>
</dependency>
<!-- -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
@ -124,6 +128,16 @@
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
</dependency>
@ -132,6 +146,10 @@
<artifactId>hutool-core</artifactId>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-resource-api</artifactId>
</dependency>
@ -159,7 +177,16 @@
<groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>${swagger-bootstrap-ui.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>2.5.6</version>
</dependency>
</dependencies>
<build>

17
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/ScheduledApplication.java

@ -1,30 +1,23 @@
package com.hnac.hzims.scheduled;
import com.hnac.hzims.operational.OperationalConstants;
import org.mybatis.spring.annotation.MapperScan;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.annotation.Resource;
/**
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/5/19 9:05
* @author ysj
*/
@EnableBladeFeign(basePackages = {"org.springblade","com.hnac"})
@EnableBladeFeign
@SpringCloudApplication
@MapperScan("com.hnac.hzims.scheduled.mapper.**.**")
@EnableScheduling
@ComponentScan(basePackages = {"com.hnac.hzims.scheduled.*","org.springblade.core"})
@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.*"})
@Resource
public class ScheduledApplication extends SpringBootServletInitializer {
public static void main(String[] args) {

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -34,6 +34,7 @@ public class RealTargetScheduledTask {
* @throws Exception
*/
@XxlJob(LOAD_EM_INFO)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo(String param) {
service.loadEmInfo();
return new ReturnT<>("SUCCESS");

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java

@ -20,7 +20,6 @@ import java.util.List;
@DS("equipment")
public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanGenerationEntity> implements PlanService {
/**
* 查询计划发电量
* @param stationIds

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java

@ -30,7 +30,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
@ -928,7 +927,7 @@ public class RealTargetServiceImpl implements RealTargetService {
*/
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
String beginTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATE);
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyseDataTaosVO> datas = dataService.periodTargetData(beginTime, endTime,2, 6,instanceCode,signage);
if(CollectionUtil.isEmpty(datas)){

19
hzims-service/hzims-scheduled/src/main/resources/banner.txt

@ -0,0 +1,19 @@
.::::.
.::::::::.
:::::::::::
':::::::::::..
:::::::::::::::'
':::::::::::.
.::::::::::::::'
.:::::::::::...
::::::::::::::''
.:::. '::::::::''::::
.::::::::. ':::::' '::::
.::::':::::::. ::::: '::::.
.:::::' ':::::::::. ::::: ':::.
.:::::' ':::::::::.::::: '::.
.::::'' ':::::::::::::: '::.
.::'' ':::::::::::: :::...
..:::: ':::::::::' .:' ''''
..''''':' ':::::.'

2
hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml

@ -16,7 +16,7 @@
<result column="CREATE_DEPT" property="createDept" jdbcType="BIGINT"/>
</resultMap>
<select id="selectPlanGenerationByParam" resultType="com.hnac.hzims.equipment.entity.PlanGenerationEntity">
<select id="planGeneration" resultType="com.hnac.hzims.equipment.entity.PlanGenerationEntity">
select * from hz_ims_plan_generation
where IS_DELETED = 0
<if test="stationIds != null">

Loading…
Cancel
Save