发送短信接口
This commit is contained in:
@ -17,7 +17,6 @@ import java.time.LocalDateTime;
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
public class BizBidNoticeVO extends BasePageRequest implements Serializable {
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgInfoVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgTemplateService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "发送短信邮件接口")
|
||||
@RequestMapping("/v1/send/msg")
|
||||
public class BizSendMsgController {
|
||||
|
||||
@Resource
|
||||
private BizSendMsgTemplateService sendMsgService;
|
||||
|
||||
@ApiOperation("发送短信")
|
||||
@PostMapping("")
|
||||
public BaseResponse<Boolean> saveMsg(@RequestBody BizSendMsgInfoVO msgInfo) {
|
||||
return BaseResponse.success(sendMsgService.sendMsg(msgInfo));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgLog;
|
||||
|
||||
public interface BizSendMsgLogMapper extends BaseMapper<BizSendMsgLog> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgTemplate;
|
||||
|
||||
public interface BizSendMsgTemplateMapper extends BaseMapper<BizSendMsgTemplate> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.dao.BizSendMsgLogMapper">
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgLog">
|
||||
<result column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||
<result column="template_id" jdbcType="VARCHAR" property="templateId"/>
|
||||
<result column="receiver_company_id" jdbcType="VARCHAR" property="receiverCompanyId"/>
|
||||
<result column="receiver_company_name" jdbcType="VARCHAR" property="receiverCompanyName"/>
|
||||
<result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount"/>
|
||||
<result column="status" jdbcType="INTEGER" property="status"/>
|
||||
<result column="send_time" jdbcType="TIMESTAMP" property="sendTime"/>
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId"/>
|
||||
<result column="project_name" jdbcType="VARCHAR" property="projectName"/>
|
||||
<result column="section_id" jdbcType="VARCHAR" property="sectionId"/>
|
||||
<result column="section_name" jdbcType="VARCHAR" property="sectionName"/>
|
||||
<result column="assess_room_id" jdbcType="VARCHAR" property="assessRoomId"/>
|
||||
<result column="assess_room_sort" jdbcType="INTEGER" property="assessRoomSort"/>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.dao.BizSendMsgTemplateMapper">
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgTemplate">
|
||||
<result column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||
<result column="template_id" jdbcType="VARCHAR" property="templateId"/>
|
||||
<result column="content" jdbcType="VARCHAR" property="content"/>
|
||||
<result column="service_name" jdbcType="VARCHAR" property="serviceName"/>
|
||||
<result column="node" jdbcType="VARCHAR" property="node"/>
|
||||
<result column="task_form" jdbcType="VARCHAR" property="taskForm"/>
|
||||
<result column="receiver" jdbcType="VARCHAR" property="receiver"/>
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
<result column="purchasing_method" jdbcType="VARCHAR" property="purchasingMethod"/>
|
||||
</resultMap>
|
||||
</mapper>
|
@ -0,0 +1,37 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 实体类 BizSendMsgLog
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
public class BizReceiverVO {
|
||||
|
||||
/**
|
||||
* 接收人机构ID
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人机构ID")
|
||||
private String receiverCompanyId;
|
||||
|
||||
/**
|
||||
* 接收人机构名称
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人机构名称")
|
||||
private String receiverCompanyName;
|
||||
|
||||
/**
|
||||
* 接收人手机号/E-mail
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人手机号/E-mail")
|
||||
private String receiverAccount;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 实体类 BizSendMsgLog
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
public class BizSendMsgInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件
|
||||
*/
|
||||
@ApiModelProperty(value = "模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 接收人机构ID
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人集合")
|
||||
private List<BizReceiverVO> receiverList;
|
||||
|
||||
/**
|
||||
* 模板ID
|
||||
*/
|
||||
@ApiModelProperty(value = "模板ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 模板参数
|
||||
* {projectName}
|
||||
* {endTime} 格式:2021年12月20日10:00
|
||||
*/
|
||||
@ApiModelProperty(value = "模板参数")
|
||||
private Map<String, String> tempParamMap;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@ApiModelProperty(value = "项目ID")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 标段ID
|
||||
*/
|
||||
@ApiModelProperty(value = "标段ID")
|
||||
private String sectionId;
|
||||
|
||||
/**
|
||||
* 标段名称
|
||||
*/
|
||||
@ApiModelProperty(value = "标段名称")
|
||||
private String sectionName;
|
||||
|
||||
/**
|
||||
* 评审室ID
|
||||
*/
|
||||
@ApiModelProperty(value = "评审室ID")
|
||||
private String assessRoomId;
|
||||
|
||||
/**
|
||||
* 评审室排序
|
||||
*/
|
||||
@ApiModelProperty(value = "评审室排序")
|
||||
private Integer assessRoomSort;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实体类 BizSendMsgLog
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class BizSendMsgInfoVO {
|
||||
|
||||
@ApiModelProperty("请求参数对象")
|
||||
private List<BizSendMsgInfo> params;
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 实体类 BizSendMsgLog
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
@TableName(value = "biz_send_msg_log", autoResultMap = true)
|
||||
public class BizSendMsgLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件
|
||||
*/
|
||||
@ApiModelProperty(value = "模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 模板ID
|
||||
*/
|
||||
@ApiModelProperty(value = "模板ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 接收人机构ID
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人机构ID")
|
||||
private String receiverCompanyId;
|
||||
|
||||
/**
|
||||
* 接收人机构名称
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人机构名称")
|
||||
private String receiverCompanyName;
|
||||
|
||||
/**
|
||||
* 接收人手机号/E-mail
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人手机号/E-mail")
|
||||
private String receiverAccount;
|
||||
|
||||
/**
|
||||
* 发送状态;0-失败;1-成功
|
||||
*/
|
||||
@ApiModelProperty(value = "发送状态;0-失败;1-成功")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 发送时间
|
||||
*/
|
||||
@ApiModelProperty(value = "发送时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
|
||||
private java.time.LocalDateTime sendTime;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@ApiModelProperty(value = "项目ID")
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@ApiModelProperty(value = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 标段ID
|
||||
*/
|
||||
@ApiModelProperty(value = "标段ID")
|
||||
private String sectionId;
|
||||
|
||||
/**
|
||||
* 标段名称
|
||||
*/
|
||||
@ApiModelProperty(value = "标段名称")
|
||||
private String sectionName;
|
||||
|
||||
/**
|
||||
* 评审室ID
|
||||
*/
|
||||
@ApiModelProperty(value = "评审室ID")
|
||||
private String assessRoomId;
|
||||
|
||||
/**
|
||||
* 评审室排序
|
||||
*/
|
||||
@ApiModelProperty(value = "评审室排序")
|
||||
private Integer assessRoomSort;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实体类 BizSendMsgTemplate
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
@TableName(value = "biz_send_msg_template", autoResultMap = true)
|
||||
public class BizSendMsgTemplate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件
|
||||
*/
|
||||
@ApiModelProperty(value = "模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 模板ID
|
||||
*/
|
||||
@ApiModelProperty(value = "模板ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 模板内容
|
||||
*/
|
||||
@ApiModelProperty(value = "模板内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 服务名
|
||||
*/
|
||||
@ApiModelProperty("服务名")
|
||||
private String serviceName;
|
||||
|
||||
/**
|
||||
* 节点
|
||||
*/
|
||||
@ApiModelProperty(value = "节点")
|
||||
private String node;
|
||||
|
||||
/**
|
||||
* 任务形式:realtime实时;timing-定时
|
||||
*/
|
||||
@ApiModelProperty(value = "任务形式:realtime实时;timing-定时")
|
||||
private String taskForm;
|
||||
|
||||
/**
|
||||
* 接收人:供应商;项目经理
|
||||
*/
|
||||
@ApiModelProperty(value = "接收人:供应商;项目经理")
|
||||
private String receiver;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 采购方式
|
||||
*/
|
||||
@ApiModelProperty(value = "采购方式:procurement_mode_1公开招标,2邀请招标,3公开比选,4公开招募,5竞争性谈判,6单一来源,7公开询价,8竞拍,9单一来源简化流程'")
|
||||
private String purchasingMethod;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgLog;
|
||||
|
||||
/**
|
||||
* 对数据表 biz_send_msg_log 操作的 service
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
public interface BizSendMsgLogService extends IService<BizSendMsgLog> {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgInfoVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgTemplate;
|
||||
|
||||
/**
|
||||
* 对数据表 biz_send_msg_template 操作的 service
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
public interface BizSendMsgTemplateService extends IService<BizSendMsgTemplate> {
|
||||
|
||||
Boolean sendMsg(BizSendMsgInfoVO msgInfo);
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.dao.BizSendMsgLogMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgLog;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 对数据表 biz_send_msg_log 操作的 serviceImpl
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class BizSendMsgLogServiceImpl extends ServiceImpl<BizSendMsgLogMapper, BizSendMsgLog> implements BizSendMsgLogService {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.dao.BizSendMsgTemplateMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.*;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgLogService;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgTemplateService;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSmsEmailService;
|
||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
|
||||
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidTemplateWarehouse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 对数据表 biz_send_msg_template 操作的 serviceImpl
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplateMapper, BizSendMsgTemplate> implements BizSendMsgTemplateService {
|
||||
|
||||
@Resource
|
||||
private BizSmsEmailService msgService;
|
||||
@Autowired
|
||||
private IBaseCacheUserService cacheUserService;
|
||||
@Autowired
|
||||
private BizSendMsgLogService msgLogService;
|
||||
|
||||
@Override
|
||||
public Boolean sendMsg(BizSendMsgInfoVO msgInfoVO) {
|
||||
log.info("sendMsg传入数据:"+ JsonUtils.objectToJson(msgInfoVO));
|
||||
Optional.ofNullable(msgInfoVO.getParams());
|
||||
//发送信息
|
||||
List<BizSendMsgInfo> msgInfoList = msgInfoVO.getParams();
|
||||
msgInfoList.forEach(msgInfo -> {
|
||||
//模板类型:sms-短信;intraMail-内网邮件;extraMail-外网邮件
|
||||
String sendType = msgInfo.getType();
|
||||
//不同平台发送的内容
|
||||
if (StringUtils.equals("sms", sendType)) {
|
||||
//模板ID
|
||||
String templateId = msgInfo.getTemplateId();
|
||||
QueryWrapper<BizSendMsgTemplate> query = new QueryWrapper<>(new BizSendMsgTemplate().setTemplateId(templateId));
|
||||
//获得短信模板信息
|
||||
BizSendMsgTemplate msgTemplate = this.getOne(query);
|
||||
//替换字段,形成需要发送的短信内容
|
||||
String magContent = generateMsgFromTemplete(msgTemplate.getContent(), msgInfo.getTempParamMap());
|
||||
|
||||
//接收人
|
||||
List<BizReceiverVO> receiverList = msgInfo.getReceiverList();
|
||||
receiverList.forEach(receiver -> {
|
||||
//任务形式:realtime实时;timing-定时
|
||||
String taskForm = msgTemplate.getTaskForm();
|
||||
if (StringUtils.equals("realtime", taskForm)) {
|
||||
//发送
|
||||
sendSms( msgInfo, receiver, magContent);
|
||||
}
|
||||
else if (StringUtils.equals("timing", taskForm)) {
|
||||
BizSendMsgLog msgLog = new BizSendMsgLog();
|
||||
BeanUtils.copyProperties(msgInfo, msgLog);
|
||||
msgLog.setReceiverCompanyId(receiver.getReceiverCompanyId())
|
||||
.setReceiverCompanyName(receiver.getReceiverCompanyName())
|
||||
.setReceiverAccount(receiver.getReceiverAccount());
|
||||
LambdaQueryWrapper<BizSendMsgLog> queryWrapper = Wrappers.lambdaQuery(msgLog);
|
||||
List<BizSendMsgLog> msgLogList = msgLogService.list(queryWrapper);
|
||||
if (msgLogList.isEmpty()){
|
||||
sendSms( msgInfo, receiver, magContent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (StringUtils.equals("intraMail", sendType)) {
|
||||
}
|
||||
else if (StringUtils.equals("extraMail", sendType)) {
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean sendSms(BizSendMsgInfo msgInfo, BizReceiverVO receiver, String magContent) {
|
||||
boolean result = false;
|
||||
//当前用户userId
|
||||
String userId = "ex-yueyang10";//cacheUserService.getCacheUser().getUserId();
|
||||
String userName = "岳洋";//cacheUserService.getCacheUser().getFullName();
|
||||
BizSendMsgVO msgVO = new BizSendMsgVO();
|
||||
msgVO.setSendUid(userId)
|
||||
.setSendUName(userName)
|
||||
.setStrMobileNumberr(receiver.getReceiverAccount())
|
||||
.setStrContent(magContent);
|
||||
//发送短信
|
||||
result = msgService.sendMsg(msgVO);
|
||||
//保存日志
|
||||
savaLog(msgInfo, result, receiver);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存发送短信/邮件日志
|
||||
* @param msgInfo
|
||||
* @param result
|
||||
* @param receiverVO
|
||||
*/
|
||||
public void savaLog(BizSendMsgInfo msgInfo, boolean result, BizReceiverVO receiverVO) {
|
||||
BizSendMsgLog msgLog = new BizSendMsgLog();
|
||||
String id = PropertyUtils.getSnowflakeId();
|
||||
msgLog.setId(id)
|
||||
.setType(msgInfo.getType())
|
||||
.setTemplateId(msgInfo.getTemplateId())
|
||||
.setReceiverCompanyId(receiverVO.getReceiverCompanyId())
|
||||
.setReceiverCompanyName(receiverVO.getReceiverCompanyName())
|
||||
.setReceiverAccount(receiverVO.getReceiverAccount())
|
||||
.setStatus(result?1:0)//发送状态;0-失败;1-成功
|
||||
.setSendTime(LocalDateTime.now())
|
||||
.setProjectId(msgInfo.getProjectId())
|
||||
.setProjectName(msgInfo.getProjectName())
|
||||
.setSectionId(msgInfo.getSectionId())
|
||||
.setSectionName(msgInfo.getSectionName())
|
||||
.setAssessRoomId(msgInfo.getAssessRoomId())
|
||||
.setAssessRoomSort(msgInfo.getAssessRoomSort());
|
||||
log.info("sendMsgLog传入数据:"+ JsonUtils.objectToJson(msgLog));
|
||||
msgLogService.save(msgLog);
|
||||
}
|
||||
|
||||
private String generateMsgFromTemplete(String msg, Map<String, String> params) {
|
||||
for (Map.Entry<String, String> param : params.entrySet()) {
|
||||
msg = msg.replace("{" + param.getKey().replace("{", "").replace("}", "").trim() + "}", param.getValue() == null ? "" : param.getValue());
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
@ -165,6 +165,7 @@ mconfig:
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
strategy-center: core-service-strategy-center #风控中心
|
||||
notification: notification
|
||||
file:
|
||||
font-address: /storage/fonts/
|
||||
upload-address: /storage/reviewReport/
|
||||
|
Reference in New Issue
Block a user