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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.typroject.tyboot.core.foundation.utils.TreeNode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
......@@ -22,7 +24,7 @@ import java.util.List;
@Accessors(chain = true)
@TableName("wl_equipment_category")
@ApiModel(value="EquipmentCategory装备分类实体", description="装备分类")
public class EquipmentCategory extends BaseEntity {
public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentCategory, Long> {
private static final long serialVersionUID = 1L;
......@@ -56,5 +58,24 @@ public class EquipmentCategory extends BaseEntity {
@TableField(exist=false)
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 @@
</exclusion>
</exclusions>
</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>
<groupId>com.itextpdf</groupId>
......
......@@ -16,7 +16,7 @@ public class ContingencyRo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1863437780244849215L;
private static final long serialVersionUID = -6721135143373410586L;
@Label("消防设备名称")
private String fireEquipmentName;//消防设备名称
@Label("消防设备id")
......
package com.yeejoin.amos.fas.business.controller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.yeejoin.amos.fas.business.util.ExcelUtils;
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.data.domain.Page;
import org.springframework.util.CollectionUtils;
......@@ -31,6 +34,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping(value = "/api/impEquip")
@Api(tags = "重点设备api")
......@@ -319,4 +324,29 @@ public class EquipmentController extends BaseController {
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{
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")
@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>
* @param equipmentId
* @return
*/
List<EquipmentSpecificVo> getEquipmentBySpe(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @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);
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, @Param("equipmentIdList") List<Long> equipmentIdList);
/**
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.yeejoin.amos.fas.dao.dto.EquipmentDTO;
import org.apache.ibatis.annotations.Param;
......@@ -21,4 +22,6 @@ public interface ImpEquipMapper extends BaseMapper {
Long reservePageCount();
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> {
@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);
Optional<Equipment> findFirstByCodeIs(String code);
}
package com.yeejoin.amos.fas.business.feign;
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.RequestParam;
......@@ -15,4 +16,10 @@ public interface IEquipManageFeign {
*/
@PutMapping(value = "/equip/building/unbind/region")
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 {
}
PlanDetail planEntity = new PlanDetail();
BeanUtils.copyProperties(planDetail, planEntity);
planEntity.setOrgCode(oldPlan.getOrgCode());
planEntity.setCreator(oldPlan.getCreator());
planDetailDao.saveAndFlush(planEntity);
planDoc.setPlanId(planId);
......
......@@ -5,7 +5,11 @@ import com.yeejoin.amos.fas.business.service.intfc.IEquipmentCategoryService;
import com.yeejoin.amos.fas.dao.entity.EquipmentCategory;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
......@@ -25,4 +29,19 @@ public class EquipmentCategoryServiceImpl implements IEquipmentCategoryService
public List<EquipmentCategory> 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.*;
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.IPreplanPictureDao;
import com.yeejoin.amos.fas.business.feign.IEquipManageFeign;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.ImgParam;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
......@@ -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.dao.dto.EquipmentDTO;
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.PreplanPicture;
import com.yeejoin.amos.fas.exception.YeeException;
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 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.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,9 +39,13 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
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.IOException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@Service("equipService")
......@@ -44,6 +53,8 @@ public class EquipmentServiceImpl implements IEquipmentService {
private final Logger log = LoggerFactory.getLogger(EquipmentServiceImpl.class);
private final String[] docxTitle = {"设备编号", "设备名称", "所属区域", "位置"};
@Autowired
ImpEquipMapper impEquipMapper;
......@@ -72,6 +83,9 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Autowired
private PlanEquipmentMapper planEquipmentMapper;
@Autowired
IEquipManageFeign iEquipManageFeign;
// @Autowired
// private IFmeaEquipmentPointDao iFmeaEquipmentPointDao;
......@@ -515,4 +529,68 @@ public class EquipmentServiceImpl implements IEquipmentService {
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;
import com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper;
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.IEquipmentCategoryService;
import com.yeejoin.amos.fas.business.util.TreeUtil;
import com.yeejoin.amos.fas.business.vo.AssoEquipsVo;
import com.yeejoin.amos.fas.business.vo.EquipmentPointVo;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 装备配置 服务实现类
......@@ -28,7 +27,8 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
@Autowired
EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
IEquipmentCategoryService categoryService;
@Override
public List<FmeaEquipmentPoint> upDateEquimentPoint(FmeaBindParam fmeaBindParam) {
......@@ -71,15 +71,33 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
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
public Map<String ,Object> getEquipmentBySpe(String name, String code, int pageNumber, int pageSize ,String equipmentId) {
Map<String, Object> map = new HashMap<>();
pageNumber = pageNumber*pageSize;
code = checkid(code);
List<EquipmentSpecificVo> equipmentBySpe = equipmentSpecificMapper.getEquipmentBySpe(pageNumber, pageSize, name, code,equipmentId);
int equipmentBySpeCount = equipmentSpecificMapper.getEquipmentBySpeCount(name, code,equipmentId);
List<EquipmentSpecificVo> equipmentBySpe = equipmentSpecificMapper.getEquipmentBySpe(pageNumber, pageSize, name, code,equipmentId, null);
int equipmentBySpeCount = equipmentSpecificMapper.getEquipmentBySpeCount(name, code,equipmentId, null);
map.put("content",equipmentBySpe);
map.put("totalElements",equipmentBySpeCount);
return map;
......@@ -113,6 +131,6 @@ public class EquipmentSpecificServiceImpl implements EquipmentSpecificService {
substring = id.substring(0, 1);
}
return substring;
return substring+"%";
}
}
......@@ -6,7 +6,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.yeejoin.amos.component.rule.RuleTrigger;
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.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.dao.mapper.*;
......@@ -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.client.invoke.RsDataQueue;
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.dao.entity.*;
import org.apache.commons.lang3.ArrayUtils;
......@@ -42,6 +40,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -113,7 +112,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
@Autowired
private IEvaluationModelDao iEvaluationModelDao;
@Autowired
private FmeaMapper fmeaMapper;
......@@ -140,6 +139,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
EquipmentSpecificForRiskVo equipmentSpecific = equipmentSpecificMapper.getOneById(eqSpecId);
// 三维屏指标状态推送
String specificIndexType = equipmentSpecificIndex.getType();
//
String typeCode = equipmentSpecificIndex.getTypeCode();
if (nameKey !=null && nameKeys.contains(nameKey)) {
if (equipmentSpecific != null) {
equipmentSpecificIndex.setId(equipmentSpecific.getId());
......@@ -157,8 +158,8 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
deviceData.setId(String.valueOf(equipmentSpecific.getId()));
deviceData.setCode(equipmentSpecific.getCode());
//设备告警处理逻辑
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(specificIndexType)) {
log.info("(报警)Message type is: " + specificIndexType);
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(typeCode)) {
log.info("(报警)Message typeCode is: " + typeCode);
/**
* 推送告警数据
* 影响区域:消防安全=>火灾告警
......@@ -168,9 +169,9 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
// 报警触发调用规则服务
//注释自动触发预案
//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 stateFalse = "false";
String state = equipmentSpecificIndex.getValue();
......@@ -197,7 +198,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
fireEquipRuleMessagePush(deviceData, toke);
}
}
} else {
// 监测数据逻辑
log.info("(监测)Message type is: " + specificIndexType);
......@@ -255,7 +256,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
}
@Override
public void subscribeTopic() {
// 若登录系统则订阅装备数据
......@@ -305,7 +306,7 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
* @Date 2020/11/16 15:25
*/
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();
List<Long> ids = Lists.newArrayList();
fmeaEquipmentPoints.forEach(fmeaEquipmentPoint -> {
......@@ -432,9 +433,9 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
}
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()));
log.debug("规则调用返回==",result);
log.info("规则调用返回==",result);
ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData();
BeanUtils.copyProperties(contingencyRo, contingencyOriginalData);
......
......@@ -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.IPlanDetailDao;
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.dao.entity.PlanClassifyTree;
import com.yeejoin.amos.fas.exception.YeeException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.StringUtil;
import org.typroject.tyboot.core.foundation.utils.TreeBuilder;
......@@ -37,14 +39,13 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
}
@Override
@Transactional(rollbackFor = {YeeException.class, Exception.class})
public Boolean delete(String ids) {
List<Long> seqs = StringUtil.String2LongList(ids);
Set<Long> allIds = new HashSet<>(seqs);
Set allIds = new HashSet<>(seqs);
for (Long seq : seqs) {
PlanClassifyTree planClassifyTree = planClassifyTreeDao.findById(seq).orElse(null);
//所有子分类
List<PlanClassifyTree> childGroupSequenceList = getChildSequenceList(planClassifyTree);
allIds.addAll(new HashSet(Bean.listToMap(childGroupSequenceList, "id", "id", PlanClassifyTree.class).keySet()));
List<PlanClassifyTreeVo> allChildIncludeMe = getAllChildIncludeMe(seq);
allIds.addAll(Bean.listToMap(TreeUtil.getAllChildren(allChildIncludeMe), "id", "id", PlanClassifyTreeVo.class).keySet());
}
// 查询分类下是否有预案
if (planDetailDao.existsByClassifyIdInAndIsDelete(allIds, false)) {
......@@ -95,39 +96,8 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
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
public Collection<PlanClassifyTreeVo> getAllChildIncludeMe(Long root) {
public List<PlanClassifyTreeVo> getAllChildIncludeMe(Long root) {
List<PlanClassifyTreeVo> treeDaoAll = Bean.toModels(planClassifyTreeDao.getAll(), PlanClassifyTreeVo.class);
Collection<PlanClassifyTreeVo> treeList = TreeBuilder.bulid(treeDaoAll, root);
if (!ROOT.equals(root)) {
......@@ -138,7 +108,7 @@ public class PlanClassifyTreeServiceImpl implements IPlanClassifyTreeService {
return Arrays.asList(classifyTreeVo);
}
}
return treeList;
return new ArrayList<>(treeList);
}
@Override
......
......@@ -16,6 +16,8 @@ import java.util.Set;
import java.util.function.Function;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -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.TodaySafetyIndexVo;
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.DateUtil;
import com.yeejoin.amos.fas.core.common.response.CoordDTO;
......@@ -118,6 +112,9 @@ public class View3dServiceImpl implements IView3dService {
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private DataSyncUtil dataSyncUtil;
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResponse setPoint3dPosition(List<BindPointBo> pointBoList) {
......@@ -248,6 +245,7 @@ public class View3dServiceImpl implements IView3dService {
if(ue4Rotation != null) riskSource.setUe4Rotation(pointBo.getUe4Rotation());
if(position3d != null) riskSource.setPosition3d(position3d);
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 {
* @return
*/
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 {
*/
List<EquipmentCategory> list( );
/**
* 获取装备树
* @return
*/
List<EquipmentCategory> getAllTree(Long root);
}
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.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.response.EquipDetailsResponse;
import com.yeejoin.amos.fas.core.util.DaoCriteria;
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.PreplanPicture;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
......@@ -113,8 +113,19 @@ public interface IEquipmentService {
/**
* 获取重点设备绑定设备
* @param id
* @param firealarm
* @param typeCode
* @return
*/
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);
}
}
......@@ -28,7 +28,7 @@ public class EquipmentSpecificIndexVo {
private String name;
private String equipmentIndexName;
private String equipmentIndexUnitName;
// 性能指标name key
......@@ -43,6 +43,16 @@ public class EquipmentSpecificIndexVo {
// 订阅类型
private String type;
private String typeCode;
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public void setId(long id) {
this.id = id;
}
......
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.vo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import java.io.Serializable;
public class ReginParams implements Serializable {
......@@ -12,6 +14,25 @@ public class ReginParams implements Serializable {
private CompanyBo company;
private RoleBo role;
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() {
return company;
}
......
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.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.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.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.RoleModel;
import org.aspectj.lang.JoinPoint;
......@@ -15,9 +22,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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.ObjectUtils;
......@@ -26,21 +31,9 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSON;
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 javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Aspect
@Component
......
......@@ -3,7 +3,7 @@ security.password=a1234560
security.loginId=fas_autosys
#environment
#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.fetch-registry = true
eureka.client.healthcheck.enabled = true
......@@ -19,11 +19,13 @@ spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
#ws
params.remoteWebsocketUrl=http://172.16.11.36:10600/
#redis
spring.redis.database=0
spring.redis.host=172.16.3.100
spring.redis.host=172.16.10.85
spring.redis.port=6379
spring.redis.password=1234560
spring.redis.password=amos2019Redis
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=10
......@@ -39,9 +41,9 @@ params.isPush=true
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.100:1883
emqx.user-name=admin
emqx.password=admin
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
#�����
file.downLoad.url=http://39.98.246.31:8888/
#站端名称使用全拼
......
spring.application.name = AMOS-AUTOSYS
server.servlet.context-path=/fireAutoSys
server.port = 8083
server.port = 8085
spring.profiles.active=dev
#应用product appkey
security.productWeb=STUDIO_APP_WEB
......@@ -50,7 +50,7 @@ visual.fegin.name=maas-visual
#值班系统
dutyMode.fegin.name=AMOS-DUTYMODE
#队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统
equipManage.fegin.name=AMOS-EQUIPMANAGE
equipManage.fegin.name=AMOS-EQUIPMANAGE-TT
#feginName
number.plan.projectName=换流站消防专项预案
......@@ -99,5 +99,10 @@ data.type.extinguisher=3104
data.type.hydrant=3105
outSystem.fegin.name=unKnow
outSystem.user.password=a1234560
privilege.fegin.name=AMOS-API-PRIVILEGE
......@@ -105,7 +105,7 @@
END AS type,
wlesa.update_date as createDate,
wlesa.recovery_date as recoveryDate,
wws.full_name as warehouseStructureName,
CONCAT(IFNULL(wws.full_name,''),' ',IFNULL(wlsd.description,'')) as warehouseStructureName,
(
SELECT
group_concat(DISTINCT f.`name`)
......
......@@ -32,7 +32,7 @@
equ.code as code,
det.name as name,
cate.name as type,
ware.full_name as address,
concat_ws('-',ware.full_name, det.area) as address,
spe.single as single,
sto.amount as amount,
spe.iot_code,
......@@ -40,8 +40,14 @@
spe.system_id,
manage.name as system_name
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' ">
left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id
</if>
......@@ -51,23 +57,36 @@
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
where sto.amount <![CDATA[>]]> 0
and spe.id is not 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},'%'))
</if>
<if test="code != null and code!='null' ">
and cate.code like CONCAT('%',#{code},'%' )
and cate.code like #{code}
</if>
<if test="equipmentId != null and equipmentId!='null' ">
and fire.equipment_id = #{equipmentId}
</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}
</select>
<select id="getEquipmentBySpeCount" resultType="int">select
count(1)
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' ">
left join f_equipment_fire_equipment as fire on spe.id = fire.fire_equipment_id
</if>
......@@ -77,15 +96,22 @@
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
where sto.amount <![CDATA[>]]> 0
and spe.id is not 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},'%'))
</if>
<if test="code != null and code!='null' ">
and cate.code like CONCAT('%',#{code},'%' )
and cate.code like #{code}
</if>
<if test="equipmentId != null and equipmentId!='null' ">
and fire.equipment_id = #{equipmentId}
</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 id="getFireEquiments" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpeVo">
select
......
......@@ -164,7 +164,7 @@
WHEN 'false' THEN '否'
ELSE ind.value END 'e_value',
ein.unit as eq_point_unit,
str.full_name as source_name,
CONCAT(IFNULL(str.full_name,''),' ',IFNULL(sto.description,'')) as source_name,
(
SELECT
group_concat(DISTINCT f.`name`)
......
......@@ -101,12 +101,16 @@
</select>
<select id="listByEquipmentPointId" resultType="com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint">
select
id,fmea_id as fmeaId,equipment_point_id as equipmentPointId,state
from
f_fmea_equipment_point
where
equipment_point_id = #{equipmentPointId}
SELECT
point.id,
point.fmea_id AS fmeaId,
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
equipment.equipment_index_id = #{equipmentPointId}
</select>
<select id="listEquipmentPoint" resultType="java.util.Map">
......
......@@ -89,4 +89,8 @@
a.reserve_plan IS NOT NULL
AND a.reserve_plan != ''
</select>
<select id="getAllCode" resultType="string">
select distinct code from f_equipment
</select>
</mapper>
\ No newline at end of file
......@@ -199,6 +199,21 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</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>
<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