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
105
106
107
108
109
110
111
112
113
114
115
package com.dsh.guns.modular.system.controller.code;
 
 
import com.dsh.course.feignClient.account.CityManagerClient;
import com.dsh.course.feignClient.account.model.CityManager;
import com.dsh.course.feignClient.account.model.Coach;
import com.dsh.course.feignClient.activity.BodySideAppointmentClient;
import com.dsh.course.feignClient.activity.model.BodySideAppointment;
import com.dsh.course.feignClient.activity.model.QueryBodySideAppointment;
import com.dsh.course.feignClient.activity.model.QueryBodySideAppointmentVO;
import com.dsh.course.feignClient.other.StoreClient;
import com.dsh.guns.config.UserExt;
import com.dsh.guns.modular.system.model.CoachQuery;
import com.dsh.guns.modular.system.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
 
import java.text.SimpleDateFormat;
import java.util.*;
 
/**
 * 体测预约管理控制器
 */
@Controller
@RequestMapping("/bodySideAppointment")
public class TBodySideAppointmentsController {
    private String PREFIX = "/system/bodySideAppointment/";
 
    @Autowired
    private StoreClient storeClient;
    @Autowired
    private BodySideAppointmentClient bodySideAppointmentClient;
    @Autowired
    private CityManagerClient cityManagerClient;
    /**
     * 跳转体测预约管理首页
     */
    @RequestMapping("")
    public String index(Model model) {
        return PREFIX + "TBodySideAppointment.html";
    }
    /**
     * 跳转体测预约管理添加页面
     */
    @RequestMapping("/add")
    public String add(Model model) {
        List<CityManager> province = cityManagerClient.listAll();
        Set<String> seenNames = new HashSet<>();
        List<CityManager> result = new ArrayList<>();
        for (CityManager cityManager : province) {
            if(!seenNames.contains(cityManager.getProvince())){
                result.add(cityManager);
                seenNames.add(cityManager.getProvince());
            }
        }
        model.addAttribute("list",result);
        return PREFIX + "TBodySideAppointment_add.html";
    }
    /**
     * 跳转体测预约管理编辑页面
     */
    @RequestMapping("/update")
    public String update(Model model) {
        return PREFIX + "TBodySideAppointment_edit.html";
    }
 
    /**
     * 获取所有体测预约记录
     * @return
     */
    @RequestMapping("/listAll")
    @ResponseBody
    public List<QueryBodySideAppointmentVO> listAll(String phone,String parentName,Integer state){
        QueryBodySideAppointment vo = new QueryBodySideAppointment();
        vo.setParentName(parentName);
        vo.setPhone(phone);
        vo.setState(state);
        List<QueryBodySideAppointmentVO> queryBodySideAppointmentVOS = bodySideAppointmentClient.listAll(vo);
        for (QueryBodySideAppointmentVO queryBodySideAppointmentVO : queryBodySideAppointmentVOS) {
            queryBodySideAppointmentVO.setProvinceAndCity(queryBodySideAppointmentVO.getProvince()+queryBodySideAppointmentVO.getCity());
        }
        return queryBodySideAppointmentVOS;
    }
 
    /**
     *  添加/修改体测预约记录
     */
    @ResponseBody
    @RequestMapping(value = "/addBodySideAppointments")
    public ResultUtil addBodySideAppointments(@RequestBody QueryBodySideAppointmentVO vo) {
        bodySideAppointmentClient.addBodySideAppointments(vo);
        return ResultUtil.success("添加成功");
    }
 
    /**
     *  添加/修改体测预约记录
     */
    @ResponseBody
    @RequestMapping(value = "/getInfoById")
    public BodySideAppointment getInfoById(@RequestBody Integer id) {
        return bodySideAppointmentClient.getInfoById(id);
    }
 
    /**
     *  手动标记用户已经到店并完成体测
     */
    @ResponseBody
    @RequestMapping(value = "/changeState")
    public Object changeState(@RequestBody List<Integer> ids) {
        return bodySideAppointmentClient.changeState(ids);
    }
 
}