| @@ -22,6 +22,7 @@ import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| 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; | ||||
| @@ -135,6 +136,14 @@ public class WxCashOutController extends BaseController { | |||||
| @PostMapping("cashout") | @PostMapping("cashout") | ||||
| public ResultData cashout(@RequestBody WxCashOut wxCashOut) { | public ResultData cashout(@RequestBody WxCashOut wxCashOut) { | ||||
| WxMerchantBUser buser = getLoginBUser(); | WxMerchantBUser buser = getLoginBUser(); | ||||
| WxBuser wxBUser = getWxBuser(); | |||||
| WxMerchant merchant = wxMerchantService.getById(buser.getMerchantId()); | |||||
| if ((!StringUtils.isBlank(wxBUser.getPhone())) && wxBUser.getPhone().equals(merchant.getLinkPhone()) ) { | |||||
| //do nothing | |||||
| }else { | |||||
| return new ResultData(Result.ERROR,"当前微信绑定的手机号["+wxBUser.getPhone()+"]非商户的联系手机号"); | |||||
| } | |||||
| //当前管理员的账户必须在c端授权了 | //当前管理员的账户必须在c端授权了 | ||||
| try { | try { | ||||
| WxCUser mUser = getCurrentCUser(buser); | WxCUser mUser = getCurrentCUser(buser); | ||||
| @@ -148,7 +157,7 @@ public class WxCashOutController extends BaseController { | |||||
| return new ResultData(Result.ERROR,buser.getPhone()+"匹配C端用户失败,该情况可能是存在多个微信对应统一手机号,请联系管理员处理, 。"); | return new ResultData(Result.ERROR,buser.getPhone()+"匹配C端用户失败,该情况可能是存在多个微信对应统一手机号,请联系管理员处理, 。"); | ||||
| } | } | ||||
| return wxCashOutService.applyCashout(buser, wxCashOut,EnumPayWay.PAY_WAY_WECHAT); | |||||
| return wxCashOutService.applyCashout(buser, wxCashOut,merchant,EnumPayWay.PAY_WAY_WECHAT); | |||||
| } | } | ||||
| // @ApiOperation("微信B端重新提现") | // @ApiOperation("微信B端重新提现") | ||||
| @@ -35,7 +35,7 @@ public interface WxCashOutService { | |||||
| void createCashOut(WxCashOut record); | void createCashOut(WxCashOut record); | ||||
| ResultData applyCashout(WxMerchantBUser buser,WxCashOut record,EnumPayWay payWay); | |||||
| ResultData applyCashout(WxMerchantBUser buser,WxCashOut record,WxMerchant merchant,EnumPayWay payWay); | |||||
| public void sendCashOutMsg(TenantEntity tenantEntity, Long cashOutId,EnumPayWay payWay); | public void sendCashOutMsg(TenantEntity tenantEntity, Long cashOutId,EnumPayWay payWay); | ||||
| @@ -93,15 +93,14 @@ public class WxCashOutServiceImpl implements WxCashOutService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData applyCashout(WxMerchantBUser buser, WxCashOut record,EnumPayWay payWay) { | |||||
| public ResultData applyCashout(WxMerchantBUser buser, WxCashOut record,WxMerchant merchant,EnumPayWay payWay) { | |||||
| WxMall mall = wxMallMapper.getByTenantId(buser.getTenantId()); | WxMall mall = wxMallMapper.getByTenantId(buser.getTenantId()); | ||||
| if (EnumCashOut.NO.getCode().intValue() == mall.getCashOutSupport().intValue()) { | if (EnumCashOut.NO.getCode().intValue() == mall.getCashOutSupport().intValue()) { | ||||
| return new ResultData(Result.ERROR,"当前租户不支持商户提现。"); | return new ResultData(Result.ERROR,"当前租户不支持商户提现。"); | ||||
| } | } | ||||
| //只有商户管理员才能进行此操作 | //只有商户管理员才能进行此操作 | ||||
| WxMerchant merchant = wxMerchantMapper.selectById(buser.getMerchantId()); | |||||
| if (!(buser.getPhone().equals(merchant.getLinkPhone()))) { | if (!(buser.getPhone().equals(merchant.getLinkPhone()))) { | ||||
| return new ResultData(Result.ERROR,"当前账号非商户管理员,不能进行此操作。"); | |||||
| return new ResultData(Result.ERROR,"当前账号不是商户的联系手机号,不能进行此操作。"); | |||||
| } | } | ||||
| if(!hasCashCount(mall,merchant)) { | if(!hasCashCount(mall,merchant)) { | ||||