Browse Source

fix

master
winter 1 year ago
parent
commit
6f9f888643
8 changed files with 13 additions and 714 deletions
  1. +0
    -2
      yqzjCApi/src/main/java/com/iformall/controller/BaseController.java
  2. +1
    -15
      yqzjService/src/main/java/com/iformall/file/wx/MerchantMediaUpload.java
  3. +0
    -50
      yqzjService/src/main/java/com/iformall/service/WxPayAccountService.java
  4. +8
    -212
      yqzjService/src/main/java/com/iformall/service/bank/impl/WxBankUtilServiceImpl.java
  5. +0
    -61
      yqzjService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java
  6. +3
    -327
      yqzjService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java
  7. +0
    -14
      yqzjService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java
  8. +1
    -33
      yqzjService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java

+ 0
- 2
yqzjCApi/src/main/java/com/iformall/controller/BaseController.java View File

@@ -66,8 +66,6 @@ public class BaseController {
@Autowired
private MemCouponFromDspService memCouponFromDspService;
@Autowired
private WxPayAccountService wxPayAccountService;
@Autowired
@Qualifier("objectCommonRedisTemplate")


+ 1
- 15
yqzjService/src/main/java/com/iformall/file/wx/MerchantMediaUpload.java View File

@@ -5,7 +5,6 @@ import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.iformall.common.ErrorCode;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxPayAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -18,22 +17,9 @@ import java.util.UUID;
@Slf4j
public class MerchantMediaUpload {

@Autowired
WxPayAccountService wxPayAccountService;

public String mediaUpload(String tenantId, String suffix,InputStream inputStream){
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantId);
String fileName = UUID.randomUUID().toString().replace("-","") + suffix;
try {
ImageUploadResult uploadResult = wxPayService.getMerchantMediaService().imageUploadV3(inputStream,fileName);
return uploadResult.getMediaId();
} catch (WxPayException e) {
e.printStackTrace();
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
} catch (IOException e) {
e.printStackTrace();
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"上传微信错误");
}
return null;
}




+ 0
- 50
yqzjService/src/main/java/com/iformall/service/WxPayAccountService.java View File

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

import com.github.binarywang.wxpay.service.WxPayService;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxPayAccount;
import com.iformall.domain.po.WxProjectConfig;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumAppPlat;

public interface WxPayAccountService {

/**
* 根据实体查询分页列表
*
* @param record
* @param pageIndex
* @param pageSize
* @return
*/
PageInfo<WxPayAccount> listAsPage(WxPayAccount record, Integer pageIndex, Integer pageSize);
/**
* 根据Id获得实体
*
* @param id
* @return
*/
WxPayAccount getById(Long id);
WxPayAccount getByIdFromRedis(Long id);
/**
* 保存或更新实体
*
* @param record
*/
void saveOrUpdate(WxPayAccount record);

/**
* 根据Id删除实体
*
* @param id
*/
void deleteById(Long id);


WxPayAccount getPayAccount(TenantEntity tenantEntity, EnumAppPlat appPlat);

WxPayService getWxPayService(String tenantId);
}

+ 8
- 212
yqzjService/src/main/java/com/iformall/service/bank/impl/WxBankUtilServiceImpl.java View File

@@ -9,7 +9,6 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxBankProvinceCity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.mapper.WxBankProvinceCityMapper;
import com.iformall.service.WxPayAccountService;
import com.iformall.service.bank.WxBankUtilService;
import com.iformall.utils.RedisCacheUtils;
import org.slf4j.Logger;
@@ -33,8 +32,6 @@ public class WxBankUtilServiceImpl implements WxBankUtilService {

private final String otherBank = "其他银行";

@Autowired
WxPayAccountService wxPayAccountService;

@Autowired
WxBankProvinceCityMapper wxBankProvinceCityMapper;
@@ -45,133 +42,31 @@ public class WxBankUtilServiceImpl implements WxBankUtilService {

@Override
public ResultData searchBanksByBankAccount(TenantEntity tenantInfo,String accountNumber) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
BankAccountResult bankAccountResult = wxPayService.getBankService().searchBanksByBankAccount(accountNumber);
return new ResultData(bankAccountResult.getData());
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return new ResultData();
}

@Override
public ResultData personalBanking(TenantEntity tenantInfo, int offset, int limit) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
BankingResult bankingResult = wxPayService.getBankService().personalBanking(offset,limit);
this.handlBankingResult(bankingResult.getData());
return new ResultData(bankingResult.getData());
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return new ResultData();
}

@Override
public ResultData personalBanking(TenantEntity tenantInfo) {
String prev = "personal_banking:";
List<BankInfo> bankInfoList = new ArrayList<>();
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
int offset = 0, limit = 200;
try {
BankingResult bankingResult = wxPayService.getBankService().personalBanking(offset,limit);
this.handlBankingResult(bankingResult.getData());
bankInfoList.addAll(bankingResult.getData());
String key = prev+offset+"_"+limit;
BankingResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankingResult.class);
boolean isNeedSearch = false;
if(cacheObject == null || !bankingResult.getTotalCount().equals(cacheObject.getTotalCount())){
RedisCacheUtils.cache(bankRedisTemplate,key,bankingResult,0);
isNeedSearch = true;
}
offset += limit;
while (offset + limit < bankingResult.getTotalCount()){
String nextkey = prev+offset+"_"+limit;
BankingResult nextBankingResult = null;
if(!isNeedSearch){
nextBankingResult = RedisCacheUtils.getCacheObject(bankRedisTemplate, nextkey, BankingResult.class);
}
if(nextBankingResult == null){
try{
nextBankingResult = wxPayService.getBankService().personalBanking(offset,limit);
this.handlBankingResult(nextBankingResult.getData());
if(nextBankingResult != null){
RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankingResult,0);
}
} catch (WxPayException e) {
e.printStackTrace();
}
}
if(nextBankingResult != null){
bankInfoList.addAll(nextBankingResult.getData());
}
offset += limit;
}
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return new ResultData(bankInfoList);
}

@Override
public ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
BankingResult bankingResult = wxPayService.getBankService().corporateBanking(offset,limit);
this.handlBankingResult(bankingResult.getData());
return new ResultData(bankingResult.getData());
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return new ResultData();
}

@Override
public ResultData corporateBanking(TenantEntity tenantInfo) {
String prev = "corporate_banking:";
List<BankInfo> bankInfoList = new ArrayList<>();
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
int offset = 0, limit = 200;
try {
BankingResult bankingResult = wxPayService.getBankService().corporateBanking(offset,limit);
this.handlBankingResult(bankingResult.getData());
bankInfoList.addAll(bankingResult.getData());
String key = prev+offset+"_"+limit;
BankingResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankingResult.class);
boolean isNeedSearch = false;
if(cacheObject == null || !bankingResult.getTotalCount().equals(cacheObject.getTotalCount())){
RedisCacheUtils.cache(bankRedisTemplate,key,bankingResult,0);
isNeedSearch = true;
}
offset += limit;
while (offset + limit < bankingResult.getTotalCount()){
String nextkey = prev+offset+"_"+limit;
BankingResult nextBankingResult = null;
if(!isNeedSearch){
nextBankingResult = RedisCacheUtils.getCacheObject(bankRedisTemplate, nextkey, BankingResult.class);
}
if(nextBankingResult == null){
try{
nextBankingResult = wxPayService.getBankService().corporateBanking(offset,limit);
this.handlBankingResult(nextBankingResult.getData());
if(nextBankingResult != null){
RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankingResult,0);
}
} catch (WxPayException e) {
e.printStackTrace();
}
}
if(nextBankingResult != null){
bankInfoList.addAll(nextBankingResult.getData());
}
offset += limit;
}
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return new ResultData(bankInfoList);
}

@@ -195,126 +90,27 @@ public class WxBankUtilServiceImpl implements WxBankUtilService {

@Override
public ResultData areasProvinces(TenantEntity tenantInfo) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
ProvincesResult provincesResult = wxPayService.getBankService().areasProvinces();
return new ResultData(provincesResult.getData());
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return null;
}

@Override
public ResultData areasCities(TenantEntity tenantInfo, Integer provinceCode) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
CitiesResult citiesResult = wxPayService.getBankService().areasCities(provinceCode);
return new ResultData(citiesResult.getData());
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return null;
}

@Override
public ResultData bankBranches(TenantEntity tenantInfo, String bankAliasCode, Integer cityCode, int offset, int limit) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
BankBranchesResult bankBranchesResult = wxPayService.getBankService().bankBranches(bankAliasCode,cityCode,offset,limit);
return new ResultData(bankBranchesResult.getData());
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return null;
}

@Override
public ResultData bankBranches(TenantEntity tenantInfo, String bankAliasCode, Integer cityCode) {
String prev = "bank_branches:";
List<BankBranchesResult.BankBranch> bankInfoList = new ArrayList<>();
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
int offset = 0, limit = 200;
try {
BankBranchesResult bankBranchesResult = wxPayService.getBankService().bankBranches(bankAliasCode,cityCode,offset,limit);
bankInfoList.addAll(bankBranchesResult.getData());
String key = prev+offset+"_"+limit;
BankBranchesResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankBranchesResult.class);
boolean isNeedSearch = false;
if(cacheObject == null || !bankBranchesResult.getTotalCount().equals(cacheObject.getTotalCount())){
RedisCacheUtils.cache(bankRedisTemplate,key,bankBranchesResult,0);
isNeedSearch = true;
}
offset += limit;
while (offset + limit < bankBranchesResult.getTotalCount()){
String nextkey = prev+offset+"_"+limit;
BankBranchesResult nextBankBranchesResult = null;
if(!isNeedSearch){
nextBankBranchesResult = RedisCacheUtils.getCacheObject(bankRedisTemplate, nextkey, BankBranchesResult.class);
}
if(nextBankBranchesResult == null){
try{
nextBankBranchesResult = wxPayService.getBankService().bankBranches(bankAliasCode,cityCode,offset,limit);
if(nextBankBranchesResult != null){
RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankBranchesResult,0);
}
} catch (WxPayException e) {
e.printStackTrace();
}
}
if(nextBankBranchesResult != null){
bankInfoList.addAll(nextBankBranchesResult.getData());
}
offset += limit;
}
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return new ResultData(bankInfoList);
return null;
}

@Override
public ResultData initProvincesCities(TenantEntity tenantInfo) {
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId());
try {
ProvincesResult provincesResult = wxPayService.getBankService().areasProvinces();
for (ProvincesResult.ProvinceInfo provinceInfo:provincesResult.getData()) {
WxBankProvinceCity provinceQuery = new WxBankProvinceCity();
provinceQuery.setProvinceCode(provinceInfo.getProvinceCode());
provinceQuery.setProvinceName(provinceInfo.getProvinceName());
WxBankProvinceCity province = wxBankProvinceCityMapper.selectOne(new QueryWrapper<>(provinceQuery));
if(province == null){
province = new WxBankProvinceCity();
province.setParentId(0l);
province.setProvinceCode(provinceInfo.getProvinceCode());
province.setProvinceName(provinceInfo.getProvinceName());
wxBankProvinceCityMapper.insert(province);
}

CitiesResult citiesResult = wxPayService.getBankService().areasCities(provinceInfo.getProvinceCode());
for (CitiesResult.CityInfo cityInfo:citiesResult.getData()) {
WxBankProvinceCity cityQuery = new WxBankProvinceCity();
cityQuery.setProvinceCode(provinceInfo.getProvinceCode());
cityQuery.setProvinceName(provinceInfo.getProvinceName());
cityQuery.setCityCode(cityInfo.getCityCode());
cityQuery.setCityName(cityInfo.getCityName());
WxBankProvinceCity city = wxBankProvinceCityMapper.selectOne(new QueryWrapper<>(cityQuery));
if(city == null){
city = new WxBankProvinceCity();
city.setParentId(province.getId());
city.setProvinceCode(provinceInfo.getProvinceCode());
city.setProvinceName(provinceInfo.getProvinceName());
city.setCityCode(cityInfo.getCityCode());
city.setCityName(cityInfo.getCityName());
}
}
}
return new ResultData();
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return null;
}

@Override


+ 0
- 61
yqzjService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java View File

@@ -68,8 +68,6 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
@Autowired
WxAppinfoService wxAppinfoService;

@Autowired
WxPayAccountService wxPayAccountService;

@Autowired
TtPoiTakeRateMapper ttPoiTakeRateMapper;
@@ -588,35 +586,8 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
if(couponAppInfo == null || couponAppInfo.getPayId() == null){
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
WxPayAccount payAccount = wxPayAccountService.getById(couponAppInfo.getPayId());
if(payAccount == null){
return new ResultData(ErrorCode.API_KEY_NOT_FOUND);
}

map.put("realRate",payAccount.getRealRate());
int rate = 0;
if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){
map.put("systemRate",payAccount.getSystemRate()+payAccount.getSellRate());
rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate();
}else{
rate = payAccount.getRealRate();
}

if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){
if(wxCoupon.getCategoryId() == null){
return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误");
}
TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId());
map.put("serviceFeeRate",ttGoodsCategory.getServiceFee()-payAccount.getRealRate());
rate = rate-payAccount.getRealRate()+ttGoodsCategory.getServiceFee();
Integer maxTakeRate = ttPoiTakeRateMapper.getMaxTakeRate(wxCoupon.getTenantId(), wxCoupon.getId());
if(maxTakeRate != null){
rate += maxTakeRate;
}
}

map.put("mallMax",getAllMax());
map.put("mallMin",rate);
return new ResultData(map);
}

@@ -659,19 +630,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
if(couponAppInfo == null || couponAppInfo.getPayId() == null){
throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND);
}
WxPayAccount payAccount = wxPayAccountService.getById(couponAppInfo.getPayId());
if(payAccount == null){
throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND);
}
int rate = 0;
rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate();
if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){
if(wxCoupon.getCategoryId() == null){
throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误");
}
TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId());
rate = rate-payAccount.getRealRate()+ttGoodsCategory.getServiceFee();
}
if(takeRate > rate){
rate = takeRate - rate;
return rate;
@@ -702,27 +661,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
if(couponAppInfo == null || couponAppInfo.getPayId() == null){
throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND);
}
WxPayAccount payAccount = wxPayAccountService.getById(couponAppInfo.getPayId());
if(payAccount == null){
throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND);
}
int rate = 0;
if(EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){
rate = payAccount.getRealRate()+payAccount.getSystemRate()+payAccount.getSellRate();
}else{
rate = payAccount.getRealRate();
}
if(EnumAppPlat.TOUTIAO.getCode().equals(couponAppInfo.getPlat())){
if(wxCoupon.getCategoryId() == null){
throw new MallinkException(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED.getCode(),"卡券信息错误");
}
TtGoodsCategory ttGoodsCategory = ttGoodsCategoryMapper.selectById(wxCoupon.getCategoryId());
rate = rate-payAccount.getRealRate()+ttGoodsCategory.getServiceFee();
Integer maxTakeRate = ttPoiTakeRateMapper.getMaxTakeRate(wxCoupon.getTenantId(), wxCoupon.getId());
if(maxTakeRate != null){
rate += maxTakeRate;
}
}
return rate;
}



+ 3
- 327
yqzjService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverApplyServiceImpl.java View File

@@ -42,8 +42,6 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
WxAppinfoService wxAppinfoService;


@Autowired
WxPayAccountService wxPayAccountService;

@Override
public PageInfo<WxProfitSharingReceiverApply> listAsPage(WxProfitSharingReceiverApply record, Integer pageIndex, Integer pageSize) {
@@ -114,45 +112,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
@Transactional(rollbackFor = {Exception.class})
public ResultData handApplymentStates(WxProfitSharingReceiverApply receiverApply) {

if(receiverApply == null || !EnumSharingReceiverApplymentState.getNeedSyncList().contains(receiverApply.getApplymentState())){
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该状态无需同步");
return new ResultData(receiverApply);
}

try {
WxPayService wxPayService = wxPayAccountService.getWxPayService(receiverApply.getTenantId());
ApplymentStateQueryResult applymentStateQueryResult = wxPayService.getApplyment4SubService().queryApplyStatusByBusinessCode(receiverApply.getOutRequestNo());
EnumSharingReceiverApplymentState enumApplymentState = EnumSharingReceiverApplymentState.getEnum(applymentStateQueryResult.getApplymentState());
if(enumApplymentState != null && !enumApplymentState.getCode().equals(receiverApply.getApplymentState())){
WxProfitSharingReceiverApply receiverApplyUpd = new WxProfitSharingReceiverApply();
receiverApplyUpd.updateTenantInfo(receiverApply);
receiverApplyUpd.setId(receiverApply.getId());
if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_FINISHED)){
receiverApplyUpd.setSubMchid(applymentStateQueryResult.getSubMchid());
}
receiverApplyUpd.setSignUrl(applymentStateQueryResult.getSignUrl());
receiverApplyUpd.setApplymentState(enumApplymentState.getCode());
receiverApplyUpd.setApplymentStateDesc(applymentStateQueryResult.getApplymentStateMsg());
if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_REJECTED)){
receiverApplyUpd.setAuditDetail(JSON.toJSONString(applymentStateQueryResult.getAuditDetail()));
}else{
receiverApplyUpd.setAuditDetail("[]");
}
receiverApplyUpd.setUpdateTime(new Date());
wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd);

receiverApply.setSubMchid(receiverApplyUpd.getSubMchid());
receiverApply.setSignUrl(receiverApplyUpd.getSignUrl());
receiverApply.setApplymentState(receiverApplyUpd.getApplymentState());
receiverApply.setApplymentStateDesc(receiverApplyUpd.getApplymentStateDesc());
receiverApply.setAuditDetail(receiverApplyUpd.getAuditDetail());
receiverApply.setUpdateTime(receiverApplyUpd.getUpdateTime());
}
return new ResultData(receiverApply);
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return null;
}

@Override
@@ -178,31 +138,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR

@Override
public ResultData handVerifyResult(WxProfitSharingReceiverApply receiverApply) {
if(receiverApply == null || !EnumSharingReceiverVerifyResult.VERIFYING.getCode().equals(receiverApply.getVerifyResult())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该状态无需同步");
}
WxPayService wxPayService = wxPayAccountService.getWxPayService(receiverApply.getTenantId());
try {
SettlementInfoResult settlementInfoResult = wxPayService.getApplyment4SubService().querySettlementBySubMchid(receiverApply.getSubMchid());
EnumSharingReceiverVerifyResult enumVerifyResult = EnumSharingReceiverVerifyResult.getEnum(settlementInfoResult.getVerifyResult());
if(enumVerifyResult != null && !enumVerifyResult.getCode().equals(receiverApply.getVerifyResult())){
WxProfitSharingReceiverApply receiverApplyUpd = new WxProfitSharingReceiverApply();
receiverApplyUpd.updateTenantInfo(receiverApply);
receiverApplyUpd.setId(receiverApply.getId());
receiverApplyUpd.setVerifyResult(enumVerifyResult.getCode());
if(enumVerifyResult.equals(EnumSharingReceiverVerifyResult.VERIFY_FAIL)){
receiverApplyUpd.setVerifyFailReason(settlementInfoResult.getVerifyFailReason());
}else{
receiverApplyUpd.setVerifyFailReason("");
}
receiverApplyUpd.setUpdateTime(new Date());
wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd);
}
return new ResultData();
} catch (WxPayException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
}
return null;
}

@Override
@@ -1096,270 +1032,10 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
}

private ResultData applyment4subApplyment(WxProfitSharingReceiverApply receiverApply){
WxPayService wxPayService = wxPayAccountService.getWxPayService(receiverApply.getTenantId());
try {
WxPayApplyment4SubCreateRequest request = new WxPayApplyment4SubCreateRequest();
request.setBusinessCode(receiverApply.getOutRequestNo());
WxPayApplyment4SubCreateRequest.SubjectInfo subjectInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo();
EnumSharingReceiverOrganizationType enumOrganizationType = EnumSharingReceiverOrganizationType.getEnum(receiverApply.getOrganizationType());
subjectInfo.setSubjectType(enumOrganizationType.getSubjectTypeEnum());
if(EnumYesOrNo.YES.getCode().equals(receiverApply.getFinanceInstitution())){
//todo 金融机构
// subjectInfo.setFinanceInstitution(true);
}
if(EnumSharingReceiverOrganizationType.GETI.equals(enumOrganizationType) || EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){
JSONObject businessLicenseInfoObject = JSONObject.parseObject(receiverApply.getBusinessLicenseInfo());
WxPayApplyment4SubCreateRequest.SubjectInfo.BusinessLicenseInfo businessLicenseInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.BusinessLicenseInfo();
JSONObject license_copy_info = businessLicenseInfoObject.getJSONObject("license_copy_info");
businessLicenseInfo.setLicenseCopy(this.getMerchantMediaId(license_copy_info));
businessLicenseInfo.setLicenseNumber(businessLicenseInfoObject.getString("license_number"));
businessLicenseInfo.setMerchantName(businessLicenseInfoObject.getString("merchant_name"));
businessLicenseInfo.setLegalPerson(businessLicenseInfoObject.getString("legal_person"));
businessLicenseInfo.setLicenseAddress(businessLicenseInfoObject.getString("license_address"));
businessLicenseInfo.setPeriodBegin(businessLicenseInfoObject.getString("period_begin"));
businessLicenseInfo.setPeriodEnd(businessLicenseInfoObject.getString("period_end"));
subjectInfo.setBusinessLicenseInfo(businessLicenseInfo);

WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo identityInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo();
EnumSharingReceiverIdDocType enumIdDocType = EnumSharingReceiverIdDocType.getEnum(receiverApply.getIdDocType());
identityInfo.setIdDocType(enumIdDocType.getIdTypeEnum());
if(EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_IDCARD.equals(enumIdDocType)){
JSONObject idCardInfoObject = JSONObject.parseObject(receiverApply.getIdCardInfo());
WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdCardInfo idCardInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdCardInfo();
JSONObject id_card_copy_info = idCardInfoObject.getJSONObject("id_card_copy_info");
idCardInfo.setIdCardCopy(this.getMerchantMediaId(id_card_copy_info));
JSONObject id_card_national_info = idCardInfoObject.getJSONObject("id_card_national_info");
idCardInfo.setIdCardNational(this.getMerchantMediaId(id_card_national_info));
idCardInfo.setIdCardName(idCardInfoObject.getString("id_card_name"));
idCardInfo.setIdCardNumber(idCardInfoObject.getString("id_card_number"));
idCardInfo.setIdCardAddress(idCardInfoObject.getString("id_card_address"));
idCardInfo.setCardPeriodBegin(idCardInfoObject.getString("card_period_begin"));
idCardInfo.setCardPeriodEnd(idCardInfoObject.getString("card_period_end"));
identityInfo.setIdCardInfo(idCardInfo);
}else{
JSONObject idDocInfoObject = JSONObject.parseObject(receiverApply.getIdDocInfo());
WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdDocInfo idDocInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdDocInfo();
JSONObject id_doc_copy_info = idDocInfoObject.getJSONObject("id_doc_copy_info");
idDocInfo.setIdDocCopy(this.getMerchantMediaId(id_doc_copy_info));
if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumIdDocType)){
JSONObject id_doc_copy_back_info = idDocInfoObject.getJSONObject("id_doc_copy_back_info");
idDocInfo.setIdDocCopyBack(this.getMerchantMediaId(id_doc_copy_back_info));
}
idDocInfo.setIdDocName(idDocInfoObject.getString("id_doc_name"));
idDocInfo.setIdDocNumber(idDocInfoObject.getString("id_doc_number"));
idDocInfo.setIdDocAddress(idDocInfoObject.getString("id_doc_address"));
idDocInfo.setDocPeriodBegin(idDocInfoObject.getString("doc_period_begin"));
idDocInfo.setDocPeriodEnd(idDocInfoObject.getString("doc_period_end"));
identityInfo.setIdDocInfo(idDocInfo);
}
if(EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){
if(EnumYesOrNo.YES.getCode().equals(receiverApply.getOwner())){
identityInfo.setOwner(true);
}else{
identityInfo.setOwner(false);
List<WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo> uboInfoList = new ArrayList<>();
JSONArray jsonArray = JSONArray.parseArray(receiverApply.getUboInfoList());
for(int i = 0;i < jsonArray.size();i++){
JSONObject uboInfoObject = jsonArray.getJSONObject(i);
WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo uboInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo();
Integer ubo_id_doc_type = uboInfoObject.getInteger("ubo_id_doc_type");
EnumSharingReceiverIdDocType enumUboIdDocType = EnumSharingReceiverIdDocType.getEnum(ubo_id_doc_type);
uboInfo.setUboIdDocType(enumUboIdDocType.getIdTypeEnum());
JSONObject ubo_id_doc_copy_info = uboInfoObject.getJSONObject("ubo_id_doc_copy_info");
uboInfo.setUboIdDocCopy(this.getMerchantMediaId(ubo_id_doc_copy_info));
if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumUboIdDocType)){
JSONObject ubo_id_doc_copy_back_info = uboInfoObject.getJSONObject("ubo_id_doc_copy_back_info");
uboInfo.setUboIdDocCopyBack(this.getMerchantMediaId(ubo_id_doc_copy_back_info));
}
uboInfo.setUboIdDocName(uboInfoObject.getString("ubo_id_doc_name"));
uboInfo.setUboIdDocNumber(uboInfoObject.getString("ubo_id_doc_number"));
uboInfo.setUboIdDocAddress(uboInfoObject.getString("ubo_id_doc_address"));
uboInfo.setUboPeriodBegin(uboInfoObject.getString("ubo_period_begin"));
uboInfo.setUboPeriodEnd(uboInfoObject.getString("ubo_period_end"));
uboInfoList.add(uboInfo);
}
subjectInfo.setUboInfoList(uboInfoList);
}
}
subjectInfo.setIdentityInfo(identityInfo);
} else{
//todo 其他主体
}
request.setSubjectInfo(subjectInfo);
WxPayApplyment4SubCreateRequest.BusinessInfo businessInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo();
businessInfo.setMerchantShortname(receiverApply.getMerchantShortname());
businessInfo.setServicePhone(receiverApply.getServicePhone());
JSONObject salesInfoObject = JSONObject.parseObject(receiverApply.getSalesInfo());
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo salesInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo();
JSONArray sales_scenes_type = salesInfoObject.getJSONArray("sales_scenes_type");
List<Integer> salesScenesTypes = sales_scenes_type.toJavaList(Integer.class);
List<SalesScenesTypeEnum> salesScenesTypeEnumList = EnumSharingReceiverSalesScenesType.getSalesScenesTypeEnumList(salesScenesTypes);
salesInfo.setSalesScenesType(salesScenesTypeEnumList);
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_STORE.getCode())){
JSONObject biz_store_info = salesInfoObject.getJSONObject("biz_store_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.BizStoreInfo bizStoreInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.BizStoreInfo();
bizStoreInfo.setBizStoreName(biz_store_info.getString("biz_store_name"));
bizStoreInfo.setBizAddressCode(biz_store_info.getString("biz_address_code"));
JSONArray store_entrance_pic = biz_store_info.getJSONArray("store_entrance_pic");
bizStoreInfo.setStoreEntrancePic(this.getMerchantMediaIds(store_entrance_pic));
JSONArray indoor_pic = biz_store_info.getJSONArray("indoor_pic");
bizStoreInfo.setIndoorPic(this.getMerchantMediaIds(indoor_pic));
bizStoreInfo.setBizSubAppid(biz_store_info.getString("biz_sub_appid"));
salesInfo.setBizStoreInfo(bizStoreInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MP.getCode())){
JSONObject mp_info = salesInfoObject.getJSONObject("mp_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MpInfo mpInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MpInfo();
mpInfo.setMpAppid(mp_info.getString("mp_appid"));
mpInfo.setMpSubAppid(mp_info.getString("mp_sub_appid"));
JSONArray mp_pics = mp_info.getJSONArray("mp_pics");
mpInfo.setMpPics(this.getMerchantMediaIds(mp_pics));
salesInfo.setMpInfo(mpInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MINI_PROGRAM.getCode())){
JSONObject mini_program_info = salesInfoObject.getJSONObject("mini_program_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MiniProgramInfo miniProgramInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MiniProgramInfo();
miniProgramInfo.setMiniProgramAppid(mini_program_info.getString("mini_program_appid"));
miniProgramInfo.setMiniProgramSubAppid(mini_program_info.getString("mini_program_sub_appid"));
List<String> mediaIds = this.getMerchantMediaIds(mini_program_info.getJSONArray("mini_program_pics"));
if(!mediaIds.isEmpty()){
miniProgramInfo.setMiniProgramPics(mediaIds);
}
salesInfo.setMiniProgramInfo(miniProgramInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEB.getCode())){
JSONObject web_info = salesInfoObject.getJSONObject("web_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WebInfo webInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WebInfo();
webInfo.setDomain(web_info.getString("domain"));
JSONObject web_authorisation_info = web_info.getJSONObject("web_authorisation_info");
webInfo.setWebAuthorisation(this.getMerchantMediaId(web_authorisation_info));
webInfo.setWebAppid(web_info.getString("web_appid"));
salesInfo.setWebInfo(webInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_APP.getCode())){
JSONObject app_info = salesInfoObject.getJSONObject("app_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.AppInfo appInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.AppInfo();
appInfo.setAppAppid(app_info.getString("app_appid"));
appInfo.setAppSubAppid(app_info.getString("app_sub_appid"));
JSONArray app_pics = app_info.getJSONArray("app_pics");
appInfo.setAppPics(this.getMerchantMediaIds(app_pics));
salesInfo.setAppInfo(appInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEWORK.getCode())){
JSONObject wework_info = salesInfoObject.getJSONObject("wework_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WeworkInfo weworkInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WeworkInfo();
weworkInfo.setSubCorpId(wework_info.getString("sub_corp_id"));
JSONArray wework_pics = wework_info.getJSONArray("wework_pics");
weworkInfo.setWeworkPics(this.getMerchantMediaIds(wework_pics));
salesInfo.setWeworkInfo(weworkInfo);
}
businessInfo.setSalesInfo(salesInfo);
request.setBusinessInfo(businessInfo);
WxPayApplyment4SubCreateRequest.SettlementInfo settlementInfo = new WxPayApplyment4SubCreateRequest.SettlementInfo();
JSONObject settlementInfoObject = JSONObject.parseObject(receiverApply.getSettlementInfo());
settlementInfo.setSettlementId(settlementInfoObject.getString("settlement_id"));
settlementInfo.setQualificationType(settlementInfoObject.getString("qualification_type"));
JSONArray qualifications = JSONObject.parseArray(receiverApply.getQualifications());
List<String> mediaIds = this.getMerchantMediaIds(qualifications);
if(!mediaIds.isEmpty()){
settlementInfo.setQualifications(mediaIds);
}
settlementInfo.setActivitiesId(settlementInfoObject.getString("activities_id"));
settlementInfo.setActivitiesRate(settlementInfoObject.getString("activities_rate"));
JSONArray activities_additions = settlementInfoObject.getJSONArray("activities_additions");
List<String> mediaIds1 = this.getMerchantMediaIds(activities_additions);
if(!mediaIds1.isEmpty()){
settlementInfo.setActivitiesAdditions(mediaIds1);
}
request.setSettlementInfo(settlementInfo);
WxPayApplyment4SubCreateRequest.BankAccountInfo bankAccountInfo = new WxPayApplyment4SubCreateRequest.BankAccountInfo();
JSONObject accountInfoObject = JSONObject.parseObject(receiverApply.getAccountInfo());
EnumSharingReceiverAccountType enumAccountType = EnumSharingReceiverAccountType.getEnum(accountInfoObject.getInteger("bank_account_type"));
bankAccountInfo.setBankAccountType(enumAccountType.getBankAccountTypeEnum());
bankAccountInfo.setAccountName(accountInfoObject.getString("account_name"));
bankAccountInfo.setAccountBank(accountInfoObject.getString("account_bank"));
boolean need_bank_branch = accountInfoObject.getBooleanValue("need_bank_branch");
if(need_bank_branch){
bankAccountInfo.setBankBranchId(accountInfoObject.getString("bank_branch_id"));
bankAccountInfo.setBankName(accountInfoObject.getString("bank_name"));
}
bankAccountInfo.setBankAddressCode(accountInfoObject.getString("bank_address_code"));
bankAccountInfo.setAccountNumber(accountInfoObject.getString("account_number"));
//todo 1. 当主体类型是“政府机关/事业单位”时或所属行业为“党费”时,支持在有合法资金管理关系的情况下结算账户设置为非同名。
//todo 2. 若结算账户设置为非同名,则需填写非同名证明材料,若结算账户为同名,则无需填写。
request.setBankAccountInfo(bankAccountInfo);
WxPayApplyment4SubCreateRequest.ContactInfo contactInfo = new WxPayApplyment4SubCreateRequest.ContactInfo();
JSONObject contactInfoObject = JSONObject.parseObject(receiverApply.getContactInfo());
Integer contact_type = contactInfoObject.getInteger("contact_type");
EnumSharingReceiverContactType enumContactType = EnumSharingReceiverContactType.getEnum(contact_type);
contactInfo.setContactType(enumContactType.getContactTypeEnum());
contactInfo.setContactName(contactInfoObject.getString("contact_name"));
if(EnumSharingReceiverContactType.SUPER.equals(enumContactType)){
Integer contact_id_doc_type = contactInfoObject.getInteger("contact_id_doc_type");
EnumSharingReceiverIdDocType enumIdDocType = EnumSharingReceiverIdDocType.getEnum(contact_id_doc_type);
contactInfo.setContactIdDocType(enumIdDocType.getIdTypeEnum());
contactInfo.setContactIdNumber(contactInfoObject.getString("contact_id_number"));
JSONObject contact_id_doc_copy_info = contactInfoObject.getJSONObject("contact_id_doc_copy_info");
contactInfo.setContactIdDocCopy(this.getMerchantMediaId(contact_id_doc_copy_info));
if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumIdDocType)) {
JSONObject contact_id_doc_copy_back_info = contactInfoObject.getJSONObject("contact_id_doc_copy_back_info");
contactInfo.setContactIdDocCopyBack(this.getMerchantMediaId(contact_id_doc_copy_back_info));
}
contactInfo.setContactPeriodBegin(contactInfoObject.getString("contact_period_begin"));
contactInfo.setContactPeriodEnd(contactInfoObject.getString("contact_period_end"));
JSONObject business_authorization_letter_info = contactInfoObject.getJSONObject("business_authorization_letter_info");
contactInfo.setBusinessAuthorizationLetter(this.getMerchantMediaId(business_authorization_letter_info));
}
contactInfo.setOpenid(contactInfoObject.getString("openid"));
contactInfo.setMobilePhone(contactInfoObject.getString("mobile_phone"));
contactInfo.setContactEmail(contactInfoObject.getString("contact_email"));
request.setContactInfo(contactInfo);
WxPayApplyment4SubCreateRequest.AdditionInfo additionInfo = new WxPayApplyment4SubCreateRequest.AdditionInfo();
if(StringUtils.isNotBlank(receiverApply.getAdditionInfo())){
JSONObject additionInfoObject = JSONObject.parseObject(receiverApply.getAdditionInfo());
JSONObject legal_person_commitment_info = additionInfoObject.getJSONObject("legal_person_commitment_info");
additionInfo.setLegalPersonCommitment(this.getMerchantMediaId(legal_person_commitment_info));
JSONObject legal_person_video_info = additionInfoObject.getJSONObject("legal_person_video_info");
additionInfo.setLegalPersonVideo(this.getMerchantMediaId(legal_person_video_info));
}
if(StringUtils.isNotBlank(receiverApply.getBusinessAdditionPics())){
JSONArray business_addition_pics = JSONObject.parseArray(receiverApply.getBusinessAdditionPics());
List<String> mediaIds2 = this.getMerchantMediaIds(business_addition_pics);
if(!mediaIds2.isEmpty()){
additionInfo.setBusinessAdditionPics(mediaIds2);
}
}
if(StringUtils.isNotBlank(receiverApply.getBusinessAdditionDesc())){
additionInfo.setBusinessAdditionMsg(contactInfoObject.getString("business_addition_msg"));
}
request.setAdditionInfo(additionInfo);
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());
}
return null;
}

private boolean modifySettlement(TenantEntity tenantEntity,String subMchid,String accountInfo){
WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantEntity.getTenantId());
try {
ModifySettlementRequest request = new ModifySettlementRequest();
JSONObject accountInfoObject = JSONObject.parseObject(accountInfo);
EnumSharingReceiverAccountType enumAccountType = EnumSharingReceiverAccountType.getEnum(accountInfoObject.getInteger("bank_account_type"));
request.setAccountType(enumAccountType.getAccountTypeEnum());
request.setAccountName(accountInfoObject.getString("account_name"));
request.setAccountBank(accountInfoObject.getString("account_bank"));
request.setBankAddressCode(accountInfoObject.getString("bank_address_code"));
request.setBankBranchId(accountInfoObject.getString("bank_branch_id"));
request.setBankName(accountInfoObject.getString("bank_name"));
request.setAccountNumber(accountInfoObject.getString("account_number"));
String result = wxPayService.getApplyment4SubService().modifySettlement(subMchid, request);
return true;
} catch (WxPayException e) {
e.printStackTrace();
logger.error("修改结算帐号异常"+subMchid);
}
return false;
}



+ 0
- 14
yqzjService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java View File

@@ -33,8 +33,6 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {
@Autowired
WxMallFloorService wxMallFloorService;
@Autowired
WxPayAccountService wxPayAccountService;
@Autowired
WxPayAccountBillService wxPayAccountBillService;
@Autowired
WxAppinfoService wxAppinfoService;
@@ -195,18 +193,6 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {
@Override
@Transactional(rollbackFor = {Exception.class})
public void initPayAccount(WxAppinfo appinfo,WxPayAccount wxPayAccount) {
if(appinfo.getPayId() != null){
wxPayAccount.setId(appinfo.getPayId());
}
wxPayAccountService.saveOrUpdate(wxPayAccount);

if(appinfo.getPayId() == null){
WxAppinfo updApp = new WxAppinfo();
updApp.updateTenantInfo(appinfo);
updApp.setId(appinfo.getId());
updApp.setPayId(wxPayAccount.getId());
wxAppinfoService.saveOrUpdate(updApp);
}
}




+ 1
- 33
yqzjService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java View File

@@ -66,8 +66,6 @@ public class TtOrderServiceImpl implements TtOrderService {
@Autowired
private WxAppinfoService wxAppinfoService;

@Autowired
private WxPayAccountService payAccountService;

@Override
public PageInfo<TtOrder> listAsPage(TtOrder record, Integer pageIndex, Integer pageSize) {
@@ -228,10 +226,6 @@ public class TtOrderServiceImpl implements TtOrderService {
if(appInfo == null) {
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId());
if(payAcount == null){
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}
TtCoupon coupon = ttcouponMapper.selectById(order.getProductId());
if (!coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_SHELFING.getCode())) {
logger.error("券已经下架了>>>" + order.getProductId());
@@ -241,33 +235,7 @@ public class TtOrderServiceImpl implements TtOrderService {
if (order.getPaymentType() != EnumPayType.PAY_PAYMENT.getCode()) {
return new ResultData(ErrorCode.PAY_ORDER_IS_NOT_PAYMENT);
}
ResultData resultData = this.updateOrderStatus(orderId, appInfo, payAcount);
if(resultData.code == ResultData.SUCCESS){
return new ResultData(ErrorCode.ORDER_HAD_PAY);
}else if(resultData.code == ErrorCode.PAY_ORDER_NOT_PAY.getCode() ){
DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder();
preOrder.setAppId(appInfo.getAppId());
preOrder.setSercrect(appInfo.getSecret());
preOrder.setSalt(payAcount.getMerchantApiKey());
preOrder.setOutOrderNo(order.getId().toString());
preOrder.setTotalAmount(order.getPayment());
preOrder.setSubject(coupon.getTitle());
preOrder.setBody(coupon.getTitle());
preOrder.setValidTime(time_out);
// preOrder.setNotifyUrl();//回调地址

CreatePreOrderResult preOrderResult = DouYinPayHelper.createPreOrder(preOrder);
// if(preOrderResult.isSuccess()){
// TtOrder orderSuc = new TtOrder();
// orderSuc.setId(order.getId());
// orderSuc.setOrderStatus(EnumTtOrderStatus.ORDER_STATUS_PAYMENT_ING.getCode());
// orderSuc.setUpdateDate(new Date());
// ttOrderMapper.updateById(orderSuc);
// }
return new ResultData(preOrderResult);
}else{
return resultData;
}
return null;

}



Loading…
Cancel
Save