Commit 96c46209 authored by taabe's avatar taabe

警情填报bug修改

parent f60f463e
......@@ -8,27 +8,37 @@ package com.yeejoin.amos.boot.biz.common.utils;
*/
public class RedisKey {
//根据动态表单code获取动态表单列表
/**根据动态表单code获取动态表单列表*/
public static final String FORM_CODE = "form_code_";
//根据字典code获取数据字典列表
/**根据字典code获取数据字典列表*/
public static final String DATA_DICTIONARY_CODE= "data_dictionary_code_";
//根据字典code获取数据字典列表
/**根据字典code获取数据字典列表*/
public static final String DATA_DICTIONARY_CODE_XIN= "data_dictionary_code_xin_";
//根据id获取消防人员基本信息
/**根据id获取消防人员基本信息*/
public static final String FIREFIGHTERS_ID="firefighters_id_";
//根据id获取消防人员列表基本信息
/**根据id获取消防人员列表基本信息*/
public static final String FIREFIGHTERS_LIST_ID="firefighters_id_list_";
//根据消防人员id查询岗位学历信息工作经历
/**根据消防人员id查询岗位学历信息工作经历*/
public static final String EDUCATION_POST_EXPERIENCE_FIREFIGHTERS_ID="education_post_experience_firefighters_id_";
//根据合同信id 查询合同信息
/**根据合同信id 查询合同信息*/
public static final String CONTRACT_ID="contract_id_";
//根据思想状况信息id 查询思想信息
/**根据思想状况信息id 查询思想信息*/
public static final String THOUGHT_ID="thought_id_";
//根据警情id查询警情详情记录
/**根据警情id查询警情详情记录*/
public static final String ALERTCALLED_ID="alertcalled_id_";
/** 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)}) */
public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase();
}
/**
* 创建redis key
*
* @param token
* @return
*/
public static String buildKey(String token) {
return "region_" + token;
}
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.biz.config;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.StringUtils;
......@@ -10,14 +11,13 @@ import org.apache.ibatis.reflection.MetaObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
/**
* @author Dell
*/
@Component
public class MetaHandler implements MetaObjectHandler {
......@@ -33,11 +33,7 @@ public class MetaHandler implements MetaObjectHandler {
// }
return authToken;
}
protected String buildKey(String token) {
//由于用户id 不是接口携带参数,为了避免,公共字段填充时频繁访问平台,缓存用户信息时,
return "region_" + token;
}
/**
* 新增数据拦截
*
......@@ -51,8 +47,8 @@ public class MetaHandler implements MetaObjectHandler {
private void autoFillUser(MetaObject metaObject) {
//获取用户信息 以及当前用户登录公司部门,角色
ReginParams reginParams =
JSONObject.parseObject(null != redisUtils.get(buildKey(getToken())) ?
redisUtils.get(buildKey(getToken())).toString() : null, ReginParams.class);
JSONObject.parseObject(null != redisUtils.get(RedisKey.buildKey(getToken())) ?
redisUtils.get(RedisKey.buildKey(getToken())).toString() : null, ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return;
}
......
package com.yeejoin.amos.boot.module.jcs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author DELL
*/
@Data
public class FireSystemDto {
@ApiModelProperty(value = "系统id")
private String id;
@ApiModelProperty(value = "系统名称")
private String name;
}
package com.yeejoin.amos.boot.module.jcs.api.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
......@@ -63,6 +65,7 @@ public class AlertSubmitted extends BaseEntity {
private Date updateTime;
@ApiModelProperty(value = "操作人名称")
@TableField(value = "rec_user_name",fill= FieldFill.INSERT_UPDATE )
private String recUserName;
}
package com.yeejoin.amos.boot.module.jcs.api.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
......@@ -46,6 +48,7 @@ public class AlertSubmittedObject extends BaseEntity {
private String userPhone;
@ApiModelProperty(value = "操作人名称")
@TableField(value = "rec_user_name",fill= FieldFill.INSERT_UPDATE )
private String recUserName;
}
......@@ -15,44 +15,19 @@ public enum AlertBusinessTypeEnum {
/**
* 警情续报,非警情确认,警情结案
*/
一般火灾警情初报("fireReportAlert", "229", "SMS_JCS_0001", "一般火灾警情初报"),
航空器救援警情初报("aircraftReportAlert", "230", "SMS_JCS_0002", "航空器救援警情初报"),
突发事件救援警情初报("emergenciesReportAlert", "235", "SMS_JCS_0003", "突发事件救援警情初报"),
漏油现场安全保障警情初报("oilSpillReportAlert", "237", "SMS_JCS_0004", "漏油现场安全保障警情初报"),
专机保障警情初报("specialReportAlert", "238", "SMS_JCS_0005", "专机保障警情初报"),
警情初报("reportAlert", "297", "", "警情初报"),
警情续报("followReportAlert", "313", "SMS_JCS_0006", "警情续报"),
非警情确认("notAlert", "314", "SMS_JCS_0008", "非警情确认"),
警情结案("endAlert", "315", "SMS_JCS_0009", "警情结案");
一般火灾警情初报("fireReportAlert", "229", "297", "SMS_JCS_0001", "一般火灾警情初报"),
航空器救援警情初报("aircraftReportAlert", "230","297","SMS_JCS_0002", "航空器救援警情初报"),
突发事件救援警情初报("emergenciesReportAlert", "235", "297","SMS_JCS_0003", "突发事件救援警情初报"),
漏油现场安全保障警情初报("oilSpillReportAlert", "237", "297","SMS_JCS_0004", "漏油现场安全保障警情初报"),
专机保障警情初报("specialReportAlert", "238", "297","SMS_JCS_0005", "专机保障警情初报"),
警情初报("reportAlert", "297", "297","", "警情初报"),
警情续报("followReportAlert", "313", "313","SMS_JCS_0006", "警情续报"),
非警情确认("notAlert", "314", "314","SMS_JCS_0008", "非警情确认"),
警情结案("endAlert", "315", "315","SMS_JCS_0009", "警情结案");
private String key;
private String code;
private String parentCode;
private String sms_code;
private String name;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -66,4 +66,12 @@ public interface EquipFeignClient {
*/
@RequestMapping(value = "/car/list-all", method = RequestMethod.GET)
ResponseModel<Object> getFireCarListAll();
/**
* 获取消防系统列表
*
* @return
*/
@RequestMapping(value = "/fire-fighting-system/list", method = RequestMethod.GET)
ResponseModel<Object> getFireSystemListAll();
}
......@@ -66,17 +66,21 @@
</select>
<select id="getSchedulingContent" resultType="com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedSMSVo">
select s.sequence_nbr,
submission_time,
user_phone,
company_name,
user_name,
SELECT
s.sequence_nbr,
s.submission_time,
o.user_phone,
o.company_name,
o.user_name,
s.sender,
submission_content,
content submission_template
from jc_alert_submitted_object o
left join jc_alert_submitted s on o.alert_submitted_id = s.sequence_nbr
left join jc_template t on s.business_type = t.type
where o.sequence_nbr = ${id}
s.submission_content,
t.content submission_template
FROM
jc_alert_submitted_object o
LEFT JOIN jc_alert_submitted s ON o.alert_submitted_id = s.sequence_nbr
LEFT JOIN jc_template t ON s.business_type_code = t.type_code
AND t.format = 1
WHERE
o.sequence_nbr = ${id}
</select>
</mapper>
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireSystemDto;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.EquipmentServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 装备服务接口
*
* @author DELL
*/
@RestController
@Api(tags = "装备服务Api")
@RequestMapping(value = "/equip")
public class EquipmentController extends BaseController {
@Autowired
EquipmentServiceImpl equipmentService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/fireSystem/list")
@ApiOperation(value = "获取消防系统列表")
public ResponseModel<List<FireSystemDto>> getFireSystemList() {
return ResponseHelper.buildResponse(equipmentService.getFireSystemList());
}
}
......@@ -5,11 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
......@@ -36,7 +42,14 @@ import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.lang.reflect.Field;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -99,7 +112,6 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedExtVoList.forEach(alertSubmittedExtVo -> {
alertSubmittedExtVo.setExtraInfo(String.format(_extraInfo, alertSubmittedExtVo.getCompanyName(),
alertSubmittedExtVo.getUserName()));
TemplateExtendDto template = templateService.getByType(alertSubmittedExtVo.getBusinessTypeCode());
String richContent = template.getRichContent();
alertSubmittedExtVo.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtVo.getSubmissionContent()));
......@@ -127,9 +139,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertFormValue.add(formValue);
alertCalledVo.setAlertFormValue(alertFormValue);
ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
RequestContextHolder.setRequestAttributes(sra, true);
// TODO 调用规则
// 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo);
return true;
}
......@@ -154,9 +164,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 1.保存警情记录主表
AlertSubmitted alertSubmitted = new AlertSubmitted();
alertSubmitted.setAlertCalledId(Long.valueOf(calledRo.getSequenceNbr()));
Optional<AlertBusinessTypeEnum> businessTypeEnum = Optional.of(AlertBusinessTypeEnum.警情初报);
alertSubmitted.setBusinessTypeCode(businessTypeEnum.get().getCode());
alertSubmitted.setBusinessType(businessTypeEnum.get().getName());
// 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 名称统一为警情初报
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
alertSubmitted.setSubmissionMethodCode(submissionMethodEnum.get().getCode());
alertSubmitted.setSubmissionMethod(submissionMethodEnum.get().getName());
......@@ -165,7 +176,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
String token = RequestContext.getToken();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get("region_" + token).toString(),
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildKey(token)).toString(),
ReginParams.class);
alertSubmitted.setRecUserName(reginParams.getUserModel().getUserName());
alertSubmitted.setSender(reginParams.getUserModel().getUserName());
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireSystemDto;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
import java.util.Timer;
/**
* @author DELL
*/
@Service
public class EquipmentServiceImpl {
@Autowired
EquipFeignClient equipFeignClient;
public List<FireSystemDto> getFireSystemList() {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ResponseModel<Object> response = equipFeignClient.getFireSystemListAll();
stopWatch.stop();
System.out.printf("耗时%f秒/n", stopWatch.getTotalTimeSeconds());
List<Map<String, Object>> fireSystemMapList = (List<Map<String, Object>>) response.getResult();
List<FireSystemDto> fireSystemDtoList = Lists.newArrayList();
fireSystemMapList.forEach(system -> {
FireSystemDto fireSystemDto = new FireSystemDto();
fireSystemDto.setId((String) system.get("id"));
fireSystemDto.setName((String) system.get("name"));
fireSystemDtoList.add(fireSystemDto);
});
return fireSystemDtoList;
}
}
......@@ -4,6 +4,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -56,6 +57,7 @@ public class RuleAlertCalledService {
alertCalledRo.setAlertTypeCode(alertCalled.getAlertTypeCode());
alertCalledRo.setCasualtiesNum(alertCalled.getCasualtiesNum() != null ? String.valueOf(alertCalled.getCasualtiesNum()) : "无");
alertCalledRo.setTrappedNum(alertCalled.getTrappedNum() != null ? String.valueOf(alertCalled.getTrappedNum()) : "无");
alertCalledRo.setCompanyName(alertCalled.getCompanyName());
List<AlertFormValue> alertFormValues = alertCalledVo.getAlertFormValue();
if (!ValidationUtil.isEmpty(alertFormValues))
......@@ -83,6 +85,10 @@ public class RuleAlertCalledService {
{
alertCalledRo.setDangerousExplosives(alertFormValue.getFieldValue());
}
if (alertFormValue.getFieldCode().equals("fireTime"))
{
alertCalledRo.setCallTimeStr(alertFormValue.getFieldValue());
}
//航空器救援
//突发事件救援
......
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