Authored by 张帅

后台发文章用户维护

@@ -31,4 +31,11 @@ public class GrassArticleController { @@ -31,4 +31,11 @@ public class GrassArticleController {
31 return new ApiResponse.ApiResponseBuilder().build(); 31 return new ApiResponse.ApiResponseBuilder().build();
32 } 32 }
33 33
  34 + @RequestMapping("/platPublishUser")
  35 + public ApiResponse platPublishUser(){
  36 + logger.info("grassArticle platPublishUser begin, req is {}");
  37 +
  38 + return new ApiResponse.ApiResponseBuilder().data(grassArticleService.getPlatPublishUser()).build();
  39 + }
  40 +
34 } 41 }
@@ -3,9 +3,13 @@ package com.yohobuy.platform.grass.service; @@ -3,9 +3,13 @@ package com.yohobuy.platform.grass.service;
3 import com.yohobuy.platform.common.exception.PlatformException; 3 import com.yohobuy.platform.common.exception.PlatformException;
4 import com.yohobuy.platform.model.grass.request.GrassArticleReq; 4 import com.yohobuy.platform.model.grass.request.GrassArticleReq;
5 5
  6 +import java.util.List;
  7 +
6 /** 8 /**
7 */ 9 */
8 public interface IGrassArticleService { 10 public interface IGrassArticleService {
9 11
10 void publishArticle(GrassArticleReq req) throws PlatformException; 12 void publishArticle(GrassArticleReq req) throws PlatformException;
  13 +
  14 + List<Integer> getPlatPublishUser();
11 } 15 }
@@ -6,6 +6,7 @@ import com.yohobuy.platform.common.util.DateUtil; @@ -6,6 +6,7 @@ import com.yohobuy.platform.common.util.DateUtil;
6 import com.yohobuy.platform.dal.grass.IGrassArticleDao; 6 import com.yohobuy.platform.dal.grass.IGrassArticleDao;
7 import com.yohobuy.platform.dal.grass.IGrassArticleImageDao; 7 import com.yohobuy.platform.dal.grass.IGrassArticleImageDao;
8 import com.yohobuy.platform.dal.grass.IGrassArticleSknDao; 8 import com.yohobuy.platform.dal.grass.IGrassArticleSknDao;
  9 +import com.yohobuy.platform.dal.grass.IGrassPlatUserDao;
9 import com.yohobuy.platform.dal.grass.model.GrassArticle; 10 import com.yohobuy.platform.dal.grass.model.GrassArticle;
10 import com.yohobuy.platform.dal.grass.model.GrassArticleImage; 11 import com.yohobuy.platform.dal.grass.model.GrassArticleImage;
11 import com.yohobuy.platform.dal.grass.model.GrassArticleSkn; 12 import com.yohobuy.platform.dal.grass.model.GrassArticleSkn;
@@ -33,6 +34,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -33,6 +34,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
33 private IGrassArticleImageDao grassArticleImageDao; 34 private IGrassArticleImageDao grassArticleImageDao;
34 @Resource 35 @Resource
35 private IGrassArticleSknDao grassArticleSknDao; 36 private IGrassArticleSknDao grassArticleSknDao;
  37 + @Resource
  38 + private IGrassPlatUserDao grassPlatUserDao;
36 39
37 40
38 @Override 41 @Override
@@ -88,6 +91,12 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ @@ -88,6 +91,12 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
88 91
89 } 92 }
90 93
  94 + @Override
  95 + public List<Integer> getPlatPublishUser() {
  96 + List<Integer> list = grassPlatUserDao.getAllPlatUid();
  97 + return list;
  98 + }
  99 +
91 private void publishCheck(GrassArticleReq req) throws PlatformException { 100 private void publishCheck(GrassArticleReq req) throws PlatformException {
92 if(req.getArticleUid() ==null){ 101 if(req.getArticleUid() ==null){
93 logger.info("publishCheck uid is null"); 102 logger.info("publishCheck uid is null");
@@ -330,6 +330,7 @@ datasources: @@ -330,6 +330,7 @@ datasources:
330 - com.yohobuy.platform.dal.grass.IGrassArticleImageDao 330 - com.yohobuy.platform.dal.grass.IGrassArticleImageDao
331 - com.yohobuy.platform.dal.grass.IGrassArticleSknDao 331 - com.yohobuy.platform.dal.grass.IGrassArticleSknDao
332 - com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO 332 - com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO
  333 + - com.yohobuy.platform.dal.grass.IGrassPlatUserDao
333 334
334 yhb_promotion: 335 yhb_promotion:
335 servers: 336 servers:
@@ -329,6 +329,7 @@ datasources: @@ -329,6 +329,7 @@ datasources:
329 - com.yohobuy.platform.dal.grass.IGrassArticleImageDao 329 - com.yohobuy.platform.dal.grass.IGrassArticleImageDao
330 - com.yohobuy.platform.dal.grass.IGrassArticleSknDao 330 - com.yohobuy.platform.dal.grass.IGrassArticleSknDao
331 - com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO 331 - com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO
  332 + - com.yohobuy.platform.dal.grass.IGrassPlatUserDao
332 333
333 yhb_promotion: 334 yhb_promotion:
334 servers: 335 servers:
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 <tr style="height: 60px"> 39 <tr style="height: 60px">
40 <td > 40 <td >
41 <span style="color:red">*</span><label>选择用户</label> <br> 41 <span style="color:red">*</span><label>选择用户</label> <br>
42 - <input id="articleUid" name="articleUid" style="width:60% " class="easyui-textbox" /> 42 + <input id="articleUid" name="articleUid" style="width:60% " class="easyui-combobox" />
43 </td> 43 </td>
44 </tr> 44 </tr>
45 45
@@ -84,8 +84,8 @@ @@ -84,8 +84,8 @@
84 </td> 84 </td>
85 </tr> 85 </tr>
86 <tr> 86 <tr>
87 - <td height="50" valign="bottom">  
88 - <input class="btn-primary" type="submit" value="保存"/> 87 + <td valign="bottom">
  88 + <input id="subBotton" class="btn-primary" type="button" style="font-size: 20px; margin-top: 0px;margin-bottom: 0px;" value="保存"/>
89 </td> 89 </td>
90 </tr> 90 </tr>
91 </table> 91 </table>
@@ -105,91 +105,80 @@ @@ -105,91 +105,80 @@
105 var checkedItemsObj = {}; 105 var checkedItemsObj = {};
106 $(function () { 106 $(function () {
107 107
108 - $("#articleUid").textbox({ 108 + $("#articleUid").combobox({
109 required: true, 109 required: true,
110 missingMessage: "发布用户不能为空", 110 missingMessage: "发布用户不能为空",
111 - prompt: "请输入发布用户" 111 + prompt: "请输入发布用户",
  112 + selectOnNavigation : true,
  113 + valueField: 'text',
  114 + textField: 'value',
  115 + url : contextPath + "/grassArticle/platPublishUser",
  116 + loadFilter: function (data) {
  117 + var list = [];
  118 + var obj = {};
  119 + debugger;
  120 + for (var i = 0; i < data.data.length; i++) {
  121 + obj['text'] = data.data[i];
  122 + obj['value'] = data.data[i];
  123 + list.push(obj);
  124 + }
  125 + return list;
  126 + }
112 }); 127 });
113 128
114 $("#topic").combobox({ 129 $("#topic").combobox({
115 prompt: "请选择话题" 130 prompt: "请选择话题"
116 }); 131 });
117 -  
118 - // $("#imageUpload1").imageUpload({  
119 - // width: 171,  
120 - // height: 120,  
121 - // realInputName: "url",  
122 - // url: contextPath + '/fileupload/uploadFile',  
123 - // queryParams: {  
124 - // bucket: "activity"  
125 - // },  
126 - // onBeforeSubmit: function () {  
127 - // $.messager.progress({  
128 - // title: "正在执行",  
129 - // msg: "正在执行,请稍后...",  
130 - // interval: 500,  
131 - // text: ""  
132 - // });  
133 - // },  
134 - // filterFileName: function (data) {  
135 - // debugger;  
136 - // if (!data || data.code != 200) {  
137 - // $.messager.progress("close");  
138 - // $.messager.alert("错误",data.message);  
139 - // return "";  
140 - // }  
141 - //  
142 - // return data.data.url;  
143 - // },  
144 - // onLoadSuccess: function (data) {  
145 - // debugger  
146 - // $.messager.progress("close");  
147 - // return false;  
148 - // }  
149 - // });  
150 -  
151 initimg(); 132 initimg();
152 133
  134 + $("#subBotton").linkbutton({
  135 + iconCls: "icon-save",
  136 + onClick: function () {
  137 + $("#publishArticleForm").form("submit",{
  138 + url : serverContextPath+"/grassArticle/publishArticle",
  139 + onSubmit : function(param) {
  140 + debugger;
  141 + if (!$("#publishArticleForm").form("validate")) {
  142 + return false;
153 143
154 - });  
155 -  
156 - $("#publishArticleForm").form("submit",{  
157 - url : serverContextPath+"/grassArticle/publishArticle",  
158 - onSubmit : function(param) {  
159 - debugger  
160 - if (!$("#publishArticleForm").form("validate")) {  
161 - return false; 144 + }
  145 + if($("#articleUid").combobox("getValue") == ''){
  146 + return false;
  147 + }
  148 + var imgs = '';
  149 + $("input[name='url']").each(function(j,item){
  150 + debugger
  151 + var url = item.value;
  152 + if(imgs == ''){
  153 + imgs = url;
  154 + }else{
  155 + imgs = imgs + ","+url;
  156 + }
  157 + });
  158 + $("#imgs").val(imgs);
  159 + return true;
  160 + },
  161 + success : function(data) {
  162 + if (data) {
  163 + data = $.parseJSON(data);
  164 + if (data.code == 200) {
  165 + $.messager.alert("保存成功");
  166 + } else {
  167 + $.messager.alert("保存失败", data.message, "error");
  168 + }
  169 + } else {
  170 + $.messager.alert("保存失败", data.message, "error");
  171 + }
  172 + }
  173 + });
162 174
163 } 175 }
164 - if($("#articleUid").val() == ''){  
165 - return false;  
166 - }  
167 - var imgs = '';  
168 - $("input[name='url']").each(function(j,item){  
169 - var url = item.val();  
170 - if(imgs == ''){  
171 - imgs = url;  
172 - }else{  
173 - imgs = imgs + ","+url;  
174 - }  
175 - });  
176 - $("#imgs").val(imgs);  
177 - return true;  
178 - },  
179 - success : function(data) {  
180 - if (data) {  
181 - data = $.parseJSON(data);  
182 - if (data.code == 200) {  
183 - $.messager.alert("保存成功");  
184 - } else {  
185 - $.messager.alert("保存失败", data.message, "error");  
186 - }  
187 - } else {  
188 - $.messager.alert("保存失败", data.message, "error");  
189 - }  
190 - } 176 + });
191 }); 177 });
192 178
  179 +
  180 +
  181 +
193 // 编辑分组 182 // 编辑分组
194 function getEditDialog(data){ 183 function getEditDialog(data){
195 var labelGroupList = $("<div id='labelGroupList'>").appendTo($(document.body)); 184 var labelGroupList = $("<div id='labelGroupList'>").appendTo($(document.body));
@@ -208,16 +197,13 @@ @@ -208,16 +197,13 @@
208 text:textVar, 197 text:textVar,
209 iconCls : "icon-save", 198 iconCls : "icon-save",
210 handler:function(){ 199 handler:function(){
211 - debugger  
212 - // $("input[type='checkbox'][name='id']:checked").each(function (index,$this) {  
213 - // buildgood(index,$this)  
214 - // }); 200 + debugger;
215 $("#goodstd").html("<div id=\"good0\" style=\"float: left;\">\n" + 201 $("#goodstd").html("<div id=\"good0\" style=\"float: left;\">\n" +
216 - " </div>") 202 + " </div>");
217 var skns = ''; 203 var skns = '';
218 for (var i = 0; i < checkedItems.length; i++) { 204 for (var i = 0; i < checkedItems.length; i++) {
219 - buildgood(i,checkedItems[i])  
220 - if( i == checkedItems.length){ 205 + buildgood(i,checkedItems[i]);
  206 + if( i == checkedItems.length -1){
221 skns = skns+ checkedItems[i] 207 skns = skns+ checkedItems[i]
222 }else{ 208 }else{
223 skns = skns+ checkedItems[i] +"," 209 skns = skns+ checkedItems[i] +","
@@ -243,7 +229,7 @@ @@ -243,7 +229,7 @@
243 } 229 }
244 230
245 function oo(num){ 231 function oo(num){
246 - debugger 232 + // debugger
247 if(num >9){ 233 if(num >9){
248 return 234 return
249 } 235 }
@@ -273,7 +259,7 @@ @@ -273,7 +259,7 @@
273 return data.data.url; 259 return data.data.url;
274 }, 260 },
275 onLoadSuccess: function (data) { 261 onLoadSuccess: function (data) {
276 - debugger 262 + debugger;
277 $.messager.progress("close"); 263 $.messager.progress("close");
278 return false; 264 return false;
279 } 265 }
@@ -289,7 +275,7 @@ @@ -289,7 +275,7 @@
289 } 275 }
290 276
291 function buildgood(index,obj) { 277 function buildgood(index,obj) {
292 - debugger 278 + debugger;
293 var data = checkedItemsObj[obj]; 279 var data = checkedItemsObj[obj];
294 $("#good"+index).html(gooddiv(data)); 280 $("#good"+index).html(gooddiv(data));
295 $div = $("#good"+(index+1)); 281 $div = $("#good"+(index+1));
@@ -299,8 +285,8 @@ @@ -299,8 +285,8 @@
299 285
300 return " <span>商品图:<img width=\"120\" height=\"60\" src="+getImageUrl()+ 286 return " <span>商品图:<img width=\"120\" height=\"60\" src="+getImageUrl()+
301 " </span>" + 287 " </span>" +
302 - "<h5 style=\"margin-top: 0px;margin-bottom: 0px>商品名:"+ data.product_name +"</h5>\n" +  
303 - "<h5 style=\"margin-top: 0px;margin-bottom: 0px>价格:"+data.sales_price+"</h5>" 288 + "<h5 style=\"margin-top: 0px;margin-bottom: 0px>\"商品名:"+ data.product_name +"</h5>\n" +
  289 + "<h5 style=\"margin-top: 0px;margin-bottom: 0px>\"价格:"+data.sales_price+"</h5>"
304 } 290 }
305 291
306 function getImageUrl(image) { 292 function getImageUrl(image) {