Commit 088dc82e authored by 单奇雲's avatar 单奇雲

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

parents 2a8b4994 4f95d864
......@@ -77,6 +77,11 @@ public class Node3DVoResponse{
private Boolean showInfo = false;
/**
* 闪烁频率
*/
private Integer frequency = 0;
/**
* 显示图标闪烁
*/
private Boolean twinkle = false;
......@@ -112,19 +117,6 @@ public class Node3DVoResponse{
private String orgCode;
/**
* 闪烁频率每秒
*/
private int rate = 0;
public int getRate() {
return rate;
}
public void setRate(int rate) {
this.rate = rate;
}
public String getId() {
return id;
}
......@@ -159,7 +151,13 @@ public class Node3DVoResponse{
this.type = type;
}
public Integer getFrequency() {
return frequency;
}
public void setFrequency(Integer frequency) {
this.frequency = frequency;
}
public String getLevel() {
return level;
......
......@@ -78,6 +78,12 @@ public class RiskSource extends BasicEntity {
@Lob
private String routePath;
/**
* 闪烁频率
*/
@Column(name = "flicker_frequency")
private Integer flickerFrequency;
private List<Fmea> fmeaList;
private List<RpnChangeLog> rpnChangeLogList;
......@@ -89,6 +95,14 @@ public class RiskSource extends BasicEntity {
return rpni;
}
public Integer getFlickerFrequency() {
return flickerFrequency;
}
public void setFlickerFrequency(Integer flickerFrequency) {
this.flickerFrequency = flickerFrequency;
}
public void setRpni(BigDecimal rpni) {
this.rpni = rpni;
}
......
......@@ -2,12 +2,7 @@ package com.yeejoin.amos.fas.dao.entity;
import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.*;
import java.math.BigDecimal;
......@@ -35,8 +30,22 @@ public class RpnChangeLog extends BasicEntity {
@Column(name = "trigger_by")
private Long triggerBy;
/**
* 触发变化类型(巡检、告警、评价、删除)
*/
@Column(name = "trigger_type")
private String triggerType;
private int type;
public String getTriggerType() {
return triggerType;
}
public void setTriggerType(String triggerType) {
this.triggerType = triggerType;
}
private RiskSource riskSource;
public RpnChangeLog() {
......
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.Node3dVoService;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/node3d")
@Api(tags="3d模型数据")
public class Node3dVoController extends BaseController {
private final Logger log = LoggerFactory.getLogger(Node3dVoController.class);
@Autowired
Node3dVoService node3dVoService;
/**
* 同步新增的3d数据
*
* @param dataType
* @return
*/
@ApiOperation(httpMethod = "POST",value = "同步新增的3d数据", notes = "同步新增的3d数据")
@RequestMapping(value = "/incremental/{dataType}", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse incrementalCreate(@ApiParam(value = "数据类型" ,required = true) @PathVariable String dataType) {
node3dVoService.incrementalCreate(dataType);
return CommonResponseUtil.success("SUCCESS");
}
/**
* 同步已经删除的的3d数据
*
* @return
*/
@ApiOperation(httpMethod = "DELETE",value = "同步已经删除的的3d数据", notes = "同步已经删除的的3d数据")
@RequestMapping(value = "/incremental/{dataType}", produces = "application/json;charset=UTF-8", method = RequestMethod.DELETE)
public CommonResponse incrementalRemove(@ApiParam(value = "数据类型" ,required = true) @PathVariable String dataType) {
node3dVoService.incrementalRemove(dataType);
return CommonResponseUtil.success("SUCCESS");
}
/**
* 同步需要更新的的3d数据
*
* @return
*/
@ApiOperation(httpMethod = "PUT",value = "同步需要更新的的3d数据", notes = "同步需要更新的的3d数据")
@RequestMapping(value = "/incremental/{dataType}", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse incrementalUpdate(@ApiParam(value = "数据类型" ,required = true) @PathVariable String dataType) throws Exception{
node3dVoService.incrementalUpdate(dataType);
return CommonResponseUtil.success("SUCCESS");
}
/**
* 同步指定的数据类型,增加,删除,更新
*
* @return
*/
@ApiOperation(httpMethod = "PUT",value = "同步需要更新的的3d数据", notes = "同步需要更新的的3d数据")
@RequestMapping(value = "/incremental/dataType/{dataType}", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse incrementalDataType(@ApiParam(value = "数据类型" ,required = true) @PathVariable String dataType) throws Exception{
node3dVoService.incrementalDataType(dataType);
return CommonResponseUtil.success("SUCCESS");
}
/**
* 对所有数据类型进行同步,新增,更新,删除
*
* @return
*/
@ApiOperation(httpMethod = "PUT",value = "对所有数据类型进行同步,新增,更新,删除", notes = "对所有数据类型进行同步,新增,更新,删除")
@RequestMapping(value = "/whole/incremental", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse wholeIncremental() throws Exception{
node3dVoService.wholeIncremental();
return CommonResponseUtil.success("SUCCESS");
}
}
......@@ -192,7 +192,7 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(view3dService.getEquipStatusList(orgCode));
}
@ApiOperation(value = "资源显示",notes = "资源显示")
@ApiOperation(value = "3d视图点显示",notes = "3d视图点显示")
@GetMapping(value = "initViewNode")
public CommonResponse initViewNode(String type,Long riskSourceId){
ReginParams reginParams =getSelectedOrgInfo();
......
package com.yeejoin.amos.fas.business.dao.mapper;
import org.apache.ibatis.annotations.Param;
public interface Node3dVoMapper extends BaseMapper {
/**
* 风险点数据同步--新增
*/
Integer incrementalCreateRiskSource(@Param("rsId") Long rsId);
/**
* 风险点数据同步--删除
*/
Integer incrementalDeleteRiskSource(@Param("rsId") Long rsId);
/**
* 风险点数据同步--更新
*/
Integer incrementalUpdateRiskSource(@Param("rsId") Long rsId, @Param("frequency") Integer frequency);
/**
* 消防设备--新增
*/
Integer incrementalCreateFierEqumt(@Param("feId") Long feId);
/**
* 消防设备--删除
*/
Integer incrementalDeleteFierEqumt(@Param("feId") Long feId);
/**
* 消防设备--更新
*/
Integer incrementalUpdateFierEqumt(@Param("feId") Long feId);
/**
* 重点设备--新增
*/
Integer incrementalCreateImpEqumt(@Param("equipId") Long equipId);
/**
* 重点设备--删除
*/
Integer incrementalDeleteImpEqumt(@Param("equipId") Long equipId);
/**
* 重点设备--更新
*/
Integer incrementalUpdateImpEqumt(@Param("equipId") Long equipId);
/**
*消防车--新增
*/
Integer incrementalCreateFireCar(@Param("carId") Long carId);
/**
* 消防车--删除
*/
Integer incrementalDeleteFireCar(@Param("carId") Long carId);
/**
* 消防车--更新
*/
Integer incrementalUpdateFireCar(@Param("carId") Long carId);
/**
*消防室和泡沫间--新增
*/
Integer incrementalCreateStation(@Param("fsId") Long fsId);
/**
* 消防室和泡沫间--删除
*/
Integer incrementalDeleteStation(@Param("fsId") Long fsId);
/**
* 消防室和泡沫间--更新
*/
Integer incrementalUpdateStation(@Param("fsId") Long fsId);
/**
*水资源--新增
*/
Integer incrementalCreateWater(@Param("wrId") Long wrId);
/**
* 消防室和泡沫间--删除
*/
Integer incrementalDeleteWater(@Param("wrId") Long wrId);
/**
* 消防室和泡沫间--更新
*/
Integer incrementalUpdateWater(@Param("wrId") Long wrId);
}
......@@ -5,7 +5,6 @@ import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper;
import com.yeejoin.amos.fas.business.dao.mongo.EquipCommunicationDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
......@@ -18,7 +17,6 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.EquipDetailsResponse;
import com.yeejoin.amos.fas.core.util.DaoCriteria;
import com.yeejoin.amos.fas.core.util.query.BaseQuerySpecification;
import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.FireEquipment;
......@@ -46,12 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
@Service("equipService")
public class EquipmentServiceImpl implements IEquipmentService {
......@@ -79,9 +72,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
ImpAndFireEquipMapper impAndFireEquipMapper;
@Autowired
Node3dVoMapper node3dVoMapper;
@Autowired
private IPreplanPictureDao preplanPictureDao;
@Autowired
......@@ -90,7 +80,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private EquipCommunicationDao equipCommunicationDao;
......@@ -103,11 +92,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
public Equipment save(Equipment equipment) {
Long eqId = equipment.getId();
equipment = iEquipmentDao.saveAndFlush(equipment);
if (eqId == null || eqId == 0) {
node3dVoMapper.incrementalCreateImpEqumt(equipment.getId());
} else {
node3dVoMapper.incrementalUpdateImpEqumt(eqId);
}
return equipment;
}
......@@ -123,21 +107,16 @@ public class EquipmentServiceImpl implements IEquipmentService {
}
@Override
public String[] delete(String[] idArray) throws Exception {
for (String id : idArray) {
Optional<Equipment> equipment1 = iEquipmentDao.findById(Long.parseLong(id));
Equipment equipment=null;
if(equipment1.isPresent()){
equipment=equipment1.get();
}
if (equipment != null) {
this.iEquipmentDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteImpEqumt(Long.parseLong(id));
} else {
throw new Exception("找不到指定的对象:" + id);
}
......@@ -199,26 +178,21 @@ public class EquipmentServiceImpl implements IEquipmentService {
result.put("exits", false);
Equipment equipment = this.iEquipmentDao.getOne(equipmentFireEquipment.getEquipmentId().longValue());
FireEquipment fireEquipment = iFireEquipmentDao.getOne(equipmentFireEquipment.getFireEquipmentId().longValue());
if (equipment == null || fireEquipment == null)
throw new Exception("找不到数据");
this.equipmentFireEquipmentDao.save(equipmentFireEquipment);
//已存在的绑定关系
List<EquipmentFireEquipment> exits = impAndFireEquipMapper.queryForList(String.valueOf(equipmentFireEquipment.getFireEquipmentId()), null);
if (!CollectionUtils.isEmpty(exits))
result.put("exits", true);
result.put("newModel", equipmentFireEquipment);
resultList.add(result);
}
return resultList;
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<Long> removeFireEqmtBind(Long equipmentId, String[] fireEquipmentIds) {
List<Long> ids = new ArrayList<>();
......@@ -243,6 +217,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
* @param equipmentId
* @return
*/
@Override
public Page queryBindFirEqumtList(CommonPageable commonPageable, Long equipmentId) {
long start = -1;
int length = -1;
......@@ -389,68 +364,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
}
return equipment;
}
/*@Override
public Equipment saveEquipmentAndImg(ImgParam imgs, Equipment equipment) {
// TODO Auto-generated method stub
if(imgs==null ){
equipment = save(equipment);
if(equipment.getCreateDate()==null){
equipment.setCreateDate(iEquipmentDao.findOne(equipment.getId()).getCreateDate()==null?new Date():iEquipmentDao.findOne(equipment.getId()).getCreateDate());
}
}else{
MultipartFile file = imgs.getFile();
int type = imgs.getType();
String remark = imgs.getRemark();
equipment = save(equipment);
if(equipment.getCreateDate()==null){
equipment.setCreateDate(iEquipmentDao.findOne(equipment.getId()).getCreateDate()==null?new Date():iEquipmentDao.findOne(equipment.getId()).getCreateDate());
}
Long equipmentId = Long.valueOf(equipment.getId());
PreplanPicture pp = preplanPictureDao.selectOne(equipmentId, type);
if(pp == null){
pp = new PreplanPicture();
pp.setEquipmentId(equipmentId);
pp.setType(type);
pp.setRemark(remark);
pp.setCreateDate(new Date());
}
String path = FasConstant.UPLOAD_ROOT_PATH + File.separator + FasConstant.UPLOAD_EQUIPMENT_PATH + File.separator
+ equipment.getId();
String filePath = getRootPath() + path;
String fileType = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."),
file.getOriginalFilename().length());
String fileName = File.separator + type+fileType;
try {
File dest = new File(filePath + File.separator + fileName);
if (!dest.exists()) {
if (dest.getParentFile() != null && !dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
}
dest.createNewFile();
}
file.transferTo(dest);
} catch (IOException e) {
throw new YeeException("上传图片失败");
}
String picture = path + fileName;
pp.setPicture(picture);
pp.setRemark(remark);
preplanPictureDao.saveAndFlush(pp);
equipment = iEquipmentDao.saveAndFlush(equipment);
}
return equipment;
}*/
@Override
public List<Map<String, Object>> findEquipVideoList() {
......
package com.yeejoin.amos.fas.business.service.impl;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.assertj.core.util.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.FireCarMapper;
import com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper;
import com.yeejoin.amos.fas.business.dao.repository.IFireCarDao;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
......@@ -35,7 +11,19 @@ import com.yeejoin.amos.fas.business.service.intfc.IFireCarService;
import com.yeejoin.amos.fas.business.vo.FireCarDetailVo;
import com.yeejoin.amos.fas.dao.entity.FireCar;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.collections.CollectionUtils;
import org.assertj.core.util.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.*;
@Service("fireCarService")
......@@ -53,19 +41,12 @@ public class FireCarServiceImpl implements IFireCarService {
private String linuxImgPath;
@Autowired
Node3dVoMapper node3dVoMapper;
@Autowired
private RemoteSecurityService remoteSecurityService;
public FireCar save(FireCar fireCar)
{
Long carId = fireCar.getId();
fireCar = iFireCarDao.saveAndFlush(fireCar);
if(carId ==null || carId == 0){
node3dVoMapper.incrementalCreateFireCar(fireCar.getId());
}else{
node3dVoMapper.incrementalUpdateFireCar(carId);
}
iFireCarDao.save(fireCar);
return fireCar;
}
......@@ -85,17 +66,13 @@ public class FireCarServiceImpl implements IFireCarService {
for(String id:idArray)
{
Optional<FireCar> fireCar1 = iFireCarDao.findById(Long.parseLong(id));
FireCar fireCar=null;
if(fireCar1.isPresent()){
fireCar=fireCar1.get();
}
if(fireCar != null)
{
this.iFireCarDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteFireCar(Long.parseLong(id));
}else
{
throw new Exception("找不到指定的对象:"+id);
......@@ -111,42 +88,22 @@ public class FireCarServiceImpl implements IFireCarService {
public Page<HashMap<String, Object>> queryFireCar(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = fireCarMapper.countPageData(param);
List<HashMap<String, Object>> content = fireCarMapper.getFireCarPage(param);
if (!CollectionUtils.isEmpty(content)) {
Set<String> deptIds = Sets.newHashSet(Lists.transform(content, Map->Map.get("dept_id")+""));
deptIds.remove("");
deptIds.remove(null);
Map<String, String> deptMap = new HashMap<String,String>();
if(!CollectionUtils.isEmpty(deptIds)){
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
}
Map<String, String> deptMapNew= deptMap;
content.forEach(e -> {
e.put("departmentName",deptMapNew.get(e.get("dept_id")));
});
}
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total);
return result;
}
......@@ -193,14 +150,8 @@ public class FireCarServiceImpl implements IFireCarService {
}
}
fireCar.setPhotoPath(photoPath);
fireCar = iFireCarDao.saveAndFlush(fireCar);
if(carId ==null || carId == 0){
node3dVoMapper.incrementalCreateFireCar(fireCar.getId());
}else{
node3dVoMapper.incrementalUpdateFireCar(carId);
}
iFireCarDao.save(fireCar);
return fireCar;
}
......
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
......@@ -42,19 +41,9 @@ public class FireEquipServiceImpl implements IFireEquipService {
@Autowired
IFireStationDao iFireStationDao;
@Autowired
Node3dVoMapper node3dVoMapper;
public FireEquipment save(FireEquipment fireEquipment) {
Long id = fireEquipment.getId();
fireEquipment = iFireEquipmentDao.saveAndFlush(fireEquipment);
if(id ==null || id == 0){
node3dVoMapper.incrementalCreateFierEqumt(fireEquipment.getId());
}else{
node3dVoMapper.incrementalUpdateFierEqumt(id);
}
iFireEquipmentDao.save(fireEquipment);
return fireEquipment;
}
......@@ -77,7 +66,6 @@ public class FireEquipServiceImpl implements IFireEquipService {
if (fireEquipment != null) {
this.iFireEquipmentDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteFierEqumt(Long.parseLong(id));
} else {
throw new Exception("找不到指定的对象:" + id);
}
......
package com.yeejoin.amos.fas.business.service.impl;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.FireStationEquipmentMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FireStationMapper;
import com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationEquipmentDao;
......@@ -29,6 +12,17 @@ import com.yeejoin.amos.fas.dao.entity.FireEquipment;
import com.yeejoin.amos.fas.dao.entity.FireStation;
import com.yeejoin.amos.fas.dao.entity.FireStationFireEquipment;
import com.yeejoin.amos.fas.exception.YeeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.*;
@Service("fireStationService")
public class FireStationServiceImpl implements IFireStationService {
......@@ -48,9 +42,6 @@ public class FireStationServiceImpl implements IFireStationService {
@Autowired
IFireEquipmentDao iFireEquipmentDao;
@Autowired
Node3dVoMapper node3dVoMapper;
@Value("${windows.img.path}")
private String winImgPath;
......@@ -59,12 +50,7 @@ public class FireStationServiceImpl implements IFireStationService {
public FireStation save(FireStation fireStation) {
Long id = fireStation.getId();
fireStation = iFireStationDao.saveAndFlush(fireStation);
if (id == null || id == 0) {
node3dVoMapper.incrementalCreateStation(fireStation.getId());
} else {
node3dVoMapper.incrementalUpdateStation(id);
}
iFireStationDao.saveAndFlush(fireStation);
return fireStation;
}
......@@ -134,7 +120,6 @@ public class FireStationServiceImpl implements IFireStationService {
}
if (fireStation != null) {
this.iFireStationDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteStation(Long.parseLong(id));
} else {
throw new Exception("找不到指定的监测点:" + id);
}
......
package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper;
import com.yeejoin.amos.fas.business.service.intfc.Node3dVoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.concurrent.Callable;
@Service("node3dVoService")
public class Node3dVoServiceImpl implements Node3dVoService {
@Autowired
private Node3dVoMapper node3dVoMapper ;
@Override
public Integer incrementalCreate(String dataType) {
Integer result = 0;
switch (dataType)
{
case DATATYPE_FIREEQUMT:
result = node3dVoMapper.incrementalCreateFierEqumt(null);
break;
case DATATYPE_IMPEQUMT:
result = node3dVoMapper.incrementalCreateImpEqumt(null);
break;
case DATATYPE_RISKSOURCE:
result = node3dVoMapper.incrementalCreateRiskSource(null);
break;
case DATATYPE_FIRECAR:
result = node3dVoMapper.incrementalCreateFireCar(null);
break;
case DATATYPE_STATION:
result = node3dVoMapper.incrementalCreateStation(null);
break;
case DATATYPE_WATER:
result = node3dVoMapper.incrementalCreateWater(null);
break;
}
return result;
}
@Override
public Integer incrementalRemove(String dataType) {
Integer result = 0;
switch (dataType)
{
case DATATYPE_FIREEQUMT:
result = node3dVoMapper.incrementalDeleteFierEqumt(null);
break;
case DATATYPE_IMPEQUMT:
result = node3dVoMapper.incrementalDeleteImpEqumt(null);
break;
case DATATYPE_RISKSOURCE:
result = node3dVoMapper.incrementalDeleteRiskSource(null);
break;
case DATATYPE_FIRECAR:
result = node3dVoMapper.incrementalDeleteFireCar(null);
break;
case DATATYPE_STATION:
result = node3dVoMapper.incrementalDeleteStation(null);
break;
case DATATYPE_WATER:
result = node3dVoMapper.incrementalDeleteWater(null);
break;
}
return result;
}
@Override
public Integer incrementalUpdate(String dataType) {
Integer result = 0;
switch (dataType)
{
case DATATYPE_FIREEQUMT:
result = node3dVoMapper.incrementalUpdateFierEqumt(null);
break;
case DATATYPE_IMPEQUMT:
result = node3dVoMapper.incrementalUpdateImpEqumt(null);
break;
case DATATYPE_RISKSOURCE:
result = node3dVoMapper.incrementalUpdateRiskSource(null, null);
break;
case DATATYPE_FIRECAR:
result = node3dVoMapper.incrementalUpdateFireCar(null);
break;
case DATATYPE_STATION:
result = node3dVoMapper.incrementalUpdateStation(null);
break;
case DATATYPE_WATER:
result = node3dVoMapper.incrementalUpdateWater(null);
break;
}
return result;
}
/**
*
* @param dataType
* @return
*/
@Override
public Integer incrementalDataType(String dataType) {
Integer result = 0;
switch (dataType)
{
case DATATYPE_FIREEQUMT:
result += node3dVoMapper.incrementalCreateFierEqumt(null)==null?0:node3dVoMapper.incrementalCreateFierEqumt(null);
result += node3dVoMapper.incrementalUpdateFierEqumt(null)==null?0:node3dVoMapper.incrementalUpdateFierEqumt(null);
result += node3dVoMapper.incrementalDeleteFierEqumt(null)==null?0:node3dVoMapper.incrementalDeleteFierEqumt(null);
break;
case DATATYPE_IMPEQUMT:
result += node3dVoMapper.incrementalCreateImpEqumt(null)==null?0:node3dVoMapper.incrementalCreateImpEqumt(null);
result += node3dVoMapper.incrementalUpdateImpEqumt(null)==null?0:node3dVoMapper.incrementalUpdateImpEqumt(null);
result += node3dVoMapper.incrementalDeleteImpEqumt(null)==null?0:node3dVoMapper.incrementalDeleteImpEqumt(null);
break;
case DATATYPE_RISKSOURCE:
result += node3dVoMapper.incrementalCreateRiskSource(null)==null?0:node3dVoMapper.incrementalCreateRiskSource(null);
result += node3dVoMapper.incrementalUpdateRiskSource(null, null)==null?0:node3dVoMapper.incrementalUpdateRiskSource(null, null);
result += node3dVoMapper.incrementalDeleteRiskSource(null)==null?0:node3dVoMapper.incrementalDeleteRiskSource(null);
break;
case DATATYPE_FIRECAR:
result += node3dVoMapper.incrementalCreateFireCar(null)==null?0:node3dVoMapper.incrementalCreateFireCar(null);
result += node3dVoMapper.incrementalUpdateFireCar(null)==null?0:node3dVoMapper.incrementalUpdateFireCar(null);
result += node3dVoMapper.incrementalDeleteFireCar(null)==null?0:node3dVoMapper.incrementalDeleteFireCar(null);
break;
case DATATYPE_STATION:
result += node3dVoMapper.incrementalCreateStation(null)==null?0:node3dVoMapper.incrementalCreateStation(null);
result += node3dVoMapper.incrementalUpdateStation(null)==null?0:node3dVoMapper.incrementalUpdateStation(null);
result += node3dVoMapper.incrementalDeleteStation(null)==null?0:node3dVoMapper.incrementalDeleteStation(null);
break;
case DATATYPE_WATER:
result += node3dVoMapper.incrementalCreateWater(null)==null?0:node3dVoMapper.incrementalCreateWater(null);
result += node3dVoMapper.incrementalUpdateWater(null)==null?0:node3dVoMapper.incrementalUpdateWater(null);
result += node3dVoMapper.incrementalDeleteWater(null)==null?0:node3dVoMapper.incrementalDeleteWater(null);
break;
}
return result;
}
@Override
public Integer wholeIncremental() {
Integer result = 0;
//消防设备
result += node3dVoMapper.incrementalCreateFierEqumt(null)==null?0:node3dVoMapper.incrementalCreateFierEqumt(null);
result += node3dVoMapper.incrementalUpdateFierEqumt(null)==null?0:node3dVoMapper.incrementalUpdateFierEqumt(null);
result += node3dVoMapper.incrementalDeleteFierEqumt(null)==null?0:node3dVoMapper.incrementalDeleteFierEqumt(null);
//重点设备
result += node3dVoMapper.incrementalCreateImpEqumt(null)==null?0:node3dVoMapper.incrementalCreateImpEqumt(null);
result += node3dVoMapper.incrementalUpdateImpEqumt(null)==null?0:node3dVoMapper.incrementalUpdateImpEqumt(null);
result += node3dVoMapper.incrementalDeleteImpEqumt(null)==null?0:node3dVoMapper.incrementalDeleteImpEqumt(null);
//风险点
result += node3dVoMapper.incrementalCreateRiskSource(null)==null?0:node3dVoMapper.incrementalCreateRiskSource(null);
result += node3dVoMapper.incrementalUpdateRiskSource(null, null)==null?0:node3dVoMapper.incrementalUpdateRiskSource(null, null);
result += node3dVoMapper.incrementalDeleteRiskSource(null)==null?0:node3dVoMapper.incrementalDeleteRiskSource(null);
//消防车
result += node3dVoMapper.incrementalCreateFireCar(null)==null?0:node3dVoMapper.incrementalCreateFireCar(null);
result += node3dVoMapper.incrementalUpdateFireCar(null)==null?0:node3dVoMapper.incrementalUpdateFireCar(null);
result += node3dVoMapper.incrementalDeleteFireCar(null)==null?0:node3dVoMapper.incrementalDeleteFireCar(null);
//消防室和泡沫间
result += node3dVoMapper.incrementalCreateStation(null)==null?0:node3dVoMapper.incrementalCreateStation(null);
result += node3dVoMapper.incrementalUpdateStation(null)==null?0:node3dVoMapper.incrementalUpdateStation(null);
result += node3dVoMapper.incrementalDeleteStation(null)==null?0:node3dVoMapper.incrementalDeleteStation(null);
//水资源
result += node3dVoMapper.incrementalCreateWater(null)==null?0:node3dVoMapper.incrementalCreateWater(null);
result += node3dVoMapper.incrementalUpdateWater(null)==null?0:node3dVoMapper.incrementalUpdateWater(null);
result += node3dVoMapper.incrementalDeleteWater(null)==null?0:node3dVoMapper.incrementalDeleteWater(null);
return result;
}
@Override
public Integer updateByRiskSourceId(Long riskSourceId, Integer frequency) {
Integer result = 0;
result = node3dVoMapper.incrementalUpdateRiskSource(riskSourceId, frequency);
return result;
}
@Async
@Override
public Integer syncData(Callable<Integer> callable ) throws Exception
{
return callable.call();
}
}
......@@ -20,7 +20,10 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.*;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.model.*;
import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.util.JexlUtil;
......@@ -98,9 +101,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private FireEquipMapper fireEquipMapper;
@Autowired
private Node3dVoService node3dVoService;
@Autowired
private IFireEquipmentDao iFireEquipmentDao;
@Autowired
......@@ -193,15 +193,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(oldRiskSource.getStatus());
}
iRiskSourceDao.saveAndFlush(riskSource);
//同步数据
if (id == 0) {
node3dVoService.syncData(() -> node3dVoService.incrementalCreate(Node3dVoService.DATATYPE_RISKSOURCE));
} else {
node3dVoService.syncData(() -> node3dVoService.incrementalUpdate(Node3dVoService.DATATYPE_RISKSOURCE));
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
}
return riskSource;
}
......@@ -217,12 +208,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
iRiskSourceDao.deleteById(rId);
}
//1.同步数据
node3dVoService.syncData(() -> node3dVoService.incrementalRemove(Node3dVoService.DATATYPE_RISKSOURCE));
//2.3d屏数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
//3.重新计算rpn
//1.重新计算rpn
List<Long> existIds = parentIds.stream().filter(e ->
iRiskSourceDao.findById(e).isPresent()
).collect(Collectors.toList());
......@@ -1047,7 +1033,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
//1.1计算rpni
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue);
BigDecimal rpni = oidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpn;
//1.2计算rpn:为空则rpni = rpn;不为空则重新计算s*d*newo
if (fmea.getNewEvaluationOid() == null) {
......@@ -1055,7 +1041,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
rpn = rpni;
} else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
rpn = newOidValue.multiply(sidValue).multiply(didValue);
rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
;
}
List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels);
......@@ -1129,7 +1116,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal newOidValue = new BigDecimal(oEvaluationModel.getCoefficient());
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
BigDecimal rpn = newOidValue.multiply(sidValue).multiply(didValue);
BigDecimal rpn = newOidValue.multiply(sidValue).multiply(didValue).setScale(2, BigDecimal.ROUND_HALF_UP);
List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels);
fmea.setRpn(rpn);
......@@ -1149,13 +1136,14 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
}
private void saveRpnLog(Long riskSourceId, Long fmeaId, BigDecimal rpn, BigDecimal rpni) {
private void saveRpnLog(Long riskSourceId, Long fmeaId, BigDecimal rpn, BigDecimal rpni, String notifyType) {
RpnChangeLog rpnChangeLog = new RpnChangeLog();
rpnChangeLog.setRiskSourceId(riskSourceId);
rpnChangeLog.setRpn(rpn);
rpnChangeLog.setRpni(rpni);
rpnChangeLog.setType(RpnUtils.getChangeType(rpn, rpni));
rpnChangeLog.setTriggerBy(fmeaId);
rpnChangeLog.setTriggerType(notifyType);
rpnChangeLog.setFmeaId(fmeaId);
iRpnChangeLogDao.save(rpnChangeLog);
}
......@@ -1188,12 +1176,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpn(null);
riskSource.setRpni(null);
riskSource.setRiskLevelId(null);
riskSource.setFlickerFrequency(0);
//1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper.updateRpn(riskSource);
//2.记录风险点rpn变化流水
this.saveRpnLog(riskSource.getId(), fmeaId, resetValue, resetValue);
this.saveRpnLog(riskSource.getId(), fmeaId, resetValue, resetValue, notifyType);
//3.更新父节点rpn、rpni、风险等级
this.updateParentRpn(riskSource.getParentId());
//4.知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
} else {//fmea评价、巡检、告警
RpnCalculationBo rpnValueBo = RpnUtils.calRpnAndRpni(fmeas);
if (rpnValueBo.isEmpty()) {
......@@ -1208,16 +1199,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpn(rpn);
riskSource.setRpni(rpni);
riskSource.setRiskLevelId(newRiskLevel.getId());
String changeType = RpnUtils.calChangeTypeByLevel(oldRiskLevel.getLevel(),newRiskLevel.getLevel());
riskSource.setFlickerFrequency(RpnUtils.calRiskPointFrequency(rpn,rpni,changeType));
//1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper.updateRpn(riskSource);
//2.记录风险点rpn变化流水
this.saveRpnLog(riskSource.getId(), fmeaId, rpn, rpni);
this.saveRpnLog(riskSource.getId(), fmeaId, rpn, rpni, notifyType);
//3.更新父节点rpn、rpni、风险等级
this.updateParentRpn(riskSource.getParentId());
//4.极光推送给手机客户端
jpushRiskSourceMessage("风险预警", jpushTargets);
//5.规则告警(消息)TODO
notifyRule(riskSourceId, rpn, rpni, oldRiskLevel.getLevel(), newRiskLevel.getLevel(), notifyType);
notifyRule(riskSourceId, rpn, rpni, notifyType,changeType);
//6.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
}
}
}
......@@ -1232,6 +1227,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public void notifyRiskSourceDelete(Long parentId) {
//1.风险点删除触发更新父节点rpn、rpni、风险等级
this.updateParentRpn(parentId);
//2.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
}
private void updateParentRpn(long parentId) {
......@@ -1289,7 +1286,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
ids.add(riskSource.getId());
}
}
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
}
/**
......@@ -1310,31 +1306,18 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
/**
* 规则告警
*/
private void notifyRule(Long id, BigDecimal rpnr, BigDecimal rpni, Integer oldLevel, Integer newLevel, String
notifyType) {
int level = oldLevel - newLevel;
String changeType;
if (level > 0) {
changeType = "up";
} else if (level == 0) {
changeType = "no";
} else {
changeType = "down";
}
private void notifyRule(
Long id,
BigDecimal rpnr,
BigDecimal rpni,
String notifyType,
String changeType) {
RiskSourceRuleRo riskSourceRuleRo = new RiskSourceRuleRo();
riskSourceRuleRo.setId(id);
riskSourceRuleRo.setRpnr(rpnr);
riskSourceRuleRo.setRpni(rpni);
riskSourceRuleRo.setLevelChangeType(changeType);
riskSourceRuleRo.setNotifyType(notifyType);
BigDecimal rg = rpnr.subtract(rpni);
int frequency = 0;
if ("up".equals(changeType) && rg.intValue() > 0) {
frequency = 3;
} else if ("no".equals(changeType) && rg.intValue() > 0) {
frequency = 1;
}
node3dVoService.updateByRiskSourceId(riskSourceRuleRo.getId(), frequency);
try {
remoteRuleServer.fireRule(riskSourceRuleRo, "风险管控/riskSource");
} catch (Exception e) {
......
package com.yeejoin.amos.fas.business.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper;
import com.yeejoin.amos.fas.business.dao.mapper.WaterResourceMapper;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceEquipmentDao;
......@@ -19,6 +8,15 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.WaterResource;
import com.yeejoin.amos.fas.dao.entity.WaterResourceEquipment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Service("waterResourceService")
public class WaterResourceServiceImpl implements IWaterResourceService {
......@@ -34,19 +32,11 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
@Autowired
IWaterResourceEquipmentDao iWaterResourceEquipmentDao;
@Autowired
Node3dVoMapper node3dVoMapper;
@Override
public WaterResource save(WaterResource waterResource)
{
Long id = waterResource.getId();
waterResource = iWaterResourceDao.saveAndFlush(waterResource);
if(id ==null || id == 0){
node3dVoMapper.incrementalCreateWater(waterResource.getId());
}else{
node3dVoMapper.incrementalUpdateWater(id);
}
return waterResource;
}
......@@ -68,7 +58,6 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
if(waterResource != null)
{
this.iWaterResourceDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteWater(Long.parseLong(id));
}else
{
throw new Exception("找不到指定的监测点:"+id);
......
package com.yeejoin.amos.fas.business.service.intfc;
import java.util.concurrent.Callable;
public interface Node3dVoService {
String DATATYPE_RISKSOURCE = "RISKSOURCE"; //数据类型-风险点
String DATATYPE_FIREEQUMT = "FIREEQUMT";//数据类型-消防设备
String DATATYPE_IMPEQUMT = "IMPEQUMT";//数据类型-重点设备
String DATATYPE_FIRECAR = "FIRECAR";//数据类型-消防车
String DATATYPE_STATION = "STATION";//数据类型-消防室和泡沫间
String DATATYPE_WATER = "WATER";//数据类型-水资源
/**
* 同步新增的3d数据
* @param dataType
* @return
*/
Integer incrementalCreate(String dataType);
/**
* 同步已经删除的的3d数据
* @param dataType
* @return
*/
Integer incrementalRemove(String dataType);
/**
* 同步需要更新的的3d数据
* @param dataType
* @return
*/
Integer incrementalUpdate(String dataType);
/**
* 同步指定数据类型,新增,删除,更新
* @param dataType
* @return
*/
Integer incrementalDataType(String dataType);
/**
* 对所有数据类型进行同步,新增,更新,删除
* @return
*/
Integer wholeIncremental();
Integer updateByRiskSourceId(Long riskSourceId, Integer frequency);
Integer syncData(Callable<Integer> callable )throws Exception;
}
......@@ -17,10 +17,11 @@ import java.util.List;
public class RpnUtils {
/**
* 计算风险值
*
* @param fmeas
* @return RpnCalculationBo
*/
public static RpnCalculationBo calRpnAndRpni(List<Fmea> fmeas){
public static RpnCalculationBo calRpnAndRpni(List<Fmea> fmeas) {
BigDecimal maxSidValue = new BigDecimal("0");
BigDecimal maxDidValue = new BigDecimal("0");
BigDecimal totalOidValue = new BigDecimal("0");
......@@ -48,10 +49,10 @@ public class RpnUtils {
if (count == 0) {
return rpnValue;
}
BigDecimal averageOidValue = totalOidValue.divide(BigDecimal.valueOf(count),2,BigDecimal.ROUND_HALF_UP);
BigDecimal averageNewOidValue = totalNewOidValue.divide(BigDecimal.valueOf(count),2,BigDecimal.ROUND_HALF_UP);
BigDecimal rpn = maxDidValue.multiply(maxSidValue).multiply(averageNewOidValue).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal averageOidValue = totalOidValue.divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
BigDecimal averageNewOidValue = totalNewOidValue.divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpn = maxDidValue.multiply(maxSidValue).multiply(averageNewOidValue).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue).setScale(2, BigDecimal.ROUND_HALF_UP);
rpnValue.setRpn(rpn);
rpnValue.setRpni(rpni);
return rpnValue;
......@@ -59,6 +60,7 @@ public class RpnUtils {
/**
* 计算最大故障率
*
* @param equipmentPoints
* @param pointInputitems
* @return
......@@ -107,6 +109,7 @@ public class RpnUtils {
/**
* 获得风险等级
*
* @param rpni
* @param levels
* @return
......@@ -127,18 +130,56 @@ public class RpnUtils {
/**
* 获取风险变化类型
* @param rpn
* @param rpni
* @return
*
* @param rpn 实时
* @param rpni 固有
* @return int
*/
public static int getChangeType(BigDecimal rpn, BigDecimal rpni) {
if(rpn.subtract(rpni).doubleValue() > 0){
if (rpn.subtract(rpni).doubleValue() > 0) {
return RpnChangeLogTypeEum.upper.getCode();
} else if(rpn.subtract(rpni).doubleValue() < 0){
} else if (rpn.subtract(rpni).doubleValue() < 0) {
return RpnChangeLogTypeEum.down.getCode();
} else {
return RpnChangeLogTypeEum.unChange.getCode();
}
}
/**
* 计算变化类型
* @param oldLevel 原有等级
* @param newLevel 现有等级
* @return up、no、down
*/
public static String calChangeTypeByLevel(Integer oldLevel, Integer newLevel){
int level = oldLevel - newLevel;
String changeType;
if (level > 0) {
changeType = "up";
} else if (level == 0) {
changeType = "no";
} else {
changeType = "down";
}
return changeType;
}
/**
* 计算闪烁频率
* @param rpnr 实时
* @param rpni 固有
* @param changeType 变化类型
* @return int
*/
public static int calRiskPointFrequency(BigDecimal rpnr,BigDecimal rpni, String changeType) {
BigDecimal rg = rpnr.subtract(rpni);
int frequency = 0;
if ("up".equals(changeType) && rg.intValue() > 0) {
frequency = 3;
} else if ("no".equals(changeType) && rg.intValue() > 0) {
frequency = 1;
}
return frequency;
}
}
......@@ -19,6 +19,42 @@ public class View3dNodeVo {
private String[] relationKeys;
private String level;
private String levelStr;
/**
* 顶牌内容
*/
private String title;
/**
* 闪烁频率
*/
private Integer frequency = 0;
/**
* 是否显示顶牌
*/
private Boolean showInfo;
public Boolean getShowInfo() {
return showInfo;
}
public void setShowInfo(Boolean showInfo) {
this.showInfo = showInfo;
}
public Integer getFrequency() {
return frequency;
}
public void setFrequency(Integer frequency) {
this.frequency = frequency;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getId() {
return id;
......
......@@ -206,7 +206,9 @@
</changeSet>
<changeSet author="suhuiguang" id="1588990926789-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_risk_level " columnName="manage_level"/>
</not>
</preConditions>
<comment>f_risk_level add column manage_level 管控级别</comment>
<sql>
......@@ -214,4 +216,28 @@
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1589165258908-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_rpn_change_log " columnName="trigger_type"/>
</not>
</preConditions>
<comment>f_rpn_change_log add column trigger_type 触发类型</comment>
<sql>
ALTER TABLE `f_rpn_change_log`
add COLUMN `trigger_type` varchar(20) DEFAULT NULL COMMENT '触发类型:巡检、告警、评价、删除' after `trigger_by`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1589165258908-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_risk_source " columnName="flicker_frequency"/>
</not>
</preConditions>
<comment>f_risk_source add column flicker_frequency 闪烁频率</comment>
<sql>
ALTER TABLE `f_risk_source`
add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -81,24 +81,6 @@
</sql>
</changeSet>
<changeSet author="lierwei" id="1561717968-1" runOnChange="true">
<comment>f_risk_source 触发器创建</comment>
<sql endDelimiter="#">
DROP TRIGGER IF EXISTS `trigger_risk_source_status_update`;
CREATE TRIGGER `trigger_risk_source_status_update` AFTER UPDATE ON `f_risk_source` FOR EACH ROW BEGIN
IF NEW.status = 'NORMAL' THEN
UPDATE toip_biz_node3dvo SET `node_state` = 'NORMAL' WHERE type = 'riskSource' and oid = NEW.id;
END IF;
IF NEW.status = null or NEW.status = '' THEN
UPDATE toip_biz_node3dvo SET `node_state` = 'NORMAL' WHERE type = 'riskSource' and oid = NEW.id;
END IF;
IF NEW.status = 'ANOMALY' THEN
UPDATE toip_biz_node3dvo SET `node_state` = NEW.rpni WHERE type = 'riskSource' and oid = NEW.id;
END IF;
END#
</sql>
</changeSet>
<changeSet author="tianbo" id="1561717770000-1" runOnChange="true">
<comment>f_fire_equipment_point_update 触发器创建(修改判断条件为->value等于'true')</comment>
<sql endDelimiter="#">
......
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.Node3dVoMapper">
<select id="incrementalCreateRiskSource" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
CONCAT('auto-sync-id',FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999)) id,
rs.`name` display_name,
'riskSource' type,
null node_state ,
rs.id oid,
null task_oid,
rs.org_code,
null remark ,
null display_icon,
CASE WHEN (ISNULL(rs.position3d) || LENGTH(trim(rs.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(rs.position3d,',', 1),',"y":',substring_index(substring_index(rs.position3d,',', -2), ',', 1),',"z":',substring_index(rs.position3d,',', -1),'}') end position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE rs.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',rs.floor3d,'"}') config,
rs.create_date,
NOW(),
rs.create_by,
rs.create_by,
'\0' is_delete,
(select rl.`level` from f_risk_level rl where rl.id = rs.risk_level_id)data_level,
rs.`code` data_code,
null protect_obj_name,
null route_name,
0 frequency
from f_risk_source rs
where
<choose>
<when test="rsId !=null">
rs.id = #{rsId}
</when>
<otherwise>
not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type = 'riskSource' and bn.oid = rs.`id`) ;
</otherwise>
</choose>
</select>
<select id="incrementalDeleteRiskSource" resultType="java.lang.Integer">
DELETE
FROM
toip_biz_node3dvo
WHERE
<choose>
<when test="rsId !=null">
oid = #{rsId} and type = 'riskSource'
</when>
<otherwise>
id IN (
SELECT
d.id
FROM
(
SELECT
bn.id
FROM
toip_biz_node3dvo bn
WHERE
bn.type = 'riskSource'
AND NOT EXISTS (
SELECT
1
FROM
f_risk_source rs
WHERE
bn.oid = rs.id
)
) d
);
</otherwise>
</choose>
</select>
<select id="incrementalCreateFierEqumt" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
CONCAT('auto-sync-id',FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999)) id,
fe.`name` display_name,
case
when fe.equip_classify = 4 then
'fireDetection'
when fe.equip_classify = 3 then
'fireEquipment'
when fe.equip_classify = 2 then
'video'
when fe.equip_classify = 1 then
'consumables'
when fe.equip_classify = 0 then
'monitorEquipment'
end
type,
null node_state,
fe.id oid,
null task_oid,
fe.org_code,
null remark ,
null display_icon,
CASE WHEN (ISNULL(fe.position3d) || LENGTH(trim(fe.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fe.position3d,',', 1),',"y":',substring_index(substring_index(fe.position3d,',', -2), ',', 1),',"z":',substring_index(fe.position3d,',', -1),'}') END position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE fe.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',fe.floor3d,'"}') config,
fe.create_date,
NOW(),
fe.create_by,
fe.create_by,
'\0' is_delete,
null data_level,
fe.`code` data_code,
(select GROUP_CONCAT(cast(eq.`name` as char(50)) SEPARATOR ',') from f_equipment_fire_equipment fre join f_equipment eq on fre.equipment_id = eq.id where fre.fire_equipment_id = fe.id) protect_obj_name,
null route_name,
0 frequency
from f_fire_equipment fe
where
<choose>
<when test="feId !=null">
fe.id = #{feId}
</when>
<otherwise>
fe.equip_classify in (0,2,3) and not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type in ('fireEquipment','video','monitorEquipment') and bn.oid = fe.`id`) ;
</otherwise>
</choose>
</select>
<select id="incrementalUpdateRiskSource" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_risk_source AS rs
ON bn.oid = rs.id
SET
bn.config = CONCAT('{"isIndoor":',CASE rs.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',rs.floor3d,'"}'),
bn.org_code = rs.org_code,
bn.position = CASE WHEN (ISNULL(rs.position3d) || LENGTH(trim(rs.position3d)) <![CDATA[<]]>1) THEN NULL ELSE CONCAT('{"x":',substring_index(rs.position3d,',', 1),',"y":',substring_index(substring_index(rs.position3d,',', -2), ',', 1),',"z":',substring_index(rs.position3d,',', -1),'}') END,
bn.data_level = (select rl.`level` from f_risk_level rl where rl.id = rs.risk_level_id),
bn.data_code = rs.`code`,
bn.display_name = rs.`name`,
<if test="frequency != null">
bn.frequency = #{frequency},
</if>
bn.node_state = rs.rpn
WHERE
bn.type = 'riskSource'
<if test="rsId !=null">
and rs.id = #{rsId}
</if>
</select>
<select id="incrementalDeleteFierEqumt" resultType="java.lang.Integer">
DELETE
FROM
toip_biz_node3dvo
WHERE
<choose>
<when test="feId !=null">
oid = #{feId} and type in ('consumables','fireDetection','fireEquipment','video','monitorEquipment')
</when>
<otherwise>
id IN (
SELECT
d.id
FROM
(
SELECT
bn.id
FROM
toip_biz_node3dvo bn
WHERE
bn.type in ('consumables','fireDetection','fireEquipment','video','monitorEquipment')
AND NOT EXISTS (
SELECT
1
FROM
f_fire_equipment fe
WHERE
bn.oid = fe.id
)
) d
);
</otherwise>
</choose>
</select>
<select id="incrementalUpdateFierEqumt" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_fire_equipment AS fe
ON bn.oid = fe.id
SET
bn.display_name = fe.`name`,
bn.config = CONCAT('{"isIndoor":',CASE fe.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',fe.floor3d,'"}'),
bn.org_code = fe.org_code,
bn.position = CASE WHEN (ISNULL(fe.position3d) || LENGTH(trim(fe.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fe.position3d,',', 1),',"y":',substring_index(substring_index(fe.position3d,',', -2), ',', 1),',"z":',substring_index(fe.position3d,',', -1),'}') END,
bn.data_code = fe.`code`,
bn.protect_obj_name = (select GROUP_CONCAT(cast(eq.`name` as char(50)) SEPARATOR ',') from f_equipment_fire_equipment fre join f_equipment eq on fre.equipment_id = eq.id where fre.fire_equipment_id = fe.id)
WHERE
bn.type in ('consumables','fireDetection','fireEquipment','video','monitorEquipment')
<if test="feId">
and fe.id =#{feId}
</if>
</select>
<select id="incrementalCreateImpEqumt" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
CONCAT('auto-sync-id',FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999)) id,
e.`name` display_name,
'impEquipment' type,
null node_state ,
e.id oid,
null task_oid,
e.org_code,
null remark ,
null display_icon,
CASE WHEN (ISNULL(e.position3d) || LENGTH(trim(e.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(e.position3d,',', 1),',"y":',substring_index(substring_index(e.position3d,',', -2), ',', 1),',"z":',substring_index(e.position3d,',', -1),'}') END position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE e.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',e.floor3d,'"}') config,
e.create_date,
NOW(),
e.create_by,
e.create_by,
'\0' is_delete,
null data_level,
e.`code` data_code,
null protect_obj_name,
null route_name,
0 frequency
from f_equipment e
where
<choose>
<when test="equipId !=null">
e.id = #{equipId}
</when>
<otherwise>
not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type = 'impEquipment' and bn.oid = e.`id`) ;
</otherwise>
</choose>
</select>
<select id="incrementalDeleteImpEqumt" resultType="java.lang.Integer">
DELETE
FROM
toip_biz_node3dvo
WHERE
<choose>
<when test="equipId !=null">
oid = #{equipId} and type = 'impEquipment'
</when>
<otherwise>
id IN (
SELECT
d.id
FROM
(
SELECT
bn.id
FROM
toip_biz_node3dvo bn
WHERE
bn.type = 'impEquipment'
AND NOT EXISTS (
SELECT
1
FROM
f_equipment e
WHERE
bn.oid = e.id
)
) d
);
</otherwise>
</choose>
</select>
<select id="incrementalUpdateImpEqumt" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_equipment AS e
ON bn.oid = e.id
SET
bn.display_name = e.`name`,
bn.config = CONCAT('{"isIndoor":',CASE e.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',e.floor3d,'"}'),
bn.org_code = e.org_code,
bn.position = CASE WHEN (ISNULL(e.position3d) || LENGTH(trim(e.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(e.position3d,',', 1),',"y":',substring_index(substring_index(e.position3d,',', -2), ',', 1),',"z":',substring_index(e.position3d,',', -1),'}') END,
bn.data_code = e.`code`
WHERE
bn.type = 'impEquipment'
<if test="equipId != null">
and e.id = #{equipId}
</if>
</select>
<select id="incrementalCreateFireCar" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
CONCAT('auto-sync-id',FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999)) id,
fc.`name` display_name,
'fireCar' type,
null node_state ,
fc.id oid,
null task_oid,
fc.org_code,
null remark ,
null display_icon,
CASE WHEN (ISNULL(fc.position3d) || LENGTH(trim(fc.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fc.position3d,',', 1),',"y":',substring_index(substring_index(fc.position3d,',', -2), ',', 1),',"z":',substring_index(fc.position3d,',', -1),'}') END position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE fc.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',IFNULL(fc.floor3d,'1'),'"}') config,
fc.create_date,
NOW(),
fc.create_by,
fc.create_by,
'\0' is_delete,
null data_level,
fc.car_num data_code,
null protect_obj_name,
null route_name,
0 frequency
from f_fire_car fc
where
<choose>
<when test="carId !=null">
fc.id = #{carId}
</when>
<otherwise>
not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type = 'fireCar' and bn.oid = fc.id) ;
</otherwise>
</choose>
</select>
<select id="incrementalDeleteFireCar" resultType="java.lang.Integer">
DELETE
FROM
toip_biz_node3dvo
WHERE
<choose>
<when test="carId !=null">
oid = #{carId} and type = 'fireCar'
</when>
<otherwise>
id IN (
SELECT
d.id
FROM
(
SELECT
bn.id
FROM
toip_biz_node3dvo bn
WHERE
bn.type = 'fireCar'
AND NOT EXISTS (
SELECT
1
FROM
f_fire_car fc
WHERE
bn.oid = fc.id
)
) d
);
</otherwise>
</choose>
</select>
<select id="incrementalUpdateFireCar" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_fire_car AS fc
ON bn.oid = fc.id
SET
bn.display_name = fc.`type`,
bn.config = CONCAT('{"isIndoor":',CASE fc.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',fc.floor3d,'"}'),
bn.org_code = fc.org_code,
bn.position = CASE WHEN (ISNULL(fc.position3d) || LENGTH(trim(fc.position3d))<![CDATA[ <]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fc.position3d,',', 1),',"y":',substring_index(substring_index(fc.position3d,',', -2), ',', 1),',"z":',substring_index(fc.position3d,',', -1),'}') END,
bn.data_code = fc.car_num
WHERE
bn.type = 'fireCar'
<if test="carId != null">
and fc.id = #{carId}
</if>
</select>
<select id="incrementalCreateStation" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
CONCAT('auto-sync-id',FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999)) id,
fs.`name` display_name,
case when fs.type = 1 then 'fireChamber'
when fs.type=2 then 'fireFoamRoom'
end type,
null node_state ,
fs.id oid,
null task_oid,
fs.org_code,
null remark ,
null display_icon,
CASE WHEN (ISNULL(fs.position3d) || LENGTH(trim(fs.position3d)) <![CDATA[<]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fs.position3d,',', 1),',"y":',substring_index(substring_index(fs.position3d,',', -2), ',', 1),',"z":',substring_index(fs.position3d,',', -1),'}') END position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE fs.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',fs.floor3d,'"}') config,
fs.create_date,
NOW(),
fs.create_by,
fs.create_by,
'\0' is_delete,
null data_level,
fs.`code` data_code,
null protect_obj_name,
null route_name ,
0 frequency
from f_fire_station fs
where
<choose>
<when test="fsId !=null">
fs.id = #{fsId}
</when>
<otherwise>
not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type in('fireChamber','fireFoamRoom') and bn.oid = fs.`id`) ;
</otherwise>
</choose>
</select>
<select id="incrementalDeleteStation" resultType="java.lang.Integer">
DELETE
FROM
toip_biz_node3dvo
WHERE
<choose>
<when test="fsId !=null">
oid = #{fsId} and type in('fireChamber','fireFoamRoom')
</when>
<otherwise>
id IN (
SELECT
d.id
FROM
(
SELECT
bn.id
FROM
toip_biz_node3dvo bn
WHERE
bn.type in('fireChamber','fireFoamRoom')
AND NOT EXISTS (
SELECT
1
FROM
f_fire_station fs
WHERE
bn.oid = fs.id
)
) d
);
</otherwise>
</choose>
</select>
<select id="incrementalUpdateStation" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_fire_station AS fs
ON bn.oid = fs.id
SET
bn.display_name = fs.`name` ,
bn.org_code = fs.org_code,
bn.position = CASE WHEN (ISNULL(fs.position3d) || LENGTH(trim(fs.position3d)) <![CDATA[<]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(fs.position3d,',', 1),',"y":',substring_index(substring_index(fs.position3d,',', -2), ',', 1),',"z":',substring_index(fs.position3d,',', -1),'}') END,
bn.data_code = fs.`code`,
bn.config = CONCAT('{"isIndoor":',CASE fs.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',fs.floor3d,'"}')
WHERE
bn.type in('fireChamber','fireFoamRoom')
<if test="fsId != null">
and fs.id = #{fsId}
</if>
</select>
<select id="incrementalCreateWater" resultType="java.lang.Integer">
INSERT INTO toip_biz_node3dvo
select
CONCAT('auto-sync-id',FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999),FLOOR(RAND() * 9999)) id,
wr.`name` display_name,
case wr.type when 1 then 'hydrant'
when 2 then 'pool'
end type,
null node_state ,
wr.id oid,
null task_oid,
wr.org_code,
null remark ,
null display_icon,
CASE WHEN (ISNULL(wr.position3d) || LENGTH(trim(wr.position3d)) <![CDATA[<]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(wr.position3d,',', 1),',"y":',substring_index(substring_index(wr.position3d,',', -2), ',', 1),',"z":',substring_index(wr.position3d,',', -1),'}') END position,
'{ "x": 0, "y": 0, "z": 0 }' rotation,
'{ "x": 1, "y": 1, "z": 1 }' scale ,
CONCAT('{"isIndoor":',CASE wr.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',wr.floor3d,'"}') config,
wr.create_date,
NOW(),
wr.create_by,
wr.create_by,
'\0' is_delete,
null data_level,
wr.`code` data_code,
null protect_obj_name,
null route_name ,
0 frequency
from f_water_resource wr
where
<choose>
<when test="wrId !=null">
wr.id = #{wrId}
</when>
<otherwise>
not EXISTS(select 1 from toip_biz_node3dvo bn where bn.type in('hydrant','pool') and bn.oid = wr.`id`) ;
</otherwise>
</choose>
</select>
<select id="incrementalDeleteWater" resultType="java.lang.Integer">
DELETE
FROM
toip_biz_node3dvo
WHERE
<choose>
<when test="wrId !=null">
oid = #{wrId} and type in ('hydrant','pool')
</when>
<otherwise>
id IN (
SELECT
d.id
FROM
(
SELECT
bn.id
FROM
toip_biz_node3dvo bn
WHERE
bn.type in ('hydrant','pool')
AND NOT EXISTS (
SELECT
1
FROM
f_water_resource wr
WHERE
bn.oid = wr.id
)
) d
);
</otherwise>
</choose>
</select>
<select id="incrementalUpdateWater" resultType="java.lang.Integer">
UPDATE
toip_biz_node3dvo AS bn
JOIN f_water_resource AS wr
ON bn.oid = wr.id
SET
bn.display_name = wr.`name` ,
bn.org_code = wr.org_code,
bn.position = CASE WHEN (ISNULL(wr.position3d) || LENGTH(trim(wr.position3d)) <![CDATA[<]]>1) THEN NULL
ELSE CONCAT('{"x":',substring_index(wr.position3d,',', 1),',"y":',substring_index(substring_index(wr.position3d,',', -2), ',', 1),',"z":',substring_index(wr.position3d,',', -1),'}') END,
bn.data_code = wr.`code`,
bn.config = CONCAT('{"isIndoor":',CASE wr.is_indoor WHEN 1 THEN 'true' WHEN 0 THEN 'false' END,',"belongObjModel":"floor_',wr.floor3d,'"}')
WHERE
bn.type in ('hydrant','pool')
<if test="wrId != null">
and wr.id = #{wrId}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -672,6 +672,9 @@
<if test="riskLevelId != null">
risk_level_id = #{riskLevelId},
</if>
<if test="flicker_frequency != null">
flicker_frequency = #{flicker_frequency}
</if>
</set>
where id = #{id}
</update>
......
......@@ -205,7 +205,10 @@
<choose>
<when test="type == 'riskSource'">
select rs.id,rs.name,rs.code,rs.ue4_location as ue4Location,rs.ue4_rotation as ue4Rotation,rs.position3d,
rl.level,rl.name as levelStr,rs.floor3d ,rs.is_indoor as isIndoor
rl.level,rl.name as levelStr,rs.floor3d ,rs.is_indoor as isIndoor,
rs.flicker_frequency as frequency,
true as 'showInfo',
rs.rpn as title
from f_risk_source rs
left join f_risk_level rl ON rl.id = rs.risk_level_id
where 1=1
......@@ -218,8 +221,27 @@
</when>
<when test="type == 'patrol'">
select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,coordinates as position3d,
status,floor as floor3d,is_indoor as isIndoor
from p_point
status,floor as floor3d,is_indoor as isIndoor,
0 as frequency,
case p.status
when '0' then false
when '1' then false
else true
end as `showInfo`,
case p.status
when '0' then '未计划'
when '1' then '合格'
when '2' then '不合格'
when '3' then '漏检'
end as title,
case p.status
when '0' then '未计划'
when '1' then '合格'
when '2' then '不合格'
when '3' then '漏检'
end as levelStr,
status as level
from p_point p
where 1=1 and is_delete = 0
<if test="pointId != null">
AND id = #{pointId}
......@@ -230,7 +252,10 @@
</when>
<when test="type == 'impEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
false as 'showInfo',
name as 'title'
from f_equipment
where 1=1
<if test="pointId != null">
......@@ -242,7 +267,10 @@
</when>
<when test="type == 'monitorEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
false as 'showInfo',
name as 'title'
from f_fire_equipment
where equip_classify = 0
<if test="pointId != null">
......@@ -254,7 +282,10 @@
</when>
<when test="type == 'video'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
false as 'showInfo',
name as 'title'
from f_fire_equipment
where equip_classify = 2
<if test="pointId != null">
......@@ -266,7 +297,10 @@
</when>
<when test="type == 'hydrant'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
false as 'showInfo',
name as 'title'
from f_water_resource
where type = 1
<if test="pointId != null">
......@@ -278,7 +312,10 @@
</when>
<when test="type == 'pool'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
false as 'showInfo',
name as 'title'
from f_water_resource
where type = 2
<if test="pointId != null">
......@@ -290,7 +327,10 @@
</when>
<when test="type == 'fireCar'">
select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
true as 'showInfo',
name as 'title'
from f_fire_car
where 1=1
<if test="pointId != null">
......@@ -302,7 +342,10 @@
</when>
<when test="type == 'fireEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
true as 'showInfo',
name as 'title'
from f_fire_equipment
where equip_classify = 3
<if test="pointId != null">
......@@ -314,7 +357,10 @@
</when>
<when test="type == 'fireChamber'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
true as 'showInfo',
name as 'title'
from f_fire_station
where type = 1
<if test="pointId != null">
......@@ -326,7 +372,10 @@
</when>
<when test="type == 'fireFoamRoom'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d,
floor3d,is_indoor as isIndoor
floor3d,is_indoor as isIndoor,
0 as frequency,
true as 'showInfo',
name as 'title'
from f_fire_station
where type = 2
<if test="pointId != null">
......@@ -549,10 +598,15 @@
'riskSource' as type,
rl.level,
CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id
from f_risk_source R
left join f_risk_level rl on rl.id = r.risk_level_id
where is_region <![CDATA[<>]]> 'TRUE' AND status = 'ANOMALY'
R.id as risk_source_id,
r.flicker_frequency as frequency,
true as 'showInfo',
r.rpn as title
from f_risk_source R ,f_risk_level rl
where
r.is_region <![CDATA[<>]]> 'TRUE'
AND R.status = 'ANOMALY'
AND rl.id = r.risk_level_id
AND R.org_code like CONCAT(#{orgCode},'%')
UNION ALL
select
......@@ -560,9 +614,24 @@
'patrol' as type,
p.status as level,
CONCAT('level_',p.status) as level_str,
p.risk_source_id
p.risk_source_id,
0 as frequency,
case p.status
when '0'
then false
else
true
end as `showInfo`,
case p.status
when '0'
then '未计划'
when '2'
then '不合格'
when '3'
then '漏检'
end as title
from p_point p
where status in (0,2,3)
where status in ('0','2','3')
AND p.org_code like CONCAT(#{orgCode},'%')
UNION ALL
select
......@@ -570,7 +639,10 @@
'impEquipment' as type,
0 as level,
'level_0' as kevek_str,
e.risk_source_id
e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
......@@ -621,11 +693,12 @@
END positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
false showInfo,
rs. CODE title,
true as showInfo,
rs.rpn as title,
'riskSource' type,
rs.org_code as orgCode,
rs.id as riskSourceId
rs.id as riskSourceId,
rs.flicker_frequency as frequency
FROM
f_risk_source rs
LEFT JOIN f_risk_level rl ON rl.id = rs.risk_level_id
......@@ -633,6 +706,7 @@
rs.position3d IS NOT NULL
AND rs.position3d != ''
AND rs.risk_level_id is not null
AND rs.is_region <![CDATA[<>]]> 'TRUE'
AND rs.status = 'ANOMALY'
UNION ALL
SELECT
......@@ -665,11 +739,12 @@
END positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE showInfo,
CODE title,
FALSE as showInfo,
name as title,
'impEquipment' type,
eq.org_code as orgCode,
eq.risk_source_id as riskSourceId
eq.risk_source_id as riskSourceId,
0 as frequency
FROM
f_equipment eq
WHERE
......@@ -711,16 +786,22 @@
END positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE showInfo,
p.point_no title,
case p.status
when '0'
then false
else
true
end as `showInfo`,
p.name as title,
'patrol' as type,
p.org_code as orgCode,
p.risk_source_id as riskSourceId
p.risk_source_id as riskSourceId,
0 as frequency
from
p_point p
left join f_risk_source rs on p.risk_source_id = rs.id AND rs.is_region='TRUE'
where rs.id is not null
AND p.status in ('2','3')
AND p.status in ('0','2','3')
AND p.coordinates != '' AND p.coordinates is not null
) temp
WHERE 1=1
......
......@@ -219,7 +219,7 @@
<url>http://172.16.1.6:8081/nexus/content/repositories/maven-public/</url>
</repository>
<repository>
<id>maven-public</id>
<id>maven-public-ty</id>
<name>maven-public</name>
<url>http://repo.typroject.org:8081/repository/maven-public/</url>
</repository>
......
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