| @@ -18,6 +18,9 @@ import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/merchant") | |||
| @Api(description = "商户相关接口") | |||
| @@ -48,7 +51,7 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(wxMerchantService.findList(getTenantInfo())); | |||
| } | |||
| @ApiOperation("微信查询分账信息") | |||
| @ApiOperation("微信查询收款/分账信息") | |||
| @GetMapping("/findAccountById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findAccountById(@ModelAttribute WxMerchant wxMerchant) { | |||
| @@ -63,7 +66,23 @@ public class WxMerchantController extends BaseController { | |||
| if(payAccount == null){ | |||
| return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| return new ResultData(wxProfitSharingReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX)); | |||
| Map<String,Object> data = new HashMap<>(); | |||
| if(EnumPayMchType.TOTAL.getCode().equals(payAccount.getMchType())){ | |||
| data.put("mchType",EnumPayMchType.TOTAL.getCode()); | |||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(tenantInfo, wxMerchant.getId(), EnumAppPlat.WX); | |||
| if(receiver != null){ | |||
| data.put("receiver",receiver); | |||
| } | |||
| return new ResultData(data); | |||
| }else if(EnumPayMchType.DIRECT.getCode().equals(payAccount.getMchType())){ | |||
| data.put("mchType",EnumPayMchType.DIRECT.getCode()); | |||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(tenantInfo, wxMerchant.getId(), EnumAppPlat.WX); | |||
| if(receiver != null){ | |||
| data.put("receiver",receiver); | |||
| } | |||
| return new ResultData(data); | |||
| } | |||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||
| } | |||
| @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") | |||
| @@ -141,26 +160,6 @@ public class WxMerchantController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("微信查询收款信息") | |||
| @GetMapping("/findPaymentAccountById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findPaymentAccountById(@ModelAttribute WxMerchant wxMerchant) { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::findPaymentAccountById"); | |||
| if (wxMerchant.getId() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); | |||
| } | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxMerchant.updateTenantInfo(tenantInfo); | |||
| WxPayAccount payAccount = payAccountService.getPayAccount(tenantInfo, EnumAppPlat.WX); | |||
| if(payAccount == null){ | |||
| return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | |||
| } | |||
| return new ResultData(wxProfitPaymentReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX)); | |||
| } | |||
| @ApiOperation("查询是否有权限修改账户") | |||
| @GetMapping("/permitModifiy") | |||
| public ResultData permitModifiy() { | |||