发送短信测试
This commit is contained in:
12
pom.xml
12
pom.xml
@ -89,18 +89,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.chinaunicom.sdsi</groupId>
|
||||
<artifactId>core-service-notification-center-api</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>cn.chinaunicom.sdsi</artifactId>-->
|
||||
<!-- <groupId>unifast-security</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
@ -1,30 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity.BizSendMsgVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.service.BizShortMsgService;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "短信接口")
|
||||
@RequestMapping("/v1/sms")
|
||||
public class BizShortMsgController {
|
||||
|
||||
@Resource
|
||||
private BizShortMsgService msgService;
|
||||
|
||||
@ApiOperation("发送短信")
|
||||
@PostMapping("/sendMsg")
|
||||
public BaseResponse<Boolean> saveMsg(@RequestBody BizSendMsgVO msgVO) {
|
||||
return BaseResponse.success(msgService.sendMsg(msgVO));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.service;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity.BizSendMsgVO;
|
||||
|
||||
public interface BizShortMsgService {
|
||||
|
||||
Boolean sendMsg(BizSendMsgVO msgVO);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.service.impl;
|
||||
|
||||
import cn.chinaunicom.sdsi.notification.NotificationApiFeignClient;
|
||||
import cn.chinaunicom.sdsi.sms.entity.EshopSmsPendingPO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity.BizSendMsgVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.enums.ExceptionEnum;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.service.BizShortMsgService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Service
|
||||
public class BizShortMsgServiceImpl implements BizShortMsgService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BizShortMsgServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private NotificationApiFeignClient feignClient;
|
||||
|
||||
@Override
|
||||
public Boolean sendMsg(BizSendMsgVO msgVO) {
|
||||
EshopSmsPendingPO po = new EshopSmsPendingPO();
|
||||
|
||||
po.setSendCenter("ebtp");
|
||||
po.setSendModule("biz-service-ebtp-extend");
|
||||
po.setSendUid(msgVO.getSendUid());
|
||||
po.setSendUName(msgVO.getSendUName());
|
||||
po.setStrMobileNumber(msgVO.getStrMobileNumberr());
|
||||
po.setStrContent(msgVO.getStrContent());
|
||||
logger.info("调用短信接口入参:[{}]", po);
|
||||
cn.chinaunicom.sdsi.framework.response.BaseResponse<Boolean> baseResponse = feignClient.saveMsg(po);
|
||||
ExceptionEnum.FRAME_EXCEPTION_SEND_MSG_FAIL.customValid(!baseResponse.isSuccess());
|
||||
logger.info("调用短信接口返回:[{}]", baseResponse);
|
||||
|
||||
return baseResponse.getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.client;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopMailPendingPO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopSmsPendingPO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(value = "${mconfig.feign.name.notification}", url = "10.242.31.158:8806/notification", fallbackFactory = NotificationFeignFallbackFactory.class)
|
||||
public interface NotificationFeignClient {
|
||||
|
||||
@ApiOperation("短信通知")
|
||||
@PostMapping("/v1/notification/saveMsg")
|
||||
BaseResponse saveMsg(@RequestBody EshopSmsPendingPO eshopSmsPendingPO);
|
||||
|
||||
@ApiOperation(value = "邮件通知", notes = "邮件通知")
|
||||
@PostMapping("/v1/notification/sendMail")
|
||||
BaseResponse sendMail(@RequestBody EshopMailPendingPO eshopMailPendingPO);
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.client;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopMailPendingPO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopSmsPendingPO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NotificationFeignFallbackFactory implements FallbackFactory<NotificationFeignClient> {
|
||||
@Override
|
||||
public NotificationFeignClient create(Throwable throwable) {
|
||||
NotificationFeignClient back = new NotificationFeignClient() {
|
||||
|
||||
@Override
|
||||
public BaseResponse saveMsg(EshopSmsPendingPO eshopSmsPendingPO) {
|
||||
log.error(eshopSmsPendingPO.toString());
|
||||
return new BaseResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse sendMail(EshopMailPendingPO eshopMailPendingPO) {
|
||||
log.error(eshopMailPendingPO.toString());
|
||||
return new BaseResponse();
|
||||
}
|
||||
};
|
||||
log.error(ExceptionUtil.stacktraceToString(throwable));
|
||||
return back;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
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.BizSendEmailVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSmsEmailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "短信接口")
|
||||
@RequestMapping("/v1/sms")
|
||||
public class BizSmsEmailController {
|
||||
|
||||
@Resource
|
||||
private BizSmsEmailService msgService;
|
||||
|
||||
@ApiOperation("发送短信")
|
||||
@PostMapping("/sendMsg")
|
||||
public BaseResponse<Boolean> saveMsg(@RequestBody @Validated BizSendMsgVO msgVO) {
|
||||
return BaseResponse.success(msgService.sendMsg(msgVO));
|
||||
}
|
||||
|
||||
@ApiOperation("发送短信")
|
||||
@PostMapping("/sendEmail")
|
||||
public BaseResponse<Boolean> saveMsg(@RequestBody @Validated BizSendEmailVO emailVO) {
|
||||
return BaseResponse.success(msgService.sendEmail(emailVO));
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity;
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
|
@ -1,4 +1,4 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity;
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author liuh
|
||||
@ -19,14 +20,6 @@ import javax.validation.constraints.NotEmpty;
|
||||
public class BizSendEmailVO {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "发送中心标识(字典表获取)")
|
||||
@NotEmpty(message = "发送中心标识不能为空")
|
||||
private String sendCenter;
|
||||
|
||||
@ApiModelProperty(value = "发送业务模块标识(字典表获取)")
|
||||
@NotEmpty(message = "发送中心标识不能为空")
|
||||
private String sendModule;
|
||||
|
||||
@ApiModelProperty(value = "发送人标识")
|
||||
@NotEmpty(message = "发送人标识不能为空")
|
||||
private String sendUid;
|
||||
@ -35,20 +28,15 @@ public class BizSendEmailVO {
|
||||
@NotEmpty(message = "发送人名称不能为空")
|
||||
private String sendUName;
|
||||
|
||||
@ApiModelProperty(value = "1.收件人邮箱,多个逗号(,)分隔\n" +
|
||||
"2.上限100个,超出部分自动抛弃\n" +
|
||||
"3.与uId互斥,必选其一\n")
|
||||
@ApiModelProperty(value = "收件人邮箱")
|
||||
private String sendTo;
|
||||
|
||||
@ApiModelProperty(value = "1.收件人集团用户中心系统账号,多个逗号(,)分隔\n" +
|
||||
"2.上限100个,超出部分自动抛\n" +
|
||||
"3.与sendTo 互斥,必选其一\n")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "邮件标题")
|
||||
@NotEmpty(message = "邮件标题不能为空")
|
||||
private String subject;
|
||||
|
||||
@ApiModelProperty(value = "邮件内容")
|
||||
@NotEmpty(message = "邮件内容不能为空")
|
||||
private String msg;
|
||||
|
||||
@ApiModelProperty(value = "附件方式1:url 2:file流")
|
||||
@ -59,8 +47,6 @@ public class BizSendEmailVO {
|
||||
"File:附件文件(限制2M)\n")
|
||||
private String file;
|
||||
|
||||
@ApiModelProperty(value = "单据id")
|
||||
private String docId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "批量发送邮箱")
|
||||
private List<String> sendToList;
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity;
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author liuh
|
||||
@ -28,12 +31,15 @@ public class BizSendMsgVO {
|
||||
@NotEmpty(message = "发送人名称不能为空")
|
||||
private String sendUName;
|
||||
|
||||
@ApiModelProperty(value = "接收人手机号,多个逗号(,)分隔;上限100个,超出部分自动抛弃,与uId互斥,必选其一")
|
||||
@ApiModelProperty(value = "接收人手机号")
|
||||
@Size(max = 11, message = "手机号不得超出11位")
|
||||
private String strMobileNumberr;
|
||||
|
||||
@ApiModelProperty(value = "短信内容(最大长度2000)")
|
||||
@Size(max = 2000, message = "手机号上限100个")
|
||||
private String strContent;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "多个手机号")
|
||||
private List<String> mutiMobileNumber;
|
||||
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @author Neo
|
||||
*/
|
||||
@ApiModel("邮件待发送的日志保存实体类")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class EshopMailPendingPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty("主键")
|
||||
@TableId("mail_pen_id")
|
||||
private String mailPenId;
|
||||
@ApiModelProperty("发送中心标识")
|
||||
@NotBlank(
|
||||
message = "发送中心标识不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送中心标识不能超过{max}个字符",
|
||||
max = 36
|
||||
)
|
||||
@TableField("send_center")
|
||||
private String sendCenter;
|
||||
@ApiModelProperty("发送业务模块标识")
|
||||
@NotBlank(
|
||||
message = "发送业务模块标识不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送业务模块标识不能超过{max}个字符",
|
||||
max = 36
|
||||
)
|
||||
@TableField("send_module")
|
||||
private String sendModule;
|
||||
@ApiModelProperty("发送人标识")
|
||||
@NotBlank(
|
||||
message = "发送人标识不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送人标识不能超过{max}个字符",
|
||||
max = 128
|
||||
)
|
||||
@TableField("send_uid")
|
||||
private String sendUid;
|
||||
@ApiModelProperty("发送人名称")
|
||||
@NotBlank(
|
||||
message = "发送人名称不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送人名称不能超过{max}个字符",
|
||||
max = 64
|
||||
)
|
||||
@TableField("send_uname")
|
||||
private String sendUname;
|
||||
@ApiModelProperty("收件人邮箱,多个逗号(,)分隔")
|
||||
@TableField("send_to")
|
||||
private String sendTo;
|
||||
@ApiModelProperty("集团用户中心系统的账号,多个逗号(,)分隔")
|
||||
@TableField("uid")
|
||||
private String uid;
|
||||
@ApiModelProperty("邮件标题")
|
||||
@NotBlank(
|
||||
message = "邮件标题不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "邮件标题不能超过{max}个字符",
|
||||
max = 500
|
||||
)
|
||||
@TableField("subject")
|
||||
private String subject;
|
||||
@ApiModelProperty("邮件内容")
|
||||
@NotBlank(
|
||||
message = "邮件内容不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "邮件内容不能超过{max}个字符",
|
||||
max = 2000
|
||||
)
|
||||
@TableField("msg")
|
||||
private String msg;
|
||||
@ApiModelProperty("附件地址")
|
||||
@TableField("file_url")
|
||||
private String fileUrl;
|
||||
@ApiModelProperty("0:未发起 1成功 2失败")
|
||||
@TableField("send_status")
|
||||
private String sendStatus;
|
||||
@ApiModelProperty("邮件发起时间")
|
||||
@TableField("launch_date")
|
||||
private LocalDateTime launchDate;
|
||||
@ApiModelProperty("保留字段")
|
||||
@TableField("mail_reserved1")
|
||||
private String mailReserved1;
|
||||
@ApiModelProperty("保留字段")
|
||||
@TableField("mail_reserved2")
|
||||
private String mailReserved2;
|
||||
@ApiModelProperty("保留字段")
|
||||
@TableField("mail_reserved3")
|
||||
private String mailReserved3;
|
||||
@ApiModelProperty("保留字段")
|
||||
@TableField("mail_reserved4")
|
||||
private String mailReserved4;
|
||||
@ApiModelProperty("保留字段")
|
||||
@TableField("mail_reserved5")
|
||||
private String mailReserved5;
|
||||
@ApiModelProperty("保留字段")
|
||||
@TableField("mail_reserved6")
|
||||
private String mailReserved6;
|
||||
@TableField(
|
||||
exist = false
|
||||
)
|
||||
private MultipartFile file;
|
||||
@TableField(
|
||||
exist = false
|
||||
)
|
||||
private String fileType;
|
||||
@TableField(
|
||||
exist = false
|
||||
)
|
||||
private String docId;
|
||||
private String fileName;
|
||||
|
||||
public EshopMailPendingPO() {
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@ApiModel("短信待发送的日志保存实体类")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class EshopSmsPendingPO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ApiModelProperty("主键")
|
||||
@TableId("sms_pen_id")
|
||||
private String smsPenId;
|
||||
@ApiModelProperty(
|
||||
value = "发送中心标识",
|
||||
required = true
|
||||
)
|
||||
@TableField("send_center")
|
||||
@NotBlank(
|
||||
message = "发送中心标识不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送中心标识不能超过{max}个字符",
|
||||
max = 36
|
||||
)
|
||||
private String sendCenter;
|
||||
@ApiModelProperty(
|
||||
value = "发送业务模块标识",
|
||||
required = true
|
||||
)
|
||||
@TableField("send_module")
|
||||
@NotBlank(
|
||||
message = "发送业务模块标识不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送业务模块标识不能超过{max}个字符",
|
||||
max = 36
|
||||
)
|
||||
private String sendModule;
|
||||
@ApiModelProperty(
|
||||
value = "发送人标识",
|
||||
required = true
|
||||
)
|
||||
@TableField("send_uid")
|
||||
@NotBlank(
|
||||
message = "发送人标识不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送人标识不能超过{max}个字符",
|
||||
max = 128
|
||||
)
|
||||
private String sendUid;
|
||||
@ApiModelProperty(
|
||||
value = "发送人名称",
|
||||
required = true
|
||||
)
|
||||
@TableField("send_uname")
|
||||
@NotBlank(
|
||||
message = "发送人名称不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "发送人名称不能超过{max}个字符",
|
||||
max = 50
|
||||
)
|
||||
private String sendUName;
|
||||
@ApiModelProperty("接收人手机号,多个逗号(,)分隔")
|
||||
@TableField("strmobile_number")
|
||||
@Length(
|
||||
message = "接收人手机号不能超过{max}个字符",
|
||||
max = 1300
|
||||
)
|
||||
private String strMobileNumber;
|
||||
@ApiModelProperty("集团用户中心系统的账号,多个逗号(,)分隔")
|
||||
@TableField("uid")
|
||||
@Length(
|
||||
message = "集团用户中心系统的账号不能超过{max}个字符",
|
||||
max = 1000
|
||||
)
|
||||
private String uid;
|
||||
@ApiModelProperty(
|
||||
value = "短信内容",
|
||||
required = true
|
||||
)
|
||||
@TableField("str_content")
|
||||
@NotBlank(
|
||||
message = "短信内容不能为空"
|
||||
)
|
||||
@Length(
|
||||
message = "短信内容不能超过{max}个字符",
|
||||
max = 2000
|
||||
)
|
||||
private String strContent;
|
||||
@ApiModelProperty("0:未发起 1:成功 2:失败")
|
||||
@TableField("send_status")
|
||||
private Integer sendStatus;
|
||||
@ApiModelProperty("短信发起时间")
|
||||
@TableField("launch_date")
|
||||
private LocalDateTime launchDate;
|
||||
@ApiModelProperty("省ou")
|
||||
@TableField("province_ou")
|
||||
private String provinceOu;
|
||||
@ApiModelProperty("省ou名")
|
||||
@TableField("province_ou_name")
|
||||
private String provinceOuName;
|
||||
@ApiModelProperty("市ou")
|
||||
@TableField("city_ou")
|
||||
private String cityOu;
|
||||
@ApiModelProperty("市ou名")
|
||||
@TableField("city_ou_name")
|
||||
private String cityOuName;
|
||||
@ApiModelProperty("单据id")
|
||||
@TableField(
|
||||
exist = false
|
||||
)
|
||||
private String docId;
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.enums;
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.enums;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.exception.service.BusinessExceptionAssert;
|
||||
import lombok.AllArgsConstructor;
|
@ -0,0 +1,14 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendEmailVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public interface BizSmsEmailService {
|
||||
|
||||
Boolean sendMsg(BizSendMsgVO msgVO);
|
||||
|
||||
Boolean sendEmail(BizSendEmailVO emailVO);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.impl;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.client.NotificationFeignClient;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendEmailVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgVO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopSmsPendingPO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.enums.ExceptionEnum;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSmsEmailService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author Neo
|
||||
*/
|
||||
@Service
|
||||
public class BizSmsEmailServiceImpl implements BizSmsEmailService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BizSmsEmailServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private NotificationFeignClient notificationFeignClient;
|
||||
|
||||
@Override
|
||||
public Boolean sendMsg(BizSendMsgVO msgVO) {
|
||||
EshopSmsPendingPO po = new EshopSmsPendingPO();
|
||||
|
||||
po.setSendCenter("ebtp");
|
||||
po.setSendModule("biz-service-ebtp-extend");
|
||||
po.setSendUid(msgVO.getSendUid());
|
||||
po.setSendUName(msgVO.getSendUName());
|
||||
if (msgVO.getMutiMobileNumber() != null && !msgVO.getMutiMobileNumber().isEmpty()) {
|
||||
po.setStrMobileNumber(StringUtils.join(msgVO.getMutiMobileNumber().toArray(),","));
|
||||
} else {
|
||||
po.setStrMobileNumber(msgVO.getStrMobileNumberr());
|
||||
}
|
||||
po.setStrContent(msgVO.getStrContent());
|
||||
logger.info("调用短信接口入参:[{}]", po);
|
||||
BaseResponse baseResponse = notificationFeignClient.saveMsg(po);
|
||||
ExceptionEnum.FRAME_EXCEPTION_SEND_MSG_FAIL.customValid(!baseResponse.isSuccess());
|
||||
logger.info("调用短信接口返回:[{}]", baseResponse.isSuccess());
|
||||
|
||||
return baseResponse.isSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean sendEmail(BizSendEmailVO emailVO) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -129,8 +129,8 @@ feign:
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
connect-timeout: 60000
|
||||
read-timeout: 60000
|
||||
|
||||
hystrix:
|
||||
command:
|
||||
@ -147,8 +147,8 @@ hystrix:
|
||||
forceClosed: true
|
||||
|
||||
ribbon:
|
||||
ReadTimeout: 20000 #请求处理的超时时间
|
||||
ConnectTimeout: 20000 #请求连接超时时间
|
||||
ReadTimeout: 60000 #请求处理的超时时间
|
||||
ConnectTimeout: 60000 #请求连接超时时间
|
||||
MaxAutoRetries: 0 #对当前实例的重试次数
|
||||
MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1
|
||||
|
||||
@ -166,6 +166,7 @@ mconfig:
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
notification: core-service-notification-center #通知中心
|
||||
|
||||
|
||||
document:
|
||||
|
Reference in New Issue
Block a user