Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
73a4550b56
|
@ -396,6 +396,10 @@ public class FTPUtil {
|
|||
if (CollUtil.isEmpty(paths)) return failList;
|
||||
// 连接FTP服务
|
||||
final FTPClient ftpClient = this.LoginFTP();
|
||||
if (ObjectUtil.isNull(ftpClient)){
|
||||
log.error("FTPUtil.removeFiles(): FTPClient is null");
|
||||
return paths;
|
||||
}
|
||||
for (String path : paths) {
|
||||
try {
|
||||
if (StrUtil.isBlank(path)) continue;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.jeecg.modules.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.base.dto.TypeDto;
|
||||
import org.jeecg.modules.base.entity.postgre.AlarmLog;
|
||||
import org.jeecg.modules.entity.AlarmHistory;
|
||||
|
@ -12,7 +14,8 @@ import java.util.Map;
|
|||
public interface AlarmLogMapper extends BaseMapper<AlarmLog> {
|
||||
|
||||
List<LocalDateTime> rangeDay(Map<String,Object> params);
|
||||
List<AlarmHistory> findPage(Map<String,Object> params);
|
||||
|
||||
Page<AlarmHistory> findPage(Page<?> page, Map<String,Object> params);
|
||||
|
||||
List<TypeDto> typeAlarms(Map<String,Object> params);
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findPage" parameterType="Map" resultType="org.jeecg.modules.entity.AlarmHistory">
|
||||
|
||||
<select id="findPage" resultType="org.jeecg.modules.entity.AlarmHistory">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
|
@ -46,26 +47,23 @@
|
|||
INNER JOIN alarm_rule r ON l.rule_id = r.ID
|
||||
) AS res
|
||||
<where>
|
||||
<if test="type != null and type.size() > 0">
|
||||
<if test="params.type != null and params.type.size() > 0">
|
||||
source_type IN
|
||||
<foreach collection="type" index="index" open="(" close=")" item="item" separator=",">
|
||||
<foreach collection="params.type" index="index" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND NAME LIKE concat ( '%', #{name} , '%' )
|
||||
<if test="params.name != null and params.name != ''">
|
||||
AND NAME LIKE concat ( '%', #{params.name} , '%' )
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
AND alarm_start_date >= #{startDate}
|
||||
<if test="params.startDate != null and params.startDate != ''">
|
||||
AND alarm_start_date >= #{params.startDate}
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
AND alarm_start_date <= #{endDate}
|
||||
<if test="params.endDate != null and params.endDate != ''">
|
||||
AND alarm_start_date <= #{params.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY alarm_start_date DESC
|
||||
<if test="pageFlag == null">
|
||||
LIMIT #{pageSize} OFFSET #{pageStart}
|
||||
</if>
|
||||
</select>
|
||||
<select id="typeAlarms" parameterType="Map" resultType="org.jeecg.modules.base.dto.TypeDto">
|
||||
SELECT
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package org.jeecg.modules.qiyeEmail.api;
|
||||
|
||||
public interface MailBoxAPI {
|
||||
|
||||
String UNREADMSG = "/api/open/mailbox/getUnreadMsg";
|
||||
}
|
|
@ -2,7 +2,9 @@ package org.jeecg.modules.qiyeEmail.service;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -26,11 +28,9 @@ import java.util.stream.Collectors;
|
|||
|
||||
public class Account {
|
||||
|
||||
public static AccountInfo getMailAccountInfo(RParam rParam) {
|
||||
public static AccountInfo getMailAccountInfo(QiyeOpenPlatSDK platSDK, RParam rParam) {
|
||||
AccountInfo accountInfo = new AccountInfo();
|
||||
try {
|
||||
// 获取已登录的SDK实例
|
||||
QiyeOpenPlatSDK platSDK = InstanceSDK.getInstance();
|
||||
// 设置请求参数
|
||||
Q reqParam = Q.init(rParam);
|
||||
// 使用SDK实例调用指定API 拿到请求结果
|
||||
|
@ -60,7 +60,10 @@ public class Account {
|
|||
Q reqParam = Q.init(rParam);
|
||||
// 使用SDK实例调用指定API 拿到请求结果
|
||||
R<Map<String, Object>> result = platSDK.commonInvoke(reqParam, AccountAPI.DOMAINS);
|
||||
List<Domain> domains = BeanUtil.mapToBean(result.getData(), Domains.class, CopyOptions.create())
|
||||
Map<String, Object> data = result.getData();
|
||||
if (ObjectUtil.isNull(data))
|
||||
return ListUtil.toList("ndc.org.cn","");
|
||||
List<Domain> domains = BeanUtil.mapToBean(data, Domains.class, CopyOptions.create())
|
||||
.getDomainList();
|
||||
return domains.stream().map(Domain::getDomain).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.jeecg.modules.qiyeEmail.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.QiyeOpenPlatSDK;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.dto.Q;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.dto.R;
|
||||
import org.jeecg.modules.qiyeEmail.api.MailBoxAPI;
|
||||
import org.jeecg.modules.qiyeEmail.base.RParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MailBox {
|
||||
|
||||
public static Integer unreadMsg(QiyeOpenPlatSDK platSDK, RParam rParam){
|
||||
Q q = Q.init(rParam);
|
||||
R<Map<String, Integer>> result = platSDK.commonInvoke(q, MailBoxAPI.UNREADMSG);
|
||||
Map<String, Integer> data = result.getData();
|
||||
if (ObjectUtil.isNull(data))
|
||||
return -1;
|
||||
return data.getOrDefault("count", -1);
|
||||
}
|
||||
}
|
|
@ -112,16 +112,11 @@ public class AlarmLogServiceImpl extends ServiceImpl<AlarmLogMapper, AlarmLog> i
|
|||
alarmVo.setStartDate(startDate + DateConstant.TIME_START);
|
||||
if (StrUtil.isNotBlank(endDate))
|
||||
alarmVo.setEndDate(endDate + DateConstant.TIME_END);
|
||||
Integer pageStart = (pageNo - 1) * pageSize;
|
||||
alarmVo.setPageStart(pageStart);
|
||||
|
||||
Page<AlarmHistory> page = new Page<>(pageNo, pageSize);
|
||||
Map<String, Object> params = BeanUtil.beanToMap(alarmVo);
|
||||
List<AlarmHistory> alarmHistories = baseMapper.findPage(params);
|
||||
// 获取数据总条数(经过查询条件过滤后的)
|
||||
params.put("pageFlag","noPage");
|
||||
Integer total = baseMapper.findPage(params).size();
|
||||
Page<AlarmHistory> page = new Page<>(pageNo,pageSize,total);
|
||||
// 当前页数据
|
||||
page.setRecords(alarmHistories);
|
||||
page = baseMapper.findPage(page, params);
|
||||
|
||||
return Result.OK(page);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.QiyeOpenPlatSDK;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.Prompt;
|
||||
|
@ -17,9 +18,11 @@ import org.jeecg.modules.base.entity.postgre.SysEmailLog;
|
|||
import org.jeecg.modules.base.enums.Qiye;
|
||||
import org.jeecg.modules.mapper.SysEmailLogMapper;
|
||||
import org.jeecg.modules.mapper.SysEmailMapper;
|
||||
import org.jeecg.modules.qiyeEmail.base.InstanceSDK;
|
||||
import org.jeecg.modules.qiyeEmail.base.RParam;
|
||||
import org.jeecg.modules.qiyeEmail.base.dto.AccountInfo;
|
||||
import org.jeecg.modules.qiyeEmail.service.Account;
|
||||
import org.jeecg.modules.qiyeEmail.service.MailBox;
|
||||
import org.jeecg.modules.service.ISysEmailLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -96,11 +99,16 @@ public class SysEmailLogServiceImpl extends ServiceImpl<SysEmailLogMapper, SysEm
|
|||
RParam rParam = new RParam();
|
||||
rParam.setDomain(domain);
|
||||
rParam.setAccount_name(accountName);
|
||||
AccountInfo mailAccountInfo = Account.getMailAccountInfo(rParam);
|
||||
// 获取已登录的SDK实例
|
||||
QiyeOpenPlatSDK platSDK = InstanceSDK.getInstance();
|
||||
AccountInfo mailAccountInfo = Account.getMailAccountInfo(platSDK, rParam);
|
||||
Integer unreadMsg = MailBox.unreadMsg(platSDK, rParam);
|
||||
Integer usedQuota = mailAccountInfo.getUsedQuota();
|
||||
Integer maxQuota = mailAccountInfo.getMaxQuota();
|
||||
maxQuota = ObjectUtil.isNull(maxQuota) ? 0 : maxQuota;
|
||||
map.put("total", maxQuota < 0 ? maxQuota + "(No Limit)" : m2G(maxQuota));
|
||||
map.put("residue", m2G(usedQuota));
|
||||
map.put("residue", m2G(usedQuota)); // 邮箱空间使用量 单位G
|
||||
map.put("unreadMsg", unreadMsg); // 未读邮件数量
|
||||
map.put("usage","74.3%");
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.QiyeOpenPlatSDK;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.dto.Q;
|
||||
import com.netease.qiye.qiyeopenplatform.sdk.dto.R;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.*;
|
||||
|
@ -25,7 +28,10 @@ import org.jeecg.modules.base.enums.Enabled;
|
|||
import org.jeecg.modules.base.enums.Qiye;
|
||||
import org.jeecg.modules.entity.AlarmHistory;
|
||||
import org.jeecg.modules.mapper.SysEmailMapper;
|
||||
import org.jeecg.modules.qiyeEmail.base.InstanceSDK;
|
||||
import org.jeecg.modules.qiyeEmail.base.RParam;
|
||||
import org.jeecg.modules.qiyeEmail.service.Account;
|
||||
import org.jeecg.modules.qiyeEmail.service.MailBox;
|
||||
import org.jeecg.modules.service.ISysEmailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -264,4 +270,12 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> i
|
|||
boolean contains = CollUtil.contains(domains, domain);
|
||||
return contains ? Qiye.IS.getValue() : Qiye.NOT.getValue();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
QiyeOpenPlatSDK platSDK = InstanceSDK.getInstance();
|
||||
RParam rParam = new RParam();
|
||||
rParam.setDomain("ndc.org.cn");
|
||||
rParam.setAccount_name("cnndc.rn.dr");
|
||||
System.out.println(MailBox.unreadMsg(platSDK, rParam));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.QueryRequest;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.enums.FileTypeEnum;
|
||||
|
@ -40,6 +41,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Service("gardsSampleDataService")
|
||||
@DS("ora")
|
||||
@Slf4j
|
||||
public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMapper, GardsSampleDataSystem> implements IGardsSampleDataService {
|
||||
|
||||
@Autowired
|
||||
|
@ -174,7 +176,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
|
|||
return Result.OK("Data and file cleanup complete!");
|
||||
}catch (Exception e){
|
||||
transactionManager.rollback(txStatus);
|
||||
e.printStackTrace();
|
||||
log.error("清理SampleId: {}的数据和文件时异常: {}", sampleId ,e.getMessage());
|
||||
return Result.error("Data deletion is abnormal, The file deletion operation has not been performed!");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user