Commit c39590ad authored by suhuiguang's avatar suhuiguang

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

parents 2ac23d6e b505fa5e
package com.yeejoin.amos.fas.dao.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
* The persistent class for the fire_car database table.
*
*/
@Entity
@Table(name="f_safety_index_change_log")
@NamedQuery(name="SafetyIndexChangeLog.findAll", query="SELECT s FROM SafetyIndexChangeLog s")
public class SafetyIndexChangeLog implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "ID",nullable=false,unique=true)
private Long id;
@Column(name="safety_index")
private BigDecimal safetyIndex;
@Column(name="collect_date")
private Date collectDate;
@Column(name="org_code")
private String orgCode;
@Column(name="remark")
private String remark;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public BigDecimal getSafetyIndex() {
return safetyIndex;
}
public void setSafetyIndex(BigDecimal safetyIndex) {
this.safetyIndex = safetyIndex;
}
public Date getCollectDate() {
return collectDate;
}
public void setCollectDate(Date collectDate) {
this.collectDate = collectDate;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.fas.business.bo.BindPointBo; import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.BindRegionBo; import com.yeejoin.amos.fas.business.bo.BindRegionBo;
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.vo.ExceptionRegionVo; import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.vo.ReginParams; import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum; import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.HashMap; import io.swagger.annotations.ApiParam;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/view3d") @RequestMapping("/api/view3d")
...@@ -120,6 +127,7 @@ public class View3dController extends BaseController { ...@@ -120,6 +127,7 @@ public class View3dController extends BaseController {
public CommonResponse getSafetyIndexDetail(@ApiParam(value = "risk-风险异常,check-巡检异常,equip-设备故障") @PathVariable String type){ public CommonResponse getSafetyIndexDetail(@ApiParam(value = "risk-风险异常,check-巡检异常,equip-设备故障") @PathVariable String type){
ReginParams reginParams =getSelectedOrgInfo(); ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams); String orgCode = this.getOrgCode(reginParams);
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.getSafetyIndexDetail(type,orgCode)); return CommonResponseUtil.success(view3dService.getSafetyIndexDetail(type,orgCode));
} }
...@@ -153,7 +161,10 @@ public class View3dController extends BaseController { ...@@ -153,7 +161,10 @@ public class View3dController extends BaseController {
@ApiOperation(value = "今日值班统计",notes = "今日值班统计") @ApiOperation(value = "今日值班统计",notes = "今日值班统计")
@GetMapping(value = "statistics/duty") @GetMapping(value = "statistics/duty")
public CommonResponse getStatisticsDuty(){ public CommonResponse getStatisticsDuty(){
return CommonResponseUtil.success(view3dService.getStatisticsDuty()); ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "10*11-28";
return view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
} }
@ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询") @ApiOperation(value = "异常区域信息查询",notes = "异常区域信息查询")
...@@ -180,16 +191,24 @@ public class View3dController extends BaseController { ...@@ -180,16 +191,24 @@ public class View3dController extends BaseController {
String orgCode = this.getOrgCode(reginParams); String orgCode = this.getOrgCode(reginParams);
//TODO:待删除 //TODO:待删除
orgCode = "1*2"; orgCode = "1*2";
return CommonResponseUtil.success(view3dService.initViewNode(type,orgCode)); return CommonResponseUtil.success(view3dService.initViewErrorNode(type,orgCode));
} }
@ApiOperation(value = "按照点类型查询点列表",notes = "按照点类型查询点列表") @ApiOperation(value = "按照点类型查询点列表",notes = "按照点类型查询点列表")
@GetMapping(value = "point/list") @GetMapping(value = "point/list")
public CommonResponse get3dPointsByType(@RequestParam(required = false,defaultValue = "all") String type){ public CommonResponse get3dPointsByType(@RequestParam(required = false,defaultValue = "grain") String model){
ReginParams reginParams =getSelectedOrgInfo(); ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams); String orgCode = this.getOrgCode(reginParams);
List<HashMap<String,Object>> pointList = view3dService.get3dPointsByType(orgCode,type); orgCode = "1*2";
return CommonResponseUtil.success(pointList); return CommonResponseUtil.success(view3dService.get3dPointsByModel(orgCode,model));
} }
@Scheduled(cron = "${param.safetyIndexchange.cron}")
@ApiOperation(value = "更新安全指数",notes = "更新安全指数")
@GetMapping(value = "safetyIndex/refresh")
public CommonResponse safetyIndexRefresh(){
view3dService.safetyIndexRefresh();
return CommonResponseUtil.success();
}
} }
...@@ -87,12 +87,29 @@ public interface View3dMapper extends BaseMapper{ ...@@ -87,12 +87,29 @@ public interface View3dMapper extends BaseMapper{
*/ */
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode); List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
List<View3dNodeVo> initViewImpEquipmentNode(String orgCode);
/** /**
* 按照类型查询点 * 按照类型查询点
* @param params {orgCode,type} * @param params {orgCode,type}
* @return 列表 * @return 列表
*/ */
List<HashMap<String, Object>> getPintsByType(Map<String, Object> params); List<HashMap<String, Object>> getPintsByType(Map<String, Object> params);
/**
* 更新safetyIndexchangelog
*/
void safetyIndexRefresh();
/**
* 重点模式设备
* @return
*/
List<View3dNodeVo> getImpEqu3dPoints(String orgCode);
/**
* 异常点
* @param type
* @param orgCode
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type, String orgCode);
} }
package com.yeejoin.amos.fas.business.dao.repository;
import org.springframework.stereotype.Repository;
import com.yeejoin.amos.fas.dao.entity.SafetyIndexChangeLog;
@Repository("iSafetyIndexChangeLogDao")
public interface ISafetyIndexChangeLogDao extends BaseDao<SafetyIndexChangeLog, Long>{
}
package com.yeejoin.amos.fas.business.feign;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
public class DutyModeServerFallback implements IDutyModeServer{
@Override
public CommonResponse dutyListByDay(String appKey,String product,String orgCode,String dutyDate) {
return CommonResponseUtil.failure("fegin调用失败!!!");
}
}
...@@ -25,5 +25,6 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor{ ...@@ -25,5 +25,6 @@ public class FeignBasicAuthRequestInterceptor implements RequestInterceptor{
authToken = request.getParameter("token"); authToken = request.getParameter("token");
} }
template.header("X-Access-Token", authToken); template.header("X-Access-Token", authToken);
template.header("token", authToken);
} }
} }
package com.yeejoin.amos.fas.business.feign;
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 com.yeejoin.amos.fas.core.util.CommonResponse;
@FeignClient(name="${dutyMode.fegin.name}", fallback=DutyModeServerFallback.class, configuration=FeignConfiguration.class)
public interface IDutyModeServer {
@RequestMapping(value = "/duty/listByDay", method = RequestMethod.POST,consumes = "application/json")
public CommonResponse dutyListByDay(
@RequestHeader(name="appKey",required = true) String appKey,
@RequestHeader(name="product",required = true) String product,
@RequestHeader(name="orgCode",required = true) String orgCode,
@RequestBody String param);
}
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import static org.hamcrest.CoreMatchers.either; import java.math.BigDecimal;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; import java.text.SimpleDateFormat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import com.alibaba.fastjson.JSONObject;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.persistence.criteria.CriteriaBuilder.Case; 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
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.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.bo.BindPointBo; import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.CheckErrorBo; import com.yeejoin.amos.fas.business.bo.CheckErrorBo;
...@@ -27,7 +31,16 @@ import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo; ...@@ -27,7 +31,16 @@ import com.yeejoin.amos.fas.business.bo.SafetyExecuteBo;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper; import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper;
import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper; import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.*; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireCarDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireStationDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.dao.repository.ISafetyIndexChangeLogDao;
import com.yeejoin.amos.fas.business.dao.repository.IWaterResourceDao;
import com.yeejoin.amos.fas.business.feign.IDutyModeServer;
import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService; import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.business.vo.ErrorContentVo; import com.yeejoin.amos.fas.business.vo.ErrorContentVo;
import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo; import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo;
...@@ -36,28 +49,24 @@ import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo; ...@@ -36,28 +49,24 @@ 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.CheckStatusEnum;
import com.yeejoin.amos.fas.common.enums.PlanTaskDetailStatusEnum; import com.yeejoin.amos.fas.common.enums.PlanTaskDetailStatusEnum;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum; import com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum;
import com.yeejoin.amos.fas.common.enums.StatisticsErrorTypeEum; import com.yeejoin.amos.fas.common.enums.StatisticsErrorTypeEum;
import com.yeejoin.amos.fas.common.enums.*; import com.yeejoin.amos.fas.common.enums.View3dRefreshAreaEum;
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.RegionTreeResponse; import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
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.Equipment;
import com.yeejoin.amos.fas.dao.entity.FireCar;
import com.yeejoin.amos.fas.dao.entity.FireEquipment;
import com.yeejoin.amos.fas.dao.entity.FireStation;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import com.yeejoin.amos.fas.dao.entity.SafetyIndexChangeLog;
import com.yeejoin.amos.fas.dao.entity.WaterResource;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author DELL * @author DELL
...@@ -85,6 +94,14 @@ public class View3dServiceImpl implements IView3dService { ...@@ -85,6 +94,14 @@ public class View3dServiceImpl implements IView3dService {
private PatrolMapper patrolMapper; private PatrolMapper patrolMapper;
@Autowired @Autowired
private IRiskLevelDao iRiskLevelDao; private IRiskLevelDao iRiskLevelDao;
@Autowired
private ISafetyIndexChangeLogDao iSafetyIndexChangeLogDao;
@Autowired
private RemoteWebSocketServer remoteWebSocketServer;
@Autowired
private IDutyModeServer dutyModeServer;
@Value("${param.system.online.date}") @Value("${param.system.online.date}")
private String onLineDate; private String onLineDate;
...@@ -442,12 +459,12 @@ public class View3dServiceImpl implements IView3dService { ...@@ -442,12 +459,12 @@ public class View3dServiceImpl implements IView3dService {
} }
@Override @Override
public Object getStatisticsDuty() { public CommonResponse getStatisticsDuty(String appKey,String product,String orgCode) {
return JSON.parse("{\r\n" + Date curDate = new Date();
" \"dutyPersonNumber\": 10,\r\n" + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
" \"firePersonNumber\": 15,\r\n" + JSONObject param = new JSONObject();
" \"securityPersonNumber\": 20,\r\n" + param.put("dutyDate", curDate);
" }"); return dutyModeServer.dutyListByDay(appKey,product,orgCode,param.toJSONString());
} }
@Override @Override
...@@ -457,21 +474,20 @@ public class View3dServiceImpl implements IView3dService { ...@@ -457,21 +474,20 @@ public class View3dServiceImpl implements IView3dService {
} }
@Override @Override
public List<View3dNodeVo> initViewNode(String type, String orgCode) { public List<View3dNodeVo> initViewErrorNode(String type, String orgCode) {
switch (type) { return view3dMapper.initViewErrorNode(type,orgCode);
case "impEquipment":
return view3dMapper.initViewImpEquipmentNode(orgCode);
default:
break;
}
return null;
} }
@Override @Override
public List<HashMap<String, Object>> get3dPointsByType(String orgCode,String type) { public CommonResponse get3dPointsByModel(String orgCode,String model) {
List<HashMap<String, Object>> points = new ArrayList<>(); if(model.equals("grain")) {
points = this.getPointsByType(orgCode,type); List<HashMap<String, Object>> points = new ArrayList<>();
return points; return CommonResponseUtil.success(this.getPointsByType(orgCode,FasConstant.ALL_POINT));
}else if(model.equals("impEquipment")) {
return CommonResponseUtil.success(view3dMapper.getImpEqu3dPoints(orgCode));
}
log.error("模式暂不支持 --> " + model);
return CommonResponseUtil.failure("模式暂不支持 --> " + model);
} }
private List<HashMap<String, Object>> getPointsByType(String orgCode,String type){ private List<HashMap<String, Object>> getPointsByType(String orgCode,String type){
...@@ -485,9 +501,46 @@ public class View3dServiceImpl implements IView3dService { ...@@ -485,9 +501,46 @@ public class View3dServiceImpl implements IView3dService {
points.forEach(point ->{ points.forEach(point ->{
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(point.get("ue4Location"))); JSONArray ue4Location = this.getInitJSONArray(String.valueOf(point.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(point.get("ue4Rotation"))); JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(point.get("ue4Rotation")));
String[] relationKeys = point.get("relationKeys") != null ? String.valueOf(point.get("relationKeys")).split(",") : null;
point.put("ue4Location",ue4Location); point.put("ue4Location",ue4Location);
point.put("ue4Rotation",ue4Rotation); point.put("ue4Rotation",ue4Rotation);
point.put("relationKeys",relationKeys);
}); });
return points; return points;
} }
@Override
public void safetyIndexRefresh() {
try {
List<RiskSource> riskSources = iRiskSourceDao.findByParentId(0l);
List<SafetyIndexChangeLog> sageTyIndexs = new ArrayList<>();
sageTyIndexs = riskSources.stream().map(riskSource -> {
SafetyIndexChangeLog safetyIndexChangeLog = new SafetyIndexChangeLog();
safetyIndexChangeLog.setOrgCode(riskSource.getOrgCode());
double changeRpnToSafetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
safetyIndexChangeLog.setSafetyIndex(BigDecimal.valueOf(changeRpnToSafetyIndex));
safetyIndexChangeLog.setCollectDate(new Date());
return safetyIndexChangeLog;
}).collect(Collectors.toList());;
iSafetyIndexChangeLogDao.saveAll(sageTyIndexs);
} catch (Exception e) {
log.error("更新失败: " + e.getMessage());
e.printStackTrace();
}
this.sendRefreshDate();
}
//推送刷新数据消息
private void sendRefreshDate() {
HashMap<String, String> message = new HashMap<>();
message.put("refreshType", View3dRefreshAreaEum.all.getCode());
try {
remoteWebSocketServer.sendMessage("refreshDate", JSON.toJSONString(message));
} catch (Exception e) {
log.error("推送消息失败!!!");
e.printStackTrace();
}
}
} }
...@@ -91,18 +91,44 @@ public interface IView3dService { ...@@ -91,18 +91,44 @@ public interface IView3dService {
*/ */
List<Map<String, Object>> getStatisticsCheck(String orgCode); List<Map<String, Object>> getStatisticsCheck(String orgCode);
/**
* 最新五条异常
* @param type
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getSafetyExecuteListTop5(String type, String orgCode); List<SafetyExecuteBo> getSafetyExecuteListTop5(String type, String orgCode);
Object getStatisticsDuty(); /**
* 今日值班统计
* @return
*/
CommonResponse getStatisticsDuty(String appKey, String product, String orgCode);
/**
* 设备状态消息最新5条
* @param orgCode
* @return
*/
Object getEquipStatusList(String orgCode); Object getEquipStatusList(String orgCode);
List<View3dNodeVo> initViewNode(String type, String orgCode); /**
* 左侧菜单(异常点)
* @param type
* @param orgCode
* @return
*/
List<View3dNodeVo> initViewErrorNode(String type, String orgCode);
/** /**
* 查询类型的点 * 查询类型的点
* @param orgCode 机构 * @param orgCode 机构
* @param type 点类型 * @param model 模式类型
* @return list * @return list
*/ */
List<HashMap<String, Object>> get3dPointsByType(String orgCode,String type); CommonResponse get3dPointsByModel(String orgCode,String model);
/**
* 刷新安全指数
*/
void safetyIndexRefresh();
} }
package com.yeejoin.amos.fas.business.vo; package com.yeejoin.amos.fas.business.vo;
import java.util.List;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.fas.business.util.StringUtil;
public class View3dNodeVo { public class View3dNodeVo {
...@@ -12,6 +15,9 @@ public class View3dNodeVo { ...@@ -12,6 +15,9 @@ public class View3dNodeVo {
private JSONArray ue4Location = new JSONArray(); private JSONArray ue4Location = new JSONArray();
private JSONArray ue4Rotation = new JSONArray(); private JSONArray ue4Rotation = new JSONArray();
private String type; private String type;
private String key;
private String[] relationKeys;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -48,5 +54,19 @@ public class View3dNodeVo { ...@@ -48,5 +54,19 @@ public class View3dNodeVo {
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String[] getRelationKeys() {
return relationKeys;
}
public void setRelationKeys(String relationKeys) {
if(StringUtil.isNotEmpty(relationKeys)) {
this.relationKeys = relationKeys.split(",");
}
}
} }
...@@ -31,6 +31,7 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml ...@@ -31,6 +31,7 @@ mybatis.mapper-locations = classpath:db/mapper/*.xml
# mybatis entity package # mybatis entity package
mybatis.type-aliases-package = com.yeejoin.amos.fas.business.entity.mybatis mybatis.type-aliases-package = com.yeejoin.amos.fas.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase=true mybatis.configuration.mapUnderscoreToCamelCase=true
logging.level.com.yeejoin.amos.fas.business.dao.mapper=debug
#liquibase #liquibase
spring.liquibase.change-log = classpath:/db/changelog/changelog-master.xml spring.liquibase.change-log = classpath:/db/changelog/changelog-master.xml
...@@ -43,4 +44,7 @@ spring.http.multipart.MaxRequestSize = 50480000 ...@@ -43,4 +44,7 @@ spring.http.multipart.MaxRequestSize = 50480000
windows.img.path = D:\\ windows.img.path = D:\\
linux.img.path = / linux.img.path = /
#
param.safetyIndexchange.cron = 0 0 2 * * ?
...@@ -710,6 +710,9 @@ ...@@ -710,6 +710,9 @@
<if test="item.ue4Extent != null" > <if test="item.ue4Extent != null" >
ue4_extent = #{item.ue4Extent,jdbcType=VARCHAR}, ue4_extent = #{item.ue4Extent,jdbcType=VARCHAR},
</if> </if>
<if test="item.position3d != null" >
position3d = #{item.position3d,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{item.riskSourceId,jdbcType=BIGINT} where id = #{item.riskSourceId,jdbcType=BIGINT}
</foreach> </foreach>
......
...@@ -70,8 +70,6 @@ ...@@ -70,8 +70,6 @@
<when test="type == 'fireEquipment'"> <when test="type == 'fireEquipment'">
select select
R.id,R.parent_id, R.id,R.parent_id,
<!-- IF(ISNULL(IF(replace(trim(R.ue4_rotation),'[]','')='',NULL,R.ue4_rotation))
AND ISNULL(IF(replace(trim(R.4_rotation),'[]','')='',NULL,R.ue4_location)),0,1) as is_bind, -->
CASE CASE
WHEN ISNULL(C.id) = 0 then IF(ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_rotation)) WHEN ISNULL(C.id) = 0 then IF(ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_rotation))
AND ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_location)),0,1) AND ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_location)),0,1)
...@@ -133,7 +131,7 @@ ...@@ -133,7 +131,7 @@
<select id="getPointDetailByTypeAndId" resultType="java.util.HashMap"> <select id="getPointDetailByTypeAndId" resultType="java.util.HashMap">
<choose> <choose>
<when test="type == 'riskSource'"> <when test="type == 'riskSource'">
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,position3d
from f_risk_source from f_risk_source
where 1=1 where 1=1
</when> </when>
...@@ -308,61 +306,126 @@ ...@@ -308,61 +306,126 @@
ORDER BY p.check_time desc ORDER BY p.check_time desc
limit 0,5 limit 0,5
</select> </select>
<select id="getPintsByType" resultType="hashmap"> <select id="getPintsByType" resultType="hashmap">
select CONCAT(type,'-',id) as `key`,sp.* from select CONCAT(type,'-',id) as `key`,sp.* from
(select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode from f_risk_source where is_region = 'FALSE' (select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,
null as relationKeys
from f_risk_source where is_region = 'FALSE'
UNION all UNION all
select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode from p_point WHERE is_delete = FALSE select id,name,point_no as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'patrol' as type,org_code as orgCode,
null as relationKeys
from p_point WHERE is_delete = FALSE
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode from f_equipment select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'impEquipment' as type,org_code as orgCode,
tmp.relationKeys
from f_equipment e
LEFT JOIN
(select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp
ON TMP.equipment_id = e.id
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode from f_fire_equipment where equip_classify = 0 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'monitorEquipment' as type,org_code as orgCode,
null as relationKeys
from f_fire_equipment where equip_classify = 0
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode from f_fire_equipment where equip_classify = 2 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'video' as type,org_code as orgCode,
null as relationKeys
from f_fire_equipment where equip_classify = 2
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode from f_water_resource where type = 1 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'hydrant' as type,org_code as orgCode,
null as relationKeys
from f_water_resource where type = 1
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode from f_water_resource where type = 2 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'pool' as type,org_code as orgCode,
null as relationKeys
from f_water_resource where type = 2
UNION all UNION all
select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode from f_fire_car select id,name,car_num as code,ue4_location as ue4Location,ue4_rotation as ue4Rotation, 'fireCar' as type,org_code as orgCode,
null as relationKeys
from f_fire_car
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode from f_fire_equipment where equip_classify = 3 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation,'fireEquipment' as type,org_code as orgCode,
null as relationKeys
from f_fire_equipment where equip_classify = 3
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode from f_fire_station where type = 2 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation , 'fireChamber' as type,org_code as orgCode,
null as relationKeys
from f_fire_station where type = 2
UNION all UNION all
select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode from f_fire_station where type = 1 select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'fireFoamRoom' as type,org_code as orgCode,
null as relationKeys
from f_fire_station where type = 1
) as sp ) as sp
where where
sp.orgCode = #{orgCode} sp.orgCode = #{orgCode}
<if test="type!=null">and sp.type =#{type}</if> <if test="type!=null">and sp.type =#{type}</if>
</select> </select>
<select id="initViewImpEquipmentNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo"> <select id="getImpEqu3dPoints" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
SELECT id,name,code,ue4_location,ue4_rotation,'monitorEquipment' as type SELECT id,name,code,ue4_location,ue4_rotation,'monitorEquipment' as type,
null as relationKeys
FROM f_fire_equipment fe FROM f_fire_equipment fe
WHERE fe.id IN ( WHERE fe.id IN (
select fire_equipment_id from f_equipment_fire_equipment select fire_equipment_id from f_equipment_fire_equipment
) AND org_code like CONCAT(#{orgCode},'%') ) AND org_code like CONCAT(#{orgCode},'%')
UNION ALL UNION ALL
SELECT id,name,code,ue4_location,ue4_rotation,'impEquipment' as type SELECT e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,'impEquipment' as type,
FROM f_equipment TMP.relationKeys
WHERE org_code like CONCAT(#{orgCode},'%') FROM f_equipment e
LEFT JOIN
(select GROUP_CONCAT(fire_equipment_id) as relationKeys,equipment_id from f_equipment_fire_equipment GROUP BY equipment_id) tmp
ON TMP.equipment_id = e.id
WHERE e.org_code like CONCAT(#{orgCode},'%')
UNION ALL UNION ALL
SELECT id,name,code,ue4_location,ue4_rotation, SELECT id,name,code,ue4_location,ue4_rotation,
case type case type
when 1 then 'hydrant' when 1 then 'hydrant'
when 2 then 'pool' when 2 then 'pool'
end as type end as type,
null as relationKeys
FROM f_water_resource FROM f_water_resource
WHERE org_code like CONCAT(#{orgCode},'%') WHERE org_code like CONCAT(#{orgCode},'%')
UNION ALL UNION ALL
SELECT id,name,code,ue4_location,ue4_rotation,'fireChamber' as type SELECT id,name,code,ue4_location,ue4_rotation,'fireChamber' as type,
null as relationKeys
FROM f_fire_station FROM f_fire_station
WHERE type = 1 AND org_code like CONCAT(#{orgCode},'%') WHERE type = 1 AND org_code like CONCAT(#{orgCode},'%')
UNION ALL UNION ALL
SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type SELECT id,name,car_num as code,ue4_location,ue4_rotation,'fireCar' as type,
null as relationKeys
FROM f_fire_car FROM f_fire_car
WHERE org_code like CONCAT(#{orgCode},'%') WHERE org_code like CONCAT(#{orgCode},'%')
</select> </select>
<select id="initViewErrorNode" resultType="com.yeejoin.amos.fas.business.vo.View3dNodeVo">
<choose>
<when test="type == 'riskSource'">
select
R.id,R.name,R.code,R.ue4_location,R.ue4_rotation,
#{type} as type
from f_risk_source R
where is_region <![CDATA[<>]]> 'TRUE' AND status = 'ANOMALY'
AND R.org_code like CONCAT(#{orgCode},'%')
</when>
<when test="type == 'patrol'">
select
p.id,p.name,p.point_no as code,p.ue4_location,p.ue4_rotation,
#{type} as type
from p_point p
where status in (2,3)
AND p.org_code like CONCAT(#{orgCode},'%')
</when>
<when test="type == 'impEquipment'">
select distinct e.id,e.name,e.code,e.ue4_location,e.ue4_rotation,
#{type} as type
from
f_equipment e
left join f_equipment_fire_equipment efe ON e.id = efe.equipment_id
left join f_fire_equipment fe ON efe.fire_equipment_id = fe.id
where fe.equip_status = 1
AND e.org_code like CONCAT(#{orgCode},'%')
</when>
</choose>
</select>
</mapper> </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