|
@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil;
|
|
|
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;
|
|
@@ -17,6 +16,7 @@ import com.zfire.mall.manager.commonmapper.K3Mapper;
|
|
|
import com.zfire.mall.manager.commonmapper.listV2.CommonCMapper;
|
|
|
import com.zfire.mall.manager.constant.Constant;
|
|
|
import com.zfire.mall.manager.constant.KingDeeCons;
|
|
|
+import com.zfire.mall.manager.enums.ExamineStatusEnum;
|
|
|
import com.zfire.mall.manager.exception.RemoteServiceException;
|
|
|
import com.zfire.mall.manager.helper.ResponseHelper;
|
|
|
import com.zfire.mall.manager.logic.common.CommonLogic;
|
|
@@ -32,6 +32,7 @@ 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.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -476,11 +477,19 @@ public class K3ReceiptLogic {
|
|
|
kingDeeWallet.updateById();
|
|
|
}
|
|
|
|
|
|
- public void examine(String billNo, String cancelStatus) {
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void examine(String billNo, String cancelStatus) throws InterruptedException {
|
|
|
|
|
|
KingDeeReceipt kingDeeReceipt = kingDeeReceiptService.getById(billNo);
|
|
|
kingDeeReceipt.setStatus(cancelStatus);
|
|
|
kingDeeReceipt.updateById();
|
|
|
+
|
|
|
+ if (kingDeeReceipt.getStatus().equals(ExamineStatusEnum.OK.getKey())) {
|
|
|
+ List<KingDeeReceipt> kingDeeReceipts = new ArrayList<>();
|
|
|
+ kingDeeReceipts.add(kingDeeReceipt);
|
|
|
+ this.initAmount(kingDeeReceipts);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -525,12 +534,62 @@ public class K3ReceiptLogic {
|
|
|
}
|
|
|
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(oldBill,subAmount,oldBill.getRemark()));
|
|
|
}
|
|
|
|
|
|
- // customerWalletAmountBeans.add(this.doAmount(kingDeeReceipt,amount,kingDeeReceipt.getRemark()));
|
|
|
+ customerWalletAmountBeans.add(this.doAmount(kingDeeReceipt,amount,kingDeeReceipt.getRemark()));
|
|
|
}
|
|
|
walletLogic.doWalletAmount(customerWalletAmountBeans);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ private CustomerWalletAmountBean doAmount(KingDeeReceipt kingDeeReceipt,BigDecimal amountParam,String remark) throws InterruptedException {
|
|
|
+ String customerId = kingDeeReceipt.getCustomerId();
|
|
|
+ String walletId = kingDeeReceipt.getWalletId();
|
|
|
+ String billType = kingDeeReceipt.getBillType();//1=收款单 2=退款单 3=付款单
|
|
|
+ String billNo = kingDeeReceipt.getBillNo();
|
|
|
+
|
|
|
+ //退款单 和 付款单 要反着来
|
|
|
+ if("3".equals(billType) || "2".equals(billType)){
|
|
|
+ amountParam = BigDecimal.valueOf(0).subtract(amountParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ double amount = amountParam.stripTrailingZeros().doubleValue();
|
|
|
+ if(amount == 0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(customerId) || StringUtils.isEmpty(walletId)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ CustomerWallet customerWallet = walletLogic.queryCustomerWallet(customerId, walletId);
|
|
|
+ if(customerWallet == null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if(amount > 0) {
|
|
|
+ String billName = "";
|
|
|
+ if(billType.equals("1")){
|
|
|
+ billName = Constant.BILL_TYPE_SKD;
|
|
|
+ }else if(billType.equals("2")){
|
|
|
+ billName = Constant.BILL_TYPE_TKD;
|
|
|
+ }else{
|
|
|
+ billName = Constant.BILL_TYPE_FKD;
|
|
|
+ }
|
|
|
+ return new CustomerWalletAmountBean(customerWallet.getCustomerWalletId(), amountParam, remark, billName, new Date(), billNo, 1, "add");
|
|
|
+ } else{
|
|
|
+ String billName = "";
|
|
|
+ if(billType.equals("1")){
|
|
|
+ billName = Constant.BILL_TYPE_SKD;
|
|
|
+ }else if(billType.equals("2")){
|
|
|
+ billName = Constant.BILL_TYPE_TKD;
|
|
|
+ }else{
|
|
|
+ billName = Constant.BILL_TYPE_FKD;
|
|
|
+ }
|
|
|
+ BigDecimal a = BigDecimal.valueOf(0).subtract(amountParam);
|
|
|
+ return new CustomerWalletAmountBean(customerWallet.getCustomerWalletId(), a, remark, billName, new Date(),billNo , 1,"sub");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|