发送短信测试
This commit is contained in:
11
pom.xml
11
pom.xml
@ -89,6 +89,17 @@
|
||||
</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>
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.chinaunicom.mall.ebtp.extend;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -22,7 +21,6 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
@EnableEurekaClient
|
||||
@MapperScan({"com.chinaunicom.mall.ebtp.extend.**.dao"})
|
||||
@ComponentScan("com.chinaunicom.mall.ebtp.*")
|
||||
@EnableApolloConfig
|
||||
public class BizServiceEbtpExtendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -0,0 +1,30 @@
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
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.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author liuh
|
||||
* @Date 2021/6/21 下午6:47
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "BizQueryMsgVO", description = "短信查询对象")
|
||||
public class BizQueryMsgVO {
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value="发起开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@ApiModelProperty(value="发起结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(typeHandler = CustomLocalDateTimeTypeHandler.class)
|
||||
private LocalDateTime endDate;
|
||||
|
||||
@ApiModelProperty(value="短信发送状态 1:已发送2:未发送 ")
|
||||
@NotEmpty(message = "短信发送状态不能为空")
|
||||
private String sendStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value="发送中心标识")
|
||||
@NotEmpty(message = "发送中心标识不能为空")
|
||||
private String sendCenter;
|
||||
|
||||
@ApiModelProperty(value="发送业务模块标识")
|
||||
@NotEmpty(message = "发送业务模块标识不能为空")
|
||||
private String sendModule;
|
||||
@ApiModelProperty(value="发送人标识")
|
||||
private String sendUid;
|
||||
@ApiModelProperty(value="邮箱前缀, 仅支持传入一个人的uid查询")
|
||||
private String uid;
|
||||
@ApiModelProperty(value="手机号,仅支持传入一个手机查询")
|
||||
private String strMobileNumberr;
|
||||
@ApiModelProperty(value="省ou")
|
||||
private String provinceOu;
|
||||
@ApiModelProperty(value="市ou")
|
||||
private String cityOu;
|
||||
@ApiModelProperty(value="单据id")
|
||||
private String docId;
|
||||
|
||||
@ApiModelProperty(value="每页数据个数(最大为100)")
|
||||
private int pageSize;
|
||||
@ApiModelProperty(value="当前页数")
|
||||
private int pageNum;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* @Author liuh
|
||||
* @Date 2021/6/21 下午6:47
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "BizSendEmailVO", description = "发送邮件接口对象")
|
||||
public class BizSendEmailVO {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "发送中心标识(字典表获取)")
|
||||
@NotEmpty(message = "发送中心标识不能为空")
|
||||
private String sendCenter;
|
||||
|
||||
@ApiModelProperty(value = "发送业务模块标识(字典表获取)")
|
||||
@NotEmpty(message = "发送中心标识不能为空")
|
||||
private String sendModule;
|
||||
|
||||
@ApiModelProperty(value = "发送人标识")
|
||||
@NotEmpty(message = "发送人标识不能为空")
|
||||
private String sendUid;
|
||||
|
||||
@ApiModelProperty(value = "发送人名称")
|
||||
@NotEmpty(message = "发送人名称不能为空")
|
||||
private String sendUName;
|
||||
|
||||
@ApiModelProperty(value = "1.收件人邮箱,多个逗号(,)分隔\n" +
|
||||
"2.上限100个,超出部分自动抛弃\n" +
|
||||
"3.与uId互斥,必选其一\n")
|
||||
private String sendTo;
|
||||
|
||||
@ApiModelProperty(value = "1.收件人集团用户中心系统账号,多个逗号(,)分隔\n" +
|
||||
"2.上限100个,超出部分自动抛\n" +
|
||||
"3.与sendTo 互斥,必选其一\n")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "邮件标题")
|
||||
private String subject;
|
||||
|
||||
@ApiModelProperty(value = "邮件内容")
|
||||
private String msg;
|
||||
|
||||
@ApiModelProperty(value = "附件方式1:url 2:file流")
|
||||
private String fileType;
|
||||
|
||||
@ApiModelProperty(value = "URL方式或附件文件方式二选一:\n" +
|
||||
"varchar:附件URL长度不超过1000\n" +
|
||||
"File:附件文件(限制2M)\n")
|
||||
private String file;
|
||||
|
||||
@ApiModelProperty(value = "单据id")
|
||||
private String docId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* @Author liuh
|
||||
* @Date 2021/6/21 下午6:47
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "BizSendMsgVO对象", description = "发送短信接口对象")
|
||||
public class BizSendMsgVO {
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "发送人标识")
|
||||
@NotEmpty(message = "发送人标识不能为空")
|
||||
private String sendUid;
|
||||
|
||||
@ApiModelProperty(value = "发送人名称")
|
||||
@NotEmpty(message = "发送人名称不能为空")
|
||||
private String sendUName;
|
||||
|
||||
@ApiModelProperty(value = "接收人手机号,多个逗号(,)分隔;上限100个,超出部分自动抛弃,与uId互斥,必选其一")
|
||||
private String strMobileNumberr;
|
||||
|
||||
@ApiModelProperty(value = "短信内容(最大长度2000)")
|
||||
private String strContent;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.enums;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.exception.service.BusinessExceptionAssert;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ExceptionEnum implements BusinessExceptionAssert {
|
||||
/**
|
||||
* 发送短信返回结果错误
|
||||
*/
|
||||
FRAME_EXCEPTION_SEND_MSG_FAIL(2200001, "调用短信接口异常!"),
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断接口返回是否有数据
|
||||
*/
|
||||
IS_SUCCESS(2200002, "接口返回异常");
|
||||
|
||||
/**
|
||||
* 返回码
|
||||
*/
|
||||
private final int code;
|
||||
/**
|
||||
* 返回消息
|
||||
*/
|
||||
private final String message;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizshortmessage.service;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.extend.bizshortmessage.entity.BizSendMsgVO;
|
||||
|
||||
public interface BizShortMsgService {
|
||||
|
||||
Boolean sendMsg(BizSendMsgVO msgVO);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
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 @@
|
||||
{ "properties": [ ] }
|
@ -4,17 +4,17 @@ server:
|
||||
context-path: /
|
||||
|
||||
# 对应 apollo 配置中心的应用名
|
||||
app:
|
||||
id: biz-service-ebtp-extend
|
||||
|
||||
# Apollo 配置信息
|
||||
apollo:
|
||||
meta: http://10.242.37.148:6001/
|
||||
bootstrap:
|
||||
namespace: application
|
||||
enabled: true
|
||||
eagerLoad:
|
||||
enabled: true
|
||||
#app:
|
||||
# id: biz-service-ebtp-extend
|
||||
#
|
||||
## Apollo 配置信息
|
||||
#apollo:
|
||||
# meta: http://10.242.37.148:6001/
|
||||
# bootstrap:
|
||||
# namespace: application
|
||||
# enabled: true
|
||||
# eagerLoad:
|
||||
# enabled: true
|
||||
|
||||
seata:
|
||||
service:
|
||||
|
182
src/main/resources/application-localuat.yml
Normal file
182
src/main/resources/application-localuat.yml
Normal file
@ -0,0 +1,182 @@
|
||||
server:
|
||||
port: 18018
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
# 对应 apollo 配置中心的应用名
|
||||
#app:
|
||||
# id: biz-service-ebtp-extend
|
||||
#
|
||||
## Apollo 配置信息
|
||||
#apollo:
|
||||
# meta: http://10.242.37.148:6001/
|
||||
# bootstrap:
|
||||
# namespace: application
|
||||
# enabled: true
|
||||
# eagerLoad:
|
||||
# enabled: true
|
||||
|
||||
seata:
|
||||
service:
|
||||
vgroup-mapping:
|
||||
biz-service-ebtp-extend-dev-service-group: default
|
||||
spring:
|
||||
main:
|
||||
allow-bean-definition-overriding: true #支持名称相同的bean的覆盖
|
||||
aop:
|
||||
auto: true #开启spring的aop配置
|
||||
proxy-target-class: true
|
||||
|
||||
application:
|
||||
name: biz-service-ebtp-extend-uat
|
||||
|
||||
shardingsphere:
|
||||
datasource:
|
||||
names: ds0
|
||||
ds0:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: mall
|
||||
password: unicom
|
||||
jdbc-url: jdbc:mysql://10.125.160.26:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://10.125.160.26:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
filters: stat,wall,log4j
|
||||
maxActive: 20
|
||||
initialSize: 1
|
||||
maxWait: 60000
|
||||
minIdle: 1
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: select 'x'
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxOpenPreparedStatements: 20
|
||||
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
|
||||
props:
|
||||
sql:
|
||||
show: true
|
||||
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
|
||||
# 天宫Kafka增加了安全认证,需要配置安全属性
|
||||
kafka:
|
||||
bootstrap-servers: 10.125.164.192:32005,10.125.164.193:32005,10.125.164.194:32005
|
||||
template:
|
||||
default-topic: jl_test
|
||||
|
||||
# 生产者配置参数
|
||||
producer:
|
||||
client-id: core-service-ebtp-crypt
|
||||
properties:
|
||||
security.protocol: SASL_PLAINTEXT
|
||||
sasl.mechanism: SCRAM-SHA-256
|
||||
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
|
||||
|
||||
# 消费者配置参数
|
||||
consumer:
|
||||
group-id: core-service-ebtp-crypt-consumer
|
||||
auto-offset-reset: latest
|
||||
properties:
|
||||
security.protocol: SASL_PLAINTEXT
|
||||
sasl.mechanism: SCRAM-SHA-256
|
||||
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
|
||||
|
||||
# 天宫 redis 需要使用哨兵进行访问
|
||||
redis:
|
||||
sentinel:
|
||||
master: eshop-redis
|
||||
nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
|
||||
password: Unicom#135
|
||||
|
||||
# 天宫Eureka配置
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://10.242.31.158:5001/eureka
|
||||
instance:
|
||||
prefer-ip-address: true
|
||||
ip-address: 125.32.114.204
|
||||
hostname: 125.32.114.204
|
||||
instance-ip: 125.32.114.204:${server.port}
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
# 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射
|
||||
map-underscore-to-camel-case: true
|
||||
auto-mapping-behavior: full
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath*:com/chinaunicom/mall/ebtp/**/mapper/*Mapper.xml
|
||||
global-config:
|
||||
# 逻辑删除配置
|
||||
db-config:
|
||||
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) @TableLogic
|
||||
logic-delete-value: deleted # 逻辑已删除值
|
||||
logic-not-delete-value: normal # 逻辑未删除
|
||||
|
||||
# --------------feign ------------
|
||||
feign:
|
||||
httpclient:
|
||||
enabled: false
|
||||
okhttp:
|
||||
enabled: true
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connect-timeout: 20000
|
||||
read-timeout: 20000
|
||||
|
||||
hystrix:
|
||||
command:
|
||||
default:
|
||||
execution:
|
||||
timeout:
|
||||
enabled: true
|
||||
isolation:
|
||||
strategy: SEMAPHORE
|
||||
thread:
|
||||
timeoutInMilliseconds: 200000 #熔断超时时间
|
||||
circuitBreaker:
|
||||
sleepWindowInMilliseconds: 20000
|
||||
forceClosed: true
|
||||
|
||||
ribbon:
|
||||
ReadTimeout: 20000 #请求处理的超时时间
|
||||
ConnectTimeout: 20000 #请求连接超时时间
|
||||
MaxAutoRetries: 0 #对当前实例的重试次数
|
||||
MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1
|
||||
|
||||
mconfig:
|
||||
workerId: 1
|
||||
datacenterId: 1
|
||||
# 服务名
|
||||
feign:
|
||||
name:
|
||||
open: biz-service-ebtp-opening #开标大厅服务
|
||||
process: biz-service-ebtp-process #评审流程服务
|
||||
project: biz-service-ebtp-project #项目服务
|
||||
resps: biz-service-ebtp-resps #应答结构化服务
|
||||
rsms: biz-service-ebtp-rsms #评审结构化服务
|
||||
tender: biz-service-ebtp-tender #投标服务
|
||||
documentcenter: core-service-document-center #文档中心
|
||||
usercenter: core-service-usercenter-public #用户中心
|
||||
|
||||
|
||||
document:
|
||||
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
|
||||
|
||||
# 用户暴露给 prometheus 的健康数据
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
cors:
|
||||
allowed-origins: "*"
|
||||
allowed-methods: "*"
|
Reference in New Issue
Block a user