init
parent
41deb60c41
commit
4094fe1e3f
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="BUILD_PROCESS_HEAP_SIZE" value="2048" />
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: com.rabbitmq:amqp-client:5.13.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/com/rabbitmq/amqp-client/5.13.1/amqp-client-5.13.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/com/rabbitmq/amqp-client/5.13.1/amqp-client-5.13.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/com/rabbitmq/amqp-client/5.13.1/amqp-client-5.13.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.springframework.amqp:spring-amqp:2.4.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/amqp/spring-amqp/2.4.2/spring-amqp-2.4.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/amqp/spring-amqp/2.4.2/spring-amqp-2.4.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/amqp/spring-amqp/2.4.2/spring-amqp-2.4.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.springframework.amqp:spring-rabbit:2.4.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/amqp/spring-rabbit/2.4.2/spring-rabbit-2.4.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/amqp/spring-rabbit/2.4.2/spring-rabbit-2.4.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/amqp/spring-rabbit/2.4.2/spring-rabbit-2.4.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.springframework.boot:spring-boot-starter-amqp:2.6.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/boot/spring-boot-starter-amqp/2.6.3/spring-boot-starter-amqp-2.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/boot/spring-boot-starter-amqp/2.6.3/spring-boot-starter-amqp-2.6.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/boot/spring-boot-starter-amqp/2.6.3/spring-boot-starter-amqp-2.6.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.springframework.retry:spring-retry:1.3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/retry/spring-retry/1.3.1/spring-retry-1.3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/retry/spring-retry/1.3.1/spring-retry-1.3.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/retry/spring-retry/1.3.1/spring-retry-1.3.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.springframework:spring-messaging:5.3.15">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/spring-messaging/5.3.15/spring-messaging-5.3.15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/spring-messaging/5.3.15/spring-messaging-5.3.15-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../repository/org/springframework/spring-messaging/5.3.15/spring-messaging-5.3.15-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -3,6 +3,7 @@
|
|||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/szhpt-fixed-task/talroad-demo.iml" filepath="$PROJECT_DIR$/szhpt-fixed-task/talroad-demo.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/talroad-module.iml" filepath="$PROJECT_DIR$/talroad-module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -51,10 +51,10 @@
|
|||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-amqp</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
package cn.cecep.talroad.config;
|
||||
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2023-04-17 14:53
|
||||
* @Class: ExchangeConfig
|
||||
* @Deseription:
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class ExchangeConfig {
|
||||
|
||||
/**
|
||||
* 消息交换机的名字
|
||||
*/
|
||||
public static final String DIRECT_EXCHANGE = "metadata-bigdata";
|
||||
|
||||
|
||||
/**
|
||||
* 1.定义direct exchange,绑定queueTest
|
||||
* 2.durable="true" rabbitmq重启的时候不需要创建新的交换机
|
||||
* 3.direct交换器相对来说比较简单,匹配规则为:如果路由键匹配,消息就被投送到相关的队列
|
||||
* fanout交换器中没有路由键的概念,他会把消息发送到所有绑定在此交换器上面的队列中。
|
||||
* topic交换器你采用模糊匹配路由键的原则进行转发消息到队列中
|
||||
* key: queue在该direct-exchange中的key值,当消息发送给direct-exchange中指定key为设置值时,
|
||||
* 消息将会转发给queue参数指定的消息队列
|
||||
*/
|
||||
@Bean
|
||||
public DirectExchange directExchange() {
|
||||
DirectExchange directExchange = new DirectExchange(DIRECT_EXCHANGE, true, false);
|
||||
return directExchange;
|
||||
}
|
||||
|
||||
}
|
||||
//package cn.cecep.talroad.config;
|
||||
//
|
||||
//import org.springframework.amqp.core.DirectExchange;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
///**
|
||||
// * @Auther: cjh
|
||||
// * @Date: 2023-04-17 14:53
|
||||
// * @Class: ExchangeConfig
|
||||
// * @Deseription:
|
||||
// * @Version V1.0
|
||||
// */
|
||||
//@Configuration
|
||||
//public class ExchangeConfig {
|
||||
//
|
||||
// /**
|
||||
// * 消息交换机的名字
|
||||
// */
|
||||
// public static final String DIRECT_EXCHANGE = "metadata-bigdata";
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 1.定义direct exchange,绑定queueTest
|
||||
// * 2.durable="true" rabbitmq重启的时候不需要创建新的交换机
|
||||
// * 3.direct交换器相对来说比较简单,匹配规则为:如果路由键匹配,消息就被投送到相关的队列
|
||||
// * fanout交换器中没有路由键的概念,他会把消息发送到所有绑定在此交换器上面的队列中。
|
||||
// * topic交换器你采用模糊匹配路由键的原则进行转发消息到队列中
|
||||
// * key: queue在该direct-exchange中的key值,当消息发送给direct-exchange中指定key为设置值时,
|
||||
// * 消息将会转发给queue参数指定的消息队列
|
||||
// */
|
||||
// @Bean
|
||||
// public DirectExchange directExchange() {
|
||||
// DirectExchange directExchange = new DirectExchange(DIRECT_EXCHANGE, true, false);
|
||||
// return directExchange;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
package cn.cecep.talroad.config;
|
||||
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2023-04-17 14:56
|
||||
* @Class: QueueConfig
|
||||
* @Deseription:
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class QueueConfig {
|
||||
|
||||
private static final String statusQueue = "status-queue";
|
||||
|
||||
private static final String yieldQueue = "yield-queue";
|
||||
|
||||
@Bean
|
||||
public Queue statusQueue() {
|
||||
/**
|
||||
durable="true" 持久化 rabbitmq重启的时候不需要创建新的队列
|
||||
auto-delete 表示消息队列没有在使用时将被自动删除 默认是false
|
||||
exclusive 表示该消息队列是否只在当前connection生效,默认是false
|
||||
*/
|
||||
return new Queue(statusQueue, true, false, false);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue yieldQueue() {
|
||||
/**
|
||||
durable="true" 持久化 rabbitmq重启的时候不需要创建新的队列
|
||||
auto-delete 表示消息队列没有在使用时将被自动删除 默认是false
|
||||
exclusive 表示该消息队列是否只在当前connection生效,默认是false
|
||||
*/
|
||||
return new Queue(yieldQueue, true, false, false);
|
||||
}
|
||||
|
||||
}
|
||||
//package cn.cecep.talroad.config;
|
||||
//
|
||||
//import org.springframework.amqp.core.Queue;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
///**
|
||||
// * @Auther: cjh
|
||||
// * @Date: 2023-04-17 14:56
|
||||
// * @Class: QueueConfig
|
||||
// * @Deseription:
|
||||
// * @Version V1.0
|
||||
// */
|
||||
//@Configuration
|
||||
//public class QueueConfig {
|
||||
//
|
||||
// private static final String statusQueue = "status-queue";
|
||||
//
|
||||
// private static final String yieldQueue = "yield-queue";
|
||||
//
|
||||
// @Bean
|
||||
// public Queue statusQueue() {
|
||||
// /**
|
||||
// durable="true" 持久化 rabbitmq重启的时候不需要创建新的队列
|
||||
// auto-delete 表示消息队列没有在使用时将被自动删除 默认是false
|
||||
// exclusive 表示该消息队列是否只在当前connection生效,默认是false
|
||||
// */
|
||||
// return new Queue(statusQueue, true, false, false);
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public Queue yieldQueue() {
|
||||
// /**
|
||||
// durable="true" 持久化 rabbitmq重启的时候不需要创建新的队列
|
||||
// auto-delete 表示消息队列没有在使用时将被自动删除 默认是false
|
||||
// exclusive 表示该消息队列是否只在当前connection生效,默认是false
|
||||
// */
|
||||
// return new Queue(yieldQueue, true, false, false);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
package cn.cecep.talroad.config;
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2023-04-17 15:20
|
||||
* @Class: RabbitmqConfig
|
||||
* @Deseription:
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitmqConfig {
|
||||
|
||||
/**
|
||||
* 停限产设备状态路由
|
||||
*/
|
||||
public static final String ROUTE_KEY_STATUS = "route_key_status";
|
||||
/**
|
||||
* 产量统计路由
|
||||
*/
|
||||
public static final String ROUTE_KEY_YIELD = "route_key_yield";
|
||||
|
||||
@Autowired
|
||||
private QueueConfig queueConfig;
|
||||
@Autowired
|
||||
private ExchangeConfig exchangeConfig;
|
||||
|
||||
/**
|
||||
* 将停限产状态消息队列和交换机进行绑定
|
||||
*/
|
||||
@Bean
|
||||
public Binding binding_statusQueue() {
|
||||
return BindingBuilder.bind(queueConfig.statusQueue()).to(exchangeConfig.directExchange()).with(RabbitmqConfig.ROUTE_KEY_STATUS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将产量统计队列和交换机进行绑定
|
||||
*/
|
||||
@Bean
|
||||
public Binding binding_yieldQueue() {
|
||||
return BindingBuilder.bind(queueConfig.yieldQueue()).to(exchangeConfig.directExchange()).with(RabbitmqConfig.ROUTE_KEY_YIELD);
|
||||
}
|
||||
|
||||
}
|
||||
//package cn.cecep.talroad.config;
|
||||
//
|
||||
//import org.springframework.amqp.core.Binding;
|
||||
//import org.springframework.amqp.core.BindingBuilder;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
///**
|
||||
// * @Auther: cjh
|
||||
// * @Date: 2023-04-17 15:20
|
||||
// * @Class: RabbitmqConfig
|
||||
// * @Deseription:
|
||||
// * @Version V1.0
|
||||
// */
|
||||
//@Configuration
|
||||
//public class RabbitmqConfig {
|
||||
//
|
||||
// /**
|
||||
// * 停限产设备状态路由
|
||||
// */
|
||||
// public static final String ROUTE_KEY_STATUS = "route_key_status";
|
||||
// /**
|
||||
// * 产量统计路由
|
||||
// */
|
||||
// public static final String ROUTE_KEY_YIELD = "route_key_yield";
|
||||
//
|
||||
// @Autowired
|
||||
// private QueueConfig queueConfig;
|
||||
// @Autowired
|
||||
// private ExchangeConfig exchangeConfig;
|
||||
//
|
||||
// /**
|
||||
// * 将停限产状态消息队列和交换机进行绑定
|
||||
// */
|
||||
// @Bean
|
||||
// public Binding binding_statusQueue() {
|
||||
// return BindingBuilder.bind(queueConfig.statusQueue()).to(exchangeConfig.directExchange()).with(RabbitmqConfig.ROUTE_KEY_STATUS);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 将产量统计队列和交换机进行绑定
|
||||
// */
|
||||
// @Bean
|
||||
// public Binding binding_yieldQueue() {
|
||||
// return BindingBuilder.bind(queueConfig.yieldQueue()).to(exchangeConfig.directExchange()).with(RabbitmqConfig.ROUTE_KEY_YIELD);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -6,7 +6,7 @@ import cn.cecep.talroad.domain.AmProblemFiProcess;
|
|||
import cn.cecep.talroad.service.IAmProblemFiService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
//import org.junit.jupiter.api.Disabled;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -37,7 +37,7 @@ public class AmProblemFiCallbackController extends BasesController {
|
|||
|
||||
@ApiOperation(value = "审核结果回调")
|
||||
@PostMapping(value = "/audit/result")
|
||||
@Disabled
|
||||
// @Disabled
|
||||
public AjaxResults auditResult(@RequestBody @Validated AmProblemFiProcess param) {
|
||||
amProblemFiService.auditResult(param);
|
||||
return AjaxResults.success();
|
||||
|
|
|
@ -14,7 +14,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
//import org.junit.jupiter.api.Disabled;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -51,7 +51,7 @@ public class ERmStationExceedController {
|
|||
|
||||
@GetMapping("/selectInfo")
|
||||
@ApiOperation("查询站点信息--弃用,使用接口 POST station/detail/air/{id}")
|
||||
@Disabled("使用cn.cecep.talroad.controller.TCodStationController.airStationDetail")
|
||||
// @Disabled("使用cn.cecep.talroad.controller.TCodStationController.airStationDetail")
|
||||
public AjaxResults<ERmStationHour> selectInfo(@RequestParam(name = "stationCode") String stationCode) {
|
||||
QueryWrapper<ERmStationHour> ew = new QueryWrapper<>();
|
||||
ew.eq(ERmStationHour.COL_STATION_CODE, stationCode);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package cn.cecep.talroad.data.analyse.task.execute.report.specifications.audit;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hehongyu
|
||||
* @description: 执行报告审核类
|
||||
* @date 2023/8/12 17:07
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExecuteReportAuditService {
|
||||
|
||||
public void audit(List<String> executeReportIds){
|
||||
//执行报表分批次进行
|
||||
List<List<String>> partitionIds = Lists.partition(executeReportIds, 10);
|
||||
for (List<String> partitionExecuteReportIds : partitionIds) {
|
||||
//执行所有审核任务
|
||||
try {
|
||||
execute(partitionExecuteReportIds);
|
||||
}catch (Exception e){
|
||||
log.error("执行审核相关任务错误 executeReportIds:{}", executeReportIds, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void execute(List<String> partitionIds){
|
||||
//所有的审核任务 需要将方法手动添加到此处!!!
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package cn.cecep.talroad.data.analyse.task.execute.report.specifications.audit;
|
||||
|
||||
/**
|
||||
* @author hehongyu
|
||||
* @description: (正常监测时段)无组织废气污染物排放浓度监测数据统计表
|
||||
* @date 2023/8/12 17:06
|
||||
*/
|
||||
public class FugitiveExhaustPollutantsService {
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* @description: 执行报告规范性 手动触发的审核相关任务
|
||||
* @author hehongyu
|
||||
* @date 2023/7/17 22:28
|
||||
*/
|
||||
package cn.cecep.talroad.data.analyse.task.execute.report.specifications.audit;
|
|
@ -4,13 +4,9 @@ import cn.cecep.talroad.common.core.utils.StringUtils;
|
|||
import cn.cecep.talroad.domain.AppVersionAddressManagement;
|
||||
import cn.cecep.talroad.mapper.AppVersionAddressManagementMapper;
|
||||
import cn.cecep.talroad.service.IAppVersionAddressManagementService;
|
||||
import cn.cecep.talroad.util.QrCodeUtils;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: app版本管理表
|
||||
|
@ -58,8 +54,8 @@ public class AppVersionAddressManagementServiceImpl extends ServiceImpl<AppVersi
|
|||
if (StringUtils.isEmpty(logUrl)) {
|
||||
logUrl = versionAddress.getLogImgUrl();
|
||||
}
|
||||
|
||||
String encode = QrCodeUtils.createQrCodeBase64Encode(url, StrUtil.isNotEmpty(logUrl)? FileUtil.file(logUrl): null, true);
|
||||
return BASE64_CODE_PREFIX + encode;
|
||||
return null;
|
||||
// String encode = QrCodeUtils.createQrCodeBase64Encode(url, StrUtil.isNotEmpty(logUrl)? FileUtil.file(logUrl): null, true);
|
||||
// return BASE64_CODE_PREFIX + encode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package cn.cecep.talroad.service.impl.analysis;
|
||||
|
||||
import cn.cecep.talroad.common.core.text.UUID;
|
||||
import cn.cecep.talroad.common.core.utils.DateUtils;
|
||||
import cn.cecep.talroad.common.core.utils.StringUtils;
|
||||
import cn.cecep.talroad.domain.BasDevice;
|
||||
import cn.cecep.talroad.mapper.BasDeviceMapper;
|
||||
import cn.cecep.talroad.service.analysis.IBasDeviceStatusService;
|
||||
import cn.cecep.talroad.service.strategy.StrategyFactory;
|
||||
import cn.cecep.talroad.util.MsgProducer;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -17,6 +15,8 @@ import java.text.ParseException;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
//import cn.cecep.talroad.util.MsgProducer;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2023-03-31 16:10
|
||||
|
@ -32,8 +32,8 @@ public class BasDeviceStatusServiceImpl implements IBasDeviceStatusService {
|
|||
private BasDeviceMapper deviceMapper;
|
||||
@Autowired
|
||||
private StrategyFactory strategyFactory;
|
||||
@Autowired
|
||||
private MsgProducer msgProducer;
|
||||
// @Autowired
|
||||
// private MsgProducer msgProducer;
|
||||
|
||||
@Override
|
||||
public void doCheckDeviceStatus(String industry, String deviceType) {
|
||||
|
@ -55,10 +55,10 @@ public class BasDeviceStatusServiceImpl implements IBasDeviceStatusService {
|
|||
deviceQueryWrapper.eq("is_status", "1");
|
||||
List<BasDevice> deviceList = deviceMapper.selectList(deviceQueryWrapper);
|
||||
if (deviceList != null && deviceList.size() > 0) {
|
||||
// 查询设备类型的参数配置
|
||||
deviceList.forEach(d -> {
|
||||
msgProducer.sendYieldStatisticMsg(UUID.randomUUID().toString(),d.getDeviceId());
|
||||
});
|
||||
// // 查询设备类型的参数配置
|
||||
// deviceList.forEach(d -> {
|
||||
// msgProducer.sendYieldStatisticMsg(UUID.randomUUID().toString(),d.getDeviceId());
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
package cn.cecep.talroad.util;
|
||||
|
||||
import cn.cecep.talroad.config.ExchangeConfig;
|
||||
import cn.cecep.talroad.config.RabbitmqConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2022-05-07 15:27
|
||||
* @Class: MsgProducer
|
||||
* @Deseription:
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MsgProducer implements RabbitTemplate.ConfirmCallback {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
* 发送消息-定时判断设备停限产状态
|
||||
*
|
||||
* @param uuid
|
||||
* @param message 消息
|
||||
*/
|
||||
public void sendStatusMsg(String uuid, Object message) {
|
||||
rabbitTemplate.setConfirmCallback(this);
|
||||
CorrelationData correlationId = new CorrelationData(uuid);
|
||||
rabbitTemplate.convertAndSend(ExchangeConfig.DIRECT_EXCHANGE, RabbitmqConfig.ROUTE_KEY_STATUS,message, correlationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送探查消息
|
||||
* @param uuid
|
||||
* @param message
|
||||
*/
|
||||
public void sendYieldStatisticMsg(String uuid, Object message) {
|
||||
rabbitTemplate.setConfirmCallback(this);
|
||||
CorrelationData correlationId = new CorrelationData(uuid);
|
||||
rabbitTemplate.convertAndSend(ExchangeConfig.DIRECT_EXCHANGE, RabbitmqConfig.ROUTE_KEY_YIELD,message, correlationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirm(CorrelationData correlationData, boolean b, String s) {
|
||||
log.info("消息推送交换机状态{},消息ID{}",b,correlationData.getId());
|
||||
}
|
||||
}
|
||||
//package cn.cecep.talroad.util;
|
||||
//
|
||||
//import cn.cecep.talroad.config.ExchangeConfig;
|
||||
//import cn.cecep.talroad.config.RabbitmqConfig;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
///**
|
||||
// * @Auther: cjh
|
||||
// * @Date: 2022-05-07 15:27
|
||||
// * @Class: MsgProducer
|
||||
// * @Deseription:
|
||||
// * @Version V1.0
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class MsgProducer implements RabbitTemplate.ConfirmCallback {
|
||||
//
|
||||
//
|
||||
// @Autowired
|
||||
// private RabbitTemplate rabbitTemplate;
|
||||
//
|
||||
// /**
|
||||
// * 发送消息-定时判断设备停限产状态
|
||||
// *
|
||||
// * @param uuid
|
||||
// * @param message 消息
|
||||
// */
|
||||
// public void sendStatusMsg(String uuid, Object message) {
|
||||
// rabbitTemplate.setConfirmCallback(this);
|
||||
// CorrelationData correlationId = new CorrelationData(uuid);
|
||||
// rabbitTemplate.convertAndSend(ExchangeConfig.DIRECT_EXCHANGE, RabbitmqConfig.ROUTE_KEY_STATUS,message, correlationId);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 发送探查消息
|
||||
// * @param uuid
|
||||
// * @param message
|
||||
// */
|
||||
// public void sendYieldStatisticMsg(String uuid, Object message) {
|
||||
// rabbitTemplate.setConfirmCallback(this);
|
||||
// CorrelationData correlationId = new CorrelationData(uuid);
|
||||
// rabbitTemplate.convertAndSend(ExchangeConfig.DIRECT_EXCHANGE, RabbitmqConfig.ROUTE_KEY_YIELD,message, correlationId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void confirm(CorrelationData correlationData, boolean b, String s) {
|
||||
// log.info("消息推送交换机状态{},消息ID{}",b,correlationData.getId());
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,229 +1,229 @@
|
|||
package cn.cecep.talroad.util;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description:二维码工具类
|
||||
* @PACKAGE_NAME: cn.cecep.talroad.utils
|
||||
* @date 2021-12-21 11:10*/
|
||||
public class QrCodeUtils {
|
||||
|
||||
private static final int BLACK = 0xFF000000;
|
||||
private static final int WHITE = 0xFFFFFFFF;
|
||||
private static final String CHARSET = "utf-8";
|
||||
private static final String FORMAT_NAME = "JPG";
|
||||
// 二维码尺寸
|
||||
private static final int QRCODE_SIZE = 300;
|
||||
// LOGO宽度
|
||||
private static final int WIDTH = 60;
|
||||
// LOGO高度
|
||||
private static final int HEIGHT = 60;
|
||||
|
||||
private static RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
* 经过base64编码
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static BufferedImage createQrCode(String url) throws WriterException {
|
||||
Map<EncodeHintType, String> hints = new HashMap<EncodeHintType, String>(4);
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, 500, 500, hints);
|
||||
|
||||
return toBufferedImage(bitMatrix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成二维码
|
||||
* 经过base64编码
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static String createQrCodeBase64(String url) {
|
||||
String base64String = "";
|
||||
try {
|
||||
Map<EncodeHintType, String> hints = new HashMap<EncodeHintType, String>(4);
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, 400, 400, hints);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
|
||||
BufferedImage bufferedImage = toBufferedImage(bitMatrix);
|
||||
ImageIO.write(bufferedImage, "jpg", outputStream);
|
||||
Base64.Encoder encoder = Base64.getEncoder();
|
||||
base64String = encoder.encodeToString(outputStream.toByteArray());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//return "data:image/jpg;base64," + base64String;
|
||||
return base64String;
|
||||
}
|
||||
|
||||
private static BufferedImage toBufferedImage(BitMatrix matrix) {
|
||||
int width = matrix.getWidth();
|
||||
int height = matrix.getHeight();
|
||||
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成二维码(内嵌LOGO)
|
||||
* author zhangpeizhi
|
||||
* @param content 内容
|
||||
* @param logoFile LOGO文件
|
||||
* @param needCompress 是否压缩LOGO
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String createQrCodeBase64Encode(String content, File logoFile,
|
||||
boolean needCompress) throws Exception {
|
||||
BufferedImage image = createImage(content, logoFile,
|
||||
needCompress);
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
|
||||
ImageIO.write(image, "jpg", outputStream);
|
||||
Base64.Encoder encoder = Base64.getEncoder();
|
||||
String base64String = encoder.encodeToString(outputStream.toByteArray());
|
||||
|
||||
return base64String;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成二维码(内嵌LOGO)
|
||||
*
|
||||
* @param content 内容
|
||||
* @param logoFile LOGO文件
|
||||
* @param destPath 存放目录
|
||||
* @param needCompress 是否压缩LOGO
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encode(String content, File logoFile, String destPath,
|
||||
boolean needCompress) throws Exception {
|
||||
BufferedImage image = createImage(content, logoFile,
|
||||
needCompress);
|
||||
mkdirs(destPath);
|
||||
String file = new Random().nextInt(99999999) + ".jpg";
|
||||
ImageIO.write(image, FORMAT_NAME, new File(destPath + "/" + file));
|
||||
return file;
|
||||
}
|
||||
|
||||
private static BufferedImage createImage(String content, File logoFile,
|
||||
boolean needCompress) throws Exception {
|
||||
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
|
||||
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
|
||||
hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
|
||||
hints.put(EncodeHintType.MARGIN, 1);
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
|
||||
BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
|
||||
int width = bitMatrix.getWidth();
|
||||
int height = bitMatrix.getHeight();
|
||||
BufferedImage image = new BufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_RGB);
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000
|
||||
: 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
if (CmUtil.isEmpty(logoFile)) {
|
||||
return image;
|
||||
}
|
||||
// 插入图片
|
||||
insertImage(image, logoFile, needCompress);
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
|
||||
*
|
||||
* @param destPath 存放目录
|
||||
* @date 2013-12-11 上午10:16:36
|
||||
*/
|
||||
public static void mkdirs(String destPath) {
|
||||
File file = new File(destPath);
|
||||
//当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
|
||||
if (!file.exists() && !file.isDirectory()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
public static class CmUtil{
|
||||
public static boolean isEmpty(File file){
|
||||
if (null == file || 0 == file.length() || !file.exists()) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入LOGO
|
||||
*
|
||||
* @param source 二维码图片
|
||||
* @param logoFile LOGO图片文件
|
||||
* @param needCompress 是否压缩
|
||||
* @throws Exception
|
||||
*/
|
||||
private static void insertImage(BufferedImage source, File logoFile,
|
||||
boolean needCompress) throws Exception {
|
||||
|
||||
if (!logoFile.exists()) {
|
||||
System.err.println("" + logoFile + " 该文件不存在!");
|
||||
return;
|
||||
}
|
||||
Image src = ImageIO.read(logoFile);
|
||||
int width = src.getWidth(null);
|
||||
int height = src.getHeight(null);
|
||||
// 压缩LOGO
|
||||
if (needCompress) {
|
||||
if (width > WIDTH) {
|
||||
width = WIDTH;
|
||||
}
|
||||
if (height > HEIGHT) {
|
||||
height = HEIGHT;
|
||||
}
|
||||
Image image = src.getScaledInstance(width, height,
|
||||
Image.SCALE_SMOOTH);
|
||||
BufferedImage tag = new BufferedImage(width, height,
|
||||
BufferedImage.TYPE_INT_RGB);
|
||||
Graphics g = tag.getGraphics();
|
||||
// 绘制缩小后的图
|
||||
g.drawImage(image, 0, 0, null);
|
||||
g.dispose();
|
||||
src = image;
|
||||
}
|
||||
// 插入LOGO
|
||||
Graphics2D graph = source.createGraphics();
|
||||
int x = (QRCODE_SIZE - width) / 2;
|
||||
int y = (QRCODE_SIZE - height) / 2;
|
||||
graph.drawImage(src, x, y, width, height, null);
|
||||
Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
|
||||
graph.setStroke(new BasicStroke(3f));
|
||||
graph.draw(shape);
|
||||
graph.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
//package cn.cecep.talroad.util;
|
||||
//
|
||||
//import com.google.zxing.BarcodeFormat;
|
||||
//import com.google.zxing.EncodeHintType;
|
||||
//import com.google.zxing.MultiFormatWriter;
|
||||
//import com.google.zxing.WriterException;
|
||||
//import com.google.zxing.common.BitMatrix;
|
||||
//import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
//import org.springframework.web.client.RestTemplate;
|
||||
//
|
||||
//import javax.imageio.ImageIO;
|
||||
//import java.awt.*;
|
||||
//import java.awt.geom.RoundRectangle2D;
|
||||
//import java.awt.image.BufferedImage;
|
||||
//import java.io.ByteArrayOutputStream;
|
||||
//import java.io.File;
|
||||
//import java.util.*;
|
||||
//
|
||||
///**
|
||||
// * @Description:二维码工具类
|
||||
// * @PACKAGE_NAME: cn.cecep.talroad.utils
|
||||
// * @date 2021-12-21 11:10*/
|
||||
//public class QrCodeUtils {
|
||||
//
|
||||
// private static final int BLACK = 0xFF000000;
|
||||
// private static final int WHITE = 0xFFFFFFFF;
|
||||
// private static final String CHARSET = "utf-8";
|
||||
// private static final String FORMAT_NAME = "JPG";
|
||||
// // 二维码尺寸
|
||||
// private static final int QRCODE_SIZE = 300;
|
||||
// // LOGO宽度
|
||||
// private static final int WIDTH = 60;
|
||||
// // LOGO高度
|
||||
// private static final int HEIGHT = 60;
|
||||
//
|
||||
// private static RestTemplate restTemplate = new RestTemplate();
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 生成二维码
|
||||
// * 经过base64编码
|
||||
// *
|
||||
// * @param url
|
||||
// * @return
|
||||
// */
|
||||
// public static BufferedImage createQrCode(String url) throws WriterException {
|
||||
// Map<EncodeHintType, String> hints = new HashMap<EncodeHintType, String>(4);
|
||||
// hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||
// BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, 500, 500, hints);
|
||||
//
|
||||
// return toBufferedImage(bitMatrix);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 生成二维码
|
||||
// * 经过base64编码
|
||||
// *
|
||||
// * @param url
|
||||
// * @return
|
||||
// */
|
||||
// public static String createQrCodeBase64(String url) {
|
||||
// String base64String = "";
|
||||
// try {
|
||||
// Map<EncodeHintType, String> hints = new HashMap<EncodeHintType, String>(4);
|
||||
// hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||
// BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, 400, 400, hints);
|
||||
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
//
|
||||
// BufferedImage bufferedImage = toBufferedImage(bitMatrix);
|
||||
// ImageIO.write(bufferedImage, "jpg", outputStream);
|
||||
// Base64.Encoder encoder = Base64.getEncoder();
|
||||
// base64String = encoder.encodeToString(outputStream.toByteArray());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// //return "data:image/jpg;base64," + base64String;
|
||||
// return base64String;
|
||||
// }
|
||||
//
|
||||
// private static BufferedImage toBufferedImage(BitMatrix matrix) {
|
||||
// int width = matrix.getWidth();
|
||||
// int height = matrix.getHeight();
|
||||
// BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
|
||||
// }
|
||||
// }
|
||||
// return image;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 生成二维码(内嵌LOGO)
|
||||
// * author zhangpeizhi
|
||||
// * @param content 内容
|
||||
// * @param logoFile LOGO文件
|
||||
// * @param needCompress 是否压缩LOGO
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String createQrCodeBase64Encode(String content, File logoFile,
|
||||
// boolean needCompress) throws Exception {
|
||||
// BufferedImage image = createImage(content, logoFile,
|
||||
// needCompress);
|
||||
//
|
||||
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
//
|
||||
// ImageIO.write(image, "jpg", outputStream);
|
||||
// Base64.Encoder encoder = Base64.getEncoder();
|
||||
// String base64String = encoder.encodeToString(outputStream.toByteArray());
|
||||
//
|
||||
// return base64String;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 生成二维码(内嵌LOGO)
|
||||
// *
|
||||
// * @param content 内容
|
||||
// * @param logoFile LOGO文件
|
||||
// * @param destPath 存放目录
|
||||
// * @param needCompress 是否压缩LOGO
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String encode(String content, File logoFile, String destPath,
|
||||
// boolean needCompress) throws Exception {
|
||||
// BufferedImage image = createImage(content, logoFile,
|
||||
// needCompress);
|
||||
// mkdirs(destPath);
|
||||
// String file = new Random().nextInt(99999999) + ".jpg";
|
||||
// ImageIO.write(image, FORMAT_NAME, new File(destPath + "/" + file));
|
||||
// return file;
|
||||
// }
|
||||
//
|
||||
// private static BufferedImage createImage(String content, File logoFile,
|
||||
// boolean needCompress) throws Exception {
|
||||
// Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
|
||||
// hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
|
||||
// hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
|
||||
// hints.put(EncodeHintType.MARGIN, 1);
|
||||
// BitMatrix bitMatrix = new MultiFormatWriter().encode(content,
|
||||
// BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints);
|
||||
// int width = bitMatrix.getWidth();
|
||||
// int height = bitMatrix.getHeight();
|
||||
// BufferedImage image = new BufferedImage(width, height,
|
||||
// BufferedImage.TYPE_INT_RGB);
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000
|
||||
// : 0xFFFFFFFF);
|
||||
// }
|
||||
// }
|
||||
// if (CmUtil.isEmpty(logoFile)) {
|
||||
// return image;
|
||||
// }
|
||||
// // 插入图片
|
||||
// insertImage(image, logoFile, needCompress);
|
||||
// return image;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
|
||||
// *
|
||||
// * @param destPath 存放目录
|
||||
// * @date 2013-12-11 上午10:16:36
|
||||
// */
|
||||
// public static void mkdirs(String destPath) {
|
||||
// File file = new File(destPath);
|
||||
// //当文件夹不存在时,mkdirs会自动创建多层目录,区别于mkdir.(mkdir如果父目录不存在则会抛出异常)
|
||||
// if (!file.exists() && !file.isDirectory()) {
|
||||
// file.mkdirs();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static class CmUtil{
|
||||
// public static boolean isEmpty(File file){
|
||||
// if (null == file || 0 == file.length() || !file.exists()) return true;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 插入LOGO
|
||||
// *
|
||||
// * @param source 二维码图片
|
||||
// * @param logoFile LOGO图片文件
|
||||
// * @param needCompress 是否压缩
|
||||
// * @throws Exception
|
||||
// */
|
||||
// private static void insertImage(BufferedImage source, File logoFile,
|
||||
// boolean needCompress) throws Exception {
|
||||
//
|
||||
// if (!logoFile.exists()) {
|
||||
// System.err.println("" + logoFile + " 该文件不存在!");
|
||||
// return;
|
||||
// }
|
||||
// Image src = ImageIO.read(logoFile);
|
||||
// int width = src.getWidth(null);
|
||||
// int height = src.getHeight(null);
|
||||
// // 压缩LOGO
|
||||
// if (needCompress) {
|
||||
// if (width > WIDTH) {
|
||||
// width = WIDTH;
|
||||
// }
|
||||
// if (height > HEIGHT) {
|
||||
// height = HEIGHT;
|
||||
// }
|
||||
// Image image = src.getScaledInstance(width, height,
|
||||
// Image.SCALE_SMOOTH);
|
||||
// BufferedImage tag = new BufferedImage(width, height,
|
||||
// BufferedImage.TYPE_INT_RGB);
|
||||
// Graphics g = tag.getGraphics();
|
||||
// // 绘制缩小后的图
|
||||
// g.drawImage(image, 0, 0, null);
|
||||
// g.dispose();
|
||||
// src = image;
|
||||
// }
|
||||
// // 插入LOGO
|
||||
// Graphics2D graph = source.createGraphics();
|
||||
// int x = (QRCODE_SIZE - width) / 2;
|
||||
// int y = (QRCODE_SIZE - height) / 2;
|
||||
// graph.drawImage(src, x, y, width, height, null);
|
||||
// Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
|
||||
// graph.setStroke(new BasicStroke(3f));
|
||||
// graph.draw(shape);
|
||||
// graph.dispose();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,48 +1,47 @@
|
|||
package cn.cecep.talroad.util;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2023-04-17 11:02
|
||||
* @Class: MsgReceiver
|
||||
* @Deseription: 停限产状态消息消费
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class StatusConsumer implements ChannelAwareMessageListener {
|
||||
|
||||
|
||||
@Override
|
||||
//@RabbitListener(queues = "status-queue")
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
// try {
|
||||
// String deviceId = new String(message.getBody());
|
||||
// BasDevice d = deviceMapper.selectById(deviceId);
|
||||
// PcFactory p = pcFactoryMapper.selectPcFactoryById(d.getFactoryId());
|
||||
//package cn.cecep.talroad.util;
|
||||
//
|
||||
// QueryWrapper<BasDeviceParam> paramWrapper = new QueryWrapper<>();
|
||||
// paramWrapper.eq("industry", d.getIndustry());
|
||||
// paramWrapper.eq("device_id", d.getDeviceId());
|
||||
// paramWrapper.eq("device_type",d.getType());
|
||||
// List<BasDeviceParam> paramList = basDeviceParamMapper.selectList(paramWrapper);
|
||||
// //拼接策略服务名称
|
||||
// String strategyName = StringUtils.upperCase(d.getIndustry() + d.getType());
|
||||
// //执行策略,处理设备状态
|
||||
// strategyFactory.getByName(strategyName).doCheckProcess(p, d, paramList);
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("MsgReceiver.onMessage##失败:" + e.getMessage());
|
||||
// } finally {
|
||||
// //ACK 手动签收消息,告诉对方消息签收成功,唯一标识ID
|
||||
// Long deliverTag = message.getMessageProperties().getDeliveryTag();
|
||||
// channel.basicAck(deliverTag, false);
|
||||
///**
|
||||
// * @Auther: cjh
|
||||
// * @Date: 2023-04-17 11:02
|
||||
// * @Class: MsgReceiver
|
||||
// * @Deseription: 停限产状态消息消费
|
||||
// * @Version V1.0
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class StatusConsumer implements ChannelAwareMessageListener {
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// //@RabbitListener(queues = "status-queue")
|
||||
// public void onMessage(Message message, Channel channel) throws Exception {
|
||||
//// try {
|
||||
//// String deviceId = new String(message.getBody());
|
||||
//// BasDevice d = deviceMapper.selectById(deviceId);
|
||||
//// PcFactory p = pcFactoryMapper.selectPcFactoryById(d.getFactoryId());
|
||||
////
|
||||
//// QueryWrapper<BasDeviceParam> paramWrapper = new QueryWrapper<>();
|
||||
//// paramWrapper.eq("industry", d.getIndustry());
|
||||
//// paramWrapper.eq("device_id", d.getDeviceId());
|
||||
//// paramWrapper.eq("device_type",d.getType());
|
||||
//// List<BasDeviceParam> paramList = basDeviceParamMapper.selectList(paramWrapper);
|
||||
//// //拼接策略服务名称
|
||||
//// String strategyName = StringUtils.upperCase(d.getIndustry() + d.getType());
|
||||
//// //执行策略,处理设备状态
|
||||
//// strategyFactory.getByName(strategyName).doCheckProcess(p, d, paramList);
|
||||
////
|
||||
//// } catch (Exception e) {
|
||||
//// log.error("MsgReceiver.onMessage##失败:" + e.getMessage());
|
||||
//// } finally {
|
||||
//// //ACK 手动签收消息,告诉对方消息签收成功,唯一标识ID
|
||||
//// Long deliverTag = message.getMessageProperties().getDeliveryTag();
|
||||
//// channel.basicAck(deliverTag, false);
|
||||
//// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
package cn.cecep.talroad.util;
|
||||
|
||||
import cn.cecep.talroad.common.core.utils.StringUtils;
|
||||
import cn.cecep.talroad.service.IBasDeviceService;
|
||||
import cn.cecep.talroad.service.strategy.StrategyFactory;
|
||||
import cn.cecep.talroad.vo.FactoryDeviceVo;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Auther: cjh
|
||||
* @Date: 2023-04-17 11:02
|
||||
* @Class: MsgReceiver
|
||||
* @Deseription: 产量统计消息消费
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class YieldConsumer implements ChannelAwareMessageListener {
|
||||
|
||||
@Autowired
|
||||
private IBasDeviceService basDeviceService;
|
||||
@Autowired
|
||||
private StrategyFactory strategyFactory;
|
||||
|
||||
@Override
|
||||
@RabbitListener(queues = "yield-queue")
|
||||
public void onMessage(Message message, Channel channel) throws Exception {
|
||||
String deviceId = new String(message.getBody());
|
||||
try {
|
||||
FactoryDeviceVo vo = basDeviceService.selectFactoryDeviceVoByDeviceId(deviceId);
|
||||
|
||||
//拼接策略服务名称
|
||||
String strategyName = StringUtils.upperCase(vo.getIndustry() + vo.getDeviceType() + vo.getDeviceType());
|
||||
log.info("开始消费者-产量统计-行业:"+vo.getIndustry()+",设备类型:"+vo.getDeviceType());
|
||||
//执行策略,处理设备状态
|
||||
strategyFactory.getByName(strategyName).doCheckProcessYield(vo);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("MsgReceiver.onMessage##设备ID:"+ deviceId+"##异常信息:"+ e.getMessage());
|
||||
} finally {
|
||||
//ACK 手动签收消息,告诉对方消息签收成功,唯一标识ID
|
||||
Long deliverTag = message.getMessageProperties().getDeliveryTag();
|
||||
channel.basicAck(deliverTag, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package cn.cecep.talroad.util;
|
||||
//
|
||||
//import cn.cecep.talroad.common.core.utils.StringUtils;
|
||||
//import cn.cecep.talroad.service.IBasDeviceService;
|
||||
//import cn.cecep.talroad.service.strategy.StrategyFactory;
|
||||
//import cn.cecep.talroad.vo.FactoryDeviceVo;
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.amqp.core.Message;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
///**
|
||||
// * @Auther: cjh
|
||||
// * @Date: 2023-04-17 11:02
|
||||
// * @Class: MsgReceiver
|
||||
// * @Deseription: 产量统计消息消费
|
||||
// * @Version V1.0
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class YieldConsumer implements ChannelAwareMessageListener {
|
||||
//
|
||||
// @Autowired
|
||||
// private IBasDeviceService basDeviceService;
|
||||
// @Autowired
|
||||
// private StrategyFactory strategyFactory;
|
||||
//
|
||||
// @Override
|
||||
// @RabbitListener(queues = "yield-queue")
|
||||
// public void onMessage(Message message, Channel channel) throws Exception {
|
||||
// String deviceId = new String(message.getBody());
|
||||
// try {
|
||||
// FactoryDeviceVo vo = basDeviceService.selectFactoryDeviceVoByDeviceId(deviceId);
|
||||
//
|
||||
// //拼接策略服务名称
|
||||
// String strategyName = StringUtils.upperCase(vo.getIndustry() + vo.getDeviceType() + vo.getDeviceType());
|
||||
// log.info("开始消费者-产量统计-行业:"+vo.getIndustry()+",设备类型:"+vo.getDeviceType());
|
||||
// //执行策略,处理设备状态
|
||||
// strategyFactory.getByName(strategyName).doCheckProcessYield(vo);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("MsgReceiver.onMessage##设备ID:"+ deviceId+"##异常信息:"+ e.getMessage());
|
||||
// } finally {
|
||||
// //ACK 手动签收消息,告诉对方消息签收成功,唯一标识ID
|
||||
// Long deliverTag = message.getMessageProperties().getDeliveryTag();
|
||||
// channel.basicAck(deliverTag, false);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 6010
|
||||
|
||||
# spring配置
|
||||
spring:
|
||||
redis:
|
||||
host: 39.100.149.153
|
||||
port: 6379
|
||||
password: abc@123@...
|
||||
# rabbitmq:
|
||||
# host: 10.0.200.121
|
||||
# port: 5672
|
||||
# username: trkj
|
||||
# password: 123@abc
|
||||
# listener:
|
||||
# simple:
|
||||
# acknowledge-mode: manual
|
||||
# concurrency: 5
|
||||
# max-concurrency: 10
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
dynamic:
|
||||
primary: master
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
maxWait: 60000
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
filters: stat,slf4j
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://39.100.149.153:5432/public?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||
username: postgres
|
||||
password: abc@123@...
|
||||
# ods:
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://10.0.200.170:5432/ts_bigdata?currentSchema=ts_accurate_emission_reduction&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||
# username: ts_bigdata
|
||||
# password: ~jLvod5s#=X}{gUigrm+w&y7.b{!
|
||||
# seata: true # 开启seata代理,开启后默认每个数据源都代理,如果某个不需要代理可单独关闭
|
||||
|
||||
|
||||
# seata配置
|
||||
seata:
|
||||
# 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启
|
||||
enabled: false
|
||||
# Seata 应用编号,默认为 ${spring.application.name}
|
||||
application-id: ${spring.application.name}
|
||||
# Seata 事务组编号,用于 TC 集群名
|
||||
tx-service-group: ${spring.application.name}-group
|
||||
# 关闭自动代理
|
||||
enable-auto-data-source-proxy: false
|
||||
# 服务配置项
|
||||
service:
|
||||
# 虚拟组和分组的映射
|
||||
vgroup-mapping:
|
||||
ruoyi-system-group: default
|
||||
config:
|
||||
type: nacos
|
||||
nacos:
|
||||
serverAddr: 10.0.200.93:8848
|
||||
group: SEATA_GROUP
|
||||
namespace:
|
||||
registry:
|
||||
type: nacos
|
||||
nacos:
|
||||
application: seata-server
|
||||
server-addr: 10.0.200.93:8848
|
||||
namespace:
|
||||
|
||||
# mybatis配置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:mapper/**/*.xml
|
||||
type-aliases-package: cn.cecep.talroad.**.mapper
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: delFlag
|
||||
logic-delete-value: 2 # 逻辑已删除值
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志
|
||||
call-setters-on-nulls: true
|
||||
#ys:
|
||||
# appKey: 9fb9d26fa9a447c5802af954fb852077
|
||||
# secret: ae77423d6c0d42698f9807b5726558a6
|
||||
#amproblem:
|
||||
# zf:
|
||||
# url: http://106.119.195.117:7080/qyzhgk/jgzfDataTask/callbackResult
|
||||
#url:
|
||||
# threeSupervision: http://106.119.195.117:7080/qyzhgk
|
|
@ -4,23 +4,23 @@ spring:
|
|||
name: szhpt-fixed-task
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 10.0.200.93:8848
|
||||
namespace: szhpt-dev
|
||||
# 本地开发不注册到注册中心
|
||||
#register-enabled: false
|
||||
config:
|
||||
name: ${spring.application.name}
|
||||
# 配置中心地址
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
# 配置文件格式
|
||||
file-extension: yaml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-pub.${spring.cloud.nacos.config.file-extension}
|
||||
- application-pub-db.${spring.cloud.nacos.config.file-extension}
|
||||
- application-swagger-ui.${spring.cloud.nacos.config.file-extension}
|
||||
namespace: ${spring.cloud.nacos.discovery.namespace}
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# # 服务注册地址
|
||||
# server-addr: 10.0.200.93:8848
|
||||
# namespace: szhpt-dev
|
||||
# # 本地开发不注册到注册中心
|
||||
# #register-enabled: false
|
||||
# config:
|
||||
# name: ${spring.application.name}
|
||||
# # 配置中心地址
|
||||
# server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
# # 配置文件格式
|
||||
# file-extension: yaml
|
||||
# # 共享配置
|
||||
# shared-configs:
|
||||
# - application-pub.${spring.cloud.nacos.config.file-extension}
|
||||
# - application-pub-db.${spring.cloud.nacos.config.file-extension}
|
||||
# - application-swagger-ui.${spring.cloud.nacos.config.file-extension}
|
||||
# namespace: ${spring.cloud.nacos.discovery.namespace}
|
||||
|
|
Loading…
Reference in New Issue