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

// sharingreceiver

release_toaliyun_real
xhxu 3 лет назад
Родитель
Сommit
894ada1525
15 измененных файлов: 149 добавлений и 95 удалений
  1. +8
    -8
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java
  2. +20
    -4
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java
  3. +10
    -13
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java
  4. +2
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingType.java
  5. +0
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java
  6. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  7. +4
    -0
      mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java
  8. +17
    -0
      mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverApplyService.java
  9. +6
    -3
      mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java
  10. +10
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  11. +0
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java
  12. +11
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountServiceImpl.java
  13. +28
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java
  14. +32
    -29
      mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java
  15. +0
    -9
      mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java

+ 8
- 8
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java Просмотреть файл

@@ -193,14 +193,14 @@ public class WxMerchantController extends BaseController {
return wxMerchantService.updateMerchant(wxMerchant); return wxMerchantService.updateMerchant(wxMerchant);
} }


@ApiOperation("更新账户接口")
@PostMapping("updateMerchantAccount")
@SystemControllerLog(description = "商户-更新账户")
public ResultData updateMerchantAccount(@RequestBody WxMerchant wxMerchant) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAccount");
wxMerchant.updateTenantInfo(getTenantInfo());
return wxMerchantService.updateMerchantAccount(wxMerchant,EnumPayWay.PAY_WAY_WECHAT);
}
// @ApiOperation("更新账户接口")
// @PostMapping("updateMerchantAccount")
// @SystemControllerLog(description = "商户-更新账户")
// public ResultData updateMerchantAccount(@RequestBody WxMerchant wxMerchant) {
// logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAccount");
// wxMerchant.updateTenantInfo(getTenantInfo());
// return wxMerchantService.updateMerchantAccount(wxMerchant,EnumPayWay.PAY_WAY_WECHAT);
// }


@ApiOperation("更新管理员接口") @ApiOperation("更新管理员接口")
@PostMapping("updateMerchantAdmin") @PostMapping("updateMerchantAdmin")


+ 20
- 4
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java Просмотреть файл

@@ -4,8 +4,10 @@ import com.iformall.annotation.RedisCache;
import com.iformall.common.ErrorCode; import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData; import com.iformall.common.ResultData;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType; import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType;
import com.iformall.enums.*; import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.service.*; import com.iformall.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -50,8 +52,22 @@ public class WxMerchantController extends BaseController {
if (wxMerchant.getId() == null) { if (wxMerchant.getId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空");
} }
wxMerchant.updateTenantInfo(getTenantInfo());
return new ResultData(wxProfitSharingReceiverService.findReceiver(wxMerchant, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT));
TenantEntity tenantInfo = getTenantInfo();
wxMerchant.updateTenantInfo(tenantInfo);

WxPayAccount payAccount = payAccountService.getPayAccount(tenantInfo, EnumAppPlat.WX);
if(payAccount == null){
return new ResultData(ErrorCode.API_KEY_NOT_FOUND);
}
EnumProfitSharingType enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT;
if(EnumPayMchType.TOTAL.getCode().equals(payAccount.getMchType())){
enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT;
}else if(EnumPayMchType.DIRECT.getCode().equals(payAccount.getMchType())){
enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2;
}else{
return new ResultData(ErrorCode.APP_PLAT_ERROR);
}
return new ResultData(wxProfitSharingReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX,enumSharingType));
} }


@ApiOperation("查询账户信息") @ApiOperation("查询账户信息")
@@ -63,7 +79,7 @@ public class WxMerchantController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空");
} }
wxMerchant.updateTenantInfo(getTenantInfo()); wxMerchant.updateTenantInfo(getTenantInfo());
return new ResultData(wxProfitSharingReceiverService.findReceiver(wxMerchant,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN));
return new ResultData(wxProfitSharingReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN));
} }


@ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)")
@@ -89,7 +105,7 @@ public class WxMerchantController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空");
} }
wxMerchant.updateTenantInfo(getTenantInfo()); wxMerchant.updateTenantInfo(getTenantInfo());
return wxMerchantService.updateMerchantAccount(wxMerchant,EnumPayWay.PAY_WAY_WECHAT);
return wxMerchantService.updateMerchantAccount(wxMerchant);
} }


@ApiOperation("删除分账账户") @ApiOperation("删除分账账户")


+ 10
- 13
mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java Просмотреть файл

@@ -94,55 +94,52 @@ public class WxMerchant extends TenantEntity {
} }


@TableField(exist = false) @TableField(exist = false)
@Excel(name="账户类型",width = 20,orderNum = "8",replace = {"_null","商户号_0","微信号_1","OPENID_3"})
@io.swagger.annotations.ApiModelProperty(value="账户类型",name="accountTypeValue") @io.swagger.annotations.ApiModelProperty(value="账户类型",name="accountTypeValue")
private Integer accountTypeValue; private Integer accountTypeValue;


@TableField(exist = false) @TableField(exist = false)
@Excel(name="账户号",width = 20,orderNum = "9")
@io.swagger.annotations.ApiModelProperty(value="账户ID",name="accountId") @io.swagger.annotations.ApiModelProperty(value="账户ID",name="accountId")
private String accountId; private String accountId;


@TableField(exist = false) @TableField(exist = false)
@Excel(name="账户名",width = 20,orderNum = "10")
@io.swagger.annotations.ApiModelProperty(value="账户名",name="accountName") @io.swagger.annotations.ApiModelProperty(value="账户名",name="accountName")
private String accountName; private String accountName;


@Excel(name="创建时间",width = 20,format="yyyy-MM-dd",orderNum = "11")
@Excel(name="创建时间",width = 20,format="yyyy-MM-dd",orderNum = "8")
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate; private Date createDate;


@Excel(name="是否展示",width = 20,orderNum = "12",replace = {"否_0","是_1"})
@Excel(name="是否展示",width = 20,orderNum = "9",replace = {"否_0","是_1"})
@io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic") @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic")
private Integer isPublic; private Integer isPublic;


@Excel(name = "待缴提醒", width = 20, orderNum = "13")
@Excel(name = "待缴提醒", width = 20, orderNum = "10")
@io.swagger.annotations.ApiModelProperty(value = "待缴提醒", name = "billSetting") @io.swagger.annotations.ApiModelProperty(value = "待缴提醒", name = "billSetting")
private Integer billSetting; private Integer billSetting;


@TableField(exist = false) @TableField(exist = false)
@Excel(name = "业态", width = 20, orderNum = "14")
@Excel(name = "业态", width = 20, orderNum = "11")
@io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId") @io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId")
private String businessName; private String businessName;


@TableField(exist = false) @TableField(exist = false)
@Excel(name = "子业态", width = 20, orderNum = "15")
@Excel(name = "子业态", width = 20, orderNum = "12")
@io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId") @io.swagger.annotations.ApiModelProperty(value="子业态",name="subBusinessId")
private String subBusinessName; private String subBusinessName;


@TableField(exist = false) @TableField(exist = false)
@Excel(name = "商铺", width = 20, orderNum = "16")
@Excel(name = "商铺", width = 20, orderNum = "13")
private String shopsStr; private String shopsStr;


@TableField(exist = false) @TableField(exist = false)
@Excel(name = "管理员", width = 20, orderNum = "17")
@Excel(name = "管理员", width = 20, orderNum = "14")
private String usersStr; private String usersStr;


@Excel(name = "主谈人", width = 20, orderNum = "18")
@Excel(name = "主谈人", width = 20, orderNum = "15")
@io.swagger.annotations.ApiModelProperty(value = "主谈人", name = "talkUserMain") @io.swagger.annotations.ApiModelProperty(value = "主谈人", name = "talkUserMain")
private String talkUserMain; private String talkUserMain;


@Excel(name = "辅谈人", width = 20, orderNum = "19")
@Excel(name = "辅谈人", width = 20, orderNum = "16")
@io.swagger.annotations.ApiModelProperty(value = "辅谈人", name = "talkUserAux") @io.swagger.annotations.ApiModelProperty(value = "辅谈人", name = "talkUserAux")
private String talkUserAux; private String talkUserAux;


@@ -269,7 +266,7 @@ public class WxMerchant extends TenantEntity {
private String linkLinePhone; private String linkLinePhone;


@TableField(exist = false) @TableField(exist = false)
private WxProfitSharingReceiver wxProfitSharingReceiver;
private List<WxProfitSharingReceiver> wxProfitSharingReceiver;


public String getWeappPath() { public String getWeappPath() {
if(id == null) if(id == null)


+ 2
- 1
mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingType.java Просмотреть файл

@@ -7,7 +7,8 @@ public enum EnumProfitSharingType {
PROFIT_SHARING_TYPE_WECHAT(1, "微信分账"), PROFIT_SHARING_TYPE_WECHAT(1, "微信分账"),
PROFIT_SHARING_TYPE_BANK(2, "银行卡分账"), PROFIT_SHARING_TYPE_BANK(2, "银行卡分账"),


PROFIT_SHARING_TYPE_DOUYIN(3, "抖音分账"),
PROFIT_SHARING_TYPE_DOUYIN(3, "抖音进件"),
PROFIT_SHARING_TYPE_WECHAT_v2(4, "微信进件"),
; ;


public static EnumProfitSharingType getEnum(Integer code) { public static EnumProfitSharingType getEnum(Integer code) {


+ 0
- 1
mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java Просмотреть файл

@@ -10,6 +10,5 @@ public interface WxProfitSharingReceiverMapper extends CommonMapper<WxProfitShar
WxProfitSharingReceiver findOne(WxProfitSharingReceiver wxProfitSharingReceiver); WxProfitSharingReceiver findOne(WxProfitSharingReceiver wxProfitSharingReceiver);



List<Long> findMerchantIdList(WxProfitSharingReceiver wxProfitSharingReceiver); List<Long> findMerchantIdList(WxProfitSharingReceiver wxProfitSharingReceiver);
} }

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Просмотреть файл

@@ -130,7 +130,7 @@ public interface WxMerchantService {


ResultData updateMerchant(WxMerchant wxMerchant); ResultData updateMerchant(WxMerchant wxMerchant);


ResultData updateMerchantAccount(WxMerchant wxMerchant,EnumPayWay payWay);
ResultData updateMerchantAccount(WxMerchant wxMerchant);


ResultData updateMerchantAdmin(WxMerchant wxMerchant); ResultData updateMerchantAdmin(WxMerchant wxMerchant);




+ 4
- 0
mallinkService/src/main/java/com/iformall/service/WxPayAccountService.java Просмотреть файл

@@ -4,6 +4,8 @@ import com.github.binarywang.wxpay.service.WxPayService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxPayAccount; import com.iformall.domain.po.WxPayAccount;
import com.iformall.domain.po.WxProjectConfig; import com.iformall.domain.po.WxProjectConfig;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumAppPlat;


public interface WxPayAccountService { public interface WxPayAccountService {


@@ -40,5 +42,7 @@ public interface WxPayAccountService {
void deleteById(Long id); void deleteById(Long id);




WxPayAccount getPayAccount(TenantEntity tenantEntity, EnumAppPlat appPlat);

WxPayService getWxPayService(String tenantId); WxPayService getWxPayService(String tenantId);
} }

+ 17
- 0
mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverApplyService.java Просмотреть файл

@@ -0,0 +1,17 @@
package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxProfitSharingReceiverApply;

public interface WxProfitSharingReceiverApplyService {

/**
* 根据实体查询分页列表
*
* @param record
* @return
*/
PageInfo<WxProfitSharingReceiverApply> listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize);


}

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

@@ -5,6 +5,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxProfitSharingReceiver; import com.iformall.domain.po.WxProfitSharingReceiver;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumPayWay; import com.iformall.enums.EnumPayWay;
import com.iformall.enums.EnumProfitSharingType; import com.iformall.enums.EnumProfitSharingType;


@@ -42,13 +43,15 @@ public interface WxProfitSharingReceiverService {
*/ */
void deleteById(Long id); void deleteById(Long id);


WxProfitSharingReceiver findReceiver(WxMerchant merchant, EnumProfitSharingType sharingType);
WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType);


ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList,EnumPayWay payWay);
List<WxProfitSharingReceiver> findReceivers(TenantEntity tenantEntity,Long merchantId);

ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList);


ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send); ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send);


ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver,EnumPayWay payWay);
ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver);


void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity); void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity);




+ 10
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -355,12 +355,9 @@ public class WxMerchantServiceImpl implements WxMerchantService {
} }


//分账信息 //分账信息
WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(wxMerchant,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT);
List<WxProfitSharingReceiver> receiver = wxProfitSharingReceiverService.findReceivers(wxMerchant,wxMerchant.getId());
if (receiver != null) { if (receiver != null) {
wxMerchant.setWxProfitSharingReceiver(receiver); wxMerchant.setWxProfitSharingReceiver(receiver);
wxMerchant.setAccountId(receiver.getReceiverAccount());
wxMerchant.setAccountName(receiver.getTrueName());
wxMerchant.setAccountTypeValue(receiver.getReceiverType());
} }


WxMerchantCorp wxMerchantCorp = new WxMerchantCorp(); WxMerchantCorp wxMerchantCorp = new WxMerchantCorp();
@@ -726,7 +723,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {


@Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
@Override @Override
public ResultData updateMerchantAccount(WxMerchant wxMerchant,EnumPayWay payWay) {
public ResultData updateMerchantAccount(WxMerchant wxMerchant) {
try { try {
if (wxMerchant.getId() == null) { if (wxMerchant.getId() == null) {
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
@@ -742,7 +739,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
receiver.setReceiverType(wxMerchant.getAccountTypeValue()); receiver.setReceiverType(wxMerchant.getAccountTypeValue());
receiver.setTrueName(wxMerchant.getAccountName()); receiver.setTrueName(wxMerchant.getAccountName());
receiver.setParameter(wxMerchant.getAccountParameter()); receiver.setParameter(wxMerchant.getAccountParameter());
return wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver,payWay);
return wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("db failed: 账户操作失败, e:" + e.getMessage(),e); logger.error("db failed: 账户操作失败, e:" + e.getMessage(),e);
@@ -929,13 +926,13 @@ public class WxMerchantServiceImpl implements WxMerchantService {
List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant); List<WxMerchant> list = wxMerchantMapper.findList(wxMerchant);


list.stream().forEach(m->{ list.stream().forEach(m->{
//分账信息
WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(m,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT);
if (receiver != null) {
m.setAccountId(receiver.getReceiverAccount());
m.setAccountName(receiver.getTrueName());
m.setAccountTypeValue(receiver.getReceiverType());
}
//分账信息 可能有多个, 先干掉
// WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(m,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT);
// if (receiver != null) {
// m.setAccountId(receiver.getReceiverAccount());
// m.setAccountName(receiver.getTrueName());
// m.setAccountTypeValue(receiver.getReceiverType());
// }
WxRentContract wxRentContract = new WxRentContract(); WxRentContract wxRentContract = new WxRentContract();
wxRentContract.setMerchantId(m.getId()); wxRentContract.setMerchantId(m.getId());
List<WxRentContract> lrc = wxRentContractMapper.selectRentContractByMerchantId(wxRentContract); List<WxRentContract> lrc = wxRentContractMapper.selectRentContractByMerchantId(wxRentContract);


+ 0
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java Просмотреть файл

@@ -92,19 +92,6 @@ public class WxParkServiceImpl implements WxParkService {
wxMerchant.setCreateDate(now); wxMerchant.setCreateDate(now);
wxMerchant.setUpdateDate(now); wxMerchant.setUpdateDate(now);
wxMerchantMapper.insert(wxMerchant); wxMerchantMapper.insert(wxMerchant);
WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver();
wxProfitSharingReceiver.setId(idWorker.nextId());
wxProfitSharingReceiver.setTenantId(record.getTenantId());
wxProfitSharingReceiver.setMerchantId(wxMerchant.getId());
wxProfitSharingReceiver.setReceiverType(1);
wxProfitSharingReceiver.setReceiverAccount("wxid_ppufk303mdrs12");
wxProfitSharingReceiver.setReceiverComments(wxMerchant.getName());
wxProfitSharingReceiver.setSharingType(1);
wxProfitSharingReceiver.setTrueName(wxMerchant.getName());
wxProfitSharingReceiver.setStatus(0);
wxProfitSharingReceiver.setCreateTime(now);
wxProfitSharingReceiver.setUpdateTime(now);
wxProfitSharingReceiverMapper.insert(wxProfitSharingReceiver);


} else { } else {
record.setUpdateDate(now); record.setUpdateDate(now);


+ 11
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxPayAccountServiceImpl.java Просмотреть файл

@@ -59,6 +59,17 @@ public class WxPayAccountServiceImpl implements WxPayAccountService {
wxPayAccountMapper.deleteById(id); wxPayAccountMapper.deleteById(id);
} }


@Override
public WxPayAccount getPayAccount(TenantEntity tenantEntity, EnumAppPlat appPlat) {
if(appPlat != null){
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(tenantEntity, appPlat);
if(cAppInfo != null){
return this.getById(cAppInfo.getPayId());
}
}
return null;
}

@Override @Override
public WxPayService getWxPayService(String tenantId) { public WxPayService getWxPayService(String tenantId) {
TenantEntity tenantEntity = new TenantEntity(); TenantEntity tenantEntity = new TenantEntity();


+ 28
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java Просмотреть файл

@@ -0,0 +1,28 @@
package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import com.iformall.mapper.WxProfitSharingReceiverApplyMapper;
import com.iformall.service.WxProfitSharingReceiverApplyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingReceiverApplyService {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxProfitSharingReceiverApplyMapper wxProfitSharingReceiverApplyMapper;

@Override
public PageInfo<WxProfitSharingReceiverApply> listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverApplyMapper.findList(record));
}


}

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

@@ -22,6 +22,7 @@ import com.iformall.douyin.pay.orderQuery.QueryMerchantResult;
import com.iformall.douyin.pay.preOrder.AppAddSubMerchant; import com.iformall.douyin.pay.preOrder.AppAddSubMerchant;
import com.iformall.douyin.pay.preOrder.AppAddSubMerchantResult; import com.iformall.douyin.pay.preOrder.AppAddSubMerchantResult;
import com.iformall.enums.*; import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.WxAppinfoMapper; import com.iformall.mapper.WxAppinfoMapper;
import com.iformall.mapper.WxMerchantMapper; import com.iformall.mapper.WxMerchantMapper;
import com.iformall.mapper.WxPayAccountMapper; import com.iformall.mapper.WxPayAccountMapper;
@@ -30,13 +31,16 @@ import com.iformall.mq.MqBaseProducer;
import com.iformall.pay.WxPayment; import com.iformall.pay.WxPayment;
import com.iformall.pay.WxProfitSharing; import com.iformall.pay.WxProfitSharing;
import com.iformall.pay.WxProfitSharingReceiverP; import com.iformall.pay.WxProfitSharingReceiverP;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxMerchantService; import com.iformall.service.WxMerchantService;
import com.iformall.service.WxPayAccountService;
import com.iformall.service.WxProfitSharingReceiverService; import com.iformall.service.WxProfitSharingReceiverService;
import com.iformall.service.pay.PayServiceFactory; import com.iformall.service.pay.PayServiceFactory;
import com.iformall.service.pay.service.share.entity.ShareAccountResult; import com.iformall.service.pay.service.share.entity.ShareAccountResult;
import com.iformall.utils.BeanUtils; import com.iformall.utils.BeanUtils;
import com.iformall.utils.DateUtils; import com.iformall.utils.DateUtils;
import com.iformall.utils.Utility; import com.iformall.utils.Utility;
import net.sf.saxon.trans.Err;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -67,9 +71,9 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
@Autowired @Autowired
WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper;
@Autowired @Autowired
WxAppinfoMapper wxAppinfoMapper;
WxAppinfoService wxAppinfoService;
@Autowired @Autowired
WxPayAccountMapper wxPayAccountMapper;
WxPayAccountService wxPayAccountService;
@Lazy @Lazy
@Autowired @Autowired
@@ -113,32 +117,33 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
} }




//todo 微信和抖音分账可能存在两个分账信息
@Override @Override
public WxProfitSharingReceiver findReceiver(WxMerchant merchant, EnumProfitSharingType sharingType) {
public WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType) {
WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); WxProfitSharingReceiver receiver = new WxProfitSharingReceiver();
receiver.updateTenantInfo(merchant);
receiver.setMerchantId(merchant.getId());
receiver.updateTenantInfo(tenantEntity);
receiver.setMerchantId(merchantId);
receiver.setPlat(plat.getCode());
receiver.setSharingType(sharingType.getCode()); receiver.setSharingType(sharingType.getCode());
receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
List<WxProfitSharingReceiver> list = wxProfitSharingReceiverMapper.findList(receiver);
if(list != null && list.size() > 0){
return list.get(0);
}
return null;
return wxProfitSharingReceiverMapper.findOne(receiver);
} }



@Override @Override
public ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList,EnumPayWay payWay) {
public List<WxProfitSharingReceiver> findReceivers(TenantEntity tenantEntity, Long merchantId) {
WxProfitSharingReceiver receiver = new WxProfitSharingReceiver();
receiver.updateTenantInfo(tenantEntity);
receiver.setMerchantId(merchantId);
receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
return wxProfitSharingReceiverMapper.findList(receiver);
}


WxAppinfo appInfo = new WxAppinfo();
appInfo.updateTenantInfo(merchant);
appInfo.setPlat(EnumPayWay.getEnum(payWay.getCode()).getPlat().getCode());
appInfo.setType(EnumAppType.C.getCode());


appInfo = wxAppinfoMapper.findList(appInfo).get(0);
WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId());
@Override
public ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList) {

WxAppinfo appInfo = wxAppinfoService.getCAppInfo(merchant,EnumAppPlat.WX);
WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId());


receiver.updateTenantInfo(merchant); receiver.updateTenantInfo(merchant);
receiver.setMerchantId(merchant.getId()); receiver.setMerchantId(merchant.getId());
@@ -149,7 +154,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
receiver.setUpdateTime(date); receiver.setUpdateTime(date);
receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
// receiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); // receiver.setIsUse(EnumProfitSharingUse.APPLY.getCode());
receiver.setPlat(payWay.getPlat().getCode());
receiver.setPlat(EnumAppPlat.WX.getCode());
//passed from uplevel //passed from uplevel
//receiver.setReceiverAccount(receiverParam.getReceiverAccount()); //receiver.setReceiverAccount(receiverParam.getReceiverAccount());
//receiver.setReceiverComments(receiverParam.getReceiverComments()); //receiver.setReceiverComments(receiverParam.getReceiverComments());
@@ -157,7 +162,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
//receiver.setTrueName(receiverParam.getTrueName()); //receiver.setTrueName(receiverParam.getTrueName());


//添加分账账户 //添加分账账户
ShareAccountResult createResult = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()).createShareAccount(appInfo, payAccount, receiver);
ShareAccountResult createResult = payServiceFactory.getPayShareAdapterService(EnumPayWay.PAY_WAY_WECHAT.getCode(),payAccount.getPayVersion())
.createShareAccount(appInfo, payAccount, receiver);
if (!createResult.isSuccess()) { if (!createResult.isSuccess()) {
return new ResultData(createResult.getCode(), createResult.getMsg()); return new ResultData(createResult.getCode(), createResult.getMsg());
} }
@@ -369,12 +375,9 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv


@Override @Override
public ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send) { public ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send) {
WxAppinfo appInfo = new WxAppinfo();
appInfo.updateTenantInfo(receiver);
appInfo.setType(EnumAppType.C.getCode());


appInfo = wxAppinfoMapper.findList(appInfo).get(0);
WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId());
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX);
WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId());


receiver = wxProfitSharingReceiverMapper.selectById(receiver.getId()); receiver = wxProfitSharingReceiverMapper.selectById(receiver.getId());


@@ -414,14 +417,14 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
} }


@Override @Override
public ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver,EnumPayWay payWay) {
public ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver) {


WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver();
oldReceiver.updateTenantInfo(merchant); oldReceiver.updateTenantInfo(merchant);
oldReceiver.setMerchantId(merchant.getId()); oldReceiver.setMerchantId(merchant.getId());
oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode());
oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
oldReceiver.setPlat(payWay.getPlat().getCode());
oldReceiver.setPlat(EnumAppPlat.WX.getCode());
List<WxProfitSharingReceiver> delList = wxProfitSharingReceiverMapper.selectList(new QueryWrapper(oldReceiver)); List<WxProfitSharingReceiver> delList = wxProfitSharingReceiverMapper.selectList(new QueryWrapper(oldReceiver));
oldReceiver.setReceiverAccount(receiver.getReceiverAccount()); oldReceiver.setReceiverAccount(receiver.getReceiverAccount());
oldReceiver.setReceiverType(receiver.getReceiverType()); oldReceiver.setReceiverType(receiver.getReceiverType());
@@ -429,7 +432,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv
oldReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); oldReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver));


if (oldReceiver == null) { if (oldReceiver == null) {
return addReceiver(merchant, receiver, delList,payWay);
return addReceiver(merchant, receiver, delList);
} else { } else {
oldReceiver.setParameter(receiver.getParameter()); oldReceiver.setParameter(receiver.getParameter());
oldReceiver.setUpdateTime(new Date()); oldReceiver.setUpdateTime(new Date());


+ 0
- 9
mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java Просмотреть файл

@@ -183,15 +183,6 @@ public class WxMerchantController extends BaseController {
return wxMerchantService.updateMerchant(wxMerchant); return wxMerchantService.updateMerchant(wxMerchant);
} }


@ApiOperation("更新账户接口")
@PostMapping("updateMerchantAccount")
@SystemControllerLog(description = "商户-更新账户")
public ResultData updateMerchantAccount(@RequestBody WxMerchant wxMerchant) {
logger.debug("[" + getIpAddr() + "] WxMerchantController::updateMerchantAccount");
wxMerchant.updateTenantInfo(getTenantInfo());
return wxMerchantService.updateMerchantAccount(wxMerchant,EnumPayWay.PAY_WAY_WECHAT);
}

@ApiOperation("更新管理员接口") @ApiOperation("更新管理员接口")
@PostMapping("updateMerchantAdmin") @PostMapping("updateMerchantAdmin")
@SystemControllerLog(description = "商户-更新管理员") @SystemControllerLog(description = "商户-更新管理员")


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