Commit 988aaede authored by tangwei's avatar tangwei

解决冲突解决冲突

parents f28f7bdc 7fda4163
......@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
*
......@@ -116,8 +117,21 @@ public class IdxBizFanHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测风机层左侧列表", notes = "预警监测风机层左侧列表")
@GetMapping(value = "/tableLeftList")
public ResponseModel<List<IdxBizFanHealthIndexDto>> queryForLeftTableList(String STATION,String HEALTHLEVEL) {
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryForLeftTableList(STATION,HEALTHLEVEL));
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableList(@RequestParam(required = false) String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,Integer current,Integer size) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>();
page.setCurrent(current);
page.setSize(size);
int total = idxBizFanHealthIndexServiceImpl.queryForLeftTableListCount(STATION, HEALTHLEVEL, EQUIPMENTNAME);
page.setTotal(Long.valueOf(total));
page.setRecords(idxBizFanHealthIndexServiceImpl.queryForLeftTableList(STATION,HEALTHLEVEL,EQUIPMENTNAME,(current-1)*size,size));
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测风机层仪表盘", notes = "预警监测风机层仪表盘")
@GetMapping(value = "/queryForLeftTableListNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListNum(@RequestParam(required = false)String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false)String EQUIPMENTNAME) {
return ResponseHelper.buildResponse( idxBizFanHealthIndexServiceImpl.queryForLeftTableListNum(STATION, HEALTHLEVEL, EQUIPMENTNAME));
}
......
......@@ -14,6 +14,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -141,4 +143,44 @@ public class IdxBizPvHealthIndexController extends BaseController {
page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION,SUBARRAY,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME,(current-1)*size,size));
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级仪表盘", notes = "预警监测设备级仪表盘")
@GetMapping(value = "/queryForLeftTableListByEquipNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListByEquipNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME) {
;
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquipNum(STATION, SUBARRAY, HEALTHLEVEL,EQUIPMENTNAME));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点级仪表盘", notes = "预警监测设备级仪表盘")
@GetMapping(value = "/queryForLeftTableListByPointNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false) String POINTNAME) {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPointNum(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计", notes = "预警监测设备级统计")
@GetMapping(value = "/queryForPointNum")
public ResponseModel<List<Map<String,Object>>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String EQUIPMENTNAME) {
List<Map<String, Object>> maps = idxBizPvHealthIndexServiceImpl.warningData(STATION, SUBARRAY, EQUIPMENTNAME);
int total = idxBizPvHealthIndexServiceImpl.pointNum(STATION, SUBARRAY, EQUIPMENTNAME);
Map<String,Object> warningNum =new HashMap<>();
warningNum.put("name","异常");
warningNum.put("value",maps.size());
Map<String,Object> pointNum =new HashMap<>();
pointNum.put("name","正常");
pointNum.put("value",total - maps.size());
List<Map<String,Object>> list = new ArrayList<>();
list.add(pointNum);
list.add(warningNum);
return ResponseHelper.buildResponse(list);
}
}
......@@ -46,10 +46,10 @@ public class IdxBizFanWarningRecordDto{
private String disposotionState;
@TableField("HEALTH_INDEX_SEQ")
private Integer healthIndexSeq;
private String healthIndexSeq;
@TableField("ANALYSIS_POINT_ID")
private Integer analysisPointId;
private String analysisPointId;
@ApiModelProperty(value = "预警等级")
@TableField("WARNING_NAME")
......@@ -73,7 +73,7 @@ public class IdxBizFanWarningRecordDto{
@ApiModelProperty(value = "网关ID")
@TableField("GATEWAY_ID")
private Integer gatewayId;
private String gatewayId;
@ApiModelProperty(value = "点表地址")
@TableField("INDEX_ADDRESS")
......
......@@ -99,5 +99,9 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<String> getAddressInfo();
List<IdxBizFanHealthIndexDto> queryForLeftTableList(String STATION,String HEALTHLEVEL);
List<Map<String,Object>> queryForLeftTableList(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,Integer current,Integer size);
int queryForLeftTableListCount(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME);
Map<String,Object> queryForLeftTableListNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME);
}
......@@ -16,9 +16,19 @@ import java.util.Map;
public interface IdxBizPvHealthIndexMapper extends BaseMapper<IdxBizPvHealthIndex> {
List<Map<String,Object>> queryForLeftTableListByEquip(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME, Integer current, Integer size);
Map<String,Object> queryForLeftTableListByEquipNum(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME);
Map<String,Object> queryForLeftTableListByPointNum(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME);
int queryForLeftTableListByEquipCount(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME);
List<Map<String,Object>> queryForLeftTableListByPoint(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME,Integer current,Integer size);
int queryForLeftTableListByPointCount(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME);
List<Map<String,Object>> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Integer pointNum(String STATION, String SUBARRAY, String EQUIPMENTNAME);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -965,6 +966,7 @@ public class HealthStatusIndicatorServiceImpl {
riskBizInfoVo.setSourceAttribution(stationMap.get(idxBizPvWarningRecord.getGatewayId()).getProjectOrgCode());
riskBizInfoVo.setSourceAttributionDesc(idxBizPvWarningRecord.getStation());
riskBizInfoVo.setWarningObjectType("equip");
riskBizInfoVo.setWarningTime(DateUtil.now());
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>();
RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo();
dynamicDetailsVo.setTabName("预警详情");
......@@ -1000,6 +1002,7 @@ public class HealthStatusIndicatorServiceImpl {
riskBizInfoVo.setSourceAttribution(stationMap.get(idxBizFanWarningRecord.getGatewayId()).getProjectOrgCode());
riskBizInfoVo.setSourceAttributionDesc(idxBizFanWarningRecord.getStation());
riskBizInfoVo.setWarningObjectType("equip");
riskBizInfoVo.setWarningTime(DateUtil.now());
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>();
RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo();
dynamicDetailsVo.setTabName("预警详情");
......
......@@ -15,10 +15,11 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 服务实现类
*
......@@ -47,8 +48,16 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
return this.queryForList("" , false);
}
public List<IdxBizFanHealthIndexDto> queryForLeftTableList(String STATION,String HEALTHLEVEL){
return this.getBaseMapper().queryForLeftTableList(STATION,HEALTHLEVEL);
public List<Map<String,Object>> queryForLeftTableList(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME, Integer current, Integer size){
return this.getBaseMapper().queryForLeftTableList(STATION,HEALTHLEVEL,EQUIPMENTNAME,current,size);
}
public int queryForLeftTableListCount(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME){
return this.getBaseMapper().queryForLeftTableListCount(STATION,HEALTHLEVEL,EQUIPMENTNAME);
}
public Map<String,Object> queryForLeftTableListNum(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME){
return this.getBaseMapper().queryForLeftTableListNum(STATION,HEALTHLEVEL,EQUIPMENTNAME);
}
......
......@@ -37,6 +37,13 @@ public class IdxBizPvHealthIndexServiceImpl extends BaseService<IdxBizPvHealthIn
public List<Map<String,Object>> queryForLeftTableListByEquip(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME, Integer current, Integer size) {
return this.getBaseMapper().queryForLeftTableListByEquip(STATION, SUBARRAY, HEALTHLEVEL,EQUIPMENTNAME,current,size);
}
public Map<String,Object>queryForLeftTableListByEquipNum(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME) {
return this.getBaseMapper().queryForLeftTableListByEquipNum(STATION, SUBARRAY, HEALTHLEVEL,EQUIPMENTNAME);
}
public Map<String,Object>queryForLeftTableListByPointNum(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME) {
return this.getBaseMapper().queryForLeftTableListByPointNum(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME);
}
public List<Map<String,Object>> queryForLeftTableListByPoint(String STATION, String SUBARRAY, String HEALTHLEVEL, String EQUIPMENTNAME,String POINTNAME,Integer current,Integer size) {
return this.getBaseMapper().queryForLeftTableListByPoint(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME,current,size);
......@@ -50,4 +57,13 @@ public class IdxBizPvHealthIndexServiceImpl extends BaseService<IdxBizPvHealthIn
return this.getBaseMapper().queryForLeftTableListByEquipCount(STATION, SUBARRAY, HEALTHLEVEL,EQUIPMENTNAME);
}
public int pointNum(String STATION, String SUBARRAY,String EQUIPMENTNAME) {
return this.getBaseMapper().pointNum(STATION, SUBARRAY,EQUIPMENTNAME);
}
public List<Map<String,Object>> warningData(String STATION, String SUBARRAY , String EQUIPMENTNAME) {
return this.getBaseMapper().warningData(STATION, SUBARRAY, EQUIPMENTNAME);
}
}
\ No newline at end of file
......@@ -38,7 +38,7 @@
idx_biz_fan_warning_record
) a
<where>
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND DATE_FORMAT( a.disposotionState, '%Y-%m-%d' ) = CURRENT_DATE))
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND a.disposotionDate > DATE_ADD( now(), INTERVAL - 3 DAY )))
<if test="arae != '' and arae != null">
AND a.arae like concat('%', #{arae}, '%')
</if>
......@@ -99,7 +99,7 @@
idx_biz_fan_warning_record
) a
<where>
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND DATE_FORMAT( a.disposotionDate, '%Y-%m-%d' ) = CURRENT_DATE))
((a.disposotionState = '未处置') or (a.disposotionState = '已处置' AND a.disposotionDate > DATE_ADD( now(), INTERVAL - 3 DAY )))
<if test="arae != '' and arae != null">
AND a.arae like concat('%', #{arae}, '%')
</if>
......
......@@ -13,7 +13,7 @@
b.HEALTH_INDEX as value,
b.HEALTH_LEVEL,
CONCAT( '子阵 ', b.SUBARRAY ) AS 子阵,
( CASE b.HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '告警' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS STATUS,
( CASE b.HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '告警' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status,
b.REC_DATE,
b.SUBARRAY
FROM
......@@ -23,20 +23,43 @@
b.ANALYSIS_TYPE = '按天'
<if test="SUBARRAY != '' and SUBARRAY != null">
AND b.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != '' and STATION != null">
AND b.STATION = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND b.EQUIPMENT_NAME = #{EQUIPMENT_NAME}
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
order by b.HEALTH_INDEX DESC
limit ${current},${size}
</select>
<select id="queryForLeftTableListByEquipNum"
resultType="map">
SELECT
b.HEALTH_INDEX as value
FROM
`idx_biz_pv_health_index` b
WHERE
DATE_FORMAT(b.REC_DATE,"%Y-%m-%d") = DATE_FORMAT(NOW(),"%Y-%m-%d") AND b.ANALYSIS_OBJ_TYPE = '设备' AND
b.ANALYSIS_TYPE = '按天'
<if test="SUBARRAY != '' and SUBARRAY != null">
AND b.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != '' and STATION != null">
AND b.STATION = #{STATION}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="HEALTHLEVEL != '' and HEALTHLEVEL != null">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
</select>
<select id="queryForLeftTableListByEquipCount"
resultType="int">
SELECT
......@@ -58,7 +81,7 @@
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND b.EQUIPMENT_NAME = #{EQUIPMENT_NAME}
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</select>
......@@ -76,6 +99,7 @@
HEALTH_INDEX,
HEALTH_INDEX as value,
HEALTH_LEVEL,
( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '告警' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status,
SUBARRAY,
REC_DATE,
EQUIPMENT_NAME,
......@@ -110,13 +134,15 @@
AND b.POINT_NAME = #{POINTNAME}
</if>
</where>
order by b.HEALTH_INDEX DESC
limit ${current},${size}
</select>
<select id="queryForLeftTableListByPointCount"
resultType="int">
SELECT
COUNT(b.*) as value
COUNT(1) as value
FROM
(
SELECT
......@@ -161,4 +187,99 @@
</where>
</select>
<select id="queryForLeftTableListByPointNum"
resultType="map">
SELECT
HEALTH_INDEX as value
FROM
(
SELECT
POINT_NAME ,
STATION,
HEALTH_INDEX,
HEALTH_INDEX as value,
HEALTH_LEVEL,
SUBARRAY,
REC_DATE,
EQUIPMENT_NAME,
INDEX_ADDRESS,
ANALYSIS_OBJ_SEQ,
ANALYSIS_TYPE
FROM
`idx_biz_pv_health_index`
WHERE
ANALYSIS_OBJ_TYPE = '测点'
AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 1 HOUR ) )
OR ( REC_DATE >= CURRENT_DATE ( ) AND ANALYSIS_TYPE = '按天' )
OR ( ANALYSIS_TYPE = '按时刻' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 10 MINUTE ) )
) b
INNER JOIN idx_biz_pv_warning_rule_set rule ON rule.ANALYSIS_POINT_ID = b.ANALYSIS_OBJ_SEQ
AND rule.WARNING_NAME = '注意'
AND rule.ANALYSIS_TYPE = b.ANALYSIS_TYPE
<where>
<if test="STATION != null and STATION != '' ">
b.STATION = #{STATION}
</if>
<if test="EQUIPMENTNAME != null and EQUIPMENTNAME != '' ">
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND b.SUBARRAY = #{SUBARRAY}
</if>
<if test="HEALTHLEVEL != null and HEALTHLEVEL != '' ">
AND b.HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if test="POINTNAME != null and POINTNAME != '' ">
AND b.INDEX_ADDRESS = #{POINTNAME}
</if>
</where>
</select>
<select id="warningData" resultType="map">
SELECT * FROM (SELECT
cl. STATION,
cl. SUBARRAY,
cl.EQUIPMENT_NAME
FROM
idx_biz_pv_point_process_variable_classification cl
INNER JOIN idx_biz_pv_warning_record re ON re.EQUIPMENT_NAME = cl.EQUIPMENT_NAME AND re.STATION = cl.STATION AND re.SUBARRAY = cl.SUBARRAY
AND re.`STATUS` = 0
WHERE
cl.TAG_CODE = '分析变量'
GROUP BY cl.EQUIPMENT_NAME) a
<where>
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND a.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != null and STATION != '' ">
AND a.STATION = #{STATION}
</if>
</where>
</select>
<select id="pointNum" resultType="int">
SELECT
count(1)
FROM
idx_biz_pv_point_process_variable_classification cl
WHERE
cl.TAG_CODE = '分析变量'
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND cl.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
<if test="SUBARRAY != null and SUBARRAY != '' ">
AND cl.SUBARRAY = #{SUBARRAY}
</if>
<if test="STATION != null and STATION != '' ">
AND cl.STATION = #{STATION}
</if>
</select>
</mapper>
......@@ -72,16 +72,6 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto, Statio
}
/**
* 列表查询 示例
*/
public List<StationBasicDto> queryForStationBasicList() {
return this.queryForList("", false);
}
private CompanyModel addCompanyModel(CompanyModel companyModel) {
FeignClientResult<CompanyModel> Model = Privilege.companyClient.create(companyModel);
CompanyModel user = new CompanyModel();
......
package com.yeejoin.amos.boot.module.jxiop.biz.tasks;
import com.yeejoin.amos.boot.module.jxiop.api.dto.DeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @description: 定时获取场站最新数据
* @author: tw
* @createDate: 2023/7/3
*/
@Component
@EnableScheduling
public class StationDataTask {
@Autowired
StationDataTaskImpl stationDataTask;
//定时获取场站指标最新数据
// @Scheduled(cron = "${station.task.cron}")
// public void getStationDataTask(){
// //获取所有场站信息
// List<StationTaksDto> list=stationDataTask.getListStationBasic();
// for (StationTaksDto stationTaksDto : list) {
// //获取分机
// List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
// if(listDeviceDto!=null&&listDeviceDto.size()>0){
// for (DeviceDto deviceDto : listDeviceDto) {
// List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
// }
// }
// }
// }
}
......@@ -206,7 +206,7 @@
IFNULL(SCCJ, '') as source,
'' as stationName,
IFNULL(QRCODE_COLOR, 'green') as qrCodeColor,
IFNULL(UPDATE_TIME, '') AS recDate
IFNULL(UPDATE_STAMP, '') AS recDate
FROM
sjgl_zsj_zsbtz
where SBBM = #{objectId}
......
package com.yeejoin.amos.boot.module.jxiop.api.mapper4;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentSpecificIndex;
public interface EquipmentSpecificIndexMapper extends BaseMapper<EquipmentSpecificIndex>{
}
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Properties;
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.jxiop.api.mapper4", sqlSessionFactoryRef = "forthSqlSessionFactory")
public class ForthDbConfig {
private Logger logger = LoggerFactory.getLogger(ForthDbConfig.class);
// 精确到 master 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/forth/*.xml";
@Value("${spring.db4.datasource.url}")
private String dbUrl;
@Value("${spring.db4.datasource.username}")
private String username;
@Value("${spring.db4.datasource.password}")
private String password;
@Value("${spring.db4.datasource.driver-class-name}")
private String driverClassName;
@Bean(name="forthDataSource") //声明其为Bean实例
public DataSource masterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "forthTransactionManager")
public DataSourceTransactionManager masterTransactionManager() {
return new DataSourceTransactionManager(masterDataSource());
}
@Bean(name = "forthSqlSessionFactory")
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("forthDataSource") DataSource masterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(masterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(ForthDbConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.api.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
//分页插件
Interceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("helperDialect", "mysql");
properties.setProperty("offsetAsPageNum", "true");
properties.setProperty("rowBoundsWithCount", "true");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params","pageNum=pageNum;pageSize=pageSize" +
"" +
";");
interceptor.setProperties(properties);
sessionFactory.setPlugins(new Interceptor[] {interceptor});
return sessionFactory.getObject();
}
}
......@@ -222,24 +222,24 @@ public class DemoController extends BaseController {
equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> {
ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get();
esEquipments.setEquipmentIndexName(equipmentsJxiopDocMysql.getEquipmentIndexName());
esEquipments.setEquipmentNumber(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getEquipmentNumber())?"":equipmentsJxiopDocMysql.getEquipmentNumber());
esEquipments.setEquipmentNumber(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getEquipmentNumber()) ? "" : equipmentsJxiopDocMysql.getEquipmentNumber());
esEquipments.setIsAlarm(equipmentsJxiopDocMysql.getIsAlarm());
esEquipments.setDataType(equipmentsJxiopDocMysql.getDataType());
esEquipments.setGatewayId(equipmentsJxiopDocMysql.getGatewayId());
esEquipments.setAddress(equipmentsJxiopDocMysql.getAddress());
esEquipments.setEquipmentSpecificName(equipmentsJxiopDocMysql.getEquipmentSpecificName());
//更新显示名称
esEquipments.setDisplayName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getDisplayName())?"":equipmentsJxiopDocMysql.getDisplayName());
esEquipments.setDisplayName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getDisplayName()) ? "" : equipmentsJxiopDocMysql.getDisplayName());
//更新排序号
esEquipments.setTraceId(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getTraceId())?"":equipmentsJxiopDocMysql.getTraceId());
esEquipments.setTraceId(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getTraceId()) ? "" : equipmentsJxiopDocMysql.getTraceId());
//更新单位
esEquipments.setUnit(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getUnit())?"":equipmentsJxiopDocMysql.getUnit());
esEquipments.setUnit(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getUnit()) ? "" : equipmentsJxiopDocMysql.getUnit());
//更新frontModule
esEquipments.setFrontModule(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getFrontModule())?"":equipmentsJxiopDocMysql.getFrontModule());
esEquipments.setFrontModule(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getFrontModule()) ? "" : equipmentsJxiopDocMysql.getFrontModule());
//更新systemType
esEquipments.setSystemType(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getSystemType())?"":equipmentsJxiopDocMysql.getSystemType());
esEquipments.setSystemType(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getSystemType()) ? "" : equipmentsJxiopDocMysql.getSystemType());
//更新图片名称
esEquipments.setPictureName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getPictureName())?"":equipmentsJxiopDocMysql.getPictureName());
esEquipments.setPictureName(ObjectUtils.isEmpty(equipmentsJxiopDocMysql.getPictureName()) ? "" : equipmentsJxiopDocMysql.getPictureName());
equipmentsRepository.save(esEquipments);
});
......@@ -254,16 +254,20 @@ public class DemoController extends BaseController {
List<Object> pointImportDtoList = EasyExcel.read(inputStream).head(PointImportDto.class).sheet(0).headRowNumber(1).doReadSync();
pointImportDtoList.forEach(o -> {
PointImportDto pointImportDto = (PointImportDto) o;
List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("gateway_id", pointImportDto.getGatewayId()).eq("equipment_index_name",pointImportDto.getEquipmentIndexName()));
if(!ObjectUtils.isEmpty(equipmentsJxiopDocMysqlList)){
List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("gateway_id", pointImportDto.getGatewayId()).eq("equipment_index_name", pointImportDto.getEquipmentIndexName()));
if (!ObjectUtils.isEmpty(equipmentsJxiopDocMysqlList)) {
equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> {
ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get();
//更新模块
equipmentsJxiopDocMysql.setFrontModule(pointImportDto.getFrontModule());
esEquipments.setFrontModule(pointImportDto.getFrontModule());
if (equipmentsJxiopDocMysql.getFrontModule().contains(pointImportDto.getFrontModule())) {
equipmentsJxiopDocMysql.setFrontModule(equipmentsJxiopDocMysql.getFrontModule() + "," + pointImportDto.getFrontModule());
esEquipments.setFrontModule(equipmentsJxiopDocMysql.getFrontModule() + "," + pointImportDto.getFrontModule());
}
//更新类型
equipmentsJxiopDocMysql.setSystemType(pointImportDto.getSystemType());
esEquipments.setSystemType(pointImportDto.getSystemType());
if (equipmentsJxiopDocMysql.getSystemType().contains(pointImportDto.getSystemType())) {
equipmentsJxiopDocMysql.setSystemType(equipmentsJxiopDocMysql.getSystemType()+","+pointImportDto.getSystemType());
esEquipments.setSystemType(equipmentsJxiopDocMysql.getSystemType()+","+pointImportDto.getSystemType());
}
//更新排序号
equipmentsJxiopDocMysql.setTraceId(pointImportDto.getTraceId());
esEquipments.setTraceId(pointImportDto.getTraceId());
......@@ -271,7 +275,7 @@ public class DemoController extends BaseController {
equipmentsJxiopDocMysql.setDisplayName(pointImportDto.getDisplayName());
esEquipments.setDisplayName(pointImportDto.getDisplayName());
//更新单位 如果单位为空或者单位超过周期性数据存储长度则丢弃单位更新操作
if(!ObjectUtils.isEmpty(pointImportDto.getUnit())&&(pointImportDto.getUnit().toCharArray().length<24)){
if (!ObjectUtils.isEmpty(pointImportDto.getUnit()) && (pointImportDto.getUnit().toCharArray().length < 24)) {
equipmentsJxiopDocMysql.setUnit(pointImportDto.getUnit());
esEquipments.setUnit(pointImportDto.getUnit());
}
......
......@@ -403,7 +403,7 @@ public class MonitorFanIdxController extends BaseController {
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
try {
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, frontModule, stringStringEntry.getKey()), JSON.toJSONString(result).getBytes(), 0, false);
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, frontModule, stringStringEntry.getKey()), JSON.toJSONString(result).getBytes(), 1, true);
} catch (MqttException e) {
e.printStackTrace();
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("wl_equipment_specific_index")
public class EquipmentSpecificIndex {
@TableField("id")
private Long id;
@TableField("equipment_specific_id")
private Long address;
@TableField("value")
private String value;
@TableField("create_date")
private Date createDate;
@TableField("equipment_index_id")
private Long equipmentIndexId;
@TableField("update_date")
private Date updateDate;
@TableField("equipment_specific_name")
private String equipmentSpecificName;
@TableField("equipment_index_name")
private String equipmentIndexName;
@TableField("equipment_index_key")
private String equipmentIndexKey;
@TableField("value_label")
private String valueLabel;
@TableField("value_enum")
private String valueEnum;
@TableField("emergency_level_color")
private String emergencyLevelColor;
@TableField("is_alarm")
private boolean isAlarm;
@TableField("emergency_level")
private String emergencyLevel;
@TableField("emergency_level_describe")
private String emergencyLevelDescribe;
@TableField("trace_id")
private String traceId;
@TableField("index_address")
private String indexAddress;
@TableField("station")
private String station;
@TableField("quality")
private boolean quality;
@TableField("data_type")
private String dataType;
@TableField("time_stamp")
private String timeStamp;
@TableField("gateway_id")
private String gatewayId;
@TableField("unit")
private String unit;
}
......@@ -12,6 +12,13 @@ spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
## db4-equip
spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db4.datasource.url=jdbc:mysql://139.9.173.44:3306/equipment?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db4.datasource.username=root
spring.db4.datasource.password=Yeejoin@2020
spring.db4.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
## db3-td-engine
#spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
......
<?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.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipmentSpecificIndexMapper">
</mapper>
......@@ -110,6 +110,10 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
}
String valueEnum = equipmentSpecificIndex.getValueEnum();
JSONArray arr = JSONObject.parseArray(valueEnum);
if(arr==null)
{
continue;
}
for (Object o : arr) {
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(o));
if (json.containsKey("key") && value.equals(json.get("key"))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment