|
@@ -1,9 +1,10 @@
|
|
|
package com.zfire.mall.manager.logic.k3;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
-import com.aliyuncs.utils.StringUtils;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.zfire.mall.manager.bean.CommonCountBean;
|
|
|
import com.zfire.mall.manager.bean.ExcelData;
|
|
@@ -30,6 +31,7 @@ import com.zfire.mall.manager.plus.service.KingDeeReceiptService;
|
|
|
import com.zfire.mall.manager.plus.service.KingDeeWalletService;
|
|
|
import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
|
|
|
import com.zfire.mall.manager.zfire.util.FieldUtils;
|
|
|
+import lombok.extern.log4j.Log4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -41,6 +43,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
+@Log4j
|
|
|
public class K3ReceiptLogic {
|
|
|
|
|
|
@Autowired
|
|
@@ -463,11 +466,6 @@ public class K3ReceiptLogic {
|
|
|
kingDeeReceipt.getTheTime(),kingDeeReceipt.getBillNo(),1,"add");
|
|
|
walletLogic.doWalletAmount(customerWalletAmountBean);
|
|
|
}
|
|
|
- //弃审金蝶
|
|
|
- boolean b = k3ReceiptBillLogic.unAuditByBillNo(kingDeeReceipt.getBillNo(),billType);
|
|
|
- if(!b){
|
|
|
- throw new RemoteServiceException("对接金蝶系统异常,弃审失败");
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
public void add(KingDeeReceipt kingDeeWallet) {
|
|
@@ -484,4 +482,55 @@ public class K3ReceiptLogic {
|
|
|
kingDeeReceipt.setStatus(cancelStatus);
|
|
|
kingDeeReceipt.updateById();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 现金钱包金额充值/反审
|
|
|
+ * @param objects
|
|
|
+ * @throws InterruptedException
|
|
|
+ */
|
|
|
+ public void initAmount(List<KingDeeReceipt> objects) throws InterruptedException {
|
|
|
+ //一键生成经销商钱包
|
|
|
+// List<String> customerIds = objects.stream().filter(v -> v != null && StringUtils.isNotEmpty(v.getWalletId()))
|
|
|
+// .map(KingDeeReceipt::getCustomerId).distinct().collect(Collectors.toList());
|
|
|
+// for (String customerId : customerIds) {
|
|
|
+// walletLogic.initByK3Customer(customerId);
|
|
|
+// }
|
|
|
+ walletLogic.initByK3Customer(null);
|
|
|
+ log.info("收款单/退款单/付款单:"+ JSONObject.toJSONString(objects));
|
|
|
+
|
|
|
+ List<CustomerWalletAmountBean> customerWalletAmountBeans = new ArrayList<>();
|
|
|
+ //处理收款单/返利单逻辑/付款单
|
|
|
+ for(KingDeeReceipt kingDeeReceipt : objects){
|
|
|
+ if(kingDeeReceipt == null || (!kingDeeReceipt.getStatus().equals("C") && !kingDeeReceipt.getStatus().equals("D"))){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isEmpty(kingDeeReceipt.getWalletId().trim()) || org.apache.commons.lang3.StringUtils.isEmpty(kingDeeReceipt.getCustomerId().trim())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //本次同步过来的钱
|
|
|
+ BigDecimal amount = kingDeeReceipt.getAmount();
|
|
|
+ if(kingDeeReceipt.getStatus().equals("D")) {
|
|
|
+ amount = BigDecimal.valueOf(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //检查是否存在反审过来的单,如果之前存在审核通过的单,又有相同的单过来,代表该单这次被反审了,需要减掉它
|
|
|
+ KingDeeReceipt oldBill = kingDeeReceiptService.getById(kingDeeReceipt.getId());
|
|
|
+ if(oldBill != null && oldBill.getExamineTime() != null && kingDeeReceipt.getExamineTime() != null
|
|
|
+ && oldBill.getExamineTime().getTime() == kingDeeReceipt.getExamineTime().getTime()){
|
|
|
+ log.info("【重复同步的收款单/付款单】id:"+kingDeeReceipt.getId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(oldBill != null && oldBill.getStatus().equals("C")){
|
|
|
+ BigDecimal subAmount = BigDecimal.valueOf(0).subtract(oldBill.getAmount());
|
|
|
+ // customerWalletAmountBeans.add(this.doAmount(oldBill,subAmount,oldBill.getRemark()));
|
|
|
+ }
|
|
|
+
|
|
|
+ // customerWalletAmountBeans.add(this.doAmount(kingDeeReceipt,amount,kingDeeReceipt.getRemark()));
|
|
|
+ }
|
|
|
+ walletLogic.doWalletAmount(customerWalletAmountBeans);
|
|
|
+ }
|
|
|
+
|
|
|
}
|