|
@@ -6,6 +6,8 @@ import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
import com.welampiot.vo.*;
|
|
|
+import org.json.JSONArray;
|
|
|
+import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
@@ -50,6 +52,16 @@ public class LampPoleController {
|
|
|
private ChargeService chargeService;
|
|
|
@Autowired
|
|
|
private EnvmonitorService envmonitorService;
|
|
|
+ @Autowired
|
|
|
+ private VideoMonitorService videoMonitorService;
|
|
|
+ @Autowired
|
|
|
+ private BroadcastService broadcastService;
|
|
|
+ @Autowired
|
|
|
+ private CableService cableService;
|
|
|
+ @Autowired
|
|
|
+ private BenchDevInfoService benchDevInfoService;
|
|
|
+ @Autowired
|
|
|
+ private WeatherRS485DevInfoService weatherRS485DevInfoService;
|
|
|
|
|
|
/**
|
|
|
* 获取屏幕详情
|
|
@@ -226,4 +238,477 @@ public class LampPoleController {
|
|
|
}
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampPoleDataVO);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取灯杆下灯控列表
|
|
|
+ * @param request 灯杆id
|
|
|
+ * @return 灯杆下灯控列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/lampList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> lampList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer id = (Integer) toolUtils.getRequestContent(request,"id",1);
|
|
|
+ if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ List<LampInfoDTO> lampList = lampService.getLampListByLampPoleId(id);
|
|
|
+ LampInfoVO lampInfoVO = new LampInfoVO();
|
|
|
+ lampInfoVO.setList(lampList);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除灯杆组件设备
|
|
|
+ * @param request 设备id,设备类型
|
|
|
+ * @return 删除灯杆组件设备
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/delLampPoleDev", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> delLampPoleDev(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ String devId = (String) toolUtils.getRequestContent(request,"devId",2);
|
|
|
+ Integer type = (Integer) toolUtils.getRequestContent(request,"type",1);
|
|
|
+ if (devId.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ String[] split = devId.split(",");
|
|
|
+ if (type == 0) { // 路灯
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = lampService.getLampPoleIdByLampId(id);
|
|
|
+ lampService.deleteById(id);
|
|
|
+ Integer lampCount = lampService.getLampCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,0,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 1) { // 摄像头
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = videoMonitorService.getLampPoleIdByVideoMonitorId(id);
|
|
|
+ videoMonitorService.deleteVideoMonitorById(id);
|
|
|
+ Integer lampCount = videoMonitorService.getVideoCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,1,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 4) { // LED屏
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = screenService.getLampPoleIdByScreenId(id);
|
|
|
+ screenService.deleteScreenById(id);
|
|
|
+ Integer lampCount = screenService.getScreenCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,4,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 5) { // 一键报警
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = emergencyService.getLampPoleIdByEmergencyId(id);
|
|
|
+ emergencyService.deleteEmergencyById(id);
|
|
|
+ Integer lampCount = emergencyService.getEmergencyCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,5,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 6) { // 充电桩
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = chargeService.getLampPoleIdByChargeId(id);
|
|
|
+ chargeService.deleteChargeById(id);
|
|
|
+ Integer lampCount = chargeService.getChargeCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,6,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 7) { // 气象站
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = envmonitorService.getLampPoleIdByEnvmonitorId(id);
|
|
|
+ envmonitorService.deleteEnvmonitorById(id);
|
|
|
+ Integer lampCount = envmonitorService.getEnvmonitorCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,7,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 9) { // 广播音柱
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ BroadcastDTO dto = broadcastService.getBroadcastById(id);
|
|
|
+ broadcastService.deleteBroadcastById(id);
|
|
|
+ Integer lampCount = broadcastService.getBroadcastCountByLampPoleId(dto.getLampPoleId());
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto1 = lampPoleService.getLampPoleDTOById(dto.getLampPoleId());
|
|
|
+ String devType = dto1.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,9,dto.getLampPoleId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 11) { // 电缆
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ CableDTO cableDTO = cableService.getCableById(id);
|
|
|
+ cableService.deleteCableById(id);
|
|
|
+ Integer lampCount = cableService.getCableCountByLampPoleId(cableDTO.getLampPoleId());
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(cableDTO.getLampPoleId());
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,11,cableDTO.getLampPoleId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type == 12) { // 太阳能板凳
|
|
|
+ for (String s : split) {
|
|
|
+ Integer id = Integer.valueOf(s);
|
|
|
+ Integer lampPoleId = benchDevInfoService.getLampPoleIdByBenchId(id);
|
|
|
+ benchDevInfoService.deleteBenchById(id);
|
|
|
+ Integer lampCount = benchDevInfoService.getBenchCountByLampPoleId(lampPoleId);
|
|
|
+ if (lampCount == 0) {
|
|
|
+ LampPoleDTO dto = lampPoleService.getLampPoleDTOById(lampPoleId);
|
|
|
+ String devType = dto.getDevType();
|
|
|
+ toolUtils.updateLampPoleDevType(devType,12,lampPoleId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑灯杆组件
|
|
|
+ * @param request 设备id,设备类型
|
|
|
+ * @return 编辑灯杆组件
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/updateLampPoleDev", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> updateLampPoleDev(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer devId = (Integer) toolUtils.getRequestContent(request,"devId",1);
|
|
|
+ Integer lampPoleId = (Integer) toolUtils.getRequestContent(request,"lampPoleId",1);
|
|
|
+ Integer type = (Integer) toolUtils.getRequestContent(request,"type",1);
|
|
|
+ if (lampPoleId == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ String installDate = (String) toolUtils.getRequestContent(request,"installDate",2);
|
|
|
+ String expirationDate = (String) toolUtils.getRequestContent(request,"expirationDate",2);
|
|
|
+ if (type == 4) { // LED屏
|
|
|
+ String model = (String) toolUtils.getRequestContent(request,"model",2);
|
|
|
+ String num = (String) toolUtils.getRequestContent(request,"num",2);
|
|
|
+ String resole = (String) toolUtils.getRequestContent(request,"resole",2);
|
|
|
+ Integer role = (Integer) toolUtils.getRequestContent(request,"role",1);
|
|
|
+ Integer powerModel = (Integer) toolUtils.getRequestContent(request,"powerModel",1);
|
|
|
+ Integer comModel = (Integer) toolUtils.getRequestContent(request,"comModel",1);
|
|
|
+ Integer maxLight = (Integer) toolUtils.getRequestContent(request,"maxLight",1);
|
|
|
+ Integer width = (Integer) toolUtils.getRequestContent(request,"width",1);
|
|
|
+ Integer height = (Integer) toolUtils.getRequestContent(request,"height",1);
|
|
|
+ if (model.length() == 0 || num.length() == 0 || resole.length() == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ if (width == 0 || height == 0 || maxLight == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ ScreenDTO screenDTO = new ScreenDTO();
|
|
|
+ screenDTO.setInstallDate(installDate);
|
|
|
+ screenDTO.setExpirationDate(expirationDate);
|
|
|
+ screenDTO.setModel(model);
|
|
|
+ screenDTO.setNum(num);
|
|
|
+ screenDTO.setResolve(resole);
|
|
|
+ screenDTO.setRole(role);
|
|
|
+ screenDTO.setPowerModel(powerModel);
|
|
|
+ screenDTO.setComModel(comModel);
|
|
|
+ screenDTO.setMaxLight(maxLight);
|
|
|
+ screenDTO.setWidth(width);
|
|
|
+ screenDTO.setHeight(height);
|
|
|
+ if (devId == 0) {
|
|
|
+ screenDTO.setLampPoleId(lampPoleId);
|
|
|
+ ScreenDTO dto = new ScreenDTO();
|
|
|
+ dto.setNum(num);
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ if (screenService.checkScreenData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.SCREEN_NUM_UNIQUE_ERROR,version);
|
|
|
+ screenService.updateLampPoleScreenData(screenDTO);
|
|
|
+ } else {
|
|
|
+ screenDTO.setId(devId);
|
|
|
+ ScreenDTO dto = new ScreenDTO();
|
|
|
+ dto.setNum(num);
|
|
|
+ dto.setId(devId);
|
|
|
+ if (screenService.checkScreenData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.SCREEN_NUM_UNIQUE_ERROR,version);
|
|
|
+ screenService.updateLampPoleScreenData(screenDTO);
|
|
|
+ }
|
|
|
+ } else if (type == 5) { // 一键报警
|
|
|
+ Integer devType = (Integer) toolUtils.getRequestContent(request,"devType",1);
|
|
|
+ String model = (String) toolUtils.getRequestContent(request,"model",2);
|
|
|
+ String num = (String) toolUtils.getRequestContent(request,"num",2);
|
|
|
+ String remarks = (String) toolUtils.getRequestContent(request,"remarks",2);
|
|
|
+ if (model.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ if (devType != 2) {
|
|
|
+ if (num.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ }
|
|
|
+ EmergencyDTO emergencyDTO = new EmergencyDTO();
|
|
|
+ emergencyDTO.setDevType(devType);
|
|
|
+ emergencyDTO.setModel(model);
|
|
|
+ emergencyDTO.setNum(num);
|
|
|
+ emergencyDTO.setRemarks(remarks);
|
|
|
+ emergencyDTO.setExpirationDate(expirationDate);
|
|
|
+ emergencyDTO.setInstallDate(installDate);
|
|
|
+ if (devId == 0) {
|
|
|
+ emergencyDTO.setLampPoleId(lampPoleId);
|
|
|
+ EmergencyDTO dto = new EmergencyDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ EmergencyDTO emergency = emergencyService.getEmergencyByLampPoleId(lampPoleId);
|
|
|
+ dto.setSectionId(emergency.getSectionId());
|
|
|
+ dto.setModel(model);
|
|
|
+ if (emergencyService.checkEmergencyData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.EMERGENCY_MODEL_UNIQUE_ERROR,version);
|
|
|
+ if (devType != 2) {
|
|
|
+ dto = new EmergencyDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setNum(num);
|
|
|
+ if (emergencyService.checkEmergencyData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.EMERGENCY_NUM_UNIQUE_ERROR,version);
|
|
|
+ }
|
|
|
+ emergencyService.updateLampPoleEmergencyData(emergencyDTO);
|
|
|
+ } else {
|
|
|
+ emergencyDTO.setDevId(devId);
|
|
|
+ EmergencyDTO dto = new EmergencyDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ Integer sectionId = emergencyService.getEmergencySectionIdByLampPoleId(devId);
|
|
|
+ dto.setSectionId(sectionId);
|
|
|
+ dto.setModel(model);
|
|
|
+ if (emergencyService.checkEmergencyData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.EMERGENCY_MODEL_UNIQUE_ERROR,version);
|
|
|
+ if (devType != 2) {
|
|
|
+ dto = new EmergencyDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setNum(num);
|
|
|
+ if (emergencyService.checkEmergencyData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.EMERGENCY_NUM_UNIQUE_ERROR,version);
|
|
|
+ }
|
|
|
+ emergencyService.updateLampPoleEmergencyData(emergencyDTO);
|
|
|
+ }
|
|
|
+ } else if (type == 6) { // 充电桩
|
|
|
+ Integer model = (Integer) toolUtils.getRequestContent(request,"model",1);
|
|
|
+ Integer power = (Integer) toolUtils.getRequestContent(request,"power",1);
|
|
|
+ Integer chargeModel = (Integer) toolUtils.getRequestContent(request,"chargeModel",1);
|
|
|
+ String num = (String) toolUtils.getRequestContent(request,"num",2);
|
|
|
+ if (num.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ ChargeDTO chargeDTO = new ChargeDTO();
|
|
|
+ chargeDTO.setModel(model);
|
|
|
+ chargeDTO.setNum(num);
|
|
|
+ chargeDTO.setPower(power);
|
|
|
+ chargeDTO.setChargeModel(chargeModel);
|
|
|
+ chargeDTO.setExpirationDate(expirationDate);
|
|
|
+ chargeDTO.setInstallDate(installDate);
|
|
|
+ if (devId == 0) {
|
|
|
+ chargeDTO.setLampPoleId(lampPoleId);
|
|
|
+ ChargeDTO dto = new ChargeDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setNum(num);
|
|
|
+ if (chargeService.checkChargeData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CHARGE_NUM_UNIQUE_ERROR,version);
|
|
|
+ chargeService.updateLampPoleChargeData(chargeDTO);
|
|
|
+ } else {
|
|
|
+ chargeDTO.setId(devId);
|
|
|
+ ChargeDTO dto = new ChargeDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ dto.setNum(num);
|
|
|
+ if (chargeService.checkChargeData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CHARGE_NUM_UNIQUE_ERROR,version);
|
|
|
+ chargeService.updateLampPoleChargeData(chargeDTO);
|
|
|
+ }
|
|
|
+ } else if (type == 7) { // 气象站
|
|
|
+ Integer devType = (Integer) toolUtils.getRequestContent(request,"devType",1);
|
|
|
+ Integer pramType = (Integer) toolUtils.getRequestContent(request,"pramType",1);
|
|
|
+ Integer rate = (Integer) toolUtils.getRequestContent(request,"rate",1);
|
|
|
+ Integer netType = (Integer) toolUtils.getRequestContent(request,"netType",1);
|
|
|
+ Integer mp = (Integer) toolUtils.getRequestContent(request,"mp",1);
|
|
|
+ String model = (String) toolUtils.getRequestContent(request,"model",2);
|
|
|
+ String address = (String) toolUtils.getRequestContent(request,"address",2);
|
|
|
+ String devList = (String) toolUtils.getRequestContent(request,"devList",2);
|
|
|
+ if (address.length() == 0 || model.length() == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ if (devType == 9) {
|
|
|
+ if (mp == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ }
|
|
|
+ if (netType == 1) {
|
|
|
+ if (devList.length() == 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ JSONArray jsonArray = new JSONArray(devList);
|
|
|
+ for (int i = 0; i < jsonArray.length();i ++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ int address1 = jsonObject.getInt("address");
|
|
|
+ int devId1 = jsonObject.getInt("devId");
|
|
|
+ WeatherRS485DevInfoDTO weatherRS485DevInfoDTO = new WeatherRS485DevInfoDTO();
|
|
|
+ weatherRS485DevInfoDTO.setAddress(address1);
|
|
|
+ weatherRS485DevInfoDTO.setDevId(devId1);
|
|
|
+ weatherRS485DevInfoService.addWeatherRS485DevInfoData(weatherRS485DevInfoDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EnvmonitorDTO envmonitorDTO = new EnvmonitorDTO();
|
|
|
+ envmonitorDTO.setDevType(devType);
|
|
|
+ envmonitorDTO.setPramType(pramType);
|
|
|
+ envmonitorDTO.setRate(rate);
|
|
|
+ envmonitorDTO.setNetType(netType);
|
|
|
+ envmonitorDTO.setMp(mp);
|
|
|
+ envmonitorDTO.setModel(model);
|
|
|
+ envmonitorDTO.setAddress(address);
|
|
|
+ envmonitorDTO.setExpirationDate(expirationDate);
|
|
|
+ envmonitorDTO.setInstallDate(installDate);
|
|
|
+ if (devId == 0) {
|
|
|
+ envmonitorDTO.setLampPoleId(lampPoleId);
|
|
|
+ EnvmonitorDTO envmonitor = envmonitorService.getEnvmonitorByLampPoleId(lampPoleId);
|
|
|
+ Integer sectionId = envmonitor.getSectionId();
|
|
|
+ EnvmonitorDTO dto = new EnvmonitorDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setModel(model);
|
|
|
+ dto.setSectionId(sectionId);
|
|
|
+ if (envmonitorService.checkEnvmonitorData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.ENVMONITOR_NAME_UNIQUE_ERROR,version);
|
|
|
+ envmonitorService.updateLampPoleEnvmonitorData(envmonitorDTO);
|
|
|
+ } else {
|
|
|
+ envmonitorDTO.setId(devId);
|
|
|
+ EnvmonitorDTO envmonitor = envmonitorService.getEnvmonitorByLampPoleId(lampPoleId);
|
|
|
+ Integer sectionId = envmonitor.getSectionId();
|
|
|
+ EnvmonitorDTO dto = new EnvmonitorDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ dto.setModel(model);
|
|
|
+ dto.setSectionId(sectionId);
|
|
|
+ if (envmonitorService.checkEnvmonitorData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.ENVMONITOR_NAME_UNIQUE_ERROR,version);
|
|
|
+ envmonitorService.updateLampPoleEnvmonitorData(envmonitorDTO);
|
|
|
+ }
|
|
|
+ } else if (type == 9) { // 广播音柱
|
|
|
+ Integer devType = (Integer) toolUtils.getRequestContent(request,"devType",1);
|
|
|
+ String address = (String) toolUtils.getRequestContent(request,"address",2);
|
|
|
+ String name = (String) toolUtils.getRequestContent(request,"name",2);
|
|
|
+ if (name.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ if (devType == 0) {
|
|
|
+ if (address.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ }
|
|
|
+ BroadcastDTO broadcastDTO = new BroadcastDTO();
|
|
|
+ broadcastDTO.setType(devType);
|
|
|
+ broadcastDTO.setAddress(address);
|
|
|
+ broadcastDTO.setName(name);
|
|
|
+ broadcastDTO.setExpirationDate(expirationDate);
|
|
|
+ broadcastDTO.setInstallDate(installDate);
|
|
|
+ if (devId == 0) {
|
|
|
+ broadcastDTO.setLampPoleId(lampPoleId);
|
|
|
+ BroadcastDTO dto = new BroadcastDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ BroadcastDTO broadcast = broadcastService.getBroadcastDTOByLampPoleId(lampPoleId);
|
|
|
+ dto.setSectionId(broadcast.getSectionId());
|
|
|
+ dto.setName(name);
|
|
|
+ if (broadcastService.checkBroadcastData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.BROADCAST_NAME_UNIQUE_ERROR,version);
|
|
|
+ if (devType == 0) {
|
|
|
+ dto = new BroadcastDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setAddress(address);
|
|
|
+ if (broadcastService.checkBroadcastData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.BROADCAST_ADDRESS_UNIQUE_ERROR,version);
|
|
|
+ }
|
|
|
+ broadcastService.updateLampPoleBroadcastData(broadcastDTO);
|
|
|
+ } else {
|
|
|
+ broadcastDTO.setId(devId);
|
|
|
+ BroadcastDTO dto = new BroadcastDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ BroadcastDTO broadcast = broadcastService.getBroadcastById(devId);
|
|
|
+ dto.setSectionId(broadcast.getSectionId());
|
|
|
+ dto.setName(name);
|
|
|
+ if (broadcastService.checkBroadcastData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.BROADCAST_NAME_UNIQUE_ERROR,version);
|
|
|
+ if (devType == 0) {
|
|
|
+ dto = new BroadcastDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ dto.setAddress(address);
|
|
|
+ if (broadcastService.checkBroadcastData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.BROADCAST_ADDRESS_UNIQUE_ERROR,version);
|
|
|
+ }
|
|
|
+ broadcastService.updateLampPoleBroadcastData(broadcastDTO);
|
|
|
+ }
|
|
|
+ } else if (type == 10) { // 云盒
|
|
|
+ Integer model = (Integer) toolUtils.getRequestContent(request,"model",1);
|
|
|
+ String sn = (String) toolUtils.getRequestContent(request,"sn",2);
|
|
|
+ if (sn.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ String remark1 = (String) toolUtils.getRequestContent(request,"remark1",2);
|
|
|
+ String remark2 = (String) toolUtils.getRequestContent(request,"remark2",2);
|
|
|
+ String remark3 = (String) toolUtils.getRequestContent(request,"remark3",2);
|
|
|
+ String remark4 = (String) toolUtils.getRequestContent(request,"remark4",2);
|
|
|
+ String remark5 = (String) toolUtils.getRequestContent(request,"remark5",2);
|
|
|
+ String remark6 = (String) toolUtils.getRequestContent(request,"remark6",2);
|
|
|
+ WifiDTO wifiDTO = new WifiDTO();
|
|
|
+ wifiDTO.setExpirationDate(expirationDate);
|
|
|
+ wifiDTO.setInstallDate(installDate);
|
|
|
+ wifiDTO.setModel(model);
|
|
|
+ wifiDTO.setSn(sn);
|
|
|
+ wifiDTO.setRemark1(remark1);
|
|
|
+ wifiDTO.setRemark2(remark2);
|
|
|
+ wifiDTO.setRemark3(remark3);
|
|
|
+ wifiDTO.setRemark4(remark4);
|
|
|
+ wifiDTO.setRemark5(remark5);
|
|
|
+ wifiDTO.setRemark6(remark6);
|
|
|
+ if (devId == 0) {
|
|
|
+ wifiDTO.setLampPoleId(lampPoleId);
|
|
|
+ WifiDTO dto = new WifiDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setSn(sn);
|
|
|
+ if (wifiService.checkWifiData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CLOUD_BOX_SN_UNIQUE_ERROR,version);
|
|
|
+ wifiService.updateWifiByLampPoleId(wifiDTO);
|
|
|
+ } else {
|
|
|
+ wifiDTO.setId(devId);
|
|
|
+ WifiDTO dto = new WifiDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ dto.setSn(sn);
|
|
|
+ if (wifiService.checkWifiData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CLOUD_BOX_SN_UNIQUE_ERROR,version);
|
|
|
+ wifiService.updateWifiByLampPoleId(wifiDTO);
|
|
|
+ }
|
|
|
+ } else if (type == 11) { // 电缆
|
|
|
+ Integer devType = (Integer) toolUtils.getRequestContent(request,"devType",1);
|
|
|
+ String address = (String) toolUtils.getRequestContent(request,"address",2);
|
|
|
+ String name = (String) toolUtils.getRequestContent(request,"name",2);
|
|
|
+ if (name.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ if (address.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
|
|
|
+ CableDTO cableDTO = new CableDTO();
|
|
|
+ cableDTO.setType(devType);
|
|
|
+ cableDTO.setAddress(address);
|
|
|
+ cableDTO.setName(name);
|
|
|
+ cableDTO.setExpirationDate(expirationDate);
|
|
|
+ cableDTO.setInstallDate(installDate);
|
|
|
+ if (devId == 0) {
|
|
|
+ cableDTO.setLampPoleId(lampPoleId);
|
|
|
+ CableDTO dto = new CableDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ CableDTO cable = cableService.getCableByLampPoleId(lampPoleId);
|
|
|
+ dto.setSectionId(cable.getSectionId());
|
|
|
+ dto.setName(name);
|
|
|
+ if (cableService.checkCableData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CABLE_NAME_UNIQUE_ERROR,version);
|
|
|
+ dto = new CableDTO();
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ dto.setAddress(address);
|
|
|
+ if (cableService.checkCableData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CABLE_ADDRESS_UNIQUE_ERROR,version);
|
|
|
+ cableService.updateLampPoleCableData(cableDTO);
|
|
|
+ } else {
|
|
|
+ cableDTO.setId(devId);
|
|
|
+ CableDTO dto = new CableDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ CableDTO cable = cableService.getCableByLampPoleId(devId);
|
|
|
+ dto.setSectionId(cable.getSectionId());
|
|
|
+ dto.setName(name);
|
|
|
+ if (cableService.checkCableData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CABLE_NAME_UNIQUE_ERROR,version);
|
|
|
+ dto = new CableDTO();
|
|
|
+ dto.setId(devId);
|
|
|
+ dto.setAddress(address);
|
|
|
+ if (cableService.checkCableData(dto) > 0)
|
|
|
+ return toolUtils.response(InterfaceResultEnum.CABLE_ADDRESS_UNIQUE_ERROR,version);
|
|
|
+ cableService.updateLampPoleCableData(cableDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|