Commit 499405059cc81781238311071a1cb8a457c745ef
1 parent
ffe95cca3b
Exists in
master
and in
1 other branch
update code
Showing 2 changed files with 102 additions and 0 deletions
platform-common/src/main/java/com/lyms/platform/common/enums/DatePointEnums.java
View file @
4994050
1 | +package com.lyms.platform.common.enums; | |
2 | + | |
3 | + | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.HashMap; | |
6 | +import java.util.List; | |
7 | +import java.util.Map; | |
8 | + | |
9 | +/** | |
10 | + * 发送日期 | |
11 | + * Created by lqy on 2016/06/27 | |
12 | + */ | |
13 | +public enum DatePointEnums { | |
14 | + | |
15 | + | |
16 | + YUN_WEEK(1,"周",10,42), | |
17 | + BABY_DAY(2,"天",11,30), | |
18 | + BABY_MONTH(3,"月",12,36), | |
19 | + CHAN_DAY(4,"天",13,60); | |
20 | + | |
21 | + DatePointEnums(int id, String name, int pid,int count) { | |
22 | + this.id = id; | |
23 | + this.name = name; | |
24 | + this.pid = pid; | |
25 | + this.count = count; | |
26 | + } | |
27 | + | |
28 | + private int id; | |
29 | + private String name; | |
30 | + private Integer pid; | |
31 | + private Integer count; | |
32 | + | |
33 | + public int getId() { | |
34 | + return id; | |
35 | + } | |
36 | + | |
37 | + public void setId(int id) { | |
38 | + this.id = id; | |
39 | + } | |
40 | + | |
41 | + public String getName() { | |
42 | + return name; | |
43 | + } | |
44 | + | |
45 | + public void setName(String name) { | |
46 | + this.name = name; | |
47 | + } | |
48 | + | |
49 | + public Integer getPid() { | |
50 | + return pid; | |
51 | + } | |
52 | + | |
53 | + public void setPid(Integer pid) { | |
54 | + this.pid = pid; | |
55 | + } | |
56 | + | |
57 | + public Integer getCount() { | |
58 | + return count; | |
59 | + } | |
60 | + | |
61 | + public void setCount(Integer count) { | |
62 | + this.count = count; | |
63 | + } | |
64 | + | |
65 | + public static List<Map> getDatePoint(Integer pid) { | |
66 | + | |
67 | + List<Map> list = new ArrayList<>(); | |
68 | + for (DatePointEnums e : DatePointEnums.values()) { | |
69 | + if(e.getPid() == pid) { | |
70 | + for(int i = 0 ; i <= e.getCount() ;i++) | |
71 | + { | |
72 | + Map rootMap = new HashMap(); | |
73 | + rootMap.put("id", e.getId()); | |
74 | + rootMap.put("name", i+e.getName()); | |
75 | + list.add(rootMap); | |
76 | + } | |
77 | + } | |
78 | + } | |
79 | + return list; | |
80 | + } | |
81 | + | |
82 | + public static String getNameById(int id){ | |
83 | + for(DatePointEnums enums:values()){ | |
84 | + if(id==enums.getId()){ | |
85 | + return enums.getName(); | |
86 | + } | |
87 | + } | |
88 | + return ""; | |
89 | + } | |
90 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EnumsController.java
View file @
4994050
... | ... | @@ -290,6 +290,18 @@ |
290 | 290 | return list; |
291 | 291 | } |
292 | 292 | |
293 | + /** | |
294 | + * 查询特殊类型对应的时间点列表 | |
295 | + * @param specialType | |
296 | + * @return | |
297 | + */ | |
298 | + @RequestMapping(value = "/getSpecialDatePoint/{specialType}", method = RequestMethod.GET) | |
299 | + @ResponseBody | |
300 | + public List<Map> getDateType(@PathVariable("specialType") Integer specialType) { | |
301 | + List<Map> list =DatePointEnums.getDatePoint(specialType); | |
302 | + return list; | |
303 | + } | |
304 | + | |
293 | 305 | |
294 | 306 | /** |
295 | 307 | * 获取发送频率 |