Browse Source

fix:【监控信息修改】修改

master
zhangjing 2 weeks ago
parent
commit
c21d2ffd90
8 changed files with 61 additions and 40 deletions
  1. +8
    -5
      src/main/java/com/fkzy/warn/common/util/DailyTask.java
  2. +3
    -3
      src/main/java/com/fkzy/warn/common/util/Demo.java
  3. +3
    -3
      src/main/java/com/fkzy/warn/common/util/LawResearchUtil.java
  4. +10
    -1
      src/main/java/com/fkzy/warn/controller/DataCenterController.java
  5. +29
    -24
      src/main/java/com/fkzy/warn/service/impl/AlarmCaseServiceImpl.java
  6. +5
    -1
      src/main/java/com/fkzy/warn/service/impl/LawCaseServiceImpl.java
  7. +2
    -2
      src/main/resources/bootstrap-prod.yml
  8. +1
    -1
      src/main/resources/bootstrap.yml

+ 8
- 5
src/main/java/com/fkzy/warn/common/util/DailyTask.java View File

@ -5,6 +5,7 @@ package com.fkzy.warn.common.util;
* @date 2025/07/08 19:29
* @description
*/
import com.fkzy.warn.model.AlarmCase;
import com.fkzy.warn.service.AlarmCaseService;
import com.fkzy.warn.service.MonitorUsersService;
@ -25,21 +26,23 @@ public class DailyTask {
AlarmCaseService alarmCaseService;
@Resource
MonitorUsersService monitorUsersService;
/**
* 在每年的3月6月9月12月的1号凌晨2点执行
* 在每年的 14710 月的 1 号凌晨 2 点执行
* Cron表达式:
*/
@Scheduled(cron = "0 0 2 1 3,6,9,12 ?")
@Scheduled(cron = "0 0 2 1 4,7,10,1 ?")
public void executeQuarterlyTask() {
reportService.quarterlyReport();
System.out.println("每季度定时任务开始执行,当前时间: " + new Date());
}
// 北京时间
@Scheduled(cron = "0 0 1 * * ?", zone = "Asia/Shanghai")
// 北京时间
@Scheduled(cron = "0 0 9 * * ?", zone = "Asia/Shanghai")
public void executeAtOneAMInShanghai() {
alarmCaseService.getAlarmInfo();
System.out.println("【北京时间】每天凌晨1点执行:" + new Date());
System.out.println("【北京时间】每天早9点执行:" + new Date());
}
// @Scheduled(cron = "0 0/5 * * * ?")
// public void executeEveryFiveMinutes() {

+ 3
- 3
src/main/java/com/fkzy/warn/common/util/Demo.java View File

@ -23,13 +23,13 @@ import java.util.*;
public class Demo {
public static void main(String[] args) {
LawResearchUtil law = new LawResearchUtil();
law.querySxx("河南省资源环境调查五院", "12410000415802064U",null);
// law.querySxx("河南省资源环境调查五院", "12410000415802064U",null);
// law.queryDishonest(null, null,null,null);
// law.queryLimitConsumption(null, null,null,null);
// law.monitorQuery(null, null);
// law.delcompany(null);
// law.queryMonitorCases(null,null,null);
law.addpublic(null);
law.queryMonitorCases(null,null,null);
// law.addpublic(null);
}

+ 3
- 3
src/main/java/com/fkzy/warn/common/util/LawResearchUtil.java View File

@ -749,7 +749,7 @@ public class LawResearchUtil {
public static InvocationRecord addpublic(String name) {
//默认测试数据
if (name == null) {
name = "丰县城市建设投资集团有限公司";
name = "河南中豫建设投资集团股份有限公司";
// creditCode = "91110108551385082Q";
}
JSONObject jsonObject = new JSONObject();
@ -802,7 +802,7 @@ public class LawResearchUtil {
//默认测试数据
if (pageIndex == null) {
pageIndex = 1;
pageSize = 20;
pageSize = 1000;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("pageIndex", pageIndex);
@ -828,7 +828,7 @@ public class LawResearchUtil {
//默认测试数据
if (queryDate == null) {
// queryDate="2022-07-06";
queryDate="2026-03-19";
queryDate="2026-03-26";
// pageIndex = 1;
// pageSize = 20;
}

+ 10
- 1
src/main/java/com/fkzy/warn/controller/DataCenterController.java View File

@ -1,10 +1,12 @@
package com.fkzy.warn.controller;
import com.alibaba.fastjson2.JSONObject;
import com.fkzy.warn.common.constants.ResponseMsgConstants;
import com.fkzy.warn.common.response.ApiResponse;
import com.fkzy.warn.model.AImessage;
import com.fkzy.warn.model.params.AILawParams;
import com.fkzy.warn.model.params.LawGroupParam;
import com.fkzy.warn.service.AlarmCaseService;
import com.fkzy.warn.service.FyApiService;
import com.fkzy.warn.service.LawCaseService;
import io.swagger.annotations.Api;
@ -34,6 +36,8 @@ public class DataCenterController {
@Resource
private LawCaseService lawCaseService;
@Resource
private AlarmCaseService alarmCaseService;
@Resource
private FyApiService fyApiService;
@RequestMapping(value = "judicialModelSave", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ -41,7 +45,12 @@ public class DataCenterController {
public ApiResponse judicialModelSave() {
ApiResponse apiResponse = new ApiResponse();
try {
lawCaseService.judicialModelSave(null);
// lawCaseService.judicialModelSave(null);
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("creditCode","91410000MA9LPPEA8U");
// lawCaseService.caseStatistics(jsonObject);
alarmCaseService.getAlarmInfo();
} catch (Exception e) {
log.error("查询错误,errMsg==={}", e.getMessage());
e.printStackTrace();

+ 29
- 24
src/main/java/com/fkzy/warn/service/impl/AlarmCaseServiceImpl.java View File

@ -60,9 +60,10 @@ public class AlarmCaseServiceImpl extends ServiceImpl
@Override
public void getAlarmInfo() {
InvocationRecord result = LawResearchUtil.queryMonitorCases(TimeUtil.formatTimeStr(new Date()), null, null);
invocationRecordService.saveModel(result);
if (result.getApiResult() == null||result.getIsSuccess().equals(0)) {
if (result.getApiResult() == null) {
return;
}
JSONObject jsonObject = new JSONObject().parseObject(result.getApiResult());
@ -71,34 +72,38 @@ public class AlarmCaseServiceImpl extends ServiceImpl
}
JSONObject object = jsonObject.getJSONObject("data");
JSONArray arr = object.getJSONArray("records");
if (arr == null || arr.isEmpty()) {
return;
}
List<MonitorUsers> monitorUsersList = new ArrayList<>();
if (arr != null && !arr.isEmpty()) {
List<AlarmCase> alarmCaseList = arr.toJavaList(AlarmCase.class);
if (alarmCaseList != null && !alarmCaseList.isEmpty()) {
alarmCaseList.forEach(item -> {
MonitorUsers monitorUsers = monitorUsersService.getOne(new LambdaQueryWrapper<MonitorUsers>()
.eq(MonitorUsers::getCompanyName, item.getName())
);
item.setCompanyName(monitorUsers != null ? monitorUsers.getCompanyName() : null);
item.setCreditCode(monitorUsers != null ? monitorUsers.getCreditCode() : null);
item.setAlarmDate(new Date());
monitorUsersList.add(monitorUsers);
});
}
this.saveBatch(alarmCaseList);
//如果有预警需要再查司法全量数据有待考虑,先存预警信息
monitorUsersList.forEach(item -> {
InvocationRecord lawResult = LawResearchUtil.querySxx(item.getCompanyName(), item.getCreditCode(),null);
invocationRecordService.saveModel(result);
JSONObject resultObj = JSONObject.parseObject(lawResult.getApiResult());
lawCaseService.judicialModelSave(resultObj);
List<AlarmCase> alarmCaseList = arr.toJavaList(AlarmCase.class);
if (alarmCaseList != null && !alarmCaseList.isEmpty()) {
alarmCaseList.forEach(item -> {
MonitorUsers monitorUsers = monitorUsersService.getOne(new LambdaQueryWrapper<MonitorUsers>()
.eq(MonitorUsers::getCompanyName, item.getName())
);
if (monitorUsers != null) {
item.setNAjbs(item.getNAjbs() + ":" + monitorUsers.getCreditCode());
item.setCompanyName(monitorUsers.getCompanyName());
item.setCreditCode(monitorUsers.getCreditCode());
}
item.setAlarmDate(new Date());
monitorUsersList.add(monitorUsers);
});
}
this.saveBatch(alarmCaseList);
//如果有预警需要再查司法全量数据有待考虑,先存预警信息
monitorUsersList.forEach(item -> {
InvocationRecord lawResult = LawResearchUtil.querySxx(item.getCompanyName(), item.getCreditCode(), null);
invocationRecordService.saveModel(result);
JSONObject resultObj = JSONObject.parseObject(lawResult.getApiResult());
lawCaseService.judicialModelSave(resultObj);
});
}
}

+ 5
- 1
src/main/java/com/fkzy/warn/service/impl/LawCaseServiceImpl.java View File

@ -3,6 +3,7 @@ package com.fkzy.warn.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fkzy.warn.common.constants.EntityConstants;
@ -194,7 +195,10 @@ public class LawCaseServiceImpl extends ServiceImpl impl
enterpriseProvinceQueue.eq("credit_code",creditCode);
enterpriseProvinceService.remove(enterpriseProvinceQueue);
enterpriseProvinceService.saveBatch(enterpriseProvinceList);
enterpriseAlarmInfoService.saveOrUpdate(data);
enterpriseAlarmInfoService.remove(new LambdaQueryWrapper<EnterpriseAlarmInfo>()
.eq(EnterpriseAlarmInfo::getCreditCode,creditCode)
);
enterpriseAlarmInfoService.save(data);
}
@Override

+ 2
- 2
src/main/resources/bootstrap-prod.yml View File

@ -5,7 +5,7 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:33066/fkzy_operation?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2b8&allowMultiQueries=true
url: jdbc:mysql://8.140.252.221:33066/fkzy_operation?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2b8&allowMultiQueries=true
username: root
password: Zjtc!@#0804
druid:
@ -20,7 +20,7 @@ spring:
#Redis
redis:
host: 127.0.0.1
host: 8.140.252.221
port: 63799
password: zjtc321!
pool:

+ 1
- 1
src/main/resources/bootstrap.yml View File

@ -26,7 +26,7 @@ spring:
maxFileSize: 200MB
maxRequestSize: 200MB
profiles:
active: dev
active: prod
application:
name: fxzy_warn

Loading…
Cancel
Save