|
@@ -7,13 +7,14 @@ import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
import com.welampiot.utils.ExcelUtil;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
+import com.welampiot.utils.WebUtils;
|
|
|
import com.welampiot.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
+import java.io.File;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
@@ -57,6 +58,8 @@ public class NewLampPoleController {
|
|
|
@Autowired
|
|
|
private LampService lampService;
|
|
|
@Autowired
|
|
|
+ private LoopService loopService;
|
|
|
+ @Autowired
|
|
|
private LampInfoLogService lampInfoLogService;
|
|
|
@Autowired
|
|
|
private LampPoleAlarmLogService lampPoleAlarmLogService;
|
|
@@ -86,74 +89,54 @@ public class NewLampPoleController {
|
|
|
lampPoleInfoVO.setRunCount(listByVO.size());
|
|
|
lampPoleInfoVO.setWifiCount(listByVO.size());
|
|
|
lampPoleInfoVO.setEmCount(0);
|
|
|
+ lampPoleInfoVO.setTiltCount(0);
|
|
|
+ lampPoleInfoVO.setChargeCount(0);
|
|
|
+ lampPoleInfoVO.setWeatherCount(0);
|
|
|
+ lampPoleInfoVO.setDisableCount(0);
|
|
|
+
|
|
|
+ // 灯控数
|
|
|
+ LampCountVO lampCountVO = new LampCountVO();
|
|
|
+ lampCountVO.setSectionList(sectionList);
|
|
|
+ lampPoleInfoVO.setLampCount(lampService.getLampPoleCountByVO(lampCountVO));
|
|
|
+
|
|
|
+ // 摄像头设备数量
|
|
|
+ VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
|
|
|
+ videoMonitorVO.setSectionList(sectionList);
|
|
|
+ lampPoleInfoVO.setVideoCount(videoMonitorService.getLampPoleCountByVO(videoMonitorVO));
|
|
|
+
|
|
|
+ // 广告屏设备数量
|
|
|
+ ScreenDTO screenDTO = new ScreenDTO();
|
|
|
+ screenDTO.setSectionList(sectionList);
|
|
|
+ lampPoleInfoVO.setScreenCount(screenService.getTotalBySectionList(screenDTO));
|
|
|
+
|
|
|
+ // 空开设备数量
|
|
|
+ LoopDTO loopDTO = new LoopDTO();
|
|
|
+ loopDTO.setSectionList(sectionList);
|
|
|
+ lampPoleInfoVO.setLoopCount(loopService.getTotalBySectionList(loopDTO));
|
|
|
+
|
|
|
for (LampPoleDTO l:listByVO) {
|
|
|
-// String devType = l.getDevType();
|
|
|
-// List split = Arrays.asList(devType.split(","));
|
|
|
-// if (split.contains("5")) lampPoleInfoVO.setEmCount(lampPoleInfoVO.getEmCount()+1);;
|
|
|
+ String devType = l.getDevType();
|
|
|
+ List split = Arrays.asList(devType.split(","));
|
|
|
+ if (split.contains("5")) lampPoleInfoVO.setEmCount(lampPoleInfoVO.getEmCount()+1);
|
|
|
+ if (split.contains("6")) lampPoleInfoVO.setChargeCount(lampPoleInfoVO.getChargeCount()+1);
|
|
|
+ if (split.contains("7")) lampPoleInfoVO.setWeatherCount(lampPoleInfoVO.getWeatherCount()+1);
|
|
|
+ if (split.contains("18")) lampPoleInfoVO.setTiltCount(lampPoleInfoVO.getTiltCount()+1);
|
|
|
}
|
|
|
-// $data['loopCount'] = $this->Loop_model->get_count(array('sectionid'=>$sectionId));
|
|
|
-// $id_arr = array_column($lampPoleList, 'id');
|
|
|
-// $temp_l = [];
|
|
|
-// if (!empty($id_arr)) {
|
|
|
-// $sql = 'select lamp_pole_id,max(updatetime),status,id,devtype from lamp_pole_alarm_log where lamp_pole_id in ('.implode(',', $id_arr).') and (status = 0 or status = 1) group by lamp_pole_id';
|
|
|
-// $l_list = $this->db->query($sql)->result_array();
|
|
|
-// foreach ($l_list as $key => $value) {
|
|
|
-// // if ($value['status'] != 1 && $value['status'] != 0) continue;
|
|
|
-// $temp_l[$value['lamp_pole_id']] = $value;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// $lampPoleId = array();
|
|
|
-// foreach ($lampPoleList as $lampPole) {
|
|
|
-// $data['deviceCount'] += 1;
|
|
|
-// $data['runCount'] += 1;
|
|
|
-// if (time() - strtotime($lampPole['createtime']) <= 3600*24*30) {
|
|
|
-// $data['newCount'] += 1;
|
|
|
-// }
|
|
|
-// $typeArr = explode(',', $lampPole['devtype']);
|
|
|
-// if (in_array('0', $typeArr)) $data['lampCount'] += 1;
|
|
|
-// if (in_array('1', $typeArr)) $data['videoCount'] += 1;
|
|
|
-// if (in_array('2', $typeArr)) $data['wifiCount'] += 1;
|
|
|
-// if (in_array('4', $typeArr)) $data['screenCount'] += 1;
|
|
|
-// if (in_array('5', $typeArr)) $data['emCount'] += 1;
|
|
|
-// if (in_array('6', $typeArr)) $data['chargeCount'] += 1;
|
|
|
-// if (in_array('7', $typeArr)) $data['weatherCount'] += 1;
|
|
|
-// if (in_array('9', $typeArr)) $data['radioCount'] += 1;
|
|
|
-// if (in_array('14', $typeArr)) $data['waterImmersionCount'] += 1;
|
|
|
-// if (in_array('18', $typeArr)) $data['tiltCount'] += 1;
|
|
|
-// if (in_array('15', $typeArr)) $data['lockCount'] += 1;
|
|
|
-// if (isset($temp_l[$lampPole['id']])) {
|
|
|
-// $data['faultCount'] += 1;
|
|
|
-// $data['runCount'] -= 1;
|
|
|
-// }
|
|
|
-//
|
|
|
-// $lampPoleId[] = $lampPole['id'];
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (!empty($lampPoleId)) {
|
|
|
-// // smart_lock_dev_info
|
|
|
-// $res = $this->db->query('select count(*) as total from smart_lock_dev_info where lamp_pole_id in ('.implode(',', $lampPoleId).')')->row_array();
|
|
|
-// $data['lockCount'] = intval($res['total']);
|
|
|
-//
|
|
|
-// $lampinfoList = $this->Lampinfo_model->get_list(array('lamp_pole_id'=>$lampPoleId),'id');
|
|
|
-// $lampId = array();
|
|
|
-// $data['lampCount'] = count($lampinfoList);
|
|
|
-// foreach ($lampinfoList as $l) {
|
|
|
-// $lampId[] = $l['id'];
|
|
|
-// }
|
|
|
-// if (!empty($lampId)) {
|
|
|
-// $join = array(
|
|
|
-// array('table'=>'lamp_info_log_new as t1','cond'=>'t1.updatetime = LI.updatetime AND t1.lampid = LI.lampid','type'=>'inner')
|
|
|
-// );
|
|
|
-// $sql = "select day_gener_energy,month_gener_energy,used_energy_total from lamp_info_log_new a where a.lampid in (".implode(',', $lampId).")";
|
|
|
-// $lampInfoLogList = $this->db->query($sql)->result_array();
|
|
|
-// foreach ($lampInfoLogList as $lampLog) {
|
|
|
-// $data['dayCom'] += $lampLog['day_gener_energy'];
|
|
|
-// $data['monthCom'] += $lampLog['month_gener_energy'];
|
|
|
-// $data['totalCom'] += $lampLog['used_energy_total'];
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+
|
|
|
+ // 近期创建数据
|
|
|
+ Date date = new Date(System.currentTimeMillis() - 24 * 3600 * 30 * 1000);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String createTime = simpleDateFormat.format(date);
|
|
|
+ LampPoleCountVO lampPoleCountVO = new LampPoleCountVO();
|
|
|
+ lampPoleCountVO.setCreateTime(createTime);
|
|
|
+ lampPoleCountVO.setSectionList(sectionList);
|
|
|
+ lampPoleInfoVO.setNewCount(lampPoleService.getCountByVO(lampPoleCountVO));
|
|
|
+
|
|
|
+ // 故障数
|
|
|
+ lampPoleCountVO = new LampPoleCountVO();
|
|
|
+ lampPoleCountVO.setSectionList(sectionList);
|
|
|
+ lampPoleInfoVO.setFaultCount(lampPoleService.getAlarmCountByVO(lampPoleCountVO));
|
|
|
+
|
|
|
// $data['dayCom'] = round($data['dayCom'],1);
|
|
|
// $data['monthCom'] = round($data['monthCom'],1);
|
|
|
// $data['totalCom'] = round($data['totalCom'],1);
|
|
@@ -884,6 +867,143 @@ public class NewLampPoleController {
|
|
|
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleInfoVO);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 摄像头随机预览
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/videoList",method = RequestMethod.POST)
|
|
|
+ public BaseResult videoList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ List sectionList = toolUtils.getSectionList(request);
|
|
|
+ VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
|
|
|
+ videoMonitorVO.setVersion(version);
|
|
|
+ videoMonitorVO.setSectionList(sectionList);
|
|
|
+ videoMonitorVO.setNetStatus(1);
|
|
|
+ List<VideoMonitorDTO> lampPoleListByVO = videoMonitorService.getLampPoleListByVO(videoMonitorVO);
|
|
|
+ List<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
|
|
|
+ if (lampPoleListByVO.size() > 4){
|
|
|
+ Random random = new Random();
|
|
|
+ int i = random.nextInt(lampPoleListByVO.size());
|
|
|
+ VideoMonitorDTO remove = lampPoleListByVO.remove(i);
|
|
|
+ videoMonitorDTOS.add(remove);
|
|
|
+
|
|
|
+ i = random.nextInt(lampPoleListByVO.size());
|
|
|
+ remove = lampPoleListByVO.remove(i);
|
|
|
+ videoMonitorDTOS.add(remove);
|
|
|
+
|
|
|
+ i = random.nextInt(lampPoleListByVO.size());
|
|
|
+ remove = lampPoleListByVO.remove(i);
|
|
|
+ videoMonitorDTOS.add(remove);
|
|
|
+
|
|
|
+ i = random.nextInt(lampPoleListByVO.size());
|
|
|
+ remove = lampPoleListByVO.remove(i);
|
|
|
+ videoMonitorDTOS.add(remove);
|
|
|
+ }else {
|
|
|
+ videoMonitorDTOS = lampPoleListByVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<VideoMonitorDTO> list = new ArrayList<>();
|
|
|
+
|
|
|
+ for (VideoMonitorDTO v : videoMonitorDTOS) {
|
|
|
+ if (v.getCity() != null){
|
|
|
+ v.setName(v.getCity()+" "+v.getArea()+" "+v.getSection()+" "+v.getName());
|
|
|
+ }else {
|
|
|
+ v.setName(v.getArea()+" "+v.getSection()+" "+v.getName());
|
|
|
+ }
|
|
|
+ String path = "/upload/videoImage/"+v.getGbAddress()+".png";
|
|
|
+ File file = new File(".."+path);
|
|
|
+ if (file.exists()){
|
|
|
+ v.setImage(path);
|
|
|
+ }else {
|
|
|
+ v.setImage("");
|
|
|
+ }
|
|
|
+ list.add(v);
|
|
|
+ }
|
|
|
+
|
|
|
+ ListResponseVO listResponseVO = new ListResponseVO();
|
|
|
+ listResponseVO.setList(list);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SectionService sectionService;
|
|
|
+ /**
|
|
|
+ * 区域概览列表
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/areaList",method = RequestMethod.POST)
|
|
|
+ public BaseResult areaList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer type = (Integer) toolUtils.getRequestContent(request,"type",1);
|
|
|
+ Integer mode = (Integer) toolUtils.getRequestContent(request,"mode",1);
|
|
|
+ List sectionList1 = toolUtils.getSectionList(request);
|
|
|
+ SectionVO sectionVO = new SectionVO();
|
|
|
+ sectionVO.setSectionList(sectionList1);
|
|
|
+ sectionVO.setVersion(version);
|
|
|
+ HashMap<Integer, LampPoleInfoVO> integerObjectHashMap = new HashMap<>();
|
|
|
+
|
|
|
+ if (mode == 0){ // 区域
|
|
|
+ List<SectionDTO> listByIdList = sectionService.getListByVO(sectionVO);
|
|
|
+ for (SectionDTO s :listByIdList) {
|
|
|
+ LampPoleInfoVO lampPoleInfoVO = new LampPoleInfoVO();
|
|
|
+ lampPoleInfoVO.setAreaId(s.getPid());
|
|
|
+ lampPoleInfoVO.setName(s.getArea());
|
|
|
+ lampPoleInfoVO.setDeviceCount(0);
|
|
|
+ lampPoleInfoVO.setNewCount(0);
|
|
|
+ lampPoleInfoVO.setDisableCount(0);
|
|
|
+ lampPoleInfoVO.setLampCount(0);
|
|
|
+ lampPoleInfoVO.setVideoCount(0);
|
|
|
+ lampPoleInfoVO.setWeatherCount(0);
|
|
|
+ lampPoleInfoVO.setWifiCount(0);
|
|
|
+ lampPoleInfoVO.setScreenCount(0);
|
|
|
+ lampPoleInfoVO.setLoopCount(0);
|
|
|
+ lampPoleInfoVO.setRadioCount(0);
|
|
|
+ lampPoleInfoVO.setEmCount(0);
|
|
|
+ lampPoleInfoVO.setChargeCount(0);
|
|
|
+ if (!integerObjectHashMap.containsKey(s.getPid())) integerObjectHashMap.put(s.getPid(),lampPoleInfoVO);
|
|
|
+ }
|
|
|
+ }else { // 公司
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ LampListResponseVO lampListResponseVO = new LampListResponseVO();
|
|
|
+ lampListResponseVO.setSectionList(sectionList1);
|
|
|
+ List<LampInfoDTO> listByVO = lampService.areaInfoLampList(lampListResponseVO);
|
|
|
+ for (LampInfoDTO l :listByVO) {
|
|
|
+ Integer id;
|
|
|
+ if (mode == 0){
|
|
|
+ id = l.getAreaId();
|
|
|
+ }else {
|
|
|
+ id = l.getCompanyId();
|
|
|
+ }
|
|
|
+ if (integerObjectHashMap.containsKey(id)){
|
|
|
+ LampPoleInfoVO lampPoleInfoVO = integerObjectHashMap.get(id);
|
|
|
+ lampPoleInfoVO.setLampCount(lampPoleInfoVO.getLampCount()+1);
|
|
|
+ integerObjectHashMap.put(id,lampPoleInfoVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// List sectionList = toolUtils.getSectionList(request);
|
|
|
+// VideoMonitorVO videoMonitorVO = new VideoMonitorVO();
|
|
|
+// videoMonitorVO.setVersion(version);
|
|
|
+// videoMonitorVO.setSectionList(sectionList);
|
|
|
+// videoMonitorVO.setNetStatus(1);
|
|
|
+// List<VideoMonitorDTO> lampPoleListByVO = videoMonitorService.getLampPoleListByVO(videoMonitorVO);
|
|
|
+// List<VideoMonitorDTO> videoMonitorDTOS = new ArrayList<>();
|
|
|
+
|
|
|
+ ArrayList<LampPoleInfoVO> lampPoleInfoVOS = new ArrayList<>();
|
|
|
+ Set<Integer> integers = integerObjectHashMap.keySet();
|
|
|
+ for (Integer i :integers) {
|
|
|
+ lampPoleInfoVOS.add(integerObjectHashMap.get(i));
|
|
|
+ }
|
|
|
+ ListResponseVO listResponseVO = new ListResponseVO();
|
|
|
+ listResponseVO.setList(lampPoleInfoVOS);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,listResponseVO);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 云盒气象站RS485设备信息列表
|
|
@@ -1164,6 +1284,137 @@ public class NewLampPoleController {
|
|
|
lampPoleVO1.setFaultCount(lampPoleAlarmTotal);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleVO1);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 设置云盒电源
|
|
|
+ * @param request sectionList
|
|
|
+ * @return 获取故障数
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/setWifiOutInfo", method = RequestMethod.POST)
|
|
|
+// public BaseResult<?> setWifiOutInfo(HttpServletRequest request) {
|
|
|
+ public BaseResult<?> setWifiOutInfo(WifiDTO wifiDTO) {
|
|
|
+ Integer version = Integer.valueOf(wifiDTO.getVersion());
|
|
|
+ WifiDTO wifiDTO1 = new WifiDTO();
|
|
|
+ wifiDTO1.setId(wifiDTO1.getId());
|
|
|
+ WifiDTO detailByDTO = wifiService.getDetailByDTO(wifiDTO1);
|
|
|
+ Integer sectionId = detailByDTO.getSectionId();
|
|
|
+ SectionDTO oneById = sectionService.getOneById(sectionId);
|
|
|
+ Integer timezone = oneById.getTimezone();
|
|
|
+ String cmdInfo = "{";
|
|
|
+ if (wifiDTO.getType1() == null || wifiDTO.getType1() == 0){
|
|
|
+ if (wifiDTO.getAC1() == null || wifiDTO.getAC1() == 0){
|
|
|
+ cmdInfo += "\"D5\":\"0000000000\",";
|
|
|
+ }else {
|
|
|
+ cmdInfo += "\"D5\":\"0001000000\",";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime1(), timezone);
|
|
|
+ String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime1(), timezone);
|
|
|
+ cmdInfo += "\"D5\":01\""+dateFormat+dateFormat2+"\",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wifiDTO.getType2() == null || wifiDTO.getType2() == 0){
|
|
|
+ if (wifiDTO.getAC2() == null || wifiDTO.getAC2() == 0){
|
|
|
+ cmdInfo += "\"D6\":\"0000000000\",";
|
|
|
+ }else {
|
|
|
+ cmdInfo += "\"D6\":\"0001000000\",";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime2(), timezone);
|
|
|
+ String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime2(), timezone);
|
|
|
+ cmdInfo += "\"D6\":01\""+dateFormat+dateFormat2+"\",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wifiDTO.getType3() == null || wifiDTO.getType3() == 0){
|
|
|
+ if (wifiDTO.getAC3() == null || wifiDTO.getAC3() == 0){
|
|
|
+ cmdInfo += "\"D7\":\"0000000000\",";
|
|
|
+ }else {
|
|
|
+ cmdInfo += "\"D7\":\"0001000000\",";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime3(), timezone);
|
|
|
+ String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime3(), timezone);
|
|
|
+ cmdInfo += "\"D7\":01\""+dateFormat+dateFormat2+"\",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wifiDTO.getType4() == null || wifiDTO.getType4() == 0){
|
|
|
+ if (wifiDTO.getLna1Status() == null || wifiDTO.getLna1Status() == 0){
|
|
|
+ cmdInfo += "\"D8\":\"0000000000\",";
|
|
|
+ }else {
|
|
|
+ cmdInfo += "\"D8\":\"0001000000\",";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime4(), timezone);
|
|
|
+ String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime4(), timezone);
|
|
|
+ cmdInfo += "\"D8\":01\""+dateFormat+dateFormat2+"\",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wifiDTO.getType5() == null || wifiDTO.getType5() == 0){
|
|
|
+ if (wifiDTO.getLna2Status() == null || wifiDTO.getLna2Status() == 0){
|
|
|
+ cmdInfo += "\"D9\":\"0000000000\",";
|
|
|
+ }else {
|
|
|
+ cmdInfo += "\"D9\":\"0001000000\",";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime5(), timezone);
|
|
|
+ String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime5(), timezone);
|
|
|
+ cmdInfo += "\"D9\":01\""+dateFormat+dateFormat2+"\",";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wifiDTO.getType6() == null || wifiDTO.getType6() == 0){
|
|
|
+ if (wifiDTO.getLna3Status() == null || wifiDTO.getLna3Status() == 0){
|
|
|
+ cmdInfo += "\"DA\":\"0000000000\",";
|
|
|
+ }else {
|
|
|
+ cmdInfo += "\"DA\":\"0001000000\",";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ String dateFormat = WebUtils.getDateFormat(wifiDTO.getCloseTime6(), timezone);
|
|
|
+ String dateFormat2 = WebUtils.getDateFormat(wifiDTO.getOpenTime6(), timezone);
|
|
|
+ cmdInfo += "\"DA\":01\""+dateFormat+dateFormat2+"\",";
|
|
|
+ }
|
|
|
+ cmdInfo += "}";
|
|
|
+
|
|
|
+ cmdInfo = "01"+cmdInfo;
|
|
|
+ String sendTopic = "/WEGW3/WriteIn/"+detailByDTO.getNum();
|
|
|
+ String resTopic = "/WEGW3/WriteOut/"+detailByDTO.getNum();
|
|
|
+ String resCmd = toolUtils.sendMqttCmd(sendTopic,cmdInfo,resTopic);
|
|
|
+ if (resCmd == null || resCmd.length() == 0) return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
|
|
|
+ wifiService.update(wifiDTO);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置DO状态
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/setWifiDo", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> setWifiDo(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request, "version", 1);
|
|
|
+ Integer id = (Integer) toolUtils.getRequestContent(request, "id", 0);
|
|
|
+ Integer type = (Integer) toolUtils.getRequestContent(request, "type", 0);
|
|
|
+ Integer status = (Integer) toolUtils.getRequestContent(request, "status", 0);
|
|
|
+ if (id == 0) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
|
|
|
+ WifiDTO wifiDTO = new WifiDTO();
|
|
|
+ wifiDTO.setId(id);
|
|
|
+ WifiDTO detailByDTO = wifiService.getDetailByDTO(wifiDTO);
|
|
|
+ String sendTopic = "/WEGW3/WriteIn/"+detailByDTO.getNum();
|
|
|
+ String resTopic = "/WEGW3/WriteOut/"+detailByDTO.getNum();
|
|
|
+ String cmdInfo;
|
|
|
+ if (status == 0){
|
|
|
+ cmdInfo = "01{" + "\"DO0\":" + "\"0000\"}";
|
|
|
+ }else {
|
|
|
+ cmdInfo = "01{" + "\"DO0\":" + "\"0001\"}";
|
|
|
+ }
|
|
|
+
|
|
|
+ String resCmd = toolUtils.sendMqttCmd(sendTopic,cmdInfo,resTopic);
|
|
|
+ if (resCmd == null || resCmd.length() == 0) return toolUtils.response(InterfaceResultEnum.SEND_CMD_TIME_OUT,version);
|
|
|
+// LampPoleVO lampPoleVO = new LampPoleVO();
|
|
|
+// lampPoleVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+// Integer lampPoleAlarmTotal = lampPoleService.getLampPoleAlarmTotal(lampPoleVO);
|
|
|
+// LampPoleVO lampPoleVO1 = new LampPoleVO();
|
|
|
+// lampPoleVO1.setFaultCount(lampPoleAlarmTotal);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 云盒sn批量授权接口
|