Commit 93b28749 authored by 李腾威's avatar 李腾威

日常管理-警情填报调试

parent 3478af19
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author litw
* @date 2021-08-09.
*/
@Data
@ApiModel(value="AlertCallInfoDto", description="初始化表单数据")
public class AlertCallInfoDto {
@ApiModelProperty(value = "警情工单编号")
private String workOrderNumber;
@ApiModelProperty(value = "接警时间")
private String callTime;
@ApiModelProperty(value = "接警人Id")
private String recUserId;
@ApiModelProperty(value = "接警人")
private String recUserName;
}
......@@ -126,4 +126,15 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "警情地址")
private String alertAddress;
/**
* 工单编号
*/
@ApiModelProperty("工单编号")
private String workOrderNumber;
@ApiModelProperty(value = "接警时间str")
private String callTimeStr;
@ApiModelProperty(value = "接警人")
protected String recUserName;
}
......@@ -162,6 +162,12 @@ public class AlertCalled extends BaseEntity {
@TableField("org_code")
private String orgCode;
/**
* 工单编号
*/
@TableField("work_order_number")
private String workOrderNumber;
@TableField("city")
@ApiModelProperty(value = "所属地市")
private String city;
......@@ -195,6 +201,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "是否处警")
private Boolean isFatherAlert = false;
@TableField(exist=false)
@ApiModelProperty(value = "接警时间str")
private String callTimeStr;
}
......@@ -204,4 +204,10 @@ public class AlertCalledVo extends BaseEntity {
@ApiModelProperty(value = "响应级别")
private String responseLevel;
/**
* 工单编号
*/
@ApiModelProperty("工单编号")
private String workOrderNumber;
}
......@@ -5,10 +5,10 @@
<select id="queryAlertStatusCount" resultType="java.util.Map">
SELECT
count( 1 ) calledCount,
sum( CASE WHEN father_alert = null THEN 1 ELSE 0 END ) majorAlertCount
sum( CASE WHEN alarm_type_code = 'KRJY' THEN 1 ELSE 0 END ) sleepyIncidentCount
sum( CASE WHEN alarm_type_code = 'GZWX' THEN 1 ELSE 0 END ) faultRescueCount
sum( CASE WHEN alarm_type_code = 'TSZX' l THEN 1 ELSE 0 END ) suggestionsCount
sum( CASE WHEN father_alert = null THEN 1 ELSE 0 END ) majorAlertCount,
sum( CASE WHEN alarm_type_code = 'KRJY' THEN 1 ELSE 0 END ) sleepyIncidentCount,
sum( CASE WHEN alarm_type_code = 'GZWX' THEN 1 ELSE 0 END ) faultRescueCount,
sum( CASE WHEN alarm_type_code = 'TSZX' THEN 1 ELSE 0 END ) suggestionsCount
FROM
tz_alert_called
WHERE 1 = 1
......@@ -18,9 +18,6 @@
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> #{endDate}
</if>
<if test="alarmTypeCode != null and alarmTypeCode != ''">
and alarm_type_code = #{alarmTypeCode}
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -10,6 +11,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCallInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
......@@ -128,6 +130,7 @@ public class AlertCalledController extends BaseController {
}
/**
* 根据id查询
*
......@@ -141,6 +144,48 @@ public class AlertCalledController extends BaseController {
return ResponseHelper.buildResponse(iAlertCalledService.selectAlertCalledById(id));
}
/**
* 生成工单编号报警人及报警时间
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getWorkOderNumber")
@ApiOperation(httpMethod = "GET",value = "生成工单编号报警人及报警时间", notes = "生成工单编号报警人及报警时间")
public ResponseModel<AlertCallInfoDto> selectOne() throws ParseException {
String workOrderNumber = nextId();
AlertCallInfoDto alertCallInfoDto = new AlertCallInfoDto();
alertCallInfoDto.setCallTime(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss "));
alertCallInfoDto.setWorkOrderNumber(workOrderNumber);
alertCallInfoDto.setRecUserId(getUserInfo().getUserId());
alertCallInfoDto.setRecUserName(getUserInfo().getUserName());
return ResponseHelper.buildResponse(alertCallInfoDto);
}
/**
* 获取下一个 工单编号
*
* @return 下一个 工单编号
*/
public synchronized String nextId() throws ParseException {
String number = DateUtils.stampToDate(SystemClock.now(),"yyyy-MM-dd HH:mm:ss SSS");
String newNumber = number.replace("-","").replace(" ","").replace(":","");
ReginParams reginParams =
JSONObject.parseObject(null != redisUtils.get(buildKey(getToken())) ?
redisUtils.get(buildKey(getToken())).toString() : null, ReginParams.class);
// Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.dateFormat(new Date(),"")+" 00:00:00",
// DateUtils.dateFormat(new Date(),"")+" 23:59:59",reginParams.getCompany().getOrgCode(),
// reginParams.getUserModel().getUserId());
Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.dateFormat(new Date(),"")+" 00:00:00",
DateUtils.dateFormat(new Date(),"")+" 23:59:59",null,
null);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(newNumber);
String workOrderNumber = stringBuilder.append(map.get("calledCount") == null ? "1" : String.valueOf(Integer.parseInt(map.get("calledCount").toString()) + 1)).toString() ;
return workOrderNumber;
}
/**
* 警情统计
......@@ -148,7 +193,7 @@ public class AlertCalledController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/alert-statistics")
@GetMapping(value = "/alertStatistics")
@ApiOperation(httpMethod = "GET",value = "警情统计", notes = "警情统计")
public ResponseModel<AlarmStatisticsVo> alertStatistics() throws ParseException {
ReginParams reginParams =
......
......@@ -31,7 +31,6 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -134,10 +133,10 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledObjsDto.getAlertCalledDto(),AlertCalled.class);
alertCalled.setCallTime(new Date());
alertCalled.setCallTime(DateUtils.longStr2Date(alertCalled.getCallTimeStr()));
// 判断是否归并警情
if (alertCalled.getFatherAlert() == null) {
if (alertCalled.getFatherAlert() != null) {
// 警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
alertCalled.setAlertStage(AlertStageEnums.JJ.getValue());
......@@ -150,18 +149,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
if(AlertStageEnums.GZWX.toString().equals(alertCalled.getAlarmTypeCode()) ){
alertFormValue.setAlertTypeCode(AlertStageEnums.GZWX.getCode());
}
if(AlertStageEnums.TSZX.toString().equals(alertCalled.getAlarmTypeCode()) ) {
alertFormValue.setAlertTypeCode(AlertStageEnums.TSZX.getCode());
}
if(AlertStageEnums.KRJY.toString().equals(alertCalled.getAlarmTypeCode()) ) {
alertFormValue.setAlertTypeCode(AlertStageEnums.KRJY.getCode());
}
alertFormValue.setAlertTypeCode(alertCalled.getAlarmTypeCode());
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
// 警情基本信息
AlertCalled alertCalledFather = this.getById(alertCalled.getFatherAlert());
alertCalledObjsDto.setAlertCalledDto(BeanDtoVoUtils.convert(alertCalledFather,AlertCalledDto.class));
} else {
// 警情报送
// ****************************************************待确认开发
......@@ -178,17 +173,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
if(AlertStageEnums.GZWX.toString().equals(alertCalled.getAlarmTypeCode()) ){
alertFormValue.setAlertTypeCode(AlertStageEnums.GZWX.getCode());
}
if(AlertStageEnums.TSZX.toString().equals(alertCalled.getAlarmTypeCode()) ) {
alertFormValue.setAlertTypeCode(AlertStageEnums.TSZX.getCode());
}
if(AlertStageEnums.KRJY.toString().equals(alertCalled.getAlarmTypeCode()) ) {
alertFormValue.setAlertTypeCode(AlertStageEnums.KRJY.getCode());
}
alertFormValue.setAlertTypeCode(alertCalled.getAlarmTypeCode());
});
if(AlertStageEnums.KRJY.toString().equals(alertCalled.getAlarmTypeCode()) ) {
if(AlertStageEnums.KRJY.getCode().equals(alertCalled.getAlarmTypeCode()) ) {
//困人救援创建警情时创建救援过程信息
rescueProcessServiceImpl.getProcessByAlertId(alertCalled.getSequenceNbr());
}
......
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