Commit 8ca61489 authored by tangwei's avatar tangwei

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

parents 234fc10b d5f23c73
......@@ -8,6 +8,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.dto.DataDictionaryDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -111,6 +112,21 @@ public class DataDictionaryController extends BaseController {
return iDataDictionaryService.getById(id);
}
/**
* 根据id查询
*
* @param code
* @return
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/code", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据code查询", notes = "根据code查询")
public DataDictionary selectByCode(HttpServletRequest request,@RequestParam("code") String code,@RequestParam("type") String type) {
return iDataDictionaryService.getByCode(code,type);
}
/**
* 列表分页查询
*
......@@ -163,7 +179,7 @@ public class DataDictionaryController extends BaseController {
@RequestMapping(value = "/gwmcDataDictionary/{type}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典", notes = "根据字典类型查询字典")
public ResponseModel<Object> gwmcDataDictionary(@PathVariable String type) throws Exception {
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
......@@ -173,7 +189,7 @@ public class DataDictionaryController extends BaseController {
return ResponseHelper.buildResponse(obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus);
......@@ -184,7 +200,7 @@ public class DataDictionaryController extends BaseController {
@RequestMapping(value = "/dataDictionary", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询字典2", notes = "根据字典类型查询字典2")
public ResponseModel<Object> getDictionary(@RequestParam String type) throws Exception {
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
......@@ -194,7 +210,7 @@ public class DataDictionaryController extends BaseController {
return ResponseHelper.buildResponse(obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return ResponseHelper.buildResponse(menus);
......@@ -205,7 +221,7 @@ public class DataDictionaryController extends BaseController {
@RequestMapping(value = "/gwmcDataDictionary/FireChemical/{type}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据字典类型查询危险品字典", notes = "根据字典类型查询危险品字典")
public ResponseModel<Object> gwmcDataDictionaryFireChemical(@PathVariable String type) throws Exception {
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
......@@ -215,7 +231,7 @@ public class DataDictionaryController extends BaseController {
return ResponseHelper.buildResponse(obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2,
"getName", "getParent", null);
MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false);
......@@ -242,7 +258,8 @@ public class DataDictionaryController extends BaseController {
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus);
......@@ -268,11 +285,13 @@ public class DataDictionaryController extends BaseController {
List<Menu> menus =null;
if ("YJLDDW".equals(type)) {
list = dataDictionaryMapper.getNoInLinkUnit();
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null);
} else {
list = iDataDictionaryService.list(queryWrapper);
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName", "getParent",
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null);
}
// 创建根节点
......@@ -283,4 +302,6 @@ public class DataDictionaryController extends BaseController {
return ResponseHelper.buildResponse(menuList);
}
}
......@@ -22,4 +22,10 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
* @return
*/
public List<DataDictionary> getNoInLinkUnit();
/**
* 根据code值查询
* @return
*/
public DataDictionary getByCode(String code,String type);
}
......@@ -37,6 +37,9 @@ public class DataDictionary extends BaseEntity {
@ApiModelProperty(value = "父级")
private Long parent;
@ApiModelProperty(value = "类型说明")
private String typeDesc;
//新加排序字段
@ApiModelProperty(value = "排序字段")
private int sortNum;
......
......@@ -48,7 +48,8 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
return obj;
} else {
Collection<DataDictionary> list = this.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0,
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2,
"getName", "getParent", null);
MenuFrom Me = new MenuFrom("-1", "-1", "-1", "危化品库", "危化品库", "危化品库", "-1", null);
Me.setIsLeaf(false);
......@@ -69,7 +70,8 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
return obj;
} else {
Collection<DataDictionary> list = this.list(queryWrapper);
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
List<Menu> menus = TreeParser.getTree(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName"
, "getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE + type, JSON.toJSON(menus), time);
return menus;
......@@ -82,12 +84,19 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
queryWrapper.orderByAsc("sort_num");
Collection<DataDictionary> list = this.list(queryWrapper);
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName"
// 数据字典生成树方法 原先通过getCode做主键 现修改为 getSequenceNbr 后期数据字典parent字段保存id 而不要保存code by kongfm 2021-09-08
List<MenuFrom> menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getSequenceNbr", 2, "getName"
, "getParent", null);
return menus;
}
public DataDictionary getByCode(String code,String type) {
DataDictionary byCode = dataDictionaryMapper.getByCode(code,type);
return byCode;
}
public List<DataDictionary> getDataDictionaryAndCount(){
List<DataDictionary> list= dataDictionaryMapper.getDataDictionaryListAndCount();
......
......@@ -47,4 +47,14 @@ WHERE
cbb.type = 'YJLDDW' and cbb.is_delete = 0
AND elink.count IS NOT NULL
</select>
<select id ="getByCode" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT
*
FROM
cb_data_dictionary cbb
WHERE
cbb.code = #{code} and cbb.is_delete = 0 and cbb.type = #{type}
</select>
</mapper>
......@@ -11,6 +11,8 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 工作经历
*
......@@ -29,9 +31,11 @@ public class FirefightersWorkexperience extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "参加工作时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date workingHours;
@ApiModelProperty(value = "参加消防部门工作时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date fireWorkingHours;
@ApiModelProperty(value = "人员id")
......
......@@ -159,5 +159,12 @@ public interface EquipFeignClient {
@RequestMapping(value = "/video/getByid", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getByid( @RequestParam Long id);
/**
*
*获取车辆简要信息
* @param id 消防车id
* @return
*/
@RequestMapping(value = "/car/simple/{id}", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> queryCarSimpleInfoById(@PathVariable Long id);
}
......@@ -19,15 +19,15 @@ import java.util.Map;
* @date 2021-06-28
*/
public interface FireStationMapper extends BaseMapper<FireStation> {
// 微型消防站按时间倒叙排列add order by cb_fire_station.rec_date desc 2021-09-08 by kongfm
@Select("<script>"
+ "select * from cb_fire_station where cb_fire_station.is_delete=0 "
+ "<if test='par.name!=null'> and cb_fire_station.name like CONCAT('%',#{par.name},'%') </if>"
+ "<if test='par.bizCompanyId!=null'> and cb_fire_station.biz_company_id = #{par.bizCompanyId} </if>"
+ "<if test='par.bizCompanyCode!=null'> and cb_fire_station.biz_company_code like CONCAT('',#{par.bizCompanyCode},'%') </if>"
+"limit #{pageNum},#{pageSize}"
+" order by cb_fire_station.rec_date desc limit #{pageNum},#{pageSize}"
+ "</script>")
List<FireStationDto>getFireStation(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par);
@Select("<script>"
......
package com.yeejoin.amos.boot.module.common.api.service;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
/**
......@@ -21,4 +22,11 @@ public interface IDutyCarService extends IDutyCommonService {
* @return List<DutyCarDto>
*/
DutyCarDto update(Long instanceId, DutyCarDto dutyCarDto);
/**
* 判断当前登陆人是否是车辆驾驶员
*
* @return
*/
JSONObject isFireCarDriver();
}
......@@ -28,7 +28,7 @@
</if>
</select>
<!--消防队伍列表按时间倒叙排列order by x.rec_date desc 2021-09-08 by kongfm -->
<select id="getFireTeamForPage" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamCardDto">
SELECT
a.sequence_nbr sequenceNbr,
......@@ -63,6 +63,7 @@
and a.sequence_nbr = #{par.nodeId}
</if>
</if>
order by a.rec_date desc
</select>
<select id="listFireTeamDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto">
select t.*, p.name parentName
......@@ -70,6 +71,8 @@
left join cb_fire_team p on t.parent = p.sequence_nbr
where t.is_delete = #{isDelete}
</select>
<!--消防队伍列表按时间倒叙排列order by x.rec_date desc 2021-09-08 by kongfm -->
<select id="listFireTeamById" resultType="com.yeejoin.amos.boot.module.common.api.entity.FireTeam">
SELECT *
FROM cb_fire_team
......@@ -77,6 +80,7 @@
<if test="teamId != null">
AND tree_code LIKE CONCAT((SELECT tree_code FROM cb_fire_team WHERE sequence_nbr = #{teamId}),'%');
</if>
order by cb_fire_team.rec_date desc
</select>
......
......@@ -9,7 +9,7 @@
where a.is_delete = 0
GROUP BY a.job_title_code
</select>
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefighters"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto">
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code areasExpertiseCode from cb_firefighters a LEFT JOIN cb_firefighters_post b on
......@@ -22,9 +22,9 @@
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date limit #{pageNum},#{pageSize}
ORDER BY a.rec_date desc limit #{pageNum},#{pageSize}
</select>
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefightersCount" resultType="Map">
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
......@@ -38,7 +38,7 @@
<if test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date
ORDER BY a.rec_date desc
</select>
......
......@@ -130,7 +130,7 @@
b.instance_id=a.instance_id where a.unit_name is not null
</select>
<!--联动单位列表按时间倒叙排列add order by clu.rec_date desc 同时处理单位根节点-1时查询全部数据问题 2021-09-08 by kongfm -->
<select id="getEmergencyLinkageUnitList"
resultType="java.util.Map">
SELECT
......@@ -189,12 +189,15 @@
AND clu.linkage_unit_type =#{linkageUnitType}
</if>
<if
test="emergencyLinkageUnitCode != null and emergencyLinkageUnitCode != ''">
AND clu.emergency_linkage_unit_code =#{emergencyLinkageUnitCode}
test="emergencyLinkageUnitCode != null and emergencyLinkageUnitCode != '' ">
<if test="emergencyLinkageUnitCode != '-1'">
AND clu.emergency_linkage_unit_code =#{emergencyLinkageUnitCode}
</if>
</if>
<if
test="linkageUnitTypeCode != null and linkageUnitTypeCode != ''">
AND clu.linkage_unit_type_code =#{linkageUnitTypeCode}
</if>
order by clu.rec_date desc
</select>
</mapper>
......@@ -52,7 +52,7 @@
</if>
</select>
<!--机场单位人员按时间倒叙排列add order by u.rec_date desc 2021-09-08 by kongfm -->
<select id="selectPersonList" resultType="Map">
select * from (
SELECT
......@@ -86,6 +86,7 @@
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
order by u.rec_date desc
)a where a.sequenceNbr is not null
<if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item">AND a.${item} = #{map.fieldsValue[${item}]}</foreach>
......@@ -159,6 +160,7 @@
and biz_org_code like concat(#{bizOrgCode}, '%')
</select>
<!--消防队伍列表按时间倒叙排列order by x.rec_date desc 2021-09-08 by kongfm -->
<select id="queryOrgPersonDtoList" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgPersonExcelDto">
select u.*,
v.person_number,
......@@ -204,6 +206,7 @@
) v
on u.sequence_nbr = v.instance_id
where u.is_delete = #{isDelete}
order by u.rec_date desc
</select>
<select id="listOrgUserById" resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT *
......
......@@ -115,6 +115,7 @@
from cb_water_resource
where is_delete = #{isDelete}
</select>
<!--消防水源按时间倒叙排列add order by cb_water_resource.rec_date desc 2021-09-08 by kongfm -->
<select id="getWaterResourcePageByParams"
resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto">
select * from cb_water_resource where is_delete = 1
......@@ -133,6 +134,7 @@
<if test="belongBuildingId != null and belongBuildingId.size() > 0">
and find_in_set(belong_building_id, #{belongBuildingId}) > 0
</if>
order by cb_water_resource.rec_date desc
</select>
......
package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
*
* @author system_generator
* @date 2021-09-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="AlertCalledFeedbackDto", description="")
public class AlertCalledFeedbackDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情id")
private Long alertCalledId;
@ApiModelProperty(value = "反馈警情任务状态")
private String status;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "图片附件")
private Map<String, List<AttachmentDto>> attachments;
}
package com.yeejoin.amos.boot.module.jcs.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;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2021-09-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("jc_alert_called_feedback")
public class AlertCalledFeedback extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 警情id
*/
@TableField("alert_called_id")
private Long alertCalledId;
/**
* 反馈警情状态
*/
@TableField(value = "status")
private String status;
/**
* 备注
*/
@TableField("remark")
private String remark;
}
package com.yeejoin.amos.boot.module.jcs.api.enums;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
import java.util.Map;
/**
*
* <pre>
* 警情反馈状态枚举
* </pre>
*
* @author tb
* @version $Id: AlertStatusEnum.java, v 0.1 2021年6月23日 下午5:11:18 gwb Exp $
*/
@Getter
@AllArgsConstructor
public enum AlertFeedbackStatusEnum {
/**
* 执行中
*/
执行中("executing", "执行中"),
/**
* 已完成
*/
已完成("finished", "已完成");
private String code;
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static AlertFeedbackStatusEnum getEnum(String code)
{
for (AlertFeedbackStatusEnum status : AlertFeedbackStatusEnum.values())
{
if (status.getCode().equals(code))
{
return status;
}
}
return null;
}
/**
* 枚举转列表
*
* @return
*/
public static List<Map<String, String>> toList() {
List<Map<String, String>> enumList = Lists.newArrayList();
for (AlertFeedbackStatusEnum item : AlertFeedbackStatusEnum.values()) {
Map<String, String> map = Maps.newHashMap();
map.put("code", item.getCode());
map.put("name", item.getName());
enumList.add(map);
}
return enumList;
}
}
package com.yeejoin.amos.boot.module.jcs.api.enums;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.List;
import java.util.Map;
/**
* @author DELL
*/
......@@ -32,4 +37,21 @@ public enum FireCarStatusEnum {
}
return null;
}
/**
* 枚举转列表
*
* @return
*/
public static List<Map<String, String>> toList() {
List<Map<String, String>> enumList = Lists.newArrayList();
for (FireCarStatusEnum item : FireCarStatusEnum.values()) {
Map<String, String> map = Maps.newHashMap();
map.put("key", item.getKey());
map.put("code", item.getCode());
map.put("name", item.getName());
enumList.add(map);
}
return enumList;
}
}
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalledFeedback;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper 接口
*
* @author system_generator
* @date 2021-09-08
*/
public interface AlertCalledFeedbackMapper extends BaseMapper<AlertCalledFeedback> {
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFeedbackDto;
/**
* 接口类
*
* @author system_generator
* @date 2021-09-08
*/
public interface IAlertCalledFeedbackService {
/**
* app-警情反馈
*
* @param model
* @return true/false
*/
boolean handleFeedback(AlertCalledFeedbackDto model);
}
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.ResourceStatisticsDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import java.util.List;
import java.util.Map;
/**
* 力量调派 服务类
......@@ -62,4 +63,18 @@ public interface IPowerTransferService extends IService<PowerTransfer> {
* @return
*/
JSONObject getPowerTransferCarResourceStatistics(Long alertCalledId);
/**
* 获取车辆状态列表
*
* @return
*/
List<Map<String, String>> getFireCarStatusList();
/**
* 获取调派任务状态列表
*
* @return
*/
List<Map<String, String>> getDispatchTaskStatusList();
}
<?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.jcs.api.mapper.AlertCalledFeedbackMapper">
</mapper>
......@@ -39,7 +39,7 @@
SELECT ptcr.resources_id carId
FROM `jc_power_transfer` pt
LEFT JOIN jc_power_transfer_company ptc ON ptc.power_transfer_id = pt.sequence_nbr
LEFT JOIN jc_power_transfer_company_resources ptcr ON ptcr.power_transfer_company_id = ptc.sequence_nbr
RIGHT JOIN jc_power_transfer_company_resources ptcr ON ptcr.power_transfer_company_id = ptc.sequence_nbr
WHERE pt.alert_called_id = #{alertCalledId}
</select>
......
......@@ -35,6 +35,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
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.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;
......@@ -158,7 +159,8 @@ public class CommandController extends BaseController {
@Autowired
IDutyPersonService iDutyPersonService;
@Autowired
IDutyCarService iDutyCarService;
/**
* 警情列表
......@@ -1098,6 +1100,7 @@ public class CommandController extends BaseController {
public ResponseModel<Object> selectByAlertCalledId(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.queryAlertCalledById(id));
}
/**
* app-根据id查询警情力量统计
**/
......@@ -1107,4 +1110,34 @@ public class CommandController extends BaseController {
public ResponseModel<Object> statisticsByAlertCalledId(@PathVariable Long alertId) {
return ResponseHelper.buildResponse(powerTransferService.getPowerTransferCarResourceStatistics(alertId));
}
/**
* app-车辆状态列表
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/app/carStatus/list")
@ApiOperation(httpMethod = "GET", value = "app-车辆状态列表", notes = "app-车辆状态列表")
public ResponseModel<Object> carStatusList() {
return ResponseHelper.buildResponse(powerTransferService.getFireCarStatusList());
}
/**
* app-调派任务状态列表
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/app/dispatchTaskStatus/list")
@ApiOperation(httpMethod = "GET", value = "app-调派任务状态列表", notes = "app-调派任务状态列表")
public ResponseModel<Object> powerTransferResourceStatusList() {
return ResponseHelper.buildResponse(powerTransferService.getFireCarStatusList());
}
/**
* app-当前登陆人是否是驾驶员
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/app/personPost")
@ApiOperation(httpMethod = "GET", value = "app-当前登陆人是否是驾驶员", notes = "app-当前登陆人是否是驾驶员")
public ResponseModel<Object> isFireCarDriver() {
return ResponseHelper.buildResponse(iDutyCarService.isFireCarDriver());
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourcePoolSer
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -92,13 +93,13 @@ public class WaterResourceController extends BaseController {
model.setResourceTypeName(resourceTypeEnum.get().getName());
model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList()));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList()));
if(model.getAddress()!=null){
/*2021-09-08 前端表示前端传递的address参数已经切割过,后端无需再切割获取 陈召 屏蔽代码 97-102行*/
/* if(model.getAddress()!=null){
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
model.setAddress(address.getString(BizConstant.ADDRESS));
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}*/
if (!StringUtils.isEmpty(resourceType)) {
switch (resourceType) {
......@@ -168,12 +169,14 @@ public class WaterResourceController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<WaterResourceDto> updateBySequenceNbrWaterResource(@RequestBody WaterResourceDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
if (StringUtils.isNotEmpty(model.getAddress())) {
/*2021-09-08 前端表示前端传递的address参数已经切割过,后端无需再切割获取 陈召 屏蔽代码 173-178行*/
/* if (StringUtils.isNotEmpty(model.getAddress())) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddress());
model.setAddress(address.getString(BizConstant.ADDRESS));
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}*/
// 更新基本信息
model.setSequenceNbr(sequenceNbr);
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List;
......@@ -23,6 +31,17 @@ import java.util.stream.Collectors;
@Service
public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCarService {
@Autowired
DynamicFormInstanceServiceImpl dynamicFormInstanceService;
@Autowired
FirefightersMapper firefightersMapper;
@Autowired
EquipFeignClient equipFeignClient;
String driverPostTypeCode = "5";
@Override
public String getGroupCode() {
return "dutyCar";
......@@ -78,4 +97,49 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column, DynamicFormInstance formInstance) {
fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId());
}
@Override
public JSONObject isFireCarDriver() {
JSONObject result = new JSONObject();
result.put("isDriver", false);
result.put("carStatus", "");
result.put("carId", "");
String loginUserId = RequestContext.getExeUserId();
// 根据登陆人id查询对应消防人员
Firefighters firefighters =
firefightersMapper.selectOne(new LambdaQueryWrapper<Firefighters>().eq(Firefighters::getSystemAccount,
loginUserId));
if (ValidationUtil.isEmpty(firefighters)) {
return result;
}
// 消防人员id
Long fighterId = firefighters.getSequenceNbr();
// 当前值班班次id
List<Long> shiftIdList = getDutyShiftIdList();
if (ValidationUtil.isEmpty(shiftIdList)) {
return result;
}
// 当前值班人员-车辆信息
List<Map<String, Object>> personList = dayDutyPersonList(DateUtils.getDateNowShortStr(), shiftIdList.get(0),
driverPostTypeCode);
if (ValidationUtil.isEmpty(personList)) {
return result;
}
personList = personList.stream().filter(m -> fighterId.equals(m.get("userId"))).collect(Collectors.toList());
if (ValidationUtil.isEmpty(personList)) {
return result;
}
result.put("isDriver", true);
result.put("carId", personList.get(0).get("carId"));
ResponseModel<Map<String, Object>> resultModel =
equipFeignClient.queryCarSimpleInfoById((Long) personList.get(0).get("carId"));
Map<String, Object> carInfo = resultModel.getResult();
result.put("carStatus", carInfo.get("carStatus"));
return result;
}
}
......@@ -29,6 +29,7 @@ public class FireChemicalServiceImpl extends BaseService<FireChemicalDto,FireChe
typeCode = null;
}
// BUG 2123 日常管理>辅助资源>危化品,危化品列表数据按创建时间倒序排列 by litw start
// 危化品按时间倒叙排列add rec_date 2021-09-08 by kongfm
return this.queryForPage(page, "rec_date", false,casNo, formula, name, typeCode, isDelete);
}
......
......@@ -30,7 +30,8 @@ public class FireExpertsServiceImpl extends BaseService<FireExpertsDto, FireExpe
@Condition(Operator.eq) Boolean isDelete,
@Condition(Operator.like) String name,
@Condition(Operator.eq) String expertCode) {
return this.queryForPage(page, null, false, isDelete, name, expertCode);
// 消防专家按时间倒叙排列add rec_date 2021-09-08 by kongfm
return this.queryForPage(page, "rec_date", false, isDelete, name, expertCode);
}
/**
......
......@@ -361,7 +361,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public List<FormValue> getFormValue(Long id) throws Exception {
// 动态表单数据
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 开始 */
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
List<FormValue> formValue = new ArrayList<>();
for (DynamicFormInstanceDto alertFormValue : list) {
......@@ -371,14 +371,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
// alertFormValue.getFieldType(), alertFormValue.getFieldValueLabel(), alertFormValue.getBlock());
// formValue.add(value);
// } else {
/*修改为动态表单返回的数据参数量 2021-09-08 陈浩 结束 */
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(),
alertFormValue.getFieldType(), alertFormValue.getFieldValue(), alertFormValue.getBlock(),alertFormValue.getFieldValueLabel());
formValue.add(value);
/*修改为动态表单返回的数据参数量 2021-09-08 陈浩 结束 */
// }
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 开始 */
}
return formValue;
/*BUG2580 返回值为code值 修改为类型名称 2021-08-31 陈召 结束 */
}
public List<FormValue> getFormValueDetail(Long id) throws Exception {
......
......@@ -90,10 +90,7 @@ public class SourceFileServiceImpl extends BaseService<SourceFileDto, SourceFile
public void saveAttachments(Long sequenceNbr, Map<String, List<AttachmentDto>> attachmentMap) {
if (!ValidationUtil.isEmpty(attachmentMap)) {
List<SourceFile> sourceFiles = Lists.newArrayList();
attachmentMap.entrySet().forEach(entry -> {
List<AttachmentDto> attachments = entry.getValue();
sourceFiles.addAll(attachment2SourceFile(entry.getKey(), attachments));
});
attachmentMap.forEach((key, attachments) -> sourceFiles.addAll(attachment2SourceFile(key, attachments)));
saveSourceFile(sequenceNbr, sourceFiles);
}
}
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.AlertCalledFeedbackServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFeedbackDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 警情反馈
*
* @author system_generator
* @date 2021-09-08
*/
@RestController
@Api(tags = "警情反馈Api")
@RequestMapping(value = "/alert-called-feedback")
public class AlertCalledFeedbackController extends BaseController {
@Autowired
AlertCalledFeedbackServiceImpl alertCalledFeedbackServiceImpl;
/**
* 新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<AlertCalledFeedbackDto> save(@RequestBody AlertCalledFeedbackDto model) {
alertCalledFeedbackServiceImpl.handleFeedback(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<AlertCalledFeedbackDto> updateBySequenceNbrAlertCalledFeedback(@RequestBody AlertCalledFeedbackDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(alertCalledFeedbackServiceImpl.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(alertCalledFeedbackServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<AlertCalledFeedbackDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(alertCalledFeedbackServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<AlertCalledFeedbackDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<AlertCalledFeedbackDto> page = new Page<AlertCalledFeedbackDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(alertCalledFeedbackServiceImpl.queryForAlertCalledFeedbackPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<AlertCalledFeedbackDto>> selectForList() {
return ResponseHelper.buildResponse(alertCalledFeedbackServiceImpl.queryForAlertCalledFeedbackList());
}
}
......@@ -165,7 +165,8 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
Boolean isDelete,
@Condition(Operator.like) String aircraftModel,
String engineTypeCode, String fuelTypeCode) {
return this.queryForPage(page, null, false, isDelete, aircraftModel, engineTypeCode, fuelTypeCode);
// 航空器信息按时间倒叙排列add rec_date 2021-09-08 by kongfm
return this.queryForPage(page, "rec_date", false, isDelete, aircraftModel, engineTypeCode, fuelTypeCode);
}
/**
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFeedbackDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalledFeedback;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertCalledFeedbackMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* 服务实现类
*
* @author system_generator
* @date 2021-09-08
*/
@Service
public class AlertCalledFeedbackServiceImpl extends BaseService<AlertCalledFeedbackDto, AlertCalledFeedback, AlertCalledFeedbackMapper> implements IAlertCalledFeedbackService {
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
PowerTransferMapper powerTransferMapper;
/**
* 分页查询
*/
public Page<AlertCalledFeedbackDto> queryForAlertCalledFeedbackPage(Page<AlertCalledFeedbackDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<AlertCalledFeedbackDto> queryForAlertCalledFeedbackList() {
return this.queryForList("", false);
}
@Override
public boolean handleFeedback(AlertCalledFeedbackDto model) {
Long alertCalledId = model.getAlertCalledId();
// 更新警情调派任务状态
List<String> carIdList = powerTransferMapper.queryTransferCarIdsByAlertCalledId(alertCalledId);
// 保存警情反馈
model = createWithModel(model);
// 保存警情反馈图片
sourceFileService.saveAttachments(model.getSequenceNbr(), model.getAttachments());
return true;
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertFeedbackStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.DutyInfoEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
......@@ -52,7 +53,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -513,6 +513,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
List<Long> shiftIdList = dutyCarService.getDutyShiftIdList();
List<Map<String, Object>> allDutyPersonList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(shiftIdList)) {
// 当前值班车辆-人
allDutyPersonList = dutyCarService.dayDutyPersonList(DateUtils.getDateNowShortStr(),
shiftIdList.get(0), null);
}
......@@ -541,4 +542,14 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
jsonObject.put("count", agentCountArrived);
resourceStatistics.put(jsonKey, jsonObject);
}
@Override
public List<Map<String, String>> getFireCarStatusList() {
return FireCarStatusEnum.toList();
}
@Override
public List<Map<String, String>> getDispatchTaskStatusList() {
return AlertFeedbackStatusEnum.toList();
}
}
......@@ -41,6 +41,8 @@ public class PushMsgParam {
* jpush发送类型:1:广播;2:标签;3:别名
*/
private String type = "3";
private String relationId;
public String getType() {
return type;
......@@ -90,5 +92,13 @@ public class PushMsgParam {
public void setEmails(String[] emails) {
this.emails = emails;
}
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
}
......@@ -147,8 +147,14 @@ public class MessageServiceImpl implements IMessageService {
}
}
//获取需要推送的app的用户
List<PushTargetBo> jpushUser = msgMapper.getPushUserBo("app", String.join(",", needUserIds), checkMsgBo.getRouteId(),getAppPushConfig(checkMsgBo.getStatus()));
//获取需要推送的app的用户 手机端暂时无订阅功能,暂时屏蔽
// List<PushTargetBo> jpushUser = msgMapper.getPushUserBo("app", String.join(",", needUserIds), checkMsgBo.getRouteId(),getAppPushConfig(checkMsgBo.getStatus()));
List<PushTargetBo> jpushUser = new ArrayList<>();
needUserIds.stream().forEach(action->{
PushTargetBo pb = new PushTargetBo();
pb.setUserId(action);
jpushUser.add(pb);
});
//获取需要推送的email的用户
List<PushTargetBo> emailUser = msgMapper.getPushUserBo("email", String.join(",", needUserIds), checkMsgBo.getRouteId(),getEmailPushConfig(checkMsgBo.getStatus()));
......@@ -157,7 +163,9 @@ public class MessageServiceImpl implements IMessageService {
List<PushTargetBo> tempList = new ArrayList<>();
tempList.addAll(jpushUser);
tempList.addAll(emailUser);
List<String> userIds=tempList.stream().map(PushTargetBo::getUserId).distinct().collect(Collectors.toList());
// 手机端暂时无订阅功能,暂时屏蔽
// List<String> userIds=tempList.stream().map(PushTargetBo::getUserId).distinct().collect(Collectors.toList());
Set<String> userIds = needUserIds;
List<AgencyUserModel> agencyUserModelList=remoteSecurityService.listUserByUserIds( toke,product,appKey,String.join(",", userIds));
try {
pushAppMsg(jpushUser,agencyUserModelList,pushMsgParam,checkMsgBo, toke, product, appKey);
......@@ -223,8 +231,8 @@ public class MessageServiceImpl implements IMessageService {
}
List<String> pushApps = jpushUser.stream()
.filter(bo->StringUtil.isNotEmpty(bo.getUsername()))
.map(PushTargetBo::getUsername).collect(Collectors.toList());
.filter(bo->StringUtil.isNotEmpty(bo.getUserId()))
.map(PushTargetBo::getUserId).collect(Collectors.toList());
pushApps = pushApps.stream().distinct().collect(Collectors.toList());
if(!pushApps.isEmpty()){
List<PushMsgParam> pmps = new ArrayList<PushMsgParam>();
......@@ -234,6 +242,7 @@ public class MessageServiceImpl implements IMessageService {
extras.put("type",MsgTypeEnum.CHECK.getCode());
extras.put("id",checkMsgBo.getCheckId()+"");
pushMsgParam.setExtras(extras);
pushMsgParam.setRelationId(checkMsgBo.getCheckId()+"");
pmps.add(pushMsgParam);
List<Msg> msgList =createMsg(jpushUser,checkMsgBo);
pushFeignServer.sendMessage( toke, product, appKey,pmps);
......@@ -302,13 +311,14 @@ public class MessageServiceImpl implements IMessageService {
}
@Override
public Msg pushMsg(String toke,String product,String appKey,Msg msg) {
public Msg pushMsgAndSave(String toke,String product,String appKey,Msg msg) {
List<PushMsgParam> pmps = new ArrayList<PushMsgParam>();
PushMsgParam pushMsg = new PushMsgParam();
pushMsg.setRecivers(Arrays.asList(msg.getTargetTel()));
pushMsg.setRecivers(Arrays.asList(msg.getUserId()));
pushMsg.setContent(ObjectUtils.isEmpty(msg.getPushBody()) ? msg.getBody() : msg.getPushBody());
pushMsg.setSubject(msg.getTitle());
pushMsg.setType(JPushTypeEnum.ALIAS.getCode());
pushMsg.setRelationId(msg.getRelationId()==null?"0":msg.getRelationId().toString());
Map<String, String> extras = new HashMap<String, String>();
extras.put("type",msg.getMsgType());
extras.put("id",msg.getRelationId()==null?"0":msg.getRelationId().toString());
......@@ -350,7 +360,7 @@ public class MessageServiceImpl implements IMessageService {
msg.setUserId(user.getUserId());
msg.setReciverName(user.getRealName());
if (isImmediately) { //立即发送
msg = pushMsg( toke, product, appKey,msg);
msg = pushMsgAndSave( toke, product, appKey,msg);
} else { //定时发送
msg.setStatus(0);
msg.setFixedTime(notice.getFixedTime());
......@@ -414,9 +424,17 @@ public class MessageServiceImpl implements IMessageService {
msg.setTargetTel(userNames);
msg.setUserId(userIds);
msg.setIsImmediately(isImmediately);
pushMsg( toke, product, appKey,msg);
pushMsgAndSave( toke, product, appKey,msg);
}
}
}
@Override
public void pushMsg(String toke, String product, String appKey, PushMsgParam pmsg) {
// TODO Auto-generated method stub
pushFeignServer.sendMessage( toke, product, appKey,pmsg);
}
}
......@@ -7,6 +7,7 @@ import org.springframework.data.domain.Page;
import com.yeejoin.amos.patrol.business.param.MsgInfoPageParam;
import com.yeejoin.amos.patrol.business.param.NoticePublishParam;
import com.yeejoin.amos.patrol.business.param.PushMsgParam;
import com.yeejoin.amos.patrol.business.vo.MsgVo;
import com.yeejoin.amos.patrol.dao.entity.Check;
import com.yeejoin.amos.patrol.dao.entity.Msg;
......@@ -48,6 +49,8 @@ public interface IMessageService {
* 消息公告推送
* @param msg
*/
public Msg pushMsg(String toke,String product,String appKey,Msg msg);
public Msg pushMsgAndSave(String toke,String product,String appKey,Msg msg);
public void pushMsg(String toke,String product,String appKey,PushMsgParam pmsg);
}
......@@ -66,37 +66,7 @@ public class AsyncTask {
private static final String TAB = "\r\n";
/**
* 邮件发送
* @param msgResponse
* @return
* @throws InterruptedException
*/
// @Async("asyncTaskExecutor")
// public Future<Boolean> sendEmail(PushMsgParam pmp) throws InterruptedException {
// long start = System.currentTimeMillis();
// iEmailService.sendSimpleEmail(pmp.getEmails(), pmp.getSubject(), pmp.getContent());
// long end = System.currentTimeMillis();
// log.info("=====邮件发送耗时:"+(end-start)+"======");
// return new AsyncResult<Boolean>(true);
// }
//
// /**
// * jpush 推送
// * @param pmps
// * @return
// * @throws InterruptedException
// */
// @Async("asyncTaskExecutor")
// public Future<Boolean> sendJpush(List<PushMsgParam> pmps) throws InterruptedException {
// long start = System.currentTimeMillis();
// appMessagePushService.sendMessage(pmps);
// long end = System.currentTimeMillis();
// //返回true,告诉此任务已完成
// log.info("=====Jpush发送耗时:"+(end-start)+"======");
// return new AsyncResult<Boolean>(true);
// }
/**
* 检查消息推送
* @param checkId
......@@ -231,6 +201,7 @@ public class AsyncTask {
msg.setIsImmediately(true);
msg.setSendTime(date);
msg.setCreateDate(date);
msg.setTargetTel(user.getString("username"));
msg.setReciverName(user.getString("realName"));
sendUserIds.add(user.getString("userId"));
msgs.add(msg);
......@@ -247,11 +218,12 @@ public class AsyncTask {
pushMsgParam.setContent(body);
pushMsgParam.setRecivers(Lists.newArrayList(sendUserIds));
pushMsgParam.setSubject(title);
pushMsgParam.setRelationId(String.valueOf(relationId));
pushMsgParam.setType(JPushTypeEnum.ALIAS.getCode());
pushMsgParam.setExtras(extras);
iMsgDao.saveAll(msgs);
appMessagePushService.sendMessage(pushMsgParam);
// log.info("极光推送成功====>" + sendUserIds);
Toke toke= remoteSecurityService.getServerToken();
messageService.pushMsg(toke.getToke(),toke.getProduct(),toke.getAppKey(),pushMsgParam);
}
}
......
package com.yeejoin.amos.patrol.feign;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -14,38 +15,57 @@ import com.yeejoin.amos.patrol.business.param.PushMsgParam;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.core.common.response.TaskInfoRespone;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
@Service("pushFeignServer")
public class PushFeignServer {
@Autowired
private RestTemplate restTemplate;
@Value("${Push.fegin.name}")
private String RPushFeginName;
private static String sendMessage = "/api/user/sendMessage";
// @Autowired
// private RestTemplate restTemplate;
//
// @Value("${Push.fegin.name}")
// private String RPushFeginName;
// private static String sendMessage = "/api/user/sendMessage";
//
// public String geturls(String url){
// return "http://"+RPushFeginName+url;
// }
// public HttpHeaders getHeader(String toke,String product,String appKey){
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_JSON);
// headers.set("Content-Type", "application/json");
// headers.set("token", toke);
// headers.set("product",product);
// headers.set("appKey", appKey);
// return headers;
// }
public String geturls(String url){
return "http://"+RPushFeginName+url;
}
public HttpHeaders getHeader(String toke,String product,String appKey){
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("token", toke);
headers.set("product",product);
headers.set("appKey", appKey);
return headers;
}
public void sendMessage( String toke,String product,String appKey, List<PushMsgParam> pushMsgParam){
try {
pushMsgParam.forEach(action->{
sendJP(action);
});
} catch (Exception e) {
e.printStackTrace();
}
}
public CommonResponse sendMessage( String toke,String product,String appKey, List<PushMsgParam> pushMsgParam){
public void sendMessage( String toke,String product,String appKey, PushMsgParam pushMsgParam){
try {
HttpEntity httpEntity = new HttpEntity<>(pushMsgParam, getHeader( toke, product, appKey));
CommonResponse commonResponse1 = restTemplate.postForObject(geturls(sendMessage),httpEntity, CommonResponse.class);
return commonResponse1;
} catch (Exception e) {
sendJP(pushMsgParam);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure("发送失败");
}
}
}
private void sendJP(PushMsgParam pushMsgParam){
MessageModel model = new MessageModel();
model.setRelationId(pushMsgParam.getRelationId());
model.setTitle(pushMsgParam.getSubject());
model.setBody(pushMsgParam.getContent());
model.setMsgType("patrolSystem");
model.setRecivers(pushMsgParam.getRecivers());
model.setExtras(pushMsgParam.getExtras());
Systemctl.messageClient.create(model);
}
}
......@@ -110,17 +110,17 @@ public class AppMessagePushService {
}
public void sendMessage(PushMsgParam response){
try {
if(null!=response && "true".equals(isPush)){
CommonResponse commonResponse = PushFeign.sendMessageone(response);
}
} catch (Exception e) {
log.error(e.getMessage(),e);
e.printStackTrace();
}
}
// public void sendMessage(PushMsgParam response){
//
// try {
// if(null!=response && "true".equals(isPush)){
// CommonResponse commonResponse = PushFeign.sendMessageone(response);
// }
// } catch (Exception e) {
// log.error(e.getMessage(),e);
// e.printStackTrace();
//
// }
// }
}
......@@ -521,7 +521,7 @@ public class JobService implements IJobService {
if (iMsgDao.existsById(msgId)) {
Msg msg = iMsgDao.findById(msgId).get();
Toke toke= remoteSecurityService.getServerToken();
messageService.pushMsg(toke.getToke(), toke.getProduct(), toke.getAppKey(),msg);
messageService.pushMsgAndSave(toke.getToke(), toke.getProduct(), toke.getAppKey(),msg);
}
removeJob(jobName);
}
......
......@@ -279,4 +279,37 @@
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1171', '1171', '不可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1');
</sql>
</changeSet>
<changeSet author="tb" id="2021-09-08-tb-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="jc_alert_called_feedback"/>
</not>
</preConditions>
<comment>create table jc_alert_called_feedback</comment>
<sql>
CREATE TABLE `jc_alert_called_feedback` (
`sequence_nbr` bigint(30) NOT NULL COMMENT '主键',
`alert_called_id` bigint(30) NOT NULL COMMENT '警情id',
`status` varchar(255) NOT NULL COMMENT '反馈警情任务状态(执行中:executing,已完成:finished)',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`rec_user_id` bigint(30) NOT NULL COMMENT '更新人id',
`rec_user_name` varchar(50) NOT NULL COMMENT '更新人名称',
`rec_date` datetime NOT NULL COMMENT '更新时间',
`is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除(1:删除,0:未删除)',
PRIMARY KEY (`sequence_nbr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='警情反馈';
</sql>
</changeSet>
<changeSet author="tb" id="2021-09-08-tb-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="jc_power_transfer_company_resources" columnName="status"/>
</not>
</preConditions>
<comment>modify table jc_power_transfer_company_resources add status column</comment>
<sql>
ALTER TABLE `jc_power_transfer_company_resources` ADD status varchar(20) DEFAULT 'executing' COMMENT
'调派任务状态(执行中:executing,已完成:finished)';
</sql>
</changeSet>
</databaseChangeLog>
......@@ -200,6 +200,16 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-privilege</artifactId>
<version>${amos.version}</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>1.6.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.13</version>
......
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