app端代码同步
This commit is contained in:
parent
8b9882842f
commit
1c34f3dde1
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.common.exception;
|
||||
|
||||
/*
|
||||
* 自定义 邮件下载异常
|
||||
* */
|
||||
public class DownloadEmailException extends RuntimeException{
|
||||
|
||||
public DownloadEmailException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public DownloadEmailException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DbItem {
|
||||
DBMEMORY("dbMemory"),
|
||||
LOGREMAININGSIZE("logRemainingSize"),
|
||||
DBLSIZE("dblSize"), DBSIZE("dbSize");
|
||||
|
||||
private final String value;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package org.jeecg.modules.job;
|
||||
|
||||
public interface Job {
|
||||
|
||||
void execute();
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.service.IAlarmAnalysisNuclideParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NuclideParamJob implements Job{
|
||||
|
||||
@Autowired
|
||||
private IAlarmAnalysisNuclideParamService nuclideParamService;
|
||||
|
||||
@Override
|
||||
@Scheduled(cron = "${task.period-param:0 1 0 * * ?}")
|
||||
public void execute() { nuclideParamService.refresh(); }
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.jeecg.modules.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.service.CalculateConcService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NucliedAvgJob implements Job{
|
||||
|
||||
@Autowired
|
||||
private CalculateConcService calculateConcService;
|
||||
|
||||
@Override
|
||||
@Scheduled(cron = "${task.period-avg:0 2 0 * * ?}")
|
||||
public void execute() {
|
||||
calculateConcService.calcAndSave();
|
||||
}
|
||||
}
|
33
jeecg-module-app/pom.xml
Normal file
33
jeecg-module-app/pom.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>jeecg-module-app</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- jeecg-system-cloud-api -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,55 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.bizVo.AlarmVo;
|
||||
import org.jeecg.modules.base.bizVo.AnalysisLogVo;
|
||||
import org.jeecg.modules.feignclient.AlarmClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping()
|
||||
@Api(value = "报警日志服务", tags = "报警日志服务")
|
||||
public class AlarmController {
|
||||
|
||||
@Autowired
|
||||
private AlarmClient alarmClient;
|
||||
|
||||
@ApiOperation(value="报警日志分页查询", notes="报警日志分页查询")
|
||||
@GetMapping(value = "/alarmAnalysisLog/findPage")
|
||||
public Result analysisLogFindPage(AnalysisLogVo analysisLogVo) {
|
||||
Result result = alarmClient.analysisLogFindPage(analysisLogVo);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询报警日志信息")
|
||||
@PostMapping("/alarmLog/findPage")
|
||||
public Result alarmLogFindPage(@RequestBody AlarmVo alarmVo){
|
||||
Result result = alarmClient.alarmLogFindPage(alarmVo);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/sysServer/findPage")
|
||||
@ApiOperation(value = "分页查询服务器配置信息", notes = "分页查询服务器配置信息")
|
||||
public Result serverFindPage(QueryRequest query){
|
||||
Result result = alarmClient.serverFindPage(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/sysDatabase/findPage")
|
||||
@ApiOperation(value = "分页查询数据库配置信息", notes = "分页查询数据库配置信息")
|
||||
public Result databaseFindPage(QueryRequest query){
|
||||
Result result = alarmClient.databaseFindPage(query);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/sysEmail/findPage")
|
||||
@ApiOperation(value = "分页查询邮箱配置信息", notes = "分页查询邮箱配置信息")
|
||||
public Result emailFindPage(QueryRequest query){
|
||||
Result result = alarmClient.emailFindPage(query);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.feignclient.AnalysisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
public class AnalysisController {
|
||||
|
||||
@Autowired
|
||||
private AnalysisService analysisService;
|
||||
|
||||
// /spectrumAnalysis/getDBSpectrumChart
|
||||
@GetMapping("/spectrumAnalysis/getDBSpectrumChart")
|
||||
@ApiOperation(value = "查询折线图相关信息接口", notes = "查询折线图相关信息接口")
|
||||
public Result getDBSpectrumChart(String dbName,Integer sampleId,String analyst, HttpServletRequest request) {
|
||||
Result result = analysisService.getDBSpectrumChart(dbName, sampleId, analyst, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /spectrumAnalysis/deleteSpectrumCacheData
|
||||
@DeleteMapping("/spectrumAnalysis/deleteSpectrumCacheData")
|
||||
@ApiOperation(value = "删除缓存数据",notes = "删除缓存数据")
|
||||
public void deleteSpectrumCacheData(String sampleFileName, HttpServletRequest request) {
|
||||
analysisService.deleteSpectrumCacheData(sampleFileName, request);
|
||||
}
|
||||
|
||||
// /gamma/gammaByDB
|
||||
@GetMapping("/gamma/gammaByDB")
|
||||
public Result gammaByDB(Integer sampleId,String dbName,String analyst, HttpServletRequest request){
|
||||
Result result = analysisService.gammaByDB(sampleId, dbName, analyst, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /gamma/delPHDCache
|
||||
@DeleteMapping("/gamma/delPHDCache")
|
||||
@ApiOperation(value = "删除PHD文件缓存", notes = "删除PHD文件缓存")
|
||||
public void delPHDCache(@RequestParam String fileName) {
|
||||
analysisService.delPHDCache(fileName);
|
||||
}
|
||||
|
||||
// /gamma/peakInformation
|
||||
@GetMapping("/gamma/peakInformation")
|
||||
@ApiOperation(value = "查看Peak Information页面数据", notes = "查看Peak Information页面数据")
|
||||
public Result<?> peakInformation(Integer sampleId, String fileName, HttpServletRequest request){
|
||||
Result<?> result = analysisService.peakInformation(sampleId, fileName, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /gamma/getGammaSelPosNuclide
|
||||
@GetMapping("/gamma/getGammaSelPosNuclide")
|
||||
@ApiOperation(value = "gamma主页面选择channel加载对应核素信息接口", notes = "gamma主页面选择channel加载对应核素信息接口")
|
||||
public Result getGammaSelPosNuclide(Integer sampleId,String fileName,int channel,double energy, HttpServletRequest request) {
|
||||
Result result = analysisService.getGammaSelPosNuclide(sampleId, fileName, channel, energy, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /gamma/radionuclideActivity
|
||||
@GetMapping("/gamma/radionuclideActivity")
|
||||
@ApiOperation(value = "查看Radionuclide Activity页面数据", notes = "查看Radionuclide Activity页面数据")
|
||||
public Result radionuclideActivity(Integer sampleId,String fileName, HttpServletRequest request) {
|
||||
Result result = analysisService.radionuclideActivity(sampleId, fileName, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.base.entity.postgre.SysAnnouncement;
|
||||
import org.jeecg.modules.base.entity.postgre.SysAnnouncementSend;
|
||||
import org.jeecg.modules.entity.AnnouncementSendModel;
|
||||
import org.jeecg.modules.feignclient.MessageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class MessageController {
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
// /sys/sysAnnouncementSend/getMyAnnouncementSend
|
||||
/**
|
||||
* @功能:获取我的消息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/sys/sysAnnouncementSend/getMyAnnouncementSend")
|
||||
public Result getMyAnnouncementSend(AnnouncementSendModel announcementSendModel,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
Result result = messageService.getMyAnnouncementSend(announcementSendModel, pageNo, pageSize);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /sys/sysAnnouncementSend/editByAnntIdAndUserId
|
||||
@PutMapping(value = "/sys/sysAnnouncementSend/editByAnntIdAndUserId")
|
||||
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
|
||||
Result<SysAnnouncementSend> result = messageService.editById(json);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /sys/sysAnnouncementSend/readAll
|
||||
@PutMapping(value = "/sys/sysAnnouncementSend/readAll")
|
||||
public Result<SysAnnouncementSend> readAll() {
|
||||
Result<SysAnnouncementSend> result = messageService.readAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
// /sys/annountCement/syncNotic
|
||||
@RequestMapping(value = "/sys/annountCement/syncNotic", method = RequestMethod.GET)
|
||||
public Result<SysAnnouncement> syncNotic(@RequestParam(name="anntId",required=false) String anntId,@RequestBody HttpServletRequest request) {
|
||||
Result<SysAnnouncement> result = messageService.syncNotic(anntId, request);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /sys/annountCement/listByUser
|
||||
@RequestMapping(value = "/sys/annountCement/listByUser", method = RequestMethod.GET)
|
||||
public Result<Map<String, Object>> listByUser(@RequestParam(required = false, defaultValue = "5") Integer pageSize) {
|
||||
Result<Map<String, Object>> result = messageService.listByUser(pageSize);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.feignclient.RadionuclideClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("radionuclide")
|
||||
public class RadionuclideController {
|
||||
|
||||
@Autowired
|
||||
private RadionuclideClient radionuclideClient;
|
||||
@GetMapping("findAutoPage")
|
||||
@ApiOperation(value = "分页查询自动处理结果", notes = "分页查询自动处理结果")
|
||||
public Result findAutoPage(QueryRequest queryRequest,
|
||||
@RequestParam Integer[] stationIds,
|
||||
@RequestParam String qualifie, @RequestParam String sampleType,
|
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
|
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
|
||||
Result result = radionuclideClient.findAutoPage(queryRequest, stationIds, qualifie, sampleType, startTime, endTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("findReviewedPage")
|
||||
@ApiOperation(value = "分页查询人工交互结果", notes = "分页查询人工交互结果")
|
||||
public Result findReviewedPage(QueryRequest queryRequest,
|
||||
@RequestParam Integer[] stationIds,@RequestParam String qualifie,
|
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
|
||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
|
||||
Result result = radionuclideClient.findReviewedPage(queryRequest, stationIds, qualifie, startTime, endTime);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.StationOperation;
|
||||
import org.jeecg.modules.entity.SysUserFocusStationStation;
|
||||
import org.jeecg.modules.feignclient.StationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class StationController {
|
||||
|
||||
@Autowired
|
||||
private StationService stationService;
|
||||
|
||||
// /armd-station-operation/stationOperation/findStationType
|
||||
@GetMapping("/armd-station-operation/stationOperation/findStationType")
|
||||
@ApiOperation(value = "查询台站/核设施类型", notes = "查询台站/核设施类型")
|
||||
public List<String> findStationType(){
|
||||
List<String> result = stationService.findStationType();
|
||||
return result;
|
||||
}
|
||||
|
||||
// /armd-station-operation/stationOperation/getDataReceivingStatus
|
||||
@GetMapping("/armd-station-operation/stationOperation/getDataReceivingStatus")
|
||||
@ApiOperation(value = "查询台站监测数据信息", notes = "查询台站监测数据信息")
|
||||
public Result getDataReceivingStatus(@RequestParam(required = false) String userId, @RequestParam(required = false) Double cacheTime,@RequestParam(required = false) String oneStationId){
|
||||
if (StringUtils.isBlank(userId) && StringUtils.isBlank(oneStationId)) {
|
||||
return new Result();
|
||||
} else {
|
||||
return stationService.getDataReceivingStatus(userId, cacheTime, oneStationId);
|
||||
}
|
||||
}
|
||||
|
||||
// /armd-station-operation/stationOperation/findList
|
||||
@GetMapping("/armd-station-operation/stationOperation/findList")
|
||||
@ApiOperation(value = "查询台站/核设施信息", notes = "查询台站/核设施信息")
|
||||
public List<StationOperation> findStationOperationList(@RequestParam(required = false) String status,@RequestParam(required = false) String stationType){
|
||||
if (StringUtils.isBlank(status)) {
|
||||
status = "";
|
||||
}
|
||||
if (StringUtils.isBlank(stationType)) {
|
||||
stationType = "";
|
||||
}
|
||||
List<StationOperation> result = stationService.findStationOperationList(status, stationType);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /stationOperation/getDataProvisionEfficiency
|
||||
@GetMapping("/stationOperation/getDataProvisionEfficiency")
|
||||
@ApiOperation(value = "查询台站数据提供率及有效率", notes = "查询台站数据提供率及有效率")
|
||||
public Result getDataProvisionEfficiency(){
|
||||
Result result = stationService.getDataProvisionEfficiency();
|
||||
return result;
|
||||
}
|
||||
|
||||
// /armd-station-operation/stationOperation/findInfo
|
||||
@GetMapping("/armd-station-operation/stationOperation/findInfo")
|
||||
@ApiOperation(value = "查询台站/核设施详情信息", notes = "查询台站/核设施详情信息")
|
||||
public Result findInfo(@RequestParam String stationId,@RequestParam String type){
|
||||
Result result = stationService.findInfo(stationId, type);
|
||||
return result;
|
||||
}
|
||||
|
||||
// /armd-station-operation/sysUserFocusStation/findList
|
||||
@GetMapping("/armd-station-operation/sysUserFocusStation/findList")
|
||||
@ApiOperation(value = "查询关注台站列表", notes = "查询关注台站列表")
|
||||
public List<SysUserFocusStationStation> findUserFocusStationList(){
|
||||
List<SysUserFocusStationStation> result = stationService.findUserFocusStationList();
|
||||
return result;
|
||||
}
|
||||
|
||||
// /armd-station-operation/sysUserFocusStation/findUserFocusByUserId
|
||||
@GetMapping("/armd-station-operation/sysUserFocusStation/findUserFocusByUserId")
|
||||
@ApiOperation(value = "根据用户id查询用户的缓存配置信息及关注台站信息", notes = "根据用户id查询用户的缓存配置信息及关注台站信息")
|
||||
public Result findUserFocusByUserId(@RequestParam String userId){
|
||||
Result result = stationService.findUserFocusByUserId(userId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUserClient;
|
||||
import org.jeecg.modules.model.SysLoginModel;
|
||||
import org.jeecg.modules.feignclient.SystemClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sys")
|
||||
public class SystemController {
|
||||
|
||||
@Autowired
|
||||
private SystemClient systemClient;
|
||||
|
||||
/**
|
||||
* app登录
|
||||
* @param sysLoginModel
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation("移动端登陆")
|
||||
@RequestMapping(value = "/mLogin", method = RequestMethod.POST)
|
||||
public Result<JSONObject> mLogin(@RequestBody SysLoginModel sysLoginModel) {
|
||||
Result<JSONObject> result = systemClient.mLogin(sysLoginModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping("/userClient/saveOrUpdateClient")
|
||||
public void saveOrUpdateClient(@RequestBody SysUserClient sysUserClient) {
|
||||
systemClient.saveOrUpdateClient(sysUserClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/logout")
|
||||
public Result<Object> logout(HttpServletRequest request) {
|
||||
//用户退出逻辑
|
||||
Result<Object> result = systemClient.logout(request);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台生成图形验证码 :有效
|
||||
* @param key
|
||||
*/
|
||||
@ApiOperation("获取验证码")
|
||||
@GetMapping(value = "/randomImage/{key}")
|
||||
public Result<String> randomImage(@PathVariable("key") String key) {
|
||||
Result<String> result = systemClient.randomImage(key);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsStations;
|
||||
import org.jeecg.modules.feignclient.WebStatisticsClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("webStatistics")
|
||||
public class WebStatisticsController {
|
||||
|
||||
@Autowired
|
||||
private WebStatisticsClient webStatisticsClient;
|
||||
|
||||
@GetMapping("/findStationList")
|
||||
@ApiOperation(value = "根据菜单名称查询对应的台站信息", notes = "根据菜单名称查询对应的台站信息")
|
||||
public Result findStationList(@RequestParam String menuName){
|
||||
Result result = webStatisticsClient.findStationList(menuName);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 用户通告阅读标记表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2019-02-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class AnnouncementSendModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**通告id*/
|
||||
private String anntId;
|
||||
/**用户id*/
|
||||
private String userId;
|
||||
/**标题*/
|
||||
private String titile;
|
||||
/**内容*/
|
||||
private String msgContent;
|
||||
/**发布人*/
|
||||
private String sender;
|
||||
/**优先级(L低,M中,H高)*/
|
||||
private String priority;
|
||||
/**阅读状态*/
|
||||
private String readFlag;
|
||||
/**发布时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date sendTime;
|
||||
/**页数*/
|
||||
private Integer pageNo;
|
||||
/**大小*/
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 消息类型1:通知公告2:系统消息
|
||||
*/
|
||||
private String msgCategory;
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String busId;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String busType;
|
||||
/**
|
||||
* 打开方式 组件:component 路由:url
|
||||
*/
|
||||
private String openType;
|
||||
/**
|
||||
* 组件/路由 地址
|
||||
*/
|
||||
private String openPage;
|
||||
|
||||
/**
|
||||
* 业务类型查询(0.非bpm业务)
|
||||
*/
|
||||
private String bizSource;
|
||||
|
||||
/**
|
||||
* 摘要
|
||||
*/
|
||||
private String msgAbstract;
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class StationOperation implements Serializable {
|
||||
|
||||
/**
|
||||
* 台站/核设施id
|
||||
*/
|
||||
private Integer stationId;
|
||||
|
||||
/**
|
||||
* 台站/核设施名称
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 台站/核设施类型
|
||||
*/
|
||||
private String stationType;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private String altitude;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lon;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 标记
|
||||
*/
|
||||
private String signal;
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package org.jeecg.modules.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUserFocusStation;
|
||||
|
||||
@Data
|
||||
@TableName("sys_user_focus_station")
|
||||
public class SysUserFocusStationStation extends SysUserFocusStation {
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double lon;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Double lat;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String altitude;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 台站编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String stationCode;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.bizVo.AlarmVo;
|
||||
import org.jeecg.modules.base.bizVo.AnalysisLogVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-abnormal-alarm")
|
||||
public interface AlarmClient {
|
||||
|
||||
@PostMapping(value = "/alarmAnalysisLog/findPageApp")
|
||||
Result analysisLogFindPage(@RequestBody AnalysisLogVo analysisLogVo);
|
||||
|
||||
@PostMapping(value = "/alarmLog/findPageApp")
|
||||
Result alarmLogFindPage(@RequestBody AlarmVo alarmVo);
|
||||
|
||||
@PostMapping(value = "/sysEmail/findPageApp")
|
||||
Result emailFindPage(@RequestBody QueryRequest query);
|
||||
|
||||
@PostMapping(value = "/sysServer/findPageApp")
|
||||
Result serverFindPage(@RequestBody QueryRequest query);
|
||||
|
||||
@PostMapping(value = "/sysDatabase/findPageApp")
|
||||
Result databaseFindPage(@RequestBody QueryRequest query);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-spectrum-analysis")
|
||||
public interface AnalysisService {
|
||||
|
||||
@GetMapping("/spectrumAnalysis/getDBSpectrumChartApp")
|
||||
Result getDBSpectrumChart(@RequestParam("dbName") String dbName, @RequestParam("sampleId") Integer sampleId,
|
||||
@RequestParam("analyst") String analyst,@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
@DeleteMapping("/spectrumAnalysis/deleteSpectrumCacheDataApp")
|
||||
void deleteSpectrumCacheData(@RequestParam("sampleFileName") String sampleFileName,
|
||||
@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
@GetMapping("/gamma/gammaByDBApp")
|
||||
Result gammaByDB(@RequestParam("sampleId") Integer sampleId,@RequestParam("dbName") String dbName,
|
||||
@RequestParam("analyst") String analyst,@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
@DeleteMapping("/gamma/delPHDCacheApp")
|
||||
void delPHDCache(@RequestParam("fileName") String fileName);
|
||||
|
||||
@GetMapping("/gamma/peakInformationApp")
|
||||
Result<?> peakInformation(@RequestParam("sampleId") Integer sampleId,
|
||||
@RequestParam("fileName") String fileName,@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
@GetMapping("/gamma/getGammaSelPosNuclideApp")
|
||||
Result getGammaSelPosNuclide(@RequestParam("sampleId") Integer sampleId,
|
||||
@RequestParam("fileName") String fileName,@RequestParam("channel") int channel,
|
||||
@RequestParam("energy") double energy,@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
@GetMapping("/gamma/radionuclideActivityApp")
|
||||
Result radionuclideActivity(@RequestParam("sampleId") Integer sampleId,
|
||||
@RequestParam("fileName") String fileName,@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.SysAnnouncement;
|
||||
import org.jeecg.modules.base.entity.postgre.SysAnnouncementSend;
|
||||
import org.jeecg.modules.entity.AnnouncementSendModel;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-system")
|
||||
public interface MessageService {
|
||||
|
||||
|
||||
@PostMapping(value = "/sys/sysAnnouncementSend/getMyAnnouncementSendApp")
|
||||
Result getMyAnnouncementSend(@RequestBody AnnouncementSendModel announcementSendModel,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize);
|
||||
|
||||
@PutMapping(value = "/sys/sysAnnouncementSend/editByAnntIdAndUserId")
|
||||
Result editById(@RequestBody JSONObject json);
|
||||
|
||||
@PutMapping(value = "/sys/sysAnnouncementSend/readAll")
|
||||
Result readAll();
|
||||
|
||||
@RequestMapping(value = "/sys/annountCement/syncNotic", method = RequestMethod.GET)
|
||||
Result syncNotic(@RequestParam(name="anntId",required=false) String anntId, HttpServletRequest request);
|
||||
|
||||
@RequestMapping(value = "/sys/annountCement/listByUser", method = RequestMethod.GET)
|
||||
Result listByUser(@RequestParam(required = false, defaultValue = "5") Integer pageSize);
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-web-statistics", path = "/radionuclide")
|
||||
public interface RadionuclideClient {
|
||||
|
||||
/**
|
||||
* 分页查询自动处理结果
|
||||
* @param queryRequest
|
||||
* @param stationIds
|
||||
* @param qualifie
|
||||
* @param sampleType
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findAutoPageApp")
|
||||
Result findAutoPage(@RequestBody QueryRequest queryRequest,
|
||||
@RequestParam("stationIds") Integer[] stationIds,
|
||||
@RequestParam("qualifie") String qualifie,@RequestParam("sampleType") String sampleType,
|
||||
@RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
||||
@RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime);
|
||||
|
||||
/**
|
||||
* 分页查询人工交互结果
|
||||
* @param queryRequest
|
||||
* @param stationIds
|
||||
* @param qualifie
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findReviewedPageApp")
|
||||
Result findReviewedPage(@RequestBody QueryRequest queryRequest,
|
||||
@RequestParam("stationIds") Integer[] stationIds, @RequestParam("qualifie") String qualifie,
|
||||
@RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
|
||||
@RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.StationOperation;
|
||||
import org.jeecg.modules.entity.SysUserFocusStationStation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-station-operation")
|
||||
public interface StationService {
|
||||
|
||||
@GetMapping("/stationOperation/findStationType")
|
||||
List<String> findStationType();
|
||||
|
||||
@GetMapping("/stationOperation/getDataReceivingStatusApp")
|
||||
Result getDataReceivingStatus(@RequestParam String userId,@RequestParam Double cacheTime, @RequestParam String oneStationId);
|
||||
|
||||
@GetMapping("/stationOperation/findListApp")
|
||||
List<StationOperation> findStationOperationList(@RequestParam String status, @RequestParam String stationType);
|
||||
|
||||
@GetMapping("/stationOperation/getDataProvisionEfficiency")
|
||||
Result getDataProvisionEfficiency();
|
||||
|
||||
@GetMapping("/stationOperation/findInfoApp")
|
||||
Result findInfo(@RequestParam String stationId,@RequestParam String type);
|
||||
|
||||
@GetMapping("/sysUserFocusStation/findList")
|
||||
List<SysUserFocusStationStation> findUserFocusStationList();
|
||||
|
||||
@GetMapping("/sysUserFocusStation/findUserFocusByUserIdApp")
|
||||
Result findUserFocusByUserId(@RequestParam String userId);
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.entity.postgre.SysUserClient;
|
||||
import org.jeecg.modules.model.SysLoginModel;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-system", path = "/sys")
|
||||
public interface SystemClient {
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/mLogin")
|
||||
Result<JSONObject> mLogin(@RequestBody SysLoginModel sysLoginModel);
|
||||
|
||||
/**
|
||||
* 保存用户关联客户端
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userClient/saveOrUpdateClient")
|
||||
void saveOrUpdateClient(@RequestBody SysUserClient sysUserClient);
|
||||
|
||||
/**
|
||||
* 登出
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/mlogout")
|
||||
Result<Object> logout(@RequestParam("request") HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 图形验证码
|
||||
*/
|
||||
@GetMapping("/randomImage/{key}")
|
||||
Result<String> randomImage(@PathVariable("key") String key);
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.jeecg.modules.feignclient;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
@FeignClient(value = "armd-web-statistics", path = "/webStatistics")
|
||||
public interface WebStatisticsClient {
|
||||
|
||||
@GetMapping("/findStationListApp")
|
||||
Result findStationList(@RequestParam String menuName);
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.jeecg.modules.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 登录表单
|
||||
*
|
||||
* @Author scott
|
||||
* @since 2019-01-18
|
||||
*/
|
||||
@ApiModel(value="登录对象", description="登录对象")
|
||||
public class SysLoginModel {
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String username;
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
@ApiModelProperty(value = "验证码")
|
||||
private String captcha;
|
||||
@ApiModelProperty(value = "验证码key")
|
||||
private String checkKey;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getCaptcha() {
|
||||
return captcha;
|
||||
}
|
||||
|
||||
public void setCaptcha(String captcha) {
|
||||
this.captcha = captcha;
|
||||
}
|
||||
|
||||
public String getCheckKey() {
|
||||
return checkKey;
|
||||
}
|
||||
|
||||
public void setCheckKey(String checkKey) {
|
||||
this.checkKey = checkKey;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.jeecg.modules.spectrum;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 批次计数器
|
||||
*/
|
||||
@Component
|
||||
public class BatchesCounter {
|
||||
|
||||
private Object lock = new Object();
|
||||
|
||||
private AtomicInteger batchesCounter = new AtomicInteger();
|
||||
|
||||
public int getCurrValue(){
|
||||
synchronized (lock){
|
||||
return batchesCounter.getAndIncrement();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.base.entity.postgre.SysTaskStation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysTaskStationMapper extends BaseMapper<SysTaskStation> {
|
||||
|
||||
List<String> findTaskStation(String userId, String nowDate);
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.mapper.SysTaskStationMapper">
|
||||
|
||||
<select id="findTaskStation" resultType="java.lang.String">
|
||||
SELECT
|
||||
station_id
|
||||
from
|
||||
sys_task_station
|
||||
where
|
||||
task_id =
|
||||
(SELECT
|
||||
id
|
||||
FROM
|
||||
sys_task
|
||||
where
|
||||
user_id = #{userId}
|
||||
and scheduling_date = to_date(#{nowDate}, 'YYYY-MM-DD')
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,156 @@
|
|||
package org.jeecg.modules.quartz.jobs;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.util.DataTool;
|
||||
import org.jeecg.common.util.NumUtil;
|
||||
import org.jeecg.common.util.TemplateUtil;
|
||||
import org.jeecg.modules.base.entity.Rule;
|
||||
import org.jeecg.modules.base.entity.monitor.ItemHistory;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmLog;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||
import org.jeecg.modules.feignclient.ManageUtil;
|
||||
import org.jeecg.modules.quartz.entity.Monitor;
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jeecg.modules.base.enums.SourceType.DATABASE;
|
||||
import static org.jeecg.modules.base.enums.Template.MONITOR_DATABASE;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DatabaseJob extends Monitor {
|
||||
/**
|
||||
* 解析Database预警规则
|
||||
**/
|
||||
@Scheduled(cron = "${task.period:0 0/1 * * * ?}")
|
||||
public void execute(){
|
||||
init();
|
||||
|
||||
// 查询所有Database的报警规则,根据报警规则查询监控项数据
|
||||
String pattern = RedisConstant.PREFIX_RULE + DATABASE.getType();
|
||||
Set<String> keys = getRedisStreamUtil().keys(pattern);
|
||||
if (CollUtil.isEmpty(keys)) return;
|
||||
|
||||
// 时间间隔为每分钟
|
||||
LocalDateTime now = LocalDateTime.now()
|
||||
.withSecond(0)
|
||||
.withNano(0);
|
||||
LocalDateTime beforeMin = now.minusMinutes(1);
|
||||
DateTimeFormatter formatter = DateTimeFormatter
|
||||
.ofPattern(DateConstant.DATE_TIME);
|
||||
String start = beforeMin.format(formatter);
|
||||
String end = now.format(formatter);
|
||||
|
||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||
String operator = null;
|
||||
for (String ruleKey : keys) {
|
||||
try {
|
||||
AlarmRule alarmRule = (AlarmRule) getRedisStreamUtil().get(ruleKey);
|
||||
// 如果报警规则为空,或者在沉默周期内,跳过当前规则
|
||||
operator = alarmRule.getOperator();
|
||||
String ruleId = alarmRule.getId();
|
||||
String itemId = alarmRule.getItemId();
|
||||
String type = alarmRule.getItemType();
|
||||
Integer itemType = StrUtil.isBlank(type) ? 0 : Integer.parseInt(type);
|
||||
String silenceKey = prefixSilence + ruleId;
|
||||
boolean hasKey = getRedisStreamUtil().hasKey(silenceKey);
|
||||
boolean blank1 = StrUtil.isBlank(operator);
|
||||
boolean blank2 = StrUtil.isBlank(itemId);
|
||||
|
||||
if (blank1 || blank2 || hasKey) continue;
|
||||
|
||||
// 根据sourceId查询Database信息(缓存)
|
||||
String sourceId = alarmRule.getSourceId();
|
||||
String databaseName = getAlarmClient().getDatabaseName(sourceId);
|
||||
|
||||
/*// 根据监控项id选择要查询的监控项信息
|
||||
Item item = Item.of(itemId);
|
||||
if (ObjectUtil.isNull(item)) continue;
|
||||
Number current = null;
|
||||
switch (item){
|
||||
case DATABASE_CONN: // 监控项-2: 测试数据源是否可以连接成功
|
||||
current = isConnection(sourceId);
|
||||
break;
|
||||
// 追加的监控项...
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
// 向运管查询监控项数据
|
||||
String token = ManageUtil.getToken();
|
||||
Result<ItemHistory> result = getMonitorSystem().itemBack(itemId, itemType, start, end, token);
|
||||
ItemHistory itemHistory = result.getResult();
|
||||
if (ObjectUtil.isNull(itemHistory)){
|
||||
log.warn("Database监控异常: [{}]查询监控项历史数据为空", databaseName);
|
||||
continue;
|
||||
}
|
||||
Double current = itemHistory.getNow();
|
||||
|
||||
// 解析预警规则,判断是否需要报警
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Rule rule = mapper.readValue(operator, Rule.class);
|
||||
String op = rule.getOperator();
|
||||
Double threshold = rule.getThreshold();
|
||||
boolean needWarn = NumUtil.compare(current, threshold, op);
|
||||
if (needWarn){
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
alarmLog.setOperator(operator);
|
||||
alarmLog.setAlarmValue(StrUtil.toString(current));
|
||||
|
||||
String ruleName = alarmRule.getName();
|
||||
Map<String, Object> data = DataTool.getInstance().
|
||||
put(databaseName).put(ruleName).put(rule.joint()).put(current).get();
|
||||
MessageDTO messageDTO = TemplateUtil.parse(MONITOR_DATABASE.getCode(), data);
|
||||
|
||||
alarmLog.setAlarmInfo(messageDTO.getContent());
|
||||
getAlarmClient().create(alarmLog);
|
||||
// 规则触发报警后,设置该规则的沉默周期(如果有)
|
||||
// 沉默周期失效之前,该规则不会再次被触发
|
||||
Long silenceCycle = alarmRule.getSilenceCycle();
|
||||
ruleSilence(silenceKey, silenceCycle);
|
||||
|
||||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Database预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
}catch (Exception e){
|
||||
log.error("Database监控异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
destroy();
|
||||
}
|
||||
|
||||
/*
|
||||
* 监控项-2: 测试数据源是否可以连接成功 (0:失败 1:成功)
|
||||
* */
|
||||
/*private Integer isConnection(String databaseId){
|
||||
int res = 1;
|
||||
String statusKey = RedisConstant.DATABASE_STATUS;
|
||||
NameValue nameValue = (NameValue)getRedisUtil().hget(statusKey, databaseId);
|
||||
if (ObjectUtil.isNull(nameValue) || ObjectUtil.isNull(nameValue.getValue()) || !nameValue.getValue())
|
||||
res = 0;
|
||||
return res;
|
||||
}*/
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package org.jeecg.modules.quartz.jobs;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.util.DataTool;
|
||||
import org.jeecg.common.util.NumUtil;
|
||||
import org.jeecg.common.util.TemplateUtil;
|
||||
import org.jeecg.modules.base.dto.NameValue;
|
||||
import org.jeecg.modules.base.entity.Rule;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmLog;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||
import org.jeecg.modules.base.enums.Item;
|
||||
import org.jeecg.modules.quartz.entity.Monitor;
|
||||
import org.quartz.*;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jeecg.modules.base.enums.SourceType.EMAIL;
|
||||
import static org.jeecg.modules.base.enums.Template.MONITOR_EMAIL;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EmailJob extends Monitor{
|
||||
/**
|
||||
* 解析Email预警规则
|
||||
**/
|
||||
@Scheduled(cron = "${task.period:0 0/1 * * * ?}")
|
||||
public void execute(){
|
||||
init();
|
||||
|
||||
// 查询所有Email的报警规则,根据报警规则查询监控项数据
|
||||
String pattern = RedisConstant.PREFIX_RULE + EMAIL.getType();
|
||||
Set<String> keys = getRedisStreamUtil().keys(pattern);
|
||||
if (CollUtil.isEmpty(keys)) return;
|
||||
|
||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||
String operator = null;
|
||||
for (String ruleKey : keys) {
|
||||
try {
|
||||
AlarmRule alarmRule = (AlarmRule) getRedisStreamUtil().get(ruleKey);
|
||||
// 如果报警规则为空,或者在沉默周期内,跳过当前规则
|
||||
operator = alarmRule.getOperator();
|
||||
String ruleId = alarmRule.getId();
|
||||
String itemId = alarmRule.getItemId();
|
||||
String silenceKey = prefixSilence + ruleId;
|
||||
boolean hasKey = getRedisStreamUtil().hasKey(silenceKey);
|
||||
boolean blank1 = StrUtil.isBlank(operator);
|
||||
boolean blank2 = StrUtil.isBlank(itemId);
|
||||
|
||||
if (blank1 || blank2 || hasKey) continue;
|
||||
|
||||
// 根据sourceId查询Eamil信息(缓存)
|
||||
String sourceId = alarmRule.getSourceId();
|
||||
String emailName = getAlarmClient().getEmailName(sourceId);
|
||||
|
||||
// 根据监控项id选择要查询的监控项信息
|
||||
Item item = Item.of(itemId);
|
||||
if (ObjectUtil.isNull(item)) continue;
|
||||
Number current = null;
|
||||
switch (item){
|
||||
case EMAIL_CONN: // 监控项-1: 测试邮箱服务是否可以连接成功
|
||||
current = isConnection(sourceId);
|
||||
break;
|
||||
// 追加的监控项...
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 解析预警规则,判断是否需要报警
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Rule rule = mapper.readValue(operator, Rule.class);
|
||||
String op = rule.getOperator();
|
||||
Double threshold = rule.getThreshold();
|
||||
boolean needWarn = NumUtil.compare(current, threshold, op);
|
||||
if (needWarn){
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
alarmLog.setOperator(operator);
|
||||
alarmLog.setAlarmValue(StrUtil.toString(current));
|
||||
|
||||
String ruleName = alarmRule.getName();
|
||||
Map<String, Object> data = DataTool.getInstance().
|
||||
put(emailName).put(ruleName).put(rule.joint()).put(current).get();
|
||||
MessageDTO messageDTO = TemplateUtil.parse(MONITOR_EMAIL.getCode(), data);
|
||||
|
||||
alarmLog.setAlarmInfo(messageDTO.getContent());
|
||||
getAlarmClient().create(alarmLog);
|
||||
// 规则触发报警后,设置该规则的沉默周期(如果有)
|
||||
// 沉默周期失效之前,该规则不会再次被触发
|
||||
Long silenceCycle = alarmRule.getSilenceCycle();
|
||||
ruleSilence(silenceKey, silenceCycle);
|
||||
|
||||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Email预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
}catch (Exception e){
|
||||
log.error("Email监控异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
destroy();
|
||||
}
|
||||
|
||||
/*
|
||||
* 监控项-1: 测试邮箱服务是否可以连接成功 (0:失败 1:成功)
|
||||
* */
|
||||
private Integer isConnection(String emailId){
|
||||
int res = 1;
|
||||
String statusKey = RedisConstant.EMAIL_STATUS;
|
||||
NameValue nameValue = (NameValue)getRedisUtil().hget(statusKey, emailId);
|
||||
if (ObjectUtil.isNull(nameValue) || ObjectUtil.isNull(nameValue.getValue()) || !nameValue.getValue())
|
||||
res = 0;
|
||||
return res;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
package org.jeecg.modules.quartz.jobs;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import feign.FeignException;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.util.DataTool;
|
||||
import org.jeecg.common.util.NumUtil;
|
||||
import org.jeecg.common.util.TemplateUtil;
|
||||
import org.jeecg.modules.base.entity.Rule;
|
||||
import org.jeecg.modules.base.entity.monitor.ItemHistory;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmLog;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmRule;
|
||||
import org.jeecg.modules.feignclient.ManageUtil;
|
||||
import org.jeecg.modules.quartz.entity.Monitor;
|
||||
import org.quartz.*;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jeecg.modules.base.enums.SourceType.SERVER;
|
||||
import static org.jeecg.modules.base.enums.Template.MONITOR_SERVER;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerJob extends Monitor{
|
||||
/**
|
||||
* 根据host定时查询服务器信息
|
||||
* 并向消息队列中推送信息
|
||||
*
|
||||
*/
|
||||
@Scheduled(cron = "${task.period:0 0/1 * * * ?}")
|
||||
public void execute(){
|
||||
init();
|
||||
|
||||
// 查询所有Server的报警规则,根据报警规则查询监控项数据
|
||||
String pattern = RedisConstant.PREFIX_RULE + SERVER.getType();
|
||||
Set<String> keys = getRedisStreamUtil().keys(pattern);
|
||||
if (CollUtil.isEmpty(keys)) return;
|
||||
|
||||
// 时间间隔为每分钟
|
||||
LocalDateTime now = LocalDateTime.now()
|
||||
.withSecond(0)
|
||||
.withNano(0);
|
||||
LocalDateTime beforeMin = now.minusMinutes(1);
|
||||
DateTimeFormatter formatter = DateTimeFormatter
|
||||
.ofPattern(DateConstant.DATE_TIME);
|
||||
String start = beforeMin.format(formatter);
|
||||
String end = now.format(formatter);
|
||||
|
||||
String prefixSilence = RedisConstant.PREFIX_SILENCE;
|
||||
String operator = null;
|
||||
for (String ruleKey : keys) {
|
||||
try {
|
||||
AlarmRule alarmRule = (AlarmRule) getRedisStreamUtil().get(ruleKey);
|
||||
// 如果报警规则为空,或者在沉默周期内,跳过当前规则
|
||||
operator = alarmRule.getOperator();
|
||||
String ruleId = alarmRule.getId();
|
||||
String itemId = alarmRule.getItemId();
|
||||
String type = alarmRule.getItemType();
|
||||
Integer itemType = StrUtil.isBlank(type) ? 0 : Integer.parseInt(type);
|
||||
String silenceKey = prefixSilence + ruleId;
|
||||
boolean hasKey = getRedisStreamUtil().hasKey(silenceKey);
|
||||
boolean blank1 = StrUtil.isBlank(operator);
|
||||
boolean blank2 = StrUtil.isBlank(itemId);
|
||||
|
||||
if (blank1 || blank2 || hasKey) continue;
|
||||
|
||||
// 根据sourceId查询Server信息(缓存)
|
||||
String sourceId = alarmRule.getSourceId();
|
||||
String serverName = getAlarmClient().getServerName(sourceId);
|
||||
|
||||
// 向运管查询监控项数据
|
||||
String token = ManageUtil.getToken();
|
||||
Result<ItemHistory> result = getMonitorSystem().itemBack(itemId, itemType, start, end, token);
|
||||
ItemHistory itemHistory = result.getResult();
|
||||
if (ObjectUtil.isNull(itemHistory)){
|
||||
log.warn("Server监控异常: [{}]查询监控项历史数据为空", serverName);
|
||||
continue;
|
||||
}
|
||||
Double current = itemHistory.getNow();
|
||||
|
||||
// 解析预警规则,判断是否需要报警
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Rule rule = mapper.readValue(operator, Rule.class);
|
||||
String op = rule.getOperator();
|
||||
Double threshold = rule.getThreshold();
|
||||
boolean needWarn = NumUtil.compare(current, threshold, op);
|
||||
if (needWarn){
|
||||
// 记录报警日志
|
||||
AlarmLog alarmLog = new AlarmLog();
|
||||
alarmLog.setRuleId(ruleId);
|
||||
alarmLog.setOperator(operator);
|
||||
alarmLog.setAlarmValue(StrUtil.toString(current));
|
||||
|
||||
String ruleName = alarmRule.getName();
|
||||
Map<String, Object> data = DataTool.getInstance().
|
||||
put(serverName).put(ruleName).put(rule.joint()).put(current).get();
|
||||
MessageDTO messageDTO = TemplateUtil.parse(MONITOR_SERVER.getCode(), data);
|
||||
|
||||
alarmLog.setAlarmInfo(messageDTO.getContent());
|
||||
getAlarmClient().create(alarmLog);
|
||||
// 规则触发报警后,设置该规则的沉默周期(如果有)
|
||||
// 沉默周期失效之前,该规则不会再次被触发
|
||||
Long silenceCycle = alarmRule.getSilenceCycle();
|
||||
ruleSilence(silenceKey, silenceCycle);
|
||||
|
||||
// 发送报警信息
|
||||
String groupId = alarmRule.getContactId();
|
||||
String notific = alarmRule.getNotification();
|
||||
getSendMessage().send(messageDTO, groupId, notific);
|
||||
getPushAppUtil().pushToSingle(messageDTO, groupId);
|
||||
}
|
||||
}catch (FeignException.Unauthorized e){
|
||||
ManageUtil.refreshToken();
|
||||
log.warn("向运管系统查询ItemHistory信息异常: Token失效,已刷新Token");
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Server预警规则: {}解析失败,失败原因: {}", operator, e.getMessage());
|
||||
}catch (Exception e){
|
||||
log.error("Server监控异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
destroy();
|
||||
}
|
||||
}
|
48
jeecg-server-cloud/armd-app-start/pom.xml
Normal file
48
jeecg-server-cloud/armd-app-start/pom.xml
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>armd-app-start</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 引入jeecg-boot-starter-cloud依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-cloud</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jeecg-module-abnormal-alarm模块 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-module-app</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,50 @@
|
|||
package org.jeecg;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients(basePackages = {"org.jeecg"})
|
||||
@EnableScheduling
|
||||
@RequiredArgsConstructor
|
||||
public class JeecgAppProcessStart extends SpringBootServletInitializer implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(JeecgAppProcessStart.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgAppProcessStart.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://localhost:" + port + path + "/doc.html\n" +
|
||||
"External: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
server:
|
||||
port: 7008
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: armd-app
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: @config.server-addr@
|
||||
group: @config.group@
|
||||
namespace: @config.namespace@
|
||||
discovery:
|
||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:armd.yaml
|
||||
- optional:nacos:armd-@profile.name@.yaml
|
||||
- optional:nacos:armd-analysis-@profile.name@.yaml
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!--定义日志文件的存储地址 -->
|
||||
<property name="LOG_HOME" value="./logs/log" />
|
||||
<property name="ERROR_LOG_HOME" value="./logs/errorLog" />
|
||||
|
||||
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名 -->
|
||||
<FileNamePattern>${LOG_HOME}/app-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数 -->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 生成 error html格式日志开始 -->
|
||||
<appender name="HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<!--设置日志级别,过滤掉info日志,只输入error日志-->
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名 -->
|
||||
<FileNamePattern>${ERROR_LOG_HOME}/app-error-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
|
||||
<!--日志文件保留天数 -->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="ch.qos.logback.classic.html.HTMLLayout">
|
||||
<pattern>%p%d%msg%M%F{32}%L</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 生成 error html格式日志结束 -->
|
||||
|
||||
<!-- 每天生成一个html格式的日志开始 -->
|
||||
<appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名 -->
|
||||
<FileNamePattern>${LOG_HOME}/app-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
|
||||
<!--日志文件保留天数 -->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<MaxFileSize>10MB</MaxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||
<layout class="ch.qos.logback.classic.html.HTMLLayout">
|
||||
<pattern>%p%d%msg%M%F{32}%L</pattern>
|
||||
</layout>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 每天生成一个html格式的日志结束 -->
|
||||
|
||||
<!--myibatis log configure -->
|
||||
<logger name="com.apache.ibatis" level="TRACE" />
|
||||
<logger name="java.sql.Connection" level="DEBUG" />
|
||||
<logger name="java.sql.Statement" level="DEBUG" />
|
||||
<logger name="java.sql.PreparedStatement" level="DEBUG" />
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="HTML" />
|
||||
<appender-ref ref="FILE_HTML" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user