Просмотр исходного кода

[短信验证码][修改]:发送验证码代码,把B端判断放到controller

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
ba8ac8e2c2
2 измененных файлов: 36 добавлений и 23 удалений
  1. +36
    -0
      mallinkBApi/src/main/java/com/simple/controller/WxMsgValidationcodeController.java
  2. +0
    -23
      mallinkService/src/main/java/com/simple/service/impl/WxMsgValidationcodeServiceImpl.java

+ 36
- 0
mallinkBApi/src/main/java/com/simple/controller/WxMsgValidationcodeController.java Просмотреть файл

@@ -1,7 +1,12 @@
package com.simple.controller;

import com.simple.common.ErrorCode;
import com.simple.common.ResultData;
import com.simple.domain.po.WxMerchant;
import com.simple.domain.po.WxMerchantBUser;
import com.simple.domain.po.WxMsgValidationcode;
import com.simple.service.WxMerchantBUserService;
import com.simple.service.WxMerchantService;
import com.simple.service.WxMsgValidationcodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -21,6 +26,14 @@ public class WxMsgValidationcodeController extends BaseController {
@Autowired
private WxMsgValidationcodeService wxMsgValidationcodeService;

@Autowired
private WxMerchantBUserService wxMerchantBUserService;

@Autowired
private WxMerchantService wxMerchantService;



@GetMapping("sendvalidationcode")
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantId", value = "租户ID", dataType = "String", paramType = "query"),
@@ -28,6 +41,29 @@ public class WxMsgValidationcodeController extends BaseController {
@ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true),
@ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)})
public ResultData sendvalidationcode(String tenantId, String phone, Integer type, String appid) {

WxMerchantBUser user = new WxMerchantBUser();
user.setAppId(appid);
user.setPhone(phone);

WxMerchantBUser buser=wxMerchantBUserService.getBUserByAppId(user);
if (buser==null) {
logger.error("B端用户不存在, phone: " + phone);
return new ResultData(ErrorCode.USER_IS_EMPTY);
}


WxMerchant merchant = wxMerchantService.getById(user.getMerchantId());
if (merchant==null) {
logger.error("B端所在商户不存在, id: " + user.getMerchantId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}

if(merchant.getStatus()==0){
logger.error("B端所在商户已停用, id: " + merchant.getId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
wxMsgValidationcode.setTenantId(tenantId);
wxMsgValidationcode.setPhone(phone);


+ 0
- 23
mallinkService/src/main/java/com/simple/service/impl/WxMsgValidationcodeServiceImpl.java Просмотреть файл

@@ -78,29 +78,6 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic
@Override
public ResultData sendvalidationcode(WxMsgValidationcode wxMsgValidationcode) {

WxMerchantBUser user = new WxMerchantBUser();
user.setAppId(wxMsgValidationcode.getAppid());
user.setPhone(wxMsgValidationcode.getPhone());

List<WxMerchantBUser> userList = wxMerchantBUserMapper.findList(user);
if (userList.size()==0) {
logger.error("B端用户不存在, phone: " + wxMsgValidationcode.getPhone());
return new ResultData(ErrorCode.USER_IS_EMPTY);
}

WxMerchant wxMerchant = new WxMerchant();
wxMerchant.setId(userList.get(0).getMerchantId());
List<WxMerchant> merchantList = wxMerchantMapper.findList(wxMerchant);
if (merchantList.size()==0) {
logger.error("B端所在商户不存在, id: " + userList.get(0).getId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}

wxMerchant = merchantList.get(0);
if(wxMerchant.getStatus()==0){
logger.error("B端所在商户已停用, id: " + userList.get(0).getId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

//1、查看是否存在未过期的短信,有返回成功 没有继续
List<WxMsgValidationcode> wxmsgvalidationcodelist = wxMsgValidationcodeMapper.findList(wxMsgValidationcode);


Загрузка…
Отмена
Сохранить