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

This commit is contained in:
qiaoqinzheng 2023-10-28 15:37:03 +08:00
commit 008475d577
4 changed files with 31 additions and 79 deletions

View File

@ -59,6 +59,7 @@ public class ClassUtil {
return objsStr;
}
@Deprecated
public static String classPath(String path){
try {
String pathPrefix = "classpath:";

View File

@ -1,79 +0,0 @@
package org.jeecg.modules;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPStore;
import javax.mail.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class Demo {
/*public static void main(String[] args) {
String host = "imap.163.com";
String username = "nzyone@163.com";
String password = "NHFYZPXSPBKZUXTJ";
try {
// 创建连接属性
Properties props = new Properties();
props.setProperty("mail.store.protocol", "imap");
props.put("mail.imap.port", "143");
// props.put("mail.imap.ssl.enable", "true");
Map<String, String> IAM = new HashMap();
//带上IMAP ID信息由key和value组成例如nameversionvendorsupport-email等
IAM.put("name","liuyang");
IAM.put("version","1.0.0");
IAM.put("vendor","myclient");
IAM.put("support-email","nzyone@163.com");
Session session = Session.getInstance(props);
IMAPStore store = (IMAPStore) session.getStore("imap");
// 创建会话
//Session session = Session.getInstance(props);
// 创建IMAP存储对象并连接到服务器
//Store store = session.getStore("imap");
store.connect(host, username, password);
store.id(IAM);
Quota[] quotas = store.getQuota("INBOX");
// 打开收件箱
//IMAPFolder inbox = (IMAPFolder) store.getFolder("INBOX");
//inbox.open(Folder.READ_ONLY);
// 获取邮箱容量信息
//Quota[] quotas = inbox.getQuota();
for (Quota quota : quotas) {
Quota.Resource[] resources = quota.resources;
for (Quota.Resource res : resources) {
long usage = res.usage;
long limit = res.limit;
System.out.println("Resource: " + res);
System.out.println("Usage: " + usage);
System.out.println("Limit: " + limit);
}
}
// 关闭连接
// inbox.close(false);
store.close();
} catch (Exception e) {
e.printStackTrace();
}
}*/
public static void main(String[] args) {
double a = 4.148059e+03;
}
}

View File

@ -3,6 +3,7 @@ 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 lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.SymbolConstant;
@ -18,11 +19,13 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
public class CalculateConcServiceImpl implements CalculateConcService {
@Autowired
@ -96,9 +99,13 @@ public class CalculateConcServiceImpl implements CalculateConcService {
manAvgs.addAll(autoAvgs);
String cycle = startDate + SymbolConstant.WELL_NUMBER + endDate;
manAvgs.forEach(item -> item.setCycle(cycle).setCaclDate(dayAgo));
// 记录日志
log.info(log(manAvgs));
return nuclideAvgService.saveBatch(manAvgs);
}catch (Throwable e){
e.printStackTrace();
log.error("核素浓度计算过程异常,异常信息为:{}",e.getMessage());
return false;
}
}
@ -135,4 +142,14 @@ public class CalculateConcServiceImpl implements CalculateConcService {
.collect(Collectors.toList());
return concDtos;
}
private String log(List<AlarmAnalysisNuclideAvg> nuclideAvgs){
List<String> nuclideNames = nuclideAvgs.stream()
.map(AlarmAnalysisNuclideAvg::getNuclide)
.collect(Collectors.toList());
String nuclide = CollUtil.join(nuclideNames, ",");
String now = LocalDateTime.now()
.format(DateTimeFormatter.ofPattern(DateConstant.DATE_TIME));
return "核素 [" + nuclide + "] 进行了浓度均值计算, 计算时间: " + now;
}
}

View File

@ -2,10 +2,14 @@ package org.jeecg.modules.quartz.job;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.config.mqtoken.UserTokenContext;
import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.feignclient.AbnormalAlarmClient;
import org.quartz.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static org.jeecg.common.util.TokenUtils.getTempToken;
/**
@ -28,6 +32,7 @@ public class NucliedAvgJob implements Job {
try {
init();
alarmClient.calculateConc();
log.info(log());
}catch (Exception e){
e.printStackTrace();
}finally {
@ -45,4 +50,12 @@ public class NucliedAvgJob implements Job {
// end:删除临时Token
UserTokenContext.remove();
}
private String log(){
String now = LocalDateTime.now()
.format(DateTimeFormatter.ofPattern(DateConstant.DATE_TIME));
return "计算核素浓度均值的定时任务成功执行, " +
"任务执行类: org.jeecg.modules.quartz.job.NucliedAvgJob, " +
"任务执行时间: " + now;
}
}