| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | | import com.dsh.account.feignclient.course.model.StuCourseResp; |
| | | import com.dsh.account.feignclient.course.model.TCoursePackagePayment; |
| | | import com.dsh.account.mapper.TStudentMapper; |
| | | import com.dsh.account.feignclient.other.ImgConfigClient; |
| | | import com.dsh.account.feignclient.other.model.TImgConfig; |
| | | import com.dsh.account.model.vo.classDetails.RegisteredCourse; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | |
| | | import com.dsh.account.util.DateUtil; |
| | | import com.dsh.account.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class TAppUserServiceImpl extends ServiceImpl<TAppUserMapper, TAppUser> implements TAppUserService { |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentMapper tsmapper; |
| | | |
| | | @Resource |
| | | private ImgConfigClient configClient; |
| | | |
| | | @Resource |
| | | private CoursePaymentClient paymentClient; |
| | | @Override |
| | | public ClassInfoVo queryUserOfStus(Integer id) { |
| | | TAppUser tAppUser = this.baseMapper.selectById(id); |
| | | if (ToolUtil.isNotEmpty(tAppUser)){ |
| | | List<TStudent> tStudents = tsmapper.selectList(new EntityWrapper<TStudent>() |
| | | List<TStudent> tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() |
| | | .eq("appUserId",tAppUser.getId()) |
| | | .eq("state",1)); |
| | | .eq("state",1) |
| | | .eq("isDefault",1)); |
| | | ClassInfoVo classInfoVo = new ClassInfoVo(); |
| | | if (null != tStudents){ |
| | | if (tStudents.size() > 0 ){ |
| | | TStudent tStudent = tStudents.get(0); |
| | | classInfoVo.setIsThere(1); |
| | | classInfoVo.setStuImg(tStudent.getHeadImg()); |
| | | classInfoVo.setStuSex(tStudent.getSex()); |
| | | classInfoVo.setStuAge(DateUtil.age(tStudent.getBirthday())); |
| | | classInfoVo.setStuName(tStudent.getName()); |
| | | classInfoVo.setHeight(tStudent.getHeight()); |
| | | classInfoVo.setWeight(tStudent.getWeight()); |
| | | classInfoVo.setBmi(tStudent.getBmi()); |
| | | |
| | | List<RegisteredCourse> courseList = new ArrayList<>(); |
| | | // 总学时数 |
| | | int total = 0; |
| | | // 已扣数 |
| | | int deduct = 0; |
| | | // 剩余数 |
| | | int remain = 0; |
| | | List<StuCourseResp> stuCoursePayment = paymentClient.getStuCoursePayment(); |
| | | if (stuCoursePayment.size() > 0){ |
| | | for (StuCourseResp tCoursePackagePayment : stuCoursePayment) { |
| | | RegisteredCourse course = new RegisteredCourse(); |
| | | course.setCourseId(tCoursePackagePayment.getCourseId()); |
| | | course.setCourseName(tCoursePackagePayment.getCourseName()); |
| | | total = total + tCoursePackagePayment.getTotalCourseNums(); |
| | | deduct = deduct + tCoursePackagePayment.getDeductionNums(); |
| | | remain = remain + tCoursePackagePayment.getResidueNums(); |
| | | courseList.add(course); |
| | | } |
| | | } |
| | | classInfoVo.setCourseList(courseList); |
| | | classInfoVo.setTotalNums(total); |
| | | classInfoVo.setDeductedNums(deduct); |
| | | classInfoVo.setRemainingNums(remain); |
| | | }else { |
| | | classInfoVo.setIsThere(2); |
| | | List<TImgConfig> tImgConfigs = configClient.getNoneStuImgs(); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean save(TAppUser entity) { |
| | | return super.save(entity); |
| | | } |
| | | } |