修改dev环境nacos配置、各服务去除nacos指定注册ip、短信对接、nacos中邮箱配置修改

master
le 3 weeks ago
parent ca39d02c9f
commit 6c1bbda6db
  1. 2
      micro-auth/src/main/resources/application.yml
  2. 10
      micro-common/micro-common-mybatis/pom.xml
  3. 2
      micro-gateway/src/main/resources/application.yml
  4. 2
      micro-modules/micro-amnt/src/main/resources/application.yml
  5. 2
      micro-modules/micro-bfs/src/main/resources/application.yml
  6. 2
      micro-modules/micro-bls/src/main/resources/application.yml
  7. 2
      micro-modules/micro-customer/src/main/resources/application.yml
  8. 2
      micro-modules/micro-leaf/src/main/resources/application.yml
  9. 5
      micro-modules/micro-msg/pom.xml
  10. 20
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/config/RestConfig.java
  11. 1
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/constant/MsgConstants.java
  12. 33
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/smsSend/config/NewSmsConfig.java
  13. 154
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/smsSend/domian/Message.java
  14. 18
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/smsSend/domian/MobileNums.java
  15. 34
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/smsSend/domian/PublicInfo.java
  16. 32
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/smsSend/domian/SmsDto.java
  17. 70
      micro-modules/micro-msg/src/main/java/com/sinosoft/msg/core/smsSend/factory/SmsSend.java
  18. 2
      micro-modules/micro-msg/src/main/resources/application.yml
  19. 2
      micro-modules/micro-print/src/main/resources/application.yml
  20. 2
      micro-modules/micro-product/src/main/resources/application.yml
  21. 2
      micro-modules/micro-resource/src/main/resources/application.yml
  22. 2
      micro-modules/micro-risk/src/main/resources/application.yml
  23. 2
      micro-modules/micro-route/src/main/resources/application.yml
  24. 2
      micro-modules/micro-system/src/main/resources/application.yml
  25. 2
      micro-visual/micro-xxljob/src/main/resources/application.yml
  26. 4
      pom.xml

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 49.232.189.43
# ip: 49.232.189.43
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -60,11 +60,11 @@
<!-- <groupId>com.oracle.database.nls</groupId>-->
<!-- <artifactId>orai18n</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; PostgreSql &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.postgresql</groupId>-->
<!-- <artifactId>postgresql</artifactId>-->
<!-- </dependency>-->
<!-- PostgreSql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- &lt;!&ndash; SqlServer &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.microsoft.sqlserver</groupId>-->

@ -23,7 +23,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 49.232.189.43
# ip: 49.232.189.43
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 49.233.1.167
# ip: 49.233.1.167
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 49.232.194.131
# ip: 49.232.194.131
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 49.232.194.131
# ip: 49.232.194.131
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 49.233.1.167
# ip: 49.233.1.167
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 82.156.199.232
# ip: 82.156.199.232
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -144,6 +144,11 @@
<version>21.1.0.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</dependencies>
<build>

@ -0,0 +1,20 @@
package com.sinosoft.msg.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.web.client.RestTemplate;
import java.time.Duration;
@Configuration
public class RestConfig {
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder
.setConnectTimeout(Duration.ofSeconds(10))
.setReadTimeout(Duration.ofSeconds(30))
.build();
}
}

@ -132,4 +132,5 @@ public interface MsgConstants {
//般若短信通道唯一ID
String SUPPLIER_WISDOM = "Wisdom";
String SUPPLIER_NEW="NEW";
}

@ -0,0 +1,33 @@
package com.sinosoft.msg.core.smsSend.config;
import com.sinosoft.common.core.utils.SpringUtils;
import com.sinosoft.msg.core.constant.MsgConstants;
import com.sinosoft.msg.domain.MsgSmsServiceConfig;
import com.sinosoft.msg.service.IMsgSmsServiceConfigService;
import lombok.Data;
import org.dromara.sms4j.provider.config.BaseConfig;
/**
* 梦网科技短信发送配置类
*/
@Data
public class NewSmsConfig extends BaseConfig {
private String url;
private String userName;
private String password;
public NewSmsConfig(){
MsgSmsServiceConfig config = SpringUtils.getBean(IMsgSmsServiceConfigService.class).getSmsServiceConfigBySupplier(getSupplier());
this.url=config.getApiAddress();
this.userName = config.getAccessKeyId();
this.password = config.getAccessKeySecret();
}
@Override
public String getSupplier() {
return MsgConstants.SUPPLIER_NEW;
}
}

@ -0,0 +1,154 @@
package com.sinosoft.msg.core.smsSend.domian;
import javax.xml.bind.annotation.XmlElement;
public class Message {
/**
* 短信id
*/
private String messageId;
/**
* 手机号列表
*/
private MobileNums mobileNums;
/**
* 短信标题
*/
private String messTopic;
/**
* 发送数据;分隔
*/
private String sendData;
/**
*数据类型0使用模版 1不使用模版
*/
private Integer dataType; // 0: 使用模板, 1: 不使用模板
/**
* 发送方式 0: 即时发送, 1: 定时发送
*/
private Integer sendWay; // 0: 即时发送, 1: 定时发送
/**
* 发送日期
*/
private String fixedDate; // 定时日期,可为空
/**
*发送时间
*/
private String fixedTime; // 定时时间,可为空
/**
* 发送机构
*/
private String unitCode; // 发送机构,如 "860000" 代表总部
/**
* 优先级
*/
private Integer dealOrder; // 优先级
/**
* 回执匹配方式
*/
private Integer answerMatch; // 回执匹配方式
@XmlElement(name = "MessageId")
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
@XmlElement(name = "MobileNums")
public MobileNums getMobileNums() {
return mobileNums;
}
public void setMobileNums(MobileNums mobileNums) {
this.mobileNums = mobileNums;
}
@XmlElement(name = "MessTopic")
public String getMessTopic() {
return messTopic;
}
public void setMessTopic(String messTopic) {
this.messTopic = messTopic;
}
@XmlElement(name = "SendData")
public String getSendData() {
return sendData;
}
public void setSendData(String sendData) {
this.sendData = sendData;
}
@XmlElement(name = "DataType")
public Integer getDataType() {
return dataType;
}
public void setDataType(Integer dataType) {
this.dataType = dataType;
}
@XmlElement(name = "SendWay")
public Integer getSendWay() {
return sendWay;
}
public void setSendWay(Integer sendWay) {
this.sendWay = sendWay;
}
@XmlElement(name = "FixedDate")
public String getFixedDate() {
return fixedDate;
}
public void setFixedDate(String fixedDate) {
this.fixedDate = fixedDate;
}
@XmlElement(name = "FixedTime")
public String getFixedTime() {
return fixedTime;
}
public void setFixedTime(String fixedTime) {
this.fixedTime = fixedTime;
}
@XmlElement(name = "UnitCode")
public String getUnitCode() {
return unitCode;
}
public void setUnitCode(String unitCode) {
this.unitCode = unitCode;
}
@XmlElement(name = "DealOrder")
public Integer getDealOrder() {
return dealOrder;
}
public void setDealOrder(Integer dealOrder) {
this.dealOrder = dealOrder;
}
@XmlElement(name = "AnswerMatch")
public Integer getAnswerMatch() {
return answerMatch;
}
public void setAnswerMatch(Integer answerMatch) {
this.answerMatch = answerMatch;
}
}

@ -0,0 +1,18 @@
package com.sinosoft.msg.core.smsSend.domian;
import javax.xml.bind.annotation.XmlElement;
import java.util.List;
public class MobileNums {
private List<String> mobileNum;
@XmlElement(name = "MobileNum")
public List<String> getMobileNum() {
return mobileNum;
}
public void setMobileNum(List<String> mobileNum) {
this.mobileNum = mobileNum;
}
}

@ -0,0 +1,34 @@
package com.sinosoft.msg.core.smsSend.domian;
import javax.xml.bind.annotation.XmlElement;
public class PublicInfo {
/**
* 系统代码
*/
private String systemCode;
/**
* 短信服务代码
*/
private String serviceCode;
@XmlElement(name = "SystemCode")
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
@XmlElement(name = "ServiceCode")
public String getServiceCode() {
return serviceCode;
}
public void setServiceCode(String serviceCode) {
this.serviceCode = serviceCode;
}
}

@ -0,0 +1,32 @@
package com.sinosoft.msg.core.smsSend.domian;
import jakarta.xml.bind.annotation.XmlElement;
import lombok.Data;
import javax.xml.bind.annotation.XmlRootElement;
@Data
@XmlRootElement(name = "Messages")//定义xml根节点
public class SmsDto {
private PublicInfo publicInfo;
private Message message;
@XmlElement(name = "PublicInfo")
public PublicInfo getPublicInfo() {
return publicInfo;
}
public void setPublicInfo(PublicInfo publicInfo) {
this.publicInfo = publicInfo;
}
@XmlElement(name = "Message")
public Message getMessage() {
return message;
}
public void setMessage(Message message) {
this.message = message;
}
}

@ -3,6 +3,7 @@ package com.sinosoft.msg.core.smsSend.factory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import com.sinosoft.common.core.constant.Constants;
import com.sinosoft.common.core.exception.ServiceException;
import com.sinosoft.common.core.utils.StringUtils;
@ -10,6 +11,10 @@ import com.sinosoft.msg.core.constant.MsgConstants;
import com.sinosoft.msg.core.enums.SendTypeByLogEnum;
import com.sinosoft.msg.core.risk.domain.RiskDecision;
import com.sinosoft.msg.core.smsSend.blend.ISmsBlend;
import com.sinosoft.msg.core.smsSend.domian.Message;
import com.sinosoft.msg.core.smsSend.domian.MobileNums;
import com.sinosoft.msg.core.smsSend.domian.PublicInfo;
import com.sinosoft.msg.core.smsSend.domian.SmsDto;
import com.sinosoft.msg.core.smsSend.utils.SmsSendUtil;
import com.sinosoft.msg.core.util.DateTimeUtils;
import com.sinosoft.msg.domain.MsgSmsSendLog;
@ -28,13 +33,16 @@ import org.dromara.sms4j.core.factory.SmsFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
/**
* 短信发送工厂
@ -58,6 +66,9 @@ public class SmsSend {
@Autowired
private RedisProcessService redisProcessService;
@Autowired
private RestTemplate restTemplate;
@Value("${sms.send.enabled}")
private String smsSendEnabled; //挡板
@ -141,7 +152,58 @@ public class SmsSend {
//发送短信
SmsResponse response = new SmsResponse();
if(smsSendEnabled.equals("true")){
//如果供应商是NEW(不知道是什么厂商随便起的名字)的执行新的短信发送逻辑
if (MsgConstants.SUPPLIER_NEW.equals(serviceConfig.getSupplier())){
//构建发送的xml报文
SmsDto smsDto = new SmsDto();
PublicInfo publicInfo = new PublicInfo();
Message message = new Message();
smsDto.setPublicInfo(publicInfo);
smsDto.setMessage(message);
//设置publicInfo节点
publicInfo.setServiceCode("**");
publicInfo.setSystemCode("**");
//设置message节点
message.setMessageId("");
MobileNums mobileNums = new MobileNums();
List<String> phoneList = Arrays.asList(phone);
mobileNums.setMobileNum(phoneList);
message.setMobileNums(mobileNums);
message.setMessTopic(configVo.getTemplateName());
String paramsStr = parms.entrySet().stream()
.map(entry -> entry.getKey() + "=" + entry.getValue())
.collect(Collectors.joining(";"));
message.setSendData(paramsStr);
message.setDataType(0);
message.setSendWay(0);
message.setUnitCode(bo.getSystem());
message.setDealOrder(0);
message.setAnswerMatch(0);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_XML);
headers.setAccept(java.util.Collections.singletonList(MediaType.APPLICATION_XML));
HttpEntity<SmsDto> entity = new HttpEntity<>(smsDto, headers);
try {
ResponseEntity<String> response1 = restTemplate.postForEntity(serviceConfig.getApiAddress()+"?userName="
+serviceConfig.getAccessKeyId()+"&password="+serviceConfig.getAccessKeySecret(), entity, String.class);
if (response1.getStatusCode().is2xxSuccessful()) {
System.out.println(response1.getBody());
// return response1.getBody();
} else {
throw new RuntimeException("调用失败,状态码: " + response1.getStatusCode());
}
} catch (Exception e) {
throw new RuntimeException("发送短信异常: " + e.getMessage(), e);
}
}else {
response = SmsSendUtil.sendMessage(phone, messageTotal,serviceConfig.getSupplier());
}
log.info("SmsSend-send,response={},是否成功={}",response,response.isSuccess());
}else{
response.setSuccess(Boolean.TRUE);

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 101.42.50.5
# ip: 101.42.50.5
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -20,7 +20,7 @@ spring:
username: @nacos.username@
password: @nacos.password@
discovery:
ip: 140.143.188.53
# ip: 140.143.188.53
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -20,7 +20,7 @@ spring:
username: @nacos.username@
password: @nacos.password@
discovery:
ip: 49.232.199.232
# ip: 49.232.199.232
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -20,7 +20,7 @@ spring:
username: @nacos.username@
password: @nacos.password@
discovery:
ip: 140.143.188.53
# ip: 140.143.188.53
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -20,7 +20,7 @@ spring:
username: @nacos.username@
password: @nacos.password@
discovery:
ip: 101.42.30.227
# ip: 101.42.30.227
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -22,7 +22,7 @@ spring:
username: @nacos.username@
password: @nacos.password@
discovery:
ip: 101.42.30.227
# ip: 101.42.30.227
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 101.42.50.5
# ip: 101.42.50.5
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -21,7 +21,7 @@ spring:
password: @nacos.password@
discovery:
# 注册IP,为了方便测试,写死部署的服务器IP
ip: 82.156.199.232
# ip: 82.156.199.232
# 注册组
group: @nacos.discovery.group@
namespace: ${spring.profiles.active}

@ -75,8 +75,8 @@
<id>dev</id>
<properties>
<!-- 环境标识,需要与配置文件的名称相对应 -->
<profiles.active>lijingbodev</profiles.active>
<nacos.server>82.157.198.128:8848</nacos.server>
<profiles.active>micro-dev-z</profiles.active>
<nacos.server>106.54.18.101:8848</nacos.server>
<nacos.discovery.group>DEFAULT_GROUP</nacos.discovery.group>
<nacos.config.group>DEFAULT_GROUP</nacos.config.group>
<nacos.username>nacos</nacos.username>

Loading…
Cancel
Save