Selaa lähdekoodia

处理以前分账错误记录

release_toaliyun_real
xiaohanzi 5 vuotta sitten
vanhempi
commit
347b828f1e
3 muutettua tiedostoa jossa 99 lisäystä ja 0 poistoa
  1. +40
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoScheduletttttttttttttttttttttttttt.java
  2. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxProfitSharingOrderService.java
  3. +56
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java

+ 40
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoScheduletttttttttttttttttttttttttt.java Näytä tiedosto

@@ -0,0 +1,40 @@
package com.iformall.schedule;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxSharingOrderDto;
import com.iformall.domain.po.WxProfitSharingOrder;
import com.iformall.enums.EnumPayWay;
import com.iformall.enums.EnumProfitSharingOrderStatus;
import com.iformall.enums.EnumProfitSharingOrderType;
import com.iformall.mapper.WxPayOrderMapper;
import com.iformall.mapper.WxProfitSharingOrderMapper;
import com.iformall.service.WxProfitSharingOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SharingOrderRedoScheduletttttttttttttttttttttttttt {

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

@Autowired
private WxProfitSharingOrderService wxProfitSharingOrderService;

@Autowired
private WxProfitSharingOrderMapper wxProfitSharingOrderMapper;


@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨02:00分账重试
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void sharingOrderResultSchedule() {

wxProfitSharingOrderService.updatetttttttttttttt();

}
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/service/WxProfitSharingOrderService.java Näytä tiedosto

@@ -40,5 +40,8 @@ public interface WxProfitSharingOrderService {
Map<String,Object> queryOrderSummary(TenantEntity tenantEntity);

ResultData findOrderDetails(Long id);
void updatetttttttttttttt();

}

+ 56
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java Näytä tiedosto

@@ -616,5 +616,61 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
}
}

//更新以前分账用户绑定微信号的分账数据,微信已经停止了微信号分账
@Override
@Deprecated
public void updatetttttttttttttt() {
WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder();
wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode());
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode());
List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder);
list.stream().forEach(sharingOrder->{
if (!sharingOrder.getType().equals(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode())) {
return;
}

WxProfitShareAppInoDto dto = getAppinfo(sharingOrder);
WxAppinfo appInfo = dto.getAppinfo();
WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId());

List<JSONObject> receivers;

receivers = JSONArray.parseArray(sharingOrder.getReceivers(), JSONObject.class);
if (receivers.size() != 1 )
return;

Integer amount = receivers.get(0).getInteger("amount");
if (!EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getMessage().equals(receivers.get(0).getString("type"))) {
return;
}
//准备分账列表
WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver();
psReceiverQ.updateTenantInfo(payAccount);
psReceiverQ.setMerchantId(sharingOrder.getMerchantId());
psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(dto.getPayWay()).getProfitSharingType());
psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode());
List<WxProfitSharingReceiver> psReceiverList = wxProfitSharingReceiverMapper.findList(psReceiverQ);
if (null == psReceiverList || psReceiverList.size() !=1 ) {
return ;
}
JSONArray realReceivers = new JSONArray();
psReceiverList.stream().forEach(receiver->{
JSONObject jo = new JSONObject();
jo.put("type",payServiceFactory.getPayShareAdapterService(dto.getPayWay()).getShareAccount(receiver.getReceiverType()).getMessage());
jo.put("account",receiver.getReceiverAccount());
jo.put("amount", amount);
//jo.put("description",receiver.getReceiverComments()); //改为存ID,
jo.put("description",receiver.getId().toString()); //为重试做准备
realReceivers.add(jo);
});
sharingOrder.setReceivers(JSON.toJSONString(realReceivers));
wxProfitSharingOrderMapper.updateById(sharingOrder);
});
}


}

Ladataan…
Peruuta
Tallenna