Commit 165d4afb authored by tangwei's avatar tangwei

修改接口

parent 462cfae0
...@@ -32,7 +32,7 @@ public class MyBatisPlusCodeGenerator { ...@@ -32,7 +32,7 @@ public class MyBatisPlusCodeGenerator {
/** /**
* 项目名称缩写 * 项目名称缩写
*/ */
static String projectShortName = "tzs"; static String projectShortName = "jcs";
/** /**
* 项目api目录 * 项目api目录
...@@ -107,7 +107,7 @@ public class MyBatisPlusCodeGenerator { ...@@ -107,7 +107,7 @@ public class MyBatisPlusCodeGenerator {
gc.setActiveRecord(false); gc.setActiveRecord(false);
// 数据源配置 // 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://172.16.6.60:3306/amos-tzs-biz?serverTimezone=GMT%2B8"); dsc.setUrl("jdbc:mysql://172.16.6.60:3306/amos-jcs-biz?serverTimezone=GMT%2B8");
// dsc.setSchemaName("public"); // dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver"); dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root"); dsc.setUsername("root");
......
package com.yeejoin.amos.boot.module.jcs.api.entity; package com.yeejoin.amos.boot.module.jcs.api.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
import java.util.Date; import java.util.Date;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -8,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -8,8 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
...@@ -28,7 +27,6 @@ public class AlertCalled extends BaseEntity { ...@@ -28,7 +27,6 @@ public class AlertCalled extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情状态") @ApiModelProperty(value = "警情状态")
private Boolean alertStatus; private Boolean alertStatus;
...@@ -109,4 +107,10 @@ public class AlertCalled extends BaseEntity { ...@@ -109,4 +107,10 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "发送人名称") @ApiModelProperty(value = "发送人名称")
private String recUserName; private String recUserName;
@ApiModelProperty(value = "接警时间开始---用于列表过滤")
@TableField(exist=false)
private Date callTimeStart ;
@ApiModelProperty(value = "接警时间结束---用于列表过滤")
@TableField(exist=false)
private Date callTimeEnd ;
} }
package com.yeejoin.amos.boot.module.jcs.api.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 警情接警记录
*
* @author tb
* @date 2021-06-17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("jc_alert_called")
@ApiModel(value="AlertCalled对象", description="警情接警记录")
public class AlertCalledListVo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情状态")
private Boolean alertStatus;
@ApiModelProperty(value = "系统/人工")
private String type;
@ApiModelProperty(value = "警情阶段")
private String alertStage;
@ApiModelProperty(value = "报警类型")
private String alarmType;
@ApiModelProperty(value = "响应级别字典code 为了过滤用(只有航空器故障有)")
private String responseLevelCode;
@ApiModelProperty(value = "报警类型code")
private String alarmTypeCode;
@ApiModelProperty(value = "报警方式")
private String alarmMode;
@ApiModelProperty(value = "报警方式code")
private String alarmModeCode;
@ApiModelProperty(value = "通话记录信息id")
private Integer callRecordId;
@ApiModelProperty(value = "父警情id")
private Long fatherAlert;
@ApiModelProperty(value = "联系人姓名")
private String contactUser;
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
@ApiModelProperty(value = "接警时间")
private Date callTime;
@ApiModelProperty(value = "接警时长")
private Double callTimeNum;
@ApiModelProperty(value = "警情来源")
private String alertSource;
@ApiModelProperty(value = "警情来源code")
private String alertSourceCode;
@ApiModelProperty(value = "警情类型")
private String alertType;
@ApiModelProperty(value = "警情类型code")
private String alertTypeCode;
@ApiModelProperty(value = "事发单位")
private String unitInvolved;
@ApiModelProperty(value = "被困人数")
private Integer trappedNum;
@ApiModelProperty(value = "伤亡人数")
private Integer casualtiesNum;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "救援方格")
private String rescueGrid;
@ApiModelProperty(value = "坐标x")
private String coordinateX;
@ApiModelProperty(value = "坐标y")
private String coordinateY;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "发送人名称")
private String recUserName;
@ApiModelProperty(value = "接警时间开始---用于列表过滤")
private Date callTimeStart ;
@ApiModelProperty(value = "接警时间结束---用于列表过滤")
private Date callTimeEnd ;
}
...@@ -2,7 +2,11 @@ package com.yeejoin.amos.boot.module.jcs.api.vo; ...@@ -2,7 +2,11 @@ package com.yeejoin.amos.boot.module.jcs.api.vo;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -14,96 +18,25 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; ...@@ -14,96 +18,25 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/** /**
* 警情接警记录 * 保存警情接警记录
* *
* @author tb * @author tb
* @date 2021-06-17 * @date 2021-06-17
*/ */
@Data @Data
@Accessors(chain = true)
@TableName("jc_alert_called")
@ApiModel(value="AlertCalledVo", description="警情接警记录")
public class AlertCalledVo{ public class AlertCalledVo{
private static final long serialVersionUID = 1L; @ApiModelProperty(value = "警情基本信息")
private AlertCalled alertCalled;
@ApiModelProperty(value = "警情状态")
private Boolean alertStatus;
@ApiModelProperty(value = "系统/人工")
private String type;
@ApiModelProperty(value = "警情阶段")
private String alertStage;
@ApiModelProperty(value = "报警类型")
private String alarmType;
@ApiModelProperty(value = "报警类型code")
private String alarmTypeCode;
@ApiModelProperty(value = "报警方式")
private String alarmMode;
@ApiModelProperty(value = "报警方式code")
private String alarmModeCode;
@ApiModelProperty(value = "通话记录信息id")
private Integer callRecordId;
@ApiModelProperty(value = "父警情id")
private Long fatherAlert;
@ApiModelProperty(value = "联系人姓名")
private String contactUser;
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
@ApiModelProperty(value = "接警时间")
private Date callTime;
@ApiModelProperty(value = "接警时长")
private Double callTimeNum;
@ApiModelProperty(value = "警情来源")
private String alertSource;
@ApiModelProperty(value = "警情来源code")
private String alertSourceCode;
@ApiModelProperty(value = "警情类型")
private String alertType;
@ApiModelProperty(value = "警情类型code")
private String alertTypeCode;
@ApiModelProperty(value = "事发单位")
private String unitInvolved;
@ApiModelProperty(value = "被困人数")
private Integer trappedNum;
@ApiModelProperty(value = "伤亡人数")
private Integer casualtiesNum;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "救援方格")
private String rescueGrid;
@ApiModelProperty(value = "坐标x")
private String coordinateX;
@ApiModelProperty(value = "坐标y")
private String coordinateY;
@ApiModelProperty(value = "更新时间") @ApiModelProperty(value = "动态表单值")
private Date updateTime; private List<AlertFromValue> alertFromValue;
@ApiModelProperty(value = "发送人名称") public AlertCalledVo(AlertCalled alertCalled, List<AlertFromValue> alertFromValue) {
private String recUserName; this.alertCalled = alertCalled;
this.alertFromValue = alertFromValue;
}
public AlertCalledVo() {
}
} }
...@@ -13,33 +13,41 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; ...@@ -13,33 +13,41 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/** /**
* 警情表单 * 表单
* *
* @author tb * @author tb
* @date 2021-06-17 * @date 2021-06-17
*/ */
@Data @Data
@Accessors(chain = true)
@TableName("jc_alert_from")
@ApiModel(value="AlertFromVo", description="警情表单")
public class AlertFromVo{ public class AlertFromVo{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情类型") @ApiModelProperty(value = "表单key")
private String alertTypeCode; private String key;
@ApiModelProperty(value = "字段名称") @ApiModelProperty(value = "表单名称")
private String fieldName; private String label;
@ApiModelProperty(value = "英文名称") @ApiModelProperty(value = "表单类型")
private String fieldCode; private String type;
@ApiModelProperty(value = "字段类型") @ApiModelProperty(value = "表单初始化值")
private String fieldType; private String data;
@ApiModelProperty(value = "操作人名称") public AlertFromVo(String key, String label, String type, String data) {
private String recUserName; super();
this.key = key;
this.label = label;
this.type = type;
this.data = data;
}
public AlertFromVo() {
super();
}
} }
package com.yeejoin.amos.boot.module.jcs.api.vo;
/*
*
* 下拉表单值
* */
import io.swagger.annotations.ApiModelProperty;
public class AlertListvalue {
@ApiModelProperty(value = "key")
private String key;
@ApiModelProperty(value = "名称")
private String text;
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "表单id")
private Long alertFromId;
@ApiModelProperty(value = "英文名称")
private String fieldCode;
@ApiModelProperty(value = "字段值字典code")
private String fieldValueCode;
}
package com.yeejoin.amos.boot.module.jcs.api.vo;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom;
import com.yeejoin.amos.boot.module.jcs.api.service.IFireTeamService;
@Component
public class FromList {
/**
* 数据字典
*
* */
@Autowired
IFireTeamService iFireTeamService;
public static List<AlertFromVo> getFromlist(List<AlertFrom> list) {
List<AlertFromVo> listfrom = new ArrayList<AlertFromVo>();
// 组装数据
for (AlertFrom alertFrom : list) {
switch (alertFrom.getFieldType()) {
case "select":
// 查询数据项
AlertFromVo vo = new AlertFromVo(null, null, null, null);
break;
case "date":
break;
case "radio":
break;
default:
break;
}
}
return null;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.aop; //package com.yeejoin.amos.boot.module.jcs.biz.aop;
//
import com.alibaba.fastjson.JSON; //import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; //import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; //import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo; //import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; //import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo; //import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.utils.GlobalCache; //import com.yeejoin.amos.boot.biz.common.utils.GlobalCache;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; //import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService; //import com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService;
import com.yeejoin.amos.component.feign.model.FeignClientResult; //import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; //import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; //import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; //import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; //import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel; //import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.aspectj.lang.JoinPoint; //import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; //import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; //import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; //import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; //import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; //import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder; //import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; //import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext; //import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; //import org.typroject.tyboot.core.foundation.utils.Bean;
//
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import java.util.Arrays; //import java.util.Arrays;
import java.util.HashMap; //import java.util.HashMap;
import java.util.List; //import java.util.List;
import java.util.Map; //import java.util.Map;
//
/** ///**
* controller层切面 用于用户数据缓存 供 sql自动填充使用 // * controller层切面 用于用户数据缓存 供 sql自动填充使用
* // *
* @author Admin // * @author Admin
*/ // */
@Aspect //@Aspect
@Component //@Component
public class ControllerAop { //public class ControllerAop {
/** // /**
* saveUserRedis设置过期时间 // * saveUserRedis设置过期时间
*/ // */
@Value("${redis_region_time_second}") // @Value("${redis_region_time_second}")
private Long redisRegionTimeSecond; // private Long redisRegionTimeSecond;
@Autowired // @Autowired
private RemoteSecurityService remoteSecurityService; // private RemoteSecurityService remoteSecurityService;
//
@Autowired // @Autowired
private RedisUtils redisUtils; // private RedisUtils redisUtils;
//
@Pointcut("execution(public * com.yeejoin.amos.boot.module.jcs.biz.controller..*(..))") // @Pointcut("execution(public * com.yeejoin.amos.boot.module.jcs.biz.controller..*(..))")
public void userCache() { // public void userCache() {
//
} // }
//
@Before("userCache()") // @Before("userCache()")
public void doBefore(JoinPoint joinPoint) throws Throwable { // public void doBefore(JoinPoint joinPoint) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
String token = request.getHeader("token");
if (token != null) {
//验证token有效性,防止token失效
AgencyUserModel userModel =new AgencyUserModel();
try {
userModel = remoteSecurityService.getAgencyUser();
if (userModel == null) {
throw new Exception("无法获取用户信息");
}
} catch (Exception e) {
//删除失效token缓存
redisUtils.del(buildKey(token));
throw new RuntimeException(e.getMessage());
}
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany"};
// 获取请求路径
if (Arrays.asList(url).contains(request.getRequestURI())) {
// 暂无需要
} else {
if (!redisUtils.hasKey(buildKey(token))) {
saveUserRedis(userModel, token);
}
}
}
System.out.println(redisUtils.get(buildKey(token)));
}
public void saveUserRedis(AgencyUserModel user, String token) {
CompanyBo company = new CompanyBo();
DepartmentBo department = new DepartmentBo();
RoleBo role = new RoleBo();
CompanyModel companyM = user.getCompanys().get(0);
Bean.copyExistPropertis(companyM, company);
Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
DepartmentModel departmentM = mapDepartments.get(companyM.getSequenceNbr()).get(0);
Bean.copyExistPropertis(departmentM, department);
Map<Long, List<RoleModel>> roles = user.getOrgRoles();
Long sequenceNbr;
if (departmentM == null) {
sequenceNbr = null;
} else {
sequenceNbr = departmentM.getSequenceNbr();
}
RoleModel roleM = null;
if (sequenceNbr == null) {
roleM = roles.get(companyM.getSequenceNbr()).get(0);
} else {
roleM = roles.get(sequenceNbr).get(0);
}
Bean.copyExistPropertis(roleM, role);
ReginParams reginParams = new ReginParams();
reginParams.setCompany(company);
reginParams.setRole(role);
reginParams.setDepartment(department);
reginParams.setUserModel(user);
redisUtils.set(buildKey(token), JSONObject.toJSONString(reginParams), redisRegionTimeSecond);
}
public String buildKey(String token) {
//由于用户id 不是接口携带参数,为了避免,公共字段填充时频繁访问平台,缓存用户信息时,
//return "region_" + userId + "_" + token;
return "region_"+ token;
}
@AfterReturning(returning = "ret", pointcut = "userCache()")
public void doAfterReturning(Object ret) throws Throwable {
//统一redis管理
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); // ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest request = attributes.getRequest(); // HttpServletRequest request = attributes.getRequest();
// String token = request.getHeader("token"); // String token = request.getHeader("token");
// if (token != null) { // if (token != null) {
// GlobalCache.paramMap.remove(token); // //验证token有效性,防止token失效
// AgencyUserModel userModel =new AgencyUserModel();
// try {
// userModel = remoteSecurityService.getAgencyUser();
// if (userModel == null) {
// throw new Exception("无法获取用户信息");
// }
// } catch (Exception e) {
// //删除失效token缓存
// redisUtils.del(buildKey(token));
// throw new RuntimeException(e.getMessage());
// }
// // 不需要添加请求头的接口
// String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany"};
// // 获取请求路径
// if (Arrays.asList(url).contains(request.getRequestURI())) {
// // 暂无需要
// } else {
// if (!redisUtils.hasKey(buildKey(token))) {
// saveUserRedis(userModel, token);
// }
// }
// } // }
} // System.out.println(redisUtils.get(buildKey(token)));
} // }
//
// public void saveUserRedis(AgencyUserModel user, String token) {
// CompanyBo company = new CompanyBo();
// DepartmentBo department = new DepartmentBo();
// RoleBo role = new RoleBo();
// CompanyModel companyM = user.getCompanys().get(0);
// Bean.copyExistPropertis(companyM, company);
// Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
// DepartmentModel departmentM = mapDepartments.get(companyM.getSequenceNbr()).get(0);
// Bean.copyExistPropertis(departmentM, department);
// Map<Long, List<RoleModel>> roles = user.getOrgRoles();
// Long sequenceNbr;
// if (departmentM == null) {
// sequenceNbr = null;
// } else {
// sequenceNbr = departmentM.getSequenceNbr();
// }
// RoleModel roleM = null;
// if (sequenceNbr == null) {
// roleM = roles.get(companyM.getSequenceNbr()).get(0);
// } else {
// roleM = roles.get(sequenceNbr).get(0);
// }
// Bean.copyExistPropertis(roleM, role);
// ReginParams reginParams = new ReginParams();
// reginParams.setCompany(company);
// reginParams.setRole(role);
// reginParams.setDepartment(department);
// reginParams.setUserModel(user);
// redisUtils.set(buildKey(token), JSONObject.toJSONString(reginParams), redisRegionTimeSecond);
// }
// public String buildKey(String token) {
// //由于用户id 不是接口携带参数,为了避免,公共字段填充时频繁访问平台,缓存用户信息时,
// //return "region_" + userId + "_" + token;
// return "region_"+ token;
// }
//
// @AfterReturning(returning = "ret", pointcut = "userCache()")
// public void doAfterReturning(Object ret) throws Throwable {
// //统一redis管理
//// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
//// HttpServletRequest request = attributes.getRequest();
//// String token = request.getHeader("token");
//// if (token != null) {
//// GlobalCache.paramMap.remove(token);
//// }
// }
//}
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.FirefightersJacket;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFromValueService;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledListVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.AlertCalledVo;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -18,7 +25,10 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; ...@@ -18,7 +25,10 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
...@@ -34,7 +44,8 @@ public class AlertCalledController extends BaseController { ...@@ -34,7 +44,8 @@ public class AlertCalledController extends BaseController {
@Autowired @Autowired
IAlertCalledService iAlertCalledService; IAlertCalledService iAlertCalledService;
@Autowired
IAlertFromValueService iAlertFromValueService;
/** /**
* 新增警情接警记录 * 新增警情接警记录
* @return * @return
...@@ -42,8 +53,29 @@ public class AlertCalledController extends BaseController { ...@@ -42,8 +53,29 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST) @RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录") @ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录")
public boolean saveAlertCalled(HttpServletRequest request, @RequestBody AlertCalled alertCalled){ @Transactional
return iAlertCalledService.save(alertCalled); public ResponseModel saveAlertCalled(HttpServletRequest request, @RequestBody AlertCalledVo alertCalledVo){
//警情基本信息
AlertCalled alertCalled= alertCalledVo.getAlertCalled();
//判断是否归并警情
if(alertCalled.getFatherAlert()!=null){
//警情归并,设置当前警情状态为结束。
alertCalled.setAlertStatus(true);
}else{
//警情报送
//****************************************************待确认开发
}
iAlertCalledService.save(alertCalled);
//动态表单
List<AlertFromValue> alertFromValuelist= alertCalledVo.getAlertFromValue();
//填充警情主键
alertFromValuelist.stream().forEach(alertFromValue->{
alertFromValue.setAlertCalledId(alertCalled.getSequenceNbr());
});
//保存动态表单数据
iAlertFromValueService.saveBatch(alertFromValuelist);
iAlertCalledService.save(alertCalled);
return CommonResponseUtil.success(alertCalledVo);
} }
/** /**
...@@ -82,8 +114,15 @@ public class AlertCalledController extends BaseController { ...@@ -82,8 +114,15 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public AlertCalled selectById(HttpServletRequest request, @PathVariable Long id){ public ResponseModel selectById(HttpServletRequest request, @PathVariable Long id){
return iAlertCalledService.getById(id); //警情基本信息
AlertCalled alertCalled=iAlertCalledService.getById(id);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
//警情动态表单数据
List<AlertFromValue> alertFromValue = iAlertFromValueService.list(queryWrapper);
AlertCalledVo alertCalledVo=new AlertCalledVo(alertCalled,alertFromValue);
return CommonResponseUtil.success(alertCalledVo);
} }
...@@ -95,11 +134,15 @@ public class AlertCalledController extends BaseController { ...@@ -95,11 +134,15 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/list", method = RequestMethod.GET) @RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<AlertCalled> listPage(String pageNum,String pageSize, AlertCalled alertCalled){ public ResponseModel listPage(String pageNum,String pageSize, AlertCalled alertCalled){
Page<AlertCalled> pageBean; Page<AlertCalled> pageBean;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>(); QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
Class<? extends AlertCalled> aClass = alertCalled.getClass(); Class<? extends AlertCalled> aClass = alertCalled.getClass();
alertCalledQueryWrapper.eq("is_delete",1);
if(alertCalled.getCallTimeStart()!=null&&alertCalled.getCallTimeEnd()!=null){
alertCalledQueryWrapper.between("call_time",alertCalled.getCallTimeStart(),alertCalled.getCallTimeEnd());
}
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> { Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try { try {
field.setAccessible(true); field.setAccessible(true);
...@@ -122,6 +165,7 @@ public class AlertCalledController extends BaseController { ...@@ -122,6 +165,7 @@ public class AlertCalledController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<AlertCalled> page; IPage<AlertCalled> page;
...@@ -131,7 +175,7 @@ public class AlertCalledController extends BaseController { ...@@ -131,7 +175,7 @@ public class AlertCalledController extends BaseController {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper); page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return page; return CommonResponseUtil.success(page);
} }
} }
...@@ -15,10 +15,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -15,10 +15,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFrom;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFromValue;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
...@@ -88,6 +90,40 @@ public class AlertFromController extends BaseController { ...@@ -88,6 +90,40 @@ public class AlertFromController extends BaseController {
/**
* 根据表态类型code查询表单数据项
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{code}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public AlertFrom selectFromdItem(HttpServletRequest request, @PathVariable String code){
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_type_code", code);
//警情动态表单数据
List<AlertFrom> alertFromValue = iAlertFromService.list(queryWrapper);
return null;
}
/** /**
* 列表分页查询 * 列表分页查询
* @return * @return
...@@ -122,6 +158,7 @@ public class AlertFromController extends BaseController { ...@@ -122,6 +158,7 @@ public class AlertFromController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<AlertFrom> page; IPage<AlertFrom> page;
......
...@@ -122,6 +122,7 @@ public class AlertFromTypeController extends BaseController { ...@@ -122,6 +122,7 @@ public class AlertFromTypeController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<AlertFromType> page; IPage<AlertFromType> page;
......
...@@ -122,6 +122,7 @@ public class AlertFromValueController extends BaseController { ...@@ -122,6 +122,7 @@ public class AlertFromValueController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<AlertFromValue> page; IPage<AlertFromValue> page;
......
...@@ -122,6 +122,7 @@ public class AlertSubmittedController extends BaseController { ...@@ -122,6 +122,7 @@ public class AlertSubmittedController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<AlertSubmitted> page; IPage<AlertSubmitted> page;
......
...@@ -122,6 +122,7 @@ public class AlertSubmittedObjectController extends BaseController { ...@@ -122,6 +122,7 @@ public class AlertSubmittedObjectController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<AlertSubmittedObject> page; IPage<AlertSubmittedObject> page;
......
...@@ -122,6 +122,7 @@ public class FireExpertsController extends BaseController { ...@@ -122,6 +122,7 @@ public class FireExpertsController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FireExperts> page; IPage<FireExperts> page;
......
package com.yeejoin.amos.boot.module.jcs.biz.controller; package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -21,6 +20,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -21,6 +20,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jcs.api.entity.FireTeam; import com.yeejoin.amos.boot.module.jcs.api.entity.FireTeam;
import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil; import com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -173,6 +174,7 @@ public class FireTeamController extends BaseController { ...@@ -173,6 +174,7 @@ public class FireTeamController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FireTeam> page; IPage<FireTeam> page;
......
...@@ -122,6 +122,7 @@ public class FirefightersContactsController extends BaseController { ...@@ -122,6 +122,7 @@ public class FirefightersContactsController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersContacts> page; IPage<FirefightersContacts> page;
......
...@@ -149,6 +149,7 @@ public class FirefightersContractController extends BaseController { ...@@ -149,6 +149,7 @@ public class FirefightersContractController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersContract> page; IPage<FirefightersContract> page;
......
...@@ -203,6 +203,7 @@ public class FirefightersController extends BaseController { ...@@ -203,6 +203,7 @@ public class FirefightersController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<Firefighters> page; IPage<Firefighters> page;
......
...@@ -122,6 +122,7 @@ public class FirefightersEducationController extends BaseController { ...@@ -122,6 +122,7 @@ public class FirefightersEducationController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersEducation> page; IPage<FirefightersEducation> page;
......
...@@ -138,6 +138,7 @@ public class FirefightersJacketController extends BaseController { ...@@ -138,6 +138,7 @@ public class FirefightersJacketController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersJacket> page; IPage<FirefightersJacket> page;
......
...@@ -161,6 +161,7 @@ public class FirefightersPostController extends BaseController { ...@@ -161,6 +161,7 @@ public class FirefightersPostController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersPost> page; IPage<FirefightersPost> page;
......
...@@ -144,6 +144,7 @@ public class FirefightersThoughtController extends BaseController { ...@@ -144,6 +144,7 @@ public class FirefightersThoughtController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersThought> page; IPage<FirefightersThought> page;
......
...@@ -122,6 +122,7 @@ public class FirefightersWorkexperienceController extends BaseController { ...@@ -122,6 +122,7 @@ public class FirefightersWorkexperienceController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<FirefightersWorkexperience> page; IPage<FirefightersWorkexperience> page;
......
...@@ -122,6 +122,7 @@ public class PowerTransferCompanyController extends BaseController { ...@@ -122,6 +122,7 @@ public class PowerTransferCompanyController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<PowerTransferCompany> page; IPage<PowerTransferCompany> page;
......
...@@ -122,6 +122,7 @@ public class PowerTransferCompanyResourcesController extends BaseController { ...@@ -122,6 +122,7 @@ public class PowerTransferCompanyResourcesController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<PowerTransferCompanyResources> page; IPage<PowerTransferCompanyResources> page;
......
...@@ -122,6 +122,7 @@ public class PowerTransferController extends BaseController { ...@@ -122,6 +122,7 @@ public class PowerTransferController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<PowerTransfer> page; IPage<PowerTransfer> page;
......
...@@ -122,6 +122,7 @@ public class TemplateController extends BaseController { ...@@ -122,6 +122,7 @@ public class TemplateController extends BaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常");
} }
}); });
IPage<Template> page; IPage<Template> page;
......
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