Преглед изворни кода

更新文件 articleTweetAction.java

陈士柏 пре 2 година
родитељ
комит
ee22e6a1ae
1 измењених фајлова са 56 додато и 3 уклоњено
  1. 56 3
      mhotel/src/com/happy/action/articleTweetAction.java

+ 56 - 3
mhotel/src/com/happy/action/articleTweetAction.java

@@ -63,12 +63,15 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
     public UserService userService;
     @Resource
     public AdminManagerService adminManagerService;
+    @Resource
+    public AdminService adminService;
 
     public String key;
     public String startTime;
     public String endTime;
     public String keyWord;
     public String userName;
+    public String adminId;
 
     public String getKey() {
         return key;
@@ -110,6 +113,14 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         this.userName = userName;
     }
 
+    public String getAdminId() {
+        return adminId;
+    }
+
+    public void setAdminId(String adminId) {
+        this.adminId = adminId;
+    }
+
     /**
      * 推文发布
      */
@@ -646,7 +657,7 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
     }
 
     // 置顶推文
-    public String topArticle(){
+    public String topArticle() throws ParseException {
         Gson gson = new Gson();
         JSONObject jsonObject = new JSONObject();
         com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
@@ -662,6 +673,8 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
                 return null;
             }
         }
+        Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+        articleTweetDto.setCreateDate(now);
         int m = articleTweetService.updateArticleTop(articleTweetDto);
         if (m>0){
             jsonObject.put("code", 200);
@@ -711,6 +724,25 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         return null;
     }
 
+    public String bindUser(){
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        Admin admin = new Admin();
+        admin.setId(json.getInteger("id"));
+        admin.setUserId(json.getString("userId"));
+        int m = articleTweetService.updateUser(admin);
+        if (m>0){
+            jsonObject.put("code", ResultStatusCode.OK.getStatus());
+            jsonObject.put("message", "绑定成功");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        jsonObject.put("code", 500);
+        jsonObject.put("message", "绑定失败");
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
+
 
     /**
      * 根据推文数据ID查询推文详情数据
@@ -1207,14 +1239,35 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         return null;
     }
 
-    public void getUserContactList() {
+    public String getUserContactList() {
+        JSONObject jsonObject = new JSONObject();
+        if (adminId == null ){
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "请传入管理员ID");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        Admin admin = adminService.getById(Integer.parseInt(adminId));
+        if (admin==null || admin.getStatus()==0){
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "该管理员已删除");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
         StringBuilder querySql = new StringBuilder("");
         if (!Func.checkNull(articleTweetDto.getUserName())) {
             querySql.append(" and user_name like '%").append(articleTweetDto.getUserName()).append("%' ");
         }
-        querySql.append(" and data_type = '").append(DataType.关联数据.toString()).append("' ");
+        querySql.append(" and data_type = '").append(DataType.游客数据.toString()).append("' ");
+        if (admin.getUserId()!=null && !admin.getUserId().equals("")){
+            querySql.append(" and id in ( ").append(admin.getUserId()).append(") ");
+        }
         IPage listPage = userService.queryUserPage(querySql.toString(), page, rows); // 查询分页
         ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(), listPage);
+        return null;
     }
 
     /**