nickchange
2023-11-21 41b60f3df5f3054aad44307c13a26b14f3b32ac0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.dsh.account.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsh.account.entity.Coach;
import com.dsh.account.entity.EvaluateStudent;
import com.dsh.account.entity.TStudent;
import com.dsh.account.mapper.EvaluateStudentMapper;
import com.dsh.account.mapper.TStudentMapper;
import com.dsh.account.model.vo.commentDetail.StuCommentsVo;
import com.dsh.account.service.CoachService;
import com.dsh.account.service.EvaluateStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
 
/**
 * <p>
 * 评价学员记录 服务实现类
 * </p>
 *
 * @author jqs
 * @since 2023-07-03
 */
@Service
public class EvaluateStudentServiceImpl extends ServiceImpl<EvaluateStudentMapper, EvaluateStudent> implements EvaluateStudentService {
 
    @Resource
    private TStudentMapper tstuMapper;
 
    private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 
 
    @Autowired
    private CoachService coachService;
    @Override
    public List<StuCommentsVo> queryStuCommentsList(Integer stuId) {
        List<StuCommentsVo> stuCommentsVos = new ArrayList<>();
        TStudent tStudent = tstuMapper.selectById(stuId);
        List<EvaluateStudent> evaluateStudents = this.list(new QueryWrapper<EvaluateStudent>()
                .eq("studentId",stuId ));
 
 
        if (evaluateStudents.size() > 0){
            for (EvaluateStudent evaluateStudent : evaluateStudents) {
                StuCommentsVo vo = new StuCommentsVo();
 
                Coach coach = coachService.getById(evaluateStudent.getCoachId());
//                vo.setHeadImg(tStudent.getHeadImg());
                vo.setHeadImg(coach.getDiploma());
//                vo.setStuName(tStudent.getName());
                vo.setStuName(coach.getName());
                vo.setComTime(format.format(tStudent.getInsertTime()));
                vo.setContents(evaluateStudent.getContent());
                String imgs = evaluateStudent.getImgs();
                String[] split = imgs.split(",");
                vo.setImgs(Arrays.asList(split));
                stuCommentsVos.add(vo);
            }
        }
        return stuCommentsVos;
    }
}