|
|
@@ -10,18 +10,11 @@ import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
|
import com.usoftchina.saas.commons.po.BillCodeSeq;
|
|
|
import com.usoftchina.saas.commons.po.Status;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
-import com.usoftchina.saas.document.entities.Bankinformation;
|
|
|
-import com.usoftchina.saas.document.entities.Customer;
|
|
|
-import com.usoftchina.saas.document.entities.Vendor;
|
|
|
-import com.usoftchina.saas.document.mapper.BankinformationMapper;
|
|
|
-import com.usoftchina.saas.document.mapper.CustomerMapper;
|
|
|
-import com.usoftchina.saas.document.mapper.VendorMapper;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
import com.usoftchina.saas.money.mapper.*;
|
|
|
import com.usoftchina.saas.money.po.*;
|
|
|
import com.usoftchina.saas.money.service.RecbalanceService;
|
|
|
import com.usoftchina.saas.page.PageRequest;
|
|
|
-import io.netty.util.internal.MathUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
@@ -47,10 +40,6 @@ public class RecbalanceServiceImpl implements RecbalanceService {
|
|
|
private BanksubledgerMapper banksubledgerMapper;
|
|
|
@Autowired
|
|
|
private SubledgerMapper subledgerMapper;
|
|
|
- @Autowired
|
|
|
- private CustomerMapper customerMapper;
|
|
|
- @Autowired
|
|
|
- private BankinformationMapper bankinformationMapper;
|
|
|
|
|
|
@Override
|
|
|
public DocBaseDTO insert(Rec rec) {
|
|
|
@@ -214,81 +203,21 @@ public class RecbalanceServiceImpl implements RecbalanceService {
|
|
|
recbalanceMapper.updateByPrimaryKeySelective(recbalance);
|
|
|
}
|
|
|
|
|
|
- Recbalance updateRay = new Recbalance();
|
|
|
+ Recbalance updatePay = new Recbalance();
|
|
|
List<Recbalancedet> recbalancedet = rec.getItems1();
|
|
|
List<Recbalancedetail> recbalancedetail = rec.getItems2();
|
|
|
- //更新主表付款金额:rb_rdamount=从表一金额合计
|
|
|
+ //更新主表付款金额:pb_pdamount=从表一金额合计
|
|
|
Double amountTotal = new Double(0);
|
|
|
for (Recbalancedet det: recbalancedet) {
|
|
|
amountTotal = amountTotal + det.getRd_amount();
|
|
|
- //更新账户资料金额
|
|
|
- Bankinformation bankinformation = new Bankinformation();
|
|
|
- Bankinformation nowBankInformation = bankinformationMapper.selectByPrimaryKey(det.getRd_bankid());
|
|
|
- bankinformation.setBk_thisamount(nowBankInformation.getBk_thisamount()+det.getRd_amount());
|
|
|
- bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
|
|
|
- }
|
|
|
- //更新主表pb_pbdamount=从表二金额合计
|
|
|
- Double amountTotal2 = new Double(0);
|
|
|
- for (Recbalancedetail detail : recbalancedetail){
|
|
|
- amountTotal2 = amountTotal2 + detail.getRbd_amount();
|
|
|
}
|
|
|
- updateRay.setId(rec.getMain().getId());
|
|
|
- updateRay.setRb_rdamount(amountTotal);
|
|
|
- updateRay.setRb_rbdamount(amountTotal2);
|
|
|
- recbalanceMapper.updateByPrimaryKeySelective(updateRay);
|
|
|
- /**
|
|
|
- * 更新客户资料
|
|
|
- * cu_preamount=nvl(cu_preamount,0)+rb_preamount,
|
|
|
- * cu_recamount=nvl(cu_recamount,0)-rb_rbdamount,
|
|
|
- * cu_leftamount=cu_beginaramount-cu_beginprerecamount+cu_recamount-cu_preamount;
|
|
|
- */
|
|
|
- Customer customerData = customerMapper.selectByPrimaryKey(Long.valueOf(String.valueOf(recbalance.getRb_custid())));
|
|
|
- Double preamount = customerData.getCu_preamount();
|
|
|
- Double beginapamount = customerData.getCu_beginaramount();
|
|
|
- Double beginprepayamount= customerData.getCu_beginprerecamount();
|
|
|
- Double recamount = customerData.getCu_recamount();
|
|
|
-
|
|
|
- Customer customer = new Customer();
|
|
|
- customer.setId(Long.valueOf(String.valueOf(recbalance.getRb_custid())));
|
|
|
- customer.setCu_preamount(preamount+amountTotal);
|
|
|
- customer.setCu_recamount(recamount-amountTotal2);
|
|
|
- customer.setCu_leftamount(beginapamount-beginprepayamount+recamount-amountTotal2-preamount-amountTotal);
|
|
|
- customerMapper.updateByPrimaryKeySelective(customer);
|
|
|
+ updatePay.setId(rec.getMain().getId());
|
|
|
+ updatePay.setRb_rdamount(amountTotal);
|
|
|
+ //updateByPrimaryKeySelective
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void unAudit(Long id) {
|
|
|
- //更新供应商资料
|
|
|
- /**
|
|
|
- * ve_preamount=nvl(ve_preamount,0)-pb_preamount,
|
|
|
- * ve_payamount=nvl(ve_payamount,0)+pb_pbdamount,
|
|
|
- * ve_leftamount=ve_beginapamount-ve_beginprepayamount+ve_payamount-ve_preamount;
|
|
|
- */
|
|
|
- Recbalance rec = recbalanceMapper.selectByPrimaryKey(Long.valueOf(id));
|
|
|
- Double pay_preamount = rec.getRb_preamount();
|
|
|
- Double pay_pbdamount = rec.getRb_rbdamount();
|
|
|
- Customer customerData = customerMapper.selectByPrimaryKey(Long.valueOf(String.valueOf(rec.getRb_custid())));
|
|
|
- Double preamount = customerData.getCu_preamount();
|
|
|
- Double beginapamount = customerData.getCu_beginaramount();
|
|
|
- Double beginprepayamount= customerData.getCu_beginprerecamount();
|
|
|
- Double recamount = customerData.getCu_recamount();
|
|
|
- Customer customer = new Customer();
|
|
|
- customer.setId(Long.valueOf(String.valueOf(rec.getRb_custid())));
|
|
|
- customer.setCu_preamount(preamount-pay_preamount);
|
|
|
- customer.setCu_recamount(recamount+pay_pbdamount);
|
|
|
- customer.setCu_leftamount(beginapamount-beginprepayamount+recamount+pay_pbdamount-preamount+pay_preamount);
|
|
|
- customerMapper.updateByPrimaryKeySelective(customer);
|
|
|
-
|
|
|
- //更新账户资料金额
|
|
|
- List<Recbalancedet> recbalancedet = recbalancedetMapper.selectByPrimaryKey(Math.toIntExact(id));
|
|
|
- for (Recbalancedet det:recbalancedet) {
|
|
|
- Bankinformation bankinformation = new Bankinformation();
|
|
|
- Bankinformation nowBankInformation = bankinformationMapper.selectByPrimaryKey(det.getRd_bankid());
|
|
|
- bankinformation.setBk_thisamount(nowBankInformation.getBk_thisamount()-det.getRd_amount());
|
|
|
- bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
Recbalance recbalance = new Recbalance();
|
|
|
recbalance.setId(id);
|
|
|
recbalance.setRb_status(Status.UNAUDITED.getDisplay());
|