ManageController.java
2.35 KB
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
package com.yoho.rfid.controller;
import com.yoho.rfid.model.ClientConfig;
import com.yoho.rfid.model.ManageCommand;
import com.yoho.rfid.service.ManageService;
import com.yoho.rfid.util.ApiResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by sailing on 2017/11/1.
*/
@Controller
@RequestMapping("/manage")
public class ManageController {
@Autowired
private ManageService manageService;
@RequestMapping("/getSystemConfig")
@ResponseBody
public ApiResponse getSystemConfig(){
return new ApiResponse.ApiResponseBuilder()
.data(manageService.showSystemConfig())
.code(200).message("getSystemConfig success").build();
}
@RequestMapping("/sendMail/{command}")
@ResponseBody
public ApiResponse sendMail(@PathVariable("command")String command){
if (StringUtils.isBlank(command)){
return new ApiResponse.ApiResponseBuilder()
.code(400).message("sendMail fail, not support this command").build();
}
boolean sendMail;
switch (command){
case ManageCommand.openSendMail:
sendMail = true;
break;
case ManageCommand.closeSendMail:
sendMail = false;
break;
default:
return new ApiResponse.ApiResponseBuilder()
.code(400).message("sendMail fail, not support this command").build();
}
manageService.sendMail(sendMail);
return new ApiResponse.ApiResponseBuilder()
.code(200).message("sendMail success").build();
}
@RequestMapping("/setBussinessDate")
@ResponseBody
public ApiResponse setBussinessDate(@RequestBody ClientConfig clientConfig){
manageService.doBusinessDate(clientConfig);
return new ApiResponse.ApiResponseBuilder()
.code(200).message("setBussinessDate success").build();
}
}