Commit e73ba75f authored by 单奇雲's avatar 单奇雲

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

parents b0471502 20083ec9
......@@ -13,7 +13,7 @@
<parent>
<groupId>com.yeejoin.amos</groupId>
<artifactId>YeeAmosFireAutoSysRoot</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
</parent>
<!-- <dependencies>
......
......@@ -14,14 +14,14 @@
<parent>
<groupId>com.yeejoin.amos</groupId>
<artifactId>YeeAmosFireAutoSysRoot</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
</parent>
<dependencies>
<dependency>
<groupId>com.yeejoin.amos</groupId>
<artifactId>YeeAmosFireAutoSysCommon</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
</dependency>
<dependency>
......
......@@ -4,6 +4,7 @@ package com.yeejoin.amos.fas.business.feign;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.vo.Toke;
......@@ -14,11 +15,15 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service("remoteSecurityService")
public class RemoteSecurityService {
......@@ -214,6 +219,61 @@ public class RemoteSecurityService {
}
return agencyUserModel;
}
/**
* 根据用户ids获取用户实体列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public Map<String,AgencyUserModel> getUsersMap(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, AgencyUserModel> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,v->v, (v1, v2) -> v1));
}
return userMap;
}
/**
* 根据用户ids获取用户名称列表
* @param toke
* @param product
* @param appKey
* @param userIds
* @return
*/
public Map<String,String> getUserRealName(String toke,String product,String appKey,Set<Object> userIds){
List<AgencyUserModel> users = listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
return userMap;
}
/**
* 根据部门ids获取部门名称
* @param toke
* @param product
* @param appKey
* @param depIds
* @return
*/
public Map<Long,String> getDepName(String toke,String product,String appKey,Set<Object> depIds){
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(depIds)){
depts = this.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(depIds));
}
Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
}
return deptMap;
}
//用户id获取用户信息
public AgencyUserModel getUserById(String toke,String product,String appKey,String userId) {
if (userId == null || userId.equals("")) {
......
......@@ -543,33 +543,25 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if(!CollectionUtils.isEmpty(content)){
Set<Object> userIds = content.stream().filter(x -> !StringUtils.isEmpty(x.get("userId"))).map(arg0 -> arg0.get("userId")).collect(Collectors.toSet());
Set<Object> deptIds = content.stream().filter(x -> !StringUtils.isEmpty(x.get("deptId"))).map(arg0 -> arg0.get("deptId")).collect(Collectors.toSet());
List<AgencyUserModel> users = new ArrayList<>();
Map<String,AgencyUserModel> userMap = new HashMap<>();
if(!CollectionUtils.isEmpty(userIds)){
users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
userMap = remoteSecurityService.getUsersMap(toke, product, appKey, userIds);
}
// Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
Map<String, String> userMap = new HashMap<>();
if(users!=null){
userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
}
List<DepartmentModel> depts = new ArrayList<>();
Map<Long, String> deptMap = new HashMap<>();
if(!CollectionUtils.isEmpty(deptIds)){
depts = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
deptMap = remoteSecurityService.getDepName(toke, product, appKey, deptIds);
}
// Map<Long, String > deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
Map<Long, String> deptMap = new HashMap<>();
if(depts!=null){
deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
}
// content.forEach(e -> {
// e.put("userName",userMap.get(e.get("userId")));
// e.put("deptName",deptMap.get(e.get("deptId")));
// e.put("tel",userMap.get(String.valueOf(e.get("deptId")+"tel")));
// });
for(int i=0;i<content.size();i++){
content.get(i).put("userName",userMap.get(content.get(i).get("userId")));
content.get(i).put("deptName",deptMap.get(content.get(i).get("deptId")));
content.get(i).put("tel",userMap.get(String.valueOf(content.get(i).get("deptId")+"tel")));
if(content.get(i).get("userId") !=null && userMap.containsKey(content.get(i).get("userId"))){
AgencyUserModel user = userMap.get(content.get(i).get("userId"));
content.get(i).put("userName", user.getRealName());
content.get(i).put("tel", user.getMobile());
}
if(content.get(i).get("deptId") !=null && deptMap.containsKey(Long.valueOf(content.get(i).get("deptId").toString()))){
content.get(i).put("deptName", deptMap.get(Long.valueOf(content.get(i).get("deptId").toString())));
}
}
}
return new PageImpl<>(content, pageable, total);
......
......@@ -9,7 +9,7 @@
<parent>
<groupId>com.yeejoin.amos</groupId>
<artifactId>YeeAmosFireAutoSysRoot</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
</parent>
<dependencies>
......@@ -17,7 +17,7 @@
<dependency>
<groupId>com.yeejoin.amos</groupId>
<artifactId>YeeAmosFireAutoSysService</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
</dependency>
</dependencies>
......
......@@ -4,11 +4,11 @@ security.productWeb=CONVERTER_STATION_WEB
security.appKeyWeb=CONVERTER_STATION
oauth2.accessToken=my
oauth2.password=a123456
oauth2.password=a1234560
#environment
#spring.profiles.active = dev
eureka.client.serviceUrl.defaultZone=http://172.16.3.75:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true
......@@ -33,7 +33,7 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
params.remoteRuleUrl=http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl=http://172.16.10.91:10600/
spring.redis.database=1
spring.redis.database=5
spring.redis.host=172.16.11.33
spring.redis.port=6379
spring.redis.password=1234560
......@@ -44,7 +44,7 @@ spring.redis.jedis.pool.min-idle=0
spring.redis.timeout=1000
#picture upload
file.uploadUrl=D:\\upload\\files\\
file.uploadUrl=E:\\upload\\files\\
#picture read
file.readUrl=http://172.16.3.89:8083/file/getFile?in=
params.isPush=true
......@@ -56,12 +56,11 @@ emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY
Push.fegin.name=APPMESSAGEPUSHSERVICE-36
dutyMode.fegin.name=AMOSDUTYMODE
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
amos.feign.gennerator.use-gateway=false
\ No newline at end of file
amos.feign.gennerator.use-gateway=true
\ No newline at end of file
spring.application.name = AMOS-AUTOSYS
spring.application.name = AMOS-AUTOSYS-my
server.port = 8083
spring.profiles.active=dev
#spring.freemarker.cache=false
spring.devtools.restart.enabled=true
spring.devtools.restart.additional-paths=src/main/java
spring.devtools.restart.exclude=WEB-INF/**
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
#JPA Configuration:
......@@ -35,18 +33,16 @@ logging.level.com.yeejoin.amos.fas.business.dao.mapper=debug
#liquibase
spring.liquibase.change-log = classpath:/db/changelog/changelog-master.xml
spring.liquibase.enabled= false
spring.liquibase.enabled= true
param.system.online.date = 2020-02-12
visual.fegin.name=maas-visual
spring.http.multipart.maxFileSize = 10480000
spring.http.multipart.MaxRequestSize = 50480000
windows.img.path = D:\\
windows.img.path = E:\\
linux.img.path = /
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOSDUTYMODE
param.safetyIndexChange.cron = 0 0 2 * * ?
......@@ -5,57 +5,27 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="maoying" id="1558405565112-1" runOnChange="true">
<comment>f_fire_equipment_point_update 触发器创建</comment>
<sql endDelimiter="#">
DROP TRIGGER IF EXISTS `trigger_fire_equipment_point_update`;
CREATE TRIGGER `trigger_fire_equipment_point_update` AFTER UPDATE ON `f_fire_equipment_point` FOR EACH ROW
BEGIN
DECLARE num1 INT (4) default 0;
select count(1) into num1 from f_fire_equipment_point where fire_equipment_id = new.fire_equipment_id and type='SWITCH' and 0x4000>=CAST(code AS SIGNED) and value > 0;
if num1 > 0 then
update f_fire_equipment set equip_status = 1 where id = new.fire_equipment_id;
else
update f_fire_equipment set equip_status = 0 where id = new.fire_equipment_id;
end if;
END#
</sql>
</changeSet>
<changeSet author="gaodongdong" id="1561454730001-1" runOnChange="true">
<comment>f_fire_equipment_point_update 触发器创建</comment>
<sql endDelimiter="#">
DROP TRIGGER IF EXISTS `trigger_fire_equipment_point_update`;
CREATE TRIGGER `trigger_fire_equipment_point_update` AFTER UPDATE ON `f_fire_equipment_point` FOR EACH ROW
BEGIN
DECLARE num1 INT (4) default 0;
select count(1) into num1 from f_fire_equipment_point where fire_equipment_id = new.fire_equipment_id and type='SWITCH' and 0x4000>=CAST(code AS SIGNED) and value > 0;
if num1 > 0 then
update f_fire_equipment set equip_status = 1 where id = new.fire_equipment_id;
update f_risk_source_equipment set status = 1 where fire_equipment_id = new.fire_equipment_id;
else
update f_fire_equipment set equip_status = 0 where id = new.fire_equipment_id;
update f_risk_source_equipment set status = 0 where fire_equipment_id = new.fire_equipment_id;
end if;
END#
</sql>
</changeSet>
<changeSet author="suhg" id="1561454393000-1" runOnChange="true">
<comment>f_risk_source_equipment 更新触发器创建</comment>
<comment>update f_fmea_equipment_point 更新触发器创建</comment>
<sql endDelimiter="#">
DROP TRIGGER IF EXISTS `fire_source_equip_upd`;
CREATE TRIGGER fire_source_equip_upd AFTER UPDATE on f_risk_source_equipment FOR EACH ROW
DROP TRIGGER IF EXISTS `trigger_fmea_equipment_point_update`;
CREATE TRIGGER trigger_fmea_equipment_point_update AFTER UPDATE on f_fmea_equipment_point FOR EACH ROW
BEGIN
DECLARE riskSourceId BIGINT (20);
DECLARE num1 int (20);
DECLARE num2 int (20);
select rse.risk_source_id INTO riskSourceId from f_risk_source_equipment rse where rse.id = new.id;
IF new.status = 1 then UPDATE f_risk_source rs set rs.status = 'ANOMALY' where rs.id = riskSourceId;
ELSEIF new.status = 0 then
SELECT COUNT(1) INTO num1 FROM f_risk_source_equipment rse WHERE rse.risk_source_id = riskSourceId and rse.status = 1;-- 告警
SELECT COUNT(1) INTO num2 FROM f_risk_source_point_inputitem rsp WHERE rsp.risk_source_id = riskSourceId and rsp.status = '2';
update f_risk_source rs set rs.`status` = (case when num1+num2>0 then 'ANOMALY' else 'NORMAL' END) where rs.id = riskSourceId;
SELECT fm.risk_source_id INTO riskSourceId FROM f_fmea fm WHERE fm.id = (select fmea_id from f_fmea_equipment_point fep where fep.id = new.id);
IF new.state = '1' then
UPDATE f_risk_source rs set rs.status = 'ANOMALY' where rs.id = riskSourceId;
ELSEIF new.state = '0' then
SELECT count(fep.id) INTO num1 FROM f_fmea_equipment_point fep
LEFT JOIN f_fmea ff ON ff.id = fep.fmea_id
WHERE fep.state = '1' AND ff.risk_source_id = riskSourceId;
SELECT count(fpi.id) INTO num2 FROM f_fmea_point_inputitem fpi
LEFT JOIN f_fmea ff ON ff.id = fpi.fmea_id
WHERE state = '1' AND ff.risk_source_id = riskSourceId;
update f_risk_source rs set rs.`status` = (case when (num1+num2) >0 then 'ANOMALY' else 'NORMAL' END) where rs.id = riskSourceId;
END IF;
END#
</sql>
......@@ -63,19 +33,25 @@
<changeSet author="suhg" id="1561454393000-2" runOnChange="true">
<comment>f_risk_source_point_inputitem 更新触发器创建</comment>
<sql endDelimiter="#">
DROP TRIGGER IF EXISTS `risk_source_point_item_upd`;
CREATE TRIGGER risk_source_point_item_upd AFTER UPDATE on f_risk_source_point_inputitem FOR EACH ROW
DROP TRIGGER IF EXISTS `trigger_fmea_point_inputitem_update`;
CREATE TRIGGER trigger_fmea_point_inputitem_update AFTER UPDATE on f_fmea_point_inputitem FOR EACH ROW
BEGIN
DECLARE riskSourceId BIGINT (20);
DECLARE num1 int (20);
DECLARE num2 int (20);
select rsp.risk_source_id INTO riskSourceId from f_risk_source_point_inputitem rsp where rsp.id = new.id;
IF new.status = '2' then UPDATE f_risk_source rs set rs.status = 'ANOMALY'
where rs.id= riskSourceId;
SELECT fm.risk_source_id INTO riskSourceId FROM f_fmea fm WHERE fm.id = (select fmea_id from f_fmea_point_inputitem fpi where fpi.id = new.id);
IF new.state = '1' then
UPDATE f_risk_source rs set rs.status = 'ANOMALY' where rs.id= riskSourceId;
ELSE
SELECT COUNT(1) INTO num1 FROM f_risk_source_equipment rse WHERE rse.risk_source_id = riskSourceId and rse.status = 1;-- 告警
SELECT COUNT(1) INTO num2 FROM f_risk_source_point_inputitem rsp WHERE rsp.risk_source_id = riskSourceId and rsp.status = '2';
update f_risk_source rs set rs.`status` = (case when num1+num2>0 then 'ANOMALY' else 'NORMAL' END) where rs.id = riskSourceId;
SELECT count(fep.id) INTO num1 FROM f_fmea_equipment_point fep
LEFT JOIN f_fmea ff ON ff.id = fep.fmea_id
WHERE fep.state = '1' AND ff.risk_source_id = riskSourceId;
SELECT count(fpi.id) INTO num2 FROM f_fmea_point_inputitem fpi
LEFT JOIN f_fmea ff ON ff.id = fpi.fmea_id
WHERE state = '1' AND ff.risk_source_id = riskSourceId;
update f_risk_source rs set rs.`status` = (case when (num1+num2)>0 then 'ANOMALY' else 'NORMAL' END) where rs.id = riskSourceId;
END IF;
END#
</sql>
......@@ -91,10 +67,8 @@
select count(1) into num1 from f_fire_equipment_point where fire_equipment_id = new.fire_equipment_id and type='SWITCH' and 0x4000>=CAST(code AS SIGNED) and value = 'true';
if num1 > 0 then
update f_fire_equipment set equip_status = 1 where id = new.fire_equipment_id;
update f_risk_source_equipment set status = 1 where fire_equipment_id = new.fire_equipment_id;
else
update f_fire_equipment set equip_status = 0 where id = new.fire_equipment_id;
update f_risk_source_equipment set status = 0 where fire_equipment_id = new.fire_equipment_id;
end if;
END#
</sql>
......
......@@ -124,7 +124,9 @@
) isBound
from
f_fire_equipment_point as a
left join f_dict fd on fd.id = a.alarm_type
<where>
fd.dict_value = 'alarm_type_trouble'
<if test="equipmentId!=null">
and a.fire_equipment_id = #{equipmentId}
</if>
......
......@@ -331,7 +331,7 @@
AND id = #{pointId}
</if>
<if test="orgCode != null">
AND org_code like = #{orgCode}
AND org_code = #{orgCode}
</if>
</when>
<when test="type == 'fireFoamRoom'">
......@@ -368,13 +368,12 @@
<select id="countUpperRiskPoint" resultType="long">
SELECT
count(DISTINCT frcl.id)
count(DISTINCT frcl.risk_source_id)
FROM
(
SELECT
a.id,
a.risk_source_id,
date_format(a.create_date, '%Y-%m-%d') AS create_date
a.risk_source_id
FROM
`f_rpn_change_log` a,
`f_risk_source` b
......@@ -382,25 +381,21 @@
a.type = #{type}
and a.risk_source_id = b.id
and b.org_code = #{orgCode}
and date_format(a.create_date, '%Y-%m-%d') = #{date}
) as frcl
WHERE
frcl.create_date = #{date}
</select>
<select id="countCheckException" resultType="long">
select count(distinct pt.point_id) from
(
SELECT
a.id,
DATE_FORMAT(b.begin_time,'%Y-%m-%d') as begin_date,
DATE_FORMAT(b.end_time,'%Y-%m-%d') as end_date,
a.point_id
FROM `p_plan_task_detail` a , p_plan_task b
where
a.task_no = b.id
and a.`status` in ('2','3')
and (b.org_code = #{orgCode} OR b.org_code like CONCAT(#{orgCode},'-%'))
) pt
where #{date} BETWEEN pt.begin_date and pt.end_date
count(distinct pc.point_id)
FROM
p_check pc
WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
</select>
<select id="countFireException" resultType="long">
......@@ -417,41 +412,43 @@
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
SELECT
b.id,
a.`name`,
a.risk_level_id as riskLevelId,
b.create_date as changeDate
rcl.id,
rcl.create_date AS changeDate,
rs.risk_level_id AS riskLevelId,
rs.`name`
FROM
f_risk_source a,
(SELECT a.id,a.type,a.risk_source_id,max(a.create_date) as create_date FROM `f_rpn_change_log` a GROUP BY a.risk_source_id) as b
(
SELECT DISTINCT
risk_source_id,
MAX(create_date) create_date,
MAX(id) id
FROM
f_rpn_change_log
WHERE
type = '0'
AND DATE_FORMAT(create_date, '%Y-%m-%d') = #{date}
) rcl
LEFT JOIN f_risk_source rs ON rs.id = rcl.risk_source_id
WHERE
b.risk_source_id = a.id
AND b.type = '0'
and a.org_code = #{orgCode}
and DATE_FORMAT(b.create_date,'%Y-%m-%d') = #{date}
rs.org_code = #{orgCode}
</select>
<select id="getAllErrorPatrolPoint" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
pc.id,
b.`name`,
pc.point_id id,
pc.point_name 'name',
pc.`is_ok` as status,
pc.check_time as changeDate
max(pc.check_time) as changeDate
FROM
(select
a.id,
a.point_id,
a.`is_ok`,
max(a.check_time) as check_time
FROM
p_check a
where DATE_FORMAT(a.check_time,'%Y-%m-%d') = #{date}
and a.`is_ok` IN ('2', '3')
GROUP BY a.point_id) as pc,
p_point b
p_check pc
WHERE
pc.point_id = b.id
and b.is_delete = false
and b.org_code = #{orgCode}
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND (
pc.org_code = #{orgCode}
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%')
)
AND pc.`is_ok` = '2'
GROUP BY pc.point_id,pc.`is_ok`,pc.point_name
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
......
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.yeejoin.amos</groupId>
<artifactId>YeeAmosFireAutoSysRoot</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
<packaging>pom</packaging>
<name>YeeAmosFireAutoSysRoot</name>
......
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