|
|
@@ -1,14 +1,17 @@ |
|
|
package com.iformall.controller; |
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.common.ResultData; |
|
|
|
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
|
|
|
import com.iformall.domain.po.WxProfitSharingReceiver; |
|
|
import com.iformall.service.WxMerchantService; |
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
|
|
import com.iformall.service.WxProfitSharingReceiverService; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
@RestController |
|
|
@RestController |
|
|
@RequestMapping("/api/merchant") |
|
|
@RequestMapping("/api/merchant") |
|
|
@@ -19,6 +22,9 @@ public class WxMerchantController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxMerchantService wxMerchantService; |
|
|
private WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WxProfitSharingReceiverService wxProfitSharingReceiverService; |
|
|
|
|
|
|
|
|
@ApiOperation("查询当前租户下商户名称列表") |
|
|
@ApiOperation("查询当前租户下商户名称列表") |
|
|
@GetMapping("/name_list") |
|
|
@GetMapping("/name_list") |
|
|
public ResultData nameList() { |
|
|
public ResultData nameList() { |
|
|
@@ -26,4 +32,44 @@ public class WxMerchantController extends BaseController { |
|
|
return new ResultData(wxMerchantService.findList(getTenantId())); |
|
|
return new ResultData(wxMerchantService.findList(getTenantId())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("查询账户信息") |
|
|
|
|
|
@GetMapping("/findAccountById") |
|
|
|
|
|
public ResultData findByMerchantId(@ModelAttribute WxMerchant wxMerchant) { |
|
|
|
|
|
log.debug("[" + getIpAddr() + "] WxMerchantController::findAccountById"); |
|
|
|
|
|
if (wxMerchant.getId() == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
wxMerchant.setTenantId(getTenantId()); |
|
|
|
|
|
return new ResultData(wxProfitSharingReceiverService.findReceiver(wxMerchant)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("更新收款账户信息") |
|
|
|
|
|
@PostMapping("/updateAccount") |
|
|
|
|
|
public ResultData addAccount(@RequestBody WxMerchant wxMerchant) { |
|
|
|
|
|
log.debug("[" + getIpAddr() + "] merchantProfitSharingReceiver::addAccount"); |
|
|
|
|
|
if (wxMerchant.getId() == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxMerchant.getName() == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户名称不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (wxMerchant.getAccountTypeValue() == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号类型不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isEmpty(wxMerchant.getAccountId())) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号ID不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isEmpty(wxMerchant.getAccountName())) { |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
wxMerchant.setTenantId(getTenantId()); |
|
|
|
|
|
//分账账号 |
|
|
|
|
|
WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); |
|
|
|
|
|
receiver.setReceiverAccount(wxMerchant.getAccountId()); |
|
|
|
|
|
receiver.setReceiverComments(wxMerchant.getName()); |
|
|
|
|
|
receiver.setReceiverType(wxMerchant.getAccountTypeValue()); |
|
|
|
|
|
receiver.setTrueName(wxMerchant.getAccountName()); |
|
|
|
|
|
return new ResultData(wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |