|
|
@@ -45,10 +45,16 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int pushInvestTransfer(InputAmbInvest in) {
|
|
|
- AmbSystem myAmb = ambSystemMapper.selectByPrimaryKey(in.getMyAmbId());
|
|
|
+ AmbSystem myAmb =null;
|
|
|
+ if (in.getRoleType()==1){
|
|
|
+ myAmb= ambSystemMapper.selectByPrimaryKey(in.getMyAmbId());
|
|
|
+ }else {
|
|
|
+ myAmb=ambSystemMapper.selectByPrimaryKey(in.getMyAmbId());
|
|
|
+
|
|
|
+ }
|
|
|
AmbSystem other=ambSystemMapper.selectByPrimaryKey(in.getOtherAmbId());
|
|
|
AmbInvest ambInvest=new AmbInvest();
|
|
|
- ambInvest.setInitiateAmbId(in.getMyAmbId());
|
|
|
+ ambInvest.setInitiateAmbId(myAmb.getId());
|
|
|
ambInvest.setAcceptAmbId(in.getOtherAmbId());
|
|
|
ambInvest.setAmount(in.getAmount());
|
|
|
ambInvest.setStatus(in.getStatus());
|
|
|
@@ -104,8 +110,9 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
@Override
|
|
|
public Pagination<?> InvestList(InputInvestList in) {
|
|
|
Map<String,Object> params=new HashMap<>();
|
|
|
- if (TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)){
|
|
|
- params.put("roleType",1);
|
|
|
+ if (in.getRoleType()!=null){
|
|
|
+ params.put("roleType",in.getRoleType());
|
|
|
+ params.put("aid",TokenManager.getAdminId());
|
|
|
}
|
|
|
|
|
|
return findPage("selectInvestList","selectInvestCount",params,in.getPageNo(),in.getPageSize());
|
|
|
@@ -147,17 +154,19 @@ public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implem
|
|
|
newAmbInvest.setStatus(in.getStatus());
|
|
|
newAmbInvest.setAmount(ambInvest.getAmount());
|
|
|
if (in.getStatus()==2){
|
|
|
- AmbSystem newMy=new AmbSystem();
|
|
|
- newMy.setId(myAmb.getId());
|
|
|
- newMy.setTotalAmount(myAmb.getTotalAmount().subtract(ambInvest.getAmount()));
|
|
|
- newMy.setSurplus(myAmb.getSurplus().subtract(ambInvest.getAmount()));
|
|
|
- newMy.setForeign(myAmb.getForeign().add(ambInvest.getAmount()));
|
|
|
+ if (!(myAmb.getId()==1L)){
|
|
|
+ AmbSystem newMy=new AmbSystem();
|
|
|
+ newMy.setId(myAmb.getId());
|
|
|
+ newMy.setTotalAmount(myAmb.getTotalAmount().subtract(ambInvest.getAmount()));
|
|
|
+ newMy.setSurplus(myAmb.getSurplus().subtract(ambInvest.getAmount()));
|
|
|
+ newMy.setForeign(myAmb.getForeign().add(ambInvest.getAmount()));
|
|
|
+ ambSystemMapper.updateByPrimaryKeySelective(newMy);
|
|
|
+ }
|
|
|
AmbSystem newOther=new AmbSystem();
|
|
|
newOther.setId(other.getId());
|
|
|
newOther.setReceived(other.getReceived().add(ambInvest.getAmount()));
|
|
|
newOther.setSurplus(other.getSurplus().add(ambInvest.getAmount()));
|
|
|
newOther.setTotalAmount(other.getTotalAmount().add(ambInvest.getAmount()));
|
|
|
- ambSystemMapper.updateByPrimaryKeySelective(newMy);
|
|
|
ambSystemMapper.updateByPrimaryKeySelective(newOther);
|
|
|
sumCountAmount(newOther.getId(), newAmbInvest);
|
|
|
}
|