Browse Source

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real

release_toaliyun_real
zhengfangyuan 3 years ago
parent
commit
a2faa1b19d
2 changed files with 37 additions and 24 deletions
  1. +2
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java
  2. +35
    -22
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java

+ 2
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/CouponOrderExpiringSchedule.java View File

@@ -87,8 +87,8 @@ public class CouponOrderExpiringSchedule {

}

// @Scheduled(cron = "0 0 5 * * ?") // 每天凌晨00:05
@Scheduled(cron = "0 */10 * * * ?") // 测试10秒中一次
@Scheduled(cron = "0 0 5 * * ?") // 每天凌晨00:05
// @Scheduled(cron = "0 */10 * * * ?") // 测试10秒中一次
public void couponOrderRefundSchedule() {
CouponOrderExpiringSchedule proxy = (CouponOrderExpiringSchedule) AopContext.currentProxy();
List<WxMall> malls = getMalls();


+ 35
- 22
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -679,20 +679,24 @@ public class WxCouponServiceImpl implements WxCouponService {
}

PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion());
List<Long> merchantIds = new ArrayList<>();
for (JSONObject o:merchantParamList) {
merchantIds.add(o.getLong("id"));
}
WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(record);
merchantQ.setIds(merchantIds);
Map<Long, String> idAndNamesMap = wxMerchantService.getIdAndNamesMap(merchantQ);

if (EnumPayMchType.DIRECT.equals(payMchType)) {
Long merchantId = null;
if (merchantParamList.size() > 1) {
List<Long> merchantIds = new ArrayList<>();
for (JSONObject o:merchantParamList) {
merchantIds.add(o.getLong("id"));
}
WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(record);
merchantQ.setIds(merchantIds);
merchantQ.setIsAdmin(EnumYesOrNo.YES.getCode());
merchantQ.setStatus(EnumMerchantStatus.VALID.getCode());
List<Long> list = wxMerchantMapper.findIdList(merchantQ);
if (merchantIds.size() > 1) {
WxMerchant merchantQ2 = new WxMerchant();
merchantQ2.updateTenantInfo(record);
merchantQ2.setIds(merchantIds);
merchantQ2.setIsAdmin(EnumYesOrNo.YES.getCode());
merchantQ2.setStatus(EnumMerchantStatus.VALID.getCode());
List<Long> list = wxMerchantMapper.findIdList(merchantQ2);
if(list == null || list.isEmpty()){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券需包含一个商管商户");
}else if(list.size() > 1){
@@ -702,28 +706,28 @@ public class WxCouponServiceImpl implements WxCouponService {
merchantId = list.get(0);
}else{
record.setMerchantType(EnumCouponMerchantType.ONE_MERCHANT.getCode());
merchantId = merchantParamList.get(0).getLong("id");
merchantId = merchantIds.get(0);
}
WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode());

if (receiver == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "对应门店至少进件一种支付模式");
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未配置收款账户");
}
if (EnumAppPlat.TOUTIAO.equals(plat)) {
if (!MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())
&& !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())
&& !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "对应门店至少进件一种支付模式");
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未配置收款账户");
}
}
} else if (EnumPayShare.YES.equals(isShare)) {
for (int i = 0, size = merchantParamList.size(); i < size; i++) {
JSONObject jsonObject = merchantParamList.get(i);
Long merchantId = jsonObject.getLong("id");
List<String> merchantNames = new ArrayList();
for (Long merchantId:merchantIds) {
WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchTypeEnum.getCode());
int n = i + 1;
if (receiver == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户还未配置分账账户或未进件");
merchantNames.add(idAndNamesMap.get(merchantId));
continue;
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户还未配置分账账户或未进件");
}
if (EnumAppPlat.TOUTIAO.equals(plat)) {
QueryMerchantResult openPayResult = payAccount.getOpenPayResult();
@@ -734,18 +738,27 @@ public class WxCouponServiceImpl implements WxCouponService {
}
if(EnumYesOrNo.YES.getCode().equals(openPayResult.getAlipay())
&& !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件支付宝");
merchantNames.add(idAndNamesMap.get(merchantId));
continue;
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件支付宝");
}
if(EnumYesOrNo.YES.getCode().equals(openPayResult.getWx())
&& !MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件微信");
merchantNames.add(idAndNamesMap.get(merchantId));
continue;
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件微信");
}
if(EnumYesOrNo.YES.getCode().equals(openPayResult.getHz())
&& !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "第(" + n + ")个商户未进件抖音");
merchantNames.add(idAndNamesMap.get(merchantId));
continue;
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "["+idAndNamesMap.get(merchantId)+"]未进件抖音");
}
}
}
if(!merchantNames.isEmpty()){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), JSONArray.toJSONString(merchantNames)+"未配置分账账户");
}
}
}
return new ResultData();


Loading…
Cancel
Save