|
|
@@ -52,16 +52,19 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
ambInvest.setStatus(in.getStatus());
|
|
|
ambInvest.setOperator(TokenManager.getAdminId());
|
|
|
ambInvest.setComment(in.getComment());
|
|
|
- Integer x=ambInvestMapper.selectCountAmountById(other.getId());
|
|
|
- if (x!=null){
|
|
|
- ambInvest.setCountAmount(ambInvest.getAmount().add(new BigDecimal(x)));
|
|
|
- }
|
|
|
+ sumCountAmount(other.getId(), ambInvest);
|
|
|
ambInvestMapper.insertSelective(ambInvest);
|
|
|
addAmbInvestLog(in, ambInvest);
|
|
|
if (in.getStatus()==1)addNoticAndEmail(1,myAmb,other);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ 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 void addNoticAndEmail(Integer i,AmbSystem myAmb,AmbSystem other) {
|
|
|
StringBuffer str=new StringBuffer();
|
|
|
Integer notceType=0;
|
|
|
@@ -152,12 +155,8 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
newOther.setTotalAmount(other.getTotalAmount().add(ambInvest.getAmount()));
|
|
|
ambSystemMapper.updateByPrimaryKeySelective(newMy);
|
|
|
ambSystemMapper.updateByPrimaryKeySelective(newOther);
|
|
|
- Integer x=ambInvestMapper.selectCountAmountById(newOther.getId());
|
|
|
- if (x!=null){
|
|
|
- newAmbInvest.setCountAmount(ambInvest.getAmount().add(new BigDecimal(x)));
|
|
|
- }
|
|
|
+ sumCountAmount(newOther.getId(), newAmbInvest);
|
|
|
}
|
|
|
-
|
|
|
ambInvestMapper.updateByPrimaryKeySelective(newAmbInvest);
|
|
|
addAmbInvestLog(in, ambInvest);
|
|
|
addNoticAndEmail(in.getStatus(),myAmb,other);
|