Browse Source

Merge branch 'master' of https://e.coding.net/chuanghaikeji/jinganxiangsu/Homestay_app_houtai

溪鸭夏 2 years ago
parent
commit
859e2ad801

+ 10 - 0
mhotel/src/com/happy/Model/Admin.java

@@ -67,6 +67,8 @@ public class Admin {
 	private Integer status;
 	private Integer status;
     public String openid;
     public String openid;
 
 
+    public String userId;
+
     public Integer getId() {
     public Integer getId() {
         return id;
         return id;
     }
     }
@@ -170,4 +172,12 @@ public class Admin {
     public void setOpenid(String openid) {
     public void setOpenid(String openid) {
         this.openid = openid;
         this.openid = openid;
     }
     }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
 }
 }

+ 2 - 0
mhotel/src/com/happy/Model/ArticleFileInfo.java

@@ -38,4 +38,6 @@ public class ArticleFileInfo {
 	 * 推文文件:1
 	 * 推文文件:1
 	 */
 	 */
 	private Integer type;
 	private Integer type;
+
+	private Integer fileType;
 }
 }

+ 6 - 0
mhotel/src/com/happy/Model/ArticleTweet.java

@@ -90,4 +90,10 @@ public class ArticleTweet {
      * 已收藏:1
      * 已收藏:1
      */
      */
     private Integer isCollect;
     private Integer isCollect;
+
+    // 发布方式
+    private String publishWay;
+
+    // 是否置顶
+    private Integer isTop;
 }
 }

+ 10 - 0
mhotel/src/com/happy/Model/FileInfo.java

@@ -23,6 +23,8 @@ public class FileInfo {
      */
      */
     private String name;
     private String name;
 
 
+	private Integer fileType;
+
 
 
 
 
 	public String getId() {
 	public String getId() {
@@ -56,4 +58,12 @@ public class FileInfo {
 	public void setName(String name) {
 	public void setName(String name) {
 		this.name = name;
 		this.name = name;
 	}
 	}
+
+	public Integer getFileType() {
+		return fileType;
+	}
+
+	public void setFileType(Integer fileType) {
+		this.fileType = fileType;
+	}
 }
 }

+ 9 - 0
mhotel/src/com/happy/Model/weixin/Users.java

@@ -20,6 +20,7 @@ public class Users {
     private String headPhoto; // 用户头像地址
     private String headPhoto; // 用户头像地址
     private String collect_hotel; // 收藏酒店
     private String collect_hotel; // 收藏酒店
     private String live_hotel;// 住过酒店
     private String live_hotel;// 住过酒店
+    private String mark;
 
 
 
 
     public int getId() {
     public int getId() {
@@ -141,4 +142,12 @@ public class Users {
     public void setLive_hotel(String live_hotel) {
     public void setLive_hotel(String live_hotel) {
         this.live_hotel = live_hotel;
         this.live_hotel = live_hotel;
     }
     }
+
+    public String getMark() {
+        return mark;
+    }
+
+    public void setMark(String mark) {
+        this.mark = mark;
+    }
 }
 }

+ 2 - 2
mhotel/src/com/happy/Model/weixin/WeiXinUtil.java

@@ -15,12 +15,12 @@ public class WeiXinUtil {
 
 
     public static String ip = "101.42.162.31";//测试回跳ip
     public static String ip = "101.42.162.31";//测试回跳ip
                               // "172.16.20.88";//线上回跳ip
                               // "172.16.20.88";//线上回跳ip
-    public static String ip_h = "https://chtech.ncjti.edu.cn/homestay/mhotel/";//31回调地址
+    public static String ip_h = "https://www.jinganrenjiams.com/hotelReservation/mhotel/";//31回调地址
                                 //"https://www.xn--gmq052a5d255v.com/hotelReservation/mhotel";//测试回跳地址 这个中文域名测试跳不过去
                                 //"https://www.xn--gmq052a5d255v.com/hotelReservation/mhotel";//测试回跳地址 这个中文域名测试跳不过去
                                 // 不知道这个乡宿的域名微信是否会回调,不会的话要改成 https://chtech.ncjti.edu.cn/homestay/mhotel/
                                 // 不知道这个乡宿的域名微信是否会回调,不会的话要改成 https://chtech.ncjti.edu.cn/homestay/mhotel/
                                 // "https://chtech.ncjti.edu.cn/hotelReservation/mhotel";//88线上回跳地址
                                 // "https://chtech.ncjti.edu.cn/hotelReservation/mhotel";//88线上回跳地址
 
 
     //public static String ip_q = "https://chtech.ncjti.edu.cn/hotelReservation/dist";
     //public static String ip_q = "https://chtech.ncjti.edu.cn/hotelReservation/dist";
-    public static String ip_q = "http://192.168.161.227:8000/hotelReservation/dist";
+    public static String ip_q = "https://www.jinganrenjiams.com/hotelReservation/dist";
 
 
 }
 }

+ 43 - 23
mhotel/src/com/happy/action/AppHomePageAction.java

@@ -28,10 +28,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.DecimalFormat;
 import java.text.ParseException;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -191,8 +188,14 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
                     }
                     }
                     AdminManager adminManager = adminManagerService.getById(hotel.getManagerId());
                     AdminManager adminManager = adminManagerService.getById(hotel.getManagerId());
                     hotel.setType(String.valueOf(adminManager.getType()));
                     hotel.setType(String.valueOf(adminManager.getType()));
-                    Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
-                    Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    Optional<HotelPriceOneDataVo> one = null;
+                    if (newOneDatas!=null){
+                        one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    }
+                    Optional<PriceHotelDataVo> min = null;
+                    if (mins!=null){
+                        min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    }
                     if (one != null && one.isPresent() && min != null && min.isPresent()) {
                     if (one != null && one.isPresent() && min != null && min.isPresent()) {
                         if(one.get().getPrice() > min.get().getPrice()){
                         if(one.get().getPrice() > min.get().getPrice()){
                             hotel.setMin_price(decimalFormat.format(min.get().getPrice()));
                             hotel.setMin_price(decimalFormat.format(min.get().getPrice()));
@@ -279,8 +282,14 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
                     }
                     }
                     AdminManager adminManager = adminManagerService.getById(hotel.getManagerId());
                     AdminManager adminManager = adminManagerService.getById(hotel.getManagerId());
                     hotel.setType(String.valueOf(adminManager.getType()));
                     hotel.setType(String.valueOf(adminManager.getType()));
-                    Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
-                    Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    Optional<HotelPriceOneDataVo> one = null;
+                    if (newOneDatas!=null){
+                        one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    }
+                    Optional<PriceHotelDataVo> min = null;
+                    if (mins!=null){
+                        min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    }
                     if (one != null && one.isPresent() && min != null && min.isPresent()) {
                     if (one != null && one.isPresent() && min != null && min.isPresent()) {
                         if(one.get().getPrice() > min.get().getPrice()){
                         if(one.get().getPrice() > min.get().getPrice()){
                             hotel.setMin_price(decimalFormat.format(min.get().getPrice()));
                             hotel.setMin_price(decimalFormat.format(min.get().getPrice()));
@@ -364,9 +373,14 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
                             hotel.setRoom_number_calc(mhd.get().getTotalHouseNum().toString());
                             hotel.setRoom_number_calc(mhd.get().getTotalHouseNum().toString());
                         }
                         }
                     }
                     }
-
-                    Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
-                    Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    Optional<HotelPriceOneDataVo> one = null;
+                    if (!newOneDatas.isEmpty()){
+                        one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    }
+                    Optional<PriceHotelDataVo> min = null;
+                    if (mins!=null){
+                        min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                    }
                     if (one != null && one.isPresent() && min != null && min.isPresent()) {
                     if (one != null && one.isPresent() && min != null && min.isPresent()) {
                         if(one.get().getPrice() > min.get().getPrice()){
                         if(one.get().getPrice() > min.get().getPrice()){
                             hotel.setMin_price(decimalFormat.format(min.get().getPrice()));
                             hotel.setMin_price(decimalFormat.format(min.get().getPrice()));
@@ -498,22 +512,28 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
             dateStrs.add(date);
             dateStrs.add(date);
         }
         }
         List<House> houseList = hotel.getHouseList();
         List<House> houseList = hotel.getHouseList();
-        for (House houseData : houseList) {
-            BigDecimal todayPrice = BigDecimal.ZERO;
-            for (String dateStr : dateStrs) {
-                Optional<HousePriceOneDataVo> oneData = oneDatas.stream().filter(e -> e.getHouseId().toString().equals(houseData.getId()) && e.getSetDate().equals(dateStr)).sorted(Comparator.comparing(HousePriceOneDataVo::getCreateDate, Comparator.reverseOrder())).findFirst();
-                if (oneData != null && oneData.isPresent()) {
-                    todayPrice = todayPrice.add(BigDecimal.valueOf(oneData.get().getPrice()));
-                } else {
-                    todayPrice = todayPrice.add(BigDecimal.valueOf(houseData.getPrice()));
+        if (houseList!=null && !houseList.isEmpty()) {
+            for (House houseData : houseList) {
+                BigDecimal todayPrice = BigDecimal.ZERO;
+                for (String dateStr : dateStrs) {
+                    Optional<HousePriceOneDataVo> oneData = null;
+                    if (!oneDatas.isEmpty()){
+                        oneData = oneDatas.stream().filter(e -> e.getHouseId().toString().equals(houseData.getId()) && e.getSetDate().equals(dateStr)).sorted(Comparator.comparing(HousePriceOneDataVo::getCreateDate, Comparator.reverseOrder())).findFirst();
+                    }
+                    if (oneData != null && oneData.isPresent()) {
+                        todayPrice = todayPrice.add(BigDecimal.valueOf(oneData.get().getPrice()));
+                    } else {
+                        todayPrice = todayPrice.add(BigDecimal.valueOf(houseData.getPrice()));
+                    }
                 }
                 }
-            }
-            houseData.setPrice(todayPrice.doubleValue());
-            if (dateStrs.size() > 0) {
+                houseData.setPrice(todayPrice.doubleValue());
+                if (dateStrs.size() > 0) {
 //                houseData.setPrice(houseData.getPrice() == 0.0 ? 0.0 : (new BigDecimal(houseData.getPrice()).divide(new BigDecimal(dateStrs.size())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
 //                houseData.setPrice(houseData.getPrice() == 0.0 ? 0.0 : (new BigDecimal(houseData.getPrice()).divide(new BigDecimal(dateStrs.size())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
-                houseData.setPrice(houseData.getPrice() == 0.0 ? 0.0 : (new BigDecimal(houseData.getPrice()).divide(new BigDecimal(dateStrs.size()), 2, BigDecimal.ROUND_HALF_UP).doubleValue()));
+                    houseData.setPrice(houseData.getPrice() == 0.0 ? 0.0 : (new BigDecimal(houseData.getPrice()).divide(new BigDecimal(dateStrs.size()), 2, BigDecimal.ROUND_HALF_UP).doubleValue()));
+                }
             }
             }
         }
         }
+
         //endregion
         //endregion
 
 
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
         // 通过时间区间查询房间信息,并带好是否有房标识给前台

+ 1 - 0
mhotel/src/com/happy/action/appAction.java

@@ -842,6 +842,7 @@ public class appAction extends ActionSupport implements ServletRequestAware {
     }
     }
 
 
     public String listAround() {
     public String listAround() {
+        System.out.println("周边城镇:"+rtown);
         JSONObject resultJson = new JSONObject();
         JSONObject resultJson = new JSONObject();
         StringBuilder s1 = new StringBuilder("");
         StringBuilder s1 = new StringBuilder("");
         if (rtype!=null){
         if (rtype!=null){

+ 648 - 62
mhotel/src/com/happy/action/articleTweetAction.java

@@ -8,6 +8,7 @@ import com.google.gson.reflect.TypeToken;
 import com.happy.Model.*;
 import com.happy.Model.*;
 import com.happy.Model.weixin.Users;
 import com.happy.Model.weixin.Users;
 import com.happy.Until.*;
 import com.happy.Until.*;
+import com.happy.Until.Enum.DataType;
 import com.happy.common.controller.BaseController;
 import com.happy.common.controller.BaseController;
 import com.happy.common.http.HttpsClient;
 import com.happy.common.http.HttpsClient;
 import com.happy.constant.ConstDefault;
 import com.happy.constant.ConstDefault;
@@ -50,27 +51,27 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
 
 
     @Resource
     @Resource
     public ArticleTweetService articleTweetService;
     public ArticleTweetService articleTweetService;
-
     @Resource
     @Resource
     public HousePriceService housePriceService;
     public HousePriceService housePriceService;
-
     @Resource
     @Resource
     public HotelDictService hotelDictService;
     public HotelDictService hotelDictService;
-
     @Resource
     @Resource
     public WorkflowService workflowService;
     public WorkflowService workflowService;
-
     @Resource
     @Resource
     public HouseService houseService;
     public HouseService houseService;
-
     @Resource
     @Resource
     public UserService userService;
     public UserService userService;
+    @Resource
+    public AdminManagerService adminManagerService;
+    @Resource
+    public AdminService adminService;
 
 
     public String key;
     public String key;
-
     public String startTime;
     public String startTime;
-
     public String endTime;
     public String endTime;
+    public String keyWord;
+    public String userName;
+    public String adminId;
 
 
     public String getKey() {
     public String getKey() {
         return key;
         return key;
@@ -96,6 +97,30 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         this.endTime = endTime;
         this.endTime = endTime;
     }
     }
 
 
+    public String getKeyWord() {
+        return keyWord;
+    }
+
+    public void setKeyWord(String keyWord) {
+        this.keyWord = keyWord;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getAdminId() {
+        return adminId;
+    }
+
+    public void setAdminId(String adminId) {
+        this.adminId = adminId;
+    }
+
     /**
     /**
      * 推文发布
      * 推文发布
      */
      */
@@ -105,7 +130,6 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
         com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
         ArticleTweetDto articleTweetDto = gson.fromJson(json.toString(), new TypeToken<ArticleTweetDto>() {
         ArticleTweetDto articleTweetDto = gson.fromJson(json.toString(), new TypeToken<ArticleTweetDto>() {
         }.getType());
         }.getType());
-
         //图片和视频判断
         //图片和视频判断
         if (articleTweetDto.getImages() == null && articleTweetDto.getVideo() == null) {
         if (articleTweetDto.getImages() == null && articleTweetDto.getVideo() == null) {
             jsonObject.put("code", 500);
             jsonObject.put("code", 500);
@@ -132,10 +156,8 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
         }
         }
-
         //推文发布参数
         //推文发布参数
         System.out.println("推文发布参数:" + JSON.toJSON(articleTweetDto));
         System.out.println("推文发布参数:" + JSON.toJSON(articleTweetDto));
-
         //查询当前用户
         //查询当前用户
         Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getCreateId()));
         Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getCreateId()));
         if (user == null) {
         if (user == null) {
@@ -145,7 +167,6 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
         }
         }
-
         Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
         Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
         try {
         try {
             //添加推文
             //添加推文
@@ -159,6 +180,8 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
             data.setCreateDate(now);
             data.setCreateDate(now);
             data.setApprove(1);//正在审批
             data.setApprove(1);//正在审批
             data.setStatus(1);
             data.setStatus(1);
+            data.setPublishWay("小程序");
+            data.setIsTop(0);
             data.setUserName(user.getUser_name());
             data.setUserName(user.getUser_name());
             data.setUserPhoto(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
             data.setUserPhoto(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
             int aId = articleTweetService.insert(data);
             int aId = articleTweetService.insert(data);
@@ -170,15 +193,15 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
 
 
                 return null;
                 return null;
             }
             }
-
             //添加附件
             //添加附件
             List<String> fileStr = new ArrayList<>();
             List<String> fileStr = new ArrayList<>();
             if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0) {
             if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0) {
                 fileStr = articleTweetDto.getImages();
                 fileStr = articleTweetDto.getImages();
-            } else {
-                fileStr.add(articleTweetDto.getVideo());
             }
             }
-
+            List<String> fileStrVideo = new ArrayList<>();
+            if (articleTweetDto.getVideo() != null && articleTweetDto.getVideo().length() > 0) {
+                fileStrVideo.add(articleTweetDto.getVideo());
+            }
             List<ArticleFileInfo> afis = new ArrayList<>();
             List<ArticleFileInfo> afis = new ArrayList<>();
             for (String f : fileStr) {
             for (String f : fileStr) {
                 String[] split = f.split("/");
                 String[] split = f.split("/");
@@ -189,6 +212,19 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
                 afi.setType(1);
                 afi.setType(1);
                 afi.setUrl(f);
                 afi.setUrl(f);
                 afi.setCreateDate(now);
                 afi.setCreateDate(now);
+                afi.setFileType(1);
+                afis.add(afi);
+            }
+            for (String f : fileStrVideo) {
+                String[] split = f.split("/");
+                String fileName = split[split.length - 1];
+                ArticleFileInfo afi = new ArticleFileInfo();
+                afi.setLinkId(aId);
+                afi.setName(fileName);
+                afi.setType(1);
+                afi.setUrl(f);
+                afi.setCreateDate(now);
+                afi.setFileType(2);
                 afis.add(afi);
                 afis.add(afi);
             }
             }
             int length = articleTweetService.insertArticleFileBatch(afis);
             int length = articleTweetService.insertArticleFileBatch(afis);
@@ -199,7 +235,6 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
                 }}.toString());
                 }}.toString());
                 return null;
                 return null;
             }
             }
-
             //添加流程
             //添加流程
             Workflow workflow = new Workflow();
             Workflow workflow = new Workflow();
             String id = String.valueOf(UUID.randomUUID());
             String id = String.valueOf(UUID.randomUUID());
@@ -227,8 +262,307 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
             }}.toString());
             }}.toString());
             return null;
             return null;
         }
         }
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", "推文发布成功");
+            put("code", 200);
+        }}.toString());
+        return null;
+    }
+
+    /**
+     * 管理端推文发布
+     */
+    public String insertArticleTweetMana() throws ParseException {
+        Gson gson = new Gson();
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        ArticleTweetDto articleTweetDto = gson.fromJson(json.toString(), new TypeToken<ArticleTweetDto>() {
+        }.getType());
+        //图片和视频判断
+        if (articleTweetDto.getImages() == null && articleTweetDto.getVideo() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "请上传图片或视频");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //图片最多上传九张
+        if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 9) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "最多上传9张图片");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //标题、内容、地点、关联民宿不能为空
+        if (Func.checkNull(articleTweetDto.getTitle()) || Func.checkNull(articleTweetDto.getContent())
+                || Func.checkNull(articleTweetDto.getTownId()) || articleTweetDto.getHotelIds() == null
+                || articleTweetDto.getCreateId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "参数不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //推文发布参数
+        System.out.println("推文发布参数:" + JSON.toJSON(articleTweetDto));
+
+        //查询当前用户
+        Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getCreateId()));
+        if (user == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户信息已失效,查看详情失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        List<ArticleTweet> articleTweets = articleTweetService.queryTops();
+        if (articleTweets!=null && articleTweets.size()>=3 && articleTweetDto.getIsTop()==1){
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "置顶攻略不可超过3个");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+        try {
+            //添加推文
+            ArticleTweet data = new ArticleTweet();
+            data.setUserId(articleTweetDto.getCreateId());
+            data.setTitle(articleTweetDto.getTitle());
+            data.setContent(articleTweetDto.getContent());
+            data.setLocationId(articleTweetDto.getTownId());
+            data.setHotelId(StringUtils.join(articleTweetDto.getHotelIds(), ","));
+            data.setCreateId(articleTweetDto.getCreateId());
+            data.setCreateDate(now);
+            data.setApprove(2);//正在审批
+            data.setStatus(1);
+            data.setPublishWay("管理端");
+            data.setIsTop(articleTweetDto.getIsTop());
+            data.setUserName(user.getUser_name());
+            data.setUserPhoto(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
+            int aId = articleTweetService.insert(data);
+            if (aId <= 0) {
+                ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                    put("message", "推文发布失败");
+                    put("code", 500);
+                }}.toString());
+
+                return null;
+            }
+            //添加附件
+            List<String> fileStr = new ArrayList<>();
+            if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0) {
+                fileStr = articleTweetDto.getImages();
+            }
+            List<String> fileStrVideo = new ArrayList<>();
+            if (articleTweetDto.getVideo() != null && articleTweetDto.getVideo().length() > 0) {
+                fileStrVideo.add(articleTweetDto.getVideo());
+            }
+            List<ArticleFileInfo> afis = new ArrayList<>();
+            for (String f : fileStr) {
+                String[] split = f.split("/");
+                String fileName = split[split.length - 1];
+                ArticleFileInfo afi = new ArticleFileInfo();
+                afi.setLinkId(aId);
+                afi.setName(fileName);
+                afi.setType(1);
+                afi.setUrl(f);
+                afi.setCreateDate(now);
+                afi.setFileType(1);
+                afis.add(afi);
+            }
+            for (String f : fileStrVideo) {
+                String[] split = f.split("/");
+                String fileName = split[split.length - 1];
+                ArticleFileInfo afi = new ArticleFileInfo();
+                afi.setLinkId(aId);
+                afi.setName(fileName);
+                afi.setType(1);
+                afi.setUrl(f);
+                afi.setCreateDate(now);
+                afi.setFileType(2);
+                afis.add(afi);
+            }
+            int length = articleTweetService.insertArticleFileBatch(afis);
+            if (length <= 0) {
+                ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                    put("message", "推文附件新增失败");
+                    put("code", 500);
+                }}.toString());
+                return null;
+            }
+            //添加流程
+            Workflow workflow = new Workflow();
+            String id = String.valueOf(UUID.randomUUID());
+            workflow.setLinkId(String.valueOf(aId));//存推文的ID
+            workflow.setCreateId(String.valueOf(articleTweetDto.getCreateId()));
+            workflow.setTitle(articleTweetDto.getTitle());
+            workflow.setRemark(articleTweetDto.getContent());
+            workflow.setId(id);
+            workflow.setStatus(2);//1是正在审批
+            workflow.setType(3);//3是推文
+            workflow.setCoverImg(articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0 ? articleTweetDto.getImages().get(0) : articleTweetDto.getVideo());
+            int i = workflowService.insert(workflow);
+            if (i <= 0) {
+                ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                    put("message", "推文流程发布失败");
+                    put("code", 500);
+                }}.toString());
+                return null;
+            }
+        } catch (Exception e) {
+            System.out.println("推文发布异常:" + e.getMessage());
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", "推文发布异常");
+                put("code", 500);
+            }}.toString());
+            return null;
+        }
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", "推文发布成功");
+            put("code", 200);
+        }}.toString());
+
+        return null;
+    }
+
+    /**
+     * 管理端修改推文
+     */
+    public String updateArticleTweetMana() throws ParseException {
+        Gson gson = new Gson();
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        ArticleTweetDto articleTweetDto = gson.fromJson(json.toString(), new TypeToken<ArticleTweetDto>() {
+        }.getType());
+        //图片和视频判断
+        if (articleTweetDto.getImages() == null && articleTweetDto.getVideo() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "请上传图片或视频");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //图片最多上传九张
+        if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 9) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "最多上传9张图片");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //标题、内容、地点、关联民宿不能为空
+        if (Func.checkNull(articleTweetDto.getTitle()) || Func.checkNull(articleTweetDto.getContent())
+                || Func.checkNull(articleTweetDto.getTownId()) || articleTweetDto.getHotelIds() == null
+                || articleTweetDto.getCreateId() == null || articleTweetDto.getId()==null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "参数不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //推文发布参数
+        System.out.println("推文发布参数:" + JSON.toJSON(articleTweetDto));
 
 
+        //查询当前用户
+        Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getCreateId()));
+        if (user == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户信息已失效,查看详情失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        List<ArticleTweet> articleTweets = articleTweetService.queryTops();
+        if (articleTweets!=null && articleTweets.size()>=3 && articleTweetDto.getIsTop()==1){
+            List<Integer> ids = articleTweets.stream().map(ArticleTweet::getId).collect(Collectors.toList());
+            if (!ids.contains(articleTweetDto.getId())){
+                jsonObject.put("code", 500);
+                jsonObject.put("message", "置顶攻略不可超过3个");
+                jsonObject.put("data", null);
+                ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+                return null;
+            }
+        }
+        Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+        try {
+            //添加推文
+            ArticleTweet data = new ArticleTweet();
+            data.setId(articleTweetDto.getId());
+            data.setUserId(articleTweetDto.getCreateId());
+            data.setTitle(articleTweetDto.getTitle());
+            data.setContent(articleTweetDto.getContent());
+            data.setLocationId(articleTweetDto.getTownId());
+            data.setHotelId(StringUtils.join(articleTweetDto.getHotelIds(), ","));
+            data.setCreateId(articleTweetDto.getCreateId());
+            data.setCreateDate(now);
+            data.setApprove(2);//1正在审批
+            data.setStatus(1);
+            data.setPublishWay("管理端");
+            data.setIsTop(articleTweetDto.getIsTop());
+            data.setUserName(user.getUser_name());
+            data.setUserPhoto(user.getHeadPhoto() == null ? ConstDefault.DefaultHeadPhoto : user.getHeadPhoto());
+            int aId = articleTweetService.update(data);
+            if (aId <= 0) {
+                ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                    put("message", "推文发布失败");
+                    put("code", 500);
+                }}.toString());
 
 
+                return null;
+            }
+            articleTweetService.delArticleFile(articleTweetDto.getId());
+            //添加附件
+            List<String> fileStr = new ArrayList<>();
+            if (articleTweetDto.getImages() != null && articleTweetDto.getImages().size() > 0) {
+                fileStr = articleTweetDto.getImages();
+            }
+            List<String> fileStrVideo = new ArrayList<>();
+            if (articleTweetDto.getVideo() != null && articleTweetDto.getVideo().length() > 0) {
+                fileStrVideo.add(articleTweetDto.getVideo());
+            }
+            List<ArticleFileInfo> afis = new ArrayList<>();
+            for (String f : fileStr) {
+                String[] split = f.split("/");
+                String fileName = split[split.length - 1];
+                ArticleFileInfo afi = new ArticleFileInfo();
+                afi.setLinkId(aId);
+                afi.setName(fileName);
+                afi.setType(1);
+                afi.setUrl(f);
+                afi.setCreateDate(now);
+                afi.setFileType(1);
+                afis.add(afi);
+            }
+            for (String f : fileStrVideo) {
+                String[] split = f.split("/");
+                String fileName = split[split.length - 1];
+                ArticleFileInfo afi = new ArticleFileInfo();
+                afi.setLinkId(aId);
+                afi.setName(fileName);
+                afi.setType(1);
+                afi.setUrl(f);
+                afi.setCreateDate(now);
+                afi.setFileType(2);
+                afis.add(afi);
+            }
+            int length = articleTweetService.insertArticleFileBatch(afis);
+            if (length <= 0) {
+                ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                    put("message", "推文附件新增失败");
+                    put("code", 500);
+                }}.toString());
+                return null;
+            }
+        } catch (Exception e) {
+            System.out.println("推文发布异常:" + e.getMessage());
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", "推文发布异常");
+                put("code", 500);
+            }}.toString());
+            return null;
+        }
         ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
         ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
             put("message", "推文发布成功");
             put("message", "推文发布成功");
             put("code", 200);
             put("code", 200);
@@ -237,6 +571,178 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         return null;
         return null;
     }
     }
 
 
+    // 操作推文-删除文件
+    public String delFile(){
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        Integer id = json.getInteger("id");
+        int m = articleTweetService.delArticleFileBatch(id);
+        if (m>0){
+            jsonObject.put("code", 200);
+            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;
+    }
+
+    // 操作推文-增加文件
+    public String addFile() throws ParseException {
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        Integer id = json.getInteger("id");
+        String images = json.getString("images");
+        String video = json.getString("video");
+        //图片和视频判断
+        if (images.equals("") && video.equals("")) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "请上传图片或视频");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        String fileStr = "";
+        if (!images.equals("")) {
+            fileStr=images;
+        } else {
+            fileStr=video;
+        }
+
+        Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+        String[] split = fileStr.split("/");
+        String fileName = split[split.length - 1];
+        ArticleFileInfo afi = new ArticleFileInfo();
+        afi.setLinkId(id);
+        afi.setName(fileName);
+        afi.setType(1);
+        afi.setUrl(fileStr);
+        afi.setCreateDate(now);
+        int length = articleTweetService.insertArticleFile(afi);
+        if (length <= 0) {
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", "新增失败");
+                put("code", 500);
+                put("data", null);
+            }}.toString());
+            return null;
+        }
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", "新增成功");
+            put("code", 200);
+            put("data", length);
+        }}.toString());
+        return null;
+    }
+
+    // 删除推文
+    public String delArticle(){
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        Integer id = json.getInteger("id");
+        int m = articleTweetService.delArticle(id);
+        int n = articleTweetService.delArticleFile(id);
+        if (m>0 && n>0){
+            jsonObject.put("code", 200);
+            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;
+    }
+
+    // 置顶推文
+    public String topArticle() throws ParseException {
+        Gson gson = new Gson();
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        ArticleTweetDto articleTweetDto = gson.fromJson(json.toString(), new TypeToken<ArticleTweetDto>() {}.getType());
+        List<ArticleTweet> articleTweets = articleTweetService.queryTops();
+        if (articleTweets!=null && articleTweets.size()>=3 && articleTweetDto.getIsTop()==1){
+            List<Integer> ids = articleTweets.stream().map(ArticleTweet::getId).collect(Collectors.toList());
+            if (!ids.contains(articleTweetDto.getId())){
+                jsonObject.put("code", 500);
+                jsonObject.put("message", "置顶攻略不可超过3个");
+                jsonObject.put("data", null);
+                ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+                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);
+            jsonObject.put("message", "修改成功");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        jsonObject.put("code", 500);
+        jsonObject.put("message", "修改失败");
+        jsonObject.put("data", null);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
+
+    public String queryManageArticlePage() {
+        JSONObject jsonObject = new JSONObject();
+        IPage<ArticleListVo> result = articleTweetService.queryManageArticlesPage(articleTweetDto.getKeyWord(), null, page, rows);
+        if (result.getPageList().size() > 0) {
+            String articleIds = StringUtils.join(result.getPageList().stream().map(ArticleListVo::getId).collect(Collectors.toList()), ",");
+            List<FileInfo> fileInfos = articleTweetService.queryList("and link_id in (" + articleIds + ")");
+
+            for (ArticleListVo data : result.getPageList()) {
+                if (fileInfos != null) {
+                    List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
+                    if (fileInfoList.size()>0) {
+                        List<String> fileUrl = new ArrayList<>();
+                        for (int i = 0; i < fileInfoList.size(); i++) {
+                            FileInfo fileInfo = fileInfoList.get(i);
+                            if (fileInfo.getFileType()==1){
+                                fileUrl.add(fileInfo.getUrl());
+                                data.setImage(fileUrl);
+                            } else {
+                                data.setVideo(fileInfo.getUrl());
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        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查询推文详情数据
      * 根据推文数据ID查询推文详情数据
@@ -278,21 +784,18 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         result.setIsCollect(data.getIsCollect());
         result.setIsCollect(data.getIsCollect());
         result.setId(data.getId());
         result.setId(data.getId());
         List<FileInfo> fileInfoList = articleTweetService.queryList("and link_id = '" + articleTweetDto.getId() + "'");
         List<FileInfo> fileInfoList = articleTweetService.queryList("and link_id = '" + articleTweetDto.getId() + "'");
-        if (fileInfoList != null) {
-            if (fileInfoList.size() > 1) {
-                result.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
-            } else if (fileInfoList.size() == 1) {
-                String url = fileInfoList.get(0).getUrl();
-                if (!url.endsWith("jpg") && !url.endsWith("png")) {
-                    result.setVideo(fileInfoList.get(0).getUrl());
+        if (fileInfoList != null && fileInfoList.size()>0) {
+            List<String> fileUrl = new ArrayList<>();
+            for (int i = 0; i < fileInfoList.size(); i++) {
+                FileInfo fileInfo = fileInfoList.get(i);
+                if (fileInfo.getFileType()==1){
+                    fileUrl.add(fileInfo.getUrl());
+                    result.setImages(fileUrl);
                 } else {
                 } else {
-                    List<String> images = new ArrayList<>();
-                    images.add(url);
-                    result.setImages(images);
+                    result.setVideo(fileInfo.getUrl());
                 }
                 }
             }
             }
         }
         }
-
         result.setUserId(data.getUserId());
         result.setUserId(data.getUserId());
         result.setUserName(data.getUserName());
         result.setUserName(data.getUserName());
         result.setUserPhoto(data.getUserPhoto() == null ? ConstDefault.DefaultHeadPhoto : data.getUserPhoto());
         result.setUserPhoto(data.getUserPhoto() == null ? ConstDefault.DefaultHeadPhoto : data.getUserPhoto());
@@ -684,7 +1187,6 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         jsonObject.put("message", "请求成功");
         jsonObject.put("message", "请求成功");
         jsonObject.put("data", result);
         jsonObject.put("data", result);
         ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
         ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
-
         return null;
         return null;
     }
     }
 
 
@@ -716,17 +1218,15 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
 
 
             for (OwnerArticleVo data : result.getPageList()) {
             for (OwnerArticleVo data : result.getPageList()) {
                 List<FileInfo> fileInfoList = fileInfos == null ? null : fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
                 List<FileInfo> fileInfoList = fileInfos == null ? null : fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
-                if (fileInfoList != null) {
-                    if (fileInfoList.size() > 1) {
-                        data.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
-                    } else if (fileInfoList.size() == 1) {
-                        String url = fileInfoList.get(0).getUrl();
-                        if (!url.endsWith("jpg") && !url.endsWith("png")) {
-                            data.setVideo(fileInfoList.get(0).getUrl());
-                        } else {
-                            List<String> images = new ArrayList<>();
-                            images.add(url);
-                            data.setImages(images);
+                if (fileInfoList != null && fileInfoList.size()>0) {
+                    for (int i = 0; i < fileInfoList.size(); i++) {
+                        FileInfo fileInfo = fileInfoList.get(i);
+                        List<String> fileUrl = new ArrayList<>();
+                        if (fileInfo.getFileType()==1){
+                            fileUrl.add(fileInfo.getUrl());
+                            data.setImages(fileUrl);
+                        }else {
+                            data.setVideo(fileInfo.getUrl());
                         }
                         }
                     }
                     }
                 }
                 }
@@ -741,6 +1241,67 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         return null;
         return null;
     }
     }
 
 
+    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("' ");
+        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;
+    }
+
+    public String getAllUserList() {
+        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("' ");
+        if (admin.getUserId()!=null && admin.getUserId().length()>0){
+            querySql.append(" order by case when id in ( ").append(admin.getUserId()).append(") then 0 else 1 end");
+        }
+        IPage listPage = userService.queryUserPage2(querySql.toString(), page, rows,admin.getUserId()); // 查询分页
+        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(), listPage);
+        return null;
+    }
 
 
     /**
     /**
      * 社区首页推文列表
      * 社区首页推文列表
@@ -772,15 +1333,15 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
             for (ArticleListVo data : result.getPageList()) {
             for (ArticleListVo data : result.getPageList()) {
                 if (fileInfos != null) {
                 if (fileInfos != null) {
                     List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
                     List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
-                    if (fileInfoList != null) {
-                        if (fileInfoList.size() > 1) {
-                            data.setImage(fileInfoList.get(0).getUrl());
-                        } else if (fileInfoList.size() == 1) {
-                            String url = fileInfoList.get(0).getUrl();
-                            if (!url.endsWith("jpg") && !url.endsWith("png")) {
-                                data.setVideo(fileInfoList.get(0).getUrl());
+                    if (fileInfoList.size() > 0) {
+                        List<String> fileUrl = new ArrayList<>();
+                        for (int i = 0; i < fileInfoList.size(); i++) {
+                            FileInfo fileInfo = fileInfoList.get(i);
+                            if (fileInfo.getFileType()==1){
+                                fileUrl.add(fileInfo.getUrl());
+                                data.setImage(fileUrl);
                             } else {
                             } else {
-                                data.setImage(url);
+                                data.setVideo(fileInfo.getUrl());
                             }
                             }
                         }
                         }
                     }
                     }
@@ -806,14 +1367,12 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         if (result != null) {
         if (result != null) {
             List<FileInfo> fileInfos = articleTweetService.queryList("and link_id = " + result.getId() + "");
             List<FileInfo> fileInfos = articleTweetService.queryList("and link_id = " + result.getId() + "");
             if (fileInfos != null) {
             if (fileInfos != null) {
-                if (fileInfos.size() > 1) {
-                    result.setImage(fileInfos.get(0).getUrl());
-                } else if (fileInfos.size() == 1) {
-                    String url = fileInfos.get(0).getUrl();
-                    if (!url.endsWith("jpg") && !url.endsWith("png")) {
-                        result.setVideo(fileInfos.get(0).getUrl());
+                for (int i = 0; i < fileInfos.size(); i++) {
+                    FileInfo fileInfo = fileInfos.get(i);
+                    if (fileInfo.getFileType()==1){
+                        result.setImage(fileInfo.getUrl());
                     } else {
                     } else {
-                        result.setImage(url);
+                        result.setVideo(fileInfo.getUrl());
                     }
                     }
                 }
                 }
             }
             }
@@ -848,15 +1407,15 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
 
 
             for (ArticleListVo data : result.getPageList()) {
             for (ArticleListVo data : result.getPageList()) {
                 List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
                 List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId().toString())).collect(Collectors.toList());
-                if (fileInfoList != null) {
-                    if (fileInfoList.size() > 1) {
-                        data.setImage(fileInfoList.get(0).getUrl());
-                    } else if (fileInfoList.size() == 1) {
-                        String url = fileInfoList.get(0).getUrl();
-                        if (!url.endsWith("jpg") && !url.endsWith("png")) {
-                            data.setVideo(fileInfoList.get(0).getUrl());
+                if (fileInfoList.size() > 0) {
+                    List<String> fileUrl = new ArrayList<>();
+                    for (int i = 0; i < fileInfoList.size(); i++) {
+                        FileInfo fileInfo = fileInfoList.get(i);
+                        if (fileInfo.getFileType()==1){
+                            fileUrl.add(fileInfo.getUrl());
+                            data.setImage(fileUrl);
                         } else {
                         } else {
-                            data.setImage(url);
+                            data.setVideo(fileInfo.getUrl());
                         }
                         }
                     }
                     }
                 }
                 }
@@ -1274,5 +1833,32 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         return null;
         return null;
     }
     }
 
 
+    /**
+     * 点赞数前三的推文
+     */
+    public String queryTop3ArticleLike() {
+        JSONObject jsonObject = new JSONObject();
+        List<ArticleLikeMaxVo> result = articleTweetService.queryTop3ArticleLike();
+        if (result != null) {
+            for (int i = 0; i < result.size(); i++) {
+                List<FileInfo> fileInfos = articleTweetService.queryList("and link_id = " + result.get(i).getId() + "");
+                if (fileInfos != null) {
+                    for (int j = 0; j < fileInfos.size(); j++) {
+                        FileInfo fileInfo = fileInfos.get(j);
+                        if (fileInfo.getFileType()==1){
+                            result.get(i).setImage(fileInfo.getUrl());
+                        } else {
+                            result.get(i).setVideo(fileInfo.getUrl());
+                        }
+                    }
+                }
+            }
+        }
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
 
 
 }
 }

+ 23 - 0
mhotel/src/com/happy/dao/ArticleTweetDao.java

@@ -21,6 +21,8 @@ public interface ArticleTweetDao {
      */
      */
     int insert(ArticleTweet articleTweet);
     int insert(ArticleTweet articleTweet);
 
 
+    public int update(ArticleTweet articleTweet);
+
     /**
     /**
      * 更新推文审批状态
      * 更新推文审批状态
      * @param articleTweet
      * @param articleTweet
@@ -35,6 +37,16 @@ public interface ArticleTweetDao {
      */
      */
     int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos);
     int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos);
 
 
+    public int insertArticleFile(ArticleFileInfo articleFileInfos);
+
+    public int delArticleFileBatch(int id);
+
+    public int delArticle(int id);
+
+    public int delArticleFile(int link_id);
+
+    public int updateArticleTop(ArticleTweet articleTweet);
+
     /**
     /**
      * 描述:根据乡镇ID进行民宿分页查询
      * 描述:根据乡镇ID进行民宿分页查询
      * @param sqlx
      * @param sqlx
@@ -169,6 +181,10 @@ public interface ArticleTweetDao {
      */
      */
     List<ArticleListVo> queryArticlesPage(String keyWord, String townId, Integer userId, Integer type, int page, int rows);
     List<ArticleListVo> queryArticlesPage(String keyWord, String townId, Integer userId, Integer type, int page, int rows);
 
 
+    public List<ArticleListVo> queryManageArticlesPage(String keyWord, String townId, int page, int rows);
+
+    public int queryManageArticlesTotal(String keyWord, String townId);
+
     /**
     /**
      * 社区首页推文列表总数据条数
      * 社区首页推文列表总数据条数
      * @param townId
      * @param townId
@@ -274,4 +290,11 @@ public interface ArticleTweetDao {
     List<WalkthroughVo> walkthroughPage(String strSql, Integer page, Integer rows);
     List<WalkthroughVo> walkthroughPage(String strSql, Integer page, Integer rows);
 
 
     int walkthroughTotal(String strSql);
     int walkthroughTotal(String strSql);
+
+    public List<ArticleLikeMaxVo> queryTop3ArticleLike();
+
+    public List<ArticleTweet> queryTops();
+
+    public int updateUser(Admin admin);
+
 }
 }

+ 2 - 0
mhotel/src/com/happy/dao/UserDao.java

@@ -42,6 +42,8 @@ public interface UserDao {
     public int queryUserTotal(String sqlStr);
     public int queryUserTotal(String sqlStr);
     public List<Users> queryUserPage(String sqlx, int page, int rows);
     public List<Users> queryUserPage(String sqlx, int page, int rows);
 
 
+    public List<Users> queryUserPage2(String sqlx, int page, int rows,String sl);
+
     UnevaluatedOrder collect(String hotelId1, Integer createId1);
     UnevaluatedOrder collect(String hotelId1, Integer createId1);
 
 
 }
 }

+ 1 - 1
mhotel/src/com/happy/dao/impl/AdminImplDao.java

@@ -31,7 +31,7 @@ public class AdminImplDao implements AdminDao {
     }
     }
 
 
     public String selectSql="select " +
     public String selectSql="select " +
-            "id,admin_name,user_name,phone,level,admin_power,remark,create_id, DATE_FORMAT(create_date,'%Y-%m-%d %T') create_date,DATE_FORMAT(modify_date,'%Y-%m-%d %T') modify_date,status,openid" +
+            "id,admin_name,user_name,phone,level,admin_power,remark,create_id, DATE_FORMAT(create_date,'%Y-%m-%d %T') create_date,DATE_FORMAT(modify_date,'%Y-%m-%d %T') modify_date,status,openid,user_id" +
             " from `admin` ";
             " from `admin` ";
 
 
     @Override
     @Override

+ 1 - 1
mhotel/src/com/happy/dao/impl/AppImplDao.java

@@ -518,7 +518,7 @@ public class AppImplDao implements AppDao {
     }
     }
 
 
     public List<Hotel> queryMs(String town){
     public List<Hotel> queryMs(String town){
-        String sql = "select a.*,b.name from (select a.*,b.hotel_township from `hotel` a left join `admin_manager` b  on a.`manager_id`=b.`manager_id` where a.`status`=1 ) a left join `hotel_dict` b on a.hotel_township=b.`id` where b.name=:town ";
+        String sql = "select a.*,b.name from (select a.*,b.hotel_township from `hotel` a left join `admin_manager` b  on a.`manager_id`=b.`manager_id` where a.`status`=1 ) a right join `hotel_dict` b on a.hotel_township=b.`id` where b.name=:town ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("town", town);
         sps.addValue("town", town);
         List<Hotel> list = namedParameterJdbcTemplate.query(sql, sps,
         List<Hotel> list = namedParameterJdbcTemplate.query(sql, sps,

+ 196 - 10
mhotel/src/com/happy/dao/impl/ArticleTweetImplDao.java

@@ -61,8 +61,8 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
     @Override
     @Override
     public int insert(ArticleTweet articleTweet) {
     public int insert(ArticleTweet articleTweet) {
         KeyHolder key = new GeneratedKeyHolder();
         KeyHolder key = new GeneratedKeyHolder();
-        String sql = "insert into `article_tweet` (user_id,user_name,user_photo,title,content,location_id,hotel_id,create_id,create_date,status,approve) " +
-                "values(:userId,:userName,:userPhoto,:title,:content,:locationId,:hotelId,:createId,:createDate,:status,:approve) ";
+        String sql = "insert into `article_tweet` (user_id,user_name,user_photo,title,content,location_id,hotel_id,create_id,create_date,status,approve,publish_way,is_top) " +
+                "values(:userId,:userName,:userPhoto,:title,:content,:locationId,:hotelId,:createId,:createDate,:status,:approve,:publishWay,:is_top) ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("userId", articleTweet.getUserId());
         sps.addValue("userId", articleTweet.getUserId());
         sps.addValue("userName", articleTweet.getUserName());
         sps.addValue("userName", articleTweet.getUserName());
@@ -75,8 +75,8 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
         sps.addValue("createDate", articleTweet.getCreateDate());
         sps.addValue("createDate", articleTweet.getCreateDate());
         sps.addValue("status", articleTweet.getStatus());
         sps.addValue("status", articleTweet.getStatus());
         sps.addValue("approve", articleTweet.getApprove());
         sps.addValue("approve", articleTweet.getApprove());
-
-
+        sps.addValue("publishWay", articleTweet.getPublishWay());
+        sps.addValue("is_top", articleTweet.getIsTop());
         int num = 0;
         int num = 0;
         try {
         try {
             num = namedParameterJdbcTemplate.update(sql, sps, key);
             num = namedParameterJdbcTemplate.update(sql, sps, key);
@@ -87,6 +87,32 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
         return num;
         return num;
     }
     }
 
 
+    public int update(ArticleTweet articleTweet) {
+        String sql = "update `article_tweet` set user_id=:userId,user_name=:userName,user_photo=:userPhoto,title=:title,content=:content,location_id=:locationId,hotel_id=:hotelId,create_id=:createId,create_date=:createDate,status=:status,approve=:approve,publish_way=:publishWay,is_top=:is_top where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", articleTweet.getUserId());
+        sps.addValue("userName", articleTweet.getUserName());
+        sps.addValue("userPhoto", articleTweet.getUserPhoto());
+        sps.addValue("title", articleTweet.getTitle());
+        sps.addValue("content", articleTweet.getContent());
+        sps.addValue("locationId", articleTweet.getLocationId());
+        sps.addValue("hotelId", articleTweet.getHotelId());
+        sps.addValue("createId", articleTweet.getCreateId());
+        sps.addValue("createDate", articleTweet.getCreateDate());
+        sps.addValue("status", articleTweet.getStatus());
+        sps.addValue("approve", articleTweet.getApprove());
+        sps.addValue("publishWay", articleTweet.getPublishWay());
+        sps.addValue("is_top", articleTweet.getIsTop());
+        sps.addValue("id", articleTweet.getId());
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
 
 
     @Override
     @Override
     public int updateArticleApprove(ArticleTweet articleTweet) {
     public int updateArticleApprove(ArticleTweet articleTweet) {
@@ -106,12 +132,88 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
     @Override
     @Override
     public int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos) {
     public int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos) {
         SqlParameterSource[] params = SqlParameterSourceUtils.createBatch(articleFileInfos.toArray());
         SqlParameterSource[] params = SqlParameterSourceUtils.createBatch(articleFileInfos.toArray());
-        String insertSql = "insert into article_file_info (link_id, url, name ,create_date ,type) " +
-                "VALUES (:linkId, :url, :name ,:createDate ,:type) ";
+        String insertSql = "insert into article_file_info (link_id, url, name ,create_date ,type,file_type) " +
+                "VALUES (:linkId, :url, :name ,:createDate ,:type,:fileType) ";
         int[] m = namedParameterJdbcTemplate.batchUpdate(insertSql, params);
         int[] m = namedParameterJdbcTemplate.batchUpdate(insertSql, params);
         return m.length;
         return m.length;
     }
     }
 
 
+    public int insertArticleFile(ArticleFileInfo articleFileInfos) {
+        KeyHolder key = new GeneratedKeyHolder();
+        String sql = "insert into article_file_info (link_id, url, name ,create_date ,type) " +
+                "VALUES (:linkId, :url, :name ,:createDate ,:type) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("linkId", articleFileInfos.getLinkId());
+        sps.addValue("url", articleFileInfos.getUrl());
+        sps.addValue("name", articleFileInfos.getName());
+        sps.addValue("createDate", articleFileInfos.getCreateDate());
+        sps.addValue("type", articleFileInfos.getType());
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps, key);
+            num = key.getKey().intValue();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int delArticleFileBatch(int id){
+        String sql = "delete from  `article_file_info` where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int delArticle(int id){
+        String sql = "delete from  `article_tweet` where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int delArticleFile(int link_id){
+        String sql = "delete from  `article_file_info` where link_id=:link_id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("link_id", link_id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int updateArticleTop(ArticleTweet articleTweet) {
+        String sql = "update article_tweet set is_top=:isTop,create_date=:createDate where id = :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("isTop", articleTweet.getIsTop());
+        sps.addValue("createDate", articleTweet.getCreateDate());
+        sps.addValue("id", articleTweet.getId());
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
 
 
     @Override
     @Override
     public List<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
     public List<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
@@ -190,7 +292,7 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
     @Override
     @Override
     public List<FileInfo> queryList(String sqlx) {
     public List<FileInfo> queryList(String sqlx) {
         SqlUtil.filterKeyword(sqlx);
         SqlUtil.filterKeyword(sqlx);
-        String sql = "SELECT id,link_id,url,name " +
+        String sql = "SELECT * " +
                 "FROM `article_file_info` WHERE type=1 " + sqlx;
                 "FROM `article_file_info` WHERE type=1 " + sqlx;
         List<FileInfo> list = null;
         List<FileInfo> list = null;
         try {
         try {
@@ -307,7 +409,6 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
                 "where article_id = :articleId";
                 "where article_id = :articleId";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("articleId", articleId);
         sps.addValue("articleId", articleId);
-
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
     }
 
 
@@ -479,6 +580,46 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
     }
 
 
+    public List<ArticleListVo> queryManageArticlesPage(String keyWord, String townId, int page, int rows) {
+        int start = (page - 1) * rows;// 每页的起始下标
+
+        String innSql = "";
+        String leftSql = "";
+        String caseSql = "";
+
+        String sqlWhere = townId == null ? "" : "and at.location_id = '" + townId + "' ";
+        sqlWhere = sqlWhere + (keyWord == null ? "" : "and (at.title like '%" + keyWord + "%') ");
+        String sql = "select at.id,at.location_id as town_id,hd.name as town_name,at.title,at.user_id,at.user_name,at.user_photo,at.content,at.create_date,at.publish_way,at.is_top,at.hotel_id, \n" + caseSql +
+                "(select count(*) from article_collect where is_lose = 0 and article_id = at.id) as collect_num\n" +
+                "from article_tweet at\n" +
+                "left join hotel_dict hd on hd.id = at.location_id\n" +
+                leftSql +
+                innSql +
+                "where at.approve = 2 " + sqlWhere +
+                "order by at.is_top desc,at.create_date desc ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<ArticleListVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(ArticleListVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int queryManageArticlesTotal(String keyWord, String townId) {
+
+        String innSql = "";
+        String sqlWhere = townId == null ? "" : "and at.location_id = '" + townId + "' ";
+        sqlWhere = sqlWhere + (keyWord == null ? "" : "and (at.title like '%" + keyWord + "%') ");
+        String sql = "select count(*) from article_tweet at\n" +
+                innSql +
+                "where at.approve = 2 " + sqlWhere;
+
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
 
 
     @Override
     @Override
     public List<ArticleListVo> relatedTweetPage(Integer userId, String townId, Integer articleId, int page, int rows) {
     public List<ArticleListVo> relatedTweetPage(Integer userId, String townId, Integer articleId, int page, int rows) {
@@ -508,10 +649,8 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
 
 
     @Override
     @Override
     public int relatedTweetTotal(String townId, Integer articleId) {
     public int relatedTweetTotal(String townId, Integer articleId) {
-
         String sql = "select count(*) from article_tweet at\n" +
         String sql = "select count(*) from article_tweet at\n" +
                 "where at.approve = 2 and at.location_id = :townId and at.id != :articleId";
                 "where at.approve = 2 and at.location_id = :townId and at.id != :articleId";
-
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("townId", townId);
         sps.addValue("townId", townId);
         sps.addValue("articleId", articleId);
         sps.addValue("articleId", articleId);
@@ -780,5 +919,52 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
     }
 
 
+    /**
+     * 获取点赞数最多的最新推文数据
+     */
+    @Override
+    public List<ArticleLikeMaxVo> queryTop3ArticleLike() {
+        String sql = "select t.id,t.townId,t.townName,t.title,t.content from (select at.id,at.location_id as townId,hd.name as townName,at.title,at.content,at.is_top,(select Count(*) from article_likes where is_lose = 0 and article_id = at.id) as like_num,at.create_date\n" +
+                "from article_tweet at\n" +
+                "left join hotel_dict hd on hd.id = at.location_id\n" +
+                "where at.approve = 2) t\n" +
+                "order by t.is_top desc, t.like_num desc,t.create_date desc LIMIT 3";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<ArticleLikeMaxVo> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(ArticleLikeMaxVo.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public List<ArticleTweet> queryTops(){
+        String sql = "select * from `article_tweet` where `status`=1 and `is_top`=1 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<ArticleTweet> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(ArticleTweet.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    public int updateUser(Admin admin){
+        String sql = "update `admin` set user_id=:userId where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", admin.getUserId());
+        sps.addValue("id", admin.getId());
+        return namedParameterJdbcTemplate.update(sql, sps);
+    }
 
 
 }
 }

+ 2 - 2
mhotel/src/com/happy/dao/impl/HotelImplDao.java

@@ -231,7 +231,7 @@ public class HotelImplDao implements HotelDao {
                 "left join (select id,manager_id,hotel_township,hotel_name,type,status,link_pro_url from admin_manager ) c on a.manager_id = c.id " +
                 "left join (select id,manager_id,hotel_township,hotel_name,type,status,link_pro_url from admin_manager ) c on a.manager_id = c.id " +
                 "LEFT JOIN (  SELECT  id,name as hotel_township_name,status  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
                 "LEFT JOIN (  SELECT  id,name as hotel_township_name,status  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
                 "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
                 "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
-                " WHERE hstatus = 1 and a.status=1 and c.status = 1 "+sqlx+" ORDER BY booking_num DESC limit :start,:rows ";
+                " WHERE hstatus = 1 and a.status=1 and c.status = 1 and c.type in ('2','3') "+sqlx+" ORDER BY booking_num DESC limit :start,:rows ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("start", start);
         sps.addValue("start", start);
         sps.addValue("rows", rows);
         sps.addValue("rows", rows);
@@ -253,7 +253,7 @@ public class HotelImplDao implements HotelDao {
                 "left join (select id,manager_id,hotel_township,hotel_name,type,status,link_pro_url from admin_manager ) c on a.manager_id = c.id " +
                 "left join (select id,manager_id,hotel_township,hotel_name,type,status,link_pro_url from admin_manager ) c on a.manager_id = c.id " +
                 "LEFT JOIN (  SELECT  id,name as hotel_township_name,status  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
                 "LEFT JOIN (  SELECT  id,name as hotel_township_name,status  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
                 "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
                 "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
-                " WHERE hstatus = 1 and a.status=1 and c.status = 1 "+sqlx;
+                " WHERE hstatus = 1 and a.status=1 and c.status = 1 and c.type in ('2','3') "+sqlx;
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
     }

+ 14 - 0
mhotel/src/com/happy/dao/impl/UserDaoImpl.java

@@ -265,6 +265,20 @@ public class UserDaoImpl implements UserDao {
         return new ArrayList<>();
         return new ArrayList<>();
     }
     }
 
 
+    public List<Users> queryUserPage2(String sqlx, int page, int rows,String sl) {
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select a.*,case when id in ("+sl+") then '1' else '0' end mark from `users` a where 1=1 "+sqlx+" limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<Users> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(Users.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return new ArrayList<>();
+    }
+
     @Override
     @Override
     public UnevaluatedOrder collect(String hotelId, Integer createId) {
     public UnevaluatedOrder collect(String hotelId, Integer createId) {
         String sql = "SELECT\n" +
         String sql = "SELECT\n" +

+ 21 - 0
mhotel/src/com/happy/service/ArticleTweetService.java

@@ -23,6 +23,8 @@ public interface ArticleTweetService {
      */
      */
     int insert(ArticleTweet articleTweet);
     int insert(ArticleTweet articleTweet);
 
 
+    public int update(ArticleTweet articleTweet);
+
     /**
     /**
      * 更新推文审批状态
      * 更新推文审批状态
      *
      *
@@ -39,6 +41,16 @@ public interface ArticleTweetService {
      */
      */
     int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos);
     int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos);
 
 
+    public int insertArticleFile(ArticleFileInfo articleFileInfos);
+
+    public int delArticleFileBatch(int id);
+
+    public int delArticle(int id);
+
+    public int delArticleFile(int link_id);
+
+    public int updateArticleTop(ArticleTweet articleTweet);
+
     /**
     /**
      * 描述:根据乡镇ID进行民宿分页查询
      * 描述:根据乡镇ID进行民宿分页查询
      *
      *
@@ -154,6 +166,8 @@ public interface ArticleTweetService {
      */
      */
     IPage<ArticleListVo> queryArticlesPage(String keyWord, String townId, Integer userId, Integer type, int page, int rows);
     IPage<ArticleListVo> queryArticlesPage(String keyWord, String townId, Integer userId, Integer type, int page, int rows);
 
 
+    public IPage<ArticleListVo> queryManageArticlesPage(String keyWord, String townId, int page, int rows);
+
     /**
     /**
      * 相关推文分页数据
      * 相关推文分页数据
      * @param userId
      * @param userId
@@ -250,4 +264,11 @@ public interface ArticleTweetService {
      * @return
      * @return
      */
      */
     IPage<WalkthroughVo> walkthroughPage(String strSql,Integer page, Integer rows);
     IPage<WalkthroughVo> walkthroughPage(String strSql,Integer page, Integer rows);
+
+    public List<ArticleLikeMaxVo> queryTop3ArticleLike();
+
+    public List<ArticleTweet> queryTops();
+
+    public int updateUser(Admin admin);
+
 }
 }

+ 2 - 0
mhotel/src/com/happy/service/UserService.java

@@ -39,6 +39,8 @@ public interface UserService {
 
 
     public IPage<Users> queryUserPage(String sqlx, int page, int rows);
     public IPage<Users> queryUserPage(String sqlx, int page, int rows);
 
 
+    public IPage<Users> queryUserPage2(String sqlx, int page, int rows,String sl);
+
     /**
     /**
      * 收藏或住过酒店
      * 收藏或住过酒店
      * @param hotelId
      * @param hotelId

+ 51 - 0
mhotel/src/com/happy/service/impl/ArticleTweetImplService.java

@@ -29,6 +29,10 @@ public class ArticleTweetImplService implements ArticleTweetService {
         return num;
         return num;
     }
     }
 
 
+    public int update(ArticleTweet articleTweet){
+        return articleTweetDao.update(articleTweet);
+    }
+
     @Override
     @Override
     public int updateArticleApprove(ArticleTweet articleTweet) {
     public int updateArticleApprove(ArticleTweet articleTweet) {
         int num = articleTweetDao.updateArticleApprove(articleTweet);
         int num = articleTweetDao.updateArticleApprove(articleTweet);
@@ -41,6 +45,26 @@ public class ArticleTweetImplService implements ArticleTweetService {
         return num;
         return num;
     }
     }
 
 
+    public int insertArticleFile(ArticleFileInfo articleFileInfos){
+        return articleTweetDao.insertArticleFile(articleFileInfos);
+    }
+
+    public int delArticleFileBatch(int id){
+        return articleTweetDao.delArticleFileBatch(id);
+    }
+
+    public int delArticle(int id){
+        return articleTweetDao.delArticle(id);
+    }
+
+    public int delArticleFile(int link_id){
+        return articleTweetDao.delArticleFile(link_id);
+    }
+
+    public int updateArticleTop(ArticleTweet articleTweet){
+        return articleTweetDao.updateArticleTop(articleTweet);
+    }
+
     @Override
     @Override
     public IPage<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
     public IPage<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
         IPage<HotelVo> iPage = new IPage();
         IPage<HotelVo> iPage = new IPage();
@@ -154,6 +178,18 @@ public class ArticleTweetImplService implements ArticleTweetService {
         return iPage;
         return iPage;
     }
     }
 
 
+    public IPage<ArticleListVo> queryManageArticlesPage(String keyWord, String townId, int page, int rows) {
+        IPage<ArticleListVo> iPage = new IPage();
+        List<ArticleListVo> commentList = articleTweetDao.queryManageArticlesPage(keyWord, townId, page, rows);
+        int total = articleTweetDao.queryManageArticlesTotal(keyWord, townId);
+        iPage.setPageList(commentList == null ? new ArrayList<>() : commentList);
+        iPage.setPage(page);
+        iPage.setTotalPage((int) Math.ceil((double) total / rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
     @Override
     @Override
     public IPage<ArticleListVo> relatedTweetPage(Integer userId, String townId, Integer articleId, int page, int rows) {
     public IPage<ArticleListVo> relatedTweetPage(Integer userId, String townId, Integer articleId, int page, int rows) {
         IPage<ArticleListVo> iPage = new IPage();
         IPage<ArticleListVo> iPage = new IPage();
@@ -278,4 +314,19 @@ public class ArticleTweetImplService implements ArticleTweetService {
         iPage.setTotal(total);
         iPage.setTotal(total);
         return iPage;
         return iPage;
     }
     }
+
+    @Override
+    public List<ArticleLikeMaxVo> queryTop3ArticleLike() {
+        List<ArticleLikeMaxVo> result = articleTweetDao.queryTop3ArticleLike();
+        return result;
+    }
+
+    public List<ArticleTweet> queryTops(){
+        return articleTweetDao.queryTops();
+    }
+
+    public int updateUser(Admin admin){
+        return articleTweetDao.updateUser(admin);
+    }
+
 }
 }

+ 11 - 0
mhotel/src/com/happy/service/impl/UserServiceImpl.java

@@ -76,6 +76,17 @@ public class UserServiceImpl implements UserService {
         return iPage;
         return iPage;
     }
     }
 
 
+    public IPage<Users> queryUserPage2(String sqlx, int page, int rows,String sl){
+        IPage<Users> iPage = new IPage();
+        List<Users> usersList = userDao.queryUserPage2(sqlx,page,rows,sl);
+        int total = userDao.queryUserTotal(sqlx);
+        iPage.setPageList(usersList);
+        iPage.setPage(page);
+        iPage.setTotalPage( (int)Math.ceil((double)total/rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
     @Override
     @Override
     public Users addhotelAndUsers(String hotelId, String userId, TempEnum type)
     public Users addhotelAndUsers(String hotelId, String userId, TempEnum type)
     {
     {

+ 13 - 1
mhotel/src/com/happy/vo/ArticleListVo.java

@@ -2,6 +2,8 @@ package com.happy.vo;
 
 
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.List;
+
 /**
 /**
  * @Author: binguo
  * @Author: binguo
  * @Date: 2023/10/12 星期四 10:45
  * @Date: 2023/10/12 星期四 10:45
@@ -18,7 +20,7 @@ public class ArticleListVo {
     /**
     /**
      * 图片
      * 图片
      */
      */
-    private String image;
+    private List<String> image;
 
 
     /**
     /**
      * 视频
      * 视频
@@ -67,4 +69,14 @@ public class ArticleListVo {
      */
      */
     private Integer collectNum;
     private Integer collectNum;
 
 
+    private String content;
+
+    private String createDate;
+
+    private String publishWay;
+
+    private Integer isTop;
+
+    private String hotelId;
+
 }
 }