|
@@ -4,6 +4,7 @@ package com.css.simulation.resource.model.ctrl;
|
|
|
import api.common.pojo.common.ResponseBodyVO;
|
|
|
import api.common.pojo.param.model.ConfigPageParam;
|
|
|
import api.common.pojo.po.model.ConfigPO;
|
|
|
+import api.common.pojo.vo.model.ConfigSensorVO;
|
|
|
import api.common.pojo.vo.model.ConfigVO;
|
|
|
import api.common.util.ObjectUtil;
|
|
|
import com.css.simulation.resource.model.service.ConfigService;
|
|
@@ -15,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@Controller
|
|
|
@RequestMapping("/config")
|
|
|
public class ConfigCtrl {
|
|
@@ -54,6 +58,17 @@ public class ConfigCtrl {
|
|
|
if(ObjectUtil.isNull(configVO)){
|
|
|
return new ResponseBodyVO(false, 500, "参数必传!",null);
|
|
|
}
|
|
|
+ //端口重复校验
|
|
|
+ Map<String, List<ConfigSensorVO>> configSensors = configVO.getConfigSensors();
|
|
|
+ if(ObjectUtil.isNotNull(configSensors)){
|
|
|
+ List<ConfigSensorVO> configSensorVOS = configSensors.get("ogt");//完美传感器
|
|
|
+ if(ObjectUtil.isNotNull(configSensorVOS)){
|
|
|
+ long count = configSensorVOS.stream().mapToInt(ConfigSensorVO::getSensorPort).distinct().count();
|
|
|
+ if(configSensorVOS.size() != count){
|
|
|
+ return new ResponseBodyVO(false, 500, "端口重复!",null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ResponseBodyVO<ConfigPO> response = new ResponseBodyVO<ConfigPO>(ResponseBodyVO.Response.SUCCESS);
|
|
|
ConfigPO po = configService.saveConfig(configVO);
|
|
|
if(ObjectUtil.isNull(po.getId())){
|