Merge remote-tracking branch 'origin/mdc' into mdc

# Conflicts:
#	jeecg-module-app/src/main/java/org/jeecg/modules/controller/AlarmController.java
This commit is contained in:
nieziyan 2024-02-05 17:26:33 +08:00
commit 2cac351fce
26 changed files with 481 additions and 83 deletions

View File

@ -356,6 +356,45 @@ public class FTPUtil {
}
}
/*
* 批量删除FTP文件 返回删除失败的文件路径
* */
public boolean removeFiles(String path){
boolean success = false;
// 连接FTP服务
final FTPClient ftpClient = this.LoginFTP();
//判断ftp是否连接成功
if (ObjectUtil.isNull(ftpClient)){
log.error("FTPUtil.removeFiles(): FTPClient is null");
}
InputStream inputStream = null;
try {
inputStream = ftpClient.retrieveFileStream(path);
//读取文件路径的流 如果文件存在则读取流数据不为空
if (Objects.nonNull(inputStream)) {
//删除文件
success = ftpClient.deleteFile(path);
}
//日志输出文件删除状态
log.info(path + " Delete Status:"+success);
} catch (Exception e) {
log.error("FTPUtil.removeFiles()删除文件[{}]失败: {}", path, e.getMessage());
} finally {
// 关闭FTP连接
try {
if (Objects.nonNull(inputStream)) {
inputStream.close();
}
if (ObjectUtil.isNotNull(ftpClient)) {
ftpClient.disconnect();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return success;
}
/*
* 批量删除FTP文件 返回删除失败的文件路径
* */
@ -369,12 +408,19 @@ public class FTPUtil {
return paths;
}
for (String path : paths) {
boolean success = false;
try {
if (StrUtil.isBlank(path)) continue;
boolean success = ftpClient.deleteFile(path);
if (success) continue;
failList.add(path);
log.error("FTPUtil.removeFiles()删除文件[{}]失败", path);
if (StrUtil.isBlank(path)) {
continue;
}
if (Objects.nonNull(ftpClient.retrieveFileStream(path))) {
success = ftpClient.deleteFile(path);
log.info(path + " Delete Status:"+success);
} else {
log.info(path + " Delete Status:false");
failList.add(path);
log.error("FTPUtil.removeFiles()删除文件[{}]失败", path);
}
} catch (Exception e) {
failList.add(path);
log.error("FTPUtil.removeFiles()删除文件[{}]失败: {}", path, e.getMessage());
@ -382,8 +428,9 @@ public class FTPUtil {
}
// 关闭FTP连接
try {
if (ObjectUtil.isNotNull(ftpClient))
if (ObjectUtil.isNotNull(ftpClient)) {
ftpClient.disconnect();
}
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -5,6 +5,8 @@ import lombok.Data;
@Data
public class AnalysesDto {
private Integer sampleId;
private String baselinePath;
private String lcPath;

View File

@ -1,7 +1,50 @@
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) {
return alarmClient.analysisLogFindPage(analysisLogVo);
}
@ApiOperation("分页查询报警日志信息")
@PostMapping("/alarmLog/findPage")
public Result alarmLogFindPage(@RequestBody AlarmVo alarmVo){
return alarmClient.alarmLogFindPage(alarmVo);
}
@GetMapping("/sysServer/findPage")
@ApiOperation(value = "分页查询服务器配置信息", notes = "分页查询服务器配置信息")
public Result serverFindPage(QueryRequest query){
return alarmClient.serverFindPage(query);
}
@GetMapping("/sysDatabase/findPage")
@ApiOperation(value = "分页查询数据库配置信息", notes = "分页查询数据库配置信息")
public Result databaseFindPage(QueryRequest query){
return alarmClient.databaseFindPage(query);
}
@GetMapping("/sysEmail/findPage")
@ApiOperation(value = "分页查询邮箱配置信息", notes = "分页查询邮箱配置信息")
public Result emailFindPage(QueryRequest query){
return alarmClient.emailFindPage(query);
}
}

View File

@ -1,11 +0,0 @@
package org.jeecg.modules.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("")
public class LoginController {
}

View File

@ -0,0 +1,37 @@
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
@RequestMapping("radionuclide")
public class RadionuclideController {
@Autowired
private RadionuclideClient radionuclideClient;
@GetMapping("findAutoPage")
@ApiOperation(value = "分页查询自动处理结果", notes = "分页查询自动处理结果")
public Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds,
String qualifie, String sampleType,
@DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return radionuclideClient.findAutoPage(queryRequest, stationIds, qualifie, sampleType,startTime, endTime);
}
@GetMapping("findReviewedPage")
@ApiOperation(value = "分页查询人工交互结果", notes = "分页查询人工交互结果")
public Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds, String qualifie,
@DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
return radionuclideClient.findReviewedPage(queryRequest, stationIds, qualifie,startTime, endTime);
}
}

View File

@ -0,0 +1,60 @@
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
*/
@RequestMapping(value = "/mLogin", method = RequestMethod.POST)
public Result<JSONObject> mLogin(@RequestBody SysLoginModel sysLoginModel) {
return systemClient.mLogin(sysLoginModel);
}
@PostMapping("/userClient/saveOrUpdateClient")
public void saveOrUpdateClient(@RequestBody SysUserClient sysUserClient) {
systemClient.saveOrUpdateClient(sysUserClient);
}
/**
* 退出登录
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/logout")
public Result<Object> logout(HttpServletRequest request, HttpServletResponse response) {
//用户退出逻辑
return systemClient.logout(request, response);
}
/**
* 后台生成图形验证码 有效
* @param response
* @param key
*/
@ApiOperation("获取验证码")
@GetMapping(value = "/randomImage/{key}")
public Result<String> randomImage(HttpServletResponse response,@PathVariable("key") String key) {
return systemClient.randomImage(response, key);
}
}

View File

@ -1,11 +0,0 @@
package org.jeecg.modules.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("")
public class WebController {
}

View File

@ -0,0 +1,29 @@
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.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(String menuName){
return webStatisticsClient.findStationList(menuName);
}
}

View File

@ -0,0 +1,29 @@
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;
@Component
@FeignClient(value = "")
public interface AlarmClient {
@GetMapping(value = "/alarmAnalysisLog/findPage")
Result<?> analysisLogFindPage(AnalysisLogVo analysisLogVo);
@GetMapping(value = "/alarmLog/findPage")
Result<?> alarmLogFindPage(AlarmVo alarmVo);
@GetMapping(value = "/sysEmail/findPage")
Result<?> emailFindPage(QueryRequest query);
@GetMapping(value = "/sysServer/findPage")
Result<?> serverFindPage(QueryRequest query);
@GetMapping(value = "/sysDatabase/findPage")
Result<?> databaseFindPage(QueryRequest query);
}

View File

@ -0,0 +1,4 @@
package org.jeecg.modules.feignclient;
public interface AnalysisService {
}

View File

@ -0,0 +1,4 @@
package org.jeecg.modules.feignclient;
public interface MessageService {
}

View File

@ -0,0 +1,47 @@
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 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
*/
@GetMapping("/findStationList")
Result findAutoPage(QueryRequest queryRequest, Integer[] stationIds,
String qualifie, String sampleType,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime);
/**
* 分页查询人工交互结果
* @param queryRequest
* @param stationIds
* @param qualifie
* @param startTime
* @param endTime
* @return
*/
@GetMapping("findReviewedPage")
Result findReviewedPage(QueryRequest queryRequest, Integer[] stationIds, String qualifie,
@DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime);
}

View File

@ -0,0 +1,4 @@
package org.jeecg.modules.feignclient;
public interface StationService {
}

View File

@ -0,0 +1,54 @@
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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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(SysLoginModel sysLoginModel);
/**
* 图形验证码
* @return
*/
@PostMapping("/checkCaptcha")
void saveOrUpdateClient(SysUserClient sysUserClient);
/**
* 登出
* @return
*/
@GetMapping("/logout")
Result<Object> logout(HttpServletRequest request, HttpServletResponse response);
/**
* 图形验证码
*/
@GetMapping("/randomImage/{key}")
Result<String> randomImage(HttpServletResponse response,@PathVariable("key") String key);
/**
* 图形验证码
* @return
*/
@PostMapping("/checkCaptcha")
Result<?> checkCaptcha();
}

View File

@ -0,0 +1,20 @@
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 java.util.Date;
@Component
@FeignClient(value = "armd-web-statistics", path = "/webStatistics")
public interface WebStatisticsClient {
@GetMapping("/findStationList")
Result<JSONObject> findStationList(String menuName);
}

View File

@ -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;
}
}

View File

@ -1,4 +0,0 @@
package org.jeecg.modules.service;
public interface AlarmService {
}

View File

@ -1,4 +0,0 @@
package org.jeecg.modules.service;
public interface AnalysisService {
}

View File

@ -1,11 +0,0 @@
package org.jeecg.modules.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
@Component
@FeignClient("armd-system")
public interface LoginService {
}

View File

@ -1,4 +0,0 @@
package org.jeecg.modules.service;
public interface MessageService {
}

View File

@ -1,4 +0,0 @@
package org.jeecg.modules.service;
public interface StationService {
}

View File

@ -1,4 +0,0 @@
package org.jeecg.modules.service;
public interface WebService {
}

View File

@ -198,6 +198,8 @@ public class SysUserFocusStationServiceImpl extends ServiceImpl<SysUserFocusStat
List<SysUserFocusStationStation> sysUserFocusStations = this.baseMapper.selectList(focusStationQueryWrapper);
if (Objects.nonNull(sysUserFocusStations)){
receivingConfig.setSysUserFocusStations(sysUserFocusStations);
} else {
receivingConfig.setSysUserFocusStations(new ArrayList<>());
}
result.setSuccess(true);
result.setResult(receivingConfig);

View File

@ -19,6 +19,6 @@ public interface GardsSampleDataMapper extends BaseMapper<GardsSampleDataSystem>
void delBatch(@Param("tableNames") List<String> tableNames,
@Param("sampleId") Integer sampleId);
AnalysesDto getAnalysis(@Param("owner") String owner,
List<AnalysesDto> getAnalysis(@Param("owner") String owner,
@Param("sampleId") Integer sampleId);
}

View File

@ -25,11 +25,12 @@
<select id="getAnalysis" resultType="org.jeecg.modules.base.dto.AnalysesDto">
SELECT
BASELINE_PATH,
LC_PATH,
SCAC_PATH,
LOG_PATH,
REPORT_PAHT
SAMPLE_ID sampleId,
BASELINE_PATH baselinePath,
LC_PATH lcPath,
SCAC_PATH scacPath,
LOG_PATH logPath,
REPORT_PAHT reportPath
FROM
${owner}.GARDS_ANALYSES
WHERE

View File

@ -171,7 +171,13 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
if (CollUtil.isEmpty(needDel))
return Result.OK("Data cleaning is complete. No files need to be cleaned!");
// 删除FTP文件
List<String> failList = ftpUtil.removeFiles(needDel);
List<String> failList = new ArrayList<>();
for (String path:needDel) {
boolean success = ftpUtil.removeFiles(path);
if (!success) {
failList.add(path);
}
}
if (CollUtil.isNotEmpty(failList))
return Result.error("Data clearing is complete, but file clearing fails!", failList);
return Result.OK("Data and file cleanup complete!");
@ -208,23 +214,30 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
private List<String> manOrAutoPath(String savePath, String logPath,
Integer sampleId, String owner){
List<String> fileList = new ArrayList<>();
AnalysesDto AnalysesDto = baseMapper.getAnalysis(owner, sampleId);
if (ObjectUtil.isNull(AnalysesDto))
return fileList;
String baselinePath = AnalysesDto.getBaselinePath();
if (StrUtil.isNotBlank(baselinePath))
fileList.add(savePath + baselinePath);
String lcPath = AnalysesDto.getLcPath();
if (StrUtil.isNotBlank(lcPath))
fileList.add(savePath + lcPath);
String scacPath = AnalysesDto.getScacPath();
if (StrUtil.isNotBlank(scacPath))
fileList.add(savePath + scacPath);
if (StrUtil.isNotBlank(AnalysesDto.getLogPath()))
fileList.add(logPath + AnalysesDto.getLogPath());
String reportPath = AnalysesDto.getReportPath();
if (StrUtil.isNotBlank(reportPath))
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
List<AnalysesDto> AnalysesDtoList = baseMapper.getAnalysis(owner, sampleId);
if (CollectionUtils.isNotEmpty(AnalysesDtoList)) {
for (AnalysesDto AnalysesDto:AnalysesDtoList) {
String baselinePath = AnalysesDto.getBaselinePath();
if (StrUtil.isNotBlank(baselinePath)) {
fileList.add(savePath + baselinePath);
}
String lcPath = AnalysesDto.getLcPath();
if (StrUtil.isNotBlank(lcPath)) {
fileList.add(savePath + lcPath);
}
String scacPath = AnalysesDto.getScacPath();
if (StrUtil.isNotBlank(scacPath)) {
fileList.add(savePath + scacPath);
}
if (StrUtil.isNotBlank(AnalysesDto.getLogPath())) {
fileList.add(logPath + AnalysesDto.getLogPath());
}
String reportPath = AnalysesDto.getReportPath();
if (StrUtil.isNotBlank(reportPath)) {
fileList.add(savePath + reportPath + FileTypeEnum.txt.getType());
}
}
}
return fileList;
}
}