Showing
8 changed files
with
184 additions
and
465 deletions
1 | package com.yohobuy.platform.grass.restapi; | 1 | package com.yohobuy.platform.grass.restapi; |
2 | 2 | ||
3 | -import com.yohobuy.platform.dal.grass.model.GrassTopic; | 3 | + |
4 | import com.yohobuy.platform.grass.service.ITopicService; | 4 | import com.yohobuy.platform.grass.service.ITopicService; |
5 | import com.yohobuy.platform.model.common.ApiResponse; | 5 | import com.yohobuy.platform.model.common.ApiResponse; |
6 | import com.yohobuy.platform.model.common.PageResponseVO; | 6 | import com.yohobuy.platform.model.common.PageResponseVO; |
@@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; | @@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; | ||
14 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
15 | import org.springframework.web.bind.annotation.ResponseBody; | 15 | import org.springframework.web.bind.annotation.ResponseBody; |
16 | 16 | ||
17 | -import java.util.List; | ||
18 | - | ||
19 | /** | 17 | /** |
20 | * Created by meiling.ge on 2019/1/8. | 18 | * Created by meiling.ge on 2019/1/8. |
21 | */ | 19 | */ |
@@ -41,17 +39,11 @@ public class GrassTopicController { | @@ -41,17 +39,11 @@ public class GrassTopicController { | ||
41 | return new ApiResponse.ApiResponseBuilder().build(); | 39 | return new ApiResponse.ApiResponseBuilder().build(); |
42 | } | 40 | } |
43 | 41 | ||
44 | - | ||
45 | - @RequestMapping("/grassTopicById") | 42 | + @RequestMapping("/changeTopicStatus") |
46 | @ResponseBody | 43 | @ResponseBody |
47 | - public ApiResponse grassTopicById(GrassTopicReq req){ | ||
48 | - TopicRespBo resp = topicService.grassTopicById(req); | ||
49 | - return new ApiResponse.ApiResponseBuilder().data(resp).build(); | 44 | + public ApiResponse changeTopicStatus(@RequestBody GrassTopicReq req){ |
45 | + topicService.changeTopicStatus(req); | ||
46 | + return new ApiResponse.ApiResponseBuilder().build(); | ||
50 | } | 47 | } |
51 | - /*@RequestMapping("/getAllTopic") | ||
52 | - @ResponseBody | ||
53 | - public ApiResponse getAllTopic(){ | ||
54 | - List<TopicRespBo> result = topicService.getAllTopic(); | ||
55 | - return new ApiResponse.ApiResponseBuilder().data(result).build(); | ||
56 | - }*/ | 48 | + |
57 | } | 49 | } |
@@ -29,7 +29,7 @@ public class TopicGroupController { | @@ -29,7 +29,7 @@ public class TopicGroupController { | ||
29 | 29 | ||
30 | @RequestMapping("/getTopicGroupList") | 30 | @RequestMapping("/getTopicGroupList") |
31 | @ResponseBody | 31 | @ResponseBody |
32 | - public ApiResponse getTopicGroupList( TopicGroupReq req){ | 32 | + public ApiResponse getTopicGroupList(@RequestBody TopicGroupReq req){ |
33 | logger.info("enter getTopicGroupList,req={}",req); | 33 | logger.info("enter getTopicGroupList,req={}",req); |
34 | PageResponseVO<TopicGroupBo> result = topicGroupService.getTopicGroupList(req); | 34 | PageResponseVO<TopicGroupBo> result = topicGroupService.getTopicGroupList(req); |
35 | return new ApiResponse.ApiResponseBuilder().data(result).build(); | 35 | return new ApiResponse.ApiResponseBuilder().data(result).build(); |
@@ -37,7 +37,7 @@ public class TopicGroupController { | @@ -37,7 +37,7 @@ public class TopicGroupController { | ||
37 | 37 | ||
38 | @RequestMapping("/addUpTopicGroup") | 38 | @RequestMapping("/addUpTopicGroup") |
39 | @ResponseBody | 39 | @ResponseBody |
40 | - public ApiResponse addUpTopicGroup( TopicGroupReq req){ | 40 | + public ApiResponse addUpTopicGroup(@RequestBody TopicGroupReq req){ |
41 | logger.info("enter addUpTopicGroup,req={}",req); | 41 | logger.info("enter addUpTopicGroup,req={}",req); |
42 | return topicGroupService.addUpTopicGroup(req); | 42 | return topicGroupService.addUpTopicGroup(req); |
43 | 43 | ||
@@ -45,13 +45,9 @@ public class TopicGroupController { | @@ -45,13 +45,9 @@ public class TopicGroupController { | ||
45 | 45 | ||
46 | @RequestMapping("/deleteTopicGroup") | 46 | @RequestMapping("/deleteTopicGroup") |
47 | @ResponseBody | 47 | @ResponseBody |
48 | - public ApiResponse deleteTopicGroup( TopicGroupReq req){ | 48 | + public ApiResponse deleteTopicGroup(@RequestBody TopicGroupReq req){ |
49 | logger.info("enter updatePacketStatus,req = {}", req); | 49 | logger.info("enter updatePacketStatus,req = {}", req); |
50 | - int flag = topicGroupService.deleteTopicGroup(req); | ||
51 | - if(flag == 2){ | ||
52 | - return new ApiResponse.ApiResponseBuilder().code(403).message("该分组下存在标签,删除失败!").build(); | ||
53 | - } | ||
54 | - return new ApiResponse.ApiResponseBuilder().build(); | 50 | + return topicGroupService.deleteTopicGroup(req); |
55 | } | 51 | } |
56 | 52 | ||
57 | /** | 53 | /** |
@@ -15,7 +15,7 @@ public interface ITopicGroupService { | @@ -15,7 +15,7 @@ public interface ITopicGroupService { | ||
15 | 15 | ||
16 | ApiResponse addUpTopicGroup(TopicGroupReq req); | 16 | ApiResponse addUpTopicGroup(TopicGroupReq req); |
17 | 17 | ||
18 | - int deleteTopicGroup(TopicGroupReq req); | 18 | + ApiResponse deleteTopicGroup(TopicGroupReq req); |
19 | 19 | ||
20 | List<TopicGroupBo> getAllTopicGroupInfo(); | 20 | List<TopicGroupBo> getAllTopicGroupInfo(); |
21 | } | 21 | } |
@@ -15,9 +15,8 @@ import java.util.List; | @@ -15,9 +15,8 @@ import java.util.List; | ||
15 | public interface ITopicService { | 15 | public interface ITopicService { |
16 | PageResponseVO<TopicRespBo> getGrassTopicList(GrassTopicReq req); | 16 | PageResponseVO<TopicRespBo> getGrassTopicList(GrassTopicReq req); |
17 | 17 | ||
18 | - List<TopicRespBo> getAllTopic(); | ||
19 | 18 | ||
20 | void addUpGrassTopic(GrassTopicReq req); | 19 | void addUpGrassTopic(GrassTopicReq req); |
21 | 20 | ||
22 | - TopicRespBo grassTopicById(GrassTopicReq req); | 21 | + void changeTopicStatus(GrassTopicReq req); |
23 | } | 22 | } |
@@ -3,6 +3,7 @@ package com.yohobuy.platform.grass.service.impl; | @@ -3,6 +3,7 @@ package com.yohobuy.platform.grass.service.impl; | ||
3 | 3 | ||
4 | import com.yohobuy.platform.common.util.BeanTool; | 4 | import com.yohobuy.platform.common.util.BeanTool; |
5 | import com.yohobuy.platform.common.util.DateUtil; | 5 | import com.yohobuy.platform.common.util.DateUtil; |
6 | +import com.yohobuy.platform.dal.grass.IGrassTopicDAO; | ||
6 | import com.yohobuy.platform.dal.grass.IGrassTopicGroupDAO; | 7 | import com.yohobuy.platform.dal.grass.IGrassTopicGroupDAO; |
7 | import com.yohobuy.platform.dal.grass.model.TopicGroup; | 8 | import com.yohobuy.platform.dal.grass.model.TopicGroup; |
8 | import com.yohobuy.platform.grass.service.ITopicGroupService; | 9 | import com.yohobuy.platform.grass.service.ITopicGroupService; |
@@ -28,6 +29,9 @@ public class TopicGroupServiceImpl implements ITopicGroupService { | @@ -28,6 +29,9 @@ public class TopicGroupServiceImpl implements ITopicGroupService { | ||
28 | @Autowired | 29 | @Autowired |
29 | private IGrassTopicGroupDAO topicGroupDAO ; | 30 | private IGrassTopicGroupDAO topicGroupDAO ; |
30 | 31 | ||
32 | + @Autowired | ||
33 | + private IGrassTopicDAO topicDAO ; | ||
34 | + | ||
31 | @Override | 35 | @Override |
32 | public PageResponseVO<TopicGroupBo> getTopicGroupList(TopicGroupReq req) { | 36 | public PageResponseVO<TopicGroupBo> getTopicGroupList(TopicGroupReq req) { |
33 | logger.info("getTopicGroupList req={}",req); | 37 | logger.info("getTopicGroupList req={}",req); |
@@ -77,16 +81,16 @@ public class TopicGroupServiceImpl implements ITopicGroupService { | @@ -77,16 +81,16 @@ public class TopicGroupServiceImpl implements ITopicGroupService { | ||
77 | } | 81 | } |
78 | 82 | ||
79 | @Override | 83 | @Override |
80 | - public int deleteTopicGroup(TopicGroupReq req) { | 84 | + public ApiResponse deleteTopicGroup(TopicGroupReq req) { |
81 | logger.info("enter deleteTopicGroup id={}", req.getId()); | 85 | logger.info("enter deleteTopicGroup id={}", req.getId()); |
82 | Integer id = req.getId(); | 86 | Integer id = req.getId(); |
83 | - TopicGroup topicGroup = topicGroupDAO.selectByPrimaryKey(id); | ||
84 | - if(topicGroup.getTopicAmount() > 0){ | ||
85 | - return 2; | 87 | + int count = topicDAO.countByGroupId(id); |
88 | + if(count > 0){ | ||
89 | + return new ApiResponse.ApiResponseBuilder().code(403).message("该分组下存在话题,禁止删除!").build(); | ||
86 | } | 90 | } |
87 | topicGroupDAO.deleteByPrimaryKey(id); | 91 | topicGroupDAO.deleteByPrimaryKey(id); |
88 | logger.info("deleteTopicGroup success! id={}", req.getId()); | 92 | logger.info("deleteTopicGroup success! id={}", req.getId()); |
89 | - return 1; | 93 | + return new ApiResponse.ApiResponseBuilder().build(); |
90 | 94 | ||
91 | } | 95 | } |
92 | 96 |
@@ -6,9 +6,8 @@ import com.yohobuy.platform.common.util.BeanTool; | @@ -6,9 +6,8 @@ import com.yohobuy.platform.common.util.BeanTool; | ||
6 | import com.yohobuy.platform.common.util.CollectionUtil; | 6 | import com.yohobuy.platform.common.util.CollectionUtil; |
7 | import com.yohobuy.platform.common.util.DateUtil; | 7 | import com.yohobuy.platform.common.util.DateUtil; |
8 | import com.yohobuy.platform.common.util.StringUtil; | 8 | import com.yohobuy.platform.common.util.StringUtil; |
9 | -import com.yohobuy.platform.dal.grass.IGrassLabelDAO; | ||
10 | -import com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO; | ||
11 | -import com.yohobuy.platform.dal.grass.IGrassTopicDAO; | 9 | +import com.yohobuy.platform.dal.grass.*; |
10 | +import com.yohobuy.platform.dal.grass.model.GrassArticle; | ||
12 | import com.yohobuy.platform.dal.grass.model.GrassLabel; | 11 | import com.yohobuy.platform.dal.grass.model.GrassLabel; |
13 | import com.yohobuy.platform.dal.grass.model.GrassTopic; | 12 | import com.yohobuy.platform.dal.grass.model.GrassTopic; |
14 | import com.yohobuy.platform.grass.service.ITopicService; | 13 | import com.yohobuy.platform.grass.service.ITopicService; |
@@ -42,20 +41,23 @@ public class TopicServiceImpl implements ITopicService { | @@ -42,20 +41,23 @@ public class TopicServiceImpl implements ITopicService { | ||
42 | private IGrassTopicDAO grassTopicDAO; | 41 | private IGrassTopicDAO grassTopicDAO; |
43 | 42 | ||
44 | @Autowired | 43 | @Autowired |
45 | - private IGrassLabelDAO grassLabelDAO; | 44 | + private IGrassTopicGroupDAO topicGroupDAO; |
46 | 45 | ||
47 | 46 | ||
48 | @Override | 47 | @Override |
49 | public PageResponseVO<TopicRespBo> getGrassTopicList(GrassTopicReq req) { | 48 | public PageResponseVO<TopicRespBo> getGrassTopicList(GrassTopicReq req) { |
50 | logger.info("enter getGrassTopicList req={}",req); | 49 | logger.info("enter getGrassTopicList req={}",req); |
50 | + | ||
51 | + Integer status = req.getStatus() == null || req.getStatus() == 8 ? null : req.getStatus(); | ||
52 | + Integer isOfficial = req.getIsOfficial() == null || req.getIsOfficial() == 8 ? null : req.getIsOfficial(); | ||
51 | String topicName = req.getTopicName(); | 53 | String topicName = req.getTopicName(); |
52 | - Integer status = req.getStatus(); | 54 | + String groupName = req.getGroupName(); |
53 | Integer startTime = req.getStartTime(); | 55 | Integer startTime = req.getStartTime(); |
54 | Integer endTime = req.getEndTime(); | 56 | Integer endTime = req.getEndTime(); |
55 | - int total = grassTopicDAO.CountByCondition(topicName,status,startTime,endTime); | 57 | + int total = grassTopicDAO.countByCondition(status,isOfficial,topicName,groupName,startTime,endTime); |
56 | List<TopicRespBo> pageData = new ArrayList<>(); | 58 | List<TopicRespBo> pageData = new ArrayList<>(); |
57 | if(total > 0){ | 59 | if(total > 0){ |
58 | - List<GrassTopic> list = grassTopicDAO.selectByPageCondition(topicName,status,startTime,endTime,req.getStart(),req.getSize()); | 60 | + List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,startTime,endTime,req.getStart(),req.getSize()); |
59 | pageData = convertTopicRespBo(list); | 61 | pageData = convertTopicRespBo(list); |
60 | } | 62 | } |
61 | PageResponseVO responseVO = new PageResponseVO(); | 63 | PageResponseVO responseVO = new PageResponseVO(); |
@@ -67,18 +69,6 @@ public class TopicServiceImpl implements ITopicService { | @@ -67,18 +69,6 @@ public class TopicServiceImpl implements ITopicService { | ||
67 | return responseVO; | 69 | return responseVO; |
68 | } | 70 | } |
69 | 71 | ||
70 | - @Override | ||
71 | - public List<TopicRespBo> getAllTopic() { | ||
72 | - List<GrassTopic> topicList = grassTopicDAO.selectUsingTopics(); | ||
73 | - List<TopicRespBo> rspList = Lists.newArrayList(); | ||
74 | - topicList.forEach(grassTopic -> { | ||
75 | - TopicRespBo bo = new TopicRespBo(); | ||
76 | - bo.setId(grassTopic.getId()); | ||
77 | - bo.setTopicName(grassTopic.getTopicName()); | ||
78 | - rspList.add(bo); | ||
79 | - }); | ||
80 | - return rspList; | ||
81 | - } | ||
82 | 72 | ||
83 | @Override | 73 | @Override |
84 | public void addUpGrassTopic(GrassTopicReq req) { | 74 | public void addUpGrassTopic(GrassTopicReq req) { |
@@ -87,83 +77,40 @@ public class TopicServiceImpl implements ITopicService { | @@ -87,83 +77,40 @@ public class TopicServiceImpl implements ITopicService { | ||
87 | record.setId(req.getId()); | 77 | record.setId(req.getId()); |
88 | record.setTopicName(req.getTopicName()); | 78 | record.setTopicName(req.getTopicName()); |
89 | record.setTopicDesc(req.getTopicDesc()); | 79 | record.setTopicDesc(req.getTopicDesc()); |
90 | - record.setStatus(req.getStatus()); | ||
91 | - String relatedLabels = ""; | ||
92 | - //一定要关联标签(前台) | ||
93 | - //每个标签id都不能为空,标签id 不能重复(前台没有做判断) | ||
94 | - if(StringUtils.isNotEmpty(req.getRelatedLabels()) && StringUtils.endsWith(req.getRelatedLabels(),",")){ | ||
95 | - String[] str = StringUtils.split(req.getRelatedLabels(),","); | ||
96 | - Set<String> labelSet = new HashSet<>(); | ||
97 | - for(String s : str){ | ||
98 | - if(StringUtils.isNotEmpty(s)){//前台可能传递重复的或者空值 | ||
99 | - labelSet.add(s); | ||
100 | - } | ||
101 | - } | ||
102 | - | ||
103 | - for(String labelId : labelSet){ | ||
104 | - relatedLabels += labelId + ","; | ||
105 | - } | ||
106 | -// relatedLabels = StringUtils.substring(relatedLabels, 0,relatedLabels.length() -1); | ||
107 | - } | ||
108 | - record.setRelatedLabels(relatedLabels); | ||
109 | record.setTopicImageUrl(req.getTopicImageUrl()); | 80 | record.setTopicImageUrl(req.getTopicImageUrl()); |
81 | + record.setRelatedGroup(req.getRelatedGroup()); | ||
82 | + record.setViewModel(req.getViewModel()); | ||
83 | + record.setIsOfficial(req.getIsOfficial() == null ? 0 : req.getIsOfficial()); | ||
84 | + record.setAllowAttention(req.getAllowAttention()== null ? 0 : req.getAllowAttention()); | ||
85 | + record.setShowAttAmount(req.getShowAttAmount()== null ? 0 : req.getShowAttAmount()); | ||
110 | if(req.getId() == null){ | 86 | if(req.getId() == null){ |
111 | record.setArticleAmount(0); | 87 | record.setArticleAmount(0); |
112 | record.setAttAmount(0); | 88 | record.setAttAmount(0); |
113 | record.setStatus(0); | 89 | record.setStatus(0); |
114 | record.setCreateTime(DateUtil.getCurrentTimeSeconds()); | 90 | record.setCreateTime(DateUtil.getCurrentTimeSeconds()); |
91 | + topicGroupDAO.updateTopicNum(req.getRelatedGroup(),true); | ||
115 | grassTopicDAO.insert(record); | 92 | grassTopicDAO.insert(record); |
116 | logger.info("addUpGrassTopic add success! req={}",req); | 93 | logger.info("addUpGrassTopic add success! req={}",req); |
117 | }else{ | 94 | }else{ |
118 | record.setUpdateTime(DateUtil.getCurrentTimeSeconds()); | 95 | record.setUpdateTime(DateUtil.getCurrentTimeSeconds()); |
96 | + GrassTopic grassTopic = grassTopicDAO.selectByPrimaryKey(req.getId()); | ||
97 | + //更改分组 | ||
98 | + if(grassTopic.getRelatedGroup().intValue() != req.getRelatedGroup().intValue()){ | ||
99 | + //分组计数 | ||
100 | + topicGroupDAO.updateTopicNum(grassTopic.getRelatedGroup(),false); | ||
101 | + topicGroupDAO.updateTopicNum(req.getRelatedGroup(),true); | ||
102 | + } | ||
119 | grassTopicDAO.updateByPrimaryKeySelective(record); | 103 | grassTopicDAO.updateByPrimaryKeySelective(record); |
120 | logger.info("addUpGrassTopic update success! req={}",req); | 104 | logger.info("addUpGrassTopic update success! req={}",req); |
121 | } | 105 | } |
122 | } | 106 | } |
123 | 107 | ||
124 | - /** | ||
125 | - * 获取话题的详细信息 | ||
126 | - * @param req | ||
127 | - * @return | ||
128 | - */ | ||
129 | @Override | 108 | @Override |
130 | - public TopicRespBo grassTopicById(GrassTopicReq req) { | ||
131 | - logger.info("enter grassTopicById req={}", req); | ||
132 | - if(req == null || req.getId() == null){ | ||
133 | - return null; | ||
134 | - } | ||
135 | - | ||
136 | - Integer topicId = req.getId(); | ||
137 | - GrassTopic grassTopic = grassTopicDAO.selectByPrimaryKey(topicId); | ||
138 | - if(grassTopic == null){//没找到 | ||
139 | - logger.warn("grassTopicById topic not exists topicId={} ", topicId); | ||
140 | - return null; | ||
141 | - } | ||
142 | - | ||
143 | - //返回结果 | ||
144 | - TopicRespBo bo = new TopicRespBo(); | ||
145 | - BeanUtils.copyProperties(grassTopic,bo); | ||
146 | - bo.setCreateTimeStr(grassTopic.getCreateTime() == null ? "" : DateUtil.int2DateStr(grassTopic.getCreateTime(),"yyyy-MM-dd HH:mm:ss")); | ||
147 | - | ||
148 | - //关联的标签 | ||
149 | - String relatedLabels = grassTopic.getRelatedLabels(); | ||
150 | - if(StringUtils.isNotEmpty(relatedLabels)){ | ||
151 | - List<String> list = Arrays.asList(StringUtils.split(relatedLabels,",")); | ||
152 | - Set<Integer> labelSet = list.stream().filter(o -> StringUtils.isNotBlank(o)).map(org.apache.commons.lang3.math.NumberUtils::toInt).collect(Collectors.toSet()); | ||
153 | - | ||
154 | - if(CollectionUtils.isNotEmpty(labelSet)){ | ||
155 | - //查询label名称 | ||
156 | - List<GrassLabel> labelList = grassLabelDAO.selectBatchByIds(labelSet); | ||
157 | - List<TopicRespBo.LabelInfo> labelInfoList = new ArrayList<>(); | ||
158 | - for(GrassLabel grassLabel : labelList){ | ||
159 | - TopicRespBo.LabelInfo labelInfo = new TopicRespBo.LabelInfo(grassLabel.getId(), grassLabel.getLabelName()); | ||
160 | - labelInfoList.add(labelInfo); | ||
161 | - } | ||
162 | - bo.setLabelInfoList(labelInfoList); | ||
163 | - } | ||
164 | - } | ||
165 | - | ||
166 | - return bo; | 109 | + public void changeTopicStatus(GrassTopicReq req) { |
110 | + logger.info("enter changeTopicStatus , req={}", req); | ||
111 | + Integer id = req.getId(); | ||
112 | + Integer status = req.getStatus(); | ||
113 | + grassTopicDAO.changeStatus(id,status); | ||
167 | } | 114 | } |
168 | 115 | ||
169 | //转换 | 116 | //转换 |
@@ -172,39 +119,17 @@ public class TopicServiceImpl implements ITopicService { | @@ -172,39 +119,17 @@ public class TopicServiceImpl implements ITopicService { | ||
172 | return new ArrayList<>(); | 119 | return new ArrayList<>(); |
173 | } | 120 | } |
174 | List<TopicRespBo> result = new ArrayList<>(); | 121 | List<TopicRespBo> result = new ArrayList<>(); |
175 | - Set<Integer> labelIdSet = new HashSet<>(); | 122 | + List<Integer> topicId = sourceList.stream().map(GrassTopic::getId).distinct().collect(Collectors.toList()); |
123 | + //查询文章表 统计话题下的文章数(不考虑文章状态) | ||
124 | + | ||
125 | + | ||
126 | + | ||
176 | for(GrassTopic grassTopic : sourceList){ | 127 | for(GrassTopic grassTopic : sourceList){ |
177 | TopicRespBo bo = new TopicRespBo(); | 128 | TopicRespBo bo = new TopicRespBo(); |
178 | BeanUtils.copyProperties(grassTopic,bo); | 129 | BeanUtils.copyProperties(grassTopic,bo); |
179 | - bo.setCreateTimeStr(grassTopic.getCreateTime() == null ? "" : DateUtil.int2DateStr(grassTopic.getCreateTime(),"yyyy-MM-dd HH:mm:ss")); | ||
180 | - String relatedLabels = grassTopic.getRelatedLabels(); | ||
181 | - | ||
182 | - //关联的标签id | ||
183 | - if(StringUtils.isNotEmpty(relatedLabels)){ | ||
184 | - List<String> list = Arrays.asList(StringUtils.split(relatedLabels,",")); | ||
185 | - List<Integer> labelIdList = list.stream().filter(o -> StringUtils.isNotBlank(o)).map(org.apache.commons.lang3.math.NumberUtils::toInt).collect(Collectors.toList()); | ||
186 | - bo.setRelatedLabelIdList(labelIdList); | ||
187 | - labelIdSet.addAll(labelIdList); | ||
188 | - } | 130 | + bo.setUpdateTimeStr(grassTopic.getUpdateTime() == null ? "" : DateUtil.int2DateStr(grassTopic.getUpdateTime(),"yyyy-MM-dd HH:mm:ss")); |
189 | result.add(bo); | 131 | result.add(bo); |
190 | } | 132 | } |
191 | - //从标签表中查询数据 | ||
192 | - if(CollectionUtils.isNotEmpty(labelIdSet)){ | ||
193 | - //查询label名称 | ||
194 | - List<GrassLabel> labelList = grassLabelDAO.selectBatchByIds(labelIdSet); | ||
195 | - Map<Integer,String> labelMap = labelList.stream().collect(Collectors.toMap(GrassLabel::getId, obj -> obj.getLabelName())); | ||
196 | - //用于前端展示 | ||
197 | - for(TopicRespBo bo : result){ | ||
198 | - List<TopicRespBo.LabelInfo> labelInfoList = new ArrayList<>(); | ||
199 | - if(CollectionUtils.isNotEmpty(bo.getRelatedLabelIdList())){ | ||
200 | - for(Integer labelId : bo.getRelatedLabelIdList()){ | ||
201 | - TopicRespBo.LabelInfo labelInfo = new TopicRespBo.LabelInfo(labelId,labelMap.get(labelId) ); | ||
202 | - labelInfoList.add(labelInfo); | ||
203 | - } | ||
204 | - } | ||
205 | - bo.setLabelInfoList(labelInfoList); | ||
206 | - } | ||
207 | - } | ||
208 | return result; | 133 | return result; |
209 | } | 134 | } |
210 | } | 135 | } |
@@ -17,39 +17,52 @@ | @@ -17,39 +17,52 @@ | ||
17 | <td> | 17 | <td> |
18 | <span style="color:red">*</span><label>话题描述</label> <br> | 18 | <span style="color:red">*</span><label>话题描述</label> <br> |
19 | <textarea id="topicDesc" name="topicDesc" style="width: 380px;" rows="6" placeholder="" | 19 | <textarea id="topicDesc" name="topicDesc" style="width: 380px;" rows="6" placeholder="" |
20 | - required="true" maxlength="500"></textarea> | 20 | + required maxlength="100"></textarea> |
21 | </td> | 21 | </td> |
22 | </tr> | 22 | </tr> |
23 | 23 | ||
24 | <tr style="height: 60px"> | 24 | <tr style="height: 60px"> |
25 | <td> | 25 | <td> |
26 | - <span style="color:red">*</span><label>图片</label> <br> | 26 | + <span style="color:red">*</span><label>背景图</label> <br> |
27 | 27 | ||
28 | <div id="imageUpload"> | 28 | <div id="imageUpload"> |
29 | </div> | 29 | </div> |
30 | <!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>--> | 30 | <!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>--> |
31 | </td> | 31 | </td> |
32 | </tr> | 32 | </tr> |
33 | + <tr style="height: 60px"> | ||
34 | + <td> | ||
35 | + <span style="color:red">*</span><label>话题分组</label><br> | ||
33 | 36 | ||
34 | - <tr style="height: 80px"> | 37 | + <input class="easyui-combobox" id="relatedGroup" name="relatedGroup"> |
38 | + </input> | ||
39 | + <!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>--> | ||
40 | + </td> | ||
41 | + </tr> | ||
35 | 42 | ||
36 | - <td> | ||
37 | - <span style="color:red">*</span><label>关联标签</label> <br> | ||
38 | - <div id="relatedLabelsDiv"> | ||
39 | - <span>已选择:</span><br> | ||
40 | - <div id="labelListDiv" style="margin-bottom: 10px; height:40px "> | ||
41 | - </div> | 43 | + <tr style="height: 60px"> |
42 | 44 | ||
43 | - </div> | 45 | + <td > |
46 | + <input value="1" type="checkbox" id="isOfficial" name="isOfficial" >官方话题</input> | ||
47 | + </td> | ||
48 | + </tr> | ||
44 | 49 | ||
45 | - <input id="labelId" name="labelId" class="easyui-combobox" style="width:380px "/> | ||
46 | - <!--<a id="searchLabelBtn" class="btn-info">+选择标签</a>--> | 50 | + <tr style="height: 60px"> |
47 | 51 | ||
52 | + <td > | ||
53 | + <span style="color:red">*</span><label>列表模式</label><br> | ||
48 | 54 | ||
55 | + <input value="0" type="radio" name="viewModel">大图详情</input> | ||
56 | + <input value="1" type="radio" name="viewModel" required="true">小图列表</input> | ||
49 | </td> | 57 | </td> |
50 | </tr> | 58 | </tr> |
51 | 59 | ||
52 | - | 60 | + <tr style="height: 60px"> |
61 | + <td > | ||
62 | + <input value="1" type="checkbox" id="showAttAmount" name="showAttAmount">展示参与人数</input> | ||
63 | + <input value="1" type="checkbox" id="allowAttention" name="allowAttention" >允许用户关注</input> | ||
64 | + </td> | ||
65 | + </tr> | ||
53 | </table> | 66 | </table> |
54 | </div> | 67 | </div> |
55 | </form> | 68 | </form> |
@@ -59,7 +72,6 @@ | @@ -59,7 +72,6 @@ | ||
59 | 72 | ||
60 | <script> | 73 | <script> |
61 | 74 | ||
62 | - var topicId = getUrlParam("topicId"); | ||
63 | 75 | ||
64 | $(function () { | 76 | $(function () { |
65 | $("#topicName").textbox({ | 77 | $("#topicName").textbox({ |
@@ -68,6 +80,28 @@ | @@ -68,6 +80,28 @@ | ||
68 | prompt: "请输入话题名称" | 80 | prompt: "请输入话题名称" |
69 | }); | 81 | }); |
70 | 82 | ||
83 | + /* $("#topicDesc").textarea({ | ||
84 | + required: true, | ||
85 | + maxLength: 100, | ||
86 | + missingMessage: "话题描述不能为空,并小于100字", | ||
87 | + prompt: "请输入话题名称" | ||
88 | + });*/ | ||
89 | + | ||
90 | + | ||
91 | + | ||
92 | + $("#relatedGroup").combobox({ | ||
93 | + valueField : "id", | ||
94 | + textField : "groupName", | ||
95 | + required:true, | ||
96 | + prompt: "请选择话题分组", | ||
97 | + url : serverContextPath + "/topicGroupManage/getAllTopicGroupInfo", | ||
98 | + loadFilter: function (data) { | ||
99 | + var data = defaultLoadFilter(data); | ||
100 | + data.unshift({'id': '', 'groupName': '--请选择分组--'}); | ||
101 | + return data; | ||
102 | + } | ||
103 | + }); | ||
104 | + | ||
71 | 105 | ||
72 | $("#imageUpload").imageUpload({ | 106 | $("#imageUpload").imageUpload({ |
73 | width: 171, | 107 | width: 171, |
@@ -75,7 +109,7 @@ | @@ -75,7 +109,7 @@ | ||
75 | realInputName: "topicImageUrl", | 109 | realInputName: "topicImageUrl", |
76 | url: serverContextPath + '/fileupload/uploadFile', | 110 | url: serverContextPath + '/fileupload/uploadFile', |
77 | queryParams: { | 111 | queryParams: { |
78 | - bucket: "activity" | 112 | + bucket: "grassImg" |
79 | }, | 113 | }, |
80 | onBeforeSubmit: function () { | 114 | onBeforeSubmit: function () { |
81 | $.messager.progress({ | 115 | $.messager.progress({ |
@@ -106,293 +140,36 @@ | @@ -106,293 +140,36 @@ | ||
106 | } | 140 | } |
107 | }); | 141 | }); |
108 | 142 | ||
109 | - $("#labelId").combobox({ | ||
110 | - prompt: "请选择标签", | ||
111 | - required: false, | ||
112 | - selectOnNavigation: true, | ||
113 | - valueField: 'id', | ||
114 | - textField: 'labelName', | ||
115 | - multiple: true, | ||
116 | - url: serverContextPath + "/grassLabelManage/getAllGrassLabelInfo", | ||
117 | - onSelect: function (newVal, oldVal) {//选中事件 | ||
118 | - debugger | ||
119 | - labelChange(newVal, oldVal); | ||
120 | -// //被选中的值 | ||
121 | -// var selectedValue = data; | ||
122 | -// //被选中的文本 | ||
123 | -// var allData = $(this).combobox('getData'); | ||
124 | -// console.log("aa" + aa); | ||
125 | - | ||
126 | - | ||
127 | - }, | ||
128 | - loadFilter: function (data) { | ||
129 | - return defaultLoadFilter(data); | ||
130 | - } | ||
131 | - }); | ||
132 | 143 | ||
133 | 144 | ||
134 | var data = paramObject.mkData; | 145 | var data = paramObject.mkData; |
135 | if (data) {//编辑窗口 | 146 | if (data) {//编辑窗口 |
147 | + | ||
136 | $("#topicName").textbox("setValue", data.topicName); | 148 | $("#topicName").textbox("setValue", data.topicName); |
137 | $("#topicDesc").html(data.topicDesc); | 149 | $("#topicDesc").html(data.topicDesc); |
138 | //图片 | 150 | //图片 |
139 | $("#imageUpload").imageUpload('setValue', data.topicImageUrl); | 151 | $("#imageUpload").imageUpload('setValue', data.topicImageUrl); |
140 | - | ||
141 | -// //已经选择的标签 | ||
142 | debugger | 152 | debugger |
143 | - var labelInfoList = data.labelInfoList; | ||
144 | - if (labelInfoList != null) { | ||
145 | - for (var i = 0; i < labelInfoList.length; i++) { | ||
146 | - var tempId = labelInfoList[i].labelId; | ||
147 | - var tempName = labelInfoList[i].labelName; | ||
148 | - var choosedTagSpan = '<span class="tag" role="choose" style="margin-left: 10px;font-size: 14px" name="choosedTag" data-labelId="' + tempId + '" data-labelName="' + tempName + '"><span style="background-color: #1caf9a;color: white;font-size: 14px">' + tempName + '</span><a href="#" style="background-color: #1caf9a;font-size: 14px" title="Removing tag" data-index="0" class="removetag">x</a></span>'; | ||
149 | - $("#labelListDiv").append(choosedTagSpan); | ||
150 | - | ||
151 | - } | 153 | + $("#relatedGroup").combobox('setValue', data.relatedGroup); |
154 | + if(data.isOfficial == 1){ | ||
155 | + $("#isOfficial").attr("checked",true) | ||
152 | } | 156 | } |
153 | 157 | ||
154 | - } | 158 | + $("input[name='viewModel'][value='"+data.viewModel+"']").attr("checked", "checked").parent().addClass('checked'); |
155 | 159 | ||
160 | + if(data.showAttAmount == 1){ | ||
161 | + $("#showAttAmount").attr("checked",true) | ||
162 | + } | ||
156 | 163 | ||
157 | - /* //查询标签列表 | ||
158 | - $("#searchLabelBtn").linkbutton({ | ||
159 | - iconCls: "icon-search", | ||
160 | - onClick: function () { | ||
161 | - chooseLabels(); | ||
162 | - } | ||
163 | - });*/ | ||
164 | - | ||
165 | -// //新建--修改话题--提交 | ||
166 | -// $("#subBotton").linkbutton({ | ||
167 | -// iconCls: "icon-save", | ||
168 | -// width: 100, | ||
169 | -// onClick: function () { | ||
170 | -// $("#topicForm").form("submit", { | ||
171 | -// url: serverContextPath + "/grassTopicManage/addUpGrassTopic", | ||
172 | -// onSubmit: function (param) { | ||
173 | -// debugger; | ||
174 | -// //1)表单基本检查 | ||
175 | -// if (!$("#topicForm").form("validate")) { | ||
176 | -// return false; | ||
177 | -// } | ||
178 | -// | ||
179 | -// //2)是否上传了图片 | ||
180 | -// var imageCount = 0; | ||
181 | -// $("input[name='topicImageUrl']").each(function (j, item) { | ||
182 | -// var url = item.value; | ||
183 | -// if (url != '') { | ||
184 | -// imageCount++; | ||
185 | -// } | ||
186 | -// }); | ||
187 | -// if (imageCount == 0) { | ||
188 | -// $.messager.alert("保存失败", "至少要选择一张图片", "error"); | ||
189 | -// return false; | ||
190 | -// | ||
191 | -// } | ||
192 | -// //3)是否选择了标签 | ||
193 | -// var relatedLabels = ""; | ||
194 | -// var tagCount = 0; | ||
195 | -// $("#taglist").find("span[role='choose']").each(function (item, index) { | ||
196 | -// debugger | ||
197 | -// var tempId = $(this).attr('data-labelid'); | ||
198 | -// if (tempId != null) { | ||
199 | -// tagCount++; | ||
200 | -// relatedLabels += tempId + ","; | ||
201 | -// } | ||
202 | -// }); | ||
203 | -// | ||
204 | -// if (tagCount == 0 || tagCount > 5) { | ||
205 | -// $.messager.alert("保存失败", "至少选择一个标签,最多5个", "error"); | ||
206 | -// return false; | ||
207 | -// } | ||
208 | -// | ||
209 | -// param.relatedLabels = relatedLabels; | ||
210 | -// param.id = topicId; | ||
211 | -// return true; | ||
212 | -// | ||
213 | -// | ||
214 | -// }, | ||
215 | -// success: function (data) { | ||
216 | -// if (data) { | ||
217 | -// data = $.parseJSON(data); | ||
218 | -// if (data.code == 200) { | ||
219 | -// $.messager.alert("提示", "保存成功", "info", function () { | ||
220 | -// window.location.reload() | ||
221 | -// }); | ||
222 | -// // alert("保存成功"); | ||
223 | -// | ||
224 | -// | ||
225 | -// } else { | ||
226 | -// $.messager.alert("保存失败", data.message, "error"); | ||
227 | -// } | ||
228 | -// } else { | ||
229 | -// $.messager.alert("保存失败", data.message, "error"); | ||
230 | -// } | ||
231 | -// } | ||
232 | -// }); | ||
233 | -// | ||
234 | -// } | ||
235 | -// }); | ||
236 | - | ||
237 | - | ||
238 | -// //编辑话题 | ||
239 | -// if (topicId != "null") {//去加载数据 | ||
240 | -// var title = "修改话题"; | ||
241 | -// $("#titleSpan").html(title); | ||
242 | -// //加载数据 | ||
243 | -// $.ajax({ | ||
244 | -// type: "get", | ||
245 | -// url: serverContextPath + "/grassTopicManage/grassTopicById?id=" + topicId, | ||
246 | -// success: function (data) { | ||
247 | -// debugger | ||
248 | -// if (data != null && data.code == 200) {//成功的 | ||
249 | -// var detailInfo = data.data; | ||
250 | -// $("#topicName").textbox("setValue", detailInfo.topicName); | ||
251 | -// $("#topicDesc").html(detailInfo.topicDesc); | ||
252 | -// //图片 | ||
253 | -// $("#imageUpload").imageUpload('setValue', detailInfo.topicImageUrl); | ||
254 | -// | ||
255 | -// //已经选择的标签 | ||
256 | -// var labelInfoList = detailInfo.labelInfoList; | ||
257 | -// if(labelInfoList!=null){ | ||
258 | -// for (var i = 0; i < labelInfoList.length; i++) { | ||
259 | -// var tempId = labelInfoList[i].labelId; | ||
260 | -// var tempName = labelInfoList[i].labelName; | ||
261 | -// var choosedTagSpan = '<span class="tag" role="choose" style="margin-left: 10px" name="choosedTag" data-labelId="' + tempId + '" data-labelName="' + tempName + '"><span style="background-color: #1caf9a;color: white">' + tempName + '</span><a href="#" style="background-color: #1caf9a" title="Removing tag" data-index="0" class="removetag">x</a></span>'; | ||
262 | -// $("#taglist").append(choosedTagSpan); | ||
263 | -// | ||
264 | -// } | ||
265 | -// } | ||
266 | -// | ||
267 | -// | ||
268 | -// | ||
269 | -// } | ||
270 | -// } | ||
271 | -// }); | ||
272 | -// | ||
273 | -// | ||
274 | -// } | ||
275 | - | ||
276 | - | ||
277 | - $(document).on('click', '.removetag', function () { | ||
278 | -// $(this).remove(); | ||
279 | - $(this).closest(".tag").remove(); | ||
280 | - }); | 164 | + if(data.allowAttention == 1){ |
165 | + $("#allowAttention").attr("checked",true) | ||
166 | + } | ||
281 | 167 | ||
168 | + } | ||
282 | 169 | ||
283 | - }); | ||
284 | 170 | ||
285 | - // //选择标签列表 | ||
286 | - // function chooseLabels() { | ||
287 | - // var chooseLabelList = $("<div id='chooseLabelList'>").appendTo($(document.body)); | ||
288 | - // var chooseLabelList = $("<div id='chooseLabelList'>").appendTo($(document.body)); | ||
289 | - // var title = "选择标签"; | ||
290 | - // $("#chooseLabelList").myDialog({ | ||
291 | - // title: title, | ||
292 | - // width: "60%", | ||
293 | - // height: "70%", | ||
294 | - // resizable: false, | ||
295 | - // buttons: [{ | ||
296 | - // id: "saveChooseLabelBtn", | ||
297 | - // text: "保存", | ||
298 | - // iconCls: "icon-save", | ||
299 | - // handler: function () { | ||
300 | - // //确定保存之前,要把之前已经选择的标签清空 | ||
301 | - // | ||
302 | - // $("#taglist").html(""); | ||
303 | - // //做相应的处理 回填信息--所有被选择的复选框 | ||
304 | - // var tempHtml = $("#choosedDiv").html(); | ||
305 | - // debugger | ||
306 | - // $("#taglist").html(tempHtml); | ||
307 | - // /* $("#taglist").find("span[role='choose']").each(function (item, index) { | ||
308 | - // $(item).val(picTextData[index][$(item).attr('data-')]); | ||
309 | - // });*/ | ||
310 | - // | ||
311 | - // | ||
312 | - // $(chooseLabelList).dialog("close"); | ||
313 | - //// $.messager.show({ | ||
314 | - //// title: "提示", | ||
315 | - //// msg: title + "成功!", | ||
316 | - //// height: 120 | ||
317 | - //// }); | ||
318 | - // } | ||
319 | - // }, { | ||
320 | - // id: "closeChooseBtn", | ||
321 | - // text: "关闭", | ||
322 | - // iconCls: "icon-cancel", | ||
323 | - // handler: function () { | ||
324 | - // $.messager.confirm("确认", "确认关闭吗?", function (flag) { | ||
325 | - // if (flag) { | ||
326 | - // $(chooseLabelList).dialog("close"); | ||
327 | - // } | ||
328 | - // }); | ||
329 | - // } | ||
330 | - // }], | ||
331 | - // modal: true, | ||
332 | - // href: contextPath + "/html/grass/labelManage/chooseLabels.html", | ||
333 | - // }); | ||
334 | - // | ||
335 | - // } | ||
336 | - | ||
337 | - | ||
338 | - //获取url中的参数方法 | ||
339 | - function getUrlParam(name) { | ||
340 | - //构造一个含有目标参数的正则表达式对象 | ||
341 | - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | ||
342 | - //匹配目标参数 | ||
343 | - var r = window.location.search.substr(1).match(reg); | ||
344 | - //返回参数 | ||
345 | - if (r != null) { | ||
346 | - return unescape(r[2]); | ||
347 | - } else { | ||
348 | - return null; | ||
349 | - } | ||
350 | - } | ||
351 | 171 | ||
352 | - function labelChange(newVal, oldVal) { | ||
353 | - //newVal---是指新增加的值 | ||
354 | - if (newVal == null) { | ||
355 | - return; | ||
356 | - } | ||
357 | - //新增加的数据 | ||
358 | - var selectedValue = newVal; | ||
359 | - var tempId = selectedValue.id; | ||
360 | - var tempName = selectedValue.labelName; | ||
361 | - var divStr = '<span class="tag" role="choose" style="margin-left: 10px;font-size: 14px" name="choosedTag" data-labelId="' + tempId + '" data-labelName="' + tempName + '"><span style="background-color: #1caf9a;color: white;font-size: 14px">' + tempName + '</span><a href="#" style="background-color: #1caf9a;font-size: 14px" title="Removing tag" data-index="0" class="removetag">x</a></span>'; | ||
362 | - //新增加的数据 | ||
363 | - $("#labelListDiv").append(divStr); | ||
364 | - | ||
365 | -// //新增加的数据 | ||
366 | -// var selectedValue = newVal; | ||
367 | -// | ||
368 | -// //被选中的文本 | ||
369 | -// var allData = $("#labelId").combobox('getData'); | ||
370 | -// // | ||
371 | -// var divStr = ""; | ||
372 | -// for(var i = 0; i< selectedValue.length; i++){ | ||
373 | -// | ||
374 | -// | ||
375 | -// var tempId = selectedValue[i]; | ||
376 | -// if(tempId == null){//搜索的时候 有可能把搜索项给写进去了 | ||
377 | -// continue; | ||
378 | -// } | ||
379 | -// //找出对应的文本 | ||
380 | -// var tempName=""; | ||
381 | -// | ||
382 | -// for(var j = 0; j< allData.length; j++){ | ||
383 | -// if(selectedValue[i] == allData[j].id){ | ||
384 | -// tempName = allData[j].labelName; | ||
385 | -// break;//跳出循环 | ||
386 | -// } | ||
387 | -// } | ||
388 | -// //把文本写到已选择的里面去 | ||
389 | -// divStr += '<span class="tag" role="choose" style="margin-left: 10px;font-size: 14px" name="choosedTag" data-labelId="' + tempId + '" data-labelName="' + tempName + '"><span style="background-color: #1caf9a;color: white;font-size: 14px">' + tempName + '</span><a href="#" style="background-color: #1caf9a;font-size: 14px" title="Removing tag" data-index="0" class="removetag">x</a></span>'; | ||
390 | -// } | ||
391 | -// | ||
392 | -// | ||
393 | -// $("#labelListDiv").html(divStr); | ||
394 | - | ||
395 | - } | 172 | + }); |
396 | 173 | ||
397 | 174 | ||
398 | </script> | 175 | </script> |
@@ -32,13 +32,19 @@ | @@ -32,13 +32,19 @@ | ||
32 | 32 | ||
33 | <div style="margin-left: 20px;margin-top: 10px"> | 33 | <div style="margin-left: 20px;margin-top: 10px"> |
34 | 34 | ||
35 | - <input class="easyui-textbox" id="topicNameParam" style="width: 140px"> | 35 | + <input class="easyui-combobox" id="statusParam"> |
36 | + </input> | ||
36 | 37 | ||
38 | + <input class="easyui-combobox" id="isOfficialParam"> | ||
37 | </input> | 39 | </input> |
38 | 40 | ||
39 | - <input class="easyui-combobox" id="statusParam"> | 41 | + <input class="easyui-textbox" id="topicNameParam" style="width: 140px"> |
42 | + </input> | ||
43 | + | ||
44 | + <input class="easyui-textbox" id="topicGroupParam" style="width: 140px"> | ||
40 | </input> | 45 | </input> |
41 | 46 | ||
47 | + <span>最近修改时间</span> | ||
42 | <input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'开始时间'"/> | 48 | <input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'开始时间'"/> |
43 | 49 | ||
44 | ~ | 50 | ~ |
@@ -75,19 +81,34 @@ | @@ -75,19 +81,34 @@ | ||
75 | } | 81 | } |
76 | }); | 82 | }); |
77 | 83 | ||
78 | - $("#topicNameParam").textbox({ | 84 | + $("#statusParam").combobox({ |
85 | + valueField: "value", | ||
86 | + textField: "text", | ||
79 | required: false, | 87 | required: false, |
80 | - prompt: "请输入话题名称" | 88 | + prompt: "请选择状态", |
89 | + data: [{text: "请选择状态", value: "8"}, {text: "进行中", value: "1"}, {text: "已下架", value: "0"}] | ||
81 | }); | 90 | }); |
82 | 91 | ||
83 | - $("#statusParam").combobox({ | 92 | + $("#isOfficialParam").combobox({ |
84 | valueField: "value", | 93 | valueField: "value", |
85 | textField: "text", | 94 | textField: "text", |
86 | required: false, | 95 | required: false, |
87 | - prompt: "请选择状态", | ||
88 | - data: [{text: "请选择状态", value: ""}, {text: "进行中", value: "1"}, {text: "已下架", value: "0"}] | 96 | + prompt: "是否官方", |
97 | + data: [{text: "全部", value: "8"}, {text: "官方", value: "1"}, {text: "非官方", value: "0"}] | ||
98 | + }); | ||
99 | + | ||
100 | + $("#topicNameParam").textbox({ | ||
101 | + required: false, | ||
102 | + prompt: "请输入话题名称" | ||
89 | }); | 103 | }); |
90 | 104 | ||
105 | + $("#topicGroupParam").textbox({ | ||
106 | + required: false, | ||
107 | + prompt: "请输入分组名称" | ||
108 | + }); | ||
109 | + | ||
110 | + | ||
111 | + | ||
91 | $("#searchBtn").linkbutton({ | 112 | $("#searchBtn").linkbutton({ |
92 | iconCls: "icon-search", | 113 | iconCls: "icon-search", |
93 | onClick: function () { | 114 | onClick: function () { |
@@ -100,8 +121,10 @@ | @@ -100,8 +121,10 @@ | ||
100 | endTime = parseInt(new Date($("#endTimeStr").datetimebox('getValue')).getTime() / 1000); | 121 | endTime = parseInt(new Date($("#endTimeStr").datetimebox('getValue')).getTime() / 1000); |
101 | } | 122 | } |
102 | $("#labelListTable").datagrid("load", { | 123 | $("#labelListTable").datagrid("load", { |
103 | - topicName: $("#topicNameParam").textbox("getValue"), | ||
104 | status: $("#statusParam").combobox("getValue"), | 124 | status: $("#statusParam").combobox("getValue"), |
125 | + isOfficial: $("#isOfficialParam").combobox("getValue"), | ||
126 | + topicName: $("#topicNameParam").textbox("getValue"), | ||
127 | + groupName: $("#topicGroupParam").textbox("getValue"), | ||
105 | startTime: startTime, | 128 | startTime: startTime, |
106 | endTime: endTime | 129 | endTime: endTime |
107 | }); | 130 | }); |
@@ -133,7 +156,7 @@ | @@ -133,7 +156,7 @@ | ||
133 | }, | 156 | }, |
134 | columns: [[ | 157 | columns: [[ |
135 | { | 158 | { |
136 | - title: "ID", | 159 | + title: "话题ID", |
137 | field: "id", | 160 | field: "id", |
138 | width: 15, | 161 | width: 15, |
139 | align: "center" | 162 | align: "center" |
@@ -160,24 +183,25 @@ | @@ -160,24 +183,25 @@ | ||
160 | } | 183 | } |
161 | }, | 184 | }, |
162 | { | 185 | { |
163 | - title: "关联标签", | ||
164 | - field: "labelInfoList", | 186 | + title: "话题分组", |
187 | + field: "groupName", | ||
165 | width: 25, | 188 | width: 25, |
166 | - align: "left", | ||
167 | - formatter: function (value, rowData, rowIndex) { | ||
168 | - var str = ""; | ||
169 | - for (var i = 0; i < value.length; i++) { | ||
170 | - str += value[i].labelName + " "; | ||
171 | - } | ||
172 | - return str; | ||
173 | - } | ||
174 | - }, { | ||
175 | - title: "创建时间", | ||
176 | - field: "createTimeStr", | 189 | + align: "left" |
190 | + }, | ||
191 | + { | ||
192 | + title: "最近修改时间", | ||
193 | + field: "updateTimeStr", | ||
177 | width: 25, | 194 | width: 25, |
178 | align: "left" | 195 | align: "left" |
179 | - }, { | 196 | + }, |
197 | + { | ||
180 | title: "参与人数", | 198 | title: "参与人数", |
199 | + field: "articleAmount", | ||
200 | + width: 25, | ||
201 | + align: "left" | ||
202 | + }, | ||
203 | + { | ||
204 | + title: "关注人数", | ||
181 | field: "attAmount", | 205 | field: "attAmount", |
182 | width: 25, | 206 | width: 25, |
183 | align: "left" | 207 | align: "left" |
@@ -190,7 +214,7 @@ | @@ -190,7 +214,7 @@ | ||
190 | if (value == 1) { | 214 | if (value == 1) { |
191 | return "进行中"; | 215 | return "进行中"; |
192 | } else { | 216 | } else { |
193 | - return "已下架"; | 217 | + return "下架"; |
194 | } | 218 | } |
195 | } | 219 | } |
196 | 220 | ||
@@ -205,9 +229,14 @@ | @@ -205,9 +229,14 @@ | ||
205 | var changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='0' dataId='" + rowData.id + "' index='" + rowIndex + "'>下架</a>"; | 229 | var changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='0' dataId='" + rowData.id + "' index='" + rowIndex + "'>下架</a>"; |
206 | ; | 230 | ; |
207 | if (rowData.status == 0) { | 231 | if (rowData.status == 0) { |
208 | - changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #ffa951' changedStatus='1' dataId='" + rowData.id + "' index='" + rowIndex + "'>上架</a>"; | 232 | + changeStatus = "<a role='changeStatus' style='margin-left:10px;background-color: #c4ddff' changedStatus='1' dataId='" + rowData.id + "' index='" + rowIndex + "'>上架</a>"; |
209 | } | 233 | } |
210 | - return str + changeStatus; | 234 | + |
235 | + str += changeStatus; | ||
236 | + | ||
237 | +// str += "<a role='' style='margin-left:10px;background-color: #ffa951' changedStatus='1' dataId='" + rowData.id + "' index='" + rowIndex + "'>复制链接</a>" ; | ||
238 | + | ||
239 | + return str ; | ||
211 | } | 240 | } |
212 | } | 241 | } |
213 | 242 | ||
@@ -391,7 +420,7 @@ | @@ -391,7 +420,7 @@ | ||
391 | status: data.status | 420 | status: data.status |
392 | }; | 421 | }; |
393 | 422 | ||
394 | - $.post(serverContextPath + "/grassTopicManage/addUpGrassTopic", param, function (data) { | 423 | + $.post(serverContextPath + "/grassTopicManage/changeTopicStatus", param, function (data) { |
395 | //数据填到框框里面 | 424 | //数据填到框框里面 |
396 | // debugger | 425 | // debugger |
397 | if (data.code == 200) { | 426 | if (data.code == 200) { |
@@ -419,7 +448,7 @@ | @@ -419,7 +448,7 @@ | ||
419 | var labelList = $("<div id='labelList'>").appendTo($(document.body)); | 448 | var labelList = $("<div id='labelList'>").appendTo($(document.body)); |
420 | var title = data == null ? "新建话题" : "修改话题"; | 449 | var title = data == null ? "新建话题" : "修改话题"; |
421 | var textVar = data == null ? "保存" : "保存"; | 450 | var textVar = data == null ? "保存" : "保存"; |
422 | - var msgVar = data == null ? "确认新增标签吗?" : "确认保存标签吗?"; | 451 | + var msgVar = data == null ? "确认新增话题吗?" : "确认保存话题吗?"; |
423 | 452 | ||
424 | window.self.paramObject.mkData = data; | 453 | window.self.paramObject.mkData = data; |
425 | $(labelList).myDialog({ | 454 | $(labelList).myDialog({ |
@@ -445,6 +474,13 @@ | @@ -445,6 +474,13 @@ | ||
445 | return false; | 474 | return false; |
446 | } | 475 | } |
447 | 476 | ||
477 | + //话题描述 | ||
478 | + var topicDesc = $("#topicDesc").val(); | ||
479 | + if(topicDesc == null || topicDesc =="" || topicDesc.length > 100){ | ||
480 | + $.messager.alert("保存失败", "话题描述不能为空,且小于100字", "error"); | ||
481 | + return false; | ||
482 | + } | ||
483 | + | ||
448 | //2)是否上传了图片 | 484 | //2)是否上传了图片 |
449 | var imageCount = 0; | 485 | var imageCount = 0; |
450 | $("input[name='topicImageUrl']").each(function (j, item) { | 486 | $("input[name='topicImageUrl']").each(function (j, item) { |
@@ -458,24 +494,14 @@ | @@ -458,24 +494,14 @@ | ||
458 | return false; | 494 | return false; |
459 | 495 | ||
460 | } | 496 | } |
461 | - //3)是否选择了标签 | ||
462 | - var relatedLabels = ""; | ||
463 | - var tagCount = 0; | ||
464 | - $("#labelListDiv").find("span[role='choose']").each(function (item, index) { | ||
465 | - debugger | ||
466 | - var tempId = $(this).attr('data-labelid'); | ||
467 | - if (tempId != null) { | ||
468 | - tagCount++; | ||
469 | - relatedLabels += tempId + ","; | ||
470 | - } | ||
471 | - }); | ||
472 | 497 | ||
473 | - if (tagCount == 0 || tagCount > 5) { | ||
474 | - $.messager.alert("保存失败", "至少选择一个标签,最多5个", "error"); | 498 | + var group = $("#relatedGroup").combobox("getValue"); |
499 | + if( group == null || group == ""){ | ||
500 | + $.messager.alert("保存失败", "请选择分组", "error"); | ||
475 | return false; | 501 | return false; |
476 | } | 502 | } |
477 | 503 | ||
478 | - param.relatedLabels = relatedLabels; | 504 | + |
479 | 505 | ||
480 | 506 | ||
481 | $.messager.progress({ | 507 | $.messager.progress({ |
-
Please register or login to post a comment