Commit 4ea3ef49 authored by honghy's avatar honghy

短信节点新增备注、目的仓搜索条件

parent e6a292ef
......@@ -37,6 +37,7 @@ create table system_sms_node
template_id_three bigint comment '模板3',
template_id_four bigint comment '模板4',
`extra` json NULL COMMENT '扩展字段',
remark varchar(255) NULL COMMENT '备注',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
......
......@@ -85,4 +85,7 @@ public class SmsNodeBackVO {
@ApiModelProperty(value = "目的仓(国家,城市,仓库id)")
private List<List<Long>> receiveAddrList;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -54,4 +54,7 @@ public class SmsNodeBaseVO {
@ApiModelProperty(value = "目的仓(国家,城市,仓库id)")
private List<List<Long>> receiveAddrList;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -54,4 +54,10 @@ public class SmsNodeQueryVO extends PageParam{
@ApiModelProperty(value = "多订单", required = true)
private Integer isOrders;
@ApiModelProperty(value = "extra")
private String extra;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -78,4 +78,8 @@ public class SmsNodeDO extends BaseDO {
* 扩展字段
*/
private String extra;
/**
* 备注
*/
private String remark;
}
......@@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.smsNode.SmsNodeQueryVO;
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsNodeDO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Mapper;
......@@ -19,7 +21,7 @@ import java.util.List;
@Mapper
public interface SmsNodeMapper extends AbstractMapper<SmsNodeDO> {
default PageResult<SmsNodeDO> selectPage(SmsNodeQueryVO vo) {
return selectPage(vo, new LambdaQuery<SmsNodeDO>()
LambdaQueryWrapperX<SmsNodeDO> smsNodeDOLambdaQueryWrapperX = new LambdaQuery<SmsNodeDO>()
.eq(StringUtils.isNotBlank(vo.getNodeValue()), SmsNodeDO::getNodeValue, vo.getNodeValue())
.eqIfPresent(SmsNodeDO::getTransportId, vo.getTransportId())
.eqIfPresent(SmsNodeDO::getCountryId, vo.getCountryId())
......@@ -31,8 +33,24 @@ public interface SmsNodeMapper extends AbstractMapper<SmsNodeDO> {
.eqIfPresent(SmsNodeDO::getTemplateIdTwo, vo.getTemplateIdTwo())
.eqIfPresent(SmsNodeDO::getTemplateIdThree, vo.getTemplateIdThree())
.eqIfPresent(SmsNodeDO::getTemplateIdFour, vo.getTemplateIdFour())
.betweenIfPresent(SmsNodeDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(SmsNodeDO::getId));
.betweenIfPresent(SmsNodeDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime());
String extra = vo.getExtra();
if (StringUtils.isNotBlank(extra)) {
List<List<Integer>> list = JSON.parseObject(extra, new TypeReference<List<List<Integer>>>() {});
if (!list.isEmpty()) {
String sql = "";
for (List<Integer> o : list) {
if (StringUtils.isBlank(sql)) {
sql = " (replace(extra -> '$.receiveAddrList',' ','') LIKE '%" + JSON.toJSONString(o) + "%') ";
} else {
sql += " or (replace(extra -> '$.receiveAddrList',' ','') LIKE '%" + JSON.toJSONString(o) + "%')";
}
}
smsNodeDOLambdaQueryWrapperX.apply(sql);
}
}
smsNodeDOLambdaQueryWrapperX.orderByDesc(SmsNodeDO::getId);
return selectPage(vo, smsNodeDOLambdaQueryWrapperX);
}
@Override
......
......@@ -337,7 +337,8 @@ public class SmsSendServiceImpl implements SmsSendService {
// 尝试从缓存中获取短信节点信息
smsNode = getSmsNodeFromCache(smsNodeDO, receive);
if (smsNode == null) {
throw exception(SMS_NODE_NOT_EXISTS);
log.error(SMS_NODE_NOT_EXISTS.getMsg());
return null;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment