|
|
@@ -67,12 +67,19 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param in 当前数据
|
|
|
+ * @param myAmb 发起方
|
|
|
+ */
|
|
|
private void chekAmount(InputAmbInvest in, AmbSystem myAmb) {
|
|
|
if (myAmb.getLvl()!=1){
|
|
|
List<OutInvestList> outInvestLists = ambInvestMapper.selectAmbInvestDtailsList(in.getMyAmbId(), 0);
|
|
|
BigDecimal count = new BigDecimal(0);
|
|
|
for (OutInvestList outInvestList : outInvestLists) {
|
|
|
- count=count.add(outInvestList.getAmount());
|
|
|
+ if (in.getId()!=null&&!in.getId().equals(outInvestList.getId())){
|
|
|
+ count=count.add(outInvestList.getAmount());
|
|
|
+ }
|
|
|
}
|
|
|
count=count.add(in.getAmount());
|
|
|
if (count.compareTo(myAmb.getSurplus())>0){
|
|
|
@@ -145,7 +152,9 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
@Override
|
|
|
public int updateInvestTransfer(InputAmbInvest in) {
|
|
|
AmbSystem myAmb = ambSystemMapper.selectByPrimaryKey(in.getMyAmbId());
|
|
|
- chekAmount(in, myAmb);
|
|
|
+ if(in.getRoleType()==0){
|
|
|
+ chekAmount(in, myAmb);
|
|
|
+ }
|
|
|
AmbSystem other=ambSystemMapper.selectByPrimaryKey(in.getOtherAmbId());
|
|
|
AmbInvest ambInvest=new AmbInvest();
|
|
|
ambInvest.setId(in.getId());
|
|
|
@@ -176,7 +185,7 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
if (in.getStatus()==2){
|
|
|
AmbSystem newMy=new AmbSystem();
|
|
|
newMy.setId(myAmb.getId());
|
|
|
- if (!(myAmb.getId()==1L)){
|
|
|
+ if (myAmb.getId()==1L){
|
|
|
newMy.setForeign(myAmb.getForeign().add(ambInvest.getAmount()));
|
|
|
}else {
|
|
|
newMy.setTotalAmount(myAmb.getTotalAmount().subtract(ambInvest.getAmount()));
|