|
|
@@ -62,7 +62,7 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
ambInvest.setComment(in.getComment());
|
|
|
AmbSystem other=ambSystemMapper.selectByPrimaryKey(in.getOtherAmbId());
|
|
|
//计算累计金额
|
|
|
- sumCountAmount(other.getId(), ambInvest);
|
|
|
+ ambInvest.setCountAmount(sumCountAmount( ambInvest));
|
|
|
ambInvestMapper.insertSelective(ambInvest);
|
|
|
addAmbInvestLog(in, ambInvest);
|
|
|
if (in.getStatus()==1)addNoticAndEmail(1,myAmb,other);
|
|
|
@@ -92,10 +92,9 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
|
|
|
|
|
|
|
|
|
- private void sumCountAmount(Long id, AmbInvest ambInvest) {
|
|
|
- Integer x=ambInvestMapper.selectCountAmountById(id);
|
|
|
- if (x==null)x=0;
|
|
|
- ambInvest.setCountAmount(ambInvest.getAmount().add(new BigDecimal(x)));
|
|
|
+ private BigDecimal sumCountAmount( AmbInvest ambInvest) {
|
|
|
+ BigDecimal count=ambInvestMapper.selectCountAmountById(ambInvest.getInitiateAmbId(),ambInvest.getAcceptAmbId());
|
|
|
+ return count!=null?count:new BigDecimal(0);
|
|
|
}
|
|
|
|
|
|
private void addNoticAndEmail(Integer i,AmbSystem myAmb,AmbSystem other) {
|
|
|
@@ -205,7 +204,7 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
newOther.setTotalAmount(other.getTotalAmount().add(ambInvest.getAmount()));
|
|
|
ambSystemMapper.updateByPrimaryKeySelective(newOther);
|
|
|
//计算累计金额
|
|
|
- sumCountAmount(newOther.getId(), newAmbInvest);
|
|
|
+ newAmbInvest.setCountAmount(sumCountAmount(ambInvest));
|
|
|
}
|
|
|
ambInvestMapper.updateByPrimaryKeySelective(newAmbInvest);
|
|
|
addAmbInvestLog(in, ambInvest);
|