package com.dsh.course.controller;
|
|
|
import com.dsh.course.entity.TCoursePackage;
|
import com.dsh.course.entity.TCoursePackagePayment;
|
import com.dsh.course.feignclient.model.StuCourseResp;
|
import com.dsh.course.service.TCoursePackageService;
|
import com.dsh.course.servs.CoursePackagePaymentRepository;
|
import io.swagger.annotations.Api;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Api
|
@CrossOrigin
|
@RestController
|
@RequestMapping("")
|
public class CoursePackagePaymentController {
|
|
private Logger logger = LoggerFactory.getLogger("business-log");
|
|
@Autowired
|
private CoursePackagePaymentRepository coursePackagePaymentRepository;
|
|
@Autowired
|
private TCoursePackageService tcpService;
|
|
/**
|
* 获取 没有学员信息的图片配置
|
*/
|
@PostMapping("/coursePack/queryPayment")
|
public List<StuCourseResp> getStuCoursePackagePayment(Integer stuId){
|
List<StuCourseResp> resps = new ArrayList<>();
|
List<TCoursePackagePayment> byUserId = coursePackagePaymentRepository.findByUserId(stuId);
|
if (byUserId.size() > 0 ){
|
for (TCoursePackagePayment tCoursePackagePayment : byUserId) {
|
TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId());
|
StuCourseResp resp = new StuCourseResp();
|
resp.setCourseId(tCoursePackage.getId());
|
resp.setCourseName(tCoursePackage.getName());
|
resp.setTotalCourseNums(tCoursePackagePayment.getTotalClassHours());
|
resp.setResidueNums(tCoursePackagePayment.getLaveClassHours());
|
resp.setDeductionNums(tCoursePackagePayment.getTotalClassHours()-tCoursePackagePayment.getLaveClassHours());
|
}
|
}
|
return resps;
|
}
|
|
}
|