完成大数据页面
This commit is contained in:
parent
6da979a9a2
commit
cd6377eae5
@ -4,6 +4,7 @@ import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
|||||||
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
||||||
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
||||||
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
||||||
|
import com.cm.tenlion.pollutantdata.service.enterprise.IEnterpriseService;
|
||||||
import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService;
|
import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService;
|
||||||
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
|
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
|
||||||
import com.cm.tenlion.pollutantdata.utils.net.TCPServer;
|
import com.cm.tenlion.pollutantdata.utils.net.TCPServer;
|
||||||
@ -22,6 +23,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
@SpringBootApplication(scanBasePackages = {"com.cm"})
|
@SpringBootApplication(scanBasePackages = {"com.cm"})
|
||||||
@MapperScan({"com.cm.**.dao"})
|
@MapperScan({"com.cm.**.dao"})
|
||||||
public class PollutantDataApplication {
|
public class PollutantDataApplication {
|
||||||
|
@Autowired
|
||||||
|
private IEnterpriseService enterpriseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IInstrumentService instrumentService;
|
private IInstrumentService instrumentService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -49,6 +52,7 @@ public class PollutantDataApplication {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
TCPServer tcpServer = new TCPServer(6666);
|
TCPServer tcpServer = new TCPServer(6666);
|
||||||
|
tcpServer.setEnterpriseService(enterpriseService);
|
||||||
tcpServer.setInstrumentService(instrumentService);
|
tcpServer.setInstrumentService(instrumentService);
|
||||||
tcpServer.setCollectorService(collectorService);
|
tcpServer.setCollectorService(collectorService);
|
||||||
tcpServer.setDataMinuteService(dataMinuteService);
|
tcpServer.setDataMinuteService(dataMinuteService);
|
||||||
|
@ -3,6 +3,7 @@ package com.cm.tenlion.pollutantdata.controller.api.count;
|
|||||||
import com.cm.common.constants.ISystemConstant;
|
import com.cm.common.constants.ISystemConstant;
|
||||||
import com.cm.common.result.ErrorResult;
|
import com.cm.common.result.ErrorResult;
|
||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO;
|
||||||
import com.cm.tenlion.pollutantdata.service.count.ICountService;
|
import com.cm.tenlion.pollutantdata.service.count.ICountService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -55,10 +56,10 @@ public class CountController {
|
|||||||
|
|
||||||
@ApiOperation(value = "污染因子列表", notes = "污染因子列表接口")
|
@ApiOperation(value = "污染因子列表", notes = "污染因子列表接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("list-pollid/{type}")
|
@GetMapping("list-enterprise-pollid/{type}")
|
||||||
public List<String> listPollId(@PathVariable("type") Integer type,
|
public List<EnterprisePollDTO> listPollId(@PathVariable("type") Integer type,
|
||||||
@RequestParam(name = "enterpriseId", required = false) String enterpriseId) {
|
@RequestParam(name = "enterpriseId", required = false) String enterpriseId) {
|
||||||
return countService.listPollId(type, enterpriseId);
|
return countService.listEnterprisePollId(type, enterpriseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "历史数据1", notes = "历史数据1接口")
|
@ApiOperation(value = "历史数据1", notes = "历史数据1接口")
|
||||||
@ -66,8 +67,15 @@ public class CountController {
|
|||||||
@GetMapping("count-history-value/{type}/{pollId}/{enterpriseId}")
|
@GetMapping("count-history-value/{type}/{pollId}/{enterpriseId}")
|
||||||
public SuccessResultData<Map<String, Object>> countHistoryValue1(@PathVariable("type") Integer type,
|
public SuccessResultData<Map<String, Object>> countHistoryValue1(@PathVariable("type") Integer type,
|
||||||
@PathVariable("pollId") String pollId,
|
@PathVariable("pollId") String pollId,
|
||||||
@RequestParam(name = "enterpriseId", required = false) String enterpriseId) {
|
@PathVariable("enterpriseId") String enterpriseId) {
|
||||||
return countService.countHistoryValue1(type, pollId, enterpriseId);
|
return countService.countHistoryValue1(type, pollId, enterpriseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "统计污染因子上报数量", notes = "统计污染因子上报数量接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("count-report-pollid")
|
||||||
|
public SuccessResultData<Map<String, Object>> countReportPollId() {
|
||||||
|
return countService.countReportPollId();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.cm.tenlion.pollutantdata.dao.dataminute;
|
|||||||
|
|
||||||
import com.cm.tenlion.pollutantdata.pojo.bos.dataminute.DataMinuteBO;
|
import com.cm.tenlion.pollutantdata.pojo.bos.dataminute.DataMinuteBO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.DataMinuteDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.DataMinuteDTO;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.RemoveException;
|
||||||
import com.cm.common.exception.SaveException;
|
import com.cm.common.exception.SaveException;
|
||||||
@ -135,6 +136,15 @@ public interface IDataMinuteDao {
|
|||||||
*/
|
*/
|
||||||
List<String> listPollId(Map<String, Object> params) throws SearchException;
|
List<String> listPollId(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业污染因子列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<EnterprisePollDTO> listEnterprisePollId(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最新实时数据
|
* 最新实时数据
|
||||||
*
|
*
|
||||||
|
@ -75,7 +75,11 @@ public enum QnRtdEnum {
|
|||||||
/**
|
/**
|
||||||
* 采集器编码空
|
* 采集器编码空
|
||||||
*/
|
*/
|
||||||
CUSTOM_CP_SN_ERROR(110006);
|
CUSTOM_CP_SN_ERROR(110006),
|
||||||
|
/**
|
||||||
|
* 企业不存在
|
||||||
|
*/
|
||||||
|
CUSTOM_ENTERPRISE_ERROR(110007);
|
||||||
|
|
||||||
private int value;
|
private int value;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.cm.tenlion.pollutantdata.manager;
|
package com.cm.tenlion.pollutantdata.manager;
|
||||||
|
|
||||||
|
import com.cm.tenlion.pollutantdata.enums.BigDataTypeEnum;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.BigDataWebSocketData;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.OnlineCollector;
|
import com.cm.tenlion.pollutantdata.pojo.OnlineCollector;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.collector.CollectorDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.collector.CollectorDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -47,15 +49,12 @@ public class CollectorManager {
|
|||||||
public void addCollector(String channelId, CollectorDTO collectorDTO) {
|
public void addCollector(String channelId, CollectorDTO collectorDTO) {
|
||||||
OnlineCollector onlineCollector = getCollector(channelId);
|
OnlineCollector onlineCollector = getCollector(channelId);
|
||||||
if (onlineCollector == null) {
|
if (onlineCollector == null) {
|
||||||
log.debug("{} 采集器设备接入", onlineCollector.getCollectorDTO().getCollectorMn());
|
log.debug("{} 采集器设备接入", collectorDTO.getCollectorMn());
|
||||||
onlineCollector = new OnlineCollector();
|
onlineCollector = new OnlineCollector();
|
||||||
onlineCollector.setChannelId(channelId);
|
onlineCollector.setChannelId(channelId);
|
||||||
onlineCollector.setCollectorDTO(collectorDTO);
|
onlineCollector.setCollectorDTO(collectorDTO);
|
||||||
onlineCollector.setLastUploadDataTime(System.currentTimeMillis());
|
onlineCollector.setLastUploadDataTime(System.currentTimeMillis());
|
||||||
collectors.put(channelId, onlineCollector);
|
collectors.put(channelId, onlineCollector);
|
||||||
|
|
||||||
// 通知有统计的页面刷新
|
|
||||||
// WebSocketManager.getInstance().sendMessage(new BigDataWebSocketData<>(BigDataTypeEnum.ONLINE_COUNT, collectors.size()));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onlineCollector.setLastUploadDataTime(System.currentTimeMillis());
|
onlineCollector.setLastUploadDataTime(System.currentTimeMillis());
|
||||||
@ -137,7 +136,13 @@ public class CollectorManager {
|
|||||||
public void deleteCollector(String channelId) {
|
public void deleteCollector(String channelId) {
|
||||||
OnlineCollector onlineCollector = getCollector(channelId);
|
OnlineCollector onlineCollector = getCollector(channelId);
|
||||||
if (onlineCollector != null) {
|
if (onlineCollector != null) {
|
||||||
log.debug("{} 采集器设备离线", onlineCollector.getCollectorDTO().getCollectorMn());
|
String message = String.format("%s %s 采集仪的 %s 采集器离线",
|
||||||
|
onlineCollector.getCollectorDTO().getEnterpriseName(),
|
||||||
|
onlineCollector.getCollectorDTO().getInstrumentName(),
|
||||||
|
onlineCollector.getCollectorDTO().getCollectorMn());
|
||||||
|
log.debug(message);
|
||||||
|
// 通知有统计的页面刷新
|
||||||
|
WebSocketManager.getInstance().sendMessage(new BigDataWebSocketData<>(BigDataTypeEnum.OFFLINE_MESSAGE, message));
|
||||||
collectors.remove(channelId);
|
collectors.remove(channelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.cm.tenlion.pollutantdata.pojo.dtos.dataminute;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When you feel like quitting. Think about why you started
|
||||||
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
|
*
|
||||||
|
* @ClassName: EnterprisePollDTO
|
||||||
|
* @Description: 企业污染因子列表
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2021/3/26 9:40 上午
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@ApiModel
|
||||||
|
@Data
|
||||||
|
public class EnterprisePollDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "enterpriseId", value = "企业ID")
|
||||||
|
private String enterpriseId;
|
||||||
|
@ApiModelProperty(name = "pollId", value = "污染因子编码")
|
||||||
|
private String pollId;
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.cm.tenlion.pollutantdata.service.count;
|
package com.cm.tenlion.pollutantdata.service.count;
|
||||||
|
|
||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -46,7 +47,7 @@ public interface ICountService {
|
|||||||
* @param enterpriseId
|
* @param enterpriseId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> listPollId(Integer type, String enterpriseId);
|
List<EnterprisePollDTO> listEnterprisePollId(Integer type, String enterpriseId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 历史数据1
|
* 历史数据1
|
||||||
@ -58,4 +59,10 @@ public interface ICountService {
|
|||||||
*/
|
*/
|
||||||
SuccessResultData<Map<String, Object>> countHistoryValue1(Integer type, String pollId, String enterpriseId);
|
SuccessResultData<Map<String, Object>> countHistoryValue1(Integer type, String pollId, String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计污染因子上报数量
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SuccessResultData<Map<String, Object>> countReportPollId();
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.cm.common.constants.ISystemConstant;
|
|||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.utils.DateUtil;
|
import com.cm.common.utils.DateUtil;
|
||||||
import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
||||||
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
||||||
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
||||||
@ -142,12 +143,12 @@ public class CountServiceImpl extends AbstractService implements ICountService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listPollId(Integer type, String enterpriseId) {
|
public List<EnterprisePollDTO> listEnterprisePollId(Integer type, String enterpriseId) {
|
||||||
Map<String, Object> params = getHashMap(8);
|
Map<String, Object> params = getHashMap(8);
|
||||||
params.put("startTime", getStartTime(type));
|
params.put("startTime", getStartTime(type));
|
||||||
params.put("enterpriseId", enterpriseId);
|
params.put("enterpriseId", enterpriseId);
|
||||||
// 污染物因子列表
|
// 污染物因子列表
|
||||||
return dataMinuteService.listPollId(params);
|
return dataMinuteService.listEnterprisePollId(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -175,9 +176,9 @@ public class CountServiceImpl extends AbstractService implements ICountService {
|
|||||||
rtdData.put("data", yRtdData);
|
rtdData.put("data", yRtdData);
|
||||||
yList.add(rtdData);
|
yList.add(rtdData);
|
||||||
Map<String, Object> zsRtdData = getHashMap(6);
|
Map<String, Object> zsRtdData = getHashMap(6);
|
||||||
rtdData.put("name", "折算实时数据");
|
zsRtdData.put("name", "折算实时数据");
|
||||||
rtdData.put("type", "line");
|
zsRtdData.put("type", "line");
|
||||||
rtdData.put("data", yZsRtdData);
|
zsRtdData.put("data", yZsRtdData);
|
||||||
yList.add(zsRtdData);
|
yList.add(zsRtdData);
|
||||||
params.clear();
|
params.clear();
|
||||||
params.put("xList", xList);
|
params.put("xList", xList);
|
||||||
@ -185,6 +186,25 @@ public class CountServiceImpl extends AbstractService implements ICountService {
|
|||||||
return new SuccessResultData<>(params);
|
return new SuccessResultData<>(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultData<Map<String, Object>> countReportPollId() {
|
||||||
|
Map<String, Object> param = getHashMap(2);
|
||||||
|
List<String> pollIds = dataMinuteService.listPollId(param);
|
||||||
|
|
||||||
|
List<Map<String, Object>> pollDatas = new ArrayList<>();
|
||||||
|
for (String pollId : pollIds) {
|
||||||
|
param.put("pollId", pollId);
|
||||||
|
Integer count = dataMinuteService.count(param);
|
||||||
|
Map<String, Object> pollData = getHashMap(4);
|
||||||
|
pollData.put("name", pollId);
|
||||||
|
pollData.put("value", count);
|
||||||
|
pollDatas.add(pollData);
|
||||||
|
}
|
||||||
|
param.clear();
|
||||||
|
param.put("pollDatas", pollDatas);
|
||||||
|
return new SuccessResultData<>(param);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取开始时间
|
* 获取开始时间
|
||||||
*
|
*
|
||||||
|
@ -2,6 +2,7 @@ package com.cm.tenlion.pollutantdata.service.dataminute;
|
|||||||
|
|
||||||
import com.cm.tenlion.pollutantdata.pojo.bos.dataminute.DataMinuteBO;
|
import com.cm.tenlion.pollutantdata.pojo.bos.dataminute.DataMinuteBO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.DataMinuteDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.DataMinuteDTO;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.vos.dataminute.DataMinuteVO;
|
import com.cm.tenlion.pollutantdata.pojo.vos.dataminute.DataMinuteVO;
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
@ -201,6 +202,14 @@ public interface IDataMinuteService {
|
|||||||
*/
|
*/
|
||||||
List<String> listPollId(Map<String, Object> params);
|
List<String> listPollId(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 污染因子列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EnterprisePollDTO> listEnterprisePollId(Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最新实时数据
|
* 最新实时数据
|
||||||
*
|
*
|
||||||
|
@ -3,6 +3,7 @@ package com.cm.tenlion.pollutantdata.service.dataminute.impl;
|
|||||||
import com.cm.tenlion.pollutantdata.dao.dataminute.IDataMinuteDao;
|
import com.cm.tenlion.pollutantdata.dao.dataminute.IDataMinuteDao;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.bos.dataminute.DataMinuteBO;
|
import com.cm.tenlion.pollutantdata.pojo.bos.dataminute.DataMinuteBO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.DataMinuteDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.DataMinuteDTO;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
import com.cm.tenlion.pollutantdata.pojo.pos.dataminute.DataMinutePO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.vos.dataminute.DataMinuteVO;
|
import com.cm.tenlion.pollutantdata.pojo.vos.dataminute.DataMinuteVO;
|
||||||
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
||||||
@ -182,6 +183,11 @@ public class DataMinuteServiceImpl extends AbstractService implements IDataMinut
|
|||||||
return dataMinuteDao.listPollId(params);
|
return dataMinuteDao.listPollId(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EnterprisePollDTO> listEnterprisePollId(Map<String, Object> params) {
|
||||||
|
return dataMinuteDao.listEnterprisePollId(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Double getLastRtd(Map<String, Object> params) {
|
public Double getLastRtd(Map<String, Object> params) {
|
||||||
return dataMinuteDao.getLastRtd(params);
|
return dataMinuteDao.getLastRtd(params);
|
||||||
|
@ -3,10 +3,12 @@ package com.cm.tenlion.pollutantdata.utils.net;
|
|||||||
import com.cm.common.utils.RegexUtil;
|
import com.cm.common.utils.RegexUtil;
|
||||||
import com.cm.tenlion.pollutantdata.enums.*;
|
import com.cm.tenlion.pollutantdata.enums.*;
|
||||||
import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.enterprise.EnterpriseDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.instrument.InstrumentDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.instrument.InstrumentDTO;
|
||||||
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
||||||
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
||||||
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
||||||
|
import com.cm.tenlion.pollutantdata.service.enterprise.IEnterpriseService;
|
||||||
import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService;
|
import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService;
|
||||||
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
|
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
|
||||||
import com.cm.tenlion.pollutantdata.utils.HJ212DataUtil;
|
import com.cm.tenlion.pollutantdata.utils.HJ212DataUtil;
|
||||||
@ -40,17 +42,20 @@ import java.net.InetSocketAddress;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class TCPHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
public class TCPHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||||
|
|
||||||
|
private IEnterpriseService enterpriseService;
|
||||||
private IInstrumentService instrumentService;
|
private IInstrumentService instrumentService;
|
||||||
private ICollectorService collectorService;
|
private ICollectorService collectorService;
|
||||||
private IDataMinuteService dataMinuteService;
|
private IDataMinuteService dataMinuteService;
|
||||||
private IPollService pollService;
|
private IPollService pollService;
|
||||||
private IAlarmLogService alarmLogService;
|
private IAlarmLogService alarmLogService;
|
||||||
|
|
||||||
public TCPHandler(IInstrumentService instrumentService,
|
public TCPHandler(IEnterpriseService enterpriseService,
|
||||||
|
IInstrumentService instrumentService,
|
||||||
ICollectorService collectorService,
|
ICollectorService collectorService,
|
||||||
IDataMinuteService dataMinuteService,
|
IDataMinuteService dataMinuteService,
|
||||||
IPollService pollService,
|
IPollService pollService,
|
||||||
IAlarmLogService alarmLogService) {
|
IAlarmLogService alarmLogService) {
|
||||||
|
this.enterpriseService = enterpriseService;
|
||||||
this.instrumentService = instrumentService;
|
this.instrumentService = instrumentService;
|
||||||
this.collectorService = collectorService;
|
this.collectorService = collectorService;
|
||||||
this.dataMinuteService = dataMinuteService;
|
this.dataMinuteService = dataMinuteService;
|
||||||
@ -102,7 +107,7 @@ public class TCPHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
|||||||
}
|
}
|
||||||
InstrumentDTO instrumentDTO = instrumentService.getByMn(data.getMn());
|
InstrumentDTO instrumentDTO = instrumentService.getByMn(data.getMn());
|
||||||
if (instrumentDTO == null) {
|
if (instrumentDTO == null) {
|
||||||
log.debug("设备不存在");
|
log.debug("采集仪不存在");
|
||||||
new ResponseDefault(ctx, QnRtdEnum.MN_ERROR, ExeRtnEnum.COMMAND_ERROR, needResponse).response(data);
|
new ResponseDefault(ctx, QnRtdEnum.MN_ERROR, ExeRtnEnum.COMMAND_ERROR, needResponse).response(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -116,6 +121,12 @@ public class TCPHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
|||||||
new ResponseDefault(ctx, QnRtdEnum.ST_ERROR, ExeRtnEnum.COMMAND_ERROR, needResponse).response(data);
|
new ResponseDefault(ctx, QnRtdEnum.ST_ERROR, ExeRtnEnum.COMMAND_ERROR, needResponse).response(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
EnterpriseDTO enterpriseDTO = enterpriseService.get(instrumentDTO.getEnterpriseId());
|
||||||
|
if (enterpriseDTO == null) {
|
||||||
|
log.debug("采集仪的企业不存在");
|
||||||
|
new ResponseDefault(ctx, QnRtdEnum.CUSTOM_ENTERPRISE_ERROR, ExeRtnEnum.COMMAND_ERROR, needResponse).response(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (CnEnum.REAL_TIME.getValue() == data.getCn()) {
|
if (CnEnum.REAL_TIME.getValue() == data.getCn()) {
|
||||||
log.debug("保存实时数据");
|
log.debug("保存实时数据");
|
||||||
RealDataHandler realDataHandler = new RealDataHandler();
|
RealDataHandler realDataHandler = new RealDataHandler();
|
||||||
@ -123,7 +134,9 @@ public class TCPHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
|||||||
realDataHandler.setPollService(pollService);
|
realDataHandler.setPollService(pollService);
|
||||||
realDataHandler.setDataMinuteService(dataMinuteService);
|
realDataHandler.setDataMinuteService(dataMinuteService);
|
||||||
realDataHandler.setCollectorService(collectorService);
|
realDataHandler.setCollectorService(collectorService);
|
||||||
|
realDataHandler.setAlarmLogService(alarmLogService);
|
||||||
realDataHandler.setInstrumentDTO(instrumentDTO);
|
realDataHandler.setInstrumentDTO(instrumentDTO);
|
||||||
|
realDataHandler.setEnterpriseDTO(enterpriseDTO);
|
||||||
realDataHandler.handle(data, needResponse, ctx);
|
realDataHandler.handle(data, needResponse, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.cm.tenlion.pollutantdata.utils.net;
|
|||||||
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
import com.cm.tenlion.pollutantdata.service.alarmlog.IAlarmLogService;
|
||||||
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
import com.cm.tenlion.pollutantdata.service.collector.ICollectorService;
|
||||||
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
import com.cm.tenlion.pollutantdata.service.dataminute.IDataMinuteService;
|
||||||
|
import com.cm.tenlion.pollutantdata.service.enterprise.IEnterpriseService;
|
||||||
import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService;
|
import com.cm.tenlion.pollutantdata.service.instrument.IInstrumentService;
|
||||||
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
|
import com.cm.tenlion.pollutantdata.service.poll.IPollService;
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
@ -30,6 +31,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
**/
|
**/
|
||||||
public class TCPServer {
|
public class TCPServer {
|
||||||
|
|
||||||
|
private IEnterpriseService enterpriseService;
|
||||||
private IInstrumentService instrumentService;
|
private IInstrumentService instrumentService;
|
||||||
private ICollectorService collectorService;
|
private ICollectorService collectorService;
|
||||||
private IDataMinuteService dataMinuteService;
|
private IDataMinuteService dataMinuteService;
|
||||||
@ -82,7 +84,7 @@ public class TCPServer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 这里的对象必须new,否则只有第一次有效,其余无法连接,每次执行的后都需要new
|
// 这里的对象必须new,否则只有第一次有效,其余无法连接,每次执行的后都需要new
|
||||||
pipeline.addLast(new TCPHandler(instrumentService, collectorService, dataMinuteService, pollService, alarmLogService));
|
pipeline.addLast(new TCPHandler(enterpriseService, instrumentService, collectorService, dataMinuteService, pollService, alarmLogService));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -101,6 +103,10 @@ public class TCPServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEnterpriseService(IEnterpriseService enterpriseService) {
|
||||||
|
this.enterpriseService = enterpriseService;
|
||||||
|
}
|
||||||
|
|
||||||
public void setInstrumentService(IInstrumentService instrumentService) {
|
public void setInstrumentService(IInstrumentService instrumentService) {
|
||||||
this.instrumentService = instrumentService;
|
this.instrumentService = instrumentService;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.cm.tenlion.pollutantdata.utils.net.handle;
|
package com.cm.tenlion.pollutantdata.utils.net.handle;
|
||||||
|
|
||||||
import com.cm.common.utils.RegexUtil;
|
import com.cm.common.utils.RegexUtil;
|
||||||
|
import com.cm.tenlion.pollutantdata.enums.BigDataTypeEnum;
|
||||||
import com.cm.tenlion.pollutantdata.enums.DataCpFlagEnum;
|
import com.cm.tenlion.pollutantdata.enums.DataCpFlagEnum;
|
||||||
import com.cm.tenlion.pollutantdata.enums.ExeRtnEnum;
|
import com.cm.tenlion.pollutantdata.enums.ExeRtnEnum;
|
||||||
import com.cm.tenlion.pollutantdata.enums.QnRtdEnum;
|
import com.cm.tenlion.pollutantdata.enums.QnRtdEnum;
|
||||||
import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
import com.cm.tenlion.pollutantdata.manager.CollectorManager;
|
||||||
|
import com.cm.tenlion.pollutantdata.manager.WebSocketManager;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.BigDataWebSocketData;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.collector.CollectorDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.collector.CollectorDTO;
|
||||||
|
import com.cm.tenlion.pollutantdata.pojo.dtos.enterprise.EnterpriseDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.dtos.instrument.InstrumentDTO;
|
import com.cm.tenlion.pollutantdata.pojo.dtos.instrument.InstrumentDTO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.pos.poll.PollPO;
|
import com.cm.tenlion.pollutantdata.pojo.pos.poll.PollPO;
|
||||||
import com.cm.tenlion.pollutantdata.pojo.vos.alarmlog.AlarmLogVO;
|
import com.cm.tenlion.pollutantdata.pojo.vos.alarmlog.AlarmLogVO;
|
||||||
@ -40,6 +44,7 @@ public class RealDataHandler implements IDataHandle<HJ212DataUtil.Data> {
|
|||||||
private ICollectorService collectorService;
|
private ICollectorService collectorService;
|
||||||
private IPollService pollService;
|
private IPollService pollService;
|
||||||
private IDataMinuteService dataMinuteService;
|
private IDataMinuteService dataMinuteService;
|
||||||
|
private EnterpriseDTO enterpriseDTO;
|
||||||
private InstrumentDTO instrumentDTO;
|
private InstrumentDTO instrumentDTO;
|
||||||
private IAlarmLogService alarmLogService;
|
private IAlarmLogService alarmLogService;
|
||||||
private String ipAddress;
|
private String ipAddress;
|
||||||
@ -93,6 +98,8 @@ public class RealDataHandler implements IDataHandle<HJ212DataUtil.Data> {
|
|||||||
new ResponseDefault(ctx, QnRtdEnum.CUSTOM_CP_SN_ERROR, ExeRtnEnum.COMMAND_ERROR, isRepo).response(data);
|
new ResponseDefault(ctx, QnRtdEnum.CUSTOM_CP_SN_ERROR, ExeRtnEnum.COMMAND_ERROR, isRepo).response(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
collectorDTO.setEnterpriseName(enterpriseDTO.getEnterpriseName());
|
||||||
|
collectorDTO.setInstrumentName(instrumentDTO.getInstrumentName());
|
||||||
|
|
||||||
DataMinuteVO dataMinuteVO = new DataMinuteVO();
|
DataMinuteVO dataMinuteVO = new DataMinuteVO();
|
||||||
dataMinuteVO.setEnterpriseId(instrumentDTO.getEnterpriseId());
|
dataMinuteVO.setEnterpriseId(instrumentDTO.getEnterpriseId());
|
||||||
@ -110,7 +117,7 @@ public class RealDataHandler implements IDataHandle<HJ212DataUtil.Data> {
|
|||||||
CollectorManager.getInstance().addCollector(ctx.channel().id().toString(), collectorDTO);
|
CollectorManager.getInstance().addCollector(ctx.channel().id().toString(), collectorDTO);
|
||||||
// 超过报警值,记录报警日志
|
// 超过报警值,记录报警日志
|
||||||
if (dataMinuteVO.getRtd() > collectorDTO.getAlarmValue()) {
|
if (dataMinuteVO.getRtd() > collectorDTO.getAlarmValue()) {
|
||||||
saveAlarmLog(dataMinuteVO, collectorDTO.getAlarmValue());
|
saveAlarmLog(dataMinuteVO, collectorDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
new ResponseDefault(ctx, QnRtdEnum.READY, ExeRtnEnum.SUCCESS, isRepo).response(data);
|
new ResponseDefault(ctx, QnRtdEnum.READY, ExeRtnEnum.SUCCESS, isRepo).response(data);
|
||||||
@ -120,10 +127,10 @@ public class RealDataHandler implements IDataHandle<HJ212DataUtil.Data> {
|
|||||||
* 保存报警日志
|
* 保存报警日志
|
||||||
*
|
*
|
||||||
* @param dataMinuteVO
|
* @param dataMinuteVO
|
||||||
* @param alarmValue
|
* @param collectorDTO
|
||||||
*/
|
*/
|
||||||
private void saveAlarmLog(DataMinuteVO dataMinuteVO, double alarmValue) throws Exception {
|
private void saveAlarmLog(DataMinuteVO dataMinuteVO, CollectorDTO collectorDTO) throws Exception {
|
||||||
if (alarmValue < 0) {
|
if (collectorDTO.getAlarmValue() < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AlarmLogVO alarmLogVO = new AlarmLogVO();
|
AlarmLogVO alarmLogVO = new AlarmLogVO();
|
||||||
@ -132,9 +139,14 @@ public class RealDataHandler implements IDataHandle<HJ212DataUtil.Data> {
|
|||||||
alarmLogVO.setCollectorId(dataMinuteVO.getCollectorId());
|
alarmLogVO.setCollectorId(dataMinuteVO.getCollectorId());
|
||||||
alarmLogVO.setRtd(dataMinuteVO.getRtd());
|
alarmLogVO.setRtd(dataMinuteVO.getRtd());
|
||||||
alarmLogVO.setZsRtd(dataMinuteVO.getZsRtd());
|
alarmLogVO.setZsRtd(dataMinuteVO.getZsRtd());
|
||||||
alarmLogVO.setAlarmValue(alarmValue);
|
alarmLogVO.setAlarmValue(collectorDTO.getAlarmValue());
|
||||||
alarmLogVO.setPollId(dataMinuteVO.getPollId());
|
alarmLogVO.setPollId(dataMinuteVO.getPollId());
|
||||||
alarmLogService.save(alarmLogVO);
|
alarmLogService.save(alarmLogVO);
|
||||||
|
|
||||||
|
// 通知
|
||||||
|
String message = String.format("%s %s 的 %s 采集仪数据超标报警",
|
||||||
|
collectorDTO.getEnterpriseName(), collectorDTO.getInstrumentName(), collectorDTO.getCollectorMn());
|
||||||
|
WebSocketManager.getInstance().sendMessage(new BigDataWebSocketData<>(BigDataTypeEnum.ALARM_MESSAGE, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,6 +195,10 @@ public class RealDataHandler implements IDataHandle<HJ212DataUtil.Data> {
|
|||||||
this.dataMinuteService = dataMinuteService;
|
this.dataMinuteService = dataMinuteService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEnterpriseDTO(EnterpriseDTO enterpriseDTO) {
|
||||||
|
this.enterpriseDTO = enterpriseDTO;
|
||||||
|
}
|
||||||
|
|
||||||
public void setInstrumentDTO(InstrumentDTO instrumentDTO) {
|
public void setInstrumentDTO(InstrumentDTO instrumentDTO) {
|
||||||
this.instrumentDTO = instrumentDTO;
|
this.instrumentDTO = instrumentDTO;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ api-path:
|
|||||||
# 安全
|
# 安全
|
||||||
security:
|
security:
|
||||||
oauth2:
|
oauth2:
|
||||||
oauth-server: http://192.168.0.106:7001/usercenter
|
oauth-server: http://192.168.0.103:7001/usercenter
|
||||||
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
|
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
|
||||||
client:
|
client:
|
||||||
client-id: 74e4b55ad48840f9b4de86ce5da58b53
|
client-id: 74e4b55ad48840f9b4de86ce5da58b53
|
||||||
|
@ -176,10 +176,14 @@
|
|||||||
pollute_collector t1
|
pollute_collector t1
|
||||||
WHERE
|
WHERE
|
||||||
t1.is_delete = 0
|
t1.is_delete = 0
|
||||||
<if test="collectorId != null and collectorId != ''">
|
<if test="collectorId != null and collectorId != ''">
|
||||||
AND
|
AND
|
||||||
t1.collector_id = #{collectorId}
|
t1.collector_id = #{collectorId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="collectorMn != null and collectorMn != ''">
|
||||||
|
AND
|
||||||
|
t1.collector_mn = #{collectorMn}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 采集器详情 -->
|
<!-- 采集器详情 -->
|
||||||
|
@ -68,6 +68,11 @@
|
|||||||
<result column="gmt_create" property="gmtCreate"/>
|
<result column="gmt_create" property="gmtCreate"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="enterprisePollDTO" type="com.cm.tenlion.pollutantdata.pojo.dtos.dataminute.EnterprisePollDTO">
|
||||||
|
<result column="enterprise_id" property="enterpriseId"/>
|
||||||
|
<result column="poll_id" property="pollId"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<!-- 新增采集分钟数据 -->
|
<!-- 新增采集分钟数据 -->
|
||||||
<insert id="save" parameterType="map">
|
<insert id="save" parameterType="map">
|
||||||
INSERT INTO pollute_data_minute (
|
INSERT INTO pollute_data_minute (
|
||||||
@ -429,6 +434,10 @@
|
|||||||
AND
|
AND
|
||||||
t1.enterprise_id = #{enterpriseId}
|
t1.enterprise_id = #{enterpriseId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="pollId != null and pollId != ''">
|
||||||
|
AND
|
||||||
|
t1.poll_id = #{pollId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 统计污染因子 -->
|
<!-- 统计污染因子 -->
|
||||||
@ -475,6 +484,35 @@
|
|||||||
poll_id
|
poll_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 污染因子列表 -->
|
||||||
|
<select id="listEnterprisePollId" parameterType="map" resultMap="enterprisePollDTO">
|
||||||
|
SELECT
|
||||||
|
poll_id,
|
||||||
|
enterprise_id
|
||||||
|
FROM
|
||||||
|
pollute_data_minute
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
<if test="enterpriseId != null and enterpriseId != ''">
|
||||||
|
AND
|
||||||
|
enterprise_id = #{enterpriseId}
|
||||||
|
</if>
|
||||||
|
<if test="day != null and day != ''">
|
||||||
|
AND
|
||||||
|
LEFT(gmt_create, 10) = #{day}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND
|
||||||
|
gmt_create <![CDATA[ >= ]]> #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND
|
||||||
|
gmt_create <![CDATA[ <= ]]> #{endTime}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
poll_id, enterprise_id
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 最新实时数据 -->
|
<!-- 最新实时数据 -->
|
||||||
<select id="getLastRtd" parameterType="map" resultType="java.lang.Double">
|
<select id="getLastRtd" parameterType="map" resultType="java.lang.Double">
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -81,6 +81,13 @@ a:hover {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alarm-span {
|
||||||
|
width: 1rem;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
/*谷哥滚动条样式*/
|
/*谷哥滚动条样式*/
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
@ -39,16 +40,20 @@ public class HJ212Test {
|
|||||||
// 采集器密码
|
// 采集器密码
|
||||||
data.setPw("123456");
|
data.setPw("123456");
|
||||||
// 采集器编号
|
// 采集器编号
|
||||||
data.setMn("SCY000001");
|
data.setMn("SCY00010001");
|
||||||
data.setFlag(DataFlagEnum.HAS_PNUM_ANSWER_V2017.getValue());
|
data.setFlag(DataFlagEnum.HAS_PNUM_ANSWER_V2017.getValue());
|
||||||
HJ212DataUtil.DataCp dataCp = new HJ212DataUtil.DataCp();
|
HJ212DataUtil.DataCp dataCp = new HJ212DataUtil.DataCp();
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
// 实时值
|
// 实时值
|
||||||
dataCp.setRtd(18.0D);
|
dataCp.setRtd((double) random.nextInt(20));
|
||||||
// 折算实时值
|
// 折算实时值
|
||||||
dataCp.setZsRtd(6.0D);
|
dataCp.setZsRtd((double) random.nextInt(20));
|
||||||
// 污染因子
|
// 污染因子
|
||||||
dataCp.setPollId("w00000");
|
// dataCp.setPollId("w00000");
|
||||||
dataCp.setSn("CJQ000001");
|
dataCp.setPollId("w01001");
|
||||||
|
// dataCp.setSn("CJQ000100010001");
|
||||||
|
dataCp.setSn("CJQ000100010002");
|
||||||
dataCp.setSampleTime(DateUtil.formatDate(System.currentTimeMillis(), "yyyyMMddHHmmssSSS"));
|
dataCp.setSampleTime(DateUtil.formatDate(System.currentTimeMillis(), "yyyyMMddHHmmssSSS"));
|
||||||
dataCp.setFlag(DataCpFlagEnum.N.getValue());
|
dataCp.setFlag(DataCpFlagEnum.N.getValue());
|
||||||
data.setDataCp(dataCp);
|
data.setDataCp(dataCp);
|
||||||
|
Loading…
Reference in New Issue
Block a user