|
|
@@ -0,0 +1,59 @@
|
|
|
+package com.goafanti.ambSystem.service.Impl;
|
|
|
+
|
|
|
+import com.goafanti.ambSystem.bo.InputAmbInvest;
|
|
|
+import com.goafanti.ambSystem.service.AmbInvestService;
|
|
|
+import com.goafanti.ambSystem.service.AmbPaymentService;
|
|
|
+import com.goafanti.common.dao.AmbInvestLogMapper;
|
|
|
+import com.goafanti.common.dao.AmbInvestMapper;
|
|
|
+import com.goafanti.common.dao.AmbPaymentApplicationMapper;
|
|
|
+import com.goafanti.common.dao.AmbSystemMapper;
|
|
|
+import com.goafanti.common.error.BusinessException;
|
|
|
+import com.goafanti.common.model.AmbInvest;
|
|
|
+import com.goafanti.common.model.AmbInvestLog;
|
|
|
+import com.goafanti.common.model.AmbSystem;
|
|
|
+import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
+import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class AmbInvestServiceImpl extends BaseMybatisDao<AmbInvestMapper> implements AmbInvestService {
|
|
|
+ @Autowired
|
|
|
+ private AmbSystemMapper ambSystemMapper;
|
|
|
+ @Autowired
|
|
|
+ private AmbInvestMapper ambInvestMapper;
|
|
|
+ @Autowired
|
|
|
+ private AmbInvestLogMapper ambInvestLogMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public int pushInvestTransfer(InputAmbInvest in) {
|
|
|
+ AmbInvest ambInvest=new AmbInvest();
|
|
|
+ ambInvest.setInitiateAmbId(in.getMyAmbId());
|
|
|
+ ambInvest.setAcceptAmbId(in.getOtherAmbId());
|
|
|
+ ambInvest.setAmount(in.getAmount());
|
|
|
+ ambInvest.setStatus(in.getStatus());
|
|
|
+ ambInvest.setOperator(TokenManager.getAdminId());
|
|
|
+ ambInvest.setComment(in.getComment());
|
|
|
+ ambInvestMapper.insertSelective(ambInvest);
|
|
|
+ AmbInvestLog log=new AmbInvestLog();
|
|
|
+ log.setAmbInvestId(ambInvest.getId());
|
|
|
+ log.setComment(in.getComment());
|
|
|
+ log.setOperator(TokenManager.getAdminId());
|
|
|
+ log.setStatus(1);
|
|
|
+ ambInvestLogMapper.insertSelective(log);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean checkMyAmb(Long myAmbId) {
|
|
|
+ AmbSystem myAmb = ambSystemMapper.selectByPrimaryKey(myAmbId);
|
|
|
+ if (!myAmb.getLeader().equals(TokenManager.getAdminId())){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|