Commit 108d313e authored by taabe's avatar taabe

交接班-接警情况接口修改

parent 9679e4ca
...@@ -14,5 +14,12 @@ import java.util.Map; ...@@ -14,5 +14,12 @@ import java.util.Map;
*/ */
public interface AlertCalledMapper extends BaseMapper<AlertCalled> { public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
/**
* 接警情况统计-交接班用
*
* @param beginDate
* @param endDate
* @return
*/
Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate); Map<String, Integer> queryAlertStatusCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
} }
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
sum( CASE WHEN alert_type_code = 230 THEN 1 ELSE 0 END ) majorAlertCount sum( CASE WHEN alert_type_code = 230 THEN 1 ELSE 0 END ) majorAlertCount
FROM FROM
jc_alert_called jc_alert_called
WHERE WHERE 1 = 1
call_time BETWEEN #{beginDate} AND #{endDate} <if test="beginDate != null and beginDate != ''">
and call_time >= #{beginDate}
</if>
<if test="endDate != null and endDate != ''">
and call_time <![CDATA[ <= ]]> #{endDate}
</if>
</select> </select>
</mapper> </mapper>
...@@ -42,9 +42,9 @@ ...@@ -42,9 +42,9 @@
<if test="params != null and params.size > 0 "> <if test="params != null and params.size > 0 ">
where 1=1 where 1=1
<foreach collection="params" index="key" item="value"> <foreach collection="params" index="key" item="value">
<if test="key != null and key == 'beginDate'"> <if test="key != null and key == 'beginDate' and value != null and value != ''">
and d.recDate >= #{value} and d.recDate >= #{value}
</if> </if>
<if test="key != null and key == 'endDate'"> <if test="key != null and key == 'endDate'">
and d.recDate <![CDATA[<=]]> #{value} and d.recDate <![CDATA[<=]]> #{value}
</if> </if>
......
...@@ -303,7 +303,7 @@ public class AlertCalledController extends BaseController { ...@@ -303,7 +303,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/dateRange/list") @GetMapping(value = "/dateRange/list")
@ApiOperation(httpMethod = "GET", value = "查询指定日期内警情列表", notes = "查询指定日期内警情列表") @ApiOperation(httpMethod = "GET", value = "查询指定日期内警情列表", notes = "查询指定日期内警情列表")
public ResponseModel<Map<String, Object>> listByDateRange(@RequestParam("beginDate") String beginDate, public ResponseModel<Map<String, Object>> listByDateRange(@RequestParam(value = "beginDate", required = false) String beginDate,
@RequestParam("endDate") String endDate) { @RequestParam("endDate") String endDate) {
return ResponseHelper.buildResponse(iAlertCalledService.getAlertInfoList(beginDate, endDate)); return ResponseHelper.buildResponse(iAlertCalledService.getAlertInfoList(beginDate, endDate));
} }
......
...@@ -185,8 +185,10 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -185,8 +185,10 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
*/ */
public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) { public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
// 查询指定日期内的警情列表 // 查询指定日期内的警情列表
List<AlertCalled> alertCalledList = List<AlertCalled> alertCalledList =
this.list(new LambdaQueryWrapper<AlertCalled>().between(AlertCalled::getCallTime, beginDate, endDate)); this.list(new LambdaQueryWrapper<AlertCalled>().apply(!ValidationUtil.isEmpty(beginDate),
"call_time >= " + beginDate).le(true, AlertCalled::getCallTime, endDate));
Map<String, String> queryParams = Maps.newHashMap(); Map<String, String> queryParams = Maps.newHashMap();
queryParams.put("beginDate", beginDate); queryParams.put("beginDate", beginDate);
queryParams.put("endDate", endDate); queryParams.put("endDate", endDate);
...@@ -196,8 +198,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -196,8 +198,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalledList.stream().collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode)); alertCalledList.stream().collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode));
Map<Long, AlertCalled> calledMap = Map<Long, AlertCalled> calledMap =
alertCalledList.stream().collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity())); alertCalledList.stream().collect(Collectors.toMap(AlertCalled::getSequenceNbr, Function.identity()));
alertCalledMap.forEach((alert, list) -> { alertCalledMap.forEach((alertTypeCode, list) -> {
allList.addAll(iAlertFormValueService.listAll(alert, queryParams)); allList.addAll(iAlertFormValueService.listAll(alertTypeCode, queryParams));
}); });
allList.forEach(i -> { allList.forEach(i -> {
......
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