Merge branch 'station' of http://git.hivekion.com:3000/xiaoguangbin/AnalysisSystemForRadionuclide into station
This commit is contained in:
commit
376be83157
|
@ -42,4 +42,6 @@ public interface Prompt {
|
|||
String UPLOAD_ERR = "File Upload Failure!";
|
||||
|
||||
String FILE_NAME_REPEAT = "File With The Same Name Appears, Stop Uploading!";
|
||||
|
||||
String NEED_TIME = "The Start Time Or End Time Cannot Be Empty!";
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName(value = "alarm_contact_group")
|
||||
|
@ -37,9 +39,9 @@ public class AlarmContactGroup implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate createTime;
|
||||
@JsonFormat(pattern = DateConstant.DATE_TIME,timezone = DateConstant.TIME_ZONE)
|
||||
@DateTimeFormat(pattern = DateConstant.DATE_TIME)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
|
@ -51,9 +53,9 @@ public class AlarmContactGroup implements Serializable {
|
|||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate updateTime;
|
||||
@JsonFormat(pattern = DateConstant.DATE_TIME,timezone = DateConstant.TIME_ZONE)
|
||||
@DateTimeFormat(pattern = DateConstant.DATE_TIME)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package org.jeecg.modules.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
|
||||
@Data
|
||||
public class FileVo extends QueryRequest {
|
||||
|
||||
String name;
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -113,7 +114,7 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
|
|||
String username = JwtUtil.getUserNameByToken(request);
|
||||
Long id = IdWorker.getId();
|
||||
alarmContactGroup.setId(id.toString());
|
||||
alarmContactGroup.setCreateTime(LocalDate.now());
|
||||
alarmContactGroup.setCreateTime(LocalDateTime.now());
|
||||
alarmContactGroup.setCreateBy(username);
|
||||
this.baseMapper.insert(alarmContactGroup);
|
||||
if (CollectionUtils.isNotEmpty(alarmContactGroup.getUserIds())){
|
||||
|
@ -171,7 +172,7 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl<AlarmContactGroupM
|
|||
alarmContactGroupMemberMapper.insert(alarmContactGroupMember);
|
||||
}
|
||||
}
|
||||
alarmContactGroup.setUpdateTime(LocalDate.now());
|
||||
alarmContactGroup.setUpdateTime(LocalDateTime.now());
|
||||
alarmContactGroup.setUpdateBy(username);
|
||||
this.baseMapper.updateById(alarmContactGroup);
|
||||
result.setSuccess(true);
|
||||
|
|
|
@ -38,8 +38,10 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
|||
public Result<?> viewAll(AlarmVo alarmVo) {
|
||||
String startDate = alarmVo.getStartDate();
|
||||
String endDate = alarmVo.getEndDate();
|
||||
boolean startNotBlank = StrUtil.isNotBlank(startDate);
|
||||
boolean endtNotBlank = StrUtil.isNotBlank(endDate);
|
||||
boolean startBlank = StrUtil.isBlank(startDate);
|
||||
boolean endBlank = StrUtil.isBlank(endDate);
|
||||
boolean blank = startBlank || endBlank;
|
||||
if (blank)return Result.error(Prompt.NEED_TIME);
|
||||
// 拼接日期为合理的日期+时间范围
|
||||
alarmVo.setStartDate(startDate + DateConstant.TIME_START);
|
||||
alarmVo.setEndDate(endDate + DateConstant.TIME_END);
|
||||
|
|
|
@ -2,10 +2,12 @@ package org.jeecg.modules.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
|
||||
import org.jeecg.modules.mapper.SysEmailLogMapper;
|
||||
import org.jeecg.modules.service.ISysEmailLogService;
|
||||
|
@ -25,7 +27,7 @@ import java.util.stream.IntStream;
|
|||
public class SysEmailLogServiceImpl extends ServiceImpl<SysEmailLogMapper, SysEmailLog> implements ISysEmailLogService {
|
||||
|
||||
@Override
|
||||
public Result totalEmail(String emailId) {
|
||||
public Result<?> totalEmail(String emailId) {
|
||||
// 当日邮件量
|
||||
LambdaQueryWrapper<SysEmailLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysEmailLog::getEmailId,emailId);
|
||||
|
@ -58,7 +60,7 @@ public class SysEmailLogServiceImpl extends ServiceImpl<SysEmailLogMapper, SysEm
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result todayHour(String emailId) {
|
||||
public Result<?> todayHour(String emailId) {
|
||||
LambdaQueryWrapper<SysEmailLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysEmailLog::getEmailId,emailId);
|
||||
LocalDate today = LocalDate.now();
|
||||
|
@ -84,7 +86,7 @@ public class SysEmailLogServiceImpl extends ServiceImpl<SysEmailLogMapper, SysEm
|
|||
return Result.OK(statistic);
|
||||
}
|
||||
|
||||
public Result todayMin(String emailId) {
|
||||
public Result<?> todayMin(String emailId) {
|
||||
LambdaQueryWrapper<SysEmailLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysEmailLog::getEmailId,emailId);
|
||||
LocalDate today = LocalDate.now();
|
||||
|
@ -115,7 +117,11 @@ public class SysEmailLogServiceImpl extends ServiceImpl<SysEmailLogMapper, SysEm
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result analysis(String emailId, String startDate, String endDate) {
|
||||
public Result<?> analysis(String emailId, String startDate, String endDate) {
|
||||
boolean startBlank = StrUtil.isBlank(startDate);
|
||||
boolean endBlank = StrUtil.isBlank(endDate);
|
||||
boolean blank = startBlank || endBlank;
|
||||
if (blank)return Result.error(Prompt.NEED_TIME);
|
||||
String startStr = startDate + DateConstant.TIME_START;
|
||||
String endStr = endDate + DateConstant.TIME_END;
|
||||
LambdaQueryWrapper<SysEmailLog> wrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.apache.commons.net.ftp.FTPClient;
|
|||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.commons.net.ftp.FTPReply;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.xmlbeans.impl.xb.xmlconfig.Extensionconfig;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
|
@ -21,6 +22,7 @@ import org.jeecg.common.constant.enums.FileTypeEnum;
|
|||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.FTPUtil;
|
||||
import org.jeecg.modules.base.dto.FileDto;
|
||||
import org.jeecg.modules.base.vo.FileVo;
|
||||
import org.jeecg.modules.service.ISpectrumFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -43,17 +45,14 @@ public class SpectrumFileController {
|
|||
|
||||
@PostMapping("upload")
|
||||
@ApiOperation(value = "谱文件上传",notes = "谱文件上传")
|
||||
public Result<?> upload(@RequestParam MultipartFile file,
|
||||
@RequestParam String choice){
|
||||
return spectrumFileService.upload(file,choice);
|
||||
public Result<?> upload(@RequestParam MultipartFile file){
|
||||
return spectrumFileService.upload(file);
|
||||
}
|
||||
|
||||
@GetMapping("get")
|
||||
@ApiOperation(value = "用户谱文件列表",notes = "用户谱文件列表")
|
||||
public Result<?> get(QueryRequest query){
|
||||
Integer pageNo = query.getPageNo();
|
||||
Integer pageSize = query.getPageSize();
|
||||
return spectrumFileService.get(pageNo,pageSize);
|
||||
public Result<?> get(FileVo fileVo){
|
||||
return spectrumFileService.get(fileVo);
|
||||
}
|
||||
|
||||
public static void unzip(File zipFile, String destDir) throws IOException {
|
||||
|
|
|
@ -2,12 +2,13 @@ package org.jeecg.modules.service;
|
|||
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.base.vo.FileVo;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface ISpectrumFileService {
|
||||
|
||||
Result<?> upload(MultipartFile file,String choice);
|
||||
Result<?> upload(MultipartFile file);
|
||||
|
||||
Result<?> get(Integer pageNo,Integer pageSize);
|
||||
Result<?> get(FileVo fileVo);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.commons.net.ftp.FTPClient;
|
|||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.constant.enums.FileTypeEnum;
|
||||
|
@ -16,6 +17,7 @@ import org.jeecg.common.system.vo.LoginUser;
|
|||
import org.jeecg.common.util.FTPUtil;
|
||||
import org.jeecg.common.util.PageUtil;
|
||||
import org.jeecg.modules.base.dto.FileDto;
|
||||
import org.jeecg.modules.base.vo.FileVo;
|
||||
import org.jeecg.modules.service.ISpectrumFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -26,6 +28,7 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
|
@ -36,7 +39,7 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
|||
private FTPUtil ftpUtil;
|
||||
|
||||
@Override
|
||||
public Result<?> upload(MultipartFile file, String choice) {
|
||||
public Result<?> upload(MultipartFile file) {
|
||||
String filename = file.getOriginalFilename();
|
||||
boolean isZip = filename.endsWith(FileTypeEnum.zip.getType());
|
||||
if (!isZip) return Result.error(Prompt.FILE_TYPE_ERR);
|
||||
|
@ -70,49 +73,14 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
|||
ftpClient = ftpUtil.LoginFTP();
|
||||
if (ObjectUtil.isNull(ftpClient))
|
||||
return Result.error(Prompt.FTP_ERR);
|
||||
// 如果指定目录不存在,直接上传
|
||||
// 如果指定目录不存在,创建目录
|
||||
boolean exist = ftpClient.changeWorkingDirectory(filePath);
|
||||
if (!exist){
|
||||
ftpClient.makeDirectory(filePath);
|
||||
for (File oneFile : fileList) {
|
||||
String fullFilePath = filePath + slash + oneFile.getName();
|
||||
FileInputStream local = new FileInputStream(oneFile);
|
||||
ftpClient.storeFile(fullFilePath,local);
|
||||
}
|
||||
return Result.OK(Prompt.UPLOAD_SUCC);
|
||||
}
|
||||
// 如果指定目录存在,则获取指定目录下所有文件名
|
||||
List<String> remoteFileNames = ListUtil.toList(ftpClient.listNames());
|
||||
Collection<String> crossFileNames = CollUtil.intersection(fileNames, remoteFileNames);
|
||||
// 没有重名文件,直接全部导入
|
||||
if (CollUtil.isEmpty(crossFileNames)){
|
||||
for (File oneFile : fileList) {
|
||||
String fullFilePath = filePath + slash + oneFile.getName();
|
||||
FileInputStream local = new FileInputStream(oneFile);
|
||||
ftpClient.storeFile(fullFilePath,local);
|
||||
}
|
||||
return Result.OK(Prompt.UPLOAD_SUCC);
|
||||
}
|
||||
// 有重名文件,根据用户选择进行处理
|
||||
if (StrUtil.equals("stop",choice)){ // 1.停止上传
|
||||
return Result.error(Prompt.FILE_NAME_REPEAT);
|
||||
}else if (StrUtil.equals("over",choice)){ // 2.直接覆盖
|
||||
for (File oneFile : fileList) {
|
||||
String fullFilePath = filePath + slash + oneFile.getName();
|
||||
FileInputStream local = new FileInputStream(oneFile);
|
||||
ftpClient.storeFile(fullFilePath,local);
|
||||
}
|
||||
}else if (StrUtil.equals("skip",choice)){ // 3.保留原文件
|
||||
for (File oneFile : fileList) {
|
||||
String oneFileName = oneFile.getName();
|
||||
if (crossFileNames.contains(oneFileName))
|
||||
continue;
|
||||
String fullFilePath = filePath + slash + oneFileName;
|
||||
FileInputStream local = new FileInputStream(oneFile);
|
||||
ftpClient.storeFile(fullFilePath,local);
|
||||
}
|
||||
}else { // 默认不上传
|
||||
return Result.error(Prompt.FILE_NAME_REPEAT);
|
||||
if (!exist) ftpClient.makeDirectory(filePath);
|
||||
// 上传所有文件
|
||||
for (File oneFile : fileList) {
|
||||
String fullFilePath = filePath + slash + oneFile.getName();
|
||||
FileInputStream local = new FileInputStream(oneFile);
|
||||
ftpClient.storeFile(fullFilePath,local);
|
||||
}
|
||||
return Result.OK(Prompt.UPLOAD_SUCC);
|
||||
} catch (IOException e) {
|
||||
|
@ -136,7 +104,9 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result<?> get(Integer pageNo, Integer pageSize) {
|
||||
public Result<?> get(FileVo fileVo) {
|
||||
Integer pageNo = fileVo.getPageNo();
|
||||
Integer pageSize = fileVo.getPageSize();
|
||||
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String username = user.getUsername();
|
||||
String slash = SymbolConstant.SINGLE_SLASH;
|
||||
|
@ -151,6 +121,13 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
|||
boolean exist = ftpClient.changeWorkingDirectory(filePath);
|
||||
if (!exist) return Result.OK(page);
|
||||
List<FTPFile> ftpFiles = ListUtil.toList(ftpClient.listFiles());
|
||||
// 根据文件名进行过滤
|
||||
String name = fileVo.getName();
|
||||
if (StrUtil.isNotBlank(name)){
|
||||
ftpFiles = ftpFiles.stream()
|
||||
.filter(file -> StrUtil.containsIgnoreCase(file.getName(),name))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
for (FTPFile ftpFile : ftpFiles) {
|
||||
String fileName = ftpFile.getName();
|
||||
Calendar calendar = ftpFile.getTimestamp();
|
||||
|
|
|
@ -130,7 +130,7 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
|
|||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
// 启动scheduler
|
||||
scheduler.start();
|
||||
// 获取 JobDetail 对象
|
||||
// TODO 获取 JobDetail 对象
|
||||
JobDetail detail = scheduler.getJobDetail(new JobKey(identity));
|
||||
if (ObjectUtil.isNull(detail))
|
||||
return Result.OK(Prompt.EXEC_SUCC);
|
||||
|
|
Loading…
Reference in New Issue
Block a user