Przeglądaj źródła

[B端账单][查询][查询条件要传入tenantId和merchantId]

release_toaliyun_real
gongbiao 7 lat temu
rodzic
commit
1cf597dce8
2 zmienionych plików z 96 dodań i 71 usunięć
  1. +88
    -67
      mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java
  2. +8
    -4
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java

+ 88
- 67
mallinkBApi/src/main/java/com/iformall/controller/WxBillController.java Wyświetl plik

@@ -4,15 +4,14 @@ package com.iformall.controller;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
import com.iformall.domain.vo.WxBillAll;
import com.iformall.enums.EnumMerchantBUserStatus;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.service.WxBillAllService;
import com.iformall.service.WxMerchantBUserService;
import com.iformall.service.WxMerchantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,40 +46,51 @@ public class WxBillController extends BaseController {
public ResultData listBillOweAndWaitPay(@RequestBody WxBillAll wxBillAll) {


WxMerchantBUser wxMerchantBUser = new WxMerchantBUser();
wxMerchantBUser.setAppId(wxBillAll.getAppId());
wxMerchantBUser.setStatus(EnumMerchantBUserStatus.VALID.getCode());
try {
wxMerchantBUser = wxMerchantBUserService.getBUserByAppId(wxMerchantBUser);
} catch (Exception e) {
logger.error(e.getMessage());
logger.error("B端用户不存在");
return new ResultData(ErrorCode.USER_IS_EMPTY);
// WxMerchantBUser wxMerchantBUser = new WxMerchantBUser();
// wxMerchantBUser.setAppId(wxBillAll.getAppId());
// wxMerchantBUser.setStatus(EnumMerchantBUserStatus.VALID.getCode());
// try {
// wxMerchantBUser = wxMerchantBUserService.getBUserByAppId(wxMerchantBUser);
// } catch (Exception e) {
// logger.error(e.getMessage());
// logger.error("B端用户不存在");
// return new ResultData(ErrorCode.USER_IS_EMPTY);
// }
// WxMerchant merchant = null;
// if (wxMerchantBUser != null) {
// // check merchant 状态
// try {
// merchant = wxMerchantService.getById(wxMerchantBUser.getMerchantId());
// } catch (Exception e) {
// logger.error(ErrorCode.DB_FAIL.getMessage() + ": " + wxMerchantBUser.getMerchantId() + e.getMessage());
// return new ResultData(ErrorCode.DB_FAIL);
// }
// if (merchant == null) {
// logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + wxMerchantBUser.getMerchantId());
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
// }
// if (merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) {
// logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + wxMerchantBUser.getMerchantId());
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
// }
// } else {
// logger.error("B端用户不存在");
// return new ResultData(ErrorCode.USER_IS_EMPTY);
// }

if(StringUtils.isEmpty(wxBillAll.getTenantId())){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId不能为空");
}
WxMerchant merchant = null;
if (wxMerchantBUser != null) {
// check merchant 状态
try {
merchant = wxMerchantService.getById(wxMerchantBUser.getMerchantId());
} catch (Exception e) {
logger.error(ErrorCode.DB_FAIL.getMessage() + ": " + wxMerchantBUser.getMerchantId() + e.getMessage());
return new ResultData(ErrorCode.DB_FAIL);
}
if (merchant == null) {
logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + wxMerchantBUser.getMerchantId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
if (merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) {
logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + wxMerchantBUser.getMerchantId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}
} else {
logger.error("B端用户不存在");
return new ResultData(ErrorCode.USER_IS_EMPTY);
if(wxBillAll.getMerchantId()==null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId不能为空");
}
WxMerchant wxMerchant = wxMerchantService.getById(wxBillAll.getMerchantId());
if(wxMerchant==null){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
if(wxMerchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

wxBillAll.setTenantId(merchant.getTenantId());
wxBillAll.setMerchantId(merchant.getId());
List<Map<String,Object>> result=wxBillAllService.listBillOweAndWaitPay(wxBillAll);
return new ResultData(result);
}
@@ -88,41 +98,52 @@ public class WxBillController extends BaseController {
@ApiOperation("账单")
@PostMapping("listBill")
public ResultData listBill(@RequestBody WxBillAll wxBillAll) {
WxMerchantBUser wxMerchantBUser = new WxMerchantBUser();
wxMerchantBUser.setAppId(wxBillAll.getAppId());
wxMerchantBUser.setStatus(EnumMerchantBUserStatus.VALID.getCode());
try {
wxMerchantBUser = wxMerchantBUserService.getBUserByAppId(wxMerchantBUser);
} catch (Exception e) {
logger.error(e.getMessage());
logger.error("B端用户不存在");
return new ResultData(ErrorCode.USER_IS_EMPTY);
}
// WxMerchantBUser wxMerchantBUser = new WxMerchantBUser();
// wxMerchantBUser.setAppId(wxBillAll.getAppId());
// wxMerchantBUser.setStatus(EnumMerchantBUserStatus.VALID.getCode());
// try {
// wxMerchantBUser = wxMerchantBUserService.getBUserByAppId(wxMerchantBUser);
// } catch (Exception e) {
// logger.error(e.getMessage());
// logger.error("B端用户不存在");
// return new ResultData(ErrorCode.USER_IS_EMPTY);
// }
//
// WxMerchant merchant = null;
// if (wxMerchantBUser != null) {
// // check merchant 状态
// try {
// merchant = wxMerchantService.getById(wxMerchantBUser.getMerchantId());
// } catch (Exception e) {
// logger.error(ErrorCode.DB_FAIL.getMessage() + ": " + wxMerchantBUser.getMerchantId() + e.getMessage());
// return new ResultData(ErrorCode.DB_FAIL);
// }
// if (merchant == null) {
// logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + wxMerchantBUser.getMerchantId());
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
// }
// if (merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) {
// logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + wxMerchantBUser.getMerchantId());
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
// }
// } else {
// logger.error("B端用户不存在");
// return new ResultData(ErrorCode.USER_IS_EMPTY);
// }

WxMerchant merchant = null;
if (wxMerchantBUser != null) {
// check merchant 状态
try {
merchant = wxMerchantService.getById(wxMerchantBUser.getMerchantId());
} catch (Exception e) {
logger.error(ErrorCode.DB_FAIL.getMessage() + ": " + wxMerchantBUser.getMerchantId() + e.getMessage());
return new ResultData(ErrorCode.DB_FAIL);
}
if (merchant == null) {
logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + wxMerchantBUser.getMerchantId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
if (merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) {
logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + wxMerchantBUser.getMerchantId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}
} else {
logger.error("B端用户不存在");
return new ResultData(ErrorCode.USER_IS_EMPTY);
if(StringUtils.isEmpty(wxBillAll.getTenantId())){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"tenantId不能为空");
}
if(wxBillAll.getMerchantId()==null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"merchantId不能为空");
}
WxMerchant wxMerchant = wxMerchantService.getById(wxBillAll.getMerchantId());
if(wxMerchant==null){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
if(wxMerchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

wxBillAll.setTenantId(merchant.getTenantId());
wxBillAll.setMerchantId(merchant.getId());
return wxBillAllService.listBill(wxBillAll);
}



+ 8
- 4
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java Wyświetl plik

@@ -52,17 +52,19 @@ public class WxMerchantBUserController extends BaseController {

WxMerchantBUser user = wxMerchantBUserService.getById(getUser().getId());

if (user == null)
if (user == null){
return new ResultData(ErrorCode.USER_IS_EMPTY);
}

WxMerchant merchant = wxMerchantService.getById(user.getMerchantId());

if (merchant == null)
if (merchant == null){
return new ResultData(ErrorCode.MCH_INFO_NOT_FOUND);
}

WxMall mall = wxMallService.getByTenantId(merchant.getTenantId());
if (mall == null)
if (mall == null){
return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND);
}

resultMap.put("phone", user.getPhone());
resultMap.put("name", user.getName());
@@ -70,6 +72,8 @@ public class WxMerchantBUserController extends BaseController {
resultMap.put("merchant_img_url", merchant.getImgUrl());
resultMap.put("mall_name", mall.getName());
resultMap.put("service_phone", mall.getServicePhone());
resultMap.put("tenant_id",merchant.getTenantId());
resultMap.put("merchant_id",merchant.getId());

return new ResultData(resultMap);
}


Ładowanie…
Anuluj
Zapisz