Commit bfe763c3 authored by 李成龙's avatar 李成龙

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

新增装备工程 # Conflicts: # amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/config/MyBatisPlusConfig.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/feign/JcsFeignClient.java
parents 163597e3 40c750b9
package com.yeejoin.amos.boot.biz.common.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author DELL
*
* 注解在mapper方法上
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DataAuth {
/**
* 菜单组件
* @return
*/
String interfacePath() default "";
}
package com.yeejoin.amos.boot.biz.common.utils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.function.BiConsumer;
public class CommonUtils {
/**
* 带索引foreach
*
* @param <T>
* @param startIndex 开始遍历的索引
* @param elements 集合
* @param action
*/
public static <T> void forEach(int startIndex, Iterable<? extends T> elements, BiConsumer<Integer, ? super T> action) {
Objects.requireNonNull(elements);
Objects.requireNonNull(action);
if (startIndex < 0) {
startIndex = 0;
}
int index = 0;
for (T element : elements) {
index++;
if (index <= startIndex) {
continue;
}
action.accept(index - 1, element);
}
}
public static Object getFiledValueByName(String filedName, Object o) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
String firstLetter = filedName.substring(0, 1).toUpperCase();
String getterName = "get" + firstLetter + filedName.substring(1);
Method method;
method = o.getClass().getMethod(getterName, new Class[]{});
Object value = method.invoke(o, new Object[]{});
return value;
}
}
......@@ -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.biz.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptor;
/**
*
......@@ -55,6 +55,10 @@ public class MyBatisPlusConfig {
public void customize(MybatisConfiguration configuration) {
configuration.addInterceptor(new com.github.pagehelper.PageInterceptor());
}
};
};}
@Bean
public PermissionInterceptor permissionInterceptor() {
return new PermissionInterceptor();
}
}
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;
}
......@@ -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
......
......@@ -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.biz.common.feign.MultipartSupportConfig;
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
......@@ -209,7 +207,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) ;
......
......@@ -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;
}
......@@ -69,6 +69,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 ,
......@@ -134,6 +137,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 +728,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>
package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -18,7 +19,6 @@ import java.util.Date;
@ApiModel(value="AlertCalledZhDto", description=" 指挥警情接警记录")
public class AlertCalledZhDto {
@ApiModelProperty(value = "主键ID")
protected Long sequenceNbr;
......
......@@ -50,4 +50,7 @@ public class AlertSubmittedSMSDto {
@ApiModelProperty(value = "报送模板")
private String submissionTemplate;
@ApiModelProperty(value = "报送类型")
private String type;
}
......@@ -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">
......
......@@ -25,9 +25,21 @@ public enum LatentDangerLevelEnum {
重大隐患("重大隐患", "2", "2", 3);
/**
* 巡检枚举缓存
*/
public static Map<String, LatentDangerLevelEnum> patrolDangerLevelEnumMap = new HashMap<>();
static {
LatentDangerLevelEnum[] initEnum = LatentDangerLevelEnum.values();
for(LatentDangerLevelEnum _enum : initEnum) {
patrolDangerLevelEnumMap.put(_enum.getCode(), _enum);
}
}
/**
* 枚举缓存
*/
public static Map<String, LatentDangerLevelEnum> enumMap = new HashMap<>();
public static Map<String, LatentDangerLevelEnum> supervisionDangerLevelEnumMap = new HashMap<>();
public static final String dictCode = "_DANGER_LEVEL";
......@@ -76,7 +88,7 @@ public enum LatentDangerLevelEnum {
}
public static LatentDangerLevelEnum getEnumByOrder(Integer order) {
for (LatentDangerLevelEnum l : enumMap.values()) {
for (LatentDangerLevelEnum l : supervisionDangerLevelEnumMap.values()) {
if (order.equals(l.getOrder())) {
return l;
}
......@@ -91,7 +103,7 @@ public enum LatentDangerLevelEnum {
*/
public static LatentDangerLevelEnum getEnumByCode(String code) {
// 这里可以做一些修改 比如若从 enumMap 中没有取得 则加载配置动态添加
return enumMap.get(code);
return supervisionDangerLevelEnumMap.get(code);
}
public static LatentDangerLevelEnum addEnumDynamic(String enumName, String name, String code,
......@@ -100,7 +112,7 @@ public enum LatentDangerLevelEnum {
new Class[]{String.class, String.class, String.class, Integer.class}, new Object[]{name, code,
riskSourceDangerLevelCode, order});
if (!ValidationUtil.isEmpty(dangerLevelEnum)) {
enumMap.put(code, dangerLevelEnum);
supervisionDangerLevelEnumMap.put(code, dangerLevelEnum);
}
return dangerLevelEnum;
}
......
......@@ -36,9 +36,21 @@ public enum LatentDangerReformTypeEnum {
private String code;
/**
* 枚举缓存
* 巡检枚举缓存
*/
public static Map<String, LatentDangerReformTypeEnum> enumMap = new HashMap<>();
public static Map<String, LatentDangerReformTypeEnum> patrolReformTypeEnumMap = new HashMap<>();
static {
LatentDangerReformTypeEnum[] initEnum = LatentDangerReformTypeEnum.values();
for(LatentDangerReformTypeEnum _enum : initEnum) {
patrolReformTypeEnumMap.put(_enum.getCode(), _enum);
}
}
/**
* 防火监督枚举缓存
*/
public static Map<String, LatentDangerReformTypeEnum> supervisionReformTypeEnumMap = new HashMap<>();
public static final String dictCode = "_GOVERNANCE";
......@@ -70,14 +82,14 @@ public enum LatentDangerReformTypeEnum {
*/
public static LatentDangerReformTypeEnum getEnumByCode(String code) {
// 这里可以做一些修改 比如若从 enumMap 中没有取得 则加载配置动态添加
return enumMap.get(code);
return supervisionReformTypeEnumMap.get(code);
}
public static LatentDangerReformTypeEnum addEnumDynamic(String enumName, String name, String code) {
LatentDangerReformTypeEnum dangerReformTypeEnum = DynamicEnumUtil.addEnum(LatentDangerReformTypeEnum.class, enumName,
new Class[]{String.class, String.class}, new Object[]{name, code});
if (!ValidationUtil.isEmpty(dangerReformTypeEnum)) {
enumMap.put(code, dangerReformTypeEnum);
supervisionReformTypeEnumMap.put(code, dangerReformTypeEnum);
}
return dangerReformTypeEnum;
}
......
......@@ -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;
}
......
......@@ -120,7 +120,7 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
}
if(!"0".equals(address.getString(BizConstant.LATITUDE))) {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}
}
......@@ -147,7 +147,7 @@ public class FireStationServiceImpl extends BaseService<FireStationDto, FireStat
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
}
if(!"0".equals(address.getString(BizConstant.LATITUDE))) {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}
......
......@@ -664,23 +664,26 @@ public class MaintenanceCompanyServiceImpl
* @return
*/
public MaintenanceCompany getMaintenanceCompany(String amosUserId) {
MaintenanceCompany maintenanceCompany;
DynamicFormInstance dyFormInstance = dynamicFormInstanceService.getOne(
new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getFieldCode, "amosAccount")
.eq(DynamicFormInstance::getFieldValue, amosUserId));
if (ValidationUtil.isEmpty(dyFormInstance)) {
throw new BadRequest("维保账号不存在或未关联系统账号.");
}
MaintenanceCompany person = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
.eq(MaintenanceCompany::getInstanceId, dyFormInstance.getInstanceId()));
if (ValidationUtil.isEmpty(person)) {
throw new BadRequest("维保账号不存在或未关联系统账号.");
}
maintenanceCompany = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
.eq(MaintenanceCompany::getSequenceNbr, person.getParentId()));
LambdaQueryWrapper<MaintenanceCompany> wrapper = new LambdaQueryWrapper<MaintenanceCompany>();
wrapper.eq(MaintenanceCompany::getIsDelete, false);
wrapper.eq(MaintenanceCompany::getAmosId, amosUserId);
MaintenanceCompany maintenanceCompany = this.baseMapper.selectOne(wrapper);
// DynamicFormInstance dyFormInstance = dynamicFormInstanceService.getOne(
// new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getFieldCode, "amosAccount")
// .eq(DynamicFormInstance::getFieldValue, amosUserId));
if (ValidationUtil.isEmpty(maintenanceCompany)) {
throw new BadRequest("维保账号不存在或未关联系统账号.");
}
// MaintenanceCompany person = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
// .eq(MaintenanceCompany::getInstanceId, dyFormInstance.getInstanceId()));
// if (ValidationUtil.isEmpty(person)) {
// throw new BadRequest("维保账号不存在或未关联系统账号.");
// }
// maintenanceCompany = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
// .eq(MaintenanceCompany::getSequenceNbr, person.getParentId()));
// if (ValidationUtil.isEmpty(maintenanceCompany)) {
// throw new BadRequest("维保账号不存在或未关联系统账号.");
// }
return maintenanceCompany;
}
......
......@@ -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,12 +403,16 @@ 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");
req.remove("parentId");
req.remove("amosOrgId");
map.put("fieldsValue", req);
map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode()));
pageBean.setTotal(this.baseMapper.selectPersonListCount(map));
......@@ -544,7 +550,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 +558,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 +569,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 +2043,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);
}
}
......@@ -8,9 +8,7 @@ import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.*;
import java.util.concurrent.TimeUnit;
/**
......@@ -26,13 +24,34 @@ public class SocketClient {
"D:\\ffmpeg-4.4-full_build-shared\\bin\\record2.pcm",
};
public static void main(String[] args) {
public static void main(String[] args) throws SocketException {
SocketClient socketClient = new SocketClient();
socketClient.process(0, 0);
//socketClient.processTcp(0, 0);
socketClient.processUdp(10001, 2);
}
@Async
public void process(int port, int type) {
public void processUdp(int port, int type) throws SocketException {
if (type < 0) type = 0;
if (type >= testFilePath.length) type -= 1;
DatagramSocket datagramSocket = new DatagramSocket();
try {
FileInputStream fis = new FileInputStream(new File(testFilePath[type]));
byte[] b = new byte[4096];
int len;
while ((len = fis.read(b)) > 0) {
logger.info("send data pack length: " + len);
datagramSocket.send(new DatagramPacket(b, b.length,InetAddress.getLocalHost(), port));
TimeUnit.MILLISECONDS.sleep(200);
}
datagramSocket.close();
} catch (Exception e) {
e.printStackTrace();
}
}
@Async
public void processTcp(int port, int type) {
if (type < 0) type = 0;
if (type >= testFilePath.length) type -= 1;
......
......@@ -7,14 +7,23 @@ import com.yeejoin.amos.speech.AppSpeechTranscriber;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
/**
* 实时语音转文字
......@@ -22,10 +31,19 @@ import java.util.List;
@Component
public class RealTimeStream2Text {
private static final Logger logger = LoggerFactory.getLogger(RealTimeStream2Text.class);
public static int serverPort = 10001;
public static int serverPort = 25000;
@Autowired
private EmqKeeper emqKeeper;
EmqKeeper emqKeeper;
@Autowired
RestTemplate restTemplate;
@Value("${ifc.url}")
String audioSystemAddress;
@Value("${ifc.call-back.localIp}")
String localIpAddress;
/**
* 开始语音转文字
......@@ -35,25 +53,35 @@ public class RealTimeStream2Text {
*/
public HashMap<String, Object> doTranslate(String cid, String myNumber, String callerNumber) {
//启动两个监听端口监听推送进来的2路语音流
ServerSocket serverSocket1 = initServerSocketPort();
ServerSocket serverSocket2 = initServerSocketPort();
DatagramSocket serverSocket1 = initServerSocketPort();
DatagramSocket serverSocket2 = initServerSocketPort();
//识别的记录
List<AudioRecord> audioRecords = new ArrayList<>();
//识别的关键字
AudioKeyWord audioKeyWord = new AudioKeyWord();
logger.warn("myNumber监听的端口为:" + serverSocket1.getLocalPort() + " callerNumber监听的端口为:" + serverSocket2.getLocalPort());
//我的语音流
Thread thread1 = new Thread(() -> {
new AppSpeechTranscriber(new RealTimeSpeechTranscriberListener(myNumber, myNumber, emqKeeper, audioRecords, audioKeyWord), serverSocket1).process();
});
Thread thread1 =
new Thread(() -> {
new AppSpeechTranscriber(
new RealTimeSpeechTranscriberListener(myNumber, myNumber, emqKeeper, audioRecords, audioKeyWord),
serverSocket1, localIpAddress)
.process();
}, "我的语音流");
//呼入的语音流
Thread thread2 = new Thread(() -> {
new AppSpeechTranscriber(new RealTimeSpeechTranscriberListener(myNumber, callerNumber, emqKeeper, audioRecords, audioKeyWord), serverSocket2).process();
});
Thread thread2 =
new Thread(() -> {
new AppSpeechTranscriber(
new RealTimeSpeechTranscriberListener(myNumber, callerNumber, emqKeeper, audioRecords, audioKeyWord),
serverSocket2, localIpAddress)
.process();
}, "呼入的语音流");
thread1.setUncaughtExceptionHandler(new SubUncaughtExceptionHandler(serverSocket1));
thread2.setUncaughtExceptionHandler(new SubUncaughtExceptionHandler(serverSocket2));
thread1.start();
thread2.start();
startNotifyAudioStreamSystem(cid, myNumber, serverSocket1.getLocalPort());
startNotifyAudioStreamSystem(cid, callerNumber, serverSocket2.getLocalPort());
HashMap<String, Object> map = new HashMap<>();
map.put(myNumber, serverSocket1.getLocalPort());
map.put(callerNumber, serverSocket2.getLocalPort());
......@@ -61,15 +89,54 @@ public class RealTimeStream2Text {
}
/**
* 获取一个ServerSocket端口号
* @param cid 会议ID
* @param number 需要的号码的音频流
* @param port 推流端口
*/
private ServerSocket initServerSocketPort() {
@Async
public void startNotifyAudioStreamSystem(String cid, String number, int port) {
try {
HttpHeaders httpHeaders = new HttpHeaders();
LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add("cid", cid);
map.add("number", number);
map.add("codec", "PCM");
map.add("uuid", UUID.randomUUID().toString());
//map.add("dstip", InetAddress.getLocalHost().getHostAddress());
map.add("dstip", localIpAddress);
map.add("dstport", String.valueOf(port));
map.add("marker", "amos");
httpHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpEntity<LinkedMultiValueMap<String, Object>> linkedMultiValueMapHttpEntity = new HttpEntity<>(map, httpHeaders);
ResponseEntity<AudioResponseEntity> audioResponseEntity = restTemplate.postForEntity(
audioSystemAddress + "/StartPushingVoiceStream", linkedMultiValueMapHttpEntity, AudioResponseEntity.class);
AudioResponseEntity responseEntityBody = audioResponseEntity.getBody();
if (responseEntityBody == null) {
logger.error("调用语音融合系统接口获取音频流返回异常:响应体为空");
return;
}
if (responseEntityBody.getState() == 200) {
logger.warn("调用语音融合系统接口获取音频流返回正常:结果:" + responseEntityBody.toString());
} else {
logger.error("调用语音融合系统接口获取音频流返回异常:响应码:" + responseEntityBody.getState());
logger.error("调用语音融合系统接口获取音频流返回异常:失败原因:" + responseEntityBody.getDescribe());
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
}
}
/**
* 获取一个ServerSocket
*/
private DatagramSocket initServerSocketPort() {
while (true) {
try {
return new ServerSocket(serverPort);
} catch (IOException exception) {
return new DatagramSocket(serverPort);
} catch (SocketException exception) {
serverPort++;
if (serverPort == 65535) serverPort = 10000;
if (serverPort == 27999) serverPort = 25000;
}
}
}
......@@ -79,22 +146,60 @@ public class RealTimeStream2Text {
*/
static class SubUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(SubUncaughtExceptionHandler.class);
ServerSocket serverSocket;
DatagramSocket serverSocket;
public SubUncaughtExceptionHandler(ServerSocket serverSocket) {
public SubUncaughtExceptionHandler(DatagramSocket serverSocket) {
this.serverSocket = serverSocket;
}
@Override
public void uncaughtException(Thread t, Throwable e) {
if (serverSocket != null && !serverSocket.isClosed()) {
try {
serverSocket.close();
logger.error("子线程出现异常,已关闭音频监听端口。" + e.getMessage());
} catch (IOException exception) {
exception.printStackTrace();
}
serverSocket.close();
logger.error("子线程出现异常,已关闭音频监听端口。" + e.getMessage());
}
}
}
/**
* 语音融合系统响应体
*/
static class AudioResponseEntity {
private int state;
private String describe;
private Object data;
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
@Override
public String toString() {
return "AudioResponseEntity{" +
"state=" + state +
", describe='" + describe + '\'' +
", data=" + data +
'}';
}
}
}
......@@ -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);
......
......@@ -8,8 +8,11 @@ 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;
......@@ -21,6 +24,7 @@ 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;
......@@ -54,6 +58,7 @@ 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;
......@@ -69,7 +74,7 @@ import io.swagger.annotations.ApiOperation;
@Api(tags = "警情接警记录Api")
@RequestMapping(value = "/alert-called")
public class AlertCalledController extends BaseController {
private final Logger logger = LogManager.getLogger(AlertCalledController.class);
@Autowired
LatentDangerFeignClient latentDangerFeignClient;
@Autowired
......@@ -92,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;
/**
* 新增警情接警记录
*
......@@ -135,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删除
*
......
......@@ -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();
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.module.jcs.biz.audioToText.streamToText.RealTimeStream2Text;
import com.yeejoin.amos.boot.module.jcs.biz.audioToText.SocketClient;
import com.yeejoin.amos.boot.module.jcs.biz.audioToText.streamToText.RealTimeStream2Text;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.net.SocketException;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
@RestController
@Api(tags = "语音转文字Api")
......@@ -26,67 +26,58 @@ public class Audio2TextController {
@Autowired
SocketClient socketClient;
/**
* 第一步收到转换请求后,启动两个serverSocket,监听不同端口
* 第一步调用语音融合系统的API并传递两个监听的端口号和本机IP地址
* 第三步serverSocket收到数据请求,开始将数据推至阿里云语音识别系统进行识别
* 第四步回调函数中获取识别结果,使用mqtt客户端推送至mqtt服务器
* 第五步前端订阅消息并进行展示
*
* @param cid 通话id
* @param myNumber 我的手机号
* @param callerNumber 呼入手机号
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/startConvertAndSendAudio")
@ApiOperation(httpMethod = "GET", value = "测试语音转文字融合接口", notes = "测试语音转文字融合接口")
public HashMap<String, Object> startConvertAndSendAudio(@RequestParam String cid, @RequestParam String myNumber, @RequestParam String callerNumber) {
HashMap<String, Object> convert = audio2Text.doTranslate(cid, myNumber, callerNumber);
/* try {
TimeUnit.SECONDS.sleep(1);
socketClient.process((Integer) convert.get(myNumber), 2);
socketClient.process((Integer) convert.get(callerNumber), 3);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
return convert;
}
/**
* 测试语音转文字第一步
* 测试语音转文字分步接口第一步
*
* @param myNumber 我的手机号
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/startConvert")
@ApiOperation(httpMethod = "GET", value = "测试语音转文字第一步", notes = "number为当前用户的手机号")
@ApiOperation(httpMethod = "GET", value = "测试语音转文字分步接口第一步", notes = "测试语音转文字分步接口第一步")
public HashMap<String, Object> startConvert(@RequestParam String myNumber, @RequestParam String callerNumber) {
return audio2Text.doTranslate("", myNumber, callerNumber);
}
/**
* 测试语音转文字第二步
* 测试语音转文字分步接口第二步
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/startSendAudio")
@ApiOperation(httpMethod = "GET", value = "测试语音转文字第二步", notes = "测试语音转文字第二步")
@ApiOperation(httpMethod = "GET", value = "测试语音转文字分步接口第二步", notes = "测试语音转文字分步接口第二步")
public String startSendAudio(@RequestParam int port, Integer type) {
if (type == null) type = 0;
socketClient.process(port, type);
return "success";
}
/**
* 测试语音转文字融合接口
*
* @param myNumber 我的手机号
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/startConvertAndSendAudio")
@ApiOperation(httpMethod = "GET", value = "测试语音转文字融合接口", notes = "测试语音转文字融合接口")
public HashMap<String, Object> startConvertAndSendAudio(@RequestParam String myNumber, @RequestParam String callerNumber) {
HashMap<String, Object> convert = audio2Text.doTranslate("", myNumber, callerNumber);
try {
TimeUnit.SECONDS.sleep(1);
socketClient.process((Integer) convert.get(myNumber), 2);
socketClient.process((Integer) convert.get(callerNumber), 3);
} catch (InterruptedException e) {
socketClient.processUdp(port, type);
} catch (SocketException e) {
e.printStackTrace();
}
return convert;
}
/**
* 第一步收到转换请求后,启动两个serverSocket,监听不同端口
* 第一步调用语音融合系统的API并传递两个监听的端口号和本机IP地址
* 第三步serverSocket收到数据请求,开始将数据推至阿里云语音识别系统进行识别
* 第四步回调函数中获取识别结果,使用mqtt客户端推送至mqtt服务器
* 第五步前端订阅消息并进行展示
*
* @param cid 通话id
* @param myPhone 我的手机号
* @param caller 呼入手机号
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/startConvertText")
@ApiOperation(httpMethod = "GET", value = "接听电话回调后端开始转文字", notes = "接听电话回调后端开始转文字")
public void startConvertText(String cid, String myPhone, String caller) {
return "success";
}
}
......
......@@ -7,7 +7,9 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.jcs.api.dto.FusionDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FusionServiceImpl;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.VoiceRecordFileServiceImpl;
......@@ -23,7 +25,9 @@ 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.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -42,7 +46,8 @@ public class FusionController extends BaseController {
@Autowired
VoiceRecordFileServiceImpl voiceRecordFileService;
@Autowired
IAlertCalledService iAlertCalledService;
/**
* 查询用户详情
*
......@@ -57,6 +62,50 @@ public class FusionController extends BaseController {
}
/**
*
*
* 800M40M 录音文件
*
* */
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "get",value = "800M40M录音文件", notes = "800M40M录音文件")
@GetMapping (value = "/getCarList/{id}")
public ResponseModel<JSONObject> getCarList( @PathVariable Long id
) {
//获取警情
AlertCalled alertCalled=iAlertCalledService.getAlertCalledById(id);
SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String beginTime=null;
String endTime=null;
//获取警情上报时间
beginTime=formatter.format(alertCalled.getCallTime());
if(alertCalled.getAlertStatus()){
endTime=formatter.format(alertCalled.getUpdateTime());
}else{
endTime=formatter.format(new Date());
}
JSONObject carList = fusionService.selectAudioVideoRecords( 1,
1000,
beginTime,
endTime,
null,
null,
null,
9);
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)) {
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -124,12 +121,21 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@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;
......@@ -254,6 +260,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
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);
......@@ -367,7 +385,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, true);
emqKeeper.getMqttClient().publish(topic1, "1".getBytes(), RuleConfig.DEFAULT_QOS, false);
} else {
// 警情报送
// ****************************************************待确认开发
......@@ -392,19 +410,28 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto, AlertBusinessTypeEnum.警情初报.getCode(),
null, null, null);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
//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), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
}
// toSendCompletePoliceSituationMatch(alertCalled.getSequenceNbr());
return alertCalledObjsDto;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
/**
* 根据id 修改警情 type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*/
......@@ -971,6 +998,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@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();
......@@ -984,9 +1012,12 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
break;
}
}
return getIdsList1( alertCalled.getAlertTypeCode() ,AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
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 = "";
......@@ -995,12 +1026,15 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
condition2 = condition1 + i.getValue();
}
}
return getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
result= getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1,
AlertStageEnums.航空器救援子类.getValue() + "," + condition2, null);
} else {
String condition1 = alertCalled.getAlertType();
return getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1, null, null);
result= getIdsList1(alertCalled.getAlertTypeCode(),AlertStageEnums.救援预案警情类型.getValue() + "," + condition1, null, null);
}
return result;
}
// private List<Map<String, Object>> getIdsList(String condition1, String condition2, String condition3) {
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.deepoove.poi.XWPFTemplate;
......@@ -27,6 +28,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 +156,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 +192,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 +223,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 +297,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 +515,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -492,7 +531,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
@Transactional(rollbackFor = Exception.class)
public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
try { Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String alertWay = "";
Map<String,String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>();
......@@ -619,6 +658,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆
......@@ -643,6 +688,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// powerTransferCompanyResourcesService.update(new UpdateWrapper<PowerTransferCompanyResources>().eq("resources_id", transferCarIdList).set("status", FireCarStatusEnum.返队.getCode()));
}
//警情結案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//tuisongxinjingqing
RequestData par=new RequestData();
par.setAlertId(alertSubmittedDto.getAlertCalledId());
List<AlertCalledZhDto> list4 = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json=list4!=null&&list4.size()>0?JSONObject.toJSONString(list4.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
emqKeeper.getMqttClient().publish(topicJa, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
// 4.发送任务消息
// 4.1组织短信内容 废弃
......@@ -658,6 +719,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,","));
return map;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("报送失败,系统异常!");
}
}
public void generateMob(AlertCalled alertCalled) throws ParseException, FileNotFoundException {
......@@ -848,14 +913,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");
}
}
}
......
......@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.ControllerEquipMapper;
*/
@Service
public class ControllerEquipServiceImpl extends BaseService<ControllerEquipDto, ControllerEquip, ControllerEquipMapper> implements IControllerEquipService {
@Autowired
JcsControlServerClient jcsControlServerClient;
......
......@@ -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/selectCallRecordByConditions", 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)) {
......
......@@ -4,6 +4,8 @@ import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -75,6 +77,10 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
TemplateServiceImpl templateService;
@Autowired
DutyCarServiceImpl iDutyCarService;
@Autowired
AlertFormValueServiceImpl alertFormValueService;
@Autowired
......@@ -110,6 +116,9 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
@Autowired
ControllerServiceImpl controllerServiceImpl;
@Autowired
private AircraftServiceImpl aircraftServiceImpl;
@Override
public PowerTransferSimpleDto getPowerTransferList(Long alertCalledId) {
List<PowerTransferCompanyResourcesDto> powerTransferList = this.baseMapper.getPowerTransferList(alertCalledId);
......@@ -162,7 +171,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
// 发送调派通知
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, false);
} catch (MqttException e) {
throw new RuntimeException();
}
......@@ -187,16 +196,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());
}
}
......@@ -267,13 +276,19 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
if (appleMap != null) {
String state = appleMap.containsKey(car.get("id")) ? appleMap.get(car.get("id")) : null;
fireCarDto.setCarState(state);
fireCarDto
.setCarStateDesc(state != null ? FireCarStatusEnum.getEnum(state).getName() : null);
fireCarDto.setCarStateDesc(state != null ? FireCarStatusEnum.getEnum(state).getName() : null);
} else {
fireCarDto.setCarState(null);
fireCarDto.setCarStateDesc(null);
}
}
if (fireCarDto.getId() != null) {
int num = 0;
num = iDutyCarService.getDutyCarCount(Long.valueOf(fireCarDto.getId()));
fireCarDto.setPersonCount(num);
}
fireCarDtoList.add(fireCarDto);
});
}
......@@ -406,12 +421,20 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
if (null != alertCalled) {
replaceContent = RuleAlertCalledService.init(alertCalledRo, alertCalledObjsDto);
}
List<AlertFormValue> alertFormValue = alertCalledObjsDto.getAlertFormValue();
String responseLevel = "";
List<AlertFormValue> list1 = alertFormValue.stream().filter(formValue -> formValue.getFieldCode().equals("responseLevel") ).collect(Collectors.toList());;
if(list1.size() > 0) {
responseLevel = list1.get(0).getFieldValue();
}
definitions.put("rescueGrid", alertCalled.getAddress());
definitions.put("type", alertCalled.getAlertType());
definitions.put("contactUser", alertCalled.getContactUser());
definitions.put("contactPhone", alertCalled.getContactPhone());
definitions.put("type", alertCalled.getAlertType());
definitions.put("replaceContent", replaceContent);
definitions.put("responseLevel", responseLevel);
definitions.put("callTime",
DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
for (PowerTransferCompanyDto powerTransferCompanyDto : powerTransferCompanyDotList) {
......@@ -535,7 +558,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());
......
......@@ -19,7 +19,6 @@ import com.yeejoin.amos.latentdanger.business.util.CommonResponseUtil;
import com.yeejoin.amos.latentdanger.business.util.FileHelper;
import com.yeejoin.amos.latentdanger.business.vo.DangerTimeAxisVo;
import com.yeejoin.amos.latentdanger.business.vo.LatentDangerDetailVo;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerLevelEnum;
import com.yeejoin.amos.latentdanger.core.common.response.DangerListResponse;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import io.swagger.annotations.Api;
......@@ -241,9 +240,6 @@ public class LatentDangerController extends BaseController {
@PostMapping(value = "/page/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel listDanger(@ApiParam(value = "查询条件", required = true) @RequestBody PageParam pageParam) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
pageParam.put("orgCode", loginOrgCode);
IPage<LatentDanger> result = iLatentDangerService.pageListDanger(pageParam);
return ResponseHelper.buildResponse(result);
}
......@@ -343,9 +339,6 @@ public class LatentDangerController extends BaseController {
@PostMapping(value = "/supervision/page/reviewList")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel reviewListDanger(@ApiParam(value = "查询条件", required = true) @RequestBody PageParam pageParam) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
pageParam.put("orgCode", loginOrgCode);
IPage<LatentDanger> result = iLatentDangerService.reviewListDanger(pageParam);
return ResponseHelper.buildResponse(result);
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.latentdanger.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerBo;
import com.yeejoin.amos.latentdanger.business.entity.mybatis.extend.LatentDangerNoticeBo;
import com.yeejoin.amos.latentdanger.business.param.LatentDangerListParam;
......@@ -79,6 +80,7 @@ public interface LatentDangerMapper extends BaseMapper<LatentDanger> {
* @param paramMap
* @return
*/
@DataAuth(interfacePath = "latent/danger/page/list")
IPage<LatentDanger> selectPageByParam(@Param("page") Page<LatentDanger> page, @Param("paramMap") Map<String, Object> paramMap);
Integer selectUnFinishedCount(@Param("dangerState1") List<String> dangerState1, @Param("dangerState2") List<String> dangerState2);
......
package com.yeejoin.amos.latentdanger.business.feign;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.cloud.openfeign.FeignClient;
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.RequestMethod;
......@@ -23,4 +25,11 @@ public interface JcsFeignClient {
**/
@RequestMapping(value = "/org-usr/amos/{orgUserId}", method = RequestMethod.GET)
ResponseModel<AgencyUserModel> getAmosIdByUserId(@PathVariable String orgUserId);
/**
* 查询用户单位信息
* @return ResponseModel<ReginParams.PersonIdentity>
*/
@GetMapping(value = "/org-usr/getLoginUserDetails")
FeignClientResult getJcsUser();
}
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.latentdanger.core.aop;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.latentdanger.business.constants.Constants;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerLevelEnum;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerReformTypeEnum;
import org.aspectj.lang.JoinPoint;
......@@ -17,7 +16,6 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
......@@ -43,14 +41,14 @@ public class EnumFillAop {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// 获取隐患等级枚举
synchronized (this) {
if (ValidationUtil.isEmpty(LatentDangerLevelEnum.enumMap)) {
if (ValidationUtil.isEmpty(LatentDangerLevelEnum.supervisionDangerLevelEnumMap)) {
List<DictionarieValueModel> dicResult =
Systemctl.dictionarieClient.dictValues(bizType + LatentDangerLevelEnum.dictCode).getResult();
dicResult.forEach(dic -> LatentDangerLevelEnum.addEnumDynamic(dic.getDictDataDesc(), dic.getDictDataValue(), dic.getDictDataKey(),
"", dic.getOrderNum()));
}
// 获取治理方式枚举
if (ValidationUtil.isEmpty(LatentDangerReformTypeEnum.enumMap)) {
if (ValidationUtil.isEmpty(LatentDangerReformTypeEnum.supervisionReformTypeEnumMap)) {
List<DictionarieValueModel> dicResult =
Systemctl.dictionarieClient.dictValues(bizType + LatentDangerReformTypeEnum.dictCode).getResult();
dicResult.forEach(dic -> LatentDangerReformTypeEnum.addEnumDynamic(dic.getDictDataDesc(), dic.getDictDataValue(), dic.getDictDataKey()));
......
......@@ -219,12 +219,9 @@ public class InputItemController extends AbstractBaseController {
@ApiOperation(value = "分页查询检查项", notes = "分页查询检查项")
@RequestMapping(value = "/queryItemByPage", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryItemByPage(
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("orgCode", loginOrgCode);
@ApiParam(value = "组合查询条件", defaultValue = "[]") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
HashMap<String, Object> paramMap = new HashMap<>();
InputItemPageParam criterias = InputItemParamUtil.fillInputItemPageParam(queryRequests, pageable, paramMap);
Page<InputItemVo> page = inputItemService.queryInputItemByPage(criterias);
return CommonResponseUtil.success(page);
......
......@@ -52,13 +52,14 @@ public class PlanController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡检计划查询", notes = "巡检计划查询")
@RequestMapping(value = "/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@PersonIdentify
public CommonResponse qryCheckInfoPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, null);
// ReginParams reginParams = getSelectedOrgInfo();
// String loginOrgCode = getOrgCode(reginParams);
// HashMap<String, Object> paramMap = buildMybatisCriterias(loginOrgCode, null);
// buildRequestCxt();
PlanInfoPageParam param = PlanPageParamUtil.fillPlanInfoParam(queryRequests, commonPageable, paramMap);
PlanInfoPageParam param = PlanPageParamUtil.fillPlanInfoParam(queryRequests, commonPageable, new HashMap<>());
Page<HashMap<String, Object>> list = planService.getPlanInfo(param);
return CommonResponseUtil.success(list);
}
......
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.supervision.business.vo.CodeOrderVo;
import com.yeejoin.amos.supervision.business.vo.PlanTaskVo;
import com.yeejoin.amos.supervision.business.vo.PointInputItemVo;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.supervision.core.framework.PersonIdentify;
import com.yeejoin.amos.supervision.exception.YeeException;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import org.slf4j.Logger;
......@@ -481,6 +482,7 @@ public class PlanTaskController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防监督任务查询-mobile", notes = "根据用户条件查询所有计划任务")
@RequestMapping(value = "/queryPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
@PersonIdentify
public ResponseModel qryLoginUserPlanTask(
@ApiParam(value = "人员") @RequestParam(value = "userId", required = false) Long userId,
@ApiParam(value = "开始日期") @RequestParam(value = "startTime", required = false) String startTime,
......
......@@ -4,6 +4,7 @@ package com.yeejoin.amos.supervision.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.supervision.business.dto.CheckReportMapperDto;
import com.yeejoin.amos.supervision.core.common.dto.CheckReportCompanyDto;
import com.yeejoin.amos.supervision.core.common.dto.CheckReportDto;
......@@ -21,6 +22,7 @@ public interface CheckReportMapper extends BaseMapper<CheckReport> {
*/
CheckReportMapperDto queryByPlanTaskId(long id);
@DataAuth(interfacePath = "supervision/check/report/page")
IPage<CheckReportDto> selectPageList(Page page, @Param("queryParam") CheckReportParamDto queryParam);
CheckReportDto selectDetailById(@Param("checkReportId") Long id);
......
package com.yeejoin.amos.supervision.business.dao.mapper;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.supervision.business.param.InputItemPageParam;
import com.yeejoin.amos.supervision.business.vo.InputItemVo;
import com.yeejoin.amos.supervision.business.vo.PointInputItemVo;
......@@ -17,8 +18,10 @@ public interface InputItemMapper {
List<HashMap<String, Object>> countByCatalogId(HashMap<String, Object> paramMap);
@DataAuth(interfacePath = "api/inputItem/queryItemByPage")
long countInputItemInfoData(InputItemPageParam param);
@DataAuth(interfacePath = "api/inputItem/queryItemByPage")
List<InputItemVo> getInputItemInfo(InputItemPageParam param);
List<InputItemVo> getInputItemListByNames(@Param("itemNames") String[] items, @Param("orgCode") String orgCode);
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.supervision.business.dao.mapper;
import java.util.HashMap;
import java.util.List;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.supervision.business.param.PlanInfoPageParam;
......@@ -26,12 +27,14 @@ public interface PlanMapper extends BaseMapper {
* @param param
* @return
*/
@DataAuth(interfacePath = "supervision/api/plan/list")
long countPlanInfoData(PlanInfoPageParam param);
/**
* 按照查询巡检计划概要列表
* @param param
* @return
*/
@DataAuth(interfacePath = "supervision/api/plan/list")
List<HashMap<String, Object>> getPlanInfo(PlanInfoPageParam param);
/**
* 按照查询巡检计划概不分页
......
package com.yeejoin.amos.supervision.business.dao.mapper;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.supervision.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.supervision.business.entity.mybatis.PlanTaskPointInputItemBo;
import com.yeejoin.amos.supervision.business.entity.mybatis.PointCheckDetailBo;
......@@ -77,6 +78,7 @@ public interface PlanTaskMapper extends BaseMapper {
* @param params
* @return
*/
@DataAuth(interfacePath = "api/planTask/queryPlanTask")
List<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params);
/**
......@@ -153,6 +155,7 @@ public interface PlanTaskMapper extends BaseMapper {
*/
List<CheckChkExListBo> getChkExList(CheckPtListPageParam param);
@DataAuth(interfacePath = "api/planTask/queryPlanTask")
long getPlanTasksCount(HashMap<String, Object> params);
Map<String, Object> getPlanTaskStatisticsForApp(HashMap<String, Object> params);
......
......@@ -5,9 +5,6 @@ import lombok.Data;
/**
* @author keyong
* @title: LatentDangerPatrolItemParam
* <pre>
* @description: TODO
* </pre>
* @date 2021/1/26 14:48
*/
@Data
......
......@@ -68,6 +68,11 @@ public class PlanInfoPageParam extends CommonPageable {
*/
private int finishStatus;
/**
* 登录用户id
*/
private String loginUserId;
public String getOwnerId() {
return ownerId;
}
......@@ -155,4 +160,12 @@ public class PlanInfoPageParam extends CommonPageable {
public void setFinishStatus(int finishStatus) {
this.finishStatus = finishStatus;
}
public String getLoginUserId() {
return loginUserId;
}
public void setLoginUserId(String loginUserId) {
this.loginUserId = loginUserId;
}
}
......@@ -12,7 +12,11 @@ import com.yeejoin.amos.boot.biz.common.excel.DataSources;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.supervision.business.dao.mapper.HiddenDangerMapper;
import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.dao.repository.ICheckInputDao;
import com.yeejoin.amos.supervision.business.dao.repository.ICheckShotDao;
import com.yeejoin.amos.supervision.business.dao.repository.IHiddenDangerDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanDao;
import com.yeejoin.amos.supervision.business.dao.repository.IPointDao;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerExportDataDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerImportDto;
......@@ -23,7 +27,11 @@ import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.DangerHandleTypeEnum;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.dao.entity.*;
import com.yeejoin.amos.supervision.dao.entity.CheckInput;
import com.yeejoin.amos.supervision.dao.entity.CheckShot;
import com.yeejoin.amos.supervision.dao.entity.HiddenDanger;
import com.yeejoin.amos.supervision.dao.entity.Plan;
import com.yeejoin.amos.supervision.dao.entity.Point;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -33,7 +41,12 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -274,6 +287,8 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("accompanyingUserName", plan.getLeadPeopleNames());
result.put("checkUnitId",plan.getCheckUnitId());
result.put("checkUnitName",plan.getCheckUnitName());
result.put("leadPeopleId", plan.getLeadPeopleIds());
result.put("leadPeopleName", plan.getLeadPeopleNames());
this.buildCheckInfo(result, hiddenDangerDto.getCheckInputId());
return result;
}
......
......@@ -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;
}
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
......@@ -7,6 +8,8 @@ import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
......@@ -99,8 +102,14 @@ public class PlanServiceImpl implements IPlanService {
@Autowired
private IPlanAuditLogDao planAuditLogDao;
@Autowired
RedisUtils redisUtils;
@Override
public Page<HashMap<String, Object>> getPlanInfo(PlanInfoPageParam param) {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId()
, RequestContext.getToken())).toString(), ReginParams.class);
param.setLoginUserId(reginParam.getPersonIdentity().getPersonSeq());
long total = planMapper.countPlanInfoData(param);
Set<String> userIds = new HashSet<>();
List<HashMap<String, Object>> content = planMapper.getPlanInfo(param);
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.beust.jcommander.internal.Sets;
import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
......@@ -54,6 +58,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException;
......@@ -105,6 +110,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired
private RulePlanService rulePlanService;
@Autowired
RedisUtils redisUtils;
@Override
public Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params);
......@@ -592,6 +600,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public Page<HashMap<String, Object>> getPlanTasks(HashMap<String, Object> params, CommonPageable pageParam) {
List<HashMap<String, Object>> content = Lists.newArrayList();
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId()
, RequestContext.getToken())).toString(), ReginParams.class);
params.put("loginUserId", reginParam.getPersonIdentity().getPersonSeq());
long total = planTaskMapper.getPlanTasksCount(params);
if (total == 0) {
return new PageImpl<>(content, pageParam, total);
......
......@@ -67,7 +67,6 @@ public class InputItemParamUtil {
}
}
}
param.setOrgCode(perMap.get("orgCode").toString());
if (commonPageable != null) {
param.setOffset(Integer.parseInt(String.valueOf(commonPageable.getOffset())));
param.setPageNumber(commonPageable.getPageNumber());
......
......@@ -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;
}
......
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));
}
/**
* 列表分页查询
......@@ -139,6 +161,19 @@ public class EquipmentController extends BaseController {
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")) {
......
......@@ -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) {
......
......@@ -39,4 +39,8 @@ file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/
ifc.url=http://11.11.16.17/IFCInterface
\ No newline at end of file
ifc.url=http://11.11.16.17/IFCInterface
ifc.call-back.localIp=11.11.16.1
......@@ -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
......
This diff is collapsed.
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