Commit 88bdbf51 authored by chenhao's avatar chenhao

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

parents 5d2c1d2e 8baec012
......@@ -43,15 +43,18 @@ public class RoutePointRespone {
private String equipmentName;
public String getAddress() {
return address;
}
/**
* 具体位置:buildName + address
*/
private String position;
public void setAddress(String address) {
this.address = address;
public String getPosition() {
return position;
}
private String address;
public void setPosition(String position) {
this.position = position;
}
private int orderNo;
......
......@@ -23,11 +23,23 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
* @param endDate
* @return
*/
List<Map<String, Integer>> queryNearlyCount(@Param("beginDate") String beginDate,
@Param("endDate") String endDate,
@Param("orgCode") String orgCode,
@Param("recUserId") String recUserId
);
/**
* 接警情况统计
*
* @param beginDate
* @param endDate
* @return
*/
Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate,
@Param("endDate") String endDate,
@Param("orgCode") String orgCode,
@Param("recUserId") String recUserId
);
);
/**
* 根据查询条件返回警情记录
......
......@@ -6,9 +6,9 @@
SELECT
count( 1 ) calledCount,
sum( CASE WHEN father_alert is 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
sum( CASE WHEN alarm_type_code = '960' THEN 1 ELSE 0 END ) sleepyIncidentCount,
sum( CASE WHEN alarm_type_code = '961' THEN 1 ELSE 0 END ) faultRescueCount,
sum( CASE WHEN alarm_type_code = '962' THEN 1 ELSE 0 END ) suggestionsCount
FROM
tz_alert_called
WHERE 1 = 1
......@@ -24,6 +24,127 @@
</if>
</select>
<select id="queryNearlyCount" resultType="java.util.Map">
SELECT
DATE_ADD(#{beginDate},INTERVAL -1 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -1 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -1 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -2 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -2 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -2 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -3 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -3 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -3 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -4 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -4 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -4 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -5 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -5 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -5 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -6 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -6 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -6 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
UNION ALL
SELECT
DATE_ADD(#{beginDate},INTERVAL -7 DAY) dateTime,
sum( CASE WHEN father_alert is null THEN 1 ELSE 0 END ) majorAlertCount
FROM
tz_alert_called
WHERE 1 = 1
<if test="beginDate != null and beginDate != ''">
and call_time >= DATE_ADD(#{beginDate},INTERVAL -7 DAY)
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> DATE_ADD(#{endDate},INTERVAL -7 DAY)
</if>
<if test="orgCode != null and orgCode != '' and recUserId != null and recUserId != ''" >
and org_code= #{orgCode}
or rec_user_id = #{recUserId}
</if>
</select>
<select id="queryAlertListByQueryDto" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto">
SELECT
a.work_order_number AS workOrderNumber,
......
......@@ -26,9 +26,9 @@ public class PointDto {
private String equipmentName;
/**
* 位置
* 具体位置:buildName + address
*/
private String address;
private String position;
/**
......
......@@ -353,6 +353,9 @@ public class PointServiceImpl implements IPointService {
PointVo pointVo = new PointVo();
BeanUtils.copyProperties(point, pointVo);
pointVo.setInputItemNum(pointInputItems.stream().filter(i -> i.getPointId() == point.getId()).count());
String buildingName = StringUtil.isNotEmpty(point.getBuildingName()) ? point.getBuildingName() : "";
String address = StringUtil.isNotEmpty(point.getAddress()) ? point.getAddress() : "";
pointVo.setPosition(buildingName + address);
pointVoList.add(pointVo);
}
Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort());
......@@ -1157,6 +1160,9 @@ public class PointServiceImpl implements IPointService {
PointDto pointDto = new PointDto();
BeanUtils.copyProperties(point, pointDto);
pointDto.setPointInputItems(pointInputItems.stream().filter(i -> i.getPointId() == point.getId()).collect(Collectors.toList()));
String buildingName = StringUtil.isNotEmpty(point.getBuildingName()) ? point.getBuildingName() : "";
String address = StringUtil.isNotEmpty(point.getAddress()) ? point.getAddress() : "";
pointDto.setPosition(buildingName + address);
pointDtos.add(pointDto);
}
Pageable pageable = new CommonPageable(pointPage.getNumber(), pointPage.getSize(), pointPage.getSort());
......
......@@ -22,7 +22,17 @@ public class PointVo {
private Date createDate;
public Date getCreateDate() {
private String originalId;
public String getOriginalId() {
return originalId;
}
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public Date getCreateDate() {
return createDate;
}
......@@ -48,10 +58,36 @@ public class PointVo {
private String equipmentName;
/**
* 建筑名称
*/
private String buildingName;
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
/**
* 位置
*/
private String address;
/**
* 具体位置:buildName + address
*/
private String position;
public String getAddress() {
return address;
}
......
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
......@@ -20,12 +20,16 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -50,6 +54,8 @@ import java.lang.reflect.Field;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
......@@ -147,7 +153,7 @@ public class AlertCalledController extends BaseController {
alertCallInfoDto.setCallTime(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss "));
alertCallInfoDto.setWorkOrderNumber(workOrderNumber);
alertCallInfoDto.setRecUserId(getUserInfo().getUserId());
alertCallInfoDto.setRecUserName(getUserInfo().getUserName());
alertCallInfoDto.setRecUserName(getUserInfo().getRealName());
return ResponseHelper.buildResponse(alertCallInfoDto);
}
......@@ -162,12 +168,13 @@ public class AlertCalledController extends BaseController {
String number = DateUtils.stampToDate(SystemClock.now(),"yyyy-MM-dd HH:mm:ss SSS");
String newNumber = number.replace("-","").replace(" ","").replace(":","");
ReginParams reginParams =getSelectedOrgInfo();
// 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.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 00:00:00",
DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 23:59:59",null,
null);
AgencyUserModel user = reginParams.getUserModel();
String orgCode = ValidationUtil.isEmpty(user.getCompanys()) ? null : user.getCompanys().get(0).getOrgCode();
Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_TIME_PATTERN),
DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_TIME_PATTERN),orgCode,
user.getUserId());
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() ;
......@@ -182,7 +189,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/alertStatistics")
@ApiOperation(httpMethod = "GET",value = "警情统计", notes = "警情统计")
public ResponseModel<AlarmStatisticsDto> alertStatistics() throws ParseException {
public ResponseModel<AlarmStatisticsDto> alertStatistics() {
ReginParams reginParams =getSelectedOrgInfo();
//我的待办数量
......@@ -202,8 +209,8 @@ public class AlertCalledController extends BaseController {
alarmStatisticsDto.setAllNum(iAlertCalledService.list(allNumQueryWrapper).size());
Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 00:00:00",
DateUtils.stampToDate(System.currentTimeMillis(),"yyyy-MM-dd")+" 23:59:59",null,
Map<String, Object> map = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN),null,
getUserInfo().getUserId());
// 当天接警
......@@ -217,15 +224,16 @@ public class AlertCalledController extends BaseController {
//困人救援数量
alarmStatisticsDto.setSleepyIncident(map.get("sleepyIncidentCount") == null ? 0 : Integer.valueOf(map.get("sleepyIncidentCount").toString())) ;
Map<String,Integer> recordMap = Maps.newHashMap();
LinkedHashMap<String,Integer> recordMap = new LinkedHashMap<>();
// 近七天办理数量
for(int i = 1 ; i < 8; i++) {
Map<String, Object> nearlySevenDaysMap = iAlertCalledService.getAlertInfoList(DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), -i).getTime(),"yyyy-MM-dd")+" 00:00:00",
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), -i).getTime(),"yyyy-MM-dd")+" 23:59:59",null,
getUserInfo().getUserId());
recordMap.put(DateUtils.stampToDate(DateUtils.dateAddDays(new Date(), -i).getTime(),"yyyy-MM-dd"),nearlySevenDaysMap.get("calledCount") == null ? 0 : Integer.valueOf(nearlySevenDaysMap.get("calledCount").toString()));
}
alarmStatisticsDto.setNearlySevenDaysNum(recordMap);
Map<String, Object> nearlySevenDaysMap = iAlertCalledService.getNearlyInfo(DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN),null,
getUserInfo().getUserId());
for(int i = 0; i<nearlySevenDaysMap.size()/2;i++) {
recordMap.put(DateUtils.dateToString(nearlySevenDaysMap.get("dateTime"+i).toString()), Integer.parseInt(nearlySevenDaysMap.get("majorAlertCount"+i).toString()));
}
alarmStatisticsDto.setNearlySevenDaysNum(recordMap);
}
return ResponseHelper.buildResponse(alarmStatisticsDto);
}
......@@ -256,7 +264,7 @@ public class AlertCalledController extends BaseController {
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
IPage<AlertCalledDto> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageDto(page);
calledVoIPage.getRecords().stream().forEach(e->{
e.setAlertAddress(e.getCity()+e.getDistrict());
getResponseLevel(e.getSequenceNbr(), e,null);
});
return ResponseHelper.buildResponse(calledVoIPage);
}
......@@ -316,6 +324,28 @@ public class AlertCalledController extends BaseController {
return queryWrapper;
}
void getResponseLevel(Long alertId, AlertCalledDto alertCalledDto, ESAlertCalledDto esAlertCalledDto) {
LambdaQueryWrapper<DispatchPaper> dispatchPaperQueryWrapper = new LambdaQueryWrapper<>();
dispatchPaperQueryWrapper.eq(DispatchPaper::getAlertId,alertId);
DispatchPaper dispatchPaper = dispatchPaperServiceImpl.getOne(dispatchPaperQueryWrapper);
if(null != dispatchPaper) {
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertFormValue::getAlertCalledId, dispatchPaper.getSequenceNbr()).eq(AlertFormValue::getAlertTypeCode, DispatchPaperEnums.getEnumById(dispatchPaper.getAlertCode()).getDynamicCode());
// 派遣单动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
// map 存取数据
Map<String,String> dynamicParms = new HashMap<String,String>();
list.stream().forEach(paperFormValue -> {
dynamicParms.put(paperFormValue.getFieldCode(),paperFormValue.getFieldValue());
});
String responseLevel = dynamicParms.get("response_level");
if(null != alertCalledDto) {
alertCalledDto.setResponseLevel(responseLevel);
} else {
esAlertCalledDto.setResponseLevel(responseLevel);
}
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
......@@ -34,6 +20,17 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 警情接警填报记录服务实现类
......@@ -263,4 +260,20 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return result;
}
public Map<String, Object> getNearlyInfo(String beginDate, String endDate,String orgCode, String recUserId) {
Map<String, Object> result = Maps.newHashMap();
List<Map<String, Integer>> statusCountMap = alertCalledMapper.queryNearlyCount(beginDate, endDate,orgCode,recUserId);
for(int i = 0; i<statusCountMap.size();i++) {
if(statusCountMap.get(i).size() > 1) {
result.put("dateTime"+i,statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount"+i,statusCountMap.get(i).get("majorAlertCount"));
} else {
result.put("dateTime"+i,statusCountMap.get(i).get("dateTime"));
result.put("majorAlertCount"+i,0);
}
}
return result;
}
}
\ No newline at end of file
......@@ -242,7 +242,7 @@
(SELECT GROUP_CONCAT(name SEPARATOR ';') FROM p_point_classify WHERE point_id = p.id GROUP BY point_id) classifyName,
p.belong_system_name,
p.equipment_name,
p.address,
concat_ws('',ifnull(p.building_name,''),ifnull(p.address,'')) as position,
(select count(1) from p_route_point_item rpi where rpi.route_point_id = rp.id) as routePointItemNum
FROM
p_route_point rp
......
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