|
|
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -78,6 +79,8 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
|
|
|
}else {
|
|
|
othreceipts.setCompanyId(BaseContextHolder.getCompanyId());
|
|
|
othreceipts.setOr_recorder(BaseContextHolder.getUserName());
|
|
|
+ othreceipts.setCreatorName(BaseContextHolder.getUserName());
|
|
|
+ othreceipts.setCreateTime(new Date());
|
|
|
othreceiptsMapper.insertSelective(othreceipts);
|
|
|
id = othreceipts.getId();
|
|
|
baseDTO = getBaseDTOById(id);
|
|
|
@@ -106,6 +109,8 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
|
|
|
Othreceipts othreceipts = othte.getMain();
|
|
|
othreceipts.setOr_status(Status.AUDITED.getDisplay());
|
|
|
othreceipts.setOr_statuscode(Status.AUDITED.name());
|
|
|
+ othreceipts.setOr_auditman(BaseContextHolder.getUserName());
|
|
|
+ othreceipts.setOr_auditdate(new Date());
|
|
|
this.changBankUntil(othte);
|
|
|
DocBaseDTO docBaseDTO = this.insert(othte);
|
|
|
Long id = docBaseDTO.getId();
|
|
|
@@ -197,11 +202,14 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
|
|
|
othreceipts.setId(Long.valueOf(id));
|
|
|
othreceipts.setOr_status(com.usoftchina.saas.commons.po.Status.UNAUDITED.getDisplay());
|
|
|
othreceipts.setOr_statuscode(Status.UNAUDITED.name());
|
|
|
+ othreceipts.setOr_auditman(null);
|
|
|
+ othreceipts.setOr_auditdate(null);
|
|
|
othreceiptsMapper.updateByPrimaryKeySelective(othreceipts);
|
|
|
|
|
|
//删除中间表
|
|
|
othreceipts = othreceiptsMapper.selectByPrimaryKey(id);
|
|
|
banksubledgerMapper.deleteByPrimaryKey(othreceipts.getOr_code(), "其他收入单");
|
|
|
+ subledgerMapper.deleteByPrimaryKey(othreceipts.getOr_code(), "其他收入单");
|
|
|
|
|
|
//更新资金
|
|
|
Double amount = banksubledgerMapper.selectThisamount(othreceipts.getOr_bankcode());
|
|
|
@@ -213,6 +221,41 @@ public class OthreceiptsServiceImpl extends CommonBaseServiceImpl<OthreceiptsMap
|
|
|
othreceipts.getOr_bankcode(), "-");
|
|
|
}
|
|
|
|
|
|
+ //资金账号表
|
|
|
+ int bk_inid = othreceipts.getOr_bankid();
|
|
|
+
|
|
|
+ Double or_amount = othreceipts.getOr_amount();
|
|
|
+ //收款
|
|
|
+ Bankinformation bankinformation = bankinformationMapper.selectByPrimaryKey(bk_inid);
|
|
|
+ Double beginamount = bankinformation.getBk_beginamount();
|
|
|
+ Double spending = bankinformation.getBk_spending() == null ? new Double(0) : bankinformation.getBk_spending();
|
|
|
+ Double incomme = bankinformation.getBk_income() == null ? new Double(0) : bankinformation.getBk_income();
|
|
|
+ bankinformation.setBk_thisamount(beginamount + incomme - spending - or_amount);
|
|
|
+ bankinformation.setBk_income(incomme - or_amount);
|
|
|
+ bankinformation.setBk_spending(spending);
|
|
|
+ bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
|
|
|
+
|
|
|
+ //客户付款
|
|
|
+ /**
|
|
|
+ * 更新客户资料
|
|
|
+ * 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 = recbalanceMapper.selectCustomerByPrimaryKey(othreceipts.getOr_custid());
|
|
|
+ Double preamount = customerData.getCu_preamount()==null?new Double(0):customerData.getCu_preamount();
|
|
|
+ Double beginapamount = customerData.getCu_beginaramount()==null?new Double(0):customerData.getCu_beginaramount();
|
|
|
+ Double beginprepayamount= customerData.getCu_beginprerecamount()==null?new Double(0):customerData.getCu_beginprerecamount();
|
|
|
+ Double recamount = customerData.getCu_recamount()==null?new Double(0):customerData.getCu_recamount();
|
|
|
+
|
|
|
+ Customer customer = new Customer();
|
|
|
+ customer.setId(Long.valueOf(othreceipts.getOr_custid()));
|
|
|
+ customer.setCu_preamount(preamount);
|
|
|
+ customer.setCu_recamount(recamount-or_amount);
|
|
|
+ customer.setCu_leftamount(beginapamount+beginprepayamount-recamount+or_amount+preamount);
|
|
|
+ recbalanceMapper.updateCustomerByPrimaryKeySelective(customer);
|
|
|
+
|
|
|
+
|
|
|
//计算期间金额
|
|
|
Statsinfo statsinfo = new Statsinfo();
|
|
|
List<Integer> ymList = othreceiptsdetailMapper.selectYm(id);
|