流量计增加加入各类接口
This commit is contained in:
parent
3ec40889a5
commit
83b89f7402
|
|
@ -10,6 +10,7 @@ import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CacheConstants;
|
import org.jeecg.common.constant.CacheConstants;
|
||||||
import org.jeecg.common.constant.IotConstants;
|
import org.jeecg.common.constant.IotConstants;
|
||||||
import org.jeecg.common.constant.PollutionConstants;
|
import org.jeecg.common.constant.PollutionConstants;
|
||||||
|
import org.jeecg.common.constant.enums.DeviceDeployEnum;
|
||||||
import org.jeecg.common.constant.enums.ScreenIndexSummaryEnum;
|
import org.jeecg.common.constant.enums.ScreenIndexSummaryEnum;
|
||||||
import org.jeecg.common.dto.CommonDTO;
|
import org.jeecg.common.dto.CommonDTO;
|
||||||
import org.jeecg.common.entity.*;
|
import org.jeecg.common.entity.*;
|
||||||
|
|
@ -1036,6 +1037,7 @@ public class BigScreenController {
|
||||||
// deployTypes.add(PollutionConstants.CAMERA);
|
// deployTypes.add(PollutionConstants.CAMERA);
|
||||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||||
deployTypes.add(PollutionConstants.SOIL_SURV);
|
deployTypes.add(PollutionConstants.SOIL_SURV);
|
||||||
|
deployTypes.add(DeviceDeployEnum.FLOWMETER.getType());
|
||||||
List<SurvDeviceDeploy> deploys = deployService.getDeviceListByStation(null,deployTypes);
|
List<SurvDeviceDeploy> deploys = deployService.getDeviceListByStation(null,deployTypes);
|
||||||
if(!deploys.isEmpty()){
|
if(!deploys.isEmpty()){
|
||||||
for (SurvDeviceDeploy deploy : deploys) {
|
for (SurvDeviceDeploy deploy : deploys) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
package org.jeecg.modules.appmana.mapper;
|
package org.jeecg.modules.appmana.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
||||||
|
import org.jeecg.common.iot.common.VOSurvIntegrateMeterDetail;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: surv_hisdata_flowmeter
|
* @Description: surv_hisdata_flowmeter
|
||||||
|
|
@ -11,4 +16,5 @@ import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
||||||
*/
|
*/
|
||||||
public interface SurvHisdataFlowmeterMapper extends BaseMapper<SurvHisdataFlowmeter> {
|
public interface SurvHisdataFlowmeterMapper extends BaseMapper<SurvHisdataFlowmeter> {
|
||||||
|
|
||||||
|
List<VOSurvIntegrateMeterDetail> integrateSummary(@Param("tenantId")String tenantId, @Param("meterDevice") List<String> meterDevice, @Param("timeDataFormat") String timeDataFormat, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,25 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvHisdataFlowmeterMapper">
|
<mapper namespace="org.jeecg.modules.appmana.mapper.SurvHisdataFlowmeterMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="integrateSummary" resultType="org.jeecg.common.iot.common.VOSurvIntegrateMeterDetail">
|
||||||
|
select date_format(t.DATA_DATE_TIME,#{timeDataFormat}) as dates,
|
||||||
|
ifnull(ROUND(avg(cast(S_DATA1 as decimal(10,1))), 2),'0') as sData1,
|
||||||
|
ifnull(ROUND(avg(cast(S_DATA2 as decimal(10,1))), 2),'0') as sData2,
|
||||||
|
ifnull(ROUND(avg(cast(S_DATA3 as decimal(10,1))), 2),'0') as sData3,
|
||||||
|
ifnull(ROUND(avg(cast(S_DATA4 as decimal(10,1))), 2),'0') as sData4,
|
||||||
|
ifnull(ROUND(avg(cast(S_DATA5 as decimal(10,1))), 2),'0') as sData5
|
||||||
|
from surv_hisdata_flowmeter t
|
||||||
|
<where>
|
||||||
|
<if test="tenantId != null and tenantId != ''">
|
||||||
|
AND TENANT_ID = #{tenantId}
|
||||||
|
</if>
|
||||||
|
AND DEPLOY_CODE IN
|
||||||
|
<foreach item="id" collection="meterDevice" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
and DATA_DATE_TIME between #{startTime} and #{endTime}
|
||||||
|
</where>
|
||||||
|
group by dates order by dates
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -2,6 +2,10 @@ package org.jeecg.modules.appmana.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
||||||
|
import org.jeecg.common.iot.common.VOSurvIntegrateMeterDetail;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: surv_hisdata_flowmeter
|
* @Description: surv_hisdata_flowmeter
|
||||||
|
|
@ -11,4 +15,5 @@ import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
||||||
*/
|
*/
|
||||||
public interface ISurvHisdataFlowmeterService extends IService<SurvHisdataFlowmeter> {
|
public interface ISurvHisdataFlowmeterService extends IService<SurvHisdataFlowmeter> {
|
||||||
|
|
||||||
|
List<VOSurvIntegrateMeterDetail> integrateSummary(String tenantId, List<String> meterDevice, String timeDataFormat, LocalDateTime startDateTime, LocalDateTime endDateTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,5 @@ import org.jeecg.common.entity.SurvTransdataFlowmeter;
|
||||||
*/
|
*/
|
||||||
public interface ISurvTransdataFlowmeterService extends IService<SurvTransdataFlowmeter> {
|
public interface ISurvTransdataFlowmeterService extends IService<SurvTransdataFlowmeter> {
|
||||||
|
|
||||||
|
SurvTransdataFlowmeter getOneByDeviceId(String deployId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,9 @@ public class IotCommonServiceImpl {
|
||||||
private ISurvHisdataSoilService hisdataSoilService;
|
private ISurvHisdataSoilService hisdataSoilService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
|
private ISurvHisdataFlowmeterService hisdataFlowmeterService;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
private ISurvHisdataOrientwaterService orientwaterService;
|
private ISurvHisdataOrientwaterService orientwaterService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
|
|
@ -162,6 +165,7 @@ public class IotCommonServiceImpl {
|
||||||
//step 2,获取设备数据
|
//step 2,获取设备数据
|
||||||
List<String> airDevice = new ArrayList<>();
|
List<String> airDevice = new ArrayList<>();
|
||||||
List<String> soilDevice = new ArrayList<>();
|
List<String> soilDevice = new ArrayList<>();
|
||||||
|
List<String> meterDevice = new ArrayList<>();
|
||||||
List<CommonDataTrans> commonDataTransList = new ArrayList<>();
|
List<CommonDataTrans> commonDataTransList = new ArrayList<>();
|
||||||
for (SurvDeviceDeploy deploy : deploys) {
|
for (SurvDeviceDeploy deploy : deploys) {
|
||||||
switch (deploy.getDeployType()){
|
switch (deploy.getDeployType()){
|
||||||
|
|
@ -177,6 +181,10 @@ public class IotCommonServiceImpl {
|
||||||
soilDevice.add(deploy.getDeployCode());
|
soilDevice.add(deploy.getDeployCode());
|
||||||
commonDataTransList.addAll(CommonUtils.transData(deploy, false, null, null, null, null).getTransData());
|
commonDataTransList.addAll(CommonUtils.transData(deploy, false, null, null, null, null).getTransData());
|
||||||
break;
|
break;
|
||||||
|
case PollutionConstants.FLOWMETER:
|
||||||
|
meterDevice.add(deploy.getDeployCode());
|
||||||
|
commonDataTransList.addAll(CommonUtils.transData(deploy, false, null, null, null, null).getTransData());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String timeDataFormat = "";
|
String timeDataFormat = "";
|
||||||
|
|
@ -395,6 +403,70 @@ public class IotCommonServiceImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!meterDevice.isEmpty()){
|
||||||
|
List<VOSurvIntegrateMeterDetail> meters = hisdataFlowmeterService.integrateSummary(null,meterDevice,timeDataFormat,startDateTime,endDateTime);
|
||||||
|
if(meters.isEmpty()){//如果meters为空,即设备未采集任何数据,则补充一条0数据,用于构造
|
||||||
|
VOSurvIntegrateMeterDetail ent = new VOSurvIntegrateMeterDetail();
|
||||||
|
Class<? extends VOSurvIntegrateMeterDetail> meterClass = ent.getClass();
|
||||||
|
Field[] fields = meterClass.getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
if(!"dates".equals(field.getName())) {
|
||||||
|
try{
|
||||||
|
field.set(ent,"0");
|
||||||
|
}catch (IllegalAccessException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
field.setAccessible(false);
|
||||||
|
}
|
||||||
|
meters.add(ent);
|
||||||
|
}
|
||||||
|
if(!meters.isEmpty()){
|
||||||
|
int counts = 0;
|
||||||
|
for (VOSurvIntegrateMeterDetail met : meters) {
|
||||||
|
Class<? extends VOSurvIntegrateMeterDetail> personClass = met.getClass();
|
||||||
|
Field[] fields = personClass.getDeclaredFields();
|
||||||
|
try {
|
||||||
|
String curIndex = "";
|
||||||
|
Map<String,String> eleMap = new HashMap<>();
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
//过滤,未配置的不要构造进去
|
||||||
|
if(!"dates".equals(field.getName())) {//非dates的未配置不处理
|
||||||
|
if (totalSurvItems.get(field.getName()) == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object values = field.get(met);
|
||||||
|
if (values != null) {
|
||||||
|
String val = values.toString();
|
||||||
|
if (StringUtils.isNotBlank(val)) {
|
||||||
|
if("dates".equals(field.getName())){
|
||||||
|
curIndex = val;
|
||||||
|
}else{
|
||||||
|
eleMap.put(field.getName(),val);
|
||||||
|
Map<String,String> meterData = filterMap.get(curIndex);
|
||||||
|
if(meterData != null){
|
||||||
|
eleMap.putAll(meterData);
|
||||||
|
}
|
||||||
|
filterMap.put(curIndex, eleMap);
|
||||||
|
if(counts==0){
|
||||||
|
survItems.add(field.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
counts++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//mk2 年月份数据时,需要拉取日数据重新进行计算
|
//mk2 年月份数据时,需要拉取日数据重新进行计算
|
||||||
if(IotConstants.year_months.equals(voSurvIntegrateParam.getSummrayMode())){
|
if(IotConstants.year_months.equals(voSurvIntegrateParam.getSummrayMode())){
|
||||||
timeDataFormat = "%Y-%m-%d";
|
timeDataFormat = "%Y-%m-%d";
|
||||||
|
|
@ -471,6 +543,43 @@ public class IotCommonServiceImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!meterDevice.isEmpty()) {
|
||||||
|
List<VOSurvIntegrateMeterDetail> dayMeter = hisdataFlowmeterService.integrateSummary(null, meterDevice, timeDataFormat, startDateTime, endDateTime);
|
||||||
|
if (!dayMeter.isEmpty()) {
|
||||||
|
for (VOSurvIntegrateMeterDetail dayDatas : dayMeter) {
|
||||||
|
Class<? extends VOSurvIntegrateMeterDetail> meterClass = dayDatas.getClass();
|
||||||
|
Field[] fields = meterClass.getDeclaredFields();
|
||||||
|
try {
|
||||||
|
String curIndex = "";
|
||||||
|
Map<String, String> eleMap = new HashMap<>();
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
//过滤,未配置的不要构造进去
|
||||||
|
if (!"dates".equals(field.getName())) {//非dates的未配置不处理
|
||||||
|
if (totalSurvItems.get(field.getName()) == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object values = field.get(dayDatas);
|
||||||
|
if (values != null) {
|
||||||
|
String val = values.toString();
|
||||||
|
if (StringUtils.isNotBlank(val)) {
|
||||||
|
if ("dates".equals(field.getName())) {
|
||||||
|
curIndex = val;
|
||||||
|
} else {
|
||||||
|
eleMap.put(field.getName(), val);
|
||||||
|
accFilterMap.put(curIndex, eleMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,14 @@ package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
import org.jeecg.common.entity.SurvHisdataFlowmeter;
|
||||||
|
import org.jeecg.common.iot.common.VOSurvIntegrateMeterDetail;
|
||||||
import org.jeecg.modules.appmana.mapper.SurvHisdataFlowmeterMapper;
|
import org.jeecg.modules.appmana.mapper.SurvHisdataFlowmeterMapper;
|
||||||
import org.jeecg.modules.appmana.service.ISurvHisdataFlowmeterService;
|
import org.jeecg.modules.appmana.service.ISurvHisdataFlowmeterService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: surv_hisdata_flowmeter
|
* @Description: surv_hisdata_flowmeter
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
|
|
@ -14,5 +18,8 @@ import org.springframework.stereotype.Service;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SurvHisdataFlowmeterServiceImpl extends ServiceImpl<SurvHisdataFlowmeterMapper, SurvHisdataFlowmeter> implements ISurvHisdataFlowmeterService {
|
public class SurvHisdataFlowmeterServiceImpl extends ServiceImpl<SurvHisdataFlowmeterMapper, SurvHisdataFlowmeter> implements ISurvHisdataFlowmeterService {
|
||||||
|
@Override
|
||||||
|
public List<VOSurvIntegrateMeterDetail> integrateSummary(String tenantId, List<String> meterDevice, String timeDataFormat, LocalDateTime startTime, LocalDateTime endTime) {
|
||||||
|
return baseMapper.integrateSummary(tenantId,meterDevice,timeDataFormat, startTime, endTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.appmana.service.impl;
|
package org.jeecg.modules.appmana.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.jeecg.common.entity.SurvTransdataFlowmeter;
|
import org.jeecg.common.entity.SurvTransdataFlowmeter;
|
||||||
import org.jeecg.modules.appmana.mapper.SurvTransdataFlowmeterMapper;
|
import org.jeecg.modules.appmana.mapper.SurvTransdataFlowmeterMapper;
|
||||||
|
|
@ -15,4 +16,12 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class SurvTransdataFlowmeterServiceImpl extends ServiceImpl<SurvTransdataFlowmeterMapper, SurvTransdataFlowmeter> implements ISurvTransdataFlowmeterService {
|
public class SurvTransdataFlowmeterServiceImpl extends ServiceImpl<SurvTransdataFlowmeterMapper, SurvTransdataFlowmeter> implements ISurvTransdataFlowmeterService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SurvTransdataFlowmeter getOneByDeviceId(String deployId) {
|
||||||
|
SurvTransdataFlowmeter flowmeter = lambdaQuery()
|
||||||
|
.eq(SurvTransdataFlowmeter::getDeployId, deployId)
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
|
return flowmeter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public class CommonUtils {
|
||||||
|
|
||||||
private static ISurvTransdataAirService transdataAirService = SpringContextUtils.getBean(ISurvTransdataAirService.class);
|
private static ISurvTransdataAirService transdataAirService = SpringContextUtils.getBean(ISurvTransdataAirService.class);
|
||||||
private static ISurvTransdataSoilService transdataSoilService = SpringContextUtils.getBean(ISurvTransdataSoilService.class);
|
private static ISurvTransdataSoilService transdataSoilService = SpringContextUtils.getBean(ISurvTransdataSoilService.class);
|
||||||
|
private static ISurvTransdataFlowmeterService transdataFlowmeterService = SpringContextUtils.getBean(ISurvTransdataFlowmeterService.class);
|
||||||
private static IScEquZhibiaoService zhibiaoService = SpringContextUtils.getBean(IScEquZhibiaoService.class);
|
private static IScEquZhibiaoService zhibiaoService = SpringContextUtils.getBean(IScEquZhibiaoService.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -114,6 +115,17 @@ w * @param pageNo 非必传,虫情孢子类,杀虫灯传入
|
||||||
return voTransData;
|
return voTransData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else if (PollutionConstants.FLOWMETER.equals(deploy.getDeployType())) {//流量计
|
||||||
|
SurvTransdataFlowmeter transdataFlowmeter = transdataFlowmeterService.getOneByDeviceId(deployId);
|
||||||
|
if (throEX) {
|
||||||
|
Assert.notNull(transdataFlowmeter, "该设备没有最新数据");
|
||||||
|
} else {
|
||||||
|
if (transdataFlowmeter != null) {
|
||||||
|
transdataFlowmeter.setDeployId(deployId);
|
||||||
|
voTransData.setTransData(CommonUtils.markZhibiao(deploy,CommonUtils.constructMeter(transdataFlowmeter), zhibiaoList));
|
||||||
|
return voTransData;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// else if (PollutionConstants.BUG_SURV.equals(deploy.getDeployType())) {
|
// else if (PollutionConstants.BUG_SURV.equals(deploy.getDeployType())) {
|
||||||
// Page<FBugSurv> bPage = new Page<>(pageNo, pageSize);
|
// Page<FBugSurv> bPage = new Page<>(pageNo, pageSize);
|
||||||
|
|
@ -167,6 +179,8 @@ w * @param pageNo 非必传,虫情孢子类,杀虫灯传入
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组装空气数据
|
* 组装空气数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -259,6 +273,96 @@ w * @param pageNo 非必传,虫情孢子类,杀虫灯传入
|
||||||
return listFinal;
|
return listFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static List<CommonDataTrans> constructMeter(SurvTransdataFlowmeter transdataFlowmeter) {
|
||||||
|
if (transdataFlowmeter == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<CommonDataTrans> listFinal = new ArrayList<>();
|
||||||
|
String timeGap = DateUtilTools.calTimeGap(transdataFlowmeter.getDataDateTime(), LocalDateTime.now());
|
||||||
|
SurvConfig fSurvConfig = survConfigService.getOneByTypeWithTenant(transdataFlowmeter.getTenantId(), IotConstants.surv_itemname);
|
||||||
|
cn.hutool.json.JSONObject configs = null;
|
||||||
|
if (fSurvConfig != null) {
|
||||||
|
configs = fSurvConfig.getConfigJson();
|
||||||
|
}
|
||||||
|
cn.hutool.json.JSONObject desConfig = null;
|
||||||
|
cn.hutool.json.JSONObject iconConfig = null;
|
||||||
|
String bsIconPath = "";
|
||||||
|
String bsIconPath2 = "";
|
||||||
|
String h5IconPath = "";
|
||||||
|
String appIconPath = "";
|
||||||
|
String midIconPath = "";
|
||||||
|
if (configs != null) {
|
||||||
|
desConfig = configs.getJSONObject("des");
|
||||||
|
iconConfig = configs.getJSONObject("icons");
|
||||||
|
bsIconPath = configs.getStr("bsIconPath");
|
||||||
|
bsIconPath2 = configs.getStr("bsIconPath2");
|
||||||
|
h5IconPath = configs.getStr("h5IconPath");
|
||||||
|
appIconPath = configs.getStr("appIconPath");
|
||||||
|
midIconPath = configs.getStr("midIconPath");
|
||||||
|
}
|
||||||
|
Class<? extends SurvTransdataFlowmeter> personClass = transdataFlowmeter.getClass();
|
||||||
|
Field[] fields = personClass.getDeclaredFields();
|
||||||
|
try {
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
if (field.getName().startsWith("data") && !field.getName().equals("dataDateTime") && !field.getName().equals("dataGatherType")) {
|
||||||
|
Object values = field.get(transdataFlowmeter);
|
||||||
|
if (values != null) {
|
||||||
|
String val = values.toString();
|
||||||
|
if (StringUtils.isNotBlank(val)) {
|
||||||
|
PollutionEnum pollutionEnum = PollutionEnum.catchPollution(field.getName());
|
||||||
|
CommonDataTrans e4 = new CommonDataTrans();//温度
|
||||||
|
|
||||||
|
String iconFinalName = pollutionEnum.getIconName();
|
||||||
|
String itemFinalName = pollutionEnum.getDescription();
|
||||||
|
String bsIcon = pollutionEnum.getBsIcon();
|
||||||
|
if (configs != null) {
|
||||||
|
String itemName = desConfig != null ? desConfig.getStr(pollutionEnum.getCode()) : "";
|
||||||
|
String iconName = iconConfig != null ? iconConfig.getStr(pollutionEnum.getCode()) : "";
|
||||||
|
if (StringUtils.isNotBlank(itemName)) {
|
||||||
|
itemFinalName = itemName;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(iconName)) {
|
||||||
|
iconFinalName = iconName;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(bsIconPath)) {
|
||||||
|
bsIcon = bsIconPath + iconFinalName;
|
||||||
|
}
|
||||||
|
e4.setBsIconPath(bsIconPath);
|
||||||
|
e4.setBsIconPath2(bsIconPath2);
|
||||||
|
e4.setH5IconPath(h5IconPath);
|
||||||
|
e4.setAppIconPath(appIconPath);
|
||||||
|
e4.setMidIconPath(midIconPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
e4.setUnit(pollutionEnum.getUnit());
|
||||||
|
e4.setName(itemFinalName);
|
||||||
|
e4.setColor(pollutionEnum.getColor());
|
||||||
|
e4.setIcon(pollutionEnum.getIcon());
|
||||||
|
e4.setMobileIcon(pollutionEnum.getMobileIcon());
|
||||||
|
e4.setBsIcon(bsIcon);
|
||||||
|
e4.setSurvItem(pollutionEnum.getCode());
|
||||||
|
e4.setValue(val);
|
||||||
|
e4.setLastUpdate(timeGap);
|
||||||
|
e4.setDataDateTime(transdataFlowmeter.getDataDateTime());
|
||||||
|
e4.setDeployId(transdataFlowmeter.getDeployId());
|
||||||
|
e4.setIconName(iconFinalName);
|
||||||
|
e4.setSurvType(IotConstants.AIR_DATA);
|
||||||
|
e4.setStationName(transdataFlowmeter.getStationName());
|
||||||
|
|
||||||
|
listFinal.add(e4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return listFinal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组装空气数据,旧版,弃用
|
* 组装空气数据,旧版,弃用
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -571,6 +571,7 @@ public class SurvStationInfoController {
|
||||||
// deployTypes.add(PollutionConstants.CAMERA);
|
// deployTypes.add(PollutionConstants.CAMERA);
|
||||||
deployTypes.add(PollutionConstants.AIR_SURV);
|
deployTypes.add(PollutionConstants.AIR_SURV);
|
||||||
deployTypes.add(PollutionConstants.SOIL_SURV);
|
deployTypes.add(PollutionConstants.SOIL_SURV);
|
||||||
|
deployTypes.add(PollutionConstants.FLOWMETER);
|
||||||
|
|
||||||
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(null,deployTypes,null,tenantId);
|
List<SurvDeviceDeploy> deploys = survDeviceDeployService.getDeviceListByStation(null,deployTypes,null,tenantId);
|
||||||
if(!deploys.isEmpty()){
|
if(!deploys.isEmpty()){
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,13 @@ public class WxAppletController {
|
||||||
}else{
|
}else{
|
||||||
job.put("dataList",new ArrayList<>());
|
job.put("dataList",new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
}else if(PollutionConstants.FLOWMETER.equals(survDeviceDeploy.getDeployType())){
|
||||||
|
VOTransData voTransData = zhAdminFeignClient.deviceNewestData(survDeviceDeploy.getId(),tenantId);
|
||||||
|
if(voTransData!=null){
|
||||||
|
job.put("dataList",voTransData.getTransData());
|
||||||
|
}else{
|
||||||
|
job.put("dataList",new ArrayList<>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
job.put("dataList",new ArrayList<>());
|
job.put("dataList",new ArrayList<>());
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ public interface PollutionConstants {
|
||||||
*/
|
*/
|
||||||
String PEST_LIGHT = "9_pestlight";
|
String PEST_LIGHT = "9_pestlight";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量计
|
||||||
|
*/
|
||||||
|
String FLOWMETER = "10_flowmeter";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据生成间隔 单位秒
|
* 数据生成间隔 单位秒
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ public enum DeviceDeployEnum {
|
||||||
|
|
||||||
PEST_LIGHT("9_pestlight", "杀虫灯", "guard"),
|
PEST_LIGHT("9_pestlight", "杀虫灯", "guard"),
|
||||||
|
|
||||||
|
FLOWMETER("10_flowmeter", "流量计","surv"),
|
||||||
|
|
||||||
CONTROL_CAB("control_cab", "温室控制柜", "control"),
|
CONTROL_CAB("control_cab", "温室控制柜", "control"),
|
||||||
|
|
||||||
INTEGRATED_MACHINE("integrated_machine", "水肥一体机", "control"),
|
INTEGRATED_MACHINE("integrated_machine", "水肥一体机", "control"),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.jeecg.common.iot.common;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VOSurvIntegrateMeterDetail {
|
||||||
|
@ApiModelProperty("时间")
|
||||||
|
private String dates;
|
||||||
|
/**
|
||||||
|
* 土壤温度1;106
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据1", width = 15)
|
||||||
|
@ApiModelProperty(value = "数据1")
|
||||||
|
private String sData1;
|
||||||
|
/**数据2*/
|
||||||
|
@Excel(name = "数据2", width = 15)
|
||||||
|
@ApiModelProperty(value = "数据2")
|
||||||
|
private String sData2;
|
||||||
|
/**数据3*/
|
||||||
|
@Excel(name = "数据3", width = 15)
|
||||||
|
@ApiModelProperty(value = "数据3")
|
||||||
|
private String sData3;
|
||||||
|
/**数据4*/
|
||||||
|
@Excel(name = "数据4", width = 15)
|
||||||
|
@ApiModelProperty(value = "数据4")
|
||||||
|
private String sData4;
|
||||||
|
/**数据5*/
|
||||||
|
@Excel(name = "数据5", width = 15)
|
||||||
|
@ApiModelProperty(value = "数据5")
|
||||||
|
private String sData5;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue