自动化立体仓库 - WCS系统
#
luxiaotao1123
2020-11-16 ad13c8327b5123b729460cf51b6d6e104067753a
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
package com.zy.asrs.controller;
 
import com.core.common.Cools;
import com.core.common.R;
import com.zy.common.service.CommonService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Calendar;
import java.util.Date;
 
/**
 * Created by vincent on 2020/11/16
 */
@RestController
@RequestMapping("/monitor")
public class MonitorController {
 
    private static final String[] WEEK = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
 
    /**
     * 获取当前时间
     */
    @GetMapping("/date")
    public R monitorDate() {
        Date now = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(now);
        return R.ok(
                Cools.add("year", calendar.get(Calendar.YEAR))
                .add("month", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MONTH)+1), 2))
                .add("day", CommonService.zerofill(String.valueOf(calendar.get(Calendar.DATE)), 2))
                .add("hour", CommonService.zerofill(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)), 2))
                .add("minute", CommonService.zerofill(String.valueOf(calendar.get(Calendar.MINUTE)), 2))
                .add("second", CommonService.zerofill(String.valueOf(calendar.get(Calendar.SECOND)) , 2))
                .add("week", WEEK[calendar.get(Calendar.DAY_OF_WEEK)-1])
        );
    }
 
 
 
}