|
@@ -1,6 +1,9 @@
|
|
|
package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.common.constant.CommonStatus;
|
|
@@ -15,6 +18,7 @@ import com.fdkankan.scene.mapper.ISurveillanceMapper;
|
|
|
import com.fdkankan.scene.service.ISceneEditInfoExtService;
|
|
|
import com.fdkankan.scene.service.IScenePlusService;
|
|
|
import com.fdkankan.scene.service.ISurveillanceService;
|
|
|
+import com.fdkankan.scene.vo.BaseSidParamVO;
|
|
|
import com.fdkankan.scene.vo.SurveillanceParamVO;
|
|
|
import com.fdkankan.scene.vo.BaseIdParamVO;
|
|
|
import java.util.List;
|
|
@@ -48,10 +52,11 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
|
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
|
|
|
|
|
|
Surveillance surveillance = null;
|
|
|
- if(Objects.nonNull(param.getId())){
|
|
|
- surveillance = this.getById(param.getId());
|
|
|
+ if(StrUtil.isNotEmpty(param.getSid())){
|
|
|
+ surveillance = this.getBySid(param.getSid());
|
|
|
}else{
|
|
|
surveillance = new Surveillance();
|
|
|
+ surveillance.setSid(param.getData().getString("sid"));
|
|
|
}
|
|
|
surveillance.setNum(param.getNum());
|
|
|
surveillance.setName(param.getName());
|
|
@@ -66,13 +71,15 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResultData deleteSurveillance(BaseIdParamVO param) {
|
|
|
+ public ResultData deleteSurveillance(BaseSidParamVO param) {
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
|
|
|
if(Objects.isNull(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
SceneEditInfoExt sceneEditInfoExt = sceneEditInfoExtService.getByScenePlusId(scenePlus.getId());
|
|
|
- this.removeById(param.getId());
|
|
|
+
|
|
|
+ this.remove(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getSid, param.getSid()));
|
|
|
+
|
|
|
long count = this.count(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getNum, param.getNum()));
|
|
|
if(count < 1){
|
|
|
sceneEditInfoExt.setSurveillances(CommonStatus.NO.code().intValue());
|
|
@@ -86,4 +93,10 @@ public class SurveillanceServiceImpl extends ServiceImpl<ISurveillanceMapper, Su
|
|
|
List<Surveillance> list = this.list(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getNum, num));
|
|
|
return BeanUtil.copyToList(list, SurveillanceBean.class);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Surveillance getBySid(String sid) {
|
|
|
+ return this.getOne(new LambdaQueryWrapper<Surveillance>().eq(Surveillance::getSid, sid));
|
|
|
+ }
|
|
|
+
|
|
|
}
|