Commit 1370c9e8 authored by tangwei's avatar tangwei

指令流接口

parent 9e6c1185
package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 警情报送记录
*
* @author tb
* @date 2021-06-17
*/
@Data
@ApiModel(value="AlertSubmittedZHDto", description=" 指挥警情报送记录")
public class AlertSubmittedZHDto {
@ApiModelProperty(value = "主键ID")
protected Long sequenceNbr;
@ApiModelProperty(value = "业务类型(警情续报、非警情确认、警情结案)")
private String businessType;
@ApiModelProperty(value = "报送时间")
private Date submissionTime;
@ApiModelProperty(value = "报送内容")
private String submissionContent;
@ApiModelProperty(value = " 单位名称")
private String companyName;
@ApiModelProperty(value = "人员名称")
private String userName;
}
package com.yeejoin.amos.boot.module.jcs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 警情报送记录
*
* @author tb
* @date 2021-06-17
*/
@Data
@ApiModel(value="InstructionsZHDto", description=" 指令报送记录")
public class InstructionsZHDto {
@ApiModelProperty(value = "主键ID")
protected Long sequenceNbr;
@ApiModelProperty(value = "业务类型")
private String type;
@ApiModelProperty(value = "报送时间")
private Date submissionTime;
@ApiModelProperty(value = "报送内容")
private String content;
public InstructionsZHDto(Long sequenceNbr, String type, Date submissionTime, String content) {
this.sequenceNbr = sequenceNbr;
this.type = type;
this.submissionTime = submissionTime;
this.content = content;
}
public InstructionsZHDto() {
}
}
package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 调派单位
*
* @author tb
* @date 2021-06-17
*/
@Data
@ApiModel(value="PowerTransferCompanyZHDto", description=" 指挥调派单位")
public class PowerTransferCompanyZHDto {
@ApiModelProperty(value = "主键ID")
protected Long sequenceNbr;
@ApiModelProperty(value = " 单位名称")
private String companyName;
@ApiModelProperty(value = "调派类型")
private String dispatchType;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "是否只派发机构")
private Boolean isDistributionAgencies;
@ApiModelProperty(value = "更新时间")
protected Date recDate;
@ApiModelProperty(value = "报送内容")
private String submissionContent;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedExtDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
......@@ -40,4 +41,19 @@ public interface AlertSubmittedMapper extends BaseMapper<AlertSubmitted> {
AlertSubmittedSMSDto getSchedulingContent(@Param("id") Long id);
/**
* * @param null
* @return
* <PRE>
* author tw
* date 2021/7/21
* </PRE>
* 报送记录
*/
List<AlertSubmittedZHDto> listAlertSubmittedZHDto(@Param("id") Long id);
}
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 调派单位 Mapper 接口
......@@ -10,5 +15,15 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
* @date 2021-06-17
*/
public interface PowerTransferCompanyMapper extends BaseMapper<PowerTransferCompany> {
/**
* * @param null
* @return
* <PRE>
* author tw
* date 2021/7/21
* </PRE>
* 调派记录
*/
List<PowerTransferCompanyZHDto> listPowerTransferCompanyZHDto(@Param("id") Long id);
}
......@@ -2,10 +2,13 @@ package com.yeejoin.amos.boot.module.jcs.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import java.util.List;
/**
* 警情报送记录 服务类
*
......@@ -40,4 +43,10 @@ public interface IAlertSubmittedService extends IService<AlertSubmitted> {
Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception;
AlertSubmittedSMSDto getSchedulingContent(Long id);
List<InstructionsZHDto> getInstructionsZHDtoList(Long id);
}
......@@ -83,4 +83,48 @@
WHERE
o.sequence_nbr = ${id}
</select>
<select id="listAlertSubmittedZHDto" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto">
SELECT
g.business_type businessType,
g.sequence_nbr sequenceNbr,
g.submission_time submissionTime,
g.submission_content submissionContent,
g.company_name companyName,
group_concat( DISTINCT g.user_name ) AS userName
FROM
(
SELECT
a.sequence_nbr,
a.business_type,
a.submission_time,
a.submission_content,
b.company_name,
b.user_name
FROM
jc_alert_submitted a
LEFT JOIN jc_alert_submitted_object b ON a.sequence_nbr = b.alert_submitted_id
WHERE
a.alert_called_id = ${id}
) g
GROUP BY
g.business_type,
g.sequence_nbr,
g.submission_time,
g.submission_content,
g.company_name;
</select>
</mapper>
......@@ -2,4 +2,40 @@
<!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.PowerTransferCompanyMapper">
<select id="listPowerTransferCompanyZHDto" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto">
SELECT
g.sequence_nbr sequenceNbr,
g.rec_date recDate,
g.dispatch_type dispatchType,
g.address,
g.is_distribution_agencies isDistributionAgencies,
g.company_name companyName,
group_concat( DISTINCT concat( g.resources_name, "(车牌:", g.resources_num, ")" ) ) AS submissionContent
FROM
(
SELECT
a.sequence_nbr,
a.dispatch_type,
a.rec_date,
a.address,
b.company_name,
b.is_distribution_agencies,
c.resources_name,
c.resources_num
FROM
jc_power_transfer a
LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
LEFT JOIN jc_power_transfer_company_resources c ON b.sequence_nbr = c.power_transfer_company_id
WHERE
a.alert_called_id = ${id}
) g
GROUP BY
g.company_name,
g.rec_date,
g.dispatch_type,
g.address,
g.is_distribution_agencies,
g.sequence_nbr;
</select>
</mapper>
......@@ -10,8 +10,10 @@ import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.service.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -57,6 +59,8 @@ public class CommandController extends BaseController {
IOrgUsrService iOrgUsrService;
@Autowired
ILinkageUnitService iLinkageUnitService;
@Autowired
IAlertSubmittedService alertSubmittedService;
/**
* 警情列表
*
......@@ -347,6 +351,18 @@ public class CommandController extends BaseController {
/**
* 根据id指令
*
* @param id
* @return
*/
@TycloudOperation(needAuth = false,ApiLevel = UserType.AGENCY)
@RequestMapping(value = "ZL/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据警情id查询指令信息", notes = "根据警情id查询指令信息")
public ResponseModel<List<InstructionsZHDto>> selectZL(@PathVariable Long id) {
return ResponseHelper.buildResponse(alertSubmittedService.getInstructionsZHDtoList(id));
}
......
......@@ -170,7 +170,7 @@ public class AlertCalledController extends BaseController {
* 相似警情分页查询
* </pre>
*
* @param alertCalled
* @param
* @param current
* @param size
* @return
......
......@@ -101,7 +101,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
public Object selectAlertCalledById(Long id) {
if(redisUtils.hasKey(RedisKey.ALERTCALLED_ID+id)){
Object obj= redisUtils.get(RedisKey.ALERTCALLED_ID+id);
return ResponseHelper.buildResponse(obj);
return obj;
}else{
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
......@@ -119,7 +119,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
redisUtils.set(RedisKey.ALERTCALLED_ID+id, JSON.toJSON(alertCalledFormVo),time);
return ResponseHelper.buildResponse(alertCalledFormVo);
return alertCalledFormVo;
}
}
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,16 +30,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedExtDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
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.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
......@@ -100,6 +86,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
AlertSubmittedMapper alertSubmittedMapper;
@Autowired
PowerTransferCompanyMapper powerTransferCompanyMapper;
@Override
public SchedulingReportingDto listSchedulingByParam(AlertSubmittedDto queryParam) {
SchedulingReportingDto schedulingReportingDto = new SchedulingReportingDto();
......@@ -420,6 +411,73 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
return this.baseMapper.getSchedulingContent(id);
}
@Override
public List<InstructionsZHDto> getInstructionsZHDtoList(Long id) {
List<InstructionsZHDto> listInstructionsZHDto=new ArrayList<>();
//获取调派记录
List<PowerTransferCompanyZHDto> listPowerTransferCompanyZHDto=powerTransferCompanyMapper.listPowerTransferCompanyZHDto(id);
listPowerTransferCompanyZHDto.stream().forEach(PowerTransferCompanyZHDto->{
String content="";
if(PowerTransferCompanyZHDto.getIsDistributionAgencies()){
content="调派"+PowerTransferCompanyZHDto.getCompanyName()+"前往"+PowerTransferCompanyZHDto.getAddress();
}else{
content="调派"+PowerTransferCompanyZHDto.getCompanyName()+PowerTransferCompanyZHDto.getSubmissionContent()+"前往"+PowerTransferCompanyZHDto.getAddress();
}
InstructionsZHDto instruct = new InstructionsZHDto(PowerTransferCompanyZHDto.getSequenceNbr(),PowerTransferCompanyZHDto.getDispatchType(), PowerTransferCompanyZHDto.getRecDate(), content);
listInstructionsZHDto.add(instruct);
});
//获取融合调度信息
List<AlertSubmittedZHDto> listAlertSubmittedZHDto= alertSubmittedMapper.listAlertSubmittedZHDto(id);
listAlertSubmittedZHDto.stream().forEach(AlertSubmittedZHDto->{
JSONObject js= JSONObject.parseObject(AlertSubmittedZHDto.getSubmissionContent());
String content="";
switch(AlertSubmittedZHDto.getBusinessType()){
case "警情初报":
content="通知"+AlertSubmittedZHDto.getUserName()+","+js.getString("address")+"发生"+js.getString("alertType");
break;
case "警情续报":
content="通知"+AlertSubmittedZHDto.getUserName()+","+"现场被困人数:"+js.getString("trappedNum")+"人伤亡人数:"+js.getString("casualtiesNum")+"人。";
break;
case "非警情确认":
content="通知"+AlertSubmittedZHDto.getUserName()+","+"此警情现场确认为假警情。";
break;
case "警情结案":
content="通知"+AlertSubmittedZHDto.getUserName()+","+"此警情已完场警情处置,警情已结案。";
break;
default:
break;
}
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(),AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content);
listInstructionsZHDto.add(instruct);
});
//排序时间倒序
List<InstructionsZHDto> listA=listInstructionsZHDto.stream().sorted(Comparator.comparing(InstructionsZHDto::getSubmissionTime).reversed()).collect(Collectors.toList());
return listA;
}
/**
* 将Object对象里面的属性和值转化成Map对象
*
......
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