Authored by 张帅

后台发文章用户维护

... ... @@ -31,4 +31,11 @@ public class GrassArticleController {
return new ApiResponse.ApiResponseBuilder().build();
}
@RequestMapping("/platPublishUser")
public ApiResponse platPublishUser(){
logger.info("grassArticle platPublishUser begin, req is {}");
return new ApiResponse.ApiResponseBuilder().data(grassArticleService.getPlatPublishUser()).build();
}
}
... ...
... ... @@ -3,9 +3,13 @@ package com.yohobuy.platform.grass.service;
import com.yohobuy.platform.common.exception.PlatformException;
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
import java.util.List;
/**
*/
public interface IGrassArticleService {
void publishArticle(GrassArticleReq req) throws PlatformException;
List<Integer> getPlatPublishUser();
}
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.dal.grass.IGrassArticleDao;
import com.yohobuy.platform.dal.grass.IGrassArticleImageDao;
import com.yohobuy.platform.dal.grass.IGrassArticleSknDao;
import com.yohobuy.platform.dal.grass.IGrassPlatUserDao;
import com.yohobuy.platform.dal.grass.model.GrassArticle;
import com.yohobuy.platform.dal.grass.model.GrassArticleImage;
import com.yohobuy.platform.dal.grass.model.GrassArticleSkn;
... ... @@ -33,6 +34,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
private IGrassArticleImageDao grassArticleImageDao;
@Resource
private IGrassArticleSknDao grassArticleSknDao;
@Resource
private IGrassPlatUserDao grassPlatUserDao;
@Override
... ... @@ -88,6 +91,12 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
}
@Override
public List<Integer> getPlatPublishUser() {
List<Integer> list = grassPlatUserDao.getAllPlatUid();
return list;
}
private void publishCheck(GrassArticleReq req) throws PlatformException {
if(req.getArticleUid() ==null){
logger.info("publishCheck uid is null");
... ...
... ... @@ -330,6 +330,7 @@ datasources:
- com.yohobuy.platform.dal.grass.IGrassArticleImageDao
- com.yohobuy.platform.dal.grass.IGrassArticleSknDao
- com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO
- com.yohobuy.platform.dal.grass.IGrassPlatUserDao
yhb_promotion:
servers:
... ...
... ... @@ -329,6 +329,7 @@ datasources:
- com.yohobuy.platform.dal.grass.IGrassArticleImageDao
- com.yohobuy.platform.dal.grass.IGrassArticleSknDao
- com.yohobuy.platform.dal.grass.IGrassLabelGroupDAO
- com.yohobuy.platform.dal.grass.IGrassPlatUserDao
yhb_promotion:
servers:
... ...
... ... @@ -39,7 +39,7 @@
<tr style="height: 60px">
<td >
<span style="color:red">*</span><label>选择用户</label> <br>
<input id="articleUid" name="articleUid" style="width:60% " class="easyui-textbox" />
<input id="articleUid" name="articleUid" style="width:60% " class="easyui-combobox" />
</td>
</tr>
... ... @@ -84,8 +84,8 @@
</td>
</tr>
<tr>
<td height="50" valign="bottom">
<input class="btn-primary" type="submit" value="保存"/>
<td valign="bottom">
<input id="subBotton" class="btn-primary" type="button" style="font-size: 20px; margin-top: 0px;margin-bottom: 0px;" value="保存"/>
</td>
</tr>
</table>
... ... @@ -105,91 +105,80 @@
var checkedItemsObj = {};
$(function () {
$("#articleUid").textbox({
$("#articleUid").combobox({
required: true,
missingMessage: "发布用户不能为空",
prompt: "请输入发布用户"
prompt: "请输入发布用户",
selectOnNavigation : true,
valueField: 'text',
textField: 'value',
url : contextPath + "/grassArticle/platPublishUser",
loadFilter: function (data) {
var list = [];
var obj = {};
debugger;
for (var i = 0; i < data.data.length; i++) {
obj['text'] = data.data[i];
obj['value'] = data.data[i];
list.push(obj);
}
return list;
}
});
$("#topic").combobox({
prompt: "请选择话题"
});
// $("#imageUpload1").imageUpload({
// width: 171,
// height: 120,
// realInputName: "url",
// url: contextPath + '/fileupload/uploadFile',
// queryParams: {
// bucket: "activity"
// },
// onBeforeSubmit: function () {
// $.messager.progress({
// title: "正在执行",
// msg: "正在执行,请稍后...",
// interval: 500,
// text: ""
// });
// },
// filterFileName: function (data) {
// debugger;
// if (!data || data.code != 200) {
// $.messager.progress("close");
// $.messager.alert("错误",data.message);
// return "";
// }
//
// return data.data.url;
// },
// onLoadSuccess: function (data) {
// debugger
// $.messager.progress("close");
// return false;
// }
// });
initimg();
$("#subBotton").linkbutton({
iconCls: "icon-save",
onClick: function () {
$("#publishArticleForm").form("submit",{
url : serverContextPath+"/grassArticle/publishArticle",
onSubmit : function(param) {
debugger;
if (!$("#publishArticleForm").form("validate")) {
return false;
});
$("#publishArticleForm").form("submit",{
url : serverContextPath+"/grassArticle/publishArticle",
onSubmit : function(param) {
debugger
if (!$("#publishArticleForm").form("validate")) {
return false;
}
if($("#articleUid").combobox("getValue") == ''){
return false;
}
var imgs = '';
$("input[name='url']").each(function(j,item){
debugger
var url = item.value;
if(imgs == ''){
imgs = url;
}else{
imgs = imgs + ","+url;
}
});
$("#imgs").val(imgs);
return true;
},
success : function(data) {
if (data) {
data = $.parseJSON(data);
if (data.code == 200) {
$.messager.alert("保存成功");
} else {
$.messager.alert("保存失败", data.message, "error");
}
} else {
$.messager.alert("保存失败", data.message, "error");
}
}
});
}
if($("#articleUid").val() == ''){
return false;
}
var imgs = '';
$("input[name='url']").each(function(j,item){
var url = item.val();
if(imgs == ''){
imgs = url;
}else{
imgs = imgs + ","+url;
}
});
$("#imgs").val(imgs);
return true;
},
success : function(data) {
if (data) {
data = $.parseJSON(data);
if (data.code == 200) {
$.messager.alert("保存成功");
} else {
$.messager.alert("保存失败", data.message, "error");
}
} else {
$.messager.alert("保存失败", data.message, "error");
}
}
});
});
// 编辑分组
function getEditDialog(data){
var labelGroupList = $("<div id='labelGroupList'>").appendTo($(document.body));
... ... @@ -208,16 +197,13 @@
text:textVar,
iconCls : "icon-save",
handler:function(){
debugger
// $("input[type='checkbox'][name='id']:checked").each(function (index,$this) {
// buildgood(index,$this)
// });
debugger;
$("#goodstd").html("<div id=\"good0\" style=\"float: left;\">\n" +
" </div>")
" </div>");
var skns = '';
for (var i = 0; i < checkedItems.length; i++) {
buildgood(i,checkedItems[i])
if( i == checkedItems.length){
buildgood(i,checkedItems[i]);
if( i == checkedItems.length -1){
skns = skns+ checkedItems[i]
}else{
skns = skns+ checkedItems[i] +","
... ... @@ -243,7 +229,7 @@
}
function oo(num){
debugger
// debugger
if(num >9){
return
}
... ... @@ -273,7 +259,7 @@
return data.data.url;
},
onLoadSuccess: function (data) {
debugger
debugger;
$.messager.progress("close");
return false;
}
... ... @@ -289,7 +275,7 @@
}
function buildgood(index,obj) {
debugger
debugger;
var data = checkedItemsObj[obj];
$("#good"+index).html(gooddiv(data));
$div = $("#good"+(index+1));
... ... @@ -299,8 +285,8 @@
return " <span>商品图:<img width=\"120\" height=\"60\" src="+getImageUrl()+
" </span>" +
"<h5 style=\"margin-top: 0px;margin-bottom: 0px>商品名:"+ data.product_name +"</h5>\n" +
"<h5 style=\"margin-top: 0px;margin-bottom: 0px>价格:"+data.sales_price+"</h5>"
"<h5 style=\"margin-top: 0px;margin-bottom: 0px>\"商品名:"+ data.product_name +"</h5>\n" +
"<h5 style=\"margin-top: 0px;margin-bottom: 0px>\"价格:"+data.sales_price+"</h5>"
}
function getImageUrl(image) {
... ...