Merge branch 'master' of codeup.aliyun.com:6428039c708c83a3fd907211/hzwmiot/hzwmiot24_java
# Conflicts: # fastbee-open-api/src/main/java/com/fastbee/data/controller/devicedetail/DeviceDetailController.java # fastbee-open-api/src/main/java/com/fastbee/data/service/devicedetail/IDeviceDetailService.java # fastbee-open-api/src/main/java/com/fastbee/data/service/devicedetail/impl/DeviceDetailServiceImpl.java
This commit is contained in:
@ -1,13 +1,13 @@
|
|||||||
package com.fastbee.data.controller.devicedetail;
|
package com.fastbee.data.controller.devicedetail;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.fastbee.common.core.controller.BaseController;
|
import com.fastbee.common.core.controller.BaseController;
|
||||||
import com.fastbee.common.core.domain.AjaxResult;
|
import com.fastbee.common.core.domain.AjaxResult;
|
||||||
|
import com.fastbee.common.core.domain.CommonResult;
|
||||||
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
||||||
import com.fastbee.common.utils.StringUtils;
|
|
||||||
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
import com.fastbee.iot.model.DeviceHistoryParam;
|
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
||||||
|
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
||||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||||
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
|
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
|
||||||
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
||||||
@ -15,10 +15,8 @@ import com.fastbee.xunjian.domain.XjInspectionRecords;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Api(tags = "设备详情数据")
|
@Api(tags = "设备详情数据")
|
||||||
@ -126,6 +124,16 @@ public class DeviceDetailController extends BaseController {
|
|||||||
}
|
}
|
||||||
return AjaxResult.success(deviceDetailService.anfangInfo(deviceId));
|
return AjaxResult.success(deviceDetailService.anfangInfo(deviceId));
|
||||||
}
|
}
|
||||||
|
@ApiOperation("箱门打开控制")
|
||||||
|
@PostMapping("/hwcmd")
|
||||||
|
public CommonResult<CmdHaiWeiVo> cmdDevices(@RequestBody CmdHaiWeiDto cmdHwDto) {
|
||||||
|
return deviceDetailService.cmdDevices(cmdHwDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fastbee.data.controller.waterele;
|
package com.fastbee.data.controller.waterele;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -57,8 +58,8 @@ public class MaWatereleRecordController extends BaseController {
|
|||||||
@GetMapping("/echart")
|
@GetMapping("/echart")
|
||||||
@ApiOperation("查询水电双计数据记录echart")
|
@ApiOperation("查询水电双计数据记录echart")
|
||||||
public Map<String, Object> echart(MaWatereleRecord maWatereleRecord) {
|
public Map<String, Object> echart(MaWatereleRecord maWatereleRecord) {
|
||||||
Map<String, Object> map = maWatereleRecordService.chartData(maWatereleRecord);
|
ArrayList<Object> list = maWatereleRecordService.chartData(maWatereleRecord);
|
||||||
return success(map);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
package com.fastbee.data.service.devicedetail;
|
package com.fastbee.data.service.devicedetail;
|
||||||
|
|
||||||
|
import com.fastbee.common.core.domain.CommonResult;
|
||||||
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
||||||
import com.fastbee.data.domain.vo.AnfangInfoVo;
|
import com.fastbee.data.domain.vo.AnfangInfoVo;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
|
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
||||||
|
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
||||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||||
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
|
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
|
||||||
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
||||||
import com.fastbee.xunjian.domain.XjInspectionRecords;
|
import com.fastbee.xunjian.domain.XjInspectionRecords;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface IDeviceDetailService {
|
public interface IDeviceDetailService {
|
||||||
@ -29,5 +31,7 @@ public interface IDeviceDetailService {
|
|||||||
|
|
||||||
List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo);
|
List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo);
|
||||||
|
|
||||||
|
CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto);
|
||||||
|
|
||||||
AnfangInfoVo anfangInfo(Long deviceId);
|
AnfangInfoVo anfangInfo(Long deviceId);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
package com.fastbee.data.service.devicedetail.impl;
|
package com.fastbee.data.service.devicedetail.impl;
|
||||||
|
|
||||||
|
import com.fastbee.common.core.domain.CommonResult;
|
||||||
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
||||||
import com.fastbee.common.utils.DevParamsUtils;
|
import com.fastbee.common.utils.DevParamsUtils;
|
||||||
import com.fastbee.common.utils.StringUtils;
|
import com.fastbee.common.utils.StringUtils;
|
||||||
|
import com.fastbee.common.utils.StringUtils;
|
||||||
import com.fastbee.data.domain.vo.AnfangInfoVo;
|
import com.fastbee.data.domain.vo.AnfangInfoVo;
|
||||||
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
import com.fastbee.iot.domain.ThingsModel;
|
import com.fastbee.iot.haiwei.service.HaiWeiService;
|
||||||
import com.fastbee.iot.mapper.DeviceMapper;
|
import com.fastbee.iot.mapper.DeviceMapper;
|
||||||
|
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
||||||
|
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
||||||
import com.fastbee.iot.service.IDeviceService;
|
import com.fastbee.iot.service.IDeviceService;
|
||||||
import com.fastbee.iot.service.IThingsModelService;
|
import com.fastbee.iot.service.IThingsModelService;
|
||||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||||
@ -35,6 +39,8 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
private XjInspectionRoutesMapper xjInspectionRoutesMapper;
|
private XjInspectionRoutesMapper xjInspectionRoutesMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private XjInspectionRecordsMapper xjInspectionRecordsMapper;
|
private XjInspectionRecordsMapper xjInspectionRecordsMapper;
|
||||||
|
@Autowired
|
||||||
|
private HaiWeiService haiWeiService;
|
||||||
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
||||||
this.deviceMapper = deviceMapper;
|
this.deviceMapper = deviceMapper;
|
||||||
}
|
}
|
||||||
@ -138,6 +144,18 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
//获取安防历史记录
|
//获取安防历史记录
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto) {
|
||||||
|
String url = "https://cloud.haiwell.com/api/project/machine/datagroup/setTagsValue";
|
||||||
|
Device deviceEntity = deviceMapper.selectDeviceByDeviceId(cmdHaiWeiDto.getDeviceId());
|
||||||
|
Map<String, Object> devParams1 = DevParamsUtils.getDevParams(deviceEntity.getDevParams());
|
||||||
|
String guimenIds = devParams1.get("guimenIds").toString();
|
||||||
|
if (StringUtils.isEmpty(guimenIds)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
cmdHaiWeiDto.setDeviceId(Long.valueOf(guimenIds));
|
||||||
|
return haiWeiService.cmdDevices(cmdHaiWeiDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fastbee.waterele.service;
|
package com.fastbee.waterele.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ public interface IMaWatereleRecordService
|
|||||||
*/
|
*/
|
||||||
public int deleteMaWatereleRecordById(Long id);
|
public int deleteMaWatereleRecordById(Long id);
|
||||||
|
|
||||||
Map<String, Object> chartData(MaWatereleRecord maWatereleRecord);
|
ArrayList<Object> chartData(MaWatereleRecord maWatereleRecord);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,20 +96,33 @@ public class MaWatereleRecordServiceImpl implements IMaWatereleRecordService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> chartData(MaWatereleRecord maWatereleRecord) {
|
public ArrayList<Object> chartData(MaWatereleRecord maWatereleRecord) {
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
ArrayList<Object> list = new ArrayList<>();
|
||||||
List<MaWatereleRecord> maWatereleRecords = maWatereleRecordMapper.selectMaWatereleRecordList(maWatereleRecord);
|
List<MaWatereleRecord> maWatereleRecords = maWatereleRecordMapper.selectMaWatereleRecordList(maWatereleRecord);
|
||||||
List<String> time = new ArrayList<>();
|
List<String> time = new ArrayList<>();
|
||||||
List<String> sumFlow = new ArrayList<>();
|
List<String> sumFlow = new ArrayList<>();
|
||||||
List<String> sumEle = new ArrayList<>();
|
List<String> sumEle = new ArrayList<>();
|
||||||
|
HashMap<String, Object> sumFlowtMap = new HashMap<>();
|
||||||
|
sumFlowtMap.put("name", "累计水量");
|
||||||
|
sumFlowtMap.put("unit", "m³");
|
||||||
|
HashMap<String, Object> sumEletMap = new HashMap<>();
|
||||||
|
sumEletMap.put("name", "累计电量");
|
||||||
|
sumEletMap.put("unit", "度");
|
||||||
for (MaWatereleRecord record : maWatereleRecords) {
|
for (MaWatereleRecord record : maWatereleRecords) {
|
||||||
time.add(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, record.getCreateTime()));
|
time.add(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, record.getCreateTime()));
|
||||||
sumFlow.add(record.getSumflow());
|
sumFlow.add(record.getSumflow());
|
||||||
sumEle.add(record.getSumele());
|
sumEle.add(record.getSumele());
|
||||||
}
|
}
|
||||||
map.put("time", time);
|
sumFlowtMap.put("time", time);
|
||||||
map.put("sumFlow", sumFlow);
|
sumFlowtMap.put("data", sumFlow);
|
||||||
map.put("sumEle", sumEle);
|
sumEletMap.put("time", time);
|
||||||
return map;
|
sumEletMap.put("data", sumEle);
|
||||||
|
list.add(sumFlowtMap);
|
||||||
|
list.add(sumEletMap);
|
||||||
|
// map.put("time", time);
|
||||||
|
// map.put("sumFlow", sumFlow);
|
||||||
|
// map.put("sumEle", sumEle);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user