Commit da47a9ce authored by taabe's avatar taabe

警情报送列表接口

parent d9f14a6c
......@@ -520,19 +520,19 @@ public class DateUtils {
return dateParse(dateFormat(date, MONTH_PATTERN) + "-" + value, null);
}
// public static void main(String[] args) throws Exception {
// /*System.out.println(dateTimeToDate(new Date()));
// System.out.println(dateParse("2017-02-04 14:58:20", null));
// System.out.println(dateTimeToDateStringIfTimeEndZero(new Date()));
// System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/
// //System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
// //System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
// System.out.println(getDate(dateParse("2017-01-17", null)));
// /*
// System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
// System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
// //System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07", StrUtils.MONTH_PATTERN), -12), StrUtils.MONTH_PATTERN));
// /*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
// System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
// }
public static void main(String[] args) throws Exception {
/*System.out.println(dateTimeToDate(new Date()));
System.out.println(dateParse("2017-02-04 14:58:20", null));
System.out.println(dateTimeToDateStringIfTimeEndZero(new Date()));
System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/
//System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
//System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
System.out.println(getDate(dateParse("2017-01-17", null)));
/*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
//System.out.println(dateFormat(dateAddMonths(dateParse("2017-02-07", StrUtils.MONTH_PATTERN), -12), StrUtils.MONTH_PATTERN));
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
}
}
......@@ -85,7 +85,7 @@ public class MyBatisPlusCodeGenerator {
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
public static void main1(String[] args) {
public static void main(String[] args) {
// 代码生成器
AutoGenerator autoGenerator = new AutoGenerator();
......
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.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import java.util.Date;
@Component
......@@ -47,9 +47,14 @@ public class MetaHandler implements MetaObjectHandler {
private void autoFillUser(MetaObject metaObject) {
//获取用户信息 以及当前用户登录公司部门,角色
ReginParams reginParams=JSONObject.parseObject(redisUtils.get(buildKey( getToken())).toString(), ReginParams.class);
AgencyUserModel agencyUserModel=reginParams.getUserModel();
ReginParams reginParams =
JSONObject.parseObject(null != redisUtils.get(buildKey(getToken())) ?
redisUtils.get(buildKey(getToken())).toString() : "", ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return;
}
AgencyUserModel agencyUserModel = reginParams.getUserModel();
if(ObjectUtils.isEmpty(reginParams)||ObjectUtils.isEmpty(agencyUserModel)){
return;
}
......
spring.application.name=AIRPORT
spring.application.name=AIRPORT-tb
server.servlet.context-path=/jcs
server.port=11000
spring.profiles.active=dev
......
......@@ -16,10 +16,18 @@ import java.util.List;
*/
public interface AlertSubmittedMapper extends BaseMapper<AlertSubmitted> {
/**
* 根据参数获取警情报送/融合调度列表
* 根据参数获取融合调度列表
*
* @param alertSubmittedDto
* @return
*/
List<AlertSubmittedExtVo> listByParam(@Param("alertSubmittedDto") AlertSubmittedDto alertSubmittedDto);
List<AlertSubmittedExtVo> listSchedulingByParam(@Param("alertSubmittedDto") AlertSubmittedDto alertSubmittedDto);
/**
* 根据参数获取警情报送列表
*
* @param alertSubmittedDto
* @return
*/
List<AlertSubmittedExtVo> listReportingByParam(@Param("alertSubmittedDto") AlertSubmittedDto alertSubmittedDto);
}
......@@ -14,10 +14,18 @@ import com.yeejoin.amos.boot.module.jcs.api.vo.SchedulingReportingVo;
public interface IAlertSubmittedService extends IService<AlertSubmitted> {
/**
* 根据参数查询警情报送/融合调度记录
* 根据参数查询融合调度记录
*
* @param queryParam
* @return SchedulingReportingVo
*/
SchedulingReportingVo listByParam(AlertSubmittedDto queryParam);
SchedulingReportingVo listSchedulingByParam(AlertSubmittedDto queryParam);
/**
* 根据参数查询警情报送记录
*
* @param queryParam
* @return SchedulingReportingVo
*/
SchedulingReportingVo listReportingByParam(AlertSubmittedDto queryParam);
}
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper">
<select id="listByParam" resultType="com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedExtVo">
<select id="listSchedulingByParam" resultType="com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedExtVo">
select
jas.sequence_nbr alertSubmittedId,
jas.alert_called_id,
......@@ -32,4 +32,34 @@
and jas.business_type_code = #{alertSubmittedDto.businessTypeCode}
</if>
</select>
<select id="listReportingByParam" resultType="com.yeejoin.amos.boot.module.jcs.api.vo.AlertSubmittedExtVo">
select
jas.sequence_nbr alertSubmittedId,
jas.alert_called_id,
jas.business_type,
jas.business_type_code,
jas.scheduling_type,
jas.scheduling_type_code,
jas.submission_time,
jas.submission_content,
jas.submission_method,
jas.submission_method_code,
jas.update_time,
jaso.sequence_nbr,
group_concat(jaso.company_name) companyNames,
group_concat(jaso.user_name) userNames
from jc_alert_submitted jas
left join jc_alert_submitted_object jaso on jas.sequence_nbr = jaso.alert_submitted_id
where 1=1
<if test="alertSubmittedDto.alertCalledId != null and alertSubmittedDto.alertCalledId != ''">
and jas.alert_called_id = #{alertSubmittedDto.alertCalledId}
</if>
<if test="alertSubmittedDto.submissionMethodCode != null and alertSubmittedDto.submissionMethodCode != ''">
and jas.submission_method_code = #{alertSubmittedDto.submissionMethodCode}
</if>
<if test="alertSubmittedDto.businessTypeCode != null and alertSubmittedDto.businessTypeCode != ''">
and jas.business_type_code = #{alertSubmittedDto.businessTypeCode}
</if>
group by jaso.alert_submitted_id
</select>
</mapper>
//package com.yeejoin.amos.boot.module.jcs.biz.aop;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//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.ReginParams;
//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.RedisUtils;
//import com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService;
//import com.yeejoin.amos.component.feign.model.FeignClientResult;
//import com.yeejoin.amos.feign.privilege.Privilege;
//import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
//import com.yeejoin.amos.feign.privilege.model.CompanyModel;
//import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
//import com.yeejoin.amos.feign.privilege.model.RoleModel;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.AfterReturning;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//import org.typroject.tyboot.core.foundation.utils.Bean;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * controller层切面 用于用户数据缓存 供 sql自动填充使用
// *
// * @author Admin
// */
//@Aspect
//@Component
//public class ControllerAop {
// /**
// * saveUserRedis设置过期时间
// */
// @Value("${redis_region_time_second}")
// private Long redisRegionTimeSecond;
// @Autowired
// private RemoteSecurityService remoteSecurityService;
//
// @Autowired
// private RedisUtils redisUtils;
//
// @Pointcut("execution(public * com.yeejoin.amos.boot.module.jcs.biz.controller..*(..))")
// public void userCache() {
//
// }
//
// @Before("userCache()")
// public void doBefore(JoinPoint joinPoint) throws Throwable {
package com.yeejoin.amos.boot.module.jcs.biz.aop;
import com.alibaba.fastjson.JSONObject;
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.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.RemoteSecurityService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.utils.Bean;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* controller层切面 用于用户数据缓存 供 sql自动填充使用
*
* @author Admin
*/
@Aspect
@Component
public class ControllerAop {
/**
* saveUserRedis设置过期时间
*/
@Value("${redis_region_time_second}")
private Long redisRegionTimeSecond;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private RedisUtils redisUtils;
@Pointcut("execution(public * com.yeejoin.amos.boot.module.jcs.biz.controller..*(..))")
public void userCache() {
}
@Before("userCache()")
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;
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) {
// //验证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);
// }
// }
// GlobalCache.paramMap.remove(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);
//// }
// }
//}
}
}
......@@ -91,11 +91,18 @@ public class AlertSubmittedController extends BaseController {
return CommonResponseUtil.success(iAlertSubmittedService.getById(id));
}
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/schedulingReporting/list", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "根据警情id查询融合调度、警情报送列表", notes = "根据警情id查询融合调度、警情报送列表")
public ResponseModel listByParam(@RequestBody AlertSubmittedDto queryParam) {
return CommonResponseUtil.success(iAlertSubmittedService.listByParam(queryParam));
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/scheduling/list", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "根据警情id查询融合调度列表", notes = "根据警情id查询融合调度列表")
public ResponseModel listSchedulingByParam(@RequestBody AlertSubmittedDto queryParam) {
return CommonResponseUtil.success(iAlertSubmittedService.listSchedulingByParam(queryParam));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/reporting/list", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "根据警情id查询警情报送列表", notes = "根据警情id查询警情报送列表")
public ResponseModel listReportingByParam(@RequestBody AlertSubmittedDto queryParam) {
return CommonResponseUtil.success(iAlertSubmittedService.listReportingByParam(queryParam));
}
/**
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper;
......@@ -22,12 +21,22 @@ import java.util.List;
public class AlertSubmittedServiceImpl extends ServiceImpl<AlertSubmittedMapper, AlertSubmitted> implements IAlertSubmittedService {
@Override
public SchedulingReportingVo listByParam(AlertSubmittedDto queryParam) {
public SchedulingReportingVo listSchedulingByParam(AlertSubmittedDto queryParam) {
SchedulingReportingVo schedulingReportingVo = new SchedulingReportingVo();
List<AlertSubmittedExtVo> alertSubmittedExtVoList = this.baseMapper.listByParam(queryParam);
List<AlertSubmittedExtVo> alertSubmittedExtVoList = this.baseMapper.listSchedulingByParam(queryParam);
schedulingReportingVo.setSchedulingReportingList(alertSubmittedExtVoList);
String extraInfo = "已调度电话" + alertSubmittedExtVoList.size() + "起";
schedulingReportingVo.setExtraInfo(extraInfo);
return schedulingReportingVo;
}
@Override
public SchedulingReportingVo listReportingByParam(AlertSubmittedDto queryParam) {
SchedulingReportingVo schedulingReportingVo = new SchedulingReportingVo();
List<AlertSubmittedExtVo> alertSubmittedExtVoList = this.baseMapper.listReportingByParam(queryParam);
schedulingReportingVo.setSchedulingReportingList(alertSubmittedExtVoList);
String extraInfo = "已报送" + alertSubmittedExtVoList.size() + "条";
schedulingReportingVo.setExtraInfo(extraInfo);
return schedulingReportingVo;
}
}
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