代码提交

This commit is contained in:
huangzj
2023-05-25 09:57:21 +08:00
parent da7b7ee8eb
commit 623750abaa
65 changed files with 4326 additions and 24 deletions

View File

@@ -68,6 +68,24 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>pqs-influx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
</dependency>
</dependencies>
<artifactId>algorithm-boot</artifactId>

View File

@@ -9,10 +9,12 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.DependsOn;
@Slf4j
@MapperScan("com.njcn.**.mapper")
@EnableFeignClients(basePackages = "com.njcn")
@DependsOn("proxyMapperRegister")
@SpringBootApplication(scanBasePackages = "com.njcn")
public class
AlgorithmBootApplication {

View File

@@ -0,0 +1,57 @@
package com.njcn.algorithm.controller.Equipment;
import com.njcn.algorithm.pojo.param.CsEquipmentDeliveryAddParm;
import com.njcn.algorithm.pojo.param.CsEquipmentTransferAddParm;
import com.njcn.algorithm.pojo.po.CsEquipmentTransferPO;
import com.njcn.algorithm.service.CsEquipmentTransferPOService;
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.*;
import java.util.List;
/**
* (cs_equipment_transfer)表控制层
*
* @author xxxxx
*/
@Slf4j
@RestController
@RequestMapping("/EquipmentTransfer")
@Api(tags = " 设备转移/恢复")
@AllArgsConstructor
public class CsEquipmentTransferPOController extends BaseController {
private final CsEquipmentTransferPOService csEquipmentTransferPOService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addEquipmentTransfer")
@ApiOperation("新增设备转移申请")
@ApiImplicitParam(name = "csEquipmentTransferAddParm", value = "新增项目参数", required = true)
public HttpResult<Boolean> add(@RequestBody @Validated CsEquipmentTransferAddParm csEquipmentTransferAddParm){
String methodDescribe = getMethodDescribe("add");
Boolean flag = csEquipmentTransferPOService.add (csEquipmentTransferAddParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/passEquipmentTransfer")
@ApiOperation("设备转移申请通过")
@ApiImplicitParam(name = "ids", value = "设备转移申请id", required = true)
public HttpResult<Boolean> pass(@RequestParam("ids") List<String> ids){
String methodDescribe = getMethodDescribe("add");
Boolean flag = csEquipmentTransferPOService.pass (ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
}

View File

@@ -0,0 +1,65 @@
package com.njcn.algorithm.controller.alarm;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsDevModelAddParm;
import com.njcn.algorithm.pojo.param.CsDevModelQueryParm;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmAddParm;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmPageParm;
import com.njcn.algorithm.pojo.po.CsDevModelPO;
import com.njcn.algorithm.pojo.vo.CsDevModelPageVO;
import com.njcn.algorithm.pojo.vo.CsEquipmentAlarmVO;
import com.njcn.algorithm.service.CsEquipmentAlarmPOService;
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;
/**
* Description:
* Date: 2023/5/16 16:33【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("/EquipmentAlarm")
@Api(tags = "设备警告")
@AllArgsConstructor
public class CsEquipmentAlarmController extends BaseController {
private final CsEquipmentAlarmPOService csEquipmentAlarmPOService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/add")
@ApiOperation("新增设备警告")
@ApiImplicitParam(name = "csEquipmentAlarmAddParm", value = "新增设备警告参数", required = true)
public HttpResult<CsEquipmentAlarmVO> add(@RequestBody @Validated CsEquipmentAlarmAddParm csEquipmentAlarmAddParm){
String methodDescribe = getMethodDescribe("add");
CsEquipmentAlarmVO csEquipmentAlarmVO = csEquipmentAlarmPOService.add (csEquipmentAlarmAddParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentAlarmVO, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPage")
@ApiOperation("设备警告分页查询")
@ApiImplicitParam(name = "csEquipmentAlarmPageParm", value = "设备警告查询参数", required = true)
public HttpResult<IPage<CsEquipmentAlarmVO>> queryPage(@RequestBody @Validated CsEquipmentAlarmPageParm csEquipmentAlarmPageParm ){
String methodDescribe = getMethodDescribe("queryPage");
IPage<CsEquipmentAlarmVO> page = csEquipmentAlarmPOService.queryPage (csEquipmentAlarmPageParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,47 @@
package com.njcn.algorithm.controller.alarm;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmPageParm;
import com.njcn.algorithm.pojo.param.CsEventDetailPageParm;
import com.njcn.algorithm.pojo.vo.CsEquipmentAlarmVO;
import com.njcn.algorithm.pojo.vo.CsEventDetailVO;
import com.njcn.algorithm.service.CsEventDetailPOService;
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.*;
import javax.annotation.Resource;
/**
* (cs_event_detail)表控制层
*
* @author xxxxx
*/
@Slf4j
@RestController
@RequestMapping("/EventAlarm")
@Api(tags = "暂态警告")
@AllArgsConstructor
public class CsEventDetailPOController extends BaseController {
private final CsEventDetailPOService csEventDetailPOService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPage")
@ApiOperation("暂态警告分页查询")
@ApiImplicitParam(name = "csEventDetailPageParm", value = "暂态警告查询参数", required = true)
public HttpResult<IPage<CsEventDetailVO>> queryPage(@RequestBody @Validated CsEventDetailPageParm csEventDetailPageParm ){
String methodDescribe = getMethodDescribe("queryPage");
IPage<CsEventDetailVO> page = csEventDetailPOService.queryPage (csEventDetailPageParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,45 @@
package com.njcn.algorithm.controller.alarm;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsStatLimitRatePageParm;
import com.njcn.algorithm.pojo.vo.CsStatLimitRateDVO;
import com.njcn.algorithm.service.CsStatLimitRateDPOService;
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.*;
/**
* (cs_stat_limit_rate_d)表控制层
*
* @author xxxxx
*/
@Slf4j
@RestController
@RequestMapping("/LimitRateAlarm")
@Api(tags = "稳态警告")
@AllArgsConstructor
public class CsStatLimitRateDPOController extends BaseController {
private final CsStatLimitRateDPOService csStatLimitRateDPOService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPage")
@ApiOperation("设备模板分页查询")
@ApiImplicitParam(name = "csStatLimitRatePageParm", value = "设备警告查询参数", required = true)
public HttpResult<IPage<CsStatLimitRateDVO>> queryPage(@RequestBody @Validated CsStatLimitRatePageParm csStatLimitRatePageParm ){
String methodDescribe = getMethodDescribe("queryPage");
IPage<CsStatLimitRateDVO> page = csStatLimitRateDPOService.queryPage (csStatLimitRatePageParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,89 @@
package com.njcn.algorithm.controller.dataset;
import com.njcn.algorithm.pojo.param.CsDataEffectiveQueryParm;
import com.njcn.algorithm.pojo.param.ThdDataQueryParm;
import com.njcn.algorithm.pojo.vo.AppBaseInformationVO;
import com.njcn.algorithm.pojo.vo.CsDataEffectiveVO;
import com.njcn.algorithm.pojo.vo.ThdDataVO;
import com.njcn.algorithm.service.StableDataService;
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.ApiImplicitParams;
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.*;
import java.util.List;
/**
* Description:
* Date: 2023/5/18 8:51【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("/stable")
@Api(tags = "稳态数据展示")
@AllArgsConstructor
public class StableDataController extends BaseController {
private final StableDataService stableDataService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryFisrtThdData")
@ApiOperation("查询谐波畸变率实时数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
@ApiImplicitParam(name = "statisticalName", value = "统计指标name", required = true)
})
public HttpResult<List<ThdDataVO>> queryFisrtThdData(@RequestParam("devId") String devId, @RequestParam("statisticalName") String statisticalName) {
String methodDescribe = getMethodDescribe("queryThdData");
List<ThdDataVO> list = stableDataService.queryThdData(devId, statisticalName);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryThdDataByTime")
@ApiOperation("查询时间段内谐波畸变率")
@ApiImplicitParam(name = "thdDataQueryParm", value = "查询参数", required = true)
public HttpResult<List<ThdDataVO>> queryThdDataByTime(@RequestBody @Validated ThdDataQueryParm thdDataQueryParm) {
String methodDescribe = getMethodDescribe("queryThdDataByTime");
List<ThdDataVO> list = stableDataService.queryThdDataByTime(thdDataQueryParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryFisrtThdContent")
@ApiOperation("查询谐波含量实时数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
@ApiImplicitParam(name = "statisticalName", value = "统计指标name", required = true)
})
public HttpResult<List<ThdDataVO>> queryFisrtThdContent(@RequestParam("devId") String devId, @RequestParam("statisticalName") String statisticalName) {
String methodDescribe = getMethodDescribe("queryFisrtThdContent");
List<ThdDataVO> list = stableDataService.queryFisrtThdContent(devId, statisticalName);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryThdContentByTime")
@ApiOperation("查询时间段内谐波畸变率")
@ApiImplicitParam(name = "thdDataQueryParm", value = "查询参数", required = true)
public HttpResult<List<ThdDataVO>> queryThdContentByTime(@RequestBody @Validated ThdDataQueryParm thdDataQueryParm) {
String methodDescribe = getMethodDescribe("queryThdContentByTime");
List<ThdDataVO> list = stableDataService.queryThdContentByTime(thdDataQueryParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -29,19 +29,25 @@ public interface AppProjectMapper extends MppBaseMapper<AppProjectPO> {
// "\tb.file_path topologyDiagramPath,\n" +
// "\ta.lng lng,\n" +
// "\ta.lat lat,\n" +
"\ta.`status` STATUS,\n" +
"\tc.name engineering_name,\n" +
"\ta.description description,\n"+
"\ta.engineering_id engineering_id,\n" +
"\ta.`status` STATUS,\n" +
"\ta.create_by create_by,\n" +
"\ta.create_time create_time,\n" +
"\ta.update_by update_by,\n" +
"\ta.update_time update_time\n" +
"FROM\n" +
"\tcs_project a\n" +
"LEFT JOIN cs_topology_diagram b ON a.id = b.project_id\n" +
"LEFT JOIN cs_engineering c on a.engineering_id=c.id \n" +
"WHERE\n" +
"\t1 = 1 AND a.status=\"1\"\n" ,
"<when test='temp.projectId!=null and temp.projectId!=\"\"'>",
"AND a.id = #{temp.projectId} "+
"</when>",
"<when test='temp.engineeringId!=null and temp.engineeringId!=\"\"'>",
"AND a.engineering_id = #{temp.engineeringId} "+
"</when>",
"<when test='temp.endTime!=null and temp.endTime!=\"\"'>",
"AND a.create_time &lt;= #{temp.endTime}" +
"</when>",
@@ -51,6 +57,7 @@ public interface AppProjectMapper extends MppBaseMapper<AppProjectPO> {
"<when test='temp.searchValue!=null and temp.searchValue!=\"\"'>",
"AND a.`name` like concat('%',#{temp.searchValue},'%')",
"</when>",
" order by a.create_time desc",
"</script>"}
)
Page<AppProjectVO> getPageVo(Page<AppProjectVO> returnpage, @Param("temp")AppProjectQueryParm appProjectQueryParm);

View File

@@ -0,0 +1,14 @@
package com.njcn.algorithm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.algorithm.pojo.po.CsEquipmentAlarmPO;
/**
* Description:
* Date: 2023/5/16 16:25【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEquipmentAlarmPOMapper extends BaseMapper<CsEquipmentAlarmPO> {
}

View File

@@ -0,0 +1,15 @@
package com.njcn.algorithm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.algorithm.pojo.po.CsEquipmentTransferPO;
/**
*
* Description:
* Date: 2023/5/17 15:40【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEquipmentTransferPOMapper extends BaseMapper<CsEquipmentTransferPO> {
}

View File

@@ -0,0 +1,19 @@
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.CsEventDetailPageParm;
import com.njcn.algorithm.pojo.po.CsEventDetailPO;
import com.njcn.algorithm.pojo.vo.CsEventDetailVO;
import org.apache.ibatis.annotations.Param;
/**
* Description:
* Date: 2023/5/17 10:51【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEventDetailPOMapper extends BaseMapper<CsEventDetailPO> {
Page<CsEventDetailVO> queryPage(Page<CsEventDetailVO> returnpage,@Param("csEventDetailPageParm") CsEventDetailPageParm csEventDetailPageParm);
}

View File

@@ -0,0 +1,15 @@
package com.njcn.algorithm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.algorithm.pojo.po.CsLinePO;
/**
*
* Description:
* Date: 2023/5/18 14:01【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsLinePOMapper extends BaseMapper<CsLinePO> {
}

View File

@@ -0,0 +1,20 @@
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.CsStatLimitRatePageParm;
import com.njcn.algorithm.pojo.po.CsStatLimitRateDPO;
import com.njcn.algorithm.pojo.vo.CsStatLimitRateDVO;
import org.apache.ibatis.annotations.Param;
/**
*
* Description:
* Date: 2023/5/17 13:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsStatLimitRateDPOMapper extends BaseMapper<CsStatLimitRateDPO> {
Page<CsStatLimitRateDVO> queryPage(Page<CsStatLimitRateDVO> returnpage,@Param("csStatLimitRatePageParm") CsStatLimitRatePageParm csStatLimitRatePageParm);
}

View File

@@ -0,0 +1,25 @@
<?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.CsEquipmentAlarmPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsEquipmentAlarmPO">
<!--@mbg.generated-->
<!--@Table cs_equipment_alarm-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="equipment_id" jdbcType="VARCHAR" property="equipmentId" />
<result column="alarm_msg" jdbcType="VARCHAR" property="alarmMsg" />
<result column="alarm_level" jdbcType="VARCHAR" property="alarmLevel" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="status" jdbcType="BIT" property="status" />
<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" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, project_id, equipment_id, alarm_msg, alarm_level, start_time, end_time, `status`,
create_by, create_time, update_by, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,25 @@
<?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.CsEquipmentTransferPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsEquipmentTransferPO">
<!--@mbg.generated-->
<!--@Table cs_equipment_transfer-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="equipment_ids" jdbcType="VARCHAR" property="equipmentIds" />
<result column="promoter" jdbcType="VARCHAR" property="promoter" />
<result column="transferor" jdbcType="VARCHAR" property="transferor" />
<result column="event_type" jdbcType="VARCHAR" property="eventType" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="status" jdbcType="BIT" property="status" />
<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" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, project_id, equipment_ids, promoter, transferor, event_type, remark, `status`,
create_by, create_time, update_by, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,72 @@
<?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.CsEventDetailPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsEventDetailPO">
<!--@mbg.generated-->
<!--@Table cs_event_detail-->
<id column="event_id" jdbcType="CHAR" property="eventId" />
<result column="measurement_point_id" jdbcType="VARCHAR" property="measurementPointId" />
<result column="event_type" jdbcType="CHAR" property="eventType" />
<result column="advance_reason" jdbcType="CHAR" property="advanceReason" />
<result column="advance_type" jdbcType="CHAR" property="advanceType" />
<result column="eventass_index" jdbcType="VARCHAR" property="eventassIndex" />
<result column="dq_time" jdbcType="DOUBLE" property="dqTime" />
<result column="deal_time" jdbcType="TIMESTAMP" property="dealTime" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="file_flag" jdbcType="BIT" property="fileFlag" />
<result column="deal_flag" jdbcType="BIT" property="dealFlag" />
<result column="first_time" jdbcType="TIMESTAMP" property="firstTime" />
<result column="first_type" jdbcType="VARCHAR" property="firstType" />
<result column="first_ms" jdbcType="DECIMAL" property="firstMs" />
<result column="energy" jdbcType="DOUBLE" property="energy" />
<result column="severity" jdbcType="DOUBLE" property="severity" />
<result column="sagsource" jdbcType="VARCHAR" property="sagsource" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="duration" jdbcType="DECIMAL" property="duration" />
<result column="feature_amplitude" jdbcType="DECIMAL" property="featureAmplitude" />
<result column="phase" jdbcType="VARCHAR" property="phase" />
<result column="event_describe" jdbcType="VARCHAR" property="eventDescribe" />
<result column="wave_path" jdbcType="VARCHAR" property="wavePath" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="transient_value" jdbcType="DOUBLE" property="transientValue" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
event_id, measurement_point_id, event_type, advance_reason, advance_type, eventass_index,
dq_time, deal_time, num, file_flag, deal_flag, first_time, first_type, first_ms,
energy, severity, sagsource, start_time, duration, feature_amplitude, phase, event_describe,
wave_path, create_time, transient_value
</sql>
<select id="queryPage" resultType="com.njcn.algorithm.pojo.vo.CsEventDetailVO">
SELECT
temp.*, cs.*
FROM
cs_event_detail cs
INNER JOIN (
SELECT
a.line_id,
a. NAME line_name,
c.id project_id,
c. NAME project_name
FROM
cs_line a,
cs_project_equipment b,
cs_project c
WHERE
1 = 1
AND c.id = b.project_id
AND b.equipment_id = a.dev_id
<if test="csEventDetailPageParm.projectId != null and csEventDetailPageParm.projectId != ''">
AND c.id = #{csEventDetailPageParm.projectId }
</if>
) temp ON cs.measurement_point_id = temp.line_id
where 1=1
<if test="csEventDetailPageParm.startTime != null and csEventDetailPageParm.startTime != ''">
AND cs.start_time &gt;= #{csEventDetailPageParm.startTime }
</if>
<if test="csEventDetailPageParm.endTime != null and csEventDetailPageParm.endTime != ''">
AND cs.start_time &lt;= #{csEventDetailPageParm.endTime }
</if>
</select>
</mapper>

View File

@@ -0,0 +1,25 @@
<?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.CsLinePOMapper">
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsLinePO">
<!--@mbg.generated-->
<!--@Table cs_line-->
<id column="line_id" jdbcType="VARCHAR" property="lineId" />
<result column="dev_id" jdbcType="VARCHAR" property="devId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="position" jdbcType="VARCHAR" property="position" />
<result column="vol_grade" jdbcType="VARCHAR" property="volGrade" />
<result column="pt_ratio" jdbcType="DECIMAL" property="ptRatio" />
<result column="ct_ratio" jdbcType="DECIMAL" property="ctRatio" />
<result column="status" jdbcType="BIT" property="status" />
<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" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
line_id, dev_id, `name`, `position`, vol_grade, pt_ratio, ct_ratio, `status`, create_by,
create_time, update_by, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,133 @@
<?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.CsStatLimitRateDPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.algorithm.pojo.po.CsStatLimitRateDPO">
<!--@mbg.generated-->
<!--@Table cs_stat_limit_rate_d-->
<id column="time_id" jdbcType="TIMESTAMP" property="timeId" />
<id column="my_index" jdbcType="VARCHAR" property="myIndex" />
<id column="phasic_type" jdbcType="VARCHAR" property="phasicType" />
<result column="all_time" jdbcType="INTEGER" property="allTime" />
<result column="flicker_all_time" jdbcType="INTEGER" property="flickerAllTime" />
<result column="freq_dev_overtime" jdbcType="INTEGER" property="freqDevOvertime" />
<result column="voltage_dev_overtime" jdbcType="INTEGER" property="voltageDevOvertime" />
<result column="ubalance_overtime" jdbcType="INTEGER" property="ubalanceOvertime" />
<result column="flicker_overtime" jdbcType="INTEGER" property="flickerOvertime" />
<result column="uaberrance_overtime" jdbcType="INTEGER" property="uaberranceOvertime" />
<result column="uharm_2_overtime" jdbcType="INTEGER" property="uharm2Overtime" />
<result column="uharm_3_overtime" jdbcType="INTEGER" property="uharm3Overtime" />
<result column="uharm_4_overtime" jdbcType="INTEGER" property="uharm4Overtime" />
<result column="uharm_5_overtime" jdbcType="INTEGER" property="uharm5Overtime" />
<result column="uharm_6_overtime" jdbcType="INTEGER" property="uharm6Overtime" />
<result column="uharm_7_overtime" jdbcType="INTEGER" property="uharm7Overtime" />
<result column="uharm_8_overtime" jdbcType="INTEGER" property="uharm8Overtime" />
<result column="uharm_9_overtime" jdbcType="INTEGER" property="uharm9Overtime" />
<result column="uharm_10_overtime" jdbcType="INTEGER" property="uharm10Overtime" />
<result column="uharm_11_overtime" jdbcType="INTEGER" property="uharm11Overtime" />
<result column="uharm_12_overtime" jdbcType="INTEGER" property="uharm12Overtime" />
<result column="uharm_13_overtime" jdbcType="INTEGER" property="uharm13Overtime" />
<result column="uharm_14_overtime" jdbcType="INTEGER" property="uharm14Overtime" />
<result column="uharm_15_overtime" jdbcType="INTEGER" property="uharm15Overtime" />
<result column="uharm_16_overtime" jdbcType="INTEGER" property="uharm16Overtime" />
<result column="uharm_17_overtime" jdbcType="INTEGER" property="uharm17Overtime" />
<result column="uharm_18_overtime" jdbcType="INTEGER" property="uharm18Overtime" />
<result column="uharm_19_overtime" jdbcType="INTEGER" property="uharm19Overtime" />
<result column="uharm_20_overtime" jdbcType="INTEGER" property="uharm20Overtime" />
<result column="uharm_21_overtime" jdbcType="INTEGER" property="uharm21Overtime" />
<result column="uharm_22_overtime" jdbcType="INTEGER" property="uharm22Overtime" />
<result column="uharm_23_overtime" jdbcType="INTEGER" property="uharm23Overtime" />
<result column="uharm_24_overtime" jdbcType="INTEGER" property="uharm24Overtime" />
<result column="uharm_25_overtime" jdbcType="INTEGER" property="uharm25Overtime" />
<result column="iharm_2_overtime" jdbcType="INTEGER" property="iharm2Overtime" />
<result column="iharm_3_overtime" jdbcType="INTEGER" property="iharm3Overtime" />
<result column="iharm_4_overtime" jdbcType="INTEGER" property="iharm4Overtime" />
<result column="iharm_5_overtime" jdbcType="INTEGER" property="iharm5Overtime" />
<result column="iharm_6_overtime" jdbcType="INTEGER" property="iharm6Overtime" />
<result column="iharm_7_overtime" jdbcType="INTEGER" property="iharm7Overtime" />
<result column="iharm_8_overtime" jdbcType="INTEGER" property="iharm8Overtime" />
<result column="iharm_9_overtime" jdbcType="INTEGER" property="iharm9Overtime" />
<result column="iharm_10_overtime" jdbcType="INTEGER" property="iharm10Overtime" />
<result column="iharm_11_overtime" jdbcType="INTEGER" property="iharm11Overtime" />
<result column="iharm_12_overtime" jdbcType="INTEGER" property="iharm12Overtime" />
<result column="iharm_13_overtime" jdbcType="INTEGER" property="iharm13Overtime" />
<result column="iharm_14_overtime" jdbcType="INTEGER" property="iharm14Overtime" />
<result column="iharm_15_overtime" jdbcType="INTEGER" property="iharm15Overtime" />
<result column="iharm_16_overtime" jdbcType="INTEGER" property="iharm16Overtime" />
<result column="iharm_17_overtime" jdbcType="INTEGER" property="iharm17Overtime" />
<result column="iharm_18_overtime" jdbcType="INTEGER" property="iharm18Overtime" />
<result column="iharm_19_overtime" jdbcType="INTEGER" property="iharm19Overtime" />
<result column="iharm_20_overtime" jdbcType="INTEGER" property="iharm20Overtime" />
<result column="iharm_21_overtime" jdbcType="INTEGER" property="iharm21Overtime" />
<result column="iharm_22_overtime" jdbcType="INTEGER" property="iharm22Overtime" />
<result column="iharm_23_overtime" jdbcType="INTEGER" property="iharm23Overtime" />
<result column="iharm_24_overtime" jdbcType="INTEGER" property="iharm24Overtime" />
<result column="iharm_25_overtime" jdbcType="INTEGER" property="iharm25Overtime" />
<result column="inuharm_1_overtime" jdbcType="INTEGER" property="inuharm1Overtime" />
<result column="inuharm_2_overtime" jdbcType="INTEGER" property="inuharm2Overtime" />
<result column="inuharm_3_overtime" jdbcType="INTEGER" property="inuharm3Overtime" />
<result column="inuharm_4_overtime" jdbcType="INTEGER" property="inuharm4Overtime" />
<result column="inuharm_5_overtime" jdbcType="INTEGER" property="inuharm5Overtime" />
<result column="inuharm_6_overtime" jdbcType="INTEGER" property="inuharm6Overtime" />
<result column="inuharm_7_overtime" jdbcType="INTEGER" property="inuharm7Overtime" />
<result column="inuharm_8_overtime" jdbcType="INTEGER" property="inuharm8Overtime" />
<result column="inuharm_9_overtime" jdbcType="INTEGER" property="inuharm9Overtime" />
<result column="inuharm_10_overtime" jdbcType="INTEGER" property="inuharm10Overtime" />
<result column="inuharm_11_overtime" jdbcType="INTEGER" property="inuharm11Overtime" />
<result column="inuharm_12_overtime" jdbcType="INTEGER" property="inuharm12Overtime" />
<result column="inuharm_13_overtime" jdbcType="INTEGER" property="inuharm13Overtime" />
<result column="inuharm_14_overtime" jdbcType="INTEGER" property="inuharm14Overtime" />
<result column="inuharm_15_overtime" jdbcType="INTEGER" property="inuharm15Overtime" />
<result column="inuharm_16_overtime" jdbcType="INTEGER" property="inuharm16Overtime" />
<result column="i_neg_overtime" jdbcType="INTEGER" property="iNegOvertime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
time_id, my_index, phasic_type, all_time, flicker_all_time, freq_dev_overtime, voltage_dev_overtime,
ubalance_overtime, flicker_overtime, uaberrance_overtime, uharm_2_overtime, uharm_3_overtime,
uharm_4_overtime, uharm_5_overtime, uharm_6_overtime, uharm_7_overtime, uharm_8_overtime,
uharm_9_overtime, uharm_10_overtime, uharm_11_overtime, uharm_12_overtime, uharm_13_overtime,
uharm_14_overtime, uharm_15_overtime, uharm_16_overtime, uharm_17_overtime, uharm_18_overtime,
uharm_19_overtime, uharm_20_overtime, uharm_21_overtime, uharm_22_overtime, uharm_23_overtime,
uharm_24_overtime, uharm_25_overtime, iharm_2_overtime, iharm_3_overtime, iharm_4_overtime,
iharm_5_overtime, iharm_6_overtime, iharm_7_overtime, iharm_8_overtime, iharm_9_overtime,
iharm_10_overtime, iharm_11_overtime, iharm_12_overtime, iharm_13_overtime, iharm_14_overtime,
iharm_15_overtime, iharm_16_overtime, iharm_17_overtime, iharm_18_overtime, iharm_19_overtime,
iharm_20_overtime, iharm_21_overtime, iharm_22_overtime, iharm_23_overtime, iharm_24_overtime,
iharm_25_overtime, inuharm_1_overtime, inuharm_2_overtime, inuharm_3_overtime, inuharm_4_overtime,
inuharm_5_overtime, inuharm_6_overtime, inuharm_7_overtime, inuharm_8_overtime, inuharm_9_overtime,
inuharm_10_overtime, inuharm_11_overtime, inuharm_12_overtime, inuharm_13_overtime,
inuharm_14_overtime, inuharm_15_overtime, inuharm_16_overtime, i_neg_overtime
</sql>
<select id="queryPage" resultType="com.njcn.algorithm.pojo.vo.CsStatLimitRateDVO">
SELECT
temp.*, cs.*
FROM
cs_stat_limit_rate_d cs
INNER JOIN (
SELECT
a.line_id,
a. NAME line_name,
c.id project_id,
c. NAME project_name
FROM
cs_line a,
cs_project_equipment b,
cs_project c
WHERE
1 = 1
AND c.id = b.project_id
AND b.equipment_id = a.dev_id
<if test="csStatLimitRatePageParm.projectId != null and csStatLimitRatePageParm.projectId != ''">
AND c.id = #{csStatLimitRatePageParm.projectId }
</if>
) temp ON cs.my_index = temp.line_id
where 1=1
<if test="csStatLimitRatePageParm.startTime != null and csStatLimitRatePageParm.startTime != ''">
AND cs.time_id &gt;= #{csStatLimitRatePageParm.startTime }
</if>
<if test="csStatLimitRatePageParm.endTime != null and csStatLimitRatePageParm.endTime != ''">
AND cs.time_id &lt;= #{csStatLimitRatePageParm.endTime }
</if>
</select>
</mapper>

View File

@@ -0,0 +1,30 @@
package com.njcn.algorithm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmAddParm;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmPageParm;
import com.njcn.algorithm.pojo.po.CsEquipmentAlarmPO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.algorithm.pojo.vo.CsEquipmentAlarmVO;
/**
*
* Description:
* Date: 2023/5/16 16:24【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEquipmentAlarmPOService extends IService<CsEquipmentAlarmPO>{
/**
* @Description: 新增设备警告
* @Param:
* @return: com.njcn.algorithm.pojo.vo.CsEquipmentAlarmVO
* @Author: clam
* @Date: 2023/5/17
*/
CsEquipmentAlarmVO add(CsEquipmentAlarmAddParm csEquipmentAlarmAddParm);
IPage<CsEquipmentAlarmVO> queryPage(CsEquipmentAlarmPageParm csEquipmentAlarmPageParm);
}

View File

@@ -0,0 +1,35 @@
package com.njcn.algorithm.service;
import com.njcn.algorithm.pojo.param.CsEquipmentTransferAddParm;
import com.njcn.algorithm.pojo.po.CsEquipmentTransferPO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
* Description:
* Date: 2023/5/17 15:40【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEquipmentTransferPOService extends IService<CsEquipmentTransferPO>{
/**
* @Description: add
* @Param:
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2023/5/17
*/
Boolean add(CsEquipmentTransferAddParm csEquipmentTransferAddParm);
/**
* @Description: 设备转移申请通过
* @Param:
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2023/5/17
*/
Boolean pass(List<String> ids);
}

View File

@@ -0,0 +1,21 @@
package com.njcn.algorithm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsEventDetailPageParm;
import com.njcn.algorithm.pojo.po.CsEventDetailPO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.algorithm.pojo.vo.CsEventDetailVO;
/**
*
* Description:
* Date: 2023/5/17 10:49【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsEventDetailPOService extends IService<CsEventDetailPO>{
IPage<CsEventDetailVO> queryPage(CsEventDetailPageParm csEventDetailPageParm);
}

View File

@@ -0,0 +1,20 @@
package com.njcn.algorithm.service;
import com.njcn.algorithm.pojo.po.CsLinePO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
* Description:
* Date: 2023/5/18 14:01【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsLinePOService extends IService<CsLinePO>{
List<CsLinePO> queryByDevId(String devId);
}

View File

@@ -0,0 +1,21 @@
package com.njcn.algorithm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsStatLimitRatePageParm;
import com.njcn.algorithm.pojo.po.CsStatLimitRateDPO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.algorithm.pojo.vo.CsStatLimitRateDVO;
/**
*
* Description:
* Date: 2023/5/17 13:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CsStatLimitRateDPOService extends IService<CsStatLimitRateDPO>{
IPage<CsStatLimitRateDVO> queryPage(CsStatLimitRatePageParm csStatLimitRatePageParm);
}

View File

@@ -0,0 +1,29 @@
package com.njcn.algorithm.service;
import com.njcn.algorithm.pojo.param.ThdDataQueryParm;
import com.njcn.algorithm.pojo.vo.ThdDataVO;
import java.util.List;
/**
* Description:
* Date: 2023/5/18 14:39【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface StableDataService {
List<ThdDataVO> queryThdData(String devId, String statisticalName);
/**
* @Description: 查询时间段内谐波畸变率
* @Param:
* @return: java.util.List<com.njcn.algorithm.pojo.vo.ThdDataVO>
* @Author: clam
* @Date: 2023/5/23
*/
List<ThdDataVO> queryThdDataByTime(ThdDataQueryParm thdDataQueryParm);
List<ThdDataVO> queryFisrtThdContent(String devId, String statisticalName);
List<ThdDataVO> queryThdContentByTime(ThdDataQueryParm thdDataQueryParm);
}

View File

@@ -104,26 +104,27 @@ public class AppProjectServiceImpl extends MppServiceImpl<AppProjectMapper, AppP
Page<AppProjectVO> returnpage = new Page<> (appProjectQueryParm.getCurrentPage ( ), appProjectQueryParm.getPageSize ( ));
returnpage = appProjectMapper.getPageVo (returnpage, appProjectQueryParm);
Page<AppProjectPO> appProjectPOPage = new Page<> (appProjectQueryParm.getCurrentPage ( ), appProjectQueryParm.getPageSize ( ));
QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
queryWrapper.eq ("status", "1").
eq (StringUtils.isNotBlank (appProjectQueryParm.getProjectId ( )), "id", appProjectQueryParm.getProjectId ( )).
le (StringUtils.isNotBlank (appProjectQueryParm.getEndTime ( )), "create_time", appProjectQueryParm.getEndTime ( )).
ge (StringUtils.isNotBlank (appProjectQueryParm.getStartTime ( )), "create_time", appProjectQueryParm.getStartTime ( )).
like (StringUtils.isNotBlank (appProjectQueryParm.getSearchValue ( )), "name", appProjectQueryParm.getSearchValue ( ));
Page<AppProjectPO> appProjectPOPage1 = appProjectMapper.selectPage (appProjectPOPage, queryWrapper);
List<AppProjectVO> collect = appProjectPOPage1.getRecords ( ).stream ( ).map (temp -> {
AppProjectVO vo = new AppProjectVO ( );
BeanUtils.copyProperties (temp, vo);
AppTopologyDiagramQueryParm appTopologyDiagramQueryParm = new AppTopologyDiagramQueryParm ( );
appTopologyDiagramQueryParm.setProjectId (vo.getId ( ));
List<AppTopologyDiagramVO> appTopologyDiagramVOList = appTopologyDiagramService.queryAppTopologyDiagram (appTopologyDiagramQueryParm);
List<String> collect1 = appTopologyDiagramVOList.stream ( ).map (AppTopologyDiagramVO::getFilePath).collect (Collectors.toList ( ));
vo.setTopologyDiagramPaths (collect1);
return vo;
}
).collect (Collectors.toList ( ));
// Page<AppProjectPO> appProjectPOPage = new Page<> (appProjectQueryParm.getCurrentPage ( ), appProjectQueryParm.getPageSize ( ));
// QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
// queryWrapper.eq ("status", "1").
// eq (StringUtils.isNotBlank (appProjectQueryParm.getProjectId ( )), "id", appProjectQueryParm.getProjectId ( )).
// eq (StringUtils.isNotBlank (appProjectQueryParm.getEngineeringId ( )), "engineering_id", appProjectQueryParm.getEngineeringId ( )).
// le (StringUtils.isNotBlank (appProjectQueryParm.getEndTime ( )), "create_time", appProjectQueryParm.getEndTime ( )).
// ge (StringUtils.isNotBlank (appProjectQueryParm.getStartTime ( )), "create_time", appProjectQueryParm.getStartTime ( )).
// like (StringUtils.isNotBlank (appProjectQueryParm.getSearchValue ( )), "name", appProjectQueryParm.getSearchValue ( ));
// Page<AppProjectPO> appProjectPOPage1 = appProjectMapper.selectPage (appProjectPOPage, queryWrapper);
// List<AppProjectVO> collect = appProjectPOPage1.getRecords ( ).stream ( ).map (temp -> {
// AppProjectVO vo = new AppProjectVO ( );
// BeanUtils.copyProperties (temp, vo);
// AppTopologyDiagramQueryParm appTopologyDiagramQueryParm = new AppTopologyDiagramQueryParm ( );
// appTopologyDiagramQueryParm.setProjectId (vo.getId ( ));
// List<AppTopologyDiagramVO> appTopologyDiagramVOList = appTopologyDiagramService.queryAppTopologyDiagram (appTopologyDiagramQueryParm);
// List<String> collect1 = appTopologyDiagramVOList.stream ( ).map (AppTopologyDiagramVO::getFilePath).collect (Collectors.toList ( ));
// vo.setTopologyDiagramPaths (collect1);
// return vo;
// }
//
// ).collect (Collectors.toList ( ));
return returnpage;
}
}

View File

@@ -0,0 +1,99 @@
package com.njcn.algorithm.service.impl;
import com.alibaba.cloud.commons.lang.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.algorithm.mapper.AppProjectMapper;
import com.njcn.algorithm.mapper.CsEquipmentDeliveryMapper;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmAddParm;
import com.njcn.algorithm.pojo.param.CsEquipmentAlarmPageParm;
import com.njcn.algorithm.pojo.po.AppProjectPO;
import com.njcn.algorithm.pojo.po.CsEquipmentDeliveryPO;
import com.njcn.algorithm.pojo.vo.CsEdDataVO;
import com.njcn.algorithm.pojo.vo.CsEquipmentAlarmVO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsEquipmentAlarmPOMapper;
import com.njcn.algorithm.pojo.po.CsEquipmentAlarmPO;
import com.njcn.algorithm.service.CsEquipmentAlarmPOService;
import org.springframework.transaction.annotation.Transactional;
/**
*
* Description:
* Date: 2023/5/16 16:24【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class CsEquipmentAlarmPOServiceImpl extends ServiceImpl<CsEquipmentAlarmPOMapper, CsEquipmentAlarmPO> implements CsEquipmentAlarmPOService{
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
private final AppProjectMapper appProjectMapper;
private final DicDataFeignClient dicDataFeignClient;
@Override
@Transactional(rollbackFor = {Exception.class})
public CsEquipmentAlarmVO add(CsEquipmentAlarmAddParm csEquipmentAlarmAddParm) {
CsEquipmentAlarmPO csEquipmentAlarmPO = new CsEquipmentAlarmPO();
BeanUtils.copyProperties(csEquipmentAlarmAddParm,csEquipmentAlarmPO);
csEquipmentAlarmPO.setStatus("1");
this.save(csEquipmentAlarmPO);
CsEquipmentAlarmVO csEquipmentAlarmVO = new CsEquipmentAlarmVO();
this.poToVO(csEquipmentAlarmPO, csEquipmentAlarmVO);
log.info("新增设备警告:{}", csEquipmentAlarmVO.toString());
return csEquipmentAlarmVO;
}
@Override
public IPage<CsEquipmentAlarmVO> queryPage(CsEquipmentAlarmPageParm csEquipmentAlarmPageParm) {
Page<CsEquipmentAlarmVO> returnpage = new Page<> (csEquipmentAlarmPageParm.getCurrentPage ( ), csEquipmentAlarmPageParm.getPageSize ( ));
Page<CsEquipmentAlarmPO> queryPage = new Page<> (csEquipmentAlarmPageParm.getCurrentPage ( ), csEquipmentAlarmPageParm.getPageSize ( ));
QueryWrapper<CsEquipmentAlarmPO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", "1");
queryWrapper.eq(StringUtils.isNotBlank(csEquipmentAlarmPageParm.getProjectId()),CsEquipmentAlarmPO.COL_PROJECT_ID,csEquipmentAlarmPageParm.getProjectId());
queryWrapper.eq(StringUtils.isNotBlank(csEquipmentAlarmPageParm.getEquipmentId()),CsEquipmentAlarmPO.COL_EQUIPMENT_ID,csEquipmentAlarmPageParm.getEquipmentId());
queryWrapper.eq(StringUtils.isNotBlank(csEquipmentAlarmPageParm.getAlarmLevel()),CsEquipmentAlarmPO.COL_ALARM_LEVEL,csEquipmentAlarmPageParm.getAlarmLevel());
queryWrapper.ge(Objects.nonNull(csEquipmentAlarmPageParm.getStartTime()),CsEquipmentAlarmPO.COL_START_TIME,csEquipmentAlarmPageParm.getStartTime());
queryWrapper.le(Objects.nonNull(csEquipmentAlarmPageParm.getStartTime()),CsEquipmentAlarmPO.COL_START_TIME,csEquipmentAlarmPageParm.getEndTime());
queryWrapper.orderByDesc("create_time");
Page<CsEquipmentAlarmPO> csEquipmentAlarmPOPage = this.getBaseMapper().selectPage(queryPage, queryWrapper);
List<CsEquipmentAlarmVO> collect = csEquipmentAlarmPOPage.getRecords().stream().map(temp -> {
CsEquipmentAlarmVO csEquipmentAlarmVO = new CsEquipmentAlarmVO();
this.poToVO(temp, csEquipmentAlarmVO);
return csEquipmentAlarmVO;
}).collect(Collectors.toList());
returnpage.setRecords(collect);
return returnpage;
}
private void poToVO(CsEquipmentAlarmPO csEquipmentAlarmPO, CsEquipmentAlarmVO csEquipmentAlarmVO) {
BeanUtils.copyProperties(csEquipmentAlarmPO,csEquipmentAlarmVO);
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(csEquipmentAlarmPO.getEquipmentId());
csEquipmentAlarmVO.setEquipmentName(csEquipmentDeliveryPO.getName());
DictData data = dicDataFeignClient.getDicDataById(csEquipmentAlarmPO.getAlarmLevel()).getData();
csEquipmentAlarmVO.setAlarmLevelName(data.getName());
AppProjectPO appProjectPO = appProjectMapper.selectById(csEquipmentAlarmPO.getProjectId());
csEquipmentAlarmVO.setProjectName(appProjectPO.getName());
}
}

View File

@@ -0,0 +1,58 @@
package com.njcn.algorithm.service.impl;
import com.njcn.algorithm.pojo.param.CsEquipmentTransferAddParm;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsEquipmentTransferPOMapper;
import com.njcn.algorithm.pojo.po.CsEquipmentTransferPO;
import com.njcn.algorithm.service.CsEquipmentTransferPOService;
import org.springframework.transaction.annotation.Transactional;
/**
*
* Description:
* Date: 2023/5/17 15:40【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class CsEquipmentTransferPOServiceImpl extends ServiceImpl<CsEquipmentTransferPOMapper, CsEquipmentTransferPO> implements CsEquipmentTransferPOService{
@Override
@Transactional(rollbackFor = {Exception.class})
public Boolean add(CsEquipmentTransferAddParm csEquipmentTransferAddParm) {
CsEquipmentTransferPO csEquipmentTransferPO = new CsEquipmentTransferPO();
BeanUtils.copyProperties(csEquipmentTransferAddParm, csEquipmentTransferPO);
csEquipmentTransferPO.setStatus(DataStateEnum.ENABLE.getCode());
boolean save = this.save(csEquipmentTransferPO);
log.info("插入成功");
return save;
}
@Override
@Transactional(rollbackFor = {Exception.class})
public Boolean pass(List<String> ids) {
ids.forEach(id -> {
CsEquipmentTransferPO csEquipmentTransferPO = this.getById(id);
String equipmentIds = csEquipmentTransferPO.getEquipmentIds();
String[] split = equipmentIds.split(",");
this.updateById(csEquipmentTransferPO);
log.info("更新成功");
});
return null;
}
}

View File

@@ -0,0 +1,36 @@
package com.njcn.algorithm.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.algorithm.pojo.param.CsEventDetailPageParm;
import com.njcn.algorithm.pojo.vo.CsEquipmentAlarmVO;
import com.njcn.algorithm.pojo.vo.CsEventDetailVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsEventDetailPOMapper;
import com.njcn.algorithm.pojo.po.CsEventDetailPO;
import com.njcn.algorithm.service.CsEventDetailPOService;
/**
*
* Description:
* Date: 2023/5/17 10:49【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class CsEventDetailPOServiceImpl extends ServiceImpl<CsEventDetailPOMapper, CsEventDetailPO> implements CsEventDetailPOService{
@Override
public IPage<CsEventDetailVO> queryPage(CsEventDetailPageParm csEventDetailPageParm) {
Page<CsEventDetailVO> returnpage = new Page<> (csEventDetailPageParm.getCurrentPage ( ), csEventDetailPageParm.getPageSize ( ));
returnpage = this.getBaseMapper().queryPage(returnpage,csEventDetailPageParm);
return returnpage;
}
}

View File

@@ -0,0 +1,29 @@
package com.njcn.algorithm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsLinePOMapper;
import com.njcn.algorithm.pojo.po.CsLinePO;
import com.njcn.algorithm.service.CsLinePOService;
/**
*
* Description:
* Date: 2023/5/18 14:01【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> implements CsLinePOService{
@Override
public List<CsLinePO> queryByDevId(String devId) {
QueryWrapper<CsLinePO> queryWrapper = new QueryWrapper();
queryWrapper.eq("dev_id", devId);
List<CsLinePO> csLinePOList = this.list(queryWrapper);
return csLinePOList;
}
}

View File

@@ -0,0 +1,32 @@
package com.njcn.algorithm.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.algorithm.pojo.param.CsStatLimitRatePageParm;
import com.njcn.algorithm.pojo.vo.CsEventDetailVO;
import com.njcn.algorithm.pojo.vo.CsStatLimitRateDVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsStatLimitRateDPOMapper;
import com.njcn.algorithm.pojo.po.CsStatLimitRateDPO;
import com.njcn.algorithm.service.CsStatLimitRateDPOService;
/**
*
* Description:
* Date: 2023/5/17 13:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class CsStatLimitRateDPOServiceImpl extends ServiceImpl<CsStatLimitRateDPOMapper, CsStatLimitRateDPO> implements CsStatLimitRateDPOService{
@Override
public IPage<CsStatLimitRateDVO> queryPage(CsStatLimitRatePageParm csStatLimitRatePageParm) {
Page<CsStatLimitRateDVO> returnpage = new Page<> (csStatLimitRatePageParm.getCurrentPage ( ), csStatLimitRatePageParm.getPageSize ( ));
returnpage = this.getBaseMapper().queryPage(returnpage,csStatLimitRatePageParm);
return returnpage;
}
}

View File

@@ -0,0 +1,163 @@
package com.njcn.algorithm.service.impl;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
import com.njcn.algorithm.constant.DataParam;
import com.njcn.algorithm.enums.AlgorithmResponseEnum;
import com.njcn.algorithm.pojo.param.ThdDataQueryParm;
import com.njcn.algorithm.pojo.po.CsLinePO;
import com.njcn.algorithm.pojo.vo.ThdDataVO;
import com.njcn.algorithm.service.CsLinePOService;
import com.njcn.algorithm.service.StableDataService;
import com.njcn.algorithm.utils.ReflectUtils;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.influx.pojo.po.HarmonicRatioData;
import com.njcn.influx.pojo.po.PowerQualityData;
import com.njcn.influx.service.HaronicRatioService;
import com.njcn.influx.service.PowerQualityService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2023/5/18 14:39【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class StableDataServiceImpl implements StableDataService {
private final CsLinePOService csLinePOService;
private final PowerQualityService PowerQualityService;
private final HaronicRatioService haronicRatioService;
@Override
public List<ThdDataVO> queryThdData(String devId, String statisticalName) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(devId);
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<PowerQualityData> firstPowerQuality = PowerQualityService.getFirstPowerQuality(collect, statisticalName);
csLinePOList.forEach(temp->{
DataParam.phases.forEach(phase->{
DataParam.statMethods.forEach(method -> {
ThdDataVO thdDataVO = new ThdDataVO();
thdDataVO.setLineId(temp.getLineId());
thdDataVO.setPosition(temp.getPosition());
thdDataVO.setStatisticalName(statisticalName);
thdDataVO.setPhase(phase);
thdDataVO.setStatMethod(method);
Double statisticalValue = 0.00;
List<PowerQualityData> collect1 = firstPowerQuality.stream().filter(powerQualityData -> Objects.equals(powerQualityData.getPhase(), phase) &&
Objects.equals(powerQualityData.getStatMethod(), method)
).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(collect1)){
statisticalValue= (Double) ReflectUtils.getValue(collect1.get(0), statisticalName);
}
thdDataVO.setStatisticalData(statisticalValue);
thdDataVOList.add(thdDataVO);
});
});
});
return thdDataVOList;
}
@Override
public List<ThdDataVO> queryThdDataByTime(ThdDataQueryParm thdDataQueryParm) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(thdDataQueryParm.getDevId());
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<PowerQualityData> firstPowerQuality = PowerQualityService.getPowerQuality(collect, thdDataQueryParm.getStatisticalName(), thdDataQueryParm.getStartTime(), thdDataQueryParm.getEndTime());
csLinePOList.forEach(temp->{
DataParam.phases.forEach(phase->{
DataParam.statMethods.forEach(method -> {
ThdDataVO thdDataVO = new ThdDataVO();
thdDataVO.setLineId(temp.getLineId());
thdDataVO.setPosition(temp.getPosition());
thdDataVO.setStatisticalName(thdDataQueryParm.getStatisticalName());
thdDataVO.setPhase(phase);
thdDataVO.setStatMethod(method);
Double statisticalValue = 0.00;
List<PowerQualityData> collect1 = firstPowerQuality.stream().filter(powerQualityData -> Objects.equals(powerQualityData.getPhase(), phase) &&
Objects.equals(powerQualityData.getStatMethod(), method)
).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(collect1)){
statisticalValue= (Double) ReflectUtils.getValue(collect1.get(0), thdDataQueryParm.getStatisticalName());
}
thdDataVO.setStatisticalData(statisticalValue);
thdDataVOList.add(thdDataVO);
});
});
});
return thdDataVOList;
}
@Override
public List<ThdDataVO> queryFisrtThdContent(String devId, String statisticalName) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(devId);
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<HarmonicRatioData> harmonicRatioList = haronicRatioService.getFirstHaronicRatio(collect, statisticalName);
harmonicRatioList.forEach(temp->{
ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(temp,thdDataVO);
thdDataVO.setStatisticalName(statisticalName);
thdDataVO.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), thdDataVO.getLineId())).collect(Collectors.toList()).get(0).getPosition();
thdDataVO.setPosition(position);
Double statisticalValue = 0.00;
statisticalValue= (Double) ReflectUtils.getValue(temp, statisticalName);
thdDataVO.setStatisticalData(statisticalValue);
thdDataVOList.add(thdDataVO);
});
return thdDataVOList;
}
@Override
public List<ThdDataVO> queryThdContentByTime(ThdDataQueryParm thdDataQueryParm) {
List<ThdDataVO> thdDataVOList = new ArrayList<>();
List<CsLinePO> csLinePOList = csLinePOService.queryByDevId(thdDataQueryParm.getDevId());
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
List<HarmonicRatioData> harmonicRatioList = haronicRatioService.getHaronicRatio(collect, thdDataQueryParm.getStatisticalName(),thdDataQueryParm.getStartTime(), thdDataQueryParm.getEndTime());
harmonicRatioList.forEach(temp->{
ThdDataVO thdDataVO = new ThdDataVO();
BeanUtils.copyProperties(temp,thdDataVO);
thdDataVO.setStatisticalName(thdDataQueryParm.getStatisticalName());
thdDataVO.setTime(temp.getTime().atZone(ZoneId.systemDefault()).toLocalDateTime());
String position = csLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), thdDataVO.getLineId())).collect(Collectors.toList()).get(0).getPosition();
thdDataVO.setPosition(position);
Double statisticalValue = 0.00;
statisticalValue= (Double) ReflectUtils.getValue(temp, thdDataQueryParm.getStatisticalName());
thdDataVO.setStatisticalData(statisticalValue);
thdDataVOList.add(thdDataVO);
});
return thdDataVOList;
}
}

View File

@@ -0,0 +1,172 @@
> 前言:
>
> 为了方便开发中使用influx时序数据库摒弃了在代码中拼接查询sql语句确保查询结果的准确性之余提高代码的阅读性。同时优化处理了部分开发过程遇到的问题
>
> * 时区问题:开发者无需关注,默认为 tz('Asia/Shanghai')
> * 返回的Instant类型的时间在序列化到前端页面时格式不对添加@JsonSerialize(using = InstantDateSerializer.class)处理解决
> * 同时由于influx针对or查询时超过100个连接是性能会有比较严重的影响提供了influx的正则表达式的查询方法InfluxQueryWrapper.regular(),此方案还待测试检查
#### 1、快速上手
目前没有采用泛型的方式,是因为想返回实体更灵活,可以指定任意想要映射的实体。
```java
//两个构造方法:
/***
* 返回和查询用的同一个实体
* @param measurement 查询目标表
*/
public InfluxQueryWrapper(Class measurement) {
this.measurement = measurement;
this.resultEntity = measurement;
this.initSql();
}
/***
* 返回和查询用的不是同一个实体
* @param measurement 查询目标表
* @param resultEntity 返回映射实体
*/
public InfluxQueryWrapper(Class measurement, Class resultEntity) {
this.measurement = measurement;
this.resultEntity = resultEntity;
this.initSql();
}
```
初始化完成后便已经确定目标measurementinflux表名以及返回实体。
###### 示例:
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
//生成 select * from "data_flicker" tz('Asia/Shanghai')
```
#### 2、函数使用
##### 2.1、select
select(ICFunction<T, R>... fieldsStr):此函数指定查询返回的那几个字段
###### 示例:
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
influxQueryWrapper.select(DataFlicker::getTime);
//生成 select time from "data_flicker" tz('Asia/Shanghai')
```
##### 2.2、count统计
count(ICFunction<T, R> columnName):累计总数;
count(ICFunction<T, R> columnName, ICFunction<T, R> resultName):累计总数,返回属性名不同
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
influxQueryWrapper.count(DataFlicker::getTime,StatisticsResult::getValue);
//生成 select COUNT("time") as value from "data_flicker" tz('Asia/Shanghai')
```
> 类似的还有mean平均值、median中位数、mode最常出现的值、spread最大与最小值的差、sum求和、abs绝对值、max最大值、min最小值
##### 2.3、top最大值的几条记录
top(ICFunction<T, R> columnName, int num):最大值的一个结果集合
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
influxQueryWrapper.top(DataFlicker::getTime,5);
//生成最大的前5某个属性的集合
//select TOP("time",5) as value from "data_flicker" tz('Asia/Shanghai')
```
> 类似的还有bottom最小值的几条记录
##### 2.4、maxSamePrefixAndSuffix针对前缀或后缀相同的属性批量处理最大值
maxSamePrefixAndSuffix(String prefix, String suffix, List<Object> diffContent):开发过程中遇到表字段前后缀一致时,需要批量处理的。
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
influxQueryWrapper.maxSamePrefixAndSuffix("v_","",timesList);
//生成最大的前5某个属性的集合
//select MAX("v_1") as v_1,MAX("v_2") as v_2,MAX("v_3") as v_3,MAX("v_4") as v_4 as value from "data_v" tz('Asia/Shanghai')
```
> 类似的还有minSamePrefixAndSuffix针对前缀或后缀相同的属性批量处理最小值
##### 2.5、percentile百分之最大值
目前灿能项目常用于cp95最大值
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
influxQueryWrapper.percentile(DataFlicker::getTime,95);
//select PERCENTILE("time",95) as value from "data_flicker" tz('Asia/Shanghai')
```
##### 2.6、between区间
between(ICFunction<T, R> fieldName, Object val1, Object val2):作为条件区间语句生成
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
influxQueryWrapper.between(DataFlicker::getTime,"2022-04-30 16:00:00","2022-05-30 16:00:00");
//select * from "data_flicker" where time >='2022-04-30 16:00:00' AND time <='2022-05-30 16:00:00' tz('Asia/Shanghai')
```
##### 2.7、eq等于
eq(ICFunction<T, R> columnName, Object columnValue)指定某字段等于xxx
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
influxQueryWrapper.eq(DataFlicker::getTime,"2022-05-30 16:00:00");
//select * from "data_flicker" where time ='2022-04-30 16:00:00' tz('Asia/Shanghai')
```
> 类似的还有ne不等于、gt大于、ge大于等于、lt小于、le小于等于
##### 2.8、or拼接多条件
or(ICFunction<T, R> fieldName, List<Object> columnValues)查询某字段等于集合内的值时的结果类似于关系数据库的in函数
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
influxQueryWrapper.or(DataV::getLineId,lineList);
//select * from "data_v" where (line_id = "111" or line_id = "222") tz('Asia/Shanghai')
```
##### 2.9、regular正则模糊查询
regular(ICFunction<T, R> fieldName, List<String> columnValues)查询条件有多个选项时效果等同于关系型数据库的in同时or的内容如果超过100个选项时会带来严重的性能问题查询很慢可以调整为正则模糊查询
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
influxQueryWrapper.regular(DataV::getLineId,lineList);
//select * from "data_v" where line_id =~/^111|222|333$/ tz('Asia/Shanghai')
```
##### 2.10、groupBy分组
> influxdb只能针对tag去分组
groupBy(ICFunction<T, R>... columnName)以tag去分组
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
influxQueryWrapper.groupBy(DataV::getLineId,DataV::getGualityFlag);
//select * from "data_v" group by line_id,quality_flag tz('Asia/Shanghai')
```
##### 2.11、timeDesc以时间降序
```java
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
influxQueryWrapper.timeDesc();
//select * from "data_v" order by time desc tz('Asia/Shanghai')
```
> 类似的还有timeAsc以时间升序