|
|
@@ -4,8 +4,14 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.github.binarywang.wxpay.bean.applyment.WxPayApplyment4SubCreateRequest; |
|
|
|
|
|
import com.github.binarywang.wxpay.bean.applyment.WxPayApplymentCreateResult; |
|
|
|
|
|
import com.github.binarywang.wxpay.bean.bank.BankingResult; |
|
|
|
|
|
import com.github.binarywang.wxpay.exception.WxPayException; |
|
|
|
|
|
import com.github.binarywang.wxpay.service.WxPayService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.po.*; |
|
|
@@ -13,6 +19,8 @@ import com.iformall.domain.po.base.TenantEntity; |
|
|
import com.iformall.enums.*; |
|
|
import com.iformall.enums.*; |
|
|
import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; |
|
|
import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; |
|
|
import com.iformall.service.WxAppinfoService; |
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
|
|
import com.iformall.service.WxPayAccountService; |
|
|
import com.iformall.service.WxProfitSharingReceiverApplyService; |
|
|
import com.iformall.service.WxProfitSharingReceiverApplyService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
@@ -37,6 +45,12 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxAppinfoService wxAppinfoService; |
|
|
WxAppinfoService wxAppinfoService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxPayAccountService wxPayAccountService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageInfo<WxProfitSharingReceiverApply> listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize) { |
|
|
public PageInfo<WxProfitSharingReceiverApply> listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize) { |
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverApplyMapper.findList(record)); |
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverApplyMapper.findList(record)); |
|
|
@@ -88,6 +102,52 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR |
|
|
return new ResultData(receiverAdd); |
|
|
return new ResultData(receiverAdd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public ResultData applyment(WxProfitSharingReceiverApply record) { |
|
|
|
|
|
WxProfitSharingReceiverApply receiverApply = this.selectById(record.getId()); |
|
|
|
|
|
if(receiverApply == null){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到数据"); |
|
|
|
|
|
} |
|
|
|
|
|
WxMerchant merchant = wxMerchantService.selectById(receiverApply.getMerchantId()); |
|
|
|
|
|
if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ |
|
|
|
|
|
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); |
|
|
|
|
|
} |
|
|
|
|
|
if(receiverApply.getApplymentState() != null && !EnumSharingReceiverApplymentState.getUpdList().contains(receiverApply.getApplymentState())){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户进件流程中,无法申请"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!this.isFinishMain(receiverApply)){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成主体资质"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!this.isFinishBusiness(receiverApply)){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成经营信息"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!this.isFinishSettlement(receiverApply)){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成行业资质"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!this.isFinishBankAccount(receiverApply)){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成结算帐号"); |
|
|
|
|
|
} |
|
|
|
|
|
if(!this.isFinishContact(receiverApply)){ |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未完成超级管理员"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ResultData result = this.applyment4subApplyment(receiverApply); |
|
|
|
|
|
if(result.code == 200){ |
|
|
|
|
|
WxProfitSharingReceiverApply receiverUpd = new WxProfitSharingReceiverApply(); |
|
|
|
|
|
receiverUpd.updateTenantInfo(receiverApply); |
|
|
|
|
|
receiverUpd.setId(receiverApply.getId()); |
|
|
|
|
|
receiverUpd.setApplymentId((String) result.data); |
|
|
|
|
|
receiverUpd.setApplymentState(EnumSharingReceiverApplymentState.APPLYMENT_STATE_AUDITING.getCode()); |
|
|
|
|
|
receiverUpd.setApplymentStateDesc(EnumSharingReceiverApplymentState.APPLYMENT_STATE_AUDITING.getMessage()); |
|
|
|
|
|
receiverUpd.setUpdateTime(new Date()); |
|
|
|
|
|
wxProfitSharingReceiverApplyMapper.updateById(receiverUpd); |
|
|
|
|
|
return result; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------------------------------ |
|
|
//------------------------------------------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
|
@@ -107,7 +167,6 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR |
|
|
receiverAdd.setSalesInfo(JSON.toJSONString(salesInfoMap)); |
|
|
receiverAdd.setSalesInfo(JSON.toJSONString(salesInfoMap)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean isFinishMain(WxProfitSharingReceiverApply record){ |
|
|
private boolean isFinishMain(WxProfitSharingReceiverApply record){ |
|
|
@@ -652,5 +711,18 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ResultData applyment4subApplyment(WxProfitSharingReceiverApply receiverApply){ |
|
|
|
|
|
WxPayService wxPayService = wxPayAccountService.getWxPayService(receiverApply.getTenantId()); |
|
|
|
|
|
try { |
|
|
|
|
|
WxPayApplyment4SubCreateRequest request = new WxPayApplyment4SubCreateRequest(); |
|
|
|
|
|
|
|
|
|
|
|
WxPayApplymentCreateResult wxPayApplymentCreateResult = wxPayService.getApplyment4SubService().createApply(request); |
|
|
|
|
|
return new ResultData(wxPayApplymentCreateResult.getApplymentId()); |
|
|
|
|
|
} catch (WxPayException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |