Compare commits
30 Commits
8cf7b0125d
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ed5f81f6d | |||
| 8eac1edc90 | |||
| dffb65432c | |||
| 9b4c3092c1 | |||
| eaf90fb8b5 | |||
| 3862fc379d | |||
| a9872467c0 | |||
| b7c03dac64 | |||
| 92f6a16106 | |||
| 71dba8bb2d | |||
| 1ab49c4178 | |||
| da9cc7cc76 | |||
| 5f51572b68 | |||
| f9edc2d15d | |||
| dd5cb05649 | |||
| 01b4d80adb | |||
| 49a31edad2 | |||
| 5d0a83cf1c | |||
| bd5108bb7e | |||
| 40dc44374b | |||
| f6e18851de | |||
| 25188a80de | |||
| 2033a7d3c6 | |||
| 77095ac5a2 | |||
| 4b37434057 | |||
| 4a810f3aef | |||
| 56f6c9a446 | |||
| b26cdfa495 | |||
| 9add81d728 | |||
| 052c5c8ea0 |
2
pom.xml
2
pom.xml
@ -71,7 +71,7 @@
|
||||
<properties>
|
||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||
<profiles.active>dev</profiles.active>
|
||||
<nacos.server>192.168.110.149:18848</nacos.server>
|
||||
<nacos.server>192.168.110.2:18848</nacos.server>
|
||||
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
|
||||
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
|
||||
<nacos.username>nacos</nacos.username>
|
||||
|
||||
@ -39,4 +39,10 @@ public interface RemoteFileService {
|
||||
|
||||
|
||||
void deleteFile(Collection<String> urls);
|
||||
|
||||
/**
|
||||
* 通过ossId列表删除
|
||||
* @param ossIds
|
||||
*/
|
||||
void deleteFileByIds(Collection<Long> ossIds);
|
||||
}
|
||||
|
||||
@ -56,4 +56,9 @@ public class RemoteFileServiceMock implements RemoteFileService {
|
||||
log.warn("服务调用异常 -> 降级处理");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFileByIds(Collection<Long> ossIds) {
|
||||
log.warn("服务调用异常 -> 降级处理");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -190,4 +190,6 @@ public interface RemoteUserService {
|
||||
Map<Long, String> selectPostNamesByIds(List<Long> postIds);
|
||||
|
||||
RemoteUserVo selectUserByPhonenumber(String phone);
|
||||
|
||||
String getPostNameByUserId(Long userId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
@ -11,7 +11,7 @@ RUN mkdir -p /ruoyi/auth/logs \
|
||||
|
||||
WORKDIR /ruoyi/auth
|
||||
|
||||
ENV SERVER_PORT=9210 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
ENV SERVER_PORT=19210 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
|
||||
@ -30,4 +30,5 @@ mybatis-plus:
|
||||
logicNotDeleteValue: 0
|
||||
insertStrategy: NOT_NULL
|
||||
updateStrategy: NOT_NULL
|
||||
# updateStrategy: ALWAYS
|
||||
whereStrategy: NOT_NULL
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
|
||||
@ -96,4 +96,13 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
storage.delete(url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ossId列表删除
|
||||
* @param ossIds
|
||||
*/
|
||||
@Override
|
||||
public void deleteFileByIds(Collection<Long> ossIds) {
|
||||
sysOssService.deleteWithValidByIds(ossIds,false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
@ -11,7 +11,7 @@ RUN mkdir -p /ruoyi/synjinlangyun/logs \
|
||||
|
||||
WORKDIR /ruoyi/synjinlangyun
|
||||
|
||||
ENV SERVER_PORT=9201 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
ENV SERVER_PORT=9202 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
|
||||
@ -494,4 +494,9 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
return BeanUtil.copyProperties(sysUserVo, RemoteUserVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPostNameByUserId(Long userId) {
|
||||
return postService.selectPostNameByUserId(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package org.dromara.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
@ -33,4 +34,10 @@ public interface SysPostMapper extends BaseMapperPlus<SysPost, SysPostVo> {
|
||||
*/
|
||||
List<SysPostVo> selectPostsByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户id获取岗位名称
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
String selectPostNameByUserId(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@ -127,4 +127,11 @@ public interface ISysPostService {
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePost(SysPostBo bo);
|
||||
|
||||
/**
|
||||
* 根据用户id获取岗位名
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
String selectPostNameByUserId(Long userId);
|
||||
}
|
||||
|
||||
@ -249,4 +249,14 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
SysPost post = MapstructUtils.convert(bo, SysPost.class);
|
||||
return baseMapper.updateById(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id获取岗位名
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String selectPostNameByUserId(Long userId) {
|
||||
return baseMapper.selectPostNameByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,5 +14,12 @@
|
||||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
<select id="selectPostNameByUserId" resultType="java.lang.String">
|
||||
select p.post_name
|
||||
from sys_post p
|
||||
left join sys_user_post up on up.post_id = p.post_id
|
||||
left join sys_user u on u.user_id = up.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
@ -11,7 +11,7 @@ RUN mkdir -p /ruoyi/workflow/logs \
|
||||
|
||||
WORKDIR /ruoyi/workflow
|
||||
|
||||
ENV SERVER_PORT=9205 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
ENV SERVER_PORT=19205 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:17.0.15-cds
|
||||
FROM bellsoft/liberica-openjdk-rocky:21.0.7-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
@ -11,7 +11,7 @@ RUN mkdir -p /xny/ops/logs \
|
||||
|
||||
WORKDIR /xny/ops
|
||||
|
||||
ENV SERVER_PORT=19301 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
ENV SERVER_PORT=9203 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
|
||||
|
||||
@ -92,6 +92,16 @@
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common-encrypt</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.dromara</groupId>-->
|
||||
<!-- <artifactId>ruoyi-workflow</artifactId>-->
|
||||
<!-- <version>2.4.1</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package org.dromara.daping.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.daping.domain.bo.GinlongBo;
|
||||
import org.dromara.daping.service.IGinlongApiService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/ginlong/api")
|
||||
public class GinlongApiController extends BaseController {
|
||||
|
||||
private final IGinlongApiService ginlongApiService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询手续办理清单模板列表
|
||||
*/
|
||||
@SaCheckPermission("formalities:listOfFormalities:list")
|
||||
@GetMapping("/getPowerStationOverview")
|
||||
public R<HashMap<String,Object>> getPowerStationOverview() {
|
||||
HashMap<String, Object> map = ginlongApiService.getPowerStationOverview();
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询手续办理清单模板列表
|
||||
*/
|
||||
@SaCheckPermission("formalities:listOfFormalities:list")
|
||||
@GetMapping("/getInverterListOverview")
|
||||
public R<HashMap<String,Object>> getInverterListOverview(GinlongBo bo) {
|
||||
HashMap<String, Object> map = ginlongApiService.getInverterListOverview(bo);
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 能源收益分析
|
||||
*/
|
||||
@SaCheckPermission("formalities:listOfFormalities:list")
|
||||
@GetMapping("/getStationMonthOverview")
|
||||
public R<HashMap<String,Object>> getStationMonthOverview(GinlongBo bo) {
|
||||
HashMap<String, Object> map = ginlongApiService.getStationMonthOverview(bo);
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 告警信息
|
||||
*/
|
||||
@SaCheckPermission("formalities:listOfFormalities:list")
|
||||
@GetMapping("/getAlarmListOverview")
|
||||
public R<List<HashMap<String,Object>>> getAlarmListOverview() {
|
||||
return R.ok(ginlongApiService.getAlarmListOverview());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package org.dromara.daping.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component // 注册为Spring Bean
|
||||
@ConfigurationProperties(prefix = "ginlong.api") // 绑定配置文件中前缀为"ginlong.api"的属性
|
||||
public class GinlongApiEntity {
|
||||
private String url;
|
||||
private String key;
|
||||
private String secret;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package org.dromara.daping.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 测试单表业务对象 test_demo
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2021-07-26
|
||||
*/
|
||||
|
||||
@Data
|
||||
//@EqualsAndHashCode(callSuper = true)
|
||||
public class GinlongBo implements Serializable {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 年月日
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String date;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package org.dromara.daping.service;
|
||||
|
||||
import org.dromara.daping.domain.bo.GinlongBo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface IGinlongApiService {
|
||||
|
||||
String test();
|
||||
|
||||
/**
|
||||
* 查询电站数据
|
||||
* @return
|
||||
*/
|
||||
HashMap<String, Object> getPowerStationOverview();
|
||||
|
||||
/**
|
||||
* 查询逆变器数据
|
||||
* @return
|
||||
*/
|
||||
HashMap<String, Object> getInverterListOverview(GinlongBo bo);
|
||||
|
||||
|
||||
/**
|
||||
* 查询能源收益分析
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
HashMap<String, Object> getStationMonthOverview(GinlongBo bo);
|
||||
|
||||
/**
|
||||
* 查询全部设备报警信息
|
||||
*/
|
||||
List<HashMap<String, Object>> getAlarmListOverview();
|
||||
}
|
||||
@ -0,0 +1,834 @@
|
||||
package org.dromara.daping.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.daping.domain.GinlongApiEntity;
|
||||
import org.dromara.daping.domain.bo.GinlongBo;
|
||||
import org.dromara.daping.service.IGinlongApiService;
|
||||
import org.dromara.daping.utils.GinlongApiClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class GinlongApiServiceImpl implements IGinlongApiService {
|
||||
|
||||
@Autowired
|
||||
private GinlongApiClient apiClient;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public GinlongApiEntity getGinlongApiEntity(){
|
||||
|
||||
|
||||
GinlongApiEntity apiEntity = new GinlongApiEntity();
|
||||
apiEntity.setUrl("https://api.ginlong.com:13333");
|
||||
apiEntity.setKey("1300386381676987116");
|
||||
apiEntity.setSecret("511045d99416484cb93acc2f16a5c149");
|
||||
|
||||
return apiEntity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String test() {
|
||||
// AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(GinlongApiTest.class);
|
||||
|
||||
// 验证GinlongApiEntity是否正确加载
|
||||
GinlongApiEntity apiEntity = new GinlongApiEntity();
|
||||
// GinlongApiEntity apiEntity = context.getBean(GinlongApiEntity.class);
|
||||
// System.out.println("加载的配置信息:"+apiEntity.toString());
|
||||
// System.out.println("url: " + apiEntity.getUrl());
|
||||
// System.out.println("key: " + apiEntity.getKey());
|
||||
// System.out.println("secret: " + apiEntity.getSecret()); // 重点检查是否为null
|
||||
|
||||
// apiEntity.setUrl("https://api.ginlong.com:13333");
|
||||
// apiEntity.setKey("1300386381676987116");
|
||||
// apiEntity.setSecret("511045d99416484cb93acc2f16a5c149");
|
||||
|
||||
if (apiEntity.getSecret() == null) {
|
||||
System.err.println("错误:secret未加载,请检查配置文件!");
|
||||
// context.close();
|
||||
return "";
|
||||
}
|
||||
|
||||
// 调用API(原有逻辑)
|
||||
// GinlongApiClient apiClient = context.getBean(GinlongApiClient.class);
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("pageNo", 1);
|
||||
params.put("pageSize", 100);
|
||||
params.put("nmiCode",null);
|
||||
params.put("idList",new ArrayList<>());
|
||||
String s = apiClient.callApi("/v1/api/userStationList", params,apiEntity);
|
||||
System.out.println("!!!! " +s);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// context.close();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账号下电站列表
|
||||
* @param apiEntity
|
||||
* @return
|
||||
*/
|
||||
public String userStationList(GinlongApiEntity apiEntity){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("pageNo", 1);
|
||||
params.put("pageSize", 100);
|
||||
params.put("nmiCode",null);
|
||||
params.put("idList",new ArrayList<>());
|
||||
return apiClient.callApi("/v1/api/userStationList", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多个电站详情
|
||||
*/
|
||||
public String stationDetailList(GinlongApiEntity apiEntity, List<Long> idList){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("pageNo", 1);
|
||||
params.put("pageSize", 100);
|
||||
params.put("idList",idList);
|
||||
return apiClient.callApi("/v1/api/stationDetailList", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有逆变器详情
|
||||
*/
|
||||
public String inverterList(GinlongApiEntity apiEntity){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("pageNo", 1);
|
||||
params.put("pageSize", 100);
|
||||
return apiClient.callApi("/v1/api/inverterList", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账号下设备报警列表
|
||||
*/
|
||||
public String alarmList(GinlongApiEntity apiEntity){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("pageNo", 1);
|
||||
params.put("pageSize", 100);
|
||||
return apiClient.callApi("/v1/api/alarmList", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单台逆变器某月的日数据
|
||||
*/
|
||||
public String inverterMonth(GinlongApiEntity apiEntity, Long id, String date){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("money", "元");
|
||||
params.put("month", date);
|
||||
|
||||
return apiClient.callApi("/v1/api/inverterMonth", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取单台逆变器某年的月数据
|
||||
*/
|
||||
public String inverterYear(GinlongApiEntity apiEntity, Long id, String date){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("money", "元");
|
||||
params.put("year", date);
|
||||
|
||||
return apiClient.callApi("/v1/api/inverterYear", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单台逆变器某日的实时数据
|
||||
*/
|
||||
public String inverterDay(GinlongApiEntity apiEntity, Long id, String date){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("money", "元");
|
||||
params.put("time", date);
|
||||
params.put("timeZone", 8);
|
||||
|
||||
return apiClient.callApi("/v1/api/inverterDay", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个电站某日的实时数据
|
||||
*/
|
||||
public String stationDay(GinlongApiEntity apiEntity, Long id, String date){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("money", "CNY");
|
||||
params.put("time", date);
|
||||
return apiClient.callApi("/v1/api/stationDay", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个电站某月的日数据
|
||||
*/
|
||||
public String stationMonth(GinlongApiEntity apiEntity, Long id, String date){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("money", "CNY");
|
||||
params.put("month", date);
|
||||
return apiClient.callApi("/v1/api/stationMonth", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取单个电站某年的月数据
|
||||
*/
|
||||
public String stationYear(GinlongApiEntity apiEntity, Long id, String date){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("money", "CNY");
|
||||
params.put("year", date);
|
||||
return apiClient.callApi("/v1/api/stationYear", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 获取多个电站某日的实时数据
|
||||
// */
|
||||
// public String stationDayEnergyList(GinlongApiEntity apiEntity, List<Long> idList, String date){
|
||||
// try {
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("idList", idList);
|
||||
// params.put("time", date);
|
||||
// return apiClient.callApi("/v1/api/stationDayEnergyList", params,apiEntity);
|
||||
// } catch (Exception e) {
|
||||
// throw new ServiceException(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * 获取多个电站的月数据
|
||||
// */
|
||||
// public String stationMonthEnergyList(GinlongApiEntity apiEntity, List<Long> idList, String date){
|
||||
// try {
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("idList", idList);
|
||||
// params.put("time", date);
|
||||
// return apiClient.callApi("/v1/api/stationMonthEnergyList", params,apiEntity);
|
||||
// } catch (Exception e) {
|
||||
// throw new ServiceException(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * 获取多个电站的年数据
|
||||
// */
|
||||
// public String stationYearEnergyList(GinlongApiEntity apiEntity, List<Long> idList, String date){
|
||||
// try {
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("idList", idList);
|
||||
// params.put("time", date);
|
||||
// return apiClient.callApi("/v1/api/stationYearEnergyList", params,apiEntity);
|
||||
// } catch (Exception e) {
|
||||
// throw new ServiceException(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取单个电站详情
|
||||
*/
|
||||
public String stationDetail(GinlongApiEntity apiEntity, Long id){
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
return apiClient.callApi("/v1/api/stationDetail", params,apiEntity);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取电站总览数据信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> getPowerStationOverview() {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
GinlongApiEntity apiEntity = getGinlongApiEntity();
|
||||
|
||||
double dayEnergy = 0.0; //今日总发电量
|
||||
|
||||
List<Long> idList = new ArrayList<>();
|
||||
//使用获取账号下电站列表接口获取数据
|
||||
String s = userStationList(apiEntity);
|
||||
String s2 = inverterList(apiEntity);
|
||||
getInverterList(s2, map);
|
||||
getUserStationList(s, idList, map);
|
||||
|
||||
//使用获取多个电站详情接口获取数据
|
||||
String s1 = stationDetailList(apiEntity, idList);
|
||||
// System.out.println(s1);
|
||||
getStationDetailList(s1, dayEnergy, map);
|
||||
|
||||
|
||||
System.out.println(map);
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private void getInverterList(String s2, HashMap<String, Object> map) {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s2);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject inverterStatusVo = data.getJSONObject("inverterStatusVo");
|
||||
// Object obj = RedisUtils.getCacheObject("health");
|
||||
// RedisUtils.getCacheObject()
|
||||
// String username = redisTemplate.get("username");
|
||||
// Double healthOld = redisTemplate.opsForValue().get("health");
|
||||
String healthOld = stringRedisTemplate.opsForValue().get("health");
|
||||
map.put("healthOld", healthOld != null ? Double.parseDouble(healthOld) : 0.0);
|
||||
// if (obj != null) {
|
||||
// double healthOld = Double.parseDouble(String.valueOf(obj));
|
||||
// // 使用 value
|
||||
// map.put("healthOld",healthOld );
|
||||
// }else {
|
||||
// map.put("healthOld",0.0 );
|
||||
//
|
||||
// }
|
||||
if (inverterStatusVo.getInt("all") >0){
|
||||
double health = (double) (inverterStatusVo.getInt("all") - inverterStatusVo.getInt("fault")) /inverterStatusVo.getInt("all") * 100;//健康度
|
||||
map.put("health", health);//健康度
|
||||
}else {
|
||||
map.put("health", 0);//健康度
|
||||
}
|
||||
}
|
||||
private static void getInverterList1(String s2) {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s2);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject inverterStatusVo = data.getJSONObject("inverterStatusVo");
|
||||
if (inverterStatusVo.getInt("all") >0){
|
||||
double health = (double) (inverterStatusVo.getInt("all") - inverterStatusVo.getInt("fault")) /inverterStatusVo.getInt("all") * 100;//健康度
|
||||
RedisUtils.setCacheObject("health",health);
|
||||
}else {
|
||||
RedisUtils.setCacheObject("health",0);
|
||||
}
|
||||
RedisUtils.expire("health",86400);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取逆电器数据
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> getInverterListOverview(GinlongBo bo) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
GinlongApiEntity apiEntity = getGinlongApiEntity();
|
||||
String s = inverterList(apiEntity);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject inverterStatusVo = data.getJSONObject("inverterStatusVo");
|
||||
map.put("all",inverterStatusVo.getInt("all"));//全部
|
||||
map.put("normal",inverterStatusVo.getInt("normal"));//正常
|
||||
map.put("offline",inverterStatusVo.getInt("offline"));//离线
|
||||
map.put("fault",inverterStatusVo.getInt("fault"));//异常
|
||||
JSONObject page = data.getJSONObject("page");
|
||||
JSONArray records = page.getJSONArray("records");
|
||||
List<Long> ids = new ArrayList<>();
|
||||
if (!records.isEmpty()) {
|
||||
for (Object record : records) {
|
||||
JSONObject object = JSONUtil.parseObj(record);
|
||||
ids.add(object.getLong("id"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<HashMap<String, Object>> hashMaps = new ArrayList<>();
|
||||
switch (bo.getType()) {
|
||||
case 1:
|
||||
String s1 = inverterDay(apiEntity, ids.getFirst(), bo.getDate());
|
||||
JSONObject jsonObject1 = JSONUtil.parseObj(s1);
|
||||
JSONArray data1 = jsonObject1.getJSONArray("data");
|
||||
int a = 0;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
double count = 0.0;
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
String time = i*2+2<10?"0"+i*2+2:(i*2+2)+"";
|
||||
map1.put("time", i*2<10?"0"+i*2+":00":i*2+":00");
|
||||
if (data1 != null && !data1.isEmpty()){
|
||||
for (int x = a; x < data1.size(); x++) {
|
||||
Object obj = data1.get(x); // 通过索引获取元素
|
||||
JSONObject object = JSONUtil.parseObj(obj);
|
||||
if (object.getStr("time").substring(0, 2).compareTo(time) >0){
|
||||
break;
|
||||
}
|
||||
count += object.getDouble("pac");
|
||||
a++;
|
||||
}
|
||||
map1.put("content", count);
|
||||
hashMaps.add(map1);
|
||||
continue;
|
||||
}else {
|
||||
map1.put("content", 0);
|
||||
}
|
||||
hashMaps.add(map1);
|
||||
}
|
||||
System.out.println(hashMaps);
|
||||
break;
|
||||
case 2:
|
||||
String s2 = inverterMonth(apiEntity, ids.getFirst(), bo.getDate());
|
||||
JSONObject jsonObject2 = JSONUtil.parseObj(s2);
|
||||
JSONArray data2 = jsonObject2.getJSONArray("data");
|
||||
if (data2 != null && !data2.isEmpty()){
|
||||
for (Object obj : data2) {
|
||||
HashMap<String, Object> map2 = new HashMap<>();
|
||||
JSONObject object = JSONUtil.parseObj(obj);
|
||||
map2.put("time", object.getStr("dateStr"));
|
||||
map2.put("content", object.get("energy"));
|
||||
hashMaps.add(map2);
|
||||
}
|
||||
}else {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
YearMonth yearMonth = YearMonth.parse(bo.getDate(), formatter);
|
||||
|
||||
int year = yearMonth.getYear(); // 2025
|
||||
int monthValue = yearMonth.getMonthValue();
|
||||
int day = LocalDate.of(year, monthValue, 1).lengthOfMonth();
|
||||
String month = monthValue<10?"0"+monthValue:monthValue+"";
|
||||
for (int i = 1; i <= day; i++){
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
map1.put("time", i<10?month+"-0"+i:month+"-"+i);
|
||||
map1.put("content", 0);
|
||||
hashMaps.add(map1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
String s3 = inverterYear(apiEntity, ids.getFirst(), bo.getDate());
|
||||
JSONObject jsonObject3 = JSONUtil.parseObj(s3);
|
||||
JSONArray data3 = jsonObject3.getJSONArray("data");
|
||||
System.out.println(data3);
|
||||
if (data3 != null && !data3.isEmpty()) {
|
||||
for (Object obj : data3) {
|
||||
HashMap<String, Object> map3 = new HashMap<>();
|
||||
JSONObject object = JSONUtil.parseObj(obj);
|
||||
map3.put("time", object.getStr("dateStr"));
|
||||
map3.put("content", object.get("energy"));
|
||||
hashMaps.add(map3);
|
||||
}
|
||||
}else {
|
||||
for (int i = 1; i <= 12; i++){
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
map1.put("time", i<10?bo.getDate()+"-0"+i:bo.getDate()+"-"+i);
|
||||
map1.put("content", 0);
|
||||
hashMaps.add(map1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
map.put("data",hashMaps);
|
||||
System.out.println(map);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 能源收益分析
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> getStationMonthOverview(GinlongBo bo) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
GinlongApiEntity apiEntity = getGinlongApiEntity();
|
||||
List<Long> idList = new ArrayList<>();
|
||||
//使用获取账号下电站列表接口获取数据
|
||||
String s = userStationList(apiEntity);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject page = data.getJSONObject("page");
|
||||
JSONArray records = page.getJSONArray("records");
|
||||
if (!records.isEmpty()){
|
||||
for (Object record : records) {
|
||||
JSONObject object = JSONUtil.parseObj(record);
|
||||
idList.add(object.getLong("id"));
|
||||
}
|
||||
}
|
||||
List<HashMap<String, Object>> hashMaps = new ArrayList<>();
|
||||
switch (bo.getType()){
|
||||
case 1:
|
||||
// String s1 = stationDay(apiEntity, idList.getFirst(), bo.getDate());
|
||||
// System.out.println(s1);
|
||||
// JSONObject jsonObject1 = JSONUtil.parseObj(s1);
|
||||
// JSONArray data1 = jsonObject1.getJSONArray("data");
|
||||
// int a = 0;
|
||||
// for (int i = 0; i < 12; i++) {
|
||||
// double count = 0.0;
|
||||
// HashMap<String, Object> map1 = new HashMap<>();
|
||||
// String time = i * 2 + 2 < 10 ? "0" + i * 2 + 2 : (i * 2 + 2) + "";
|
||||
// map1.put("time", i * 2 < 10 ? "0" + i * 2 + ":00" : i * 2 + ":00");
|
||||
// if (data1 != null && !data1.isEmpty()) {
|
||||
// for (int x = a; x < data1.size(); x++) {
|
||||
// Object obj = data1.get(x); // 通过索引获取元素
|
||||
// JSONObject object = JSONUtil.parseObj(obj);
|
||||
// if (object.getStr("timeStr").substring(0, 2).compareTo(time) > 0) {
|
||||
// break;
|
||||
// }
|
||||
// count += object.getDouble("power");
|
||||
// a++;
|
||||
// }
|
||||
// map1.put("content", count);
|
||||
//
|
||||
// hashMaps.add(map1);
|
||||
// continue;
|
||||
// } else {
|
||||
// map1.put("content", 0);
|
||||
// }
|
||||
// hashMaps.add(map1);
|
||||
// }
|
||||
// int y = 0;
|
||||
// for (Long id : idList) {
|
||||
// String s1 = stationDay(apiEntity, id, bo.getDate());
|
||||
// System.out.println(s1);
|
||||
// JSONObject jsonObject1 = JSONUtil.parseObj(s1);
|
||||
// JSONArray data1 = jsonObject1.getJSONArray("data");
|
||||
// int a = 0;
|
||||
// for (int i = 0; i < 12; i++) {
|
||||
// double count = 0.0;
|
||||
// HashMap<String, Object> map1 = new HashMap<>();
|
||||
// String time = i*2+2<10?"0"+i*2+2:(i*2+2)+"";
|
||||
// if (y == 0){
|
||||
// map1.put("time", i*2<10?"0"+i*2+":00":i*2+":00");
|
||||
// }
|
||||
// if (data1 != null && !data1.isEmpty()){
|
||||
// for (int x = a; x < data1.size(); x++) {
|
||||
// Object obj = data1.get(x); // 通过索引获取元素
|
||||
// JSONObject object = JSONUtil.parseObj(obj);
|
||||
// if (object.getStr("timeStr").substring(0, 2).compareTo(time) >0){
|
||||
// break;
|
||||
// }
|
||||
// count += object.getDouble("power");
|
||||
// a++;
|
||||
// }
|
||||
// map1.put("content", y == 0 ? count: (hashMaps.get(y).get(time) == null) ? 0.0 : (Double) hashMaps.get(y).get(time) + count);
|
||||
//
|
||||
// hashMaps.add(map1);
|
||||
// continue;
|
||||
// }else {
|
||||
// map1.put("content", y == 0 ? 0: (hashMaps.get(y).get(time) == null) ? 0.0 : (Double) hashMaps.get(y).get(time) + 0);
|
||||
// }
|
||||
// hashMaps.add(map1);
|
||||
// }
|
||||
// y++;
|
||||
// }
|
||||
break;
|
||||
case 2:
|
||||
String s2 = stationMonth(apiEntity, idList.getFirst(), bo.getDate());
|
||||
JSONObject jsonObject2 = JSONUtil.parseObj(s2);
|
||||
JSONArray data2 = jsonObject2.getJSONArray("data");
|
||||
|
||||
if (data2 != null && !data2.isEmpty()){
|
||||
for (Object obj : data2) {
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
JSONObject object = JSONUtil.parseObj(obj);
|
||||
map1.put("time", object.getStr("dateStr"));
|
||||
map1.put("content", object.get("money"));
|
||||
hashMaps.add(map1);
|
||||
}
|
||||
}else {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
YearMonth yearMonth = YearMonth.parse(bo.getDate(), formatter);
|
||||
|
||||
int year = yearMonth.getYear(); // 2025
|
||||
int monthValue = yearMonth.getMonthValue();
|
||||
int day = LocalDate.of(year, monthValue, 1).lengthOfMonth();
|
||||
String month = monthValue<10?"0"+monthValue:monthValue+"";
|
||||
for (int i = 1; i <= day; i++){
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
map1.put("time", i<10?month+"-0"+i:month+"-"+i);
|
||||
map1.put("content", 0);
|
||||
hashMaps.add(map1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
String s3 = stationYear(apiEntity, idList.getFirst(), bo.getDate());
|
||||
JSONObject jsonObject3 = JSONUtil.parseObj(s3);
|
||||
JSONArray data3 = jsonObject3.getJSONArray("data");
|
||||
System.out.println(data3);
|
||||
if (data3 != null && !data3.isEmpty()) {
|
||||
for (Object obj : data3) {
|
||||
HashMap<String, Object> map3 = new HashMap<>();
|
||||
JSONObject object = JSONUtil.parseObj(obj);
|
||||
map3.put("time", object.getStr("dateStr").substring(0, 7));
|
||||
map3.put("content", object.get("money"));
|
||||
hashMaps.add(map3);
|
||||
}
|
||||
}else {
|
||||
for (int i = 1; i <= 12; i++){
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
map1.put("time", i<10?bo.getDate()+"-0"+i:bo.getDate()+"-"+i);
|
||||
map1.put("content", 0);
|
||||
hashMaps.add(map1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
map.put("data",hashMaps);
|
||||
|
||||
String s2 = stationDetail(apiEntity, idList.getFirst());
|
||||
JSONObject jsonObject2 = JSONUtil.parseObj(s2);
|
||||
JSONObject data2 = jsonObject2.getJSONObject("data");
|
||||
map.put("allInCome",data2.get("allInCome"));//累计收益
|
||||
map.put("monthInCome",data2.get("monthInCome"));//本月收益
|
||||
map.put("yearInCome",data2.get("yearInCome"));//本年收益
|
||||
map.put("price",data2.get("price"));//每度电收益
|
||||
|
||||
System.out.println(map);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部设备报警信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<HashMap<String, Object>> getAlarmListOverview() {
|
||||
List<HashMap<String, Object>> list = new ArrayList<>();
|
||||
GinlongApiEntity apiEntity = getGinlongApiEntity();
|
||||
String s = alarmList(apiEntity);
|
||||
System.out.println(s);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray records = data.getJSONArray("records");
|
||||
for (Object record : records) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
JSONObject obj = JSONUtil.parseObj(record);
|
||||
map.put("stationName", obj.get("stationName"));//电站名称
|
||||
map.put("alarmLevel", obj.get("alarmLevel")); // 报警等级:1 = 提示,2 = 一般,3 = 紧急
|
||||
map.put("alarmBeginTime", obj.get("alarmBeginTime")); //报警开始时间
|
||||
map.put("alarmMsg", obj.get("alarmMsg")); //报警内容
|
||||
map.put("advice", obj.get("advice")); //报警处理建议
|
||||
map.put("state", obj.get("state")); //报警状态:0 = 未处理,1 = 已处理,2 = 已恢复
|
||||
if ("1".equals(obj.getStr("state")) || "2".equals(obj.getStr("state"))){
|
||||
continue;
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
// return list.stream().filter(map -> {
|
||||
// Object statusObj = map.get("state");
|
||||
// if (statusObj instanceof Integer) {
|
||||
// int status = (Integer) statusObj;
|
||||
// return status == 1 || status == 2;
|
||||
// }
|
||||
// return false;
|
||||
// }).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void getStationDetailList(String s1, double dayEnergy, HashMap<String, Object> map) {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s1);
|
||||
String dayEnergyOld = stringRedisTemplate.opsForValue().get("dayEnergy");
|
||||
map.put("dayEnergyOld", dayEnergyOld != null ? Double.parseDouble(dayEnergyOld) : 0.0);
|
||||
String powerStationAvoidedCo2Old = stringRedisTemplate.opsForValue().get("powerStationAvoidedCo2");
|
||||
map.put("powerStationAvoidedCo2Old", powerStationAvoidedCo2Old != null ? Double.parseDouble(powerStationAvoidedCo2Old) : 0.0);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray records = data.getJSONArray("records");
|
||||
double powerStationAvoidedCo2 = 0.0;
|
||||
for (Object record : records) {
|
||||
JSONObject object = JSONUtil.parseObj(record);
|
||||
dayEnergy += object.getDouble("dayEnergy");
|
||||
powerStationAvoidedCo2 += object.getDouble("powerStationAvoidedCo2");
|
||||
}
|
||||
map.put("dayEnergy", dayEnergy);//今日总发电量
|
||||
map.put("powerStationAvoidedCo2", powerStationAvoidedCo2);//碳排放量
|
||||
}
|
||||
private static void getStationDetailList1(String s1, double dayEnergy) {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s1);
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONArray records = data.getJSONArray("records");
|
||||
double powerStationAvoidedCo2 = 0.0;
|
||||
for (Object record : records) {
|
||||
JSONObject object = JSONUtil.parseObj(record);
|
||||
dayEnergy += object.getDouble("dayEnergy");
|
||||
powerStationAvoidedCo2 += object.getDouble("powerStationAvoidedCo2");
|
||||
}
|
||||
RedisUtils.setCacheObject("dayEnergy",dayEnergy);//今日总发电量
|
||||
RedisUtils.setCacheObject("powerStationAvoidedCo2",powerStationAvoidedCo2);//碳排放量
|
||||
|
||||
RedisUtils.expire("dayEnergy",86400);
|
||||
RedisUtils.expire("powerStationAvoidedCo2",86400);
|
||||
|
||||
}
|
||||
|
||||
private void getUserStationList(String s, List<Long> idList, HashMap<String, Object> map) {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
double capacity = 0.0; // 总装机容量
|
||||
int module = 0;//光伏板数量
|
||||
double generateElectricity = 0.0;//发电效率
|
||||
double batteryTodayDischargeEnergy = 0.0;//放电效率
|
||||
double batteryTodayChargeEnergy = 0.0;//充电效率
|
||||
String capacityOld = stringRedisTemplate.opsForValue().get("capacity");
|
||||
map.put("capacityOld", capacityOld != null ? Double.parseDouble(capacityOld) : 0.0);
|
||||
String moduleOld = stringRedisTemplate.opsForValue().get("module");
|
||||
map.put("moduleOld", moduleOld != null ? Double.parseDouble(moduleOld) : 0.0);
|
||||
String generateElectricityOld = stringRedisTemplate.opsForValue().get("generateElectricity");
|
||||
map.put("generateElectricityOld", generateElectricityOld != null ? Double.parseDouble(generateElectricityOld) : 0.0);
|
||||
String operatingRateOld = stringRedisTemplate.opsForValue().get("operatingRate");
|
||||
map.put("operatingRateOld", operatingRateOld != null ? Double.parseDouble(operatingRateOld) : 0.0);
|
||||
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject stationStatusVo = data.getJSONObject("stationStatusVo");
|
||||
if (stationStatusVo.getInt("all") >0){
|
||||
JSONObject page = data.getJSONObject("page");
|
||||
JSONArray records = page.getJSONArray("records");
|
||||
int all = stationStatusVo.getInt("all");//全部电站
|
||||
if (!records.isEmpty()){
|
||||
for (Object record : records) {
|
||||
JSONObject object = JSONUtil.parseObj(record);
|
||||
capacity += object.getDouble("capacity");
|
||||
batteryTodayDischargeEnergy += object.getDouble("batteryTodayDischargeEnergy");
|
||||
batteryTodayChargeEnergy += object.getDouble("batteryTodayChargeEnergy");
|
||||
module += object.getInt("module");
|
||||
idList.add(object.getLong("id"));
|
||||
|
||||
}
|
||||
}
|
||||
if (batteryTodayDischargeEnergy >0){
|
||||
generateElectricity = (1-(batteryTodayChargeEnergy/batteryTodayDischargeEnergy))*100;
|
||||
}else {
|
||||
generateElectricity = 0;
|
||||
}
|
||||
map.put("operatingRate", all);//电站总数
|
||||
}else {
|
||||
map.put("operatingRate", 0.0);//运行率
|
||||
}
|
||||
map.put("capacity", capacity);//总装机容量
|
||||
map.put("module", module);//光伏板数量
|
||||
map.put("generateElectricity", generateElectricity);//发电效率
|
||||
}
|
||||
|
||||
private static void getUserStationList1(String s, List<Long> idList) {
|
||||
JSONObject jsonObject = JSONUtil.parseObj(s);
|
||||
double capacity = 0.0; // 总装机容量
|
||||
int module = 0;//光伏板数量
|
||||
double generateElectricity = 0.0;//发电效率
|
||||
double batteryTodayDischargeEnergy = 0.0;//放电效率
|
||||
double batteryTodayChargeEnergy = 0.0;//充电效率
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
JSONObject stationStatusVo = data.getJSONObject("stationStatusVo");
|
||||
if (stationStatusVo.getInt("all") >0){
|
||||
JSONObject page = data.getJSONObject("page");
|
||||
JSONArray records = page.getJSONArray("records");
|
||||
int all = stationStatusVo.getInt("all");//全部电站
|
||||
int normal = stationStatusVo.getInt("normal");//正常电站
|
||||
|
||||
if (!records.isEmpty()){
|
||||
for (Object record : records) {
|
||||
JSONObject object = JSONUtil.parseObj(record);
|
||||
capacity += object.getDouble("capacity");
|
||||
batteryTodayDischargeEnergy += object.getDouble("batteryTodayDischargeEnergy");
|
||||
batteryTodayChargeEnergy += object.getDouble("batteryTodayChargeEnergy");
|
||||
module += object.getInt("module");
|
||||
idList.add(object.getLong("id"));
|
||||
|
||||
}
|
||||
}
|
||||
if (batteryTodayDischargeEnergy >0){
|
||||
generateElectricity = (1-(batteryTodayChargeEnergy/batteryTodayDischargeEnergy))*100;
|
||||
}else {
|
||||
generateElectricity = 0;
|
||||
}
|
||||
RedisUtils.setCacheObject("operatingRate",all);
|
||||
}else {
|
||||
RedisUtils.setCacheObject("operatingRate",0);
|
||||
}
|
||||
RedisUtils.setCacheObject("capacity",capacity);//总装机容量
|
||||
RedisUtils.setCacheObject("module",module);//光伏板数量
|
||||
RedisUtils.setCacheObject("generateElectricity",generateElectricity);//发电效率
|
||||
RedisUtils.expire("capacity",86400);
|
||||
RedisUtils.expire("module",86400);
|
||||
RedisUtils.expire("generateElectricity",86400);
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 59 23 * * ?")
|
||||
@Scheduled(initialDelay = 5000)
|
||||
public void redisSetData(){
|
||||
GinlongApiEntity apiEntity = getGinlongApiEntity();
|
||||
|
||||
double dayEnergy = 0.0; //今日总发电量
|
||||
|
||||
List<Long> idList = new ArrayList<>();
|
||||
String s = userStationList(apiEntity);
|
||||
String s2 = inverterList(apiEntity);
|
||||
getInverterList1(s2);
|
||||
getUserStationList1(s, idList);
|
||||
|
||||
//使用获取多个电站详情接口获取数据
|
||||
String s1 = stationDetailList(apiEntity, idList);
|
||||
// System.out.println(s1);
|
||||
getStationDetailList1(s1, dayEnergy);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package org.dromara.daping.utils;
|
||||
|
||||
import cn.hutool.crypto.digest.HMac;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.dromara.daping.domain.GinlongApiEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class GinlongApiClient {
|
||||
|
||||
private static final String CONTENT_TYPE = "application/json";
|
||||
|
||||
// 直接注入从配置文件绑定的实体类
|
||||
@Autowired
|
||||
private GinlongApiEntity apiEntity;
|
||||
|
||||
/**
|
||||
* 通用API调用方法
|
||||
*
|
||||
* @param path 接口路径(如:/v1/api/userStationList)
|
||||
* @param params 请求参数(无参数时传null)
|
||||
* @param apiEntity
|
||||
* @return 接口返回的JSON字符串
|
||||
* @throws Exception 可能的异常(签名失败、网络错误等)
|
||||
*/
|
||||
public String callApi(String path, Map<String, Object> params, GinlongApiEntity apiEntity) throws Exception {
|
||||
// 1. 处理请求体(转为JSON字符串)
|
||||
String body = (params != null) ? JSONUtil.toJsonStr(params) : "{}";
|
||||
// 2. 计算Content-MD5
|
||||
String contentMd5 = calcContentMD5(body);
|
||||
// 3. 获取GMT时间(需在当前时间±15分钟内)
|
||||
String gmtDate = getGMTDate();
|
||||
// 4. 计算签名
|
||||
String signature = buildSignature(path, contentMd5, gmtDate,apiEntity);
|
||||
// 5. 构建完整请求URL
|
||||
String url = apiEntity.getUrl() + path;
|
||||
|
||||
// 6. 发送POST请求并返回结果
|
||||
HttpResponse response = HttpRequest.post(url)
|
||||
.header("Content-Type", CONTENT_TYPE)
|
||||
.header("Content-MD5", contentMd5)
|
||||
.header("Date", gmtDate)
|
||||
.header("Authorization", "API " + apiEntity.getKey() + ":" + signature) // 使用实体类的key
|
||||
.body(body)
|
||||
.execute();
|
||||
|
||||
return response.body();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算Content-MD5(按文档规范)
|
||||
*/
|
||||
private String calcContentMD5(String body) {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(body.getBytes(StandardCharsets.UTF_8));
|
||||
byte[] digest = md.digest();
|
||||
return Base64.getEncoder().encodeToString(digest);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("计算Content-MD5失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取符合格式的GMT时间
|
||||
*/
|
||||
private String getGMTDate() {
|
||||
//1、获取GMT时区下的当前时间;
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
//2、将当前时间按以下格式转换为字符串。 格式:EEE, d MMM yyyy HH:mm:ss 'GMT'注意:Date 时间不能超出当前时间的正负15分钟,否则会出现调用失败。
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"EEE, d MMM yyyy HH:mm:ss 'GMT'",
|
||||
Locale.US
|
||||
);
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return sdf.format(calendar.getTime());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建签名(按文档规范)
|
||||
*/
|
||||
private String buildSignature(String path, String contentMd5, String gmtDate, GinlongApiEntity apiEntity) {
|
||||
// 拼接签名原文
|
||||
String signatureText = "POST" + "\n"
|
||||
+ contentMd5 + "\n"
|
||||
+ CONTENT_TYPE + "\n"
|
||||
+ gmtDate + "\n"
|
||||
+ path;
|
||||
// 计算HmacSHA1并Base64编码
|
||||
HMac hmac = new HMac(
|
||||
HmacAlgorithm.HmacSHA1,
|
||||
apiEntity.getSecret().getBytes(StandardCharsets.UTF_8)); // 使用实体类的secret
|
||||
return hmac.digestBase64(signatureText, false);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package org.dromara.inspection.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionNodeBo;
|
||||
import org.dromara.inspection.service.IOpsInspectionNodeService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点
|
||||
* 前端访问路由地址为:/inspection/node
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/node")
|
||||
public class OpsInspectionNodeController extends BaseController {
|
||||
|
||||
private final IOpsInspectionNodeService opsInspectionNodeService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-通用节点列表
|
||||
*/
|
||||
@SaCheckPermission("inspection:node:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OpsInspectionNodeVo> list(OpsInspectionNodeBo bo, PageQuery pageQuery) {
|
||||
return opsInspectionNodeService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出运维-巡检-通用节点列表
|
||||
*/
|
||||
@SaCheckPermission("inspection:node:export")
|
||||
@Log(title = "运维-巡检-通用节点", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OpsInspectionNodeBo bo, HttpServletResponse response) {
|
||||
List<OpsInspectionNodeVo> list = opsInspectionNodeService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "运维-巡检-通用节点", OpsInspectionNodeVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运维-巡检-通用节点详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("inspection:node:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<OpsInspectionNodeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(opsInspectionNodeService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-通用节点
|
||||
*/
|
||||
@SaCheckPermission("inspection:node:add")
|
||||
@Log(title = "运维-巡检-通用节点", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@Transactional
|
||||
public R<String> add(@Validated(AddGroup.class) @RequestBody List<OpsInspectionNodeBo> bo) {
|
||||
return opsInspectionNodeService.insertByBo(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-通用节点
|
||||
*/
|
||||
@SaCheckPermission("inspection:node:edit")
|
||||
@Log(title = "运维-巡检-通用节点", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody List<OpsInspectionNodeBo> bo) {
|
||||
return toAjax(opsInspectionNodeService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运维-巡检-通用节点
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("inspection:node:remove")
|
||||
@Log(title = "运维-巡检-通用节点", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(opsInspectionNodeService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package org.dromara.inspection.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.inspection.domain.vo.OrderRecordVo;
|
||||
import org.dromara.inspection.service.impl.OpsInspectionOrderServiceImpl;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionOrderVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionOrderBo;
|
||||
import org.dromara.inspection.service.IOpsInspectionOrderService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单
|
||||
* 前端访问路由地址为:/inspection/order
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OpsInspectionOrderController extends BaseController {
|
||||
|
||||
private final OpsInspectionOrderServiceImpl opsInspectionOrderService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-工单列表
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OpsInspectionOrderVo> list(OpsInspectionOrderBo bo, PageQuery pageQuery) {
|
||||
return opsInspectionOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出运维-巡检-工单列表
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:export")
|
||||
@Log(title = "运维-巡检-工单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OpsInspectionOrderBo bo, HttpServletResponse response) {
|
||||
List<OpsInspectionOrderVo> list = opsInspectionOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "运维-巡检-工单", OpsInspectionOrderVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运维-巡检-工单详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<OpsInspectionOrderVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(opsInspectionOrderService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-工单
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:add")
|
||||
@Log(title = "运维-巡检-工单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OpsInspectionOrderBo bo) {
|
||||
return toAjax(opsInspectionOrderService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-工单
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:edit")
|
||||
@Log(title = "运维-巡检-工单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsInspectionOrderBo bo) {
|
||||
return toAjax(opsInspectionOrderService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运维-巡检-工单
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:remove")
|
||||
@Log(title = "运维-巡检-工单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(opsInspectionOrderService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取纪录
|
||||
*/
|
||||
@SaCheckPermission("inspection:order:record")
|
||||
@GetMapping("/record")
|
||||
public R<OrderRecordVo> record(Long projectId) {
|
||||
return opsInspectionOrderService.record(projectId);
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class OpsInspectionTaskController extends BaseController {
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsInspectionTaskBo bo) {
|
||||
return toAjax(opsInspectionTaskService.updateByBo(bo));
|
||||
return opsInspectionTaskService.updateByBo(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
package org.dromara.inspection.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTaskProblemVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTaskProblemBo;
|
||||
import org.dromara.inspection.service.IOpsInspectionTaskProblemService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题
|
||||
* 前端访问路由地址为:/inspection/problem
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/problem")
|
||||
public class OpsInspectionTaskProblemController extends BaseController {
|
||||
|
||||
private final IOpsInspectionTaskProblemService opsInspectionTaskProblemService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-任务-问题列表
|
||||
*/
|
||||
@SaCheckPermission("inspection:problem:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OpsInspectionTaskProblemVo> list(OpsInspectionTaskProblemBo bo, PageQuery pageQuery) {
|
||||
return opsInspectionTaskProblemService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出运维-巡检-任务-问题列表
|
||||
*/
|
||||
@SaCheckPermission("inspection:problem:export")
|
||||
@Log(title = "运维-巡检-任务-问题", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OpsInspectionTaskProblemBo bo, HttpServletResponse response) {
|
||||
List<OpsInspectionTaskProblemVo> list = opsInspectionTaskProblemService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "运维-巡检-任务-问题", OpsInspectionTaskProblemVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运维-巡检-任务-问题详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("inspection:problem:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<OpsInspectionTaskProblemVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(opsInspectionTaskProblemService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-任务-问题
|
||||
*/
|
||||
@SaCheckPermission("inspection:problem:add")
|
||||
@Log(title = "运维-巡检-任务-问题", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OpsInspectionTaskProblemBo bo) {
|
||||
return toAjax(opsInspectionTaskProblemService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-任务-问题
|
||||
*/
|
||||
@SaCheckPermission("inspection:problem:edit")
|
||||
@Log(title = "运维-巡检-任务-问题", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsInspectionTaskProblemBo bo) {
|
||||
return toAjax(opsInspectionTaskProblemService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运维-巡检-任务-问题
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("inspection:problem:remove")
|
||||
@Log(title = "运维-巡检-任务-问题", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(opsInspectionTaskProblemService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class OpsInspectionTestTaskController extends BaseController {
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsInspectionTestTaskBo bo) {
|
||||
return toAjax(opsInspectionTestTaskService.updateByBo(bo));
|
||||
return opsInspectionTestTaskService.updateByBo(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,11 +110,11 @@ public class OpsInspectionTestTaskController extends BaseController {
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
// @SaCheckPermission("inspection:testTask:record")
|
||||
// @GetMapping("/record")
|
||||
// public R<Object> record(@RequestParam Long projectId){
|
||||
// return opsInspectionTestTaskService.record(projectId);
|
||||
// }
|
||||
@SaCheckPermission("inspection:testTask:record")
|
||||
@GetMapping("/record")
|
||||
public R<Object> record(@RequestParam Long projectId){
|
||||
return opsInspectionTestTaskService.record(projectId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
package org.dromara.inspection.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点对象 ops_inspection_node
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ops_inspection_node")
|
||||
public class OpsInspectionNode extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所用模块1工单2巡检任务3试验任务
|
||||
*/
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 顺序编号
|
||||
*/
|
||||
private Long code;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 预期目的
|
||||
*/
|
||||
private String intendedPurpose;
|
||||
|
||||
/**
|
||||
* 预期完成时间
|
||||
*/
|
||||
private Date intendedTime;
|
||||
|
||||
/**
|
||||
* 实际完成时间
|
||||
*/
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态1完成2未完成3失败
|
||||
*/
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package org.dromara.inspection.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单对象 ops_inspection_order
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ops_inspection_order")
|
||||
public class OpsInspectionOrder extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主要id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目(电站)id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工单标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 工单类型1维护保养2检查检测3安装调试4升级改造
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 工单优先级1低2中3高
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 工单描述
|
||||
*/
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 执行地点
|
||||
*/
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 相关设备/系统
|
||||
*/
|
||||
private String device;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 节点ids
|
||||
*/
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 预期成果
|
||||
*/
|
||||
private String results;
|
||||
|
||||
/**
|
||||
* 是否需要执行人,1是2否(取消使用)
|
||||
*/
|
||||
private String executor;
|
||||
|
||||
/**
|
||||
* 执行人ids(取消使用)
|
||||
*/
|
||||
private String executorIds;
|
||||
|
||||
/**
|
||||
* 工单状态1待派单2已派单3执行中4已完成
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 派单时间
|
||||
*/
|
||||
private Date sendOrderTime;
|
||||
|
||||
/**
|
||||
* 接单时间
|
||||
*/
|
||||
private Date getOrderTime;
|
||||
|
||||
/**
|
||||
* 接单人
|
||||
*/
|
||||
private Long getOrderPerson;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
private Date finishiOrderTime;
|
||||
|
||||
/**
|
||||
* 验收结果1通过2需整改
|
||||
*/
|
||||
private String orderResult;
|
||||
|
||||
/**
|
||||
* 是否重点跟踪1是2否
|
||||
*/
|
||||
private String point;
|
||||
|
||||
|
||||
}
|
||||
@ -38,7 +38,7 @@ public class OpsInspectionPlan extends BaseEntity {
|
||||
/**
|
||||
* 计划名称
|
||||
*/
|
||||
private Long planName;
|
||||
private String planName;
|
||||
|
||||
/**
|
||||
* 计划类型,1每日巡检2每周巡检3每月巡检4每季度巡检
|
||||
|
||||
@ -69,10 +69,9 @@ public class OpsInspectionTask extends BaseEntity {
|
||||
private Long personId;
|
||||
|
||||
/**
|
||||
* 进度
|
||||
* 节点ids
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal taskProgress;
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 状态 1待执行2已延期3执行中4已完成
|
||||
@ -84,6 +83,11 @@ public class OpsInspectionTask extends BaseEntity {
|
||||
*/
|
||||
private String problemType;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
package org.dromara.inspection.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题对象 ops_inspection_task_problem
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ops_inspection_task_problem")
|
||||
public class OpsInspectionTaskProblem extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 巡检任务ID
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 发现问题类型1磁盘使用率2内存使用率3服务状态4响应时间5设备运行状态
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 问题详细信息
|
||||
*/
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 发现日期
|
||||
*/
|
||||
private Date findTime;
|
||||
|
||||
/**
|
||||
* 是否解决1解决2未解决
|
||||
*/
|
||||
private String finish;
|
||||
|
||||
/**
|
||||
* 解决日期
|
||||
*/
|
||||
private Date finishTime;
|
||||
|
||||
|
||||
}
|
||||
@ -64,11 +64,21 @@ public class OpsInspectionTestTask extends BaseEntity {
|
||||
*/
|
||||
private Long person;
|
||||
|
||||
/**
|
||||
* 节点IDS
|
||||
*/
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 状态,1待执行2暂停3失败4执行中5已完成
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否已分析1未分析2已分析
|
||||
*/
|
||||
private String unPack;
|
||||
|
||||
/**
|
||||
* 关联测试计划ID
|
||||
*/
|
||||
@ -87,7 +97,7 @@ public class OpsInspectionTestTask extends BaseEntity {
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private Long progress;
|
||||
// private Long progress;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package org.dromara.inspection.domain.bo;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点业务对象 ops_inspection_node
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = OpsInspectionNode.class, reverseConvertGenerate = false)
|
||||
public class OpsInspectionNodeBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所用模块1工单2巡检任务3试验任务
|
||||
*/
|
||||
@NotBlank(message = "所用模块1工单2巡检任务3试验任务不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
@NotNull(message = "工单ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 顺序编号
|
||||
*/
|
||||
@NotNull(message = "顺序编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long code;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@NotBlank(message = "节点名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 预期目的
|
||||
*/
|
||||
// @NotBlank(message = "预期目的不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String intendedPurpose;
|
||||
|
||||
/**
|
||||
* 预期完成时间
|
||||
*/
|
||||
// @NotNull(message = "预期完成时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date intendedTime;
|
||||
|
||||
/**
|
||||
* 实际完成时间
|
||||
*/
|
||||
// @NotNull(message = "实际完成时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态1完成2未完成3失败
|
||||
*/
|
||||
@NotBlank(message = "状态1完成2未完成不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
package org.dromara.inspection.domain.bo;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionOrder;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单业务对象 ops_inspection_order
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = OpsInspectionOrder.class, reverseConvertGenerate = false)
|
||||
public class OpsInspectionOrderBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主要id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目(电站)id
|
||||
*/
|
||||
@NotNull(message = "项目(电站)id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工单标题
|
||||
*/
|
||||
@NotBlank(message = "工单标题不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 工单类型1维护保养2检查检测3安装调试4升级改造
|
||||
*/
|
||||
@NotBlank(message = "工单类型1维护保养2检查检测3安装调试4升级改造不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 工单优先级1低2中3高
|
||||
*/
|
||||
@NotBlank(message = "工单优先级1低2中3高不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
@NotNull(message = "截止时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 工单描述
|
||||
*/
|
||||
@NotBlank(message = "工单描述不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 执行地点
|
||||
*/
|
||||
@NotBlank(message = "执行地点不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 相关设备/系统
|
||||
*/
|
||||
@NotBlank(message = "相关设备/系统不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String device;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 节点ids
|
||||
*/
|
||||
@NotBlank(message = "节点ids不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 预期成果
|
||||
*/
|
||||
@NotBlank(message = "预期成果不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String results;
|
||||
|
||||
/**
|
||||
* 是否需要执行人,1是2否(取消使用)
|
||||
*/
|
||||
private String executor;
|
||||
|
||||
/**
|
||||
* 执行人ids(取消使用)
|
||||
*/
|
||||
private String executorIds;
|
||||
|
||||
/**
|
||||
* 工单状态1待派单2已派单3执行中4已完成
|
||||
*/
|
||||
@NotBlank(message = "工单状态1待派单2已派单3执行中4已完成不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 派单时间
|
||||
*/
|
||||
private Date sendOrderTime;
|
||||
|
||||
/**
|
||||
* 接单时间
|
||||
*/
|
||||
private Date getOrderTime;
|
||||
|
||||
/**
|
||||
* 接单人
|
||||
*/
|
||||
private Long getOrderPerson;
|
||||
|
||||
/**
|
||||
* 接单人信息
|
||||
*/
|
||||
private RemoteUserVo getOrderPersonVo;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
private Date finishiOrderTime;
|
||||
|
||||
/**
|
||||
* 验收结果1通过2需整改
|
||||
*/
|
||||
private String orderResult;
|
||||
|
||||
/**
|
||||
* 是否重点跟踪1是2否
|
||||
*/
|
||||
private String point;
|
||||
|
||||
|
||||
}
|
||||
@ -38,7 +38,7 @@ public class OpsInspectionPlanBo extends BaseEntity {
|
||||
* 计划名称
|
||||
*/
|
||||
@NotNull(message = "计划名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long planName;
|
||||
private String planName;
|
||||
|
||||
/**
|
||||
* 计划类型,1每日巡检2每周巡检3每月巡检4每季度巡检
|
||||
|
||||
@ -87,13 +87,13 @@ public class OpsInspectionRepairBo extends BaseEntity {
|
||||
/**
|
||||
* 报修人姓名
|
||||
*/
|
||||
@NotBlank(message = "报修人姓名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "报修人姓名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报修人联系电话
|
||||
*/
|
||||
@NotBlank(message = "报修人联系电话不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "报修人联系电话不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String reportPhone;
|
||||
|
||||
/**
|
||||
|
||||
@ -88,13 +88,13 @@ public class OpsInspectionReportBo extends BaseEntity {
|
||||
/**
|
||||
* 报修人姓名
|
||||
*/
|
||||
@NotBlank(message = "姓名不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "姓名不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报修人联系电话
|
||||
*/
|
||||
@NotBlank(message = "电话不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "电话不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String reportPhone;
|
||||
|
||||
private String reportFinal;
|
||||
|
||||
@ -74,12 +74,10 @@ public class OpsInspectionTaskBo extends BaseEntity {
|
||||
@NotNull(message = "执行人ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long personId;
|
||||
|
||||
|
||||
/**
|
||||
* 进度
|
||||
* 节点ids
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal taskProgress;
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 状态 1待执行2已延期3执行中4已完成
|
||||
@ -92,6 +90,11 @@ public class OpsInspectionTaskBo extends BaseEntity {
|
||||
*/
|
||||
private String problemType;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
package org.dromara.inspection.domain.bo;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionTaskProblem;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题业务对象 ops_inspection_task_problem
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = OpsInspectionTaskProblem.class, reverseConvertGenerate = false)
|
||||
public class OpsInspectionTaskProblemBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 巡检任务ID
|
||||
*/
|
||||
@NotNull(message = "巡检任务ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
@NotNull(message = "电站ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 发现问题类型1磁盘使用率2内存使用率3服务状态4响应时间5设备运行状态
|
||||
*/
|
||||
@NotBlank(message = "发现问题类型1磁盘使用率2内存使用率3服务状态4响应时间5设备运行状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 问题详细信息
|
||||
*/
|
||||
@NotBlank(message = "问题详细信息不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 发现日期
|
||||
*/
|
||||
@NotNull(message = "发现日期不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date findTime;
|
||||
|
||||
/**
|
||||
* 是否解决1解决2未解决
|
||||
*/
|
||||
@NotBlank(message = "是否解决1解决2未解决不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String finish;
|
||||
|
||||
/**
|
||||
* 解决日期
|
||||
*/
|
||||
private Date finishTime;
|
||||
|
||||
|
||||
}
|
||||
@ -69,12 +69,23 @@ public class OpsInspectionTestTaskBo extends BaseEntity {
|
||||
@NotNull(message = "执行人员不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long person;
|
||||
|
||||
/**
|
||||
* 节点IDS
|
||||
*/
|
||||
@NotNull(message = "节点不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 状态,1待执行2暂停3失败4执行中5已完成
|
||||
*/
|
||||
@NotBlank(message = "状态,1待执行2暂停3失败4执行中5已完成不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否已分析1未分析2已分析
|
||||
*/
|
||||
private String unPack;
|
||||
|
||||
/**
|
||||
* 关联测试计划ID
|
||||
*/
|
||||
@ -94,7 +105,7 @@ public class OpsInspectionTestTaskBo extends BaseEntity {
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private Long progress;
|
||||
// private Long progress;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package org.dromara.inspection.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点视图对象 ops_inspection_node
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = OpsInspectionNode.class)
|
||||
public class OpsInspectionNodeVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
@ExcelProperty(value = "节点ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所用模块1工单2巡检任务3试验任务
|
||||
*/
|
||||
@ExcelProperty(value = "所用模块1工单2巡检任务3试验任务")
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
@ExcelProperty(value = "工单ID")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 顺序编号
|
||||
*/
|
||||
@ExcelProperty(value = "顺序编号")
|
||||
private Long code;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@ExcelProperty(value = "节点名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 预期目的
|
||||
*/
|
||||
@ExcelProperty(value = "预期目的")
|
||||
private String intendedPurpose;
|
||||
|
||||
/**
|
||||
* 预期完成时间
|
||||
*/
|
||||
@ExcelProperty(value = "预期完成时间")
|
||||
private Date intendedTime;
|
||||
|
||||
/**
|
||||
* 实际完成时间
|
||||
*/
|
||||
@ExcelProperty(value = "实际完成时间")
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态1完成2未完成3失败
|
||||
*/
|
||||
@ExcelProperty(value = "状态1完成2未完成")
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,179 @@
|
||||
package org.dromara.inspection.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionOrder;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单视图对象 ops_inspection_order
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = OpsInspectionOrder.class)
|
||||
public class OpsInspectionOrderVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主要id
|
||||
*/
|
||||
@ExcelProperty(value = "主要id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目(电站)id
|
||||
*/
|
||||
@ExcelProperty(value = "项目(电站)id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 工单标题
|
||||
*/
|
||||
@ExcelProperty(value = "工单标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 工单类型1维护保养2检查检测3安装调试4升级改造
|
||||
*/
|
||||
@ExcelProperty(value = "工单类型1维护保养2检查检测3安装调试4升级改造")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 工单优先级1低2中3高
|
||||
*/
|
||||
@ExcelProperty(value = "工单优先级1低2中3高")
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 截止时间
|
||||
*/
|
||||
@ExcelProperty(value = "截止时间")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 工单描述
|
||||
*/
|
||||
@ExcelProperty(value = "工单描述")
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 执行地点
|
||||
*/
|
||||
@ExcelProperty(value = "执行地点")
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 相关设备/系统
|
||||
*/
|
||||
@ExcelProperty(value = "相关设备/系统")
|
||||
private String device;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
@ExcelProperty(value = "文件ID")
|
||||
private String fileId;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
@ExcelProperty(value = "文件路径")
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 节点ids
|
||||
*/
|
||||
@ExcelProperty(value = "节点ids")
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 工单进度
|
||||
*/
|
||||
private BigDecimal progress;
|
||||
|
||||
/**
|
||||
* 工单节点
|
||||
*/
|
||||
private List<OpsInspectionNodeVo> nodes;
|
||||
|
||||
/**
|
||||
* 预期成果
|
||||
*/
|
||||
@ExcelProperty(value = "预期成果")
|
||||
private String results;
|
||||
|
||||
/**
|
||||
* 是否需要执行人,1是2否(取消使用)
|
||||
*/
|
||||
@ExcelProperty(value = "是否需要执行人,1是2否(取消使用)")
|
||||
private String executor;
|
||||
|
||||
/**
|
||||
* 执行人ids(取消使用)
|
||||
*/
|
||||
@ExcelProperty(value = "执行人ids(取消使用)")
|
||||
private String executorIds;
|
||||
|
||||
/**
|
||||
* 工单状态1待派单2已派单3执行中4已完成
|
||||
*/
|
||||
@ExcelProperty(value = "工单状态1待派单2已派单3执行中4已完成")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 派单时间
|
||||
*/
|
||||
@ExcelProperty(value = "派单时间")
|
||||
private Date sendOrderTime;
|
||||
|
||||
/**
|
||||
* 接单时间
|
||||
*/
|
||||
@ExcelProperty(value = "接单时间")
|
||||
private Date getOrderTime;
|
||||
|
||||
private Long getOrderPerson;
|
||||
|
||||
private RemoteUserVo getOrderPersonVo;
|
||||
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@ExcelProperty(value = "完成时间")
|
||||
private Date finishiOrderTime;
|
||||
|
||||
/**
|
||||
* 验收结果1通过2需整改
|
||||
*/
|
||||
@ExcelProperty(value = "验收结果1通过2需整改")
|
||||
private String orderResult;
|
||||
|
||||
/**
|
||||
* 是否重点跟踪1是2否
|
||||
*/
|
||||
@ExcelProperty(value = "是否重点跟踪1是2否")
|
||||
private String point;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Long createBy;
|
||||
|
||||
private RemoteUserVo sendOrderPersonVo;
|
||||
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class OpsInspectionPlanVo implements Serializable {
|
||||
* 计划名称
|
||||
*/
|
||||
@ExcelProperty(value = "计划名称")
|
||||
private Long planName;
|
||||
private String planName;
|
||||
|
||||
/**
|
||||
* 计划类型,1每日巡检2每周巡检3每月巡检4每季度巡检
|
||||
@ -111,6 +111,8 @@ public class OpsInspectionPlanVo implements Serializable {
|
||||
@ExcelProperty(value = "巡检项ID")
|
||||
private String inspectionItemId;
|
||||
|
||||
private List<OpsInspectionItemVo> itemVoList;
|
||||
|
||||
/**
|
||||
* 1启用2停用
|
||||
*/
|
||||
|
||||
@ -22,7 +22,7 @@ public class OpsInspectionRecordVo {
|
||||
private Long finishInspectionCount;
|
||||
|
||||
/**
|
||||
* 问题梳数量
|
||||
* 问题数量
|
||||
*/
|
||||
private Long problemCount;
|
||||
|
||||
@ -36,10 +36,20 @@ public class OpsInspectionRecordVo {
|
||||
*/
|
||||
private Long averageCompletionTime;
|
||||
|
||||
/**
|
||||
* 巡检完成率
|
||||
*/
|
||||
private String xjwcl;
|
||||
|
||||
/**
|
||||
* 已解决率
|
||||
*/
|
||||
// private String yjjl;
|
||||
|
||||
/**
|
||||
* 解决效率
|
||||
*/
|
||||
private BigDecimal solveEfficiency;
|
||||
private BigDecimal jjxl;
|
||||
|
||||
/**
|
||||
* 磁盘使用率类型问题数量
|
||||
|
||||
@ -8,6 +8,7 @@ import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -69,7 +70,7 @@ public class OpsInspectionRepairVo implements Serializable {
|
||||
@ExcelProperty(value = "指派维修人")
|
||||
private Long sendPerson;
|
||||
|
||||
private OpsUserVo sendPersonVo;
|
||||
private RemoteUserVo sendPersonVo;
|
||||
|
||||
/**
|
||||
* 详细信息
|
||||
@ -138,4 +139,5 @@ public class OpsInspectionRepairVo implements Serializable {
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Long createBy;
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -70,7 +71,7 @@ public class OpsInspectionReportVo implements Serializable {
|
||||
/**
|
||||
* 指派维修人
|
||||
*/
|
||||
private OpsUserVo sendPersonVo;
|
||||
private RemoteUserVo sendPersonVo;
|
||||
|
||||
/**
|
||||
* 详细信息
|
||||
@ -116,4 +117,6 @@ public class OpsInspectionReportVo implements Serializable {
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Long createBy;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package org.dromara.inspection.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.inspection.domain.OpsInspectionTaskProblem;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题视图对象 ops_inspection_task_problem
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = OpsInspectionTaskProblem.class)
|
||||
public class OpsInspectionTaskProblemVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 巡检任务ID
|
||||
*/
|
||||
@ExcelProperty(value = "巡检任务ID")
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 发现问题类型1磁盘使用率2内存使用率3服务状态4响应时间5设备运行状态
|
||||
*/
|
||||
@ExcelProperty(value = "发现问题类型1磁盘使用率2内存使用率3服务状态4响应时间5设备运行状态")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 问题详细信息
|
||||
*/
|
||||
@ExcelProperty(value = "问题详细信息")
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 发现日期
|
||||
*/
|
||||
@ExcelProperty(value = "发现日期")
|
||||
private Date findTime;
|
||||
|
||||
/**
|
||||
* 是否解决1解决2未解决
|
||||
*/
|
||||
@ExcelProperty(value = "是否解决1解决2未解决")
|
||||
private String finish;
|
||||
|
||||
/**
|
||||
* 解决日期
|
||||
*/
|
||||
@ExcelProperty(value = "解决日期")
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@ -13,11 +13,12 @@ import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -86,13 +87,25 @@ public class OpsInspectionTaskVo implements Serializable {
|
||||
@ExcelProperty(value = "执行人ID")
|
||||
private Long personId;
|
||||
|
||||
private OpsUserVo person;
|
||||
private RemoteUserVo person;
|
||||
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
private BigDecimal taskProgress;
|
||||
|
||||
/**
|
||||
* 节点ids
|
||||
*/
|
||||
private String nodeIds;
|
||||
|
||||
private List<OpsInspectionNodeVo> nodes;
|
||||
|
||||
/**
|
||||
* 问题列表
|
||||
*/
|
||||
private List<OpsInspectionTaskProblemVo> problems;
|
||||
|
||||
/**
|
||||
* 状态 1待执行2已延期3执行中4已完成
|
||||
*/
|
||||
@ -103,6 +116,11 @@ public class OpsInspectionTaskVo implements Serializable {
|
||||
*/
|
||||
private String problemType;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
private Date finishTime;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@ -12,6 +12,7 @@ import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -93,7 +94,7 @@ public class OpsInspectionTestPlanVo implements Serializable {
|
||||
@ExcelProperty(value = "负责人ID")
|
||||
private Long personCharge;
|
||||
|
||||
private OpsUserVo person;
|
||||
private RemoteUserVo person;
|
||||
|
||||
/**
|
||||
* 参与人员IDS
|
||||
@ -101,7 +102,7 @@ public class OpsInspectionTestPlanVo implements Serializable {
|
||||
@ExcelProperty(value = "参与人员IDS")
|
||||
private String personIds;
|
||||
|
||||
private List<OpsUserVo> persons;
|
||||
private List<RemoteUserVo> persons;
|
||||
|
||||
/**
|
||||
* 自定义检查项
|
||||
|
||||
@ -10,36 +10,36 @@ public class OpsInspectionTestTaskRecord {
|
||||
/**
|
||||
* 本月完成数
|
||||
*/
|
||||
private Long finishCount;
|
||||
private String finishCount;
|
||||
|
||||
/**
|
||||
* 上月增加数
|
||||
*/
|
||||
private BigDecimal finishCountAdd;
|
||||
private String finishCountAdd;
|
||||
|
||||
/**
|
||||
* 本月通过率
|
||||
*/
|
||||
private BigDecimal passValue;
|
||||
private String passValue;
|
||||
|
||||
/**
|
||||
* 通过增长率
|
||||
*/
|
||||
private BigDecimal passValueAdd;
|
||||
private String passValueAdd;
|
||||
|
||||
/**
|
||||
* 待分析数
|
||||
*/
|
||||
private Long failCount;
|
||||
private String failCount;
|
||||
|
||||
/**
|
||||
* 平均测试时间
|
||||
*/
|
||||
private Long averageTestTime;
|
||||
private String averageTestTime;
|
||||
|
||||
/**
|
||||
* 平均测试时间数增长率
|
||||
*/
|
||||
private BigDecimal averageTestTimeAdd;
|
||||
private String averageTestTimeAdd;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.inspection.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.inspection.domain.OpsInspectionTestTask;
|
||||
@ -10,11 +11,12 @@ import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -79,7 +81,17 @@ public class OpsInspectionTestTaskVo implements Serializable {
|
||||
@ExcelProperty(value = "执行人员")
|
||||
private Long person;
|
||||
|
||||
private OpsUserVo personInfo;
|
||||
private RemoteUserVo personInfo;
|
||||
|
||||
/**
|
||||
* 节点IDS
|
||||
*/
|
||||
private String nodeIds;
|
||||
|
||||
/**
|
||||
* 节点列表
|
||||
*/
|
||||
private List<OpsInspectionNodeVo> nodes;
|
||||
|
||||
/**
|
||||
* 状态,1待执行2暂停3失败4执行中5已完成
|
||||
@ -87,6 +99,11 @@ public class OpsInspectionTestTaskVo implements Serializable {
|
||||
@ExcelProperty(value = "状态,1待执行2暂停3失败4执行中5已完成")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否已分析1未分析2已分析
|
||||
*/
|
||||
private String unPack;
|
||||
|
||||
/**
|
||||
* 关联测试计划ID
|
||||
*/
|
||||
@ -111,7 +128,7 @@ public class OpsInspectionTestTaskVo implements Serializable {
|
||||
* 进度
|
||||
*/
|
||||
@ExcelProperty(value = "进度")
|
||||
private Long progress;
|
||||
private BigDecimal progress;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
@ -178,4 +195,9 @@ public class OpsInspectionTestTaskVo implements Serializable {
|
||||
*/
|
||||
private Date planFinishTime;
|
||||
|
||||
/**
|
||||
* 创建 时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package org.dromara.inspection.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderRecordVo {
|
||||
|
||||
/**
|
||||
* 本月派单数
|
||||
*/
|
||||
private String bypds;
|
||||
|
||||
/**
|
||||
* 拍单数增长率
|
||||
*/
|
||||
private String pdzzl;
|
||||
|
||||
/**
|
||||
* 平均响应时间
|
||||
*/
|
||||
private String pjxysj;
|
||||
|
||||
/**
|
||||
* 响应时间增长率
|
||||
*/
|
||||
private String xysjzzl;
|
||||
|
||||
/**
|
||||
* 待接收工单
|
||||
*/
|
||||
private String djsgd;
|
||||
|
||||
/**
|
||||
* 按时完成率
|
||||
*/
|
||||
private String aswcl;
|
||||
|
||||
/**
|
||||
* 完成增长率
|
||||
*/
|
||||
private String wczzl;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.inspection.mapper;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
public interface OpsInspectionNodeMapper extends BaseMapperPlus<OpsInspectionNode, OpsInspectionNodeVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.inspection.mapper;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionOrder;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionOrderVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
public interface OpsInspectionOrderMapper extends BaseMapperPlus<OpsInspectionOrder, OpsInspectionOrderVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.inspection.mapper;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionTaskProblem;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTaskProblemVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
public interface OpsInspectionTaskProblemMapper extends BaseMapperPlus<OpsInspectionTaskProblem, OpsInspectionTaskProblemVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.inspection.service;
|
||||
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionNodeBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
public interface IOpsInspectionNodeService {
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-通用节点
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 运维-巡检-通用节点
|
||||
*/
|
||||
OpsInspectionNodeVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询运维-巡检-通用节点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维-巡检-通用节点分页列表
|
||||
*/
|
||||
TableDataInfo<OpsInspectionNodeVo> queryPageList(OpsInspectionNodeBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维-巡检-通用节点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维-巡检-通用节点列表
|
||||
*/
|
||||
List<OpsInspectionNodeVo> queryList(OpsInspectionNodeBo bo);
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-通用节点
|
||||
*
|
||||
* @param bo 运维-巡检-通用节点
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
R<String> insertByBo(List<OpsInspectionNodeBo> bo);
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-通用节点
|
||||
*
|
||||
* @param bo 运维-巡检-通用节点
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(List<OpsInspectionNodeBo> bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-通用节点信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package org.dromara.inspection.service;
|
||||
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionOrderVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionOrderBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
public interface IOpsInspectionOrderService {
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-工单
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 运维-巡检-工单
|
||||
*/
|
||||
OpsInspectionOrderVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询运维-巡检-工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维-巡检-工单分页列表
|
||||
*/
|
||||
TableDataInfo<OpsInspectionOrderVo> queryPageList(OpsInspectionOrderBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维-巡检-工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维-巡检-工单列表
|
||||
*/
|
||||
List<OpsInspectionOrderVo> queryList(OpsInspectionOrderBo bo);
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-工单
|
||||
*
|
||||
* @param bo 运维-巡检-工单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(OpsInspectionOrderBo bo);
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-工单
|
||||
*
|
||||
* @param bo 运维-巡检-工单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(OpsInspectionOrderBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-工单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.inspection.service;
|
||||
|
||||
import org.dromara.inspection.domain.OpsInspectionTaskProblem;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTaskProblemVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTaskProblemBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
public interface IOpsInspectionTaskProblemService {
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-任务-问题
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 运维-巡检-任务-问题
|
||||
*/
|
||||
OpsInspectionTaskProblemVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询运维-巡检-任务-问题列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维-巡检-任务-问题分页列表
|
||||
*/
|
||||
TableDataInfo<OpsInspectionTaskProblemVo> queryPageList(OpsInspectionTaskProblemBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维-巡检-任务-问题列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维-巡检-任务-问题列表
|
||||
*/
|
||||
List<OpsInspectionTaskProblemVo> queryList(OpsInspectionTaskProblemBo bo);
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-任务-问题
|
||||
*
|
||||
* @param bo 运维-巡检-任务-问题
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(OpsInspectionTaskProblemBo bo);
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-任务-问题
|
||||
*
|
||||
* @param bo 运维-巡检-任务-问题
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(OpsInspectionTaskProblemBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-任务-问题信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.inspection.service;
|
||||
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.inspection.domain.OpsInspectionTask;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTaskVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTaskBo;
|
||||
@ -56,7 +57,7 @@ public interface IOpsInspectionTaskService {
|
||||
* @param bo 运维-巡检计划-任务
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(OpsInspectionTaskBo bo);
|
||||
R<Void> updateByBo(OpsInspectionTaskBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检计划-任务信息
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.inspection.service;
|
||||
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.inspection.domain.OpsInspectionTestTask;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTestTaskVo;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTestTaskBo;
|
||||
@ -56,7 +57,7 @@ public interface IOpsInspectionTestTaskService {
|
||||
* @param bo 运维-巡检-试验任务
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(OpsInspectionTestTaskBo bo);
|
||||
R<Void> updateByBo(OpsInspectionTestTaskBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-试验任务信息
|
||||
|
||||
@ -0,0 +1,154 @@
|
||||
package org.dromara.inspection.service.impl;
|
||||
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionNodeBo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionNodeVo;
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
||||
import org.dromara.inspection.service.IOpsInspectionNodeService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 运维-巡检-通用节点Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsInspectionNodeServiceImpl implements IOpsInspectionNodeService {
|
||||
|
||||
private final OpsInspectionNodeMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-通用节点
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 运维-巡检-通用节点
|
||||
*/
|
||||
@Override
|
||||
public OpsInspectionNodeVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询运维-巡检-通用节点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维-巡检-通用节点分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OpsInspectionNodeVo> queryPageList(OpsInspectionNodeBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OpsInspectionNode> lqw = buildQueryWrapper(bo);
|
||||
Page<OpsInspectionNodeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维-巡检-通用节点列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维-巡检-通用节点列表
|
||||
*/
|
||||
@Override
|
||||
public List<OpsInspectionNodeVo> queryList(OpsInspectionNodeBo bo) {
|
||||
LambdaQueryWrapper<OpsInspectionNode> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OpsInspectionNode> buildQueryWrapper(OpsInspectionNodeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OpsInspectionNode> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(OpsInspectionNode::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getModule()), OpsInspectionNode::getModule, bo.getModule());
|
||||
lqw.eq(bo.getOrderId() != null, OpsInspectionNode::getOrderId, bo.getOrderId());
|
||||
lqw.eq(bo.getCode() != null, OpsInspectionNode::getCode, bo.getCode());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), OpsInspectionNode::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-通用节点
|
||||
*
|
||||
* @param bo 运维-巡检-通用节点
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public R<String> insertByBo(List<OpsInspectionNodeBo> bo) {
|
||||
List<String> ids = new ArrayList<>();
|
||||
if (bo != null) {
|
||||
for (OpsInspectionNodeBo nodeBo : bo) {
|
||||
OpsInspectionNode add = MapstructUtils.convert(nodeBo, OpsInspectionNode.class);
|
||||
validEntityBeforeSave(add);
|
||||
int insert = baseMapper.insert(add);
|
||||
if (insert > 0){
|
||||
if (add != null) {
|
||||
ids.add(add.getId().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
// log.info("{}", StringUtils.join(ids, ","));
|
||||
return R.ok(StringUtils.join(ids, ","));
|
||||
}else{
|
||||
return R.fail();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-通用节点
|
||||
*
|
||||
* @param bo 运维-巡检-通用节点
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(List<OpsInspectionNodeBo> bo) {
|
||||
List<OpsInspectionNode> nodes = new ArrayList<>();
|
||||
for (OpsInspectionNodeBo nodeBo : bo) {
|
||||
OpsInspectionNode update = MapstructUtils.convert(nodeBo, OpsInspectionNode.class);
|
||||
validEntityBeforeSave(update);
|
||||
nodes.add(update);
|
||||
}
|
||||
return baseMapper.updateBatchById(nodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OpsInspectionNode entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-通用节点信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,410 @@
|
||||
package org.dromara.inspection.service.impl;
|
||||
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionRepairBo;
|
||||
import org.dromara.inspection.domain.vo.*;
|
||||
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.mapper.OpsUserMapper;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionOrderBo;
|
||||
import org.dromara.inspection.domain.OpsInspectionOrder;
|
||||
import org.dromara.inspection.mapper.OpsInspectionOrderMapper;
|
||||
import org.dromara.inspection.service.IOpsInspectionOrderService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 运维-巡检-工单Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsInspectionOrderServiceImpl implements IOpsInspectionOrderService {
|
||||
|
||||
|
||||
private final OpsInspectionOrderMapper baseMapper;
|
||||
|
||||
private final OpsInspectionNodeMapper nodeMapper;
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
@DubboReference
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-工单
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 运维-巡检-工单
|
||||
*/
|
||||
@Override
|
||||
public OpsInspectionOrderVo queryById(Long id){
|
||||
OpsInspectionOrderVo opsInspectionOrderVo = baseMapper.selectVoById(id);
|
||||
List<OpsInspectionOrderVo> opsInspectionOrderVo1 = List.of(opsInspectionOrderVo);
|
||||
setValue(opsInspectionOrderVo1);
|
||||
return opsInspectionOrderVo1.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询运维-巡检-工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维-巡检-工单分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OpsInspectionOrderVo> queryPageList(OpsInspectionOrderBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OpsInspectionOrder> lqw = buildQueryWrapper(bo);
|
||||
Page<OpsInspectionOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
setValue(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维-巡检-工单列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维-巡检-工单列表
|
||||
*/
|
||||
@Override
|
||||
public List<OpsInspectionOrderVo> queryList(OpsInspectionOrderBo bo) {
|
||||
LambdaQueryWrapper<OpsInspectionOrder> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OpsInspectionOrder> buildQueryWrapper(OpsInspectionOrderBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OpsInspectionOrder> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(OpsInspectionOrder::getId);
|
||||
lqw.eq(bo.getProjectId() != null, OpsInspectionOrder::getProjectId, bo.getProjectId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getType()), OpsInspectionOrder::getType, bo.getType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLevel()), OpsInspectionOrder::getLevel, bo.getLevel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPoint()), OpsInspectionOrder::getPoint, bo.getPoint());
|
||||
lqw.eq(bo.getCreateTime() != null, OpsInspectionOrder::getCreateTime, bo.getCreateTime());
|
||||
lqw.eq(bo.getStatus() != null, OpsInspectionOrder::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-工单
|
||||
*
|
||||
* @param bo 运维-巡检-工单
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OpsInspectionOrderBo bo) {
|
||||
OpsInspectionOrder add = MapstructUtils.convert(bo, OpsInspectionOrder.class);
|
||||
validEntityBeforeSave(add);
|
||||
|
||||
if (add.getFileId() != null){
|
||||
String[] split = add.getFileId().split(",");
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (String s : split) {
|
||||
String ossUrl = remoteFileService.selectUrlByIds(s);
|
||||
if (ossUrl != null){
|
||||
urls.add(ossUrl);
|
||||
}
|
||||
}
|
||||
String join = String.join(",", urls);
|
||||
add.setFileUrl(join);
|
||||
bo.setFileUrl(join);
|
||||
}
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-工单
|
||||
*
|
||||
* @param bo 运维-巡检-工单
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OpsInspectionOrderBo bo) {
|
||||
OpsInspectionOrder update = MapstructUtils.convert(bo, OpsInspectionOrder.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OpsInspectionOrder entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-工单信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
|
||||
List<String> urls = new ArrayList<>();
|
||||
List<Long> nodeIds = new ArrayList<>();
|
||||
|
||||
for (Long id : ids) {
|
||||
OpsInspectionOrderVo vo = queryById(id);
|
||||
if (vo != null){
|
||||
if (vo.getFileUrl()!=null) {
|
||||
urls.add(vo.getFileUrl());
|
||||
}
|
||||
for (String nodeId : List.of(vo.getNodeIds().split(","))) {
|
||||
nodeIds.add(Long.valueOf(nodeId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!urls.isEmpty()) {
|
||||
for (String url : urls) {
|
||||
List<String> list = Arrays.asList(url.split(","));
|
||||
remoteFileService.deleteFile(list);
|
||||
}
|
||||
}
|
||||
|
||||
//同时删除节点
|
||||
if (!nodeIds.isEmpty()) {
|
||||
nodeMapper.deleteByIds(nodeIds);
|
||||
}
|
||||
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理回显数据
|
||||
*/
|
||||
private void setValue(List<OpsInspectionOrderVo> list){
|
||||
|
||||
LambdaQueryWrapper<OpsInspectionNode> nodeWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
for (OpsInspectionOrderVo vo : list) {
|
||||
|
||||
List<String> split = Arrays.stream(vo.getNodeIds().split(",")).toList();
|
||||
|
||||
nodeWrapper.clear();
|
||||
nodeWrapper.in(OpsInspectionNode::getId, split);
|
||||
|
||||
List<OpsInspectionNodeVo> nodeVoList = nodeMapper.selectVoList(nodeWrapper);
|
||||
|
||||
//处理进度百分比 完成节点 / 总节点 * 100
|
||||
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
||||
//统计完成节点
|
||||
int finishCount = nodeVoList.stream().filter(nodeVo -> nodeVo.getStatus().equals("1")).toList().size();
|
||||
if (finishCount == nodeVoList.size()){
|
||||
vo.setProgress(new BigDecimal("100"));
|
||||
}else {
|
||||
vo.setProgress(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(nodeVoList.size()), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100.00)));
|
||||
}
|
||||
}
|
||||
|
||||
//处理派单人
|
||||
List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(List.of(vo.getCreateBy()));
|
||||
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||
vo.setSendOrderPersonVo(remoteUserVos.getFirst());
|
||||
}
|
||||
|
||||
//处理接单人
|
||||
if (vo.getGetOrderPerson() != null){
|
||||
remoteUserVos = remoteUserService.selectListByIds(Collections.singletonList(vo.getGetOrderPerson()));
|
||||
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||
vo.setGetOrderPersonVo(remoteUserVos.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
//处理节点列表
|
||||
if (vo.getNodeIds() != null && !vo.getNodeIds().isEmpty()){
|
||||
String[] ids = vo.getNodeIds().split(",");
|
||||
List<OpsInspectionNodeVo> nodeVos = new ArrayList<>();
|
||||
for (String id : ids) {
|
||||
OpsInspectionNodeVo nodeVo = nodeMapper.selectVoById(id);
|
||||
if (nodeVo != null) {
|
||||
nodeVos.add(nodeVo);
|
||||
}
|
||||
}
|
||||
vo.setNodes(nodeVos);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取纪录
|
||||
*/
|
||||
public R<OrderRecordVo> record(Long projectId){
|
||||
//变量初始化
|
||||
OrderRecordVo recordVo = new OrderRecordVo();
|
||||
|
||||
OpsInspectionOrderBo bo = new OpsInspectionOrderBo();
|
||||
bo.setProjectId(projectId);
|
||||
//日期初始化
|
||||
Date startDate = Date.from(LocalDate.now().withDayOfMonth(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date endDate = Date.from(LocalDate.now().withDayOfMonth(1).plusMonths(1).minusDays(1).atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
|
||||
//查询当前项目的数据
|
||||
List<OpsInspectionOrderVo> vos = queryList(bo);
|
||||
//过滤本月数据
|
||||
List<OpsInspectionOrderVo> thisMonth = vos.stream()
|
||||
.filter(vo -> vo.getCreateTime().after(startDate))
|
||||
.filter(vo -> vo.getCreateTime().before(endDate))
|
||||
.toList();
|
||||
//本月派单总数
|
||||
BigDecimal bypdzs = BigDecimal.valueOf(thisMonth.size());
|
||||
//统计平均响应时间
|
||||
Long zgxysj = 0L;//总共响应时间
|
||||
Long jds = 0L;//本月接单数 有接单才有响应时间
|
||||
for (OpsInspectionOrderVo orderVo : thisMonth) {
|
||||
if (orderVo.getGetOrderTime() != null) {
|
||||
jds++;
|
||||
zgxysj += orderVo.getGetOrderTime().getTime() - orderVo.getCreateTime().getTime();
|
||||
}
|
||||
}
|
||||
//平均响应时间
|
||||
BigDecimal avg;
|
||||
if ((BigDecimal.valueOf(jds).compareTo(BigDecimal.ZERO) > 0)) {
|
||||
avg = BigDecimal.valueOf(TimeUnit.MILLISECONDS.toMinutes(zgxysj)).divide(BigDecimal.valueOf(jds), 2, RoundingMode.HALF_UP);
|
||||
}else{
|
||||
avg = BigDecimal.ZERO;
|
||||
}
|
||||
//统计待接收工单
|
||||
int waiting = thisMonth.stream().filter(vo -> vo.getStatus().equals("2")).toList().size();
|
||||
//待接单数
|
||||
BigDecimal djds = BigDecimal.valueOf(waiting);
|
||||
//按时完成率 找到完成的工单 获取工单完成时间
|
||||
|
||||
//获取所有完成数
|
||||
int sywcs = thisMonth.stream()
|
||||
.filter(vo -> vo.getStatus().equals("4"))
|
||||
.toList().size();
|
||||
|
||||
//获取按时完成数
|
||||
int aswcs = thisMonth.stream()
|
||||
.filter(vo -> vo.getStatus().equals("4"))
|
||||
.filter(vo -> vo.getFinishiOrderTime().before(endDate))
|
||||
.toList().size();
|
||||
//按时完成率
|
||||
BigDecimal aswcl;
|
||||
if (sywcs > 0) {
|
||||
aswcl = BigDecimal.valueOf(aswcs).divide(BigDecimal.valueOf(sywcs), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||
}else {
|
||||
aswcl = BigDecimal.valueOf(0);
|
||||
}
|
||||
|
||||
recordVo.setBypds(String.valueOf(bypdzs));
|
||||
recordVo.setPjxysj(String.valueOf(avg));
|
||||
recordVo.setDjsgd(String.valueOf(djds));
|
||||
recordVo.setAswcl(String.valueOf(aswcl));
|
||||
|
||||
//获取上月数据列表
|
||||
Date finalStartDate = Date.from(LocalDate.now().minusMonths(1).withDayOfMonth(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date finalEndDate = Date.from(LocalDate.now().minusMonths(1).withDayOfMonth(1).plusMonths(1).minusDays(1).atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
thisMonth = vos.stream()
|
||||
.filter(vo -> vo.getCreateTime().after(finalStartDate))
|
||||
.filter(vo -> vo.getCreateTime().before(finalEndDate))
|
||||
.toList();
|
||||
|
||||
//上月派单总数
|
||||
BigDecimal sypdzs = BigDecimal.valueOf(thisMonth.size());
|
||||
|
||||
//统计上月平均响应时间
|
||||
zgxysj = 0L;//总共响应时间
|
||||
jds = 0L;//本月接单数 有接单才有响应时间
|
||||
for (OpsInspectionOrderVo orderVo : thisMonth) {
|
||||
if (orderVo.getGetOrderTime() != null) {
|
||||
jds++;
|
||||
zgxysj += orderVo.getGetOrderTime().getTime() - orderVo.getCreateTime().getTime();
|
||||
}
|
||||
}
|
||||
//上月平均响应时间
|
||||
BigDecimal syavg;
|
||||
if ((BigDecimal.valueOf(jds).compareTo(BigDecimal.ZERO) > 0)) {
|
||||
syavg = BigDecimal.valueOf(TimeUnit.MILLISECONDS.toMinutes(zgxysj)).divide(BigDecimal.valueOf(jds), 2, RoundingMode.HALF_UP);
|
||||
}else {
|
||||
syavg = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
//获取上月所有完成数
|
||||
int sysywcs = thisMonth.stream()
|
||||
.filter(vo -> vo.getStatus().equals("4"))
|
||||
.toList().size();
|
||||
|
||||
//获取上月按时完成数
|
||||
int syaswcs = thisMonth.stream()
|
||||
.filter(vo -> vo.getStatus().equals("4"))
|
||||
.filter(vo -> vo.getFinishiOrderTime().before(finalEndDate))
|
||||
.toList().size();
|
||||
//上月按时完成率
|
||||
BigDecimal syaswcl;
|
||||
if (sywcs > 0) {
|
||||
syaswcl = BigDecimal.valueOf(syaswcs).divide(BigDecimal.valueOf(sysywcs), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||
}else {
|
||||
syaswcl = BigDecimal.valueOf(0);
|
||||
}
|
||||
|
||||
//本月完成 / 上月完成 * 100 = 增长率
|
||||
BigDecimal wczzl;
|
||||
if (syaswcl.compareTo(BigDecimal.ZERO) > 0) {
|
||||
wczzl = BigDecimal.valueOf(Double.parseDouble(recordVo.getAswcl())).divide(syaswcl, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}else {
|
||||
wczzl = BigDecimal.valueOf(0);
|
||||
}
|
||||
|
||||
//上月完成率增长率
|
||||
recordVo.setWczzl(wczzl.toString());
|
||||
|
||||
//派单增长率
|
||||
BigDecimal pdzzl;
|
||||
if (sypdzs.compareTo(BigDecimal.ZERO) > 0) {
|
||||
pdzzl = BigDecimal.valueOf(Double.parseDouble(recordVo.getBypds())).divide(sypdzs, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}else {
|
||||
pdzzl = BigDecimal.valueOf(0);
|
||||
}
|
||||
recordVo.setPdzzl(pdzzl.toString());
|
||||
|
||||
//响应时间增长率
|
||||
BigDecimal xysjzzl;
|
||||
if (BigDecimal.valueOf(Double.parseDouble(recordVo.getPjxysj())).compareTo(BigDecimal.ZERO) > 0){
|
||||
xysjzzl = syavg.divide(BigDecimal.valueOf(Double.parseDouble(recordVo.getPjxysj())), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}else {
|
||||
xysjzzl = BigDecimal.ZERO;
|
||||
}
|
||||
recordVo.setXysjzzl(xysjzzl.toString());
|
||||
|
||||
return R.ok(recordVo);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,10 +10,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionItemVo;
|
||||
import org.dromara.inspection.mapper.OpsInspectionItemMapper;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryCustomizer;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionPlanBo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionPlanVo;
|
||||
@ -21,6 +25,7 @@ import org.dromara.inspection.domain.OpsInspectionPlan;
|
||||
import org.dromara.inspection.mapper.OpsInspectionPlanMapper;
|
||||
import org.dromara.inspection.service.IOpsInspectionPlanService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
@ -38,10 +43,9 @@ public class OpsInspectionPlanServiceImpl implements IOpsInspectionPlanService {
|
||||
|
||||
@DubboReference
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
private OpsUserServiceImpl opsUserService;
|
||||
|
||||
private final OpsInspectionPlanMapper baseMapper;
|
||||
private final OpsInspectionItemMapper itemMapper;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-计划
|
||||
@ -155,12 +159,26 @@ public class OpsInspectionPlanServiceImpl implements IOpsInspectionPlanService {
|
||||
*/
|
||||
private void setValue(List<OpsInspectionPlanVo> list){
|
||||
list.forEach(record -> {
|
||||
OpsUser byId = opsUserService.getById(record.getPerson());
|
||||
if (byId != null){
|
||||
record.setNickName(byId.getUserName());
|
||||
List<RemoteUserVo> remoteUserVos = remoteUserService.selectListByIds(List.of(record.getPerson()));
|
||||
|
||||
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||
record.setNickName(remoteUserVos.getFirst().getUserName());
|
||||
}else{
|
||||
record.setNickName("未知用户");
|
||||
}
|
||||
|
||||
if (record.getInspectionItemId()!=null){
|
||||
String[] itemIds = record.getInspectionItemId().split(",");
|
||||
List<OpsInspectionItemVo> itemVos = new ArrayList<>();
|
||||
for (String itemId : itemIds) {
|
||||
OpsInspectionItemVo itemVo = itemMapper.selectVoById(itemId);
|
||||
if (itemVo != null){
|
||||
itemVos.add(itemVo);
|
||||
}
|
||||
}
|
||||
record.setItemVoList(itemVos);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package org.dromara.inspection.service.impl;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.apache.seata.spring.annotation.GlobalTransactional;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -19,6 +20,8 @@ import org.dromara.inspection.service.IOpsInspectionRepairService;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionRepairBo;
|
||||
@ -48,8 +51,8 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
@Autowired
|
||||
private OpsUserServiceImpl opsUserService;
|
||||
@DubboReference
|
||||
private RemoteUserService userService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-抢修
|
||||
@ -113,8 +116,11 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
|
||||
public Boolean insertByBo(OpsInspectionRepairBo bo) {
|
||||
OpsInspectionRepair add = MapstructUtils.convert(bo, OpsInspectionRepair.class);
|
||||
validEntityBeforeSave(add);
|
||||
if (add == null){
|
||||
throw new ServiceException("新增数据不能为空!!");
|
||||
}
|
||||
|
||||
if (add.getFileId() != null){
|
||||
if (add.getFileId() != null || !add.getFileId().isEmpty()){
|
||||
String[] split = add.getFileId().split(",");
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (String s : split) {
|
||||
@ -203,13 +209,13 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
|
||||
continue;
|
||||
}
|
||||
|
||||
OpsUserVo opsUserVo = opsUserService.queryById(vo.getSendPerson());
|
||||
if (opsUserVo == null){
|
||||
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getSendPerson()));
|
||||
|
||||
if (remoteUserVos == null || remoteUserVos.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
vo.setSendPersonVo(opsUserVo);
|
||||
|
||||
vo.setSendPersonVo(remoteUserVos.getFirst());
|
||||
|
||||
//处理分钟数
|
||||
if (vo.getStatus().equals("3")){
|
||||
@ -217,6 +223,16 @@ public class OpsInspectionRepairServiceImpl implements IOpsInspectionRepairServi
|
||||
vo.setMinute(String.valueOf(TimeUnit.MILLISECONDS.toMinutes( time)));
|
||||
}
|
||||
|
||||
remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getCreateBy()));
|
||||
if (remoteUserVos != null&&!remoteUserVos.isEmpty()){
|
||||
if (remoteUserVos.getFirst().getUserName()!=null) {
|
||||
vo.setName(remoteUserVos.getFirst().getUserName());
|
||||
}
|
||||
if (remoteUserVos.getFirst().getPhonenumber()!=null){
|
||||
vo.setReportPhone(remoteUserVos.getFirst().getPhonenumber());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ import org.dromara.inspection.domain.vo.OpsInspectionReportRecordVo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||
import org.dromara.resource.api.RemoteFileService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionReportBo;
|
||||
@ -48,8 +50,8 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
|
||||
|
||||
@DubboReference
|
||||
private RemoteFileService remoteFileService;
|
||||
@Autowired
|
||||
private OpsUserServiceImpl opsUserService;
|
||||
@DubboReference
|
||||
private RemoteUserService userService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-报修
|
||||
@ -127,7 +129,7 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
|
||||
return false;
|
||||
}
|
||||
|
||||
if (add.getFileId() != null){
|
||||
if (add.getFileId() != null || !add.getFileId().isEmpty()){
|
||||
String[] split = add.getFileId().split(",");
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (String s : split) {
|
||||
@ -216,13 +218,22 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
|
||||
continue;
|
||||
}
|
||||
|
||||
OpsUserVo opsUserVo = opsUserService.queryById(vo.getSendPerson());
|
||||
if (opsUserVo == null){
|
||||
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getSendPerson()));
|
||||
if (remoteUserVos == null || remoteUserVos.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
|
||||
vo.setSendPersonVo(opsUserVo);
|
||||
vo.setSendPersonVo(remoteUserVos.getFirst());
|
||||
|
||||
remoteUserVos = userService.selectListByIds(Collections.singletonList(vo.getCreateBy()));
|
||||
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||
if (remoteUserVos.getFirst().getUserName()!=null) {
|
||||
vo.setName(remoteUserVos.getFirst().getUserName());
|
||||
}
|
||||
if (remoteUserVos.getFirst().getPhonenumber()!=null){
|
||||
vo.setReportPhone(remoteUserVos.getFirst().getPhonenumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,9 +266,13 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
|
||||
}
|
||||
}
|
||||
time = TimeUnit.MILLISECONDS.toMinutes(time);
|
||||
BigDecimal divide1 = BigDecimal.valueOf(time).divide(BigDecimal.valueOf(thisMonth.size()), 0, RoundingMode.HALF_UP);
|
||||
long hours = TimeUnit.MINUTES.toHours(Long.parseLong(divide1.toString()));
|
||||
|
||||
long hours;
|
||||
if (thisMonth.size() != 0) {
|
||||
BigDecimal divide1 = BigDecimal.valueOf(time).divide(BigDecimal.valueOf(thisMonth.size()), 0, RoundingMode.HALF_UP);
|
||||
hours = TimeUnit.MINUTES.toHours(Long.parseLong(divide1.toString()));
|
||||
}else {
|
||||
hours = 0;
|
||||
}
|
||||
//平均处理时长
|
||||
recordVo.setPjclsc(Long.toString(hours));
|
||||
|
||||
@ -268,8 +283,14 @@ public class OpsInspectionReportServiceImpl implements IOpsInspectionReportServi
|
||||
//完成率
|
||||
//完成数
|
||||
int finishCount = thisMonth.stream().filter(vo -> vo.getStatus().equals("3")).toList().size();
|
||||
BigDecimal divide = BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(thisMonth.size()), 2, RoundingMode.HALF_UP);
|
||||
recordVo.setWcl(divide.multiply(new BigDecimal("100")).toString());
|
||||
BigDecimal divide = BigDecimal.ZERO;
|
||||
if (thisMonth.size() == 0){
|
||||
divide = BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(thisMonth.size()), 2, RoundingMode.HALF_UP);
|
||||
recordVo.setWcl(divide.multiply(new BigDecimal("100")).toString());
|
||||
}else {
|
||||
recordVo.setWcl("0");
|
||||
}
|
||||
|
||||
|
||||
//统计上一月的数据
|
||||
firstDay = LocalDate.now().minusMonths(1).withDayOfMonth(1);
|
||||
|
||||
@ -0,0 +1,137 @@
|
||||
package org.dromara.inspection.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTaskProblemBo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTaskProblemVo;
|
||||
import org.dromara.inspection.domain.OpsInspectionTaskProblem;
|
||||
import org.dromara.inspection.mapper.OpsInspectionTaskProblemMapper;
|
||||
import org.dromara.inspection.service.IOpsInspectionTaskProblemService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 运维-巡检-任务-问题Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-26
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsInspectionTaskProblemServiceImpl implements IOpsInspectionTaskProblemService {
|
||||
|
||||
private final OpsInspectionTaskProblemMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-任务-问题
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 运维-巡检-任务-问题
|
||||
*/
|
||||
@Override
|
||||
public OpsInspectionTaskProblemVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询运维-巡检-任务-问题列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维-巡检-任务-问题分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OpsInspectionTaskProblemVo> queryPageList(OpsInspectionTaskProblemBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> lqw = buildQueryWrapper(bo);
|
||||
Page<OpsInspectionTaskProblemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维-巡检-任务-问题列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维-巡检-任务-问题列表
|
||||
*/
|
||||
@Override
|
||||
public List<OpsInspectionTaskProblemVo> queryList(OpsInspectionTaskProblemBo bo) {
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OpsInspectionTaskProblem> buildQueryWrapper(OpsInspectionTaskProblemBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(OpsInspectionTaskProblem::getId);
|
||||
lqw.eq(bo.getTaskId() != null, OpsInspectionTaskProblem::getTaskId, bo.getTaskId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getType()), OpsInspectionTaskProblem::getType, bo.getType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getInfo()), OpsInspectionTaskProblem::getInfo, bo.getInfo());
|
||||
lqw.eq(bo.getFindTime() != null, OpsInspectionTaskProblem::getFindTime, bo.getFindTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFinish()), OpsInspectionTaskProblem::getFinish, bo.getFinish());
|
||||
lqw.eq(bo.getFinishTime() != null, OpsInspectionTaskProblem::getFinishTime, bo.getFinishTime());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-巡检-任务-问题
|
||||
*
|
||||
* @param bo 运维-巡检-任务-问题
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OpsInspectionTaskProblemBo bo) {
|
||||
OpsInspectionTaskProblem add = MapstructUtils.convert(bo, OpsInspectionTaskProblem.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-巡检-任务-问题
|
||||
*
|
||||
* @param bo 运维-巡检-任务-问题
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OpsInspectionTaskProblemBo bo) {
|
||||
OpsInspectionTaskProblem update = MapstructUtils.convert(bo, OpsInspectionTaskProblem.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OpsInspectionTaskProblem entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维-巡检-任务-问题信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.inspection.service.impl;
|
||||
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -10,14 +11,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionPlanVo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionRecordVo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import org.dromara.inspection.domain.OpsInspectionTaskProblem;
|
||||
import org.dromara.inspection.domain.vo.*;
|
||||
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
||||
import org.dromara.inspection.mapper.OpsInspectionTaskProblemMapper;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTaskBo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTaskVo;
|
||||
import org.dromara.inspection.domain.OpsInspectionTask;
|
||||
import org.dromara.inspection.mapper.OpsInspectionTaskMapper;
|
||||
import org.dromara.inspection.service.IOpsInspectionTaskService;
|
||||
@ -28,12 +31,8 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 运维-巡检计划-任务Service业务层处理
|
||||
@ -47,10 +46,13 @@ import java.util.stream.Collectors;
|
||||
public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
|
||||
private final OpsInspectionTaskMapper baseMapper;
|
||||
private final OpsInspectionNodeMapper nodeMapper;
|
||||
private final OpsInspectionTaskProblemMapper problemMapper;
|
||||
|
||||
@Autowired
|
||||
private OpsInspectionPlanServiceImpl opsInspectionPlanService;
|
||||
@Autowired
|
||||
private OpsUserServiceImpl opsUserService;
|
||||
@DubboReference
|
||||
private RemoteUserService userService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检计划-任务
|
||||
@ -134,10 +136,55 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OpsInspectionTaskBo bo) {
|
||||
public R<Void> updateByBo(OpsInspectionTaskBo bo) {
|
||||
OpsInspectionTask update = MapstructUtils.convert(bo, OpsInspectionTask.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
|
||||
//过滤出更新为完成任务的情况
|
||||
OpsInspectionTaskVo oldVo = baseMapper.selectVoById(bo.getId());
|
||||
//如果原来不为完成状态而更新为完成状态
|
||||
if (!oldVo.getTaskType().equals("4") && bo.getTaskType().equals("4")){
|
||||
|
||||
//判断节点是否全部完成
|
||||
List<String> split = Arrays.stream(bo.getNodeIds().split(",")).toList();
|
||||
LambdaQueryWrapper<OpsInspectionNode> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
nodeLambdaQueryWrapper.in(OpsInspectionNode::getId, split);
|
||||
//全部节点
|
||||
List<OpsInspectionNodeVo> nodeVos = nodeMapper.selectVoList(nodeLambdaQueryWrapper);
|
||||
boolean isAllFinish = true;
|
||||
for (OpsInspectionNodeVo nodeVo : nodeVos) {
|
||||
if (nodeVo.getStatus().equals("2")){
|
||||
isAllFinish = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!isAllFinish){
|
||||
return R.fail("节点尚未全部完成");
|
||||
}
|
||||
|
||||
//判断问题是否全部解决
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> problemLqw = new LambdaQueryWrapper<>();
|
||||
problemLqw.eq(OpsInspectionTaskProblem::getTaskId, bo.getId());
|
||||
List<OpsInspectionTaskProblemVo> problems = problemMapper.selectVoList(problemLqw);
|
||||
for (OpsInspectionTaskProblemVo problem : problems) {
|
||||
if (problem.getFinish().equals("2")){
|
||||
isAllFinish = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isAllFinish){
|
||||
return R.fail("纪录的问题尚未完全解决");
|
||||
}
|
||||
}
|
||||
|
||||
boolean b = baseMapper.updateById(update) > 0;
|
||||
|
||||
if (b){
|
||||
return R.ok();
|
||||
}else {
|
||||
|
||||
return R.fail("更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,6 +206,28 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
|
||||
//删除任务时删除节点和节点问题
|
||||
List<Long> problemIds = new ArrayList<>();
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> problemLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
for (Long id : ids) {
|
||||
//删除节点
|
||||
OpsInspectionTaskVo taskVo = baseMapper.selectVoById(id);
|
||||
if (taskVo!= null){
|
||||
if (taskVo.getNodeIds()!=null){
|
||||
nodeMapper.deleteByIds(Arrays.stream(taskVo.getNodeIds().split(",")).toList());
|
||||
}
|
||||
}
|
||||
//删除问题
|
||||
problemLambdaQueryWrapper.clear();
|
||||
problemLambdaQueryWrapper.eq(OpsInspectionTaskProblem::getId, id);
|
||||
List<OpsInspectionTaskProblemVo> problemVos = problemMapper.selectVoList(problemLambdaQueryWrapper);
|
||||
if (problemVos!= null && !problemVos.isEmpty()){
|
||||
problemMapper.deleteByIds(problemVos);
|
||||
}
|
||||
}
|
||||
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@ -187,7 +256,6 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
// 设置时间范围:今天的00:00:00到23:59:59
|
||||
startDate = Date.from(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).atZone(ZoneId.systemDefault()).toInstant());
|
||||
endDate = Date.from(LocalDateTime.of(LocalDate.now(), LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
}
|
||||
|
||||
//统计本周
|
||||
@ -216,48 +284,62 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
Date finalStartDate = startDate;
|
||||
Date finalEndDate = endDate;
|
||||
|
||||
Long finishInspectionCount = (long) opsInspectionTaskVos.stream()
|
||||
.filter(taskVo -> taskVo.getFinishTime().after(finalStartDate) && taskVo.getFinishTime().before(finalEndDate))
|
||||
.toList().size();
|
||||
recordVo.setFinishInspectionCount(finishInspectionCount);
|
||||
//仅统计在指定时间段内完成的巡检任务
|
||||
List<OpsInspectionTaskVo> finishList = opsInspectionTaskVos.stream()
|
||||
.filter(taskVo -> taskVo.getFinishTime() != null && taskVo.getStartTime() != null && taskVo.getFinishTime().before(finalEndDate) && taskVo.getStartTime().after(finalStartDate))
|
||||
.filter(vo -> vo.getCreateTime().after(finalStartDate) && vo.getCreateTime().before(finalEndDate))
|
||||
.toList();
|
||||
recordVo.setFinishInspectionCount((long) finishList.size());
|
||||
|
||||
//发现问题数 通过createTime统计
|
||||
int problemCount = opsInspectionTaskVos.stream()
|
||||
.filter(taskVo -> taskVo.getCreateTime().after(finalStartDate) && taskVo.getCreateTime().before(finalEndDate))
|
||||
.toList().size();
|
||||
int problemCount = 0;
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> problemLqw = new LambdaQueryWrapper<>();
|
||||
problemLqw.eq(OpsInspectionTaskProblem::getProjectId, projectId);
|
||||
problemLqw.ge(OpsInspectionTaskProblem::getCreateTime, finalStartDate);
|
||||
problemLqw.le(OpsInspectionTaskProblem::getCreateTime, finalEndDate);
|
||||
|
||||
List<OpsInspectionTaskProblemVo> problemVos = problemMapper.selectVoList(problemLqw);
|
||||
if (problemVos != null && !problemVos.isEmpty()){
|
||||
problemCount = problemVos.size();
|
||||
}
|
||||
recordVo.setProblemCount((long) problemCount);
|
||||
|
||||
//已解决数 获取列表以供通用
|
||||
List<OpsInspectionTaskVo> list = opsInspectionTaskVos.stream()
|
||||
.filter(taskVo -> taskVo.getCreateTime().after(finalStartDate) && taskVo.getCreateTime().before(finalEndDate))
|
||||
.filter(taskVo -> taskVo.getTaskType().equals("4"))
|
||||
.toList();
|
||||
recordVo.setSolvedProblemCount((long) list.size());
|
||||
//已解决数 获取列表以供通用 从本月发现列表里筛选出已解决
|
||||
List<OpsInspectionTaskProblemVo> finishProblems = new ArrayList<>();
|
||||
if (problemVos == null || problemVos.isEmpty()){
|
||||
recordVo.setSolvedProblemCount(0L);
|
||||
}else {
|
||||
//过滤出完成的
|
||||
finishProblems.addAll(problemVos.stream().filter(vo -> vo.getFinish().equals("1")).toList());
|
||||
recordVo.setSolvedProblemCount((long) finishProblems.size());
|
||||
}
|
||||
|
||||
// 计算总共耗时(毫秒)
|
||||
long durationMillis = 0L;
|
||||
for (OpsInspectionTaskVo opsInspectionTaskVo : list) {
|
||||
durationMillis += opsInspectionTaskVo.getFinishTime().getTime() - opsInspectionTaskVo.getCreateTime().getTime();
|
||||
for (OpsInspectionTaskProblemVo vo : finishProblems) {
|
||||
durationMillis += vo.getFinishTime().getTime() - vo.getFindTime().getTime();
|
||||
}
|
||||
//赋值分钟
|
||||
if (list.isEmpty()){
|
||||
//平均处理分钟
|
||||
if (finishProblems.isEmpty()){
|
||||
recordVo.setAverageCompletionTime(0L);
|
||||
}else {
|
||||
recordVo.setAverageCompletionTime(TimeUnit.MILLISECONDS.toMinutes(durationMillis) / list.size());
|
||||
recordVo.setAverageCompletionTime(TimeUnit.MILLISECONDS.toMinutes(durationMillis) / finishProblems.size());
|
||||
}
|
||||
|
||||
//解决效率 已解决数 / 总共数量 * 100
|
||||
//解决效率 = 已解决数 / 已发现数总共数量 * 100
|
||||
BigDecimal problemCountBigDecimal = BigDecimal.valueOf(recordVo.getProblemCount());
|
||||
BigDecimal solvedProblemCountBigDecimal = BigDecimal.valueOf(recordVo.getSolvedProblemCount());
|
||||
if (solvedProblemCountBigDecimal.compareTo(BigDecimal.ZERO) == 0 || problemCountBigDecimal.compareTo(BigDecimal.ZERO) == 0){
|
||||
recordVo.setSolveEfficiency(BigDecimal.valueOf(0));
|
||||
|
||||
if (solvedProblemCountBigDecimal.compareTo(BigDecimal.ZERO) < 1 || problemCountBigDecimal.compareTo(BigDecimal.ZERO) < 1){
|
||||
recordVo.setJjxl(BigDecimal.valueOf(0));
|
||||
}else {
|
||||
BigDecimal bigDecimal = solvedProblemCountBigDecimal.divide(problemCountBigDecimal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP);
|
||||
recordVo.setSolveEfficiency(bigDecimal);
|
||||
recordVo.setJjxl(bigDecimal);
|
||||
}
|
||||
for (OpsInspectionTaskVo opsInspectionTaskVo : opsInspectionTaskVos) {
|
||||
if (opsInspectionTaskVo.getCreateTime().after(startDate) && opsInspectionTaskVo.getCreateTime().before(endDate)){
|
||||
switch (opsInspectionTaskVo.getProblemType()){
|
||||
|
||||
if (problemVos != null) {
|
||||
for (OpsInspectionTaskProblemVo vo : problemVos) {
|
||||
switch (vo.getType()){
|
||||
case "1" -> cpsyl++;
|
||||
case "2" -> ncsyl++;
|
||||
case "3" -> fwzt++;
|
||||
@ -272,6 +354,31 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
recordVo.setXysj(xysj);
|
||||
recordVo.setSbyxzt(sbyxzt);
|
||||
|
||||
//巡检完成率
|
||||
BigDecimal xjwcl;
|
||||
//统计指定时间段内创建的巡检任务数
|
||||
int byxjs = opsInspectionTaskVos.stream()
|
||||
.filter(vo -> !vo.getCreateTime().before(finalStartDate) && !vo.getCreateTime().after(finalEndDate))
|
||||
.toList()
|
||||
.size();
|
||||
//完成 / 巡检数 * 100
|
||||
if (byxjs > 0) {
|
||||
xjwcl = BigDecimal.valueOf(recordVo.getFinishInspectionCount()).divide(BigDecimal.valueOf(byxjs), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}else {
|
||||
xjwcl = BigDecimal.valueOf(0);
|
||||
}
|
||||
recordVo.setXjwcl(xjwcl.toString());
|
||||
|
||||
//问题解决率
|
||||
BigDecimal wtjjl;
|
||||
//解决数 / 问题数 * 100
|
||||
if (problemVos == null || problemVos.isEmpty()){
|
||||
wtjjl = BigDecimal.valueOf(0);
|
||||
}else {
|
||||
wtjjl = BigDecimal.valueOf(recordVo.getSolvedProblemCount()).divide(BigDecimal.valueOf(problemVos.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}
|
||||
recordVo.setJjxl(wtjjl);
|
||||
|
||||
return R.ok(recordVo);
|
||||
}
|
||||
|
||||
@ -282,18 +389,63 @@ public class OpsInspectionTaskServiceImpl implements IOpsInspectionTaskService {
|
||||
private void buildEcho(List<OpsInspectionTaskVo> taskVos) {
|
||||
//TODO 回显信息
|
||||
taskVos.forEach(taskVo -> {
|
||||
LambdaQueryWrapper<OpsInspectionNode> nodeWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (taskVo.getPlanId()!=null) {
|
||||
OpsInspectionPlanVo opsInspectionPlanVo = opsInspectionPlanService.queryById(taskVo.getPlanId());
|
||||
if (opsInspectionPlanVo != null) {
|
||||
taskVo.setPlan(opsInspectionPlanVo);
|
||||
}
|
||||
}
|
||||
|
||||
if (taskVo.getPersonId()!=null) {
|
||||
OpsUserVo opsUserVo = opsUserService.queryById(taskVo.getPersonId());
|
||||
if (opsUserVo != null) {
|
||||
taskVo.setPerson(opsUserVo);
|
||||
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(List.of(taskVo.getPersonId()));
|
||||
if (remoteUserVos != null && !remoteUserVos.isEmpty()) {
|
||||
taskVo.setPerson(remoteUserVos.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
//处理进度和节点信息
|
||||
if (taskVo.getNodeIds() != null && !taskVo.getNodeIds().isEmpty()){
|
||||
|
||||
List<String> stringList = Arrays.stream(taskVo.getNodeIds().split(",")).toList();
|
||||
|
||||
nodeWrapper.clear();
|
||||
nodeWrapper.in(OpsInspectionNode::getId, stringList);
|
||||
List<OpsInspectionNodeVo> nodeVoList = nodeMapper.selectVoList(nodeWrapper);
|
||||
|
||||
//处理进度百分比 完成节点 / 总节点 * 100
|
||||
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
||||
//统计完成节点
|
||||
int finishCount = nodeVoList.stream().filter(nodeVo -> nodeVo.getStatus().equals("1")).toList().size();
|
||||
if (finishCount == nodeVoList.size()){
|
||||
taskVo.setTaskProgress(new BigDecimal("100"));
|
||||
}else {
|
||||
taskVo.setTaskProgress(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(nodeVoList.size()), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100.00)));
|
||||
}
|
||||
}
|
||||
|
||||
//处理节点列表
|
||||
if (taskVo.getNodeIds() != null && !taskVo.getNodeIds().isEmpty()){
|
||||
|
||||
List<OpsInspectionNodeVo> nodeVos = new ArrayList<>();
|
||||
for (String id : stringList) {
|
||||
OpsInspectionNodeVo nodeVo = nodeMapper.selectVoById(id);
|
||||
if (nodeVo != null) {
|
||||
nodeVos.add(nodeVo);
|
||||
}
|
||||
}
|
||||
taskVo.setNodes(nodeVos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//处理问题列表
|
||||
LambdaQueryWrapper<OpsInspectionTaskProblem> problemWrapper = new LambdaQueryWrapper<>();
|
||||
problemWrapper.eq(OpsInspectionTaskProblem::getTaskId, taskVo.getId());
|
||||
List<OpsInspectionTaskProblemVo> problemVos = problemMapper.selectVoList(problemWrapper);
|
||||
taskVo.setProblems(problemVos);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.inspection.service.impl;
|
||||
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -14,6 +15,8 @@ import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTestPlanBo;
|
||||
@ -38,10 +41,8 @@ import java.util.Collection;
|
||||
@Service
|
||||
public class OpsInspectionTestPlanServiceImpl implements IOpsInspectionTestPlanService {
|
||||
|
||||
@Autowired
|
||||
private OpsUserServiceImpl opsUserService;
|
||||
@Autowired
|
||||
private OpsInspectionItemServiceImpl inspectionItemService;
|
||||
@DubboReference
|
||||
private RemoteUserService userService;
|
||||
|
||||
private final OpsInspectionTestPlanMapper baseMapper;
|
||||
|
||||
@ -166,19 +167,19 @@ public class OpsInspectionTestPlanServiceImpl implements IOpsInspectionTestPlanS
|
||||
for (OpsInspectionTestPlanVo opsInspectionTestPlanVo : list) {
|
||||
|
||||
if(opsInspectionTestPlanVo.getPersonCharge()!=null) {
|
||||
OpsUserVo byId = opsUserService.queryById(opsInspectionTestPlanVo.getPersonCharge());
|
||||
if (byId != null) {
|
||||
opsInspectionTestPlanVo.setPerson(byId);
|
||||
List<RemoteUserVo> byId = userService.selectListByIds(List.of(opsInspectionTestPlanVo.getPersonCharge()));
|
||||
if (byId != null && !byId.isEmpty()) {
|
||||
opsInspectionTestPlanVo.setPerson(byId.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
if (opsInspectionTestPlanVo.getPersonIds() != null){
|
||||
String[] split = opsInspectionTestPlanVo.getPersonIds().split(",");
|
||||
List<OpsUserVo> opsUserVos = new ArrayList<>();
|
||||
List<RemoteUserVo> opsUserVos = new ArrayList<>();
|
||||
for (String s : split) {
|
||||
OpsUserVo opsUserVo = opsUserService.queryById(Long.parseLong(s));
|
||||
if (opsUserVo != null){
|
||||
opsUserVos.add(opsUserVo);
|
||||
List<RemoteUserVo> opsUserVo = userService.selectListByIds(List.of(Long.parseLong(s)));
|
||||
if (opsUserVo != null && !opsUserVo.isEmpty()){
|
||||
opsUserVos.add(opsUserVo.getFirst());
|
||||
}
|
||||
}
|
||||
opsInspectionTestPlanVo.setPersons(opsUserVos);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package org.dromara.inspection.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.Data;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -11,14 +13,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTestPlanVo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTestTaskRecord;
|
||||
import org.dromara.inspection.domain.OpsInspectionNode;
|
||||
import org.dromara.inspection.domain.vo.*;
|
||||
import org.dromara.inspection.mapper.OpsInspectionNodeMapper;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.service.impl.OpsUserServiceImpl;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.inspection.domain.bo.OpsInspectionTestTaskBo;
|
||||
import org.dromara.inspection.domain.vo.OpsInspectionTestTaskVo;
|
||||
import org.dromara.inspection.domain.OpsInspectionTestTask;
|
||||
import org.dromara.inspection.mapper.OpsInspectionTestTaskMapper;
|
||||
import org.dromara.inspection.service.IOpsInspectionTestTaskService;
|
||||
@ -27,10 +31,8 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 运维-巡检-试验任务Service业务层处理
|
||||
@ -44,10 +46,12 @@ import java.util.Collection;
|
||||
public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskService {
|
||||
|
||||
private final OpsInspectionTestTaskMapper baseMapper;
|
||||
@Autowired
|
||||
private OpsUserServiceImpl opsUserService;
|
||||
private final OpsInspectionNodeMapper nodeMapper;
|
||||
|
||||
@Autowired
|
||||
private OpsInspectionTestPlanServiceImpl opsInspectionTestPlanService;
|
||||
@DubboReference
|
||||
private RemoteUserService userService;
|
||||
|
||||
/**
|
||||
* 查询运维-巡检-试验任务
|
||||
@ -105,7 +109,7 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
||||
lqw.eq(bo.getTestPlanId() != null, OpsInspectionTestTask::getTestPlanId, bo.getTestPlanId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTestSetting()), OpsInspectionTestTask::getTestSetting, bo.getTestSetting());
|
||||
lqw.eq(bo.getPlanBeginTime() != null, OpsInspectionTestTask::getPlanBeginTime, bo.getPlanBeginTime());
|
||||
lqw.eq(bo.getProgress() != null, OpsInspectionTestTask::getProgress, bo.getProgress());
|
||||
// lqw.eq(bo.getProgress() != null, OpsInspectionTestTask::getProgress, bo.getProgress());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFailReason()), OpsInspectionTestTask::getFailReason, bo.getFailReason());
|
||||
lqw.eq(bo.getFailTime() != null, OpsInspectionTestTask::getFailTime, bo.getFailTime());
|
||||
lqw.eq(bo.getFailPhase() != null, OpsInspectionTestTask::getFailPhase, bo.getFailPhase());
|
||||
@ -143,10 +147,67 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OpsInspectionTestTaskBo bo) {
|
||||
public R<Void> updateByBo(OpsInspectionTestTaskBo bo) {
|
||||
OpsInspectionTestTask update = MapstructUtils.convert(bo, OpsInspectionTestTask.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
|
||||
if(update == null){
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
OpsInspectionTestTaskVo oldVo = baseMapper.selectVoById(bo.getId());
|
||||
|
||||
if (!oldVo.getStatus().equals("5") && bo.getStatus().equals("5")){
|
||||
//判断节点是否全部完成
|
||||
List<String> split = Arrays.stream(bo.getNodeIds().split(",")).toList();
|
||||
LambdaQueryWrapper<OpsInspectionNode> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
nodeLambdaQueryWrapper.in(OpsInspectionNode::getId, split);
|
||||
//全部节点
|
||||
List<OpsInspectionNodeVo> nodeVos = nodeMapper.selectVoList(nodeLambdaQueryWrapper);
|
||||
boolean isAllFinish = true;
|
||||
for (OpsInspectionNodeVo nodeVo : nodeVos) {
|
||||
if (nodeVo.getStatus().equals("2")) {
|
||||
isAllFinish = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isAllFinish){
|
||||
return R.fail("节点尚未全部完成");
|
||||
}
|
||||
}
|
||||
|
||||
// 使用 UpdateWrapper 更新包括 null 的字段
|
||||
UpdateWrapper<OpsInspectionTestTask> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", bo.getId());
|
||||
|
||||
// 手动设置需要更新的字段,包括可能为 null 的字段
|
||||
updateWrapper.set("task_name", update.getTaskName())
|
||||
.set("test_object", update.getTestObject())
|
||||
.set("begin_time", update.getBeginTime())
|
||||
.set("end_time", update.getEndTime())
|
||||
.set("time_info", update.getTimeInfo())
|
||||
.set("person", update.getPerson())
|
||||
.set("status", update.getStatus())
|
||||
.set("test_plan_id", update.getTestPlanId())
|
||||
.set("test_setting", update.getTestSetting())
|
||||
.set("plan_begin_time", update.getPlanBeginTime())
|
||||
.set("fail_reason", update.getFailReason())
|
||||
.set("fail_time", update.getFailTime())
|
||||
.set("fail_phase", update.getFailPhase())
|
||||
.set("faile_analyze", update.getFaileAnalyze())
|
||||
.set("faile_tips", update.getFaileTips())
|
||||
.set("test_long_time", update.getTestLongTime())
|
||||
.set("test_final", update.getTestFinal())
|
||||
.set("final_info", update.getFinalInfo())
|
||||
.set("pause_for", update.getPauseFor())
|
||||
.set("pause_time", update.getPauseTime());
|
||||
|
||||
boolean b = baseMapper.update(updateWrapper) > 0;
|
||||
if (b){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.fail();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,22 +236,62 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
||||
* 处理回显信息
|
||||
*/
|
||||
private void setValue(List<OpsInspectionTestTaskVo> list){
|
||||
for (OpsInspectionTestTaskVo opsInspectionTestTaskVo : list) {
|
||||
if(opsInspectionTestTaskVo.getPerson()!= null){
|
||||
OpsUserVo opsUserVo = opsUserService.queryById(opsInspectionTestTaskVo.getPerson());
|
||||
if (opsUserVo != null){
|
||||
opsInspectionTestTaskVo.setPersonInfo(opsUserVo);
|
||||
|
||||
LambdaQueryWrapper<OpsInspectionNode> nodeWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
for (OpsInspectionTestTaskVo vo : list) {
|
||||
|
||||
if(vo.getPerson()!= null){
|
||||
List<RemoteUserVo> remoteUserVos = userService.selectListByIds(List.of(vo.getPerson()));
|
||||
if (remoteUserVos != null && !remoteUserVos.isEmpty()){
|
||||
vo.setPersonInfo(remoteUserVos.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (opsInspectionTestTaskVo.getTestPlanId() != null){
|
||||
OpsInspectionTestPlanVo opsInspectionTestPlanVo = opsInspectionTestPlanService.queryById(opsInspectionTestTaskVo.getTestPlanId());
|
||||
if (vo.getTestPlanId() != null){
|
||||
OpsInspectionTestPlanVo opsInspectionTestPlanVo = opsInspectionTestPlanService.queryById(vo.getTestPlanId());
|
||||
if (opsInspectionTestPlanVo != null){
|
||||
opsInspectionTestTaskVo.setTestPlan(opsInspectionTestPlanVo);
|
||||
vo.setTestPlan(opsInspectionTestPlanVo);
|
||||
}
|
||||
}
|
||||
|
||||
//处理节点回显列表
|
||||
if (vo.getNodeIds() != null && !vo.getNodeIds().isEmpty()){
|
||||
|
||||
List<String> stringList = Arrays.stream(vo.getNodeIds().split(",")).toList();
|
||||
|
||||
nodeWrapper.clear();
|
||||
nodeWrapper.in(OpsInspectionNode::getId, stringList);
|
||||
List<OpsInspectionNodeVo> nodeVoList = nodeMapper.selectVoList(nodeWrapper);
|
||||
|
||||
//处理进度百分比 完成节点 / 总节点 * 100
|
||||
if (nodeVoList != null && !nodeVoList.isEmpty()){
|
||||
//统计完成节点
|
||||
int finishCount = nodeVoList.stream().filter(nodeVo -> nodeVo.getStatus().equals("1")).toList().size();
|
||||
if (finishCount == nodeVoList.size()){
|
||||
vo.setProgress(new BigDecimal("100"));
|
||||
}else {
|
||||
vo.setProgress(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(nodeVoList.size()), 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100.00)));
|
||||
}
|
||||
}
|
||||
|
||||
//处理节点列表
|
||||
if (vo.getNodeIds() != null && !vo.getNodeIds().isEmpty()){
|
||||
|
||||
List<OpsInspectionNodeVo> nodeVos = new ArrayList<>();
|
||||
for (String id : stringList) {
|
||||
OpsInspectionNodeVo nodeVo = nodeMapper.selectVoById(id);
|
||||
if (nodeVo != null) {
|
||||
nodeVos.add(nodeVo);
|
||||
}
|
||||
}
|
||||
vo.setNodes(nodeVos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -214,6 +315,9 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
||||
if (list==null || list.isEmpty()){
|
||||
return R.fail("没有数据");
|
||||
}
|
||||
//筛选出本月数据
|
||||
List<OpsInspectionTestTaskVo> benyueList = list.stream().filter(vo -> vo.getPlanBeginTime() != null && vo.getPlanFinishTime() != null && vo.getPlanBeginTime().after(startDate) && vo.getPlanFinishTime().before(endDate)).toList();
|
||||
|
||||
OpsInspectionTestTaskRecord record = new OpsInspectionTestTaskRecord();
|
||||
|
||||
//完成实验数
|
||||
@ -221,33 +325,98 @@ public class OpsInspectionTestTaskServiceImpl implements IOpsInspectionTestTaskS
|
||||
//待分析记录
|
||||
Long failCount = 0L;
|
||||
//总共完成时间
|
||||
Long totalTestTime = 0L;
|
||||
long totalTestTime = 0L;
|
||||
|
||||
for (OpsInspectionTestTaskVo opsInspectionTestTaskVo : list) {
|
||||
if (opsInspectionTestTaskVo.getPlanFinishTime().after(startDate) && opsInspectionTestTaskVo.getPlanFinishTime().before(endDate) && opsInspectionTestTaskVo.getStatus().equals("5")){
|
||||
for (OpsInspectionTestTaskVo vo : benyueList) {
|
||||
//只统计开始和结束都在本月内的
|
||||
if (vo.getStatus().equals("5")){
|
||||
finishCount++;
|
||||
totalTestTime += opsInspectionTestTaskVo.getPlanFinishTime().getTime() - opsInspectionTestTaskVo.getPlanBeginTime().getTime();
|
||||
totalTestTime += vo.getPlanFinishTime().getTime() - vo.getPlanBeginTime().getTime();
|
||||
}
|
||||
if (opsInspectionTestTaskVo.getPlanFinishTime().after(startDate) && opsInspectionTestTaskVo.getPlanFinishTime().before(endDate) && opsInspectionTestTaskVo.getStatus().equals("3")){
|
||||
|
||||
if (vo.getStatus().equals("3") && vo.getUnPack().equals("1")){
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
record.setFinishCount(finishCount);
|
||||
record.setFailCount(failCount);
|
||||
record.setPassValue(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(list.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
|
||||
record.setAverageTestTime(totalTestTime/finishCount);
|
||||
|
||||
//统计上一月的数据
|
||||
firstDay = LocalDate.now().minusMonths(1).withDayOfMonth(1);
|
||||
lastDay = firstDay.plusMonths(1).minusDays(1);
|
||||
Date finalEndDate = Date.from(firstDay.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date finalStartDate = Date.from(lastDay.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
|
||||
record.setFinishCount(String.valueOf(finishCount));
|
||||
record.setFailCount(String.valueOf(failCount));
|
||||
if (!list.isEmpty() && !benyueList.isEmpty()) {
|
||||
record.setPassValue(String.valueOf(BigDecimal.valueOf(finishCount).divide(BigDecimal.valueOf(benyueList.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
|
||||
}else {
|
||||
record.setPassValue("0");
|
||||
}
|
||||
if(finishCount >0 ) {
|
||||
record.setAverageTestTime(BigDecimal.valueOf((double) TimeUnit.MILLISECONDS.toMinutes(totalTestTime) / finishCount).toString());
|
||||
}else {
|
||||
record.setAverageTestTime("0");
|
||||
}
|
||||
//统计上一月的数据finalStartDate finalEndDate
|
||||
Date finalStartDate = Date.from(LocalDate.now().minusMonths(1).withDayOfMonth(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Date finalEndDate = Date.from(LocalDate.now().minusMonths(1).withDayOfMonth(1).plusMonths(1).minusDays(1).atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
//上月数据列表
|
||||
List<OpsInspectionTestTaskVo> lastMonth = list.stream().filter(testTaskVo -> testTaskVo.getPlanBeginTime().before(finalEndDate) && testTaskVo.getPlanFinishTime().after(finalStartDate))
|
||||
List<OpsInspectionTestTaskVo> lastMonth = list.stream().filter(testTaskVo -> testTaskVo.getCreateTime().before(finalEndDate) && testTaskVo.getCreateTime().after(finalStartDate))
|
||||
.toList();
|
||||
log.info("上月数据列表:{}",lastMonth);
|
||||
|
||||
//上月完成数
|
||||
finishCount = 0L;
|
||||
//上月实验通过率
|
||||
BigDecimal passValue = BigDecimal.ZERO;
|
||||
//上月平均实验时长
|
||||
totalTestTime = 0L;
|
||||
|
||||
for (OpsInspectionTestTaskVo vo : lastMonth) {
|
||||
if (vo.getStatus().equals("5")){
|
||||
finishCount++;
|
||||
totalTestTime += vo.getPlanFinishTime().getTime() - vo.getPlanBeginTime().getTime();
|
||||
}
|
||||
}
|
||||
log.info("上月完成数:{}",finishCount);
|
||||
log.info("上月总共时长:{}",totalTestTime);
|
||||
|
||||
//完成数增长率
|
||||
BigDecimal wcszzl;
|
||||
if (BigDecimal.valueOf(finishCount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
wcszzl = BigDecimal.valueOf(Double.parseDouble(record.getFinishCount())).divide(BigDecimal.valueOf(finishCount), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||
}else {
|
||||
wcszzl = BigDecimal.ZERO;
|
||||
}
|
||||
record.setFinishCountAdd(wcszzl.toString());
|
||||
|
||||
//上月通过率
|
||||
if(BigDecimal.valueOf(lastMonth.size()).compareTo(BigDecimal.ZERO) > 0) {
|
||||
passValue = BigDecimal.valueOf(Double.valueOf(finishCount)).divide(BigDecimal.valueOf(lastMonth.size()), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
||||
}
|
||||
log.info("上月通过率:{}",passValue);
|
||||
//进行比较 得出通过增长率
|
||||
BigDecimal tgzzl;
|
||||
if(passValue.compareTo(BigDecimal.ZERO) > 0) {
|
||||
tgzzl = BigDecimal.valueOf(Double.parseDouble(record.getPassValue())).divide(passValue, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||
}else {
|
||||
tgzzl = BigDecimal.ZERO;
|
||||
}
|
||||
record.setPassValueAdd(tgzzl.toString());
|
||||
|
||||
//上月平均实验时间
|
||||
BigDecimal sypjsj;
|
||||
if (finishCount > 0) {
|
||||
sypjsj = BigDecimal.valueOf((double) TimeUnit.MILLISECONDS.toMinutes(totalTestTime) / finishCount);
|
||||
}else {
|
||||
sypjsj = BigDecimal.ZERO;
|
||||
}
|
||||
log.info("上月平均实验分钟数:{}",sypjsj);
|
||||
log.info("本月平均实验分钟数:{}",record.getAverageTestTime());
|
||||
//平均时间增长率
|
||||
BigDecimal sysjzzl;
|
||||
if (BigDecimal.valueOf(Double.parseDouble(record.getAverageTestTime())).compareTo(BigDecimal.ZERO) > 0) {
|
||||
sysjzzl=sypjsj.divide(BigDecimal.valueOf(Double.parseDouble(record.getAverageTestTime())), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100.00));
|
||||
}else {
|
||||
sysjzzl = BigDecimal.ZERO;
|
||||
}
|
||||
log.info("实验分钟数增长率:{}",sysjzzl);
|
||||
record.setAverageTestTimeAdd(sysjzzl.toString());
|
||||
|
||||
return R.ok(record);
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package org.dromara.monitoring.config;
|
||||
|
||||
public class SnowFlakeUtil {
|
||||
// 起始时间戳
|
||||
private static final long startTimeStamp = 1577808000000L;
|
||||
// 机器ID
|
||||
private static final long workID = 1L;
|
||||
// 数据中心ID
|
||||
private static final long dataCenterID = 1L;
|
||||
// 序列号
|
||||
private static long sequence = 0L;
|
||||
// 数据中心ID移动位数
|
||||
private static final long dataCenterIndex = 12L;
|
||||
// 机器ID移动位数
|
||||
private static final long workIDIndex = 17L;
|
||||
// 时间戳移动位数
|
||||
private static final long timeStampIndex = 22L;
|
||||
// 记录上一次时间戳
|
||||
private static long lastTimeStamp = -1L;
|
||||
// 序列号掩码
|
||||
private static final long sequenceMask = -1L ^ (-1L << 12);
|
||||
public synchronized static long getID() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now < lastTimeStamp) {
|
||||
throw new RuntimeException("时钟回拨异常");
|
||||
}
|
||||
if (now == lastTimeStamp) {
|
||||
sequence = (sequence + 1) & sequenceMask;
|
||||
if (sequence == 0L) {
|
||||
try {
|
||||
Thread.sleep(1L);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
now = System.currentTimeMillis();
|
||||
}
|
||||
} else {
|
||||
sequence = 0L;
|
||||
}
|
||||
lastTimeStamp = now;
|
||||
return ((now - startTimeStamp) << timeStampIndex) | (dataCenterID << dataCenterIndex) | (workID << workIDIndex) | sequence;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.dromara.monitoring.config;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "ys7")
|
||||
public class YsDto {
|
||||
private String appKey;
|
||||
private String appSecret;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package org.dromara.monitoring.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.monitoring.domain.bo.MonDevicePresetBo;
|
||||
import org.dromara.monitoring.domain.dto.DelYzd;
|
||||
import org.dromara.monitoring.domain.vo.MonDevicePresetVo;
|
||||
import org.dromara.monitoring.service.IMonDevicePresetService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 摄像头预置位
|
||||
* 前端访问路由地址为:/camera/devicePreset
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/devicePreset")
|
||||
public class MonDevicePresetController extends BaseController {
|
||||
|
||||
private final IMonDevicePresetService monDevicePresetService;
|
||||
|
||||
/**
|
||||
* 查询摄像头预置位列表
|
||||
*/
|
||||
@SaCheckPermission("camera:devicePreset:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<MonDevicePresetVo> list(MonDevicePresetBo bo, PageQuery pageQuery) {
|
||||
return monDevicePresetService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出摄像头预置位列表
|
||||
*/
|
||||
@SaCheckPermission("camera:devicePreset:export")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(MonDevicePresetBo bo, HttpServletResponse response) {
|
||||
List<MonDevicePresetVo> list = monDevicePresetService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "摄像头预置位", MonDevicePresetVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取摄像头预置位详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("camera:devicePreset:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<MonDevicePresetVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(monDevicePresetService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增摄像头预置位
|
||||
*/
|
||||
@SaCheckPermission("camera:devicePreset:add")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MonDevicePresetBo bo) {
|
||||
return toAjax(monDevicePresetService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改摄像头预置位
|
||||
*/
|
||||
@SaCheckPermission("camera:devicePreset:edit")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody MonDevicePresetBo bo) {
|
||||
return toAjax(monDevicePresetService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除摄像头预置位
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@SaCheckPermission("camera:devicePreset:remove")
|
||||
@Log(title = "摄像头预置位", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delYzd")
|
||||
public R<Void> remove(@RequestBody List<DelYzd> yzd) {
|
||||
return toAjax(monDevicePresetService.deleteWithValidByIds(yzd, true));
|
||||
}
|
||||
|
||||
@Log(title = "调用摄像头预置位", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/callYzd")
|
||||
public R<Void> invoking(@RequestBody List<DelYzd> yzd) {
|
||||
return toAjax(monDevicePresetService.invoking(yzd));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.monitoring.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.monitoring.domain.dto.DelYzd;
|
||||
import org.dromara.monitoring.domain.dto.MonitoringListDto;
|
||||
import org.dromara.monitoring.domain.vo.MonList;
|
||||
import org.dromara.monitoring.domain.vo.MonYsVo;
|
||||
import org.dromara.monitoring.service.MonitoringYsService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/monitoriing")
|
||||
/**
|
||||
* 监控管理
|
||||
*/
|
||||
public class MonitoriingYsColltroller {
|
||||
|
||||
private final MonitoringYsService monitoringYsService;
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
*/
|
||||
@GetMapping("/getToken")
|
||||
@Log(title = "获取莹石云token", businessType = BusinessType.INSERT)
|
||||
public R<String> getysTokenColltroller(){
|
||||
return R.ok("ok",monitoringYsService.getYsTokenService());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控列表
|
||||
*/
|
||||
@PostMapping("/getMonitoringList")
|
||||
@Log(title = "获取监控列表", businessType = BusinessType.INSERT)
|
||||
public R<MonList> getMonitoringList(@RequestBody MonitoringListDto dto){
|
||||
return R.ok("请求成功",monitoringYsService.getMonitoringList(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取大屏项目
|
||||
*/
|
||||
@GetMapping("/getMonitoringDp")
|
||||
@Log(title = "数据组装", businessType = BusinessType.INSERT)
|
||||
public R<MonYsVo> getMonitoringDp(){
|
||||
return R.ok("请求成功",monitoringYsService.getMonitoringDp());
|
||||
}
|
||||
|
||||
/**
|
||||
* 抓拍
|
||||
*/
|
||||
@GetMapping("/capturePho")
|
||||
@Log(title = "抓拍接口:未用", businessType = BusinessType.INSERT)
|
||||
public R<String> capturePho(@RequestBody DelYzd dto){
|
||||
return R.ok("请求成功",monitoringYsService.capturePho(dto));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/test")
|
||||
public R<Void> test(){
|
||||
return R.ok("请求成功",monitoringYsService.test());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package org.dromara.monitoring.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.checkerframework.checker.i18nformatter.qual.I18nFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 设备预置点记录 mon_device_preset
|
||||
*/
|
||||
@TableName("mon_device_preset")
|
||||
@Data
|
||||
public class MonDevicePreset {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 预置点ID */
|
||||
@TableId(value = "id", type = com.baomidou.mybatisplus.annotation.IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
|
||||
/** 设备序列号 */
|
||||
private String deviceSerial;
|
||||
|
||||
|
||||
/** 通道号 */
|
||||
private Integer channelNo;
|
||||
|
||||
|
||||
/** 预置点序号 */
|
||||
private Integer PresetIndex;
|
||||
|
||||
|
||||
/** 预置点名称 */
|
||||
private String presetName;
|
||||
|
||||
|
||||
/**创建时间 */
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**更新时间 */
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package org.dromara.monitoring.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("mon_equipment_histroy")
|
||||
/**
|
||||
* 设备点击历史记录表 mon_equipment_histroy
|
||||
*/
|
||||
public class MonEquipmentHistroy {
|
||||
/** 历史id */
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 设备序列号 */
|
||||
private String deviceSerial;
|
||||
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 设备型号 */
|
||||
private String deviceType;
|
||||
|
||||
|
||||
/** 用户id */
|
||||
private Long userId;
|
||||
|
||||
/** 部门id */
|
||||
private Long deptId;
|
||||
|
||||
/** 项目id */
|
||||
private Long projectId;
|
||||
|
||||
/** 点击时间 */
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package org.dromara.monitoring.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 设备列表表 mon_equipment_list
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2023-08-09
|
||||
*/
|
||||
@TableName("mon_equipment_list")
|
||||
@Data
|
||||
public class MonEquipmentList {
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
|
||||
/** 设备序列号 */
|
||||
private String deviceSerial;
|
||||
|
||||
/**设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/**设备型号 */
|
||||
private String deviceType;
|
||||
|
||||
/**设备在线状态,1-在线;0-离线 */
|
||||
private Integer status;
|
||||
|
||||
/**布撤防状态 */
|
||||
private Integer defence;
|
||||
|
||||
/**固件版本号 */
|
||||
private String deviceVersion;
|
||||
|
||||
/**用户添加时间 */
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**设备最后更新时间 */
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**设备二级类目名称 */
|
||||
private String parentCategory;
|
||||
|
||||
/**设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大 */
|
||||
private Integer riskLevel;
|
||||
|
||||
/**设备IP地址 */
|
||||
private String netAddress;
|
||||
|
||||
|
||||
private Integer total;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package org.dromara.monitoring.domain.bo;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.monitoring.domain.MonDevicePreset;
|
||||
|
||||
/**
|
||||
* 摄像头预置位业务对象 mon_device_preset
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = MonDevicePreset.class, reverseConvertGenerate = false)
|
||||
public class MonDevicePresetBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@NotBlank(message = "设备序列号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceSerial;
|
||||
|
||||
/**
|
||||
* 通道号
|
||||
*/
|
||||
@NotNull(message = "通道号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long channelNo;
|
||||
|
||||
/**
|
||||
* 预置点序号
|
||||
*/
|
||||
private Long presetIndex;
|
||||
|
||||
/**
|
||||
* 预置点
|
||||
*/
|
||||
@NotBlank(message = "预置点不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String presetName;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package org.dromara.monitoring.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.monitoring.domain.MonEquipmentList;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备列业务对象 mon_equipment_list
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = MonEquipmentList.class, reverseConvertGenerate = false)
|
||||
public class MonEquipmentListBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@NotBlank(message = "设备序列号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceSerial;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotBlank(message = "设备名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
@NotBlank(message = "设备型号 不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 设备在线状态,1-在线;0-离线
|
||||
*/
|
||||
@NotNull(message = "设备在线状态,1-在线;0-离线不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 布撤防状态
|
||||
*/
|
||||
@NotNull(message = "布撤防状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long defence;
|
||||
|
||||
/**
|
||||
* 固件版本号
|
||||
*/
|
||||
@NotBlank(message = "固件版本号 不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceVersion;
|
||||
|
||||
/**
|
||||
* 用户添加时间
|
||||
*/
|
||||
@NotNull(message = "用户添加时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date addTime;
|
||||
|
||||
/**
|
||||
* 设备二级类目名称
|
||||
*/
|
||||
@NotBlank(message = "设备二级类目名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String parentCategory;
|
||||
|
||||
/**
|
||||
* 设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大
|
||||
*/
|
||||
@NotNull(message = "设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long riskLevel;
|
||||
|
||||
/**
|
||||
* 设备IP地址
|
||||
*/
|
||||
@NotBlank(message = "设备IP地址不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String netAddress;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package org.dromara.monitoring.domain.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
/**
|
||||
* 删除预置点
|
||||
*/
|
||||
public class DelYzd {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
private String deviceSerial;
|
||||
/**
|
||||
* 通道号
|
||||
*/
|
||||
private Integer channelNo = 1;
|
||||
/**
|
||||
* 预置点序号
|
||||
*/
|
||||
private Integer presetIndex ;
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package org.dromara.monitoring.domain.dto;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
public class MonitoringListDto {
|
||||
|
||||
|
||||
/**
|
||||
* 分页页码,起始页从0开始,不超过400页
|
||||
*/
|
||||
private Integer pageStart;
|
||||
|
||||
|
||||
/**
|
||||
* 分页大小,默认为10,不超过50
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
// 部门id
|
||||
@NotNull(message = "部门id不能为空")
|
||||
private Long projectId;
|
||||
|
||||
@NotNull(message = "是否为历史数据")
|
||||
private Boolean isflow;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package org.dromara.monitoring.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.monitoring.domain.MonDevicePreset;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 摄像头预置位视图对象 mon_device_preset
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = MonDevicePreset.class)
|
||||
public class MonDevicePresetVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@ExcelProperty(value = "设备序列号")
|
||||
private String deviceSerial;
|
||||
|
||||
/**
|
||||
* 通道号
|
||||
*/
|
||||
@ExcelProperty(value = "通道号")
|
||||
private Long channelNo;
|
||||
|
||||
/**
|
||||
* 预置点序号
|
||||
*/
|
||||
@ExcelProperty(value = "预置点序号")
|
||||
private Long presetIndex;
|
||||
|
||||
/**
|
||||
* 预置点
|
||||
*/
|
||||
@ExcelProperty(value = "预置点")
|
||||
private String presetName;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package org.dromara.monitoring.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.monitoring.domain.MonEquipmentList;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备列视图对象 mon_equipment_list
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = MonEquipmentList.class)
|
||||
public class MonEquipmentListVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@ExcelProperty(value = "设备序列号")
|
||||
private String deviceSerial;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称 ")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
@ExcelProperty(value = "设备型号 ")
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 设备在线状态,1-在线;0-离线
|
||||
*/
|
||||
@ExcelProperty(value = "设备在线状态,1-在线;0-离线")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 布撤防状态
|
||||
*/
|
||||
@ExcelProperty(value = "布撤防状态")
|
||||
private Long defence;
|
||||
|
||||
/**
|
||||
* 固件版本号
|
||||
*/
|
||||
@ExcelProperty(value = "固件版本号 ")
|
||||
private String deviceVersion;
|
||||
|
||||
/**
|
||||
* 用户添加时间
|
||||
*/
|
||||
@ExcelProperty(value = "用户添加时间")
|
||||
private Date addTime;
|
||||
|
||||
/**
|
||||
* 设备二级类目名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备二级类目名称")
|
||||
private String parentCategory;
|
||||
|
||||
/**
|
||||
* 设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大
|
||||
*/
|
||||
@ExcelProperty(value = "设备风险安全等级,0-安全;大于0,有风险,风险越高,值越大")
|
||||
private Long riskLevel;
|
||||
|
||||
/**
|
||||
* 设备IP地址
|
||||
*/
|
||||
@ExcelProperty(value = "设备IP地址")
|
||||
private String netAddress;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package org.dromara.monitoring.domain.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MonList {
|
||||
|
||||
private Object object;
|
||||
private Integer sum;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package org.dromara.monitoring.domain.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MonYsVo {
|
||||
|
||||
/**
|
||||
* 监控总数
|
||||
*/
|
||||
private Integer sumMon;
|
||||
|
||||
/**
|
||||
* 在线总数
|
||||
*/
|
||||
private Long sumOnLine;
|
||||
|
||||
/**
|
||||
* 离线总数
|
||||
*/
|
||||
private Long sumOffLine;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package org.dromara.monitoring.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.monitoring.domain.MonDevicePreset;
|
||||
import org.dromara.monitoring.domain.vo.MonDevicePresetVo;
|
||||
|
||||
/**
|
||||
* 摄像头预置位Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Mapper
|
||||
public interface MonDevicePresetMapper extends BaseMapperPlus<MonDevicePreset, MonDevicePresetVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.dromara.monitoring.mapper;
|
||||
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.monitoring.domain.MonEquipmentList;
|
||||
import org.dromara.monitoring.domain.vo.MonEquipmentListVo;
|
||||
|
||||
/**
|
||||
* 设备列Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
public interface MonEquipmentListMapper extends BaseMapperPlus<MonEquipmentList, MonEquipmentListVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package org.dromara.monitoring.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.monitoring.domain.MonEquipmentHistroy;
|
||||
import org.dromara.monitoring.domain.MonEquipmentList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MonitoringYsMapper {
|
||||
|
||||
|
||||
Integer setSunList();
|
||||
|
||||
void insettList(@Param("list") List<MonEquipmentList> tempList);
|
||||
|
||||
void insertHistroy(@Param("data") List<MonEquipmentHistroy> data);
|
||||
|
||||
@Delete("TRUNCATE TABLE mon_equipment_list")
|
||||
void delList();
|
||||
|
||||
List<MonEquipmentList> selDpList();
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package org.dromara.monitoring.monEnum;
|
||||
|
||||
|
||||
|
||||
public enum ListConstant {
|
||||
PAGESTART(0),
|
||||
pageSize(300);
|
||||
|
||||
private Integer constant;
|
||||
|
||||
ListConstant(Integer constant) {
|
||||
this.constant = constant;
|
||||
}
|
||||
|
||||
public Integer getConstant() {
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package org.dromara.monitoring.monEnum;
|
||||
|
||||
public enum QualityEnum {
|
||||
|
||||
FLUENCY("流畅", "0"),
|
||||
HIGHDEFINITION("高清", "1"),
|
||||
CIF("4CIF", "2"),
|
||||
CIFG("1080P", "3");
|
||||
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
private QualityEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package org.dromara.monitoring.monEnum;
|
||||
|
||||
|
||||
public enum YsPort {
|
||||
ON_OFF_LINE_TOPIC_TYP("设备在线状态类型","ys.onoffline"),
|
||||
GETTOKENURLBYPOST("获取token的url","https://open.ys7.com/api/lapp/token/get"),
|
||||
GETDEVICELISTURL("获取设备列表的url","https://open.ys7.com/api/lapp/device/list"),
|
||||
UPDATEDEVICENAMEURLBYPOST("修改设备名称的url","https://open.ys7.com/api/lapp/device/name/update"),
|
||||
ADDDEVICEPRESETURLBYPOST("添加设备预置点请求地址","https://open.ys7.com/api/lapp/device/preset/add"),
|
||||
MOVEDEVICEPRESETURLBYPOST("调用设备预置点请求地址","https://open.ys7.com/api/lapp/device/preset/move"),
|
||||
DELETEDEVICEPRESETURLBYPOST("删除设备预置点请求地址","https://open.ys7.com/api/lapp/device/preset/clear"),
|
||||
CAPTUREDEVICEURLBYPOST("设备拍照请求地址","https://open.ys7.com/api/lapp/device/capture"),
|
||||
DEVICESTORAGEMEDIUM ("设备存储介质格式化接口","https://open.ys7.com/api/v3/device/format/disk"),
|
||||
STORAGEMEDIUMSTATUS ("设备存储介质状态查询接口","https://open.ys7.com/api/v3/device/format/status");
|
||||
|
||||
|
||||
|
||||
// 成员变量
|
||||
private final String sitename; // 中文名称
|
||||
private final String site;
|
||||
|
||||
public String getSiteName() {
|
||||
return sitename;
|
||||
}
|
||||
|
||||
public String getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
|
||||
YsPort(String sitename, String site) {
|
||||
this.sitename = sitename;
|
||||
this.site = site;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package org.dromara.monitoring.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.monitoring.domain.bo.MonDevicePresetBo;
|
||||
import org.dromara.monitoring.domain.dto.DelYzd;
|
||||
import org.dromara.monitoring.domain.vo.MonDevicePresetVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 摄像头预置位Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
public interface IMonDevicePresetService {
|
||||
|
||||
/**
|
||||
* 查询摄像头预置位
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 摄像头预置位
|
||||
*/
|
||||
MonDevicePresetVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询摄像头预置位列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 摄像头预置位分页列表
|
||||
*/
|
||||
TableDataInfo<MonDevicePresetVo> queryPageList(MonDevicePresetBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的摄像头预置位列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 摄像头预置位列表
|
||||
*/
|
||||
List<MonDevicePresetVo> queryList(MonDevicePresetBo bo);
|
||||
|
||||
/**
|
||||
* 新增摄像头预置位
|
||||
*
|
||||
* @param bo 摄像头预置位
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(MonDevicePresetBo bo);
|
||||
|
||||
/**
|
||||
* 修改摄像头预置位
|
||||
*
|
||||
* @param bo 摄像头预置位
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(MonDevicePresetBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除摄像头预置位信息
|
||||
*
|
||||
* @param
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(List<DelYzd> yzd, Boolean isValid);
|
||||
|
||||
boolean invoking(List<DelYzd> yzd);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.monitoring.service;
|
||||
|
||||
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.monitoring.domain.bo.MonEquipmentListBo;
|
||||
import org.dromara.monitoring.domain.vo.MonEquipmentListVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备列Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
public interface IMonEquipmentListService {
|
||||
|
||||
/**
|
||||
* 查询设备列
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备列
|
||||
*/
|
||||
MonEquipmentListVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询设备列列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备列分页列表
|
||||
*/
|
||||
TableDataInfo<MonEquipmentListVo> queryPageList(MonEquipmentListBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备列列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备列列表
|
||||
*/
|
||||
List<MonEquipmentListVo> queryList(MonEquipmentListBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备列
|
||||
*
|
||||
* @param bo 设备列
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(MonEquipmentListBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备列
|
||||
*
|
||||
* @param bo 设备列
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(MonEquipmentListBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备列信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package org.dromara.monitoring.service;
|
||||
|
||||
import org.dromara.monitoring.domain.dto.DelYzd;
|
||||
import org.dromara.monitoring.domain.dto.MonitoringListDto;
|
||||
import org.dromara.monitoring.domain.vo.MonList;
|
||||
import org.dromara.monitoring.domain.vo.MonYsVo;
|
||||
|
||||
public interface MonitoringYsService {
|
||||
|
||||
|
||||
String getYsTokenService();
|
||||
|
||||
MonList getMonitoringList(MonitoringListDto dto);
|
||||
|
||||
MonYsVo getMonitoringDp();
|
||||
|
||||
String capturePho(DelYzd dto);
|
||||
|
||||
Void test();
|
||||
}
|
||||
@ -0,0 +1,206 @@
|
||||
package org.dromara.monitoring.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.monitoring.config.SnowFlakeUtil;
|
||||
import org.dromara.monitoring.domain.MonDevicePreset;
|
||||
import org.dromara.monitoring.domain.bo.MonDevicePresetBo;
|
||||
import org.dromara.monitoring.domain.dto.DelYzd;
|
||||
import org.dromara.monitoring.domain.vo.MonDevicePresetVo;
|
||||
import org.dromara.monitoring.mapper.MonDevicePresetMapper;
|
||||
import org.dromara.monitoring.monEnum.YsPort;
|
||||
import org.dromara.monitoring.service.IMonDevicePresetService;
|
||||
import org.dromara.monitoring.service.MonitoringYsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 摄像头预置位Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MonDevicePresetServiceImpl implements IMonDevicePresetService {
|
||||
|
||||
private final MonDevicePresetMapper baseMapper;
|
||||
|
||||
private final MonitoringYsService monitoringYsService;
|
||||
|
||||
/**
|
||||
* 查询摄像头预置位
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 摄像头预置位
|
||||
*/
|
||||
@Override
|
||||
public MonDevicePresetVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询摄像头预置位列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 摄像头预置位分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<MonDevicePresetVo> queryPageList(MonDevicePresetBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<MonDevicePreset> lqw = buildQueryWrapper(bo);
|
||||
Page<MonDevicePresetVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的摄像头预置位列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 摄像头预置位列表
|
||||
*/
|
||||
@Override
|
||||
public List<MonDevicePresetVo> queryList(MonDevicePresetBo bo) {
|
||||
LambdaQueryWrapper<MonDevicePreset> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MonDevicePreset> buildQueryWrapper(MonDevicePresetBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<MonDevicePreset> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(MonDevicePreset::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceSerial()), MonDevicePreset::getDeviceSerial, bo.getDeviceSerial());
|
||||
lqw.eq(bo.getChannelNo() != null, MonDevicePreset::getChannelNo, bo.getChannelNo());
|
||||
lqw.eq(bo.getPresetIndex() != null, MonDevicePreset::getPresetIndex, bo.getPresetIndex());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getPresetName()), MonDevicePreset::getPresetName, bo.getPresetName());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增摄像头预置位
|
||||
*
|
||||
* @param bo 摄像头预置位
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(MonDevicePresetBo bo) {
|
||||
MonDevicePreset add = MapstructUtils.convert(bo, MonDevicePreset.class);
|
||||
validEntityBeforeSave(add);
|
||||
String jsonStr = HttpRequest
|
||||
.post(YsPort.ADDDEVICEPRESETURLBYPOST.getSite()).
|
||||
form("accessToken",monitoringYsService.getYsTokenService())
|
||||
.form("deviceSerial", add.getDeviceSerial())
|
||||
.form("channelNo", add.getChannelNo())
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim());
|
||||
|
||||
Map page1 = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class);
|
||||
|
||||
|
||||
add.setPresetIndex(Integer.parseInt(page1.get("index").toString()));
|
||||
add.setId(SnowFlakeUtil.getID());
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改摄像头预置位
|
||||
*
|
||||
* @param bo 摄像头预置位
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(MonDevicePresetBo bo) {
|
||||
MonDevicePreset update = MapstructUtils.convert(bo, MonDevicePreset.class);
|
||||
String jsonStr = HttpRequest
|
||||
.post(YsPort.ADDDEVICEPRESETURLBYPOST.getSite()).
|
||||
form("accessToken",monitoringYsService.getYsTokenService())
|
||||
.form("deviceSerial", update.getDeviceSerial())
|
||||
.form("channelNo", update.getChannelNo())
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim());
|
||||
|
||||
Map page1 = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class);
|
||||
|
||||
|
||||
update.setPresetIndex(Integer.parseInt(page1.get("index").toString()));
|
||||
|
||||
|
||||
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(MonDevicePreset entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除摄像头预置位信息
|
||||
*
|
||||
* @param
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(List<DelYzd> yzd, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (yzd.size() >0){
|
||||
yzd.stream().forEach(temp ->{
|
||||
HttpRequest
|
||||
.post(YsPort.DELETEDEVICEPRESETURLBYPOST.getSite()).
|
||||
form("accessToken",monitoringYsService.getYsTokenService())
|
||||
.form("deviceSerial", temp.getDeviceSerial())
|
||||
.form("channelNo", temp.getChannelNo())
|
||||
.form("index", temp.getPresetIndex())
|
||||
.execute().body();
|
||||
});
|
||||
}
|
||||
}
|
||||
Collection<Long> collect = yzd.stream().map(temp -> {
|
||||
return temp.getId();
|
||||
}).collect(Collectors.toList());
|
||||
return baseMapper.deleteByIds(collect) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean invoking(List<DelYzd> yzd) {
|
||||
try {
|
||||
yzd.stream().forEach(temp ->{{
|
||||
HttpRequest
|
||||
.post(YsPort.MOVEDEVICEPRESETURLBYPOST.getSite()).
|
||||
form("accessToken",monitoringYsService.getYsTokenService())
|
||||
.form("deviceSerial", temp.getDeviceSerial())
|
||||
.form("channelNo", temp.getChannelNo())
|
||||
.form("index", temp.getPresetIndex())
|
||||
.execute().body();
|
||||
}});
|
||||
}catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package org.dromara.monitoring.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.monitoring.domain.MonEquipmentList;
|
||||
import org.dromara.monitoring.domain.bo.MonEquipmentListBo;
|
||||
import org.dromara.monitoring.domain.vo.MonEquipmentListVo;
|
||||
import org.dromara.monitoring.mapper.MonEquipmentListMapper;
|
||||
import org.dromara.monitoring.service.IMonEquipmentListService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备列Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-25
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MonEquipmentListServiceImpl implements IMonEquipmentListService {
|
||||
|
||||
private final MonEquipmentListMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备列
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备列
|
||||
*/
|
||||
@Override
|
||||
public MonEquipmentListVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备列列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备列分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<MonEquipmentListVo> queryPageList(MonEquipmentListBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<MonEquipmentList> lqw = buildQueryWrapper(bo);
|
||||
Page<MonEquipmentListVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备列列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备列列表
|
||||
*/
|
||||
@Override
|
||||
public List<MonEquipmentListVo> queryList(MonEquipmentListBo bo) {
|
||||
LambdaQueryWrapper<MonEquipmentList> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MonEquipmentList> buildQueryWrapper(MonEquipmentListBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<MonEquipmentList> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(MonEquipmentList::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceSerial()), MonEquipmentList::getDeviceSerial, bo.getDeviceSerial());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), MonEquipmentList::getDeviceName, bo.getDeviceName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceType()), MonEquipmentList::getDeviceType, bo.getDeviceType());
|
||||
lqw.eq(bo.getStatus() != null, MonEquipmentList::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getDefence() != null, MonEquipmentList::getDefence, bo.getDefence());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceVersion()), MonEquipmentList::getDeviceVersion, bo.getDeviceVersion());
|
||||
lqw.eq(bo.getAddTime() != null, MonEquipmentList::getAddTime, bo.getAddTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getParentCategory()), MonEquipmentList::getParentCategory, bo.getParentCategory());
|
||||
lqw.eq(bo.getRiskLevel() != null, MonEquipmentList::getRiskLevel, bo.getRiskLevel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getNetAddress()), MonEquipmentList::getNetAddress, bo.getNetAddress());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备列
|
||||
*
|
||||
* @param bo 设备列
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(MonEquipmentListBo bo) {
|
||||
MonEquipmentList add = MapstructUtils.convert(bo, MonEquipmentList.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备列
|
||||
*
|
||||
* @param bo 设备列
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(MonEquipmentListBo bo) {
|
||||
MonEquipmentList update = MapstructUtils.convert(bo, MonEquipmentList.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(MonEquipmentList entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备列信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,267 @@
|
||||
package org.dromara.monitoring.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.monitoring.config.SnowFlakeUtil;
|
||||
import org.dromara.monitoring.config.YsDto;
|
||||
import org.dromara.monitoring.domain.MonEquipmentHistroy;
|
||||
import org.dromara.monitoring.domain.MonEquipmentList;
|
||||
import org.dromara.monitoring.domain.dto.DelYzd;
|
||||
import org.dromara.monitoring.domain.dto.MonitoringListDto;
|
||||
import org.dromara.monitoring.domain.vo.MonList;
|
||||
import org.dromara.monitoring.domain.vo.MonYsVo;
|
||||
import org.dromara.monitoring.mapper.MonitoringYsMapper;
|
||||
import org.dromara.monitoring.monEnum.ListConstant;
|
||||
import org.dromara.monitoring.monEnum.QualityEnum;
|
||||
import org.dromara.monitoring.monEnum.YsPort;
|
||||
import org.dromara.monitoring.service.MonitoringYsService;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MonitoringYsServiceImpl implements MonitoringYsService {
|
||||
|
||||
|
||||
private final YsDto ysDto;
|
||||
|
||||
private final MonitoringYsMapper monitoringYsMapper;
|
||||
|
||||
private final String GETDEVICELISTURL = "https://open.ys7.com/api/lapp/device/list";
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "opsMonToken#432000s")
|
||||
public String getYsTokenService() {
|
||||
|
||||
String jsonStr = HttpRequest.post(YsPort.GETTOKENURLBYPOST.getSite()).
|
||||
form("appKey", ysDto.getAppKey())
|
||||
.form("appSecret", ysDto.getAppSecret())
|
||||
.execute().body();
|
||||
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim());
|
||||
String accessToken = jsonObject.getJSONObject("data").getStr("accessToken");
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonList getMonitoringList(MonitoringListDto dto) {
|
||||
|
||||
MonList monList = new MonList();
|
||||
|
||||
if (StringUtils.isEmpty(dto.getPageSize().toString())){
|
||||
dto.setPageSize(ListConstant.pageSize.getConstant());
|
||||
dto.setPageStart(ListConstant.PAGESTART.getConstant());
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
String jsonStr = HttpRequest
|
||||
.post(YsPort.GETDEVICELISTURL.getSite()).
|
||||
form("accessToken",getYsTokenService())
|
||||
.form("pageStart",dto.getPageStart() - 1)
|
||||
.form("pageSize",dto.getPageSize())
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(jsonStr.trim());
|
||||
List<MonEquipmentList> data = (List<MonEquipmentList>)jsonObject.get("data");
|
||||
|
||||
|
||||
Map page1 = JSONUtil.parseObj(jsonObject.get("page")).toBean(Map.class);
|
||||
monList.setSum(Integer.parseInt(page1.get("total").toString()));
|
||||
|
||||
|
||||
if(dto.getPageSize() != ListConstant.pageSize.getConstant()&& dto.getIsflow()) {
|
||||
|
||||
List<MonEquipmentHistroy> monEquipmentHistroys = new ArrayList<MonEquipmentHistroy>();
|
||||
data = JSONUtil.toList(data.toString(), MonEquipmentList.class);
|
||||
|
||||
data.stream().forEach(item -> {
|
||||
MonEquipmentHistroy monEquipmentHistroy = new MonEquipmentHistroy();
|
||||
monEquipmentHistroy.setId(SnowFlakeUtil.getID());
|
||||
monEquipmentHistroy.setDeviceSerial(item.getDeviceSerial());
|
||||
monEquipmentHistroy.setDeviceName(item.getDeviceName());
|
||||
monEquipmentHistroy.setDeviceType(item.getDeviceType());
|
||||
monEquipmentHistroy.setUserId(LoginHelper.getUserId());
|
||||
monEquipmentHistroy.setDeptId(LoginHelper.getDeptId());
|
||||
monEquipmentHistroy.setProjectId(dto.getProjectId());
|
||||
monEquipmentHistroy.setCreateTime(LocalDateTime.now());
|
||||
monEquipmentHistroys.add(monEquipmentHistroy);
|
||||
});
|
||||
|
||||
// 将返回的数据列为点击数据
|
||||
if (monEquipmentHistroys.size() > 0) {
|
||||
monitoringYsMapper.insertHistroy(monEquipmentHistroys);
|
||||
}
|
||||
}
|
||||
monList.setObject(data);
|
||||
|
||||
// 查询所有并将数据存入数据库 :先判断数据库里是否有数据
|
||||
Integer sum = monitoringYsMapper.setSunList();
|
||||
|
||||
|
||||
|
||||
|
||||
if(sum != Integer.parseInt(page1.get("total").toString())){
|
||||
monitoringYsMapper.delList();
|
||||
insertMonitoring(Integer.parseInt(page1.get("total").toString()),1);
|
||||
}
|
||||
return monList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonYsVo getMonitoringDp() {
|
||||
List<MonEquipmentList> list = monitoringYsMapper.selDpList();
|
||||
MonYsVo monYsVo = new MonYsVo();
|
||||
if (list.size() > 0){
|
||||
monYsVo.setSumMon(list.size());
|
||||
long count = list.stream().filter(item -> item.getStatus() == 1).count();
|
||||
monYsVo.setSumOnLine(count);
|
||||
monYsVo.setSumOffLine(list.size() - count);
|
||||
}
|
||||
|
||||
return monYsVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String capturePho(DelYzd dto) {
|
||||
String temp = HttpRequest
|
||||
.post(YsPort.CAPTUREDEVICEURLBYPOST.getSite()).
|
||||
form("accessToken",getYsTokenService())
|
||||
.form("deviceSerial",dto.getDeviceSerial())
|
||||
.form("channelNo",dto.getChannelNo())
|
||||
.form("quality", QualityEnum.HIGHDEFINITION.getValue())
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(temp.trim());
|
||||
Map bean = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class);
|
||||
/**Todo 后期照片需要对接ai识别 */
|
||||
return bean.get("picUrl").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void test() {
|
||||
// 查询所有的设备
|
||||
List<MonEquipmentList> monEquipmentList = monitoringYsMapper.selDpList();
|
||||
|
||||
monEquipmentList.forEach(item -> {
|
||||
serialNumber(item);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//格式化存储
|
||||
public void serialNumber(MonEquipmentList equipmentList){
|
||||
|
||||
ArrayList<String> temp = selSTORAGEMEDIUMSTATUS(equipmentList.getDeviceSerial());
|
||||
if (temp.size() == 0)return;
|
||||
|
||||
temp.forEach(s -> {
|
||||
HttpRequest
|
||||
.put(YsPort.DEVICESTORAGEMEDIUM.getSite())
|
||||
.header("accessToken",getYsTokenService())
|
||||
.form("deviceSerial",equipmentList.getDeviceSerial())
|
||||
.form("diskIndex",s)
|
||||
.execute().body();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询存储状态
|
||||
* @param deviceSerial
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<String> selSTORAGEMEDIUMSTATUS(String deviceSerial){
|
||||
|
||||
ArrayList<String> res = new ArrayList<>();
|
||||
String body = HttpRequest
|
||||
.get(YsPort.STORAGEMEDIUMSTATUS.getSite())
|
||||
.header("accessToken", getYsTokenService())
|
||||
.form("deviceSerial", deviceSerial)
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONUtil.parseObj(body.trim());
|
||||
|
||||
|
||||
|
||||
|
||||
Map bean = JSONUtil.parseObj(jsonObject.get("data")).toBean(Map.class);
|
||||
|
||||
if (bean.get("storageStatus") == null){return res;}
|
||||
|
||||
JSONArray objects = JSONUtil.parseArray( bean.get("storageStatus").toString());
|
||||
|
||||
if (objects != null && objects.size() > 0){
|
||||
objects.stream().forEach(temp ->{
|
||||
Map temoMap = JSONUtil.parseObj(temp.toString()).toBean(Map.class);
|
||||
res.add(temoMap.get("index").toString());
|
||||
});
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void insertMonitoring(Integer sum,Integer start){
|
||||
if (sum > 50){
|
||||
String temp = HttpRequest
|
||||
.post(YsPort.GETDEVICELISTURL.getSite()).
|
||||
form("accessToken",getYsTokenService())
|
||||
.form("pageStart",start - 1)
|
||||
.form("pageSize",50)
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonTemp = JSONUtil.parseObj(temp.trim());
|
||||
List<MonEquipmentList> tempList = (List<MonEquipmentList>)jsonTemp.get("data");
|
||||
tempList = JSONUtil.toList(tempList.toString(), MonEquipmentList.class);
|
||||
List<MonEquipmentList> collect = tempList.stream().map(monEquipmentList -> {
|
||||
|
||||
monEquipmentList.setId(SnowFlakeUtil.getID());
|
||||
return monEquipmentList;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
monitoringYsMapper.insettList(collect);
|
||||
start++;
|
||||
sum = sum - 50;
|
||||
insertMonitoring(sum,start);
|
||||
}else {
|
||||
String temp = HttpRequest
|
||||
.post(YsPort.GETDEVICELISTURL.getSite()).
|
||||
form("accessToken",getYsTokenService())
|
||||
.form("pageStart",start - 1)
|
||||
.form("pageSize",sum)
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonTemp = JSONUtil.parseObj(temp.trim());
|
||||
List<MonEquipmentList> tempList = (List<MonEquipmentList>)jsonTemp.get("data");
|
||||
tempList = JSONUtil.toList(tempList.toString(), MonEquipmentList.class);
|
||||
List<MonEquipmentList> collect = tempList.stream().map(monEquipmentList -> {
|
||||
|
||||
monEquipmentList.setId(SnowFlakeUtil.getID());
|
||||
return monEquipmentList;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
monitoringYsMapper.insettList(collect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package org.dromara.personnel.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.personnel.domain.dto.OpsBeipinBeijianDto;
|
||||
import org.dromara.personnel.domain.vo.OpsBeipinBeijianCountVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.personnel.domain.vo.OpsBeipinBeijianVo;
|
||||
import org.dromara.personnel.domain.bo.OpsBeipinBeijianBo;
|
||||
import org.dromara.personnel.service.IOpsBeipinBeijianService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 运维-物资-备品配件
|
||||
* 前端访问路由地址为:/personnel/beipinBeijian
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-24
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/beipinBeijian")
|
||||
public class OpsBeipinBeijianController extends BaseController {
|
||||
|
||||
private final IOpsBeipinBeijianService opsBeipinBeijianService;
|
||||
|
||||
/**
|
||||
* 查询运维-物资-备品配件列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OpsBeipinBeijianDto> list(OpsBeipinBeijianBo bo, PageQuery pageQuery) {
|
||||
return opsBeipinBeijianService.getList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运维-物资-备品配件列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:list")
|
||||
@GetMapping("/getCount")
|
||||
public R<OpsBeipinBeijianCountVo> getCount(OpsBeipinBeijianBo bo) {
|
||||
return R.ok(opsBeipinBeijianService.getCount(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出运维-物资-备品配件列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:export")
|
||||
@Log(title = "运维-物资-备品配件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OpsBeipinBeijianBo bo, HttpServletResponse response) {
|
||||
List<OpsBeipinBeijianVo> list = opsBeipinBeijianService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "运维-物资-备品配件", OpsBeipinBeijianVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运维-物资-备品配件详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<OpsBeipinBeijianVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(opsBeipinBeijianService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维-物资-备品配件
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:add")
|
||||
@Log(title = "运维-物资-备品配件", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OpsBeipinBeijianBo bo) {
|
||||
return toAjax(opsBeipinBeijianService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维-物资-备品配件
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:edit")
|
||||
@Log(title = "运维-物资-备品配件", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsBeipinBeijianBo bo) {
|
||||
return toAjax(opsBeipinBeijianService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运维-物资-备品配件
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("personnel:beipinBeijian:remove")
|
||||
@Log(title = "运维-物资-备品配件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(opsBeipinBeijianService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user