44323
2023-11-27 aa925d851857f50eff0556411366690d9a78a0e5
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.dsh.activity.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.activity.entity.BenefitsVideoClassification;
import com.dsh.activity.entity.BenefitsVideos;
import com.dsh.activity.entity.BodySideAppointment;
import com.dsh.activity.feignclient.other.StoreClient;
import com.dsh.activity.feignclient.other.model.Store;
import com.dsh.activity.model.*;
import com.dsh.activity.service.BenefitsVideosService;
import com.dsh.activity.service.BodySideAppointmentService;
import com.dsh.activity.service.IBenefitsVideoClassificationService;
import com.dsh.activity.util.ResultUtil;
import com.dsh.activity.util.TokenUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
 
/**
 * 体测预约管理控制器
 */
@RestController
@RequestMapping("")
public class BodySideAppointmentsController {
    @Autowired
    private BodySideAppointmentService bodySideAppointmentService;
    @Autowired
    private StoreClient storeClient;
 
    /**
     * 获取所有体测预约记录
     *
     * @return
     */
    @RequestMapping("/base/bodySideAppointments/listAll")
    public List<QueryBodySideAppointmentVO> listAll(@RequestBody QueryBodySideAppointment vo) {
        List<QueryBodySideAppointmentVO> queryBodySideAppointmentVOS = bodySideAppointmentService.listAll(vo);
        List<Integer> list = new ArrayList<>();
        for (QueryBodySideAppointmentVO queryBodySideAppointmentVO : queryBodySideAppointmentVOS) {
            list.add(queryBodySideAppointmentVO.getStoreId());
        }
        List<Store> stores = storeClient.queryStoreByIds(list);
        for (QueryBodySideAppointmentVO queryBodySideAppointmentVO : queryBodySideAppointmentVOS) {
            for (Store store : stores) {
                if (queryBodySideAppointmentVO.getStoreId() == store.getId()) {
                    queryBodySideAppointmentVO.setStoreName(store.getName());
                    break;
                }
            }
        }
        return queryBodySideAppointmentVOS;
    }
 
    /**
     * 增加/修改体测预约记录
     *
     * @return
     */
    @RequestMapping("/base/bodySideAppointments/addBodySideAppointments")
    public Object addBodySideAppointments(@RequestBody QueryBodySideAppointmentVO vo) {
        BodySideAppointment bodySideAppointment = new BodySideAppointment();
        BeanUtils.copyProperties(vo, bodySideAppointment);
        bodySideAppointment.setStatus(1);
        bodySideAppointment.setState(1);
        bodySideAppointment.setInsertTime(new Date());
        if (vo.getId() != null) {
            return bodySideAppointmentService.updateById(bodySideAppointment);
        } else {
            return bodySideAppointmentService.save(bodySideAppointment);
        }
    }
 
    /**
     * 手动标记用户已经到店并完成体测
     *
     * @return
     */
    @RequestMapping("/base/bodySideAppointments/changeState")
    public Object changeState(@RequestBody List<Integer> ids) {
        return bodySideAppointmentService.changeState(ids);
    }
 
    /**
     * 通过id获取体测预约记录
     *
     * @return
     */
    @RequestMapping("/base/bodySideAppointments/getInfoById")
    public BodySideAppointment getInfoById(@RequestBody Integer id) {
        return bodySideAppointmentService.getById(id);
 
    }
}