Commit 9f881e0a authored by xukaiqiang's avatar xukaiqiang

Merge branch 'feture-xkq' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into feture-xkq

parents 14eca8ec e5636366
......@@ -87,6 +87,12 @@ public class Fmea extends BasicEntity {
@Column(name = "person_leader")
private Integer personLeader;
@Column(name = "identify_user")
private Integer identifyUser;
@Column(name = "identify_method")
private String identifyMethod;
public Fmea() {
}
......@@ -288,4 +294,20 @@ public class Fmea extends BasicEntity {
public void setPersonLeader(Integer personLeader) {
this.personLeader = personLeader;
}
public Integer getIdentifyUser() {
return identifyUser;
}
public void setIdentifyUser(Integer identifyUser) {
this.identifyUser = identifyUser;
}
public String getIdentifyMethod() {
return identifyMethod;
}
public void setIdentifyMethod(String identifyMethod) {
this.identifyMethod = identifyMethod;
}
}
\ No newline at end of file
......@@ -43,4 +43,5 @@ public class FasConstant {
public static final String RISK_SOURCE_STATUS_NORMAL = "NORMAL";//风险点状态-正常
public static final String RISK_SOURCE_STATUS_ANOMALY = "ANOMALY";//风险点状态-正常
public static final String PLAN_SOURCE_TYPE = "plan_source_type";//预案资源类型
}
......@@ -3,8 +3,10 @@ package com.yeejoin.amos.fas.business.controller;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.param.FireEquipmentParam;
import com.yeejoin.amos.fas.business.param.FireEquipmentPointParam;
import com.yeejoin.amos.fas.business.param.WaterResourceParam;
import com.yeejoin.amos.fas.business.service.intfc.IExcelService;
import com.yeejoin.amos.fas.business.util.FileHelper;
import com.yeejoin.amos.fas.core.util.FileUtil;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.security.authorization.Authorization;
......@@ -14,15 +16,13 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@RestController
......@@ -76,20 +76,50 @@ public class ExcelController extends BaseController {
@Authorization(ingore = true)
public void export(HttpServletResponse response,
@ApiParam(value = "data:导出数据;model:导出模板", required = true) @RequestParam String exportType,
@ApiParam(value = "point:监测点;equipment:设备", required = true) @RequestParam String modelName) {
@ApiParam(value = "point:监测点;equipment:设备", required = true) @RequestParam String modelName,
@ApiParam(value = "查询条件") @RequestBody(required = false) Map<String, Object> paramsMap) {
String fileName = UUID.randomUUID().toString() + ".xls";
String title = "监测点";
Class cls = null;
if ("point".equals(modelName)) {
title = "消防点位";
cls = FireEquipmentPointParam.class;
} else if ("equipment".equals(modelName)) {
title = "消防资源";
cls = FireEquipmentParam.class;
} else if ("water".equals(modelName)) {
title = "水资源";
cls = WaterResourceParam.class;
}
if (cls != null) {
List<?> list = Lists.newArrayList();
if ("model".equals(exportType)) {
FileHelper.exportExcel(list, title, title, cls, fileName, response);
if ("data".equals(exportType)) {
list = iExcelService.exportPointData(paramsMap);
}
FileHelper.exportExcel(list, title, title, cls, fileName, response);
}
}
@ApiOperation(value = "导入数据", notes = "导入数据")
@PostMapping(value = "/import/data/excel/{type}")
public CommonResponse importExcelData(@RequestPart("file") MultipartFile file, @ApiParam(value = "导入资源类型", required = true) @PathVariable String type) {
String fileName = file.getOriginalFilename();
if (fileName.endsWith(".xls") || fileName.endsWith(".xlsx")) {
try {
if ("fireResource".equals(type)) {//导入消防装备
List<FireEquipmentParam> list = FileHelper.importExcel(file, 1, 1, FireEquipmentParam.class);
iExcelService.importFireEquipment(list);
} else if ("water".equals(type)) {//导入水资源
List<WaterResourceParam> list = FileHelper.importExcel(file, 1, 1, WaterResourceParam.class);
iExcelService.importWaterResource(list);
}
return CommonResponseUtil.success();
} catch (Exception e) {
logger.info("导入数据异常", e);
return CommonResponseUtil.failure("导入失败");
}
} else {
return CommonResponseUtil.failure("文件格式错误");
}
}
}
package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.service.intfc.IMaasVisualService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.core.util.*;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
......@@ -45,7 +45,7 @@ public class FileController extends BaseController {
private String readUrl;
@Autowired
private IMaasVisualService iMaasVisualService;
private IPlanVisual3dService iMaasVisualService;
//文件上传
@RequestMapping(value = "/uploadfile", method = RequestMethod.POST)
......
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IMaasVisualService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.security.authorization.Authorization;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,25 +15,54 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/api/visual")
@Api(tags="预案可视化API")
public class MaasVisualController extends BaseController {
@Api(tags = "预案可视化API")
public class PlanVisual3dController extends BaseController {
private final Logger log = LoggerFactory.getLogger(MaasVisualController.class);
private final Logger log = LoggerFactory.getLogger(PlanVisual3dController.class);
@Autowired
private IMaasVisualService maasVisualService;
private IPlanVisual3dService planVisual3dService;
@ApiOperation(value = "预案应用树", notes = "预案应用树")
@GetMapping(value = "/plan/tree")
public CommonResponse getPlanTree() {
return CommonResponseUtil.success(maasVisualService.getPlanTree());
return CommonResponseUtil.success(planVisual3dService.getPlanTree());
}
@ApiOperation(value = "根据ID获取文字预案", notes = "根据ID获取文字预案")
@GetMapping(value = "/plan/text/{id}")
public CommonResponse getTextPlanById(@PathVariable(value = "id") Long id) {
return CommonResponseUtil.success(maasVisualService.getTextPlanInfoById(id));
return CommonResponseUtil.success(planVisual3dService.getTextPlanInfoById(id));
}
/**
* 资源设备信息查询
*/
@ApiOperation(httpMethod = "GET", value = "资源查询", notes = "资源查询")
@Authorization(ingore = true)
@GetMapping(value = "/resource/{type}/list")
public CommonResponse getResourceList(@ApiParam(value = "资源类型", required = true) @PathVariable String type) {
return planVisual3dService.getResourceListByType(type);
}
/**
* 资源设备数据项查询
*
* @param id
* @return
*/
@Authorization(ingore = true)
@GetMapping(value = "/{type}/detail/{id}")
@ApiOperation(value = "数据项查询", notes = "按照分类及id查询数据项")
public CommonResponse getResourceDetail(
@ApiParam(value = "资源类型", required = true) @PathVariable String type,
@ApiParam(value = "主键id", required = true) @PathVariable Long id) {
List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id);
return CommonResponseUtil.success(list);
}
}
......@@ -22,12 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
......@@ -170,4 +165,10 @@ public class RiskModelController extends BaseController {
Page<HashMap<String, Object>> fmeaList = fmeaService.queryFmeaList(param);
return CommonResponseUtil.success(fmeaList);
}
@ApiOperation(value = "Fmea是否关联对象查询", notes = "Fmea是否关联对象查询")
@GetMapping(value = "/fmea/{ids}/controlObjCount")
public CommonResponse queryFmeaControlObj(@ApiParam(value = "fmea ids") @PathVariable(value = "ids", required = true) String[] ids) {
return CommonResponseUtil.success(fmeaService.queryControlObjCount(ids));
}
}
package com.yeejoin.amos.fas.business.dao.mapper;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface PlanVisual3dMapper extends BaseMapper {
List<HashMap<String,String>> getResourceListByType(@Param("type") String type);
Map<String, Object> queryOneByTypeAndId(@Param("type") String type, @Param("id") Long id);
}
package com.yeejoin.amos.fas.business.dao.mapper;
import com.yeejoin.amos.fas.business.param.WaterResourceParam;
import com.yeejoin.amos.fas.dao.entity.WaterResource;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface WaterResourceMapper extends BaseMapper {
......@@ -28,4 +31,10 @@ public interface WaterResourceMapper extends BaseMapper {
Long queryCountForBindFireEqumntPage(
@Param("waterResourceId") Long waterResourceId);
List<WaterResource> listByCodes(@Param("codes") Set<String> codes);
void saveBatch(List<WaterResourceParam> list);
void updateBatch(List<WaterResourceParam> list);
}
......@@ -38,4 +38,10 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> {
Fmea findById(Long id);
@Query(value = "SELECT count(1) FROM `f_fmea_point_inputitem` WHERE fmea_id in ?1", nativeQuery = true)
int countAssociatedInputItemByIds(String[] ids);
@Query(value = "SELECT count(1) FROM `f_fmea_equipment_point` WHERE fmea_id in ?1", nativeQuery = true)
int countAssociatedEquipPointByIds(String[] ids);
}
......@@ -30,6 +30,8 @@ public class FireEquipmentPointEntity extends FireEquipmentPointExtend {
private Long alarmType;
private String fireEquipmentCode;
public Long getId() {
return id;
}
......@@ -125,4 +127,12 @@ public class FireEquipmentPointEntity extends FireEquipmentPointExtend {
public void setAlarmType(Long alarmType) {
this.alarmType = alarmType;
}
public String getFireEquipmentCode() {
return fireEquipmentCode;
}
public void setFireEquipmentCode(String fireEquipmentCode) {
this.fireEquipmentCode = fireEquipmentCode;
}
}
......@@ -51,6 +51,9 @@ public class FireEquipmentParam {
@Excel(name = "风险区域编号", orderNum = "14")
private Long riskSourceId;
@Excel(name = "厂商", orderNum = "15", width = 20)
private String manufacturer;
public Long getId() {
return id;
}
......@@ -178,4 +181,12 @@ public class FireEquipmentParam {
public void setRiskSourceId(Long riskSourceId) {
this.riskSourceId = riskSourceId;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
}
......@@ -6,25 +6,30 @@ public class FireEquipmentPointParam {
private Long id;
@Excel(name = "名称", orderNum = "1")
@Excel(name = "名称", orderNum = "1", width = 50)
private String name;
@Excel(name = "编号", orderNum = "2")
@Excel(name = "编号", orderNum = "2", width = 12)
private String code;
@Excel(name = "消防装备编号", orderNum = "3")
@Excel(name = "消防装备编号", orderNum = "3", width = 15)
private String fireEquipmentCode;
@Excel(name = "消防装备名称", orderNum = "4", width = 50)
private String fireEquipmentName;
private Long fireEquipmentId;
@Excel(name = "类型", replace = {"模拟量_ANALOGUE", "开关量_SWITCH"}, orderNum = "4")
@Excel(name = "类型", replace = {"模拟量_ANALOGUE", "开关量_SWITCH"}, orderNum = "5")
private String type;
@Excel(name = "单位", orderNum = "5")
@Excel(name = "值", replace = {"是_true", "否_false"}, orderNum = "6", width = 12)
private String value;
@Excel(name = "单位", orderNum = "7", width = 12)
private String unit;
@Excel(name = "告警类型", replace = {"火灾告警_1", "电源开关_2", "换流变_6", "液位_3", "流量_4", "容量_5"}, orderNum = "6")
@Excel(name = "告警类型", replace = {"火灾告警_1", "电源开关_2", "换流变_6", "液位_3", "流量_4", "容量_5"}, orderNum = "8")
private Long alarmType;
public Long getId() {
......@@ -90,4 +95,20 @@ public class FireEquipmentPointParam {
public void setFireEquipmentId(Long fireEquipmentId) {
this.fireEquipmentId = fireEquipmentId;
}
public String getFireEquipmentName() {
return fireEquipmentName;
}
public void setFireEquipmentName(String fireEquipmentName) {
this.fireEquipmentName = fireEquipmentName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.yeejoin.amos.fas.business.param;
import cn.afterturn.easypoi.excel.annotation.Excel;
public class WaterResourceParam {
private Long id;
@Excel(name = "编号", width = 20)
private String code;
@Excel(name = "名称", orderNum = "1", width = 20)
private String name;
@Excel(name = "类型", replace = {"消火栓_1", "消防水池_2", "喷淋_3"}, orderNum = "3")
private String type;
@Excel(name = "三维坐标", orderNum = "4", width = 15)
private String position3d;
@Excel(name = "三维楼层", orderNum = "5")
private String floor3d;
@Excel(name = "是否室内", replace = {"是_1", "否_0"}, orderNum = "6")
private Boolean isIndoor=true;
@Excel(name = "所属风险区域", orderNum = "7")
private Long riskSourceId;
@Excel(name = "房间", orderNum = "8")
private String room;
@Excel(name = "位置", orderNum = "9")
private String address;
@Excel(name = "机构编号", orderNum = "10")
private String orgCode;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getPosition3d() {
return position3d;
}
public void setPosition3d(String position3d) {
this.position3d = position3d;
}
public String getFloor3d() {
return floor3d;
}
public void setFloor3d(String floor3d) {
this.floor3d = floor3d;
}
public Boolean getIsIndoor() {
return isIndoor;
}
public void setIsIndoor(Boolean isIndoor) {
this.isIndoor = isIndoor;
}
public Long getRiskSourceId() {
return riskSourceId;
}
public void setRiskSourceId(Long riskSourceId) {
this.riskSourceId = riskSourceId;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
}
......@@ -5,16 +5,24 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FireEquipPointMapper;
import com.yeejoin.amos.fas.business.dao.mapper.WaterResourceMapper;
import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentEntity;
import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentPointEntity;
import com.yeejoin.amos.fas.business.param.FireEquipmentParam;
import com.yeejoin.amos.fas.business.param.FireEquipmentPointParam;
import com.yeejoin.amos.fas.business.param.WaterResourceParam;
import com.yeejoin.amos.fas.business.service.intfc.IExcelService;
import com.yeejoin.amos.fas.business.service.intfc.IFireEquipPontService;
import com.yeejoin.amos.fas.dao.entity.WaterResource;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -28,6 +36,12 @@ public class ExcelServiceImpl implements IExcelService {
@Autowired
private FireEquipPointMapper fireEquipPointMapper;
@Autowired
private IFireEquipPontService fireEquipPointService;
@Autowired
private WaterResourceMapper waterResourceMapper;
@Transactional
@Override
public void importFireEquipment(List<FireEquipmentParam> list) {
......@@ -90,4 +104,43 @@ public class ExcelServiceImpl implements IExcelService {
fireEquipPointMapper.updateBatch(updateList);
}
}
@Override
public List<?> exportPointData(Map<String, Object> paramsMap) {
CommonResponse result = fireEquipPointService.queryByMap(paramsMap);
List<FireEquipmentPointEntity> fireEquipmentPoints = ((PageImpl) result.getDataList()).getContent();
List<FireEquipmentPointParam> pointExcelList = new ArrayList<>();
for (FireEquipmentPointEntity point : fireEquipmentPoints) {
FireEquipmentPointParam pointParam = new FireEquipmentPointParam();
BeanUtils.copyProperties(point, pointParam);
pointExcelList.add(pointParam);
}
return pointExcelList;
}
@Override
public void importWaterResource(List<WaterResourceParam> list) {
List<String> codeList = Lists.transform(list, WaterResourceParam::getCode);
Set<String> codeSet = Sets.newHashSet(codeList);
List<WaterResource> waterResources = waterResourceMapper.listByCodes(codeSet);
Map<String, WaterResource> waterResourceMap = Maps.uniqueIndex(waterResources, WaterResource::getCode);
List<WaterResourceParam> saveList = Lists.newArrayList();
List<WaterResourceParam> updateList = Lists.newArrayList();
list.forEach(warerRes -> {
String code = warerRes.getCode();
WaterResource waterResource = waterResourceMap.get(code);
if (waterResource == null) {
saveList.add(warerRes);
} else {
warerRes.setId(waterResource.getId());
updateList.add(warerRes);
}
});
if (!CollectionUtils.isEmpty(saveList)) {
waterResourceMapper.saveBatch(saveList);
}
if (!CollectionUtils.isEmpty(updateList)) {
waterResourceMapper.updateBatch(updateList);
}
}
}
......@@ -109,6 +109,16 @@ public class FmeaServiceImpl implements IFmeaService {
}
@Override
public int queryControlObjCount(String[] ids) {
int count1 = iFmeaDao.countAssociatedEquipPointByIds(ids);
int count2 = iFmeaDao.countAssociatedInputItemByIds(ids);
if (count1 > 0 || count2 > 0) {
return count1 + count2;
}
return 0;//没有关联对象
}
private boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from) throws Exception {
if (!CollectionUtils.isEmpty(riskSourceList)) {
for (RiskSource riskSource : riskSourceList) {
......
package com.yeejoin.amos.fas.business.service.impl;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
import com.yeejoin.amos.fas.business.service.intfc.IMaasVisualService;
import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service("maasVisualService")
public class MaasVisualServiceImpl implements IMaasVisualService {
@Service("planVisual3dService")
public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
IMaasVisualServer maasVisualServer;
......@@ -24,13 +28,19 @@ public class MaasVisualServiceImpl implements IMaasVisualService {
@Autowired
ITextPlanDao iTextPlanDao;
@Autowired
PlanVisual3dMapper planVisual3dMapper;
@Autowired
IDictService dictService;
@Override
public List<TreeSubjectVo> getPlanTree() {
CommonResponse response = maasVisualServer.getTree();
List<TreeSubjectVo> treeSubjectVos = Lists.newArrayList();
if (null != response.getDataList()) {
List<Object> res = (List<Object>)response.getDataList();
List<Object> res = (List<Object>) response.getDataList();
if (!CollectionUtils.isEmpty(res)) {
treeSubjectVos = listToTree(res);
}
......@@ -115,4 +125,54 @@ public class MaasVisualServiceImpl implements IMaasVisualService {
return treeSubjectVos;
}
@Override
public CommonResponse getResourceListByType(String type) {
//1.校验是否是约定的字典,不存在则提示失败
Dict dict = new Dict();
dict.setDictCode(FasConstant.PLAN_SOURCE_TYPE);
dict.setDictValue(type);
List<Dict> dictList = dictService.getDictList(dict);
if (CollectionUtils.isEmpty(dictList)) {
return CommonResponseUtil.failure(type + "字典类型不存在");
}
//2.返回存在的数据
return CommonResponseUtil.success(planVisual3dMapper.getResourceListByType(type));
}
@Override
public List<Map<String, Object>> getResourceById(String type, Long id) {
//1.查询出要返回数据
Map<String, Object> map = planVisual3dMapper.queryOneByTypeAndId(type, id);
//1.1无数据则返回
if (CollectionUtils.isEmpty(map)) {
return new ArrayList<>();
}
//2.加工数据
//2.0查询出中英文对照字典映射
Dict dict = new Dict();
dict.setDictCode(type);
List<Dict> dictList = dictService.getDictList(dict);
Map<String, String> dicts = dictList.stream().collect(
Collectors.toMap(Dict::getDictValue, Dict::getDictName, (key1, key2) -> key2));
//2.1换key为中文
Map<String, Object> tempMap = new HashMap<String, Object>();
map.forEach((k, v) -> {
if (dicts.containsKey(k)) {
tempMap.put(dicts.get(k), v);
}
});
//2.2map转list
List<Map<String, Object>> list = new ArrayList<>();
list = tempMap.entrySet().stream().map(e -> {
Map<String, Object> newMap = new HashMap<String, Object>();
newMap.put("label", e.getKey());
newMap.put("value", e.getValue());
return newMap;
}).collect(Collectors.toList());
return list;
}
}
......@@ -2,8 +2,10 @@ package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.param.FireEquipmentParam;
import com.yeejoin.amos.fas.business.param.FireEquipmentPointParam;
import com.yeejoin.amos.fas.business.param.WaterResourceParam;
import java.util.List;
import java.util.Map;
public interface IExcelService {
......@@ -11,4 +13,7 @@ public interface IExcelService {
void importFireEquipmentPoint(List<FireEquipmentPointParam> list);
List<?> exportPointData(Map<String, Object> paramsMap);
void importWaterResource(List<WaterResourceParam> list);
}
......@@ -38,4 +38,12 @@ public interface IFmeaService {
void updateRpniInfo(Long riskSourceId);
/**
* 查询关联的关联对象个数
*
* @param ids
* @return count 关联对象个数
*/
int queryControlObjCount(String[] ids);
}
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface IMaasVisualService {
public interface IPlanVisual3dService {
/**
* 获取预案树
......@@ -29,4 +31,8 @@ public interface IMaasVisualService {
* @return
*/
TextPlan getTextPlanInfoById(Long id);
CommonResponse getResourceListByType(String type);
List<Map<String,Object>> getResourceById(String type,Long id);
}
......@@ -892,7 +892,7 @@ public class FileHelper {
private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
try {
String name = new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
response.reset();
// response.reset();
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment;filename=" + name);
......
......@@ -102,4 +102,28 @@
</sql>
</changeSet>
<changeSet author="tianbo" id="1582104676000-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="identify_user"/>
</not>
</preConditions>
<comment>f_fmea add column identify_user</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `identify_user` int(11) DEFAULT NULL COMMENT '辨识人';
</sql>
</changeSet>
<changeSet author="tianbo" id="1582104676000-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="identify_method"/>
</not>
</preConditions>
<comment>f_fmea add column identify_method</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `identify_method` varchar(255) DEFAULT NULL COMMENT '辨识方法';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper">
<!--查询-->
<select id="getResourceListByType" resultType="java.util.HashMap">
SELECT
rs.id,rs.name,rs.code
from
<choose>
<when test="type=='fireCar'">
(SELECT a.id,a.name,a.car_num as code FROM `f_fire_car` a) as rs
</when>
<when test="type=='monitorEquipment'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 0) as rs
</when>
<when test="type=='fireConsumables'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 1) as rs
</when>
<when test="type=='video'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 2) as rs
</when>
<when test="type=='fireEquipment'">
(select a.id,a.name,a.code from f_fire_equipment a where a.equip_classify = 3) as rs
</when>
<when test="type=='impEquipment'">
(select a.id,a.`name`,a.`code` from f_equipment a) as rs
</when>
<when test="type=='fireStrength'">
(select a.id,a.`username` as name ,a.`code` from f_fire_strength a) as rs
</when>
<when test="type=='fireChamber'">
(select a.id,a.`name`,a.`code` from f_fire_station a where a.type = '1') as rs
</when>
<when test="type=='fireFoamRoom'">
(select a.id,a.`name`,a.`code` from f_fire_station a where a.type = '2') as rs
</when>
<when test="type=='hydrant'">
(SELECT a.id,a.`name`,a.code FROM `f_water_resource` a where a.type = '1') as rs
</when>
<when test="type=='pool'">
(SELECT a.id,a.`name`,a.code FROM `f_water_resource` a where a.type = '2') as rs
</when>
</choose>
</select>
<select id="queryOneByTypeAndId" resultType="hashmap">
SELECT
*
from
<choose>
<when test="type=='fireCar'">
(SELECT * FROM `f_fire_car` a) as rs
</when>
<when test="type=='monitorEquipment'">
(select * from f_fire_equipment a where a.equip_classify = 0) as rs
</when>
<when test="type=='fireConsumables'">
(select * from f_fire_equipment a where a.equip_classify = 1) as rs
</when>
<when test="type=='video'">
(select * from f_fire_equipment a where a.equip_classify = 2) as rs
</when>
<when test="type=='fireEquipment'">
(select * from f_fire_equipment a where a.equip_classify = 3) as rs
</when>
<when test="type=='impEquipment'">
(select * from f_equipment a) as rs
</when>
<when test="type=='fireStrength'">
(select * from f_fire_strength a) as rs
</when>
<when test="type=='fireChamber'">
(select * from f_fire_station a where a.type = '1') as rs
</when>
<when test="type=='fireFoamRoom'">
(select * from f_fire_station a where a.type = '2') as rs
</when>
<when test="type=='hydrant'">
(SELECT * FROM `f_water_resource` a where a.type = '1') as rs
</when>
<when test="type=='pool'">
(SELECT * FROM `f_water_resource` a where a.type = '2') as rs
</when>
</choose>
where rs.id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -25,8 +25,9 @@
select fd.dict_name, fd.dict_value, fd.dict_code, fd.id, fd.parent_id, fd.remark, fd.dict_order from f_dict fd
<where>
<if test="dictName != null">fd.dict_name like concat('%', #{dict.dictName}, '%')</if>
<if test="dictCode != null">fd.dict_code = #{dictCode}</if>
<if test="parentId != null and parentId > 0 ">fd.parent_id = #{parentId}</if>
<if test="dictCode != null"> and fd.dict_code = #{dictCode}</if>
<if test="dictValue !=null">and fd.dict_value = #{dictValue}</if>
<if test="parentId != null and parentId > 0 ">and fd.parent_id = #{parentId}</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -132,7 +132,8 @@
a.unit,
a.org_code as orgCode,
a.alarm_type as alarmType,
b.name as fireEquipmentName
b.name as fireEquipmentName,
b.code as fireEquipmentCode
from
f_fire_equipment_point as a
left join
......@@ -149,7 +150,7 @@
</if>
</where>
order by a.create_date desc
<if test="pageSize!=null and pageNumber!=null">
<if test="pageSize!=null and pageSize!=-1 and pageNumber!=null">
limit #{pageNumber},#{pageSize}
</if>
</select>
......
......@@ -50,7 +50,10 @@
rf.`name` AS riskFactorName,
fat.`name` AS accidentTypeName,
fat.id AS accidentTypeId,
concat(fems.influence,'-',fems.describe) as influence
concat(fems.influence,'-',fems.describe) as influence,
fm.identify_user as identifyUser,
(select name from s_user where id = fm.identify_user) as identifyUserName,
fm.identify_method as identifyMethod
FROM
(
SELECT
......
......@@ -103,5 +103,89 @@
LIMIT ${start}, ${length};
</select>
<select id="listByCodes" resultType="com.yeejoin.amos.fas.dao.entity.WaterResource">
select
id,
code,
name
from
f_water_resource
where
code in
<foreach collection="codes" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<insert id="saveBatch" keyColumn="id" keyProperty="id"
parameterType="com.yeejoin.amos.fas.business.param.WaterResourceParam"
useGeneratedKeys="true">
insert into f_water_resource
(
`name`,
`code`,
`type`,
`floor3d`,
`room`,
`address`,
`position3d`,
`org_code`,
`is_indoor`,
`risk_source_id`
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.name},
#{item.code},
#{item.type},
#{item.floor3d},
#{item.room},
#{item.address},
#{item.position3d},
#{item.orgCode},
#{item.isIndoor},
#{item.riskSourceId}
)
</foreach>
</insert>
<update id="updateBatch">
<foreach collection="list" item="item" index="index" separator=";">
update f_water_resource
<set>
<if test="item.orgCode != null">
org_code = #{item.orgCode},
</if>
<if test="item.code != null">
code = #{item.code},
</if>
<if test="item.type != null">
type = #{item.type},
</if>
<if test="item.position3d != null">
position3d = #{item.position3d},
</if>
<if test="item.floor3d != null">
floor3d = #{item.floor3d},
</if>
<if test="item.isIndoor != null">
is_indoor = #{item.isIndoor},
</if>
<if test="item.name != null">
name = #{item.name},
</if>
<if test="item.room != null">
room = #{item.room},
</if>
<if test="item.address != null">
address = #{item.address},
</if>
<if test="item.riskSourceId != null">
risk_source_id = #{item.riskSourceId},
</if>
</set>
where id = #{item.id}
</foreach>
</update>
</mapper>
\ No newline at end of file
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