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