Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -38,6 +38,11 @@
|
|||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-microservice</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.algorithm.api;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||||
|
import com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.ALGORITHM_BOOT, path = "/EquipmentDelivery", fallbackFactory = EquipmentFeignClientFallbackFactory.class,contextId = "EquipmentDelivery")
|
||||||
|
public interface EquipmentFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/queryEquipmentByndid")
|
||||||
|
HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid") String ndid);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.njcn.algorithm.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class EquipmentFeignClientFallbackFactory implements FallbackFactory<EquipmentFeignClient> {
|
||||||
|
@Override
|
||||||
|
public EquipmentFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
// exceptionEnum = UserEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new EquipmentFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(String ndid) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","通过ndid查询出厂设备异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.algorithm.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置数据模板表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsDevModelAddParm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置型号(字典数据)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "装置型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本号")
|
||||||
|
private String versionNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private Date versionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置模板文件路径
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "装置模板文件路径")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.njcn.algorithm.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置数据模板表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsDevModelAuditParm {
|
||||||
|
@NotNull(message="版本id不能为空!")
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 装置型号(字典数据)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "装置型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本号")
|
||||||
|
private String versionNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private Date versionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置模板文件路径
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "装置模板文件路径")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.njcn.algorithm.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/7 11:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 程序版本表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsDevModelQueryListParm {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置型号(字典数据)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "装置型号")
|
||||||
|
private String devType;
|
||||||
|
@ApiModelProperty(value = "版本号")
|
||||||
|
private String versionNo;
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private String versionStartDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private String versionendDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.njcn.algorithm.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/7 11:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 程序版本表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsDevModelQueryParm {
|
||||||
|
|
||||||
|
@NotNull(message="当前页不能为空!")
|
||||||
|
@Min(value = 1, message = "当前页不能为0")
|
||||||
|
@ApiModelProperty(value = "当前页",name = "currentPage",dataType ="Integer",required = true)
|
||||||
|
private Integer currentPage;
|
||||||
|
/**显示条数*/
|
||||||
|
@NotNull(message="显示条数不能为空!")
|
||||||
|
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||||
|
private Integer pageSize;
|
||||||
|
/**
|
||||||
|
* 装置型号(字典数据)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "装置型号")
|
||||||
|
private String devType;
|
||||||
|
@ApiModelProperty(value = "装置名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private String versionStartDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||||
|
private String versionendDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.njcn.algorithm.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 装置数据模板表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "cs_dev_model")
|
||||||
|
public class CsDevModelPO extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置型号(字典数据)
|
||||||
|
*/
|
||||||
|
@TableField(value = "dev_type")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@TableField(value = "version_no")
|
||||||
|
private String versionNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@TableField(value = "version_date")
|
||||||
|
private Date versionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置模板文件路径
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_path")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0:删除 1:正常)
|
||||||
|
*/
|
||||||
|
@TableField(value = "status")
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.njcn.algorithm.pojo.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置数据模板表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CsDevModelPageVO extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备型号(字典数据)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "设备型号")
|
||||||
|
private String devType;
|
||||||
|
@ApiModelProperty(value = "设备名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本号")
|
||||||
|
private String versionNo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "版本日期")
|
||||||
|
private LocalDate versionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置模板文件路径
|
||||||
|
*/
|
||||||
|
@TableField(value = "file_path")
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0:删除 1:正常)
|
||||||
|
*/
|
||||||
|
@TableField(value = "status")
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@@ -22,6 +22,8 @@ import java.time.LocalDate;
|
|||||||
@Data
|
@Data
|
||||||
public class CsEdDataVO extends BaseEntity {
|
public class CsEdDataVO extends BaseEntity {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置型号(字典数据)
|
* 装置型号(字典数据)
|
||||||
|
|||||||
@@ -101,44 +101,44 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- <plugin>-->
|
<plugin>
|
||||||
<!-- <groupId>com.spotify</groupId>-->
|
<groupId>com.spotify</groupId>
|
||||||
<!-- <artifactId>docker-maven-plugin</artifactId>-->
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<!-- <version>1.0.0</version>-->
|
<version>1.0.0</version>
|
||||||
<!-- <executions>-->
|
<executions>
|
||||||
<!-- <!–执行mvn package,即执行 mvn clean package docker:build–>-->
|
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||||
<!-- <execution>-->
|
<execution>
|
||||||
<!-- <id>build-image</id>-->
|
<id>build-image</id>
|
||||||
<!-- <phase>${docker.operate}</phase>-->
|
<phase>${docker.operate}</phase>
|
||||||
<!-- <goals>-->
|
<goals>
|
||||||
<!-- <goal>build</goal>-->
|
<goal>build</goal>
|
||||||
<!-- </goals>-->
|
</goals>
|
||||||
<!-- </execution>-->
|
</execution>
|
||||||
<!-- </executions>-->
|
</executions>
|
||||||
<!-- <configuration>-->
|
<configuration>
|
||||||
<!-- <!–<serverId>36dockerHarbor</serverId>–>-->
|
<!--<serverId>36dockerHarbor</serverId>-->
|
||||||
<!-- <registryUrl>http://${docker.repostory}</registryUrl>-->
|
<registryUrl>http://${docker.repostory}</registryUrl>
|
||||||
<!-- <!– 镜像名称 –>-->
|
<!-- 镜像名称 -->
|
||||||
<!-- <imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>-->
|
<imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>
|
||||||
<!-- <!– 指定标签 –>-->
|
<!-- 指定标签 -->
|
||||||
<!-- <imageTags>-->
|
<imageTags>
|
||||||
<!-- <imageTag>latest</imageTag>-->
|
<imageTag>latest</imageTag>
|
||||||
<!-- </imageTags>-->
|
</imageTags>
|
||||||
<!-- <!– 指定远程 Docker API地址 –>-->
|
<!-- 指定远程 Docker API地址 -->
|
||||||
<!-- <dockerHost>${docker.url}</dockerHost>-->
|
<dockerHost>${docker.url}</dockerHost>
|
||||||
<!-- <dockerDirectory>${basedir}/</dockerDirectory>-->
|
<dockerDirectory>${basedir}/</dockerDirectory>
|
||||||
<!-- <!– 复制 jar包到docker容器指定目录–>-->
|
<!-- 复制 jar包到docker容器指定目录-->
|
||||||
<!-- <resources>-->
|
<resources>
|
||||||
<!-- <resource>-->
|
<resource>
|
||||||
<!-- <targetPath>/ROOT</targetPath>-->
|
<targetPath>/ROOT</targetPath>
|
||||||
<!-- <!– 用于指定需要复制的根目录,${project.build.directory}表示target目录 –>-->
|
<!-- 用于指定需要复制的根目录,${project.build.directory}表示target目录 -->
|
||||||
<!-- <directory>${project.build.directory}</directory>-->
|
<directory>${project.build.directory}</directory>
|
||||||
<!-- <!– 用于指定需要复制的文件,${project.build.finalName}.jar就是打包后的target目录下的jar包名称 –>-->
|
<!-- 用于指定需要复制的文件,${project.build.finalName}.jar就是打包后的target目录下的jar包名称 -->
|
||||||
<!-- <include>${project.build.finalName}.jar</include>-->
|
<include>${project.build.finalName}.jar</include>
|
||||||
<!-- </resource>-->
|
</resource>
|
||||||
<!-- </resources>-->
|
</resources>
|
||||||
<!-- </configuration>-->
|
</configuration>
|
||||||
<!-- </plugin>-->
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.njcn.algorithm.controller.Equipment;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
|
||||||
|
import com.njcn.algorithm.pojo.param.CsDevModelAuditParm;
|
||||||
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
||||||
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryParm;
|
||||||
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
|
import com.njcn.algorithm.service.CsDevModelService;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/3/27 15:31【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/devmodel")
|
||||||
|
@Api(tags = "设备模板")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DevModelController extends BaseController {
|
||||||
|
|
||||||
|
private final CsDevModelService csDevModelService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addDevModel")
|
||||||
|
@ApiOperation("新增设备模板")
|
||||||
|
@ApiImplicitParam(name = "csDevModelAddParm", value = "新增设备模板参数", required = true)
|
||||||
|
public HttpResult<Boolean> addDevModel(@RequestBody @Validated CsDevModelAddParm csDevModelAddParm){
|
||||||
|
String methodDescribe = getMethodDescribe("addDevModel");
|
||||||
|
|
||||||
|
Boolean flag = csDevModelService.addDevModel (csDevModelAddParm);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/AuditDevModel")
|
||||||
|
@ApiOperation("更新/删除出厂设备")
|
||||||
|
@ApiImplicitParam(name = "csDevModelAuditParm", value = "更新/删除设备模板参数", required = true)
|
||||||
|
public HttpResult<Boolean> AuditDevModel(@RequestBody @Validated CsDevModelAuditParm csDevModelAuditParm ){
|
||||||
|
String methodDescribe = getMethodDescribe("AuditDevModel");
|
||||||
|
|
||||||
|
Boolean flag = csDevModelService.AuditDevModel(csDevModelAuditParm);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryDevModelPage")
|
||||||
|
@ApiOperation("设备模板分页查询")
|
||||||
|
@ApiImplicitParam(name = "csDevModelQueryParm", value = "设备模板查询参数", required = true)
|
||||||
|
public HttpResult<IPage<CsDevModelPageVO>> queryDevModelPage(@RequestBody @Validated CsDevModelQueryParm csDevModelQueryParm ){
|
||||||
|
String methodDescribe = getMethodDescribe("queryDevModelPage");
|
||||||
|
|
||||||
|
IPage<CsDevModelPageVO> page = csDevModelService.queryPage (csDevModelQueryParm);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryEquipmentByProject")
|
||||||
|
@ApiOperation("通过项目查询出厂设备")
|
||||||
|
@ApiImplicitParam(name = "csDevModelQueryListParm", value = "项目信息", required = true)
|
||||||
|
public HttpResult<List<CsDevModelPageVO>> queryEquipmentByProject(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm){
|
||||||
|
String methodDescribe = getMethodDescribe("queryEquipmentByProject");
|
||||||
|
|
||||||
|
List<CsDevModelPageVO> list = csDevModelService.queryList(csDevModelQueryListParm);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -59,19 +59,10 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @PostMapping("/queryEquipment")
|
|
||||||
// @ApiOperation("项目查询")
|
|
||||||
// @ApiImplicitParam(name = "appProjectQueryParm", value = "项目查询参数", required = true)
|
|
||||||
// public HttpResult<List<CsEquipmentDeliveryVO>> queryEquipment(@Validated @RequestBody AppProjectQueryParm appProjectQueryParm){
|
|
||||||
// String methodDescribe = getMethodDescribe("queryEquipment");
|
|
||||||
//
|
|
||||||
// List<CsEquipmentDeliveryVO> appProjectVOIPage = csEquipmentDeliveryService.queryEquipment (appProjectQueryParm);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appProjectVOIPage, methodDescribe);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryEquipmentByndid")
|
@PostMapping("/queryEquipmentByndid")
|
||||||
@ApiOperation("通过ndid查询出厂设备")
|
@ApiOperation("通过ndid查询出厂设备")
|
||||||
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
||||||
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.algorithm.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryListParm;
|
||||||
|
import com.njcn.algorithm.pojo.param.CsDevModelQueryParm;
|
||||||
|
import com.njcn.algorithm.pojo.po.CsDevModelPO;
|
||||||
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface CsDevModelMapper extends BaseMapper<CsDevModelPO> {
|
||||||
|
Page<CsDevModelPageVO> getPage(Page<CsDevModelPageVO> returnpage,@Param("csDevModelQueryParm") CsDevModelQueryParm csDevModelQueryParm);
|
||||||
|
|
||||||
|
List<CsDevModelPageVO> queryList(@Param("csDevModelQueryListParm")CsDevModelQueryListParm csDevModelQueryListParm);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.algorithm.mapper.CsDevModelMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsDevModelPO">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table cs_dev_model-->
|
||||||
|
<result column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="dev_type" jdbcType="VARCHAR" property="devType" />
|
||||||
|
<result column="version_no" jdbcType="VARCHAR" property="versionNo" />
|
||||||
|
<result column="version_date" jdbcType="TIMESTAMP" property="versionDate" />
|
||||||
|
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
|
||||||
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="status" jdbcType="BOOLEAN" property="status" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, dev_type, version_no, version_date, file_path, create_by, create_time, update_by,
|
||||||
|
update_time, `status`
|
||||||
|
</sql><select id="getPage" resultType="com.njcn.algorithm.pojo.vo.CsDevModelPageVO">
|
||||||
|
SELECT a.*,
|
||||||
|
b.code as devName
|
||||||
|
FROM cs_dev_model a
|
||||||
|
LEFT JOIN sys_dict_data b ON a.dev_type = b.id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
<if test="csDevModelQueryParm.versionStartDate != null and csDevModelQueryParm.versionStartDate != ''">
|
||||||
|
AND a.version_date >= #{csDevModelQueryParm.versionStartDate }
|
||||||
|
</if>
|
||||||
|
<if test="csDevModelQueryParm.versionendDate != null and csDevModelQueryParm.versionendDate != ''">
|
||||||
|
AND a.version_date <= #{csDevModelQueryParm.versionendDate }
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||||
|
AND b.CODE LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">
|
||||||
|
AND a.dev_type = #{csDevModelQueryParm.devType}
|
||||||
|
</if>
|
||||||
|
</select><select id="queryList" resultType="com.njcn.algorithm.pojo.vo.CsDevModelPageVO">
|
||||||
|
SELECT a.*,
|
||||||
|
b.code as devName
|
||||||
|
FROM cs_dev_model a
|
||||||
|
LEFT JOIN sys_dict_data b ON a.dev_type = b.id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
<if test="csDevModelQueryListParm.versionStartDate != null and csDevModelQueryListParm.versionStartDate != ''">
|
||||||
|
AND a.version_date >= #{csDevModelQueryListParm.versionStartDate }
|
||||||
|
</if>
|
||||||
|
<if test="csDevModelQueryListParm.versionendDate != null and csDevModelQueryListParm.versionendDate != ''">
|
||||||
|
AND a.version_date <= #{csDevModelQueryListParm.versionendDate }
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="csDevModelQueryListParm.versionNo != null and csDevModelQueryListParm.versionNo != ''">
|
||||||
|
AND a.version_no = #{csDevModelQueryListParm.versionNo}
|
||||||
|
</if>
|
||||||
|
<if test="csDevModelQueryListParm.devType != null and csDevModelQueryListParm.devType != ''">
|
||||||
|
AND a.dev_type = #{csDevModelQueryListParm.devType}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.njcn.algorithm.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.njcn.algorithm.pojo.param.*;
|
||||||
|
import com.njcn.algorithm.pojo.po.CsDevModelPO;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface CsDevModelService extends IService<CsDevModelPO>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: addDevModel
|
||||||
|
* @Param: [csDevModelAddParm]
|
||||||
|
* @return: java.lang.Boolean
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2023/4/10
|
||||||
|
*/
|
||||||
|
Boolean addDevModel(CsDevModelAddParm csDevModelAddParm);
|
||||||
|
/**
|
||||||
|
* @Description: AuditDevModel
|
||||||
|
* @Param: [csDevModelAuditParm]
|
||||||
|
* @return: java.lang.Boolean
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2023/4/10
|
||||||
|
*/
|
||||||
|
Boolean AuditDevModel(CsDevModelAuditParm csDevModelAuditParm);
|
||||||
|
/**
|
||||||
|
* @Description: 设备模板
|
||||||
|
* @Param: [csDevModelQueryParm]
|
||||||
|
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.njcn.algorithm.pojo.vo.CsDevModelPageVO>
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2023/4/10
|
||||||
|
*/
|
||||||
|
IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm);
|
||||||
|
/**
|
||||||
|
* @Description: queryList
|
||||||
|
* @Param: [projectEquipmentQueryParm]
|
||||||
|
* @return: java.util.List<com.njcn.algorithm.pojo.vo.CsDevModelPageVO>
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2023/4/10
|
||||||
|
* @param projectEquipmentQueryParm
|
||||||
|
*/
|
||||||
|
List<CsDevModelPageVO> queryList(CsDevModelQueryListParm projectEquipmentQueryParm);
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.njcn.algorithm.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.algorithm.mapper.CsDevModelMapper;
|
||||||
|
import com.njcn.algorithm.pojo.param.*;
|
||||||
|
import com.njcn.algorithm.pojo.po.CsDevModelPO;
|
||||||
|
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
|
||||||
|
import com.njcn.algorithm.service.CsDevModelService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/4/10 11:28【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevModelPO> implements CsDevModelService{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
||||||
|
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||||
|
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
|
||||||
|
csDevModelPO.setStatus ("1");
|
||||||
|
boolean save = this.save (csDevModelPO);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean AuditDevModel(CsDevModelAuditParm csDevModelAuditParm) {
|
||||||
|
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||||
|
BeanUtils.copyProperties (csDevModelAuditParm, csDevModelPO);
|
||||||
|
boolean b = this.updateById (csDevModelPO);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
|
||||||
|
Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getCurrentPage ( ), csDevModelQueryParm.getPageSize ( ));
|
||||||
|
|
||||||
|
returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm);
|
||||||
|
return returnpage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsDevModelPageVO> queryList(CsDevModelQueryListParm csDevModelQueryListParm) {
|
||||||
|
List<CsDevModelPageVO> list = this.getBaseMapper ().queryList(csDevModelQueryListParm);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ public interface ServerInfo {
|
|||||||
String QUALITY = "quality-boot";
|
String QUALITY = "quality-boot";
|
||||||
String PROCESS = "process-boot";
|
String PROCESS = "process-boot";
|
||||||
String PREPARE_BOOT = "prepare-boot";
|
String PREPARE_BOOT = "prepare-boot";
|
||||||
|
String ALGORITHM_BOOT = "algorithm-boot";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,4 +72,6 @@ public class RunManageParam extends BaseParam implements Serializable {
|
|||||||
@ApiModelProperty(name = "runFlag", value = "终端状态")
|
@ApiModelProperty(name = "runFlag", value = "终端状态")
|
||||||
private List<Integer> runFlag;
|
private List<Integer> runFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "searchValue", value = "篩選數據")
|
||||||
|
private String searchValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public class RunTimeVO implements Serializable {
|
|||||||
@ApiModelProperty(name = "loginTime",value = "投运时间")
|
@ApiModelProperty(name = "loginTime",value = "投运时间")
|
||||||
private String loginTime;
|
private String loginTime;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(name = "devType",value = "终端型号")
|
@ApiModelProperty(name = "devType",value = "终端型号")
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.njcn.device.pq.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserScaleVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 月份
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("月份")
|
||||||
|
private String timeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计增量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("累计增量")
|
||||||
|
private Integer incrementNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当月增量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("当月增量")
|
||||||
|
private Integer monthIncrementNum;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.njcn.device.pq.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.device.pq.pojo.po.Device;
|
import com.njcn.device.pq.pojo.po.Device;
|
||||||
|
import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
|
||||||
import com.njcn.device.pq.pojo.vo.RunManageVO;
|
import com.njcn.device.pq.pojo.vo.RunManageVO;
|
||||||
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -36,24 +37,30 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
* 获取监测点台账信息
|
* 获取监测点台账信息
|
||||||
* @param list 监测点集合
|
* @param list 监测点集合
|
||||||
* @param comFlag 状态
|
* @param comFlag 状态
|
||||||
* @param runFlag 状态
|
* @param searchValue
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
List<RunManageVO> getRunManageList(@Param("list") List<String> list, @Param("comFlag")List<Integer> comFlag, @Param("runFlag")List<Integer> runFlag);
|
List<RunManageVO> getRunManageList(@Param("list") List<String> list,
|
||||||
|
@Param("comFlag") List<Integer> comFlag,
|
||||||
|
@Param("searchValue") String searchValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取监测点台账信息
|
* 获取监测点台账信息
|
||||||
* @param list 终端集合
|
* @param list 终端集合
|
||||||
* @param comFlag 状态
|
* @param comFlag 状态
|
||||||
* @param runFlag 状态
|
* @param runFlag 状态
|
||||||
|
* @param manufacturer
|
||||||
|
* @param searchValue
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
List<RunTimeVO> getRunManageDevList(@Param("list") List<String> list, @Param("comFlag")List<Integer> comFlag, @Param("runFlag")List<Integer> runFlag);
|
List<RunTimeVO> getRunManageDevList(@Param("list") List<String> list,
|
||||||
|
@Param("comFlag") List<Integer> comFlag,
|
||||||
|
@Param("runFlag") List<Integer> runFlag,
|
||||||
|
@Param("manufacturers") List<String> manufacturer,
|
||||||
|
@Param("searchValue") String searchValue);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定等级的装置
|
List<LineInfluxDbOnlineVO> getOnlineEvaluate(@Param("list") List<String> devIndexes,
|
||||||
* @author cdf
|
@Param("begin") String searchBeginTime,
|
||||||
* @date 2023/2/10
|
@Param("end") String searchEndTime);
|
||||||
*/
|
|
||||||
List<String> getDevByGrade(@Param("devId")List<String> devIds,@Param("lineGrade") String lineGrade);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,72 +18,71 @@
|
|||||||
|
|
||||||
<select id="getRunManageList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
<select id="getRunManageList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
||||||
SELECT
|
SELECT
|
||||||
linedetail.Num AS id,
|
linedetail.Num AS id,
|
||||||
line.NAME AS lineName,
|
line.NAME AS lineName,
|
||||||
area.NAME AS areaName,
|
area.NAME AS areaName,
|
||||||
gd.NAME AS gdName,
|
gd.NAME AS gdName,
|
||||||
sub.NAME AS bdName,
|
sub.NAME AS bdName,
|
||||||
scaleId.Name as scale,
|
scaleId.Name as scale,
|
||||||
manufacturerId.name as manufacturer,
|
manufacturerId.name as manufacturer,
|
||||||
dev.name as devName,
|
dev.name as devName,
|
||||||
device.IP as ip,
|
device.IP as ip,
|
||||||
case device.Run_Flag when 0 then "投运"
|
case device.Run_Flag when 0 then "投运"
|
||||||
when 1 then "热备用"
|
when 1 then "热备用"
|
||||||
when 2 then "停运"
|
when 2 then "停运"
|
||||||
end as runFlag,
|
end as runFlag,
|
||||||
case device.Com_Flag when 0 then "中断"
|
case device.Com_Flag when 0 then "中断"
|
||||||
when 1 then "正常"
|
when 1 then "正常"
|
||||||
end as comFlag,
|
end as comFlag,
|
||||||
loadtypeId.Name as loadType,
|
loadtypeId.Name as loadType,
|
||||||
businesstypeId.name as businessType,
|
businesstypeId.name as businessType,
|
||||||
IFNULL(linedetail.Obj_Name,"/") as objName,
|
IFNULL(linedetail.Obj_Name,"/") as objName,
|
||||||
case linedetail.PT_Type when 0 then "星型接线"
|
case linedetail.PT_Type when 0 then "星型接线"
|
||||||
when 1 then "三角型接线"
|
when 1 then "三角型接线"
|
||||||
when 2 then "开口三角型接线"
|
when 2 then "开口三角型接线"
|
||||||
end as ptType,
|
end as ptType,
|
||||||
CONCAT(linedetail.PT1,"/", linedetail.PT2) as pt,
|
CONCAT(linedetail.PT1,"/", linedetail.PT2) as pt,
|
||||||
CONCAT(linedetail.CT1,"/", linedetail.CT2) as ct,
|
CONCAT(linedetail.CT1,"/", linedetail.CT2) as ct,
|
||||||
linedetail.Standard_Capacity as standardCapacity,
|
linedetail.Standard_Capacity as standardCapacity,
|
||||||
linedetail.Short_Capacity as shortCapacity,
|
linedetail.Short_Capacity as shortCapacity,
|
||||||
linedetail.Dev_Capacity as devCapacity,
|
linedetail.Dev_Capacity as devCapacity,
|
||||||
linedetail.Deal_Capacity as dealCapacity,
|
linedetail.Deal_Capacity as dealCapacity,
|
||||||
over.Freq_Dev as freqDev,
|
over.Freq_Dev as freqDev,
|
||||||
over.Voltage_Dev as voltageDev,
|
over.Voltage_Dev as voltageDev,
|
||||||
over.Uvoltage_Dev as uvoltageDev,
|
over.Uvoltage_Dev as uvoltageDev,
|
||||||
over.Ubalance as ubalance,
|
over.Ubalance as ubalance,
|
||||||
over.I_Neg as iNeg,
|
over.I_Neg as iNeg,
|
||||||
over.Flicker as flicker,
|
over.Flicker as flicker,
|
||||||
over.Uaberrance as uaberrance,
|
over.Uaberrance as uaberrance,
|
||||||
over.Uharm_3 as oddHarm,
|
over.Uharm_3 as oddHarm,
|
||||||
over.Uharm_2 as evenHarm,
|
over.Uharm_2 as evenHarm,
|
||||||
over.Iharm_2 as iharm2,
|
over.Iharm_2 as iharm2,
|
||||||
over.Iharm_3 as iharm3,
|
over.Iharm_3 as iharm3,
|
||||||
over.Iharm_4 as iharm4,
|
over.Iharm_4 as iharm4,
|
||||||
over.Iharm_5 as iharm5,
|
over.Iharm_5 as iharm5,
|
||||||
over.Iharm_6 as iharm6,
|
over.Iharm_6 as iharm6,
|
||||||
over.Iharm_7 as iharm7,
|
over.Iharm_7 as iharm7,
|
||||||
over.Iharm_8 as iharm8,
|
over.Iharm_8 as iharm8,
|
||||||
over.Iharm_9 as iharm9,
|
over.Iharm_9 as iharm9,
|
||||||
over.Iharm_10 as iharm10,
|
over.Iharm_10 as iharm10,
|
||||||
over.Iharm_11 as iharm11,
|
over.Iharm_11 as iharm11,
|
||||||
over.Iharm_12 as iharm12,
|
over.Iharm_12 as iharm12,
|
||||||
over.Iharm_13 as iharm13,
|
over.Iharm_13 as iharm13,
|
||||||
over.Iharm_14 as iharm14,
|
over.Iharm_14 as iharm14,
|
||||||
over.Iharm_15 as iharm15,
|
over.Iharm_15 as iharm15,
|
||||||
over.Iharm_16 as iharm16,
|
over.Iharm_16 as iharm16,
|
||||||
over.Iharm_17 as iharm17,
|
over.Iharm_17 as iharm17,
|
||||||
over.Iharm_18 as iharm18,
|
over.Iharm_18 as iharm18,
|
||||||
over.Iharm_19 as iharm19,
|
over.Iharm_19 as iharm19,
|
||||||
over.Iharm_20 as iharm20,
|
over.Iharm_20 as iharm20,
|
||||||
over.Iharm_21 as iharm21,
|
over.Iharm_21 as iharm21,
|
||||||
over.Iharm_22 as iharm22,
|
over.Iharm_22 as iharm22,
|
||||||
over.Iharm_23 as iharm23,
|
over.Iharm_23 as iharm23,
|
||||||
over.Iharm_24 as iharm24,
|
over.Iharm_24 as iharm24,
|
||||||
over.Iharm_25 as iharm25,
|
over.Iharm_25 as iharm25,
|
||||||
over.InUharm_1 as inUharm,
|
over.InUharm_1 as inUharm,
|
||||||
over.InUharm_16 as inUharm16
|
over.InUharm_16 as inUharm16
|
||||||
FROM
|
FROM pq_line line
|
||||||
pq_line line
|
|
||||||
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||||
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||||
@@ -102,20 +101,19 @@
|
|||||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="runFlag == '' and type !=null">
|
<if test="comFlag.size()!=0">
|
||||||
and device.Run_Flag in
|
|
||||||
<foreach item="item1" collection="runFlag" open="(" separator="," close=")">
|
|
||||||
#{item1}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="comFlag == '' and type !=null">
|
|
||||||
and device.Com_Flag in
|
and device.Com_Flag in
|
||||||
<foreach item="item2" collection="comFlag" open="(" separator="," close=")">
|
<foreach item="item2" collection="comFlag" open="(" separator="," close=")">
|
||||||
#{item2}
|
#{item2}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
<if test="searchValue != '' and searchValue != null ">
|
||||||
areaId.NAME
|
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||||
|
AND sub.NAME LIKE #{searchValueLike}
|
||||||
|
OR dev.name LIKE #{searchValueLike}
|
||||||
|
OR line.NAME LIKE #{searchValueLike}
|
||||||
|
</if>
|
||||||
|
ORDER BY areaId.NAME
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
||||||
@@ -160,19 +158,46 @@
|
|||||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="runFlag == '' and runFlag !=null">
|
<if test="runFlag.size()!=0">
|
||||||
and device.Run_Flag in
|
and device.Run_Flag in
|
||||||
<foreach item="item1" collection="runFlag" open="(" separator="," close=")">
|
<foreach item="item1" collection="runFlag" separator="," open="(" close=")">
|
||||||
#{item1}
|
#{item1}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="comFlag == '' and comFlag !=null">
|
<if test="comFlag.size()!=0">
|
||||||
and device.Com_Flag in
|
and device.Com_Flag in
|
||||||
<foreach item="item2" collection="comFlag" open="(" separator="," close=")">
|
<foreach item="item2" collection="comFlag" separator="," open="(" close=")">
|
||||||
#{item2}
|
#{item2}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="manufacturers.size()!=0">
|
||||||
|
and device.Manufacturer in
|
||||||
|
<foreach collection="manufacturers" item="item3" separator="," open="(" close=")">
|
||||||
|
#{item3}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="searchValue != '' and searchValue != null ">
|
||||||
|
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||||
|
AND sub.NAME LIKE #{searchValueLike}
|
||||||
|
OR dev.NAME LIKE #{searchValueLike}
|
||||||
|
OR devT.Name LIKE #{searchValueLike}
|
||||||
|
OR device.IP LIKE #{searchValueLike}
|
||||||
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
areaId.NAME
|
areaId.NAME
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getOnlineEvaluate" resultType="com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO">
|
||||||
|
SELECT
|
||||||
|
SUM(r.online_min) / (SUM(r.online_min)+SUM(r.offline_min)) AS onlineRate,
|
||||||
|
r.dev_index AS devIndex
|
||||||
|
FROM r_stat_onlinerate_d r
|
||||||
|
WHERE time_id BETWEEN #{begin} AND #{end}
|
||||||
|
<if test="list.size > 0">
|
||||||
|
AND r.dev_index IN
|
||||||
|
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
GROUP BY r.dev_index
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
|
|
||||||
private final LineDetailMapper lineDetailMapper;
|
private final LineDetailMapper lineDetailMapper;
|
||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||||
@@ -77,8 +75,8 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
||||||
List<String> lineIndexes = generalDeviceDTOList.stream().flatMap(list->list.getLineIndexes().stream()).collect(Collectors.toList());
|
List<String> lineIndexes = generalDeviceDTOList.stream().flatMap(list->list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
if (!CollectionUtils.isEmpty(lineIndexes)) {
|
if (!CollectionUtils.isEmpty(lineIndexes)) {
|
||||||
return deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag());
|
return deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),runManageParam.getSearchValue());
|
||||||
}else {
|
} else {
|
||||||
throw new BusinessException(CommonResponseEnum.FAIL);
|
throw new BusinessException(CommonResponseEnum.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,19 +91,22 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||||
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list->list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list->list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||||
DateFormat bf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat bf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
runManageParam.setSearchBeginTime(DateUtil.beginOfMonth(new Date()).toString(bf));
|
runManageParam.setSearchBeginTime(bf.format(DateUtil.beginOfDay(DateUtil.parse(runManageParam.getSearchBeginTime()))));
|
||||||
runManageParam.setSearchEndTime(DateUtil.endOfMonth(new Date()).toString(bf));
|
runManageParam.setSearchEndTime(bf.format(DateUtil.beginOfDay(DateUtil.parse(runManageParam.getSearchEndTime()))));
|
||||||
|
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||||
if(CollectionUtil.isNotEmpty(devIndexes)){
|
if(CollectionUtil.isNotEmpty(devIndexes)){
|
||||||
runManageDevList = deviceMapper.getRunManageDevList(devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag());
|
runManageDevList = deviceMapper.getRunManageDevList(devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(),manuList,runManageParam.getSearchValue());
|
||||||
|
|
||||||
StringBuilder devSql = InfluxDBCommUtils.assToInfluxParamDev(devIndexes);
|
List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVOList = deviceMapper.getOnlineEvaluate(devIndexes,runManageParam.getSearchBeginTime(),runManageParam.getSearchEndTime());
|
||||||
String stringBuilder = "time >= '" + runManageParam.getSearchBeginTime() + "' and " + "time <= '" + runManageParam.getSearchEndTime()+"' and "+devSql+" group by dev_id";
|
|
||||||
//sql语句
|
|
||||||
String sql = "SELECT MEAN(online_rate) AS online_rate FROM " + PQS_ONLINERATE + " WHERE " + stringBuilder + TIME_ZONE;
|
|
||||||
QueryResult queryResult = influxDbUtils.query(sql);
|
|
||||||
|
|
||||||
InfluxDBResultMapper inCn = new InfluxDBResultMapper();
|
// StringBuilder devSql = InfluxDBCommUtils.assToInfluxParamDev(devIndexes);
|
||||||
List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVOList = inCn.toPOJO(queryResult,LineInfluxDbOnlineVO.class);
|
// String stringBuilder = "time >= '" + runManageParam.getSearchBeginTime() + "' and " + "time <= '" + runManageParam.getSearchEndTime()+"' and "+devSql+" group by dev_id";
|
||||||
|
// //sql语句
|
||||||
|
// String sql = "SELECT MEAN(online_rate) AS online_rate FROM " + PQS_ONLINERATE + " WHERE " + stringBuilder + TIME_ZONE;
|
||||||
|
// QueryResult queryResult = influxDbUtils.query(sql);
|
||||||
|
//
|
||||||
|
// InfluxDBResultMapper inCn = new InfluxDBResultMapper();
|
||||||
|
// List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVOList = inCn.toPOJO(queryResult,LineInfluxDbOnlineVO.class);
|
||||||
runManageDevList = runManageDevList.stream().peek(item-> lineInfluxDbOnlineVOList.stream().filter(it-> Objects.equals(item.getId(),it.getDevIndex())).findFirst().ifPresent(i->item.setOnlineEvaluate(i.getOnlineRate()))).collect(Collectors.toList());
|
runManageDevList = runManageDevList.stream().peek(item-> lineInfluxDbOnlineVOList.stream().filter(it-> Objects.equals(item.getId(),it.getDevIndex())).findFirst().ifPresent(i->item.setOnlineEvaluate(i.getOnlineRate()))).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.njcn.user.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.HomeostasisAreaVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||||
|
import com.njcn.user.service.LargeScreenService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/10
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "大屏")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/largeScreen")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class LargeScreenController extends BaseController {
|
||||||
|
|
||||||
|
private final LargeScreenService largeScreenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 灿能云用户规模
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getUserScale")
|
||||||
|
@ApiOperation("灿能云用户规模")
|
||||||
|
@ApiImplicitParam(name = "largeScreenParam", value = "灿能云用户规模", required = true)
|
||||||
|
public HttpResult<List<UserScaleVO>> getUserScale(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getUserScale");
|
||||||
|
List<UserScaleVO> result = largeScreenService.getUserScale(largeScreenParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.user.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/10
|
||||||
|
*/
|
||||||
|
public interface LargeScreenMapper {
|
||||||
|
|
||||||
|
List<UserScaleVO> getUserScale (LargeScreenParam largeScreenParam);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.user.mapper.LargeScreenMapper">
|
||||||
|
|
||||||
|
<select id="getUserScale" resultType="com.njcn.device.pq.pojo.vo.UserScaleVO">
|
||||||
|
SELECT DATE_FORMAT(REGISTER_TIME, '%Y-%m') AS `timeId`, COUNT(*) AS `monthIncrementNum`
|
||||||
|
FROM app_user
|
||||||
|
where STATE = '1'
|
||||||
|
<if test="searchBeginTime != null and searchBeginTime != ''">
|
||||||
|
and date_format(REGISTER_TIME,'%y%m%d') >= date_format(#{searchBeginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="searchEndTime != null and searchEndTime != ''">
|
||||||
|
and date_format(REGISTER_TIME,'%y%m%d') <= date_format(#{searchEndTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
GROUP BY `timeId`;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.user.service;
|
||||||
|
|
||||||
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/10
|
||||||
|
*/
|
||||||
|
public interface LargeScreenService {
|
||||||
|
|
||||||
|
List<UserScaleVO> getUserScale(LargeScreenParam largeScreenParam);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.njcn.user.service.impl;
|
||||||
|
|
||||||
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.HomeostasisAreaVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||||
|
import com.njcn.user.mapper.LargeScreenMapper;
|
||||||
|
import com.njcn.user.service.LargeScreenService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.Year;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/10
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class LargeScreenServiceImpl implements LargeScreenService {
|
||||||
|
|
||||||
|
private final LargeScreenMapper largeScreenMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 灿能云用户规模
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<UserScaleVO> getUserScale(LargeScreenParam largeScreenParam) {
|
||||||
|
//创建返回VO
|
||||||
|
List<UserScaleVO> result = new ArrayList<>();
|
||||||
|
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
//获取当前年第一天日期
|
||||||
|
Year year = Year.now();
|
||||||
|
String firstDay = year.atDay(1).format(formatter);
|
||||||
|
//获取当前天字符串日期
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
String endDay = today.format(formatter);
|
||||||
|
//替换属性
|
||||||
|
largeScreenParam.setSearchBeginTime(firstDay);
|
||||||
|
largeScreenParam.setSearchEndTime(endDay);
|
||||||
|
List<UserScaleVO> list = largeScreenMapper.getUserScale(largeScreenParam);
|
||||||
|
//获取传入起始月结束月中所有月份
|
||||||
|
List<String> monthList = selectDate(largeScreenParam.getSearchBeginTime(),
|
||||||
|
largeScreenParam.getSearchEndTime());
|
||||||
|
|
||||||
|
for (String s : monthList) {
|
||||||
|
UserScaleVO vo = new UserScaleVO();
|
||||||
|
vo.setTimeId(s);
|
||||||
|
result.add(vo);
|
||||||
|
}
|
||||||
|
//集合不为空
|
||||||
|
if (list.size()>0){
|
||||||
|
for (UserScaleVO userScaleVO : result) {
|
||||||
|
for (UserScaleVO scaleVO : list) {
|
||||||
|
if (Objects.equals(scaleVO.getTimeId(),userScaleVO.getTimeId())){
|
||||||
|
userScaleVO.setMonthIncrementNum(scaleVO.getMonthIncrementNum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (UserScaleVO vo : result) {
|
||||||
|
if (vo.getMonthIncrementNum()==null){
|
||||||
|
vo.setMonthIncrementNum(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 0; i < result.size(); i++) {
|
||||||
|
count = count + result.get(i).getMonthIncrementNum();
|
||||||
|
result.get(i).setIncrementNum(count);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}else{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取传入起始月结束月中所有月份
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> selectDate(String startDate, String endDate) {
|
||||||
|
LocalDate start = LocalDate.parse(startDate, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
|
LocalDate end = LocalDate.parse(endDate, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
|
|
||||||
|
List<String> allMonths = new ArrayList<>();
|
||||||
|
YearMonth current = YearMonth.from(start);
|
||||||
|
|
||||||
|
while (!current.isAfter(YearMonth.from(end))) {
|
||||||
|
allMonths.add(current.format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
||||||
|
current = current.plusMonths(1);
|
||||||
|
}
|
||||||
|
return allMonths;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user