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.port=11100
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;
import java.util.List;
import java.util.Map;
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.entity.AlertFormValue;
import org.apache.ibatis.annotations.Param;
/**
* Mapper 接口
......@@ -16,4 +18,15 @@ public interface AlertFormValueMapper extends BaseMapper<AlertFormValue> {
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 @@
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
WHERE v.alert_called_id=#{id}
</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>
......@@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -292,4 +294,17 @@ public class AlertCalledController extends BaseController {
});
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;
import java.util.Date;
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.query.LambdaQueryWrapper;
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.RedisUtils;
......@@ -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.mapper.AlertCalledMapper;
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
@Autowired
RuleAlertCalledService ruleAlertCalledService;
public static String GROUP_CODE = "229";
/**
*
* <pre>
* 保存警情信息
* </pre>
*
* @param alertCalledVo
* @param alertCalledObjsDto
* @return
*/
@Transactional
......@@ -118,46 +122,59 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
throw new RuntimeException("报送失败,系统异常!");
}
}
/*
* 根据id 修改警情
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
* */
/**
* 根据id 修改警情
* type:警情相关 操作类型 0警情续报 1非警情确认 2 警情结案
*
*/
@Override
@Transactional
public boolean updateAlertCalled(Long id, String code) {
@Transactional(rollbackFor = RuntimeException.class)
public boolean updateAlertCalled(Long id, String code) {
// TODO Auto-generated method stub
try {
switch (code) {
case "314":
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()) );
break;
case "315":
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_status", 1).set("alert_stage", AlertStageEnums.CZJS.getValue()) );
break;
default:
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_stage", AlertStageEnums.CZGZ.getValue()));
break;
}
AlertCalled alertCalled =this.getById(id);
case "314":
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()));
break;
case "315":
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_status", 1).set("alert_stage", AlertStageEnums.CZJS.getValue()));
break;
default:
alertCalledMapper.update(null, new UpdateWrapper<AlertCalled>().eq("sequence_nbr", id)
.set("alert_stage", AlertStageEnums.CZGZ.getValue()));
break;
}
AlertCalled alertCalled = this.getById(id);
//删除缓存
redisUtils.del(RedisKey.ALERTCALLED_ID+id);
/**
* 同步更新存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
redisUtils.del(RedisKey.ALERTCALLED_ID + id);
/**
* 同步更新存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
return true;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 根据时间区间查询警情列表信息
*
* @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;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
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.mapper.AlertFormValueMapper;
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;
/**
......@@ -23,6 +28,9 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al
@Autowired
private AlertFormValueMapper alertFormValueMapper;
@Autowired
private AlertFormServiceImpl alertFormService;
public List<AlertFormValueDto> queryByCalledId(Long alertCalledId) {
return this.queryForList(null, false, alertCalledId);
......@@ -32,4 +40,16 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al
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
"JQBSLX"));
for (DataDictionary dataDictionary : dataDictionaries) {
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code",
dataDictionary.getCode()));
dataDictionary.getCode()).eq("format", true));
List<PowerTransferCompanyDto> lastPowerTransferCompany;
if ("警情续报".equals(template.getType()) && (lastPowerTransferCompany =
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