Commit 1553b8b0 authored by 田涛's avatar 田涛

Merge remote-tracking branch 'origin/dev_upgrade-1225' into dev_upgrade-1225

parents 2b7da872 78ba6319
...@@ -94,8 +94,12 @@ public class EquipmentSpecificController extends BaseController{ ...@@ -94,8 +94,12 @@ public class EquipmentSpecificController extends BaseController{
@RequestParam(value = "name",required = false) String name, @RequestParam(value = "name",required = false) String name,
@RequestParam(value = "pageNumber",required = false) int pageNumber, @RequestParam(value = "pageNumber",required = false) int pageNumber,
@RequestParam(value = "pageSize",required = false) int pageSize, @RequestParam(value = "pageSize",required = false) int pageSize,
@RequestParam(value = "equipmentId",required = false) Long equipmentId ) { @RequestParam(value = "equipmentId",required = false) String equipmentId ) {
return CommonResponseUtil.success(equipmentSpecificService.getEquipmentBySpeV2(name, pageNumber, pageSize,equipmentId)); Long aLong = null;
if (!"null".equals(equipmentId) && equipmentId != null && !"".equals(equipmentId.trim())){
aLong = Long.valueOf(equipmentId);
}
return CommonResponseUtil.success(equipmentSpecificService.getEquipmentBySpeV2(name, pageNumber, pageSize,aLong));
} }
@GetMapping(value = "/list-tree", produces = "application/json;charset=UTF-8") @GetMapping(value = "/list-tree", produces = "application/json;charset=UTF-8")
......
...@@ -22,6 +22,7 @@ import java.util.stream.Collectors; ...@@ -22,6 +22,7 @@ import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.fas.business.util.DataSyncUtil;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -226,6 +227,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -226,6 +227,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private PlanDetailMapper planDetailMapper; private PlanDetailMapper planDetailMapper;
@Autowired
private DataSyncUtil dataSyncUtil;
public static String cacheKeyForCanBeRunning() { public static String cacheKeyForCanBeRunning() {
return Redis.genKey(CacheType.ERASABLE.name(), "CONTINGENCYRUNING"); return Redis.genKey(CacheType.ERASABLE.name(), "CONTINGENCYRUNING");
} }
...@@ -233,6 +237,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -233,6 +237,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Autowired @Autowired
private IDataRefreshService iDataRefreshService; private IDataRefreshService iDataRefreshService;
@Autowired
private WebMqttComponent webMqttComponent;
@Override @Override
public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception { public RiskSource editRiskSource(HashMap<String, Object> map) throws Exception {
RiskSource riskSource = (RiskSource) map.get("param"); RiskSource riskSource = (RiskSource) map.get("param");
...@@ -259,10 +266,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -259,10 +266,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(oldRiskSource.getStatus()); riskSource.setStatus(oldRiskSource.getStatus());
} }
iRiskSourceDao.saveAndFlush(riskSource); iRiskSourceDao.saveAndFlush(riskSource);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
return riskSource; return riskSource;
} }
@Override @Override
@Transactional
public void deleteRiskSource(String appKey, String product, String token, String success, Long[] riskSourceId) throws Exception { public void deleteRiskSource(String appKey, String product, String token, String success, Long[] riskSourceId) throws Exception {
Set<Long> parentIds = new LinkedHashSet<>(); Set<Long> parentIds = new LinkedHashSet<>();
for (Long rId : riskSourceId) { for (Long rId : riskSourceId) {
...@@ -278,6 +287,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -278,6 +287,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
//1、删除风险点 //1、删除风险点
iRiskSourceDao.deleteById(rId); iRiskSourceDao.deleteById(rId);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_DELETE_BY_ID.getValue(), String.valueOf(rId)), String.valueOf(rId));
//2.删除关联建筑关系,防止对站服务有问题,捕获异常,不影响业务正常秩序 //2.删除关联建筑关系,防止对站服务有问题,捕获异常,不影响业务正常秩序
try { try {
rs.ifPresent(r->{ rs.ifPresent(r->{
...@@ -302,6 +312,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -302,6 +312,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override @Override
public void deleteById(Long id) { public void deleteById(Long id) {
iRiskSourceDao.deleteById(id); iRiskSourceDao.deleteById(id);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_DELETE_BY_ID.getValue(), String.valueOf(id)), String.valueOf(id));
} }
@Override @Override
...@@ -322,6 +333,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -322,6 +333,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fillBasicParams(userId, orgCode, synBo.getId(), riskSource); fillBasicParams(userId, orgCode, synBo.getId(), riskSource);
riskSource = iRiskSourceDao.save(riskSource); riskSource = iRiskSourceDao.save(riskSource);
} }
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
//2.同步下级(只有一级) //2.同步下级(只有一级)
if(!CollectionUtils.isEmpty(synBo.getChildren())){ if(!CollectionUtils.isEmpty(synBo.getChildren())){
RiskSource finalRiskSource = riskSource; RiskSource finalRiskSource = riskSource;
...@@ -333,6 +345,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -333,6 +345,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return t; return t;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
iRiskSourceDao.saveAll(children); iRiskSourceDao.saveAll(children);
dataSyncUtil.astDataSync(com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE_ALL.getValue(), JSON.toJSONString(children));
} }
return riskSource; return riskSource;
} }
...@@ -354,6 +367,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -354,6 +367,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
RiskSource riskSource = exist.get(); RiskSource riskSource = exist.get();
riskSource.setSourceId(null); riskSource.setSourceId(null);
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
} }
return exist.isPresent(); return exist.isPresent();
} }
...@@ -1293,8 +1307,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1293,8 +1307,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
// } // }
// } // }
@Autowired
private WebMqttComponent webMqttComponent;
@Value("${autoSys.push.type}") @Value("${autoSys.push.type}")
private String pushType; private String pushType;
@Value("${spring.application.name}") @Value("${spring.application.name}")
...@@ -1818,6 +1830,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1818,6 +1830,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpni(null); riskSource.setRpni(null);
riskSource.setRiskLevelId(null); riskSource.setRiskLevelId(null);
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
return; return;
} }
BigDecimal rpn = rpnValueBo.getRpn(); BigDecimal rpn = rpnValueBo.getRpn();
...@@ -1831,6 +1844,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1831,6 +1844,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
} }
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
this.updateParentRpn(riskSource.getParentId()); this.updateParentRpn(riskSource.getParentId());
} }
} }
......
...@@ -16,6 +16,7 @@ import java.util.Set; ...@@ -16,6 +16,7 @@ import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.fas.business.util.DataSyncUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -118,6 +119,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -118,6 +119,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
@Autowired
private DataSyncUtil dataSyncUtil;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) { public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) {
...@@ -248,6 +252,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -248,6 +252,7 @@ public class View3dServiceImpl implements IView3dService {
if(ue4Rotation != null) riskSource.setUe4Rotation(pointBo.getUe4Rotation()); if(ue4Rotation != null) riskSource.setUe4Rotation(pointBo.getUe4Rotation());
if(position3d != null) riskSource.setPosition3d(position3d); if(position3d != null) riskSource.setPosition3d(position3d);
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
dataSyncUtil.astDataSync(String.join("_", com.yeejoin.dataprocess.common.enums.AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
} }
} }
......
package com.yeejoin.amos.fas.business.util;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
/**
* @ProjectName: YeeAmosFireAutoSysRoot
* @Package: com.yeejoin.amos.fas.business.util
* @ClassName: DataSyncUtil
* @Author: Jianqiang Gao
* @Description: 数据同步工具类
* @Date: 2021/3/24 15:31
* @Version: 1.0
*/
@Component
public class DataSyncUtil {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private WebMqttComponent webMqttComponent;
public void astDataSync(String topic, String message) {
redisTemplate.opsForValue().set(topic, message);
webMqttComponent.publish(topic.substring(0, topic.lastIndexOf("_")), message);
}
}
\ No newline at end of file
package com.yeejoin.dataprocess.common.enums;
/**
* @ProjectName: YeeFireDataProcessRoot
* @Package: com.yeejoin.dataprocess.common.enums
* @ClassName: TopicName
* @Author: Jianqiang Gao
* @Description: TopicName
* @Date: 2021/3/23 15:55
* @Version: 1.0
*/
public enum AstDataSyncTopic {
AST_REGION_SAVE(10, "ast_save"),
AST_REGION_SAVE_ALL(11, "ast_save_all"),
AST_REGION_DELETE_BY_ID(12, "ast_delete_by_id");
private final Integer key;
private final String value;
private AstDataSyncTopic(Integer key, String value) {
this.key = key;
this.value = value;
}
public Integer getKey() {
return key;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return this.value;
}
}
\ No newline at end of file
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
left join wl_equipment_category as cate on equ.category_id = cate.id left join wl_equipment_category as cate on equ.category_id = cate.id
left join f_fire_fighting_system as manage on spe.system_id = manage.id left join f_fire_fighting_system as manage on spe.system_id = manage.id
where sto.amount <![CDATA[>]]> 0 where sto.amount <![CDATA[>]]> 0
and spe.id is not null
<if test="name != null and name!='null' "> <if test="name != null and name!='null' ">
and (det.name like CONCAT('%',#{name},'%') or ware.full_name like CONCAT('%',#{name},'%') or spe.iot_code like CONCAT('%',#{name},'%') or spe.code like CONCAT('%',#{name},'%')) and (det.name like CONCAT('%',#{name},'%') or ware.full_name like CONCAT('%',#{name},'%') or spe.iot_code like CONCAT('%',#{name},'%') or spe.code like CONCAT('%',#{name},'%'))
</if> </if>
...@@ -83,6 +84,7 @@ ...@@ -83,6 +84,7 @@
left join wl_equipment_category as cate on equ.category_id = cate.id left join wl_equipment_category as cate on equ.category_id = cate.id
left join f_fire_fighting_system as manage on spe.system_id = manage.id left join f_fire_fighting_system as manage on spe.system_id = manage.id
where sto.amount <![CDATA[>]]> 0 where sto.amount <![CDATA[>]]> 0
and spe.id is not null
<if test="name != null and name!='null' "> <if test="name != null and name!='null' ">
and (det.name like CONCAT('%',#{name},'%') or ware.full_name like CONCAT('%',#{name},'%') or spe.iot_code like CONCAT('%',#{name},'%') or spe.code like CONCAT('%',#{name},'%')) and (det.name like CONCAT('%',#{name},'%') or ware.full_name like CONCAT('%',#{name},'%') or spe.iot_code like CONCAT('%',#{name},'%') or spe.code like CONCAT('%',#{name},'%'))
</if> </if>
......
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