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
package com.dsh.other.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.other.entity.Notice;
import com.dsh.other.entity.Phone;
import com.dsh.other.feignclient.model.SysNotice;
import com.dsh.other.service.NoticeService;
import com.dsh.other.service.PhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
 
@RestController
@RequestMapping("")
public class SystemNoticeController {
 
    @Autowired
    private NoticeService noticeSers;
 
    @Autowired
    private PhoneService phoneService;
 
    private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 
 
    @PostMapping("/base/notice/queryNoticeDetails")
    public List<SysNotice> getSysNoticeDetails() {
        List<SysNotice> notices = new ArrayList<>();
        List<Notice> list = noticeSers.list(new QueryWrapper<Notice>()
                .eq("state", 1)
                .eq("upOrDown", 1)
                .orderByDesc("insertTime"));
        if (list.size() > 0) {
            list.forEach(noList -> {
                SysNotice notice = new SysNotice();
                notice.setNoticeId(noList.getId());
                notice.setNoticeTitle(noList.getName());
                notice.setNoticeContents(noList.getContent());
                notice.setNoticeTime(format.format(noList.getInsertTime()));
                notices.add(notice);
            });
        }
        return notices;
    }
 
 
    @PostMapping("/base/notice/queryNotice")
    public SysNotice getSysNoticeBuId(@RequestParam("noticeId") Integer noticeId) {
        SysNotice sysNotice = new SysNotice();
        Notice notice = noticeSers.getById(noticeId);
        if (null != notice) {
            sysNotice.setNoticeId(notice.getId());
            sysNotice.setNoticeTitle(notice.getName());
            sysNotice.setNoticeContents(notice.getContent());
            sysNotice.setNoticeTime(format.format(notice.getInsertTime()));
        }
        return sysNotice;
    }
 
 
    @PostMapping("/base/notice/sysTell")
    public List<String> queryCustomerTel() {
        List<String> tellS = new ArrayList<>();
        List<Phone> list = phoneService.list();
        if (list.size() > 0) {
            String phone = list.get(0).getPhone();
            String[] split = phone.split(",");
            tellS = Arrays.asList(split);
        }
        return tellS;
 
    }
 
}