Commit 1df592b9 authored by helinlin's avatar helinlin

Merge remote-tracking branch 'origin/developer' into developer

parents 6ba8a7fd 64094e18
......@@ -4,6 +4,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
......@@ -665,4 +667,17 @@ public class oConvertUtils {
}
return json;
}
/**
* 字符串转为数组
* @param strs
* @return
*/
public static List<String> stringToList(String strs){
if(ObjectUtils.isEmpty(strs)){
return new ArrayList<String>();
}
String str[] = strs.split(",");
return Arrays.asList(str);
}
}
package com.yeejoin.amos.boot.module.ccs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
/**
* 电力设备资产
*
* @author system_generator
* @date 2021-11-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "EquipmentDto", description = "电力设备资产")
public class EquipmentDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "站点编码")
private String stationCode;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "电力设备唯一标识")
private String mrid;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "所属区域mrid")
private String areaMrid;
@ApiModelProperty(value = "所属区域")
private String workArea;
@ApiModelProperty(value = "所属建筑mrid")
private String buildMrid;
@ApiModelProperty(value = "所属建筑")
private String buildName;
@ApiModelProperty(value = "所属楼层mrid")
private String floorMrid;
@ApiModelProperty(value = "所属楼层")
private String floorName;
@ApiModelProperty(value = "所属房间mrid")
private String roomMrid;
@ApiModelProperty(value = "所属房间")
private String roomName;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "设备图片,多条以,隔开")
private List<String> img;
@ApiModelProperty(value = " 电源负荷图,多条以,隔开")
private List<String> powerImg;
@ApiModelProperty(value = " 封堵图,多条以,隔开")
private List<String> pluggingImg;
@ApiModelProperty(value = "行车路线图,多条以,隔开")
private List<String> routeImg;
@ApiModelProperty(value = "取水图,多条以,隔开")
private List<String> fetchWaterImg;
@ApiModelProperty(value = "责任部门")
private String chargeDept;
@ApiModelProperty(value = "责任人")
private String chargeUser;
}
package com.yeejoin.amos.boot.module.ccs.api.dto;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 消防建筑表
*
......@@ -63,6 +63,9 @@ public class FireBuildingDto extends BaseDto {
@ApiModelProperty(value = "位置")
private String position;
@ApiModelProperty(value = "属性信息")
private String attribute;
@ApiModelProperty(value = "子节点")
private List<FireBuildingDto> children;
}
......@@ -74,6 +74,9 @@ public class FireEquipmentSignalLogDto extends BaseDto {
@ApiModelProperty(value = "装备所属消防系统code(冗余字段)")
private String systemMrids;
@ApiModelProperty(value = "装备所属消防系统名称(冗余字段)")
private String systemNames;
@ApiModelProperty(value = "装备定义code(冗余字段)")
private String equipmentDefinitionMrid;
......@@ -100,4 +103,16 @@ public class FireEquipmentSignalLogDto extends BaseDto {
@ApiModelProperty(value = "是否为告警信号数据")
private Boolean isAlarm;
@ApiModelProperty(value = "保护对象code")
private String protectedObjectMrid;
@ApiModelProperty(value = "保护对象名称")
private String protectedObjectName;
@ApiModelProperty(value = "换流站负责人")
private String stationChargePerson;
@ApiModelProperty(value = "负责人联系电话")
private String chargePersonPhone;
}
......@@ -65,10 +65,10 @@ public class FireLatentDangerDto extends BaseDto {
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value ="隐患经度")
private String sourceLng;
@ApiModelProperty(value = "换流站经度")
private String stationLng;
@ApiModelProperty(value = "隐患纬度")
private String sourceLat;
@ApiModelProperty(value = "换流站纬度")
private String stationLat;
}
......@@ -53,4 +53,11 @@ public class FireVideoDto extends BaseDto {
@ApiModelProperty(value = "纬度")
private String lat;
@ApiModelProperty(value = "关联的电力设备mrids")
private String relationEquipmentMrids;
@ApiModelProperty(value = "关联的消防设备mrids")
private String relationFireEquipmentMrids;
}
package com.yeejoin.amos.boot.module.ccs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 电力设备表
*
* @author system_generator
* @date 2021-11-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ast_equipment")
public class Equipment extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 站点编码
*/
@TableField("station_code")
private String stationCode;
/**
* 站点名称
*/
@TableField("station_name")
private String stationName;
/**
* 消防建筑唯一标识
*/
@TableField("mrid")
private String mrid;
/**
* 名称
*/
@TableField("name")
private String name;
/**
* 所属区域
*/
@TableField("area_mrid")
private String areaMrid;
/**
* 所属区域
*/
@TableField("work_area")
private String workArea;
@TableField("build_mrid")
private String buildMrid;
/**
* 所属建筑
*/
@TableField("build_name")
private String buildName;
@TableField("floor_mrid")
private String floorMrid;
/**
* 所属楼层
*/
@TableField("floor_name")
private String floorName;
@TableField("room_mrid")
private String roomMrid;
/**
* 所属房间
*/
@TableField("room_name")
private String roomName;
/**
* 地址
*/
@TableField("address")
private String address;
/**
* 设备图片,多条以,隔开
*/
@TableField("img")
private String img;
/**
* 电源负荷图,多条以,隔开
*/
@TableField("power_img")
private String powerImg;
/**
* 封堵图,多条以,隔开
*/
@TableField("plugging_img")
private String pluggingImg;
/**
* 行车路线图,多条以,隔开
*/
@TableField("route_img")
private String routeImg;
/**
* 取水图,多条以,隔开
*/
@TableField("fetch_water_img")
private String fetchWaterImg;
/**
* 责任部门
*/
@TableField("charge_dept")
private String chargeDept;
/**
* 责任人
*/
@TableField("charge_user")
private String chargeUser;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.ccs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -101,5 +102,10 @@ public class FireBuilding extends BaseEntity {
* 详情位置
*/
private String position;
/**
* 属性信息
*/
private String attribute;
}
......@@ -130,6 +130,11 @@ public class FireEquipmentSignalLog extends BaseEntity {
private String systemMrids;
/**
* 装备所属消防系统名称(冗余字段)
*/
private String systemNames;
/**
* 装备定义code(冗余字段)
*/
@TableField("equipment_definition_mrid")
......@@ -169,4 +174,14 @@ public class FireEquipmentSignalLog extends BaseEntity {
*/
private Boolean isAlarm;
/**
*保护对象code
*/
private String protectedObjectMrid;
/**
*保护对象名称
*/
private String protectedObjectName;
}
......@@ -91,4 +91,14 @@ public class FireVideo extends BaseEntity {
*/
@TableField("lat")
private String lat;
/**
* 关联的电力设备mrids
*/
private String relationEquipmentMrids;
/**
* 关联的消防设备mrids
*/
private String relationFireEquipmentMrids;
}
package com.yeejoin.amos.boot.module.ccs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.ccs.api.entity.Equipment;
/**
* 电力设备表 Mapper 接口
*
* @author system_generator
* @date 2021-11-09
*/
public interface EquipmentMapper extends BaseMapper<Equipment> {
}
package com.yeejoin.amos.boot.module.ccs.api.mapper;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireBuildingDto;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireBuilding;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
......@@ -10,5 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2021-11-09
*/
public interface FireBuildingMapper extends BaseMapper<FireBuilding> {
List<FireBuildingDto> getFireBuildingByMridIntreeMrids(@Param("mrid") String mrid);
}
package com.yeejoin.amos.boot.module.ccs.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireVideoDto;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireVideo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* 消防视频表 Mapper 接口
*
......@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface FireVideoMapper extends BaseMapper<FireVideo> {
Page<FireVideoDto> listByRelationMrid(Page page, String relationId);
}
package com.yeejoin.amos.boot.module.ccs.api.service;
import com.yeejoin.amos.boot.module.ccs.api.dto.EquipmentDto;
/**
* 电力设备接口类
*
* @author system_generator
* @date 2021-11-09
*/
public interface IEquipmentService {
EquipmentDto getEquipmentByMrid(String mrid);
}
package com.yeejoin.amos.boot.module.ccs.api.service;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireBuildingDto;
import java.util.List;
/**
* 消防建筑表接口类
*
......
package com.yeejoin.amos.boot.module.ccs.api.service;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireVehicleDto;
import java.util.List;
/**
* 消防车辆信息接口类
*
......@@ -9,4 +13,5 @@ package com.yeejoin.amos.boot.module.ccs.api.service;
*/
public interface IFireVehicleService {
List<FireVehicleDto> queryForFireVehicleList(String stationCode);
}
package com.yeejoin.amos.boot.module.ccs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireVideoDto;
import java.util.List;
/**
* 消防视频表接口类
*
......@@ -9,4 +14,5 @@ package com.yeejoin.amos.boot.module.ccs.api.service;
*/
public interface IFireVideoService {
Page<FireVideoDto> listByRelationMrid(Page page, String relationId);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ccs.api.mapper.FireBuildingMapper">
<select id="getFireBuildingByMridIntreeMrids" resultType="com.yeejoin.amos.boot.module.ccs.api.dto.FireBuildingDto">
SELECT
*
FROM
`ast_fire_building`
WHERE
type = 'building'
AND find_in_set(#{mrid}, tree_mrids)
</select>
</mapper>
......@@ -25,7 +25,14 @@
</choose>
a.station_code,
a.lat as sourceLat,
a.lng as sourceLng
a.lng as sourceLng,
a.fire_equipment_mrid,
a.protected_object_mrid,
a.protected_object_name,
a.system_names,
s.station_charge_person,
s.charge_person_phone,
a.fire_building_mrid
from
asf_fire_equipment_signal_log a,
asf_fire_station_info s
......
......@@ -13,18 +13,10 @@
s.name as station_name,
d.station_code,
d.discovery_date,
<choose>
<when test="stationCode != null and stationCode != ''">
d.lat,
d.lng,
</when>
<otherwise>
s.lng,
s.lat,
</otherwise>
</choose>
d.lng as sourceLng,
d.lat as sourceLat
d.lng,
d.lat,
s.lng as stationLng,
s.lat as stationLat
from
asf_fire_latent_danger d,
asf_fire_station_info s
......
......@@ -2,4 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ccs.api.mapper.FireVideoMapper">
<select id="listByRelationMrid" resultType="com.yeejoin.amos.boot.module.ccs.api.dto.FireVideoDto">
SELECT
v.id,
v.mrid,
v.name,
v.position,
v.play_url
FROM `ast_fire_video` v
where
FIND_IN_SET(#{relationId},v.relation_equipment_mrids) or
FIND_IN_SET(#{relationId},v.relation_fire_equipment_mrids)
</select>
</mapper>
package com.yeejoin.amos.boot.module.common.api.feign;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.common.api.dto.PerfQuotaIotDTO;
import com.yeejoin.amos.boot.module.common.api.dto.VideoDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 装备服务feign
......@@ -208,7 +206,7 @@ public interface EquipFeignClient {
@RequestMapping(value = "/confirmAlarm/getDetailsById", method = RequestMethod.GET)
public Map<String, Object> getDetailsById(@RequestParam Long alamId, @RequestParam Long equipId, @RequestParam String type, @RequestParam String area) ;
public ResponseModel<Map<String, Object>> getDetailsById(@RequestParam Long alamId, @RequestParam(required = false) Long equipId, @RequestParam(required = false) String type, @RequestParam String area) ;
......
package com.yeejoin.amos.boot.module.common.api.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@FeignClient(name = "${Knowledgebase.fegin.name}",path = "knowledgebase" ,configuration = {MultipartSupportConfig.class})
public interface KnowledgebaseFeignClient {
@RequestMapping(value = "/v1/tagvalue/getAll/tegartValue", method = RequestMethod.GET)
ResponseModel<Object> getAllTegartValue(@RequestParam String value) ;
@RequestMapping(value = "/v1/taginstance/find/{id}", method = RequestMethod.GET)
ResponseModel<Object> findById(@PathVariable("id") Long id);
@RequestMapping(value = "/v1/doccontent/getSimpleDetail/{sequenceNbr}", method = RequestMethod.GET)
ResponseModel<Object> getSimpleDetail(@PathVariable(value = "sequenceNbr") String sequenceNbr);
@RequestMapping(value = "/v1/taginstance/targetSeq/{id}", method = RequestMethod.GET)
ResponseModel<Object> queryListByTargetSeq(@PathVariable("id") Long id);
@RequestMapping(value = "/v1/tagvalue/getOne/", method = RequestMethod.GET)
ResponseModel<Object> queryByInstance(@RequestParam Long id) ;
@RequestMapping(value = "/v1/taginstance/getTarget/byName", method = RequestMethod.GET)
ResponseModel<Object> queryListByTagName(@RequestParam String name);
}
......@@ -96,4 +96,5 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<Map<String,Object>> queryCompanyIdNew(String bizOrgName);
OrgUsr queryByUserId(@Param("userId")Long userId);
}
package com.yeejoin.amos.boot.module.common.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
......@@ -280,4 +281,6 @@ public interface IOrgUsrService {
OrgUsrDto saveOrgPersonFlc(OrgPersonDto OrgPersonDto) throws Exception;
void updateByIdOrgPersonFlc(OrgPersonDto OrgPersonVo, Long id) throws Exception;
JSONObject selectPersonByUserId(Long userId) throws Exception;
}
......@@ -134,6 +134,9 @@
<if test="map.bizOrgCode != null and map.bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{map.bizOrgCode}, '%')
</if>
<if test="map.amosOrgId != null and map.amosOrgId != '-1'">
AND u.amos_org_id like concat(#{map.amosOrgId}, '%')
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
......@@ -722,4 +725,13 @@ LEFT JOIN (
</select>
<select id="queryByUserId" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT *
FROM cb_org_usr
WHERE is_delete = 0
<if test="userId != null">
AND amos_org_id = #{userId}
</if>
</select>
</mapper>
......@@ -50,4 +50,7 @@ public class AlertSubmittedSMSDto {
@ApiModelProperty(value = "报送模板")
private String submissionTemplate;
@ApiModelProperty(value = "报送类型")
private String type;
}
......@@ -52,6 +52,12 @@ public enum AlertStageEnums {
fireBrigade("fireBrigade", "岗位名称,规则配置"),
airportUnit("airportUnit", "人员职务规则配置"),
flag("flag", "值班单位"),
keySiteExcle("keySiteExcle","重点部位"),
救援预案警情类型("0","救援预案警情类型"),
责任单位("1","责任单位"),
重点部位名称("2","重点部位名称"),
航空器救援子类("3","航空器救援子类"),
aircraftRescueSub("aircraftRescueSub","航空器救援子类"),
JKDD("6", "企(事)业单位监控大队");
......
......@@ -45,4 +45,22 @@ public interface IFusionService {
* @return
*/
Map<String, String> getCallRecordByCID(String cid);
/**
*
*
* 获取800m,400m 录音文件列表
*
* **/
JSONObject selectAudioVideoRecords(
Integer curPage,
Integer pageRows,
String beginTime,
String endTime,
String beginLongTime,
String endLongTime,
String number,
Integer callType
);
}
......@@ -59,7 +59,9 @@
and a.alert_type_code = #{par.alertTypeCode}
</if>
<if test='par.alertId==null'>
and a.sequence_nbr =#{par.alertId}
</if>
<if test='par.whether24!=false'>
and a.call_time &gt;= (NOW() - interval 24 hour)
</if>
......
......@@ -75,7 +75,8 @@
o.user_name,
s.sender,
s.submission_content,
t.content submission_template
t.content submission_template,
t.type
FROM
jc_alert_submitted_object o
LEFT JOIN jc_alert_submitted s ON o.alert_submitted_id = s.sequence_nbr
......
......@@ -11,7 +11,7 @@
jc_alert_called a LEFT JOIN jc_power_transfer b on a.sequence_nbr=b.alert_called_id
LEFT JOIN jc_power_transfer_company c on c.power_transfer_id=b.sequence_nbr
LEFT JOIN jc_power_transfer_company_resources d on d.power_transfer_company_id=c.sequence_nbr where c.sequence_nbr= #{id}
ORDER BY d.rec_date DESC LIMIT 1
</select>
......@@ -51,7 +51,7 @@
jc_alert_called a LEFT JOIN jc_power_transfer b on a.sequence_nbr=b.alert_called_id
LEFT JOIN jc_power_transfer_company c on c.power_transfer_id=b.sequence_nbr
LEFT JOIN jc_power_transfer_company_resources d on d.power_transfer_company_id=c.sequence_nbr where a.sequence_nbr= #{alertCalledId}
and d.resources_id=#{carId}
and d.resources_id=#{carId} ORDER BY d.rec_date DESC LIMIT 1
</select>
......
......@@ -203,7 +203,7 @@
LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
LEFT JOIN jc_power_transfer_company_resources c ON c.power_transfer_company_id = b.sequence_nbr
WHERE
a.alert_called_id = ${alertId} and c.resources_id = ${carId}
a.alert_called_id = ${alertId} and c.resources_id = ${carId} ORDER BY c.rec_date LIMIT 1
</select>
<select id="getPowerDataCar" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.PowerData">
......
......@@ -45,7 +45,7 @@ public interface LatentDangerState {
/**
* 检查组长确认
*/
检查组长确认("检查组长确认", "leaderConfirm", "secondConfirm","onSiteConfirm", "1", ""),
检查组长确认("检查组长确认", "leaderConfirm", "secondConfirm","onSiteConfirm", "1", "auditRecordPage"),
/**
* 隐患二次审核确认
*/
......
......@@ -95,4 +95,10 @@ public class EquipmentDto extends BaseDto {
@ApiModelProperty(value = "设备参数")
private List<EquipmentIndexDto> equipmentIndex;
@ApiModelProperty(value = "设备所属单位id")
private Long equipUnitId;
@ApiModelProperty(value = "设备所属单位")
private String equipUnit;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -142,4 +143,16 @@ public class Equipment extends BaseEntity {
@TableField("status")
private String status;
/**
* 设备所属单位id
*/
@TableField("equip_unit_id")
private Long equipUnitId;
/**
* 设备所属单位
*/
@TableField("equip_unit")
private String equipUnit;
}
......@@ -124,10 +124,5 @@ public class EquipmentAssociated extends BaseEntity {
@TableField("approval_certificate_number")
private String approvalCertificateNumber;
/**
* 更新人id
*/
@TableField("rec_user_d")
private Long recUserD;
}
......@@ -36,4 +36,6 @@ public interface IEquipmentService {
List<Object> getEquipmentClass(String typeCode);
EquipmentDto getEquipmentById(Long sequenceNbr);
Boolean batchDelete(List<Long> sequenceNbrList);
}
package com.yeejoin.amos.boot.module.ccs.biz.controller;
import java.text.ParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ccs.api.service.IEquipmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* 电力设备资产
*
* @author system_generator
* @date 2021-11-09
*/
@RestController
@Api(tags = "电力设备资产Api")
@RequestMapping(value = "/equipment")
public class EquipmentController extends BaseController {
@Autowired
IEquipmentService iEquipmentService;
/**
* 根据电力设备mrid获取设备信息
* @param mrid
* @return
* @throws ParseException
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据电力设备mrid获取设备信息", notes = "根据电力设备mrid获取设备信息")
@GetMapping(value = "/{mrid}/info")
public ResponseModel getEquipmentByMrid(
@ApiParam(value = "电力设备编号") @PathVariable String mrid) throws ParseException {
return ResponseHelper.buildResponse(iEquipmentService.getEquipmentByMrid(mrid));
}
}
package com.yeejoin.amos.boot.module.ccs.biz.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireBuildingDto;
import com.yeejoin.amos.boot.module.ccs.biz.service.impl.FireBuildingServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;
/**
* 消防建筑表
......@@ -58,4 +64,25 @@ public class FireBuildingController extends BaseController {
@ApiParam(value = "换流站code") @PathVariable String stationCode) {
return ResponseHelper.buildResponse(fireBuildingServiceImpl.buildingTree(stationCode));
}
/**
*
* @param mrid
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{mrid}/info")
@ApiOperation(httpMethod = "GET", value = "根据建筑编码获取建筑信息", notes = "根据建筑编码获取建筑信息")
public ResponseModel getBuildingByMrid(
@ApiParam(value = "建筑code") @PathVariable String mrid) {
return ResponseHelper.buildResponse(fireBuildingServiceImpl.getBuildingByMrid(mrid));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "stationBuildingTree")
@ApiOperation(httpMethod = "GET", value = "换流站建筑树", notes = "换流站建筑树")
public ResponseModel stationBuildingTree (@ApiParam(value = "换流站code")
@RequestParam(value = "stationCode", required = false) String stationCode) {
return ResponseHelper.buildResponse(fireBuildingServiceImpl.stationBuildingTree(stationCode));
}
}
......@@ -14,6 +14,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;
/**
* 消防车辆信息
*
......@@ -48,4 +50,17 @@ public class FireVehicleController extends BaseController {
page.setSize(size);
return ResponseHelper.buildResponse(fireVehicleServiceImpl.queryForFireVehiclePage(page, name, stationCode));
}
/**
* 消防车辆信息列表
*
* @return List<FireVehicleDto>
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{stationCode}/list")
@ApiOperation(httpMethod = "GET", value = "消防车辆信息列表", notes = "消防车辆信息列表")
public ResponseModel<List<FireVehicleDto>> queryForList(
@ApiParam(value = "换流站code", required = true) @PathVariable String stationCode) {
return ResponseHelper.buildResponse(fireVehicleServiceImpl.queryForFireVehicleList(stationCode));
}
}
......@@ -51,6 +51,7 @@ public class FireVideoController extends BaseController {
@ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current,
@ApiParam(value = "页大小", required = true) @RequestParam(value = "size") int size,
@ApiParam(value = "换流站code", required = true) @PathVariable String stationCode,
@ApiParam(value = "摄像头编码") @RequestParam(value = "videoMrid", required = false) String videoMrid,
@ApiParam(value = "所在建筑,多个用逗号分隔") @RequestParam(value = "buildingMrids", required = false) String buildingMrids) {
List<String> buildingMridList = new ArrayList<>();
//根节点id(全部建筑时使用,本来可以不送来实现过滤,但是地图前端不支持)
......@@ -61,7 +62,23 @@ public class FireVideoController extends BaseController {
Page<FireVideoDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(fireVideoServiceImpl.queryForFireVideoPage(page, name, stationCode, buildingMridList));
String code = ("-1").equals(stationCode) ? "" : stationCode;
return ResponseHelper.buildResponse(fireVideoServiceImpl.queryForFireVideoPage(page, name, code, buildingMridList, videoMrid));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询关联的摄像头", notes = "查询关联的摄像头")
@GetMapping(value = "/relation-list")
public ResponseModel<Page<FireVideoDto>> getVideoByRelationMrids(
@ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current,
@ApiParam(value = "页大小", required = true) @RequestParam(value = "size") int size,
@ApiParam(value = "关联id,重点设备mrid或者消防装备mrid", required = true) @RequestParam String relationId
) {
Page<FireVideoDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(fireVideoServiceImpl.listByRelationMrid(page, relationId));
}
}
package com.yeejoin.amos.boot.module.ccs.biz.service.impl;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.amos.boot.module.ccs.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ccs.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ccs.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ccs.api.service.IEquipmentService;
/**
* 电力设备实现类
*
* @author system_generator
* @date 2021-11-09
*/
@Service
public class EquipmentServiceImpl extends BaseService<EquipmentDto,Equipment,EquipmentMapper> implements IEquipmentService {
@Override
public EquipmentDto getEquipmentByMrid(String mrid) {
// TODO Auto-generated method stub
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Equipment::getMrid, mrid);
Equipment eq = this.getOne(wrapper);
EquipmentDto eqDto = new EquipmentDto();
if(ObjectUtils.isEmpty(eq)){
return eqDto;
}
BeanUtils.copyProperties(eq, eqDto);
eqDto.setImg(oConvertUtils.stringToList(eq.getImg()));
eqDto.setFetchWaterImg(oConvertUtils.stringToList(eq.getFetchWaterImg()));
eqDto.setPluggingImg(oConvertUtils.stringToList(eq.getPluggingImg()));
eqDto.setPowerImg(oConvertUtils.stringToList(eq.getPowerImg()));
eqDto.setRouteImg(oConvertUtils.stringToList(eq.getRouteImg()));
return eqDto;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.ccs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ccs.api.dto.BaseDto;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireBuildingDto;
......@@ -8,13 +9,16 @@ import com.yeejoin.amos.boot.module.ccs.api.mapper.FireBuildingMapper;
import com.yeejoin.amos.boot.module.ccs.api.service.IFireBuildingService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -48,6 +52,44 @@ public class FireBuildingServiceImpl extends BaseService<FireBuildingDto, FireBu
}
private List<FireBuildingDto> getChildren(String mrid, List<FireBuildingDto> dtoList) {
return dtoList.stream().filter(d -> StringUtils.isNotBlank(d.getParentMrid()) && d.getParentMrid().equals(mrid)).peek(s -> s.setChildren(this.getChildren(s.getMrid(), dtoList))).sorted(Comparator.comparing(BaseDto::getCreateDate)).collect(Collectors.toList());
return dtoList.stream().filter(d -> StringUtils.isNotBlank(d.getParentMrid()) && d.getParentMrid().equals(mrid)).
peek(s -> s.setChildren(this.getChildren(s.getMrid(), dtoList))).
sorted(Comparator.comparing(BaseDto::getCreateDate)).collect(Collectors.toList());
}
public List<FireBuildingDto> stationBuildingTree(String stationCode) {
List<FireBuildingDto> dtoList = this.queryForList("create_date", true, stationCode);
// 根据换流站code分组list
Map<String, List<FireBuildingDto>> stationMap = dtoList.stream().collect(Collectors.groupingBy(f -> f.getStationName()+"_"+f.getStationCode()));
return stationMap.keySet().stream().map(key -> {
FireBuildingDto parentNode = new FireBuildingDto();
String[] temp = key.split("_");
String name = temp[0];
String code = temp[1];
parentNode.setStationCode(code);
parentNode.setStationName(name);
parentNode.setId(code);
parentNode.setType("station");
parentNode.setName(name);
List<FireBuildingDto> childrenNode = stationMap.get(key).stream().filter(d -> StringUtils.isBlank(d.getParentMrid()) || "0".equals(d.getParentMrid()) || "-1".equals(d.getParentMrid())).
peek(s -> s.setChildren(this.getChildren(s.getMrid(), dtoList))).
sorted(Comparator.comparing(BaseDto::getCreateDate)).collect(Collectors.toList());
parentNode.setChildren(childrenNode);
return parentNode;
}).collect(Collectors.toList());
}
public Map<String, Object> getBuildingByMrid(String mrid){
Map<String,Object> result = new HashMap<String, Object>();
List<FireBuildingDto> fireBuildings = this.baseMapper.getFireBuildingByMridIntreeMrids(mrid);
if(!ObjectUtils.isEmpty(fireBuildings)){
FireBuildingDto fireBuilding = fireBuildings.get(0);
result = JSON.parseObject(JSON.toJSONString(fireBuilding), HashMap.class);
if(!ObjectUtils.isEmpty(fireBuilding.getAttribute())){
HashMap<String, Object> attribute = JSON.parseObject(fireBuilding.getAttribute().toString(), HashMap.class);
result.putAll(attribute);
}
}
return result;
}
}
\ No newline at end of file
......@@ -10,6 +10,8 @@ import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* 消防车辆信息服务实现类
*
......@@ -24,4 +26,9 @@ public class FireVehicleServiceImpl extends BaseService<FireVehicleDto, FireVehi
public Page<FireVehicleDto> queryForFireVehiclePage(Page<FireVehicleDto> page, @Condition(Operator.like) String name, String stationCode) {
return this.queryForPage(page, "create_date", false, name, stationCode);
}
@Override
public List<FireVehicleDto> queryForFireVehicleList(String stationCode) {
return this.queryForList("syn_date", false, stationCode);
}
}
\ No newline at end of file
......@@ -23,8 +23,13 @@ public class FireVideoServiceImpl extends BaseService<FireVideoDto, FireVideo, F
/**
* 分页查询
*/
public Page<FireVideoDto> queryForFireVideoPage(Page<FireVideoDto> page, @Condition(Operator.like) String name, String stationCode, @Condition(Operator.in) List<String> buildingMrid) {
return this.queryForPage(page, "create_date", false, name, stationCode, buildingMrid);
public Page<FireVideoDto> queryForFireVideoPage(Page<FireVideoDto> page, @Condition(Operator.like) String name, String stationCode, @Condition(Operator.in) List<String> buildingMrid,
@Condition(Operator.like) String mrid) {
return this.queryForPage(page, "create_date", false, name, stationCode, buildingMrid, mrid);
}
@Override
public Page<FireVideoDto> listByRelationMrid(Page page, String relationId) {
return this.baseMapper.listByRelationMrid(page, relationId);
}
}
\ No newline at end of file
......@@ -23,18 +23,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.VideoFeignClient;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.api.service.IFireChemicalService;
import com.yeejoin.amos.boot.module.common.api.service.IFireExpertsService;
import com.yeejoin.amos.boot.module.common.api.service.IFireStationService;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.ILinkageUnitService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceService;
import com.yeejoin.amos.boot.module.common.api.service.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
......@@ -48,7 +37,6 @@ import com.yeejoin.amos.boot.module.jcs.api.service.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
......@@ -67,13 +55,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* *指挥资源Api
......@@ -369,10 +351,9 @@ public class CommandController extends BaseController {
@GetMapping(value = "confirmAlarm/getDetailsById")
@ApiOperation(value = "根据id,type查询确警页面相关数据")
public ResponseModel<Map<String, Object>> getDetailsById(@RequestParam Long alamId, @RequestParam Long equipId, @RequestParam String type, @RequestParam String area) {
Map<String, Object> data = equipFeignClient.getDetailsById( alamId, equipId, type, area);
ResponseModel<Map<String, Object>> response = equipFeignClient.getDetailsById( alamId, equipId, type, area);
Map<String, Object> data = response.getResult();
List<Map<String, Object>> records = data != null ? (List<Map<String, Object>>)data.get("video") : null;
if (records != null && records.size() > 0) {
for (Map<String, Object> record : records) {
ResponseModel<String> da = videoFeignClient.videoUrlByIndexCode(record.get("code") + "");
......
......@@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -281,4 +282,19 @@ public class OrgPersonController {
// @PathVariable Long id) throws Exception {
// return ResponseHelper.buildResponse(iOrgUsrService.queryCompanyId(id));
// }
/**
* 根据userId查询人员
*
* @param request
* @param userId
* @return
* @throws Exception
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getPersonByUserId/{userId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据平台用户ID查询人员详情", notes = "根据平台用户ID查询人员详情")
public ResponseModel<JSONObject> selectByUserId(HttpServletRequest request, @PathVariable Long userId) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.selectPersonByUserId(userId));
}
}
......@@ -583,4 +583,18 @@ public class OrgUsrController extends BaseController {
public ResponseModel<List<OrgUsr>> getPersonListByCompanyId(@PathVariable String companyId) {
return ResponseHelper.buildResponse(iOrgUsrService.getPersonListByCompanyId(companyId));
}
/**
* 根据id获取单位人员列表
*
* @param amosUserId
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getOrgUser/byAmosUserId", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据amos userid模糊匹配获取对应机场单位人员信息列表", notes = "根据amos userid模糊匹配获取对应机场单位人员信息列表")
public ResponseModel<Object> getOrgUserByAmosUserId(@RequestParam String amosUserId) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.getOrgUserByAmosUserId(amosUserId));
}
}
\ No newline at end of file
......@@ -155,7 +155,10 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
titleMap_1.put("消防车辆", map.get("carName").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 =new LinkedHashMap<String, Object>();
titleMap_2.put("单位/部门", map.get("teamName").toString());
//titleMap_2.put("单位/部门", map.get("teamName").toString());
if(map.containsKey("teamName") && map.get("teamName") != null){
titleMap_2.put("单位/部门", map.get("teamName").toString());
}
resultList.add(titleMap_2);
String carId =map.get("carId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
......@@ -184,8 +187,12 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
// infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
// resultList.add(infoMap_2);
if( specify.containsKey("postTypeName")&& specify.get("postTypeName")!=null && specify.containsKey("userName")&& specify.get("userName")!=null ) {
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
}
......
......@@ -71,7 +71,9 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
titleMap_1.put("微型消防站", map.get("fireFighting").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 =new LinkedHashMap<String, Object>();
titleMap_2.put("单位/部门", map.get("teamName").toString());
if(map.containsKey("teamName") && map.get("teamName") != null){
titleMap_2.put("单位/部门", map.get("teamName").toString());
}
resultList.add(titleMap_2);
String carId =map.get("fireFightingId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
......@@ -100,8 +102,10 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
if( specify.containsKey("postTypeName")&& specify.get("postTypeName")!=null && specify.containsKey("userName")&& specify.get("userName")!=null ) {
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
}
......
......@@ -72,7 +72,9 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
titleMap_1.put("120急救站", map.get("firstAid").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 = new LinkedHashMap<String, Object>();
titleMap_2.put("单位/部门", map.get("teamName").toString());
if(map.containsKey("teamName") && map.get("teamName") != null){
titleMap_2.put("单位/部门", map.get("teamName").toString());
}
resultList.add(titleMap_2);
String carId = map.get("firstAidId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
......@@ -102,9 +104,14 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 = new LinkedHashMap<String, Object>();
infoMap_2.put(specify.get("postTypeName").toString(), specify.get("userName").toString());
resultList.add(infoMap_2);
// infoMap_2.put(specify.get("postTypeName").toString(), specify.get("userName").toString());
// resultList.add(infoMap_2);
if( specify.containsKey("postTypeName")&& specify.get("postTypeName")!=null && specify.containsKey("userName")&& specify.get("userName")!=null ) {
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
}
}
......
......@@ -92,9 +92,15 @@ public class ESOrgUsrService {
public ESOrgUsrDto saveAlertCalledToES(OrgUsr orgUsr) throws Exception
{
ESOrgUsrDto esOrgUsrDto = new ESOrgUsrDto();
esOrgUsrDto.setSequenceNbr(orgUsr.getSequenceNbr());
esOrgUsrDto.setBizOrgName(orgUsr.getBizOrgName());
esOrgUsrDtoRepository.save(esOrgUsrDto);
String seqStr = String.valueOf(orgUsr.getSequenceNbr());
try {
Long seq = Long.parseLong(seqStr);
esOrgUsrDto.setSequenceNbr(seq);
esOrgUsrDto.setBizOrgName(orgUsr.getBizOrgName());
esOrgUsrDtoRepository.save(esOrgUsrDto);
} catch (Exception e) {
e.printStackTrace();
}
return esOrgUsrDto;
}
......
......@@ -116,8 +116,12 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
if (model.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
model.setAddress(address.getString(BizConstant.ADDRESS));
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
if(!"0".equals(address.getString(BizConstant.LONGITUDE))) {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
}
if(!"0".equals(address.getString(BizConstant.LATITUDE))) {
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}
}
FireStation entity = this.prepareEntity(model);
......@@ -139,8 +143,12 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
if (model.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
model.setAddress(address.getString(BizConstant.ADDRESS));
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
if(!"0".equals(address.getString(BizConstant.LONGITUDE))) {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
}
if(!"0".equals(address.getString(BizConstant.LATITUDE))) {
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}
FireStation entity = this.prepareEntity(model);
......
......@@ -15,6 +15,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -76,6 +77,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import ch.qos.logback.core.joran.conditional.IfAction;
import net.bytebuddy.asm.Advice.This;
/**
* 机构/部门/人员表 服务实现类
......@@ -401,7 +403,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
map.put("bizOrgCode", ObjectUtils.isEmpty(parent) ? null : parent.getBizOrgCode());
}
/* BUG2680 查询部门人员错误 传递参数类型不正确 修改为string 2021-09-14 陈召 开始 */
if (req.containsKey("amosOrgId") && !ObjectUtils.isEmpty(req.get("amosOrgId"))) {
map.put("amosOrgId", req.get("amosOrgId"));
}
req.remove("bizOrgName");
req.remove("pageSize");
req.remove("pageNum");
......@@ -544,7 +549,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Map<Long, DynamicFormInstanceDto> resourceMap = new HashMap<>();
Map<Long, DynamicFormInstance> newResourceMap = new HashMap<>();
formList.parallelStream().forEach(form -> {
formList.forEach(form -> {
resourceMap.put(form.getFormColumnId(), form);
});
......@@ -552,7 +557,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<DynamicFormInstance> addList = new ArrayList<>();
List<Long> deleteList = new ArrayList<>();
fromValueList.parallelStream().forEach(submitFormItem -> {
fromValueList.forEach(submitFormItem -> {
if (resourceMap.containsKey(submitFormItem.getFormColumnId())) {
DynamicFormInstanceDto oldForm = resourceMap.get(submitFormItem.getFormColumnId());
submitFormItem.setSequenceNbr(oldForm.getSequenceNbr());
......@@ -563,11 +568,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
newResourceMap.put(submitFormItem.getFormColumnId(), submitFormItem);
});
newResourceMap.keySet().parallelStream().forEach(form -> {
newResourceMap.keySet().forEach(form -> {
resourceMap.remove(form);
});
resourceMap.keySet().parallelStream().forEach(action -> {
resourceMap.keySet().forEach(action -> {
deleteList.add(resourceMap.get(action).getSequenceNbr());
});
......@@ -2037,4 +2042,29 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgPersonVo.getDynamicFormValue());
}
@Override
public JSONObject selectPersonByUserId(Long userId) throws Exception {
OrgUsr orgUsr = orgUsrMapper.queryByUserId(userId);
// 动态表单数据
List<FormValue> formValue = getFormValue(orgUsr.getSequenceNbr());
OrgPersonFormDto orgPersonFormVo = new OrgPersonFormDto(formValue);
BeanUtils.copyProperties(orgUsr, orgPersonFormVo);
OrgUsr parent = getById(orgUsr.getParentId());
if (!ObjectUtils.isEmpty(parent)) {
orgPersonFormVo.setParentName(parent.getBizOrgName());
}
List<FormValue> dynamicFormAlert = orgPersonFormVo.getDynamicFormAlert();
Map<String, String> collect = dynamicFormAlert.stream().collect(HashMap::new, (map, item) -> map.put(item.getKey(), item.getValue()), HashMap::putAll);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(orgPersonFormVo));
jsonObject.put("map", collect);
return jsonObject;
}
public Object getOrgUserByAmosUserId(String amosUserId) throws Exception{
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
wrapper.eq(OrgUsr::getBizOrgType, CommonConstant.BIZ_ORG_TYPE_PERSON);
wrapper.like(StringUtils.isNotBlank(amosUserId), OrgUsr::getAmosOrgId, amosUserId);
return this.baseMapper.selectList(wrapper);
}
}
......@@ -190,17 +190,17 @@ public class AircraftController extends BaseController {
ResponseModel<Map<String, Object>> dataModel = iotFeignClient.getDynamicFlightInfo(num);
if (dataModel != null) {
Map<String, Object> map = dataModel.getResult();
Map<String, Object> map = dataModel.getResult()!=null? dataModel.getResult():null;
if (map != null) {
map1.put("aircraftModel", map.get("aircraftType"));
map1.put("dynamicFlightId", map.get("dynamicFlightId"));
map1.put("landingTime", map.get("sta"));
map1.put("aircraftModel", map.containsKey("aircraftType")?map.get("aircraftType"):null);
map1.put("dynamicFlightId", map.containsKey("dynamicFlightId")?map.get("dynamicFlightId"):null);
map1.put("landingTime", map.containsKey("sta")?map.get("sta"):null);
/* 任务 3488 根据航班号查询航班信息回填 增加跑道,机位字段 start*/
map1.put("runway", map.get("runway"));
map1.put("stand", map.get("stand"));
map1.put("runway", map.containsKey("runway")?map.get("runway"):null);
map1.put("stand", map.containsKey("stand")?map.get("stand"):null);
/* 任务 3488 根据航班号查询航班信息回填 end*/
// map1.put("fuelQuantity", map.get(""));
map1.put("passengerCapacity", map.get("psgNumTotal"));
map1.put("passengerCapacity", map.containsKey("passengerCapacity")?map.get("passengerCapacity"):null );
}
}
return ResponseHelper.buildResponse(map1);
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.component.emq.EmqKeeper;
import org.typroject.tyboot.component.event.RestEventTrigger;
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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -25,36 +58,10 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ESAlertCalledService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
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.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.component.event.RestEventTrigger;
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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
......@@ -67,7 +74,7 @@ import java.util.stream.Stream;
@Api(tags = "警情接警记录Api")
@RequestMapping(value = "/alert-called")
public class AlertCalledController extends BaseController {
private final Logger logger = LogManager.getLogger(AlertCalledController.class);
@Autowired
LatentDangerFeignClient latentDangerFeignClient;
@Autowired
......@@ -90,6 +97,12 @@ public class AlertCalledController extends BaseController {
private static String ALETR_TYPE_AID = "1214";
private static String ALETR_TYPE_AID_STATUS = "patientStatus";
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
/**
* 新增警情接警记录
*
......@@ -133,9 +146,22 @@ public class AlertCalledController extends BaseController {
}
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto);
toSendCompletePoliceSituationMatch(alertCalledObjsDto.getAlertCalled().getSequenceNbr());
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalled());
}
@Async
public void toSendCompletePoliceSituationMatch(Long id){
try {
Object result = iAlertCalledService.toCompletePoliceSituationMatch(id);
List<Object> list= (List<Object>) result;
if(list.size()>0) {
emqKeeper.getMqttClient().publish(topicMatch, result.toString().getBytes(), RuleConfig.DEFAULT_QOS, false);
}
} catch (Exception e) {
logger.info(topicMatch+":警情id"+id+"获取匹配的预案失败------------"+e.getMessage());
}
}
/**
* 根据id删除
*
......@@ -515,4 +541,14 @@ public class AlertCalledController extends BaseController {
public ResponseModel<Object> getLocationLike(@RequestParam(required = false) String locationt) {
return ResponseHelper.buildResponse(iAlertCalledService.getLocationLike(locationt));
}
/**
* 警情预案匹配
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/police/situation/match")
@ApiOperation(httpMethod = "GET", value = "警情预案匹配", notes = "警情预案匹配")
public ResponseModel<Object> toCompletePoliceSituationMatch(@RequestParam Long id)throws Exception {
return ResponseHelper.buildResponse(iAlertCalledService.toCompletePoliceSituationMatch(id));
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
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;
......@@ -16,8 +17,11 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertSubmittedObjectServiceImpl;
......@@ -28,6 +32,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.TemplateServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -238,6 +243,23 @@ public class AlertSubmittedController extends BaseController {
/**
* 构建警情报送规则对象
*/
boolean flag = false;
TemplateExtendDto template = null;
Template templateN = null;
if(schedulingContent.getType().equals(AlertBusinessTypeEnum.警情结案.getName()) ||
schedulingContent.getType().equals(AlertBusinessTypeEnum.警情续报.getName()) ||
schedulingContent.getType().equals(AlertBusinessTypeEnum.非警情确认.getName())) {
} else {
// 获取模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
template.setRichContent(template.getContent());
flag = true;
}
AlertCalledRo alertCalledRo = new AlertCalledRo();
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
......@@ -249,7 +271,24 @@ public class AlertSubmittedController extends BaseController {
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress());
definitions.put("$recDate",DateUtils.convertDateToString(alertCalled.getRecDate(),DateUtils.DATE_TIME_PATTERN));
String content = getTaskInformation( schedulingContent.getSubmissionTemplate(),definitions);
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "无" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "无" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "无" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "无" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(schedulingContent.getSubmissionContent()).getString("$companyName") ;
definitions.put("$companyName", null == companyName ? "" : companyName);
String content ="";
if(flag) {
content = getTaskInformation( template.getRichContent(),definitions);
} else {
content = getTaskInformation( schedulingContent.getSubmissionTemplate(),definitions);
}
schedulingContent.setSubmissionTemplate(content);
if(!ValidationUtil.isEmpty(schedulingContent.getSubmissionContent())) {
try {
......@@ -262,26 +301,6 @@ public class AlertSubmittedController extends BaseController {
return ResponseHelper.buildResponse(schedulingContent);
}
/**
* 获取警情续报内容
*
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/alert_submitted/ddd", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取警情续报内容和模板", notes = "获取警情续报内容和模板")
public ResponseModel<Object> getAlertSubmittedContentDD() {
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledByIdNoRedis(1455815417061728258L);
alertSubmittedService.generateMob(alertCalledFormDto.getAlertCalled());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(null);
}
private String getTaskInformation(String content, Map<String, String> definitions) {
int size = definitions.size();
......
......@@ -57,6 +57,44 @@ public class FusionController extends BaseController {
}
/**
*
*
* 800M40M 录音文件
*
* */
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "800M40M录音文件", notes = "800M40M录音文件")
@PostMapping (value = "/getCarList")
public ResponseModel<JSONObject> getCarList(
@RequestParam(value = "curPage", required = false) Integer curPage,
@RequestParam(value = "pageRows", required = false) Integer pageRows,
@RequestParam(value = "beginTime", required = false) String beginTime,
@RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "beginLongTime", required = false) String beginLongTime,
@RequestParam(value = "endLongTime", required = false) String endLongTime,
@RequestParam(value = "number", required = false) String number,
@RequestParam(value = "callType", required = false) Integer callType
) {
JSONObject carList = fusionService.selectAudioVideoRecords( curPage,
pageRows,
beginTime,
endTime,
beginLongTime,
endLongTime,
number,
callType);
return ResponseHelper.buildResponse(carList);
}
/**
* 查询车辆
*
* @return
......
......@@ -3,9 +3,12 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
......@@ -16,6 +19,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import org.apache.commons.collections.map.HashedMap;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -51,6 +55,10 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
@Autowired
IotFeignClient iotFeignClient;
@Autowired
AlertCalledServiceImpl iAlertCalledService;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
......@@ -108,10 +116,22 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
*/
@Override
public AircraftDto queryByAircraftSeq(String agencyCode, Long seq) {
AircraftDto aircraftDto = this.queryBySeq(seq);
AlertCalledObjsDto dto = (AlertCalledObjsDto)iAlertCalledService.selectAlertCalledByIdNoRedisNew(seq);
List<AlertFormValue> list = dto.getAlertFormValue();
String aircraft = "";
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals("aircraftModel")).collect(Collectors.toList());
if(list1.size() > 0) {
aircraft = list1.get(0).getFieldValueCode();
}
LambdaQueryWrapper<Aircraft> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Aircraft::getAircraftModel,aircraft);
AircraftDto aircraftDto = new AircraftDto();
Aircraft one = this.getOne(queryWrapper);
Bean.toPo(one,aircraftDto);
//填充航空器附件信息
FeignClientResult<List<FileInfoModel>> fileInfoModelResult = Systemctl.fileInfoClient.queryByEntity(
agencyCode, Aircraft.class.getSimpleName(), String.valueOf(seq));
agencyCode, Aircraft.class.getSimpleName(), String.valueOf(one.getSequenceNbr()));
List<FileInfoModel> fileInfoModels = fileInfoModelResult.getResult();
if (!ValidationUtil.isEmpty(fileInfoModels)) {
......
......@@ -9,10 +9,7 @@ import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.service.IVoiceRecordFileService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -25,8 +22,10 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -44,10 +43,27 @@ import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.feign.JcsControlServerClient;
import com.yeejoin.amos.boot.module.common.api.feign.KnowledgebaseFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.ControllerEquipDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertLocationLog;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.enums.ControllerTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum;
......@@ -66,98 +82,109 @@ import com.yeejoin.amos.component.rule.config.RuleConfig;
*/
@Service
public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCalled, AlertCalledMapper>
implements IAlertCalledService {
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
@Autowired
RedisUtils redisUtils;
@Autowired
AlertCalledMapper alertCalledMapper;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
@Autowired
TemplateMapper templateMapper;
@Autowired
PowerTransferMapper powerTransferMapper;
@Autowired
AlertSubmittedMapper alertSubmittedMapper;
@Autowired
private JcsControlServerClient jcsControlServerClient;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
@Autowired
private ESAlertCalledService eSAlertCalledService;
@Autowired
private ControllerServiceImpl controllerService;
@Autowired
private ControllerEquipServiceImpl controllerEquipService;
@Autowired
FirefightersServiceImpl firefightersService;
@Autowired
KeySiteServiceImpl keySiteService;
@Autowired
AlertSubmittedServiceImpl alertSubmittedService;
@Autowired
private AlertLocationLogServiceImpl alertLocationLogService;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.alert.notice}")
private String topic;
@Value("${redis.cache.failure.time}")
private long time;
@Value("${mqtt.topic.command.power.deployment}")
private String topic1;
@Autowired
private OrgUsrServiceImpl iOrgUsrService;
@Autowired
AircraftServiceImpl aircraftService;
@Autowired
AlertFormValueServiceImpl alertFormValueService;
@Autowired
OrgUsrServiceImpl orgUsrServiceImpl;
@Autowired
VoiceRecordFileServiceImpl voiceRecordFileService;
private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
int result = 0;
if (map.get(key) instanceof DateTime) {
long r1 = ((Date) map.get(key)).getTime();
long r2 = ((Date) map2.get(key)).getTime();
result = Long.compare(r1, r2);
}
return result;
}
/**
* 指挥系统 未结束的警情列表
**/
@Override
public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) {
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par);
return list;
}
@Override
public int alertCalledListByAlertStatusCount(RequestData par) {
return alertCalledMapper.alertCalledListByAlertStatusCount(par);
}
/**
* 接警记录 列表分页查询
**/ /*
* bug2407 筛选参数解析异常 修改筛选条件方法 XML中添加了selectAllPage 方法 data代表排序条件 lift 升降序 陈召
* 2021-09-03 开始
*/
implements IAlertCalledService {
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
@Autowired
RedisUtils redisUtils;
@Autowired
AlertCalledMapper alertCalledMapper;
@Autowired
RuleAlertCalledService ruleAlertCalledService;
@Autowired
TemplateMapper templateMapper;
@Autowired
PowerTransferMapper powerTransferMapper;
@Autowired
AlertSubmittedMapper alertSubmittedMapper;
@Autowired
private JcsControlServerClient jcsControlServerClient;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
@Autowired
private ESAlertCalledService eSAlertCalledService;
@Autowired
private ControllerServiceImpl controllerService;
@Autowired
private ControllerEquipServiceImpl controllerEquipService;
@Autowired
FirefightersServiceImpl firefightersService;
@Autowired
KeySiteServiceImpl keySiteService;
@Autowired
AlertSubmittedServiceImpl alertSubmittedService;
@Autowired
private AlertLocationLogServiceImpl alertLocationLogService;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.command.alert.notice}")
private String topic;
@Value("${mqtt.topic.command.alert.noticeData}")
private String topicData;
@Value("${redis.cache.failure.time}")
private long time;
@Value("${mqtt.topic.command.power.deployment}")
private String topic1;
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
@Autowired
private OrgUsrServiceImpl iOrgUsrService;
@Autowired
AircraftServiceImpl aircraftService;
@Autowired
AlertFormValueServiceImpl alertFormValueService;
@Autowired
OrgUsrServiceImpl orgUsrServiceImpl;
@Autowired
VoiceRecordFileServiceImpl voiceRecordFileService;
@Autowired
KnowledgebaseFeignClient knowledgebaseFeignClient;
private static int comparingByGroupVal(Map<String, Object> map, Map<String, Object> map2, String key) {
int result = 0;
if (map.get(key) instanceof DateTime) {
long r1 = ((Date) map.get(key)).getTime();
long r2 = ((Date) map2.get(key)).getTime();
result = Long.compare(r1, r2);
}
return result;
}
/**
* 指挥系统 未结束的警情列表
**/
@Override
public List<AlertCalledZhDto> alertCalledListByAlertStatus(Integer pageNum, Integer pageSize, RequestData par) {
List<AlertCalledZhDto> list = alertCalledMapper.alertCalledListByAlertStatus(pageNum, pageSize, par);
return list;
}
@Override
public int alertCalledListByAlertStatusCount(RequestData par) {
return alertCalledMapper.alertCalledListByAlertStatusCount(par);
}
/**
* 接警记录 列表分页查询
**/ /*
* bug2407 筛选参数解析异常 修改筛选条件方法 XML中添加了selectAllPage 方法 data代表排序条件 lift 升降序 陈召
* 2021-09-03 开始
*/
// public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus,
// String alertTypeCode,
// String alertSourceCode,
......@@ -174,467 +201,490 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
//
// List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, data, lift);
// }
public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, String alertTypeCode,
String alertSourceCode, String startTime, String endTime, String sort, String isFatherAlert) {
String[] split = sort != null ? sort.split(",") : null;
/* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 start */
if (split != null) {
if (split[0] != null) {
if (split[0].equals("alertType") || split[0].equals("alertSource") || split[0].equals("alarmType")) {
split[0] = split[0] + "Code";
}
if (split[0].equals("alertStatusStr")) {
split[0] = "alertStatus";
}
}
if (split[1] != null) {
if (split[1].equals("ascend")) {
split[1] = "ASC";
}
if (split[1].equals("descend")) {
split[1] = "DESC";
}
}
}
String data = split != null ? RedisKey.humpToLine(split[0]) : null;
/* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 end */
String lift = split != null ? split[1] : null;
List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus,
alertTypeCode, alertSourceCode, startTime, endTime, data, lift, isFatherAlert);
IPage<AlertCalled> iPage = new Page<>();
iPage.setRecords(list);
iPage.setTotal(
alertCalledMapper.selectAllCount(alertStatus, alertTypeCode, alertSourceCode, startTime, endTime, isFatherAlert));
//iPage.setSize(pageBean.getSize());
return iPage;
/* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束 */
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledById(Long id) {
if (redisUtils.hasKey(RedisKey.ALERTCALLED_ID + id)) {
Object obj = redisUtils.get(RedisKey.ALERTCALLED_ID + id);
return obj;
} else {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value);
}
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
redisUtils.set(RedisKey.ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time);
return alertCalledFormVo;
}
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledByIdNoRedis(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value);
}
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
return alertCalledFormVo;
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledByIdNoRedisNew(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
public IPage<AlertCalled> queryForCalledList(Page pageBean, Integer alertStatus, String alertTypeCode,
String alertSourceCode, String startTime, String endTime, String sort, String isFatherAlert) {
String[] split = sort != null ? sort.split(",") : null;
/* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 start */
if (split != null) {
if (split[0] != null) {
if (split[0].equals("alertType") || split[0].equals("alertSource") || split[0].equals("alarmType")) {
split[0] = split[0] + "Code";
}
if (split[0].equals("alertStatusStr")) {
split[0] = "alertStatus";
}
}
if (split[1] != null) {
if (split[1].equals("ascend")) {
split[1] = "ASC";
}
if (split[1].equals("descend")) {
split[1] = "DESC";
}
}
}
String data = split != null ? RedisKey.humpToLine(split[0]) : null;
/* 2407 【web】日常值班>警情记录>接警记录,表头排序功能失效 chenzhao 09-28 end */
String lift = split != null ? split[1] : null;
List<AlertCalled> list = alertCalledMapper.selectAllPage(pageBean.getCurrent(), pageBean.getSize(), alertStatus,
alertTypeCode, alertSourceCode, startTime, endTime, data, lift, isFatherAlert);
IPage<AlertCalled> iPage = new Page<>();
iPage.setRecords(list);
iPage.setTotal(alertCalledMapper.selectAllCount(alertStatus, alertTypeCode, alertSourceCode, startTime, endTime,
isFatherAlert));
// iPage.setSize(pageBean.getSize());
return iPage;
/* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束 */
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledById(Long id) {
if (redisUtils.hasKey(RedisKey.ALERTCALLED_ID + id)) {
Object obj = redisUtils.get(RedisKey.ALERTCALLED_ID + id);
return obj;
} else {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
if("flightNumber".equals(alertFormValue.getFieldCode())) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
formValue.add(value);
continue;
}
if("aircraftModel".equals(alertFormValue.getFieldCode())) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValueCode(), alertFormValue.getBlock());
formValue.add(value);
continue;
}
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
"text", alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value);
}
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
redisUtils.set(RedisKey.ALERTCALLED_ID + id, JSON.toJSON(alertCalledFormVo), time);
return alertCalledFormVo;
}
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledByIdNoRedis(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text",
alertFormValue.getFieldValue(), alertFormValue.getBlock());
formValue.add(value);
}
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
return alertCalledFormVo;
}
/**
* 根据灾情id 查询灾情详情
**/
@Override
public Object selectAlertCalledByIdNoRedisNew(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
List<FormValue> formValue = new ArrayList<FormValue>();
//
AlertCalledObjsDto alertCalledFormVo = new AlertCalledObjsDto();
alertCalledFormVo.setAlertCalled(alertCalled);
alertCalledFormVo.setAlertFormValue(list);
return alertCalledFormVo;
}
/**
* <pre>
* 保存警情信息
* </pre>
*
* @param alertCalledObjsDto
* @return
*/
@Transactional(rollbackFor = RuntimeException.class)
public AlertCalledObjsDto createAlertCalled(AlertCalledObjsDto alertCalledObjsDto) {
try {
// 警情基本信息
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
//主表增加备注字段
if (alertCalled.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress());
alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
alertCalled.setCallTime(new Date());
if (AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())
|| AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())) {
alertCalled.setType("0");
} else {
alertCalled.setType("1");
}
// 动态表单
List<AlertFormValue> alertFormValuelist = alertCalledObjsDto.getAlertFormValue();
// 判断是否航空器救援 如果为航空器救援则保存冗余字段 response_level_code bug2542 bykongfm
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
alertFormValuelist.stream().forEach(alertFormValue -> {
if (alertFormValue.getFieldCode().equals("responseLevel")) {
alertCalled.setResponseLevelCode(alertFormValue.getFieldValueCode());
alertCalled.setResponseLevel(alertFormValue.getFieldValue());
}
});
}
// 判断是否归并警情
if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
alertCalled.setUpdateTime(new Date());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
} else {
// 警情报送
// ****************************************************待确认开发
alertCalled.setAlertStatus(false);
alertCalled.setIsDelete(false);
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
// 警情报送
// 调用规则 警情初报
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(), null, null, null);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
return alertCalledObjsDto;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public boolean updateAlertCalled(Long id, String code) {
// TODO Auto-generated method stub
try {
switch (code) {
case "314":
alertCalledMapper.update(null,
new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1)
.set("alert_stage", AlertStageEnums.ZBQJ.getValue())
.set("update_time", new Date())
.set("alarm_type", AlertStageEnums.FJQ.getValue())
.set("alarm_type_code", AlertStageEnums.FJQ.getCode()));
break;
case "315":
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_status", 1).set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZJS.getValue()));
break;
default:
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZGZ.getValue()));
break;
}
AlertCalled alertCalled = this.getById(id);
// 删除缓存
redisUtils.del(RedisKey.ALERTCALLED_ID + id);
/**
* 同步更新存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper.getMqttClient().publish(topic, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
return true;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 根据时间区间查询警情列表信息
*
* @param beginDate 开始时间
* @param endDate 结束时间
*/
public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
// 查询指定日期内的警情列表
List<AlertCalled> alertCalledList = this.list(new LambdaQueryWrapper<AlertCalled>()
.apply(!ValidationUtil.isEmpty(beginDate), "call_time >= '" + beginDate + "'")
.le(true, AlertCalled::getCallTime, endDate));
Map<String, String> queryParams = Maps.newHashMap();
queryParams.put("beginDate", beginDate);
queryParams.put("endDate", endDate);
List<Map<String, Object>> allList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(alertCalledList)) {
Map<String, List<AlertCalled>> alertCalledMap = alertCalledList.stream()
.collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode));
Map<Long, AlertCalled> calledMap = alertCalledList.stream()
.collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity()));
alertCalledMap.forEach((alertTypeCode, list) -> {
allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams));
});
allList.forEach(i -> {
// 增加非空判断 cz 2021-10-08
if (calledMap.get(Long.parseLong(i.get("instanceId").toString())) != null) {
AlertCalled alertCalled = calledMap.get(Long.parseLong(i.get("instanceId").toString()));
i.putAll(Bean.BeantoMap(alertCalled));
}
});
}
// 按接警时间正序排序
allList.sort((e, o) -> comparingByGroupVal(e, o, "recDate"));
return allList;
}
public Map<String, Object> getAlertInfoList(String beginDate, String endDate) {
Map<String, Object> result = Maps.newHashMap();
List<Map<String, Object>> list = listByDateRange(beginDate, endDate);
// 获取接警情况模板
List<Template> templateList = templateMapper.selectList(new LambdaQueryWrapper<Template>()
.eq(Template::getFormat, false).like(Template::getTypeCode, DutyInfoEnum.接警情况.getKey() + "-"));
Map<String, Template> templateMap = templateList.stream()
.collect(Collectors.toMap(Template::getTypeCode, Function.identity()));
List<String> contentList = Lists.newArrayList();
// 增加非空判断 cz 2021-10-08
list.forEach(i -> {
if (i.get("alertTypeCode") != null) {
String tempContent = templateMap.get(DutyInfoEnum.接警情况.getKey() + "-" + i.get("alertTypeCode"))
.getContent();
contentList.add(replaceTemplate(tempContent, i));
}
});
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate);
Integer unFinishedCount = this
.count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532
// 未结案警情统计错误
// bykongfm
result.put("alertInfoList", contentList);
result.putAll(statusCountMap);
result.put("unFinishedCount", unFinishedCount);
return result;
}
/**
* 替换模板
*
* @param tempContent 模板
* @param objMap 对象map
* @return
*/
private String replaceTemplate(String tempContent, Map<String, Object> objMap) {
int size = objMap.size();
String[] keys = objMap.keySet().toArray(new String[size]);
Object[] values = objMap.values().toArray(new Object[size]);
List<String> strList = Lists.newArrayList();
for (Object obj : values) {
if (!ValidationUtil.isEmpty(obj)) {
if (obj instanceof Date) {
obj = DateUtils.date2LongStr((Date) obj);
}
strList.add(obj.toString());
} else {
strList.add("");
}
}
return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
}
@Override
public Map<String, Object> selectAlertCalledKeyValueLabelById(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
AlertCalledObjsDto alertCalledFormVo = new AlertCalledObjsDto();
alertCalledFormVo.setAlertCalled(alertCalled);
alertCalledFormVo.setAlertFormValue(list);
return alertCalledFormVo;
}
/**
* <pre>
* 保存警情信息
* </pre>
*
* @param alertCalledObjsDto
* @return
*/
@Transactional(rollbackFor = RuntimeException.class)
public AlertCalledObjsDto createAlertCalled(AlertCalledObjsDto alertCalledObjsDto) {
try {
// 警情基本信息
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
// 主表增加备注字段
if (alertCalled.getAddress() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(alertCalled.getAddress());
alertCalled.setAddress(address.getString(BizConstant.ADDRESS));
alertCalled.setCoordinateX(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
alertCalled.setCoordinateY(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
alertCalled.setCallTime(new Date());
if (AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())
|| AlertStageEnums.RG.getValue().equals(alertCalled.getAlertSourceCode())) {
alertCalled.setType("0");
} else {
alertCalled.setType("1");
}
// 动态表单
List<AlertFormValue> alertFormValuelist = alertCalledObjsDto.getAlertFormValue();
// 判断是否航空器救援 如果为航空器救援则保存冗余字段 response_level_code bug2542 bykongfm
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
alertFormValuelist.stream().forEach(alertFormValue -> {
if (alertFormValue.getFieldCode().equals("responseLevel")) {
alertCalled.setResponseLevelCode(alertFormValue.getFieldValueCode());
alertCalled.setResponseLevel(alertFormValue.getFieldValue());
}
});
}
// 判断是否归并警情
if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
alertCalled.setAlertStage(AlertStageEnums.JQJB.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQGB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQGB.getCode());
alertCalled.setUpdateTime(new Date());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
} else {
// 警情报送
// ****************************************************待确认开发
alertCalled.setAlertStatus(false);
alertCalled.setIsDelete(false);
alertCalled.setAlertStage(AlertStageEnums.LLDP.getValue());
alertCalled.setAlarmType(AlertStageEnums.JQCB.getValue());
alertCalled.setAlarmTypeCode(AlertStageEnums.JQCB.getCode());
alertCalled.setRemark(alertCalledObjsDto.getRemark());
this.save(alertCalled);
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlertTypeCode());
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
// 警情报送
// 调用规则 警情初报
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(),
null, null, null);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
//tuisongxinjingqing
RequestData par=new RequestData();
par.setAlertId(alertCalled.getSequenceNbr());
List<AlertCalledZhDto> list = this.alertCalledListByAlertStatus(null, null, par);
String json=list!=null&&list.size()>0?JSONObject.toJSONString(list.get(0)):"";
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, true);
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
// toSendCompletePoliceSituationMatch(alertCalled.getSequenceNbr());
return alertCalledObjsDto;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public boolean updateAlertCalled(Long id, String code) {
// TODO Auto-generated method stub
try {
switch (code) {
case "314":
alertCalledMapper.update(null,
new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1)
.set("alert_stage", AlertStageEnums.ZBQJ.getValue()).set("update_time", new Date())
.set("alarm_type", AlertStageEnums.FJQ.getValue())
.set("alarm_type_code", AlertStageEnums.FJQ.getCode()));
break;
case "315":
alertCalledMapper.update(null,
new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id).set("alert_status", 1)
.set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZJS.getValue()));
break;
default:
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("update_time", new Date()).set("alert_stage", AlertStageEnums.CZGZ.getValue()));
break;
}
AlertCalled alertCalled = this.getById(id);
// 删除缓存
redisUtils.del(RedisKey.ALERTCALLED_ID + id);
/**
* 同步更新存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0新警情, 1警情状态变化
emqKeeper.getMqttClient().publish(topic, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
return true;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 根据时间区间查询警情列表信息
*
* @param beginDate 开始时间
* @param endDate 结束时间
*/
public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
// 查询指定日期内的警情列表
List<AlertCalled> alertCalledList = this.list(new LambdaQueryWrapper<AlertCalled>()
.apply(!ValidationUtil.isEmpty(beginDate), "call_time >= '" + beginDate + "'")
.le(true, AlertCalled::getCallTime, endDate));
Map<String, String> queryParams = Maps.newHashMap();
queryParams.put("beginDate", beginDate);
queryParams.put("endDate", endDate);
List<Map<String, Object>> allList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(alertCalledList)) {
Map<String, List<AlertCalled>> alertCalledMap = alertCalledList.stream()
.collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode));
Map<Long, AlertCalled> calledMap = alertCalledList.stream()
.collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity()));
alertCalledMap.forEach((alertTypeCode, list) -> {
allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams));
});
allList.forEach(i -> {
// 增加非空判断 cz 2021-10-08
if (calledMap.get(Long.parseLong(i.get("instanceId").toString())) != null) {
AlertCalled alertCalled = calledMap.get(Long.parseLong(i.get("instanceId").toString()));
i.putAll(Bean.BeantoMap(alertCalled));
}
});
}
// 按接警时间正序排序
allList.sort((e, o) -> comparingByGroupVal(e, o, "recDate"));
return allList;
}
public Map<String, Object> getAlertInfoList(String beginDate, String endDate) {
Map<String, Object> result = Maps.newHashMap();
List<Map<String, Object>> list = listByDateRange(beginDate, endDate);
// 获取接警情况模板
List<Template> templateList = templateMapper.selectList(new LambdaQueryWrapper<Template>()
.eq(Template::getFormat, false).like(Template::getTypeCode, DutyInfoEnum.接警情况.getKey() + "-"));
Map<String, Template> templateMap = templateList.stream()
.collect(Collectors.toMap(Template::getTypeCode, Function.identity()));
List<String> contentList = Lists.newArrayList();
// 增加非空判断 cz 2021-10-08
list.forEach(i -> {
if (i.get("alertTypeCode") != null) {
String tempContent = templateMap.get(DutyInfoEnum.接警情况.getKey() + "-" + i.get("alertTypeCode"))
.getContent();
contentList.add(replaceTemplate(tempContent, i));
}
});
Map<String, Integer> statusCountMap = alertCalledMapper.queryAlertStatusCount(beginDate, endDate);
Integer unFinishedCount = this
.count(new LambdaQueryWrapper<AlertCalled>().eq(AlertCalled::getAlertStatus, false));// bug2532
// 未结案警情统计错误
// bykongfm
result.put("alertInfoList", contentList);
result.putAll(statusCountMap);
result.put("unFinishedCount", unFinishedCount);
return result;
}
/**
* 替换模板
*
* @param tempContent 模板
* @param objMap 对象map
* @return
*/
private String replaceTemplate(String tempContent, Map<String, Object> objMap) {
int size = objMap.size();
String[] keys = objMap.keySet().toArray(new String[size]);
Object[] values = objMap.values().toArray(new Object[size]);
List<String> strList = Lists.newArrayList();
for (Object obj : values) {
if (!ValidationUtil.isEmpty(obj)) {
if (obj instanceof Date) {
obj = DateUtils.date2LongStr((Date) obj);
}
strList.add(obj.toString());
} else {
strList.add("");
}
}
return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
}
@Override
public Map<String, Object> selectAlertCalledKeyValueLabelById(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
// listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> {
/* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 开始 */
String valueCode = alertFormValue.getFieldValue();
/* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 结束 */
/*
* if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); }
*/
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
});
map.put("data", listdate);
return map;
}
@Override
public List<KeyValueLabel> selectAlertCalledcount(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
return listdate;
}
@Override
public List<KeyValueLabel> powercount(Long id) {
Map<String, Integer> map = powerTransferMapper.getCarNum(id);
list.stream().forEach(alertFormValue -> {
/* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 开始 */
String valueCode = alertFormValue.getFieldValue();
/* 2661 灾情详情中字典类数据错误显示为code 改为value值 2021-09-23 陈召 结束 */
/*
* if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); }
*/
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
});
map.put("data", listdate);
return map;
}
@Override
public List<KeyValueLabel> selectAlertCalledcount(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
return listdate;
}
@Override
public List<KeyValueLabel> powercount(Long id) {
Map<String, Integer> map = powerTransferMapper.getCarNum(id);
// Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id);
// Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id);
// 统计参与人员
List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// 统计参与车辆
listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆"));
// 统计参与队伍
listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个"));
return listdate;
}
@Override
public List<PowerData> getPowerDataList(Long id) {
List<PowerData> list = powerTransferMapper.getPowerDataList(id);
return list;
}
@Override
public AlertCalled getAlertCalledById(Long id) {
return this.getById(id);
}
@Override
public Integer AlertCalledcountTime(int type) {
return alertCalledMapper.AlertCalledcountTime(type);
}
@Override
public List<AlertCalledTodyDto> getTodayAlertCalled() {
return alertCalledMapper.getTodayAlertCalled();
}
public Boolean controlEquip() {
/**
* 获取控制器设备
*/
List<ControllerEquipDto> controllerEquipDtoList = controllerEquipService.queryAllForList();
Map<Long, List<String>> controllerEquipMap = new HashMap<>();
for (ControllerEquipDto controllerEquipDto : controllerEquipDtoList) {
List<String> numList = controllerEquipMap.get(controllerEquipDto.getControllerSeq());
if (ValidationUtil.isEmpty(numList)) {
numList = new ArrayList<>();
}
numList.add(controllerEquipDto.getNum());
controllerEquipMap.put(controllerEquipDto.getControllerSeq(), numList);
}
/**
* 获取联动控制器
*/
List<ControllerDto> controllerDtoList = controllerService.queryAllForList();
StringBuilder bellNumSb = new StringBuilder();
// 统计参与人员
List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// 统计参与车辆
listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆"));
// 统计参与队伍
listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个"));
return listdate;
}
@Override
public List<PowerData> getPowerDataList(Long id) {
List<PowerData> list = powerTransferMapper.getPowerDataList(id);
return list;
}
@Override
public AlertCalled getAlertCalledById(Long id) {
return this.getById(id);
}
@Override
public Integer AlertCalledcountTime(int type) {
return alertCalledMapper.AlertCalledcountTime(type);
}
@Override
public List<AlertCalledTodyDto> getTodayAlertCalled() {
return alertCalledMapper.getTodayAlertCalled();
}
public Boolean controlEquip() {
/**
* 获取控制器设备
*/
List<ControllerEquipDto> controllerEquipDtoList = controllerEquipService.queryAllForList();
Map<Long, List<String>> controllerEquipMap = new HashMap<>();
for (ControllerEquipDto controllerEquipDto : controllerEquipDtoList) {
List<String> numList = controllerEquipMap.get(controllerEquipDto.getControllerSeq());
if (ValidationUtil.isEmpty(numList)) {
numList = new ArrayList<>();
}
numList.add(controllerEquipDto.getNum());
controllerEquipMap.put(controllerEquipDto.getControllerSeq(), numList);
}
/**
* 获取联动控制器
*/
List<ControllerDto> controllerDtoList = controllerService.queryAllForList();
StringBuilder bellNumSb = new StringBuilder();
// StringBuilder broadcastNumSb = new StringBuilder();
for (ControllerDto controllerDto : controllerDtoList) {
// 消防警铃
if (controllerDto.getType().equals(ControllerTypeEnum.BELL.getCode())) {
List<String> bellNumList = controllerEquipMap.get(controllerDto.getSequenceNbr());
if (!ValidationUtil.isEmpty(bellNumList)) {
for (String num : bellNumList) {
bellNumSb.append(num).append(",");
}
}
}
// 广播
for (ControllerDto controllerDto : controllerDtoList) {
// 消防警铃
if (controllerDto.getType().equals(ControllerTypeEnum.BELL.getCode())) {
List<String> bellNumList = controllerEquipMap.get(controllerDto.getSequenceNbr());
if (!ValidationUtil.isEmpty(bellNumList)) {
for (String num : bellNumList) {
bellNumSb.append(num).append(",");
}
}
}
// 广播
// if (controllerDto.getType().equals(ControllerTypeEnum.BROADCAST.getCode())) {
// List<String> broadcastList = controllerEquipMap.get(controllerDto.getSequenceNbr());
// if (!ValidationUtil.isEmpty(broadcastList)) {
......@@ -643,266 +693,267 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// }
// }
// }
}
/**
* 打开消防警铃
*/
if (!ValidationUtil.isEmpty(bellNumSb.toString())) {
String bellNum = bellNumSb.toString();
bellNum = bellNum.substring(0, bellNum.length() - 1);
String[] bellNums = bellNum.split(",");
for (int i = 0; i < bellNums.length; i++) {
//打开15s后自动关闭
try {
jcsControlServerClient.sendBellActionWithTime(bellNums[i], "1", 15);
} catch (Exception e) {
logger.info("打开警铃【" + bellNums[i] + "】异常!");
}
}
}
/**
* 播放广播
*/
}
/**
* 打开消防警铃
*/
if (!ValidationUtil.isEmpty(bellNumSb.toString())) {
String bellNum = bellNumSb.toString();
bellNum = bellNum.substring(0, bellNum.length() - 1);
String[] bellNums = bellNum.split(",");
for (int i = 0; i < bellNums.length; i++) {
// 打开15s后自动关闭
try {
jcsControlServerClient.sendBellActionWithTime(bellNums[i], "1", 15);
} catch (Exception e) {
logger.info("打开警铃【" + bellNums[i] + "】异常!");
}
}
}
/**
* 播放广播
*/
// if (!ValidationUtil.isEmpty(broadcastNumSb.toString())) {
// String broadcastNum = broadcastNumSb.toString();
// broadcastNum = broadcastNum.substring(0, broadcastNum.length() - 1);
// jcsControlServerClient.sendFileAction(broadcastNum, "1490075199246.mp3");
// }
/**
* 打开北站车库门
*/
List<ControllerDto> northDoor = controllerService.queryForList("3", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(northDoor)) {
ControllerDto controllerDto = northDoor.get(0);
// 打开北站车库门
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1,1,1,1");
} catch (Exception e) {
logger.info("打开北站车库门【" + controllerDto.getIp() + "】异常!");
}
// 打开北站车库门弱电警铃
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} catch (Exception e) {
logger.info("打开北站弱电警铃【" + controllerDto.getIp() + "】异常!");
}
}
/**
* 打开南站车库门
*/
List<ControllerDto> southDoor = controllerService.queryForList("2", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(southDoor)) {
ControllerDto controllerDto = southDoor.get(0);
// 打开南站车库门
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1");
} catch (Exception e) {
logger.info("打开南站车库门【" + controllerDto.getIp() + "】异常!");
}
// 打开南站车库门弱电警铃
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} catch (Exception e) {
logger.info("打开南站弱电警铃【" + controllerDto.getIp() + "】异常!");
}
}
return true;
}
/**
* 警情重新定位
*
* @param alertId 警情id
* @param longitude 经度
* @param latitude 纬度
* @return
*/
public Boolean reLocate(String alertId, String longitude, String latitude) {
try {
// 更新警情主表
AlertCalled alertCalled = this.baseMapper.selectById(alertId);
alertCalled.setCoordinateX(Double.valueOf(longitude));
alertCalled.setCoordinateY(Double.valueOf(latitude));
this.updateById(alertCalled);
// 插入定位日志表
AlertLocationLog alertLocationLog = new AlertLocationLog();
alertLocationLog.setAlertId(Long.valueOf(alertId));
alertLocationLog.setLongitude(longitude);
alertLocationLog.setLatitude(latitude);
alertLocationLogService.save(alertLocationLog);
return true;
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
throw new RuntimeException("警情定位失败!");
}
}
@Override
public Map<String, Object> queryAlertCalledById(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap<>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> {
String valueCode = alertFormValue.getFieldValueCode();
if (null == valueCode) {
valueCode = alertFormValue.getFieldValue();
}
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
if ("fireTime".equals(alertFormValue.getFieldCode())) {
map.put("occurrenceTime", alertFormValue.getFieldValue());
}
});
map.put("data", listdate);
// app警情首页使用alarmDetailInfo,alarmContactInfo
if (!AlertStageEnums.YBHZ.getCode().equals(alertCalled.getAlertTypeCode())) {
map.put("occurrenceTime", alertCalled.getCallTime());
}
map.put("alertType", alertCalled.getAlertType());
map.put("address", alertCalled.getAddress());
map.put("contactUser", alertCalled.getContactUser());
map.put("contactPhone", alertCalled.getContactPhone());
map.put("callTime", alertCalled.getCallTime());
//获取通话录音文件地址
List<VoiceRecordFileDto> voiceRecordFileDtos = voiceRecordFileService.listByAlertId(alertCalled.getSequenceNbr());
if (!voiceRecordFileDtos.isEmpty()) {
map.put("voiceRecordFile", voiceRecordFileDtos.get(0).getFilePath());
}
return map;
}
// 未结案警情统计
@Override
public Integer AlertCalledcount(int type) {
return alertCalledMapper.AlertCalledcount(0);
}
@Override
public List<AlertCalled> AlertCalledStatusPage(Integer current, Integer size) {
return alertCalledMapper.AlertCalledStatusPage(current, size);
}
@Override
public List<JSONObject> queryDisposalObjectList(String alertId) {
AlertCalled alertCalled = this.getById(Long.valueOf(alertId));
String alertTypeCode = alertCalled.getAlertTypeCode();
AlertStageEnums alertStage = AlertStageEnums.getEnum(alertTypeCode);
List<JSONObject> resultList = Lists.newArrayList();
if (alertStage != null) {
switch (alertStage) {
case YBHZ:
case TFSJ:
case QTJQ:
resultList = queryDisposalObjectUnit(alertCalled);
break;
case HKJY:
case LYXC:
case ZJBZ:
resultList = queryDisposalObjectAircraft(alertCalled);
default:
break;
}
}
return resultList;
}
private List<JSONObject> queryDisposalObjectUnit(AlertCalled alertCalled) {
List<JSONObject> resultList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) {
List<OrgUsrzhDto> unitInvolvedDto = iOrgUsrService.getOrgUsrzhDto(alertCalled.getUnitInvolved());
JSONObject a1 = new JSONObject();
a1.put("name", "单位名称");
a1.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getBizOrgName() : "");
JSONObject a2 = new JSONObject();
a2.put("name", "单位性质");
a2.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyNature() : "");
JSONObject a3 = new JSONObject();
a3.put("name", "单位电话");
a3.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyPhone() : "");
JSONObject a4 = new JSONObject();
a4.put("name", "单位地址");
a4.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyLocation() : "");
JSONObject a5 = new JSONObject();
a5.put("name", "重点部位数量");
a5.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0))
? unitInvolvedDto.get(0).getKeySiteCount() != null ? unitInvolvedDto.get(0).getKeySiteCount() : 0
: 0 + "个");
resultList.add(a1);
resultList.add(a2);
resultList.add(a3);
resultList.add(a4);
resultList.add(a5);
}
return resultList;
}
private List<JSONObject> queryDisposalObjectAircraft(AlertCalled alertCalled) {
// 警情动态表单数据
List<AlertFormValue> list = alertFormValueService.getzqlist(alertCalled.getSequenceNbr());
Aircraft aircraft = new Aircraft();
for (AlertFormValue alertFormValue : list) {
if ("aircraftModel".equals(alertFormValue.getFieldCode())) {
String aircraftModel = alertFormValue.getFieldValue();
aircraft = aircraftService.queryAircraftInfoByModel(aircraftModel);
break;
}
}
List<JSONObject> resultList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(aircraft)) {
JSONObject a1 = new JSONObject();
a1.put("name", "飞机型号");
a1.put("value", aircraft.getAircraftModel());
JSONObject a2 = new JSONObject();
a2.put("name", "发动机类型");
a2.put("value", aircraft.getEngineType());
JSONObject a3 = new JSONObject();
a3.put("name", "发动机数量");
a3.put("value", aircraft.getEnginesmNum());
JSONObject a4 = new JSONObject();
a4.put("name", "燃油类型");
a4.put("value", aircraft.getFuelType());
JSONObject a5 = new JSONObject();
a5.put("name", "主要燃烧物质");
a5.put("value", aircraft.getCombustionMaterial());
resultList.add(a1);
resultList.add(a2);
resultList.add(a3);
resultList.add(a4);
resultList.add(a5);
}
return resultList;
}
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始 */
public List<Map<String, String>> getContactName() {
// List<Map<String,String>> firefightersName =
// firefightersService.getFirefightersName();
// firefightersName.forEach(r->{
/**
* 打开北站车库门
*/
List<ControllerDto> northDoor = controllerService.queryForList("3", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(northDoor)) {
ControllerDto controllerDto = northDoor.get(0);
// 打开北站车库门
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1,1,1,1");
} catch (Exception e) {
logger.info("打开北站车库门【" + controllerDto.getIp() + "】异常!");
}
// 打开北站车库门弱电警铃
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} catch (Exception e) {
logger.info("打开北站弱电警铃【" + controllerDto.getIp() + "】异常!");
}
}
/**
* 打开南站车库门
*/
List<ControllerDto> southDoor = controllerService.queryForList("2", ControllerTypeEnum.DOOR.getCode());
if (!ValidationUtil.isEmpty(southDoor)) {
ControllerDto controllerDto = southDoor.get(0);
// 打开南站车库门
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 100, "1");
} catch (Exception e) {
logger.info("打开南站车库门【" + controllerDto.getIp() + "】异常!");
}
// 打开南站车库门弱电警铃
try {
jcsControlServerClient.writeStateAction(controllerDto.getIp(), controllerDto.getPort(), 107, "1");
} catch (Exception e) {
logger.info("打开南站弱电警铃【" + controllerDto.getIp() + "】异常!");
}
}
return true;
}
/**
* 警情重新定位
*
* @param alertId 警情id
* @param longitude 经度
* @param latitude 纬度
* @return
*/
public Boolean reLocate(String alertId, String longitude, String latitude) {
try {
// 更新警情主表
AlertCalled alertCalled = this.baseMapper.selectById(alertId);
alertCalled.setCoordinateX(Double.valueOf(longitude));
alertCalled.setCoordinateY(Double.valueOf(latitude));
this.updateById(alertCalled);
// 插入定位日志表
AlertLocationLog alertLocationLog = new AlertLocationLog();
alertLocationLog.setAlertId(Long.valueOf(alertId));
alertLocationLog.setLongitude(longitude);
alertLocationLog.setLatitude(latitude);
alertLocationLogService.save(alertLocationLog);
return true;
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
throw new RuntimeException("警情定位失败!");
}
}
@Override
public Map<String, Object> queryAlertCalledById(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String, Object> map = new HashMap<>();
map.put("title", "【" + alertCalled.getAlertType() + "】" + alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间", "callTime", alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点", "address", alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型", "alertType", alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段", "alertStage", alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级", "responseLevel", "无"));
listdate.add(new KeyValueLabel("被困人数", "trappedNum", alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数", "casualtiesNum", alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人", "contactUser", alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话", "contactPhone", alertCalled.getContactPhone()));
listdate.add(new KeyValueLabel("联系人电话", "contactPhone", alertCalled.getContactPhone()));
list.stream().forEach(alertFormValue -> {
String valueCode = alertFormValue.getFieldValueCode();
if (null == valueCode) {
valueCode = alertFormValue.getFieldValue();
}
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
if ("fireTime".equals(alertFormValue.getFieldCode())) {
map.put("occurrenceTime", alertFormValue.getFieldValue());
}
});
map.put("data", listdate);
// app警情首页使用alarmDetailInfo,alarmContactInfo
if (!AlertStageEnums.YBHZ.getCode().equals(alertCalled.getAlertTypeCode())) {
map.put("occurrenceTime", alertCalled.getCallTime());
}
map.put("alertType", alertCalled.getAlertType());
map.put("address", alertCalled.getAddress());
map.put("contactUser", alertCalled.getContactUser());
map.put("contactPhone", alertCalled.getContactPhone());
map.put("callTime", alertCalled.getCallTime());
// 获取通话录音文件地址
List<VoiceRecordFileDto> voiceRecordFileDtos = voiceRecordFileService
.listByAlertId(alertCalled.getSequenceNbr());
if (!voiceRecordFileDtos.isEmpty()) {
map.put("voiceRecordFile", voiceRecordFileDtos.get(0).getFilePath());
}
return map;
}
// 未结案警情统计
@Override
public Integer AlertCalledcount(int type) {
return alertCalledMapper.AlertCalledcount(0);
}
@Override
public List<AlertCalled> AlertCalledStatusPage(Integer current, Integer size) {
return alertCalledMapper.AlertCalledStatusPage(current, size);
}
@Override
public List<JSONObject> queryDisposalObjectList(String alertId) {
AlertCalled alertCalled = this.getById(Long.valueOf(alertId));
String alertTypeCode = alertCalled.getAlertTypeCode();
AlertStageEnums alertStage = AlertStageEnums.getEnum(alertTypeCode);
List<JSONObject> resultList = Lists.newArrayList();
if (alertStage != null) {
switch (alertStage) {
case YBHZ:
case TFSJ:
case QTJQ:
resultList = queryDisposalObjectUnit(alertCalled);
break;
case HKJY:
case LYXC:
case ZJBZ:
resultList = queryDisposalObjectAircraft(alertCalled);
default:
break;
}
}
return resultList;
}
private List<JSONObject> queryDisposalObjectUnit(AlertCalled alertCalled) {
List<JSONObject> resultList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(alertCalled.getUnitInvolved())) {
List<OrgUsrzhDto> unitInvolvedDto = iOrgUsrService.getOrgUsrzhDto(alertCalled.getUnitInvolved());
JSONObject a1 = new JSONObject();
a1.put("name", "单位名称");
a1.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getBizOrgName() : "");
JSONObject a2 = new JSONObject();
a2.put("name", "单位性质");
a2.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyNature() : "");
JSONObject a3 = new JSONObject();
a3.put("name", "单位电话");
a3.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyPhone() : "");
JSONObject a4 = new JSONObject();
a4.put("name", "单位地址");
a4.put("value",
!ValidationUtil.isEmpty(unitInvolvedDto.get(0)) ? unitInvolvedDto.get(0).getCompanyLocation() : "");
JSONObject a5 = new JSONObject();
a5.put("name", "重点部位数量");
a5.put("value", !ValidationUtil.isEmpty(unitInvolvedDto.get(0))
? unitInvolvedDto.get(0).getKeySiteCount() != null ? unitInvolvedDto.get(0).getKeySiteCount() : 0
: 0 + "个");
resultList.add(a1);
resultList.add(a2);
resultList.add(a3);
resultList.add(a4);
resultList.add(a5);
}
return resultList;
}
private List<JSONObject> queryDisposalObjectAircraft(AlertCalled alertCalled) {
// 警情动态表单数据
List<AlertFormValue> list = alertFormValueService.getzqlist(alertCalled.getSequenceNbr());
Aircraft aircraft = new Aircraft();
for (AlertFormValue alertFormValue : list) {
if ("aircraftModel".equals(alertFormValue.getFieldCode())) {
String aircraftModel = alertFormValue.getFieldValue();
aircraft = aircraftService.queryAircraftInfoByModel(aircraftModel);
break;
}
}
List<JSONObject> resultList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(aircraft)) {
JSONObject a1 = new JSONObject();
a1.put("name", "飞机型号");
a1.put("value", aircraft.getAircraftModel());
JSONObject a2 = new JSONObject();
a2.put("name", "发动机类型");
a2.put("value", aircraft.getEngineType());
JSONObject a3 = new JSONObject();
a3.put("name", "发动机数量");
a3.put("value", aircraft.getEnginesmNum());
JSONObject a4 = new JSONObject();
a4.put("name", "燃油类型");
a4.put("value", aircraft.getFuelType());
JSONObject a5 = new JSONObject();
a5.put("name", "主要燃烧物质");
a5.put("value", aircraft.getCombustionMaterial());
resultList.add(a1);
resultList.add(a2);
resultList.add(a3);
resultList.add(a4);
resultList.add(a5);
}
return resultList;
}
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 开始 */
public List<Map<String, String>> getContactName() {
// List<Map<String,String>> firefightersName =
// firefightersService.getFirefightersName();
// firefightersName.forEach(r->{
// String phone = r.get("phone");
// phone = QRCodeUtil.generateQRCode()+"@"+phone;
// r.put("phone",phone);
......@@ -916,32 +967,255 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// }
// );
// firefightersName.addAll(contactNames);
List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
list.stream().forEach(i -> {
String phone = "";
if (i.containsKey("phone")) {
phone = QRCodeUtil.generateQRCode() + "@" + i.get("phone").toString();
i.replace("phone", phone);
} else {
phone = QRCodeUtil.generateQRCode() + "@" + phone;
i.put("phone", phone);
}
});
return list;
}
public List<String> getCalledAddress() {
List<String> keyAddress = keySiteService.getAddress();
List<String> alertAddress = alertCalledMapper.getAddress();
keyAddress.addAll(alertAddress);
return keyAddress;
}
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */
public Set<Map<String, Object>> getLocationLike(String locationt) {
Set<Map<String, Object>> set = alertCalledMapper.getLocation();
set.remove(null);
return set;
}
List<Map<String, String>> list = orgUsrServiceImpl.getPersonSimpleDetail();
list.stream().forEach(i -> {
String phone = "";
if (i.containsKey("phone")) {
phone = QRCodeUtil.generateQRCode() + "@" + i.get("phone").toString();
i.replace("phone", phone);
} else {
phone = QRCodeUtil.generateQRCode() + "@" + phone;
i.put("phone", phone);
}
});
return list;
}
public List<String> getCalledAddress() {
List<String> keyAddress = keySiteService.getAddress();
List<String> alertAddress = alertCalledMapper.getAddress();
keyAddress.addAll(alertAddress);
return keyAddress;
}
/* 2304 地址 联系人模糊查询缺失 陈召 2021-09-23 结束 */
public Set<Map<String, Object>> getLocationLike(String locationt) {
Set<Map<String, Object>> set = alertCalledMapper.getLocation();
set.remove(null);
return set;
}
@SuppressWarnings("unchecked")
public Object toCompletePoliceSituationMatch(Long id) throws Exception{
Object result=null;;
AlertCalledFormDto dto = (AlertCalledFormDto) selectAlertCalledByIdNoRedis(id);
AlertCalled alertCalled = dto.getAlertCalled();
List<FormValue> list = dto.getDynamicFormAlert();
if (alertCalled.getAlertTypeCode().equals(AlertStageEnums.YBHZ.getCode())) {// 一般火灾
String condition1 = alertCalled.getAlertType();// 一般火灾
String condition2 = alertCalled.getUnitInvolved();// 事发单位
String condition3 = "";
for (FormValue i : list) {
if (i.getKey().equals(AlertStageEnums.keySiteExcle.getCode())) {
condition3 = i.getValue();
break;
}
}
result= getIdsList1( alertCalled.getAlertTypeCode() ,AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
AlertStageEnums.责任单位.getValue() + "," + condition2,
AlertStageEnums.重点部位名称.getValue() + "," + condition3);
//
} else if (alertCalled.getAlertTypeCode().equals(AlertStageEnums.HKJY.getCode())) {
String condition1 = alertCalled.getAlertType();// 航空器救援
String condition2 = "";
for (FormValue i : list) {
if (i.getKey().equals(AlertStageEnums.aircraftRescueSub.getCode())) {
condition2 = condition1 + i.getValue();
}
}
result= getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
AlertStageEnums.航空器救援子类.getValue() + "," + condition2, null);
} else {
String condition1 = alertCalled.getAlertType();
result= getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1, null, null);
}
return result;
}
// private List<Map<String, Object>> getIdsList(String condition1, String condition2, String condition3) {
// List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
// ResponseModel condition1Response = knowledgebaseFeignClient.getAllTegartValue(condition1.split(",")[1]);
// List condition1List = (List) condition1Response.getResult();
// if (condition1List.size() < 1) {
// return null;
// } else {
// for (Object i : condition1List) {
// int priority = 1;
// JSONObject obj = JSONObject.parseObject(JSONObject.toJSONString(i));
// String instanceSeq = obj.getString("instanceSeq");
// ResponseModel<Object> list = knowledgebaseFeignClient.findById(Long.parseLong(instanceSeq));
// Object instanceReslt = list.getResult();
// if (instanceReslt != null) {
// JSONObject instanceResltobj = JSONObject.parseObject(JSONObject.toJSONString(instanceReslt));
// String targetSeq = instanceResltobj.getString("targetSeq");
// ResponseModel<Object> targetSeqResult = knowledgebaseFeignClient
// .queryListByTargetSeq(Long.parseLong(targetSeq));
// Object targetSeqResultObj = targetSeqResult.getResult();
// JSONArray targetSeqResultArray = JSONArray.parseArray(JSONArray.toJSONString(targetSeqResultObj));
// boolean flag2 = false;
// boolean flag3 = false;
// for (Object targetDetail : targetSeqResultArray) {
// JSONObject targetDetailJson = JSONObject.parseObject(JSONObject.toJSONString(targetDetail));
// String sequenceNbr = targetDetailJson.getString("sequenceNbr");
// ResponseModel<Object> detailResponseModel = knowledgebaseFeignClient
// .queryByInstance(Long.parseLong(sequenceNbr));
// Object detailResponseModelObj = detailResponseModel.getResult();
// JSONArray detailResponseModelArray = JSONArray
// .parseArray(JSONArray.toJSONString(detailResponseModelObj));
// JSONObject detailJson = JSONObject
// .parseObject(JSONObject.toJSONString(detailResponseModelArray.get(0)));
// if (!detailJson.containsKey("tagValue")) {
// continue;
// }
// if (condition2 != null && condition2.split(",")[1].equals(detailJson.getString("tagValue"))) {
// flag2 = true;
// }
// if (condition3 != null && condition3.split(",")[1].equals(detailJson.getString("tagValue"))) {
// flag3 = true;
// }
// }
// if (StringUtils.isNotBlank(condition3)) {
// if (flag2 && flag3) {
// priority = 1;
// } else if (flag2) {
// priority = 2;
// } else if (flag3) {
// priority = 3;
// } else {
// priority = 0;
// }
// } else if (StringUtils.isNotBlank(condition2) && condition3 == null) {
// if (flag2) {
// priority = 1;
// } else {
// priority = 2;
// }
// }
//
// Map<String, Object> map = new HashMap<String, Object>();
// ResponseModel<Object> SimpleDetailResponse = knowledgebaseFeignClient.getSimpleDetail(targetSeq);
// if (ObjectUtils.isNotEmpty(SimpleDetailResponse) && priority != 0) {
// map.put("priority", priority);
// map.put("data", SimpleDetailResponse.getResult());
// resultList.add(map);
// }
// }
// }
// }
// return resultList;
// }
private Object getIdsList1(String type ,String condition1, String condition2, String condition3)throws Exception {
List<Object> resultList = new ArrayList<Object>();
ResponseModel<Object> responseForcondition1Name = knowledgebaseFeignClient
.queryListByTagName(condition1.split(",")[0]);
if(200!= responseForcondition1Name.getStatus()) {
return responseForcondition1Name;
}
List listForcondition1Name = (List) responseForcondition1Name.getResult();
if (listForcondition1Name.size() > 0) {
for (Object i : listForcondition1Name) {
int priority = 1;
boolean flag2 = false;
boolean flag3 = false;
JSONObject listForcondition1Nameobj = JSONObject.parseObject(JSONObject.toJSONString(i));
ResponseModel<Object> responseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(listForcondition1Nameobj.getString("sequenceNbr")));
List responseForInstanceIdList = (List) responseForInstanceId.getResult();
Object responseForInstanceIdDetail = responseForInstanceIdList.get(0);
JSONObject responseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(responseForInstanceIdDetail));
if (!(condition1.split(",")[1]).equals(responseForInstanceIdJsonDetail.getString("tagValue"))) {
continue;
}
String condition2Name = null;
String condition2value = null;
if (condition2 != null) {
String[] condition2Array = condition2.split(",");
if(condition2Array.length>1) {
condition2Name = condition2Array[0];
condition2value = condition2Array[1];
}
}
String condition3Name = null;
String condition3value = null;
if (condition3 != null) {
String[] condition3Array = condition3.split(",");
if(condition3Array.length>1) {
condition3Name = condition3Array[0];
condition3value = condition3Array[1];
}
}
ResponseModel<Object> targetSeqResult = knowledgebaseFeignClient
.queryListByTargetSeq(Long.parseLong(listForcondition1Nameobj.getString("targetSeq")));
Object targetSeqResultObj = targetSeqResult.getResult();
JSONArray targetSeqResultArray = JSONArray.parseArray(JSONArray.toJSONString(targetSeqResultObj));
for (Object m : targetSeqResultArray) {
JSONObject detailJson = JSONObject.parseObject(JSONObject.toJSONString(m));
if (condition2Name != null && condition2Name.equals(detailJson.getString("tagName"))) {
ResponseModel<Object> condition2ResponseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(detailJson.getString("sequenceNbr")));
List condition2ResponseForInstanceIdList = (List) condition2ResponseForInstanceId.getResult();
Object condition2ResponseForInstanceIdDetail = condition2ResponseForInstanceIdList.get(0);
JSONObject condition2ResponseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(condition2ResponseForInstanceIdDetail));
if (condition2value != null && condition2value
.equals(condition2ResponseForInstanceIdJsonDetail.getString("tagValue"))) {
flag2 = true;
}
}
if (condition3Name != null && condition3Name.equals(detailJson.getString("tagName"))) {
ResponseModel<Object> condition3ResponseForInstanceId = knowledgebaseFeignClient
.queryByInstance(Long.parseLong(detailJson.getString("sequenceNbr")));
List condition3ResponseForInstanceIdList = (List) condition3ResponseForInstanceId.getResult();
Object condition3ResponseForInstanceIdDetail = condition3ResponseForInstanceIdList.get(0);
JSONObject condition3ResponseForInstanceIdJsonDetail = JSONObject
.parseObject(JSONObject.toJSONString(condition3ResponseForInstanceIdDetail));
if (condition3value != null && condition3value
.equals(condition3ResponseForInstanceIdJsonDetail.getString("tagValue"))) {
flag3 = true;
}
}
}
if (type.equals(AlertStageEnums.YBHZ.getCode())) {
if (flag2 && flag3) {
priority = 1;
} else if (flag2) {
priority = 2;
} else if (flag3) {
priority = 3;
} else {
priority = 0;
}
} else if (type.equals(AlertStageEnums.HKJY.getCode())) {
if (flag2) {
priority = 1;
} else {
priority = 2;
}
}
Map<String, Object> map = new HashMap<String, Object>();
ResponseModel<Object> SimpleDetailResponse = knowledgebaseFeignClient
.getSimpleDetail(listForcondition1Nameobj.getString("targetSeq"));
if (ObjectUtils.isNotEmpty(SimpleDetailResponse.getResult()) && priority != 0) {
JSONArray detailJsonArray = JSONArray.parseArray(JSONArray.toJSONString(SimpleDetailResponse.getResult()));
JSONObject detailJsonObject= detailJsonArray.getJSONObject(0);
map.put("recDate",detailJsonObject.getString("REC_DATE"));
map.put("sequenceNbr", detailJsonObject.getString("SEQUENCE_NBR"));
map.put("docTitle", detailJsonObject.getString("DOC_TITLE"));
map.put("priority", priority);
resultList.add(map);
}
}
}
return resultList;
}
}
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.WordConverterUtils;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
......@@ -154,6 +155,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
private RuleTrigger ruleTrigger;
@Value("${mqtt.topic.command.alert.noticeJa}")
private String topicJa;
private final String msgType = "jcs119";
@Override
......@@ -187,7 +191,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
try {
alertSubmittedExtDto.setExtraInfo(String.format(_extraInfo, alertSubmittedExtDto.getCompanyName(),
alertSubmittedExtDto.getUserName()));
TemplateExtendDto template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode());
TemplateExtendDto template = null;
Template templateN = null;
if(AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
// 获取任务派发模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN,template);
template.setRichContent(template.getContent());
} else {
template = templateService.getByType(alertSubmittedExtDto.getBusinessTypeCode());
}
AlertCalledObjsDto alertCalledVo = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(queryParam.getAlertCalledId());
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
......@@ -205,11 +222,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.dateTimeToDateString(alertCalled.getCallTime()));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",alertCalled.getAddress());
definitions.put("$address",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "无" : alertCalled.getAddress());
definitions.put("$recDate",DateUtils.dateTimeToDateString(alertCalled.getRecDate()));
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "无" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "无" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "无" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "无" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("$companyName") ;
definitions.put("$companyName", null == companyName ? "" : companyName);
String content = getTaskInformation( template.getRichContent(),definitions);
alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()));
alertSubmittedExtDto.setSubmissionContent(content);
} catch (JSONException e) {
alertSubmittedExtDto.setSubmissionContentValue(alertSubmittedExtDto.getSubmitContent());
} catch (ParseException e) {
......@@ -267,6 +296,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto)alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
alertCalled = alertCalledObjsDto.getAlertCalled();
// AlertCalledRo tempCalledRo = new AlertCalledRo();
// RuleAlertCalledService.init(tempCalledRo,alertCalledObjsDto);
// BeanUtils.copyProperties(tempCalledRo,calledRo,"feedback","usIds","ids","alertWay","replaceContent","unitInvolved","alertSubmittedId");
String alertTypeCode = calledRo.getAlertTypeCode();
alertWay = calledRo.getAlertWay();
String unitInvolved = calledRo.getUnitInvolved();
......@@ -481,6 +514,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
//警情結案推送
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
RequestData par=new RequestData();
par.setAlertId(alertCalled.getSequenceNbr());
List<AlertCalledZhDto> list = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json=list!=null&&list.size()>0?JSONObject.toJSONString(list.get(0)):"";
emqKeeper.getMqttClient().publish(topicJa, json.getBytes(), RuleConfig.DEFAULT_QOS, true);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -848,14 +894,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
void handleFunc(AlertCalledPowerInfoDto dto,Map<String, Object> map) {
dto.setCarName(map.get("carName").toString());
if (map.containsKey("carName")) {
dto.setCarName(map.get("carName").toString());
}
dto.setStation(map.get("companyName").toString());
// 随车人员
List<PowerData> powerDataOne = powerTransferMapper.getPowerDataOne(Long.valueOf(map.get("id").toString()));
if(!ValidationUtil.isEmpty(powerDataOne)) {
dto.setPersonNum(String.valueOf(powerDataOne.size()));
} else {
dto.setPersonNum("0");
if (map.containsKey("id")) {
List<PowerData> powerDataOne = powerTransferMapper.getPowerDataOne(Long.valueOf(map.get("id").toString()));
if (!ValidationUtil.isEmpty(powerDataOne)) {
dto.setPersonNum(String.valueOf(powerDataOne.size()));
} else {
dto.setPersonNum("0");
}
}
}
......
......@@ -1480,7 +1480,9 @@ public class ExcelServiceImpl {
list.add(row.getAndIncrement());
list.add(o.getFireTeamName() + "@" + o.getFireTeamId());
list.add(o.getName() + "@" + o.getSequenceNbr());
list.add(o.getJobTitle() + "@" + o.getJobTitleCode());
if(!ValidationUtil.isEmpty(o.getJobTitle())) {
list.add(o.getJobTitle() + "@" + o.getJobTitleCode());
}
data.add(list);
});
}
......
......@@ -94,6 +94,62 @@ public class FusionServiceImpl implements IFusionService {
return getResult(jsonObject);
}
@Override
public JSONObject selectAudioVideoRecords(
Integer curPage,
Integer pageRows,
String beginTime,
String endTime,
String beginLongTime,
String endLongTime,
String number,
Integer callType
) {
MultiValueMap<String, Object> requestEntity = new LinkedMultiValueMap<String, Object>();
if(curPage!=null){
requestEntity.add("curPage", curPage);
};
if(pageRows!=null){
requestEntity.add("pageRows", pageRows);
};
if(beginTime!=null){
requestEntity.add("beginTime", beginTime);
};
if(endTime!=null){
requestEntity.add("endTime", endTime);
};
if(beginLongTime!=null){
requestEntity.add("beginLongTime", beginLongTime);
};
if(endLongTime!=null){
requestEntity.add("endLongTime", endLongTime);
};
if(number!=null){
requestEntity.add("number", number);
};
if(callType!=null){
requestEntity.add("callType", callType);
};
JSONObject jsonObject = null;
try {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/selectAudioVideoRecords", voiceURL), requestEntity, JSONObject.class);
} catch (RestClientException e) {
e.printStackTrace();
throw new BadRequest("访问融合终端失败");
}
return jsonObject;
}
public Map<String, String> getResult(JSONObject jsonObject) {
Map<String, String> map = new HashMap<>();
if (ValidationUtil.isEmpty(jsonObject)) {
......
......@@ -187,16 +187,16 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
if (fullTimeList.size() > 0) {
ruleAlertCalledService.powerTransferCalledRule(fullTimeList, powerTransferDto.getAlertCalledId(),
FireBrigadeTypeEnum.专职消防队.getKey());
FireBrigadeTypeEnum.专职消防队.getKey(), powerTransferDto.getCompanyName());
}
if (medicalTeamList.size() > 0) {
ruleAlertCalledService.powerTransferCalledRule(medicalTeamList, powerTransferDto.getAlertCalledId(),
FireBrigadeTypeEnum.医疗救援队.getKey());
FireBrigadeTypeEnum.医疗救援队.getKey(), powerTransferDto.getCompanyName());
}
if (monitorTeamList.size() > 0) {
ruleAlertCalledService.powerTransferCalledRule(monitorTeamList, powerTransferDto.getAlertCalledId(),
FireBrigadeTypeEnum.监控大队.getKey());
FireBrigadeTypeEnum.监控大队.getKey(), powerTransferDto.getCompanyName());
}
}
......@@ -535,7 +535,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
} else {
String transferDetails = templateContent
.replace("departmentName-type-resourcesNum", transferDetail.toString())
.replace("rescueGrid", rescueGrid == null ? "" : rescueGrid).replace("taskStatus", "");
.replace("rescueGrid", rescueGrid == null ? "" : rescueGrid).replace("任务状态:taskStatus", "");
transferContent.add(transferDetails);
}
});
......
......@@ -73,7 +73,7 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
PowerTransferCompany company = powerTransferCompanyService.getById(id);
list.stream().forEach(e->{
dto.setReceiveName(dto.getReceiveName() == null ? "".concat(e.getReceiveName() == null ? "" : e.getReceiveName()) : dto.getReceiveName().concat("/").concat(e.getReceiveName() == null ? "" : e.getReceiveName()) );
dto.setReceiveName(dto.getReceiveName() == null ? "".concat(e.getReceiveName() == null ? "" : e.getReceiveName()) : "".equals(e.getReceiveName()) ? "".concat(e.getReceiveName()) : dto.getReceiveName().concat("/").concat(e.getReceiveName() == null ? "" : e.getReceiveName()) );
dto.setSendTime(e.getSendTime());
dto.setSendContent(e.getSendContent());
dto.setRecUserName(e.getRecUserName());
......@@ -92,10 +92,12 @@ public class PowerrTransferLogServiceImpl extends BaseService<PowerrTransferLogD
PowerrTransferLogDto dto = new PowerrTransferLogDto();
queryWrapper.eq(PowerrTransferLog::getResourceId,id);
PowerrTransferLog powerrTransferLog = this.getOne(queryWrapper);
PowerTransferCompanyResources resources = powerTransferCompanyResourcesService.getById(id);
PowerTransferCompany byId = powerTransferCompanyService.getById(resources.getPowerTransferCompanyId());
powerrTransferLog.setSendContent(byId.getTaskInformation());
Bean.toPo(powerrTransferLog,dto);
if(null != powerrTransferLog) {
PowerTransferCompanyResources resources = powerTransferCompanyResourcesService.getById(id);
PowerTransferCompany byId = powerTransferCompanyService.getById(resources.getPowerTransferCompanyId());
powerrTransferLog.setSendContent(byId.getTaskInformation());
Bean.toPo(powerrTransferLog,dto);
}
return dto;
}
......
......@@ -126,10 +126,10 @@ public class RuleAlertCalledService {
}
//航空器救援
if (alertFormValue.getFieldCode().equals("flightNumber")) {
alertCalledRo.setFlightNumber(alertFormValue.getFieldValue());
alertCalledRo.setFlightNumber(alertFormValue.getFieldValueCode());
}
if (alertFormValue.getFieldCode().equals("aircraftModel")) {
alertCalledRo.setAircraftModel(alertFormValue.getFieldValue());
alertCalledRo.setAircraftModel(alertFormValue.getFieldValueCode());
}
if (alertFormValue.getFieldCode().equals("landingTime")) {
alertCalledRo.setLandingTime(alertFormValue.getFieldValue());
......@@ -235,7 +235,7 @@ public class RuleAlertCalledService {
return replaceContent;
}
public boolean powerTransferCalledRule(Set<PowerTransferCompanyDto> i, Long alertCalledId, String type) throws Exception {
public boolean powerTransferCalledRule(Set<PowerTransferCompanyDto> i, Long alertCalledId, String type,String companyName) throws Exception {
if (ValidationUtil.isEmpty(alertCalledId)) {
throw new BadRequest("参数校验失败.");
}
......@@ -255,7 +255,7 @@ public class RuleAlertCalledService {
alertCallePowerTransferRo.setAddress(alertCalled.getAddress());
alertCallePowerTransferRo.setAlertType(alertCalled.getAlertType());
alertCallePowerTransferRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCallePowerTransferRo.setCompanyName(alertCalled.getCompanyName());
alertCallePowerTransferRo.setCompanyName(companyName);
alertCallePowerTransferRo.setTrappedNum(Integer.toString(alertCalled.getTrappedNum()));
alertCallePowerTransferRo.setCasualtiesNum(Integer.toString(alertCalled.getCasualtiesNum()));
alertCallePowerTransferRo.setContactPhone(alertCalled.getContactPhone());
......
package com.yeejoin.amos.knowledgebase.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.service.DocContentService;
import com.yeejoin.amos.knowledgebase.face.service.DocLibraryService;
import com.yeejoin.amos.knowledgebase.face.service.DynamicsOptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -22,10 +22,16 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.knowledgebase.face.enumeration.DynamicsFunctional;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.service.DocContentService;
import com.yeejoin.amos.knowledgebase.face.service.DocLibraryService;
import com.yeejoin.amos.knowledgebase.face.service.DynamicsOptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <p>
......@@ -221,5 +227,12 @@ public class DocContentResource {
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(docContentService.queryLikeOrDis(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取简单的预案信息")
@RequestMapping(value = "/getSimpleDetail/{sequenceNbr}", method = RequestMethod.GET)
public ResponseModel<List<Map<String, Object>>> getSimpleDetail(
@PathVariable(value = "sequenceNbr") String sequenceNbr) {
return ResponseHelper.buildResponse(docContentService.getSimpleDetail(sequenceNbr));
}
}
package com.yeejoin.amos.knowledgebase.controller;
import com.yeejoin.amos.knowledgebase.face.service.TagInstanceService;
import io.swagger.annotations.Api;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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.doc.TycloudResource;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.service.TagInstanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <p>
......@@ -27,4 +41,25 @@ public class TagInstanceResource {
private final Logger logger = LogManager.getLogger(TagInstanceResource.class);
@Autowired
private TagInstanceService tagInstanceService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据主键查询实例标签")
@RequestMapping(value = "find/{id}", method = RequestMethod.GET)
public ResponseModel<KnowledgeTagInstance> findById(@PathVariable("id") Long id) {
return ResponseHelper.buildResponse(tagInstanceService.findById(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据targetSeq查询实例标签")
@RequestMapping(value = "targetSeq/{id}", method = RequestMethod.GET)
public ResponseModel<List<KnowledgeTagInstanceModel>> queryListByTargetSeq(@PathVariable("id") Long id) {
return ResponseHelper.buildResponse(tagInstanceService.queryListByTargetSeq(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据targetSeq查询实例标签")
@RequestMapping(value = "getTarget/byName", method = RequestMethod.GET)
public ResponseModel<List<KnowledgeTagInstanceModel>> queryListByTagName(@RequestParam String name) {
return ResponseHelper.buildResponse(tagInstanceService.queryListByTagName(name));
}
}
package com.yeejoin.amos.knowledgebase.controller;
import com.yeejoin.amos.knowledgebase.face.service.TagValueService;
import io.swagger.annotations.Api;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.doc.TycloudResource;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.knowledgebase.face.service.TagValueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <p>
......@@ -27,5 +36,17 @@ public class TagValueResource {
private final Logger logger = LogManager.getLogger(TagValueResource.class);
@Autowired
private TagValueService tagValueService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取所有当前系统的值标签的实例值")
@RequestMapping(value = "/getAll/tegartValue", method = RequestMethod.GET)
public ResponseModel<Object> getAllTegartValue(@RequestParam String value) {
return ResponseHelper.buildResponse(tagValueService.getAllTegartValue(value));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取所有当前系统的值标签的实例值")
@RequestMapping(value = "/getOne/", method = RequestMethod.GET)
public ResponseModel<Object> queryByInstance(@RequestParam Long id) {
return ResponseHelper.buildResponse(tagValueService.queryByInstance(id));
}
}
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.knowledgebase.face.feign.RemoteData;
import com.yeejoin.amos.knowledgebase.face.model.*;
import com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil;
import com.yeejoin.amos.knowledgebase.face.util.QuoteCountFlushTiming;
......@@ -657,4 +658,19 @@ public class DocContentService extends BaseService<KnowledgeDocContentModel, Kno
private List<KnowledgeDocContentModel> queryListByCategorySeqList(@Condition(Operator.in) List<Long> directoryId) {
return this.queryForList(null, false, directoryId);
}
public List<Map<String, Object>> getSimpleDetail(String sequenceNbrs) {
String[] idStrings= sequenceNbrs.split(",");
List<String> idListString= Arrays.asList(idStrings);
List<Long> idList= new ArrayList<Long>();
idListString.stream().forEach(i->{
idList.add(Long.parseLong(i));
});
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<KnowledgeDocContent>();
wrapper.eq("DOC_STATUS", "PUBLISHED");
wrapper.in("SEQUENCE_NBR",idList);
wrapper.select("SEQUENCE_NBR","DOC_TITLE","REC_DATE");
return this.baseMapper.selectMaps(wrapper);
}
}
package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagInstanceMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -19,7 +15,14 @@ import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.*;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsValueModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagInstanceMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.util.Constants;
/**
......@@ -152,4 +155,16 @@ public class TagInstanceService extends BaseService<KnowledgeTagInstanceModel, K
public List<KnowledgeTagInstanceModel> queryListByTargetSeqs(@Condition(Operator.in) Collection<Long> targetSeq) {
return this.queryForList(null, false, targetSeq);
}
public KnowledgeTagInstance findById(Long id) {
return this.baseMapper.selectById(id);
}
public List<KnowledgeTagInstanceModel> queryListByTagName(String tagName) {
// TODO Auto-generated method stub
return this.queryForList(null, false, tagName);
}
}
package com.yeejoin.amos.knowledgebase.face.service;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
......@@ -12,10 +13,14 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.TagValueMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import net.bytebuddy.asm.Advice.This;
/**
* <p>
......@@ -66,4 +71,13 @@ public class TagValueService extends BaseService<KnowledgeTagValueModel, Knowled
public List<KnowledgeTagValueModel> queryTagValuesByDocIds(Collection<Long> docSeqList) {
return Bean.toModels(this.getBaseMapper().queryTagValuesByDocIds(docSeqList), KnowledgeTagValueModel.class);
}
public List<KnowledgeTagValue> getAllTegartValue(String value) {
String[] strings = value.split(",");
QueryWrapper<KnowledgeTagValue> wrapper = new QueryWrapper<KnowledgeTagValue>();
wrapper.eq("AGENCY_CODE", RequestContext.getAgencyCode());
wrapper.in("TAG_VALUE", Arrays.asList(strings));
return this.baseMapper.selectList(wrapper);
}
}
......@@ -358,18 +358,18 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
Bean.copyExistPropertis(dangerDto, latentDanger);
if (ValidationUtil.isEmpty(dangerDto.getId())) {
// 新增
latentDanger.setBusinessKey(businessKey);
latentDanger.setDiscovererDepartmentId(departmentId);
latentDanger.setDiscovererUserId(userId);
latentDanger.setOrgCode(orgCode);
latentDanger.setDangerType(dangerTypeEnum.getCode());
latentDanger.setDangerTypeName(dangerTypeEnum.getName());
latentDanger.setBusinessKey(businessKey == null?"":businessKey);
latentDanger.setDiscovererDepartmentId(departmentId == null?"":departmentId);
latentDanger.setDiscovererUserId(userId == null?"": userId);
latentDanger.setOrgCode(orgCode == null?"":orgCode);
latentDanger.setDangerType(dangerTypeEnum.getCode() == null?"":dangerTypeEnum.getCode());
latentDanger.setDangerTypeName(dangerTypeEnum.getName() == null?"":dangerTypeEnum.getName());
if (LatentDangerBizTypeEnum.防火监督.getCode().equals(bizType)) {
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName());
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode() == null?"":LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode() );
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName() == null?"":LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName());
} else if (LatentDangerBizTypeEnum.巡检.getCode().equals(bizType)) {
latentDanger.setDangerState(LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
latentDanger.setDangerStateName(LatentDangerState.PatrolDangerStateEnum.待评审.getName());
latentDanger.setDangerState(LatentDangerState.PatrolDangerStateEnum.待评审.getCode() == null?"":LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
latentDanger.setDangerStateName(LatentDangerState.PatrolDangerStateEnum.待评审.getName() == null?"":LatentDangerState.PatrolDangerStateEnum.待评审.getName() );
}
if (ValidationUtil.isEmpty(dangerDto.getDangerName())) {
latentDanger.setDangerName(dangerDto.getInputItemName());
......
......@@ -197,12 +197,13 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
//提交隐患
// jsonObject = remoteWorkFlowService.excute(instance.getString("id"), null);
// JSONObject task = jsonObject.getJSONObject("data");
latentDangerBo.setInstanceId(instance.getString("id"));
latentDangerBo.setInstanceId(instance.getString("id") == null ? " ":instance.getString("id"));
JSONObject flowJson = new JSONObject();
flowJson.put("photoUrls", latentDangerParam.getPhotoUrls());
LatentDangerFlowRecordBo record = saveFlowRecord(instance.getString("id"), "提交隐患", userId, departmentId, flowJson, dangerId, role, LatentDangerExcuteTypeEnum.填写隐患完成.getName(), latentDangerParam.getRemark());
latentDangerBo.setCurrentFlowRecordId(record.getId());
latentDangerMapper.update(latentDangerBo);
sendMessage(latentDangerBo, LatentDangerExcuteTypeEnum.填写隐患完成, null,
"隐患排查与治理", this.getNextExecuteUsers(latentDangerBo.getInstanceId()), userRealName, departmentName);
try {
......@@ -374,17 +375,17 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
Integer level, String position, LatentDangerTypeEnum dangerTypeEnum,
String photoUrls, Long checkInputId, Long structureId, String structureName, String instanceKey) {
LatentDangerBo latentDangerBo = new LatentDangerBo();
latentDangerBo.setInstanceId(instanceId);
latentDangerBo.setProblemDescription(problemDescription);
latentDangerBo.setRemark(remark);
latentDangerBo.setInstanceId(instanceId == null ? " ":instanceId);
latentDangerBo.setProblemDescription(problemDescription == null ? " ":problemDescription);
latentDangerBo.setRemark(remark == null ? " ":remark);
latentDangerBo.setDangerState(LatentDangerStateEnum.待评审.getCode());
latentDangerBo.setDiscovererUserId(userId);
latentDangerBo.setDiscovererDepartmentId(departmentId);
latentDangerBo.setBusinessKey(businessKey);
latentDangerBo.setOrgCode(orgCode);
latentDangerBo.setDangerName(dangerName);
latentDangerBo.setDiscovererUserId(userId == null ? " ": remark);
latentDangerBo.setDiscovererDepartmentId(departmentId == null ? " ": departmentId);
latentDangerBo.setBusinessKey(businessKey == null ? " ":businessKey);
latentDangerBo.setOrgCode(orgCode == null ? " ":orgCode);
latentDangerBo.setDangerName(dangerName == null ? " ":dangerName);
latentDangerBo.setDangerLevel(level);
latentDangerBo.setDangerPosition(position);
latentDangerBo.setDangerPosition(position == null ? " ":position);
latentDangerBo.setDangerType(dangerTypeEnum.getCode());
StringBuilder photoUrlsB = new StringBuilder();
if (org.apache.commons.lang3.StringUtils.isNotBlank(photoUrls)) {
......@@ -396,11 +397,11 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
}
}
latentDangerBo.setPhotoUrls(photoUrlsB.toString());
latentDangerBo.setPhotoUrls(photoUrlsB.toString() == null ? " ":photoUrlsB.toString());
latentDangerBo.setCheckInputId(checkInputId);
latentDangerBo.setStructureId(structureId);
latentDangerBo.setStructureName(structureName);
latentDangerBo.setInstanceKey(instanceKey);
latentDangerBo.setStructureName(structureName == null ? " ":structureName);
latentDangerBo.setInstanceKey(instanceKey == null ? " ":instanceKey);
latentDangerMapper.save(latentDangerBo);
return latentDangerBo;
}
......
......@@ -121,6 +121,8 @@ public class WechatController extends BaseController {
@Autowired
ISourceFileService sourceFileService;
private Long TOKEN_TIME = 1209600l;
/**
* 获取微信回调信息返回验证是否通过
......@@ -331,7 +333,7 @@ public class WechatController extends BaseController {
if(loginResult.getStatus() == 200) {
HashMap resultMap = (HashMap) loginResult.getResult();
dto.setToken(resultMap.get("token").toString());
redisUtils.set(model.getPhone() + "_token", resultMap.get("token").toString(), 25920000l);
redisUtils.set(model.getPhone() + "_token", resultMap.get("token").toString(), TOKEN_TIME);
}
return ResponseHelper.buildResponse(dto);
......@@ -349,7 +351,7 @@ public class WechatController extends BaseController {
if(loginResult.getStatus() == 200) {
HashMap resultMap = (HashMap) loginResult.getResult();
token = resultMap.get("token").toString();
redisUtils.set(tel + "_token", resultMap.get("token").toString(), 25920000l);
redisUtils.set(tel + "_token", resultMap.get("token").toString(), TOKEN_TIME);
}
return token;
}
......
......@@ -6,8 +6,11 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -274,4 +277,29 @@ public class BeanDtoVoUtils {
}
});
}
/**
* 将设备实体类转换为Vo
*
* @param page 原分页对象
* @return 转换后的分页对象
*/
public static IPage<EquipmentDto> equipmentIPageDto(IPage<Equipment> page) {
return page.convert(item -> {
try {
EquipmentDto target = new EquipmentDto();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(item, target);
if(EquipmentStatusEnum.未安装.getCode().equals(item.getStatus())) {
target.setStatus(EquipmentStatusEnum.未安装.getName());
} else if(EquipmentStatusEnum.已安装.getCode().equals(item.getStatus())) {
target.setStatus(EquipmentStatusEnum.已安装.getName());
}
return target;
} catch (Exception e) {
return null;
}
});
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentAssociated;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -24,7 +32,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
* @date 2021-11-26
*/
@RestController
@Api(tags = "配套设备/设施/部件Api")
@Api(tags = "配套设备设施部件Api")
@RequestMapping(value = "/equipment-associated")
public class EquipmentAssociatedController extends BaseController {
......@@ -38,79 +46,38 @@ public class EquipmentAssociatedController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增配套设备/设施/部件", notes = "新增配套设备/设施/部件")
@ApiOperation(httpMethod = "POST", value = "新增配套设备设施部件", notes = "新增配套设备设施部件")
public ResponseModel<EquipmentAssociatedDto> save(@RequestBody EquipmentAssociatedDto model) {
model = equipmentAssociatedServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新配套设备/设施/部件", notes = "根据sequenceNbr更新配套设备/设施/部件")
public ResponseModel<EquipmentAssociatedDto> updateBySequenceNbrEquipmentAssociated(@RequestBody EquipmentAssociatedDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除配套设备/设施/部件", notes = "根据sequenceNbr删除配套设备/设施/部件")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个配套设备/设施/部件", notes = "根据sequenceNbr查询单个配套设备/设施/部件")
public ResponseModel<EquipmentAssociatedDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "配套设备/设施/部件分页查询", notes = "配套设备/设施/部件分页查询")
public ResponseModel<Page<EquipmentAssociatedDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EquipmentAssociatedDto> page = new Page<EquipmentAssociatedDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.queryForEquipmentAssociatedPage(page));
}
/**
* 列表全部数据查询
*
*
* @param pageNum
* @param pageSize
* @param equipId
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "配套设备/设施/部件列表全部数据查询", notes = "配套设备/设施/部件列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentAssociatedDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.queryForEquipmentAssociatedList());
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "配套设备设施部件分页查询", notes = "配套设备设施部件分页查询")
public ResponseModel<IPage<EquipmentAssociatedDto>> queryForPage(String pageNum, String pageSize, @RequestParam (value = "equipId") Long equipId) {
Page<EquipmentAssociated> pageBean;
IPage<EquipmentAssociated> page;
LambdaQueryWrapper<EquipmentAssociated> queryWrapper = new LambdaQueryWrapper<EquipmentAssociated>().eq(EquipmentAssociated::getIsDelete,false).eq(EquipmentAssociated::getEquipmentId,equipId);
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 = equipmentAssociatedServiceImpl.page(pageBean, queryWrapper);
int num= equipmentAssociatedServiceImpl.count(queryWrapper);
pageBean.setTotal(num);
IPage<EquipmentAssociatedDto> result = BeanDtoVoUtils.iPageVoStream(page,EquipmentAssociatedDto.class);
return ResponseHelper.buildResponse(result);
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.RedisKey;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.UnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentServiceImpl;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
......@@ -49,6 +55,10 @@ public class EquipmentController extends BaseController {
@Autowired
EquipmentServiceImpl equipmentServiceImpl;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
/**
* 新增装备信息表
*
......@@ -108,6 +118,18 @@ public class EquipmentController extends BaseController {
return ResponseHelper.buildResponse(equipmentServiceImpl.deleteById(sequenceNbr));
}
/**
* 根据sequenceNbr删除
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/delete_batch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除装备信息", notes = "批量删除装备信息")
public ResponseModel<Boolean> deleteBySequenceNbr(@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(equipmentServiceImpl.batchDelete(sequenceNbrList));
}
/**
* 列表分页查询
......@@ -132,13 +154,26 @@ public class EquipmentController extends BaseController {
page = equipmentServiceImpl.page(pageBean, equipmentQueryWrapper);
int num= equipmentServiceImpl.count(equipmentQueryWrapper);
pageBean.setTotal(num);
IPage<EquipmentDto> equipmentDtoIPager = BeanDtoVoUtils.iPageVoStream(page,EquipmentDto.class);
IPage<EquipmentDto> equipmentDtoIPager = BeanDtoVoUtils.equipmentIPageDto(page);
return ResponseHelper.buildResponse(equipmentDtoIPager);
}
private QueryWrapper<Equipment> setQueryWrapper(QueryWrapper<Equipment> queryWrapper, EquipmentDto equipmentDto, String sort) {
queryWrapper.eq("is_delete", false);
// 获取用户所在单位 保存设备所属单位
OrgUsr myUnit = null;
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
for(CompanyModel c : companys) {
myUnit = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
}
if(myUnit == null) {
throw new BadRequest("该用户非企业人员无法查询企业设备");
}
queryWrapper.eq("equip_unit_id", myUnit.getSequenceNbr());
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
......@@ -163,12 +198,12 @@ public class EquipmentController extends BaseController {
if (!ValidationUtil.isEmpty(equipmentDto.getName())) { // 设备名称
queryWrapper.like("name",equipmentDto.getName());
}
if(!ValidationUtil.isEmpty(equipmentDto.getTypeId())) { // 设备种类
queryWrapper.eq("type_id",equipmentDto.getTypeId());
}
if(!ValidationUtil.isEmpty(equipmentDto.getCategoryId())) { // 设备类别
queryWrapper.eq("category_id",equipmentDto.getCategoryId());
}
if(!ValidationUtil.isEmpty(equipmentDto.getTypeId())) { // 设备种类
queryWrapper.eq("type_id",equipmentDto.getTypeId());
}
if(!ValidationUtil.isEmpty(equipmentDto.getVarietyId())) { // 设备品种
queryWrapper.eq("variety_id",equipmentDto.getVarietyId());
}
......
......@@ -386,4 +386,45 @@ public class UnitPersonController extends BaseController {
/**
* 监管端-根据当前登录人获取企业列表
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/companyTreeSup")
@ApiOperation(httpMethod = "GET",value = "监管端-根据当前登录人获取企业列表", notes = "监管端-根据当前登录人获取企业列表")
public ResponseModel<List<CompanyModel>> getUserUnitSup() throws Exception {
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
return ResponseHelper.buildResponse(companys);
}
/**
* 监管端-角色信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/listMyUnitRolesSup")
@ApiOperation(httpMethod = "GET",value = "监管端-获取本单位拥有的角色信息", notes = "监管端-获取本单位拥有的角色信息")
public ResponseModel<List<RoleModel>> listMyUnitRolesSup() {
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
List<RoleModel> allRoleList = roleListResult.getResult();
return ResponseHelper.buildResponse(allRoleList);
}
/**
* 监管端-应用信息
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/listMyUnitAppSup")
@ApiOperation(httpMethod = "GET",value = "监管端-获取本单位拥有的应用信息", notes = "监管端-获取本单位拥有的应用信息")
public ResponseModel<List<ApplicationModel>> listMyUnitAppSup() {
List<ApplicationModel> allApp = Privilege.applicationClient.queryAgencyApplications().getResult();
return ResponseHelper.buildResponse(allApp);
}
}
......@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
......@@ -12,12 +14,17 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentService;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList;
import java.util.List;
......@@ -42,6 +49,9 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Autowired
EquipmentIndexServiceImpl equipmentIndexServiceImpl;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
/**
* 分页查询
......@@ -60,9 +70,23 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
@Override
public EquipmentDto createEquipment(EquipmentDto model) {
model.setStatus(EquipmentStatusEnum.未安装.getCode()); // 0 未安装 1 已安装
// 获取用户所在单位 保存设备所属单位
OrgUsr myUnit = null;
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
List<CompanyModel> companys = user.getCompanys();
for(CompanyModel c : companys) {
myUnit = iOrgUsrService.getOne(new LambdaQueryWrapper<OrgUsr>().eq(OrgUsr::getIsDelete,false).eq(OrgUsr::getAmosOrgId,c.getSequenceNbr()));
}
if(myUnit == null) {
throw new BadRequest("该用户非企业人员无法添加设备");
}
model.setEquipUnitId(myUnit.getSequenceNbr());
model.setEquipUnit(myUnit.getBizOrgName());
model = this.createWithModel(model);
// 保存设备参数信息
List<EquipmentIndexDto> equipmentIndex = model.getEquipmentIndex();
if(equipmentIndex != null && equipmentIndex.size()>0) {
for(EquipmentIndexDto t : equipmentIndex) {
t.setEquipmentId(model.getSequenceNbr());
......@@ -137,6 +161,20 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
return result;
}
@Transactional
@Override
public Boolean batchDelete(List<Long> sequenceNbrList) {
for(Long sequenceNbr : sequenceNbrList) {
EquipmentDto equipmentDto = this.queryBySeq(sequenceNbr);
// 未安装设备可删除
if (!ValidationUtil.isEmpty(equipmentDto) && EquipmentStatusEnum.未安装.getCode().equals(equipmentDto.getStatus())) {
equipmentDto.setIsDelete(true);
this.updateWithModel(equipmentDto);
}
}
return true;
}
// 保存附件信息
public void saveSourceFile(EquipmentDto model) {
if (model.getAttachments() != null) {
......
......@@ -498,6 +498,9 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(company == null || company.getResult() == null) {
throw new BadRequest("所在单位选择有误");
}
OrgUsr oldInfo = iOrgUsrService.getById(unitPersonInfoDto.getSequenceNbr());
String originalPassword = oldInfo.getOrgExpandAttr2();
String amosId = oldInfo.getAmosOrgId();
unitPersonInfoDto.setParentName(company.getResult().getCompanyName());
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
......@@ -528,7 +531,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
// 更新人员资质信息
personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
if(personQualityDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
} else {
personQualityDto = flcPersonQualityServiceImpl.createWithModel(personQualityDto);
}
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo());
iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach);
......@@ -538,7 +546,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(personEducationDto != null) {
// 更新人员教育信息
personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
if(personEducationDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
} else {
personEducationDto = personEducationServiceImpl.createWithModel(personEducationDto);
}
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment());
iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach);
......@@ -554,49 +567,104 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
Long companyId = Long.parseLong(unitPersonInfoDto.getOrgExpandAttr3());
// 首先判断是否存在 用户信息, 如果不存在走新增方法
if(StringUtils.isNotEmpty(amosId)) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
Long companyId = Long.parseLong(unitPersonInfoDto.getOrgExpandAttr3());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = Privilege.agencyUserClient.queryByUserId(orgPersonVo.getAmosOrgId()).getResult();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setOriginalPassword(originalPassword);
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
Privilege.agencyUserClient.update(agencyUserModel,orgPersonVo.getAmosOrgId());
// 密码另外更新
Privilege.agencyUserClient.modifyPassword(orgPersonVo.getAmosOrgId(),agencyUserModel);
} else {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
Long companyId = Long.parseLong(unitPersonInfoDto.getOrgExpandAttr3());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.create(agencyUserModel);
agencyUserModel = userResult.getResult();
unitPersonInfoDto.setAmosOrgId(agencyUserModel.getUserId() + "");
orgPersonVo.setAmosOrgId(agencyUserModel.getUserId() + "");
iOrgUsrService.updateByIdOrgPersonFlc(orgPersonVo,unitPersonInfoDto.getSequenceNbr());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = Privilege.agencyUserClient.queryByUserId(orgPersonVo.getAmosOrgId()).getResult();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
}
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
Privilege.agencyUserClient.update(agencyUserModel,orgPersonVo.getAmosOrgId());
// 密码另外更新
Privilege.agencyUserClient.modifyPassword(orgPersonVo.getAmosOrgId(),agencyUserModel);
}
} catch (Exception e) {
e.printStackTrace();
......@@ -617,6 +685,9 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
}
// 只有parentId 需要手动填充name
OrgUsr parent = iOrgUsrService.getById(Long.parseLong(unitPersonInfoDto.getParentId()));
OrgUsr oldInfo = iOrgUsrService.getById(unitPersonInfoDto.getSequenceNbr());
String originalPassword = oldInfo.getOrgExpandAttr2();
String amosId = oldInfo.getAmosOrgId();
unitPersonInfoDto.setParentName(parent.getBizOrgName());
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
......@@ -647,7 +718,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
// 更新人员资质信息
personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
if(personQualityDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
} else {
personQualityDto = flcPersonQualityServiceImpl.createWithModel(personQualityDto);
}
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo());
iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach);
......@@ -657,7 +733,14 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(personEducationDto != null) {
// 更新人员教育信息
personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
if(personEducationDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
} else {
personEducationDto = personEducationServiceImpl.createWithModel(personEducationDto);
}
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment());
iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach);
......@@ -673,51 +756,100 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 首先判断是否存在 用户信息, 如果不存在走新增方法
if(StringUtils.isNotEmpty(amosId)) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = Privilege.agencyUserClient.queryByUserId(orgPersonVo.getAmosOrgId()).getResult();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setOriginalPassword(originalPassword);
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
Privilege.agencyUserClient.update(agencyUserModel,orgPersonVo.getAmosOrgId());
// 密码另外更新
Privilege.agencyUserClient.modifyPassword(orgPersonVo.getAmosOrgId(),agencyUserModel);
} else {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.create(agencyUserModel);
agencyUserModel = userResult.getResult();
unitPersonInfoDto.setAmosOrgId(agencyUserModel.getUserId() + "");
orgPersonVo.setAmosOrgId(agencyUserModel.getUserId() + "");
iOrgUsrService.updateByIdOrgPersonFlc(orgPersonVo,unitPersonInfoDto.getSequenceNbr());
}
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = Privilege.agencyUserClient.queryByUserId(orgPersonVo.getAmosOrgId()).getResult();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
Privilege.agencyUserClient.update(agencyUserModel,orgPersonVo.getAmosOrgId());
// 密码另外更新
Privilege.agencyUserClient.modifyPassword(orgPersonVo.getAmosOrgId(),agencyUserModel);
}
} catch (Exception e) {
e.printStackTrace();
......@@ -736,10 +868,21 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
break;
}
}
OrgUsr company = iOrgUsrService.getById(orgPerson.getParentId());
String qrString = "人员类型: " +personType +"\n\r";
qrString += "企业编码: " +company.getBizOrgCode() +"\n\r";
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r";
OrgUsr company = iOrgUsrService.getById(orgPerson.getParentId());
// 如果company 为空 说明是 监管端 需要获取组织机构树
if(company == null) {
FeignClientResult<CompanyModel> amosCompany = Privilege.companyClient.seleteOne(Long.parseLong(orgPerson.getParentId()));
if(amosCompany == null || amosCompany.getResult() == null) {
throw new BadRequest("所在单位有误");
}
qrString += "企业编码: " +amosCompany.getResult().getOrgCode()+"\n\r";
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r";
} else {
qrString += "企业编码: " +company.getBizOrgCode() +"\n\r";
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r";
}
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(qrString, 480);
MultipartFile file = new MockMultipartFile("person_" + orgPerson.getSequenceNbr() + ".png","person_" + orgPerson.getSequenceNbr() + ".png","application/octet-stream" ,bytes);
......
......@@ -58,6 +58,10 @@ mqtt.topic.alert.reporting=alertReporting
## 实战指挥新警情主题
mqtt.topic.command.alert.notice=alertNotice
mqtt.topic.command.alert.noticeData=alertNoticeData
mqtt.topic.command.alert.noticeJa=alertNoticeJa
## 跑马灯地震、天气预警信息
mqtt.topic.command.meteorological.notice=meteorological
......@@ -65,7 +69,8 @@ mqtt.topic.command.power.deployment=power
mqtt.topic.alert.iot=iot-system-alarm
mqtt.topic.alert.iot.web=iot-system-alarm-web
#警情预案匹配的消息topic名称
mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
security.systemctl.name=AMOS-API-SYSTEMCTL
......@@ -79,6 +84,8 @@ equip.fegin.name=AMOS-EQUIPMANAGE
## 设备联动服务(车库门、广播、警铃)
control.fegin.name=JCS-API-CONTROL
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 故障报修流程
failure.work.flow.processDefinitionKey=malfunction_repair
#设置文件上传的大小限制
......
......@@ -2357,6 +2357,27 @@
alter table `jc_controller` add column `fire_team_seq` varchar(22) DEFAULT NULL COMMENT '关联的消防队伍ID';
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-12-09-litengwei-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_alert_form" />
</preConditions>
<comment>update data jc_alert_form</comment>
<sql>
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code='PJPD', field_name='迫降跑道', field_code='forcedLandingTrack', field_type='select', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=6, url='' WHERE sequence_nbr=109;
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-12-09-1-1">
<preConditions onFail="MARK_RAN">
<not>
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="jc_template"/>
</not>
</preConditions>
<comment>insert data jc_template</comment>
<sql>
INSERT INTO `jc_template` (sequence_nbr, type_code, `type`, content, format, rec_user_name, rec_user_id, rec_date, is_delete) VALUES(27, 'JQCB', '警情初报统一模板', '【警情初报】时间:$callTime;地址:$address;发生【$type】警情 $replaceContent 被困人数:$trappedNum 伤亡人数:$casualtiesNum 发送单位:$companyName 联系人: $contactUser 联系电话: $contactPhone ', 0, NULL, NULL, NULL, 0);
</sql>
</changeSet>
</databaseChangeLog>
......@@ -9,6 +9,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
......@@ -20,6 +23,9 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
*/
@EnableScheduling
@EnableFeignClients
@EnableDiscoveryClient
@EnableEurekaClient
@EnableAsync
@MapperScan({"com.yeejoin.amos.knowledgebase.face.orm.dao*",
"org.typroject.tyboot.face.*.orm.dao*",
......
##开发环境配置文件
# jdbc_config
spring.datasource.url=jdbc:mysql://localhost:3306/safety-knowledge-3.0.0?characterEncoding=utf8&serverTimezone=Asia/Shanghai
spring.datasource.url=jdbc:mysql://172.16.6.60:3306/knowledge_base?characterEncoding=utf8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root_123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
......
......@@ -58,4 +58,5 @@ control.fegin.name=JCS-API-CONTROL
redis.cache.failure.time=10800
failure.work.flow.processDefinitionKey=malfunction_repair
video.fegin.name=video
latentDanger.feign.name=AMOS-LATENT-DANGER
\ No newline at end of file
latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
\ No newline at end of file
......@@ -467,6 +467,18 @@
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-12-07-01">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tcb_equipment"/>
</preConditions>
<comment>modify table tcb_equipment add equip_unit, equip_unit_id columns</comment>
<sql>
ALTER TABLE `tcb_equipment` add equip_unit_id bigint(32) COMMENT '设备所属单位id';
ALTER TABLE `tcb_equipment` add equip_unit varchar(104) COMMENT '设备所属单位';
</sql>
</changeSet>
</databaseChangeLog>
</databaseChangeLog>
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