Commit 6f3f0405 by yangyang

日志调整提交(西藏)

parent bf5f9810
......@@ -2,6 +2,9 @@ package com.founder.commonutils.model.newPublicEntity;
import cn.hutool.json.JSONObject;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author jlt
......@@ -21,17 +24,41 @@ public class Token {
* 密码
*/
private String password;
/**
* 单位代码
*/
private String unitcode;
/**
* 单位名称
*/
private String unitname;
/**
* 真实姓名
*/
private String truename;
/**
* 用户证件号码
*/
private String identitycard;
public Token(){}
public Token(String username,String ip,String password){
this.username=username;
this.ip=ip;
public Token(SysUser one,String password){
this.username=one.getUsername();
this.ip=one.getIp();
this.password=password;
this.unitcode=one.getUnitcode();
this.unitname=one.getUnitname();
this.truename=one.getTrueName();
this.identitycard=one.getIdentitycard();
}
public Token(JSONObject object) {
this.username= (String) object.get("username");
this.ip=(String) object.get("ip");
this.password=(String) object.get("password");
this.unitcode=(String) object.get("unitcode");
this.unitname=(String) object.get("unitname");
this.truename=(String) object.get("truename");
this.identitycard=(String) object.get("identitycard");
}
}
......@@ -15,6 +15,10 @@ public class Coordinate {
private double x;
@ApiModelProperty(value = "y轴")
private double y;
@ApiModelProperty(value = "开始时间")
private String kssjtime;
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "结束时间")
private String jssjtime;
}
package com.founder.commonutils.util.map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import java.util.*;
public class LCSS {
......@@ -14,7 +17,7 @@ public class LCSS {
return distance;
}
public boolean isNearby(Coordinate a, Coordinate b,int radius) {
public boolean isNearby(Coordinate a, Coordinate b, int radius) {
if (getDistance(a.getX(), a.getY(), b.getX(), b.getY()) < radius) return true;
return false;
}
......@@ -33,8 +36,11 @@ public class LCSS {
}
//轨迹相似度
public Map lcs(List<Coordinate> l1, List<Coordinate> l2, int radius,int minutes) {
public Map lcs(List<Coordinate> l1, List<Coordinate> l2, int radius, int minutes) {
long timeItervalMinutes = minutes * 60 * 1000;
// 弱轨迹转换
l1 = getRgjSjd(l1, timeItervalMinutes);
l2 = getRgjSjd(l2, timeItervalMinutes);
Map map = new HashMap();
Set<Coordinate> loneMz = new HashSet<>();
Set<Coordinate> ltwoMz = new HashSet<>();
......@@ -48,31 +54,31 @@ public class LCSS {
//内层遍历第二条轨迹
for (int j = 0; j < len2; j++) {
// 时间范围比较 俩个点之间的时差
long timeIterval = Long.parseLong(l1.get(i).getTime()) - Long.parseLong(l2.get(j).getTime());
//第一条轨迹的第i个点和第二条轨迹的第j个点是否在radius范围内 && 俩个点之间的时差小于等于minutes && 俩个点之间的时差大于等于-minutes
if ( isNearby(l1.get(i), l2.get(j),radius) && timeIterval<=timeItervalMinutes && timeIterval>=-timeItervalMinutes) {
loneMz.add(l1.get(i));
ltwoMz.add(l2.get(j));
c[i + 1][j + 1] = c[i][j] + 1;
flag[i + 1][j + 1] = 1;//1='ok' //1表示箭头为 左上
//for循环知道行数列数的情况
System.out.print("1++++"+flag[i + 1][j + 1] + " ");
} else if (c[i + 1][j] > c[i][j + 1]) {
c[i + 1][j + 1] = c[i + 1][j];
flag[i + 1][j + 1] = 2;//2='left' //2表示箭头向 上
//for循环知道行数列数的情况
System.out.print("2++++"+flag[i + 1][j + 1] + " ");
} else {
c[i + 1][j + 1] = c[i][j + 1];
flag[i + 1][j + 1] = 3;//3='up' //3表示箭头向 左
//for循环知道行数列数的情况
System.out.print("3++++"+flag[i + 1][j + 1] + " ");
if(StringUtils.isNotBlank(l1.get(i).getTime())&&StringUtils.isNotBlank(l2.get(j).getTime())){
long timeIterval = Long.parseLong(l1.get(i).getTime()) - Long.parseLong(l2.get(j).getTime());
//第一条轨迹的第i个点和第二条轨迹的第j个点是否在radius范围内 && 俩个点之间的时差小于等于minutes && 俩个点之间的时差大于等于-minutes
if ( isNearby(l1.get(i), l2.get(j),radius) && timeIterval<=timeItervalMinutes && timeIterval>=-timeItervalMinutes) {
loneMz.add(l1.get(i));
ltwoMz.add(l2.get(j));
c[i + 1][j + 1] = c[i][j] + 1;
flag[i + 1][j + 1] = 1;//1='ok' //1表示箭头为 左上
//for循环知道行数列数的情况
System.out.print("1++++"+flag[i + 1][j + 1] + " ");
} else if (c[i + 1][j] > c[i][j + 1]) {
c[i + 1][j + 1] = c[i + 1][j];
flag[i + 1][j + 1] = 2;//2='left' //2表示箭头向 上
//for循环知道行数列数的情况
System.out.print("2++++"+flag[i + 1][j + 1] + " ");
} else {
c[i + 1][j + 1] = c[i][j + 1];
flag[i + 1][j + 1] = 3;//3='up' //3表示箭头向 左
//for循环知道行数列数的情况
System.out.print("3++++"+flag[i + 1][j + 1] + " ");
}
}
}
}
printLcs(flag, l1, len1, len2);
System.out.println(lcs);
xsd=(lcs.size() * 1.0 / Math.min(len1, len2));
map.put("listOneMz",loneMz);
map.put("listTwoMz",ltwoMz);
......@@ -95,4 +101,45 @@ public class LCSS {
s = Math.round(s * 1000);
return s;
}
// 弱轨迹转换
public List<Coordinate> getRgjSjd(List<Coordinate> list, long timeItervalMillns){
List<Coordinate> resultList = new ArrayList<>();
list.stream().forEach(a->{
a.setKssjtime(a.getTime());
//如果是弱轨迹则传入时间段StartTime EndTime
if (a.getX() != 0D && a.getY() != 0D && StringUtils.isNotBlank(a.getKssjtime()) && StringUtils.isNotBlank(a.getJssjtime())) {
List<Long> timeList = getTimeSplitList(Long.valueOf(a.getKssjtime()), Long.valueOf(a.getJssjtime()), timeItervalMillns);
if (timeList != null && timeList.size() != 0) {
Iterator<Long> it = timeList.iterator();
while (it.hasNext()) {
Coordinate b = new Coordinate();
BeanUtils.copyProperties(a,b);
b.setTime(String.valueOf(it.next()));
resultList.add(b);
}
}
}
});
if(resultList.size()>0){
return resultList;
}
return list;
}
/**
* 将开始时间和结束时间的时间段转为时间点*/
public List<Long> getTimeSplitList(long startTime, long endTime, long timeItervalMillns) {
List resultList = new ArrayList();
resultList.add(startTime);
do {
startTime += timeItervalMillns;
if (startTime < endTime) {
resultList.add(startTime);
} else if (startTime >= endTime){
resultList.add(endTime);
break;
}
}
while (startTime < endTime);
return resultList;
}
}
\ No newline at end of file
......@@ -110,7 +110,7 @@ public class CodeYymcController {
@PostMapping("yymcSelect")
@ApiOperation(value = "查询code编码")
@OperLog(message = "查询code编码", operation = OperationType.QUERY)
// @OperLog(message = "查询code编码", operation = OperationType.QUERY)
public MapRestResult yymcSelect(@RequestBody SkCodeYymc skCodeYymc){
......@@ -183,7 +183,7 @@ public class CodeYymcController {
@PostMapping("codeAdd")
@ApiOperation(value = "入200库")
@OperLog(message = "入200库", operation = OperationType.ADD)
// @OperLog(message = "入200库", operation = OperationType.ADD)
public MapRestResult codeAdd(HttpServletRequest request) {
String logcode = request.getHeader("logcode");
......
......@@ -90,7 +90,7 @@ public class SkDictionaryController implements ExcelControllerInterface {
*/
@PostMapping("detail")
@ApiOperation(value = "查询字典详情信息")
@OperLog(message = "查询字典详情信息",operation = OperationType.QUERY)
//@OperLog(message = "查询字典详情信息",operation = OperationType.QUERY)
public MapRestResult detail(String xxzjbh) {
SkDictionary byId = service.getById(xxzjbh);
return new MapRestResult(byId);
......@@ -101,7 +101,7 @@ public class SkDictionaryController implements ExcelControllerInterface {
*/
@PostMapping("query")
@ApiOperation(value = "以图研判_获取任务类型")
@OperLog(message = "以图研判_获取任务类型",operation = OperationType.QUERY)
//@OperLog(message = "以图研判_获取任务类型",operation = OperationType.QUERY)
public MapRestResult query(@RequestBody SkDictionaryParam skDictionaryParam) {
Page page=new Page(skDictionaryParam.getPage(), skDictionaryParam.getPageSize());
QueryWrapper queryWrapper=new QueryWrapper();
......@@ -125,7 +125,7 @@ public class SkDictionaryController implements ExcelControllerInterface {
*/
@PostMapping("queryByDmlx")
@ApiOperation(value = "根据代码类型查找相应字典")
@OperLog(message = "根据代码类型查找相应字典",operation = OperationType.QUERY)
//@OperLog(message = "根据代码类型查找相应字典",operation = OperationType.QUERY)
public MapRestResult queryByDmlx(String dmlx){
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("dmlx",dmlx);
......@@ -145,7 +145,7 @@ public class SkDictionaryController implements ExcelControllerInterface {
*/
@PostMapping("queryAllDmlx")
@ApiOperation(value = "查找所有代码类型")
@OperLog(message = "查找所有代码类型",operation = OperationType.QUERY)
//@OperLog(message = "查找所有代码类型",operation = OperationType.QUERY)
public MapRestResult queryAllDmlx(){
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.groupBy("dmlx","dmms");
......
......@@ -77,9 +77,8 @@ public class SysUserController extends ApiController {
// 拿到真实ip
one.setIp(NetworkUtil.getIpAddr(request));
JwtUser util = new JwtUser();
String ip = request.getRemoteAddr();
//密码加密与刑专一致
Token tokenEntity=new Token(one.getUsername(),one.getIp(), DigestUtil.encrypt(password));
Token tokenEntity=new Token(one,DigestUtil.encrypt(password));
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(tokenEntity);
//用户JWT生成token
String token = util.createJWT(jsonObject.toString());
......@@ -121,7 +120,7 @@ public class SysUserController extends ApiController {
one.setIp(NetworkUtil.getIpAddr(request));
JwtUser util = new JwtUser();
String ip = request.getRemoteAddr();
Token tokenEntity=new Token(one.getUsername(),one.getIp(),one.getPassword());
Token tokenEntity=new Token(one,one.getPassword());
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(tokenEntity);
// 用户JWT生成token
String token = util.createJWT(jsonObject.toString());
......
......@@ -20,11 +20,8 @@ public class LogCount {
* 用户登录次数
*/
private Integer user;
public LogCount(){}
public LogCount(String date,Integer count,Integer user){
this.date=date;
this.count=count;
this.user=user;
}
/**
* 单位操作次数
*/
private String dw;
}
......@@ -18,7 +18,15 @@ public class SkSysLog implements Serializable {
@TableId(type = IdType.INPUT)
private String id; //
private String userid; // 操作用户 ID
private String userid; // 操作用户 ID 警号
private String yhxm; // 用户姓名
private String yhgmsfhm; // 用户公民身份号码
private String yhdwgajgjgdm; // 用户单位公安机关机构代码
private String yhdwgajgmc; // 用户单位名称
private String message; // 消息
......@@ -36,5 +44,5 @@ public class SkSysLog implements Serializable {
private String content; // 返回值
//添加set和get方法
private String url; // 请求url
}
\ No newline at end of file
......@@ -131,6 +131,10 @@ public class SysLogAspect {
Token token = new Token(object);
System.out.println("token===>" + token);
sysLog.setUserid(token.getUsername());
sysLog.setYhxm(token.getTruename());
sysLog.setYhgmsfhm(token.getIdentitycard());
sysLog.setYhdwgajgjgdm(token.getUnitcode());
sysLog.setYhdwgajgmc(token.getUnitname());
} catch (
TokenException e) {
sysLog.setUserid("system");
......@@ -171,6 +175,7 @@ public class SysLogAspect {
System.out.println("============================================2.请求开始:" + df.format(new
Date()) + "============================================");
sysLog.setUrl(request.getRequestURL().toString());
System.out.println("URL===>" + request.getRequestURL());
System.out.println("用户===>" + sysLog.getUserid());
System.out.println("请求ip===>" + sysLog.getIp());
......
......@@ -127,8 +127,8 @@ public class SkSysLogController {
queryWrapper.orderByDesc("createDate");
List list = service.list(queryWrapper);
ExportExcelUtil<SkService> exportExcelUtil = new ExportExcelUtil<>();
String[] headersName = {"用户id","方法名","ip","请求url","传入参数","返回参数","响应时长","访问时间"};
String[] headersField = {"id","method","ip","url","params","content","totaltime","createdate"};
String[] headersName = {"用户id","用户姓名","用户证件号","用户单位","方法名","ip","请求url","操作类型","传入参数","返回参数","响应时长","访问时间"};
String[] headersField = {"userid","yhxm","yhgmsfhm","yhdwgajgmc","method","ip","url","operation","params","content","totaltime","createdate"};
exportExcelUtil.exportExcel("DataStatistics", headersName, headersField, list, response,"日志列表信息");
}
@PostMapping("countTotal")
......
......@@ -21,6 +21,8 @@ public interface SkSysLogMapper extends BaseMapper<SkSysLog> {
List<LogMoudleCount> countMoudle(LogCountParam param);
List<LogCount> countDw(LogCountParam param);
List<LogMoudleCount> countThreeUserId(LogCountParam param);
}
......@@ -39,6 +39,58 @@
and
message is not NULL group by SUBSTRING_INDEX(message,'_',1)
</select>
<select id="countDw" resultType="com.founder.servicebase.logs.LogCount" parameterType="com.founder.servicebase.logs.param.LogCountParam">
SELECT
ifnull (a.cs, 0 ) AS count,
c.NAME AS dw
FROM
(
SELECT
CONCAT( LEFT ( sys.yhdwgajgjgdm, 2 ), '0000000000' ) AS dw,
count(*) AS cs
FROM
sk_sys_log sys
where 1=1
<if test="startTime!=null and startTime!='' ">
and str_to_date(#{startTime},'%Y-%m-%d') <![CDATA[ <= ]]> date_format(createDate,'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!='' ">
and str_to_date(#{endTime},'%Y-%m-%d') <![CDATA[ >= ]]> date_format(createDate,'%Y-%m-%d')
</if>
GROUP BY
CONCAT( LEFT ( sys.yhdwgajgjgdm, 2 ), '0000000000' )) a
JOIN sys_dictitem c ON a.dw = c.CODE
WHERE
c.groupid = 'CODE_UNIT'
AND c.scbz = 0
AND c.code = '540000000000'
UNION
SELECT
ifnull (a.cs, 0 ) AS count,
REPLACE ( c.NAME, '西藏自治区','') AS dw
FROM
(
SELECT
CONCAT( LEFT ( sys.yhdwgajgjgdm, 4 ), '00000000' ) AS dw,
count(*) AS cs
FROM
sk_sys_log sys
where 1=1
<if test="startTime!=null and startTime!='' ">
and str_to_date(#{startTime},'%Y-%m-%d') <![CDATA[ <= ]]> date_format(createDate,'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!='' ">
and str_to_date(#{endTime},'%Y-%m-%d') <![CDATA[ >= ]]> date_format(createDate,'%Y-%m-%d')
</if>
GROUP BY
CONCAT( LEFT ( sys.yhdwgajgjgdm, 4 ), '00000000' )) a
RIGHT JOIN sys_dictitem c ON a.dw = c.CODE
WHERE
c.groupid = 'CODE_UNIT'
AND c.scbz = 0
AND PID = '540000000000'
AND c.code not like '5400%'
</select>
<select id="countThreeUserId" resultType="com.founder.servicebase.logs.LogMoudleCount" parameterType="com.founder.servicebase.logs.param.LogCountParam">
select COUNT(*) as count,userId as moudle from sk_sys_log
......
......@@ -28,15 +28,7 @@ public class SkSysLogServiceImpl extends ServiceImpl<SkSysLogMapper, SkSysLog> i
@Override
public List<LogCount> countTotal(LogCountParam param) throws ParseException {
List<LogCount> all=new ArrayList<>();
//计算时间
List<String> dateList = splitDateList(dateFormat.parse(param.getStartTime()), dateFormat.parse(param.getEndTime()));
for (String str:dateList) {
LogCount logCount = baseMapper.countOne(str);
logCount.setDate(str);
all.add(logCount==null?new LogCount(str,0,0):logCount);
}
return all;
return baseMapper.countDw(param);
}
@Override
......
......@@ -56,7 +56,7 @@ public class AsjController {
return MapRestResult.build(200,"成功获取案件信息",total,asjList);
}
@OperLog(message = "获取串并线索组信息",operation = OperationType.QUERY)
@OperLog(message = "以案侦查_获取串并线索组信息",operation = OperationType.QUERY)
@ApiOperation(value = "获取串并线索组信息")
@PostMapping("/querAsjxxCbzAndXlaj")
public MapRestResult getAsjxxCbzAndXlaj(@ApiParam(name = "asjbh", value = "案事件编号")
......@@ -159,7 +159,7 @@ public class AsjController {
return MapRestResult.build(200,"成功",list.size(),list);
}
@OperLog(message = "涉案视频",operation = OperationType.QUERY)
@OperLog(message = "以案侦查_涉案视频",operation = OperationType.QUERY)
@ApiOperation(value = "涉案视频")
@PostMapping("/querySasp")
public MapRestResult querySasp(String asjbh){
......@@ -172,7 +172,7 @@ public class AsjController {
return MapRestResult.build(200,"成功",jsonArray.size(),jsonArray);
}
@OperLog(message = "点位校验案件信息查询",operation = OperationType.QUERY)
@OperLog(message = "点位校验_案件信息查询",operation = OperationType.QUERY)
@ApiOperation(value = "点位校验案件信息查询")
@RequestMapping("/toQueryJwdinfo")
@ResponseBody
......@@ -231,7 +231,7 @@ public class AsjController {
return MapRestResult.build(200,"成功获取经纬度校验信息","1",tbAsjJwdinfo);
}
@OperLog(message = "点位校验案件信息统计",operation = OperationType.QUERY)
@OperLog(message = "点位校验_案件信息统计",operation = OperationType.QUERY)
@ApiOperation(value = "点位校验案件信息统计")
@RequestMapping("/toQueryJwdinfoTj")
@ResponseBody
......
......@@ -360,8 +360,8 @@ public class SkRegionalsResultController extends ApiController implements ExcelC
* 查询结果列表信息(分页)
*/
@PostMapping("query")
@ApiOperation(value = "查询结果列表信息")
@OperLog(message = "查询结果列表信息", operation = OperationType.QUERY)
@ApiOperation(value = "以图研判_查询结果列表信息")
@OperLog(message = "以图研判_查询结果列表信息", operation = OperationType.QUERY)
public MapRestResult query(@RequestBody SkRegionalsResultParam skRegionalsDetailParam) {
//分页
Page page = new Page(skRegionalsDetailParam.getPage(), skRegionalsDetailParam.getPageSize());
......
......@@ -54,7 +54,7 @@ public class SkRelatedResultController extends ApiController {
*/
@PostMapping("query")
@ApiOperation(value = "以车侦查_关联关系")
@OperLog(message = "以车侦查_关联关系", operation = OperationType.QUERY)
@OperLog(message = "公共_关联关系", operation = OperationType.QUERY)
public MapRestResult query(@RequestBody SkRelatedResultParam param) throws UnsupportedEncodingException {
if("dev".equals(environment)) {
......
......@@ -230,7 +230,7 @@ public class SkTrailController extends ApiController implements ExcelControllerI
@PostMapping("queryTj")
@ApiOperation(value = "轨迹信息统计")
@OperLog(message = "轨迹信息统计接口", operation = OperationType.QUERY)
@OperLog(message = "公共_轨迹信息统计接口", operation = OperationType.QUERY)
public MapRestResult queryTj(@RequestBody SkTrailParam sktrailParam,HttpServletRequest request) {
Map<String,String> mapResult = new HashMap<>();
List<SkTrail> records = new ArrayList<>();
......
......@@ -26,8 +26,8 @@ public class JsController {
@Autowired
AddressPoiUtil addressPoiUtil;
@OperLog(message = "地址",operation = OperationType.QUERY)
@ApiOperation(value = "地址")
@OperLog(message = "公共_poi检索",operation = OperationType.QUERY)
@ApiOperation(value = "poi检索")
@PostMapping(value = "/poiname")
public MapRestResult poiname(@RequestBody JsParams jsParams) throws Exception {
List<JsResult> listResult = new ArrayList<>();
......
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