Commit 13ebde71 by 高晓磊

场站新增不许编辑状态的逻辑

parent b15a9b0b
...@@ -27,4 +27,5 @@ public interface StationDao extends BaseDao { ...@@ -27,4 +27,5 @@ public interface StationDao extends BaseDao {
List<KObject> queryStationByRegionalCompany(UUID uuid); List<KObject> queryStationByRegionalCompany(UUID uuid);
List<KObject> getStationCameraById(UUID id1);
} }
...@@ -194,4 +194,14 @@ public class StationDaoImpl extends AbstractBaseDao implements StationDao, Stat ...@@ -194,4 +194,14 @@ public class StationDaoImpl extends AbstractBaseDao implements StationDao, Stat
}); });
} }
@Override
public List<KObject> getStationCameraById(UUID id1) {
return template.execute(session -> {
Query<KObject> query = session.createQuery(" from com.xyst.dinas.camera.datamodel.CameraInfo where station.id=:id and del=:del", KObject.class);
query.setParameter("id", id1);
query.setParameter("del", false);
return query.getResultList();
});
}
} }
...@@ -86,5 +86,11 @@ public class StationServiceImpl implements StationService { ...@@ -86,5 +86,11 @@ public class StationServiceImpl implements StationService {
return list; return list;
} }
@Override
public List<KObject> getStationCameraById(UUID id1) {
return stationDao.getStationCameraById(id1);
}
} }
...@@ -25,4 +25,6 @@ public interface StationService { ...@@ -25,4 +25,6 @@ public interface StationService {
void deleteById(UUID id); void deleteById(UUID id);
List<KObject> queryStationByRegionalCompany(); List<KObject> queryStationByRegionalCompany();
List<KObject> getStationCameraById(UUID id1);
} }
...@@ -2,6 +2,7 @@ package com.xyst.dinas.biz.web; ...@@ -2,6 +2,7 @@ package com.xyst.dinas.biz.web;
import com.beecode.amino.core.Amino; import com.beecode.amino.core.Amino;
import com.beecode.bap.attachment.common.Page; import com.beecode.bap.attachment.common.Page;
import com.beecode.bap.log.LogConstants;
import com.beecode.bcp.type.KClass; import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject; import com.beecode.bcp.type.KObject;
import com.beecode.bcp.type.json.JSONObjectUtils; import com.beecode.bcp.type.json.JSONObjectUtils;
...@@ -104,9 +105,25 @@ public class StationController { ...@@ -104,9 +105,25 @@ public class StationController {
if(StringUtils.isEmpty(kobject.getString("telephone"))){ if(StringUtils.isEmpty(kobject.getString("telephone"))){
return ResponseObj.error(400,"联系人电话不能为空"); return ResponseObj.error(400,"联系人电话不能为空");
} }
if(kobject.getUuid("id") == null){ UUID id1 = kobject.getUuid("id");
if(id1== null){
return ResponseObj.error(400,"'id' must be not null!"); return ResponseObj.error(400,"'id' must be not null!");
} }
//判断场站状态
if(0==kobject.getInt("stationStatus")){
//查询场站下是否有未禁用的用户
List<KObject> id = warehouseUserService.getAllByStationId(id1);
if(id.size()>0){
return ResponseObj.error(500,"当前场站下有人员账号,请在清空账号后修改场站状态!");
}
//查询场站下是否有未删除的摄像头
List<KObject> cameras= stationService.getStationCameraById(id1);
if(cameras.size()>0){
return ResponseObj.error(500,"当前场站下有摄像头信息,请在清空摄像头信息后修改场站状态!");
}
}
stationService.update(kobject); stationService.update(kobject);
return ResponseObj.success("修改成功"); return ResponseObj.success("修改成功");
} }
...@@ -166,7 +183,7 @@ public class StationController { ...@@ -166,7 +183,7 @@ public class StationController {
/** /**
* 根据当前登录人所在区域公司查询场站 * 根据当前登录人所在区域公司查询场站
* @param id * @param
* @return * @return
*/ */
@GetMapping("/queryStationByRegionalCompany") @GetMapping("/queryStationByRegionalCompany")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment