修改bug
This commit is contained in:
@@ -27,13 +27,11 @@ public class DynamicMailConfig {
|
||||
public JavaMailSender createMailSender(OaEmailAccount account) {
|
||||
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
||||
|
||||
// 设置SMTP服务器
|
||||
// 判断是否为网易企业邮箱(如 freeqiye.com)
|
||||
if (account.getEmail() != null && account.getEmail().toLowerCase().endsWith("@freeqiye.com")) {
|
||||
mailSender.setHost("smtp.qiye.163.com");
|
||||
} else {
|
||||
mailSender.setHost(account.getSmtpHost());
|
||||
}
|
||||
// 设置SMTP服务器 - 根据邮箱域名自动识别企业邮箱
|
||||
String email = account.getEmail();
|
||||
String smtpHost = getSmtpHostByEmail(email, account.getSmtpHost());
|
||||
|
||||
mailSender.setHost(smtpHost);
|
||||
mailSender.setPort(account.getSmtpPort() == null ? 465 : account.getSmtpPort().intValue());
|
||||
mailSender.setUsername(account.getEmail());
|
||||
mailSender.setPassword(account.getPassword());
|
||||
@@ -86,4 +84,120 @@ public class DynamicMailConfig {
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
// 测试方法
|
||||
public static void main(String[] args) {
|
||||
DynamicMailConfig config = new DynamicMailConfig();
|
||||
|
||||
// 测试各种邮箱类型
|
||||
String[] testEmails = {
|
||||
"test@freeqiye.com", // 网易企业邮箱
|
||||
"test@qiye.163.com", // 网易企业邮箱
|
||||
"test@163.com", // 网易个人邮箱
|
||||
"test@126.com", // 网易126邮箱
|
||||
"test@qq.com", // QQ邮箱
|
||||
"test@exmail.qq.com", // QQ企业邮箱
|
||||
"test@aliyun.com", // 阿里云邮箱
|
||||
"test@sina.com", // 新浪邮箱
|
||||
"test@vip.sina.com", // 新浪VIP邮箱
|
||||
"test@sohu.com", // 搜狐邮箱
|
||||
"test@139.com", // 139邮箱
|
||||
"test@189.cn", // 189邮箱
|
||||
"test@feishu.cn", // 飞书邮箱
|
||||
"test@gmail.com", // Gmail邮箱
|
||||
"test@outlook.com", // Outlook邮箱
|
||||
"test@hotmail.com", // Hotmail邮箱
|
||||
"test@company.com" // 自定义企业邮箱
|
||||
};
|
||||
|
||||
System.out.println("邮箱SMTP服务器识别测试:");
|
||||
System.out.println("==========================================");
|
||||
|
||||
for (String email : testEmails) {
|
||||
String smtpHost = config.getSmtpHostByEmail(email, null);
|
||||
System.out.printf("%-20s -> %s%n", email, smtpHost);
|
||||
}
|
||||
|
||||
System.out.println("==========================================");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据邮箱地址自动识别SMTP服务器
|
||||
*
|
||||
* @param email 邮箱地址
|
||||
* @param defaultSmtpHost 默认SMTP服务器
|
||||
* @return SMTP服务器地址
|
||||
*/
|
||||
public String getSmtpHostByEmail(String email, String defaultSmtpHost) {
|
||||
if (email == null) {
|
||||
return defaultSmtpHost != null ? defaultSmtpHost : "smtp.163.com";
|
||||
}
|
||||
|
||||
String domain = email.toLowerCase();
|
||||
|
||||
// 网易企业邮箱
|
||||
if (domain.contains("@freeqiye.com") || domain.contains("@qiye.163.com")) {
|
||||
return "smtp.qiye.163.com";
|
||||
}
|
||||
// 网易个人邮箱
|
||||
else if (domain.contains("@163.com")) {
|
||||
return "smtp.163.com";
|
||||
}
|
||||
// 网易126邮箱
|
||||
else if (domain.contains("@126.com")) {
|
||||
return "smtp.126.com";
|
||||
}
|
||||
// QQ邮箱
|
||||
else if (domain.contains("@qq.com")) {
|
||||
return "smtp.qq.com";
|
||||
}
|
||||
// QQ企业邮箱
|
||||
else if (domain.contains("@exmail.qq.com")) {
|
||||
return "smtp.exmail.qq.com";
|
||||
}
|
||||
// 阿里云邮箱
|
||||
else if (domain.contains("@aliyun.com")) {
|
||||
return "smtp.aliyun.com";
|
||||
}
|
||||
// 新浪邮箱
|
||||
else if (domain.contains("@sina.com")) {
|
||||
return "smtp.sina.com";
|
||||
}
|
||||
// 新浪VIP邮箱
|
||||
else if (domain.contains("@vip.sina.com")) {
|
||||
return "smtp.vip.sina.com";
|
||||
}
|
||||
// 搜狐邮箱
|
||||
else if (domain.contains("@sohu.com")) {
|
||||
return "smtp.sohu.com";
|
||||
}
|
||||
// 139邮箱
|
||||
else if (domain.contains("@139.com")) {
|
||||
return "smtp.139.com";
|
||||
}
|
||||
// 189邮箱
|
||||
else if (domain.contains("@189.cn")) {
|
||||
return "smtp.189.cn";
|
||||
}
|
||||
// 飞书邮箱
|
||||
else if (domain.contains("@feishu.cn")) {
|
||||
return "smtp.feishu.cn";
|
||||
}
|
||||
// Gmail邮箱
|
||||
else if (domain.contains("@gmail.com")) {
|
||||
return "smtp.gmail.com";
|
||||
}
|
||||
// Outlook邮箱
|
||||
else if (domain.contains("@outlook.com") || domain.contains("@hotmail.com")) {
|
||||
return "smtp-mail.outlook.com";
|
||||
}
|
||||
// 企业邮箱通用域名识别(可以根据需要添加更多)
|
||||
else if (domain.contains("@qiye.") || domain.contains("@corp.") || domain.contains("@enterprise.")) {
|
||||
// 对于企业邮箱,优先使用配置的SMTP服务器,如果没有配置则使用通用企业邮箱SMTP
|
||||
return defaultSmtpHost != null ? defaultSmtpHost : "smtp." + domain.split("@")[1];
|
||||
}
|
||||
|
||||
// 如果都不匹配,使用配置的SMTP服务器或默认服务器
|
||||
return defaultSmtpHost != null ? defaultSmtpHost : "smtp.163.com";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.oa.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.oa.domain.OaExpress;
|
||||
@@ -16,7 +17,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface OaExpressMapper extends BaseMapperPlus<OaExpressMapper, OaExpress, OaExpressVo> {
|
||||
|
||||
Page<OaExpressVo> selectVoPagePlus(@Param("build") Page<Object> build, @Param(Constants.WRAPPER) LambdaQueryWrapper<OaExpress> lqw);
|
||||
Page<OaExpressVo> selectVoPagePlus(@Param("build") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<OaExpress> lqw);
|
||||
|
||||
OaExpressVo selectVoByIdPlus(@Param("expressId") Long expressId);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.oa.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.oa.domain.OaExpressQuestion;
|
||||
@@ -16,5 +17,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface OaExpressQuestionMapper extends BaseMapperPlus<OaExpressQuestionMapper, OaExpressQuestion, OaExpressQuestionVo> {
|
||||
|
||||
Page<OaExpressQuestionVo> selectVoPagePlus(@Param("build") Page<Object> build, @Param(Constants.WRAPPER) LambdaQueryWrapper<OaExpressQuestion> lqw);
|
||||
Page<OaExpressQuestionVo> selectVoPagePlus(@Param("build") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<OaExpressQuestion> lqw);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.ruoyi.oa.mapper.OaEmailAccountMapper;
|
||||
import com.ruoyi.oa.service.IOaEmailAccountService;
|
||||
import com.ruoyi.oa.domain.request.EmailSendRequest;
|
||||
import com.ruoyi.oa.utils.EmailUtil;
|
||||
import com.ruoyi.oa.config.DynamicMailConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import com.ruoyi.oa.mapper.OaFurnitureTableMapper;
|
||||
@@ -55,6 +56,9 @@ public class OaEmailAccountServiceImpl implements IOaEmailAccountService {
|
||||
@Autowired
|
||||
private OaFurnitureTableMapper oaFurnitureTableMapper;
|
||||
|
||||
@Autowired
|
||||
private DynamicMailConfig dynamicMailConfig;
|
||||
|
||||
/**
|
||||
* 查询发件人邮箱账号管理
|
||||
*/
|
||||
@@ -143,6 +147,11 @@ public class OaEmailAccountServiceImpl implements IOaEmailAccountService {
|
||||
if (account == null) {
|
||||
return "发件人邮箱账号不存在";
|
||||
}
|
||||
|
||||
// 输出SMTP服务器信息
|
||||
String smtpHost = dynamicMailConfig.getSmtpHostByEmail(account.getEmail(), account.getSmtpHost());
|
||||
System.out.println("使用邮箱: " + account.getEmail() + ", SMTP服务器: " + smtpHost);
|
||||
|
||||
List<String> emailList = oaFurnitureTableMapper.selectEmailsByFurnitureIds(request.getFurnitureIds());
|
||||
int type = account.getType() == null ? -1 : account.getType().intValue();
|
||||
int success = 0, fail = 0;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@@ -45,7 +46,7 @@ public class OaExpressQuestionServiceImpl implements IOaExpressQuestionService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaExpressQuestionVo> queryPageList(OaExpressQuestionBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OaExpressQuestion> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<OaExpressQuestion> lqw = buildQueryWrapper(bo);
|
||||
Page<OaExpressQuestionVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
@@ -55,19 +56,33 @@ public class OaExpressQuestionServiceImpl implements IOaExpressQuestionService {
|
||||
*/
|
||||
@Override
|
||||
public List<OaExpressQuestionVo> queryList(OaExpressQuestionBo bo) {
|
||||
LambdaQueryWrapper<OaExpressQuestion> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<OaExpressQuestion> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OaExpressQuestion> buildQueryWrapper(OaExpressQuestionBo bo) {
|
||||
private QueryWrapper<OaExpressQuestion> buildQueryWrapper(OaExpressQuestionBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OaExpressQuestion> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getExpressId() != null, OaExpressQuestion::getExpressId, bo.getExpressId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), OaExpressQuestion::getDescription, bo.getDescription());
|
||||
lqw.eq(bo.getReportTime() != null, OaExpressQuestion::getReportTime, bo.getReportTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReportBy()), OaExpressQuestion::getReportBy, bo.getReportBy());
|
||||
lqw.eq(bo.getStatus() != null, OaExpressQuestion::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
QueryWrapper<OaExpressQuestion> qw = new QueryWrapper<>();
|
||||
// 设置表别名
|
||||
if (bo.getExpressId() != null) {
|
||||
qw.eq("oeq.express_id", bo.getExpressId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getDescription())) {
|
||||
qw.eq("oeq.description", bo.getDescription());
|
||||
}
|
||||
if (bo.getReportTime() != null) {
|
||||
qw.eq("oeq.report_time", bo.getReportTime());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getReportBy())) {
|
||||
qw.eq("oeq.report_by", bo.getReportBy());
|
||||
}
|
||||
if (bo.getStatus() != null) {
|
||||
qw.eq("oeq.status", bo.getStatus());
|
||||
}
|
||||
// 逻辑删除
|
||||
qw.eq("oeq.del_flag", 0);
|
||||
|
||||
return qw;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.ruoyi.oa.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.oa.utils.BestRouteQueryUtil;
|
||||
import com.ruoyi.oa.utils.SfRouteQueryUtil;
|
||||
import com.ruoyi.oa.utils.StoRouteQueryUtil;
|
||||
import com.ruoyi.oa.utils.ZtoTrackQueryUtil;
|
||||
import com.ruoyi.oa.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.oa.domain.bo.OaExpressBo;
|
||||
@@ -51,7 +49,7 @@ public class OaExpressServiceImpl implements IOaExpressService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OaExpressVo> queryPageList(OaExpressBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OaExpress> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<OaExpress> lqw = buildQueryWrapper(bo);
|
||||
Page<OaExpressVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
@@ -61,25 +59,48 @@ public class OaExpressServiceImpl implements IOaExpressService {
|
||||
*/
|
||||
@Override
|
||||
public List<OaExpressVo> queryList(OaExpressBo bo) {
|
||||
LambdaQueryWrapper<OaExpress> lqw = buildQueryWrapper(bo);
|
||||
QueryWrapper<OaExpress> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OaExpress> buildQueryWrapper(OaExpressBo bo) {
|
||||
private QueryWrapper<OaExpress> buildQueryWrapper(OaExpressBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OaExpress> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getExpressCode()), OaExpress::getExpressCode, bo.getExpressCode());
|
||||
lqw.eq(bo.getStatus() != null, OaExpress::getStatus, bo.getStatus());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getSupplyName()), OaExpress::getSupplyName, bo.getSupplyName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSupplyPhone()), OaExpress::getSupplyPhone, bo.getSupplyPhone());
|
||||
lqw.eq(bo.getOwnerId() != null, OaExpress::getOwnerId, bo.getOwnerId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOwnerPhone()), OaExpress::getOwnerPhone, bo.getOwnerPhone());
|
||||
lqw.eq(bo.getPlanDate() != null, OaExpress::getPlanDate, bo.getPlanDate());
|
||||
lqw.eq(bo.getProjectId() != null, OaExpress::getProjectId, bo.getProjectId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getExpressType()), OaExpress::getExpressType, bo.getExpressType());
|
||||
return lqw;
|
||||
QueryWrapper<OaExpress> qw = new QueryWrapper<>();
|
||||
// 设置表别名
|
||||
if (StringUtils.isNotBlank(bo.getExpressCode())) {
|
||||
qw.like("oe.express_code", bo.getExpressCode());
|
||||
}
|
||||
if (bo.getStatus() != null) {
|
||||
qw.eq("oe.status", bo.getStatus());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getSupplyName())) {
|
||||
qw.like("oe.supply_name", bo.getSupplyName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getSupplyPhone())) {
|
||||
qw.eq("oe.supply_phone", bo.getSupplyPhone());
|
||||
}
|
||||
if (bo.getOwnerId() != null) {
|
||||
qw.eq("oe.owner_id", bo.getOwnerId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getOwnerPhone())) {
|
||||
qw.eq("oe.owner_phone", bo.getOwnerPhone());
|
||||
}
|
||||
if (bo.getPlanDate() != null) {
|
||||
qw.eq("oe.plan_date", bo.getPlanDate());
|
||||
}
|
||||
if (bo.getProjectId() != null) {
|
||||
qw.eq("oe.project_id", bo.getProjectId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bo.getExpressType())) {
|
||||
qw.eq("oe.express_type", bo.getExpressType());
|
||||
}
|
||||
// 添加逻辑删除条件
|
||||
qw.eq("oe.del_flag", 0);
|
||||
|
||||
return qw;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增物流预览
|
||||
*/
|
||||
@@ -155,7 +176,6 @@ public class OaExpressServiceImpl implements IOaExpressService {
|
||||
oaExpressVo.setLastStatus(oaExpressVo1.getFirstStatusName());
|
||||
}
|
||||
}
|
||||
|
||||
if (expressType.equals("Best") && oaExpressVo.getStatus() ==1L) {
|
||||
// 校验为顺丰则进入此位置更新状态
|
||||
OaExpressVo oaExpressVo1 = BestRouteQueryUtil.queryRoute(oaExpressVo.getExpressCode());
|
||||
@@ -168,7 +188,7 @@ public class OaExpressServiceImpl implements IOaExpressService {
|
||||
if (expressType.equals("YD") && oaExpressVo.getStatus() == 1L) {
|
||||
// 韵达快递轨迹查询
|
||||
String result = com.ruoyi.oa.utils.YdRouteQueryUtil.queryRoute(oaExpressVo.getExpressCode());
|
||||
OaExpressVo ydVo = com.ruoyi.oa.utils.YdRouteQueryUtil.parseData(result);
|
||||
OaExpressVo ydVo = YdRouteQueryUtil.parseData(result);
|
||||
if (ydVo != null) {
|
||||
oaExpressVo.setLastUpdateTime(ydVo.getLastUpdateTime());
|
||||
oaExpressVo.setLastStatus(ydVo.getLastStatus());
|
||||
@@ -177,7 +197,7 @@ public class OaExpressServiceImpl implements IOaExpressService {
|
||||
if (expressType.equals("YT") && oaExpressVo.getStatus() == 1L) {
|
||||
// 圆通快递轨迹查询
|
||||
String result = com.ruoyi.oa.utils.YtRouteQueryUtil.queryRoute(oaExpressVo.getExpressCode());
|
||||
OaExpressVo ytVo = com.ruoyi.oa.utils.YtRouteQueryUtil.parseData(result);
|
||||
OaExpressVo ytVo = YtRouteQueryUtil.parseData(result);
|
||||
if (ytVo != null) {
|
||||
oaExpressVo.setLastUpdateTime(ytVo.getLastUpdateTime());
|
||||
oaExpressVo.setLastStatus(ytVo.getLastStatus());
|
||||
@@ -186,10 +206,10 @@ public class OaExpressServiceImpl implements IOaExpressService {
|
||||
if (expressType.equals("STO") && oaExpressVo.getStatus() == 1L) {
|
||||
// 申通快递轨迹查询
|
||||
String result = StoRouteQueryUtil.queryRoute(Collections.singletonList(oaExpressVo.getExpressCode()));
|
||||
OaExpressVo stoVo = com.ruoyi.oa.utils.StoRouteQueryUtil.parseData(result);
|
||||
OaExpressVo stoVo = StoRouteQueryUtil.parseData(result);
|
||||
if (stoVo != null) {
|
||||
oaExpressVo.setLastUpdateTime(stoVo.getLastUpdateTime());
|
||||
oaExpressVo.setLastStatus(stoVo.getLastStatus());
|
||||
oaExpressVo.setLastUpdateTime(stoVo.getAcceptTime());
|
||||
oaExpressVo.setLastStatus(stoVo.getFirstStatusName());
|
||||
}
|
||||
}
|
||||
OaExpress add = BeanUtil.toBean(oaExpressVo, OaExpress.class);
|
||||
|
||||
@@ -75,6 +75,8 @@ public class OaFurnitureTableServiceImpl implements IOaFurnitureTableService {
|
||||
lqw.eq(bo.getLastEmailSendTime() != null, OaFurnitureTable::getLastEmailSendTime, bo.getLastEmailSendTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContactPerson()), OaFurnitureTable::getContactPerson, bo.getContactPerson());
|
||||
lqw.eq(bo.getReceiveCount() != null, OaFurnitureTable::getReceiveCount, bo.getReceiveCount());
|
||||
// 按邮件发送次数升序排序,发送次数少的靠前显示
|
||||
lqw.orderByAsc(OaFurnitureTable::getEmailSendCount);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,8 +216,8 @@ public class SfRouteQueryUtil {
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
String mailNo = "SF0282456509537";
|
||||
String result = queryRoute(mailNo,"18012017423");
|
||||
String mailNo = "SF3191365477469";
|
||||
String result = queryRoute(mailNo,"15075462410");
|
||||
System.out.println(result);
|
||||
OaExpressVo oaExpress = parseData(result);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.net.URLEncoder;
|
||||
@@ -106,9 +107,21 @@ public class StoRouteQueryUtil {
|
||||
JSONObject last = arr.getJSONObject(arr.size() - 1);
|
||||
OaExpressVo vo = new OaExpressVo();
|
||||
vo.setExpressCode(last.getString("waybillNo"));
|
||||
vo.setLastUpdateTime(last.getDate("opTime"));
|
||||
vo.setLastStatus(last.getString("scanType"));
|
||||
vo.setRemark(last.getString("memo"));
|
||||
// 设置时间
|
||||
String opTime = last.getString("opTime");
|
||||
if (opTime != null) {
|
||||
try {
|
||||
// 解析时间格式 "2025-07-27 13:01:00"
|
||||
java.text.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
vo.setAcceptTime(sdf.parse(opTime));
|
||||
} catch (Exception e) {
|
||||
vo.setAcceptTime(null);
|
||||
}
|
||||
}
|
||||
// 设置状态 - 使用scanType作为状态
|
||||
vo.setFirstStatusName(last.getString("memo"));
|
||||
// 设置备注 - 使用memo作为备注
|
||||
vo.setRemark(last.getString("scanType"));
|
||||
return vo;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -120,7 +133,7 @@ public class StoRouteQueryUtil {
|
||||
// main方法测试
|
||||
public static void main(String[] args) {
|
||||
List<String> waybillNos = new ArrayList<>();
|
||||
waybillNos.add("777325378857266"); // 测试单号
|
||||
waybillNos.add("777326763655544"); // 测试单号
|
||||
String result = queryRoute(waybillNos);
|
||||
System.out.println("申通原始返回:" + result);
|
||||
OaExpressVo vo = parseData(result);
|
||||
|
||||
@@ -114,8 +114,8 @@ public class ZtoTrackQueryUtil {
|
||||
// main方法测试
|
||||
public static void main(String[] args) throws IOException {
|
||||
System.out.println("本机公网IP为: " + getPublicIp());
|
||||
String billCode = "78921681808881";
|
||||
OaExpressVo result = queryTrack(billCode,"9553");
|
||||
String billCode = "78925013374727";
|
||||
OaExpressVo result = queryTrack(billCode,"2410");
|
||||
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
left join sys_user su on su.user_id = oe.owner_id
|
||||
left join sys_oa_project sop on sop.project_id = oe.project_id
|
||||
left join oa_report_detail ord on ord.detail_id = oe.detail_id
|
||||
${ew.getCustomSqlSegment}
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="selectVoByIdPlus" resultType="com.ruoyi.oa.domain.vo.OaExpressVo">
|
||||
select oe.express_id,
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
</if>
|
||||
AND s.del_flag = 0
|
||||
</where>
|
||||
ORDER BY
|
||||
COALESCE(d.latest_create_time, s.report_date) DESC,
|
||||
s.report_date DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user