|
|
|
@@ -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); |
|
|
|
|