Commit b27b1f36 authored by KeYong's avatar KeYong

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

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
parents d7de83d4 6c3f38a9
package com.yeejoin.amos.fas.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
...@@ -7,8 +7,10 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -7,8 +7,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.typroject.tyboot.core.foundation.utils.TreeNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
...@@ -22,7 +24,7 @@ import java.util.List; ...@@ -22,7 +24,7 @@ import java.util.List;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("wl_equipment_category") @TableName("wl_equipment_category")
@ApiModel(value="EquipmentCategory装备分类实体", description="装备分类") @ApiModel(value="EquipmentCategory装备分类实体", description="装备分类")
public class EquipmentCategory extends BaseEntity { public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentCategory, Long> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -57,4 +59,23 @@ public class EquipmentCategory extends BaseEntity { ...@@ -57,4 +59,23 @@ public class EquipmentCategory extends BaseEntity {
@TableField(exist=false) @TableField(exist=false)
private List<EquipmentCategory> children = new ArrayList<>(); //子集 private List<EquipmentCategory> children = new ArrayList<>(); //子集
@Override
public Long getMyParentId() {
return parentId;
}
@Override
public Long getMyId() {
return getId();
}
@Override
public void setChildren(Collection<EquipmentCategory> collection) {
this.children = new ArrayList<>(collection);
}
@Override
public int compareTo(EquipmentCategory o) {
return this.getId().compareTo(o.getId());
}
} }
package com.yeejoin.amos.fas.dao.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@Data
public class EquipmentExcelData {
@Excel(name = "设备编号", orderNum = "1", width = 36)
private String equipCode;
@Excel(name = "设备名称", orderNum = "2", width = 24)
private String equipName;
@Excel(name = "所属区域", orderNum = "3", width = 24)
private String areaCode;
@Excel(name = "位置", orderNum = "4", width = 50)
private String position;
}
\ No newline at end of file
...@@ -102,21 +102,6 @@ ...@@ -102,21 +102,6 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> --> </dependency> -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>3.0.3</version>
</dependency>
<dependency> <dependency>
<groupId>com.itextpdf</groupId> <groupId>com.itextpdf</groupId>
......
package com.yeejoin.amos.fas.business.action; package com.yeejoin.amos.fas.business.action;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -38,7 +12,6 @@ import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext; ...@@ -38,7 +12,6 @@ import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent; import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo; import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.model.DeviceRo; import com.yeejoin.amos.fas.business.action.model.DeviceRo;
import com.yeejoin.amos.fas.business.action.model.SetpEnum;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent; import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.result.ActionResult; import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult; import com.yeejoin.amos.fas.business.action.result.SafteyPlanResult;
...@@ -66,6 +39,25 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; ...@@ -66,6 +39,25 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.PlanDetail; import com.yeejoin.amos.fas.dao.entity.PlanDetail;
import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord; import com.yeejoin.amos.fas.dao.entity.PlanOperationRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//import com.yeejoin.amos.fas.business.service.intfc.FireStengthService; //import com.yeejoin.amos.fas.business.service.intfc.FireStengthService;
...@@ -355,13 +347,13 @@ public class ContingencyAction implements CustomerAction { ...@@ -355,13 +347,13 @@ public class ContingencyAction implements CustomerAction {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/DD HH:mm:ss"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE"); List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>(); ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) { if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> { list.forEach(action -> {
HashMap map = new HashMap(); HashMap map = new HashMap();
map.put("time", sdf.format(action.getCreateDate())); map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent()); map.put("stepName", action.getContent());
records.add(map); records.add(map);
}); });
...@@ -562,13 +554,14 @@ public class ContingencyAction implements CustomerAction { ...@@ -562,13 +554,14 @@ public class ContingencyAction implements CustomerAction {
SafteyPlanResult result = new SafteyPlanResult(); SafteyPlanResult result = new SafteyPlanResult();
Map<String, Object> tempmap1 = new HashMap<>(); Map<String, Object> tempmap1 = new HashMap<>();
try { try {
SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/DD HH:mm:ss"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE"); List<ContingencyPlanInstance> list = iContingencyInstance.queryForTimeLine(contingencyRo.getBatchNo(), "MESSAGE");
ArrayList records = new ArrayList<>(); ArrayList records = new ArrayList<>();
if (!ObjectUtils.isEmpty(list)) { if (!ObjectUtils.isEmpty(list)) {
list.forEach(action -> { list.forEach(action -> {
HashMap map = new HashMap(); HashMap map = new HashMap();
map.put("time", sdf.format(action.getCreateDate())); // map.put("time", sdf.format(action.getCreateDate()));
map.put("time", sdf1.format(action.getCreateDate().getTime()));
map.put("stepName", action.getContent()); map.put("stepName", action.getContent());
records.add(map); records.add(map);
}); });
......
...@@ -16,7 +16,7 @@ public class ContingencyRo implements Serializable { ...@@ -16,7 +16,7 @@ public class ContingencyRo implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1863437780244849215L; private static final long serialVersionUID = -6721135143373410586L;
@Label("消防设备名称") @Label("消防设备名称")
private String fireEquipmentName;//消防设备名称 private String fireEquipmentName;//消防设备名称
@Label("消防设备id") @Label("消防设备id")
......
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.yeejoin.amos.fas.business.util.ExcelUtils;
import com.yeejoin.amos.fas.core.util.*; import com.yeejoin.amos.fas.core.util.*;
import com.yeejoin.amos.fas.dao.entity.EquipmentExcelData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -31,6 +34,8 @@ import io.swagger.annotations.Api; ...@@ -31,6 +34,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import javax.servlet.http.HttpServletResponse;
@RestController @RestController
@RequestMapping(value = "/api/impEquip") @RequestMapping(value = "/api/impEquip")
@Api(tags = "重点设备api") @Api(tags = "重点设备api")
...@@ -319,4 +324,29 @@ public class EquipmentController extends BaseController { ...@@ -319,4 +324,29 @@ public class EquipmentController extends BaseController {
return CommonResponseUtil.success(iEquipService.findFireEquipDataByPointCode(code)); return CommonResponseUtil.success(iEquipService.findFireEquipDataByPointCode(code));
} }
/**
* 模板下载
*
* @return
*/
@Permission
@RequestMapping(value = "/downTemplate")
@ApiOperation(httpMethod = "GET", value = "下载模板", notes = "下载模板")
public void downTemplate(HttpServletResponse response) {
ExcelUtils.exportExcel(new ArrayList<EquipmentExcelData>(), "电力设备信息", "导入模板", EquipmentExcelData.class, "电力设备模板.xls", response);
}
/**
* 电力设备信息导入
*
* @return
*/
@RequestMapping(value = "/uploadList")
@ApiOperation(httpMethod = "POST", value = "导入", notes = "导入")
public Object uploadList(MultipartFile file) {
List<EquipmentExcelData> list = ExcelUtils.importExcel(file, 1, 1, EquipmentExcelData.class);
iEquipService.uploadList(list, getOrgCode(getSelectedOrgInfo()));
return CommonResponseUtil.success();
}
} }
...@@ -88,7 +88,19 @@ public class EquipmentSpecificController extends BaseController{ ...@@ -88,7 +88,19 @@ public class EquipmentSpecificController extends BaseController{
return CommonResponseUtil.success(equipmentSpecificService.getEquipmentBySpe(name, code, pageNumber, pageSize,equipmentId)); return CommonResponseUtil.success(equipmentSpecificService.getEquipmentBySpe(name, code, pageNumber, pageSize,equipmentId));
} }
@GetMapping(value = "/getEquipmentBySpeV2")
@ApiOperation(httpMethod = "GET", value = "获取装备台账信息", notes = "获取装备台账信息")
public CommonResponse getEquipmentBySpeV2(
@RequestParam(value = "name",required = false) String name,
@RequestParam(value = "pageNumber",required = false) int pageNumber,
@RequestParam(value = "pageSize",required = false) int pageSize,
@RequestParam(value = "equipmentId",required = false) String 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")
@ApiOperation(httpMethod = "GET", value = "全量数据树形结构返回", notes = "全量数据树形结构返回") @ApiOperation(httpMethod = "GET", value = "全量数据树形结构返回", notes = "全量数据树形结构返回")
......
package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.feign.OutTokenLoginFeign;
import com.yeejoin.amos.fas.business.feign.PrivilegeFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.vo.CompanyBo;
import com.yeejoin.amos.fas.business.vo.DepartmentBo;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.business.vo.RoleBo;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zjw
* @date 2020-03-30
*/
@RestController
@RequestMapping(value = "/api/loginBytoken")
@Api(tags = "外部token登录Api")
public class TokenLoginController {
private static final Logger logger = LoggerFactory.getLogger(TokenLoginController.class);
@Autowired
private OutTokenLoginFeign outTokenLoginFeign;
@Autowired
private PrivilegeFeign privilegeFeign;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Value("${outSystem.user.password}")
private String password;
@Value("${security.productWeb}")
private String product;
@Value("${security.appKeyWeb}")
private String appKey;
@ApiOperation(value = "外部token登錄", notes = "查询设备指标")
@GetMapping(value = "/{token}")
synchronized public ReginParams getBindEquipment(@PathVariable("token") String outToken) throws Exception {
if ( ObjectUtils.isEmpty(outToken)) {
throw new Exception("token异常");
}
String userId = "wk";
// String userId = outTokenLoginFeign.getUserName(outToken);
if (ObjectUtils.isEmpty(userId)){
throw new Exception("用户信息不存在");
}
ReginParams reginParams;
reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, outToken)), ReginParams.class);
if(reginParams == null){
reginParams = new ReginParams();
Map<String, String> param = new HashMap<>();
param.put("loginId",userId);
param.put("password",password);
Object result = privilegeFeign.login(appKey, product, outToken, param).getResult();
if (ObjectUtils.isEmpty(result)){
throw new Exception("缺失登录信息");
}
Map<String ,String > re = (Map<String ,String >) result;
String token = re.get("token");
privilegeFeign.warrant(appKey,product,token);
RequestContext.setToken(token);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
AgencyUserModel userModel = (AgencyUserModel) Privilege.agencyUserClient.getme().getResult();
CompanyModel companyModel = userModel.getCompanys().get(0);
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
reginParams.setDepartment(departmentBo);
reginParams.setCompany(companyBo);
}
reginParams.setToken(token);
reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams));
redisTemplate.opsForValue().set(buildKey(userId, outToken), JSONObject.toJSONString(reginParams));
}
return reginParams;
}
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
DepartmentBo departmentBo = new DepartmentBo();
if(departmentModel != null) {
departmentBo.setCompanySeq(departmentModel.getCompanySeq().toString());
departmentBo.setDepartmentDesc(departmentModel.getDepartmentDesc());
departmentBo.setDepartmentName(departmentModel.getDepartmentName());
departmentBo.setLevel(departmentModel.getLevel());
departmentBo.setOrgCode(departmentModel.getOrgCode());
departmentBo.setParentId(departmentModel.getParentId().toString());
departmentBo.setDeptOrgCode(departmentModel.getDeptOrgCode().toString());
departmentBo.setSequenceNbr(departmentModel.getSequenceNbr().toString());
}
return departmentBo;
}
/**
* Model 转 Bo
*/
private CompanyBo convertCompanyModelToBo(CompanyModel companyModel){
CompanyBo companyBo = new CompanyBo();
if(companyModel != null) {
companyBo.setAddress(companyModel.getAddress());
companyBo.setCompanyName(companyModel.getCompanyName());
companyBo.setCompanyOrgCode(Long.parseLong(companyModel.getCompanyOrgCode().toString()));
companyBo.setEmail(companyModel.getEmail());
companyBo.setLandlinePhone(companyModel.getLandlinePhone());
companyBo.setLongitude(companyModel.getLongitude());
companyBo.setLatitude(companyModel.getLatitude());
companyBo.setLevel(companyModel.getLevel());
companyBo.setOrgCode(companyModel.getOrgCode());
companyBo.setSequenceNbr(companyModel.getSequenceNbr().toString());
companyBo.setParentId(companyModel.getParentId().toString());
}
return companyBo;
}
private RoleBo convertRoleModelToBo(RoleModel roleModel) {
RoleBo roleBo = new RoleBo();
if(roleModel != null){
roleBo.setRoleName(roleModel.getRoleName());
roleBo.setRoleType(roleModel.getRoleType());
roleBo.setSequenceNbr(roleModel.getSequenceNbr().toString());
}
return roleBo;
}
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
}
}
...@@ -45,8 +45,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo> ...@@ -45,8 +45,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo>
* @param equipmentId * @param equipmentId
* @return * @return
*/ */
List<EquipmentSpecificVo> getEquipmentBySpe(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("name")String name, @Param("code")String code,@Param("equipmentId") String equipmentId); List<EquipmentSpecificVo> getEquipmentBySpe(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("name")String name, @Param("code")String code,@Param("equipmentId") String equipmentId, @Param("equipmentIdList") List<Long> equipmentIdList);
int getEquipmentBySpeCount( @Param("name")String name, @Param("code")String code,@Param("equipmentId") String equipmentId); int getEquipmentBySpeCount( @Param("name")String name, @Param("code")String code,@Param("equipmentId") String equipmentId, @Param("equipmentIdList") List<Long> equipmentIdList);
/** /**
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.dao.mapper; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import com.yeejoin.amos.fas.dao.dto.EquipmentDTO; import com.yeejoin.amos.fas.dao.dto.EquipmentDTO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -21,4 +22,6 @@ public interface ImpEquipMapper extends BaseMapper { ...@@ -21,4 +22,6 @@ public interface ImpEquipMapper extends BaseMapper {
Long reservePageCount(); Long reservePageCount();
List<EquipmentDTO> reservePage(@Param("start") long start,@Param("length") int length); List<EquipmentDTO> reservePage(@Param("start") long start,@Param("length") int length);
Set<String> getAllCode();
} }
...@@ -23,4 +23,6 @@ public interface IEquipmentDao extends BaseDao<Equipment, Long> { ...@@ -23,4 +23,6 @@ public interface IEquipmentDao extends BaseDao<Equipment, Long> {
@Query(value = "SELECT ss.equipment_specific_id FROM(SELECT si.equipment_specific_id, si.equipment_index_id FROM wl_equipment_specific_index si WHERE si.equipment_specific_id IN ( SELECT fe.fire_equipment_id FROM f_equipment_fire_equipment fe WHERE fe.equipment_id = ?1 ) ) ss LEFT JOIN wl_equipment_index ei ON ss.equipment_index_id = ei.id WHERE ei.type_code = ?2", nativeQuery = true) @Query(value = "SELECT ss.equipment_specific_id FROM(SELECT si.equipment_specific_id, si.equipment_index_id FROM wl_equipment_specific_index si WHERE si.equipment_specific_id IN ( SELECT fe.fire_equipment_id FROM f_equipment_fire_equipment fe WHERE fe.equipment_id = ?1 ) ) ss LEFT JOIN wl_equipment_index ei ON ss.equipment_index_id = ei.id WHERE ei.type_code = ?2", nativeQuery = true)
List<Object> getReserveEquipById(Long id, String typeCode); List<Object> getReserveEquipById(Long id, String typeCode);
Optional<Equipment> findFirstByCodeIs(String code);
} }
package com.yeejoin.amos.fas.business.feign; package com.yeejoin.amos.fas.business.feign;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -15,4 +16,10 @@ public interface IEquipManageFeign { ...@@ -15,4 +16,10 @@ public interface IEquipManageFeign {
*/ */
@PutMapping(value = "/equip/building/unbind/region") @PutMapping(value = "/equip/building/unbind/region")
void unbindRelation(@RequestParam(value ="instanceId") Long instanceId); void unbindRelation(@RequestParam(value ="instanceId") Long instanceId);
/**
* 查询建筑位置全路径
*/
@GetMapping(value = "/equip/building/getBuildingCodeKeyMap")
Object getBuildingCodeKey();
} }
package com.yeejoin.amos.fas.business.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "${outSystem.fegin.name}", configuration = {MultipartSupportConfig.class})
public interface OutTokenLoginFeign {
@RequestMapping(value = "/getUserName", method = RequestMethod.GET)
String getUserName(@RequestParam String token);
}
package com.yeejoin.amos.fas.business.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
@FeignClient(name = "${privilege.fegin.name}", configuration = {MultipartSupportConfig.class})
public interface PrivilegeFeign {
@RequestMapping(value = "privilege/v1/auth/idpassword", method = RequestMethod.POST)
FeignClientResult login(
@RequestHeader(name = "appKey", required = true) String appKey,
@RequestHeader(name = "product", required = true) String product,
@RequestHeader(name = "token", required = true) String token,
@RequestBody Map person);
@RequestMapping(value = "privilege/v1/application/list/user/service", method = RequestMethod.GET)
FeignClientResult warrant(
@RequestHeader(name = "appKey", required = true) String appKey,
@RequestHeader(name = "product", required = true) String product,
@RequestHeader(name = "token", required = true) String token);
}
...@@ -412,6 +412,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService { ...@@ -412,6 +412,8 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
} }
PlanDetail planEntity = new PlanDetail(); PlanDetail planEntity = new PlanDetail();
BeanUtils.copyProperties(planDetail, planEntity); BeanUtils.copyProperties(planDetail, planEntity);
planEntity.setOrgCode(oldPlan.getOrgCode());
planEntity.setCreator(oldPlan.getCreator());
planDetailDao.saveAndFlush(planEntity); planDetailDao.saveAndFlush(planEntity);
planDoc.setPlanId(planId); planDoc.setPlanId(planId);
......
...@@ -5,7 +5,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IEquipmentCategoryService; ...@@ -5,7 +5,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IEquipmentCategoryService;
import com.yeejoin.amos.fas.dao.entity.EquipmentCategory; import com.yeejoin.amos.fas.dao.entity.EquipmentCategory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.TreeBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -25,4 +29,19 @@ public class EquipmentCategoryServiceImpl implements IEquipmentCategoryService ...@@ -25,4 +29,19 @@ public class EquipmentCategoryServiceImpl implements IEquipmentCategoryService
public List<EquipmentCategory> list( ) { public List<EquipmentCategory> list( ) {
return equipmentCategoryMapper.list(); return equipmentCategoryMapper.list();
} }
@Override
public List<EquipmentCategory> getAllTree(Long root) {
List<EquipmentCategory> list = equipmentCategoryMapper.list();
if (list.isEmpty()) {
return Collections.emptyList();
}
Long root123 = -1L;
list.forEach(eq -> { if(eq.getParentId() == null) { eq.setParentId(root123);}});
if (root == null) {
root = root123;
}
Collection<EquipmentCategory> bulid = TreeBuilder.bulid(list, root);
return new ArrayList<>(bulid);
}
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.*; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.*;
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;
import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao; import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao;
import com.yeejoin.amos.fas.business.feign.IEquipManageFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.ImgParam; import com.yeejoin.amos.fas.business.param.ImgParam;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService; import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
...@@ -16,12 +17,16 @@ import com.yeejoin.amos.fas.core.util.DaoCriteria; ...@@ -16,12 +17,16 @@ 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.dto.EquipmentDTO; import com.yeejoin.amos.fas.dao.dto.EquipmentDTO;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentExcelData;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.PreplanPicture; import com.yeejoin.amos.fas.dao.entity.PreplanPicture;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -34,9 +39,13 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -34,9 +39,13 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@Service("equipService") @Service("equipService")
...@@ -44,6 +53,8 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -44,6 +53,8 @@ public class EquipmentServiceImpl implements IEquipmentService {
private final Logger log = LoggerFactory.getLogger(EquipmentServiceImpl.class); private final Logger log = LoggerFactory.getLogger(EquipmentServiceImpl.class);
private final String[] docxTitle = {"设备编号", "设备名称", "所属区域", "位置"};
@Autowired @Autowired
ImpEquipMapper impEquipMapper; ImpEquipMapper impEquipMapper;
...@@ -72,6 +83,9 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -72,6 +83,9 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Autowired @Autowired
private PlanEquipmentMapper planEquipmentMapper; private PlanEquipmentMapper planEquipmentMapper;
@Autowired
IEquipManageFeign iEquipManageFeign;
// @Autowired // @Autowired
// private IFmeaEquipmentPointDao iFmeaEquipmentPointDao; // private IFmeaEquipmentPointDao iFmeaEquipmentPointDao;
...@@ -515,4 +529,68 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -515,4 +529,68 @@ public class EquipmentServiceImpl implements IEquipmentService {
return iEquipmentDao.getReserveEquipById(id, typeCode); return iEquipmentDao.getReserveEquipById(id, typeCode);
} }
@Override
public void downTemplate(HttpServletResponse response) {
Workbook workbook = new HSSFWorkbook();
Sheet sheet = workbook.createSheet();
Row row = sheet.createRow(0);
for (int i = 0; i < docxTitle.length; i++) {
Cell cell = row.createCell(i);
cell.setCellValue(docxTitle[i]);
}
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=" + URLEncoder.encode("电力设备批量导入模板.xls", "UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
workbook.write(response.getOutputStream());
} catch (IOException e) {
//throw new NormalException(e.getMessage());
}
}
@Override
public void uploadList(List<EquipmentExcelData> list, String orgCode) {
if (!list.isEmpty()) {
List<Equipment> equipmentList = new LinkedList<>();
// 获取所有的区域编码
Map<String, Object> res = (Map<String, Object>) iEquipManageFeign.getBuildingCodeKey();
if (((int)res.get("status")) != 200) {
throw new YeeException("解析位置编码失败");
}
Map<String, String> areaCodeIdMap = (Map<String, String>) res.getOrDefault("result", new HashMap<String, String>());
// 获取所有存在的重点设备编码
Set<String> equipCodeSet = impEquipMapper.getAllCode();
for (int i = 0; i < list.size(); i++) {
int row = i + 3;
EquipmentExcelData x = list.get(i);
String equipCode = x.getEquipCode();
String equipName = x.getEquipName();
String areaCode = x.getAreaCode();
String position = x.getPosition();
if (ValidationUtil.isEmpty(equipCode) || ValidationUtil.isEmpty(equipName) || ValidationUtil.isEmpty(areaCode)) {
throw new YeeException("错误行" + row + ":检查非空字段");
}
if (equipCodeSet.contains(equipCode.trim())) {
throw new YeeException("错误行" + row + ":重复的设备编号");
}
if (!areaCodeIdMap.containsKey(areaCode.trim())) {
throw new YeeException("错误行" + row + ":所属区域编号有误");
}
equipCodeSet.add(equipCode.trim());
Equipment equipment = new Equipment();
equipment.setName(equipName.trim());
equipment.setCode(equipCode.trim());
equipment.setRiskSourceId(Long.valueOf(areaCodeIdMap.get(areaCode.trim())));
if (!ValidationUtil.isEmpty(position)) {
equipment.setAddress(position);
}
equipment.setIsIndoor(false);
equipment.setOrgCode(orgCode);
equipmentList.add(equipment);
}
iEquipmentDao.saveAll(equipmentList);
}
}
} }
...@@ -3,19 +3,18 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -3,19 +3,18 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper; import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificService; import com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentCategoryService;
import com.yeejoin.amos.fas.business.util.TreeUtil;
import com.yeejoin.amos.fas.business.vo.AssoEquipsVo; import com.yeejoin.amos.fas.business.vo.AssoEquipsVo;
import com.yeejoin.amos.fas.business.vo.EquipmentPointVo; import com.yeejoin.amos.fas.business.vo.EquipmentPointVo;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificVo; import com.yeejoin.amos.fas.business.vo.EquipmentSpecificVo;
import com.yeejoin.amos.fas.dao.entity.EquipmentCategory;
import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint; import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 装备配置 服务实现类 * 装备配置 服务实现类
...@@ -28,7 +27,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService { ...@@ -28,7 +27,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
@Autowired @Autowired
EquipmentSpecificMapper equipmentSpecificMapper; EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
IEquipmentCategoryService categoryService;
@Override @Override
public List<FmeaEquipmentPoint> upDateEquimentPoint(FmeaBindParam fmeaBindParam) { public List<FmeaEquipmentPoint> upDateEquimentPoint(FmeaBindParam fmeaBindParam) {
...@@ -71,15 +71,33 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService { ...@@ -71,15 +71,33 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
return map; return map;
} }
@Override
public Map<String, Object> getEquipmentBySpeV2(String name, int pageNumber, int pageSize, Long equipmentId) {
Map<String, Object> map = new HashMap<>();
List<Long> equipmentIdList = null;
if (equipmentId != null) {
List<EquipmentCategory> allChildren = TreeUtil.getAllChildren(categoryService.getAllTree(equipmentId));
equipmentIdList = new LinkedList<>();
equipmentIdList.add(equipmentId);
if(!allChildren.isEmpty()){
List<Long> finalEquipmentIdList = equipmentIdList;
allChildren.forEach(cate -> finalEquipmentIdList.add(cate.getId()));
}
}
List<EquipmentSpecificVo> equipmentBySpe = equipmentSpecificMapper.getEquipmentBySpe(pageNumber * pageSize, pageSize, name, null,null, equipmentIdList);
int equipmentBySpeCount = equipmentSpecificMapper.getEquipmentBySpeCount(name, null,null, equipmentIdList);
map.put("content",equipmentBySpe);
map.put("totalElements",equipmentBySpeCount);
return map;
}
@Override @Override
public Map<String ,Object> getEquipmentBySpe(String name, String code, int pageNumber, int pageSize ,String equipmentId) { public Map<String ,Object> getEquipmentBySpe(String name, String code, int pageNumber, int pageSize ,String equipmentId) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
pageNumber = pageNumber*pageSize; pageNumber = pageNumber*pageSize;
code = checkid(code); code = checkid(code);
List<EquipmentSpecificVo> equipmentBySpe = equipmentSpecificMapper.getEquipmentBySpe(pageNumber, pageSize, name, code,equipmentId); List<EquipmentSpecificVo> equipmentBySpe = equipmentSpecificMapper.getEquipmentBySpe(pageNumber, pageSize, name, code,equipmentId, null);
int equipmentBySpeCount = equipmentSpecificMapper.getEquipmentBySpeCount(name, code,equipmentId); int equipmentBySpeCount = equipmentSpecificMapper.getEquipmentBySpeCount(name, code,equipmentId, null);
map.put("content",equipmentBySpe); map.put("content",equipmentBySpe);
map.put("totalElements",equipmentBySpeCount); map.put("totalElements",equipmentBySpeCount);
return map; return map;
...@@ -113,6 +131,6 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService { ...@@ -113,6 +131,6 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
substring = id.substring(0, 1); substring = id.substring(0, 1);
} }
return substring; return substring+"%";
} }
} }
...@@ -6,7 +6,6 @@ import com.google.common.collect.Lists; ...@@ -6,7 +6,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.fas.business.action.model.ContingencyRo; import com.yeejoin.amos.fas.business.action.model.ContingencyRo;
import com.yeejoin.amos.fas.business.action.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent; import com.yeejoin.amos.fas.business.action.mq.WebMqttComponent;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe; import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.dao.mapper.*; import com.yeejoin.amos.fas.business.dao.mapper.*;
...@@ -27,7 +26,6 @@ import com.yeejoin.amos.fas.business.vo.Toke; ...@@ -27,7 +26,6 @@ import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.business.vo.TopicEntityVo; import com.yeejoin.amos.fas.business.vo.TopicEntityVo;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue; import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum; import com.yeejoin.amos.fas.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
import com.yeejoin.amos.fas.core.util.StringUtil; import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
...@@ -42,6 +40,7 @@ import org.springframework.stereotype.Service; ...@@ -42,6 +40,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -140,6 +139,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -140,6 +139,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId); EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId);
// 三维屏指标状态推送 // 三维屏指标状态推送
String specificIndexType = equipmentSpecificIndex.getType(); String specificIndexType = equipmentSpecificIndex.getType();
//
String typeCode = equipmentSpecificIndex.getTypeCode();
if (nameKey !=null && nameKeys.contains(nameKey)) { if (nameKey !=null && nameKeys.contains(nameKey)) {
if (equipmentSpecific != null) { if (equipmentSpecific != null) {
equipmentSpecificIndex.setId(equipmentSpecific.getId()); equipmentSpecificIndex.setId(equipmentSpecific.getId());
...@@ -157,8 +158,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -157,8 +158,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
deviceData.setId(String.valueOf(equipmentSpecific.getId())); deviceData.setId(String.valueOf(equipmentSpecific.getId()));
deviceData.setCode(equipmentSpecific.getCode()); deviceData.setCode(equipmentSpecific.getCode());
//设备告警处理逻辑 //设备告警处理逻辑
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(specificIndexType)) { if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(typeCode)) {
log.info("(报警)Message type is: " + specificIndexType); log.info("(报警)Message typeCode is: " + typeCode);
/** /**
* 推送告警数据 * 推送告警数据
* 影响区域:消防安全=>火灾告警 * 影响区域:消防安全=>火灾告警
...@@ -168,9 +169,9 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -168,9 +169,9 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
// 报警触发调用规则服务 // 报警触发调用规则服务
//注释自动触发预案 //注释自动触发预案
//executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke,topicEntity.getRecordId()); //executeDynamicPlan(deviceData, equipment, equipmentSpecific, toke,topicEntity.getRecordId());
} else if (EquipmentRiskTypeEnum.GZ.getCode().equals(specificIndexType)) { } else if (EquipmentRiskTypeEnum.GZ.getCode().equals(typeCode)) {
// 设备故障处理逻辑 // 设备故障处理逻辑
log.info("(故障)Message type is: " +specificIndexType); log.info("(故障)Message typeCode is: " +typeCode);
final String stateTrue = "true"; final String stateTrue = "true";
final String stateFalse = "false"; final String stateFalse = "false";
String state = equipmentSpecificIndex.getValue(); String state = equipmentSpecificIndex.getValue();
...@@ -305,7 +306,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -305,7 +306,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
* @Date 2020/11/16 15:25 * @Date 2020/11/16 15:25
*/ */
private void notifyAlarm(EquipmentSpecificIndexVo equipmentSpecificIndex, int state) { private void notifyAlarm(EquipmentSpecificIndexVo equipmentSpecificIndex, int state) {
List<FmeaEquipmentPoint> fmeaEquipmentPoints = fmeaEquipmentPointMapper.listByEquipmentPointId(equipmentSpecificIndex.getId()); List<FmeaEquipmentPoint> fmeaEquipmentPoints = fmeaEquipmentPointMapper.listByEquipmentPointId(equipmentSpecificIndex.getEquipmentIndexId());
Set<Long> fmeaIds = Sets.newHashSet(); Set<Long> fmeaIds = Sets.newHashSet();
List<Long> ids = Lists.newArrayList(); List<Long> ids = Lists.newArrayList();
fmeaEquipmentPoints.forEach(fmeaEquipmentPoint -> { fmeaEquipmentPoints.forEach(fmeaEquipmentPoint -> {
...@@ -432,9 +433,9 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService { ...@@ -432,9 +433,9 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
} }
contingencyRo.setTelemetryMap(telemetryMap); contingencyRo.setTelemetryMap(telemetryMap);
log.debug("开始调用规则"); log.info("开始调用规则 参数 contingencyRo{},reservePlan{},equipmentNames"+contingencyRo.toString()+","+equipment.getReservePlan()+","+ ArrayUtils.toArray(equipment.getName()));
Object result = ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName())); Object result = ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName()));
log.debug("规则调用返回==",result); log.info("规则调用返回==",result);
ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData(); ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData();
BeanUtils.copyProperties(contingencyRo, contingencyOriginalData); BeanUtils.copyProperties(contingencyRo, contingencyOriginalData);
......
...@@ -3,12 +3,14 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -3,12 +3,14 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.fas.business.dao.repository.IPlanClassifyTreeDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanClassifyTreeDao;
import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao; import com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao;
import com.yeejoin.amos.fas.business.service.intfc.IPlanClassifyTreeService; import com.yeejoin.amos.fas.business.service.intfc.IPlanClassifyTreeService;
import com.yeejoin.amos.fas.business.util.TreeUtil;
import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo; import com.yeejoin.amos.fas.business.vo.PlanClassifyTreeVo;
import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree; import com.yeejoin.amos.fas.dao.entity.PlanClassifyTree;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.StringUtil; import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.TreeBuilder; import org.typroject.tyboot.core.foundation.utils.TreeBuilder;
...@@ -37,14 +39,13 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService { ...@@ -37,14 +39,13 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
} }
@Override @Override
@Transactional(rollbackFor = {YeeException.class, Exception.class})
public Boolean delete(String ids) { public Boolean delete(String ids) {
List<Long> seqs = StringUtil.String2LongList(ids); List<Long> seqs = StringUtil.String2LongList(ids);
Set<Long> allIds = new HashSet<>(seqs); Set allIds = new HashSet<>(seqs);
for (Long seq : seqs) { for (Long seq : seqs) {
PlanClassifyTree planClassifyTree = planClassifyTreeDao.findById(seq).orElse(null); List<PlanClassifyTreeVo> allChildIncludeMe = getAllChildIncludeMe(seq);
//所有子分类 allIds.addAll(Bean.listToMap(TreeUtil.getAllChildren(allChildIncludeMe), "id", "id", PlanClassifyTreeVo.class).keySet());
List<PlanClassifyTree> childGroupSequenceList = getChildSequenceList(planClassifyTree);
allIds.addAll(new HashSet(Bean.listToMap(childGroupSequenceList, "id", "id", PlanClassifyTree.class).keySet()));
} }
// 查询分类下是否有预案 // 查询分类下是否有预案
if (planDetailDao.existsByClassifyIdInAndIsDelete(allIds, false)) { if (planDetailDao.existsByClassifyIdInAndIsDelete(allIds, false)) {
...@@ -95,39 +96,8 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService { ...@@ -95,39 +96,8 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return completeList; return completeList;
} }
/**
* 预案分类的子id
*
* @param planClassifyTree
* @return
*/
public List<PlanClassifyTree> getChildSequenceList(PlanClassifyTree planClassifyTree) {
List<Long> sequenceList = new ArrayList<>();
List<PlanClassifyTree> childList = new ArrayList<>();
this.getAllChildList(planClassifyTree, childList);
// for (KnowledgeDocCategoryModel tagGroupModel : childList) {
// sequenceList.add(tagGroupModel.getSequenceNbr());
// }
return childList;
}
private void getAllChildList(PlanClassifyTree currentPlanClassifyTree, List<PlanClassifyTree> resList) {
if (null == currentPlanClassifyTree) {
return;
}
Long parentId = currentPlanClassifyTree.getId();
List<PlanClassifyTree> childList = planClassifyTreeDao.findByParentId(parentId);
if (!childList.isEmpty()) {
for (PlanClassifyTree tagPlanClassifyTree : childList) {
this.getAllChildList(tagPlanClassifyTree, resList);
}
}
resList.add(currentPlanClassifyTree);
}
@Override @Override
public Collection<PlanClassifyTreeVo> getAllChildIncludeMe(Long root) { public List<PlanClassifyTreeVo> getAllChildIncludeMe(Long root) {
List<PlanClassifyTreeVo> treeDaoAll = Bean.toModels(planClassifyTreeDao.getAll(), PlanClassifyTreeVo.class); List<PlanClassifyTreeVo> treeDaoAll = Bean.toModels(planClassifyTreeDao.getAll(), PlanClassifyTreeVo.class);
Collection<PlanClassifyTreeVo> treeList = TreeBuilder.bulid(treeDaoAll, root); Collection<PlanClassifyTreeVo> treeList = TreeBuilder.bulid(treeDaoAll, root);
if (!ROOT.equals(root)) { if (!ROOT.equals(root)) {
...@@ -138,7 +108,7 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService { ...@@ -138,7 +108,7 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return Arrays.asList(classifyTreeVo); return Arrays.asList(classifyTreeVo);
} }
} }
return treeList; return new ArrayList<>(treeList);
} }
@Override @Override
......
...@@ -22,6 +22,8 @@ import java.util.stream.Collectors; ...@@ -22,6 +22,8 @@ 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.*;
import com.yeejoin.amos.fas.common.enums.AstDataSyncTopic;
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;
...@@ -46,7 +48,6 @@ import org.typroject.tyboot.core.foundation.utils.Bean; ...@@ -46,7 +48,6 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
...@@ -96,9 +97,6 @@ import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService; ...@@ -96,9 +97,6 @@ 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.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService; import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus; import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.util.JexlUtil;
import com.yeejoin.amos.fas.business.util.RpnUtils;
import com.yeejoin.amos.fas.business.vo.EquipCommunicationData; import com.yeejoin.amos.fas.business.vo.EquipCommunicationData;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo; import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.business.vo.Toke; import com.yeejoin.amos.fas.business.vo.Toke;
...@@ -227,6 +225,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -227,6 +225,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");
} }
...@@ -234,6 +235,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -234,6 +235,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");
...@@ -260,10 +264,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -260,10 +264,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setStatus(oldRiskSource.getStatus()); riskSource.setStatus(oldRiskSource.getStatus());
} }
iRiskSourceDao.saveAndFlush(riskSource); iRiskSourceDao.saveAndFlush(riskSource);
dataSyncUtil.astDataSync(String.join("_", 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) {
...@@ -279,16 +285,17 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -279,16 +285,17 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
//1、删除风险点 //1、删除风险点
iRiskSourceDao.deleteById(rId); iRiskSourceDao.deleteById(rId);
dataSyncUtil.astDataSync(String.join("_", AstDataSyncTopic.AST_REGION_DELETE_BY_ID.getValue(), String.valueOf(rId)), String.valueOf(rId));
//2.删除关联建筑关系,防止对站服务有问题,捕获异常,不影响业务正常秩序 //2.删除关联建筑关系,防止对站服务有问题,捕获异常,不影响业务正常秩序
try { try {
rs.ifPresent(r->{ rs.ifPresent(r -> {
if(r.getSourceId() != null){ if (r.getSourceId() != null) {
iEquipManageFeign.unbindRelation(r.getSourceId()); iEquipManageFeign.unbindRelation(r.getSourceId());
} }
}); });
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
} }
} }
//3.重新计算rpn //3.重新计算rpn
...@@ -303,6 +310,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -303,6 +310,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("_", AstDataSyncTopic.AST_REGION_DELETE_BY_ID.getValue(), String.valueOf(id)), String.valueOf(id));
} }
@Override @Override
...@@ -311,7 +319,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -311,7 +319,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
Optional<RiskSource> op = iRiskSourceDao.findBySourceId(synBo.getId()); Optional<RiskSource> op = iRiskSourceDao.findBySourceId(synBo.getId());
RiskSource riskSource; RiskSource riskSource;
//1.同步上级 //1.同步上级
if(op.isPresent()){ if (op.isPresent()) {
//有就更新,业务只能调整上级 //有就更新,业务只能调整上级
riskSource = op.get(); riskSource = op.get();
riskSource.setParentId(synBo.getParentId()); riskSource.setParentId(synBo.getParentId());
...@@ -319,21 +327,23 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -319,21 +327,23 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} else { } else {
//无则插入 //无则插入
riskSource = new RiskSource(); riskSource = new RiskSource();
Bean.copyExistPropertis(synBo,riskSource); Bean.copyExistPropertis(synBo, riskSource);
fillBasicParams(userId, orgCode, synBo.getId(), riskSource); fillBasicParams(userId, orgCode, synBo.getId(), riskSource);
riskSource = iRiskSourceDao.save(riskSource); riskSource = iRiskSourceDao.save(riskSource);
} }
dataSyncUtil.astDataSync(String.join("_", 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;
List<RiskSource> children = synBo.getChildren().stream().map(s->{ List<RiskSource> children = synBo.getChildren().stream().map(s -> {
RiskSource t = new RiskSource(); RiskSource t = new RiskSource();
Bean.copyExistPropertis(s,t); Bean.copyExistPropertis(s, t);
fillBasicParams(userId, orgCode, s.getId(), t); fillBasicParams(userId, orgCode, s.getId(), t);
t.setParentId(finalRiskSource.getId()); t.setParentId(finalRiskSource.getId());
return t; return t;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
iRiskSourceDao.saveAll(children); iRiskSourceDao.saveAll(children);
dataSyncUtil.astDataSync(String.join("_", AstDataSyncTopic.AST_REGION_SAVE_ALL.getValue(), RandomUtil.buildNo()), JSON.toJSONString(children));
} }
return riskSource; return riskSource;
} }
...@@ -351,10 +361,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -351,10 +361,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
@Override @Override
public Boolean removeBind(Long instanceId) { public Boolean removeBind(Long instanceId) {
Optional<RiskSource> exist = iRiskSourceDao.findBySourceId(instanceId); Optional<RiskSource> exist = iRiskSourceDao.findBySourceId(instanceId);
if(exist.isPresent()){ if (exist.isPresent()) {
RiskSource riskSource = exist.get(); RiskSource riskSource = exist.get();
riskSource.setSourceId(null); riskSource.setSourceId(null);
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
dataSyncUtil.astDataSync(String.join("_", AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
} }
return exist.isPresent(); return exist.isPresent();
} }
...@@ -632,7 +643,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -632,7 +643,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo.setTelemetryMap(telemetryMap); contingencyRo.setTelemetryMap(telemetryMap);
List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId())); List<String> plan = this.getNumberPlan(Long.parseLong(contingencyRo.getEquipmentId()));
if(plan.size()>0){ if (plan.size() > 0) {
log.debug("开始调用规则"); log.debug("开始调用规则");
Object result = ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(equipment.getName())); Object result = ruleTrigger.publish(contingencyRo, "换流站消防专项预案/" + plan.get(0), ArrayUtils.toArray(equipment.getName()));
log.debug("规则调用返回==", result); log.debug("规则调用返回==", result);
...@@ -787,40 +798,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -787,40 +798,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getStatisticsCheck(orgCode))); webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getStatisticsCheck(orgCode)));
} }
/**
* <pre>
* @Description: 隐患治理更新State、rpn值
* </pre>
*
* @Throws
* @Author keyong
* @Date 2021/2/1 19:50
*/
@Override
public void processProtalDataFromDanger(DangerResultBo dangerResultBo) {
List<FmeaPointInputitem> fmeaPointInputitems = fmeaPointInputitemMapper.listByPointInputItemId(dangerResultBo.getInputItemId());
if (0 < fmeaPointInputitems.size()) {
Set<Long> fmeaIds = Sets.newHashSet();
List<Long> list = Lists.newArrayList();
fmeaPointInputitems.forEach(x -> {
list.add(x.getId());
fmeaIds.add(x.getFmeaId());
});
fmeaPointInputitemMapper.updateStateByIds(0, list);
RsDataQueue rsDataQueue = RsDataQueue.getInstance();
fmeaIds.forEach(fmeaId -> rsDataQueue.addPatrolMessage(fmeaId, dangerResultBo.getUserName(), null, "1"));
iDataRefreshService.refreshViewData(DataRefreshTypeEum.handleDanger.getCode());
// 今日安全
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(new Date());
String topicOne = String.format("/%s/%s/%s/%s", serviceName, stationName, "data/refresh", "todaySafetyIndex");
webMqttComponent.publish(topicOne, JSON.toJSONString(view3dService.getSafetyIndexInfoByDate(dangerResultBo.getOrgCode(), dateString)));
// 一周安全趋势
String topicThree = String.format("/%s/%s/%s/%s", serviceName, stationName, "data/refresh", "weekSafetyIndex");
webMqttComponent.publish(topicThree, JSON.toJSONString(view3dService.getSafetyIndexWeek(dangerResultBo.getOrgCode())));
}
}
/** /**
* 巡检消息规则推送 * 巡检消息规则推送
...@@ -1037,7 +1014,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1037,7 +1014,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
topicEntity.setMessage(JSON.toJSONString(equipmentSpecificIndexVo)); topicEntity.setMessage(JSON.toJSONString(equipmentSpecificIndexVo));
String data = JSON.toJSONString(topicEntity); String data = JSON.toJSONString(topicEntity);
System.out.println(data); System.out.println(data);
iEquipmentHandlerService.handlerMqttMessage("",data ); iEquipmentHandlerService.handlerMqttMessage("", data);
return "SUCCESS"; return "SUCCESS";
} }
...@@ -1060,7 +1037,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1060,7 +1037,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
topicEntity.setMessage(JSON.toJSONString(equipmentSpecificIndexVo)); topicEntity.setMessage(JSON.toJSONString(equipmentSpecificIndexVo));
topicEntity.setEquipment(equipment); topicEntity.setEquipment(equipment);
String data = JSON.toJSONString(topicEntity); String data = JSON.toJSONString(topicEntity);
iEquipmentHandlerService.handlerMqttMessage("",data ); iEquipmentHandlerService.handlerMqttMessage("", data);
if (equipment != null) { if (equipment != null) {
equipment.setStartTime(DateUtil.getDateNow()); equipment.setStartTime(DateUtil.getDateNow());
equipment.setEndTime(null); equipment.setEndTime(null);
...@@ -1328,8 +1305,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1328,8 +1305,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}")
...@@ -1853,6 +1828,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1853,6 +1828,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("_", AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
return; return;
} }
BigDecimal rpn = rpnValueBo.getRpn(); BigDecimal rpn = rpnValueBo.getRpn();
...@@ -1866,6 +1842,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1866,6 +1842,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
} }
iRiskSourceDao.save(riskSource); iRiskSourceDao.save(riskSource);
dataSyncUtil.astDataSync(String.join("_", AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
this.updateParentRpn(riskSource.getParentId()); this.updateParentRpn(riskSource.getParentId());
} }
} }
...@@ -2006,7 +1983,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -2006,7 +1983,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return null; return null;
} }
public List<String> getNumberPlan(Long id){ public List<String> getNumberPlan(Long id) {
List<String> ruleId = planDetailMapper.getRuleIdByEquipment(id); List<String> ruleId = planDetailMapper.getRuleIdByEquipment(id);
return ruleId; return ruleId;
} }
......
...@@ -16,6 +16,8 @@ import java.util.Set; ...@@ -16,6 +16,8 @@ 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 com.yeejoin.amos.fas.common.enums.*;
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;
...@@ -55,14 +57,6 @@ import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo; ...@@ -55,14 +57,6 @@ import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo;
import com.yeejoin.amos.fas.business.vo.SafetyIndexDetailVo; import com.yeejoin.amos.fas.business.vo.SafetyIndexDetailVo;
import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo; import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo;
import com.yeejoin.amos.fas.business.vo.View3dNodeVo; import com.yeejoin.amos.fas.business.vo.View3dNodeVo;
import com.yeejoin.amos.fas.common.enums.CheckStatusEnum;
import com.yeejoin.amos.fas.common.enums.DataRefreshTypeEum;
import com.yeejoin.amos.fas.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.common.enums.RiskSourceLevelEum;
import com.yeejoin.amos.fas.common.enums.RiskSourceRegionEum;
import com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum;
import com.yeejoin.amos.fas.common.enums.StatisticsErrorTypeEum;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.request.DateUtil; import com.yeejoin.amos.fas.core.common.request.DateUtil;
import com.yeejoin.amos.fas.core.common.response.CoordDTO; import com.yeejoin.amos.fas.core.common.response.CoordDTO;
...@@ -118,6 +112,9 @@ public class View3dServiceImpl implements IView3dService { ...@@ -118,6 +112,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 +245,7 @@ public class View3dServiceImpl implements IView3dService { ...@@ -248,6 +245,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("_", AstDataSyncTopic.AST_REGION_SAVE.getValue(), String.valueOf(riskSource.getId())), JSON.toJSONString(riskSource));
} }
} }
......
...@@ -53,4 +53,6 @@ public interface EquipmentSpecificService { ...@@ -53,4 +53,6 @@ public interface EquipmentSpecificService {
* @return * @return
*/ */
Map<String ,Object> getEquipmentBySpe(String name, String code, int pageNumber, int pageSize, String equipmentId); Map<String ,Object> getEquipmentBySpe(String name, String code, int pageNumber, int pageSize, String equipmentId);
Map<String ,Object> getEquipmentBySpeV2(String name, int pageNumber, int pageSize, Long equipmentId);
} }
...@@ -17,4 +17,9 @@ public interface IEquipmentCategoryService { ...@@ -17,4 +17,9 @@ public interface IEquipmentCategoryService {
*/ */
List<EquipmentCategory> list( ); List<EquipmentCategory> list( );
/**
* 获取装备树
* @return
*/
List<EquipmentCategory> getAllTree(Long root);
} }
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.fas.business.param.ImgParam; import com.yeejoin.amos.fas.business.param.ImgParam;
import com.yeejoin.amos.fas.business.vo.EquipCommunicationData; import com.yeejoin.amos.fas.business.vo.EquipCommunicationData;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificIndexVo;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; 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.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentExcelData;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.PreplanPicture; import com.yeejoin.amos.fas.dao.entity.PreplanPicture;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -113,8 +113,19 @@ public interface IEquipmentService { ...@@ -113,8 +113,19 @@ public interface IEquipmentService {
/** /**
* 获取重点设备绑定设备 * 获取重点设备绑定设备
* @param id * @param id
* @param firealarm * @param typeCode
* @return * @return
*/ */
List<Object> getReserveEquipById(Long id, String typeCode); List<Object> getReserveEquipById(Long id, String typeCode);
/**
* 下载导入模板
* @param response
*/
void downTemplate(HttpServletResponse response);
/**
* 导入数据
*/
void uploadList(List<EquipmentExcelData> list, String orgCode);
} }
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.amos.fas.business.util;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
/**
* @description: easyPoi工具类
* @author: duanwei
* @create: 2020-05-28 13:57
**/
public class ExcelUtils {
/**
* excel 导出
*
* @param list 数据
* @param title 标题
* @param sheetName sheet名称
* @param pojoClass pojo类型
* @param fileName 文件名称
* @param isCreateHeader 是否创建表头
* @param response
*/
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass,
String fileName, boolean isCreateHeader, HttpServletResponse response) {
ExportParams exportParams = new ExportParams(title, sheetName);
exportParams.setCreateHeadRows(isCreateHeader);
defaultExport(list, pojoClass, fileName, response, exportParams);
}
/**
* excel 导出
*
* @param list 数据
* @param title 标题
* @param sheetName sheet名称
* @param pojoClass pojo类型
* @param fileName 文件名称
* @param response
*/
public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName,
HttpServletResponse response) {
defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName));
}
/**
* excel 导出
*
* @param list 数据
* @param fileName 文件名称
* @param response
*/
public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) {
defaultExport(list, fileName, response);
}
/**
* 默认的 excel 导出
*
* @param list 数据
* @param pojoClass pojo类型
* @param fileName 文件名称
* @param response
* @param exportParams 导出参数
*/
private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName,
HttpServletResponse response, ExportParams exportParams) {
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);
if (workbook != null){
downLoadExcel(fileName, response, workbook);
};
}
/**
* 下载
*
* @param fileName 文件名称
* @param response
* @param workbook excel数据
*/
private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
workbook.write(response.getOutputStream());
} catch (IOException e) {
//throw new NormalException(e.getMessage());
}
}
/**
* 默认的 excel 导出
*
* @param list 数据
* @param fileName 文件名称
* @param response
*/
private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) {
Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
if (workbook != null) {
downLoadExcel(fileName, response, workbook);}
}
/**
* excel 导入
*
* @param filePath excel文件路径
* @param titleRows 标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> pojoClass) {
if (StringUtils.isBlank(filePath)) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
List<T> list = null;
try {
list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
} catch (NoSuchElementException e) {
//throw new NormalException("模板不能为空");
} catch (Exception e) {
e.printStackTrace();
//throw new NormalException(e.getMessage());
}
return list;
}
/**
* excel 导入
*
* @param file 上传的文件
* @param titleRows 标题行
* @param headerRows 表头行
* @param pojoClass pojo类型
* @param <T>
* @return
*/
public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) {
if (file == null) {
return null;
}
ImportParams params = new ImportParams();
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
List<T> list = null;
try {
list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params);
} catch (NoSuchElementException e) {
// throw new NormalException("excel文件不能为空");
} catch (Exception e) {
//throw new NormalException(e.getMessage());
System.out.println(e.getMessage());
}
return list;
}
}
package com.yeejoin.amos.fas.business.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public class RandomUtil {
private static ThreadLocalRandom threadLocalRandom;
public static String buildOrderNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String newDate = sdf.format(new Date());
String result = "";
Random random = new Random();
for (int i = 0; i < 3; i++) {
result += random.nextInt(10);
}
return newDate + result;
}
/**
* @param resourceType 资源类型
* @param companyCode 单位编号
* @Description Random存在性能问题可能造成线程阻塞问题,使
* 用性能更加卓越的threadLocalRandom(线程安全的单例模式)生成随机数
* 四位随机数无法保证不可重复性,如果对不可重复要求高,请使用其他工具
* @Author songLei
* @Return String
* @Date 2020/12/18 11:49
*/
public static String buildNo(String resourceType, String companyCode) {
threadLocalRandom = ThreadLocalRandom.current();
int num = threadLocalRandom.nextInt(1000, 9999);
return resourceType + companyCode + num;
}
public static String buildNo() {
threadLocalRandom = ThreadLocalRandom.current();
int num = threadLocalRandom.nextInt(1000, 9999);
return String.valueOf(num);
}
}
...@@ -43,6 +43,16 @@ public class EquipmentSpecificIndexVo { ...@@ -43,6 +43,16 @@ public class EquipmentSpecificIndexVo {
// 订阅类型 // 订阅类型
private String type; private String type;
private String typeCode;
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public void setId(long id) { public void setId(long id) {
this.id = id; this.id = id;
} }
......
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.vo; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.vo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import java.io.Serializable; import java.io.Serializable;
public class ReginParams implements Serializable { public class ReginParams implements Serializable {
...@@ -12,6 +14,25 @@ public class ReginParams implements Serializable { ...@@ -12,6 +14,25 @@ public class ReginParams implements Serializable {
private CompanyBo company; private CompanyBo company;
private RoleBo role; private RoleBo role;
private DepartmentBo department; private DepartmentBo department;
private String token;
private AgencyUserModel userModel;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public AgencyUserModel getUserModel() {
return userModel;
}
public void setUserModel(AgencyUserModel userModel) {
this.userModel = userModel;
}
public CompanyBo getCompany() { public CompanyBo getCompany() {
return company; return company;
} }
......
package com.yeejoin.amos.fas.config; package com.yeejoin.amos.fas.config;
import javax.servlet.http.HttpServletRequest; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe; import com.yeejoin.amos.component.feign.config.TokenOperation;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.vo.CompanyBo;
import com.yeejoin.amos.fas.business.vo.DepartmentBo; import com.yeejoin.amos.fas.business.vo.DepartmentBo;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.business.vo.RoleBo; import com.yeejoin.amos.fas.business.vo.RoleBo;
import com.yeejoin.amos.fas.exception.PermissionException;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
...@@ -15,9 +22,7 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -15,9 +22,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -26,21 +31,9 @@ import org.springframework.web.context.request.RequestContextHolder; ...@@ -26,21 +31,9 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSON; import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.config.TokenOperation;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.vo.CompanyBo;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.exception.PermissionException;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
@Aspect @Aspect
@Component @Component
......
...@@ -3,7 +3,7 @@ security.password=a1234560 ...@@ -3,7 +3,7 @@ security.password=a1234560
security.loginId=fas_autosys security.loginId=fas_autosys
#environment #environment
#spring.profiles.active = dev #spring.profiles.active = dev
eureka.client.serviceUrl.defaultZone=http://172.16.3.100:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eureka.client.register-with-eureka = true eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true eureka.client.healthcheck.enabled = true
...@@ -19,11 +19,13 @@ spring.datasource.hikari.maxLifetime = 1765000 ...@@ -19,11 +19,13 @@ spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10 spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle = true spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1 spring.datasource.validationQuery = SELECT 1
#ws
params.remoteWebsocketUrl=http://172.16.11.36:10600/
#redis #redis
spring.redis.database=0 spring.redis.database=0
spring.redis.host=172.16.3.100 spring.redis.host=172.16.10.85
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=1234560 spring.redis.password=amos2019Redis
spring.redis.jedis.pool.max-active=200 spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.max-idle=10
...@@ -39,9 +41,9 @@ params.isPush=true ...@@ -39,9 +41,9 @@ params.isPush=true
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.100:1883 emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=admin emqx.user-name=super
emqx.password=admin emqx.password=a123456
#����� #�����
file.downLoad.url=http://39.98.246.31:8888/ file.downLoad.url=http://39.98.246.31:8888/
#站端名称使用全拼 #站端名称使用全拼
......
spring.application.name = AMOS-AUTOSYS spring.application.name = AMOS-AUTOSYS
server.servlet.context-path=/fireAutoSys server.servlet.context-path=/fireAutoSys
server.port = 8083 server.port = 8085
spring.profiles.active=dev spring.profiles.active=dev
#应用product appkey #应用product appkey
security.productWeb=STUDIO_APP_WEB security.productWeb=STUDIO_APP_WEB
...@@ -50,7 +50,7 @@ visual.fegin.name=maas-visual ...@@ -50,7 +50,7 @@ visual.fegin.name=maas-visual
#值班系统 #值班系统
dutyMode.fegin.name=AMOS-DUTYMODE dutyMode.fegin.name=AMOS-DUTYMODE
#队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统 #队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统
equipManage.fegin.name=AMOS-EQUIPMANAGE equipManage.fegin.name=AMOS-EQUIPMANAGE-TT
#feginName #feginName
number.plan.projectName=换流站消防专项预案 number.plan.projectName=换流站消防专项预案
...@@ -99,5 +99,10 @@ data.type.extinguisher=3104 ...@@ -99,5 +99,10 @@ data.type.extinguisher=3104
data.type.hydrant=3105 data.type.hydrant=3105
outSystem.fegin.name=unKnow
outSystem.user.password=a1234560
privilege.fegin.name=AMOS-API-PRIVILEGE
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
END AS type, END AS type,
wlesa.update_date as createDate, wlesa.update_date as createDate,
wlesa.recovery_date as recoveryDate, wlesa.recovery_date as recoveryDate,
wws.full_name as warehouseStructureName, CONCAT(IFNULL(wws.full_name,''),' ',IFNULL(wlsd.description,'')) as warehouseStructureName,
( (
SELECT SELECT
group_concat(DISTINCT f.`name`) group_concat(DISTINCT f.`name`)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
equ.code as code, equ.code as code,
det.name as name, det.name as name,
cate.name as type, cate.name as type,
ware.full_name as address, concat_ws('-',ware.full_name, det.area) as address,
spe.single as single, spe.single as single,
sto.amount as amount, sto.amount as amount,
spe.iot_code, spe.iot_code,
...@@ -40,8 +40,14 @@ ...@@ -40,8 +40,14 @@
spe.system_id, spe.system_id,
manage.name as system_name manage.name as system_name
from from
wl_stock_detail as sto (
left join wl_equipment_specific as spe on sto.qr_code = spe.qr_code SELECT amount,
(SELECT equipment_specific_id FROM wl_stock_detail WHERE stock_id = stk.id limit 1) AS equipment_specific_id,
(SELECT warehouse_structure_id FROM wl_stock_detail WHERE stock_id = stk.id limit 1) AS warehouse_structure_id,
(SELECT equipment_detail_id FROM wl_stock_detail WHERE stock_id = stk.id limit 1) AS equipment_detail_id
FROM wl_stock stk
) AS sto
left join wl_equipment_specific as spe on sto.equipment_specific_id = spe.id
<if test="equipmentId != null and equipmentId!='null' "> <if test="equipmentId != null and equipmentId!='null' ">
left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id
</if> </if>
...@@ -51,23 +57,36 @@ ...@@ -51,23 +57,36 @@
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>
<if test="code != null and code!='null' "> <if test="code != null and code!='null' ">
and cate.code like CONCAT('%',#{code},'%' ) and cate.code like #{code}
</if> </if>
<if test="equipmentId != null and equipmentId!='null' "> <if test="equipmentId != null and equipmentId!='null' ">
and fire.equipment_id = #{equipmentId} and fire.equipment_id = #{equipmentId}
</if> </if>
<if test="equipmentIdList != null and equipmentIdList.size > 0 ">
and equ.category_id in
<foreach collection="equipmentIdList" item="equipmentId" open="(" close=")" separator=",">
#{equipmentId}
</foreach>
</if>
limit #{pageNumber},#{pageSize} limit #{pageNumber},#{pageSize}
</select> </select>
<select id="getEquipmentBySpeCount" resultType="int">select <select id="getEquipmentBySpeCount" resultType="int">select
count(1) count(1)
from from
wl_stock_detail as sto (
left join wl_equipment_specific as spe on sto.qr_code = spe.qr_code SELECT amount,
(SELECT equipment_specific_id FROM wl_stock_detail WHERE stock_id = stk.id limit 1) AS equipment_specific_id,
(SELECT warehouse_structure_id FROM wl_stock_detail WHERE stock_id = stk.id limit 1) AS warehouse_structure_id,
(SELECT equipment_detail_id FROM wl_stock_detail WHERE stock_id = stk.id limit 1) AS equipment_detail_id
FROM wl_stock stk
) AS sto
left join wl_equipment_specific as spe on sto.equipment_specific_id = spe.id
<if test="equipmentId != null and equipmentId!='null' "> <if test="equipmentId != null and equipmentId!='null' ">
left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id
</if> </if>
...@@ -77,15 +96,22 @@ ...@@ -77,15 +96,22 @@
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>
<if test="code != null and code!='null' "> <if test="code != null and code!='null' ">
and cate.code like CONCAT('%',#{code},'%' ) and cate.code like #{code}
</if> </if>
<if test="equipmentId != null and equipmentId!='null' "> <if test="equipmentId != null and equipmentId!='null' ">
and fire.equipment_id = #{equipmentId} and fire.equipment_id = #{equipmentId}
</if> </if>
<if test="equipmentIdList != null and equipmentIdList.size > 0 ">
and equ.category_id in
<foreach collection="equipmentIdList" item="equipmentId" open="(" close=")" separator=",">
#{equipmentId}
</foreach>
</if>
</select> </select>
<select id="getFireEquiments" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpeVo"> <select id="getFireEquiments" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpeVo">
select select
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
WHEN 'false' THEN '否' WHEN 'false' THEN '否'
ELSE ind.value END 'e_value', ELSE ind.value END 'e_value',
ein.unit as eq_point_unit, ein.unit as eq_point_unit,
str.full_name as source_name, CONCAT(IFNULL(str.full_name,''),' ',IFNULL(sto.description,'')) as source_name,
( (
SELECT SELECT
group_concat(DISTINCT f.`name`) group_concat(DISTINCT f.`name`)
......
...@@ -101,12 +101,16 @@ ...@@ -101,12 +101,16 @@
</select> </select>
<select id="listByEquipmentPointId" resultType="com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint"> <select id="listByEquipmentPointId" resultType="com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint">
select SELECT
id,fmea_id as fmeaId,equipment_point_id as equipmentPointId,state point.id,
from point.fmea_id AS fmeaId,
f_fmea_equipment_point point.equipment_point_id AS equipmentPointId,
point.state
FROM
f_fmea_equipment_point point
LEFT JOIN wl_equipment_specific_index equipment ON equipment.id = point.equipment_point_id
where where
equipment_point_id = #{equipmentPointId} equipment.equipment_index_id = #{equipmentPointId}
</select> </select>
<select id="listEquipmentPoint" resultType="java.util.Map"> <select id="listEquipmentPoint" resultType="java.util.Map">
......
...@@ -89,4 +89,8 @@ ...@@ -89,4 +89,8 @@
a.reserve_plan IS NOT NULL a.reserve_plan IS NOT NULL
AND a.reserve_plan != '' AND a.reserve_plan != ''
</select> </select>
<select id="getAllCode" resultType="string">
select distinct code from f_equipment
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -199,6 +199,21 @@ ...@@ -199,6 +199,21 @@
<groupId>org.springframework.integration</groupId> <groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId> <artifactId>spring-integration-mqtt</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
......
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