Просмотр исходного кода

[A端][新增]:微信分账接受方接口

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
2b867f1779
3 измененных файлов: 102 добавлений и 18 удалений
  1. +85
    -0
      mallinkAdmin/src/main/java/com/simple/controller/WxProfitSharingReceiverController.java
  2. +2
    -3
      mallinkService/src/main/java/com/simple/service/WxProfitSharingReceiverService.java
  3. +15
    -15
      mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java

+ 85
- 0
mallinkAdmin/src/main/java/com/simple/controller/WxProfitSharingReceiverController.java Просмотреть файл

@@ -0,0 +1,85 @@
package com.simple.controller;

import com.github.pagehelper.PageInfo;
import com.simple.common.ErrorCode;
import com.simple.common.Result;
import com.simple.common.ResultData;
import com.simple.domain.po.WxMerchant;
import com.simple.domain.po.WxProfitSharingReceiver;
import com.simple.service.WxMerchantService;
import com.simple.service.WxProfitSharingReceiverService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("wxProfitSharingReceiver")
public class WxProfitSharingReceiverController extends BaseController {
@Autowired
private WxProfitSharingReceiverService wxProfitSharingReceiverService;
@Autowired
private WxMerchantService wxMerchantService;

private Logger logger = Logger.getLogger(WxProfitSharingReceiverController.class);

@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData list(@ModelAttribute WxProfitSharingReceiver receiver, Integer pageNum, Integer pageSize) {
if (null == receiver) receiver = new WxProfitSharingReceiver();
final PageInfo<WxProfitSharingReceiver> page = wxProfitSharingReceiverService.listAsPage(receiver, pageNum, pageSize);
return new ResultData(page);
}


@ApiOperation("新增接口")
@PostMapping("add")
public ResultData add(@RequestBody WxProfitSharingReceiver receiver) {

if (receiver == null)
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
if (receiver.getMerchantId() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
if (receiver.getReceiverType() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
if (receiver.getReceiverComments() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
if (receiver.getReceiverAccount() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);

WxMerchant merchant = wxMerchantService.getById(receiver.getMerchantId());
if (merchant == null)
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);

return wxProfitSharingReceiverService.addReceiver(merchant, receiver);
}


@ApiOperation("根据id删除接口")
@GetMapping("del")
public ResultData delete(@RequestBody WxProfitSharingReceiver receiver) {
if (receiver == null)
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
if (receiver.getMerchantId() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
if (receiver.getReceiverType() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
if (receiver.getReceiverAccount() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);

WxMerchant merchant = wxMerchantService.getById(receiver.getMerchantId());
if (merchant == null)
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);

return wxProfitSharingReceiverService.delReceiver(merchant, receiver);
}


}

+ 2
- 3
mallinkService/src/main/java/com/simple/service/WxProfitSharingReceiverService.java Просмотреть файл

@@ -41,10 +41,9 @@ public interface WxProfitSharingReceiverService {
void deleteById(Long id);


ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver);

ResultData addReceiver(WxMerchant merchant);


ResultData delReceiver(WxMerchant merchant);
ResultData delReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver);
}

+ 15
- 15
mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java Просмотреть файл

@@ -83,7 +83,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv


@Override
public ResultData addReceiver(WxMerchant merchant) {
public ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver) {

WxAppinfo appInfo = new WxAppinfo();
appInfo.setTenantId(merchant.getTenantId());
@@ -92,16 +92,17 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
appInfo = wxAppinfoMapper.findList(appInfo).get(0);
WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId());

WxProfitSharingReceiver receiver = new WxProfitSharingReceiver();
receiver.setMerchantId(merchant.getId());
receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode());
receiver.setId(IdWorker.get().nextId());
receiver.setCreateTime(new Date());
receiver.setUpdateTime(new Date());
//receiver.setReceiverAccount(merchant.getReceiverAccount().toString());
receiver.setReceiverComments(merchant.getName());
receiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode());
receiver.setTrueName(merchant.getName());

//passed from uplevel
//receiver.setReceiverAccount(receiverParam.getReceiverAccount());
//receiver.setReceiverComments(receiverParam.getReceiverComments());
//receiver.setReceiverType(receiverParam.getReceiverType());
//receiver.setTrueName(receiverParam.getTrueName());

//添加分账账户
WxProfitSharingReceiverP wxProfitSharingReceiverP = new WxProfitSharingReceiverP();
@@ -113,9 +114,9 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv


JSONObject receiverJSON = new JSONObject();
receiverJSON.put("type",EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getMessage());
//receiverJSON.put("account",merchant.getReceiverAccount());
receiverJSON.put("name",merchant.getName());
receiverJSON.put("type",EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage());
receiverJSON.put("account",receiver.getReceiverAccount());
receiverJSON.put("name",receiver.getTrueName());

wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString());
String response;
@@ -145,7 +146,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
}

@Override
public ResultData delReceiver(WxMerchant merchant) {
public ResultData delReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver) {
WxAppinfo appInfo = new WxAppinfo();
appInfo.setTenantId(merchant.getTenantId());
appInfo.setType(EnumAppType.C.getCode());
@@ -153,11 +154,10 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
appInfo = wxAppinfoMapper.findList(appInfo).get(0);
WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId());

WxProfitSharingReceiver receiver = new WxProfitSharingReceiver();
receiver.setMerchantId(merchant.getId());
receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode());
//receiver.setReceiverAccount(merchant.getReceiverAccount().toString());
receiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode());
//receiver.setReceiverAccount(receiverParam.getReceiverAccount());
//receiver.setReceiverType(receiverParam.getReceiverType());

receiver = wxProfitSharingReceiverMapper.selectOne(receiver);

@@ -174,8 +174,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv


JSONObject receiverJSON = new JSONObject();
receiverJSON.put("type",EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getMessage());
//receiverJSON.put("account",merchant.getReceiverAccount());
receiverJSON.put("type",EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage());
receiverJSON.put("account",receiver.getReceiverAccount());

wxProfitSharingReceiverP.setReceiver(receiverJSON.toJSONString());
String response;


Загрузка…
Отмена
Сохранить