Commit 572b0d5b authored by taabe's avatar taabe

修改配置文件;添加根据指定时间查询警情列表接口

parent 5d52e8dc
spring.application.name=JCS_FPY spring.application.name=JCS
server.servlet.context-path=/jcs server.servlet.context-path=/jcs
server.port=11100 server.port=11100
spring.profiles.active=dev spring.profiles.active=dev
......
package com.yeejoin.amos.boot.module.jcs.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 值班情况枚举
*
* @author DELL
*/
@Getter
@AllArgsConstructor
public enum DutyInfoEnum {
// 接警情况
接警情况("JJQK", "接警情况"),
// 出动状态
力量出动("LLCD", "出动状态");
private String key;
private String name;
}
package com.yeejoin.amos.boot.module.jcs.api.mapper; package com.yeejoin.amos.boot.module.jcs.api.mapper;
import java.util.List; import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormValueDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormValueDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import org.apache.ibatis.annotations.Param;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -16,4 +18,15 @@ public interface AlertFormValueMapper extends BaseMapper<AlertFormValue> { ...@@ -16,4 +18,15 @@ public interface AlertFormValueMapper extends BaseMapper<AlertFormValue> {
public List<AlertFormValueDto> selectListByCalledId(Long id); public List<AlertFormValueDto> selectListByCalledId(Long id);
/**
* 列转行查询
*
* @param fieldCodes 列
* @param groupCode 分组code
* @return List<Map>
*/
List<Map<String, Object>> listAll(
@Param("fieldCodes") List<String> fieldCodes,
@Param("groupCode") String groupCode
);
} }
...@@ -22,4 +22,22 @@ ...@@ -22,4 +22,22 @@
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
WHERE v.alert_called_id=#{id} WHERE v.alert_called_id=#{id}
</select> </select>
<select id="listAll" resultType="java.util.Map">
select
d.*
from
(
select
i.alert_called_id instanceId,
i.alert_type_code groupCode,
<foreach collection="fieldCodes" item="item" index="key" separator=",">
MAX(CASE WHEN i.FIELD_CODE = #{item} THEN i.FIELD_VALUE END) as ${item}
</foreach>
from
jc_alert_form_value i
where i.alert_type_code = #{groupCode}
GROUP by
i.alert_called_id)d
order by instanceId
</select>
</mapper> </mapper>
...@@ -4,6 +4,7 @@ import java.lang.reflect.Field; ...@@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.CommonUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -292,4 +294,17 @@ public class AlertCalledController extends BaseController { ...@@ -292,4 +294,17 @@ public class AlertCalledController extends BaseController {
}); });
return queryWrapper; return queryWrapper;
} }
/**
* 查询指定日期内警情列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/dateRange/list")
@ApiOperation(httpMethod = "GET", value = "查询指定日期内警情列表", notes = "查询指定日期内警情列表")
public ResponseModel<List<Map<String, Object>>> listByDateRange(@RequestParam("beginDate") String beginDate,
@RequestParam("endDate") String endDate) {
return ResponseHelper.buildResponse(iAlertCalledService.listByDateRange(beginDate, endDate));
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.Date; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -20,6 +11,16 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue; ...@@ -20,6 +11,16 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums; import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertCalledMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService; import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 警情接警记录 服务实现类 * 警情接警记录 服务实现类
...@@ -43,13 +44,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -43,13 +44,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired @Autowired
RuleAlertCalledService ruleAlertCalledService; RuleAlertCalledService ruleAlertCalledService;
public static String GROUP_CODE = "229";
/** /**
* *
* <pre> * <pre>
* 保存警情信息 * 保存警情信息
* </pre> * </pre>
* *
* @param alertCalledVo * @param alertCalledObjsDto
* @return * @return
*/ */
@Transactional @Transactional
...@@ -120,23 +124,24 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -120,23 +124,24 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
/* /**
* 根据id 修改警情 * 根据id 修改警情
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案 * type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
* */ *
*/
@Override @Override
@Transactional @Transactional(rollbackFor = RuntimeException.class)
public boolean updateAlertCalled(Long id, String code) { public boolean updateAlertCalled(Long id, String code) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { try {
switch (code) { switch (code) {
case "314": case "314":
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_status", 1).set("alert_stage", AlertStageEnums.ZBQJ.getValue()).set("alarm_type", AlertStageEnums.FJQ.getValue()).set("alarm_type_code", AlertStageEnums.FJQ.getCode()) ); .set("alert_status", 1).set("alert_stage", AlertStageEnums.ZBQJ.getValue()).set("alarm_type", AlertStageEnums.FJQ.getValue()).set("alarm_type_code", AlertStageEnums.FJQ.getCode()));
break; break;
case "315": case "315":
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_status", 1).set("alert_stage", AlertStageEnums.CZJS.getValue()) ); .set("alert_status", 1).set("alert_stage", AlertStageEnums.CZJS.getValue()));
break; break;
default: default:
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id) alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
...@@ -145,9 +150,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -145,9 +150,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
break; break;
} }
AlertCalled alertCalled =this.getById(id); AlertCalled alertCalled = this.getById(id);
//删除缓存 //删除缓存
redisUtils.del(RedisKey.ALERTCALLED_ID+id); redisUtils.del(RedisKey.ALERTCALLED_ID + id);
/** /**
* 同步更新存ES * 同步更新存ES
*/ */
...@@ -158,6 +163,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall ...@@ -158,6 +163,18 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
} }
} }
/**
* 根据时间区间查询警情列表信息
*
* @param beginDate 开始时间
* @param endDate 结束时间
*/
public List<Map<String, Object>> listByDateRange(String beginDate, String endDate) {
List<AlertCalled> alertCalledDtoList =
this.list(new LambdaQueryWrapper<AlertCalled>().between(AlertCalled::getCallTime, beginDate, endDate));
Map<String, List<AlertCalled>> alertCalledMap =
alertCalledDtoList.stream().collect(Collectors.groupingBy(AlertCalled::getAlertTypeCode));
List<Map<String, Object>> formValueList = iAlertFormValueService.listAll(GROUP_CODE);
return null;
}
} }
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormValueDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormValueDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertForm;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertFormValueMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertFormValueMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFormValueService; import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFormValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/** /**
...@@ -24,6 +29,9 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al ...@@ -24,6 +29,9 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al
@Autowired @Autowired
private AlertFormValueMapper alertFormValueMapper; private AlertFormValueMapper alertFormValueMapper;
@Autowired
private AlertFormServiceImpl alertFormService;
public List<AlertFormValueDto> queryByCalledId(Long alertCalledId) { public List<AlertFormValueDto> queryByCalledId(Long alertCalledId) {
return this.queryForList(null, false, alertCalledId); return this.queryForList(null, false, alertCalledId);
} }
...@@ -32,4 +40,16 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al ...@@ -32,4 +40,16 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al
return alertFormValueMapper.selectListByCalledId(id); return alertFormValueMapper.selectListByCalledId(id);
} }
/**
* 根据动态表单分组类型查询改分组下所有数据实例
*
* @param groupCode
* @return List<Map <String, Object>>
*/
public List<Map<String, Object>> listAll(String groupCode) {
List<AlertForm> columns =
alertFormService.list(new LambdaQueryWrapper<AlertForm>().eq(AlertForm::getAlertTypeCode, groupCode));
List<String> fieldCodes = Lists.transform(columns, AlertForm::getFieldCode);
return this.baseMapper.listAll(fieldCodes, groupCode);
}
} }
...@@ -392,7 +392,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -392,7 +392,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
"JQBSLX")); "JQBSLX"));
for (DataDictionary dataDictionary : dataDictionaries) { for (DataDictionary dataDictionary : dataDictionaries) {
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code", Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code",
dataDictionary.getCode())); dataDictionary.getCode()).eq("format", true));
List<PowerTransferCompanyDto> lastPowerTransferCompany; List<PowerTransferCompanyDto> lastPowerTransferCompany;
if ("警情续报".equals(template.getType()) && (lastPowerTransferCompany = if ("警情续报".equals(template.getType()) && (lastPowerTransferCompany =
powerTransferService.getLastPowerTransferCompany(alertCalledId)).size() > 0) { powerTransferService.getLastPowerTransferCompany(alertCalledId)).size() > 0) {
......
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