Your commit message
This commit is contained in:
parent
4d56117b48
commit
7d7ae23a42
@ -37,16 +37,16 @@
|
||||
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.lettuce</groupId>
|
||||
<artifactId>lettuce-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>io.lettuce</groupId>-->
|
||||
<!-- <artifactId>lettuce-core</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
@ -140,11 +140,11 @@
|
||||
<artifactId>caffeine</artifactId>
|
||||
<version>2.5.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>redis.clients</groupId>-->
|
||||
<!-- <artifactId>jedis</artifactId>-->
|
||||
<!-- <version>2.9.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
|
||||
|
||||
@ -1,87 +1,87 @@
|
||||
package com.weiqi.mis;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Created by sky on 2019/7/24.
|
||||
*/
|
||||
|
||||
|
||||
@Configuration
|
||||
//@PropertySource("classpath:redis.properties")
|
||||
public class RedisUtil {
|
||||
|
||||
@Value("${spring.redis.host:192.168.0.1}")
|
||||
private String host;
|
||||
|
||||
@Value("${spring.redis.port:6793}")
|
||||
private int port;
|
||||
|
||||
@Value("${spring.redis.timeout:5000}")
|
||||
private int timeout;
|
||||
|
||||
@Value("${spring.redis.jedis.pool.max-idle:1}")
|
||||
private int maxIdle;
|
||||
|
||||
@Value("${spring.redis.jedis.pool.max-wait:0}")
|
||||
private long maxWaitMillis;
|
||||
|
||||
@Value("${spring.redis.block-when-exhausted:0}")
|
||||
private boolean blockWhenExhausted;
|
||||
|
||||
@Bean
|
||||
public JedisPool redisPoolFactory() throws Exception{
|
||||
|
||||
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
||||
jedisPoolConfig.setMaxIdle(maxIdle);
|
||||
jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
|
||||
// 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
|
||||
jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted);
|
||||
// 是否启用pool的jmx管理功能, 默认true
|
||||
jedisPoolConfig.setJmxEnabled(true);
|
||||
JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
|
||||
return jedisPool;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static JedisPool pool=null;
|
||||
@Autowired
|
||||
void init(JedisPool _pool)
|
||||
{
|
||||
pool=_pool;
|
||||
}
|
||||
public static void call(Consumer<Jedis> fun)
|
||||
{
|
||||
try (Jedis jedis = pool.getResource()) {
|
||||
fun.accept(jedis);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static final String SCRIPT="local t= redis.call('time')[1]\n return redis.call('incrby',KEYS[1]..':'..KEYS[2]..':'..t,ARGV[1])";
|
||||
public static Long qpsOK(String key, Integer value) {
|
||||
try (Jedis jedis = pool.getResource()) {
|
||||
return (Long) jedis.eval(SCRIPT,2,"incrOK",key, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
public static Long qpsERROR(String key, Integer value) {
|
||||
try (Jedis jedis = pool.getResource()) {
|
||||
return (Long) jedis.eval(SCRIPT,2,"incrERROR",key, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//package com.weiqi.mis;
|
||||
//
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.context.annotation.PropertySource;
|
||||
//import redis.clients.jedis.Jedis;
|
||||
//import redis.clients.jedis.JedisPool;
|
||||
//import redis.clients.jedis.JedisPoolConfig;
|
||||
//
|
||||
//import java.util.function.Consumer;
|
||||
//
|
||||
///**
|
||||
// * Created by sky on 2019/7/24.
|
||||
// */
|
||||
//
|
||||
//
|
||||
//@Configuration
|
||||
////@PropertySource("classpath:redis.properties")
|
||||
//public class RedisUtil {
|
||||
//
|
||||
// @Value("${spring.redis.host:192.168.0.1}")
|
||||
// private String host;
|
||||
//
|
||||
// @Value("${spring.redis.port:6793}")
|
||||
// private int port;
|
||||
//
|
||||
// @Value("${spring.redis.timeout:5000}")
|
||||
// private int timeout;
|
||||
//
|
||||
// @Value("${spring.redis.jedis.pool.max-idle:1}")
|
||||
// private int maxIdle;
|
||||
//
|
||||
// @Value("${spring.redis.jedis.pool.max-wait:0}")
|
||||
// private long maxWaitMillis;
|
||||
//
|
||||
// @Value("${spring.redis.block-when-exhausted:0}")
|
||||
// private boolean blockWhenExhausted;
|
||||
//
|
||||
// @Bean
|
||||
// public JedisPool redisPoolFactory() throws Exception{
|
||||
//
|
||||
// JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
|
||||
// jedisPoolConfig.setMaxIdle(maxIdle);
|
||||
// jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
|
||||
// // 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true
|
||||
// jedisPoolConfig.setBlockWhenExhausted(blockWhenExhausted);
|
||||
// // 是否启用pool的jmx管理功能, 默认true
|
||||
// jedisPoolConfig.setJmxEnabled(true);
|
||||
// JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
|
||||
// return jedisPool;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static JedisPool pool=null;
|
||||
// @Autowired
|
||||
// void init(JedisPool _pool)
|
||||
// {
|
||||
// pool=_pool;
|
||||
// }
|
||||
// public static void call(Consumer<Jedis> fun)
|
||||
// {
|
||||
// try (Jedis jedis = pool.getResource()) {
|
||||
// fun.accept(jedis);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// private static final String SCRIPT="local t= redis.call('time')[1]\n return redis.call('incrby',KEYS[1]..':'..KEYS[2]..':'..t,ARGV[1])";
|
||||
// public static Long qpsOK(String key, Integer value) {
|
||||
// try (Jedis jedis = pool.getResource()) {
|
||||
// return (Long) jedis.eval(SCRIPT,2,"incrOK",key, String.valueOf(value));
|
||||
// }
|
||||
// }
|
||||
// public static Long qpsERROR(String key, Integer value) {
|
||||
// try (Jedis jedis = pool.getResource()) {
|
||||
// return (Long) jedis.eval(SCRIPT,2,"incrERROR",key, String.valueOf(value));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
//
|
||||
//
|
||||
|
||||
477
car-dao/src/main/java/com/weiqi/mis/bo/WxXrPemsOrderResult.java
Normal file
477
car-dao/src/main/java/com/weiqi/mis/bo/WxXrPemsOrderResult.java
Normal file
@ -0,0 +1,477 @@
|
||||
package com.weiqi.mis.bo;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName WxXrPemsOrderResult
|
||||
* @Description 订单列表
|
||||
* @createTime 2024-09-22 23:48:00
|
||||
*/
|
||||
|
||||
public class WxXrPemsOrderResult {
|
||||
private int count;
|
||||
private List<WxXrPemsOrderItemResult> wxXrPemsOrderItemResultList;
|
||||
|
||||
public List<WxXrPemsOrderItemResult> getWxXrPemsOrderItemResultList() {
|
||||
return wxXrPemsOrderItemResultList == null ? new ArrayList<>() : wxXrPemsOrderItemResultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* **************低怠速检测数据定义:**************
|
||||
* CO检测值 超标级别 数据定义
|
||||
* [0,0.24) A 较低排放
|
||||
* [0.24,0.40) B 临界超标
|
||||
* [0.40,1.6) C 一般超标
|
||||
* [1.6,∞) D 严重超标
|
||||
*
|
||||
* HC检测值 超标级别 数据定义
|
||||
* [0,24) A 较低排放
|
||||
* [24,40) B 临界超标
|
||||
* [40,160) C 一般超标
|
||||
* [160,∞) D 严重超标
|
||||
*
|
||||
* NOX检测值 超标级别 数据定义
|
||||
* [0,16) A 较低排放
|
||||
* [16,20) B 临界超标
|
||||
* [20,60) C 一般超标
|
||||
* [60,∞) D 严重超标
|
||||
*
|
||||
* λ检测值 数值分类 数据定义
|
||||
* [0,0.9) R3 过浓
|
||||
* [0.9,0.95) R2 偏浓
|
||||
* [0.95,0.98) R1 较浓
|
||||
* [0.98,1.03) N 正常
|
||||
* [1.03,1.05) L1 较稀
|
||||
* [1.05,∞) L2 偏稀
|
||||
*
|
||||
* **************高怠速检测数据定义:**************
|
||||
*
|
||||
* CO检测值 超标级别 数据定义
|
||||
* [0,0.18) A 较低排放
|
||||
* [0.18,0.30) B 临界超标
|
||||
* [0.30,1.2) C 一般超标
|
||||
* [1.2,∞) D 严重超标
|
||||
*
|
||||
* HC检测值 超标级别 数据定义
|
||||
* [0,18) A 较低排放
|
||||
* [18,30) B 临界超标
|
||||
* [30,120) C 一般超标
|
||||
* [120,∞) D 严重超标
|
||||
*
|
||||
* NOX检测值 超标级别 数据定义
|
||||
* [0,24) A 较低排放
|
||||
* [24,30) B 临界超标
|
||||
* [30,90) C 一般超标
|
||||
* [90,∞) D 严重超标
|
||||
*
|
||||
* λ检测值 数值分类 数据定义
|
||||
* [0,0.9) R3 过浓
|
||||
* [0.9,0.95) R2 偏浓
|
||||
* [0.95,0.98) R1 较浓
|
||||
* [0.98,1.03) N 正常
|
||||
* [1.03,1.05) L1 较稀
|
||||
* [1.05,∞) L2 偏稀
|
||||
* */
|
||||
|
||||
public static class WxXrPemsOrderItemResult{
|
||||
/**
|
||||
* id
|
||||
* */
|
||||
private Integer id;
|
||||
/**
|
||||
* 工单号
|
||||
* */
|
||||
private String orderNo;
|
||||
/**
|
||||
* 车辆照片
|
||||
* */
|
||||
private String vehicleSrc;
|
||||
/**
|
||||
* 车牌号
|
||||
* */
|
||||
private String plateNumber;
|
||||
/**
|
||||
* 车型名称
|
||||
* */
|
||||
private String vehicleType;
|
||||
/**
|
||||
* 检测时间 HH-MM-DD hh:mm
|
||||
* */
|
||||
private String checkUpDateTime;
|
||||
/**
|
||||
* 最后一位检修员名称
|
||||
* */
|
||||
private String pemsUserName;
|
||||
/**
|
||||
* 订单状态
|
||||
* 1 未处理
|
||||
* 2 检测中
|
||||
* 4 检测完成
|
||||
* */
|
||||
private int status;
|
||||
/**
|
||||
* 订单状态
|
||||
* 1 未处理
|
||||
* 2 检测中
|
||||
* 4 检测完成
|
||||
* */
|
||||
private String orderStatus;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getVehicleSrc() {
|
||||
return vehicleSrc;
|
||||
}
|
||||
|
||||
public void setVehicleSrc(String vehicleSrc) {
|
||||
this.vehicleSrc = vehicleSrc;
|
||||
}
|
||||
|
||||
public String getPlateNumber() {
|
||||
return plateNumber;
|
||||
}
|
||||
|
||||
public void setPlateNumber(String plateNumber) {
|
||||
this.plateNumber = plateNumber;
|
||||
}
|
||||
|
||||
public String getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(String vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
public String getCheckUpDateTime() {
|
||||
return checkUpDateTime;
|
||||
}
|
||||
|
||||
public void setCheckUpDateTime(String checkUpDateTime) {
|
||||
this.checkUpDateTime = checkUpDateTime;
|
||||
}
|
||||
|
||||
public String getPemsUserName() {
|
||||
return pemsUserName;
|
||||
}
|
||||
|
||||
public void setPemsUserName(String pemsUserName) {
|
||||
this.pemsUserName = pemsUserName;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getOrderStatus() {
|
||||
return orderStatus;
|
||||
}
|
||||
|
||||
public void setOrderStatus(String orderStatus) {
|
||||
this.orderStatus = orderStatus;
|
||||
}
|
||||
|
||||
public double gethLambda() {
|
||||
return hLambda;
|
||||
}
|
||||
|
||||
public void sethLambda(double hLambda) {
|
||||
this.hLambda = hLambda;
|
||||
}
|
||||
|
||||
public void sethLambdaDetection(String hLambdaDetection) {
|
||||
this.hLambdaDetection = hLambdaDetection;
|
||||
}
|
||||
|
||||
public double gethCO() {
|
||||
return hCO;
|
||||
}
|
||||
|
||||
public void sethCO(double hCO) {
|
||||
this.hCO = hCO;
|
||||
}
|
||||
|
||||
public void sethCODetection(String hCODetection) {
|
||||
this.hCODetection = hCODetection;
|
||||
}
|
||||
|
||||
public double gethHC() {
|
||||
return hHC;
|
||||
}
|
||||
|
||||
public void sethHC(double hHC) {
|
||||
this.hHC = hHC;
|
||||
}
|
||||
|
||||
public void sethHCDetection(String hHCDetection) {
|
||||
this.hHCDetection = hHCDetection;
|
||||
}
|
||||
|
||||
public double getlLambda() {
|
||||
return lLambda;
|
||||
}
|
||||
|
||||
public void setlLambda(double lLambda) {
|
||||
this.lLambda = lLambda;
|
||||
}
|
||||
|
||||
public void setlLambdaDetection(String lLambdaDetection) {
|
||||
this.lLambdaDetection = lLambdaDetection;
|
||||
}
|
||||
|
||||
public double getlCO() {
|
||||
return lCO;
|
||||
}
|
||||
|
||||
public void setlCO(double lCO) {
|
||||
this.lCO = lCO;
|
||||
}
|
||||
|
||||
public void setlCODetection(String lCODetection) {
|
||||
this.lCODetection = lCODetection;
|
||||
}
|
||||
|
||||
public double getlHC() {
|
||||
return lHC;
|
||||
}
|
||||
|
||||
public void setlHC(double lHC) {
|
||||
this.lHC = lHC;
|
||||
}
|
||||
|
||||
public void setlHCDetection(String lHCDetection) {
|
||||
this.lHCDetection = lHCDetection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 高怠速——Lambda
|
||||
* */
|
||||
private double hLambda;
|
||||
private String hLambdaDetection;
|
||||
|
||||
// /**
|
||||
// * 高怠速——O2
|
||||
// * */
|
||||
// private double categoryHighO2;
|
||||
/**
|
||||
* 高怠速——CO
|
||||
* */
|
||||
private double hCO;
|
||||
private String hCODetection;
|
||||
// /**
|
||||
// * 高怠速——CO2
|
||||
// * */
|
||||
// private double categoryHighCO2;
|
||||
/**
|
||||
* 高怠速——HC
|
||||
* */
|
||||
private double hHC;
|
||||
private String hHCDetection;
|
||||
// /**
|
||||
// * 高怠速——NO
|
||||
// * */
|
||||
// private double categoryHighNO;
|
||||
|
||||
|
||||
/**
|
||||
* 低怠速——Lambda
|
||||
* */
|
||||
private double lLambda;
|
||||
/**
|
||||
* 低怠速——Lambda检测结果
|
||||
* */
|
||||
private String lLambdaDetection;
|
||||
// /**
|
||||
// * 低怠速——O2
|
||||
// * */
|
||||
// private double categoryLowO2;
|
||||
/**
|
||||
* 低怠速——CO
|
||||
* */
|
||||
private double lCO;
|
||||
/**
|
||||
* 低怠速——CO检测结果
|
||||
* */
|
||||
private String lCODetection;
|
||||
// /**
|
||||
// * 低怠速——CO2
|
||||
// * */
|
||||
// private double categoryLowCO2;
|
||||
/**
|
||||
* 低怠速——HC
|
||||
* */
|
||||
private double lHC;
|
||||
/**
|
||||
* 低怠速——HC检测结果
|
||||
* */
|
||||
private String lHCDetection;
|
||||
// /**
|
||||
// * 低怠速——NO
|
||||
// * */
|
||||
// private double categoryLowNO;
|
||||
|
||||
|
||||
/**
|
||||
* 高怠速——Lambda检测结果
|
||||
* * λ检测值 数值分类 数据定义
|
||||
* * [0,0.9) R3 过浓
|
||||
* * [0.9,0.95) R2 偏浓
|
||||
* * [0.95,0.98) R1 较浓
|
||||
* * [0.98,1.03) N 正常
|
||||
* * [1.03,1.05) L1 较稀
|
||||
* * [1.05,∞) L2 偏稀
|
||||
* */
|
||||
public String gethLambdaDetection() {
|
||||
List<String> listMap = new ArrayList<>();
|
||||
listMap.add("0,0.9,λ过浓");
|
||||
listMap.add("0.9,0.95,λ偏浓");
|
||||
listMap.add("0.95,0.98,λ较浓");
|
||||
listMap.add("0.98,1.03,λ正常");
|
||||
listMap.add("1.03,1.05,λ较稀");
|
||||
listMap.add("1.05,10000000,λ偏稀");
|
||||
String value = getText(listMap, hLambda);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 高怠速——CO检测结果
|
||||
* * CO检测值 超标级别 数据定义
|
||||
* * [0,0.18) A 较低排放
|
||||
* * [0.18,0.30) B 临界超标
|
||||
* * [0.30,1.2) C 一般超标
|
||||
* * [1.2,∞) D 严重超标
|
||||
* */
|
||||
public String gethCODetection() {
|
||||
List<String> listMap = new ArrayList<>();
|
||||
listMap.add("0,0.18,CO较低排放");
|
||||
listMap.add("0.18,0.30,CO临界超标");
|
||||
listMap.add("0.30,1.2,CO一般超标");
|
||||
listMap.add("1.2,10000000,CO严重超标");
|
||||
String value = getText(listMap, hCO);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 高怠速——HC检测结果
|
||||
* * HC检测值 超标级别 数据定义
|
||||
* * [0,18) A 较低排放
|
||||
* * [18,30) B 临界超标
|
||||
* * [30,120) C 一般超标
|
||||
* * [120,∞) D 严重超标
|
||||
* */
|
||||
public String gethHCDetection() {
|
||||
List<String> listMap = new ArrayList<>();
|
||||
listMap.add("0,18,HC较低排放");
|
||||
listMap.add("18,30,HC临界超标");
|
||||
listMap.add("30,120,HC一般超标");
|
||||
listMap.add("120,10000000,HC严重超标");
|
||||
String value = getText(listMap, hHC);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* λ检测值 数值分类 数据定义
|
||||
* [0,0.9) R3 过浓
|
||||
* [0.9,0.95) R2 偏浓
|
||||
* [0.95,0.98) R1 较浓
|
||||
* [0.98,1.03) N 正常
|
||||
* [1.03,1.05) L1 较稀
|
||||
* [1.05,∞) L2 偏稀
|
||||
* */
|
||||
public String getlLambdaDetection() {
|
||||
List<String> listMap = new ArrayList<>();
|
||||
listMap.add("0,0.9,λ过浓");
|
||||
listMap.add("0.9,0.95,λ偏浓");
|
||||
listMap.add("0.95,0.98,λ较浓");
|
||||
listMap.add("0.98,1.03,λ正常");
|
||||
listMap.add("1.03,1.05,λ较稀");
|
||||
listMap.add("1.05,10000000,λ偏稀");
|
||||
String value = getText(listMap, lLambda);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* CO检测值 超标级别 数据定义
|
||||
* [0,0.24) A 较低排放
|
||||
* [0.24,0.40) B 临界超标
|
||||
* [0.40,1.6) C 一般超标
|
||||
* [1.6,∞) D 严重超标
|
||||
* */
|
||||
public String getlCODetection() {
|
||||
List<String> listMap = new ArrayList<>();
|
||||
listMap.add("0,0.24,CO较低排放");
|
||||
listMap.add("0.24,0.40,CO临界超标");
|
||||
listMap.add("0.40,1.6,CO一般超标");
|
||||
listMap.add("1.6,10000000,CO严重超标");
|
||||
String value = getText(listMap, lCO);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* HC检测值 超标级别 数据定义
|
||||
* [0,24) A 较低排放
|
||||
* [24,40) B 临界超标
|
||||
* [40,160) C 一般超标
|
||||
* [160,∞) D 严重超标
|
||||
* */
|
||||
public String getlHCDetection() {
|
||||
List<String> listMap = new ArrayList<>();
|
||||
listMap.add("0,24,HC较低排放");
|
||||
listMap.add("24,40,HC临界超标");
|
||||
listMap.add("40,160,HC一般超标");
|
||||
listMap.add("160,10000000,HC严重超标");
|
||||
String value = getText(listMap, lHC);
|
||||
return value;
|
||||
}
|
||||
|
||||
private String getText(List<String> listMap, double value){
|
||||
if(Double.compare(value, 0) == 0){
|
||||
return "暂无";
|
||||
}
|
||||
for(int i=0; i<listMap.size(); i++){
|
||||
String[] arr = listMap.get(i).split(",");
|
||||
double min = Double.valueOf(arr[0]);
|
||||
double max = Double.valueOf(arr[1]);
|
||||
String text = arr[2];
|
||||
int comparisonResult1 = Double.compare(value, min);
|
||||
int comparisonResult2 = Double.compare(value, max);
|
||||
if(comparisonResult1 >= 0 && comparisonResult2 == -1){
|
||||
return text;
|
||||
}
|
||||
}
|
||||
return "暂无";
|
||||
}
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public void setWxXrPemsOrderItemResultList(List<WxXrPemsOrderItemResult> wxXrPemsOrderItemResultList) {
|
||||
this.wxXrPemsOrderItemResultList = wxXrPemsOrderItemResultList;
|
||||
}
|
||||
}
|
||||
145
car-dao/src/main/java/com/weiqi/mis/domain/WxSgPolluteSds.java
Normal file
145
car-dao/src/main/java/com/weiqi/mis/domain/WxSgPolluteSds.java
Normal file
@ -0,0 +1,145 @@
|
||||
package com.weiqi.mis.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class WxSgPolluteSds {
|
||||
private Integer id;
|
||||
|
||||
private Double lambda;
|
||||
|
||||
private Double o2;
|
||||
|
||||
private Double co;
|
||||
|
||||
private Double co2;
|
||||
|
||||
private Double hc;
|
||||
|
||||
private Double no;
|
||||
|
||||
private Integer category;
|
||||
|
||||
private Integer wxOrderId;
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Double getLambda() {
|
||||
return lambda;
|
||||
}
|
||||
|
||||
public void setLambda(Double lambda) {
|
||||
this.lambda = lambda;
|
||||
}
|
||||
|
||||
public Double getO2() {
|
||||
return o2;
|
||||
}
|
||||
|
||||
public void setO2(Double o2) {
|
||||
this.o2 = o2;
|
||||
}
|
||||
|
||||
public Double getCo() {
|
||||
return co;
|
||||
}
|
||||
|
||||
public void setCo(Double co) {
|
||||
this.co = co;
|
||||
}
|
||||
|
||||
public Double getCo2() {
|
||||
return co2;
|
||||
}
|
||||
|
||||
public void setCo2(Double co2) {
|
||||
this.co2 = co2;
|
||||
}
|
||||
|
||||
public Double getHc() {
|
||||
return hc;
|
||||
}
|
||||
|
||||
public void setHc(Double hc) {
|
||||
this.hc = hc;
|
||||
}
|
||||
|
||||
public Double getNo() {
|
||||
return no;
|
||||
}
|
||||
|
||||
public void setNo(Double no) {
|
||||
this.no = no;
|
||||
}
|
||||
|
||||
public Integer getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(Integer category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Integer getWxOrderId() {
|
||||
return wxOrderId;
|
||||
}
|
||||
|
||||
public void setWxOrderId(Integer wxOrderId) {
|
||||
this.wxOrderId = wxOrderId;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy == null ? null : createBy.trim();
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy == null ? null : updateBy.trim();
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,23 @@
|
||||
package com.weiqi.mis.mapper;
|
||||
|
||||
import com.weiqi.mis.domain.WxSgPolluteSds;
|
||||
import com.weiqi.mis.domain.WxSgPolluteSdsExample;
|
||||
import java.util.List;
|
||||
|
||||
public interface WxSgPolluteSdsMapper {
|
||||
int countByExample(WxSgPolluteSdsExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(WxSgPolluteSds record);
|
||||
|
||||
int insertSelective(WxSgPolluteSds record);
|
||||
|
||||
List<WxSgPolluteSds> selectByExample(WxSgPolluteSdsExample example);
|
||||
|
||||
WxSgPolluteSds selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(WxSgPolluteSds record);
|
||||
|
||||
int updateByPrimaryKey(WxSgPolluteSds record);
|
||||
}
|
||||
@ -0,0 +1,249 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.weiqi.mis.mapper.WxSgPolluteSdsMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.weiqi.mis.domain.WxSgPolluteSds" >
|
||||
<id column="id" property="id" jdbcType="INTEGER" />
|
||||
<result column="lambda" property="lambda" jdbcType="DOUBLE" />
|
||||
<result column="O2" property="o2" jdbcType="DOUBLE" />
|
||||
<result column="CO" property="co" jdbcType="DOUBLE" />
|
||||
<result column="CO2" property="co2" jdbcType="DOUBLE" />
|
||||
<result column="HC" property="hc" jdbcType="DOUBLE" />
|
||||
<result column="NO" property="no" jdbcType="DOUBLE" />
|
||||
<result column="category" property="category" jdbcType="INTEGER" />
|
||||
<result column="wx_order_id" property="wxOrderId" jdbcType="INTEGER" />
|
||||
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
|
||||
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause" >
|
||||
<where >
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or" >
|
||||
<if test="criteria.valid" >
|
||||
<trim prefix="(" suffix=")" prefixOverrides="and" >
|
||||
<foreach collection="criteria.criteria" item="criterion" >
|
||||
<choose >
|
||||
<when test="criterion.noValue" >
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue" >
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue" >
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue" >
|
||||
and ${criterion.condition}
|
||||
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List" >
|
||||
id, lambda, O2, CO, CO2, HC, NO, category, wx_order_id, del_flag, create_by, create_time,
|
||||
update_by, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.weiqi.mis.domain.WxSgPolluteSdsExample" >
|
||||
select
|
||||
<if test="distinct" >
|
||||
distinct
|
||||
</if>
|
||||
'true' as QUERYID,
|
||||
<include refid="Base_Column_List" />
|
||||
from wx_sg_pollute_sds
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null" >
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from wx_sg_pollute_sds
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
||||
delete from wx_sg_pollute_sds
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.weiqi.mis.domain.WxSgPolluteSds" >
|
||||
insert into wx_sg_pollute_sds (id, lambda, O2,
|
||||
CO, CO2, HC, NO,
|
||||
category, wx_order_id, del_flag,
|
||||
create_by, create_time, update_by,
|
||||
update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{lambda,jdbcType=DOUBLE}, #{o2,jdbcType=DOUBLE},
|
||||
#{co,jdbcType=DOUBLE}, #{co2,jdbcType=DOUBLE}, #{hc,jdbcType=DOUBLE}, #{no,jdbcType=DOUBLE},
|
||||
#{category,jdbcType=INTEGER}, #{wxOrderId,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER},
|
||||
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
|
||||
#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.weiqi.mis.domain.WxSgPolluteSds" >
|
||||
insert into wx_sg_pollute_sds
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
id,
|
||||
</if>
|
||||
<if test="lambda != null" >
|
||||
lambda,
|
||||
</if>
|
||||
<if test="o2 != null" >
|
||||
O2,
|
||||
</if>
|
||||
<if test="co != null" >
|
||||
CO,
|
||||
</if>
|
||||
<if test="co2 != null" >
|
||||
CO2,
|
||||
</if>
|
||||
<if test="hc != null" >
|
||||
HC,
|
||||
</if>
|
||||
<if test="no != null" >
|
||||
NO,
|
||||
</if>
|
||||
<if test="category != null" >
|
||||
category,
|
||||
</if>
|
||||
<if test="wxOrderId != null" >
|
||||
wx_order_id,
|
||||
</if>
|
||||
<if test="delFlag != null" >
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="createBy != null" >
|
||||
create_by,
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateBy != null" >
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="lambda != null" >
|
||||
#{lambda,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="o2 != null" >
|
||||
#{o2,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="co != null" >
|
||||
#{co,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="co2 != null" >
|
||||
#{co2,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="hc != null" >
|
||||
#{hc,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="no != null" >
|
||||
#{no,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="category != null" >
|
||||
#{category,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="wxOrderId != null" >
|
||||
#{wxOrderId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="delFlag != null" >
|
||||
#{delFlag,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createBy != null" >
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null" >
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.weiqi.mis.domain.WxSgPolluteSdsExample" resultType="java.lang.Integer" >
|
||||
select count(*) from wx_sg_pollute_sds
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.weiqi.mis.domain.WxSgPolluteSds" >
|
||||
update wx_sg_pollute_sds
|
||||
<set >
|
||||
<if test="lambda != null" >
|
||||
lambda = #{lambda,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="o2 != null" >
|
||||
O2 = #{o2,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="co != null" >
|
||||
CO = #{co,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="co2 != null" >
|
||||
CO2 = #{co2,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="hc != null" >
|
||||
HC = #{hc,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="no != null" >
|
||||
NO = #{no,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="category != null" >
|
||||
category = #{category,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="wxOrderId != null" >
|
||||
wx_order_id = #{wxOrderId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="delFlag != null" >
|
||||
del_flag = #{delFlag,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createBy != null" >
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null" >
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null" >
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null" >
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.weiqi.mis.domain.WxSgPolluteSds" >
|
||||
update wx_sg_pollute_sds
|
||||
set lambda = #{lambda,jdbcType=DOUBLE},
|
||||
O2 = #{o2,jdbcType=DOUBLE},
|
||||
CO = #{co,jdbcType=DOUBLE},
|
||||
CO2 = #{co2,jdbcType=DOUBLE},
|
||||
HC = #{hc,jdbcType=DOUBLE},
|
||||
NO = #{no,jdbcType=DOUBLE},
|
||||
category = #{category,jdbcType=INTEGER},
|
||||
wx_order_id = #{wxOrderId,jdbcType=INTEGER},
|
||||
del_flag = #{delFlag,jdbcType=INTEGER},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -4,14 +4,16 @@ import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@MapperScan(basePackages = { "com.weiqi.mis.mapper"})
|
||||
@MapperScan(basePackages = {"com.weiqi.mis.mapper"})
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
public class MisApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MisApplication.class, args);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MisApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
package com.weiqi.mis.config;
|
||||
|
||||
import com.weiqi.mis.DateUtil;
|
||||
import com.xxl.job.core.context.XxlJobContext;
|
||||
import com.xxl.job.core.log.XxlJobFileAppender;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Date;
|
||||
|
||||
public class JobLog {
|
||||
private static final Logger logger = LoggerFactory.getLogger("xxl-job logger");
|
||||
|
||||
public static void info(String appendLog) {
|
||||
String formatAppendLog = formatLog(appendLog);
|
||||
if (XxlJobContext.getXxlJobContext() == null) {
|
||||
logger.info(appendLog);
|
||||
return;
|
||||
}
|
||||
String jobLogFileName = XxlJobContext.getXxlJobContext() == null ? null : XxlJobContext.getXxlJobContext().getJobLogFileName();
|
||||
if (jobLogFileName != null && jobLogFileName.trim().length() != 0) {
|
||||
XxlJobFileAppender.appendLog(jobLogFileName, formatAppendLog);
|
||||
logger.info("[{}]: {}", jobLogFileName, appendLog);
|
||||
} else {
|
||||
logger.info(appendLog);
|
||||
}
|
||||
}
|
||||
|
||||
public static void warn(String appendLog) {
|
||||
String formatAppendLog = formatLog(appendLog);
|
||||
if (XxlJobContext.getXxlJobContext() == null) {
|
||||
logger.warn(appendLog);
|
||||
return;
|
||||
}
|
||||
String jobLogFileName = XxlJobContext.getXxlJobContext().getJobLogFileName();
|
||||
if (jobLogFileName != null && jobLogFileName.trim().length() != 0) {
|
||||
XxlJobFileAppender.appendLog(jobLogFileName, formatAppendLog);
|
||||
logger.warn("[{}]: {}", jobLogFileName, appendLog);
|
||||
} else {
|
||||
logger.warn(appendLog);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(String appendLog, Throwable e) {
|
||||
String formatAppendLog = formatLog(appendLog);
|
||||
if (XxlJobContext.getXxlJobContext() == null) {
|
||||
logger.error(appendLog, e);
|
||||
return;
|
||||
}
|
||||
String jobLogFileName = XxlJobContext.getXxlJobContext().getJobLogFileName();
|
||||
if (jobLogFileName != null && jobLogFileName.trim().length() != 0) {
|
||||
XxlJobFileAppender.appendLog(jobLogFileName, formatAppendLog);
|
||||
StringWriter out = new StringWriter();
|
||||
PrintWriter pr = new PrintWriter(out);
|
||||
e.printStackTrace(pr);
|
||||
XxlJobFileAppender.appendLog(jobLogFileName, out.toString());
|
||||
|
||||
logger.error("[{}]: {}", jobLogFileName, appendLog, e);
|
||||
} else {
|
||||
logger.error(appendLog, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String formatLog(String appendLog) {
|
||||
StackTraceElement[] stackTraceElements = (new Throwable()).getStackTrace();
|
||||
StackTraceElement callInfo = stackTraceElements[1];
|
||||
String formatLocalDateTime = DateUtil.Date2String (new Date(),"yyyy-MM-dd HH:mm:ss");
|
||||
return formatLocalDateTime + " [" +
|
||||
callInfo.getClassName() + "]-[" +
|
||||
callInfo.getMethodName() + "]-[" +
|
||||
callInfo.getLineNumber() + "]-[" +
|
||||
Thread.currentThread().getName() + "] " +
|
||||
(appendLog != null ? appendLog : "");
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
package com.weiqi.mis.config;
|
||||
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@ConditionalOnProperty(name = "xxl.job.enable", havingValue = "true", matchIfMissing = false)
|
||||
@Configuration
|
||||
public class XxlJobConfig {
|
||||
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
|
||||
|
||||
@Value("${xxl.job.admin.addresses}")
|
||||
private String adminAddresses;
|
||||
|
||||
@Value("${xxl.job.executor.appname}")
|
||||
private String appName;
|
||||
|
||||
@Value("${xxl.job.executor.bindip}")
|
||||
private String ip;
|
||||
|
||||
@Value("${xxl.job.executor.port}")
|
||||
private int port;
|
||||
|
||||
@Value("${xxl.job.accessToken}")
|
||||
private String accessToken;
|
||||
|
||||
@Value("${xxl.job.executor.logpath}")
|
||||
private String logPath;
|
||||
|
||||
@Value("${xxl.job.executor.logretentiondays}")
|
||||
private int logRetentionDays;
|
||||
|
||||
|
||||
@Bean
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
xxlJobSpringExecutor.setAppname(appName);
|
||||
xxlJobSpringExecutor.setIp(ip);
|
||||
xxlJobSpringExecutor.setPort(port);
|
||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
xxlJobSpringExecutor.setLogPath(logPath);
|
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.weiqi.mis.contorller;
|
||||
|
||||
import com.weiqi.mis.MsgService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 项目启动后执行一次
|
||||
*
|
||||
* @author createTime 2024-10-07 22:37
|
||||
**/
|
||||
@Component
|
||||
public class AppRunnerController implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
MsgService msgService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
|
||||
// 启动后初始化参数表信息
|
||||
msgService.addinfo();
|
||||
}
|
||||
}
|
||||
@ -23,7 +23,9 @@ public class CarController {
|
||||
MsgService msgService;
|
||||
|
||||
|
||||
/** 订单明细
|
||||
/**
|
||||
* 订单明细
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/index")
|
||||
@ -59,6 +61,17 @@ public class CarController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "init123")
|
||||
@ResponseBody
|
||||
public Object setorderInfo() {
|
||||
|
||||
return msgService.setorderInfo();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通道
|
||||
*
|
||||
@ -94,9 +107,16 @@ public class CarController {
|
||||
@ResponseBody
|
||||
public Object tb(int id) {
|
||||
|
||||
log.info("id= {}",id);
|
||||
log.info("id= {}", id);
|
||||
return ReturnValue.buildErrordata(0, "同步成功!");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "addinfo")
|
||||
@ResponseBody
|
||||
public Object addinfo() {
|
||||
|
||||
return msgService.addinfo();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.weiqi.mis.contorller;
|
||||
|
||||
import com.weiqi.mis.MsgService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Configurable;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Component
|
||||
@Configurable
|
||||
@EnableScheduling
|
||||
@RestController
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ScheduledTasks {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
MsgService msgService;
|
||||
|
||||
/**
|
||||
* 一小时缓存失效一次
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0/1 * * ? ")
|
||||
public void addinfoCron() {
|
||||
msgService.addinfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 定期更新订单表数据
|
||||
*
|
||||
*/
|
||||
@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void setorderInfoCron() {
|
||||
msgService.setorderInfo();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,9 +1,10 @@
|
||||
###\u7AEF\u53E3\u914D\u7F6E
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
spring.datasource.url=jdbc:mysql://10.27.74.56:4000/smsdb?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useSSL=false
|
||||
spring.datasource.username=sysbench
|
||||
spring.datasource.password=SysBench12
|
||||
|
||||
spring.datasource.url=jdbc:mysql://cfo.mycar369.com:3306/wx_weiqi?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useSSL=false
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=autoHOME2022!!!!mysql
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.initialSize=1
|
||||
@ -25,13 +26,3 @@ spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowS
|
||||
logging.config=classpath:logback-test.xml
|
||||
|
||||
|
||||
##redis 189
|
||||
#spring.redis.database=0
|
||||
#spring.redis.host=10.168.100.189
|
||||
#spring.redis.password=0gyU7a
|
||||
#spring.redis.port=6379
|
||||
#spring.redis.jedis.pool.max-active=1024
|
||||
#spring.redis.jedis.pool.max-idle=500
|
||||
#spring.redis.jedis.pool.min-idle=100
|
||||
#spring.redis.block-when-exhausted=true
|
||||
|
||||
|
||||
@ -1,57 +1,57 @@
|
||||
###\u7AEF\u53E3\u914D\u7F6E
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
####\u7AEF\u53E3\u914D\u7F6E
|
||||
#spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
#
|
||||
#spring.datasource.url=jdbc:mysql://feed-4000-tidb.yz.weiqi.com.cn:4000/smsdb?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
spring.datasource.url=jdbc:mysql://sms-master-4000.tidb.db.corpweiqi.com:4000/smsdb?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useSSL=false
|
||||
spring.datasource.username=smsdb_wr
|
||||
spring.datasource.password=ULZahlCFfI9Tt5qk
|
||||
|
||||
#\u4E3A\u4E86\u4F7F\u7528tiflash\u5148\u4F7F\u7528\u5ECA\u574A\u673A\u623F
|
||||
#spring.datasource.url=jdbc:mysql://sms-slave-4000.tidb.db.corpweiqi.com:4000/smsdb?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&useServerPrepStmts=true&allowMultiQueries=true
|
||||
##
|
||||
##spring.datasource.url=jdbc:mysql://feed-4000-tidb.yz.weiqi.com.cn:4000/smsdb?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
#spring.datasource.url=jdbc:mysql://sms-master-4000.tidb.db.corpweiqi.com:4000/smsdb?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2b8&useSSL=false
|
||||
#spring.datasource.username=smsdb_wr
|
||||
#spring.datasource.password=ULZahlCFfI9Tt5qk
|
||||
|
||||
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.initialSize=1
|
||||
spring.datasource.minIdle=1
|
||||
spring.datasource.maxActive=20
|
||||
spring.datasource.dbcp2.max-open-prepared-statements=20
|
||||
spring.datasource.maxWait=60000
|
||||
spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
spring.datasource.testWhileIdle=true
|
||||
spring.datasource.testOnBorrow=false
|
||||
spring.datasource.testOnReturn=false
|
||||
spring.datasource.poolPreparedStatements=false
|
||||
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
|
||||
spring.datasource.hikari.validation-timeout=900000
|
||||
spring.datasource.filters=stat,wall,log4j
|
||||
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=50
|
||||
|
||||
logging.config=classpath:logback-prod.xml
|
||||
|
||||
|
||||
spring.redis.database=0
|
||||
spring.redis.host=jiage-sms-kafka.redis.cache.corpweiqi.com
|
||||
spring.redis.port=20061
|
||||
spring.redis.password=9FL4a*g4Ai
|
||||
#spring.redis.host=10.231.61.40
|
||||
#spring.redis.port=6379
|
||||
#
|
||||
##\u4E3A\u4E86\u4F7F\u7528tiflash\u5148\u4F7F\u7528\u5ECA\u574A\u673A\u623F
|
||||
##spring.datasource.url=jdbc:mysql://sms-slave-4000.tidb.db.corpweiqi.com:4000/smsdb?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&useServerPrepStmts=true&allowMultiQueries=true
|
||||
##spring.datasource.username=smsdb_wr
|
||||
##spring.datasource.password=ULZahlCFfI9Tt5qk
|
||||
#
|
||||
#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
#spring.datasource.initialSize=1
|
||||
#spring.datasource.minIdle=1
|
||||
#spring.datasource.maxActive=20
|
||||
#spring.datasource.dbcp2.max-open-prepared-statements=20
|
||||
#spring.datasource.maxWait=60000
|
||||
#spring.datasource.timeBetweenEvictionRunsMillis=60000
|
||||
#spring.datasource.minEvictableIdleTimeMillis=300000
|
||||
#spring.datasource.testWhileIdle=true
|
||||
#spring.datasource.testOnBorrow=false
|
||||
#spring.datasource.testOnReturn=false
|
||||
#spring.datasource.poolPreparedStatements=false
|
||||
#spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
|
||||
#spring.datasource.hikari.validation-timeout=900000
|
||||
#spring.datasource.filters=stat,wall,log4j
|
||||
#spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=50
|
||||
#
|
||||
#logging.config=classpath:logback-prod.xml
|
||||
#
|
||||
#
|
||||
#spring.redis.database=0
|
||||
#spring.redis.host=jiage-sms-kafka.redis.cache.corpweiqi.com
|
||||
#spring.redis.port=20061
|
||||
#spring.redis.password=9FL4a*g4Ai
|
||||
spring.redis.jedis.pool.max-active=1024
|
||||
spring.redis.jedis.pool.max-idle=500
|
||||
spring.redis.jedis.pool.min-idle=100
|
||||
spring.redis.block-when-exhausted=true
|
||||
|
||||
#\u9001\u8FBE\u7387\u4F4E\u4E8E90%\u62A5\u8B66
|
||||
send.rate.alarm.phoneno=18801217561,18975045528,16601102415,13180180070,13581608179
|
||||
# xxl-job??
|
||||
xxl.job.enable=true
|
||||
xxl.job.admin.addresses=http://uag-job.corpweiqi.com/xxl-job-admin
|
||||
xxl.job.executor.appname=sms-mis
|
||||
xxl.job.executor.port=7999
|
||||
xxl.job.executor.logpath=/data/jiage-sms-mis/log
|
||||
xxl.job.executor.logretentiondays=30
|
||||
xxl.job.accessToken=xMrVFjivwewvVriOeikYJFJIpUEktBGWrZMrBkhSXJS
|
||||
xxl.job.executor.bindip=
|
||||
##spring.redis.host=10.231.61.40
|
||||
##spring.redis.port=6379
|
||||
##spring.redis.password=9FL4a*g4Ai
|
||||
#spring.redis.jedis.pool.max-active=1024
|
||||
#spring.redis.jedis.pool.max-idle=500
|
||||
#spring.redis.jedis.pool.min-idle=100
|
||||
#spring.redis.block-when-exhausted=true
|
||||
#
|
||||
##\u9001\u8FBE\u7387\u4F4E\u4E8E90%\u62A5\u8B66
|
||||
#send.rate.alarm.phoneno=18801217561,18975045528,16601102415,13180180070,13581608179
|
||||
## xxl-job??
|
||||
#xxl.job.enable=true
|
||||
#xxl.job.admin.addresses=http://uag-job.corpweiqi.com/xxl-job-admin
|
||||
#xxl.job.executor.appname=sms-mis
|
||||
#xxl.job.executor.port=7999
|
||||
#xxl.job.executor.logpath=/data/jiage-sms-mis/log
|
||||
#xxl.job.executor.logretentiondays=30
|
||||
#xxl.job.accessToken=xMrVFjivwewvVriOeikYJFJIpUEktBGWrZMrBkhSXJS
|
||||
#xxl.job.executor.bindip=
|
||||
@ -22,5 +22,3 @@ spring.jackson.time-zone=GMT+8
|
||||
spring.jackson.date-format=yyyy/MM/dd HH:mm:ss
|
||||
|
||||
|
||||
redis.check.geetest.status.key=REDIS_CHECK_GEETEST_STATUS_KEY
|
||||
redis.check.geetest.status.extime=86400
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
# \u5411\u6781\u9A8C\u7533\u8BF7\u7684id\u548Ckey
|
||||
geetest.id=467f23c37772ea257ecda512156704bc
|
||||
geetest.key=5467948a5474802dd245e8f4d544a72d
|
||||
|
||||
# \u6781\u9A8C\u4E91\u76D1\u63A7\u63A5\u53E3
|
||||
check.geetest.status.url=http://bypass.geetest.com/v1/bypass_status.php
|
||||
# \u5B9A\u65F6\u5668\u4EFB\u52A1\u8F6E\u8BE2\u95F4\u9694\u65F6\u95F4\u8BBE\u7F6E\uFF0C\u5355\u4F4D/\u6BEB\u79D2
|
||||
task.schedule.check.geetest.status.interval=10000
|
||||
|
||||
# redis\u4E2D\u5B58\u5165\u6781\u9A8C\u4E91\u72B6\u6001\u7684key
|
||||
redis.check.geetest.status.key=REDIS_CHECK_GEETEST_STATUS_KEY
|
||||
# redis\u8FC7\u671F\u65F6\u95F4\uFF0C\u5355\u4F4D/\u79D2
|
||||
redis.check.geetest.status.extime=86400
|
||||
|
||||
# redis\u5730\u5740
|
||||
#redis1.ip=127.0.0.1
|
||||
#redis1.port=6379
|
||||
#redis1.password=crs-57hpob9h4ng6d#o2s5H
|
||||
|
||||
redis1.ip=10.28.74.50
|
||||
redis1.port=6399
|
||||
|
||||
# redis\u8FDE\u63A5\u6C60\u914D\u7F6E
|
||||
# \u6700\u5927\u8FDE\u63A5\u6570
|
||||
redis.max.total=20
|
||||
# \u5728jedispool\u4E2D\u6700\u5927\u7684idle\u72B6\u6001(\u7A7A\u95F2\u7684)jedis\u5B9E\u4F8B\u7684\u4E2A\u6570
|
||||
redis.max.idle=20
|
||||
# \u5728jedispool\u4E2D\u6700\u5C0F\u7684idle\u72B6\u6001(\u7A7A\u95F2\u7684)jedis\u5B9E\u4F8B\u7684\u4E2A\u6570
|
||||
redis.min.idle=20
|
||||
# \u6700\u5927\u7B49\u5F85\u65F6\u95F4
|
||||
redis.max.millis=5
|
||||
# \u5728borow\u4E00\u4E2Ajedis\u5B9E\u4F8B\u7684\u65F6\u5019\uFF0C\u662F\u5426\u8981\u8FDB\u884C\u9A8C\u8BC1\u64CD\u4F5C\uFF0C\u5982\u679C\u8D4B\u503Ctrue\uFF0C\u5219\u5F97\u5230\u7684jedis\u5B9E\u4F8B\u80AF\u5B9A\u662F\u53EF\u4EE5\u7528\u7684\u3002
|
||||
redis.test.borrow=true
|
||||
# \u5728return\u4E00\u4E2Ajedis\u5B9E\u4F8B\u7684\u65F6\u5019\uFF0C\u662F\u5426\u8981\u8FDB\u884C\u9A8C\u8BC1\u64CD\u4F5C\uFF0C\u5982\u679C\u8D4B\u503Ctrue\uFF0C\u5219\u653E\u56DE\u7684jedis\u5B9E\u4F8B\u80AF\u5B9A\u662F\u53EF\u4EE5\u7528\u7684\u3002
|
||||
redis.test.return=true
|
||||
# \u8FDE\u63A5\u8017\u5C3D\u7684\u65F6\u5019\uFF0C\u662F\u5426\u963B\u585E\uFF0Cfalse\u4F1A\u629B\u51FA\u5F02\u5E38\uFF0Ctrue\u963B\u585E\u76F4\u5230\u8D85\u65F6\u3002\u9ED8\u8BA4true
|
||||
redis.block.exhausted=true
|
||||
|
||||
|
||||
|
||||
@ -23,4 +23,8 @@ public interface MsgService {
|
||||
|
||||
public Object getOrderinfoLog(OrderInfoVo records);
|
||||
|
||||
public Object addinfo();
|
||||
|
||||
public Object setorderInfo();
|
||||
|
||||
}
|
||||
|
||||
9
car-service/src/main/java/com/weiqi/mis/PushService.java
Normal file
9
car-service/src/main/java/com/weiqi/mis/PushService.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.weiqi.mis;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public interface PushService {
|
||||
|
||||
JSONObject pushorder(int id);
|
||||
|
||||
}
|
||||
@ -3,15 +3,21 @@ package com.weiqi.mis.impl;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.weiqi.mis.DateUtil;
|
||||
import com.weiqi.mis.ReturnValue;
|
||||
import com.weiqi.mis.domain.*;
|
||||
import com.weiqi.mis.mapper.WxXrPemsOrderMapper;
|
||||
import com.weiqi.mis.mapper.WxXrPemsOrderPushLogMapper;
|
||||
import com.weiqi.vo.OrderInfoVo;
|
||||
import lombok.val;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -23,8 +29,12 @@ import com.weiqi.mis.*;
|
||||
@Service
|
||||
public class MsgServiceImpl implements MsgService {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
public static Cache<String, Integer> brandIdCache =
|
||||
Caffeine.newBuilder().expireAfterWrite(12, TimeUnit.HOURS).build();
|
||||
public static Cache<String, JSONObject> seriesIdCache =
|
||||
Caffeine.newBuilder().expireAfterWrite(12, TimeUnit.HOURS).build();
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
||||
// 记录上次处理时间
|
||||
@ -37,18 +47,13 @@ public class MsgServiceImpl implements MsgService {
|
||||
|
||||
@Resource(name = "threadPool")
|
||||
Executor executor;
|
||||
public Object getinfo(){
|
||||
|
||||
public Object getinfo() {
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有appid
|
||||
*
|
||||
@ -79,7 +84,6 @@ public class MsgServiceImpl implements MsgService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Object getOrderinfo(OrderInfoVo records) {
|
||||
|
||||
@ -98,7 +102,7 @@ public class MsgServiceImpl implements MsgService {
|
||||
|
||||
if (records.getPlatenumber() != null && !records.getPlatenumber().equals("null")
|
||||
&& records.getPlatenumber().toString().length() > 0) {
|
||||
cri1.andPlatenumberLike("%"+records.getPlatenumber()+"%");
|
||||
cri1.andPlatenumberLike("%" + records.getPlatenumber() + "%");
|
||||
}
|
||||
offset = (pageNumber - 1) * pagesize;
|
||||
example1.setOrderByClause(" create_time desc limit " + offset + " ," + pagesize);
|
||||
@ -113,8 +117,9 @@ public class MsgServiceImpl implements MsgService {
|
||||
int num = wxXrPemsOrderMapper.countByExample(example1);
|
||||
List<WxXrPemsOrder> wxXrPemsOrders = wxXrPemsOrderMapper.selectByExample(example1);
|
||||
|
||||
return ReturnValue.buildSuccessdata(wxXrPemsOrders, num);
|
||||
return ReturnValue.buildSuccessdata(wxXrPemsOrders, num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOrderinfoLog(OrderInfoVo records) {
|
||||
|
||||
@ -146,7 +151,85 @@ public class MsgServiceImpl implements MsgService {
|
||||
int num = wxXrPemsOrderPushLogMapper.countByExample(example1);
|
||||
List<WxXrPemsOrderPushLog> wxXrPemsOrders = wxXrPemsOrderPushLogMapper.selectByExample(example1);
|
||||
|
||||
return ReturnValue.buildSuccessdata(wxXrPemsOrders, num);
|
||||
return ReturnValue.buildSuccessdata(wxXrPemsOrders, num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object addinfo() {
|
||||
|
||||
getbrandInfo();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setorderInfo() {
|
||||
|
||||
WxXrPemsOrderExample example1 = new WxXrPemsOrderExample();
|
||||
WxXrPemsOrderExample.Criteria cri1 = example1.createCriteria();
|
||||
cri1.andSeriesidIsNull();
|
||||
|
||||
List<WxXrPemsOrder> wxXrPemsOrders = wxXrPemsOrderMapper.selectByExample(example1);
|
||||
for (WxXrPemsOrder wxXrPemsOrder : wxXrPemsOrders) {
|
||||
Integer brandId = brandIdCache.getIfPresent(wxXrPemsOrder.getBrandname());
|
||||
JSONObject jsonObject = seriesIdCache.getIfPresent(wxXrPemsOrder.getSeriesname());
|
||||
Integer id = jsonObject.getInteger("id");
|
||||
String img = jsonObject.getString("img");
|
||||
wxXrPemsOrder.setBrandid(brandId);
|
||||
wxXrPemsOrder.setSeriesid(id);
|
||||
wxXrPemsOrder.setVehiclesrc(img);
|
||||
int i = wxXrPemsOrderMapper.updateByPrimaryKeySelective(wxXrPemsOrder);
|
||||
logger.info("更新结果为:{}", i);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Integer> getbrandInfo() {
|
||||
|
||||
JSONObject js = new JSONObject();
|
||||
Map<String, Integer> retmap = new HashMap();
|
||||
try {
|
||||
String url = "https://api.mycar369.com/api//app/getbrands/v1?appid=LANBBXCXtest&os=android-11-M2011K2C&version=1.1.2×tamp=1725702019&udid=a97c068f-0ba3-3f3b-a25e-172087d538e2&noncestr=WySsMg&usid=36&_sign=C404D844CC87716925DC40E65F6E4FF9";
|
||||
String body = HttpUtil.sendGetRequest(url);
|
||||
js = JSONObject.parseObject(body);
|
||||
JSONArray objects = js.getJSONObject("result").getJSONArray("brand");
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
retmap.put(objects.getJSONObject(i).getString("brandname"), objects.getJSONObject(i).getInteger("brandid"));
|
||||
brandIdCache.put(objects.getJSONObject(i).getString("brandname"), objects.getJSONObject(i).getInteger("brandid"));
|
||||
getseries(objects.getJSONObject(i).getInteger("brandid") + "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("{}", e);
|
||||
}
|
||||
return retmap;
|
||||
}
|
||||
|
||||
|
||||
public JSONObject getseries(String brandId) {
|
||||
JSONObject js = new JSONObject();
|
||||
try {
|
||||
String url = "https://api.mycar369.com/api/app/getseries/v1?brandid=" + brandId + "&appid=LANBBXCXtest&os=android-11-M2011K2C&version=1.1.2×tamp=1725705334&udid=a97c068f-0ba3-3f3b-a25e-172087d538e2&noncestr=B7aIVh&usid=36&_sign=AF5BBEE40C3C6C7205550B73A3B531E8";
|
||||
String body = HttpUtil.sendGetRequest(url);
|
||||
js = JSONObject.parseObject(body);
|
||||
if (js.getInteger("returncode") == 2000) {
|
||||
JSONArray objects = js.getJSONArray("result");
|
||||
for (int i = 0; i < objects.size(); i++) {
|
||||
JSONObject jsonObject = objects.getJSONObject(i);
|
||||
seriesIdCache.put(jsonObject.getString("name"), jsonObject);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
}
|
||||
|
||||
return js;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,264 @@
|
||||
package com.weiqi.mis.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weiqi.mis.DateHelper;
|
||||
import com.weiqi.mis.HttpUtil;
|
||||
import com.weiqi.mis.PushService;
|
||||
import com.weiqi.mis.bo.WxXrPemsOrderResult;
|
||||
import com.weiqi.mis.domain.WxSgPolluteSds;
|
||||
import com.weiqi.mis.domain.WxSgPolluteSdsExample;
|
||||
import com.weiqi.mis.domain.WxXrPemsOrder;
|
||||
import com.weiqi.mis.domain.WxXrPemsOrderPushLog;
|
||||
import com.weiqi.mis.mapper.WxSgPolluteSdsMapper;
|
||||
import com.weiqi.mis.mapper.WxXrPemsOrderMapper;
|
||||
import com.weiqi.mis.mapper.WxXrPemsOrderPushLogMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PushServiceImpl implements PushService {
|
||||
@Autowired
|
||||
private WxSgPolluteSdsMapper wxSgPolluteSdsMapper;
|
||||
@Autowired
|
||||
private WxXrPemsOrderMapper wxXrPemsOrderMapper;
|
||||
@Autowired
|
||||
private WxXrPemsOrderPushLogMapper wxXrPemsOrderPushLogMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject pushorder(int id) {
|
||||
JSONObject jsret = new JSONObject();
|
||||
jsret.put("returncode", 0);
|
||||
jsret.put("message", "");
|
||||
|
||||
try {
|
||||
|
||||
WxXrPemsOrder wxXrPemsOrder = wxXrPemsOrderMapper.selectByPrimaryKey(id);
|
||||
log.info("{}", wxXrPemsOrder);
|
||||
//调用生成订单接口,返回订单编号
|
||||
JSONObject createorder = createorder(wxXrPemsOrder);
|
||||
//{"extmessage":null,"message":"操作成功","result":{"brandimg":"https://api.mycar369.com/api/carimg/14.jpg","orderid":"2024101418552975925900036","sname":"思域","platenum":"京atest1"},"returncode":2000}
|
||||
|
||||
if (createorder.getInteger("returncode") != 2000) {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口生成订单失败");
|
||||
return jsret;
|
||||
}
|
||||
String orderId = createorder.getJSONObject("result").getString("orderid");
|
||||
List<WxSgPolluteSds> wxSgPolluteSdsList = new ArrayList<>();
|
||||
|
||||
List<WxXrPemsOrderResult.WxXrPemsOrderItemResult> wxXrPemsOrderItemResultList = new ArrayList<>();
|
||||
|
||||
//查询订单检测结果list
|
||||
|
||||
WxSgPolluteSdsExample example1 = new WxSgPolluteSdsExample();
|
||||
WxSgPolluteSdsExample.Criteria ca = example1.createCriteria();
|
||||
ca.andWxOrderIdEqualTo(id);
|
||||
wxSgPolluteSdsList = wxSgPolluteSdsMapper.selectByExample(example1);
|
||||
|
||||
|
||||
JSONObject pollutesave = pollutesave(wxXrPemsOrder, wxSgPolluteSdsList, orderId);
|
||||
if (pollutesave.getInteger("returncode") != 2000) {
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", "调用接口保存订单失败");
|
||||
return jsret;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("pushorder is error:{}", e);
|
||||
jsret.put("returncode", -1);
|
||||
jsret.put("message", e.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return jsret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【第一步】:
|
||||
* https://api.mycar369.com/api/sg/createorder?mid=22&userid=36&vin=0000&platenum=%E4%BA%ACatest1&licensingtime=2022-10-14&mileage=10&drivinglicenseimgsrc=&carimgsrc=&modelid=135&brandid=14&linkname=lxr&phonenum=13126679999&engine_air_count=4&exhaustsystem=2&appid=LANBBXCXtest&os=xiaochengxu&version=1.1.2×tamp=1728900072&udid=000&noncestr=000&usid=36&_sign=77705A9803DCEBBD6006E07BF592882D
|
||||
* 发动机缸数
|
||||
* engine_air_count:4
|
||||
* 排气系统类型 1,单排 2,双排
|
||||
* exhaustsystem: 1 or 2
|
||||
* 维修门店id
|
||||
* mid:22
|
||||
* 操作用户id
|
||||
* usid:36 对应数据库里的用户id
|
||||
* userid:36 对应数据库里的用户id
|
||||
* 车系品牌id
|
||||
* modelid=135&brandid=14
|
||||
* <p>
|
||||
* 返回内容:
|
||||
* {"extmessage":null,"message":"操作成功","result":{"brandimg":"https://api.mycar369.com/api/carimg/14.jpg","orderid":"2024101418552975925900036","sname":"思域","platenum":"京atest1"},"returncode":2000}
|
||||
* returncode:2000 表示成功
|
||||
*
|
||||
* @param wxXrPemsOrder
|
||||
* @return
|
||||
*/
|
||||
public JSONObject createorder(WxXrPemsOrder wxXrPemsOrder) {
|
||||
JSONObject js = new JSONObject();
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
String body = "";
|
||||
try {
|
||||
fields.put("mid", wxXrPemsOrder.getMid()+"");
|
||||
fields.put("userid", wxXrPemsOrder.getOrderuserid()+"");
|
||||
fields.put("vin", wxXrPemsOrder.getVin());
|
||||
fields.put("platenum", wxXrPemsOrder.getPlatenumber());
|
||||
fields.put("licensingtime", DateHelper.serialize(wxXrPemsOrder.getAdmissiontime(), DateHelper.DATEFORMAT_ONLY_DATE));
|
||||
fields.put("mileage", wxXrPemsOrder.getKilometers().intValue()+"");
|
||||
fields.put("drivinglicenseimgsrc", wxXrPemsOrder.getDrivinglicensesrc() == null ? "" : wxXrPemsOrder.getDrivinglicensesrc());
|
||||
fields.put("carimgsrc", wxXrPemsOrder.getVehiclesrc() == null ? "" : wxXrPemsOrder.getVehiclesrc());
|
||||
fields.put("modelid", wxXrPemsOrder.getSeriesid() == null ? "" : wxXrPemsOrder.getSeriesid()+"");
|
||||
fields.put("brandid", wxXrPemsOrder.getBrandid() == null ? "" : wxXrPemsOrder.getBrandid()+"");
|
||||
fields.put("linkname", wxXrPemsOrder.getLinkname() == null ? "" : wxXrPemsOrder.getLinkname());
|
||||
fields.put("phonenum", wxXrPemsOrder.getLinktel() == null ? "" : wxXrPemsOrder.getLinktel());
|
||||
fields.put("engine_air_count", wxXrPemsOrder.getEnginestructurenumber()+"");
|
||||
// 排气系统类型 1,单排 2,双排 这个对应表中哪个字段,是排期构造? exhau
|
||||
fields.put("exhaustsystem", "1");
|
||||
// fields.put("exhaustsystem", wxXrPemsOrder.getExhauststructure());
|
||||
fields.put("appid", "LANBBXCXtest");
|
||||
fields.put("os", "xiaochengxu");
|
||||
fields.put("version", "1.1.2");
|
||||
fields.put("timestamp", (System.currentTimeMillis() / 1000)+"");
|
||||
fields.put("udid", "000");
|
||||
fields.put("noncestr", "000");
|
||||
fields.put("usid", wxXrPemsOrder.getOrderuserid()+"");
|
||||
fields.put("_sign", "77705A9803DCEBBD6006E07BF592882D");
|
||||
|
||||
String url = "https://api.mycar369.com/api/sg/createorder?";
|
||||
body = HttpUtil.sendGetRequest(url, fields);
|
||||
|
||||
// String url = "https://api.mycar369.com/api/sg/createorder?mid=22&userid=36&vin=0000&platenum=%E4%BA%ACatest1&licensingtime=2022-10-14&mileage=10&drivinglicenseimgsrc=&carimgsrc=&modelid=135&brandid=14&linkname=lxr&phonenum=13126679999&engine_air_count=4&exhaustsystem=2&appid=LANBBXCXtest&os=xiaochengxu&version=1.1.2×tamp=1728900072&udid=000&noncestr=000&usid=36&_sign=77705A9803DCEBBD6006E07BF592882D";
|
||||
// body = HttpUtil.sendGetRequest(url);
|
||||
|
||||
js = JSONObject.parseObject(body);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("createorder is error:{}", e);
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
} finally {
|
||||
WxXrPemsOrderPushLog record = new WxXrPemsOrderPushLog();
|
||||
record.setOrderno(wxXrPemsOrder.getOrderno());
|
||||
record.setWeixiuorderno("");
|
||||
record.setRequestparam(fields.toString());
|
||||
record.setResponse(body.length() > 1000 ? body.substring(0, 1000) : body);
|
||||
record.setStep(1);
|
||||
|
||||
if (js.containsKey("returncode")) {
|
||||
record.setStatus(js.getInteger("returncode"));
|
||||
} else {
|
||||
record.setStatus(-1);
|
||||
}
|
||||
wxXrPemsOrderPushLogMapper.insert(record);
|
||||
}
|
||||
|
||||
return js;
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二步】:
|
||||
* https://api.mycar369.com/api/sg/pollutesave?ordernum=2024101418552975925900036&categroy=2&jystco=0&jysthc=0&jystnox=0&cohigh1=1&hchigh=2&lambdahigh1=3&colow1=0&hclow1=0&lambdalow1=0&appid=LANBB00M&os=android-11-M2011K2C&version=1.1.2×tamp=1728900609&udid=a97c068f-0ba3-3f3b-a25e-172087d538e2&noncestr=3PbaRn&usid=36&_sign=8F016C479C2D69561AE541A0A26C98C7
|
||||
* <p>
|
||||
* 第一步得到的订单id
|
||||
* ordernum:2024101418552975925900036
|
||||
* 污染数据-高怠速
|
||||
* categroy=2
|
||||
* 污染数据 cohigh1=1&hchigh=2&lambdahigh1=3 其它污染数据填0
|
||||
* 污染数据-低怠速
|
||||
* categroy=3
|
||||
* 污染数据 colow1=20&hclow1=20&lambdalow1=20 其它污染数据填0
|
||||
* 返回内容:
|
||||
* {"extmessage":null,"message":"操作成功","result":{"code":"0","message":"添加成功"},"returncode":2000}
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public JSONObject pollutesave(WxXrPemsOrder wxXrPemsOrder, List<WxSgPolluteSds> wxSgPolluteSdsList, String orderId) {
|
||||
JSONObject js = new JSONObject();
|
||||
js.put("returncode",-1);
|
||||
String body = "";
|
||||
Map<String, String> fields = new HashMap<>();
|
||||
try {
|
||||
for (WxSgPolluteSds wxSgPolluteSds : wxSgPolluteSdsList) {
|
||||
String url = "https://api.mycar369.com/api/sg/pollutesave?";
|
||||
fields = new HashMap<>();
|
||||
fields.put("ordernum", orderId);
|
||||
//高怠速
|
||||
if (wxSgPolluteSds.getCategory() == 2) {
|
||||
fields.put("categroy", wxSgPolluteSds.getCategory()+"");
|
||||
fields.put("cohigh1", wxSgPolluteSds.getCo()+"");
|
||||
fields.put("hchigh", wxSgPolluteSds.getHc()+"");
|
||||
fields.put("lambdahigh1", wxSgPolluteSds.getLambda()+"");
|
||||
fields.put("lambdalow1", "0");
|
||||
fields.put("colow1", "0");
|
||||
fields.put("hclow1", "0");
|
||||
} else {
|
||||
fields.put("categroy", "1");
|
||||
fields.put("colow1", wxSgPolluteSds.getCo()+"");
|
||||
fields.put("hclow1", wxSgPolluteSds.getHc()+"");
|
||||
fields.put("lambdalow1", wxSgPolluteSds.getLambda()+"");
|
||||
fields.put("lambdahigh1", "0");
|
||||
fields.put("cohigh1", "0");
|
||||
fields.put("hchigh", "0");
|
||||
}
|
||||
fields.put("jystco", "0");
|
||||
fields.put("jysthc", "0");
|
||||
fields.put("jystnox", "0");
|
||||
|
||||
fields.put("appid", "LANBBXCXtest");
|
||||
fields.put("os", "xiaochengxu");
|
||||
fields.put("version", "1.1.2");
|
||||
fields.put("timestamp", (System.currentTimeMillis()/1000)+"");
|
||||
fields.put("udid", "000");
|
||||
fields.put("noncestr", "000");
|
||||
fields.put("usid", wxXrPemsOrder.getOrderuserid()+"");
|
||||
fields.put("_sign", "77705A9803DCEBBD6006E07BF592882D");
|
||||
body= HttpUtil.sendGetRequest(url, fields);
|
||||
|
||||
try{
|
||||
js = JSONObject.parseObject(body);
|
||||
}catch (Exception e){
|
||||
log.error("返回结果非json body={}",body);
|
||||
}
|
||||
|
||||
WxXrPemsOrderPushLog record = new WxXrPemsOrderPushLog();
|
||||
record.setOrderno(wxXrPemsOrder.getOrderno());
|
||||
record.setWeixiuorderno("");
|
||||
record.setRequestparam(fields.toString());
|
||||
record.setResponse(body.length() > 1000 ? body.substring(1, 1000) : body);
|
||||
record.setStep(2);
|
||||
savelog(record, js);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("pollutesave is error:{}", e);
|
||||
js.put("returncode", -1);
|
||||
js.put("message", "请求数据报错");
|
||||
}
|
||||
return js;
|
||||
}
|
||||
|
||||
public void savelog(WxXrPemsOrderPushLog record, JSONObject js) {
|
||||
try {
|
||||
if (js.containsKey("returncode")) {
|
||||
record.setStatus(js.getInteger("returncode"));
|
||||
} else {
|
||||
record.setStatus(-1);
|
||||
}
|
||||
record.setCreateTime(new Date());
|
||||
record.setUpdateTime(new Date());
|
||||
wxXrPemsOrderPushLogMapper.insert(record);
|
||||
} catch (Exception e) {
|
||||
log.error("insert log error:{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,105 +1,105 @@
|
||||
package com.weiqi.mis.redis;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
public class RedisListenerConfig {
|
||||
|
||||
public static final String sms_redisqueue_channel = "sms_redisqueue";
|
||||
public static final String sms_redisqueue_total_channel = "sms_redisqueue_total";
|
||||
public static final String sms_redis_kg_channel = "sms_redi_kg_channel";
|
||||
public static final String sms_redis_wg_channel = "sms_redi_wg_channel";
|
||||
public static final String sms_redis_headbeat = "headbeat";
|
||||
|
||||
/**
|
||||
* redis消息监听器容器 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理
|
||||
*
|
||||
* @param connectionFactory
|
||||
* @param listenerAdapter
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
|
||||
MessageListenerAdapter listenerAdapter, MessageListenerAdapter listenerAdapter2,
|
||||
MessageListenerAdapter listenerAdapterkg,MessageListenerAdapter listenerAdapterwg,MessageListenerAdapter listenerAdapterhb) {
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(connectionFactory);
|
||||
|
||||
// 可以添加多个 messageListener
|
||||
container.addMessageListener(listenerAdapter, new PatternTopic(sms_redisqueue_channel));
|
||||
container.addMessageListener(listenerAdapter2, new PatternTopic(sms_redisqueue_total_channel));
|
||||
container.addMessageListener(listenerAdapterkg, new PatternTopic(sms_redis_kg_channel));
|
||||
container.addMessageListener(listenerAdapterwg, new PatternTopic(sms_redis_wg_channel));
|
||||
container.addMessageListener(listenerAdapterhb, new PatternTopic(sms_redis_headbeat));
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
*
|
||||
* @param redisReceiver
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
MessageListenerAdapter listenerAdapter(RedisReceiver redisReceiver) {
|
||||
|
||||
return new MessageListenerAdapter(redisReceiver, "receiveMessage");
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
*
|
||||
* @param redisReceiver
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
MessageListenerAdapter listenerAdapter2(RedisReceiver redisReceiver) {
|
||||
|
||||
return new MessageListenerAdapter(redisReceiver, "receiveMessage2");
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
*
|
||||
* @param redisReceiver
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
MessageListenerAdapter listenerAdapterkg(RedisReceiver redisReceiver) {
|
||||
|
||||
return new MessageListenerAdapter(redisReceiver, "receiveMessage3");
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
*
|
||||
* @param redisReceiver
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
MessageListenerAdapter listenerAdapterwg(RedisReceiver redisReceiver) {
|
||||
|
||||
return new MessageListenerAdapter(redisReceiver, "receiveMessage4");
|
||||
}
|
||||
@Bean
|
||||
MessageListenerAdapter listenerAdapterhb(RedisReceiver redisReceiver) {
|
||||
|
||||
return new MessageListenerAdapter(redisReceiver, "receiveMessage5");
|
||||
}
|
||||
|
||||
// 使用默认的工厂初始化redis操作模板
|
||||
@Bean
|
||||
StringRedisTemplate template(RedisConnectionFactory connectionFactory) {
|
||||
return new StringRedisTemplate(connectionFactory);
|
||||
}
|
||||
}
|
||||
//package com.weiqi.mis.redis;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
//import org.springframework.data.redis.core.RedisTemplate;
|
||||
//import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
//import org.springframework.data.redis.listener.PatternTopic;
|
||||
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
//import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||
//import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||
//import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
//
|
||||
//@Configuration
|
||||
//public class RedisListenerConfig {
|
||||
//
|
||||
// public static final String sms_redisqueue_channel = "sms_redisqueue";
|
||||
// public static final String sms_redisqueue_total_channel = "sms_redisqueue_total";
|
||||
// public static final String sms_redis_kg_channel = "sms_redi_kg_channel";
|
||||
// public static final String sms_redis_wg_channel = "sms_redi_wg_channel";
|
||||
// public static final String sms_redis_headbeat = "headbeat";
|
||||
//
|
||||
// /**
|
||||
// * redis消息监听器容器 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理
|
||||
// *
|
||||
// * @param connectionFactory
|
||||
// * @param listenerAdapter
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
|
||||
// MessageListenerAdapter listenerAdapter, MessageListenerAdapter listenerAdapter2,
|
||||
// MessageListenerAdapter listenerAdapterkg,MessageListenerAdapter listenerAdapterwg,MessageListenerAdapter listenerAdapterhb) {
|
||||
// RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
// container.setConnectionFactory(connectionFactory);
|
||||
//
|
||||
// // 可以添加多个 messageListener
|
||||
// container.addMessageListener(listenerAdapter, new PatternTopic(sms_redisqueue_channel));
|
||||
// container.addMessageListener(listenerAdapter2, new PatternTopic(sms_redisqueue_total_channel));
|
||||
// container.addMessageListener(listenerAdapterkg, new PatternTopic(sms_redis_kg_channel));
|
||||
// container.addMessageListener(listenerAdapterwg, new PatternTopic(sms_redis_wg_channel));
|
||||
// container.addMessageListener(listenerAdapterhb, new PatternTopic(sms_redis_headbeat));
|
||||
//
|
||||
// return container;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
// *
|
||||
// * @param redisReceiver
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// MessageListenerAdapter listenerAdapter(RedisReceiver redisReceiver) {
|
||||
//
|
||||
// return new MessageListenerAdapter(redisReceiver, "receiveMessage");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
// *
|
||||
// * @param redisReceiver
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// MessageListenerAdapter listenerAdapter2(RedisReceiver redisReceiver) {
|
||||
//
|
||||
// return new MessageListenerAdapter(redisReceiver, "receiveMessage2");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
// *
|
||||
// * @param redisReceiver
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// MessageListenerAdapter listenerAdapterkg(RedisReceiver redisReceiver) {
|
||||
//
|
||||
// return new MessageListenerAdapter(redisReceiver, "receiveMessage3");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
|
||||
// *
|
||||
// * @param redisReceiver
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// MessageListenerAdapter listenerAdapterwg(RedisReceiver redisReceiver) {
|
||||
//
|
||||
// return new MessageListenerAdapter(redisReceiver, "receiveMessage4");
|
||||
// }
|
||||
// @Bean
|
||||
// MessageListenerAdapter listenerAdapterhb(RedisReceiver redisReceiver) {
|
||||
//
|
||||
// return new MessageListenerAdapter(redisReceiver, "receiveMessage5");
|
||||
// }
|
||||
//
|
||||
// // 使用默认的工厂初始化redis操作模板
|
||||
// @Bean
|
||||
// StringRedisTemplate template(RedisConnectionFactory connectionFactory) {
|
||||
// return new StringRedisTemplate(connectionFactory);
|
||||
// }
|
||||
//}
|
||||
@ -1,86 +1,86 @@
|
||||
package com.weiqi.mis.redis;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.weiqi.mis.Z;
|
||||
import com.weiqi.util.SmsTools;
|
||||
import com.weiqi.vo.SmsGlobalIndex;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@Service
|
||||
public class RedisReceiver {
|
||||
private static final Logger log = LoggerFactory.getLogger(RedisReceiver.class);
|
||||
|
||||
public void receiveMessage(String message) {
|
||||
|
||||
try {
|
||||
|
||||
List<SmsGlobalIndex> jsonObj = Z.fromJSON(new TypeReference<List<SmsGlobalIndex>>() {}, message);
|
||||
SmsTools.sv = jsonObj;
|
||||
|
||||
log.info("SmsTools.sv 消息条数为:{},info={}", SmsTools.sv.size(), SmsTools.sv);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("消息来了:{}", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** 接收消息的方法 */
|
||||
public void receiveMessage2(String message) {
|
||||
|
||||
try {
|
||||
SmsTools.sendTotalNum = Integer.parseInt(message);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
log.error("消息来了2:{}", e);
|
||||
}
|
||||
log.info("SmsTools.sendTotalNum ={}", SmsTools.sendTotalNum);
|
||||
|
||||
}
|
||||
|
||||
/** 接收消息的方法 */
|
||||
public void receiveMessage3(String message) {
|
||||
|
||||
try {
|
||||
SmsTools.isRedisStatistic = message.equalsIgnoreCase("1") ? true : false;
|
||||
|
||||
log.info("消息来了3:{}", SmsTools.isRedisStatistic);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
log.error("消息来了3:{}", e);
|
||||
}
|
||||
log.info("SmsTools.sendTotalNum ={}", SmsTools.sendTotalNum);
|
||||
|
||||
}
|
||||
|
||||
/** 接收消息的方法 */
|
||||
public void receiveMessage4(String message) {
|
||||
|
||||
try {
|
||||
SmsTools.isRedisStatisticUP = message.equalsIgnoreCase("1") ? true : false;
|
||||
|
||||
log.info("消息来了4:{}", SmsTools.isRedisStatisticUP);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
log.error("消息来了4:{}", e);
|
||||
}
|
||||
log.info("SmsTools.sendTotalNum ={}", SmsTools.sendTotalNum);
|
||||
|
||||
}
|
||||
/** 心跳 */
|
||||
public void receiveMessage5(String message) {
|
||||
|
||||
try {
|
||||
log.info("心跳消息来了5:{}",message);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
log.error("心跳消息来了5:{}", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//package com.weiqi.mis.redis;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import com.weiqi.mis.Z;
|
||||
//import com.weiqi.util.SmsTools;
|
||||
//import com.weiqi.vo.SmsGlobalIndex;
|
||||
//import com.fasterxml.jackson.core.type.TypeReference;
|
||||
//
|
||||
//@Service
|
||||
//public class RedisReceiver {
|
||||
// private static final Logger log = LoggerFactory.getLogger(RedisReceiver.class);
|
||||
//
|
||||
// public void receiveMessage(String message) {
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// List<SmsGlobalIndex> jsonObj = Z.fromJSON(new TypeReference<List<SmsGlobalIndex>>() {}, message);
|
||||
// SmsTools.sv = jsonObj;
|
||||
//
|
||||
// log.info("SmsTools.sv 消息条数为:{},info={}", SmsTools.sv.size(), SmsTools.sv);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// log.error("消息来了:{}", e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /** 接收消息的方法 */
|
||||
// public void receiveMessage2(String message) {
|
||||
//
|
||||
// try {
|
||||
// SmsTools.sendTotalNum = Integer.parseInt(message);
|
||||
// } catch (NumberFormatException e) {
|
||||
// e.printStackTrace();
|
||||
// log.error("消息来了2:{}", e);
|
||||
// }
|
||||
// log.info("SmsTools.sendTotalNum ={}", SmsTools.sendTotalNum);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /** 接收消息的方法 */
|
||||
// public void receiveMessage3(String message) {
|
||||
//
|
||||
// try {
|
||||
// SmsTools.isRedisStatistic = message.equalsIgnoreCase("1") ? true : false;
|
||||
//
|
||||
// log.info("消息来了3:{}", SmsTools.isRedisStatistic);
|
||||
// } catch (NumberFormatException e) {
|
||||
// e.printStackTrace();
|
||||
// log.error("消息来了3:{}", e);
|
||||
// }
|
||||
// log.info("SmsTools.sendTotalNum ={}", SmsTools.sendTotalNum);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /** 接收消息的方法 */
|
||||
// public void receiveMessage4(String message) {
|
||||
//
|
||||
// try {
|
||||
// SmsTools.isRedisStatisticUP = message.equalsIgnoreCase("1") ? true : false;
|
||||
//
|
||||
// log.info("消息来了4:{}", SmsTools.isRedisStatisticUP);
|
||||
// } catch (NumberFormatException e) {
|
||||
// e.printStackTrace();
|
||||
// log.error("消息来了4:{}", e);
|
||||
// }
|
||||
// log.info("SmsTools.sendTotalNum ={}", SmsTools.sendTotalNum);
|
||||
//
|
||||
// }
|
||||
// /** 心跳 */
|
||||
// public void receiveMessage5(String message) {
|
||||
//
|
||||
// try {
|
||||
// log.info("心跳消息来了5:{}",message);
|
||||
// } catch (NumberFormatException e) {
|
||||
// e.printStackTrace();
|
||||
// log.error("心跳消息来了5:{}", e);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
Loading…
Reference in New Issue
Block a user