Просмотр исходного кода

新增每次通过后计算累计

anderx лет назад: 3
Родитель
Сommit
d365ad90c1

+ 7 - 1
src/main/java/com/goafanti/ambSystem/service/Impl/AmbInvestServiceImpl.java

@@ -52,6 +52,10 @@ 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)));
+        }
         ambInvestMapper.insertSelective(ambInvest);
         addAmbInvestLog(in, ambInvest);
         if (in.getStatus()==1)addNoticAndEmail(1,myAmb,other);
@@ -149,7 +153,9 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
             ambSystemMapper.updateByPrimaryKeySelective(newMy);
             ambSystemMapper.updateByPrimaryKeySelective(newOther);
             Integer x=ambInvestMapper.selectCountAmountById(newOther.getId());
-            if (x!=null)newAmbInvest.setCountAmount(new BigDecimal(x));
+            if (x!=null){
+                newAmbInvest.setCountAmount(ambInvest.getAmount().add(new BigDecimal(x)));
+            }
         }
 
         ambInvestMapper.updateByPrimaryKeySelective(newAmbInvest);