增加接口
This commit is contained in:
parent
14ba1cd442
commit
16c07bb8b6
|
|
@ -324,12 +324,7 @@ public class BigScreenController {
|
|||
|
||||
List<PollutionSetVo> survList = new ArrayList<>();
|
||||
if(survStationInfo.getSurvObj()!=null&&survStationInfo.getSurvObj().length>0) {
|
||||
for (String survStr : survStationInfo.getSurvObj()) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
pollutionSetVo.setColor(PollutionEnum.catchMessage(survStr).getColor());
|
||||
pollutionSetVo.setName(survStr);
|
||||
survList.add(pollutionSetVo);
|
||||
}
|
||||
survList = iotutils.translateArrPollution(survStationInfo.getSurvObj());
|
||||
}
|
||||
survStationInfo.setSurvColorItems(survList);
|
||||
count++;
|
||||
|
|
@ -343,22 +338,7 @@ public class BigScreenController {
|
|||
@ApiOperation("获取污染物字典属性")
|
||||
@GetMapping("/getPollutionDict")
|
||||
public Result getPollutionDict(){
|
||||
PollutionEnum[] values = PollutionEnum.values();
|
||||
JSONArray jarrs = new JSONArray();
|
||||
for (PollutionEnum e : values) {
|
||||
PolutionVo pvo = new PolutionVo();
|
||||
pvo.setCode(e.getCode());
|
||||
pvo.setDescription(e.getDescription());
|
||||
pvo.setUnit(e.getUnit());
|
||||
pvo.setIcon(e.getIcon());
|
||||
pvo.setColor(e.getColor());
|
||||
// JSONObject job =new JSONObject();
|
||||
// job.put(e.getCode(),pvo);
|
||||
// jarrs.add(job);
|
||||
jarrs.add(JSONObject.parseObject(JSONObject.toJSONString(pvo)));
|
||||
|
||||
}
|
||||
return Result.ok(jarrs);
|
||||
return Result.ok(iotutils.getPollutionDict());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -670,6 +650,7 @@ public class BigScreenController {
|
|||
stationSummry.setDateStr(wholeTime);
|
||||
stationSummry.setGroupId(survStationInfo.getGroupId());
|
||||
stationSummry.setGroupName(survStationInfo.getGroupName());
|
||||
stationSummry.setStationName(survStationInfo.getStationName());
|
||||
returnArrs.add(JSONObject.parseObject(JSONObject.toJSONString(stationSummry, SerializerFeature.WriteNullStringAsEmpty)));
|
||||
}
|
||||
if(liveList.size()>0){
|
||||
|
|
@ -734,6 +715,7 @@ public class BigScreenController {
|
|||
|
||||
stationSummry.setGroupId(survStationInfo.getGroupId());
|
||||
stationSummry.setGroupName(survStationInfo.getGroupName());
|
||||
stationSummry.setStationName(survStationInfo.getStationName());
|
||||
returnArrs.add(JSONObject.parseObject(JSONObject.toJSONString(stationSummry, SerializerFeature.WriteNullStringAsEmpty)));
|
||||
}
|
||||
}
|
||||
|
|
@ -933,12 +915,7 @@ public class BigScreenController {
|
|||
|
||||
List<PollutionSetVo> survList = new ArrayList<>();
|
||||
if(survStationInfo.getSurvObj()!=null&&survStationInfo.getSurvObj().length>0) {
|
||||
for (String survStr : survStationInfo.getSurvObj()) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
pollutionSetVo.setColor(PollutionEnum.catchMessage(survStr).getColor());
|
||||
pollutionSetVo.setName(survStr);
|
||||
survList.add(pollutionSetVo);
|
||||
}
|
||||
survList = iotutils.translateArrPollution(survStationInfo.getSurvObj());
|
||||
}
|
||||
survStationInfo.setSurvColorItems(survList);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,28 @@
|
|||
package org.jeecg.modules.appmana.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.entity.PollutionSetVo;
|
||||
import org.jeecg.common.entity.ScEquZhibiao;
|
||||
import org.jeecg.common.iot.common.VOIntegrateStatistic;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateParam;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateResult;
|
||||
import org.jeecg.common.iot.common.VOWaterSurvIntegrateParam;
|
||||
import org.jeecg.common.vo.inner.TransSurvObjVo;
|
||||
import org.jeecg.common.vo.inner.TransZhiBiaoVo;
|
||||
import org.jeecg.modules.appmana.service.impl.IotCommonServiceImpl;
|
||||
import org.jeecg.modules.appmana.utils.Iotutils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
|
@ -29,6 +32,8 @@ public class InnerController {
|
|||
|
||||
@Autowired
|
||||
private IotCommonServiceImpl iotCommonService;
|
||||
@Autowired
|
||||
private Iotutils iotutils;
|
||||
|
||||
|
||||
@ApiOperation(value = "1. 空气土壤监测综合数据统计", notes = "")
|
||||
|
|
@ -41,10 +46,37 @@ public class InnerController {
|
|||
|
||||
@ApiOperation(value = "2. 水质监测综合数据统计", notes = "")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@PostMapping(value = "/WaterIntegrateStatistic")
|
||||
public Result<VOIntegrateStatistic> WaterIntegrateStatistic(@RequestBody VOWaterSurvIntegrateParam voSurvIntegrateParam) {
|
||||
@PostMapping(value = "/waterIntegrateStatistic")
|
||||
public Result<VOIntegrateStatistic> waterIntegrateStatistic(@RequestBody VOWaterSurvIntegrateParam voSurvIntegrateParam) {
|
||||
VOIntegrateStatistic voIntegrateStatistic = iotCommonService.waterIntegrate(voSurvIntegrateParam);
|
||||
return Result.OK(voIntegrateStatistic);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "4. 获取监测项列表", notes = "")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@PostMapping(value = "/getPollutionDict")
|
||||
public JSONArray getPollutionDict() {
|
||||
return iotutils.getPollutionDict();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "4. 翻译字典监测项", notes = "")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@PostMapping(value = "/translatePollution")
|
||||
public List<PollutionSetVo> translatePollution(@RequestBody TransZhiBiaoVo transZhiBiaoVo) {
|
||||
if(transZhiBiaoVo!=null){
|
||||
return iotutils.translatePollution(transZhiBiaoVo.getZhibiaos());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "5. 翻译数组监测项", notes = "")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping(value = "/translateArrPollution")
|
||||
public List<PollutionSetVo> translateArrPollution(@RequestBody TransSurvObjVo transSurvObjVo) {
|
||||
if(transSurvObjVo!=null){
|
||||
return iotutils.translateArrPollution(transSurvObjVo.getSurvObj());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ public class StatisticsContoller {
|
|||
|
||||
@ApiOperation(value = "2. 水质监测综合数据统计", notes = "")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@PostMapping(value = "/WaterIntegrateStatistic")
|
||||
public Result<VOIntegrateStatistic> WaterIntegrateStatistic(@RequestBody VOWaterSurvIntegrateParam voSurvIntegrateParam) {
|
||||
@PostMapping(value = "/waterIntegrateStatistic")
|
||||
public Result<VOIntegrateStatistic> waterIntegrateStatistic(@RequestBody VOWaterSurvIntegrateParam voSurvIntegrateParam) {
|
||||
VOIntegrateStatistic voIntegrateStatistic = iotCommonService.waterIntegrate(voSurvIntegrateParam);
|
||||
return Result.OK(voIntegrateStatistic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvHisdataLivestockwater;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateLiveDetail;
|
||||
import org.jeecg.common.vo.LiveDataTrans;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -25,4 +26,6 @@ public interface SurvHisdataLivestockwaterMapper extends BaseMapper<SurvHisdataL
|
|||
List<SurvHisdataLivestockwater> listByParams(@Param("deployCode")String deployCode, @Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime);
|
||||
|
||||
SurvHisdataLivestockwater getRecentDate(String deployCode);
|
||||
|
||||
List<VOSurvIntegrateLiveDetail> integrateSummary(@Param("tenantId") String tenantId,@Param("liveDevice") List<String> liveDevice,@Param("timeDataFormat") String timeDataFormat, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvHisdataOrientwater;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateOrientDetail;
|
||||
import org.jeecg.common.vo.OrientDataTrans;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -28,4 +29,6 @@ public interface SurvHisdataOrientwaterMapper extends BaseMapper<SurvHisdataOrie
|
|||
List<SurvHisdataOrientwater> listByParams(@Param("deployCode")String deployCode, @Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime);
|
||||
|
||||
SurvHisdataOrientwater getRecentDate(String deployCode);
|
||||
|
||||
List<VOSurvIntegrateOrientDetail> integrateSummary(@Param("tenantId") String tenantId,@Param("orientDevice") List<String> orientDevice,@Param("timeDataFormat") String timeDataFormat, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
and DATA_DATE_TIME between #{startTime} and #{endTime}
|
||||
group by dates
|
||||
</where>
|
||||
group by dates order by dates
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -81,4 +81,24 @@
|
|||
<select id="getRecentDate" resultMap="baseResultMap">
|
||||
select <include refid="baseSql"/> from surv_hisdata_livestockwater where DEVICE_CODE = #{deployCode} order by DATA_DATE_TIME desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="integrateSummary" resultType="org.jeecg.common.iot.common.VOSurvIntegrateLiveDetail">
|
||||
select date_format(t.DATA_DATE_TIME,#{timeDataFormat}) as dates,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_TP as decimal(10,1))), 2),'0') as dataWaterTp,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_TN as decimal(10,1))), 2),'0') as dataWaterTn,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_NH as decimal(10,1))), 2),'0') as dataWaterNh,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_COD as decimal(10,1))), 2),'0') as dataWaterCod
|
||||
from surv_hisdata_livestockwater t
|
||||
<where>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
AND DEVICE_CODE IN
|
||||
<foreach item="id" collection="liveDevice" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and DATA_DATE_TIME between #{startTime} and #{endTime}
|
||||
</where>
|
||||
group by dates
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -106,4 +106,23 @@
|
|||
<select id="getRecentDate" resultMap="baseResultMap">
|
||||
select <include refid="baseSql"/> from surv_hisdata_orientwater where DEVICE_CODE = #{deployCode} order by DATA_DATE_TIME desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="integrateSummary" resultType="org.jeecg.common.iot.common.VOSurvIntegrateOrientDetail">
|
||||
select date_format(t.DATA_DATE_TIME,#{timeDataFormat}) as dates,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_TP as decimal(10,1))), 2),'0') as dataWaterTp,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_TN as decimal(10,1))), 2),'0') as dataWaterTn,
|
||||
ifnull(ROUND(avg(cast(DATA_WATER_NO as decimal(10,1))), 2),'0') as dataWaterNo
|
||||
from surv_hisdata_orientwater t
|
||||
<where>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
AND TENANT_ID = #{tenantId}
|
||||
</if>
|
||||
AND DEVICE_CODE IN
|
||||
<foreach item="id" collection="orientDevice" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and DATA_DATE_TIME between #{startTime} and #{endTime}
|
||||
</where>
|
||||
group by dates
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import org.jeecg.common.entity.SurvHisdataLivestockwater;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.entity.SurvTransdataLivestockwater;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateLiveDetail;
|
||||
import org.jeecg.common.vo.LiveDataTrans;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -26,4 +27,5 @@ public interface ISurvHisdataLivestockwaterService extends IService<SurvHisdataL
|
|||
|
||||
SurvHisdataLivestockwater getRecentDate(String deployCode);
|
||||
|
||||
List<VOSurvIntegrateLiveDetail> integrateSummary(String tenantId, List<String> liveDevice, String timeDataFormat, LocalDateTime startDateTime, LocalDateTime endDateTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
import org.jeecg.common.entity.SurvHisdataOrientwater;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.entity.SurvTransdataOrientwater;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateOrientDetail;
|
||||
import org.jeecg.common.vo.DataTrans;
|
||||
import org.jeecg.common.vo.OrientDataTrans;
|
||||
|
||||
|
|
@ -31,4 +32,5 @@ public interface ISurvHisdataOrientwaterService extends IService<SurvHisdataOrie
|
|||
|
||||
SurvHisdataOrientwater getRecentDate(String deployCode);
|
||||
|
||||
List<VOSurvIntegrateOrientDetail> integrateSummary(String tenantId, List<String> orientDevice, String timeDataFormat, LocalDateTime startDateTime, LocalDateTime endDateTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ import org.jeecg.common.iot.common.*;
|
|||
import org.jeecg.common.util.DateTimeRangeUtils;
|
||||
import org.jeecg.common.util.ReflectionUtils;
|
||||
import org.jeecg.common.vo.CommonDataTrans;
|
||||
import org.jeecg.modules.appmana.service.ISurvDeviceDeployService;
|
||||
import org.jeecg.modules.appmana.service.ISurvHisdataAirService;
|
||||
import org.jeecg.modules.appmana.service.ISurvHisdataSoilService;
|
||||
import org.jeecg.modules.appmana.service.*;
|
||||
import org.jeecg.modules.appmana.utils.CommonUtils;
|
||||
import org.jeecg.modules.appmana.utils.Iotutils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -48,6 +46,12 @@ public class IotCommonServiceImpl {
|
|||
@Autowired
|
||||
@Lazy
|
||||
private ISurvHisdataSoilService hisdataSoilService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ISurvHisdataOrientwaterService orientwaterService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ISurvHisdataLivestockwaterService livestockwaterService;
|
||||
|
||||
|
||||
public VOIntegrateStatistic airSoilIntegrate(VOSurvIntegrateParam voSurvIntegrateParam){
|
||||
|
|
@ -77,6 +81,7 @@ public class IotCommonServiceImpl {
|
|||
//获取所有设备
|
||||
List<String> deployTypes = new ArrayList<>();
|
||||
deployTypes.add(PollutionConstants.WATER_ORIENT);
|
||||
deployTypes.add(PollutionConstants.WATER_LIVE);
|
||||
List<SurvDeviceDeploy> deploys = fDeviceDeployService.getAllDevice(deployTypes);
|
||||
VOIntegrateStatistic voIntegrateStatistic = new VOIntegrateStatistic();
|
||||
if(!deploys.isEmpty()) {
|
||||
|
|
@ -367,37 +372,76 @@ public class IotCommonServiceImpl {
|
|||
//mk2 年月份数据时,需要拉取日数据重新进行计算
|
||||
if(IotConstants.year_months.equals(voSurvIntegrateParam.getSummrayMode())){
|
||||
timeDataFormat = "%Y-%m-%d";
|
||||
List<VOSurvIntegrateAirDetail> dayAir = hisdataAirService.integrateSummary(null,airDevice,timeDataFormat,startDateTime,endDateTime);
|
||||
if(!dayAir.isEmpty()){
|
||||
for (VOSurvIntegrateAirDetail dayData : dayAir) {
|
||||
Class<? extends VOSurvIntegrateAirDetail> personClass = dayData.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;
|
||||
if(!airDevice.isEmpty()) {
|
||||
List<VOSurvIntegrateAirDetail> dayAir = hisdataAirService.integrateSummary(null, airDevice, timeDataFormat, startDateTime, endDateTime);
|
||||
if (!dayAir.isEmpty()) {
|
||||
for (VOSurvIntegrateAirDetail dayData : dayAir) {
|
||||
Class<? extends VOSurvIntegrateAirDetail> personClass = dayData.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(dayData);
|
||||
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);
|
||||
Object values = field.get(dayData);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!soilDevice.isEmpty()) {
|
||||
List<VOSurvIntegrateSoilDetail> daySoil = hisdataSoilService.integrateSummary(null, soilDevice, timeDataFormat, startDateTime, endDateTime);
|
||||
if (!daySoil.isEmpty()) {
|
||||
for (VOSurvIntegrateSoilDetail dayDatas : daySoil) {
|
||||
Class<? extends VOSurvIntegrateSoilDetail> personClass = dayDatas.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(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();
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -649,17 +693,17 @@ public class IotCommonServiceImpl {
|
|||
}
|
||||
|
||||
//step 2,获取设备数据
|
||||
List<String> airDevice = new ArrayList<>();
|
||||
List<String> soilDevice = new ArrayList<>();
|
||||
List<String> orientDevice = new ArrayList<>();
|
||||
List<String> liveDevice = new ArrayList<>();
|
||||
List<CommonDataTrans> commonDataTransList = new ArrayList<>();
|
||||
for (SurvDeviceDeploy deploy : deploys) {
|
||||
switch (deploy.getDeployType()){
|
||||
case PollutionConstants.AIR_SURV:
|
||||
airDevice.add(deploy.getDeployCode());
|
||||
case PollutionConstants.WATER_ORIENT:
|
||||
orientDevice.add(deploy.getDeployCode());
|
||||
commonDataTransList.addAll(CommonUtils.transData(deploy, false, null, null, null, null).getTransData());
|
||||
break;
|
||||
case PollutionConstants.SOIL_SURV:
|
||||
soilDevice.add(deploy.getDeployCode());
|
||||
case PollutionConstants.WATER_LIVE:
|
||||
liveDevice.add(deploy.getDeployCode());
|
||||
commonDataTransList.addAll(CommonUtils.transData(deploy, false, null, null, null, null).getTransData());
|
||||
break;
|
||||
}
|
||||
|
|
@ -755,53 +799,53 @@ public class IotCommonServiceImpl {
|
|||
List<String> survItems = new ArrayList<>();
|
||||
Map<String,Map<String,String>> filterMap = new HashMap<>();
|
||||
Map<String,Map<String,String>> accFilterMap = new HashMap<>();
|
||||
if(!airDevice.isEmpty()){
|
||||
List<VOSurvIntegrateAirDetail> airs = hisdataAirService.integrateSummary(null,airDevice,timeDataFormat,startDateTime,endDateTime);
|
||||
if(airs.isEmpty()){//如果airs为空,即设备未采集任何数据,则补充一条0数据,用于构造
|
||||
VOSurvIntegrateAirDetail ent = new VOSurvIntegrateAirDetail();
|
||||
Class<? extends VOSurvIntegrateAirDetail> airClass = ent.getClass();
|
||||
if(!orientDevice.isEmpty()) {
|
||||
List<VOSurvIntegrateOrientDetail> orients = orientwaterService.integrateSummary(null, orientDevice, timeDataFormat, startDateTime, endDateTime);
|
||||
if (orients.isEmpty()) {//如果airs为空,即设备未采集任何数据,则补充一条0数据,用于构造
|
||||
VOSurvIntegrateOrientDetail ent = new VOSurvIntegrateOrientDetail();
|
||||
Class<? extends VOSurvIntegrateOrientDetail> airClass = ent.getClass();
|
||||
Field[] fields = airClass.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
if(!"dates".equals(field.getName())) {
|
||||
try{
|
||||
field.set(ent,"0");
|
||||
}catch (IllegalAccessException e){
|
||||
if (!"dates".equals(field.getName())) {
|
||||
try {
|
||||
field.set(ent, "0");
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
field.setAccessible(false);
|
||||
}
|
||||
airs.add(ent);
|
||||
orients.add(ent);
|
||||
}
|
||||
if(!airs.isEmpty()){
|
||||
if (!orients.isEmpty()) {
|
||||
int counts = 0;
|
||||
for (VOSurvIntegrateAirDetail air : airs) {
|
||||
Class<? extends VOSurvIntegrateAirDetail> personClass = air.getClass();
|
||||
for (VOSurvIntegrateOrientDetail orient : orients) {
|
||||
Class<? extends VOSurvIntegrateOrientDetail> personClass = orient.getClass();
|
||||
Field[] fields = personClass.getDeclaredFields();
|
||||
try {
|
||||
String curIndex = "";
|
||||
Map<String,String> eleMap = new HashMap<>();
|
||||
Map<String, String> eleMap = new HashMap<>();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
//过滤,未配置的不要构造进去
|
||||
if(!"dates".equals(field.getName())) {//非dates的未配置不处理
|
||||
if (!"dates".equals(field.getName())) {//非dates的未配置不处理
|
||||
if (totalSurvItems.get(field.getName()) == null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Object values = field.get(air);
|
||||
Object values = field.get(orient);
|
||||
if (values != null) {
|
||||
String val = values.toString();
|
||||
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
if("dates".equals(field.getName())){
|
||||
if ("dates".equals(field.getName())) {
|
||||
curIndex = val;
|
||||
}else{
|
||||
eleMap.put(field.getName(),val);
|
||||
} else {
|
||||
eleMap.put(field.getName(), val);
|
||||
filterMap.put(curIndex, eleMap);
|
||||
if(counts==0){
|
||||
if (counts == 0) {
|
||||
survItems.add(field.getName());
|
||||
}
|
||||
}
|
||||
|
|
@ -814,12 +858,13 @@ public class IotCommonServiceImpl {
|
|||
counts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!soilDevice.isEmpty()){
|
||||
List<VOSurvIntegrateSoilDetail> soils = hisdataSoilService.integrateSummary(null,soilDevice,timeDataFormat,startDateTime,endDateTime);
|
||||
if(soils.isEmpty()){//如果soils为空,即设备未采集任何数据,则补充一条0数据,用于构造
|
||||
VOSurvIntegrateSoilDetail ent = new VOSurvIntegrateSoilDetail();
|
||||
Class<? extends VOSurvIntegrateSoilDetail> soilClass = ent.getClass();
|
||||
if(!liveDevice.isEmpty()){
|
||||
List<VOSurvIntegrateLiveDetail> lives = livestockwaterService.integrateSummary(null,liveDevice,timeDataFormat,startDateTime,endDateTime);
|
||||
if(lives.isEmpty()){//如果lives为空,即设备未采集任何数据,则补充一条0数据,用于构造
|
||||
VOSurvIntegrateLiveDetail ent = new VOSurvIntegrateLiveDetail();
|
||||
Class<? extends VOSurvIntegrateLiveDetail> soilClass = ent.getClass();
|
||||
Field[] fields = soilClass.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
|
|
@ -833,12 +878,12 @@ public class IotCommonServiceImpl {
|
|||
}
|
||||
field.setAccessible(false);
|
||||
}
|
||||
soils.add(ent);
|
||||
lives.add(ent);
|
||||
}
|
||||
if(!soils.isEmpty()){
|
||||
if(!lives.isEmpty()){
|
||||
int counts = 0;
|
||||
for (VOSurvIntegrateSoilDetail soil : soils) {
|
||||
Class<? extends VOSurvIntegrateSoilDetail> personClass = soil.getClass();
|
||||
for (VOSurvIntegrateLiveDetail live : lives) {
|
||||
Class<? extends VOSurvIntegrateLiveDetail> personClass = live.getClass();
|
||||
Field[] fields = personClass.getDeclaredFields();
|
||||
try {
|
||||
String curIndex = "";
|
||||
|
|
@ -851,7 +896,7 @@ public class IotCommonServiceImpl {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
Object values = field.get(soil);
|
||||
Object values = field.get(live);
|
||||
if (values != null) {
|
||||
String val = values.toString();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
|
|
@ -882,42 +927,80 @@ public class IotCommonServiceImpl {
|
|||
//mk2 年月份数据时,需要拉取日数据重新进行计算
|
||||
if(IotConstants.year_months.equals(voSurvIntegrateParam.getSummrayMode())){
|
||||
timeDataFormat = "%Y-%m-%d";
|
||||
List<VOSurvIntegrateAirDetail> dayAir = hisdataAirService.integrateSummary(null,airDevice,timeDataFormat,startDateTime,endDateTime);
|
||||
if(!dayAir.isEmpty()){
|
||||
for (VOSurvIntegrateAirDetail dayData : dayAir) {
|
||||
Class<? extends VOSurvIntegrateAirDetail> personClass = dayData.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;
|
||||
if(!orientDevice.isEmpty()) {
|
||||
List<VOSurvIntegrateOrientDetail> dayAir = orientwaterService.integrateSummary(null, orientDevice, timeDataFormat, startDateTime, endDateTime);
|
||||
if (!dayAir.isEmpty()) {
|
||||
for (VOSurvIntegrateOrientDetail dayData : dayAir) {
|
||||
Class<? extends VOSurvIntegrateOrientDetail> personClass = dayData.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(dayData);
|
||||
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);
|
||||
Object values = field.get(dayData);
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!liveDevice.isEmpty()) {
|
||||
List<VOSurvIntegrateLiveDetail> daySoil = livestockwaterService.integrateSummary(null, liveDevice, timeDataFormat, startDateTime, endDateTime);
|
||||
if (!daySoil.isEmpty()) {
|
||||
for (VOSurvIntegrateLiveDetail daysData : daySoil) {
|
||||
Class<? extends VOSurvIntegrateLiveDetail> personClass = daysData.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(daysData);
|
||||
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();
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Map<String,String> accItems = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.appmana.service.impl;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.entity.SurvHisdataLivestockwater;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateLiveDetail;
|
||||
import org.jeecg.common.vo.LiveDataTrans;
|
||||
import org.jeecg.modules.appmana.mapper.SurvHisdataLivestockwaterMapper;
|
||||
import org.jeecg.modules.appmana.service.ISurvHisdataLivestockwaterService;
|
||||
|
|
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -45,6 +47,10 @@ public class SurvHisdataLivestockwaterServiceImpl extends ServiceImpl<SurvHisdat
|
|||
return baseMapper.getRecentDate(deployCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VOSurvIntegrateLiveDetail> integrateSummary(String tenantId, List<String> liveDevice, String timeDataFormat, LocalDateTime startDateTime, LocalDateTime endDateTime) {
|
||||
return baseMapper.integrateSummary(tenantId,liveDevice,timeDataFormat, startDateTime, endDateTime);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.appmana.service.impl;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.jeecg.common.entity.SurvHisdataOrientwater;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateOrientDetail;
|
||||
import org.jeecg.common.vo.OrientDataTrans;
|
||||
import org.jeecg.modules.appmana.mapper.SurvHisdataOrientwaterMapper;
|
||||
import org.jeecg.modules.appmana.service.ISurvHisdataOrientwaterService;
|
||||
|
|
@ -13,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -52,4 +54,9 @@ public class SurvHisdataOrientwaterServiceImpl extends ServiceImpl<SurvHisdataOr
|
|||
return baseMapper.getRecentDate(deployCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VOSurvIntegrateOrientDetail> integrateSummary(String tenantId, List<String> orientDevice, String timeDataFormat, LocalDateTime startDateTime, LocalDateTime endDateTime) {
|
||||
return baseMapper.integrateSummary(tenantId,orientDevice,timeDataFormat, startDateTime, endDateTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,9 +180,6 @@ w * @param pageNo 非必传,虫情孢子类,杀虫灯传入
|
|||
}
|
||||
List<CommonDataTrans> listFinal = new ArrayList<>();
|
||||
String timeGap = DateUtilTools.calTimeGap(transdataAir.getDataDateTime(), LocalDateTime.now());
|
||||
if("1042".equals(transdataAir.getTenantId())){
|
||||
timeGap = "1";
|
||||
}
|
||||
SurvConfig fSurvConfig = survConfigService.getOneByTypeWithTenant(transdataAir.getTenantId(), IotConstants.surv_itemname);
|
||||
cn.hutool.json.JSONObject configs = null;
|
||||
if (fSurvConfig != null) {
|
||||
|
|
@ -391,9 +388,6 @@ w * @param pageNo 非必传,虫情孢子类,杀虫灯传入
|
|||
}
|
||||
List<CommonDataTrans> listFinal = new ArrayList<>();
|
||||
String timeGap = DateUtilTools.calTimeGap(transdataSoil.getDataDateTime(), LocalDateTime.now());
|
||||
if("1042".equals(transdataSoil.getTenantId())){
|
||||
timeGap = "1";
|
||||
}
|
||||
Class<? extends SurvTransdataSoil> personClass = transdataSoil.getClass();
|
||||
Field[] fields = personClass.getDeclaredFields();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
package org.jeecg.modules.appmana.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.IotConstants;
|
||||
import org.jeecg.common.constant.enums.PollutionEnum;
|
||||
import org.jeecg.common.entity.PollutionSetVo;
|
||||
import org.jeecg.common.entity.ScEquZhibiao;
|
||||
import org.jeecg.common.entity.SurvConfig;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.vo.PolutionVo;
|
||||
import org.jeecg.modules.appmana.service.ISurvConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -125,4 +133,165 @@ public class Iotutils {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public JSONArray getPollutionDict(){
|
||||
PollutionEnum[] values = PollutionEnum.values();
|
||||
JSONArray jarrs = new JSONArray();
|
||||
SurvConfig fSurvConfig = survConfigService.getOneByTypeWithTenant(null, 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");
|
||||
}
|
||||
|
||||
|
||||
for (PollutionEnum e : values) {
|
||||
String iconFinalName = e.getIconName();
|
||||
String itemFinalName = e.getDescription();
|
||||
String bsIcon = e.getBsIcon();
|
||||
PolutionVo pvo = new PolutionVo();
|
||||
if (configs != null) {
|
||||
String itemName = desConfig != null ? desConfig.getStr(e.getCode()) : "";
|
||||
String iconName = iconConfig != null ? iconConfig.getStr(e.getCode()) : "";
|
||||
if (StringUtils.isNotBlank(itemName)) {
|
||||
itemFinalName = itemName;
|
||||
}
|
||||
if (StringUtils.isNotBlank(iconName)) {
|
||||
iconFinalName = iconName;
|
||||
}
|
||||
if (StringUtils.isNotBlank(bsIconPath)) {
|
||||
bsIcon = bsIconPath + iconFinalName;
|
||||
}
|
||||
pvo.setBsIconPath(bsIconPath);
|
||||
pvo.setBsIconPath2(bsIconPath2);
|
||||
pvo.setH5IconPath(h5IconPath);
|
||||
pvo.setAppIconPath(appIconPath);
|
||||
pvo.setMidIconPath(midIconPath);
|
||||
}
|
||||
pvo.setCode(e.getCode());
|
||||
pvo.setDescription(itemFinalName);
|
||||
pvo.setUnit(e.getUnit());
|
||||
pvo.setIcon(e.getIcon());
|
||||
pvo.setColor(e.getColor());
|
||||
pvo.setBsIcon(bsIcon);
|
||||
// JSONObject job =new JSONObject();
|
||||
// job.put(e.getCode(),pvo);
|
||||
// jarrs.add(job);
|
||||
jarrs.add(JSONObject.parseObject(JSONObject.toJSONString(pvo)));
|
||||
|
||||
}
|
||||
return jarrs;
|
||||
}
|
||||
|
||||
public List<PollutionSetVo> translatePollution(List<ScEquZhibiao> zhibiaos){
|
||||
List<PollutionSetVo> pollutionSetVos = new ArrayList<>();
|
||||
if(!zhibiaos.isEmpty()){
|
||||
|
||||
SurvConfig fSurvConfig = survConfigService.getOneByTypeWithTenant(null, 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");
|
||||
}
|
||||
|
||||
|
||||
for (ScEquZhibiao scEquZhibiao : zhibiaos) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
PollutionEnum e = PollutionEnum.catchPollution(scEquZhibiao.getEntityField());
|
||||
String itemFinalName = e.getDescription();
|
||||
PolutionVo pvo = new PolutionVo();
|
||||
if (configs != null) {
|
||||
String itemName = desConfig != null ? desConfig.getStr(e.getCode()) : "";
|
||||
if (StringUtils.isNotBlank(itemName)) {
|
||||
itemFinalName = itemName;
|
||||
}
|
||||
}
|
||||
|
||||
pollutionSetVo.setColor(e.getColor());
|
||||
pollutionSetVo.setName(itemFinalName);
|
||||
pollutionSetVos.add(pollutionSetVo);
|
||||
}
|
||||
}
|
||||
return pollutionSetVos;
|
||||
}
|
||||
|
||||
|
||||
public List<PollutionSetVo> translateArrPollution(String [] arrs){
|
||||
List<PollutionSetVo> pollutionSetVos = new ArrayList<>();
|
||||
if(arrs.length>0){
|
||||
|
||||
SurvConfig fSurvConfig = survConfigService.getOneByTypeWithTenant(null, 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");
|
||||
}
|
||||
|
||||
if(arrs!=null && arrs.length>0) {
|
||||
for (String survStr : arrs) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
PollutionEnum e = PollutionEnum.catchMessage(survStr);
|
||||
|
||||
String itemFinalName = e.getDescription();
|
||||
PolutionVo pvo = new PolutionVo();
|
||||
if (configs != null) {
|
||||
String itemName = desConfig != null ? desConfig.getStr(e.getCode()) : "";
|
||||
if (StringUtils.isNotBlank(itemName)) {
|
||||
itemFinalName = itemName;
|
||||
}
|
||||
}
|
||||
|
||||
pollutionSetVo.setColor(e.getColor());
|
||||
pollutionSetVo.setName(itemFinalName);
|
||||
pollutionSetVos.add(pollutionSetVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pollutionSetVos;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,34 @@
|
|||
package org.jeecg.system.applet.client;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.entity.PollutionSetVo;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateParam;
|
||||
import org.jeecg.common.iot.common.VOWaterSurvIntegrateParam;
|
||||
import org.jeecg.common.vo.inner.TransSurvObjVo;
|
||||
import org.jeecg.common.vo.inner.TransZhiBiaoVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value = "zh-applet-admin")
|
||||
public interface ZhAdminFeignClient {
|
||||
|
||||
@GetMapping("/inner/b/hello/{name}")
|
||||
String callServiceB(@PathVariable("name") String name);
|
||||
@GetMapping("/appmana/inner/api/survIntegrateStatistic")
|
||||
JSONObject survIntegrateStatistic(@RequestBody VOSurvIntegrateParam voSurvIntegrateParam);
|
||||
|
||||
@GetMapping("/appmana/inner/api/waterIntegrateStatistic")
|
||||
JSONObject waterIntegrateStatistic(@RequestBody VOWaterSurvIntegrateParam waterSurvIntegrateParam);
|
||||
|
||||
@GetMapping("/appmana/inner/api/getPollutionDict")
|
||||
JSONArray getPollutionDict();
|
||||
|
||||
@GetMapping("/appmana/inner/api/translatePollution")
|
||||
List<PollutionSetVo> translatePollution(@RequestBody TransZhiBiaoVo transZhiBiaoVo);
|
||||
|
||||
@GetMapping("/appmana/inner/api/translateArrPollution")
|
||||
List<PollutionSetVo> translateArrPollution(@RequestBody TransSurvObjVo transSurvObjVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,18 @@ import java.util.*;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import org.jeecg.common.constant.PollutionConstants;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.entity.SurvStationInfo;
|
||||
import org.jeecg.common.iot.common.VOIntegrateStatistic;
|
||||
import org.jeecg.common.iot.common.VOSurvIntegrateParam;
|
||||
import org.jeecg.common.iot.common.VOWaterSurvIntegrateParam;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.system.applet.annotation.ApiLogin;
|
||||
import org.jeecg.system.applet.client.ZhAdminFeignClient;
|
||||
import org.jeecg.system.applet.service.ISurvDeviceDeployService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
|
@ -43,7 +49,8 @@ public class SurvDeviceDeployController {
|
|||
private ISurvStationInfoService stationInfoService;
|
||||
@Autowired
|
||||
private Iotutils iotutils;
|
||||
|
||||
@Autowired
|
||||
private ZhAdminFeignClient zhAdminFeignClient;
|
||||
|
||||
/**
|
||||
* 监控摄像头分页列表查询
|
||||
|
|
@ -92,4 +99,19 @@ public class SurvDeviceDeployController {
|
|||
|
||||
|
||||
|
||||
@ApiOperation(value = "空气土壤监测综合数据统计", notes = "")
|
||||
@PostMapping(value = "/survIntegrateStatistic")
|
||||
public R<VOIntegrateStatistic> survIntegrateStatistic(@RequestBody VOSurvIntegrateParam voSurvIntegrateParam) {
|
||||
JSONObject job = zhAdminFeignClient.survIntegrateStatistic(voSurvIntegrateParam);
|
||||
VOIntegrateStatistic voIntegrateStatistic = job.getObject("result",VOIntegrateStatistic.class);
|
||||
return R.ok(voIntegrateStatistic);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "水质监测综合数据统计", notes = "")
|
||||
@PostMapping(value = "/waterIntegrateStatistic")
|
||||
public R<VOIntegrateStatistic> waterIntegrateStatistic(@RequestBody VOWaterSurvIntegrateParam waterSurvIntegrateParam) {
|
||||
JSONObject job = zhAdminFeignClient.waterIntegrateStatistic(waterSurvIntegrateParam);
|
||||
VOIntegrateStatistic voIntegrateStatistic = job.getObject("result",VOIntegrateStatistic.class);
|
||||
return R.ok(voIntegrateStatistic);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ import org.jeecg.common.constant.enums.PollutionEnum;
|
|||
import org.jeecg.common.entity.*;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.common.vo.*;
|
||||
import org.jeecg.common.vo.inner.TransSurvObjVo;
|
||||
import org.jeecg.common.vo.inner.TransZhiBiaoVo;
|
||||
import org.jeecg.system.applet.annotation.ApiLogin;
|
||||
import org.jeecg.system.applet.client.ZhAdminFeignClient;
|
||||
import org.jeecg.system.applet.service.*;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -87,7 +90,11 @@ public class SurvStationInfoController {
|
|||
@Autowired
|
||||
private Iotutils iotutils;
|
||||
|
||||
/**
|
||||
@Autowired
|
||||
private ZhAdminFeignClient zhAdminFeignClient;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param pageNo
|
||||
|
|
@ -220,12 +227,9 @@ public class SurvStationInfoController {
|
|||
}
|
||||
List<ScEquZhibiao> equList = zhibiaoService.getShowedChemical(deployList);
|
||||
if(equList.size()>0){
|
||||
for (ScEquZhibiao scEquZhibiao : equList) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
pollutionSetVo.setColor(PollutionEnum.catchMessage(scEquZhibiao.getName()).getColor());
|
||||
pollutionSetVo.setName(scEquZhibiao.getName());
|
||||
allSurv.add(pollutionSetVo);
|
||||
}
|
||||
TransZhiBiaoVo transZhiBiaoVo = new TransZhiBiaoVo();
|
||||
transZhiBiaoVo.setZhibiaos(equList);
|
||||
allSurv = zhAdminFeignClient.translatePollution(transZhiBiaoVo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -284,12 +288,9 @@ public class SurvStationInfoController {
|
|||
curStation.setSurvItemCount(curStation.getSurvObj().length);
|
||||
List<PollutionSetVo> survList = new ArrayList<>();
|
||||
if(curStation.getSurvObj()!=null&&curStation.getSurvObj().length>0) {
|
||||
for (String survStr : curStation.getSurvObj()) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
pollutionSetVo.setColor(PollutionEnum.catchMessage(survStr).getColor());
|
||||
pollutionSetVo.setName(survStr);
|
||||
survList.add(pollutionSetVo);
|
||||
}
|
||||
TransSurvObjVo transSurvObjVo = new TransSurvObjVo();
|
||||
transSurvObjVo.setSurvObj(curStation.getSurvObj());
|
||||
survList = zhAdminFeignClient.translateArrPollution(transSurvObjVo);
|
||||
}
|
||||
curStation.setSurvColorItems(survList);
|
||||
jsonObject.put("stationInfo",curStation);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import org.jeecg.common.entity.*;
|
|||
import org.jeecg.common.constant.enums.PollutionEnum;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.common.vo.*;
|
||||
import org.jeecg.common.vo.inner.TransZhiBiaoVo;
|
||||
import org.jeecg.system.applet.client.ZhAdminFeignClient;
|
||||
import org.jeecg.system.applet.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -67,6 +69,9 @@ public class WxAppletController {
|
|||
@Autowired
|
||||
private ISurvHisdataVocsService vocsService;
|
||||
|
||||
@Autowired
|
||||
private ZhAdminFeignClient zhAdminFeignClient;
|
||||
|
||||
// @PostMapping("/getNewestData")
|
||||
// @ApiOperation("获取首页最新数据")
|
||||
// public R getNewestData(){
|
||||
|
|
@ -442,7 +447,30 @@ public class WxAppletController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// @ApiOperation("按设备查询监测数据")
|
||||
// @GetMapping("/getSurvDataByDevice")
|
||||
// public R getSurvDataByDevice(@RequestParam("deployCode") String deployCode){
|
||||
// SurvDeviceDeploy survDeviceDeploy = deviceDeployService.getDeviceByCode(deployCode);
|
||||
// if(survDeviceDeploy==null){
|
||||
// return R.failed("无效的设备");
|
||||
// }
|
||||
// //获取设备信息
|
||||
// JSONObject job = new JSONObject();
|
||||
// List<PollutionSetVo> zhibiaoList = new ArrayList<>();
|
||||
// List<ScEquZhibiao> equList = zhibiaoService.getSingleShowedChemical(survDeviceDeploy.getId());
|
||||
// if(equList.size()>0){
|
||||
// for (ScEquZhibiao scEquZhibiao : equList) {
|
||||
// PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
// pollutionSetVo.setColor(PollutionEnum.catchMessage(scEquZhibiao.getName()).getColor());
|
||||
// pollutionSetVo.setName(scEquZhibiao.getName());
|
||||
// zhibiaoList.add(pollutionSetVo);
|
||||
// }
|
||||
// }
|
||||
// job.put("zhibiao",zhibiaoList);
|
||||
//
|
||||
//// job.put("dataList",listFinal);
|
||||
// return R.ok(job);
|
||||
// }
|
||||
|
||||
|
||||
@ApiOperation("按设备查询监测数据")
|
||||
|
|
@ -458,13 +486,10 @@ public class WxAppletController {
|
|||
JSONObject job = new JSONObject();
|
||||
List<PollutionSetVo> zhibiaoList = new ArrayList<>();
|
||||
List<ScEquZhibiao> equList = zhibiaoService.getSingleShowedChemical(survDeviceDeploy.getId());
|
||||
if(equList.size()>0){
|
||||
for (ScEquZhibiao scEquZhibiao : equList) {
|
||||
PollutionSetVo pollutionSetVo = new PollutionSetVo();
|
||||
pollutionSetVo.setColor(PollutionEnum.catchMessage(scEquZhibiao.getName()).getColor());
|
||||
pollutionSetVo.setName(scEquZhibiao.getName());
|
||||
zhibiaoList.add(pollutionSetVo);
|
||||
}
|
||||
if(!equList.isEmpty()){
|
||||
TransZhiBiaoVo transZhiBiaoVo = new TransZhiBiaoVo();
|
||||
transZhiBiaoVo.setZhibiaos(equList);
|
||||
zhibiaoList = zhAdminFeignClient.translatePollution(transZhiBiaoVo);
|
||||
}
|
||||
job.put("zhibiao",zhibiaoList);
|
||||
if(PollutionConstants.WATER_ORIENT.equals(survDeviceDeploy.getDeployType())){
|
||||
|
|
|
|||
|
|
@ -225,19 +225,18 @@ public enum PollutionEnum {
|
|||
public void setIconName(String iconName) {
|
||||
this.iconName = iconName;
|
||||
}
|
||||
|
||||
public static PollutionEnum catchMessage(String msg) {
|
||||
|
||||
PollutionEnum result = null;
|
||||
|
||||
for (PollutionEnum s : values()) {
|
||||
if (s.code.equals(msg)) {
|
||||
if (s.description.equals(msg)) {
|
||||
result = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == null) {
|
||||
if(result==null){
|
||||
return dataDefault;
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package org.jeecg.common.iot.common;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
public class VOSurvIntegrateLiveDetail {
|
||||
@ApiModelProperty("时间")
|
||||
private String dates;
|
||||
|
||||
/**
|
||||
* 总磷
|
||||
*/
|
||||
@Excel(name = "总磷(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "大气温度(mg/L)")
|
||||
private String dataWaterTp;
|
||||
|
||||
/**
|
||||
* 总氮
|
||||
*/
|
||||
@Excel(name = "总氮(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "大气湿度(mg/L)")
|
||||
private String dataWaterTn;
|
||||
|
||||
/**
|
||||
* 氨氮
|
||||
*/
|
||||
@Excel(name = "氨氮(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "氨氮(mg/L)")
|
||||
private String dataWaterNh;
|
||||
|
||||
|
||||
/**
|
||||
* 化学需氧量
|
||||
*/
|
||||
@Excel(name = "化学需氧量(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "化学需氧量(mg/L)")
|
||||
private String dataWaterCod;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package org.jeecg.common.iot.common;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
@Data
|
||||
public class VOSurvIntegrateOrientDetail {
|
||||
@ApiModelProperty("时间")
|
||||
private String dates;
|
||||
|
||||
/**
|
||||
* 总磷
|
||||
*/
|
||||
@Excel(name = "总磷(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "大气温度(mg/L)")
|
||||
private String dataWaterTp;
|
||||
|
||||
/**
|
||||
* 总氮
|
||||
*/
|
||||
@Excel(name = "总氮(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "大气湿度(mg/L)")
|
||||
private String dataWaterTn;
|
||||
|
||||
/**
|
||||
* 硝态氮
|
||||
*/
|
||||
@Excel(name = "硝态氮(mg/L)", width = 15)
|
||||
@ApiModelProperty(value = "硝态氮(mg/L)")
|
||||
private String dataWaterNo;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
|
@ -26,4 +27,17 @@ public class PolutionVo {
|
|||
* 颜色
|
||||
*/
|
||||
private String color;
|
||||
|
||||
@ApiModelProperty("h5图标路径")
|
||||
private String h5IconPath;
|
||||
@ApiModelProperty("中台图标路径")
|
||||
private String midIconPath;
|
||||
@ApiModelProperty("app图标路径")
|
||||
private String appIconPath;
|
||||
@ApiModelProperty("大屏图标路径")
|
||||
private String bsIconPath;
|
||||
@ApiModelProperty("大屏图标路径2")
|
||||
private String bsIconPath2;
|
||||
@ApiModelProperty("大屏图标")
|
||||
private String bsIcon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ public class StationSummry {
|
|||
private String groupId;
|
||||
@JSONField(name = "groupName")
|
||||
private String groupName;
|
||||
@JSONField(name = "stationName")
|
||||
private String stationName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.common.vo.inner;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.entity.ScEquZhibiao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TransSurvObjVo {
|
||||
|
||||
private String[] survObj;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.common.vo.inner;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.entity.ScEquZhibiao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TransZhiBiaoVo {
|
||||
|
||||
private List<ScEquZhibiao> zhibiaos;
|
||||
}
|
||||
Loading…
Reference in New Issue