tianze-pro/web/src/main/java/com/ibeetl/jlw/service/StudentAccountP2pSystemServ...

67 lines
2.3 KiB
Java

package com.ibeetl.jlw.service;
import com.ibeetl.admin.core.service.CoreBaseService;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.dao.StudentAccountP2pSystemDao;
import com.ibeetl.jlw.entity.StudentAccountAssetAllocation;
import com.ibeetl.jlw.entity.StudentAccountP2pSystem;
import com.ibeetl.jlw.web.query.StudentAccountP2pSystemQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.util.List;
/**
* P2P系统用户资金数据表 Service
* 当分布式ID开启后请勿使用insert(*,true)
*/
@Service
@Transactional
@Validated
public class StudentAccountP2pSystemService extends CoreBaseService<StudentAccountP2pSystem> {
@Autowired
private StudentAccountP2pSystemDao studentAccountP2pSystemDao;
public JsonResult<List<StudentAccountP2pSystem>> getList(StudentAccountP2pSystemQuery query) {
return JsonResult.success(studentAccountP2pSystemDao.getValuesByQueryNotWithPermission(query));
}
/**
* 对接智云子系统
*/
private void getSubsystemData() {
//TODO 对接智云子系统
StudentAccountP2pSystem p2pSystem = new StudentAccountP2pSystem();
studentAccountP2pSystemDao.insert(p2pSystem);
}
public void add(StudentAccountP2pSystem p2pSystem) {
studentAccountP2pSystemDao.insert(p2pSystem);
}
public boolean update(StudentAccountP2pSystem system) {
studentAccountP2pSystemDao.updateById(system);
return true;
}
public void updateByTransfer(BigDecimal availableFunds, BigDecimal initialCapital, BigDecimal initialInvestmentCapital,Long studentId) {
StudentAccountP2pSystem p2pSystem = studentAccountP2pSystemDao.getValuesByStudentId(studentId);
p2pSystem.setAvailableBalance(availableFunds);
p2pSystem.setInitialInvestmentCapital(initialInvestmentCapital);
p2pSystem.setInitialCapital(initialCapital);
studentAccountP2pSystemDao.updateTemplateById(p2pSystem);
}
public StudentAccountP2pSystem getValuesByStudentId(Long studentId){
return studentAccountP2pSystemDao.getValuesByStudentId(studentId);
}
}