mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-04-27 13:09:36 +08:00
修复短信发送问题
This commit is contained in:
@@ -27,12 +27,12 @@ public class LoginRequest implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号", required = true, example = "18991352728")
|
@ApiModelProperty(value = "手机号", required = true, example = "18888888")
|
||||||
@Pattern(regexp = RegularConstants.PHONE, message = "手机号码格式错误")
|
@Pattern(regexp = RegularConstants.PHONE, message = "手机号码格式错误")
|
||||||
@JsonProperty(value = "account")
|
@JsonProperty(value = "account")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "密码", required = true, example = "Abc123")
|
@ApiModelProperty(value = "密码", required = true, example = "1~[6,18]")
|
||||||
@Pattern(regexp = RegularConstants.PASSWORD, message = "密码格式错误,密码必须以字母开头,长度在6~18之间,只能包含字符、数字和下划线")
|
@Pattern(regexp = RegularConstants.PASSWORD, message = "密码格式错误,密码必须以字母开头,长度在6~18之间,只能包含字符、数字和下划线")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
|||||||
@@ -185,9 +185,9 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 检测支付方式
|
// 检测支付方式
|
||||||
if(!orderUtils.checkPayType(request.getPayType())) throw new CrmebException("暂不支持该支付方式,请刷新页面或者联系管理员");
|
if(!orderUtils.checkPayType(request.getPayType())) throw new CrmebException("暂不支持该支付方式,请刷新页面或者联系管理员");
|
||||||
|
|
||||||
Integer isChannel = 1;
|
// Integer isChannel = 1;
|
||||||
if(request.getFrom() == "weixin") isChannel = 0;
|
// if(request.getFrom() == "weixin") isChannel = 0;
|
||||||
if(request.getFrom() == "weixinh5") isChannel = 2;
|
// if(request.getFrom() == "weixinh5") isChannel = 2;
|
||||||
String existCacheOrder = orderUtils.cacheGetOrderInfo(userService.getUserIdException(), orderKey);
|
String existCacheOrder = orderUtils.cacheGetOrderInfo(userService.getUserIdException(), orderKey);
|
||||||
ConfirmOrderResponse cor = JSONObject.parseObject(existCacheOrder,ConfirmOrderResponse.class);
|
ConfirmOrderResponse cor = JSONObject.parseObject(existCacheOrder,ConfirmOrderResponse.class);
|
||||||
if(null == existCacheOrder) throw new CrmebException("订单已过期,请刷新当前页面!");
|
if(null == existCacheOrder) throw new CrmebException("订单已过期,请刷新当前页面!");
|
||||||
|
|||||||
@@ -440,11 +440,15 @@ public class SmsServiceImpl implements SmsService {
|
|||||||
JSONObject data = joResult.getJSONObject("data");
|
JSONObject data = joResult.getJSONObject("data");
|
||||||
String smsRecodeId = (data.containsKey("id") ? data.getString("id") : "0");
|
String smsRecodeId = (data.containsKey("id") ? data.getString("id") : "0");
|
||||||
|
|
||||||
|
try{
|
||||||
// 注意这里的状态仅仅是调用是否成功的状态 需要等待5分钟一周另外一个任务去查询发送状态后再更新status数据
|
// 注意这里的状态仅仅是调用是否成功的状态 需要等待5分钟一周另外一个任务去查询发送状态后再更新status数据
|
||||||
SmsRecord smsRecord = new SmsRecord(0,sendSmsVo.getUid(), sendSmsVo.getMobile(),sendSmsVo.getContent(),
|
SmsRecord smsRecord = new SmsRecord(0,sendSmsVo.getUid(), sendSmsVo.getMobile(),sendSmsVo.getContent(),
|
||||||
"", sendSmsVo.getTemplate().toString(),
|
"", sendSmsVo.getTemplate().toString(),
|
||||||
resultCode,Integer.parseInt(smsRecodeId), message);
|
resultCode,Integer.parseInt(smsRecodeId), message);
|
||||||
smsRecordService.save(smsRecord);
|
smsRecordService.save(smsRecord);
|
||||||
|
}catch (Exception e){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// 添加到短信实际发送状态队列
|
// 添加到短信实际发送状态队列
|
||||||
if(smsRecodeId.length() > 0){
|
if(smsRecodeId.length() > 0){
|
||||||
List<Integer> recordsIds = new ArrayList<>();
|
List<Integer> recordsIds = new ArrayList<>();
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ import javax.validation.constraints.NotEmpty;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SystemAdminLoginRequest {
|
public class SystemAdminLoginRequest {
|
||||||
@ApiModelProperty(value = "后台管理员账号", example = "admin")
|
@ApiModelProperty(value = "后台管理员账号", example = "userName")
|
||||||
@NotEmpty(message = "账号 不能为空")
|
@NotEmpty(message = "账号 不能为空")
|
||||||
private String account;
|
private String account;
|
||||||
|
|
||||||
@ApiModelProperty(value = "后台管理员密码", example = "123456")
|
@ApiModelProperty(value = "后台管理员密码", example = "userPassword")
|
||||||
@NotEmpty(message = "密码 不能为空")
|
@NotEmpty(message = "密码 不能为空")
|
||||||
private String pwd;
|
private String pwd;
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ import com.zbkj.crmeb.system.service.SystemConfigService;
|
|||||||
import com.zbkj.crmeb.system.service.SystemFormTempService;
|
import com.zbkj.crmeb.system.service.SystemFormTempService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mr.Zhang
|
* @author Mr.Zhang
|
||||||
@@ -45,6 +47,9 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
|
|
||||||
private static final String redisKey = Constants.CONFIG_LIST;
|
private static final String redisKey = Constants.CONFIG_LIST;
|
||||||
|
|
||||||
|
@Value("${server.asyncConfig}")
|
||||||
|
private Boolean asyncConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索列表
|
* 搜索列表
|
||||||
* @param pageParamRequest PageParamRequest 分页参数
|
* @param pageParamRequest PageParamRequest 分页参数
|
||||||
@@ -148,7 +153,11 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
//删除之前隐藏的数据
|
//删除之前隐藏的数据
|
||||||
deleteStatusByFormId(systemFormCheckRequest.getId());
|
deleteStatusByFormId(systemFormCheckRequest.getId());
|
||||||
|
|
||||||
async(systemConfigList);
|
List<SystemConfig> forAsyncPram = systemConfigList.stream().map(e -> {
|
||||||
|
e.setStatus(true);
|
||||||
|
return e;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
async(forAsyncPram);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -225,7 +234,8 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
@Override
|
@Override
|
||||||
public HashMap<String, String> info(Integer formId){
|
public HashMap<String, String> info(Integer formId){
|
||||||
LambdaQueryWrapper<SystemConfig> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SystemConfig> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper1.eq(SystemConfig::getStatus, false).eq(SystemConfig::getFormId, formId);
|
// lambdaQueryWrapper1.eq(SystemConfig::getStatus, false).eq(SystemConfig::getFormId, formId);
|
||||||
|
lambdaQueryWrapper1.eq(SystemConfig::getFormId, formId);
|
||||||
List<SystemConfig> systemConfigList = dao.selectList(lambdaQueryWrapper1);
|
List<SystemConfig> systemConfigList = dao.selectList(lambdaQueryWrapper1);
|
||||||
if(systemConfigList.size() < 1){
|
if(systemConfigList.size() < 1){
|
||||||
return null;
|
return null;
|
||||||
@@ -281,6 +291,11 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
private void async(List<SystemConfig> systemConfigList){
|
private void async(List<SystemConfig> systemConfigList){
|
||||||
|
if (!asyncConfig) {
|
||||||
|
//如果配置没有开启
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (SystemConfig systemConfig : systemConfigList) {
|
for (SystemConfig systemConfig : systemConfigList) {
|
||||||
if(systemConfig.getStatus()){
|
if(systemConfig.getStatus()){
|
||||||
//隐藏之后,删除redis的数据
|
//隐藏之后,删除redis的数据
|
||||||
@@ -299,6 +314,10 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
private void deleteRedis(String name){
|
private void deleteRedis(String name){
|
||||||
|
if (!asyncConfig) {
|
||||||
|
//如果配置没有开启
|
||||||
|
return;
|
||||||
|
}
|
||||||
redisUtil.hmDelete(redisKey, name);
|
redisUtil.hmDelete(redisKey, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,6 +329,18 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
private String get(String name){
|
private String get(String name){
|
||||||
|
if (!asyncConfig) {
|
||||||
|
//如果配置没有开启
|
||||||
|
LambdaQueryWrapper<SystemConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(SystemConfig::getStatus, false).eq(SystemConfig::getName, name);
|
||||||
|
SystemConfig systemConfig = dao.selectOne(lambdaQueryWrapper);
|
||||||
|
if(null == systemConfig || StringUtils.isBlank(systemConfig.getValue())){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return systemConfig.getValue();
|
||||||
|
|
||||||
|
}
|
||||||
setRedisByVoList();
|
setRedisByVoList();
|
||||||
Object data = redisUtil.hmGet(redisKey, name);
|
Object data = redisUtil.hmGet(redisKey, name);
|
||||||
if(null == data || StringUtils.isBlank(data.toString())){
|
if(null == data || StringUtils.isBlank(data.toString())){
|
||||||
@@ -318,8 +349,6 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
}
|
}
|
||||||
|
|
||||||
//去数据库查找,然后写入redis
|
//去数据库查找,然后写入redis
|
||||||
|
|
||||||
|
|
||||||
return data.toString();
|
return data.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +361,7 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
private void setRedisByVoList(){
|
private void setRedisByVoList(){
|
||||||
//检测redis是否为空
|
//检测redis是否为空
|
||||||
Long size = redisUtil.getHashSize(redisKey);
|
Long size = redisUtil.getHashSize(redisKey);
|
||||||
if(size > 0){
|
if(size > 0 || !asyncConfig){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zbkj.crmeb.task;
|
package com.zbkj.crmeb.task.cloud;
|
||||||
|
|
||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zbkj.crmeb.task;
|
package com.zbkj.crmeb.task.sms;
|
||||||
|
|
||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.sms.service.SmsService;
|
import com.zbkj.crmeb.sms.service.SmsService;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zbkj.crmeb.task;
|
package com.zbkj.crmeb.task.sms;
|
||||||
|
|
||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.sms.model.SmsRecord;
|
import com.zbkj.crmeb.sms.model.SmsRecord;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.zbkj.crmeb.task;
|
package com.zbkj.crmeb.task.wechat;
|
||||||
|
|
||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.zbkj.crmeb.task;
|
package com.zbkj.crmeb.task.wechat;
|
||||||
|
|
||||||
import com.constants.Constants;
|
|
||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
|
||||||
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
||||||
import com.zbkj.crmeb.wechat.service.WeChatService;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -5,6 +5,8 @@ server:
|
|||||||
wechat-api-url:
|
wechat-api-url:
|
||||||
wechat-js-api-debug: false
|
wechat-js-api-debug: false
|
||||||
wechat-js-api-beta: false
|
wechat-js-api-beta: false
|
||||||
|
asyncConfig: true
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
# 配置的环境
|
# 配置的环境
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8080
|
||||||
domain:
|
domain:
|
||||||
wechat-api-url: 微信消息转发服务器http地址
|
wechat-api-url: #微信消息转发服务器http地址
|
||||||
wechat-js-api-debug: true
|
wechat-js-api-debug: true
|
||||||
wechat-js-api-beta: true
|
wechat-js-api-beta: true
|
||||||
|
asyncConfig: false
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
|
|||||||
Reference in New Issue
Block a user