修复短信发送问题
This commit is contained in:
@@ -27,12 +27,12 @@ public class LoginRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "18991352728")
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "18888888")
|
||||
@Pattern(regexp = RegularConstants.PHONE, message = "手机号码格式错误")
|
||||
@JsonProperty(value = "account")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "密码", required = true, example = "Abc123")
|
||||
@ApiModelProperty(value = "密码", required = true, example = "1~[6,18]")
|
||||
@Pattern(regexp = RegularConstants.PASSWORD, message = "密码格式错误,密码必须以字母开头,长度在6~18之间,只能包含字符、数字和下划线")
|
||||
private String password;
|
||||
|
||||
|
||||
@@ -185,9 +185,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 检测支付方式
|
||||
if(!orderUtils.checkPayType(request.getPayType())) throw new CrmebException("暂不支持该支付方式,请刷新页面或者联系管理员");
|
||||
|
||||
Integer isChannel = 1;
|
||||
if(request.getFrom() == "weixin") isChannel = 0;
|
||||
if(request.getFrom() == "weixinh5") isChannel = 2;
|
||||
// Integer isChannel = 1;
|
||||
// if(request.getFrom() == "weixin") isChannel = 0;
|
||||
// if(request.getFrom() == "weixinh5") isChannel = 2;
|
||||
String existCacheOrder = orderUtils.cacheGetOrderInfo(userService.getUserIdException(), orderKey);
|
||||
ConfirmOrderResponse cor = JSONObject.parseObject(existCacheOrder,ConfirmOrderResponse.class);
|
||||
if(null == existCacheOrder) throw new CrmebException("订单已过期,请刷新当前页面!");
|
||||
|
||||
@@ -440,11 +440,15 @@ public class SmsServiceImpl implements SmsService {
|
||||
JSONObject data = joResult.getJSONObject("data");
|
||||
String smsRecodeId = (data.containsKey("id") ? data.getString("id") : "0");
|
||||
|
||||
// 注意这里的状态仅仅是调用是否成功的状态 需要等待5分钟一周另外一个任务去查询发送状态后再更新status数据
|
||||
SmsRecord smsRecord = new SmsRecord(0,sendSmsVo.getUid(), sendSmsVo.getMobile(),sendSmsVo.getContent(),
|
||||
"", sendSmsVo.getTemplate().toString(),
|
||||
resultCode,Integer.parseInt(smsRecodeId), message);
|
||||
smsRecordService.save(smsRecord);
|
||||
try{
|
||||
// 注意这里的状态仅仅是调用是否成功的状态 需要等待5分钟一周另外一个任务去查询发送状态后再更新status数据
|
||||
SmsRecord smsRecord = new SmsRecord(0,sendSmsVo.getUid(), sendSmsVo.getMobile(),sendSmsVo.getContent(),
|
||||
"", sendSmsVo.getTemplate().toString(),
|
||||
resultCode,Integer.parseInt(smsRecodeId), message);
|
||||
smsRecordService.save(smsRecord);
|
||||
}catch (Exception e){
|
||||
return true;
|
||||
}
|
||||
// 添加到短信实际发送状态队列
|
||||
if(smsRecodeId.length() > 0){
|
||||
List<Integer> recordsIds = new ArrayList<>();
|
||||
|
||||
@@ -15,11 +15,11 @@ import javax.validation.constraints.NotEmpty;
|
||||
*/
|
||||
@Data
|
||||
public class SystemAdminLoginRequest {
|
||||
@ApiModelProperty(value = "后台管理员账号", example = "admin")
|
||||
@ApiModelProperty(value = "后台管理员账号", example = "userName")
|
||||
@NotEmpty(message = "账号 不能为空")
|
||||
private String account;
|
||||
|
||||
@ApiModelProperty(value = "后台管理员密码", example = "123456")
|
||||
@ApiModelProperty(value = "后台管理员密码", example = "userPassword")
|
||||
@NotEmpty(message = "密码 不能为空")
|
||||
private String pwd;
|
||||
|
||||
|
||||
@@ -16,12 +16,14 @@ import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||
import com.zbkj.crmeb.system.service.SystemFormTempService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Mr.Zhang
|
||||
@@ -45,6 +47,9 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
|
||||
private static final String redisKey = Constants.CONFIG_LIST;
|
||||
|
||||
@Value("${server.asyncConfig}")
|
||||
private Boolean asyncConfig;
|
||||
|
||||
/**
|
||||
* 搜索列表
|
||||
* @param pageParamRequest PageParamRequest 分页参数
|
||||
@@ -148,7 +153,11 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
//删除之前隐藏的数据
|
||||
deleteStatusByFormId(systemFormCheckRequest.getId());
|
||||
|
||||
async(systemConfigList);
|
||||
List<SystemConfig> forAsyncPram = systemConfigList.stream().map(e -> {
|
||||
e.setStatus(true);
|
||||
return e;
|
||||
}).collect(Collectors.toList());
|
||||
async(forAsyncPram);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -225,7 +234,8 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
@Override
|
||||
public HashMap<String, String> info(Integer formId){
|
||||
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);
|
||||
if(systemConfigList.size() < 1){
|
||||
return null;
|
||||
@@ -281,6 +291,11 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
* @return JSONObject
|
||||
*/
|
||||
private void async(List<SystemConfig> systemConfigList){
|
||||
if (!asyncConfig) {
|
||||
//如果配置没有开启
|
||||
return;
|
||||
}
|
||||
|
||||
for (SystemConfig systemConfig : systemConfigList) {
|
||||
if(systemConfig.getStatus()){
|
||||
//隐藏之后,删除redis的数据
|
||||
@@ -299,6 +314,10 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
* @return JSONObject
|
||||
*/
|
||||
private void deleteRedis(String name){
|
||||
if (!asyncConfig) {
|
||||
//如果配置没有开启
|
||||
return;
|
||||
}
|
||||
redisUtil.hmDelete(redisKey, name);
|
||||
}
|
||||
|
||||
@@ -310,6 +329,18 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
* @return JSONObject
|
||||
*/
|
||||
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();
|
||||
Object data = redisUtil.hmGet(redisKey, name);
|
||||
if(null == data || StringUtils.isBlank(data.toString())){
|
||||
@@ -318,8 +349,6 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
}
|
||||
|
||||
//去数据库查找,然后写入redis
|
||||
|
||||
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
@@ -332,7 +361,7 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
private void setRedisByVoList(){
|
||||
//检测redis是否为空
|
||||
Long size = redisUtil.getHashSize(redisKey);
|
||||
if(size > 0){
|
||||
if(size > 0 || !asyncConfig){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zbkj.crmeb.task;
|
||||
package com.zbkj.crmeb.task.cloud;
|
||||
|
||||
import com.utils.DateUtil;
|
||||
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.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.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.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.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
||||
import com.zbkj.crmeb.wechat.service.WeChatService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -5,6 +5,8 @@ server:
|
||||
wechat-api-url:
|
||||
wechat-js-api-debug: false
|
||||
wechat-js-api-beta: false
|
||||
asyncConfig: true
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
# 配置的环境
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
server:
|
||||
port: 8080
|
||||
domain:
|
||||
wechat-api-url: 微信消息转发服务器http地址
|
||||
wechat-api-url: #微信消息转发服务器http地址
|
||||
wechat-js-api-debug: true
|
||||
wechat-js-api-beta: true
|
||||
asyncConfig: false
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#
|
||||
# Host: 127.0.0.1 (MySQL 5.7.23)
|
||||
# Database: crmeb_java
|
||||
# Generation Time: 2020-08-26 02:49:50 +0000
|
||||
# Generation Time: 2020-08-28 05:02:57 +0000
|
||||
# ************************************************************
|
||||
|
||||
|
||||
@@ -754,12 +754,12 @@ CREATE TABLE `eb_sms_record` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '短信发送记录编号',
|
||||
`uid` varchar(255) NOT NULL COMMENT '短信平台账号',
|
||||
`phone` char(11) NOT NULL COMMENT '接受短信的手机号',
|
||||
`content` text NOT NULL COMMENT '短信内容',
|
||||
`content` text COMMENT '短信内容',
|
||||
`add_ip` varchar(30) DEFAULT NULL COMMENT '添加记录ip',
|
||||
`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`template` varchar(255) NOT NULL COMMENT '短信模板ID',
|
||||
`resultcode` int(6) unsigned NOT NULL COMMENT '状态码 100=成功,130=失败,131=空号,132=停机,133=关机,134=无状态',
|
||||
`record_id` int(11) unsigned NOT NULL COMMENT '发送记录id',
|
||||
`template` varchar(255) DEFAULT '' COMMENT '短信模板ID',
|
||||
`resultcode` int(6) unsigned DEFAULT NULL COMMENT '状态码 100=成功,130=失败,131=空号,132=停机,133=关机,134=无状态',
|
||||
`record_id` int(11) unsigned DEFAULT NULL COMMENT '发送记录id',
|
||||
`memo` text COMMENT '短信平台返回信息',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短信发送记录表';
|
||||
|
||||
Reference in New Issue
Block a user