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

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

parents 2a8b4994 4f95d864
...@@ -75,6 +75,11 @@ public class Node3DVoResponse{ ...@@ -75,6 +75,11 @@ public class Node3DVoResponse{
* 显示图标闪烁标题 * 显示图标闪烁标题
*/ */
private Boolean showInfo = false; private Boolean showInfo = false;
/**
* 闪烁频率
*/
private Integer frequency = 0;
/** /**
* 显示图标闪烁 * 显示图标闪烁
...@@ -111,19 +116,6 @@ public class Node3DVoResponse{ ...@@ -111,19 +116,6 @@ public class Node3DVoResponse{
private String orgCode; private String orgCode;
/**
* 闪烁频率每秒
*/
private int rate = 0;
public int getRate() {
return rate;
}
public void setRate(int rate) {
this.rate = rate;
}
public String getId() { public String getId() {
return id; return id;
...@@ -159,7 +151,13 @@ public class Node3DVoResponse{ ...@@ -159,7 +151,13 @@ public class Node3DVoResponse{
this.type = type; this.type = type;
} }
public Integer getFrequency() {
return frequency;
}
public void setFrequency(Integer frequency) {
this.frequency = frequency;
}
public String getLevel() { public String getLevel() {
return level; return level;
......
...@@ -78,6 +78,12 @@ public class RiskSource extends BasicEntity { ...@@ -78,6 +78,12 @@ public class RiskSource extends BasicEntity {
@Lob @Lob
private String routePath; private String routePath;
/**
* 闪烁频率
*/
@Column(name = "flicker_frequency")
private Integer flickerFrequency;
private List<Fmea> fmeaList; private List<Fmea> fmeaList;
private List<RpnChangeLog> rpnChangeLogList; private List<RpnChangeLog> rpnChangeLogList;
...@@ -89,6 +95,14 @@ public class RiskSource extends BasicEntity { ...@@ -89,6 +95,14 @@ public class RiskSource extends BasicEntity {
return rpni; return rpni;
} }
public Integer getFlickerFrequency() {
return flickerFrequency;
}
public void setFlickerFrequency(Integer flickerFrequency) {
this.flickerFrequency = flickerFrequency;
}
public void setRpni(BigDecimal rpni) { public void setRpni(BigDecimal rpni) {
this.rpni = rpni; this.rpni = rpni;
} }
......
...@@ -2,12 +2,7 @@ package com.yeejoin.amos.fas.dao.entity; ...@@ -2,12 +2,7 @@ package com.yeejoin.amos.fas.dao.entity;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -35,8 +30,22 @@ public class RpnChangeLog extends BasicEntity { ...@@ -35,8 +30,22 @@ public class RpnChangeLog extends BasicEntity {
@Column(name = "trigger_by") @Column(name = "trigger_by")
private Long triggerBy; private Long triggerBy;
/**
* 触发变化类型(巡检、告警、评价、删除)
*/
@Column(name = "trigger_type")
private String triggerType;
private int type; private int type;
public String getTriggerType() {
return triggerType;
}
public void setTriggerType(String triggerType) {
this.triggerType = triggerType;
}
private RiskSource riskSource; private RiskSource riskSource;
public RpnChangeLog() { 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 { ...@@ -192,7 +192,7 @@ public class View3dController extends BaseController {
return CommonResponseUtil.success(view3dService.getEquipStatusList(orgCode)); return CommonResponseUtil.success(view3dService.getEquipStatusList(orgCode));
} }
@ApiOperation(value = "资源显示",notes = "资源显示") @ApiOperation(value = "3d视图点显示",notes = "3d视图点显示")
@GetMapping(value = "initViewNode") @GetMapping(value = "initViewNode")
public CommonResponse initViewNode(String type,Long riskSourceId){ public CommonResponse initViewNode(String type,Long riskSourceId){
ReginParams reginParams =getSelectedOrgInfo(); 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; ...@@ -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.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper; 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.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.mongo.EquipCommunicationDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
...@@ -18,7 +17,6 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable; ...@@ -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.common.response.EquipDetailsResponse;
import com.yeejoin.amos.fas.core.util.DaoCriteria; import com.yeejoin.amos.fas.core.util.DaoCriteria;
import com.yeejoin.amos.fas.core.util.query.BaseQuerySpecification; 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.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.FireEquipment; import com.yeejoin.amos.fas.dao.entity.FireEquipment;
...@@ -46,12 +44,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -46,12 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Service("equipService") @Service("equipService")
public class EquipmentServiceImpl implements IEquipmentService { public class EquipmentServiceImpl implements IEquipmentService {
...@@ -79,9 +72,6 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -79,9 +72,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
ImpAndFireEquipMapper impAndFireEquipMapper; ImpAndFireEquipMapper impAndFireEquipMapper;
@Autowired @Autowired
Node3dVoMapper node3dVoMapper;
@Autowired
private IPreplanPictureDao preplanPictureDao; private IPreplanPictureDao preplanPictureDao;
@Autowired @Autowired
...@@ -90,7 +80,6 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -90,7 +80,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Autowired @Autowired
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Autowired @Autowired
private EquipCommunicationDao equipCommunicationDao; private EquipCommunicationDao equipCommunicationDao;
...@@ -103,11 +92,6 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -103,11 +92,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
public Equipment save(Equipment equipment) { public Equipment save(Equipment equipment) {
Long eqId = equipment.getId(); Long eqId = equipment.getId();
equipment = iEquipmentDao.saveAndFlush(equipment); equipment = iEquipmentDao.saveAndFlush(equipment);
if (eqId == null || eqId == 0) {
node3dVoMapper.incrementalCreateImpEqumt(equipment.getId());
} else {
node3dVoMapper.incrementalUpdateImpEqumt(eqId);
}
return equipment; return equipment;
} }
...@@ -123,21 +107,16 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -123,21 +107,16 @@ public class EquipmentServiceImpl implements IEquipmentService {
} }
@Override
public String[] delete(String[] idArray) throws Exception { public String[] delete(String[] idArray) throws Exception {
for (String id : idArray) { for (String id : idArray) {
Optional<Equipment> equipment1 = iEquipmentDao.findById(Long.parseLong(id)); Optional<Equipment> equipment1 = iEquipmentDao.findById(Long.parseLong(id));
Equipment equipment=null; Equipment equipment=null;
if(equipment1.isPresent()){ if(equipment1.isPresent()){
equipment=equipment1.get(); equipment=equipment1.get();
} }
if (equipment != null) { if (equipment != null) {
this.iEquipmentDao.deleteById(Long.parseLong(id)); this.iEquipmentDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteImpEqumt(Long.parseLong(id));
} else { } else {
throw new Exception("找不到指定的对象:" + id); throw new Exception("找不到指定的对象:" + id);
} }
...@@ -199,26 +178,21 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -199,26 +178,21 @@ public class EquipmentServiceImpl implements IEquipmentService {
result.put("exits", false); result.put("exits", false);
Equipment equipment = this.iEquipmentDao.getOne(equipmentFireEquipment.getEquipmentId().longValue()); Equipment equipment = this.iEquipmentDao.getOne(equipmentFireEquipment.getEquipmentId().longValue());
FireEquipment fireEquipment = iFireEquipmentDao.getOne(equipmentFireEquipment.getFireEquipmentId().longValue()); FireEquipment fireEquipment = iFireEquipmentDao.getOne(equipmentFireEquipment.getFireEquipmentId().longValue());
if (equipment == null || fireEquipment == null) if (equipment == null || fireEquipment == null)
throw new Exception("找不到数据"); throw new Exception("找不到数据");
this.equipmentFireEquipmentDao.save(equipmentFireEquipment); this.equipmentFireEquipmentDao.save(equipmentFireEquipment);
//已存在的绑定关系 //已存在的绑定关系
List<EquipmentFireEquipment> exits = impAndFireEquipMapper.queryForList(String.valueOf(equipmentFireEquipment.getFireEquipmentId()), null); List<EquipmentFireEquipment> exits = impAndFireEquipMapper.queryForList(String.valueOf(equipmentFireEquipment.getFireEquipmentId()), null);
if (!CollectionUtils.isEmpty(exits)) if (!CollectionUtils.isEmpty(exits))
result.put("exits", true); result.put("exits", true);
result.put("newModel", equipmentFireEquipment); result.put("newModel", equipmentFireEquipment);
resultList.add(result); resultList.add(result);
} }
return resultList; return resultList;
} }
@Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<Long> removeFireEqmtBind(Long equipmentId, String[] fireEquipmentIds) { public List<Long> removeFireEqmtBind(Long equipmentId, String[] fireEquipmentIds) {
List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>();
...@@ -243,6 +217,7 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -243,6 +217,7 @@ public class EquipmentServiceImpl implements IEquipmentService {
* @param equipmentId * @param equipmentId
* @return * @return
*/ */
@Override
public Page queryBindFirEqumtList(CommonPageable commonPageable, Long equipmentId) { public Page queryBindFirEqumtList(CommonPageable commonPageable, Long equipmentId) {
long start = -1; long start = -1;
int length = -1; int length = -1;
...@@ -389,68 +364,6 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -389,68 +364,6 @@ public class EquipmentServiceImpl implements IEquipmentService {
} }
return equipment; 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 @Override
public List<Map<String, Object>> findEquipVideoList() { public List<Map<String, Object>> findEquipVideoList() {
......
package com.yeejoin.amos.fas.business.service.impl; 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.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant; 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.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.dao.repository.IFireCarDao;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
...@@ -35,7 +11,19 @@ import com.yeejoin.amos.fas.business.service.intfc.IFireCarService; ...@@ -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.business.vo.FireCarDetailVo;
import com.yeejoin.amos.fas.dao.entity.FireCar; import com.yeejoin.amos.fas.dao.entity.FireCar;
import com.yeejoin.amos.fas.exception.YeeException; 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") @Service("fireCarService")
...@@ -53,19 +41,12 @@ public class FireCarServiceImpl implements IFireCarService { ...@@ -53,19 +41,12 @@ public class FireCarServiceImpl implements IFireCarService {
private String linuxImgPath; private String linuxImgPath;
@Autowired @Autowired
Node3dVoMapper node3dVoMapper;
@Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
public FireCar save(FireCar fireCar) public FireCar save(FireCar fireCar)
{ {
Long carId = fireCar.getId(); Long carId = fireCar.getId();
fireCar = iFireCarDao.saveAndFlush(fireCar); iFireCarDao.save(fireCar);
if(carId ==null || carId == 0){
node3dVoMapper.incrementalCreateFireCar(fireCar.getId());
}else{
node3dVoMapper.incrementalUpdateFireCar(carId);
}
return fireCar; return fireCar;
} }
...@@ -85,17 +66,13 @@ public class FireCarServiceImpl implements IFireCarService { ...@@ -85,17 +66,13 @@ public class FireCarServiceImpl implements IFireCarService {
for(String id:idArray) for(String id:idArray)
{ {
Optional<FireCar> fireCar1 = iFireCarDao.findById(Long.parseLong(id)); Optional<FireCar> fireCar1 = iFireCarDao.findById(Long.parseLong(id));
FireCar fireCar=null; FireCar fireCar=null;
if(fireCar1.isPresent()){ if(fireCar1.isPresent()){
fireCar=fireCar1.get(); fireCar=fireCar1.get();
} }
if(fireCar != null) if(fireCar != null)
{ {
this.iFireCarDao.deleteById(Long.parseLong(id)); this.iFireCarDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteFireCar(Long.parseLong(id));
}else }else
{ {
throw new Exception("找不到指定的对象:"+id); throw new Exception("找不到指定的对象:"+id);
...@@ -110,43 +87,23 @@ public class FireCarServiceImpl implements IFireCarService { ...@@ -110,43 +87,23 @@ public class FireCarServiceImpl implements IFireCarService {
@Override @Override
public Page<HashMap<String, Object>> queryFireCar(String toke,String product,String appKey,CommonPageInfoParam param) { public Page<HashMap<String, Object>> queryFireCar(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = fireCarMapper.countPageData(param); long total = fireCarMapper.countPageData(param);
List<HashMap<String, Object>> content = fireCarMapper.getFireCarPage(param); List<HashMap<String, Object>> content = fireCarMapper.getFireCarPage(param);
if (!CollectionUtils.isEmpty(content)) { if (!CollectionUtils.isEmpty(content)) {
Set<String> deptIds = Sets.newHashSet(Lists.transform(content, Map->Map.get("dept_id")+"")); Set<String> deptIds = Sets.newHashSet(Lists.transform(content, Map->Map.get("dept_id")+""));
deptIds.remove(""); deptIds.remove("");
deptIds.remove(null); deptIds.remove(null);
Map<String, String> deptMap = new HashMap<String,String>(); Map<String, String> deptMap = new HashMap<String,String>();
if(!CollectionUtils.isEmpty(deptIds)){ if(!CollectionUtils.isEmpty(deptIds)){
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds)); List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
for (int i = 0; i < deptList.size(); i++) { for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString()); deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
} }
} }
Map<String, String> deptMapNew= deptMap; Map<String, String> deptMapNew= deptMap;
content.forEach(e -> { content.forEach(e -> {
e.put("departmentName",deptMapNew.get(e.get("dept_id"))); e.put("departmentName",deptMapNew.get(e.get("dept_id")));
}); });
} }
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total); Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total);
return result; return result;
} }
...@@ -193,14 +150,8 @@ public class FireCarServiceImpl implements IFireCarService { ...@@ -193,14 +150,8 @@ public class FireCarServiceImpl implements IFireCarService {
} }
} }
fireCar.setPhotoPath(photoPath); fireCar.setPhotoPath(photoPath);
fireCar = iFireCarDao.saveAndFlush(fireCar); iFireCarDao.save(fireCar);
if(carId ==null || carId == 0){
node3dVoMapper.incrementalCreateFireCar(fireCar.getId());
}else{
node3dVoMapper.incrementalUpdateFireCar(carId);
}
return fireCar; return fireCar;
} }
......
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -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.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.ImpEquipMapper; 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.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao; import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao; import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
...@@ -41,20 +40,10 @@ public class FireEquipServiceImpl implements IFireEquipService { ...@@ -41,20 +40,10 @@ public class FireEquipServiceImpl implements IFireEquipService {
@Autowired @Autowired
IFireStationDao iFireStationDao; IFireStationDao iFireStationDao;
@Autowired
Node3dVoMapper node3dVoMapper;
public FireEquipment save(FireEquipment fireEquipment) { public FireEquipment save(FireEquipment fireEquipment) {
Long id = fireEquipment.getId(); Long id = fireEquipment.getId();
fireEquipment = iFireEquipmentDao.saveAndFlush(fireEquipment); iFireEquipmentDao.save(fireEquipment);
if(id ==null || id == 0){
node3dVoMapper.incrementalCreateFierEqumt(fireEquipment.getId());
}else{
node3dVoMapper.incrementalUpdateFierEqumt(id);
}
return fireEquipment; return fireEquipment;
} }
...@@ -77,7 +66,6 @@ public class FireEquipServiceImpl implements IFireEquipService { ...@@ -77,7 +66,6 @@ public class FireEquipServiceImpl implements IFireEquipService {
if (fireEquipment != null) { if (fireEquipment != null) {
this.iFireEquipmentDao.deleteById(Long.parseLong(id)); this.iFireEquipmentDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteFierEqumt(Long.parseLong(id));
} else { } else {
throw new Exception("找不到指定的对象:" + id); throw new Exception("找不到指定的对象:" + id);
} }
......
package com.yeejoin.amos.fas.business.service.impl; 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.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.FireStationEquipmentMapper; 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.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.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao; import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IFireStationEquipmentDao;
...@@ -29,6 +12,17 @@ import com.yeejoin.amos.fas.dao.entity.FireEquipment; ...@@ -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.FireStation;
import com.yeejoin.amos.fas.dao.entity.FireStationFireEquipment; import com.yeejoin.amos.fas.dao.entity.FireStationFireEquipment;
import com.yeejoin.amos.fas.exception.YeeException; 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") @Service("fireStationService")
public class FireStationServiceImpl implements IFireStationService { public class FireStationServiceImpl implements IFireStationService {
...@@ -48,9 +42,6 @@ public class FireStationServiceImpl implements IFireStationService { ...@@ -48,9 +42,6 @@ public class FireStationServiceImpl implements IFireStationService {
@Autowired @Autowired
IFireEquipmentDao iFireEquipmentDao; IFireEquipmentDao iFireEquipmentDao;
@Autowired
Node3dVoMapper node3dVoMapper;
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -59,12 +50,7 @@ public class FireStationServiceImpl implements IFireStationService { ...@@ -59,12 +50,7 @@ public class FireStationServiceImpl implements IFireStationService {
public FireStation save(FireStation fireStation) { public FireStation save(FireStation fireStation) {
Long id = fireStation.getId(); Long id = fireStation.getId();
fireStation = iFireStationDao.saveAndFlush(fireStation); iFireStationDao.saveAndFlush(fireStation);
if (id == null || id == 0) {
node3dVoMapper.incrementalCreateStation(fireStation.getId());
} else {
node3dVoMapper.incrementalUpdateStation(id);
}
return fireStation; return fireStation;
} }
...@@ -134,7 +120,6 @@ public class FireStationServiceImpl implements IFireStationService { ...@@ -134,7 +120,6 @@ public class FireStationServiceImpl implements IFireStationService {
} }
if (fireStation != null) { if (fireStation != null) {
this.iFireStationDao.deleteById(Long.parseLong(id)); this.iFireStationDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteStation(Long.parseLong(id));
} else { } else {
throw new Exception("找不到指定的监测点:" + id); 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; ...@@ -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.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; 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.service.model.*;
import com.yeejoin.amos.fas.business.util.DateUtils; import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.util.JexlUtil; import com.yeejoin.amos.fas.business.util.JexlUtil;
...@@ -98,9 +101,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -98,9 +101,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private FireEquipMapper fireEquipMapper; private FireEquipMapper fireEquipMapper;
@Autowired @Autowired
private Node3dVoService node3dVoService;
@Autowired
private IFireEquipmentDao iFireEquipmentDao; private IFireEquipmentDao iFireEquipmentDao;
@Autowired @Autowired
...@@ -193,15 +193,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -193,15 +193,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(oldRiskSource.getStatus()); riskSource.setStatus(oldRiskSource.getStatus());
} }
iRiskSourceDao.saveAndFlush(riskSource); 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; return riskSource;
} }
...@@ -217,12 +208,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -217,12 +208,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
iRiskSourceDao.deleteById(rId); iRiskSourceDao.deleteById(rId);
} }
//1.重新计算rpn
//1.同步数据
node3dVoService.syncData(() -> node3dVoService.incrementalRemove(Node3dVoService.DATATYPE_RISKSOURCE));
//2.3d屏数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
//3.重新计算rpn
List<Long> existIds = parentIds.stream().filter(e -> List<Long> existIds = parentIds.stream().filter(e ->
iRiskSourceDao.findById(e).isPresent() iRiskSourceDao.findById(e).isPresent()
).collect(Collectors.toList()); ).collect(Collectors.toList());
...@@ -1047,7 +1033,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1047,7 +1033,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal sidValue = new BigDecimal(fmea.getSidValue()); BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue()); BigDecimal didValue = new BigDecimal(fmea.getDidValue());
//1.1计算rpni //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; BigDecimal rpn;
//1.2计算rpn:为空则rpni = rpn;不为空则重新计算s*d*newo //1.2计算rpn:为空则rpni = rpn;不为空则重新计算s*d*newo
if (fmea.getNewEvaluationOid() == null) { if (fmea.getNewEvaluationOid() == null) {
...@@ -1055,7 +1041,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1055,7 +1041,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
rpn = rpni; rpn = rpni;
} else { } else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue()); 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(); List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels); RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels);
...@@ -1129,7 +1116,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1129,7 +1116,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal newOidValue = new BigDecimal(oEvaluationModel.getCoefficient()); BigDecimal newOidValue = new BigDecimal(oEvaluationModel.getCoefficient());
BigDecimal sidValue = new BigDecimal(fmea.getSidValue()); BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue()); 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(); List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels); RiskLevel newLevel = RpnUtils.getBetweenLevel(rpn, levels);
fmea.setRpn(rpn); fmea.setRpn(rpn);
...@@ -1149,13 +1136,14 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -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 rpnChangeLog = new RpnChangeLog();
rpnChangeLog.setRiskSourceId(riskSourceId); rpnChangeLog.setRiskSourceId(riskSourceId);
rpnChangeLog.setRpn(rpn); rpnChangeLog.setRpn(rpn);
rpnChangeLog.setRpni(rpni); rpnChangeLog.setRpni(rpni);
rpnChangeLog.setType(RpnUtils.getChangeType(rpn, rpni)); rpnChangeLog.setType(RpnUtils.getChangeType(rpn, rpni));
rpnChangeLog.setTriggerBy(fmeaId); rpnChangeLog.setTriggerBy(fmeaId);
rpnChangeLog.setTriggerType(notifyType);
rpnChangeLog.setFmeaId(fmeaId); rpnChangeLog.setFmeaId(fmeaId);
iRpnChangeLogDao.save(rpnChangeLog); iRpnChangeLogDao.save(rpnChangeLog);
} }
...@@ -1188,12 +1176,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1188,12 +1176,15 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpn(null); riskSource.setRpn(null);
riskSource.setRpni(null); riskSource.setRpni(null);
riskSource.setRiskLevelId(null); riskSource.setRiskLevelId(null);
riskSource.setFlickerFrequency(0);
//1.更新fmea对应风险点rpn、rpni、level //1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper.updateRpn(riskSource); riskSourceMapper.updateRpn(riskSource);
//2.记录风险点rpn变化流水 //2.记录风险点rpn变化流水
this.saveRpnLog(riskSource.getId(), fmeaId, resetValue, resetValue); this.saveRpnLog(riskSource.getId(), fmeaId, resetValue, resetValue, notifyType);
//3.更新父节点rpn、rpni、风险等级 //3.更新父节点rpn、rpni、风险等级
this.updateParentRpn(riskSource.getParentId()); this.updateParentRpn(riskSource.getParentId());
//4.知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
} else {//fmea评价、巡检、告警 } else {//fmea评价、巡检、告警
RpnCalculationBo rpnValueBo = RpnUtils.calRpnAndRpni(fmeas); RpnCalculationBo rpnValueBo = RpnUtils.calRpnAndRpni(fmeas);
if (rpnValueBo.isEmpty()) { if (rpnValueBo.isEmpty()) {
...@@ -1208,16 +1199,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1208,16 +1199,20 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpn(rpn); riskSource.setRpn(rpn);
riskSource.setRpni(rpni); riskSource.setRpni(rpni);
riskSource.setRiskLevelId(newRiskLevel.getId()); riskSource.setRiskLevelId(newRiskLevel.getId());
String changeType = RpnUtils.calChangeTypeByLevel(oldRiskLevel.getLevel(),newRiskLevel.getLevel());
riskSource.setFlickerFrequency(RpnUtils.calRiskPointFrequency(rpn,rpni,changeType));
//1.更新fmea对应风险点rpn、rpni、level //1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper.updateRpn(riskSource); riskSourceMapper.updateRpn(riskSource);
//2.记录风险点rpn变化流水 //2.记录风险点rpn变化流水
this.saveRpnLog(riskSource.getId(), fmeaId, rpn, rpni); this.saveRpnLog(riskSource.getId(), fmeaId, rpn, rpni, notifyType);
//3.更新父节点rpn、rpni、风险等级 //3.更新父节点rpn、rpni、风险等级
this.updateParentRpn(riskSource.getParentId()); this.updateParentRpn(riskSource.getParentId());
//4.极光推送给手机客户端 //4.极光推送给手机客户端
jpushRiskSourceMessage("风险预警", jpushTargets); jpushRiskSourceMessage("风险预警", jpushTargets);
//5.规则告警(消息)TODO //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 { ...@@ -1232,6 +1227,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public void notifyRiskSourceDelete(Long parentId) { public void notifyRiskSourceDelete(Long parentId) {
//1.风险点删除触发更新父节点rpn、rpni、风险等级 //1.风险点删除触发更新父节点rpn、rpni、风险等级
this.updateParentRpn(parentId); this.updateParentRpn(parentId);
//2.通知全景监控屏幕数据刷新
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
} }
private void updateParentRpn(long parentId) { private void updateParentRpn(long parentId) {
...@@ -1289,7 +1286,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1289,7 +1286,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
ids.add(riskSource.getId()); ids.add(riskSource.getId());
} }
} }
iDataRefreshService.refreshViewData(DataRefreshTypeEum.rpn.getCode());
} }
/** /**
...@@ -1310,31 +1306,18 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1310,31 +1306,18 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
/** /**
* 规则告警 * 规则告警
*/ */
private void notifyRule(Long id, BigDecimal rpnr, BigDecimal rpni, Integer oldLevel, Integer newLevel, String private void notifyRule(
notifyType) { Long id,
int level = oldLevel - newLevel; BigDecimal rpnr,
String changeType; BigDecimal rpni,
if (level > 0) { String notifyType,
changeType = "up"; String changeType) {
} else if (level == 0) {
changeType = "no";
} else {
changeType = "down";
}
RiskSourceRuleRo riskSourceRuleRo = new RiskSourceRuleRo(); RiskSourceRuleRo riskSourceRuleRo = new RiskSourceRuleRo();
riskSourceRuleRo.setId(id); riskSourceRuleRo.setId(id);
riskSourceRuleRo.setRpnr(rpnr); riskSourceRuleRo.setRpnr(rpnr);
riskSourceRuleRo.setRpni(rpni); riskSourceRuleRo.setRpni(rpni);
riskSourceRuleRo.setLevelChangeType(changeType); riskSourceRuleRo.setLevelChangeType(changeType);
riskSourceRuleRo.setNotifyType(notifyType); 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 { try {
remoteRuleServer.fireRule(riskSourceRuleRo, "风险管控/riskSource"); remoteRuleServer.fireRule(riskSourceRuleRo, "风险管控/riskSource");
} catch (Exception e) { } catch (Exception e) {
......
package com.yeejoin.amos.fas.business.service.impl; 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.mapper.WaterResourceMapper;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao; import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceEquipmentDao;
...@@ -19,6 +8,15 @@ import com.yeejoin.amos.fas.core.common.request.CommonPageable; ...@@ -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.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.WaterResource; import com.yeejoin.amos.fas.dao.entity.WaterResource;
import com.yeejoin.amos.fas.dao.entity.WaterResourceEquipment; 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") @Service("waterResourceService")
public class WaterResourceServiceImpl implements IWaterResourceService { public class WaterResourceServiceImpl implements IWaterResourceService {
...@@ -33,20 +31,12 @@ public class WaterResourceServiceImpl implements IWaterResourceService { ...@@ -33,20 +31,12 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
@Autowired @Autowired
IWaterResourceEquipmentDao iWaterResourceEquipmentDao; IWaterResourceEquipmentDao iWaterResourceEquipmentDao;
@Autowired
Node3dVoMapper node3dVoMapper;
@Override
public WaterResource save(WaterResource waterResource) public WaterResource save(WaterResource waterResource)
{ {
Long id = waterResource.getId(); Long id = waterResource.getId();
waterResource = iWaterResourceDao.saveAndFlush(waterResource); waterResource = iWaterResourceDao.saveAndFlush(waterResource);
if(id ==null || id == 0){
node3dVoMapper.incrementalCreateWater(waterResource.getId());
}else{
node3dVoMapper.incrementalUpdateWater(id);
}
return waterResource; return waterResource;
} }
...@@ -68,7 +58,6 @@ public class WaterResourceServiceImpl implements IWaterResourceService { ...@@ -68,7 +58,6 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
if(waterResource != null) if(waterResource != null)
{ {
this.iWaterResourceDao.deleteById(Long.parseLong(id)); this.iWaterResourceDao.deleteById(Long.parseLong(id));
node3dVoMapper.incrementalDeleteWater(Long.parseLong(id));
}else }else
{ {
throw new Exception("找不到指定的监测点:"+id); 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; ...@@ -17,10 +17,11 @@ import java.util.List;
public class RpnUtils { public class RpnUtils {
/** /**
* 计算风险值 * 计算风险值
*
* @param fmeas * @param fmeas
* @return RpnCalculationBo * @return RpnCalculationBo
*/ */
public static RpnCalculationBo calRpnAndRpni(List<Fmea> fmeas){ public static RpnCalculationBo calRpnAndRpni(List<Fmea> fmeas) {
BigDecimal maxSidValue = new BigDecimal("0"); BigDecimal maxSidValue = new BigDecimal("0");
BigDecimal maxDidValue = new BigDecimal("0"); BigDecimal maxDidValue = new BigDecimal("0");
BigDecimal totalOidValue = new BigDecimal("0"); BigDecimal totalOidValue = new BigDecimal("0");
...@@ -48,10 +49,10 @@ public class RpnUtils { ...@@ -48,10 +49,10 @@ public class RpnUtils {
if (count == 0) { if (count == 0) {
return rpnValue; return rpnValue;
} }
BigDecimal averageOidValue = totalOidValue.divide(BigDecimal.valueOf(count),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 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 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 rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue).setScale(2, BigDecimal.ROUND_HALF_UP);
rpnValue.setRpn(rpn); rpnValue.setRpn(rpn);
rpnValue.setRpni(rpni); rpnValue.setRpni(rpni);
return rpnValue; return rpnValue;
...@@ -59,6 +60,7 @@ public class RpnUtils { ...@@ -59,6 +60,7 @@ public class RpnUtils {
/** /**
* 计算最大故障率 * 计算最大故障率
*
* @param equipmentPoints * @param equipmentPoints
* @param pointInputitems * @param pointInputitems
* @return * @return
...@@ -107,6 +109,7 @@ public class RpnUtils { ...@@ -107,6 +109,7 @@ public class RpnUtils {
/** /**
* 获得风险等级 * 获得风险等级
*
* @param rpni * @param rpni
* @param levels * @param levels
* @return * @return
...@@ -127,18 +130,56 @@ public class RpnUtils { ...@@ -127,18 +130,56 @@ public class RpnUtils {
/** /**
* 获取风险变化类型 * 获取风险变化类型
* @param rpn *
* @param rpni * @param rpn 实时
* @return * @param rpni 固有
* @return int
*/ */
public static int getChangeType(BigDecimal rpn, BigDecimal rpni) { public static int getChangeType(BigDecimal rpn, BigDecimal rpni) {
if(rpn.subtract(rpni).doubleValue() > 0){ if (rpn.subtract(rpni).doubleValue() > 0) {
return RpnChangeLogTypeEum.upper.getCode(); return RpnChangeLogTypeEum.upper.getCode();
} else if(rpn.subtract(rpni).doubleValue() < 0){ } else if (rpn.subtract(rpni).doubleValue() < 0) {
return RpnChangeLogTypeEum.down.getCode(); return RpnChangeLogTypeEum.down.getCode();
} else { } else {
return RpnChangeLogTypeEum.unChange.getCode(); 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,7 +19,43 @@ public class View3dNodeVo { ...@@ -19,7 +19,43 @@ public class View3dNodeVo {
private String[] relationKeys; private String[] relationKeys;
private String level; private String level;
private String levelStr; 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() { public Long getId() {
return id; return id;
} }
......
...@@ -206,7 +206,9 @@ ...@@ -206,7 +206,9 @@
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1588990926789-1"> <changeSet author="suhuiguang" id="1588990926789-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<columnExists tableName="f_risk_level " columnName="manage_level"/> <not>
<columnExists tableName="f_risk_level " columnName="manage_level"/>
</not>
</preConditions> </preConditions>
<comment>f_risk_level add column manage_level 管控级别</comment> <comment>f_risk_level add column manage_level 管控级别</comment>
<sql> <sql>
...@@ -214,4 +216,28 @@ ...@@ -214,4 +216,28 @@
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别'; add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql> </sql>
</changeSet> </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> </databaseChangeLog>
\ No newline at end of file
...@@ -81,24 +81,6 @@ ...@@ -81,24 +81,6 @@
</sql> </sql>
</changeSet> </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"> <changeSet author="tianbo" id="1561717770000-1" runOnChange="true">
<comment>f_fire_equipment_point_update 触发器创建(修改判断条件为->value等于'true')</comment> <comment>f_fire_equipment_point_update 触发器创建(修改判断条件为->value等于'true')</comment>
<sql endDelimiter="#"> <sql endDelimiter="#">
......
...@@ -672,6 +672,9 @@ ...@@ -672,6 +672,9 @@
<if test="riskLevelId != null"> <if test="riskLevelId != null">
risk_level_id = #{riskLevelId}, risk_level_id = #{riskLevelId},
</if> </if>
<if test="flicker_frequency != null">
flicker_frequency = #{flicker_frequency}
</if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -205,7 +205,10 @@ ...@@ -205,7 +205,10 @@
<choose> <choose>
<when test="type == 'riskSource'"> <when test="type == 'riskSource'">
select rs.id,rs.name,rs.code,rs.ue4_location as ue4Location,rs.ue4_rotation as ue4Rotation,rs.position3d, 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 from f_risk_source rs
left join f_risk_level rl ON rl.id = rs.risk_level_id left join f_risk_level rl ON rl.id = rs.risk_level_id
where 1=1 where 1=1
...@@ -218,8 +221,27 @@ ...@@ -218,8 +221,27 @@
</when> </when>
<when test="type == 'patrol'"> <when test="type == 'patrol'">
select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,coordinates as position3d, 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 status,floor as floor3d,is_indoor as isIndoor,
from p_point 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 where 1=1 and is_delete = 0
<if test="pointId != null"> <if test="pointId != null">
AND id = #{pointId} AND id = #{pointId}
...@@ -230,7 +252,10 @@ ...@@ -230,7 +252,10 @@
</when> </when>
<when test="type == 'impEquipment'"> <when test="type == 'impEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_equipment
where 1=1 where 1=1
<if test="pointId != null"> <if test="pointId != null">
...@@ -242,7 +267,10 @@ ...@@ -242,7 +267,10 @@
</when> </when>
<when test="type == 'monitorEquipment'"> <when test="type == 'monitorEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_fire_equipment
where equip_classify = 0 where equip_classify = 0
<if test="pointId != null"> <if test="pointId != null">
...@@ -254,7 +282,10 @@ ...@@ -254,7 +282,10 @@
</when> </when>
<when test="type == 'video'"> <when test="type == 'video'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_fire_equipment
where equip_classify = 2 where equip_classify = 2
<if test="pointId != null"> <if test="pointId != null">
...@@ -266,7 +297,10 @@ ...@@ -266,7 +297,10 @@
</when> </when>
<when test="type == 'hydrant'"> <when test="type == 'hydrant'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_water_resource
where type = 1 where type = 1
<if test="pointId != null"> <if test="pointId != null">
...@@ -278,7 +312,10 @@ ...@@ -278,7 +312,10 @@
</when> </when>
<when test="type == 'pool'"> <when test="type == 'pool'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_water_resource
where type = 2 where type = 2
<if test="pointId != null"> <if test="pointId != null">
...@@ -290,7 +327,10 @@ ...@@ -290,7 +327,10 @@
</when> </when>
<when test="type == 'fireCar'"> <when test="type == 'fireCar'">
select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_fire_car
where 1=1 where 1=1
<if test="pointId != null"> <if test="pointId != null">
...@@ -302,7 +342,10 @@ ...@@ -302,7 +342,10 @@
</when> </when>
<when test="type == 'fireEquipment'"> <when test="type == 'fireEquipment'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_fire_equipment
where equip_classify = 3 where equip_classify = 3
<if test="pointId != null"> <if test="pointId != null">
...@@ -314,7 +357,10 @@ ...@@ -314,7 +357,10 @@
</when> </when>
<when test="type == 'fireChamber'"> <when test="type == 'fireChamber'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_fire_station
where type = 1 where type = 1
<if test="pointId != null"> <if test="pointId != null">
...@@ -326,7 +372,10 @@ ...@@ -326,7 +372,10 @@
</when> </when>
<when test="type == 'fireFoamRoom'"> <when test="type == 'fireFoamRoom'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d, 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 from f_fire_station
where type = 2 where type = 2
<if test="pointId != null"> <if test="pointId != null">
...@@ -549,10 +598,15 @@ ...@@ -549,10 +598,15 @@
'riskSource' as type, 'riskSource' as type,
rl.level, rl.level,
CONCAT('level_',rl.level) as level_str, CONCAT('level_',rl.level) as level_str,
R.id as risk_source_id R.id as risk_source_id,
from f_risk_source R r.flicker_frequency as frequency,
left join f_risk_level rl on rl.id = r.risk_level_id true as 'showInfo',
where is_region <![CDATA[<>]]> 'TRUE' AND status = 'ANOMALY' 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},'%') AND R.org_code like CONCAT(#{orgCode},'%')
UNION ALL UNION ALL
select select
...@@ -560,9 +614,24 @@ ...@@ -560,9 +614,24 @@
'patrol' as type, 'patrol' as type,
p.status as level, p.status as level,
CONCAT('level_',p.status) as level_str, 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 from p_point p
where status in (0,2,3) where status in ('0','2','3')
AND p.org_code like CONCAT(#{orgCode},'%') AND p.org_code like CONCAT(#{orgCode},'%')
UNION ALL UNION ALL
select select
...@@ -570,7 +639,10 @@ ...@@ -570,7 +639,10 @@
'impEquipment' as type, 'impEquipment' as type,
0 as level, 0 as level,
'level_0' as kevek_str, 'level_0' as kevek_str,
e.risk_source_id e.risk_source_id,
0 as frequency,
false as 'showInfo',
'' as title
from from
f_equipment e f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
...@@ -621,18 +693,20 @@ ...@@ -621,18 +693,20 @@
END positionDTO, END positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO, '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO, '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
false showInfo, true as showInfo,
rs. CODE title, rs.rpn as title,
'riskSource' type, 'riskSource' type,
rs.org_code as orgCode, rs.org_code as orgCode,
rs.id as riskSourceId rs.id as riskSourceId,
FROM rs.flicker_frequency as frequency
FROM
f_risk_source rs f_risk_source rs
LEFT JOIN f_risk_level rl ON rl.id = rs.risk_level_id LEFT JOIN f_risk_level rl ON rl.id = rs.risk_level_id
WHERE WHERE
rs.position3d IS NOT NULL rs.position3d IS NOT NULL
AND rs.position3d != '' AND rs.position3d != ''
AND rs.risk_level_id is not null AND rs.risk_level_id is not null
AND rs.is_region <![CDATA[<>]]> 'TRUE'
AND rs.status = 'ANOMALY' AND rs.status = 'ANOMALY'
UNION ALL UNION ALL
SELECT SELECT
...@@ -665,12 +739,13 @@ ...@@ -665,12 +739,13 @@
END positionDTO, END positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO, '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO, '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE showInfo, FALSE as showInfo,
CODE title, name as title,
'impEquipment' type, 'impEquipment' type,
eq.org_code as orgCode, eq.org_code as orgCode,
eq.risk_source_id as riskSourceId eq.risk_source_id as riskSourceId,
FROM 0 as frequency
FROM
f_equipment eq f_equipment eq
WHERE WHERE
position3d IS NOT NULL position3d IS NOT NULL
...@@ -711,16 +786,22 @@ ...@@ -711,16 +786,22 @@
END positionDTO, END positionDTO,
'{ "x": 0, "y": 0, "z": 0 }' rotationDTO, '{ "x": 0, "y": 0, "z": 0 }' rotationDTO,
'{ "x": 1, "y": 1, "z": 1 }' scaleDTO, '{ "x": 1, "y": 1, "z": 1 }' scaleDTO,
FALSE showInfo, case p.status
p.point_no title, when '0'
'patrol' as type, then false
else
true
end as `showInfo`,
p.name as title,
'patrol' as type,
p.org_code as orgCode, p.org_code as orgCode,
p.risk_source_id as riskSourceId p.risk_source_id as riskSourceId,
0 as frequency
from from
p_point p p_point p
left join f_risk_source rs on p.risk_source_id = rs.id AND rs.is_region='TRUE' left join f_risk_source rs on p.risk_source_id = rs.id AND rs.is_region='TRUE'
where rs.id is not null 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 AND p.coordinates != '' AND p.coordinates is not null
) temp ) temp
WHERE 1=1 WHERE 1=1
......
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
<url>http://172.16.1.6:8081/nexus/content/repositories/maven-public/</url> <url>http://172.16.1.6:8081/nexus/content/repositories/maven-public/</url>
</repository> </repository>
<repository> <repository>
<id>maven-public</id> <id>maven-public-ty</id>
<name>maven-public</name> <name>maven-public</name>
<url>http://repo.typroject.org:8081/repository/maven-public/</url> <url>http://repo.typroject.org:8081/repository/maven-public/</url>
</repository> </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