Commit 37678fda authored by zhangsen's avatar zhangsen

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6_temp

# Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/OrgUsrMapper.java # amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IDataSyncService.java # amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/OrgUsrMapper.xml # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/OrgUsrController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/OrgUsrServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/WaterResourceServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/fegin/JcsFeign.java # amos-boot-system-equip/src/main/resources/application-dev.properties # amos-boot-system-equip/src/main/resources/mapper/FireFightingSystemMapper.xml # amos-boot-system-jcs/src/main/resources/application-dev.properties # amos-boot-utils/amos-boot-utils-message/src/main/resources/application-dev.properties
parents 45875084 9bdfc2ab
......@@ -23,7 +23,7 @@
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>
\ No newline at end of file
......@@ -79,11 +79,11 @@ public class KeySiteExcleDto implements Serializable {
private String keyPreventionReason;
@ExcelProperty(value = "消防设施情况", index = 8)
@ExplicitConstraint(indexNum=11,source = {"有","无"})
@ApiModelProperty(value = "消防设施情况")
private String fireFacilitiesInfo;
@ExcelProperty(value = "防火标志设立情况", index = 9)
@ExplicitConstraint(indexNum=9,source = {"有","无"})
@ApiModelProperty(value = "防火标志设立情况")
private String firePreventionFlagName;
......
......@@ -63,10 +63,10 @@ public class WaterResourcePoolDto extends BaseDto {
private String recUserName;
@ApiModelProperty(value = "最低报警水位(m)")
private float minWaterLevel;
private Float minWaterLevel;
@ApiModelProperty(value = "最高报警水位(m)")
private float maxWaterLevel;
private Float maxWaterLevel;
@ApiModelProperty("水池液位显示装置id")
private String levelDeviceId;
......
......@@ -50,4 +50,6 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<Map<String, Object>> getStationSignInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getUsrSignInfoByBizOrgCode(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getUserInfoByYJYA(String bizOrgCode);
}
......@@ -49,4 +49,6 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> {
List<Map<String, Object>> getWaterTypeByBizOrgCode(String bizOrgCode);
Page<WaterResourceDto> pageByDefect(Page<WaterResourceDto> page, @Param("nameOrCode") String nameOrCode, @Param("bizOrgCode") String bizOrgCode, @Param("systemName") String systemName);
Map<String, Object> getWaterResourceInfoList(@Param("map") Map<String, Object> map);
}
......@@ -36,4 +36,8 @@ public interface IFirefightersService {
void saveFirefightersByUser(PeopleInfoDto firefighters);
BigScreen1VO getFireForceInfoByCode(String companyCode);
String getCompanyName(String bizOrgCode);
List<Map<String, Object>> getUserInfoByYJYA(String bizOrgCode);
}
......@@ -368,7 +368,7 @@ public interface IOrgUsrService {
* @param id
* @return
*/
String deleteFirefighterPeopleById(Long id);
String deleteFirefighterPeopleById(Long id, String type);
OrgUsr selectParentOrgUsr(OrgUsr orgUsr);
......
......@@ -652,7 +652,7 @@ WHERE
ou.sequence_nbr as id,
ou.biz_org_name as userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IF(MAX( CASE WHEN cfi.field_code = 'postTypeName' THEN field_value END ) = '', NULL, MAX( CASE WHEN cfi.field_code = 'postTypeName' THEN field_value END )) AS postTypeName,
IF(MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ) = '', NULL, MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END )) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
......
......@@ -597,4 +597,102 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
AND u.`biz_org_code` LIKE concat(#{bizOrgCode}, '%')
</if>
</select>
<select id="getUserInfoByYJYA" resultType="java.util.Map">
SELECT
'运行人员' AS departmentName,
(
SELECT
count( 1 )
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN ( SELECT * FROM cb_dynamic_form_instance WHERE field_code = 'peopleType' ) cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.biz_org_code LIKE concat(#{bizOrgCode}, '%')
and cfi.field_value = 1602
AND ou.biz_org_type = 'PERSON'
AND ou.is_delete = 0
) onDuty,
(
SELECT
count( 1 )
FROM
(
SELECT
ou.*
FROM
cb_org_usr ou
LEFT JOIN ( SELECT * FROM cb_dynamic_form_instance WHERE field_code = 'peopleType' ) cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
cfi.field_value = 1602
AND ou.is_delete = 0
AND ou.biz_org_type = 'PERSON'
and ou.biz_org_code like CONCAT(#{bizOrgCode}, '%')
GROUP BY
ou.sequence_nbr
) a
) total
union all
SELECT
'驻站消防队' AS departmentName,
(
SELECT
count( 1 )
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN ( SELECT * FROM cb_dynamic_form_instance WHERE field_code = 'peopleType' ) cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.biz_org_code LIKE concat(#{bizOrgCode}, '%')
and cfi.field_value = 1601
AND ou.biz_org_type = 'PERSON'
AND ou.is_delete = 0
) onDuty,
(
SELECT
count( 1 )
FROM
(
SELECT
ou.*
FROM
cb_org_usr ou
LEFT JOIN ( SELECT * FROM cb_dynamic_form_instance WHERE field_code = 'peopleType' ) cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
cfi.field_value = 1601
AND ou.is_delete = 0
AND ou.biz_org_type = 'PERSON'
and ou.biz_org_code like CONCAT(#{bizOrgCode}, '%')
GROUP BY
ou.sequence_nbr
) a
) total
</select>
</mapper>
......@@ -87,7 +87,14 @@
order by u.rec_date desc
)a where a.sequenceNbr is not null
<if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item">AND a.${item} = #{map.fieldsValue[${item}]}</foreach>
<foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'">
AND a.${item} = #{map.fieldsValue[${item}]}
</if>
</foreach>
</if>
</select>
......@@ -164,7 +171,14 @@
order by u.rec_date desc
)a where a.sequenceNbr is not null
<if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item">AND a.${item} = #{map.fieldsValue[${item}]}</foreach>
<foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'">
AND a.${item} = #{map.fieldsValue[${item}]}
</if>
</foreach>
</if>
LIMIT #{map.pageNum}, #{map.pageSize}
</select>
......@@ -965,19 +979,6 @@ LEFT JOIN (
and usr.is_delete = false
</select>
<select id="companyDeptListWithPersonCountNew"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
usr.*,
(select count(1) from cb_org_usr u where u.biz_org_type = 'PERSON' and u.is_delete = false and u.biz_org_code like CONCAT(usr.biz_org_code,'%')) as total
FROM
cb_org_usr usr
where
(usr.biz_org_type = 'COMPANY' OR usr.biz_org_type = 'DEPARTMENT') and usr.biz_org_code like concat (#{bizOrgCode},'%')
and usr.is_delete = false
</select>
<select id="companyTreeByUser"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT
......@@ -1079,122 +1080,64 @@ LEFT JOIN (
</select>
<select id="getOrgUsrSyncDataList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrSyncDto">
SELECT
u.*,
case
when u.biz_org_type = 'person'
and (
SELECT
s.biz_org_type
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id) = 'DEPARTMENT'
then (
SELECT
s.biz_org_name
from
cb_org_usr s
WHERE
s.sequence_nbr = (
SELECT
s.parent_id
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id))
when u.biz_org_type = 'person'
and (
SELECT
s.biz_org_type
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id) = 'COMPANY'
then u.parent_name
else u.biz_org_name
end as company_biz_name,
case
when u.biz_org_type = 'person'
and (
SELECT
s.biz_org_type
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id) = 'DEPARTMENT'
then (
SELECT
s.biz_org_code
from
cb_org_usr s
WHERE
s.sequence_nbr = (
SELECT
s.parent_id
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id))
when u.biz_org_type = 'person'
and (
SELECT
s.biz_org_type
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id) = 'COMPANY'
then (
SELECT
s.biz_org_code
from
cb_org_usr s
WHERE
s.sequence_nbr = u.parent_id)
else u.biz_org_code
end as company_biz_code,
cfp.fire_management_post,
cft.type_code,
cf.certificate_number certificatesNumber,
cf.employee_number ,
cf.mobile_phone telephone,
( CASE
WHEN cfp.post_qualification IS NULL THEN 0
ELSE 1
END ) AS is_certificate,
IF
((
SELECT
field_value
FROM
cb_dynamic_form_instance dfi
WHERE
dfi.field_code = 'peopleType'
AND dfi.instance_id = u.sequence_nbr )= 2,
1,
0 ) AS is_firefighters,
(
SELECT
field_value
FROM
cb_dynamic_form_instance dfi
WHERE
dfi.field_code = 'personImg'
AND dfi.instance_id = u.sequence_nbr ) AS personImg,
cfp.job_title
u.*,
CASE
WHEN u.biz_org_type = 'person'
AND ( SELECT s.biz_org_type FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id ) = 'DEPARTMENT' THEN
(
SELECT
s.biz_org_name
FROM
cb_org_usr u
LEFT JOIN cb_firefighters_post cfp ON
cfp.org_usr_id = u.sequence_nbr
LEFT JOIN cb_firefighters cf ON
cf.org_usr_id = u.sequence_nbr AND cf.is_delete= 0
LEFT JOIN cb_fire_team cft ON
cft.sequence_nbr = cf.fire_team_id
cb_org_usr s
WHERE
u.is_delete = 0
<if test="id != null">
AND u.sequence_nbr = #{id}
</if>
s.sequence_nbr = ( SELECT s.parent_id FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id )
)
WHEN u.biz_org_type = 'person'
AND ( SELECT s.biz_org_type FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id ) = 'COMPANY' THEN
u.parent_name ELSE u.biz_org_name
END AS company_biz_name,
CASE
WHEN u.biz_org_type = 'person'
AND ( SELECT s.biz_org_type FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id ) = 'DEPARTMENT' THEN
(
SELECT
s.biz_org_code
FROM
cb_org_usr s
WHERE
s.sequence_nbr = ( SELECT s.parent_id FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id )
)
WHEN u.biz_org_type = 'person'
AND ( SELECT s.biz_org_type FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id ) = 'COMPANY' THEN
( SELECT s.biz_org_code FROM cb_org_usr s WHERE s.sequence_nbr = u.parent_id ) ELSE u.biz_org_code
END AS company_biz_code,
cfp.fire_management_post,
cft.type_code,
cf.certificate_number certificatesNumber,
cf.employee_number,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'telephone' AND dfi.instance_id = u.sequence_nbr ) AS telephone,
( CASE WHEN cfp.post_qualification IS NULL THEN 0 ELSE 1 END ) AS is_certificate,
IF
(
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'peopleType' AND dfi.instance_id = u.sequence_nbr ) = 1601,
1,
0
) AS is_firefighters,
( SELECT field_value FROM cb_dynamic_form_instance dfi WHERE dfi.field_code = 'personImg' AND dfi.instance_id = u.sequence_nbr ) AS personImg,
cfp.job_title
FROM
cb_org_usr u
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = u.sequence_nbr
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr
LEFT JOIN cb_fire_team cft ON cft.sequence_nbr = cf.fire_team_id
WHERE
u.is_delete = 0
<if test="id != null">
AND u.sequence_nbr = #{id}
</if>
GROUP BY
u.sequence_nbr
u.sequence_nbr
</select>
</mapper>
......@@ -199,4 +199,44 @@
<if test="bizOrgCode != null and bizOrgCode != ''">and biz_org_code like concat( #{bizOrgCode}, '%')</if>
order by cb_water_resource.rec_date desc
</select>
<select id="getWaterResourceInfoList" resultType="java.util.Map">
SELECT
(
SELECT
COUNT(DISTINCT cwr.sequence_nbr)
FROM
cb_water_resource cwr
WHERE
cwr.is_delete = 1
AND cwr.resource_type = #{map.fireHydrant}
<if test="map.bizOrgCode != null and map.bizOrgCode != ''">
AND cwr.biz_org_code LIKE concat(#{map.bizOrgCode}, '%')
</if>
) AS fireHydrant,
(
SELECT
COUNT(DISTINCT cwr.sequence_nbr)
FROM
cb_water_resource cwr
WHERE
cwr.is_delete = 1
AND cwr.resource_type = #{map.firePool}
<if test="map.bizOrgCode != null and map.bizOrgCode != ''">
AND cwr.biz_org_code LIKE concat(#{map.bizOrgCode}, '%')
</if>
) AS firePool,
(
SELECT
COUNT(DISTINCT cwr.sequence_nbr)
FROM
cb_water_resource cwr
WHERE
cwr.is_delete = 1
AND cwr.resource_type = #{map.fireWaterTank}
<if test="map.bizOrgCode != null and map.bizOrgCode != ''">
AND cwr.biz_org_code LIKE concat(#{map.bizOrgCode}, '%')
</if>
) AS fireWaterTank
</select>
</mapper>
package com.yeejoin.equipmanage.common.dto;
import lombok.Data;
@Data
public class FireFightingSystemDto {
private Long id;
private String code;
private String name;
private Integer equipTotal = 0;
private Integer alarmEquipTotal = 0;
private Integer status = 0;
private String image;
private Long sort;
}
......@@ -202,4 +202,16 @@ public class EquipmentSpecificAlarm extends BaseEntity {
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
}
/**
* 机构/部门名称
*/
@TableField(exist = false)
private String bizOrgName;
/**
* 机构编码
*/
@TableField(exist = false)
private String bizOrgCode;
}
\ No newline at end of file
......@@ -226,4 +226,20 @@ public class EquipmentSpecificAlarmLog extends BaseEntity {
@TableField(value = "defect_batch_id")
private String defectBatchId;
@ApiModelProperty(value = "机构/部门名称")
@TableField(value = "biz_org_name")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
@TableField(value = "biz_org_code")
private String bizOrgCode;
@ApiModelProperty(value = "站名称")
@TableField(value = "station_name")
private String stationName;
@ApiModelProperty(value = "站编码")
@TableField(value = "station_code")
private String stationCode;
}
......@@ -153,4 +153,30 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false)
private int num;
/**
* 机构/部门名称
*/
@TableField(exist = false)
private String bizOrgName;
/**
* 机构编码
*/
@TableField(exist = false)
private String bizOrgCode;
@ApiModelProperty(value = "装备系统code")
@TableField(exist = false)
private String specificCode;
@ApiModelProperty(value = "装备定义名称")
@TableField(exist = false)
private String equipmentName;
@TableField(exist = false)
private String equipmentType;
// 直流中心方便前端刷新展示
@TableField(exist = false)
private String UUID;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
......@@ -23,6 +24,7 @@ import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -201,10 +203,23 @@ public class OrgPersonController extends BaseController {
// if(redisUtils.get("userList") != null){
// return ResponseHelper.buildResponse(redisUtils.get("userList"));
// }
return ResponseHelper.buildResponse(iOrgUsrService.pagePerson(
String type = null;
if (requestBody.containsKey("type") && "station".equals(requestBody.get("type"))) {
type = "station";
requestBody.remove("type");
}
IPage<Map<String, Object>> mapIPage = iOrgUsrService.pagePerson(
requestBody.containsKey("pageNum") ? requestBody.get("pageNum").toString() : null ,
requestBody.containsKey("pageSize") ? requestBody.get("pageSize").toString() : null ,
requestBody));
requestBody);
if (!ObjectUtils.isEmpty(type)) {
for (Map<String, Object> record : mapIPage.getRecords()) {
if (!record.containsKey("amosOrgId")) {
record.put("amosOrgId", record.get("sequenceNbr"));
}
}
}
return ResponseHelper.buildResponse(mapIPage);
}
/**
......@@ -430,8 +445,8 @@ public class OrgPersonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/people/firefighter/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public ResponseModel<String> deleteFirefighterPeopleById(@PathVariable Long id) {
return ResponseHelper.buildResponse(iOrgUsrService.deleteFirefighterPeopleById(id));
public ResponseModel<String> deleteFirefighterPeopleById(@PathVariable Long id,@PathVariable String type) {
return ResponseHelper.buildResponse(iOrgUsrService.deleteFirefighterPeopleById(id,type));
}
/**
*
......
......@@ -811,11 +811,22 @@ public class OrgUsrController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据机构类型(逗号分割),机构编码获取列表不分页", notes = "根据机构类型(逗号分割),机构编码获取列表不分页")
@GetMapping(value = "/{authKey}/listWithAuth")
public ResponseModel<List<OrgUsr>> getListWithAuth(@RequestParam(required = false) String orgTypes,
@RequestParam(required = false) String type,
@PathVariable String authKey) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String bizOrgCode = personIdentity.getBizOrgCode();
if ("dl".equals(type)){
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
lambda.eq(OrgUsr::getBizOrgCode, bizOrgCode);
lambda.eq(OrgUsr::getIsDelete, false);
OrgUsr orgUsr = orgUsrMapper.selectList(lambda).get(0);
if (!org.apache.commons.lang3.ObjectUtils.isEmpty(orgUsr.getBizOrgType()) && "COMPANY".equals(orgUsr.getBizOrgType())) {
bizOrgCode = orgUsr.getBizOrgCode();
} else {
bizOrgCode = getCompanyNameById(orgUsr.getParentId());
}
}
//拿到数据字典中存储的 特殊类型 特殊部门
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
......@@ -1006,6 +1017,33 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(orgUsr.getBizOrgCode());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询公司bizOrgCode", notes = "查询公司bizOrgCode")
@GetMapping(value = "/getCompany")
public ResponseModel<String> getBizByAmos(@RequestParam("bizOrgCode") String bizOrgCode) {
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
lambda.eq(OrgUsr::getBizOrgCode, bizOrgCode);
lambda.eq(OrgUsr::getIsDelete, false);
OrgUsr orgUsr = orgUsrMapper.selectList(lambda).get(0);
if (!org.apache.commons.lang3.ObjectUtils.isEmpty(orgUsr.getBizOrgType()) && "COMPANY".equals(orgUsr.getBizOrgType())) {
return ResponseHelper.buildResponse(orgUsr.getBizOrgCode());
} else {
return ResponseHelper.buildResponse(getCompanyNameById(orgUsr.getParentId()));
}
}
private String getCompanyNameById(String id) {
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
lambda.eq(OrgUsr::getSequenceNbr, id);
lambda.eq(OrgUsr::getIsDelete, false);
OrgUsr orgUsr = orgUsrMapper.selectList(lambda).get(0);
if (!org.apache.commons.lang3.ObjectUtils.isEmpty(orgUsr.getBizOrgType()) && "COMPANY".equals(orgUsr.getBizOrgType())) {
return orgUsr.getBizOrgCode();
} else {
return getCompanyNameById(orgUsr.getParentId());
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询单位基本信息", notes = "查询单位基本信息")
......
......@@ -241,7 +241,7 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
OrgPersonDto orgPersonDto = new OrgPersonDto();
BeanUtils.copyProperties(orgUsr, orgPersonDto);
List<DynamicFormInstance> dynamicFormInstances = orgUsrService.dynamicFormColumn(peopleInfoDto.getFirefighters(), false);
List<DynamicFormInstance> dynamicFormInstances = orgUsrService.dynamicFormColumn(peopleInfoDto, false);
orgPersonDto.setDynamicFormValue(dynamicFormInstances);
try {
orgUsrService.updateByIdOrgPerson(orgPersonDto, id);
......@@ -329,4 +329,36 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
bigScreen1VO.setUsrSignInfoByCode(usrSignInfoByBizOrgCode);
return bigScreen1VO;
}
@Override
public String getCompanyName(String bizOrgCode) {
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
lambda.eq(OrgUsr::getBizOrgCode, bizOrgCode);
lambda.eq(OrgUsr::getIsDelete, false);
OrgUsr orgUsr = orgUsrMapper.selectList(lambda).get(0);
if (!ObjectUtils.isEmpty(orgUsr.getBizOrgType()) && "COMPANY".equals(orgUsr.getBizOrgType())) {
return orgUsr.getBizOrgName();
} else {
return getCompanyNameById(orgUsr.getParentId());
}
}
private String getCompanyNameById(String id) {
LambdaQueryWrapper<OrgUsr> lambda = new QueryWrapper<OrgUsr>().lambda();
lambda.eq(OrgUsr::getSequenceNbr, id);
lambda.eq(OrgUsr::getIsDelete, false);
OrgUsr orgUsr = orgUsrMapper.selectList(lambda).get(0);
if (!ObjectUtils.isEmpty(orgUsr.getBizOrgType()) && "COMPANY".equals(orgUsr.getBizOrgType())) {
return orgUsr.getBizOrgName();
} else {
return getCompanyNameById(orgUsr.getParentId());
}
}
@Override
public List<Map<String, Object>> getUserInfoByYJYA(String bizOrgCode) {
return firefightersMapper.getUserInfoByYJYA(bizOrgCode);
}
}
......@@ -22,9 +22,11 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper;
import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
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.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
......@@ -33,6 +35,8 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
......
......@@ -53,18 +53,8 @@
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-authtoken</artifactId>
<artifactId>amos-component-security</artifactId>
<version>1.7.13-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>io.springfox</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
......@@ -355,8 +355,8 @@ public class BuildingController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("公司消防建筑树")
@GetMapping(value = "/companyBuildingTree")
public List<BuildingTreeVo> getCompanyBuildingTree() {
return buildService.getCompanyBuildingTree(null);
public List<BuildingTreeVo> getCompanyBuildingTree(@RequestParam(required = false, value = "type")String type) {
return buildService.getCompanyBuildingTree(null, type);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -800,4 +800,18 @@ public class ConfigureController extends AbstractBaseController {
page.setRecords(iFireFightingSystemService.getStockEquipStatistics(bizOrgCode));
return CommonResponseUtil.success(page);
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "应急预案车辆信息")
@GetMapping("/getFireCarInfoByYJYA")
public ResponseModel getFireCarInfoByYJYA() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
return CommonResponseUtil.success(fireFightingSystemMapper.getFireCarInfoByYJYA(bizOrgCode));
}
}
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author Jianqiang Gao
* @title: DCenterController
* <pre>
* @description: 设备告警
* </pre>
* @date 2022/11/15 09:54
*/
@RestController
@Api(tags = "总部直流中心监管页面Api")
@RequestMapping(value = "/dc-center", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class DCenterController extends AbstractBaseController {
@Autowired
private IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IFireFightingSystemService fireFightingSystemService;
@Autowired
IEquipmentSpecificSerivce specificService;
/**
* 直流中心告警列表分页,用于直流中心大数据查询分页,不建议再扩展联表查询
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
public ResponseModel listPage(@RequestParam(value = "alarmType", required = false) String alarmType,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
List<CommonRequest> queryRequests = new ArrayList<>();
CommonRequest request = new CommonRequest();
request.setName("alarmType");
request.setValue(StringUtil.isNotEmpty(alarmType) ? StringUtils.trimToNull(alarmType) : null);
queryRequests.add(request);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = equipmentSpecificAlarmService.zlzxListPage(param);
return CommonResponseUtil.success(list);
}
/**
* 消防系统运行状态分页查询
* @param bizOrgCode
* @param commonPageable
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统运行状态分页查询")
@GetMapping("/fireSysRunStatusPage")
public ResponseModel fireSysRunStatusPage(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemService.fireSysRunStatusPage(page, bizOrgCode));
}
/**
* 获取消防系统总体运行情况
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防系统告警状态信息", notes = "获取消防系统告警状态信息")
@GetMapping(value = "/system/running/info")
public ResponseModel getSystemRunningInfoList() throws Exception {
return CommonResponseUtil.success(fireFightingSystemService.getSystemRunningInfoList());
}
/**
* 获取消防设备数量
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防设备数量", notes = "获取消防设备数量")
@GetMapping(value = "/equip/info")
public ResponseModel getEquipmentStatisticsInfo(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) throws Exception {
return CommonResponseUtil.success(specificService.getEquipmentStatisticsInfo(bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防水池液位")
@GetMapping("/equip/water/info")
public ResponseModel getWaterInfo(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getCenterWaterInfo(page, bizOrgCode));
}
}
......@@ -132,7 +132,9 @@ public class EquipmentIndexController {
x.setEmergencyLevel("4");
x.setEmergencyLevelDescribe("正常");
});
carPropertyService.updateBatchById(list);
if(list.size() > 0){
carPropertyService.updateBatchById(list);
}
} else {
LambdaUpdateWrapper<EquipmentSpecificIndex> equipWrapper = new LambdaUpdateWrapper<>();
equipWrapper.eq(EquipmentSpecificIndex::getEquipmentIndexId, equipmentIndex.getId());
......
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* @author ZeHua Li
* @date 2020/10/29 14:26
* @since v2.0
*/
@RestController
@Api(tags = "设备报警日志信息")
@RequestMapping(value = "/equipSpecificAlarmLog")
public class EquipmentSpecificAlarmLogController extends AbstractBaseController {
@Autowired
IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService;
/**
* 获取告警设备日月环比信息
*
* @param date
* @return
*/
@RequestMapping(value = "/equipAlarmLink", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取告警设备日月环比信息", notes = "获取告警设备日月环比信息")
public ResponseModel equipAlarmLink(@RequestParam(required = false) String date) {
return CommonResponseUtil.success(equipmentSpecificAlarmLogService.equipAlarmLink(date));
}
}
......@@ -381,6 +381,38 @@ public class EquipmentSpecificController extends AbstractBaseController {
return equipmentSpecificSerivce.getListByEquipmentCode(code);
}
@GetMapping(value = "/index/normal")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询非告警指标list", notes = "查询非告警指标list")
public ResponseModel normalIndexInfoList(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.normalIndexInfoList(startDate, endDate));
}
@GetMapping(value = "/info/fire")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询火报系统指标", notes = "查询火报系统指标")
public ResponseModel getFireAutoSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.getFireAutoSysInfo(startDate, endDate));
}
@GetMapping(value = "/info/paomo")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询泡沫系统指标", notes = "查询泡沫系统指标")
public ResponseModel getPaomoSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.getPaomoSysInfo(startDate, endDate));
}
@GetMapping(value = "/info/water")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询给水系统指标", notes = "查询给水系统指标")
public ResponseModel getWaterSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
return CommonResponseUtil.success(equipmentSpecificSerivce.getWaterSysInfo(startDate, endDate));
}
@RequestMapping(value = "/equipment/iotIndexInfo/{equipSpeId}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据装备id获取物联日志", notes = "根据装备id获取物联日志")
......@@ -418,4 +450,6 @@ public class EquipmentSpecificController extends AbstractBaseController {
return CommonResponseUtil.success(equipmentSpecificSerivce.getIndexInfoList(iotCode, entity, isTrend, fieldKey));
}
}
......@@ -643,7 +643,7 @@ public class FireFightingSystemController extends AbstractBaseController {
* @return
*/
@RequestMapping(value = "/getSpeIndex", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public List<SpeIndexVo> selectById(Long id) {
return fireFightingSystemService.getSpeIndex(id,1);
......@@ -921,7 +921,26 @@ public class FireFightingSystemController extends AbstractBaseController {
ExcelUtil.createTemplate(response, "装备信息", "装备信息", list, EquipmentExportVO.class, null, false);
}
/**
* 获取消防系统状态信息
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防系统状态信息", notes = "获取消防系统状态信息")
@GetMapping(value = "/state/info")
public Object getSystemInfoList() throws Exception {
return fireFightingSystemService.getSystemInfoList();
}
/**
* 获取消防系统告警状态信息
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防系统告警状态信息", notes = "获取消防系统告警状态信息")
@GetMapping(value = "/alarm/num")
public Object getSystemAlarmInfoList(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) throws Exception {
return fireFightingSystemService.getSystemAlarmInfoList(startDate, endDate);
}
}
......@@ -196,7 +196,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/fireAlarmLogPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防报警列表分页查询", produces = "application/json;charset=UTF-8", notes = "消防报警列表分页查询")
public ResponseModel pageQuery(@RequestParam(required = false) String code, @RequestParam(required = false) String typeCode, CommonPageable commonPageable) {
public ResponseModel pageQuery(@RequestParam(required = false) String code,
@RequestParam(required = false) String typeCode,
@RequestParam(required = false) String bizOrgCode,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
......@@ -210,12 +213,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
request8.setName("specificIndexKey");
request8.setValue(StringUtil.isNotEmpty(typeCode) ? StringUtils.trimToNull(typeCode) : null);
queryRequests.add(request8);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
queryRequests.add(request13);
}
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(ObjectUtils.isEmpty(bizOrgCode) ? reginParams.getPersonIdentity().getBizOrgCode() : bizOrgCode);
queryRequests.add(request13);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
return CommonResponseUtil.success(equipmentSpecificAlarmService.fireAlarmLogPage(param));
}
......@@ -225,15 +226,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/alarmTrend", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报警类型趋势", produces = "application/json;charset=UTF-8", notes = "报警类型趋势")
public ResponseModel alarmTrend() {
String bizOrgCode = null;
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
public ResponseModel alarmTrend(@RequestParam(required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
return CommonResponseUtil.success(equipmentSpecificAlarmService.alarmTrend(bizOrgCode));
}
......@@ -242,16 +238,21 @@ public class SupervisionConfigureController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览稳压泵信息")
@GetMapping("/getPressurePumpInfo")
public ResponseModel getPressurePumpInfo(CommonPageable commonPageable) {
public ResponseModel getPressurePumpInfo(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> pressurePumpInfo = fireFightingSystemMapper.getPressurePumpInfo(page, bizOrgCode, null);
List<Long> ids = new ArrayList();
pressurePumpInfo.getRecords().stream().map(item -> {
......@@ -329,10 +330,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
long nowDateTime = new Date().getTime();//当前时间戳
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
ids.add((Long) item.get("id"));
boolean time = false;
boolean time = true;
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) {
item.put("update_time", String.valueOf(stateMap.get("update_date")).replaceAll("T", " "));
if(!ObjectUtils.isEmpty(stateMap.get("value"))){
if (!ObjectUtils.isEmpty(stateMap.get("value"))) {
item.put("equipment_index_name", stateMap.get("equipment_index_name"));
} else {
item.put("equipment_index_name", "无信号");
......@@ -346,13 +347,13 @@ public class SupervisionConfigureController extends AbstractBaseController {
}
long res = nowDateTime - update_time;
long diffMinute = res / 1000 / 60;
if (diffMinute <= 5) {
time = true;
if (diffMinute > 5) {
time = false;
}
item.put("upTime", diffMinute);
}
}
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 || time ? "正常" : "异常");
item.put("stateDesc", Integer.parseInt(String.valueOf(item.get("isAlarm"))) == 0 && time ? "正常" : "异常");
return item;
}).collect(Collectors.toList());
List<Map<String, Object>> stateMap = fireFightingSystemMapper.queryStartAndStopBySpecificId(ids);
......@@ -376,6 +377,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
pressurePumpInfo.getRecords().stream(
).map(item -> {
item.put("startAndStopInterval", finalDiffMinute);
item.put("nameKey", pressurePumpStart);
return item;
}).collect(Collectors.toList());
return CommonResponseUtil.success(pressurePumpInfo);
......
......@@ -143,7 +143,7 @@ public interface JcsFeign {
* @return ResponseModel<OrgUsrDto>
*/
@GetMapping(value = "/org-usr/{authKey}/listWithAuth")
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuth(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes);
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuth(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes, @RequestParam(value = "type", required = false) String type);
@GetMapping(value = "/org-usr/{authKey}/listWithAuthToPartol")
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuthToPartol(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes);
......@@ -193,4 +193,8 @@ public interface JcsFeign {
*/
@GetMapping(value = "/org-person/getUser/{id}")
FeignClientResult selectById(@PathVariable String id);
@GetMapping(value = "/org-usr/getCompany")
FeignClientResult getCompany( @RequestParam("bizOrgCode") String bizOrgCode);
}
......@@ -8,7 +8,6 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -40,4 +39,7 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
List<Map<String, Object>> getOtherEquipInfo(@Param("date") String date, @Param("equipmentId") Long equipmentId);
Map<String, Object> alarmEquipLink(String date, String pattern, String cleanFlag);
Map<String, Object> unCleanAlarmEquipLink(String date, String pattern, String cleanFlag);
}
......@@ -140,6 +140,8 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
Page<Map<String, Object>> page(Page page, @Param("param") CommonPageInfoParam param);
Page<Map<String, Object>> zlzxPage(Page page, @Param("param") CommonPageInfoParam param);
Page<Map<String, Object>> pageQuery(Page page, @Param("param") CommonPageInfoParam param);
......
package com.yeejoin.equipmanage.mapper;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -234,4 +232,19 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings);
Integer getAllEquipNum(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
Map<String, Object> getFireAutoSysInfo();
Map<String, Object> getPaomoSysInfo();
Map<String, Object> getWaterSysInfo();
Map<String, Object> getEquipmentStatisticsInfo(@Param("map") Map<String, Object> map);
Page<FireFightingSystemDto> fireSysIotEquipCount(Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode);
List<FireFightingSystemDto> fireSysIotEquipAlarmCount(Date date, String bizOrgCode);
}
......@@ -613,4 +613,16 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, String>> getEquipExpiryListByPage(@Param("page") Page page, @Param("bizOrgCode") String bizOrgCode, @Param("expiryDayNum") Integer expiryDayNum);
List<Map<String, Integer>> getStockEquipStatistics(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getSystemInfoList();
List<Map<String, Object>> getSystemAlarmInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
Map<String, Object> getSystemCountInfo();
Map<String, Object> getSystemRunningInfoList();
List<Map<String, Object>> getFireCarInfoByYJYA(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getCenterWaterInfo(Page page, String bizOrgCode);
}
......@@ -9,7 +9,8 @@ import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.authtoken.robot.AmosRequestContext;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
......
......@@ -314,7 +314,7 @@ public interface IBuilldService extends IService<Building> {
* @return list
* @param authKey
*/
List<BuildingTreeVo> getCompanyBuildingTree(String authKey);
List<BuildingTreeVo> getCompanyBuildingTree(String authKey, String type);
/**
* 获取单位树
......
......@@ -5,6 +5,7 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import java.util.List;
import java.util.Map;
/**
* @author keyong
......@@ -23,9 +24,17 @@ public interface IEquipmentSpecificAlarmLogService extends IService<EquipmentSpe
/**
* 通过告警ID,获取告警Log数据
*
* @param equipmentSpecificAlarmId
* @param isConfirm '' 为全部数据 0 为未确认 1为已确认
* @param isConfirm '' 为全部数据 0 为未确认 1为已确认
* @return
*/
List<EquipmentSpecificAlarmLog> getIsConfirmByAlarmId(Long equipmentSpecificId,String equipmentSpecificIndexKey, String isConfirm);
List<EquipmentSpecificAlarmLog> getIsConfirmByAlarmId(Long equipmentSpecificId, String equipmentSpecificIndexKey, String isConfirm);
/**
* 获取设备告警环比
*
* @return
*/
Map<String, Object> equipAlarmLink(String date);
}
......@@ -31,6 +31,8 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif
Page<Map<String, Object>> listPage(CommonPageInfoParam param);
Page<Map<String, Object>> zlzxListPage(CommonPageInfoParam param);
Page<Map<String, Object>> pageQuery(CommonPageInfoParam param);
void handleExport(HttpServletResponse response, List<Long> ids, String alarmType);
......
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipment;
import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
......@@ -17,9 +18,9 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.IotIndexInfoVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -238,4 +239,30 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
*/
List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey);
List<Map<String, Object>> normalIndexInfoList(String startDate, String endDate);
Map<String, Object> getFireAutoSysInfo(String startDate, String endDate);
Map<String, Object> getPaomoSysInfo(String startDate, String endDate);
Map<String, Object> getWaterSysInfo(String startDate, String endDate);
List<Map<String, Object>> getEquipmentStatisticsInfo(String bizOrgCode);
/**
* 消防系统物联部件统计
* @param page
* @param bizOrgCode
* @return
*/
Page<FireFightingSystemDto> fireSysIotEquipCount(Page<Map<String, Object>> page, String bizOrgCode);
/**
* 系统状态及告警设备统计
* @param date
* @param bizOrgCode
* @return
*/
List<FireFightingSystemDto> fireSysIotEquipAlarmCount(Date date, String bizOrgCode);
}
......@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.feign.morphic.model.ResourceDTO;
import com.yeejoin.equipmanage.common.datasync.entity.FireFightingSystem;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
......@@ -289,4 +290,12 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, String>> getEquipExpiryListByPage(String bizOrgCode, Integer expiryDayNum, Page page);
List<Map<String, Integer>> getStockEquipStatistics(String bizOrgCode);
List<Map<String, Object>> getSystemInfoList();
List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate);
List<Map<String, Object>> getSystemRunningInfoList();
Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode);
}
......@@ -283,7 +283,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
@Override
public List<UnitAreaTreeVo> getAreaTreeListVo() {
// 获取公司list
List<OrgUsrDto> orgCompanyLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY");
List<OrgUsrDto> orgCompanyLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY", null);
if (orgCompanyLists.isEmpty()) {
return new ArrayList<>();
}
......
......@@ -1355,9 +1355,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
@Override
public List<BuildingTreeVo> getCompanyBuildingTree(String authKey) {
public List<BuildingTreeVo> getCompanyBuildingTree(String authKey, String type) {
//1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey);
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type);
//2.list to tree
List<BuildingTreeVo> buildingTreeVos = companyBuildingList.stream().filter(a -> companyBuildingList.stream().noneMatch(c -> c.getId().toString().equals(a.getParentId()))).peek(b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyBuildingList))).collect(Collectors.toList());
// 任务 7481
......@@ -1417,13 +1417,13 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
private List<BuildingTreeVo> buildBuildingAndCompanyListVos(String authKey) {
private List<BuildingTreeVo> buildBuildingAndCompanyListVos(String authKey, String type) {
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
}
List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false, null);
// 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY");
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY", type);
if(orgUsrLists.isEmpty()){
return new ArrayList<>();
}
......@@ -1463,7 +1463,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public List<BuildingTreeVo> getBuildingVideoTreeNew() {
//1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(buildVideoAuthKey);
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(buildVideoAuthKey, null);
List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
......
......@@ -14,6 +14,7 @@ import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UUIDUtils;
import com.yeejoin.equipmanage.common.vo.Token;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
......@@ -290,7 +291,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Override
public void afterCommit() {
//数字换流站使用
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), "");
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), UUIDUtils.getUUID());
JSONObject jsonObject = new JSONObject();
jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase());
mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
......
......@@ -4,13 +4,18 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmLogService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author keyong
......@@ -39,4 +44,26 @@ public class EquipmentSpecificAlarmLogServiceImpl extends ServiceImpl<EquipmentS
}
return Lists.newArrayList();
}
@Override
public Map<String, Object> equipAlarmLink(String date) {
Map<String, Object> map = new HashMap<>();
if (StringUtils.isBlank(date)) {
date = DateUtils.convertDateToString(new Date(), "yyyy-MM-dd");
}
String monthDate = date.substring(0, 7);
// 获取今日告警设备、日环比
Map<String, Object> alarmEquipDayLink = equipmentSpecificAlarmLogMapper.alarmEquipLink(date, "%Y-%m-%d", null);
// 获取今日告警设备、月环比
Map<String, Object> alarmEquipMonthLink = equipmentSpecificAlarmLogMapper.alarmEquipLink(monthDate, "%Y-%m", null);
// 获取未消除告警设备,日环比
Map<String, Object> unCleanAlarmEquipDayLink = equipmentSpecificAlarmLogMapper.unCleanAlarmEquipLink(date, "%Y-%m-%d", "unClean");
// 获取未消除告警设备,月环比
Map<String, Object> unCleanAlarmEquipMonthLink = equipmentSpecificAlarmLogMapper.unCleanAlarmEquipLink(monthDate, "%Y-%m", "unClean");
map.put("alarmEquipDayLink", alarmEquipDayLink);
map.put("alarmEquipMonthLink", alarmEquipMonthLink);
map.put("unCleanAlarmEquipDayLink", unCleanAlarmEquipDayLink);
map.put("unCleanAlarmEquipMonthLink", unCleanAlarmEquipMonthLink);
return map;
}
}
......@@ -206,6 +206,27 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
}
@Override
public Page<Map<String, Object>> zlzxListPage(CommonPageInfoParam param) {
Page result = new Page<>(param.getPageNumber(), param.getPageSize());
if (AlarmTypeEnum.GZGJ.getCode().equals(param.getAlarmType())) {
param.setAlarmType("");
param.setIsFireAlarm("false");
}
Page<Map<String, Object>> resultPage = this.baseMapper.zlzxPage(result, param);
if (resultPage.getTotal() > 0) {
for (Map<String, Object> x : resultPage.getRecords()) {
if (ObjectUtils.isEmpty(x.get("handleType"))) {
x.put("handleType", null);
} else {
String handleType = ConfirmAlamEnum.getTypeByCode(String.valueOf(x.get("handleType")));
x.put("handleType", StringUtil.isNotEmpty(handleType) ? handleType : signalClassifyService.getTypeNameByCode(String.valueOf(x.get("handleType"))).getTypeName());
}
}
}
return resultPage;
}
@Override
public Page<Map<String, Object>> pageQuery(CommonPageInfoParam param) {
Page result = new Page<>(param.getPageNumber(), param.getPageSize());
return this.baseMapper.pageQuery(result, param);
......
package com.yeejoin.equipmanage.service.impl;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
......@@ -15,11 +17,13 @@ import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
import org.apache.catalina.util.IOTools;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -217,6 +221,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${window.vedioFormat}")
String vedioFormat;
@Value("classpath:/json/equipmentCode.json")
private Resource equipmentCode;
private final String injection = "{\n" +
"\n" +
......@@ -487,7 +494,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<EquipmentSpecificAlarm> alarms = equipmentSpecificAlarmService.getBaseMapper().selectList(queryWrapper);
if (0 < alarms.size()) {
alarms.stream().map(x -> x.setLocation(equipmentSpecific.getPosition() + " "
+ null == equipmentSpecific.getStockDetail().getDescription() ? "" : equipmentSpecific.getStockDetail().getDescription())).collect(Collectors.toList());
+ (null == equipmentSpecific.getStockDetail().getDescription() ? "" : equipmentSpecific.getStockDetail().getDescription()))).collect(Collectors.toList());
equipmentSpecificAlarmService.updateBatchById(alarms);
}
}
......@@ -1947,4 +1954,75 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
}
@Override
public List<Map<String, Object>> normalIndexInfoList(String startDate, String endDate) {
List<Map<String, Object>> list = equipmentSpecificMapper.normalIndexInfoList(startDate, endDate);
List<Map<String, Object>> results = new ArrayList<>();
if (0 < list.size()) {
int i = 0;
for (Map<String, Object> map : list) {
Map<String, Object> map1 = new HashMap<>();
map1.put("key", i + 1);
map1.put("sb", map.get("equipName"));
map1.put("cs", map.get("equipmentIndexName"));
map1.put("zz", map.get("value"));
map1.put("yz", map.get("standardValue"));
map1.put("sj", map.get("time"));
map1.put("zrr", map.get("chargePersonName"));
map1.put("szqy", map.get("areaName"));
map1.put("ssxt", map.get("fightSysName"));
results.add(map1);
}
}
return results;
}
@Override
public Map<String, Object> getFireAutoSysInfo(String startDate, String endDate) {
return equipmentSpecificMapper.getFireAutoSysInfo();
}
@Override
public Map<String, Object> getPaomoSysInfo(String startDate, String endDate) {
return equipmentSpecificMapper.getPaomoSysInfo();
}
@Override
public Map<String, Object> getWaterSysInfo(String startDate, String endDate) {
return equipmentSpecificMapper.getWaterSysInfo();
}
@Override
public List<Map<String, Object>> getEquipmentStatisticsInfo(String bizOrgCode) {
String json = null;
try {
json = IOUtils.toString(equipmentCode.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
List<Map> mapList = JSONObject.parseArray(json, Map.class);
Map<String, Object> map = new HashMap<>();
mapList.forEach(x -> map.put(String.valueOf(x.get("nameKey")), x.get("code")));
map.put("bizOrgCode", bizOrgCode);
Map<String, Object> result = equipmentSpecificMapper.getEquipmentStatisticsInfo(map);
List<Map<String, Object>> list = new ArrayList<>();
mapList.forEach(y -> {
Map<String, Object> tempMap = new HashMap<>();
tempMap.put("name", y.get("name"));
tempMap.put("code", y.get("nameKey"));
tempMap.put("total", result.get(y.get("nameKey")));
list.add(tempMap);
});
return list;
}
@Override
public Page<FireFightingSystemDto> fireSysIotEquipCount(Page<Map<String, Object>> page, String bizOrgCode) {
return equipmentSpecificMapper.fireSysIotEquipCount(page, bizOrgCode);
}
@Override
public List<FireFightingSystemDto> fireSysIotEquipAlarmCount(Date date, String bizOrgCode) {
return equipmentSpecificMapper.fireSysIotEquipAlarmCount(date, bizOrgCode);
}
}
......@@ -21,6 +21,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireFightingSystem;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
......@@ -105,6 +106,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Value("classpath:/json/systemIndex.json")
private Resource systemIndex;
@Value("classpath:/json/systemCode.json")
private Resource systemCode;
@Autowired
private IEqDynamicFormGroupService iEqDynamicFormGroupService;
......@@ -1061,7 +1065,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public List<FireFightingSystemTreeVo> getSystemTreeByOrgCode(String bizOrgCode) {
// 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth("COMPANY,DEPARTMENT", bizOrgCode);
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth("COMPANY,DEPARTMENT", bizOrgCode, null);
List<FireFightingSystemTreeVo> fireFightingSystemTreeList = orgUsrLists.stream().map(key -> {
FireFightingSystemTreeVo vo = new FireFightingSystemTreeVo();
vo.setId(valueOf(key.getSequenceNbr()));
......@@ -2018,4 +2022,76 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public List<Map<String, Integer>> getStockEquipStatistics(String bizOrgCode) {
return fireFightingSystemMapper.getStockEquipStatistics(bizOrgCode);
}
@Override
public List<Map<String, Object>> getSystemInfoList() {
List<Map<String, Object>> list = fireFightingSystemMapper.getSystemInfoList();
if (0 < list.size()) {
list.forEach(x -> {
List<Map<String, Object>> list1 = new ArrayList();
Map<String, Object> map = new HashMap<>();
map.put("name", x.get("status"));
if ("正常".equals(String.valueOf(x.get("status")))) {
map.put("level", "success");
} else {
map.put("level", "failure");
}
list1.add(map);
x.put("status", list1);
});
}
return list;
}
@Override
public List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate) {
return fireFightingSystemMapper.getSystemAlarmInfoList(startDate, endDate);
}
@Override
public List<Map<String, Object>> getSystemRunningInfoList() {
Map<String, Object> totalMap = fireFightingSystemMapper.getSystemCountInfo();
Map<String, Object> alarmNumMap = fireFightingSystemMapper.getSystemRunningInfoList();
String json = null;
try {
json = IOUtils.toString(systemCode.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
List<Map> mapList = JSONObject.parseArray(json, Map.class);
Map<String, Object> map = new HashMap<>();
mapList.forEach(x -> map.put(String.valueOf(x.get("nameKey")), x.get("code")));
List<Map<String, Object>> list = new ArrayList<>();
mapList.forEach(y -> {
Map<String, Object> tempMap = new HashMap<>();
tempMap.put("name", y.get("name"));
tempMap.put("code", y.get("code"));
tempMap.put("total", totalMap.get(y.get("code")));
tempMap.put("alarmNum", alarmNumMap.get(y.get("code")));
list.add(tempMap);
});
return list;
}
@Override
public Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode) {
// 消防系统物联部件统计
Page<FireFightingSystemDto> pages = equipmentSpecificSerivce.fireSysIotEquipCount(page, bizOrgCode);
List<FireFightingSystemDto> records = pages.getRecords();
// 系统状态及今日告警设备统计
if (!CollectionUtils.isEmpty(records)) {
List<Long> idList = records.stream().map(FireFightingSystemDto::getId).collect(Collectors.toList());
List<FireFightingSystemDto> list = equipmentSpecificSerivce.fireSysIotEquipAlarmCount(new Date(), bizOrgCode);
if (!CollectionUtils.isEmpty(list)) {
//使用stream流把list1和list2根据属性userId合并一个list集合,并根据状态倒序、系统排序升序
List<FireFightingSystemDto> collect = records.stream().peek(m -> list.stream().filter(m2 -> Objects.equals(m.getId(), m2.getId())).forEach(m2 -> {
m.setAlarmEquipTotal(m2.getAlarmEquipTotal());
m.setStatus(m2.getStatus());
})).sorted(Comparator.comparing(FireFightingSystemDto::getStatus, Comparator.reverseOrder())
.thenComparing(FireFightingSystemDto::getSort)).collect(Collectors.toList());
pages.setRecords(collect);
}
}
return pages;
}
}
......@@ -36,8 +36,8 @@ public class JCSRemoteService {
* @param orgTypes(多个逗号分隔) 为空默认查询公司和部门,COMPANY: 公司树 DEPARTMENT部门树
* @return List<OrgUsrDto>
*/
public List<OrgUsrDto> getCompanyDeptListWithAuth(String authKey, String orgTypes) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, orgTypes);
public List<OrgUsrDto> getCompanyDeptListWithAuth(String authKey, String orgTypes,String type) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, orgTypes, type);
return feignClientResult.getResult();
}
......@@ -52,4 +52,9 @@ public class JCSRemoteService {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getlistCompanyTree( orgType);
return feignClientResult.getResult();
}
public String getCompany(String bizOrgCode) {
FeignClientResult<String> feignClientResult = jcsFeignClient.getCompany(bizOrgCode);
return feignClientResult.getResult();
}
}
......@@ -16,6 +16,7 @@ import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.UUIDUtils;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.*;
......@@ -180,6 +181,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${equipManage.name}")
private String serverName;
@Value("${state.code:code}")
private String stationCode;
@Value("${state.name:name}")
private String stationName;
@Value("${mqtt.vehicle.topic}")
private String carTopic;
......@@ -207,6 +214,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${isSendIot:false}")
private Boolean isSendIot;
@Value("${is.open.telemetering:false}")
private Boolean isOpenTelemetering;
private static Boolean jcsSwitch;
@Value("${systemctl.jcs.switch}")
public void setJcsSwitch(Boolean jcsSwitch){
......@@ -353,6 +363,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpeIndex.setTraceId(traceId);
equipmentSpeIndex.setValueLabel(valueTranslate(value, equipmentSpecificIndex.getValueEnum()));
equipmentSpeIndex.setUpdateDate(new Date());
equipmentSpeIndex.setEquipmentType(topicEntity.getType());
equipmentSpeIndex.setUUID(UUIDUtils.getUUID());
equipmentSpecificIndexService.updateById(equipmentSpeIndex);
// 更新设备表指标状态
......@@ -382,6 +394,54 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
iotDataVO.getKey().toLowerCase().equals(FHS_WirelessliquidDetector_WaterLevel.toLowerCase())) {
doWaterPoolLevel(iotDataVO, equipmentSpecificIndex);
}
// 遥测遥信数据推送云端kafka
JSONObject jsonObjectXf = new JSONObject();
jsonObjectXf.put("data_class", "realdata");
if(equipmentSpeIndex.getIsTrend() == 1) {
jsonObjectXf.put("data_type", "analog");
} else {
jsonObjectXf.put("data_type", "state");
}
String date = DateUtils.date2LongStr(new Date());
jsonObjectXf.put("op_type", "subscribe_emergency");
JSONObject jsonObjectCondition = new JSONObject();
jsonObjectCondition.put("station_psr_id", stationCode);
jsonObjectCondition.put("station_name", stationName);
jsonObjectCondition.put("data_upload_time", date );
jsonObjectXf.put("condition",jsonObjectCondition);
JSONObject jsonObjectData = new JSONObject();
jsonObjectData.put("psrId", stationCode);
jsonObjectData.put("astId", equipmentSpecificIndex.getSpecificCode());
jsonObjectData.put("equipType", equipmentSpecificIndex.getEquipmentCode());
jsonObjectData.put("name", equipmentSpecificIndex.getEquipmentSpecificName()+"-"+equipmentSpecificIndex.getEquipmentSpecificIndexName());
if(value.equals("true")) {
jsonObjectData.put("value","1");
} else if (value.equals("false")) {
jsonObjectData.put("value","0");
} else {
jsonObjectData.put("value", value);
}
jsonObjectData.put("measurementType",equipmentSpecificIndex.getEquipmentIndexKey());
jsonObjectData.put("dateTime",date);
jsonObjectData.put("quality","0"); // 量测质量码:0 有效,1 无效
List<JSONObject> jsonObjects = Arrays.asList(jsonObjectData);
jsonObjectXf.put("data", jsonObjects);
// 遥测
if(!isOpenTelemetering && equipmentSpeIndex.getIsTrend() == 1) {
} else {
try {
emqKeeper.getMqttClient().publish("emq.xf.created",jsonObjectXf.toString().getBytes(),1,false);
log.info("遥测遥信数据推送云端kafka成功");
} catch (MqttException e) {
log.error("遥测遥信数据推送云端kafka失败=====>" + e.getMessage());
e.printStackTrace();
}
}
}
}
});
......@@ -391,7 +451,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if(!ObjectUtils.isEmpty(equipmentSpecificAlarms)){
equipmentSpecificAlarmService.saveOrUpdateBatch(equipmentSpecificAlarms);
}
// 需要在事务提交之后,否事务隔离查询不出数据
// 需要在事务提交之后,否事务隔离查询不出数据
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
......@@ -430,6 +490,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs);
// 直流中心消息推送刷新
publishDataToDCCenterPage(equipmentSpecificIndexList);
}
});
}
......@@ -785,6 +848,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarmLog.setId(null);
equipmentSpecificAlarmLog.setCreateDate(new Date());
equipmentSpecificAlarmLog.setEquipmentSpecificAlarmId(equipmentSpecificAlarm.getId());
equipmentSpecificAlarmLog.setStationCode(stationCode);
equipmentSpecificAlarmLog.setStationName(stationName);
boolean bool = equipmentSpecificAlarmLogService.save(equipmentSpecificAlarmLog);
// 同步告警消息给平台
if (amosSwitch && bool) {
......@@ -826,6 +891,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarm.setEmergencyLevel(equipmentSpecificIndex.getEmergencyLevel());
equipmentSpecificAlarm.setEmergencyLevelColor(equipmentSpecificIndex.getEmergencyLevelColor());
equipmentSpecificAlarm.setEmergencyLevelDescribe(equipmentSpecificIndex.getEmergencyLevelDescribe());
equipmentSpecificAlarm.setBizOrgCode(equipmentSpecificIndex.getBizOrgCode());
equipmentSpecificAlarm.setBizOrgName(equipmentSpecificIndex.getBizOrgName());
equipmentSpecificAlarms.add(equipmentSpecificAlarm);
return equipmentSpecificAlarms;
}
......@@ -1008,7 +1075,6 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("seqNo", UUID.randomUUID().toString().replace("-", "").toLowerCase());
mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), "");
// 数字换流站数据处理(高斯库同步及南瑞告警推送)
if (syncSwitch) {
List<FireEquipmentFireAlarm> alarmList = createFireEquipmentFireAlarmVo(equipmentAlarmLogs);
......@@ -1147,10 +1213,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 冗余字段,alarm_log表更新时使用
action.setEquipmentSpecificCode(equipmentSpcIndex.getEquipmentSpecificCode());
action.setBuildId(equipmentSpcIndex.getBuildId());
action.setBizOrgName(equipmentSpcIndex.getBizOrgName());
action.setBizOrgCode(equipmentSpcIndex.getBizOrgCode());
equipmentSpecificAlarms.add(action);
}
}
return equipmentSpecificAlarms;
}
......@@ -1194,6 +1261,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
iEquipmentSpecificSerivce.integrationPageSysDataRefresh(topicEntity.getCode());
}
public void publishDataToDCCenterPage(List<EquipmentSpecificIndex> equipmentSpecificIndexList) {
mqttSendGateway.sendToMqtt(TopicEnum.EQZXDT.getTopic(), JSON.toJSONString(equipmentSpecificIndexList));
log.info(String.format("直流中心指标消息发送:%s", JSON.toJSONString(equipmentSpecificIndexList)));
}
/**
* 更新数据报表表
*
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@RestController
@Api(tags = "一张图大屏Api")
@RequestMapping(value = "/bigScreen")
public class BigScreenController {
public class BigScreenController extends BaseController {
@Autowired
private IFirefightersService iFirefightersService;
@Autowired
private RedisUtils redisUtils;
@GetMapping(value = "/getFireForceInfoByCode")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防车、消防力量信息(专职消防队、运维人员)、人员出勤", notes = "消防车、消防力量信息(专职消防队、运维人员、人员出勤)")
public ResponseModel getFireForceInfoByCode(@RequestParam(required = false, value = "companyCode") String companyCode) {
return CommonResponseUtil.success(iFirefightersService.getFireForceInfoByCode(companyCode));
}
@PersonIdentify
@GetMapping(value = "/getUserInfo")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "应急预案页面消防力量人员信息", notes = "应急预案页面消防力量人员信息")
public ResponseModel getUserInfoByYJYA(@ApiParam(value = "3小概览用-- 0-运行人员 1-驻站消防队 【为空时为应急预案页面使用】") @RequestParam(required = false) Integer fireTeamType) {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String bizOrgCode = null;
if(null != reginParam) {
bizOrgCode = reginParam.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
} else {
return CommonResponseUtil.success(null);
}
List<Map<String, Object>> userInfoByYJYA = iFirefightersService.getUserInfoByYJYA(bizOrgCode);
if (!Objects.isNull(fireTeamType)) {
return CommonResponseUtil.success(userInfoByYJYA.get(fireTeamType));
}
return CommonResponseUtil.success(userInfoByYJYA);
}
}
......@@ -61,4 +61,11 @@ public class EquipmentController extends BaseController {
public ResponseModel<Long> getMaintenanceId(@RequestParam() String userId) {
return ResponseHelper.buildResponse(equipmentService.getMaintenanceId(userId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/water/resource")
@ApiOperation(value = "查询人员绑定维保单位id")
public ResponseModel getWaterResourceList(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
return ResponseHelper.buildResponse(equipmentService.getWaterResourceInfoList(bizOrgCode));
}
}
......@@ -520,12 +520,13 @@ public class FirefightersController extends BaseController {
firefightersQueryWrapper1.like("biz_org_code", bizOrgCode);
firefightersQueryWrapper1.eq("people_type", "1601");
firefightersQueryWrapper1.eq("is_delete", "0");
String companyName = iFirefightersService.getCompanyName(bizOrgCode);
List<Firefighters> firefighters = iFirefightersService.getBaseMapper().selectList(firefightersQueryWrapper1);
firefighters.stream().forEach(e -> {
Map<String, Object> map = new HashMap<>();
map.put("name", e.getName());
map.put("jobTitle", e.getJobTitle());
map.put("bizOrgName", e.getBizOrgName());
map.put("bizOrgName", companyName);
map.put("bizOrgCode", bizOrgCode);
map.put("amosUserId", e.getOrgUsrId());
map.put("personnelPhotos", e.getPersonnelPhotos());
......
......@@ -13,7 +13,10 @@ import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.MaintenanceCompanyMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
......@@ -21,6 +24,9 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -42,6 +48,7 @@ public class EquipmentServiceImpl {
@Autowired
private RedisUtils redisUtils;
public List<MenuFrom> getFireSystemList() {
// 导出模板增加权限
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
......@@ -134,4 +141,8 @@ public class EquipmentServiceImpl {
return null;
}
}
public List<Map<String, Object>> getWaterResourceInfoList(String bizOrgCode){
return waterResourceServiceImpl.getWaterResourceInfoList(bizOrgCode);
}
}
package com.yeejoin.amos;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// 授权
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.headers()
.frameOptions()
.disable()
.and()
.authorizeRequests()
.regexMatchers("^(?!/actuator).*$").permitAll()
.regexMatchers("/actuator/health").permitAll()
.regexMatchers("/actuator/info").permitAll()
.anyRequest().authenticated().and()
.formLogin();
}
}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.10.211/xiy_safety_business_v3.0.1_20100712?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url = jdbc:mysql://172.16.11.201/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
......@@ -14,10 +14,10 @@ spring.datasource.hikari.connection-test-query= SELECT 1
# \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
fileserver_domain=http://172.16.10.211:9000/
fileserver_domain=http://172.16.11.201:9000/
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 172.16.10.211
eureka.instance.hostname= 172.16.11.201
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......@@ -38,9 +38,9 @@ amos.system.user.product=STUDIO_APP_WEB
spring.redis.database=1
spring.redis.host=172.16.10.211
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.password=1234560
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
......@@ -50,10 +50,10 @@ spring.redis.expire.time=30000
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.211:2883
emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.10.211:8083/mqtt
mqtt.scene.host=mqtt://172.16.11.201:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
......@@ -111,3 +111,10 @@ equipment.scrap.cron=0 0 9 * * ?
equipment.pressurepump.start=FHS_PressurePump_Start
# 稳压泵停止信号
equipment.pressurepump.stop=FHS_PressurePump_Stop
# 站端标识
state.code=GW190301
state.name=锦屏换流站
# 是否开启遥测数据上报
is.open.telemetering=false
\ No newline at end of file
......@@ -373,4 +373,93 @@
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221116-1152-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="biz_org_name"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_name</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `biz_org_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构/部门名称' AFTER `defect_batch_id`;
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221116-1152-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_code</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `biz_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码' AFTER `biz_org_name`;
</sql>
</changeSet>
<changeSet author="keyong" id="1668587039">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment_specific_alarm_log" />
</preConditions>
<comment>sync field</comment>
<sql>
UPDATE wl_equipment_specific_alarm_log wesal
SET wesal.biz_org_name = ( SELECT biz_org_name FROM wl_equipment_specific wes WHERE wes.id = wesal.equipment_specific_id ),
wesal.biz_org_code = ( SELECT biz_org_code FROM wl_equipment_specific wes WHERE wes.id = wesal.equipment_specific_id );
</sql>
</changeSet>
<changeSet author="keyong" id="1668587039-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="clean_time"/>
</preConditions>
<comment>sync field</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm_log` MODIFY `clean_time` datetime DEFAULT NULL COMMENT '消除时间';
</sql>
</changeSet>
<changeSet author="keyong" id="1668587039-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment"/>
</preConditions>
<comment>添加基础字段</comment>
<sql>
REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`) VALUES (1463079835982106626, '消防水鹤', '93060200KOI44', 1438772365205991426, NULL, NULL, NULL, NULL, NULL, NULL, '2022-03-14 13:40:54', NULL, 55, NULL, NULL, 'upload/jcs/studio_normalapp_3157169/E5F46D5CF35D2DF1F62971DA166C18C.png', NULL, NULL, NULL, NULL, '2021-11-23 17:39:50', NULL, NULL, NULL, NULL, NULL, NULL, '0', '0');
REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`) VALUES (1583285119978835970, '工业水池', '93060500F6A44', 1579292738841481218, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 104, NULL, NULL, 'upload/jcs/studio_normalapp_3157169/65BA2E0B6489024DA0B9F98EC189.png', NULL, NULL, NULL, NULL, '2022-10-21 10:32:43', NULL, NULL, NULL, NULL, NULL, NULL, '0', '0');
REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`) VALUES (1463080224227856386, '天然水源', '93060300GJY44', 1438772459552665602, NULL, NULL, NULL, NULL, NULL, NULL, '2022-03-14 13:50:55', NULL, 55, NULL, NULL, 'upload/jcs/studio_normalapp_3157169/C8A1D43C46892D78B76315B4C2B67BC.png', NULL, NULL, NULL, NULL, '2021-11-23 17:41:23', NULL, NULL, NULL, NULL, NULL, NULL, '0', '0');
</sql>
</changeSet>
<changeSet author="tw" id="20221121-01" runAlways="true">
<comment>`getBuildingParentIds`</comment>
<sql endDelimiter="#">
DROP FUNCTION IF EXISTS `getBuildingParentIds`#
CREATE DEFINER=`root`@`%` FUNCTION `getBuildingParentIds`(rootId bigint) RETURNS varchar(1000) CHARSET utf8mb4
DETERMINISTIC
BEGIN
DECLARE fid bigint default 0;
DECLARE str varchar(1000) default concat(rootId, '');
WHILE rootId != 0 do
SET fid =(SELECT parentid FROM get_building_tree WHERE instanceId = rootId);
IF fid != 0 THEN
SET str = concat(str, ',', fid);
SET rootId = fid;
ELSE
SET rootId = fid;
END IF;
END WHILE;
return str;
END#
</sql>
</changeSet>
<changeSet author="keyong" id="1668587041">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="station_name"/>
</not>
</preConditions>
<comment>新增站属性字段</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `station_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '换流站名称';
ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `station_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '换流站编码';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
[
{
"name": "灭火器",
"code": "3104",
"nameKey": "extinguisher"
},
{
"name": "消防车",
"code": "210",
"nameKey": "car"
},
{
"name": "泡沫罐",
"code": "92031900",
"nameKey": "foamtank"
}
]
\ No newline at end of file
[
{
"name": "事故排油系统",
"code": "fireONLSys"
},
{
"name": "消防给水系统",
"code": "fireWaterSys"
},
{
"name": "火灾自动报警系统",
"code": "fireAlarmSys"
},
{
"name": "压缩空气泡沫系统",
"code": "fireCAFSSys"
}
]
\ No newline at end of file
......@@ -183,4 +183,64 @@
</where>
ORDER BY weal.create_date DESC
</select>
<select id="alarmEquipLink" resultType="java.util.Map">
SELECT
ta.`date`,
IFNULL( ta.sumNum, 0 ) AS sumNum,
IFNULL( tc.sumNum, 0 ) AS hbSumNum,
concat(
ifnull( round( ( ta.sumNum - tc.sumNum ) / tc.sumNum * 100, 0 ), 0 ),
'%'
) AS hbRate
FROM
<choose>
<when test="pattern != null and pattern != ''">
( SELECT DATE_FORMAT( wesal.create_date, #{pattern} ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal GROUP BY `date` ) ta
LEFT JOIN ( SELECT DATE_FORMAT( wesal.create_date, #{pattern} ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal GROUP BY `date` ) tc
ON ta.`date` = date_add( tc.`date`, INTERVAL 1 DAY )
</when>
<otherwise>
( SELECT DATE_FORMAT( wesal.create_date, '%Y-%m-%d' ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal GROUP BY `date` ) ta
LEFT JOIN ( SELECT DATE_FORMAT( wesal.create_date, '%Y-%m-%d' ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal GROUP BY `date` ) tc
ON ta.`date` = date_add( tc.`date`, INTERVAL 1 DAY )
</otherwise>
</choose>
<where>
<if test="date != null and date != ''">
ta.`date` = #{date}
</if>
</where>
ORDER BY
ta.`date`
</select>
<select id="unCleanAlarmEquipLink" resultType="java.util.Map">
SELECT
ta.`date`,
IFNULL( ta.sumNum, 0 ) AS sumNum,
IFNULL( tc.sumNum, 0 ) AS hbSumNum,
concat(
ifnull( round( ( ta.sumNum - tc.sumNum ) / tc.sumNum * 100, 0 ), 0 ),
'%'
) AS hbRate
FROM
<choose>
<when test="pattern != null and pattern != ''">
( SELECT DATE_FORMAT( wesal.create_date, #{pattern} ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal WHERE wesal.clean_time IS NULL GROUP BY `date` ) ta
LEFT JOIN ( SELECT DATE_FORMAT( wesal.create_date, #{pattern} ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal GROUP BY `date` ) tc
ON ta.`date` = date_add( tc.`date`, INTERVAL 1 DAY )
</when>
<otherwise>
( SELECT DATE_FORMAT( wesal.create_date, '%Y-%m-%d' ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal WHERE wesal.clean_time IS NULL GROUP BY `date` ) ta
LEFT JOIN ( SELECT DATE_FORMAT( wesal.create_date, '%Y-%m-%d' ) `date`, COUNT( 1 ) AS sumNum FROM wl_equipment_specific_alarm_log wesal GROUP BY `date` ) tc
ON ta.`date` = date_add( tc.`date`, INTERVAL 1 DAY )
</otherwise>
</choose>
<where>
<if test="date != null and date != ''">
ta.`date` = #{date}
</if>
</where>
ORDER BY
ta.`date`
</select>
</mapper>
\ No newline at end of file
......@@ -47,9 +47,12 @@
wei.unit AS indexUnitName,
wes.org_code AS orgCode,
ed.`name` AS equipmentSpecificName,
ed.equipment_name AS equipmentName,
wes.iot_code AS iotCode,
wes.code AS specificCode,
wei.`name` AS equipmentSpecificIndexName,
wei.`value_enum` AS valueEnum,
wei.is_trend AS isTrend,
wes.qr_code AS qrCode,
wesi.update_date AS updateDate,
ed.code AS equipmentCode,
......@@ -62,7 +65,9 @@
wesi.emergency_level as emergencyLevel,
wesi.emergency_level_describe as emergencyLevelDescribe,
TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location,
sd.warehouse_structure_id AS buildId
sd.warehouse_structure_id AS buildId,
wes.biz_org_name AS bizOrgName,
wes.biz_org_code AS bizOrgCode
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes
......
......@@ -103,7 +103,7 @@
</if>
AND cpd.is_delete = 0
</where>
ORDER BY cpd.create_date ASC
ORDER BY cpd.create_date DESC
LIMIT #{start}, #{size}
</select>
......
package com.yeejoin.amos;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// 授权
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.headers()
.frameOptions()
.disable()
.and()
.authorizeRequests()
.regexMatchers("^(?!/actuator).*$").permitAll()
.regexMatchers("/actuator/health").permitAll()
.regexMatchers("/actuator/info").permitAll()
.anyRequest().authenticated().and()
.formLogin();
}
}
......@@ -40,12 +40,11 @@ rule.definition.default-agency=jcs
#spring.data.mongodb.uri=mongodb://172.16.6.60:27017/command_db
## file properties:
file.url=http://172.16.11.201:9000/
file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/
ifc.url=http://11.11.16.17/IFCInterface
ifc.call-back.localIp=11.11.16.1
#人员消息同步开关
#人员消息数据同步开关
emq.orgUsr.sync.switch=true
[
{
"name": "消火栓",
"type": "hydrant",
"nameKey": "fireHydrant"
},
{
"name": "消防水池",
"type": "pool",
"nameKey": "firePool"
},
{
"name": "消防水箱",
"type": "waterTank",
"nameKey": "fireWaterTank"
}
]
\ No newline at end of file
package com.yeejoin.amos.boot.module.tdc.api.dto;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* Dto
*
* @author duanwei
* @date 2022-11-22
*/
@Data
@ApiModel(value = "TdcDrawingDto", description = "")
public class TdcDrawingDto {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long sequenceNbr;
/**
*
*/
private String record;
/**
*
*/
private LocalDateTime recDate;
/**
*
*/
private String recUserId;
/**
*
*/
private String instanceId;
@ApiModelProperty(value = "图纸名称")
/**
* 图纸名称
*/
private String drawingName;
@ApiModelProperty(value = "图纸地址")
/**
* 图纸地址
*/
private String drawingUrl;
@ApiModelProperty(value = "上传人姓名")
/**
* 上传人姓名
*/
private String uploadUserName;
@ApiModelProperty(value = "上传人单位")
/**
* 上传人单位
*/
private String uploadCompanyName;
@ApiModelProperty(value = "上传人单位code")
/**
* 上传人单位code
*/
private String uploadCompanyCode;
@ApiModelProperty(value = "上传时间")
/**
* 上传时间
*/
private Date uploadTime;
}
......@@ -34,5 +34,10 @@ public class ModelItem {
@ApiModelProperty(value = "提交记录id")
private long submitRecordId;
@ApiModelProperty(value = "标签名称")
private String tagName;
@ApiModelProperty(value = "类型")
private int type = -1;
}
package com.yeejoin.amos.boot.module.tdc.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
......@@ -38,4 +39,19 @@ public class SubmitRecord {
@ApiModelProperty(value = "校验批次号")
private String batchNo;
@ApiModelProperty(value = "是否草稿 0: 草稿 1:提交")
private int draft;
@ApiModelProperty(value = "文件id")
private Long fileId;
@ApiModelProperty(value = "审核状态 0: 未审核 1:已审核")
private int examine;
@TableField(exist = false)
private String examineName;
@TableField(exist = false)
private String fileName;
}
package com.yeejoin.amos.boot.module.tdc.api.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.joda.time.DateTime;
/**
* @author duanwei
* @date 2022-11-22
*/
@Data
@TableName("tdc_drawing")
@Accessors(chain = true)
@ApiModel(value = "TdcDrawing对象", description = "")
public class TdcDrawing extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "图纸名称")
@TableField("DRAWING_NAME")
private String drawingName;
@ApiModelProperty(value = "图纸地址")
@TableField("DRAWING_URL")
private String drawingUrl;
@ApiModelProperty(value = "上传人姓名")
@TableField("UPLOAD_USER_NAME")
private String uploadUserName;
@ApiModelProperty(value = "上传人单位")
@TableField("UPLOAD_COMPANY_NAME")
private String uploadCompanyName;
@ApiModelProperty(value = "上传人单位code")
@TableField("UPLOAD_COMPANY_CODE")
private String uploadCompanyCode;
@ApiModelProperty(value = "上传时间")
@TableField("UPLOAD_TIME")
private Date uploadTime;
}
......@@ -12,5 +12,7 @@ import org.mapstruct.Mapper;
@Mapper
public interface SubmitRecordMapper extends BaseMapper<SubmitRecord> {
IPage<SubmitRecord> selectByOrgCode(Page page);
}
IPage<SubmitRecord> selectByOrgCode(Page page);
IPage<SubmitRecord> selectByOrgCodes(Page page);
}
package com.yeejoin.amos.boot.module.tdc.api.mapper;
import com.yeejoin.amos.boot.module.tdc.api.entity.TdcDrawing;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.mapstruct.Mapper;
/**
* Mapper 接口
*
* @author duanwei
* @date 2022-11-22
*/
@Mapper
public interface TdcDrawingMapper extends BaseMapper<TdcDrawing> {
}
package com.yeejoin.amos.boot.module.tdc.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.entity.TdcDrawing;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
/**
* 服务类
*
* @author duanwei
* @date 2022-11-22
*/
@Service
public interface ITdcDrawingService extends IService<TdcDrawing> {
}
package com.yeejoin.amos.boot.module.tdc.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Service;
......@@ -12,11 +14,11 @@ import java.util.Map;
* @author xxz
*/
@Service
public interface ModelItemService {
public interface ModelItemService extends IService<ModelItem> {
void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo);
SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft);
void editModelItem(JSONObject jsonObject, AgencyUserModel userInfo);
SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id, int examine);
/**
* 获取详情接口
......
package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author xxz
*/
@Service
public interface SubmitRecordService {
public interface SubmitRecordService extends IService<SubmitRecord> {
IPage<SubmitRecord> selectByOrgCode(int current, int size);
int saveSubmitRecord(SubmitRecord submitRecord);
SubmitRecord updateById(Long sequenceNbr, String batchNo);
SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft, int examine);
List<SubmitRecord> selectRecord();
void saveFileId(Long id, Long fileId);
SubmitRecord getFileId(Long id);
}
......@@ -47,6 +47,8 @@
batch_no
FROM
tdc_submit_record
WHERE
draft = 1
ORDER BY
submit_time DESC
LIMIT 1
......@@ -68,8 +70,8 @@
batch_no
FROM
tdc_submit_record
-- WHERE
-- amos_org_code = '50*110'
WHERE
draft = 1
ORDER BY
submit_time DESC
LIMIT 1
......
......@@ -14,6 +14,7 @@
tdc_submit_record
WHERE
amos_org_code = #{orgCode}
AND draft = 1
ORDER BY
submit_time DESC
LIMIT 1
......
......@@ -3,6 +3,25 @@
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper">
<select id="selectByOrgCode" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord">
SELECT sequence_nbr,submit_people,submit_time,amos_org_name FROM `tdc_submit_record`
SELECT
sequence_nbr,submit_people,submit_time,amos_org_name,file_id,
case examine when 0 then "未审核" when 1 then "已审核" end examineName
FROM
`tdc_submit_record` order by submit_time desc
</select>
<select id="selectByOrgCodes" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord">
SELECT
sequence_nbr,submit_people,submit_time,amos_org_name,file_id,examine,
"换流站新建工程消防设计文件" as fileName,
case examine when 0 then "未审核" when 1 then "已审核" end examineName
FROM
`tdc_submit_record` order by submit_time desc
</select>
</mapper>
......@@ -104,6 +104,14 @@ public class CheckModelAction {
checkResult.setModelName(checkModel.getModelName());
checkResultService.save(checkResult);
List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode);
int sum = checkModels.stream().mapToInt(CheckModel::getCheckItemAmount).sum();
Integer itemCount = checkResultService.selectItemCount(batchNo);
if (sum == itemCount) {
checkResultService.saveSql(orgCode, checkPeopleName, batchNo);
}
// // 2. 判断是否检验结束
// if (ObjectUtils.isNotEmpty(checkType)) {
// if (checkType == 1) {
......@@ -111,8 +119,8 @@ public class CheckModelAction {
// sendWebMessage(batchNo, checkModel.getCheckItemAmount(), orgCode, checkPeopleName, checkType, itemName);
// } else if (checkType == 0) {
// // 2.1 全站校验
// List<CheckModel> checkModels = checkModelService.selectByOrgCode(orgCode);
// int sum = checkModels.stream().mapToInt(CheckModel::getCheckItemAmount).sum();
// sendWebMessage(batchNo, sum, orgCode, checkPeopleName, checkType, itemName);
// }
// }
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.service.ModelItemService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
......@@ -32,18 +33,17 @@ public class ModelItemController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/saveModelItem")
@ApiOperation(httpMethod = "POST", value = "保存模型项", notes = "保存模型项")
public ResponseModel saveModelItem(@RequestBody JSONObject jsonObject){
public ResponseModel<SubmitRecord> saveModelItem(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "draft") int draft, @RequestBody JSONObject jsonObject,
@RequestParam(value = "examine") int examine){
AgencyUserModel userInfo = getUserInfo();
if (ObjectUtils.isEmpty(jsonObject)) {
return null;
}
Object sequenceNbr = jsonObject.get("sequenceNbr");
if (ObjectUtils.isEmpty(sequenceNbr)) {
modelItemService.saveModelItem(jsonObject, userInfo);
return ResponseHelper.buildResponse(true);
if (ObjectUtils.isEmpty(sequenceNbr) && ObjectUtils.isEmpty(id)) {
return ResponseHelper.buildResponse(modelItemService.saveModelItem(jsonObject, userInfo, draft));
}
modelItemService.editModelItem(jsonObject, userInfo);
return ResponseHelper.buildResponse(true);
return ResponseHelper.buildResponse(modelItemService.editModelItem(jsonObject, userInfo, draft, id, examine));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
......@@ -13,6 +13,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 校验记录
* @author xxz
......@@ -30,4 +32,26 @@ public class SubmitRecordController {
public ResponseModel<IPage<SubmitRecord>> selectByOrgCode(int current,int size){
return ResponseHelper.buildResponse(submitRecordService.selectByOrgCode(current, size));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "selectRecord")
@ApiOperation(httpMethod = "GET",value = "查询记录top20", notes = "查询记录top20")
public ResponseModel<List<SubmitRecord>> selectRecord(){
return ResponseHelper.buildResponse(submitRecordService.selectRecord());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "saveFileId")
@ApiOperation(httpMethod = "GET",value = "保存文件id", notes = "保存文件id")
public ResponseModel saveFileId(@RequestParam(value = "id") Long id, @RequestParam(value = "fileId") Long fileId){
submitRecordService.saveFileId(id, fileId);
return ResponseHelper.buildResponse(true);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "getFileId")
@ApiOperation(httpMethod = "GET",value = "根据主键id获取文件id", notes = "根据主键id获取文件id")
public ResponseModel<SubmitRecord> getFileId(@RequestParam(value = "id") Long id){
return ResponseHelper.buildResponse(submitRecordService.getFileId(id));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.tdc.api.entity.TdcDrawing;
import com.yeejoin.amos.boot.module.tdc.api.service.ITdcDrawingService;
import com.yeejoin.amos.boot.module.tdc.biz.service.impl.TdcDrawingServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
/**
* @author duanwei
* @date 2022-11-22
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/tdc-drawing")
public class TdcDrawingController extends BaseController {
@Autowired
ITdcDrawingService iTdcDrawingService;
@Autowired
TdcDrawingServiceImpl iTdcDrawingServiceImpl;
/**
* 新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public boolean saveTdcDrawing(HttpServletRequest request, @RequestBody TdcDrawing tdcDrawing) {
return iTdcDrawingService.save(tdcDrawing);
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public ResponseModel<Boolean> deleteById(HttpServletRequest request, @PathVariable List<Long> id) {
return ResponseHelper.buildResponse(iTdcDrawingService.removeByIds(id));
}
/**
* 修改
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean updateByIdTdcDrawing(HttpServletRequest request, @RequestBody TdcDrawing tdcDrawing) {
return iTdcDrawingService.updateById(tdcDrawing);
}
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public TdcDrawing selectById(HttpServletRequest request, @PathVariable Long id) {
return iTdcDrawingService.getById(id);
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<TdcDrawing> listPage(String pageNum, String pageSize,
TdcDrawing tdcDrawing) {
Page<TdcDrawing> pageBean;
QueryWrapper<TdcDrawing> tdcDrawingQueryWrapper = new QueryWrapper<>();
Class<? extends TdcDrawing> aClass = tdcDrawing.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(tdcDrawing);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(tdcDrawing);
tdcDrawingQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(tdcDrawing);
tdcDrawingQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(tdcDrawing);
tdcDrawingQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(tdcDrawing);
tdcDrawingQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<TdcDrawing> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iTdcDrawingService.page(pageBean, tdcDrawingQueryWrapper);
return page;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "saveAttachment")
@ApiOperation(httpMethod = "Post", value = "直接查询列表", notes = "直接查询列表")
public ResponseModel<List<TdcDrawing>> saveAttachment(@RequestBody JSONObject attachment) {
//当前登录用户信息
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(iTdcDrawingServiceImpl.saveAttachment(attachment, userInfo));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/listInfo")
@ApiOperation(httpMethod = "GET", value = "分页查询")
public ResponseModel<IPage> listInfo(int current, int size) {
IPage page = new Page();
page.setSize(size);
page.setCurrent(current);
return ResponseHelper.buildResponse(iTdcDrawingService.page(page));
}
}
......@@ -47,10 +47,10 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItemMapper modelItemMapper;
@Override
public void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo) {
public SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft) {
long start = System.currentTimeMillis();
if (ObjectUtils.isEmpty(jsonObject)) {
return;
return null;
}
SubmitRecord submitRecord = new SubmitRecord();
userInfo.getUserName();
......@@ -62,6 +62,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
submitRecord.setAmosOrgCode(orgCode);
submitRecord.setAmosOrgName(companyName);
}
submitRecord.setDraft(draft);
submitRecord.setSubmitPeople(userInfo.getRealName());
submitRecord.setSubmitTime(new Date());
String batchNo = UUID.randomUUID().toString();
......@@ -72,22 +73,36 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
long end = System.currentTimeMillis();
log.error("=====记录入库用时:"+(end-start1)+"======");
if (StringUtils.isEmpty(submitRecord.getSequenceNbr())) {
return;
return null;
}
List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> {
ModelItem modelItem = new ModelItem();
String key = e.getKey();
String[] s = key.split("_");
if (s.length > 0) {
if (s.length == 2) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
} else if (s.length == 3) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
modelItem.setType(1);
modelItem.setTagName(s[2]);
} else {
return null;
}
String value = String.valueOf(e.getValue());
modelItem.setCheckItemValue(value);
if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length == 2) {
modelItem.setCheckItemValue(value.split("_")[1]);
modelItem.setTagName(value.split("_")[0]);
modelItem.setType(0);
} else {
modelItem.setCheckItemValue(value);
}
// modelItem.setCheckItemValue(value);
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem;
}).collect(Collectors.toList());
}).filter(item -> !ObjectUtils.isEmpty(item)).collect(Collectors.toList());
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
......@@ -98,40 +113,65 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
log.error("=====入库用时:"+(e2-e1)+"======");
// 异步请求规则校验
syncMethodService.checkItem(itemValue, submitRecord);
if (draft == 1) {
syncMethodService.checkItem(itemValue, submitRecord);
}
return submitRecord;
}
@Override
public void editModelItem(JSONObject jsonObject, AgencyUserModel userInfo) {
public SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id, int examine) {
Long sequenceNbr = Long.valueOf(String.valueOf(jsonObject.get("sequenceNbr")));
Long sequenceNbr = ObjectUtils.isEmpty(jsonObject.get("sequenceNbr")) ? null : Long.valueOf(String.valueOf(jsonObject.get("sequenceNbr")));
String batchNo = UUID.randomUUID().toString();
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbr, batchNo);
Long sequenceNbrId = ObjectUtils.isEmpty(sequenceNbr) ? id : sequenceNbr;
// SubmitRecord submitRecord = new SubmitRecord();
// submitRecord.setSequenceNbr(sequenceNbr);
// submitRecord.setBatchNo(batchNo);
// submitRecord.setDraft(draft);
// submitRecord.setExamine(examine);
// submitRecordService.updateById(submitRecord);
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbrId, batchNo, draft, examine);
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbr);
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbrId);
this.baseMapper.delete(wrapper);
List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> {
ModelItem modelItem = new ModelItem();
String key = e.getKey();
String[] s = key.split("_");
if (s.length > 1) {
if (s.length == 2) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
String value = String.valueOf(e.getValue());
modelItem.setCheckItemValue(value);
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem;
} else if (s.length == 3) {
modelItem.setModelName(s[0]);
modelItem.setCheckItemLabel(s[1]);
modelItem.setType(1);
modelItem.setTagName(s[2]);
} else {
return null;
}
String value = String.valueOf(e.getValue());
if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length == 2) {
modelItem.setCheckItemValue(value.split("_")[1]);
modelItem.setTagName(value.split("_")[0]);
modelItem.setType(0);
} else {
modelItem.setCheckItemValue(value);
}
// modelItem.setCheckItemValue(value);
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem;
}).filter(item -> !ObjectUtils.isEmpty(item)).collect(Collectors.toList());
this.saveOrUpdateBatch(collect);
// 异步请求规则校验
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
syncMethodService.checkItem(itemValue, submitRecord);
if (draft == 1) {
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
syncMethodService.checkItem(itemValue, submitRecord);
}
return submitRecord;
}
......@@ -140,7 +180,16 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbr);
List<ModelItem> list = this.list(wrapper);
Map<String, Object> map = list.stream().collect(Collectors.toMap(e -> e.getModelName() + "_" + e.getCheckItemLabel(), ModelItem::getCheckItemValue));
Map<String, Object> map = new HashMap<>();
list.forEach(item -> {
if (item.getType() == 1 ) {
map.put(item.getModelName() + "_" + item.getCheckItemLabel() + "_" + item.getTagName(), item.getCheckItemValue());
} else if (item.getType() == 0) {
map.put(item.getModelName() + "_" + item.getCheckItemLabel(), item.getTagName() + "_" + item.getCheckItemValue());
} else {
map.put(item.getModelName() + "_" + item.getCheckItemLabel(), item.getCheckItemValue());
}
});
map.put("sequenceNbr", sequenceNbr);
return map;
}
......
package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -8,7 +10,9 @@ import com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
/**
......@@ -21,9 +25,12 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
SubmitRecordMapper submitRecordMapper;
@Override
public IPage<SubmitRecord> selectByOrgCode(int current, int size) {
public IPage selectByOrgCode(int current, int size) {
Page page = new Page(current,size);
return submitRecordMapper.selectByOrgCode(page);
LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.orderByDesc(SubmitRecord::getSubmitTime);
// List<SubmitRecord> list = this.baseMapper.selectPage(page, wrapper);
return submitRecordMapper.selectByOrgCodes(page);
}
@Override
......@@ -32,10 +39,38 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
}
@Override
public SubmitRecord updateById(Long sequenceNbr, String batchNo) {
public SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft, int examine) {
SubmitRecord submitRecord = this.getById(sequenceNbr);
submitRecord.setBatchNo(batchNo);
submitRecord.setDraft(draft);
submitRecord.setSubmitTime(new Date());
submitRecord.setExamine(examine);
this.updateById(submitRecord);
return submitRecord;
}
@Override
public List<SubmitRecord> selectRecord() {
LambdaQueryWrapper<SubmitRecord> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SubmitRecord::getDraft,1);
wrapper.orderByDesc(SubmitRecord::getSubmitTime);
wrapper.last(" limit 20");
return this.baseMapper.selectList(wrapper);
}
@Override
public void saveFileId(Long id, Long fileId) {
SubmitRecord submitRecord = this.getById(id);
submitRecord.setFileId(fileId);
// LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>();
// wrapper.set(SubmitRecord::getFileId, fileId);
// wrapper.set(SubmitRecord::getSequenceNbr, id);
// this.update(wrapper);
this.updateById(submitRecord);
}
@Override
public SubmitRecord getFileId(Long id) {
return this.getById(id);
}
}
......@@ -40,7 +40,8 @@ public class SyncMethodServiceImpl implements SyncMethodService {
// 调用规则校验模型
try {
// 没有配决策流,processIds传null即可
String packageId = "三维校验/" + key;
Thread.sleep(1000);
String packageId = "数据填报/" + key;
ruleTrigger.publish(idxProjectModel, packageId, null);
} catch (Exception e) {
e.printStackTrace();
......
package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.entity.TdcDrawing;
import com.yeejoin.amos.boot.module.tdc.api.mapper.TdcDrawingMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.ITdcDrawingService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 服务实现类
*
* @author duanwei
* @date 2022-11-22
*/
@Service
public class TdcDrawingServiceImpl extends ServiceImpl<TdcDrawingMapper, TdcDrawing> implements ITdcDrawingService {
public List<TdcDrawing> saveAttachment(@RequestBody JSONObject attachment, AgencyUserModel userInfo) {
List<TdcDrawing> tdcDrawingList = new ArrayList<>();
if (!ValidationUtil.isEmpty(attachment)) {
JSONArray attachment1 = attachment.getJSONArray("attachment");
for (Object i : attachment1) {
TdcDrawing tdcDrawing = new TdcDrawing();
List<CompanyModel> company = userInfo.getCompanys();
if (!CollectionUtils.isEmpty(company)) {
//机构名称
String companyName = company.get(0).getCompanyName();
tdcDrawing.setUploadCompanyName(companyName);
//机构code
String orgCode = company.get(0).getOrgCode();
tdcDrawing.setUploadCompanyCode(orgCode);
//登录人姓名
String realName = userInfo.getRealName();
tdcDrawing.setUploadUserName(realName);
}
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(i));
tdcDrawing.setDrawingName(jsonObject.getString("name"));
tdcDrawing.setDrawingUrl(jsonObject.getString("url"));
tdcDrawing.setUploadTime(new Date());
save(tdcDrawing);
tdcDrawingList.add(tdcDrawing);
}
}
return tdcDrawingList;
}
}
## DB properties:
spring.datasource.url=jdbc:mysql://172.16.11.201:3306/dl_amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.10.215:3306/dl_amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
## eureka properties:
eureka.instance.hostname=172.16.11.201
#eureka.client.register-with-eureka=false
#eureka.client.fetchRegistry=false
#eureka.client.server.waitTimeInMsWhenSyncEmpty=0
eureka.instance.hostname=172.16.10.215
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database=1
spring.redis.host=172.16.11.201
spring.redis.host=172.16.10.215
spring.redis.port=6379
spring.redis.password=1234560
spring.redis.password=yeejoin@2020
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.broker=tcp://172.16.10.215:1883
emqx.user-name=admin
emqx.password=public
......
......@@ -28,7 +28,7 @@ public class KafkaConsumerService {
* 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
* @param message 消息
*/
@KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}")
@KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2")
public void consumerSingle(String message,Acknowledgment ack) {
JSONObject messageObj = JSONObject.fromObject(message);
String topic = messageObj.getString("topic");
......
package com.yeejoin.amos.message.kafka.config;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
/**
* topic初始化
*
* @author litw
* @create 2022/11/1 10:06
*/
@Configuration class KafkaConfig {
@Value("${kafka.init.topics}")
private String topics;
/**
* 创建一个名为topic.test的Topic并设置分区数为8,分区副本数为2
*/
@Bean public void initialTopic() {
String[] split = topics.split(",");
Arrays.stream(split).forEach(e->{
new NewTopic(e, 8, (short) 2);
});
}
}
\ No newline at end of file
//package com.yeejoin.amos.message.kafka.config;
//
//
//import org.apache.kafka.clients.admin.NewTopic;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.Arrays;
//
///**
// * topic初始化
// *
// * @author litw
// * @create 2022/11/1 10:06
// */
//@Configuration class KafkaConfig {
//
// @Value("${kafka.init.topics}")
// private String topics;
//
// /**
// * 创建一个名为topic.test的Topic并设置分区数为8,分区副本数为2
// */
// @Bean public void initialTopic() {
// String[] split = topics.split(",");
// Arrays.stream(split).forEach(e->{
// new NewTopic(e, 8, (short) 2);
// });
// }
//
//
//}
\ No newline at end of file
......@@ -9,6 +9,64 @@ eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=1
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
management.health.redis.enabled=false
## emqx
......@@ -20,9 +78,17 @@ emqx.client-password=public
emqx.max-inflight=1000
# 下面个配置默认站端 中心级系统的时候注释掉上边 放开下边
#站端配置
#需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
kafka.topics=null.topic
kafka.init.topics=
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
emq.topic=emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
\ No newline at end of file
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
##中心级配置配置
##需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
#kafka.topics=JKXT2BP-XFYY-Topic
#
##需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
#emq.topic=
\ No newline at end of file
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.11.201:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=1
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 生产者 ssl
spring.kafka.producer.properties.security.protocol=SASL_SSL
spring.kafka.producer.properties.sasl.mechanism=PLAIN
spring.kafka.producer.properties.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="io.cs" \
password="@$-5mocGV2n62K67GiMv9#sqvpaOu.0=%4y6vZ#cS#.@n2n-x5$n/35xfvSAKD12";
spring.kafka.producer.properties.ssl.truststore.location=D:/client.truststore.jks
spring.kafka.producer.properties.ssl.truststore.password=dms@kafka
spring.kafka.producer.properties.ssl.endpoint.identification.algorithm=
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 消费者 ssl
spring.kafka.consumer.properties.security.protocol=SASL_SSL
spring.kafka.consumer.properties.sasl.mechanism=PLAIN
spring.kafka.consumer.properties.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="io.cs" \
password="@$-5mocGV2n62K67GiMv9#sqvpaOu.0=%4y6vZ#cS#.@n2n-x5$n/35xfvSAKD12";
spring.kafka.consumer.properties.ssl.truststore.location=D:/client.truststore.jks
spring.kafka.consumer.properties.ssl.truststore.password=dms@kafka
spring.kafka.consumer.properties.ssl.endpoint.identification.algorithm=
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
management.health.redis.enabled=false
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin
emqx.client-password=public
emqx.max-inflight=1000
# 下面个配置默认站端 中心级系统的时候注释掉上边 放开下边
#站端配置
#需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
kafka.topics=JKXT2BP-XF-Topic
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
##中心级配置配置
##需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
#kafka.topics=JKXT2BP-XFYY-Topic
#
##需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
#emq.topic=
\ No newline at end of file
......@@ -5,59 +5,4 @@ spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=3
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
......@@ -2,26 +2,31 @@
{
"code": "iot",
"emqTopic": "emq.iot.created",
"akkaTopic": "akka.iot.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "akka.patrol.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "sign",
"emqTopic": "emq.sign.created",
"akkaTopic": "akka.sign.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "bussSign",
"emqTopic": "emq.bussSign.created",
"akkaTopic": "akka.bussSign.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "user",
"emqTopic": "emq.user.created",
"akkaTopic": "akka.user.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "xf",
"emqTopic": "emq.xf.created",
"akkaTopic": "JKXT2BP-XF-Topic"
}
]
\ No newline at end of file
......@@ -20,5 +20,6 @@
<module>amos-boot-utils-jpush</module>
<module>amos-boot-utils-video</module>
<module>amos-boot-utils-speech</module>
<module>amos-boot-utils-message</module>
</modules>
</project>
\ 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