@@ -124,6 +124,11 @@ | |||
<groupId>org.springframework.data</groupId> | |||
<artifactId>spring-data-redis</artifactId> | |||
</dependency> | |||
<!-- Redis 起始依赖 --> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-data-redis-reactive</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.security</groupId> | |||
<artifactId>spring-security-core</artifactId> |
@@ -0,0 +1,52 @@ | |||
package com.tuoheng.common.core.common; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* 全局枚举常量类 | |||
* | |||
* @author zhu_zishuang | |||
* @date 2021-03-12 | |||
*/ | |||
@Accessors(chain = true) | |||
@AllArgsConstructor | |||
public enum OperationEnum implements ExceptionInterface { | |||
/** | |||
* 登陆成功 | |||
*/ | |||
LOGIN_SUCCESS(200, "登陆成功!"), | |||
/** | |||
* 新增操作成功 | |||
*/ | |||
SAVE_SUCCESS(201, "新增成功!"), | |||
/** | |||
* 修改操作成功 | |||
*/ | |||
UPDATE_SUCCESS(202, "修改成功!"), | |||
/** | |||
* 删除操作成功 | |||
*/ | |||
DELETE_SUCCESS(203, "删除成功!"), | |||
/** | |||
* 操作异常 | |||
*/ | |||
OPERATION_ERROR(204, "操作失败!"), | |||
/** | |||
* 操作成功 | |||
*/ | |||
OPERATION_SUCCESS(205, "操作成功!"); | |||
/** | |||
* 结果类型CODE | |||
*/ | |||
@Getter | |||
private final int code; | |||
/** | |||
* 结果类型描述 | |||
*/ | |||
@Getter | |||
private final String message; | |||
} |
@@ -0,0 +1,163 @@ | |||
package com.tuoheng.common.core.config; | |||
import com.tuoheng.common.core.utils.RedisUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.data.redis.connection.RedisConnectionFactory; | |||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | |||
import org.springframework.data.redis.core.RedisTemplate; | |||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; | |||
import org.springframework.data.redis.serializer.StringRedisSerializer; | |||
@Configuration | |||
//@PropertySource("classpath:redis.properties") | |||
public class RedisConfig { | |||
@Value("${spring.redis.host}") | |||
private String hostName; | |||
@Value("${spring.redis.port}") | |||
private Integer port; | |||
@Value("${spring.redis.password}") | |||
private String password; | |||
@Value("${spring.redis.timeout}") | |||
private Integer timeout; | |||
/* | |||
@Value("${redis.maxIdle}") | |||
private Integer maxIdle; | |||
@Value("${redis.maxTotal}") | |||
private Integer maxTotal; | |||
@Value("${redis.maxWaitMillis}") | |||
private Integer maxWaitMillis; | |||
@Value("${redis.minEvictableIdleTimeMillis}") | |||
private Integer minEvictableIdleTimeMillis; | |||
@Value("${redis.numTestsPerEvictionRun}") | |||
private Integer numTestsPerEvictionRun; | |||
@Value("${redis.timeBetweenEvictionRunsMillis}") | |||
private long timeBetweenEvictionRunsMillis; | |||
@Value("${redis.testOnBorrow}") | |||
private boolean testOnBorrow; | |||
@Value("${redis.testWhileIdle}") | |||
private boolean testWhileIdle; | |||
*/ | |||
/** | |||
* JedisPoolConfig 连接池 | |||
* @return | |||
@Bean public JedisPoolConfig jedisPoolConfig() { | |||
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); | |||
// 最大空闲数 | |||
jedisPoolConfig.setMaxIdle(maxIdle); | |||
// 连接池的最大数据库连接数 | |||
jedisPoolConfig.setMaxTotal(maxTotal); | |||
// 最大建立连接等待时间 | |||
jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); | |||
// 逐出连接的最小空闲时间 默认1800000毫秒(30分钟) | |||
jedisPoolConfig.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); | |||
// 每次逐出检查时 逐出的最大数目 如果为负数就是 : 1/abs(n), 默认3 | |||
jedisPoolConfig.setNumTestsPerEvictionRun(numTestsPerEvictionRun); | |||
// 逐出扫描的时间间隔(毫秒) 如果为负数,则不运行逐出线程, 默认-1 | |||
jedisPoolConfig.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); | |||
// 是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个 | |||
jedisPoolConfig.setTestOnBorrow(testOnBorrow); | |||
// 在空闲时检查有效性, 默认false | |||
jedisPoolConfig.setTestWhileIdle(testWhileIdle); | |||
return jedisPoolConfig; | |||
} | |||
/** | |||
* 单机版配置 | |||
* @Title: JedisConnectionFactory | |||
* @param @param jedisPoolConfig | |||
* @param @return | |||
* @return JedisConnectionFactory | |||
* @autor lpl | |||
* @date 2018年2月24日 | |||
* @throws | |||
@Bean public JedisConnectionFactory jedisConnectionFactory(){ | |||
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); | |||
redisStandaloneConfiguration.setHostName(hostName); | |||
redisStandaloneConfiguration.setPort(port); | |||
redisStandaloneConfiguration.setPassword(password); | |||
JedisClientConfiguration.JedisClientConfigurationBuilder jedisClientConfigurationBuilder = JedisClientConfiguration.builder(); | |||
jedisClientConfigurationBuilder.connectTimeout(Duration.ofMillis(timeout)); | |||
JedisConnectionFactory factory = new JedisConnectionFactory(redisStandaloneConfiguration,jedisClientConfigurationBuilder.build()); | |||
return factory; | |||
} | |||
*/ | |||
/** | |||
* 实例化 RedisTemplate 对象 jredis实现方式,springboot2.x以后使用下面的方法 | |||
* | |||
* @return | |||
@Bean public RedisTemplate<String, Object> functionDomainRedisTemplate(RedisConnectionFactory redisConnectionFactory) { | |||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); | |||
initDomainRedisTemplate(redisTemplate, redisConnectionFactory); | |||
return redisTemplate; | |||
} | |||
*/ | |||
/** | |||
* lettuce实现redis方式 | |||
* | |||
* @param redisConnectionFactory | |||
* @return | |||
*/ | |||
@Bean | |||
public RedisTemplate<String, Object> redisCacheTemplate(LettuceConnectionFactory redisConnectionFactory) { | |||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); | |||
initDomainRedisTemplate(redisTemplate, redisConnectionFactory); | |||
return redisTemplate; | |||
} | |||
/** | |||
* 设置数据存入 redis 的序列化方式,并开启事务 | |||
* | |||
* @param redisTemplate | |||
* @param factory | |||
*/ | |||
private void initDomainRedisTemplate(RedisTemplate<String, Object> redisTemplate, RedisConnectionFactory factory) { | |||
//如果不配置Serializer,那么存储的时候缺省使用String,如果用User类型存储,那么会提示错误User can't cast to String! | |||
redisTemplate.setKeySerializer(new StringRedisSerializer()); | |||
redisTemplate.setHashKeySerializer(new StringRedisSerializer()); | |||
redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); | |||
redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer()); | |||
// 开启事务 | |||
redisTemplate.setEnableTransactionSupport(true); | |||
redisTemplate.setConnectionFactory(factory); | |||
} | |||
/** | |||
* 注入封装RedisTemplate | |||
* | |||
* @return RedisUtil | |||
* @throws | |||
* @Title: redisUtil | |||
* @autor lpl | |||
* @date 2017年12月21日 | |||
*/ | |||
@Bean(name = "redisUtils") | |||
public RedisUtils redisUtils(RedisTemplate<String, Object> redisTemplate) { | |||
RedisUtils redisUtil = new RedisUtils(); | |||
redisUtil.setRedisTemplate(redisTemplate); | |||
return redisUtil; | |||
} | |||
// @Bean("redissonClient") | |||
// public Redisson getRedisson(){ | |||
// Config config = new Config(); | |||
// String redisson_url = String.format(Locale.ENGLISH, "redis://%s:%s", hostName, port); | |||
// config.useSingleServer().setAddress(redisson_url).setDatabase(0); | |||
// return (Redisson) Redisson.create(config); | |||
// } | |||
} |
@@ -33,6 +33,11 @@ public class CommonConfig { | |||
*/ | |||
public static String channelUrl; | |||
/** | |||
* 飞手平台URL | |||
*/ | |||
public static String pilotURL; | |||
/** | |||
* 图片域名赋值 | |||
* | |||
@@ -82,4 +87,14 @@ public class CommonConfig { | |||
public void setChannelUrl(String url) { | |||
channelUrl = url; | |||
} | |||
/** | |||
* 飞手平台 | |||
* @param url 不同环境对应不同的url | |||
*/ | |||
@Value("${tuoheng.pilot-url}") | |||
public void setPilotURL(String url) { | |||
pilotURL = url; | |||
} | |||
} |
@@ -0,0 +1,608 @@ | |||
package com.tuoheng.common.core.utils; | |||
import org.springframework.data.redis.core.RedisTemplate; | |||
import org.springframework.transaction.annotation.Propagation; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.util.CollectionUtils; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Set; | |||
import java.util.concurrent.TimeUnit; | |||
public class RedisUtils { | |||
private RedisTemplate<String, Object> redisTemplate; | |||
public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) { | |||
this.redisTemplate = redisTemplate; | |||
} | |||
// =============================common============================ | |||
/** | |||
* 普通缓存获取 | |||
* | |||
* @param | |||
* @return 值 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public Set<String> keys(String pattern) { | |||
return redisTemplate.keys(pattern); | |||
} | |||
/** | |||
* 指定缓存失效时间 | |||
* | |||
* @param key 键 | |||
* @param time 时间(秒) | |||
* @return | |||
*/ | |||
public boolean expire(String key, long time) { | |||
try { | |||
if (time > 0) { | |||
redisTemplate.expire(key, time, TimeUnit.SECONDS); | |||
} | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 根据key 获取过期时间 | |||
* | |||
* @param key 键 不能为null | |||
* @return 时间(秒) 返回0代表为永久有效 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public long getExpire(String key) { | |||
return redisTemplate.getExpire(key, TimeUnit.SECONDS); | |||
} | |||
/** | |||
* 判断key是否存在 | |||
* | |||
* @param key 键 | |||
* @return true 存在 false不存在 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public boolean hasKey(String key) { | |||
try { | |||
return redisTemplate.hasKey(key); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 删除缓存 | |||
* | |||
* @param key 可以传一个值 或多个 | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public void del(String... key) { | |||
if (key != null && key.length > 0) { | |||
if (key.length == 1) { | |||
redisTemplate.delete(key[0]); | |||
} else { | |||
redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key)); | |||
} | |||
} | |||
} | |||
// ============================String============================= | |||
/** | |||
* 普通缓存获取 | |||
* | |||
* @param key 键 | |||
* @return 值 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public Object get(String key) { | |||
return key == null ? null : redisTemplate.opsForValue().get(key); | |||
} | |||
/** | |||
* 普通缓存放入 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @return true成功 false失败 | |||
*/ | |||
public boolean set(String key, Object value) { | |||
try { | |||
redisTemplate.opsForValue().set(key, value); | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 普通缓存放入并设置时间 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 | |||
* @return true成功 false 失败 | |||
*/ | |||
public boolean set(String key, Object value, long time) { | |||
try { | |||
if (time > 0) { | |||
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); | |||
} else { | |||
set(key, value); | |||
} | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 递增 | |||
* | |||
* @param key 键 | |||
* @param delta 要增加几(大于0) | |||
* @return | |||
*/ | |||
public long incr(String key, long delta) { | |||
if (delta < 0) { | |||
throw new RuntimeException("递增因子必须大于0"); | |||
} | |||
return redisTemplate.opsForValue().increment(key, delta); | |||
} | |||
/** | |||
* 递减 | |||
* | |||
* @param key 键 | |||
* @param delta 要减少几(小于0) | |||
* @return | |||
*/ | |||
public long decr(String key, long delta) { | |||
if (delta < 0) { | |||
throw new RuntimeException("递减因子必须大于0"); | |||
} | |||
return redisTemplate.opsForValue().increment(key, -delta); | |||
} | |||
// ================================Map================================= | |||
/** | |||
* HashGet | |||
* | |||
* @param key 键 不能为null | |||
* @param item 项 不能为null | |||
* @return 值 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public Object hget(String key, String item) { | |||
return redisTemplate.opsForHash().get(key, item); | |||
} | |||
/** | |||
* 获取hashKey对应的所有键值 | |||
* | |||
* @param key 键 | |||
* @return 对应的多个键值 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public Map<Object, Object> hmget(String key) { | |||
return redisTemplate.opsForHash().entries(key); | |||
} | |||
/** | |||
* HashSet | |||
* | |||
* @param key 键 | |||
* @param map 对应多个键值 | |||
* @return true 成功 false 失败 | |||
*/ | |||
public boolean hmset(String key, Map<String, Object> map) { | |||
try { | |||
redisTemplate.opsForHash().putAll(key, map); | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* HashSet 并设置时间 | |||
* | |||
* @param key 键 | |||
* @param map 对应多个键值 | |||
* @param time 时间(秒) | |||
* @return true成功 false失败 | |||
*/ | |||
public boolean hmset(String key, Map<String, Object> map, long time) { | |||
try { | |||
redisTemplate.opsForHash().putAll(key, map); | |||
if (time > 0) { | |||
expire(key, time); | |||
} | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 向一张hash表中放入数据,如果不存在将创建 | |||
* | |||
* @param key 键 | |||
* @param item 项 | |||
* @param value 值 | |||
* @return true 成功 false失败 | |||
*/ | |||
public boolean hset(String key, String item, Object value) { | |||
try { | |||
redisTemplate.opsForHash().put(key, item, value); | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 向一张hash表中放入数据,如果不存在将创建 | |||
* | |||
* @param key 键 | |||
* @param item 项 | |||
* @param value 值 | |||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 | |||
* @return true 成功 false失败 | |||
*/ | |||
public boolean hset(String key, String item, Object value, long time) { | |||
try { | |||
redisTemplate.opsForHash().put(key, item, value); | |||
if (time > 0) { | |||
expire(key, time); | |||
} | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 删除hash表中的值 | |||
* | |||
* @param key 键 不能为null | |||
* @param item 项 可以使多个 不能为null | |||
*/ | |||
public void hdel(String key, Object... item) { | |||
redisTemplate.opsForHash().delete(key, item); | |||
} | |||
/** | |||
* 判断hash表中是否有该项的值 | |||
* | |||
* @param key 键 不能为null | |||
* @param item 项 不能为null | |||
* @return true 存在 false不存在 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public boolean hHasKey(String key, String item) { | |||
return redisTemplate.opsForHash().hasKey(key, item); | |||
} | |||
/** | |||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回 | |||
* | |||
* @param key 键 | |||
* @param item 项 | |||
* @param by 要增加几(大于0) | |||
* @return | |||
*/ | |||
public double hincr(String key, String item, double by) { | |||
return redisTemplate.opsForHash().increment(key, item, by); | |||
} | |||
/** | |||
* hash递减 | |||
* | |||
* @param key 键 | |||
* @param item 项 | |||
* @param by 要减少记(小于0) | |||
* @return | |||
*/ | |||
public double hdecr(String key, String item, double by) { | |||
return redisTemplate.opsForHash().increment(key, item, -by); | |||
} | |||
// ============================set============================= | |||
/** | |||
* 根据key获取Set中的所有值 | |||
* | |||
* @param key 键 | |||
* @return | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public Set<Object> sGet(String key) { | |||
try { | |||
return redisTemplate.opsForSet().members(key); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return null; | |||
} | |||
} | |||
/** | |||
* 根据value从一个set中查询,是否存在 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @return true 存在 false不存在 | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public boolean sHasKey(String key, Object value) { | |||
try { | |||
return redisTemplate.opsForSet().isMember(key, value); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 将数据放入set缓存 | |||
* | |||
* @param key 键 | |||
* @param values 值 可以是多个 | |||
* @return 成功个数 | |||
*/ | |||
public long sSet(String key, Object... values) { | |||
try { | |||
return redisTemplate.opsForSet().add(key, values); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return 0; | |||
} | |||
} | |||
/** | |||
* 将set数据放入缓存 | |||
* | |||
* @param key 键 | |||
* @param time 时间(秒) | |||
* @param values 值 可以是多个 | |||
* @return 成功个数 | |||
*/ | |||
public long sSetAndTime(String key, long time, Object... values) { | |||
try { | |||
Long count = redisTemplate.opsForSet().add(key, values); | |||
if (time > 0) { | |||
expire(key, time); | |||
} | |||
return count; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return 0; | |||
} | |||
} | |||
/** | |||
* 获取set缓存的长度 | |||
* | |||
* @param key 键 | |||
* @return | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public long sGetSetSize(String key) { | |||
try { | |||
return redisTemplate.opsForSet().size(key); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return 0; | |||
} | |||
} | |||
/** | |||
* 移除值为value的 | |||
* | |||
* @param key 键 | |||
* @param values 值 可以是多个 | |||
* @return 移除的个数 | |||
*/ | |||
public long setRemove(String key, Object... values) { | |||
try { | |||
Long count = redisTemplate.opsForSet().remove(key, values); | |||
return count; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return 0; | |||
} | |||
} | |||
// ===============================list================================= | |||
/** | |||
* 获取list缓存的内容 | |||
* | |||
* @param key 键 | |||
* @param start 开始 | |||
* @param end 结束 0 到 -1代表所有值 | |||
* @return | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public List<Object> lGet(String key, long start, long end) { | |||
try { | |||
return redisTemplate.opsForList().range(key, start, end); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return null; | |||
} | |||
} | |||
/** | |||
* 获取list缓存的长度 | |||
* | |||
* @param key 键 | |||
* @return | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public long lGetListSize(String key) { | |||
try { | |||
return redisTemplate.opsForList().size(key); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return 0; | |||
} | |||
} | |||
/** | |||
* 通过索引 获取list中的值 | |||
* | |||
* @param key 键 | |||
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 | |||
* @return | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public Object lGetIndex(String key, long index) { | |||
try { | |||
return redisTemplate.opsForList().index(key, index); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return null; | |||
} | |||
} | |||
/** | |||
* 将list放入缓存 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @param time 时间(秒) | |||
* @return | |||
*/ | |||
public boolean lSet(String key, Object value) { | |||
try { | |||
redisTemplate.opsForList().rightPush(key, value); | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 将list放入缓存 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @param time 时间(秒) | |||
* @return | |||
*/ | |||
public boolean lSet(String key, Object value, long time) { | |||
try { | |||
redisTemplate.opsForList().rightPush(key, value); | |||
if (time > 0) { | |||
expire(key, time); | |||
} | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 将list放入缓存 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @param time 时间(秒) | |||
* @return | |||
*/ | |||
public boolean lSet(String key, List<Object> value) { | |||
try { | |||
redisTemplate.opsForList().rightPushAll(key, value); | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 将list放入缓存 | |||
* | |||
* @param key 键 | |||
* @param value 值 | |||
* @param time 时间(秒) | |||
* @return | |||
*/ | |||
public boolean lSet(String key, List<Object> value, long time) { | |||
try { | |||
redisTemplate.opsForList().rightPushAll(key, value); | |||
if (time > 0) { | |||
expire(key, time); | |||
} | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 根据索引修改list中的某条数据 | |||
* | |||
* @param key 键 | |||
* @param index 索引 | |||
* @param value 值 | |||
* @return | |||
*/ | |||
public boolean lUpdateIndex(String key, long index, Object value) { | |||
try { | |||
redisTemplate.opsForList().set(key, index, value); | |||
return true; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return false; | |||
} | |||
} | |||
/** | |||
* 移除N个值为value | |||
* | |||
* @param key 键 | |||
* @param count 移除多少个 | |||
* @param value 值 | |||
* @return 移除的个数 | |||
*/ | |||
public long lRemove(String key, long count, Object value) { | |||
try { | |||
Long remove = redisTemplate.opsForList().remove(key, count, value); | |||
return remove; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
return 0; | |||
} | |||
} | |||
/** | |||
* 按键的排序获取对应的值 | |||
* | |||
* @param keys 多个键 | |||
* @return List<Object> | |||
*/ | |||
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) | |||
public List<Object> mget(Collection<String> keys) { | |||
return redisTemplate.opsForValue().multiGet(keys); | |||
} | |||
} |
@@ -3,11 +3,12 @@ package com.tuoheng.admin; | |||
import org.mybatis.spring.annotation.MapperScan; | |||
import org.springframework.boot.SpringApplication; | |||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration; | |||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | |||
import org.springframework.cloud.openfeign.EnableFeignClients; | |||
import org.springframework.scheduling.annotation.EnableAsync; | |||
@SpringBootApplication | |||
@SpringBootApplication(scanBasePackages = {"com.tuoheng.*"}, exclude = {MultipartAutoConfiguration.class}) | |||
@EnableDiscoveryClient | |||
@EnableFeignClients(basePackages = "com.tuoheng") | |||
@MapperScan("com.tuoheng.**.**.mapper") |
@@ -1,70 +1,70 @@ | |||
package com.tuoheng.admin.config; | |||
import lombok.Data; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Configuration; | |||
@Configuration | |||
@Data | |||
public class CommonConfig { | |||
/** | |||
* 图片域名 | |||
*/ | |||
public static String imageURL; | |||
/** | |||
* OSS域名 | |||
*/ | |||
public static String ossURL; | |||
/** | |||
* 视频域名 | |||
*/ | |||
public static String videoURL; | |||
/** | |||
* oidc地址 | |||
*/ | |||
public static String oidcUrl; | |||
/** | |||
* 图片域名赋值 | |||
* | |||
* @param url 域名地址 | |||
*/ | |||
@Value("${tuoheng.image-url}") | |||
public void setImageURL(String url) { | |||
imageURL = url; | |||
} | |||
/** | |||
* 阿里云OSS域名 | |||
* | |||
* @param url 图片地址 | |||
*/ | |||
@Value("${tuoheng.oss-url}") | |||
public void setOssURL(String url) { | |||
ossURL = url; | |||
} | |||
/** | |||
* 视频域名赋值 | |||
* | |||
* @param url 域名地址 | |||
*/ | |||
@Value("${tuoheng.video-url}") | |||
public void setVideoURL(String url) { | |||
videoURL = url; | |||
} | |||
/** | |||
* oidc地址赋值 | |||
* | |||
* @param url 通道地址 | |||
*/ | |||
@Value("${tuoheng.oidc-url}") | |||
public void setOidcUrl(String url) { | |||
oidcUrl = url; | |||
} | |||
} | |||
//package com.tuoheng.admin.config; | |||
// | |||
//import lombok.Data; | |||
//import org.springframework.beans.factory.annotation.Value; | |||
//import org.springframework.context.annotation.Configuration; | |||
// | |||
//@Configuration | |||
//@Data | |||
//public class CommonConfig { | |||
// | |||
// /** | |||
// * 图片域名 | |||
// */ | |||
// public static String imageURL; | |||
// | |||
// /** | |||
// * OSS域名 | |||
// */ | |||
// public static String ossURL; | |||
// | |||
// /** | |||
// * 视频域名 | |||
// */ | |||
// public static String videoURL; | |||
// | |||
// /** | |||
// * oidc地址 | |||
// */ | |||
// public static String oidcUrl; | |||
// | |||
// /** | |||
// * 图片域名赋值 | |||
// * | |||
// * @param url 域名地址 | |||
// */ | |||
// @Value("${tuoheng.image-url}") | |||
// public void setImageURL(String url) { | |||
// imageURL = url; | |||
// } | |||
// | |||
// /** | |||
// * 阿里云OSS域名 | |||
// * | |||
// * @param url 图片地址 | |||
// */ | |||
// @Value("${tuoheng.oss-url}") | |||
// public void setOssURL(String url) { | |||
// ossURL = url; | |||
// } | |||
// | |||
// /** | |||
// * 视频域名赋值 | |||
// * | |||
// * @param url 域名地址 | |||
// */ | |||
// @Value("${tuoheng.video-url}") | |||
// public void setVideoURL(String url) { | |||
// videoURL = url; | |||
// } | |||
// | |||
// /** | |||
// * oidc地址赋值 | |||
// * | |||
// * @param url 通道地址 | |||
// */ | |||
// @Value("${tuoheng.oidc-url}") | |||
// public void setOidcUrl(String url) { | |||
// oidcUrl = url; | |||
// } | |||
//} |
@@ -1,29 +1,29 @@ | |||
package com.tuoheng.admin.config; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.http.client.ClientHttpRequestFactory; | |||
import org.springframework.http.client.SimpleClientHttpRequestFactory; | |||
import org.springframework.web.client.RestTemplate; | |||
/** | |||
* 第三方配置 | |||
* @Author: xiaoying | |||
* @Date: 2022/10/18 9:02 | |||
*/ | |||
@Configuration | |||
public class RestTemplateConfig { | |||
@Bean | |||
public RestTemplate restTemplate(ClientHttpRequestFactory factory){ | |||
return new RestTemplate(factory); | |||
} | |||
@Bean | |||
public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ | |||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); | |||
factory.setConnectTimeout(30000); | |||
factory.setReadTimeout(30000); | |||
return factory; | |||
} | |||
} | |||
//package com.tuoheng.admin.config; | |||
// | |||
//import org.springframework.context.annotation.Bean; | |||
//import org.springframework.context.annotation.Configuration; | |||
//import org.springframework.http.client.ClientHttpRequestFactory; | |||
//import org.springframework.http.client.SimpleClientHttpRequestFactory; | |||
//import org.springframework.web.client.RestTemplate; | |||
// | |||
///** | |||
// * 第三方配置 | |||
// * @Author: xiaoying | |||
// * @Date: 2022/10/18 9:02 | |||
// */ | |||
//@Configuration | |||
//public class RestTemplateConfig { | |||
// | |||
// @Bean | |||
// public RestTemplate restTemplate(ClientHttpRequestFactory factory){ | |||
// return new RestTemplate(factory); | |||
// } | |||
// | |||
// @Bean | |||
// public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ | |||
// SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); | |||
// factory.setConnectTimeout(30000); | |||
// factory.setReadTimeout(30000); | |||
// return factory; | |||
// } | |||
//} |
@@ -1,86 +1,86 @@ | |||
package com.tuoheng.admin.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; | |||
/** | |||
* xxl-job config | |||
* | |||
* @author xuxueli 2017-04-28 | |||
*/ | |||
@Configuration | |||
@ConditionalOnProperty(name = XxlJobConfig.XXL_ENABLE, havingValue = XxlJobConfig.TRUE) | |||
public class XxlJobConfig { | |||
public static final String XXL_ENABLE = "xxl.enable"; | |||
public static final String TRUE = "true"; | |||
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); | |||
@Value("${xxl.job.admin.addresses}") | |||
private String adminAddresses; | |||
@Value("${xxl.job.accessToken}") | |||
private String accessToken; | |||
@Value("${xxl.job.executor.appname}") | |||
private String appname; | |||
@Value("${xxl.job.executor.address}") | |||
private String address; | |||
@Value("${xxl.job.executor.ip}") | |||
private String ip; | |||
@Value("${xxl.job.executor.port}") | |||
private int port; | |||
@Value("${xxl.job.executor.logpath}") | |||
private String logPath; | |||
@Value("${xxl.job.executor.logretentiondays}") | |||
private int logRetentionDays; | |||
@Bean | |||
public XxlJobSpringExecutor xxlJobExecutor() throws InterruptedException { | |||
logger.info(">>>>>>>>>>> xxl-job config init."); | |||
Thread.sleep(5000); | |||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); | |||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); | |||
xxlJobSpringExecutor.setAppname(appname); | |||
xxlJobSpringExecutor.setAddress(address); | |||
xxlJobSpringExecutor.setIp(ip); | |||
xxlJobSpringExecutor.setPort(port); | |||
xxlJobSpringExecutor.setAccessToken(accessToken); | |||
xxlJobSpringExecutor.setLogPath(logPath); | |||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); | |||
return xxlJobSpringExecutor; | |||
} | |||
/** | |||
* 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP; | |||
* | |||
* 1、引入依赖: | |||
* <dependency> | |||
* <groupId>org.springframework.cloud</groupId> | |||
* <artifactId>spring-cloud-commons</artifactId> | |||
* <version>${version}</version> | |||
* </dependency> | |||
* | |||
* 2、配置文件,或者容器启动变量 | |||
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.' | |||
* | |||
* 3、获取IP | |||
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); | |||
*/ | |||
} | |||
//package com.tuoheng.admin.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; | |||
// | |||
///** | |||
// * xxl-job config | |||
// * | |||
// * @author xuxueli 2017-04-28 | |||
// */ | |||
//@Configuration | |||
//@ConditionalOnProperty(name = XxlJobConfig.XXL_ENABLE, havingValue = XxlJobConfig.TRUE) | |||
//public class XxlJobConfig { | |||
// | |||
// public static final String XXL_ENABLE = "xxl.enable"; | |||
// | |||
// public static final String TRUE = "true"; | |||
// | |||
// private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); | |||
// | |||
// @Value("${xxl.job.admin.addresses}") | |||
// private String adminAddresses; | |||
// | |||
// @Value("${xxl.job.accessToken}") | |||
// private String accessToken; | |||
// | |||
// @Value("${xxl.job.executor.appname}") | |||
// private String appname; | |||
// | |||
// @Value("${xxl.job.executor.address}") | |||
// private String address; | |||
// | |||
// @Value("${xxl.job.executor.ip}") | |||
// private String ip; | |||
// | |||
// @Value("${xxl.job.executor.port}") | |||
// private int port; | |||
// | |||
// @Value("${xxl.job.executor.logpath}") | |||
// private String logPath; | |||
// | |||
// @Value("${xxl.job.executor.logretentiondays}") | |||
// private int logRetentionDays; | |||
// | |||
// | |||
// @Bean | |||
// public XxlJobSpringExecutor xxlJobExecutor() throws InterruptedException { | |||
// logger.info(">>>>>>>>>>> xxl-job config init."); | |||
// Thread.sleep(5000); | |||
// XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); | |||
// xxlJobSpringExecutor.setAdminAddresses(adminAddresses); | |||
// xxlJobSpringExecutor.setAppname(appname); | |||
// xxlJobSpringExecutor.setAddress(address); | |||
// xxlJobSpringExecutor.setIp(ip); | |||
// xxlJobSpringExecutor.setPort(port); | |||
// xxlJobSpringExecutor.setAccessToken(accessToken); | |||
// xxlJobSpringExecutor.setLogPath(logPath); | |||
// xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); | |||
// | |||
// return xxlJobSpringExecutor; | |||
// } | |||
// | |||
// /** | |||
// * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP; | |||
// * | |||
// * 1、引入依赖: | |||
// * <dependency> | |||
// * <groupId>org.springframework.cloud</groupId> | |||
// * <artifactId>spring-cloud-commons</artifactId> | |||
// * <version>${version}</version> | |||
// * </dependency> | |||
// * | |||
// * 2、配置文件,或者容器启动变量 | |||
// * spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.' | |||
// * | |||
// * 3、获取IP | |||
// * String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); | |||
// */ | |||
// | |||
// | |||
//} |
@@ -12,4 +12,25 @@ public interface SystemConstant { | |||
*/ | |||
String GAO_DE_URL = "https://restapi.amap.com/v3/geocode/regeo"; | |||
/** | |||
* 机场平台:获取机场列表接口 | |||
*/ | |||
String API_AIRPORT_LIST = "/api/airportInterface/airportList"; | |||
/** | |||
* 机场平台:获取机场路线列表接口 | |||
*/ | |||
String API_AIRPORT_LINE_LIST = "/api/airportInterface/taskByDroneId"; | |||
/** | |||
* 机场平台:执行接口 | |||
*/ | |||
String API_AIRPORT_EXECUTE_TASK = "/api/airportInterface/executeTask"; | |||
// 飞手平台不同接口url | |||
/** | |||
* 新增任务接口 | |||
*/ | |||
String ADD_PILOTTASK = "apiTask/add"; | |||
} |
@@ -35,7 +35,7 @@ public class AirPortController { | |||
* @param droneId 机场列表里面的droneId | |||
* @return | |||
*/ | |||
@GetMapping("/line/{droneId}") | |||
@GetMapping("/line/list/{droneId}") | |||
public JsonResult getAirLineList(@PathVariable("droneId") Integer droneId) { | |||
return airportService.getAirLineList(droneId); | |||
} |
@@ -39,10 +39,10 @@ public class DeptController { | |||
/** | |||
* 根据id查询子部门列表 | |||
*/ | |||
@GetMapping("/child/page/list/{id}") | |||
public JsonResult getChildList(@RequestBody QueryDeptChildPageListRequest queryDeptChildPageListRequest) { | |||
log.info("进入获取子部门分页列表列表接口, id:{}", queryDeptChildPageListRequest.getId()); | |||
return deptService.getChildPageList(queryDeptChildPageListRequest); | |||
@GetMapping("/child/list/{id}") | |||
public JsonResult getChildList(@PathVariable("id") String id) { | |||
log.info("进入获取子部门分页列表列表接口, id:{}", id); | |||
return deptService.getChildList(id); | |||
} | |||
/** |
@@ -0,0 +1,46 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.query.FlightDataQuery; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.common.core.common.OperationEnum; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@RestController | |||
@RequestMapping("/flightData") | |||
public class FlightDataController { | |||
@Autowired | |||
private IFlightDataService flightDataService; | |||
/** | |||
* 获取任务巡检坐标列表 | |||
* | |||
* @param flightDataQuery 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/getFlightDataList") | |||
public IPage<FlightData> getFlightDataList(FlightDataQuery flightDataQuery) { | |||
return flightDataService.getFlightDataList(flightDataQuery); | |||
} | |||
/** | |||
* 飞行遥测数据入库 | |||
* @param entity | |||
* @return | |||
*/ | |||
@PostMapping("/addCallback") | |||
public OperationEnum addCallback(@RequestBody FlightData entity){ | |||
flightDataService.addCallback(entity); | |||
return OperationEnum.OPERATION_SUCCESS; | |||
} | |||
} |
@@ -1,6 +1,9 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
@@ -30,17 +33,26 @@ public class InspectionController { | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult list(QueryInspectionPageListRequest request) { | |||
log.info("进入查询巡检任务分页列表"); | |||
log.info("进入查询巡检任务分页列表接口"); | |||
return iInspectionService.selectPageList(request); | |||
} | |||
/** | |||
* 获取巡检任务详细信息 | |||
* 获取巡检任务信息信息 | |||
*/ | |||
@GetMapping(value = "/{id}") | |||
public JsonResult getInfo(String id) { | |||
@GetMapping(value = "/info/{id}") | |||
public JsonResult getInfo(@PathVariable("id") String id) { | |||
log.info("进入查询任务详情接口, id={}", id); | |||
return iInspectionService.selectOneById(id); | |||
return iInspectionService.getInspectionInfo(id); | |||
} | |||
/** | |||
* 获取巡检任务详情信息 | |||
*/ | |||
@GetMapping(value = "/details/{id}") | |||
public JsonResult getDetails(@PathVariable("id") String id) { | |||
log.info("进入查询任务详情接口, id={}", id); | |||
return iInspectionService.getInspectionDetails(id); | |||
} | |||
/** | |||
@@ -72,12 +84,12 @@ public class InspectionController { | |||
/** | |||
* 根据机场id查询任务 | |||
* @param airportId | |||
* @param dto | |||
* @return | |||
*/ | |||
@GetMapping("/listByAirportId/{airportId}") | |||
public JsonResult getListByAirportId(@PathVariable("airportId") Integer airportId){ | |||
return iInspectionService.getListByAirportId(airportId); | |||
@GetMapping("/listByAirportId") | |||
public JsonResult getListByAirportId(InspectionDto dto){ | |||
return iInspectionService.getListByAirportId(dto); | |||
} | |||
/** | |||
@@ -89,4 +101,56 @@ public class InspectionController { | |||
public JsonResult videoById(@PathVariable("id") String id){ | |||
return iInspectionService.getVideoById(id); | |||
} | |||
/** | |||
* 获取飞行轨迹 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/findFlightData/{id}") | |||
public JsonResult finFlightData(@PathVariable("id") String id){ | |||
return iInspectionService.findFlightData(id); | |||
} | |||
/** | |||
* 根据巡检id查询最新一条遥测数据 | |||
* @param inspectionId | |||
* @return | |||
*/ | |||
@GetMapping("/getFlightDataByInspectionId") | |||
public FlightData getFlightDataByInspectionId(@RequestParam("inspectionId") String inspectionId){ | |||
return iInspectionService.getFlightDataByInspectionId(inspectionId); | |||
} | |||
/** | |||
* 重新提交巡检任务 | |||
*/ | |||
@PutMapping("/resubmit") | |||
public JsonResult resubmit(@RequestBody EditInspectionRequest editInspectionRequest) { | |||
log.info("进入重新提交任务接口, id={}", editInspectionRequest.getId()); | |||
return iInspectionService.resubmit(editInspectionRequest); | |||
} | |||
/** | |||
* 立即执行 | |||
* @param id | |||
* @return | |||
*/ | |||
@PostMapping("/execute/{id}") | |||
public JsonResult execute(@PathVariable("id") String id) { | |||
log.info("进入立即执行任务接口, id={}", id); | |||
return iInspectionService.execute(id); | |||
} | |||
/** | |||
* 根据用户id获取最新的五条任务信息 | |||
* @param | |||
* @return | |||
*/ | |||
@GetMapping("/getNewInspectionList") | |||
public JsonResult getNewInspectionList(){ | |||
return iInspectionService.getNewInspectionList(); | |||
} | |||
} |
@@ -1,11 +1,16 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest; | |||
import com.tuoheng.admin.service.IInspectionFileService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
@@ -27,5 +32,85 @@ public class InspectionFileController { | |||
return iInspectionFileService.getQuestionList(); | |||
} | |||
/** | |||
* 根据登录人角色获取该部门及子部门下任务问题列表 | |||
* @param query | |||
* @return | |||
*/ | |||
@GetMapping("/listByDeptUserType") | |||
public JsonResult getListByDeptUserType(InspectionFileQuery query){ | |||
return iInspectionFileService.getListByDeptUserType(query); | |||
} | |||
/** | |||
* 查询任务问题分页列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(QueryInspectionFilePageListRequest request){ | |||
return iInspectionFileService.getPageList(request); | |||
} | |||
/** | |||
* 根据任务ID查询任务问题分页列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/page/list/by/inspectionid") | |||
public JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request){ | |||
return iInspectionFileService.getPageListByInspectionId(request); | |||
} | |||
/** | |||
* 任务问题忽略 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/confirm/{idList}") | |||
public JsonResult confirm(@PathVariable("idList") List<String> idList){ | |||
return iInspectionFileService.confirm(idList); | |||
} | |||
/** | |||
* 任务问题忽略 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/ignore/{idList}") | |||
public JsonResult ignore(@PathVariable("idList") List<String> idList){ | |||
return iInspectionFileService.ignore(idList); | |||
} | |||
/** | |||
* | |||
* 查看问题处理 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/handle/{id}") | |||
public JsonResult getHandle(@PathVariable("id") String id) { | |||
return iInspectionFileService.getHandle(id); | |||
} | |||
/** | |||
* 查询任务问题分布列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/list/distribution") | |||
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request){ | |||
return iInspectionFileService.getDistributionList(request); | |||
} | |||
/** | |||
* 查询工单问题列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/page/list/workorker") | |||
public JsonResult getListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request){ | |||
return iInspectionFileService.getPageListByWorkOrderId(request); | |||
} | |||
} |
@@ -0,0 +1,37 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.request.inspectionfile.InspectionFileProcessingRresultRequest; | |||
import com.tuoheng.admin.service.IInspectionFileService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* 巡检问题处理结果前端控制器 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
@RestController | |||
@RequestMapping("/inspectionfile/handle") | |||
public class InspectionFileHandleController { | |||
@Autowired | |||
private IInspectionFileService iInspectionFileService; | |||
/** | |||
* 处理结果 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@PostMapping("/processing") | |||
public JsonResult processing(@RequestBody InspectionFileProcessingRresultRequest request){ | |||
return iInspectionFileService.processing(request); | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.tuoheng.admin.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@RestController | |||
@RequestMapping("/liveChannel") | |||
public class LiveChannelController { | |||
} |
@@ -1,5 +1,9 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.service.questiontype.IQuestionTypeService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
@@ -8,10 +12,20 @@ import org.springframework.web.bind.annotation.RestController; | |||
* @Date 2022/11/29 | |||
*/ | |||
@RestController | |||
@RequestMapping("/questionType") | |||
@RequestMapping("/question/type") | |||
public class QuestionTypeController { | |||
@Autowired | |||
private IQuestionTypeService questionTypeService; | |||
/** | |||
* 查询问题类型列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult getList() { | |||
return questionTypeService.getList(); | |||
} | |||
} |
@@ -48,6 +48,15 @@ public class RoadInformationController { | |||
return roadInformationService.getListByDeptId(deptId); | |||
} | |||
/** | |||
* 根据登录人角色获取该部门下公路信息列表 | |||
* @return | |||
*/ | |||
@GetMapping("/list/by/dept/userType") | |||
public JsonResult getListByUserType(){ | |||
return roadInformationService.getListByUserType(); | |||
} | |||
/** | |||
* 公路新增 | |||
* @param entity |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.service.user.IUserService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* 用户前端控制器 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Slf4j | |||
@RestController | |||
@RequestMapping("/user") | |||
public class UserController { | |||
@Autowired | |||
private IUserService userService; | |||
/** | |||
* 根据部门id查询用户列表 | |||
*/ | |||
@GetMapping("/list/dept/{deptId}") | |||
public JsonResult getListByDeptId(@PathVariable("deptId") String deptId) { | |||
log.info("进入根据部门id查询用户列表接口, deptId:{}", deptId); | |||
return userService.getListByDeptId(deptId); | |||
} | |||
} |
@@ -0,0 +1,64 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import com.tuoheng.admin.service.workorder.IWorkorderService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/29 | |||
*/ | |||
@Slf4j | |||
@RestController | |||
@RequestMapping("/workorder") | |||
public class WorkOrderController { | |||
@Autowired | |||
private IWorkorderService iWorkorderService; | |||
/** | |||
* 生成工单 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@PostMapping("/generate/{idList}") | |||
public JsonResult generate(@PathVariable("idList") List<String> idList) { | |||
return iWorkorderService.generate(idList); | |||
} | |||
/** | |||
* 查询工单分页列表 | |||
* | |||
* @param | |||
* @return | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | |||
return iWorkorderService.getPageList(request); | |||
} | |||
/** | |||
* 获取工单详情信息 | |||
*/ | |||
@GetMapping("/details/{id}") | |||
public JsonResult getDetails(@PathVariable("id") String id) { | |||
log.info("进入工单详情接口, id={}", id); | |||
return iWorkorderService.getDetails(id); | |||
} | |||
/** | |||
* 分配工单 | |||
*/ | |||
@PostMapping("/distribution") | |||
public JsonResult distribution(@RequestBody DistributionWorkorderRequest request) { | |||
log.info("进入分配工单接口, request={}", request); | |||
return iWorkorderService.distribution(request); | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.vo.InspectionDetailsVo; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
@@ -20,4 +21,6 @@ public interface InspectionConverMapper { | |||
List<InspectionVo> fromInspectionListToInspectionVoList(List<Inspection> inspectionList); | |||
InspectionDetailsVo fromInspectionToInspectionDetailsVo(Inspection inspection); | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileDistribution; | |||
import com.tuoheng.admin.entity.InspectionFileExtend; | |||
import com.tuoheng.admin.vo.InspectionFileDistributionListVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface InspectionFileConverMapper { | |||
InspectionFileConverMapper INSTANCE = Mappers.getMapper(InspectionFileConverMapper.class); | |||
List<InspectionFilePageListByInspectionIdVo> fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(List<InspectionFile> inspectionFileList); | |||
List<InspectionFilePageListVo> fromInspectionFileExtendListToInspectionFilePageListVoList(List<InspectionFileExtend> inspectionFileExtendList); | |||
List<InspectionFileDistributionListVo> fromInspectionFileDistributionListToInspectionFileDistributionListVoList(List<InspectionFileDistribution> inspectionFileDistributionList); | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.InspectionFileHandle; | |||
import com.tuoheng.admin.vo.InspectionFileHandleVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
@Mapper | |||
public interface InspectionFileHandleConverMapper { | |||
InspectionFileHandleConverMapper INSTANCE = Mappers.getMapper(InspectionFileHandleConverMapper.class); | |||
InspectionFileHandleVo fromInspectionFileHandleToInspectionFileHandleVo(InspectionFileHandle inspectionFileHandle); | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.vo.WorkOrderPageListVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface WorkOrderConverMapper { | |||
WorkOrderConverMapper INSTANCE = Mappers.getMapper(WorkOrderConverMapper.class); | |||
List<WorkOrderPageListVo> fromWorkOrderListToWorkOrderPageListVoList(List<WorkOrder> workOrderList); | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.dto; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
public class InspectionDto { | |||
/** | |||
* 机场id | |||
*/ | |||
private Integer airportId; | |||
/** | |||
* 用户id | |||
*/ | |||
private String UserId; | |||
} |
@@ -0,0 +1,92 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_flight_data") | |||
public class FlightData extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
*租户id | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 云盒SN号 | |||
*/ | |||
private String boxSn; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
/** | |||
* 海拔高度 | |||
*/ | |||
private String altitude; | |||
/** | |||
* 相对高度 | |||
*/ | |||
private String ultrasonic; | |||
/** | |||
* 俯仰角 | |||
*/ | |||
private String pitch; | |||
/** | |||
* 横滚角 | |||
*/ | |||
private String roll; | |||
/** | |||
* 航向角 | |||
*/ | |||
private String yaw; | |||
/** | |||
* 空速 | |||
*/ | |||
private String airspeed; | |||
/** | |||
* 地速 | |||
*/ | |||
private String velocity; | |||
/** | |||
* 时间戳 | |||
*/ | |||
private String timestamp; | |||
/** | |||
* 是否是SRT文件数据,1是 | |||
*/ | |||
private Integer isSrt; | |||
} |
@@ -1,181 +1,275 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务对象 th_inspection | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2022-11-16 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_inspection") | |||
public class Inspection extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** 租户ID */ | |||
private String tenantId; | |||
/** 部门ID */ | |||
private String deptId; | |||
/** 巡检任务编号 */ | |||
private String code; | |||
/** 巡检任务名称 */ | |||
private String name; | |||
/** 巡检任务类型 1 临时巡检 */ | |||
private Integer type; | |||
/** 公路ID */ | |||
private String roadId; | |||
/** 公路名称 */ | |||
private String roadName; | |||
/** 路段ID */ | |||
private String sectionId; | |||
/** 路段名称 */ | |||
private String sectionName; | |||
/** 巡检方式类型 1 无人机 2机场 */ | |||
private Integer inspectionType; | |||
/** 巡检机场id */ | |||
private Integer airportId; | |||
/** 巡检机场名称 */ | |||
private String airportName; | |||
/** 巡检线路id */ | |||
private Integer inspectionLine; | |||
/** 巡检线路名称 */ | |||
private String inspectionLineName; | |||
/** 飞行设备 */ | |||
private String equipmentId; | |||
/** 飞行设备名称 */ | |||
private String equipmentName; | |||
/** 挂载设备(多选逗号","分隔) */ | |||
private String equipmentMountId; | |||
/** 挂载设备名称(多选逗号","分隔) */ | |||
private String equipmentMountName; | |||
/** 5G云盒ID */ | |||
private String cloudBoxId; | |||
/** 云盒名称 */ | |||
private String cloudBoxName; | |||
/** 云盒SN号 */ | |||
private String boxSn; | |||
/** 飞手(多选逗号","分隔) */ | |||
private String flightHand; | |||
/** 飞手姓名(多选逗号","分隔) */ | |||
private String flightHandName; | |||
/** 计划巡检日期 */ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date inspectionTime; | |||
/** 执行开始时间 */ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionStartTime; | |||
/** 执行结束时间 */ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionEndTime; | |||
/** 是否实时,1:实时 2:离线 默认:null */ | |||
private Integer isLive; | |||
/** 是否正摄:1是 2否 */ | |||
private Integer isTaken; | |||
/** 是否倾斜摄影:1是 2否 */ | |||
private Integer isTilt; | |||
/** 原视频地址 */ | |||
private String videoUrl; | |||
/** AI识别后视频地址 */ | |||
private String aiVideoUrl; | |||
/** 报告地址 */ | |||
private String reportUrl; | |||
/** SRT文件地址 */ | |||
private String srtUrl; | |||
/** 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成 */ | |||
private Integer status; | |||
/** 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败 */ | |||
private Integer analyseStatus; | |||
/** ai任务分析进度 */ | |||
private BigDecimal progressbar; | |||
/** 备注 */ | |||
private String note; | |||
/** 巡检时天气情况 */ | |||
private String weather; | |||
/** 飞行高度 */ | |||
private String flyHeight; | |||
/** srt文件名称 */ | |||
private String srtName; | |||
/** ai心跳更新时间 */ | |||
private Long heartbeatTime; | |||
/** 定时任务的执行状态。1:未执行,2:已执行 */ | |||
private Long executionStatus; | |||
/** 起点经度 */ | |||
private String startLongitude; | |||
/** 起点纬度 */ | |||
private String startLatitude; | |||
/** 终点经度 */ | |||
private String endLongitude; | |||
/** 终点纬度 */ | |||
private String endLatitude; | |||
/** 联系方式 */ | |||
private String mobile; | |||
/** 巡逻地点 */ | |||
private String patrolLocation; | |||
} | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务对象 th_inspection | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_inspection") | |||
public class Inspection extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 巡检任务编号 | |||
*/ | |||
private String code; | |||
/** | |||
* 巡检任务名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 巡检任务类型 1 临时巡检 | |||
*/ | |||
private Integer type; | |||
/** | |||
* 公路ID | |||
*/ | |||
private String roadId; | |||
/** | |||
* 公路名称 | |||
*/ | |||
private String roadName; | |||
/** | |||
* 路段ID | |||
*/ | |||
private String sectionId; | |||
/** | |||
* 路段名称 | |||
*/ | |||
private String sectionName; | |||
/** | |||
* 巡检方式类型 1 无人机 2机场巡逻 3飞手值飞 | |||
*/ | |||
private Integer inspectionType; | |||
/** | |||
* 巡检机场id | |||
*/ | |||
private Integer airportId; | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private String airportName; | |||
/** | |||
* 巡检线路id | |||
*/ | |||
private Integer inspectionLine; | |||
/** | |||
* 巡检线路名称 | |||
*/ | |||
private String inspectionLineName; | |||
/** | |||
* 飞行设备 | |||
*/ | |||
private String equipmentId; | |||
/** | |||
* 飞行设备名称 | |||
*/ | |||
private String equipmentName; | |||
/** | |||
* 挂载设备(多选逗号","分隔) | |||
*/ | |||
private String equipmentMountId; | |||
/** | |||
* 挂载设备名称(多选逗号","分隔) | |||
*/ | |||
private String equipmentMountName; | |||
/** | |||
* 5G云盒ID | |||
*/ | |||
private String cloudBoxId; | |||
/** | |||
* 云盒名称 | |||
*/ | |||
private String cloudBoxName; | |||
/** | |||
* 云盒SN号 | |||
*/ | |||
private String boxSn; | |||
/** | |||
* 飞手(多选逗号","分隔) | |||
*/ | |||
private String flightHand; | |||
/** | |||
* 飞手姓名(多选逗号","分隔) | |||
*/ | |||
private String flightHandName; | |||
/** | |||
* 计划巡检日期 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date inspectionTime; | |||
/** | |||
* 执行开始时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionStartTime; | |||
/** | |||
* 执行结束时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionEndTime; | |||
/** | |||
* 是否实时,1:实时 2:离线 默认:null | |||
*/ | |||
private Integer isLive; | |||
/** | |||
* 是否正摄:1是 2否 | |||
*/ | |||
private Integer isTaken; | |||
/** | |||
* 是否倾斜摄影:1是 2否 | |||
*/ | |||
private Integer isTilt; | |||
/** | |||
* 原视频地址 | |||
*/ | |||
private String videoUrl; | |||
/** | |||
* AI识别后视频地址 | |||
*/ | |||
private String aiVideoUrl; | |||
/** | |||
* 报告地址 | |||
*/ | |||
private String reportUrl; | |||
/** | |||
* SRT文件地址 | |||
*/ | |||
private String srtUrl; | |||
/** | |||
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败 | |||
*/ | |||
private Integer analyseStatus; | |||
/** | |||
* ai任务分析进度 | |||
*/ | |||
private BigDecimal progressbar; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 巡检时天气情况 | |||
*/ | |||
private String weather; | |||
/** | |||
* 飞行高度 | |||
*/ | |||
private String flyHeight; | |||
/** | |||
* srt文件名称 | |||
*/ | |||
private String srtName; | |||
/** | |||
* ai心跳更新时间 | |||
*/ | |||
private Long heartbeatTime; | |||
/** | |||
* 定时任务的执行状态。1:未执行,2:已执行 | |||
*/ | |||
private Integer executionStatus; | |||
/** | |||
* 起点经度 | |||
*/ | |||
private String startLongitude; | |||
/** | |||
* 起点纬度 | |||
*/ | |||
private String startLatitude; | |||
/** | |||
* 终点经度 | |||
*/ | |||
private String endLongitude; | |||
/** | |||
* 终点纬度 | |||
*/ | |||
private String endLatitude; | |||
/** | |||
* 联系方式 | |||
*/ | |||
private String mobile; | |||
/** | |||
* 巡逻地点 | |||
*/ | |||
private String patrolLocation; | |||
} |
@@ -0,0 +1,91 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务问题分布 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class InspectionFileDistribution extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 缩略图 | |||
*/ | |||
private String fileThumbnail; | |||
/** | |||
* 纬度(原始图片纬度) | |||
*/ | |||
private String latitude; | |||
/** | |||
* 经度(原始图片经度) | |||
*/ | |||
private String longitude; | |||
/** | |||
* 位置信息 | |||
*/ | |||
private String location; | |||
/** | |||
* 高德地图经度 | |||
*/ | |||
private String gaodeLongitude; | |||
/** | |||
* 高德地图纬度 | |||
*/ | |||
private String gaodeLatitude; | |||
/** | |||
* 高德地图地址 | |||
*/ | |||
private String gaodeAddress; | |||
/** | |||
* 问题类型二级分类ID | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 任务编号 | |||
*/ | |||
private String inspectionCode; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
} |
@@ -0,0 +1,163 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务问题扩展 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2022-11-23 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class InspectionFileExtend extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 图片编号 | |||
*/ | |||
private String fileCode; | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 附件类型:1图片 2视频 | |||
*/ | |||
private Integer fileType; | |||
/** | |||
* 文件名称 | |||
*/ | |||
private String fileName; | |||
/** | |||
* 缩略图 | |||
*/ | |||
private String fileThumbnail; | |||
/** | |||
* 原图 | |||
*/ | |||
private String fileOriginal; | |||
/** | |||
* 标记图 | |||
*/ | |||
private String fileImage; | |||
/** | |||
* 文件大小 | |||
*/ | |||
private BigDecimal fileSize; | |||
/** | |||
* 纬度(原始图片纬度) | |||
*/ | |||
private String latitude; | |||
/** | |||
* 经度(原始图片经度) | |||
*/ | |||
private String longitude; | |||
/** | |||
* 位置信息 | |||
*/ | |||
private String location; | |||
/** | |||
* 高德地图经度 | |||
*/ | |||
private String gaodeLongitude; | |||
/** | |||
* 高德地图纬度 | |||
*/ | |||
private String gaodeLatitude; | |||
/** | |||
* 高德地图地址 | |||
*/ | |||
private String gaodeAddress; | |||
/** | |||
* 问题类型二级分类ID | |||
*/ | |||
private String questionId; | |||
/** | |||
* 图片来源:1AI 2后台 3视频 | |||
*/ | |||
private Integer source; | |||
/** | |||
* 问题名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 巡检内容 | |||
*/ | |||
private String content; | |||
/** | |||
* 详细描述 | |||
*/ | |||
private String questionDesc; | |||
/** | |||
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 审核人 | |||
*/ | |||
private String checkUser; | |||
/** | |||
* 审核时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private Date checkTime; | |||
/** | |||
* 任务编号 | |||
*/ | |||
private String inspectionCode; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
/** | |||
* 所在公路ID | |||
*/ | |||
private String roadId; | |||
/** | |||
* 所在部门ID | |||
*/ | |||
private String deptId; | |||
} |
@@ -35,7 +35,7 @@ public class InspectionFileHandle extends BaseEntity { | |||
private String inspectionFileId; | |||
/** | |||
* 处理人 | |||
* 处理人ID | |||
*/ | |||
private String handlerUser; | |||
@@ -0,0 +1,74 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_live_channel") | |||
public class LiveChannel extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 部门id | |||
*/ | |||
private String deptId; | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
*通道编号 | |||
*/ | |||
private String channelCode; | |||
/** | |||
* 直播通道名称 | |||
*/ | |||
private String name; | |||
/** | |||
*无人机推流地址 | |||
*/ | |||
private String pushUrl; | |||
/** | |||
* 无人机拉流地址 | |||
*/ | |||
private String pullUrl; | |||
/** | |||
* AI推流地址 | |||
*/ | |||
private String aipushUrl; | |||
/** | |||
* AI拉流地址 | |||
*/ | |||
private String aipullUrl; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
*状态:1正常 2停用 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,80 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.util.Date; | |||
/** | |||
* 巡检问题工单对象 th_work_order | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_work_order") | |||
public class WorkOrder extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 问题工单号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 分配人员ID | |||
*/ | |||
private String distributionId; | |||
/** | |||
* 指派部门ID | |||
*/ | |||
private String assignDeptId; | |||
/** | |||
* 指派负责人 | |||
*/ | |||
private String assignUser; | |||
/** | |||
* 指派负责人联系方式 | |||
*/ | |||
private String assignContact; | |||
/** | |||
* 指派备注 | |||
*/ | |||
private String assignNote; | |||
/** | |||
* 指派时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private Date assignTime; | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* 巡检问题工单子对象 th_work_order_file | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
@Data | |||
@Accessors(chain = true) | |||
@TableName("th_work_order_file") | |||
public class WorkOrderFile { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 巡检问题工单ID | |||
*/ | |||
private String workOrderId; | |||
/** | |||
* 巡检问题文件ID | |||
*/ | |||
private String inspectionFileId; | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 工单状态类型 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public enum WorkOrderStatusEnum { | |||
WAIT(5,"待分配"), | |||
PROCESSING(10,"处理中(已分配)"), | |||
COMPLETED(15,"已完成"); | |||
WorkOrderStatusEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -11,10 +11,10 @@ package com.tuoheng.admin.enums.code.inspection; | |||
*/ | |||
public enum AddInspectionCodeEnum { | |||
ADD_INSPECTION_IS_FAILED(1230100, "添加任务失败"), | |||
ADD_IS_FAILED(1230100, "添加任务失败"), | |||
NAME_IS_NULL(1230101, "任务名为空"), | |||
TYPE_IS_NULL(1230102, "任务类型为空"), | |||
ROAD_IS_NULL(1230103, "任务地点为空"), | |||
ROAD_IS_NULL(1230103, "公路信息为空"), | |||
SECTION_IS_NULL(1230104, "路段信息为空"), | |||
INSPECTION_TYPE_IS_NULL(1230105, "巡检方式为空"), | |||
AIRPORT_IS_NULL(1230106, "巡检机场为空"), |
@@ -11,7 +11,7 @@ package com.tuoheng.admin.enums.code.inspection; | |||
*/ | |||
public enum EditInspectionCodeEnum { | |||
ADD_DEPT_IS_FAILED(1230300, "修改任务失败"), | |||
EDIT_IS_FAILED(1230300, "修改任务失败"), | |||
ID_IS_NULL(1230301, "任务ID为空"), | |||
NAME_IS_NULL(1230302, "任务名为空"), | |||
TYPE_IS_NULL(1230303, "任务类型为空"), |
@@ -0,0 +1,53 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 立即执行任务信息返回码 | |||
* 模块代码:23(任务管理) | |||
* 接口代码:08 (立即执行) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-02 | |||
*/ | |||
public enum ExecuteInspectionCodeEnum { | |||
EXECUTE_IS_FAILED(1230800, "立即执行失败"), | |||
ID_IS_NULL(1230801, "任务ID为空"), | |||
INSPECTION_IS_NOT_EXIST(1230802, "任务不存在"), | |||
USER_ONLY_EXECUTE_DEPARTMENT_TASK(1230803, "用户只能执行本部门任务"), | |||
TENANT_IS_NOT_EXIST(1230804, "租户不存在"), | |||
AIRPORT_URL_IS_NULL(1230805, "机场平台URL为空"), | |||
AIRPORT_RETURN_DATA_IS_NULL(1230806, "机场接口返回数据为空"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
ExecuteInspectionCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 查询巡检任务详情返回码 | |||
* 模块代码:23(公路管理) | |||
* 接口代码:06 (查询巡检任务详情) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
public enum QueryInspectionDetailsByIdCodeEnum { | |||
QUERY_IS_FAILED(1230600, "获取数据失败"), | |||
INSPECTION_ID_IS_NULL(1230601, "任务id为空"), | |||
INSPECTION_IS_NOT_EXIST(1230602, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionDetailsByIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 查询巡检任务详情返回码 | |||
* 模块代码:23(公路管理) | |||
* 接口代码:05 (查询巡检任务信息) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-24 | |||
*/ | |||
public enum QueryInspectionInfoByIdCodeEnum { | |||
QUERY_IS_FAILED(1230500, "获取数据失败"), | |||
INSPECTION_ID_IS_NULL(1230501, "任务id为空"), | |||
INSPECTION_IS_NOT_EXIST(1230502, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionInfoByIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public enum QueryInspectionListServiceEnum { | |||
QUERY_IS_FAILED(1230600, "获取数据失败"), | |||
USER_ID_IS_NULL(1230601, "用户id为空"), | |||
USER_IS_NOT_EXIST(1230602, "用户不存在"), | |||
DEPT_ID_IS_NULL(1230603, "部门id为空"), | |||
DEPT_IS_NOT_EXIST(1230604, "部门不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionListServiceEnum | |||
(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -3,7 +3,7 @@ package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 查询巡检任务分页列表返回码 | |||
* 模块代码:23(公路管理) | |||
* 接口代码:04 (根据部门id获取该部门下公路列表) | |||
* 接口代码:04 (查询巡检任务分页列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
@@ -13,7 +13,8 @@ public enum QueryInspectionPageListCodeEnum { | |||
QUERY_IS_FAILED(1230400, "获取数据失败"), | |||
DEPT_ID_IS_NULL(1230401, "部门id为空"), | |||
DEPT_IS_NOT_EXIST(1230402, "部门不存在"); | |||
DEPT_IS_NOT_EXIST(1230402, "部门不存在"), | |||
DATA_IS_FAILED(1230403, "获取数据为空"); | |||
/** | |||
* 错误码 |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public enum QueryVideoServiceEnum { | |||
QUERY_IS_FAILED(1230700, "获取数据失败"), | |||
INSPECTION_ID_IS_NULL(1230701, "任务id为空"), | |||
LIVE_CHANNEL_IS_NOT_EXIST(1230702, "直播通道为空"), | |||
AIPULL_URL_IS_NOT_NULL(1230703, "直播地址为空"), | |||
AIVIDEO_URL_IS_NOT_NULL(1230704, "回放地址为空"), | |||
INSPECTION_IS_NOT_EXIST(1230705, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryVideoServiceEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,72 @@ | |||
package com.tuoheng.admin.enums.code.inspection; | |||
/** | |||
* 重新提交任务信息返回码 | |||
* 模块代码:23(任务管理) | |||
* 接口代码:07 (重新提交任务) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
public enum ResubmitInspectionCodeEnum { | |||
RESUBMIT_IS_FAILED(1230700, "重新提交失败"), | |||
ID_IS_NULL(1230701, "任务ID为空"), | |||
NAME_IS_NULL(1230702, "任务名为空"), | |||
TYPE_IS_NULL(1230703, "任务类型为空"), | |||
ROAD_IS_NULL(1230704, "公路信息为空"), | |||
SECTION_IS_NULL(1230705, "路段信息为空"), | |||
INSPECTION_TYPE_IS_NULL(1230706, "巡检方式为空"), | |||
AIRPORT_IS_NULL(1230707, "巡检机场为空"), | |||
INSPECTION_LINE_IS_NULL(1230708, "巡检路线为空"), | |||
LIVE_IS_NULL(1230709, "是否直播为空"), | |||
START_LONGITUDE_IS_NULL(1230710, "起点经度为空"), | |||
START_LATITUDE_IS_NULL(1230711, "起点纬度为空"), | |||
END_LONGITUDE_IS_NULL(1230712, "终点经度为空"), | |||
END_LATITUDE_IS_NULL(1230713, "终点纬度为空"), | |||
INSPECTION_TIME_IS_NULL(1230714, "巡检时间为空"), | |||
INSPECTION_IS_NOT_EXIST(1230715, "任务不存在"), | |||
FAILED_INSPECTION_CANNOT_RESUBMIT(1230716, "非失败的任务不能被重新提交"), | |||
TYPE_IS_NOT_EDIT(1230717, "巡检类型不能被修改"), | |||
INSPECTION_TYPE_IS_NOT_EDIT(1230718, "巡检方式不能被修改"), | |||
ROAD_IS_NOT_EXIST(1230719, "公路不存在"), | |||
SECTION_IS_NOT_EXIST(1230720, "路段不存在"), | |||
USER_IS_NOT_EXIST(1230721, "用户不存在"), | |||
DEPT_IS_NOT_EXIST(1230722, "部门不存在"), | |||
CALL_PILOT_IS_FAILED(1230723, "对接飞手平台失败"), | |||
CALL_DSP_IS_FAILED(1230724, "对接DSP平台失败"), | |||
CALL_AMAP_IS_FAILED(1230725, "对接高德地图平台失败"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
ResubmitInspectionCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 任务问题确认返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:05 (任务问题确认) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
public enum InspectionFileConfirmCodeEnum { | |||
CONFIRM_IS_FAILED(1240500, "确认任务问题失败"), | |||
INSPECTION_FILE_ID_IS_NULL(1240501, "任务问题id为空"), | |||
INSPECTION_FILE_IS_NOT_EXIST(1240502, "任务问题不存在"), | |||
NOT_CONFIRM_INSPECTION_FILE(1240503, "非待确认任务不能被确认"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
InspectionFileConfirmCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 任务问题忽略返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:06 (任务问题忽略) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
public enum InspectionFileIgnoreCodeEnum { | |||
IGNORE_IS_FAILED(1240600, "忽略任务问题失败"), | |||
INSPECTION_FILE_ID_IS_NULL(1240601, "任务问题id为空"), | |||
INSPECTION_FILE_IS_NOT_EXIST(1240602, "任务问题不存在"), | |||
NOT_WAIT_CONFIRMED_OR_CONFIRMED_CAN_IGNORED(1240603, "非待确认和已确认不能被忽略"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
InspectionFileIgnoreCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/2 | |||
*/ | |||
public enum ListByDeptUserTypeEnum { | |||
QUERY_IS_FAILED(1100300, "获取数据失败"), | |||
USER_NAME_IS_NULL(1100301, "登录用户名为空"), | |||
USER_IS_NULL(1100302, "用户不存在"), | |||
INSPECTION_TYPE_LIST_IS_NULL(1100303, "问题列表为空"), | |||
INSPECTION_LIST_IS_NULL(1100304, "任务列表为空"), | |||
DEPT_ID_IS_NULL(1100305, "部门id为空"), | |||
QUESTION_ID_IS_NULL(1100306, "问题列表为空"), | |||
TENANT_ID_IS_NULL(1100307, "租户id为空"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
ListByDeptUserTypeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 根据任务ID查询巡检任务问题分页列表返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:04 (根据任务ID查询巡检任务问题分页列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
public enum QueryInspectionFilePageListByInspectionIdCodeEnum { | |||
QUERY_IS_FAILED(1240400, "获取数据失败"), | |||
INSPECTION_ID_IS_NULL(1240401, "任务id为空"), | |||
INSPECTION_IS_NOT_EXIST(1240402, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionFilePageListByInspectionIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 根据工单ID查询巡检任务问题分页列表返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:07 (根据工单ID查询巡检任务问题分页列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
public enum QueryInspectionFilePageListByWorkOrderIdCodeEnum { | |||
QUERY_IS_FAILED(1240700, "获取数据失败"), | |||
WORK_ORDER_ID_IS_NULL(1240701, "工单id为空"), | |||
WORK_ORDER_IS_NOT_EXIST(1240702, "工单不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionFilePageListByWorkOrderIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfilehandle; | |||
/** | |||
* 任务问题处理返回码 | |||
* 模块代码:25(问题管理) | |||
* 接口代码:01 (任务问题处理) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-09 | |||
*/ | |||
public enum InspectionFileProcessingCodeEnum { | |||
PROCESSINGIS_FAILED(1250100, "处理失败"), | |||
WORK_ORDER_ID_IS_NULL(1250101, "工单id为空"), | |||
WORK_ORDER_IS_NOT_EXIST(1250102, "工单不存在"), | |||
INSPECTION_FILE_ID_IS_NULL(1250103, "任务问题id为空"), | |||
INSPECTION_FILE_IS_NOT_EXIST(1250104, "任务问题不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
InspectionFileProcessingCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfilehandle; | |||
/** | |||
* 查询任务问题处理返回码 | |||
* 模块代码:25(问题管理) | |||
* 接口代码:04 (查询任务问题处理) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-06 | |||
*/ | |||
public enum QueryInspectionFileHandleByInspectionFileIdCodeEnum { | |||
QUERY_IS_FAILED(1250400, "查询任务问题处理结果失败"), | |||
INSPECTION_FILE_ID_IS_NULL(1250401, "任务问题id为空"), | |||
INSPECTION_FILE_IS_NOT_EXIST(1250402, "任务问题不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionFileHandleByInspectionFileIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,45 @@ | |||
package com.tuoheng.admin.enums.code.questiontype; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/5 | |||
*/ | |||
public enum QuestionTypeEnum { | |||
PING_GROOVE_NAME(1, "坑槽"), | |||
PON_DING_NAME(2, "积水"), | |||
CRACK_NAME(3, "裂缝"); | |||
/** | |||
* 编号 | |||
*/ | |||
private int code; | |||
/** | |||
* 类型名称 | |||
*/ | |||
private String msg; | |||
QuestionTypeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
package com.tuoheng.admin.enums.code.user; | |||
/** | |||
* 根据部门ID查询用户列表返回码 | |||
* 模块代码:10(部门管理) | |||
* 接口代码:01 (据部门ID查询用户列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum QueryUserListByDeptIdCodeEnum { | |||
DEPT_ID_IS_NULL(1100101, "部门ID为空"), | |||
DEPT_IS_NOT_EXIST(1100102, "部门不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryUserListByDeptIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 分配工单返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:04 (分配工单) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum DistributionWorkorderCodeEnum { | |||
DISTRIBUTION_IS_FAILED(1260400, "分配工单失败"), | |||
ID_LIST_IS_NULL(1260401, "工单id为空"), | |||
WORK_ORDER_IS_NOT_EXIST(1260402, "工单不存在"), | |||
ASSIGN_DEPT_ID_IS_NULL(1260403, "指派部门ID为空"), | |||
ASSIGN_USER_ID_IS_NULL(1260404, "指派负责人为空"), | |||
ASSIGN_USER_ID_IS_NOT_EXIST(1260405, "指派负责人不存在"), | |||
SUPER_ADMIN_NOT_DISTRIBUTION(1260406, "超级管理员不能分配工单"), | |||
ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER(1260407, "管理员不能分配子部门工单"), | |||
ORDINARY_USER_NOT_DISTRIBUTION(1260408, "普通用户不能分配工单"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
DistributionWorkorderCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 生成工单返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:01 (生成工单) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public enum GenerateWorkorderCodeEnum { | |||
GENERATE_IS_FAILED(1260100, "生成工单失败"), | |||
ID_LIST_IS_NULL(1260101, "任务问题id列表为空"), | |||
INSPECTION_FILE_ID_LIST_IS_NOT_EXIST(1260102, "任务问题不存在"), | |||
INCLUDE_NO_CONFIRMED_INSPECTION(1260103, "包含非确认状态任务问题"), | |||
ADMIN_NOT_GENERATE_CHILD_WORKORDER(1260104, "管理员不能生成子部门工单"), | |||
ORDINARY_USER_NO_PERMISSION_TO_GENERATE(1260105, "普通用户不能生成工单"), | |||
; | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
GenerateWorkorderCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 工单详情返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:02 (工单详情) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum QueryWorkOrderDetailsCodeEnum { | |||
QUERY_IS_FAILED(1260200, "查看工单详情失败"), | |||
ID_IS_NULL(1260201, "工单id"), | |||
WORK_ORDER_IS_NOT_EXIST(1260202, "工单不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryWorkOrderDetailsCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 查询工单分页列表返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:03 (查询工单分页列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum QueryWorkOrderPageListCodeEnum { | |||
QUERY_IS_FAILED(1260300, "查询工单分页列表失败"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryWorkOrderPageListCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -2,24 +2,6 @@ | |||
package com.tuoheng.admin.interceptor; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.service.IUserService; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.common.core.utils.ThreadLocalUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.BeanFactory; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.web.context.support.WebApplicationContextUtils; | |||
import org.springframework.web.servlet.HandlerInterceptor; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
//@Component | |||
//@Slf4j | |||
//public class UserInterceptor implements HandlerInterceptor { |
@@ -22,6 +22,14 @@ public interface DeptMapper extends BaseMapper<Dept> { | |||
*/ | |||
List<String> selectAllChildListById(String id); | |||
/** | |||
* 通过部门idList,查找部门列表 | |||
* | |||
* @param idList 部门id列表 | |||
* @return 结果 | |||
*/ | |||
List<Dept> selectListByIdList(List<String> idList); | |||
/** | |||
* 修改部门 | |||
* |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public interface FlightDataMapper extends BaseMapper<FlightData> { | |||
List<FlightData> selectListByInspectionId(String id); | |||
} |
@@ -1,8 +1,19 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileDistribution; | |||
import com.tuoheng.admin.entity.InspectionFileExtend; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
@@ -32,4 +43,31 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> { | |||
*/ | |||
int deleteByInspectionId(String inspectionId); | |||
int updateByIdList(Map<String, Object> map); | |||
List<InspectionFile> selectListByInspectIdList(List<String> inspectionIdList); | |||
/** | |||
* 查询任务ID查询任务问题分页列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
Page<InspectionFile> selectPageListByInspectionId(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListByInspectionIdRequest request); | |||
/** | |||
* 查询任务问题分页列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
Page<InspectionFileExtend> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request); | |||
/** | |||
* 查询任务问题分布列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
List<InspectionFileDistribution> selectDistributionList(@Param("request") QueryInspectionFileDistributionListRequest request); | |||
} |
@@ -65,4 +65,8 @@ public interface InspectionMapper extends BaseMapper<Inspection> { | |||
*/ | |||
int deleteByPhysical(String id); | |||
List<Inspection> getListByBox(@Param("boxSn") String boxSn); | |||
List<Inspection> selectListByDeptIdList(List<String> deptIdList); | |||
} |
@@ -0,0 +1,12 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.LiveChannel; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public interface LiveChannelMapper extends BaseMapper<LiveChannel> { | |||
} |
@@ -19,4 +19,6 @@ public interface RoadDeptMapper extends BaseMapper<RoadDept> { | |||
void deleteBatchByMap(Map<String, Object> map); | |||
List<RoadDept> selectListByDeptIdList(List<String> deptIdList); | |||
} |
@@ -0,0 +1,19 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.WorkOrderFile; | |||
import java.util.List; | |||
/** | |||
* 巡检问题工单子Mapper接口 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2022-12-07 | |||
*/ | |||
public interface WorkOrderFileMapper extends BaseMapper<WorkOrderFile> { | |||
int insertBatch(List<WorkOrderFile> workOrderFileList); | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* 巡检工单Mapper接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public interface WorkOrderMapper extends BaseMapper<WorkOrder> { | |||
/** | |||
* 分配工单 | |||
*/ | |||
Integer update(WorkOrder workOrder); | |||
/** | |||
* 查询工单分页列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
Page<WorkOrder> selectPageList(@Param("page") IPage page, @Param("request") QueryWorkOrderPageListRequest request); | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.query; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 飞行轨迹坐标查询条件 | |||
*/ | |||
@Data | |||
public class FlightDataQuery extends BaseQuery { | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
String inspectionId; | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.tuoheng.admin.query; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/2 | |||
*/ | |||
@Data | |||
public class InspectionFileQuery { | |||
/** | |||
* 用户id | |||
*/ | |||
private String userId; | |||
} |
@@ -15,7 +15,7 @@ import java.util.List; | |||
* @date 2022-11-22 | |||
*/ | |||
@Data | |||
public class QueryDeptChildPageListRequest extends BaseQuery { | |||
public class QueryDeptChildPageListRequest { | |||
private static final long serialVersionUID = 1L; | |||
@@ -74,7 +74,7 @@ public class AddInspectionRequest { | |||
private String sectionName; | |||
/** | |||
* 是否实时,1:实时 2:离线 默认:null | |||
* 是否直播,1:实时 2:离线 默认:null | |||
*/ | |||
private Integer isLive; | |||
@@ -32,6 +32,11 @@ public class EditInspectionRequest { | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 任务编码 | |||
*/ | |||
private String code; | |||
/** | |||
* 任务名称 | |||
*/ | |||
@@ -92,6 +97,31 @@ public class EditInspectionRequest { | |||
*/ | |||
private String sectionName; | |||
/** | |||
* 是否直播,1:实时 2:离线 默认:null | |||
*/ | |||
private Integer isLive; | |||
/** | |||
* 起点经度 | |||
*/ | |||
private String startLongitude; | |||
/** | |||
* 起点纬度 | |||
*/ | |||
private String startLatitude; | |||
/** | |||
* 终点经度 | |||
*/ | |||
private String endLongitude; | |||
/** | |||
* 终点纬度 | |||
*/ | |||
private String endLatitude; | |||
/** | |||
* 计划巡检日期 | |||
*/ |
@@ -3,6 +3,8 @@ package com.tuoheng.admin.request.inspection; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* 查询巡检任务请求实体 | |||
* | |||
@@ -68,4 +70,9 @@ public class QueryInspectionPageListRequest extends BaseQuery { | |||
*/ | |||
private String deptId; | |||
/** | |||
* 部门及子部门Id列表 | |||
*/ | |||
private List<String> deptIdList; | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import lombok.Data; | |||
/** | |||
* 处理任务问题结果请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-09 | |||
*/ | |||
@Data | |||
public class InspectionFileProcessingRresultRequest { | |||
/** | |||
* 工单ID | |||
*/ | |||
private String workOrderId; | |||
/** | |||
* 巡检问题文件ID | |||
*/ | |||
private String inspectionFileId; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
/** | |||
* 处理后图片(多个图片逗号“,”分隔) | |||
*/ | |||
private String handlerImage; | |||
} |
@@ -0,0 +1,38 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* 查询巡检任务分配请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
public class QueryInspectionFileDistributionListRequest { | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 部门及子部门Id列表 | |||
*/ | |||
private List<String> deptIdList; | |||
} |
@@ -0,0 +1,33 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* 查询巡检任务请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Data | |||
public class QueryInspectionFilePageListByInspectionIdRequest extends BaseQuery { | |||
/** | |||
* 任务Id | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* 查询巡检任务请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Data | |||
public class QueryInspectionFilePageListRequest extends BaseQuery { | |||
/** | |||
* 关键字,匹配任务编号和任务名称 | |||
*/ | |||
private String key; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 部门Id | |||
*/ | |||
private String deptId; | |||
/** | |||
* 核实开始时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date beginTime; | |||
/** | |||
* 核实结束时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date endTime; | |||
/** | |||
* 部门及子部门Id列表 | |||
*/ | |||
private List<String> deptIdList; | |||
} |
@@ -0,0 +1,23 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* 根据工单ID查询任务问题分页列表请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-09 | |||
*/ | |||
@Data | |||
public class QueryInspectionFileWorkOrderPageListRequest extends BaseQuery { | |||
/** | |||
* 工单ID | |||
*/ | |||
private String workOrderId; | |||
} |
@@ -0,0 +1,91 @@ | |||
package com.tuoheng.admin.request.third; | |||
import lombok.Data; | |||
import java.util.Date; | |||
/** | |||
* 新增部门请求参数 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-02 | |||
*/ | |||
@Data | |||
public class PilotTaskRequest { | |||
/** | |||
* 任务编码 | |||
*/ | |||
private String taskCode; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String taskName; | |||
/** | |||
* 租户名称 | |||
*/ | |||
private String tenantName; | |||
/** | |||
* 巡逻地点 | |||
*/ | |||
private String patrolLocation; | |||
/** | |||
* 平台编码 | |||
*/ | |||
private String platformCode; | |||
/** | |||
* 发起人名称 | |||
*/ | |||
private String sponsorName; | |||
/** | |||
* 发起人手机号 | |||
*/ | |||
private String sponsorPhone; | |||
/** | |||
* 任务执行时间(期望巡检时间) | |||
*/ | |||
private Date taskStartTime; | |||
/** | |||
* 备注 | |||
*/ | |||
private String remark; | |||
/** | |||
* 是否直播 0否,1是 | |||
*/ | |||
private Integer isLive; | |||
/** | |||
* 起点纬度 | |||
*/ | |||
private String startLatitude; | |||
/** | |||
* 起点经度 | |||
*/ | |||
private String startLongitude; | |||
/** | |||
*终点经度 | |||
*/ | |||
private String endLongitude; | |||
/** | |||
* 终点纬度 | |||
*/ | |||
private String endLatitude; | |||
/** | |||
* 巡检类型 1.自营飞行计划 | |||
*/ | |||
private Integer inspectionType; | |||
} |
@@ -0,0 +1,30 @@ | |||
package com.tuoheng.admin.request.workorder; | |||
import lombok.Data; | |||
/** | |||
* 分配工单请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
public class DistributionWorkorderRequest { | |||
/** | |||
* 工单Id | |||
*/ | |||
private String workorderId; | |||
/** | |||
* 指派部门ID | |||
*/ | |||
private String assignDeptId; | |||
/** | |||
* 指派负责人 | |||
*/ | |||
private String assignUserIds; | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.tuoheng.admin.request.workorder; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 生成工单请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
public class GenerateWorkorderRequest { | |||
/** | |||
* 任务Id | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.tuoheng.admin.request.workorder; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* 查询工单分页列表请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
public class QueryWorkOrderPageListRequest extends BaseQuery { | |||
/** | |||
* 问题工单号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 工单生成开始时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date beginTime; | |||
/** | |||
* 工单生成结束时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date endTime; | |||
/** | |||
* 用户所在部门ID | |||
*/ | |||
private String userDeptId; | |||
/** | |||
* 检索条件中选择的部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 部门idList | |||
*/ | |||
private List<String> deptIdList; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.tuoheng.admin.service; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.query.FlightDataQuery; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public interface IFlightDataService { | |||
/** | |||
* 获取飞机巡检坐标列表 | |||
* @param flightDataQuery | |||
* @return | |||
*/ | |||
IPage<FlightData> getFlightDataList(FlightDataQuery flightDataQuery); | |||
/** | |||
* 飞行遥测数据入库 | |||
* @param entity | |||
*/ | |||
void addCallback(FlightData entity); | |||
} |
@@ -1,11 +1,89 @@ | |||
package com.tuoheng.admin.service; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.*; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/29 | |||
*/ | |||
public interface IInspectionFileService { | |||
JsonResult getQuestionList(); | |||
JsonResult getListByDeptUserType(InspectionFileQuery query); | |||
/** | |||
* | |||
* 根据任务Id查询任务分页列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request); | |||
/** | |||
* | |||
* 查询任务分页列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getPageList(QueryInspectionFilePageListRequest request); | |||
/** | |||
* | |||
* 确认 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
JsonResult confirm(List<String> idList); | |||
/** | |||
* | |||
* 忽略 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
JsonResult ignore(List<String> idList); | |||
/** | |||
* | |||
* 获取任务问题处理结果 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult getHandle(String id); | |||
/** | |||
* | |||
* 查询任务问题分布列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request); | |||
/** | |||
* | |||
* 根据工单ID查询工单问题列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getPageListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request); | |||
/** | |||
* | |||
* 处理任务问题 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult processing(InspectionFileProcessingRresultRequest request); | |||
} |
@@ -2,7 +2,7 @@ package com.tuoheng.admin.service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/29 | |||
* @Date 2022/12/1 | |||
*/ | |||
public interface IQuestionTypeService { | |||
public interface ILiveChannelService { | |||
} |
@@ -19,5 +19,7 @@ public interface RoadInformationService extends IBaseService<RoadInformation> { | |||
JsonResult editInfo(RoadInformation entity); | |||
JsonResult getListByUserType(); | |||
// JsonResult deleteRoadByIds(String[] ids); | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.tuoheng.admin.service.airport; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.enums.code.AriportCodeEnum; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
@@ -34,7 +35,7 @@ public class AirportServiceImpl implements AirportService { | |||
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg()); | |||
} | |||
String url = tenant.getAirportUrl() + "/api/airportInterface/airportList"; | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_LIST; | |||
String param = "page=1&limit=10"; | |||
String airPortStr = HttpUtils.sendGet(url, param); | |||
@@ -57,7 +58,7 @@ public class AirportServiceImpl implements AirportService { | |||
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg()); | |||
} | |||
String url = tenant.getAirportUrl() + "/api/airportInterface/taskByDroneId"; | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_LINE_LIST; | |||
String param = "page=1&limit=100&droneId=" + droneId; | |||
String airPortStr = HttpUtils.sendGet(url, param); | |||
JsonResult<AirLineVO> jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); |
@@ -64,8 +64,8 @@ public class DeptServiceImpl implements IDeptService { | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getChildPageList(QueryDeptChildPageListRequest queryDeptChildPageListRequest) { | |||
return queryChildListService.getChildPageList(queryDeptChildPageListRequest); | |||
public JsonResult getChildList(String id) { | |||
return queryChildListService.getChildList(id); | |||
} | |||
/** |
@@ -37,7 +37,7 @@ public interface IDeptService { | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getChildPageList(QueryDeptChildPageListRequest queryDeptChildPageListRequest); | |||
JsonResult getChildList(String id); | |||
/** |
@@ -38,45 +38,29 @@ public class QueryChildListService { | |||
* | |||
* @return | |||
*/ | |||
public JsonResult getChildPageList(QueryDeptChildPageListRequest queryDeptChildPageListRequest) { | |||
public JsonResult getChildList(String deptId) { | |||
log.info("进入查询子部门列表业务"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String deptId = queryDeptChildPageListRequest.getId(); | |||
JsonResult result = this.check(tenantId, deptId); | |||
JsonResult result = this.check(deptId); | |||
if (0 != result.getCode()) { | |||
log.info("根据id查询子部门列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 查询所有有效的子部门数据 | |||
IPage<Dept> page = new Page<>(queryDeptChildPageListRequest.getPage(), queryDeptChildPageListRequest.getLimit()); | |||
IPage<Dept> pageData = deptMapper.selectPage(page, Wrappers.<Dept>lambdaQuery() | |||
.eq(Dept::getMark, 1) | |||
.eq(Dept::getTenantId, tenantId) | |||
.orderByDesc(Dept::getCreateTime)); | |||
List<Dept> deptList = pageData.getRecords(); | |||
List<Dept> list = new ArrayList<>(); | |||
for (Dept record : deptList) { | |||
list.add(record); | |||
} | |||
pageData.setRecords(list); | |||
if (CollectionUtil.isEmpty(deptList)) { | |||
log.info("获取子部门列表为空"); | |||
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_LIST_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_LIST_IS_NULL.getMsg()); | |||
List<String> deptIdList = deptMapper.selectAllChildListById(deptId); | |||
if (CollectionUtil.isEmpty(deptIdList)) { | |||
log.info("获取部门列表为空"); | |||
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_LIST_IS_FAILED.getCode(), QueryDeptChildListCodeEnum.DEPT_LIST_IS_FAILED.getMsg()); | |||
} | |||
return JsonResult.success(pageData); | |||
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList); | |||
return JsonResult.success(deptList); | |||
} | |||
/** | |||
* 检查参数 | |||
* @param tenantId | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(String tenantId, String id) { | |||
private JsonResult check(String id) { | |||
// 判断id是否为空 | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | |||
@@ -84,7 +68,6 @@ public class QueryChildListService { | |||
// 判断部门是否存在 | |||
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, id) | |||
.eq(Dept::getMark, 1)); | |||
if (count <= 0) { |
@@ -0,0 +1,81 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.mapper.FlightDataMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.query.FlightDataQuery; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.RedisUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class FlightDataServiceImpl implements IFlightDataService { | |||
@Autowired | |||
private FlightDataMapper flightDataMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
/** | |||
* 获取巡检任务飞行轨迹坐标列表 | |||
* @param flightDataQuery | |||
* @return | |||
*/ | |||
@Override | |||
public IPage<FlightData> getFlightDataList(FlightDataQuery flightDataQuery) { | |||
if(StringUtils.isEmpty(flightDataQuery.getInspectionId())){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
QueryWrapper<FlightData> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("inspection_id",flightDataQuery.getInspectionId()); | |||
queryWrapper.eq("mark",1); | |||
//飞机坐标不关联租户id | |||
//queryWrapper.eq("tenant_id", ShiroUtils.getTenantId()) | |||
queryWrapper.orderByDesc("id"); | |||
//查询分页数据 | |||
IPage<FlightData> page = new Page<>(flightDataQuery.getPage(),flightDataQuery.getLimit()); | |||
IPage<FlightData> pageData = flightDataMapper.selectPage(page,queryWrapper); | |||
return pageData; | |||
} | |||
@Override | |||
public void addCallback(FlightData entity) { | |||
if(entity !=null && StringUtils.isNotEmpty(entity.getBoxSn())){ | |||
log.info("addCallback接口入参:"+entity); | |||
//查询正在执行的云盒所对应的任务 | |||
List<Inspection> inspectionList = inspectionMapper.getListByBox(entity.getBoxSn()); | |||
if(StringUtils.isNotEmpty(inspectionList)){ | |||
entity.setTenantId(inspectionList.get(0).getTenantId()); | |||
entity.setInspectionId(inspectionList.get(0).getId()); | |||
//将最新一条数据存放入缓存,并设置过期时间 | |||
redisUtils.set(inspectionList.get(0).getId(),entity,10); | |||
} | |||
entity.setCreateTime(DateUtils.now()); | |||
flightDataMapper.insert(entity); | |||
log.info("addCallback接口入库成功:"+entity.getId()); | |||
} | |||
} | |||
} |
@@ -1,16 +1,33 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.QuestionType; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.QuestionTypeMapper; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; | |||
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.*; | |||
import com.tuoheng.admin.service.IInspectionFileService; | |||
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService; | |||
import com.tuoheng.admin.service.inspectionfile.handle.QueryInspectionFileHandleByInspectionFileIdService; | |||
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService; | |||
import com.tuoheng.admin.service.inspectionfile.processing.InspectionFileProcessingService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFileDistributionListService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByWorkOrderIdService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionFileVo; | |||
import com.tuoheng.admin.vo.ListByDeptUserTypeVo; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -42,6 +59,35 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
@Autowired | |||
private QuestionTypeMapper questionTypeMapper; | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private QueryInspectionFilePageListByInspectionIdService queryInspectionFilePageListByInspectionIdService; | |||
@Autowired | |||
private QueryInspectionFilePageListService queryInspectionFilePageListService; | |||
@Autowired | |||
private InspectionFileIgnoreService inspectionFileIgnoreService; | |||
@Autowired | |||
private InspectionFileConfirmService inspectionFileConfirmService; | |||
@Autowired | |||
private QueryInspectionFileHandleByInspectionFileIdService queryInspectionFileHandleByInspectionFileIdService; | |||
@Autowired | |||
private QueryInspectionFileDistributionListService queryInspectionFileDistributionListService; | |||
@Autowired | |||
private QueryInspectionFilePageListByWorkOrderIdService queryInspectionFilePageListByWorkOrderIdService; | |||
@Autowired | |||
private InspectionFileProcessingService inspectionFileProcessingService; | |||
/** | |||
* 问题类型和任务名称 | |||
@@ -95,5 +141,232 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
return JsonResult.success(list); | |||
} | |||
@Override | |||
public JsonResult getListByDeptUserType(InspectionFileQuery query) { | |||
if(query.getUserId()==null){ | |||
JsonResult.error(ListByDeptUserTypeEnum.QUERY_IS_FAILED.getCode(),ListByDeptUserTypeEnum.QUERY_IS_FAILED.getMsg()); | |||
} | |||
//获取当前登录人信息 | |||
//String username = SecurityUserUtils.username(); | |||
String username = "admin"; | |||
if(StringUtils.isEmpty(username)){ | |||
JsonResult.error(ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getCode(),ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getMsg()); | |||
} | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getMark, 1).eq(User::getUsername, username)); | |||
if(ObjectUtil.isNull(user)){ | |||
JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(),ListByDeptUserTypeEnum.USER_IS_NULL.getMsg()); | |||
} | |||
String tenantId = ShiroUtils.getTenantId(); | |||
//用户角色判断 1超级管理员 2部门管理员 3普通用户 | |||
if(null == user.getType()){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
List<ListByDeptUserTypeVo> list = new ArrayList<>(); | |||
ListByDeptUserTypeVo vo = new ListByDeptUserTypeVo(); | |||
ListByDeptUserTypeVo vo1 = new ListByDeptUserTypeVo(); | |||
ListByDeptUserTypeVo vo2 = new ListByDeptUserTypeVo(); | |||
//问题数量 | |||
Long pitGrooveNum = 0l; | |||
Long ponDingNum = 0l; | |||
Long crackNum = 0l; | |||
//若角色为超级管理员,查看状态为已生成工单和和问题已处理 | |||
if(UserTypeEnum.SUPER_ADMIN.getCode()==user.getType()){ | |||
//直接查问题列表 | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() | |||
.eq(InspectionFile::getMark, 1) | |||
.eq(InspectionFile::getTenantId, tenantId) | |||
.in(InspectionFile::getStatus,20,25)); | |||
//根据状态类型分类 | |||
if(null == inspectionFileList){ | |||
JsonResult.error(ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getCode(),ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getMsg()); | |||
} | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if(StringUtils.isEmpty(inspectionFile.getQuestionId())){ | |||
JsonResult.error(ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getCode(),ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getMsg()); | |||
} | |||
//查找问题类型 | |||
QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery() | |||
.eq(QuestionType::getMark, 1) | |||
.eq(QuestionType::getId, inspectionFile.getQuestionId())); | |||
if(ObjectUtil.isNull(questionType)){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
Integer name = questionType.getName(); | |||
//1坑槽 | |||
if(name== QuestionTypeEnum.PING_GROOVE_NAME.getCode()) { | |||
pitGrooveNum+=1; | |||
}else if(name==QuestionTypeEnum.PON_DING_NAME.getCode()){ | |||
//积水 | |||
ponDingNum+=1; | |||
}else if(name==QuestionTypeEnum.CRACK_NAME.getCode()){ | |||
//裂缝 | |||
crackNum+=1; | |||
} | |||
} | |||
vo.setType(QuestionTypeEnum.PING_GROOVE_NAME.getCode()); | |||
vo1.setType(QuestionTypeEnum.PON_DING_NAME.getCode()); | |||
vo2.setType(QuestionTypeEnum.CRACK_NAME.getCode()); | |||
vo.setNum(pitGrooveNum); | |||
vo1.setNum(ponDingNum); | |||
vo2.setNum(crackNum); | |||
list.add(vo); | |||
list.add(vo1); | |||
list.add(vo2); | |||
} | |||
//若角色为部门管理员或普通用户 | |||
if(UserTypeEnum.ADMIN.getCode()== user.getType() || UserTypeEnum.ORDINARY_USER.getCode()== user.getType()){ | |||
//获取用户对应的部门 | |||
String deptId = user.getDeptId(); | |||
if(StringUtils.isEmpty(deptId)){ | |||
JsonResult.error(ListByDeptUserTypeEnum.DEPT_ID_IS_NULL.getCode(),ListByDeptUserTypeEnum.DEPT_ID_IS_NULL.getMsg()); | |||
} | |||
//根据部门id获取部门id列表 | |||
List<String> deptIdList = deptMapper.selectAllChildListById(deptId); | |||
if(CollectionUtil.isEmpty(deptIdList)){ | |||
return null; | |||
} | |||
//根据部门id列表查多条任务 | |||
List<Inspection> inspectionList = inspectionMapper.selectListByDeptIdList(deptIdList); | |||
if(null == inspectionList){ | |||
JsonResult.error(ListByDeptUserTypeEnum.INSPECTION_LIST_IS_NULL.getCode(),ListByDeptUserTypeEnum.INSPECTION_LIST_IS_NULL.getMsg()); | |||
} | |||
List<String> inspectionIdList = inspectionList.stream().map(o -> o.getId()).collect(Collectors.toList()); | |||
//根据任务id列表查找多条问题 | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectListByInspectIdList(inspectionIdList); | |||
//根据状态类型分类 | |||
if(null == inspectionFileList){ | |||
JsonResult.error(ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getCode(),ListByDeptUserTypeEnum.INSPECTION_TYPE_LIST_IS_NULL.getMsg()); | |||
} | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if(StringUtils.isEmpty(inspectionFile.getQuestionId())){ | |||
JsonResult.error(ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getCode(),ListByDeptUserTypeEnum.QUESTION_ID_IS_NULL.getMsg()); | |||
} | |||
//查找问题类型 | |||
QuestionType questionType = questionTypeMapper.selectOne(Wrappers.<QuestionType>lambdaQuery() | |||
.eq(QuestionType::getMark, 1) | |||
.eq(QuestionType::getId, inspectionFile.getQuestionId())); | |||
if(ObjectUtil.isNull(questionType)){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
Integer name = questionType.getName(); | |||
//1坑槽 | |||
if(name==QuestionTypeEnum.PING_GROOVE_NAME.getCode()) { | |||
pitGrooveNum+=1; | |||
}else if(name==QuestionTypeEnum.PON_DING_NAME.getCode()){ | |||
//积水 | |||
ponDingNum+=1; | |||
}else if(name==QuestionTypeEnum.CRACK_NAME.getCode()){ | |||
//裂缝 | |||
crackNum+=1; | |||
} | |||
} | |||
vo.setType(QuestionTypeEnum.PING_GROOVE_NAME.getCode()); | |||
vo1.setType(QuestionTypeEnum.PON_DING_NAME.getCode()); | |||
vo2.setType(QuestionTypeEnum.CRACK_NAME.getCode()); | |||
vo.setNum(pitGrooveNum); | |||
vo1.setNum(ponDingNum); | |||
vo2.setNum(crackNum); | |||
list.add(vo); | |||
list.add(vo1); | |||
list.add(vo2); | |||
} | |||
return JsonResult.success(list); | |||
} | |||
/** | |||
* 根据任务ID查询任务问题分页列表 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request){ | |||
return queryInspectionFilePageListByInspectionIdService.getPageListByInspectionId(request); | |||
} | |||
/** | |||
* | |||
* 查询任务问题分页列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getPageList(QueryInspectionFilePageListRequest request) { | |||
return queryInspectionFilePageListService.getPageList(request); | |||
} | |||
/** | |||
* | |||
* 确认 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult confirm(List<String> idList) { | |||
return inspectionFileConfirmService.confirm(idList); | |||
} | |||
/** | |||
* | |||
* 忽略 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult ignore(List<String> idList) { | |||
return inspectionFileIgnoreService.ignore(idList); | |||
} | |||
/** | |||
* | |||
* 获取任务问题处理结果 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getHandle(String id) { | |||
return queryInspectionFileHandleByInspectionFileIdService.handle(id); | |||
} | |||
/** | |||
* | |||
* 查询任务问题分布列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request) { | |||
return queryInspectionFileDistributionListService.getList(request); | |||
} | |||
/** | |||
* | |||
* 根据工单ID查询工单问题列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getPageListByWorkOrderId(QueryInspectionFileWorkOrderPageListRequest request) { | |||
return queryInspectionFilePageListByWorkOrderIdService.getPageList(request); | |||
} | |||
/** | |||
* | |||
* 处理任务问题 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult processing(InspectionFileProcessingRresultRequest request) { | |||
return inspectionFileProcessingService.processing(request); | |||
} | |||
} |
@@ -1,14 +1,14 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import com.tuoheng.admin.service.IQuestionTypeService; | |||
import com.tuoheng.admin.service.ILiveChannelService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/29 | |||
* @Date 2022/12/1 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class QuestionTypeServiceImpl implements IQuestionTypeService { | |||
public class LiveChannelServiceImpl implements ILiveChannelService { | |||
} |
@@ -1,30 +1,32 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.RoadInformation; | |||
import com.tuoheng.admin.entity.Section; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.RoadInformationMapper; | |||
import com.tuoheng.admin.mapper.SectionMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.query.RoadInformationQuery; | |||
import com.tuoheng.admin.service.RoadInformationService; | |||
import com.tuoheng.admin.service.road.query.QueryRoadListByDeptIdService; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import com.tuoheng.common.core.utils.ThreadLocalUtil; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.*; | |||
import org.jetbrains.annotations.NotNull; | |||
import org.jetbrains.annotations.Nullable; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Author ChengWang | |||
@@ -42,6 +44,15 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM | |||
@Autowired | |||
private QueryRoadListByDeptIdService queryRoadListByDeptIdService; | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private RoadDeptMapper roadDeptMapper; | |||
@Override | |||
public JsonResult queryPage(RoadInformationQuery query) { | |||
if (query.getLimit() == null && query.getPage() == null) { | |||
@@ -112,34 +123,96 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM | |||
return JsonResult.success(); | |||
} | |||
// @Override | |||
// public JsonResult deleteRoadByIds(String[] ids) { | |||
// if (StringUtils.isNull(ids)) { | |||
// return JsonResult.error("公路ID不能为空"); | |||
// } | |||
// for (String id : ids) { | |||
// RoadInformation roadInformation = roadInformationMapper.selectById(id); | |||
// //判断公路是否关联路段 | |||
// List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>() | |||
// .eq(Section::getMark, 1) | |||
// .eq(Section::getTenantId, 1) | |||
// .eq(Section::getRoadId, roadInformation.getId())); | |||
// if (StringUtils.isEmpty(sectionList)) { | |||
// super.deleteById(id); | |||
// } | |||
// //公路关联路段不为空,删除公路对应的路段 | |||
// for (Section section : sectionList) { | |||
// LambdaUpdateWrapper<Section> qw = new LambdaUpdateWrapper<>(); | |||
// qw.set(Section::getMark, 0); | |||
// qw.eq(Section::getId, section.getId()); | |||
// int update = sectionMapper.update(section, qw); | |||
// if (update <= 0) { | |||
// return JsonResult.error(); | |||
// } | |||
// } | |||
// } | |||
// return JsonResult.success("删除成功"); | |||
// } | |||
/** | |||
* 根据登录人角色获取该部门下公路信息列表 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getListByUserType() { | |||
//获取当前登录人信息 登录用户名 | |||
//String username = SecurityUserUtils.username(); | |||
String username="admin"; | |||
if(StringUtils.isEmpty(username)){ | |||
return JsonResult.error("登录用户名不存在"); | |||
} | |||
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||
.eq(User::getMark, 1) | |||
.eq(User::getUsername, username)); | |||
if(null == user){ | |||
return JsonResult.error("用户不存在"); | |||
} | |||
//获取租户id | |||
String tenantId = user.getTenantId(); | |||
//用户类型角色判断 1超级管理员 2 部门管理员 3普通用户 | |||
if(null == user.getType()){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
//登录用户若为部门管理员或普通用户需要查询所在部门 | |||
String deptId = user.getDeptId(); | |||
//获取公路列表 | |||
List<RoadInformation> roadInformationList = new ArrayList<>(); | |||
if(null == deptId){ | |||
//超级管理员 | |||
if(UserTypeEnum.SUPER_ADMIN.getCode()== user.getType()){ | |||
roadInformationList = this.getAllRoadInformationList(tenantId); | |||
} | |||
} | |||
//部门管理员 | |||
if(UserTypeEnum.ADMIN.getCode() == user.getType()){ | |||
//根据当前用户对应的部门id获取该部门及子部门的id集合 | |||
List<String> deptIdList = deptMapper.selectAllChildListById(deptId); | |||
if(CollectionUtil.isEmpty(deptIdList)){ | |||
return null; | |||
} | |||
List<RoadDept> list = roadDeptMapper.selectListByDeptIdList(deptIdList); | |||
roadInformationList = this.getRoadInformationList(tenantId, list); | |||
} | |||
//普通用户 | |||
if(UserTypeEnum.ORDINARY_USER.getCode() == user.getType()){ | |||
List<RoadDept> roadDeptList = roadDeptMapper.selectList(new LambdaQueryWrapper<RoadDept>() | |||
.eq(RoadDept::getTenantId, tenantId) | |||
.eq(RoadDept::getDeptId, deptId)); | |||
if (CollectionUtil.isEmpty(roadDeptList)) { | |||
return null; | |||
} | |||
roadInformationList =this.getRoadInformationList(tenantId,roadDeptList); | |||
} | |||
return JsonResult.success(roadInformationList); | |||
} | |||
/** | |||
* 根据部门列表获取公路列表 | |||
* @param tenantId | |||
* @param list | |||
* @return | |||
*/ | |||
private List<RoadInformation> getRoadInformationList(String tenantId, List<RoadDept> list) { | |||
List<RoadInformation> roadInformationList; | |||
List<String> roadIdList = list.stream().map(o -> o.getRoadId()).collect(Collectors.toList()); | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("tenantId", tenantId); | |||
map.put("roadIdList", roadIdList); | |||
map.put("mark",1); | |||
roadInformationList = roadInformationMapper.getListByMap(map); | |||
return roadInformationList; | |||
} | |||
/** | |||
* 如果是顶级部门,则查询所有公路列表 | |||
* | |||
* @param tenantId | |||
* @return | |||
*/ | |||
private List<RoadInformation> getAllRoadInformationList(String tenantId) { | |||
List<RoadInformation> roadList = roadInformationMapper.selectList(new LambdaQueryWrapper<RoadInformation>() | |||
.eq(RoadInformation::getTenantId, tenantId) | |||
.eq(RoadInformation::getMark, 1)); | |||
if (CollectionUtil.isEmpty(roadList)) { | |||
return null; | |||
} | |||
return roadList; | |||
} | |||
/** | |||
* 判断公路是否关联路段 |
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.config.CommonConfig; | |||
import com.tuoheng.admin.entity.RoadInformation; | |||
import com.tuoheng.admin.entity.Section; | |||
import com.tuoheng.admin.entity.Structure; | |||
@@ -17,6 +16,7 @@ import com.tuoheng.admin.query.StructureQuery; | |||
import com.tuoheng.admin.service.IStructureService; | |||
import com.tuoheng.admin.vo.StructureInfoVo; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.*; | |||
@@ -67,7 +67,7 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc | |||
if(StringUtils.isNotEmpty(imageUrls)){ | |||
for (int i = 0; i < imageUrls.length; i++) { | |||
if(StringUtils.isNotEmpty(imageUrls[i])){ | |||
imageUrls[i]=CommonConfig.imageURL+imageUrls[i]; | |||
imageUrls[i]= CommonConfig.imageURL+imageUrls[i]; | |||
} | |||
} | |||
} | |||
@@ -120,6 +120,10 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 当前登录人对应的公路所属的构造物 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getSectionInfo() { | |||
//获取登录信息 |
@@ -1,25 +0,0 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.service.IUserService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 后台用户管理表 服务实现类 | |||
* </p> | |||
* | |||
* @author 拓恒 | |||
* @since 2020-10-30 | |||
*/ | |||
@Service | |||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
} |
@@ -1,6 +1,9 @@ | |||
package com.tuoheng.admin.service.inspection; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
@@ -24,12 +27,20 @@ public interface IInspectionService { | |||
JsonResult selectPageList(QueryInspectionPageListRequest queryInspectionRequest); | |||
/** | |||
* 查询巡检任务 | |||
* 查询巡检任务信息 | |||
* | |||
* @param id 巡检任务Id | |||
* @return 巡检任务 | |||
*/ | |||
JsonResult selectOneById(String id); | |||
JsonResult getInspectionInfo(String id); | |||
/** | |||
* 查询巡检任务详情 | |||
* | |||
* @param id 巡检任务Id | |||
* @return 巡检任务详情 | |||
*/ | |||
JsonResult getInspectionDetails(String id); | |||
/** | |||
* 查询巡检任务列表 | |||
@@ -63,8 +74,44 @@ public interface IInspectionService { | |||
*/ | |||
JsonResult deleteById(String id); | |||
JsonResult getListByAirportId(Integer airportId); | |||
JsonResult getListByAirportId(InspectionDto dto); | |||
JsonResult getVideoById(String id); | |||
/** | |||
* 重新提交巡检任务 | |||
* | |||
* @param editInspectionRequest 修改任务请求参数 | |||
* @return 结果 | |||
*/ | |||
JsonResult resubmit(EditInspectionRequest editInspectionRequest); | |||
/** | |||
* 获取飞行轨迹 | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult findFlightData(String id); | |||
/** | |||
* 根据巡检ID查询最新一条遥测数据 | |||
* @param inspectionId | |||
* @return | |||
*/ | |||
FlightData getFlightDataByInspectionId(String inspectionId); | |||
/** | |||
* 立即执行 | |||
* @param id 任务id | |||
* @return 结果 | |||
*/ | |||
JsonResult execute(String id); | |||
/** | |||
* 根据用户id获取最新的五条任务信息 | |||
* @param | |||
* @return | |||
*/ | |||
JsonResult getNewInspectionList(); | |||
} |
@@ -1,25 +1,23 @@ | |||
package com.tuoheng.admin.service.inspection; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.service.inspection.add.AddInspectionService; | |||
import com.tuoheng.admin.service.inspection.execute.ExecuteInspectionService; | |||
import com.tuoheng.admin.service.inspection.resubmit.ResubmitInspectionService; | |||
import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService; | |||
import com.tuoheng.admin.service.inspection.query.QueryInspectionListService; | |||
import com.tuoheng.admin.service.inspection.query.QueryInspectionPageListService; | |||
import com.tuoheng.admin.service.inspection.query.QueryVideoService; | |||
import com.tuoheng.admin.service.inspection.query.*; | |||
import com.tuoheng.admin.service.inspection.update.UpdateInspectionService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* 巡检任务Service业务层处理 | |||
* | |||
@@ -30,12 +28,19 @@ import java.util.List; | |||
@Slf4j | |||
@Service | |||
public class InspectionServiceImpl implements IInspectionService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private QueryInspectionPageListService queryInspectionPageListService; | |||
@Autowired | |||
private QueryInspectionByIdService queryInspectionByIdService; | |||
@Autowired | |||
private QueryInspectionDetailsByIdService queryInspectionDetailsByIdService; | |||
@Autowired | |||
private AddInspectionService addinspectionService; | |||
@@ -51,6 +56,22 @@ public class InspectionServiceImpl implements IInspectionService { | |||
@Autowired | |||
private QueryVideoService queryVideoService; | |||
@Autowired | |||
private ResubmitInspectionService resubmitInspectionService; | |||
@Autowired | |||
private QueryFindFlightDataService queryFindFlightDataService; | |||
@Autowired | |||
private QueryFindFlightDataByInspectionIdService queryFindFlightDataByInspectionIdService; | |||
@Autowired | |||
private ExecuteInspectionService executeInspectionService; | |||
@Autowired | |||
private QueryNewInspectionListService queryNewInspectionListService; | |||
/** | |||
* 查询巡检任务分页分页列表 | |||
* | |||
@@ -63,15 +84,25 @@ public class InspectionServiceImpl implements IInspectionService { | |||
} | |||
/** | |||
* 查询巡检任务 | |||
* 查询巡检任务信息 | |||
* | |||
* @param id 巡检任务id | |||
* @return 巡检任务 | |||
*/ | |||
@Override | |||
public JsonResult selectOneById(String id) { | |||
public JsonResult getInspectionInfo(String id) { | |||
return queryInspectionByIdService.getInspectionInfo(id); | |||
} | |||
return JsonResult.success(); | |||
/** | |||
* 查询巡检任务详情 | |||
* | |||
* @param id 巡检任务id | |||
* @return 巡检任务 | |||
*/ | |||
@Override | |||
public JsonResult getInspectionDetails(String id) { | |||
return queryInspectionDetailsByIdService.getInspectionDetails(id); | |||
} | |||
/** | |||
@@ -125,13 +156,71 @@ public class InspectionServiceImpl implements IInspectionService { | |||
return deleteInspectionService.deleteById(id); | |||
} | |||
/** | |||
* 根据机场id获取当前登录人部门的巡检任务列表 | |||
* @param dto | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getListByAirportId(Integer airportId) { | |||
return queryInspectionListService.getListByAirportId(airportId); | |||
public JsonResult getListByAirportId(InspectionDto dto) { | |||
return queryInspectionListService.getListByAirportId(dto); | |||
} | |||
@Override | |||
public JsonResult getVideoById(String id) { | |||
return queryVideoService.getVideoById(id); | |||
} | |||
/** | |||
* 重新提交巡检任务 | |||
* | |||
* @param editInspectionRequest 修改任务请求参数 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult resubmit(EditInspectionRequest editInspectionRequest) { | |||
return resubmitInspectionService.resubmit(editInspectionRequest); | |||
} | |||
/** | |||
* 获取飞行轨迹 | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult findFlightData(String id) { | |||
return queryFindFlightDataService.findFlightData(id); | |||
} | |||
/** | |||
* 根据巡检ID查询最新一条遥测数据 | |||
* @param inspectionId | |||
* @return | |||
*/ | |||
@Override | |||
public FlightData getFlightDataByInspectionId(String inspectionId) { | |||
return queryFindFlightDataByInspectionIdService.getFlightData(inspectionId); | |||
} | |||
/** | |||
*立即执行 | |||
* @param id 任务id | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult execute(String id) { | |||
return executeInspectionService.execute(id); | |||
} | |||
/** | |||
* 根据用户id获取最新的五条任务信息 | |||
* @param | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getNewInspectionList() { | |||
return queryNewInspectionListService.getList(); | |||
} | |||
} |
@@ -2,6 +2,7 @@ package com.tuoheng.admin.service.inspection.add; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
@@ -9,12 +10,19 @@ import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.AddInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.request.third.PilotTaskRequest; | |||
import com.tuoheng.admin.service.third.pilot.PilotService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpEntity; | |||
import org.springframework.http.HttpMethod; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.http.ResponseEntity; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
@@ -43,6 +51,12 @@ public class AddInspectionService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
@Autowired | |||
private PilotService pilotService; | |||
/** | |||
* 添加任务 | |||
* | |||
@@ -58,8 +72,16 @@ public class AddInspectionService { | |||
return result; | |||
} | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
if (null == user) { | |||
return JsonResult.error(AddInspectionCodeEnum.USER_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.USER_IS_NOT_EXIST.getMsg()); | |||
} | |||
// 构造inspection对象 | |||
result = this.buildInspection(userId, tenantId, addInspectionRequest); | |||
result = this.buildInspection(user, tenantId, addInspectionRequest); | |||
if (0 != result.getCode()) { | |||
log.info("添加任务业务:构建inspection对象失败:{}", result.getMsg()); | |||
return result; | |||
@@ -67,7 +89,7 @@ public class AddInspectionService { | |||
Inspection inspection = (Inspection) result.getData(); | |||
// 调用第三方平台 | |||
result = this.callThirdPlatform(tenantId, inspection); | |||
result = this.callThirdPlatform(user, tenantId, inspection); | |||
if (0 != result.getCode()) { | |||
log.info("添加任务业务:对接第三方平台失败:{}", result.getMsg()); | |||
return result; | |||
@@ -76,7 +98,7 @@ public class AddInspectionService { | |||
log.info("添加任务, 返回结果: deptId={}", rowId); | |||
if (rowId <= 0) { | |||
log.info("添加任务业务:添加任务失败:{}", result.getMsg()); | |||
return JsonResult.error(AddInspectionCodeEnum.ADD_INSPECTION_IS_FAILED.getCode(), AddInspectionCodeEnum.ADD_INSPECTION_IS_FAILED.getMsg()); | |||
return JsonResult.error(AddInspectionCodeEnum.ADD_IS_FAILED.getCode(), AddInspectionCodeEnum.ADD_IS_FAILED.getMsg()); | |||
} | |||
log.info("添加任务业务:添加任务成功:{}", inspection); | |||
return JsonResult.success(inspection); | |||
@@ -100,15 +122,21 @@ public class AddInspectionService { | |||
if (null == addInspectionRequest.getInspectionType()) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||
} | |||
if (InspectionTypeEnum.AIRPORT.getCode() == addInspectionRequest.getInspectionType()) { | |||
// 巡检方式:机场巡逻,可选择巡检机场和巡检路线 | |||
if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||
if (null == addInspectionRequest.getAirportId() || StringUtils.isEmpty(addInspectionRequest.getAirportName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||
if (null == addInspectionRequest.getInspectionLine() || StringUtils.isEmpty(addInspectionRequest.getInspectionLineName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | |||
} | |||
} else if (InspectionTypeEnum.MABNNEDFLIGHT.getCode() == addInspectionRequest.getInspectionType()) { | |||
// 巡检方式:飞手值飞,可选择是否直播,起点坐标,终点坐标 | |||
@@ -128,15 +156,6 @@ public class AddInspectionService { | |||
return JsonResult.error(AddInspectionCodeEnum.END_LATITUDE_IS_NULL.getCode(), AddInspectionCodeEnum.END_LATITUDE_IS_NULL.getMsg()); | |||
} | |||
} | |||
if (null == addInspectionRequest.getAirportId() || StringUtils.isEmpty(addInspectionRequest.getAirportName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getInspectionLine() || StringUtils.isEmpty(addInspectionRequest.getInspectionLineName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | |||
} | |||
if (null == addInspectionRequest.getInspectionTime()) { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg()); | |||
} | |||
@@ -164,19 +183,12 @@ public class AddInspectionService { | |||
* | |||
* 构造Inspection对象 | |||
* | |||
* @param userId | |||
* @param user | |||
* @param tenantId | |||
* @param addInspectionRequest | |||
* @return | |||
*/ | |||
private JsonResult buildInspection(String userId, String tenantId, AddInspectionRequest addInspectionRequest) { | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
if (null == user) { | |||
return JsonResult.error(AddInspectionCodeEnum.USER_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.USER_IS_NOT_EXIST.getMsg()); | |||
} | |||
private JsonResult buildInspection(User user, String tenantId, AddInspectionRequest addInspectionRequest) { | |||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, user.getDeptId()) | |||
@@ -189,7 +201,7 @@ public class AddInspectionService { | |||
inspection.setCode(code); | |||
inspection.setTenantId(tenantId); | |||
inspection.setDeptId(dept.getId()); | |||
inspection.setCreateUser(userId); | |||
inspection.setCreateUser(user.getId()); | |||
inspection.setCreateTime(DateUtils.now()); | |||
inspection.setMobile(user.getMobile()); | |||
inspection.setStatus(InspectionStatusEnum.WAIT_FLIGHT.getCode()); | |||
@@ -197,58 +209,26 @@ public class AddInspectionService { | |||
} | |||
/** | |||
* 验证与第三方平台(飞手、dsp、高德)对接 | |||
* 与第三方平台(飞手、高德)对接 | |||
* | |||
* @param user | |||
* @param tenantId | |||
* @param inspection | |||
* @return | |||
*/ | |||
private JsonResult callThirdPlatform(String tenantId, Inspection inspection) { | |||
private JsonResult callThirdPlatform(User user, String tenantId, Inspection inspection) { | |||
// 对接高德地图 | |||
JsonResult result = this.callGaode(inspection); | |||
if (0 != result.getCode()) { | |||
return result; | |||
} | |||
// 对接飞手平台 | |||
result = this.callPilot(inspection); | |||
if (0 != result.getCode()) { | |||
return result; | |||
} | |||
// 对接DSP平台 | |||
result = this.callDSP(inspection); | |||
if (0 != result.getCode()) { | |||
return result; | |||
} | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* | |||
* 对接飞手平台 | |||
* | |||
* @return | |||
*/ | |||
private JsonResult callPilot(Inspection inspection) { | |||
// TODO | |||
// 具体业务逻辑待实现,以下写法只是为了体现调用飞手平台成功或失败场景 | |||
if (StringUtils.isEmpty(inspection.getName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.CALL_PILOT_IS_FAILED.getCode(), AddInspectionCodeEnum.CALL_PILOT_IS_FAILED.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* | |||
* 对接DSP平台 | |||
* | |||
* @return | |||
*/ | |||
private JsonResult callDSP(Inspection inspection) { | |||
// TODO | |||
// 具体业务逻辑待实现,以下写法只是为了体现调用DSP平台成功或失败场景 | |||
if (StringUtils.isEmpty(inspection.getName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.CALL_DSP_IS_FAILED.getCode(), AddInspectionCodeEnum.CALL_DSP_IS_FAILED.getMsg()); | |||
if (InspectionTypeEnum.MABNNEDFLIGHT.getCode() == inspection.getInspectionType()) { | |||
// 对接飞手平台 | |||
result = pilotService.addTask(user, inspection); | |||
if (0 != result.getCode()) { | |||
return result; | |||
} | |||
} | |||
return JsonResult.success(); | |||
} |
@@ -0,0 +1,169 @@ | |||
package com.tuoheng.admin.service.inspection.execute; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionHistory; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.code.inspection.ExecuteInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionHistoryMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.*; | |||
import lombok.Data; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 立即执行任务业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class ExecuteInspectionService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
@Autowired | |||
private InspectionHistoryMapper inspectionHistoryMapper; | |||
/** | |||
* 重新提交任务 | |||
* | |||
* @return | |||
*/ | |||
public JsonResult execute(String id) { | |||
log.info("进入立即执行任务业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(userId, tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("立即执行任务业务:校验参数失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
Inspection inspection = (Inspection) result.getData(); | |||
// 立即执行任务 | |||
this.executeTask(userId, tenantId, inspection); | |||
log.info("立即执行任务业务:立即执行成功:id:{}", inspection.getId()); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* 注意:1)、超级管理员不能执行任务 | |||
* 2)、管理员和普通用户只能执行本部门任务,不能执行子部门任务 | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(String userId, String tenantId, String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(ExecuteInspectionCodeEnum.ID_IS_NULL.getCode(), ExecuteInspectionCodeEnum.ID_IS_NULL.getMsg()); | |||
} | |||
Inspection inspection = inspectionMapper.selectById(id); | |||
if (null == inspection) { | |||
return JsonResult.error(ExecuteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), ExecuteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
if (!user.getDeptId().equals(inspection.getDeptId())) { | |||
return JsonResult.error(ExecuteInspectionCodeEnum.USER_ONLY_EXECUTE_DEPARTMENT_TASK.getCode(), ExecuteInspectionCodeEnum.USER_ONLY_EXECUTE_DEPARTMENT_TASK.getMsg()); | |||
} | |||
return JsonResult.success(inspection); | |||
} | |||
/** | |||
* 调用机场平台 | |||
* | |||
* @param tenantId | |||
* @param inspection | |||
* @return | |||
*/ | |||
public JsonResult executeTask(String userId, String tenantId, Inspection inspection) { | |||
//读取不同租户的机场平台url | |||
Tenant tenant = tenantMapper.selectById(inspection.getTenantId()); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
return JsonResult.error(ExecuteInspectionCodeEnum.TENANT_IS_NOT_EXIST.getCode(), ExecuteInspectionCodeEnum.TENANT_IS_NOT_EXIST.getMsg()); | |||
} | |||
if (StringUtils.isEmpty(tenant.getAirportUrl())) { | |||
return JsonResult.error(ExecuteInspectionCodeEnum.AIRPORT_URL_IS_NULL.getCode(), ExecuteInspectionCodeEnum.AIRPORT_URL_IS_NULL.getMsg()); | |||
} | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_EXECUTE_TASK; | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("taskId", inspection.getInspectionLine()); | |||
jsonObject.put("requestId", inspection.getId()); | |||
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||
if (StringUtils.isEmpty(airPortStr)) { | |||
log.info("立即执行任务业务:机场接口返回数据为空,任务id:{},任务名称:{},机场id:{},机场名称:{}, 路线id:{},路线名称:{}", | |||
inspection.getId(), inspection.getName(), inspection.getAirportId(), inspection.getAirportName(), inspection.getInspectionLine(), inspection.getInspectionLineName()); | |||
return JsonResult.error(ExecuteInspectionCodeEnum.AIRPORT_RETURN_DATA_IS_NULL.getCode(), ExecuteInspectionCodeEnum.AIRPORT_RETURN_DATA_IS_NULL.getMsg()); | |||
} | |||
this.updateInspection(userId, inspection); | |||
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | |||
if (jsonResult.getCode() != 0) { | |||
log.info("立即执行任务业务:机场接口返回结果:失败:{}", jsonResult.getMsg()); | |||
this.insertInspectionHistory(userId, tenantId, inspection, jsonResult.getMsg()); | |||
return JsonResult.error(jsonResult.getMsg()); | |||
} else { | |||
return JsonResult.success(); | |||
} | |||
} | |||
/** | |||
* 修改任务执行状态 | |||
* | |||
* @param userId | |||
* @param inspection | |||
*/ | |||
private void updateInspection(String userId, Inspection inspection) { | |||
inspection.setExecutionStatus(2); | |||
inspection.setUpdateUser(userId); | |||
inspection.setUpdateTime(DateUtils.now()); | |||
inspectionMapper.update(inspection); | |||
} | |||
/** | |||
* 更新任务中 | |||
* | |||
* @param tenantId | |||
* @param inspection | |||
*/ | |||
private void insertInspectionHistory(String userId, String tenantId, Inspection inspection, String msg) { | |||
InspectionHistory inspectionHistory = new InspectionHistory(); | |||
inspectionHistory.setTenantId(tenantId); | |||
inspectionHistory.setInspectionId(inspection.getId()); | |||
inspectionHistory.setHistoryName(msg); | |||
inspectionHistory.setCreateUser(userId); | |||
inspectionHistory.setCreateTime(DateUtils.now()); | |||
inspectionHistoryMapper.insert(inspectionHistory); | |||
} | |||
} |