Commit 5360ac70 authored by 吴俊凯's avatar 吴俊凯

1.4.0.2版本修改代码提交

parent 27aead40
......@@ -15,9 +15,10 @@ public enum AlarmPointEnum {
未确认已清除("未确认已清除", "未确认已清除"),
已确认未清除("已确认未清除", "已确认未清除"),
已确认已清除("已确认已清除", "已确认已清除"),
异常("异常", "异常"),
正常("正常", "正常");
正常("正常", "正常"),
异常("异常", "异常"),
告警("告警", "告警"),;
/**
* 名称,描述
*/
......
......@@ -26,7 +26,7 @@ public enum DeviceUriEnum {
this.desc = desc;
}
public String getUri() {
public String getUri() {
return uri;
}
......
......@@ -16,12 +16,12 @@ import com.yeejoin.amos.spc.dao.entity.BasicEntity;
@Entity
@Table(name="p_alarm_point")
public class AlarmPoint {
/**
*
*
*/
private static final long serialVersionUID = 5191299540189393188L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "id",nullable=false,unique=true)
......@@ -29,30 +29,30 @@ public class AlarmPoint {
@Column(name = "point_id")
private Long pointId;
@Column(name = "update_date")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateDate;
@Column(name = "is_alarm")
private Integer isAlarm = 1;//0 正常|1 告警
@Column(name = "point_type")
private String pointType;
@Column(name = "content")
private String content;//告警内容
@Column(name = "code")
private String code;//code
@Column(name = "point_name")
private String pointName;
@Column(name = "source_id")
private String sourceId;
@Column(name = "auth_org")
private String authOrg;
......@@ -67,6 +67,16 @@ public class AlarmPoint {
@Column(name = "point_attrs")
private String pointAttrs;//告警点信息
@Column(name = "cpbl_id")
private Long cpblId;//告警指标ID
public Long getTarget() {
return cpblId;
}
public void setTarget(Long target) {
this.cpblId = target;
}
public Date getUpdateDate() {
return updateDate;
......
......@@ -30,7 +30,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
private static final Logger logger = Logger.getLogger(DeviceListener.class);
private static ObjectMapper mapper = new ObjectMapper();
//临界温度
private static final double CRITICAL_TEMPERATURE = 35;
......@@ -108,19 +108,19 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
System.out.println("----shudu equipmentsPointId : "+ equipmentsPointId);
List<Long> riskFactorId = equipmentMapper.judgeEquipmentExists(equipmentsPointId);
Integer value = 0;
if (Double.valueOf(statusName) >= CRITICAL_TEMPERATURE) {
value = DevicePointEnum.getValue("异常");
equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId());
} else {
value = DevicePointEnum.getValue("正常");
equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId());
}
// if (Double.valueOf(statusName) >= CRITICAL_TEMPERATURE) {
// value = DevicePointEnum.getValue("异常");
// equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId());
// } else {
// value = DevicePointEnum.getValue("正常");
// equipmentMapper.updateEquipmentPointStatus(value, queryEquipmentPoint.getId());
// }
System.out.println("----shudu riskFactorId : "+ riskFactorId);
for (int j = 0; j < riskFactorId.size(); j++) {
try {
riskModelRemoteClient.updateEquipmentAlarmData(riskFactorId.get(j),eqpName,value);
......@@ -130,8 +130,8 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
}
}
}
if (remark.equals("temperatureAlarm") || remark.equals("humidityAlarm")) {
if ("告警".equals(statusName)||"异常".equals(statusName)||"正常".equals(statusName)) {
System.out.println("----start chuli device temperatureAlarm : "+ remark);
EquipmentQualityVo queryEquipmentPoint = equipmentMapper.queryEquipmentPoint(eqpId, remark);
System.out.println("----update device queryEquipmentPoint :"+ queryEquipmentPoint);
......@@ -156,6 +156,7 @@ public class DeviceListener extends EmqxListener implements InitializingBean {
System.out.println("----update device state fail : "+ riskFactorId);
}
}
}
});
......
......@@ -129,7 +129,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
}
//告警信息
String metricKey = "";
//默认状态为正常
//默认状态为正常
int statusByName = 0;
// jsonArray.forEach(e -> {
for (Object e : jsonArray) {
......@@ -204,7 +204,7 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
// });
//增加报警
//增加报警
List<AlarmPoint> alarmPoint = alarmPointService.selectPointTypeAndPointId(AlarmPointTypeEnum.设备.getCode(), eqpId);
if (alarmPoint != null && alarmPoint.size() > 0) {
//存在报警,判断当前状态是不是合格,合格则删除上次的报警
......@@ -241,10 +241,10 @@ public class SelfSupportListener extends EmqxListener implements InitializingBea
}
}
//增建告警记录表
//增建告警记录表
//告警记录
List<Alarm> curAlarmList = alarmService.findByQueryColumn(eqpId + metricKey);
if (curAlarmList != null && curAlarmList.size() > 0) {
if (curAlarmList != null && curAlarmList.size() > 0) {
Alarm alarm = curAlarmList.get(0);
alarm.setUpdateDate(DateTimeKit.now());
if (!ObjectUtils.isEmpty(alarm.getHappenDate())) {
......
......@@ -14,6 +14,8 @@ public class AlarmConstant {
public static String ALARM_NORMAL_STATUS = "清除";
public static String ALARM_ABNORMAL_STATUS = "告警";
public static String ALARM_DEVICE = "警告告警";
public static String ALARM_DEVICE_TYPE = "监测设备告警";
public static String ALARM_DEVICE_TYPE = "动环告警";
public static String ALARM_DEVICE_AlARAM = "监测异常";
public static String ALARM_DEVICE_MAJOR = "重要告警";
}
package com.yeejoin.amos.bank.controller;
import java.util.Date;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
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.bind.annotation.*;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.bank.service.IAlarmPointService;
......@@ -23,17 +21,17 @@ import io.swagger.annotations.ApiParam;
@RequestMapping(value = "/bank/dynamicRingData")
@Api(value = "/bank/dynamicRingData", tags = {"动环数据API"})
public class DynamicRingDataController extends BaseController{
@Autowired
private IDynamicRingDataService dynamicRingDataService;
@GetMapping(value = "/{id}", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "动环数据", notes = "动环数据")
public CommonResponse detail(@ApiParam(value = "动环数据id", required = false) @PathVariable(value = "id")Long id) {
String token = getToken();
return CommonResponseUtil.success(dynamicRingDataService.queryDynamicRingDataById(id,token));
}
@Autowired
private IAlarmPointService alar;
@GetMapping(value = "/test", produces = "application/json;charset=UTF-8")
......@@ -47,4 +45,10 @@ public class DynamicRingDataController extends BaseController{
return CommonResponseUtil.success();
}
@PutMapping (value = "/update", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "动环修改坐标位置", notes = "动环修改坐标位置")
public CommonResponse updatePosition(@ApiParam(value = "动环修改坐标位置", required = true) @RequestBody Map<String,Object> param) {
String result = dynamicRingDataService.updatePosition(param);
return CommonResponseUtil.success(result);
}
}
......@@ -19,4 +19,7 @@ public interface IAlarmPointRepository extends IBaseRepository<AlarmPoint, Strin
@Query(value="select * from p_alarm_point where point_type IN ('4','5') and point_id =?1 and content = ?2 ",nativeQuery=true )
public List<AlarmPoint> selectPointTypeAndPointId(String pointId,String content);
@Query(value="select * from p_alarm_point where point_type =?1 and point_id =?2 and cpbl_id =?3 ",nativeQuery=true )
public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId,Long cpblId);
}
......@@ -17,9 +17,13 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> {
@Query(value="select * from spc_alarm where query_column =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true )
public List<Alarm> selectByQueryColumn(String type);
@Query(value="select COUNT(*) value,sa.alarm_level name, sa.org_code orgCode from spc_alarm sa where sa.org_code like CONCAT('%', ?1, '%' ) and sa.current_state in ('未确认未清除','已确认未清除','异常','告警') GROUP BY sa.alarm_level",nativeQuery=true )
public List<Map<String, Object>> countnum(String code);
@Query(value="select * from spc_alarm where source_id =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true )
public List<Alarm> selectByQuerySourceId(String sourceId);
}
package com.yeejoin.amos.bank.dao.repository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.yeejoin.amos.bank.TopographyNodeDetail;
import com.yeejoin.amos.op.core.jpa.IBaseRepository;
import java.util.List;
import java.util.Map;
@Repository("iTopographyNodeDetailDao")
public interface ITopographyNodeDetailRepository extends IBaseRepository<TopographyNodeDetail, String> {
TopographyNodeDetail findByNodeid(String nodeid);
@Query(value="SELECT\n" +
"\tb.nodeid,b.node_detail,a.state,a.text,a.treeid \n" +
"FROM\n" +
"( SELECT id ,state ,text,treeid FROM b_topography_node WHERE text IN ( '1#温湿度', '2#温湿度', '3#温湿度', '4#温湿度', '1温湿度', '5温湿度', '消防监测', '漏水监测' ) ) AS a\n" +
"\tLEFT JOIN b_topography_node_detail b ON a.id = b.nodeid",nativeQuery=true )
List<Map<String,Object>> HomePageDetail();
}
package com.yeejoin.amos.bank.dao.repository;
import java.util.List;
import java.util.Map;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
......@@ -10,12 +11,12 @@ import com.yeejoin.amos.op.core.jpa.IBaseRepository;
@Repository("iTopographyNodeDao")
public interface ITopographyNodeRepository extends IBaseRepository<TopographyNode, String> {
@Query(value="select * from b_topography_node where org_code like concat(?1,'%') and treeid =?2 and type =?3",nativeQuery=true )
List<TopographyNode> findByOrgCodeAndTreeidAndType(String orgcode,String treeid, int type);
@Query(value="select * from b_topography_node where org_code like concat(?1,'%') and type =?2",nativeQuery=true )
List<TopographyNode> findByOrgCodeAndType(String orgcode,int type);
TopographyNode findBySourceId(String sourceId);
TopographyNode findBySourceIdAndTreeid(String fromSourceId, String treeId);
......@@ -25,4 +26,7 @@ public interface ITopographyNodeRepository extends IBaseRepository<TopographyNod
TopographyNode findBySourceIdAndTreeidAndGroup(String toSourceId, String treeIdStr, String groupKey);
TopographyNode findBySourceIdAndType(String sourceId, int type);
@Query(value = "SELECT node.id,detail.node_detail FROM b_topography_node node LEFT JOIN b_topography_node_detail detail ON node.id = detail.nodeid WHERE node.source_id =?1", nativeQuery=true )
Map<String,Object> findNodeDetailBySourceId(String sourceId);
}
......@@ -79,4 +79,14 @@ public class RemoteDeviceService {
}
return null;
}
public String updatePosition(String jsonDate) {
try {
Object result = deviceRemoteClient.updatePosition(jsonDate);
return JSON.toJSONString(result);
} catch (InnerInvokException e) {
log.error("updatePosition fail " + e.getMessage());
}
return null;
}
}
......@@ -41,7 +41,7 @@ public interface DeviceRemoteClient {
*/
@RequestMapping(value = "/xml/alarm", method = RequestMethod.GET)
Object sendAlarm(@RequestParam(value = "xmlData", required = false) String xmlData) throws InnerInvokException;
/**
* 查询设备详情列表以及指标
* @param equipmentId
......@@ -50,5 +50,9 @@ public interface DeviceRemoteClient {
*/
@RequestMapping(value = "/device/cpbl/attr", method = RequestMethod.GET)
CommonResponse listDeviceAndDeviceCpblAttr(@RequestParam(value = "equipmentId",required = false) Long equipmentId) throws InnerInvokException;
/**
* 修改动环设备坐标点(暂时不启用)
*/
@RequestMapping(value = "/xml/updatePosition", method = RequestMethod.POST)
Object updatePosition(@RequestParam(value = "xmlData", required = false) String xmlData) throws InnerInvokException;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.bank.remote.client;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -12,12 +13,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
* @Description:
* @Date: 2020-02-18 14:52
*/
@FeignClient(name = "YEEAMOSPATROL-237")
@FeignClient(name = "${gateway.fegin.name}")
public interface PatrolRemoteClient {
/**
* 发送告警信息
*/
@RequestMapping(value = "api/msgSubscribe/alarmNotification", method = RequestMethod.POST, consumes="application/json" )
@RequestMapping(value = "api/msgSubscribe/alarmNotification", method = RequestMethod.POST, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse sendAlarmNotification(@RequestBody String input) throws InnerInvokException;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.bank.remote.client;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.op.core.common.response.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -12,13 +13,13 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author DELL
*
*/
@FeignClient(name = "${Risk.fegin.name}")
@FeignClient(name = "${gateway.fegin.name}")
public interface RiskModelRemoteClient {
/**
* 修改rpn值
*/
@RequestMapping(value = "api/risksource/update/fireqeuiment/sod", method = RequestMethod.GET, consumes = "application/json")
@RequestMapping(value = "api/risksource/update/fireqeuiment/sod", method = RequestMethod.GET, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse updateEquipmentAlarmData(@RequestParam(value = "riskFactorID") Long riskFactorID,
@RequestParam("equipmentName") String equipmentName,@RequestParam("state") Integer state)
throws InnerInvokException;
......@@ -26,13 +27,13 @@ public interface RiskModelRemoteClient {
/**
* 根据风险因素id查询巡检点和指标项目列表
*/
@RequestMapping(value = "/api/risksource/getEquiments/points", method = RequestMethod.GET, consumes="application/json" )
@RequestMapping(value = "/api/risksource/getEquiments/points", method = RequestMethod.GET, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse listPointInputitemByFactorId(@RequestParam(value = "factorId") Long factorId) throws InnerInvokException;
/**
* 根据风险因素id查询设备和指标项列表
*/
@RequestMapping(value = "/api/risksource/getFactorBindPoints", method = RequestMethod.GET, consumes="application/json" )
@RequestMapping(value = "/api/risksource/getFactorBindPoints", method = RequestMethod.GET, consumes= MediaType.APPLICATION_JSON_UTF8_VALUE)
CommonResponse queryBoundByFactroId(@RequestParam(value = "factorId") Long factorId) throws InnerInvokException;
}
package com.yeejoin.amos.bank.service;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.op.core.jpa.IGenericManager;
public interface IAlarmPointService extends IGenericManager<AlarmPoint, String> {
public void saveItem(AlarmPoint alarmPoint);
public void deleteItem(List<AlarmPoint> alarmPointList);
public void deleteItems(List<AlarmPoint> alarmPointList);
public List<AlarmPoint> selectPointTypeAndPointId(String type,Long pointId);
public void alarmTigger(String xmlData,String token);
public List<AlarmPoint> queryAutoInspection(String pointId, String content);
public Map<String,Object> getSevenDayscount() throws ParseException;
public List<AlarmPoint> selectPointTypeAndPointId(String type,Long pointId,Long cpblId);
}
......@@ -12,18 +12,20 @@ import com.yeejoin.amos.op.core.jpa.IGenericManager;
import com.yeejoin.amos.spc.core.common.request.CommonPageable;
public interface IAlarmService extends IGenericManager<Alarm, String> {
public Page<Alarm> list(List<DaoCriteria> criterias,CommonPageable commonPageable);
public void saveBatch(List<Alarm> alarms);
public List<Alarm> findByQueryColumn(String queryColumn);
public List<Map<String, Object>> countnum(String code);
List<HashMap<String, Object>> getcountxd(String code);
List<HashMap<String, Object>> getcountnum(String code);
List<HashMap<String, Object>> getcountyc( String code);
List<HashMap<String, Object>> getxuncount( String code);
public List<Alarm> selectByQuerySourceId(String sourceId);
}
package com.yeejoin.amos.bank.service;
import java.util.ArrayList;
import java.util.Map;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.spc.core.common.response.Node3DVoResponse;
......@@ -15,4 +16,5 @@ public interface IDynamicRingDataService {
ArrayList<Node3DVoResponse> query3dData(String token,String orgCode);
String updatePosition (Map<String,Object> param);
}
......@@ -2,6 +2,7 @@
package com.yeejoin.amos.bank.service.impl;
import com.google.common.collect.Maps;
import com.yeejoin.amos.bank.common.enums.AbnormalStateEnum;
import com.yeejoin.amos.bank.dao.entity.AlarmPoint;
import com.yeejoin.amos.bank.dao.repository.IAlarmPointRepository;
import com.yeejoin.amos.bank.remote.RemoteAlarmTiggerService;
......@@ -11,20 +12,20 @@ import com.yeejoin.amos.spc.business.dao.mapper.InputItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> implements IAlarmPointService {
@Autowired
private IAlarmPointRepository iAlarmPointDao;
@Autowired
private InputItemMapper inputMapper;
@Autowired
private RemoteAlarmTiggerService alarmTiggerService;
......@@ -59,11 +60,17 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im
@Override
public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId) {
return iAlarmPointDao.selectPointTypeAndPointId( type, pointId);
}
@Override
public List<AlarmPoint> selectPointTypeAndPointId(String type, Long pointId,Long cpblId) {
return iAlarmPointDao.selectPointTypeAndPointId( type,pointId,cpblId);
}
@Override
public void alarmTigger(String xmlData,String token) {
......@@ -78,4 +85,33 @@ public class AlarmServiceImpl extends GenericManagerImpl<AlarmPoint, String> im
public List<AlarmPoint> queryAutoInspection(String pointId,String content) {
return iAlarmPointDao.selectPointTypeAndPointId(pointId,content);
}
@Override
public Map<String,Object> getSevenDayscount() throws ParseException {
Map<String,Object> result = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, -6);
//紧急告警
List<Long> urgent = inputMapper.getSevenDayscount(AbnormalStateEnum.E.getName());
result.put("urgent",urgent);
//重要告警
List<Long> important = inputMapper.getSevenDayscount(AbnormalStateEnum.M.getName());
result.put("important",important);
//次要告警
List<Long> secondary = inputMapper.getSevenDayscount(AbnormalStateEnum.S.getName());
result.put("secondary",secondary);
//警告告警
List<Long> warning = inputMapper.getSevenDayscount(AbnormalStateEnum.W.getName());
result.put("warning",warning);
List<String> xAxis = new ArrayList<>();
for (int i = 0; i < 7; i++) {
xAxis.add(sdf.format(c.getTime()).substring(5,sdf.format(c.getTime()).length()));
c.add(Calendar.DATE, 1);
}
//时间轴
result.put("xAxis",xAxis);
return result;
}
}
......@@ -74,7 +74,23 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService {
return list;
}
private void convertNode3DVoResponse(ArrayList<Node3DVoResponse> list, JSONObject json, String type,String orgCode) {
@Override
public String updatePosition(Map<String, Object> param) {
String params1 = "{\"eqpTempAttr\":{\"name\":\"affiliatedSystem\",\"value\":\"动环系统\"},\"pageNumber\":0,\"pageSize\":1000000000,\"needAttr\":[\"position\",\"storey\",\"storey\"]}";
String resStr = deviceService.selectEquipments(params1);
//String resStr = deviceService.dynamicRingData(DeviceUriEnum.查询三维设备点, token, params1);
JSONObject updateObject =new JSONObject();
JSONArray resJson = JSONArray.parseArray(JSONObject.parseObject(resStr).get("content").toString());
for (int i = 0; i <resJson.size() ; i++) {
if(resJson.getJSONObject(i).get("id").equals(param.get("id"))){
resJson.getJSONObject(i).getJSONObject("equipmentAttrs").put("position",param.get("position3d"));
updateObject = resJson.getJSONObject(i);
}
}
return deviceService.updatePosition(updateObject.toJSONString());
}
private void convertNode3DVoResponse(ArrayList<Node3DVoResponse> list, JSONObject json, String type,String orgCode) {
List<JSONObject> dataArray = (List<JSONObject>) json.get("content");
dataArray.forEach(e -> {
JSONArray authOrgs = e.getJSONArray("authOrg");
......@@ -132,6 +148,8 @@ public class DynamicRingDataServiceImpl implements IDynamicRingDataService {
node3dVoResponse.setType("dynamicRingData");
return node3dVoResponse;
}
public static void main(String[] args) {
}
}
......@@ -47,13 +47,13 @@ import fr.opensagres.xdocreport.template.velocity.internal.Foreach;
*/
@Service
public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, String> implements ITopographyService {
//平台字典管理中配置value为key值
private static final String BNAK_ORG_KEY = "BANK_ORG";
//平台字典管理中配置value为key值
private static final String BNAK_XIAN_KEY = "xian";
//平台字典管理中配置value为key值
private static final String BNAK_KEJICHU_KEY = "科技处";
......@@ -74,7 +74,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
@Autowired
private RemoteWebSocketServer webSocketServer;
@Autowired
RemoteSecurityService remoteSecurityService;
......@@ -85,7 +85,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
@Override
public List<TopographyTreeDTO> getTree(String orgcode,int type) {
List<TopographyTreeDTO> list = iTopographyTreeDao.findByTypeAndOrgCode(type,orgcode).stream().map(t -> convert(t)).collect(Collectors.toList());
boolean judgeDeviceAuth = JudgeDeviceAuth(list,orgcode);
if(false == judgeDeviceAuth) {
......@@ -159,7 +159,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
iTopographyNodeDao.saveAll(list);
}
@Override
public String getSelfOrgCode() {
List<DictionarieValueModel> listDictionaryByDictCode = remoteSecurityService.listDictionaryByDictCode(BNAK_ORG_KEY);
......@@ -170,7 +170,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
});
return sb.toString();
}
@Override
......@@ -326,8 +326,9 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
public Object getNodeDetail(String id) {
TopographyNode node = iTopographyNodeDao.findById(id).get();
TopographyNodeDetail detail = iTopographyNodeDetailDao.findByNodeid(id);
List<Map> list = new ArrayList<>();
if (detail != null) {
List<Map> list = JSON.parseArray(detail.getNodeDetail(), Map.class);
list = JSON.parseArray(detail.getNodeDetail(), Map.class);
for (Map map : list) {
if (map.get("name").equals("监测状态") || map.get("name").equals("健康状态")) {
if (node.getState() == 0) {
......@@ -342,10 +343,12 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
return list;
} else {
return null;
return list;
}
}
@Override
public List<Map> getDeviceNodes(String orgcode) {
List<TopographyNode> nodes = iTopographyNodeDao.findByOrgCodeAndType(orgcode, 4);
......@@ -362,7 +365,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
return results;
}
@Override
public List<TopographyLineDTO> getDeviceLinks(String orgcode) {
......@@ -393,7 +396,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
}
/**
* 判断该用户登选择公司有无查看该拓扑的权限
* @param list
......@@ -401,15 +404,15 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
* @return
*/
private boolean JudgeDeviceAuth(List<TopographyTreeDTO> list, String orgCode) {
String userOrgCode = null;
if(orgCode.startsWith("%#")) {
userOrgCode = truncateHeadString(orgCode,2);
userOrgCode = truncateHeadString(orgCode,2);
}else {
userOrgCode = orgCode;
userOrgCode = orgCode;
}
for (TopographyTreeDTO topographyTreeDTO : list) {
if (!StringUtils.isEmpty(topographyTreeDTO.getOrgCode())) {
......@@ -430,7 +433,7 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
}
}
} else {
String[] arr = topographyTreeDTO.getOrgCode().split("-");
......@@ -443,11 +446,11 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
}
}
return false;
}
/**
* 去除字符串前n个字符
* @param origin 要操作的字符串
......@@ -465,5 +468,5 @@ public class TopographyServiceImpl extends GenericManagerImpl<TopographyTree, St
}
return String.copyValueOf(ret);
}
}
......@@ -20,7 +20,7 @@ import com.yeejoin.amos.spc.core.util.query.BaseQuerySpecification;
@Service
public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> implements IAlarmService {
@Autowired
private IAlarmRepository iAlarmDao;
@Autowired
......@@ -33,7 +33,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
@Override
public Page<Alarm> list(List<DaoCriteria> criterias, CommonPageable commonPageable) {
BaseQuerySpecification<Alarm> spec = new BaseQuerySpecification<>(criterias);
Page<Alarm> page = iAlarmDao.findAll(spec, commonPageable);
Page<Alarm> page = iAlarmDao.findAll(spec, commonPageable);
return page;
}
......@@ -46,7 +46,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
public List<Alarm> findByQueryColumn(String queryColumn) {
return iAlarmDao.selectByQueryColumn(queryColumn);
}
public List<Map<String, Object>> countnum(String code) {
return iAlarmDao.countnum(code);
}
......@@ -74,4 +74,9 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
// TODO Auto-generated method stub
return inputMapper.getxuncount(code);
}
@Override
public List<Alarm> selectByQuerySourceId(String sourceId) {
return iAlarmDao.selectByQuerySourceId(sourceId);
}
}
......@@ -20,22 +20,22 @@ public interface EquipmentMapper extends BaseMapper {
Long countByMap(PageParam pageParam);
void insertEquipment(EquipmentVo vo);
//void updateEquipment(EquipmentVo vo);
//void updateEquipmentAttrs(EquipmentQualityVo vo);
void insertEquipmentAttrs( EquipmentQualityVo vo);
/**
* 更新指标关联表中指标的状态
* @param status
* @param id
*/
void updateEquipmentPointStatus(@Param("state")int state,@Param("equipmentsPointId") Long equipmentsPointId);
/**
* 根据设备Id和指标名称查询指标详情
* @param equipmentId
......@@ -43,14 +43,14 @@ public interface EquipmentMapper extends BaseMapper {
* @return
*/
EquipmentQualityVo queryEquipmentPoint(@Param("equipmentId") Long equipmentId,@Param("remark") String remark);
/**
* 判断关联关系表中该指标是否存在
* @param equipmentsPointId
* @return
*/
List<Long> judgeEquipmentExists(@Param("equipmentsPointId") Long equipmentsPointId);
/**
* 判断关联关系表中该指标是否存在
* @param equipmentsPointId
......@@ -64,13 +64,23 @@ public interface EquipmentMapper extends BaseMapper {
Long querySelfDeviceCount(
@Param("fname") String fname);
TopographyNode queryNodeBySourceId( @Param("sourceId")String sourceId);
void updateNodeState(TopographyNode node);
void updateNodeDetail(@Param("nodeid")String nodeid,@Param("nodeDetail")String nodeDetail);
void deleteOneHourNormal();
/**
* 装备同步的时候先删除f_fire_equipment表的所有信息
* @return
*/
void deleteAllEquipmentInfo();
/**
* 装备同步的时候先删除f_fire_equipment_point表装备参数信息
* @return
*/
void deleteAllEquipmentPoint();
}
......@@ -9,7 +9,7 @@ import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.bank.common.enums.PaymentEnum;
public interface InputItemMapper extends BaseMapper {
void deleteInputItemByMeasureContentId(@Param("measureContentId") String id);
List<HashMap<String, Object>> queryPaymentByCode(@Param("itemNo") String itemNo,@Param("name") String name);
......@@ -21,4 +21,9 @@ public interface InputItemMapper extends BaseMapper {
List<HashMap<String, Object>> getcountyc(@Param("code") String code);
List<HashMap<String, Object>> getcountnum(@Param("code")String code);
List<HashMap<String, Object>> getxuncount(@Param("code") String code);
/**
* 统计七天之前每天的告警数量
* @return
*/
List<Long> getSevenDayscount (@Param("alarmLevel") String alarmLevel);
}
......@@ -18,6 +18,12 @@
<artifactId>AmosBankService</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.yeejoin.amos</groupId>
<artifactId>AmosBankService</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<!-- maven打包时将lib提取到jar同目录,将配置文件提取到jar目录/config/下 -->
......
......@@ -93,5 +93,7 @@ param.remoteurl=http://localhost:8080
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.20:1883
emqx.password=0
\ No newline at end of file
emqx.broker=tcp://172.16.10.85:1883
emqx.password=0
gateway.fegin.name=AMOS-BANK-SERVER-GATEWAY-WJK
\ No newline at end of file
......@@ -93,7 +93,7 @@ spring.rabbitmq.connection-timeout=1000
spring.redis.jedis.pool.min-idle=0
spring.redis.jedis.pool.max-wait=-1
gateway.fegin.name=AMOS-BANK-SERVER-GATEWAY
param.remoteurl=http://localhost:8080
#tcp.host=172.16.3.42
#tcp.port=8888
......
......@@ -93,7 +93,7 @@ spring.rabbitmq.connection-timeout=1000
spring.redis.jedis.pool.min-idle=0
spring.redis.jedis.pool.max-wait=-1
gateway.fegin.name=AMOS-BANK-SERVER-GATEWAY
param.remoteurl=http://localhost:8080
#tcp.host=172.16.3.42
#tcp.port=8888
\ No newline at end of file
......@@ -128,8 +128,8 @@
</if>
</where>
</select>
<insert id="insertEquipment"
parameterType="com.yeejoin.amos.bank.entity.EquipmentVo"
useGeneratedKeys="true" keyProperty="id">
......@@ -164,7 +164,7 @@
</if>
</trim>
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
<if test="id !=null">`id`=#{id},</if>
<if test="orgCode !=null">`org_code`=#{orgCode},</if>
......@@ -172,8 +172,8 @@
<if test="name !=null">name=#{name}</if>
</trim>
</insert>
<insert id="insertEquipmentAttrs"
parameterType="com.yeejoin.amos.bank.entity.EquipmentQualityVo"
useGeneratedKeys="true" keyProperty="id" >
......@@ -220,7 +220,7 @@
</if>
</trim>
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
<if test="id !=null">`id`=#{id},</if>
<if test="type !=null">`type`=#{type},</if>
......@@ -228,21 +228,21 @@
<if test="displayName !=null">`name`=#{displayName},</if>
<if test="code !=null">code=#{code},</if>
<if test="equipmentId !=null">fire_equipment_id=#{equipmentId}</if>
</trim>
</insert>
<update id="updateEquipmentPointStatus" >
UPDATE
r_risk_factor_equipment_index
UPDATE
r_risk_factor_equipment_index
set
state=#{state}
WHERE
WHERE
equipment_point_id=#{equipmentsPointId}
</update>
<select id = "queryEquipmentPoint" resultType="com.yeejoin.amos.bank.entity.EquipmentQualityVo">
SELECT
f.id as id,
......@@ -250,23 +250,23 @@
f.`code` as code,
f.fire_equipment_id as equipmentId,
f.remark as remark
FROM
f_fire_equipment_point f
f_fire_equipment_point f
WHERE
f.fire_equipment_id = #{equipmentId}
AND
f.fire_equipment_id = #{equipmentId}
AND
f.remark = #{remark}
</select>
<select id = "judgeEquipmentExists" resultType="java.lang.Long">
SELECT
f.risk_factor_id
FROM
r_risk_factor_equipment_index f
r_risk_factor_equipment_index f
WHERE equipment_point_id=#{equipmentsPointId}
</select>
<select id="querySelfDeviceCount" resultType="long">
SELECT
count( DISTINCT fe.id)
......@@ -276,11 +276,11 @@
<if test="fname != null" >
AND fe.`name` like concat('%',#{fname},'%')
</if>
</select>
<select id="querySelfDevice" resultType="com.yeejoin.amos.bank.entity.DeviceRecord">
SELECT
id,
......@@ -291,17 +291,17 @@
FROM
b_device_record efe
WHERE 1=1
ORDER BY update_date DESC
ORDER BY update_date DESC
<if test="fname != null">
AND efe.`name` like concat('%',#{fname},'%')
</if>
<if test="length > 0">
LIMIT ${start},${length} ;
</if>
</select>
<select id="queryNodeBySourceId" resultType="com.yeejoin.amos.bank.TopographyNode">
SELECT
*
......@@ -311,9 +311,9 @@
<if test="sourceId != null">
AND efe.`source_id`= #{sourceId}
</if>
</select>
<update id="updateNodeState" parameterType="com.yeejoin.amos.bank.TopographyNode">
UPDATE b_topography_node
<trim prefix="set" suffixOverrides=",">
......@@ -322,24 +322,24 @@
</trim>
WHERE source_id=#{sourceId}
</update >
<update id="updateNodeDetail" >
UPDATE b_topography_node_detail
<trim prefix="set" suffixOverrides=",">
<if test="nodeDetail != null">node_detail=#{nodeDetail},</if>
</trim>
WHERE nodeid=#{nodeid}
</update >
<delete id="deleteOneHourNormal">
DELETE
FROM
b_device_record
WHERE
id IN (
SELECT a.id from(
SELECT
`ID`
......@@ -350,4 +350,11 @@
)
</delete>
<delete id="deleteAllEquipmentInfo">
DELETE FROM f_fire_equipment
</delete>
<delete id="deleteAllEquipmentPoint">
DELETE FROM f_fire_equipment_point
</delete>
</mapper>
\ No newline at end of file
......@@ -9,9 +9,9 @@
WHERE
original_id = #{measureContentId}
</update>
<select id="queryPaymentByCode" parameterType="java.lang.String" resultType="java.util.HashMap">
<!-- select
<!-- select
SUM(IFNULL(I.input_value,0)) as score,I.point_classify_name as payName,#{name} as name
from p_check C
left join p_check_input I on C.id=I.check_id
......@@ -49,12 +49,12 @@
group by I.point_classify_name,M.name,M.item_no
order by M.item_no
</select>-->
<select id="queryPaymentByCodes" resultType="java.util.HashMap" parameterType="java.util.List">
select I.input_value as score,I.point_classify_name as payName,M.name,M.item_no
from p_check_input I
left join p_input_item M ON M.id = I.input_id
where
where
I.is_ok != 3
AND I.id in
( SELECT max(I.id) FROM
......@@ -77,29 +77,29 @@
group by I.point_classify_name,M.name,M.item_no
order by M.item_no
</select>
<delete id="deletePointAlarmByIds">
delete from p_alarm_point
delete from p_alarm_point
where id IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="getcountnum" parameterType="java.lang.String" resultType="java.util.HashMap">
select COUNT(id) num
from r_risk_source
where is_region='FALSE'
from r_risk_source
where is_region='FALSE'
<if test="code != null and code != ''">
and r_risk_source.org_code LIKE concat( #{code}, "%")
</if>
</if>
</select>
<select id="getcountxd" parameterType="java.lang.String" resultType="java.util.HashMap">
select
select
CASE r_risk_level.`code`
WHEN 1 THEN
'一级风险'
......@@ -111,26 +111,26 @@
'四级风险'
WHEN 5 THEN
'五级风险'
END
END
name ,
r_risk_level.`code`,
a.num
a.num
from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num,r_risk_level.`code`
from r_risk_source RIGHT JOIN r_risk_level on r_risk_source.risk_level_id=r_risk_level.id
where is_region='FALSE'
where is_region='FALSE'
<if test="code != null and code != ''">
and r_risk_source.org_code LIKE concat( #{code}, "%")
</if>
</if>
GROUP BY r_risk_level.id) a on a.code= r_risk_level.`code`
</select>
<select id="getcountyc" parameterType="java.lang.String" resultType="java.util.HashMap">
select
select
CASE r_risk_level.`code`
WHEN 1 THEN
'一级风险'
......@@ -142,31 +142,56 @@ from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num,r_risk_leve
'四级风险'
WHEN 5 THEN
'五级风险'
END
END
name ,
r_risk_level.`code`,
a.num
a.num
from r_risk_level LEFT JOIN (select COUNT(r_risk_source.id) num, r_risk_level.`code`
from r_risk_source RIGHT JOIN r_risk_level on r_risk_source.risk_level_id=r_risk_level.id
where is_region='FALSE' and r_risk_source.flicker_frequency >0
where is_region='FALSE' and r_risk_source.flicker_frequency >0
<if test="code != null and code != ''">
and r_risk_source.org_code LIKE concat( #{code}, "%")
</if>
GROUP BY r_risk_level.id) a on a.code= r_risk_level.`code`
</select>
<select id="getxuncount" parameterType="java.lang.String" resultType="java.util.HashMap">
select status ,count(id) num from p_point where p_point.is_delete=0 and p_point.org_code LIKE concat( #{code}, "%") GROUP BY status
<select id="getxuncount" resultType="java.util.HashMap">
select status ,count(id) num from p_point where p_point.is_delete=0 and p_point.org_code LIKE concat( #{code}, "%") GROUP BY status
</select>
<select id="getSevenDayscount" parameterType="java.lang.String" resultType="java.lang.Long">
SELECT
ifnull( b.count, 0 ) AS count
FROM
(
SELECT
date_sub( curdate( ), INTERVAL 1 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 2 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 3 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 4 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 5 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 6 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 7 DAY ) AS click_date
) a
LEFT JOIN (
SELECT date( happen_date ) AS happen_date, count( * ) AS count FROM spc_alarm
WHERE alarm_level = #{alarmLevel} GROUP BY date( happen_date )
) b ON a.click_date = b.happen_date
ORDER BY a.click_date ASC
</select>
</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