Przeglądaj źródła

[B端商户][修改][添加收款账户]

release_toaliyun_real
gongbiao 7 lat temu
rodzic
commit
d325bac2ca
3 zmienionych plików z 97 dodań i 7 usunięć
  1. +49
    -3
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java
  2. +14
    -4
      mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiver.java
  3. +34
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingUse.java

+ 49
- 3
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java Wyświetl plik

@@ -1,14 +1,17 @@
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.WxProfitSharingReceiver;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxProfitSharingReceiverService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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
@RequestMapping("/api/merchant")
@@ -19,6 +22,9 @@ public class WxMerchantController extends BaseController {
@Autowired
private WxMerchantService wxMerchantService;

@Autowired
private WxProfitSharingReceiverService wxProfitSharingReceiverService;

@ApiOperation("查询当前租户下商户名称列表")
@GetMapping("/name_list")
public ResultData nameList() {
@@ -26,4 +32,44 @@ public class WxMerchantController extends BaseController {
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));
}

}

+ 14
- 4
mallinkService/src/main/java/com/iformall/domain/po/WxProfitSharingReceiver.java Wyświetl plik

@@ -1,11 +1,11 @@
package com.iformall.domain.po;

import javax.persistence.*;
import java.util.*;
import javax.persistence.Transient;
import java.util.List;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Table(name = "wx_profit_sharing_receiver")
public class WxProfitSharingReceiver implements Serializable {
@@ -84,6 +84,16 @@ public class WxProfitSharingReceiver implements Serializable {
@Transient
private Integer sharingAmount;

@io.swagger.annotations.ApiModelProperty(value = "是否使用 0,不使用 1,使用", name = "isUse")
private Integer isUse;

public Integer getIsUse() {
return isUse;
}

public void setIsUse(Integer isUse) {
this.isUse = isUse;
}

public Integer getStatus() {
return status;


+ 34
- 0
mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingUse.java Wyświetl plik

@@ -0,0 +1,34 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumProfitSharingUse {
YES(1, "使用"),
NO(0, "不使用"),;

public static EnumProfitSharingUse getEnum(Integer code) {
for (EnumProfitSharingUse value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumProfitSharingUse(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

Ładowanie…
Anuluj
Zapisz