夏文涛 2 years ago
parent
commit
fdd1226329

+ 49 - 0
mhotel/src/com/happy/Model/ArticleCollect.java

@@ -0,0 +1,49 @@
+package com.happy.Model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 推文收藏表Model
+ */
+@Data
+public class ArticleCollect {
+    /**
+     * 数据id
+     */
+    private Integer id;
+
+    /**
+     * 推文ID
+     */
+    private Integer articleId;
+
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+
+    /**
+     * 是否失效
+     * 未失效:0
+     * 已失效:1
+     */
+    private Integer isLose;
+
+    /**
+     * 创建人
+     */
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+
+    /**
+     * 数据状态(0删除 1正常)
+     */
+    private Integer status;
+
+}

+ 63 - 0
mhotel/src/com/happy/Model/ArticleComment.java

@@ -0,0 +1,63 @@
+package com.happy.Model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 文章评论表Model
+ */
+@Data
+public class ArticleComment {
+    /**
+     * 数据id
+     */
+    private Integer id;
+
+    /**
+     * 推文ID
+     */
+    private Integer articleId;
+
+    /**
+     * 主评论ID
+     * 为0则说明是一级评论数据
+     */
+    private Integer commentParentId;
+
+    /**
+     * 评论人ID
+     */
+    private Integer commentId;
+
+    /**
+     * 评论人名称
+     */
+    private String commentName;
+
+    /**
+     * 评论人头像
+     */
+    private String commentImage;
+
+    /**
+     * 评论内容
+     */
+    private String content;
+
+    /**
+     * 创建人
+     */
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+
+    /**
+     * 数据状态(0删除 1正常)
+     */
+    private Integer status;
+
+}

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

@@ -0,0 +1,41 @@
+package com.happy.Model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ArticleFileInfo {
+
+
+    /**
+     * id
+     */
+    private Integer id;
+
+	/**
+     * 关联id
+     */
+    private Integer linkId;
+
+    /**
+     * 附件路径
+     */
+    private String url;
+
+    /**
+     * 附件名称
+     */
+    private String name;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createDate;
+
+	/**
+	 * 文件类型
+	 * 推文文件:1
+	 */
+	private Integer type;
+}

+ 59 - 0
mhotel/src/com/happy/Model/ArticleLikes.java

@@ -0,0 +1,59 @@
+package com.happy.Model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 文章点赞表Model
+ */
+@Data
+public class ArticleLikes {
+    /**
+     * 数据id
+     */
+    private Integer id;
+
+    /**
+     * 推文ID
+     */
+    private Integer articleId;
+
+    /**
+     * 点赞人ID
+     */
+    private Integer likeId;
+
+    /**
+     * 点赞人名称
+     */
+    private String likeName;
+
+    /**
+     * 点赞人头像
+     */
+    private String likeImage;
+
+    /**
+     * 是否失效
+     * 未失效:0
+     * 已失效:1
+     */
+    private Integer isLose;
+
+    /**
+     * 创建人
+     */
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+
+    /**
+     * 数据状态(0删除 1正常)
+     */
+    private Integer status;
+
+}

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

@@ -0,0 +1,81 @@
+package com.happy.Model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 推文表Model
+ */
+@Data
+public class ArticleTweet {
+    /**
+     * 数据id
+     */
+    private Integer id;
+
+    /**
+     * 推文发送人ID
+     */
+    private Integer userId;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 乡镇ID
+     */
+    private String locationId;
+
+    /**
+     * 乡镇名称
+     */
+    private String locationName;
+
+    /**
+     * 民宿ID
+     */
+    private String hotelId;
+
+    /**
+     * 创建人
+     */
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+
+    /**
+     * 修改时间
+     */
+    private Date modifyDate;
+
+    /**
+     * 审批状态(1、正在审批 2、审批通过 3、拒绝)
+     */
+    private Integer approve;
+
+    /**
+     * 数据状态(0删除 1正常)
+     */
+    private Integer status;
+
+    /**
+     * 用户名称
+     */
+    private String userName;
+
+    /**
+     * 文章收藏数
+     */
+    private Integer collectNum;
+}

+ 60 - 0
mhotel/src/com/happy/Model/UserCollect.java

@@ -0,0 +1,60 @@
+package com.happy.Model;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/12 星期四 15:20
+ * @Description: com.happy.Model
+ * @Version: 1.0
+ */
+@Data
+public class UserCollect {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 被关注人ID
+     */
+    private Integer parentUserid;
+
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+
+    /**
+     * 是否失效
+     * 未失效:“0
+     * 失效:1
+     */
+    private Integer isLose;
+
+    /**
+     * 创建人
+     */
+    private Integer createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+
+    /**
+     * 修改时间
+     */
+    private Date modifyDate;
+
+    /**
+     * 状态
+     * 删除:0
+     * 正常:1
+     * 待审核:2
+     * 审批拒绝:3
+     */
+    private Integer status;
+}

+ 1 - 4
mhotel/src/com/happy/action/WorkflowAction.java

@@ -7,10 +7,7 @@ import com.happy.Until.GetHttpParam;
 import com.happy.Until.ResUtil;
 import com.happy.Until.ResUtil;
 import com.happy.Until.UUIDUtil;
 import com.happy.Until.UUIDUtil;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
-import com.happy.service.BookingCommentService;
-import com.happy.service.FileService;
-import com.happy.service.HotelService;
-import com.happy.service.WorkflowService;
+import com.happy.service.*;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.ServletActionContext;

+ 936 - 0
mhotel/src/com/happy/action/articleTweetAction.java

@@ -0,0 +1,936 @@
+package com.happy.action;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baidubce.model.User;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.*;
+import com.happy.Model.weixin.Users;
+import com.happy.Until.*;
+import com.happy.common.controller.BaseController;
+import com.happy.constant.ResultStatusCode;
+import com.happy.dto.ArticleCommentDto;
+import com.happy.dto.ArticleTweetDto;
+import com.happy.dto.IPage;
+import com.happy.service.*;
+import com.happy.vo.*;
+import com.opensymphony.xwork2.ModelDriven;
+import lombok.SneakyThrows;
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.ServletActionContext;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class articleTweetAction extends BaseController implements ModelDriven<ArticleTweetDto> {
+
+    private final ArticleTweetDto articleTweetDto = new ArticleTweetDto();
+
+    @Override
+    public ArticleTweetDto getModel() {
+        return articleTweetDto;
+    }
+
+    @Resource
+    public ArticleTweetService articleTweetService;
+
+    @Resource
+    public HousePriceService housePriceService;
+
+    @Resource
+    public HotelDictService hotelDictService;
+
+    @Resource
+    public WorkflowService workflowService;
+
+    @Resource
+    public HouseService houseService;
+
+    @Resource
+    public UserService userService;
+
+
+    /**
+     * 推文发布
+     */
+    public String insertArticleTweet() 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;
+        }
+
+        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(1);//正在审批
+            data.setStatus(1);
+            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) {
+                fileStr = articleTweetDto.getImages();
+            } else {
+                fileStr.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);
+                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.setId(id);
+            workflow.setStatus(1);//1是正在审批
+            workflow.setType(3);//3是推文
+            workflow.setCoverImg(articleTweetDto.getImages() != null ? 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) {
+            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;
+    }
+
+
+    /**
+     * 根据推文数据ID查询推文详情数据
+     *
+     * @return
+     */
+    public String queryDetail() {
+        JSONObject jsonObject = new JSONObject();
+        //图片和视频判断
+        if (articleTweetDto.getId() == null || articleTweetDto.getUserId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "推文ID或用户ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询当前用户
+        Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getUserId()));
+        if (user == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户信息已失效,查看详情失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询推文数据
+        ArticleTweet data = articleTweetService.queryArticleById(String.valueOf(articleTweetDto.getId()));
+        if (data == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "推文数据已失效,查看详情失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        ArticleDetailVo result = new ArticleDetailVo();
+        result.setId(data.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 {
+                result.setVideo(fileInfoList.get(0).getUrl());
+            }
+        }
+
+        result.setUserId(data.getUserId());
+        result.setUserName(data.getUserName());
+        //region 关注
+        if (articleTweetDto.getUserId().equals(data.getUserId())) {
+            result.setIsFollow(3);//自己的推文
+        } else {
+            //是否关注
+            UserCollect uc = articleTweetService.queryUserCollect(data.getUserId(), articleTweetDto.getUserId());
+            result.setIsFollow(uc == null ? 0 : 1);//已关注给0;未关注给1
+        }
+        //endregion
+        result.setTitle(data.getTitle());
+        result.setContent(data.getContent());
+        result.setDateStr(TimeExchange.DateToString(data.getCreateDate(), "yyyy-MM-dd"));
+        result.setTownId(data.getLocationId());
+        result.setTownName(data.getLocationName());
+
+        //region 民宿列表
+        //根据乡镇ID获取
+        List<String> hotelIds = Arrays.asList(user.getCollect_hotel().split(","));
+        String sql = "id in = (" + data.getHotelId() + ")";
+        List<HotelVo> hotels = articleTweetService.queryHotels(sql);
+        List<HotelListVo> hotelDatas = new ArrayList<>();
+
+        //region 最低价
+        List<Integer> managerIds = hotels.stream().map(HotelVo::getManagerId).collect(Collectors.toList());
+        List<HotelPriceDataVo> prices = housePriceService.queryHotelPriceDatas(StringUtils.join(managerIds, ","), TimeExchange.getDateStr());
+
+        List<HotelPriceOneDataVo> oneDatas = new ArrayList<>();
+        //获取当天的
+        for (HotelPriceDataVo hp : prices) {
+            HotelPriceOneDataVo oneData = new HotelPriceOneDataVo();
+            oneData.setSetDate(TimeExchange.getDateStr());
+            oneData.setCreateDate(hp.getCreateDate());
+            oneData.setPrice(hp.getPrice());
+            oneData.setManagerId(hp.getManagerId());
+            oneDatas.add(oneData);
+        }
+
+        /**
+         * 根据房型ID处理重复的数据
+         */
+        List<HotelPriceOneDataVo> newOneDatas = new ArrayList<>();
+        if (oneDatas.size() > 0) {
+            for (Integer managerId : managerIds) {
+                Optional<HotelPriceOneDataVo> one = oneDatas.stream().filter(e -> e.getManagerId().equals(managerId)).sorted(Comparator.comparing(HotelPriceOneDataVo::getCreateDate, Comparator.reverseOrder())).findFirst();
+                if (one != null && one.isPresent()) {
+                    HotelPriceOneDataVo oneData = new HotelPriceOneDataVo();
+                    oneData.setSetDate(one.get().getSetDate());
+                    oneData.setCreateDate(one.get().getCreateDate());
+                    oneData.setPrice(one.get().getPrice());
+                    oneData.setManagerId(one.get().getManagerId());
+                    newOneDatas.add(oneData);
+                }
+            }
+        }
+
+        /**
+         * 获取商家集合中最低房型价格
+         */
+        List<PriceHotelDataVo> mins = houseService.gethotelMinPrice(StringUtils.join(managerIds, ","));
+        DecimalFormat decimalFormat = new DecimalFormat("#####.##");
+        //endregion
+
+        for (HotelVo hotel : hotels) {
+            HotelListVo hotelData = new HotelListVo();
+            hotelData.setId(hotel.getId());
+            hotelData.setName(hotel.getName());
+            hotelData.setScore(hotel.getScore());
+            hotelData.setCoverImg(hotel.getCoverImg());
+            hotelData.setComment(hotel.getComment());
+            //是否收藏
+            Optional<String> hotelId = hotelIds.stream().filter(e -> e.equals(hotel.getId())).findFirst();
+            if (hotelId != null && hotelId.isPresent()) {
+                hotelData.setIsCollect(1);
+            } else {
+                hotelData.setIsCollect(0);
+            }
+            hotelData.setType(hotel.getType());
+            //价格
+            Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+            if (one != null && one.isPresent()) {
+                hotelData.setPrice(decimalFormat.format(one.get().getPrice()));
+            } else {
+                Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                if (min != null && min.isPresent()) {
+                    hotelData.setPrice(decimalFormat.format(min.get().getPrice()));
+                }
+            }
+            hotelDatas.add(hotelData);
+        }
+        //endregion
+
+        List<LikeListVo> likes = articleTweetService.queryArticleLikes(articleTweetDto.getId());
+        result.setLikes(likes.stream().map(LikeListVo::getImage).collect(Collectors.toList()));
+        result.setLikeNum(likes == null ? 0 : likes.size());
+
+        List<ArticleCommentVo> comments = articleTweetService.queryArticleComment(articleTweetDto.getId());
+        result.setComments(comments);
+        int total = articleTweetService.queryArticleCommentTotal(articleTweetDto.getId());
+        result.setCommentNum(total);
+
+        result.setCollectNum(data.getCollectNum());
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 获取推文详情中民宿分页列表
+     */
+    public String queryHotelList() {
+        JSONObject jsonObject = new JSONObject();
+        if (articleTweetDto.getId() == null || articleTweetDto.getUserId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "推文ID或用户ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询当前用户
+        Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getUserId()));
+        if (user == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户信息已失效,查看详情失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询推文数据
+        ArticleTweet data = articleTweetService.queryArticleById(String.valueOf(articleTweetDto.getId()));
+        if (data == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "推文数据已失效,查看详情失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //region 民宿列表
+        //根据乡镇ID获取
+        List<String> hotelIds = Arrays.asList(user.getCollect_hotel().split(","));
+        String sql = "id in = (" + data.getHotelId() + ")";
+        IPage<HotelVo> hotels = articleTweetService.queryHotelPageByHotleId(sql, page, rows);
+        List<HotelListVo> hotelDatas = new ArrayList<>();
+
+        //region 最低价
+        List<Integer> managerIds = hotels.getPageList().stream().map(HotelVo::getManagerId).collect(Collectors.toList());
+        List<HotelPriceDataVo> prices = housePriceService.queryHotelPriceDatas(StringUtils.join(managerIds, ","), TimeExchange.getDateStr());
+
+        List<HotelPriceOneDataVo> oneDatas = new ArrayList<>();
+        //获取当天的
+        for (HotelPriceDataVo hp : prices) {
+            HotelPriceOneDataVo oneData = new HotelPriceOneDataVo();
+            oneData.setSetDate(TimeExchange.getDateStr());
+            oneData.setCreateDate(hp.getCreateDate());
+            oneData.setPrice(hp.getPrice());
+            oneData.setManagerId(hp.getManagerId());
+            oneDatas.add(oneData);
+        }
+
+        /**
+         * 根据房型ID处理重复的数据
+         */
+        List<HotelPriceOneDataVo> newOneDatas = new ArrayList<>();
+        if (oneDatas.size() > 0) {
+            for (Integer managerId : managerIds) {
+                Optional<HotelPriceOneDataVo> one = oneDatas.stream().filter(e -> e.getManagerId().equals(managerId)).sorted(Comparator.comparing(HotelPriceOneDataVo::getCreateDate, Comparator.reverseOrder())).findFirst();
+                if (one != null && one.isPresent()) {
+                    HotelPriceOneDataVo oneData = new HotelPriceOneDataVo();
+                    oneData.setSetDate(one.get().getSetDate());
+                    oneData.setCreateDate(one.get().getCreateDate());
+                    oneData.setPrice(one.get().getPrice());
+                    oneData.setManagerId(one.get().getManagerId());
+                    newOneDatas.add(oneData);
+                }
+            }
+        }
+
+        /**
+         * 获取商家集合中最低房型价格
+         */
+        List<PriceHotelDataVo> mins = houseService.gethotelMinPrice(StringUtils.join(managerIds, ","));
+        DecimalFormat decimalFormat = new DecimalFormat("#####.##");
+        //endregion
+
+        for (HotelVo hotel : hotels.getPageList()) {
+            HotelListVo hotelData = new HotelListVo();
+            hotelData.setId(hotel.getId());
+            hotelData.setName(hotel.getName());
+            hotelData.setScore(hotel.getScore());
+            hotelData.setCoverImg(hotel.getCoverImg());
+            hotelData.setComment(hotel.getComment());
+            //是否收藏
+            Optional<String> hotelId = hotelIds.stream().filter(e -> e.equals(hotel.getId())).findFirst();
+            if (hotelId != null && hotelId.isPresent()) {
+                hotelData.setIsCollect(1);
+            } else {
+                hotelData.setIsCollect(0);
+            }
+            hotelData.setType(hotel.getType());
+            //价格
+            Optional<HotelPriceOneDataVo> one = newOneDatas.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+            if (one != null && one.isPresent()) {
+                hotelData.setPrice(decimalFormat.format(one.get().getPrice()));
+            } else {
+                Optional<PriceHotelDataVo> min = mins.stream().filter(e -> e.getManagerId().equals(hotel.getManagerId())).findFirst();
+                if (min != null && min.isPresent()) {
+                    hotelData.setPrice(decimalFormat.format(min.get().getPrice()));
+                }
+            }
+            hotelDatas.add(hotelData);
+        }
+        //endregion
+
+        IPage<HotelListVo> result = new IPage<>();
+        result.setPage(hotels.getPage());
+        result.setRows(hotels.getRows());
+        result.setPageList(hotelDatas);
+        result.setTotal(hotels.getTotal());
+        result.setTotalPage(hotels.getTotalPage());
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 获取推文详情中评论分页列表
+     * 先获取一级评论 再区获取对应子级
+     */
+    public String queryCommentList() {
+        JSONObject jsonObject = new JSONObject();
+        //推文ID判断
+        if (articleTweetDto.getId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "推文ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //一级分页数据
+        IPage<ArticleCommentVo> result = articleTweetService.queryCommentPageByArticle(articleTweetDto.getId(), page, rows);
+
+        //子级评论数据
+        List<ArticleCommentVo> childs = articleTweetService.queryCommentsByArticle(articleTweetDto.getId());
+
+        for (ArticleCommentVo data : result.getPageList()) {
+            List<ArticleCommentVo> comments = QueryTreeDatas(data.getId(), childs);
+            data.setChildrens(comments);
+        }
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+    //region 循环递归获取子级
+
+    /**
+     * 根据父类ID获取树形菜单数据
+     *
+     * @param parentID 父级ID
+     * @param lists    数据集合
+     * @return
+     */
+    private List<ArticleCommentVo> QueryTreeDatas(Integer parentID, List<ArticleCommentVo> lists) {
+        List<ArticleCommentVo> newTrees = new ArrayList<>();
+
+        List<ArticleCommentVo> datas = lists.stream().filter(e -> e.getParentId().equals(parentID)).collect(Collectors.toList());
+
+        for (ArticleCommentVo data : datas) {
+
+            List<ArticleCommentVo> news = QueryTreeDatas(data.getId(), lists);
+            if (news == null || news.size() == 0) {
+                newTrees.add(data);
+                continue;
+            } else {
+                data.setChildrens(news);
+                newTrees.add(data);
+            }
+        }
+
+        return newTrees;
+    }
+    //endregion
+
+
+    /**
+     * 根据用户ID获取个人主页相关信息
+     */
+    public String queryUserInfo() {
+        JSONObject jsonObject = new JSONObject();
+        //用户ID判断
+        if (articleTweetDto.getUserId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        articleUserVo result = articleTweetService.queryUserInfo(articleTweetDto.getUserId());
+
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+    /**
+     * 根据用户ID获取用户主页推文列表分页数据
+     */
+    public String queryOwnerArticlePage() {
+        JSONObject jsonObject = new JSONObject();
+        //用户ID判断
+        if (articleTweetDto.getUserId() == null || articleTweetDto.getType() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户ID或类型ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        String sqlWhere = "";//全部推文
+        if (articleTweetDto.getType().intValue() == 1) {
+            sqlWhere = "at.approve = 1 ";//审核中
+        } else if (articleTweetDto.getType().intValue() == 2) {
+            sqlWhere = "at.approve = 3 ";//驳回
+        }
+        IPage<OwnerArticleVo> result = articleTweetService.queryOwnerArticlePage(articleTweetDto.getUserId(), sqlWhere, page, rows);
+
+        if (result.getPageList().size() > 0) {
+            String articleIds = StringUtils.join(result.getPageList().stream().map(OwnerArticleVo::getId).collect(Collectors.toList()), ",");
+            List<FileInfo> fileInfos = articleTweetService.queryList("and link_id in (" + articleIds + ")");
+
+            for (OwnerArticleVo data : result.getPageList()) {
+                List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId())).collect(Collectors.toList());
+                if (fileInfoList != null) {
+                    if (fileInfoList.size() > 1) {
+                        data.setImages(fileInfoList.stream().map(FileInfo::getUrl).collect(Collectors.toList()));
+                    } else {
+                        data.setVideo(fileInfoList.get(0).getUrl());
+                    }
+                }
+            }
+        }
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 社区首页推文列表
+     */
+    public String queryArticlePage() {
+        JSONObject jsonObject = new JSONObject();
+
+        if (articleTweetDto.getType() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "推文列表类型不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        if (articleTweetDto.getUserId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        IPage<ArticleListVo> result = articleTweetService.queryArticlesPage(articleTweetDto.getTownId(), articleTweetDto.getUserId(), articleTweetDto.getType(), 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()) {
+                List<FileInfo> fileInfoList = fileInfos.stream().filter(e -> e.getLinkId().equals(data.getId())).collect(Collectors.toList());
+                if (fileInfoList != null) {
+                    if (fileInfoList.size() > 1) {
+                        data.setImage(fileInfoList.get(0).getUrl());
+                    } else {
+                        data.setVideo(fileInfoList.get(0).getUrl());
+                    }
+                }
+            }
+        }
+
+
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 收藏文章
+     */
+    public String collectArticle() throws ParseException {
+        JSONObject jsonObject = new JSONObject();
+
+        if (articleTweetDto.getId() == null || articleTweetDto.getUserId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户ID或推文ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询当前操作人是否已经收藏过这篇文章
+        ArticleCollect data = articleTweetService.queryArticleCollect(articleTweetDto.getId(), articleTweetDto.getUserId());
+
+        String actionStr = "收藏";
+        if (data != null) {
+            if (data.getIsLose().intValue() == 0) {//说明原来是未失效,现在要取消
+                actionStr = "取消收藏";
+                data.setIsLose(1);
+            } else {
+                data.setIsLose(0);
+            }
+        } else {
+            Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+            data = new ArticleCollect();
+            data.setArticleId(articleTweetDto.getId());
+            data.setUserId(articleTweetDto.getUserId());
+            data.setIsLose(0);
+            data.setCreateId(articleTweetDto.getUserId());
+            data.setCreateDate(now);
+            data.setStatus(1);
+        }
+
+        int m = articleTweetService.updateArticleCollect(data);
+        if (m <= 0) {
+            String message = actionStr + "失败";
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", message);
+                put("code", 500);
+            }}.toString());
+
+            return null;
+        }
+
+        String successMessage =actionStr +"成功";
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", successMessage);
+            put("code", 200);
+        }}.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 评论文章
+     */
+    public String commentArticle() throws ParseException {
+        Gson gson = new Gson();
+        JSONObject jsonObject = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
+        ArticleCommentDto articleCommentDto = gson.fromJson(json.toString(), new TypeToken<ArticleCommentDto>() {
+        }.getType());
+
+        if(articleCommentDto.getArticleId() == null || Func.checkNull(articleCommentDto.getContent())
+         || articleCommentDto.getParentId() == null || articleCommentDto.getUserId() == null){
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "参数不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询操作人身份
+        Users user = userService.queryByUserId(String.valueOf(articleCommentDto.getUserId()));
+        if (user == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户信息已失效,评论失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+        ArticleComment articleComment = new ArticleComment();
+        articleComment.setArticleId(articleCommentDto.getArticleId());
+        articleComment.setCommentParentId(articleCommentDto.getParentId());
+        articleComment.setCommentId(articleCommentDto.getUserId());
+        articleComment.setCommentName(user.getUser_name());
+        articleComment.setCommentImage(user.getHeadPhoto());
+        articleComment.setContent(articleCommentDto.getContent());
+        articleComment.setCreateId(articleCommentDto.getUserId());
+        articleComment.setCreateDate(now);
+        articleComment.setStatus(1);
+
+        int num = articleTweetService.insertArticleComment(articleComment);
+        if(num <= 0){
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", "评论失败");
+                put("code", 500);
+            }}.toString());
+            return null;
+        }
+
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", "评论成功");
+            put("code", 500);
+        }}.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 关注作者
+     */
+    public String followAuthor() throws ParseException {
+        JSONObject jsonObject = new JSONObject();
+        if(articleTweetDto.getAuthorId() == null || articleTweetDto.getUserId() == null){
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "作者ID或用户ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询当前操作人是否已经关注过作者
+        UserCollect data = articleTweetService.queryUserCollectNoLose(articleTweetDto.getAuthorId(), articleTweetDto.getUserId());
+        String actionStr = "关注";
+        if (data != null) {
+            if (data.getIsLose().intValue() == 0) {//说明原来是未失效,现在要取消
+                actionStr = "取消关注";
+                data.setIsLose(1);
+            } else {
+                data.setIsLose(0);
+            }
+        } else {
+            Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+            data = new UserCollect();
+            data.setParentUserid(articleTweetDto.getAuthorId());
+            data.setUserId(articleTweetDto.getUserId());
+            data.setIsLose(0);
+            data.setCreateId(articleTweetDto.getUserId());
+            data.setCreateDate(now);
+            data.setStatus(1);
+        }
+
+        int m = articleTweetService.updateUserCollect(data);
+        if (m <= 0) {
+            String message = actionStr + "失败";
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", message);
+                put("code", 500);
+            }}.toString());
+
+            return null;
+        }
+
+        String successMessage =actionStr +"成功";
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", successMessage);
+            put("code", 200);
+        }}.toString());
+
+        return null;
+    }
+
+    /**
+     * 点赞文章
+     */
+    public String likeArticle() throws ParseException {
+        JSONObject jsonObject = new JSONObject();
+
+        if (articleTweetDto.getId() == null || articleTweetDto.getUserId() == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户ID或推文ID不能为空");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询操作人身份
+        Users user = userService.queryByUserId(String.valueOf(articleTweetDto.getUserId()));
+        if (user == null) {
+            jsonObject.put("code", 500);
+            jsonObject.put("message", "用户信息已失效,评论失败");
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        //查询当前操作人是否已经收藏过这篇文章
+        ArticleLikes data = articleTweetService.queryArticleLike(articleTweetDto.getId(), articleTweetDto.getUserId());
+
+        String actionStr = "点赞";
+        if (data != null) {
+            if (data.getIsLose().intValue() == 0) {//说明原来是未失效,现在要取消
+                actionStr = "取消点赞";
+                data.setIsLose(1);
+            } else {
+                data.setIsLose(0);
+            }
+        } else {
+            Date now = DateUtil.formateDate(DateUtil.getCurrentDate(), DateUtil.Time_Formatter_Second);
+            data = new ArticleLikes();
+            data.setArticleId(articleTweetDto.getId());
+            data.setLikeId(articleTweetDto.getUserId());
+            data.setLikeName(user.getUser_name());
+            data.setLikeImage(user.getHeadPhoto());
+            data.setIsLose(0);
+            data.setCreateId(articleTweetDto.getUserId());
+            data.setCreateDate(now);
+            data.setStatus(1);
+        }
+
+        int m = articleTweetService.updateArticleLike(data);
+        if (m <= 0) {
+            String message = actionStr + "失败";
+            ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+                put("message", message);
+                put("code", 500);
+            }}.toString());
+
+            return null;
+        }
+
+        String successMessage =actionStr +"成功";
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", successMessage);
+            put("code", 200);
+        }}.toString());
+
+        return null;
+    }
+
+    /**
+     * 获取乡镇列表
+     */
+    public String townShips() {
+        List<HotelDict> hotelDicts = hotelDictService.queryList("and code = 10");
+        List<TownshipVo> result = new ArrayList<>();
+        for (HotelDict hotelDict : hotelDicts) {
+            TownshipVo data = new TownshipVo();
+            data.setId(hotelDict.getId());
+            data.setName(hotelDict.getName());
+            result.add(data);
+        }
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+
+        return null;
+    }
+
+
+    /**
+     * 根据乡镇ID获取民宿列表
+     */
+    public String hotelByid() {
+        JSONObject jsonObject = new JSONObject();
+        if (Func.checkNull(articleTweetDto.getTownId())) {
+            jsonObject.put("code", ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put("message", ResultStatusCode.BAD_REQUEST.getMsg());
+            jsonObject.put("data", null);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        String sql = "hotel_township = '" + articleTweetDto.getTownId() + "'";
+
+        IPage<HotelVo> houseIPage = articleTweetService.queryHotelPage(sql, page, rows);
+
+        jsonObject.put("message", "查询分页成功");
+        jsonObject.put("code", 200);
+        jsonObject.put("data", houseIPage);
+        ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
+
+}

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

@@ -0,0 +1,232 @@
+package com.happy.dao;
+
+import com.happy.Model.*;
+import com.happy.vo.*;
+
+import java.util.List;
+
+public interface ArticleTweetDao {
+
+    /**
+     * 根据数据ID查询推文数据
+     * @param id
+     * @return
+     */
+    ArticleTweet queryArticleById(String id);
+
+    /**
+     * 新增推文数据
+     * @param articleTweet
+     * @return
+     */
+    int insert(ArticleTweet articleTweet);
+
+    /**
+     * 更新推文审批状态
+     * @param articleTweet
+     * @return
+     */
+    int updateArticleApprove(ArticleTweet articleTweet);
+
+    /**
+     * 批量存储推文文件
+     * @param articleFileInfos
+     * @return
+     */
+    int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos);
+
+    /**
+     * 描述:根据乡镇ID进行民宿分页查询
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     */
+    List<HotelVo> queryHotelPage(String sqlx, int page, int rows);
+
+    /**
+     * 描述:根据乡镇ID获取民宿总条数
+     * @param sqlx
+     * @return
+     */
+    int queryHotelTotal(String sqlx);
+
+    /**
+     * 根据民宿ID查询民宿分页数据
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     */
+    List<HotelVo> queryHotelPageByHotleId(String sqlx, int page, int rows);
+
+    /**
+     * 根据民宿ID查询民宿总数
+     * @param sqlx
+     * @return
+     */
+    int queryHotelTotalByHotleId(String sqlx);
+
+    /**
+     * 描述:根据乡镇ID查询民宿数据
+     * @param sqlx
+     * @return
+     */
+    List<HotelVo> queryHotels(String sqlx);
+
+    /**
+     * 获取推文文件数据
+     * @param sqlx
+     * @return
+     */
+    List<FileInfo> queryList(String sqlx);
+
+    /**
+     * 查询是否关注当前用户
+     * @param parentId
+     * @param userId
+     * @return
+     */
+    UserCollect queryUserCollect(Integer parentId, Integer userId);
+
+    /**
+     * 获取十条以内的点赞人列表数据
+     * @param articleId 文章ID
+     * @return
+     */
+    List<LikeListVo> queryArticleLikes(Integer articleId);
+
+    /**
+     * 获取三条评论数据
+     * @param articleId
+     * @return
+     */
+    List<ArticleCommentVo> queryArticleComment(Integer articleId);
+
+    /**
+     * 根据文章ID获取评论总数(包括子级)
+     * @param articleId
+     * @return
+     */
+    int queryArticleCommentTotal(Integer articleId);
+
+    /**
+     * 根据文章ID获取一级评论分页数据
+     * @param articleId
+     * @param page
+     * @param rows
+     * @return
+     */
+    List<ArticleCommentVo> queryCommentPageByArticle(Integer articleId, int page, int rows);
+
+    /**
+     * 根据文章ID获取一级评论总数
+     * @param articleId
+     * @return
+     */
+    int queryCommentTotalByArticle(Integer articleId);
+
+    /**
+     * 根据文章ID获取子级评论数据
+     * @param articleId
+     * @return
+     */
+    List<ArticleCommentVo> queryCommentsByArticle(Integer articleId);
+
+    /**
+     * 获取用户主页用户信息
+     * @param userId
+     * @return
+     */
+    articleUserVo queryUserInfo(Integer userId);
+
+    /**
+     * 获取用户列表中的文章列表数据
+     * @param userId
+     * @param sqlWhere
+     * @param page
+     * @param rows
+     * @return
+     */
+    List<OwnerArticleVo> queryOwnerArticlePage(Integer userId, String sqlWhere, int page, int rows);
+
+    /**
+     * 获取用户列表中的文章数据总数
+     * @param userId
+     * @param sqlWhere
+     * @return
+     */
+    int queryOwnerArticleTotal(Integer userId, String sqlWhere);
+
+    /**
+     * 社区首页推文列表分页数据
+     * @param townId
+     * @param userId
+     * @param type
+     * @param page
+     * @param rows
+     * @return
+     */
+    List<ArticleListVo> queryArticlesPage(String townId, Integer userId, Integer type, int page, int rows);
+
+    /**
+     * 社区首页推文列表总数据条数
+     * @param townId
+     * @param userId
+     * @param type
+     * @return
+     */
+    int queryArticlesTotal(String townId, Integer userId, Integer type);
+
+    /**
+     * 查询文章收藏数据
+     * @param articleId
+     * @param userId
+     * @return
+     */
+    ArticleCollect queryArticleCollect(Integer articleId, Integer userId);
+
+    /**
+     * 收藏或取消收藏文章
+     * @param articleCollect
+     * @return
+     */
+    int updateArticleCollect(ArticleCollect articleCollect);
+
+    /**
+     * 评论文章
+     * @param articleComment
+     * @return
+     */
+    int insertArticleComment(ArticleComment articleComment);
+
+    /**
+     * 查询用户关注记录数据
+     * @param authorId
+     * @param userId
+     * @return
+     */
+    UserCollect queryUserCollectNoLose(Integer authorId, Integer userId);
+
+    /**
+     * 关注或取消关注操作
+     * @param userCollect
+     * @return
+     */
+    int updateUserCollect(UserCollect userCollect);
+
+    /**
+     * 查询用户点赞记录数据
+     * @param articleId
+     * @param userId
+     * @return
+     */
+    ArticleLikes queryArticleLike(Integer articleId, Integer userId);
+
+    /**
+     * 点赞文章
+     * @param articleLikes
+     * @return
+     */
+    int updateArticleLike(ArticleLikes articleLikes);
+}

+ 606 - 0
mhotel/src/com/happy/dao/impl/ArticleTweetImplDao.java

@@ -0,0 +1,606 @@
+package com.happy.dao.impl;
+
+import com.happy.Model.*;
+import com.happy.Until.SqlUtil;
+import com.happy.Until.UUIDUtil;
+import com.happy.dao.ArticleTweetDao;
+import com.happy.vo.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.jdbc.core.namedparam.SqlParameterSource;
+import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
+import org.springframework.jdbc.support.GeneratedKeyHolder;
+import org.springframework.jdbc.support.KeyHolder;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("ArticleTweetDao")
+public class ArticleTweetImplDao implements ArticleTweetDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    @Override
+    public ArticleTweet queryArticleById(String id) {
+        String sql = "SELECT (select IFNULL(count(*),0) from article_collect where article_id = :id and is_lose = 0) as collect_num,hd.name as location_name,u.user_name,at.* FROM article_tweet at" +
+                "inner join users u on u.id = at.user_id " +
+                "left join hotel_dict hd on hd.code = 10 and hd.id = at.location_id" +
+                "WHERE at.id = :id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        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.get(0);
+        }
+        return null;
+    }
+
+
+    @Override
+    public int insert(ArticleTweet articleTweet) {
+        KeyHolder key = new GeneratedKeyHolder();
+        String sql = "insert into `article_tweet`(user_id,title,content,location_id,hotel_id,create_id,create_date,status,approve)" +
+                "values(:userId,:title,:content,:locationId,:hotelId,:createId,:createDate,:status,:approve) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", articleTweet.getUserId());
+        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());
+
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps, key);
+            num = key.getKey().intValue();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+
+    @Override
+    public int updateArticleApprove(ArticleTweet articleTweet) {
+        String sql = "update article_tweet set approve = :approve where id = :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", articleTweet.getId());
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    @Override
+    public int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos) {
+        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) ";
+        int[] m = namedParameterJdbcTemplate.batchUpdate(insertSql, params);
+        return m.length;
+    }
+
+
+    @Override
+    public List<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
+        SqlUtil.filterKeyword(sqlx);
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select h.id,h.hname as name,h.cover_img,h.score_hotel as score,am.type from admin_manager am\n" +
+                "inner join hotel h on h.status = 1 and h.manager_id = am.id\n" +
+                "where am.status = 1 and am." + sqlx + " ORDER BY name asc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<HotelVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(HotelVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public int queryHotelTotal(String sqlx) {
+        SqlUtil.filterKeyword(sqlx);
+        String sql = "select count(*) from admin_manager am\n" +
+                "inner join hotel h on h.status = 1 and h.manager_id = am.id\n" +
+                "where am.status = 1 and am." + sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    @Override
+    public List<HotelVo> queryHotels(String sqlx) {
+        SqlUtil.filterKeyword(sqlx);
+        String sql = "select h.manager_id,(select IFNULL(count(*),0) from booking_comment where status = 1 and hotel_id = h.id) as comment,h.id,h.hname as name,h.cover_img,h.score_hotel as score,am.type from hotel h\n" +
+                "left join admin_manager am on am.status = 1 and h.manager_id = am.id\n" +
+                "where h.status = 1 and h." + sqlx + " ORDER BY name asc limit 0,2";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<HotelVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(HotelVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public List<HotelVo> queryHotelPageByHotleId(String sqlx, int page, int rows) {
+        SqlUtil.filterKeyword(sqlx);
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql =
+                "select h.manager_id,(select IFNULL(count(*),0) from booking_comment where status = 1 and hotel_id = h.id) as comment,h.id,h.hname as name,h.cover_img,h.score_hotel as score,am.type from hotel h\n" +
+                        "left join admin_manager am on am.status = 1 and h.manager_id = am.id\n" +
+                        "where h.status = 1 and h." + sqlx + " ORDER BY name asc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<HotelVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(HotelVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public int queryHotelTotalByHotleId(String sqlx) {
+        SqlUtil.filterKeyword(sqlx);
+        String sql = "select h.manager_id,(select IFNULL(count(*),0) from booking_comment where status = 1 and hotel_id = h.id) as comment,h.id,h.hname as name,h.cover_img,h.score_hotel as score,am.type from hotel h\n" +
+                "left join admin_manager am on am.status = 1 and h.manager_id = am.id\n" +
+                "where h.status = 1 and h." + sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    @Override
+    public List<FileInfo> queryList(String sqlx) {
+        SqlUtil.filterKeyword(sqlx);
+        String sql = "SELECT id,link_id,url,name FROM `article_file_info` WHERE type=1 " + sqlx;
+        List<FileInfo> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(FileInfo.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) return list;
+        return null;
+    }
+
+
+    @Override
+    public UserCollect queryUserCollect(Integer parentId, Integer userId) {
+        String sql = "SELECT * FROM user_collect WHERE is_lose=0 and parent_userid = :parentId and user_id = :userId";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("parentId", parentId);
+        sps.addValue("userId", userId);
+        List<UserCollect> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(UserCollect.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+
+    @Override
+    public List<LikeListVo> queryArticleLikes(Integer articleId) {
+        String sql = "select (select IFNULL(count(*),0) from article_tweet where user_id = al.like_id) as article_number,(select IFNULL(count(*),0) from user_collect where is_lose = 0 and parent_userid = al.like_id) as fans_number,al.like_id as id,al.like_image as image,al.like_name as name from article_likes al\n" +
+                "where al.is_lose = 0 and al.article_id = :articleId order by al.create_date desc limit 0,10";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+        List<LikeListVo> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps, new BeanPropertyRowMapper<>(LikeListVo.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public List<ArticleCommentVo> queryArticleComment(Integer articleId) {
+        String sql = "select id,comment_parent_id as parent_id,comment_id as user_id,comment_name as user_name,comment_image as image,content,create_date as date from article_comment " +
+                "where article_id = :articleId and comment_parent_id = 0" +
+                "ORDER BY create_date desc limit 0,3";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+        List<ArticleCommentVo> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps, new BeanPropertyRowMapper<>(ArticleCommentVo.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+
+    @Override
+    public int queryArticleCommentTotal(Integer articleId) {
+        String sql = "select Count(*) from article_comment " +
+                "where article_id = :articleId";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+
+    @Override
+    public List<ArticleCommentVo> queryCommentPageByArticle(Integer articleId, int page, int rows) {
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select id,comment_parent_id as parent_id,comment_id as user_id,comment_name as user_name,comment_image as image,content,create_date as date from article_comment " +
+                "where article_id = :articleId and comment_parent_id = 0" +
+                "ORDER BY create_date desc limit :start,:rows";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        sps.addValue("articleId", articleId);
+        List<ArticleCommentVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(ArticleCommentVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public int queryCommentTotalByArticle(Integer articleId) {
+        String sql = "select id,comment_parent_id as parent_id,comment_id as user_id,comment_name as user_name,comment_image as image,content,create_date as date from article_comment " +
+                "where article_id = :articleId and comment_parent_id = 0";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+
+    @Override
+    public List<ArticleCommentVo> queryCommentsByArticle(Integer articleId) {
+        String sql = "select id,comment_parent_id as parent_id,comment_id as user_id,comment_name as user_name,comment_image as image,content,create_date as date from article_comment " +
+                "where article_id = :articleId and comment_parent_id > 0" +
+                "order BY create_date desc";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+        List<ArticleCommentVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(ArticleCommentVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public articleUserVo queryUserInfo(Integer userId) {
+        String sql = "select id,head_photo as image,user_name,descript,\n" +
+                "(select count(*) from user_collect where is_lose = 0 and parent_userid = :userId) as fans_num,\n" +
+                "(select count(*) from user_collect where is_lose = 0 and user_id = :userId) as follow_num,\n" +
+                "(select count(*) from article_likes where is_lose = 0 and article_id in (select id from article_tweet where user_id = :userId)) as like_num\n" +
+                "from users where id = :userId";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", userId);
+        List<articleUserVo> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(articleUserVo.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+
+    }
+
+    @Override
+    public List<OwnerArticleVo> queryOwnerArticlePage(Integer userId, String sqlWhere, int page, int rows) {
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select at.approve,at.id,at.title,at.create_date as date,at.location_id as town_id,\n" +
+                "hd.name as town_name,(select count(*) from article_likes where article_id = at.id and is_lose = 0) as like_num,\n" +
+                "(select count(*) from article_comment where article_id = at.id) as comment_num\n" +
+                "from article_tweet at\n" +
+                "left join hotel_dict hd on hd.id = at.location_id\n" +
+                "where at.user_id = :userId " + sqlWhere +
+                "ORDER BY at.create_date desc limit :start,:rows";
+
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        sps.addValue("userId", userId);
+        List<OwnerArticleVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(OwnerArticleVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public int queryOwnerArticleTotal(Integer userId, String sqlWhere) {
+        String sql = "select count(*) from article_tweet \n" +
+                "where user_id = :userId " + sqlWhere;
+
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", userId);
+
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    @Override
+    public List<ArticleListVo> queryArticlesPage(String townId, Integer userId, Integer type, int page, int rows) {
+        int start = (page - 1) * rows;// 每页的起始下标
+
+        String innSql = "";
+        String leftSql = "";
+        String caseSql = "";
+        if (type.intValue() == 0) {//发现
+            caseSql = "case ac.id when null then 0 else 1 end is_collect,";
+            leftSql = "left join article_collect ac on ac.is_lose = 0 and ac.article_id = at.id and ac.user_id = :userId\n";
+        } else if (type.intValue() == 1) {//关注
+            caseSql = "case ac.id when null then 0 else 1 end is_collect,";
+            leftSql = "left join article_collect ac on ac.is_lose = 0 and ac.article_id = at.id and ac.user_id = :userId\n";
+            innSql = "inner join user_collect uc on uc.is_lose = 0 and uc.parent_userid = at.user_id and uc.user_id = :userId\n";//关注
+        } else if (type.intValue() == 2) {//收藏
+            caseSql = "1 as is_collect,";
+            innSql = "inner join article_collect acc on acc.is_lose = 0 and acc.article_id = at.id and acc.user_id = :userId\n";//收藏
+        }
+
+        String sqlWhere = townId == null ? "" : "at.location_id = '" + townId + "'";
+
+        String sql = "select at.id,at.location_id as town_id,hd.name as town_name,at.title,at.user_id,u.user_name,\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 dh.id = at.location_id\n" +
+                "left join users u on u.id = at.user_id\n" +
+                leftSql +
+                innSql +
+                "where at.approve = 2 " + sqlWhere;
+
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        sps.addValue("userId", userId);
+        List<ArticleListVo> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<>(ArticleListVo.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+    @Override
+    public int queryArticlesTotal(String townId, Integer userId, Integer type) {
+
+        String innSql = "";
+        if (type.intValue() == 1) {//关注
+            innSql = "inner join user_collect uc on uc.is_lose = 0 and uc.parent_userid = at.user_id and uc.user_id = :userId\n";//关注
+        } else if (type.intValue() == 2) {//收藏
+            innSql = "inner join article_collect acc on acc.is_lose = 0 and acc.article_id = at.id and acc.user_id = :userId\n";//收藏
+        }
+
+        String sqlWhere = townId == null ? "" : "at.location_id = '" + townId + "'";
+
+        String sql = "select count(at.*) from article_tweet at\n" +
+                innSql +
+                "where at.approve = 2 " + sqlWhere;
+
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("userId", userId);
+        sps.addValue("townId", townId);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+
+    @Override
+    public ArticleCollect queryArticleCollect(Integer articleId, Integer userId) {
+        String sql = "select * from article_collect\n" +
+                     "where article_id = :articleId and user_id = :userId ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+        sps.addValue("userId", userId);
+        List<ArticleCollect> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(ArticleCollect.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+
+    }
+
+    @Override
+    public int updateArticleCollect(ArticleCollect articleCollect) {
+        String sql ="";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        if(articleCollect.getId() == null){
+            sql = "insert into article_collect (article_id,user_id,is_lose,create_id,create_date,status)" +
+                    "values(:articleId,:userId,:isLose,:createId,:createDate,:status) ";
+
+            sps.addValue("articleId", articleCollect.getArticleId());
+            sps.addValue("userId", articleCollect.getUserId());
+            sps.addValue("isLose", articleCollect.getIsLose());
+            sps.addValue("createId", articleCollect.getCreateId());
+            sps.addValue("createDate", articleCollect.getCreateDate());
+            sps.addValue("status", articleCollect.getStatus());
+        }else{
+            sql = "update article_collect set is_lose = :isLose where id = :id";
+            sps.addValue("isLose", articleCollect.getIsLose());
+            sps.addValue("id", articleCollect.getId());
+        }
+
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    @Override
+    public int insertArticleComment(ArticleComment articleComment) {
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        String sql = "insert into article_comment (article_id,comment_parent_id,comment_id,comment_name,comment_image,content,create_id,create_date,status)" +
+                "values(:articleId,:commentParentId,:commentId,:commentName,:commentImage,:content,:createId,:createDate,:status) ";
+
+        sps.addValue("articleId", articleComment.getArticleId());
+        sps.addValue("commentParentId", articleComment.getCommentParentId());
+        sps.addValue("commentId", articleComment.getCommentId());
+        sps.addValue("commentName", articleComment.getCommentName());
+        sps.addValue("commentImage", articleComment.getCommentImage());
+        sps.addValue("content", articleComment.getContent());
+        sps.addValue("createId", articleComment.getCreateId());
+        sps.addValue("createDate", articleComment.getCreateDate());
+        sps.addValue("status", articleComment.getStatus());
+
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+
+    @Override
+    public UserCollect queryUserCollectNoLose(Integer authorId, Integer userId) {
+        String sql = "select * from user_collect\n" +
+                     "where parent_userid = :authorId and user_id = :userId ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("authorId", authorId);
+        sps.addValue("userId", userId);
+        List<UserCollect> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(UserCollect.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+
+    }
+
+    @Override
+    public int updateUserCollect(UserCollect userCollect) {
+        String sql ="";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        if(userCollect.getId() == null){
+            sql = "insert into user_collect (parent_userid,user_id,is_lose,create_id,create_date,status)" +
+                    "values(:parentUserid,:userId,:isLose,:createId,:createDate,:status) ";
+
+            sps.addValue("parentUserid", userCollect.getParentUserid());
+            sps.addValue("userId", userCollect.getUserId());
+            sps.addValue("isLose", userCollect.getIsLose());
+            sps.addValue("createId", userCollect.getCreateId());
+            sps.addValue("createDate", userCollect.getCreateDate());
+            sps.addValue("status", userCollect.getStatus());
+        }else{
+            sql = "update user_collect set is_lose = :isLose where id = :id";
+            sps.addValue("isLose", userCollect.getIsLose());
+            sps.addValue("id", userCollect.getId());
+        }
+
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    @Override
+    public ArticleLikes queryArticleLike(Integer articleId, Integer userId) {
+        String sql = "select * from article_likes\n" +
+                "where article_id = :articleId and like_id = :userId ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("articleId", articleId);
+        sps.addValue("userId", userId);
+        List<ArticleLikes> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(ArticleLikes.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+
+    }
+
+    @Override
+    public int updateArticleLike(ArticleLikes articleLikes) {
+        String sql ="";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        if(articleLikes.getId() == null){
+            sql = "insert into article_collect (article_id,like_id,like_name,like_image,is_lose,create_id,create_date,status)" +
+                    "values(:articleId,:likeId,:likeName,:likeImage,:isLose,:createId,:createDate,:status) ";
+
+            sps.addValue("articleId", articleLikes.getArticleId());
+            sps.addValue("likeId", articleLikes.getLikeId());
+            sps.addValue("likeName", articleLikes.getLikeName());
+            sps.addValue("likeImage", articleLikes.getLikeImage());
+            sps.addValue("isLose", articleLikes.getIsLose());
+            sps.addValue("createId", articleLikes.getCreateId());
+            sps.addValue("createDate", articleLikes.getCreateDate());
+            sps.addValue("status", articleLikes.getStatus());
+        }else{
+            sql = "update article_collect set is_lose = :isLose where id = :id";
+            sps.addValue("isLose", articleLikes.getIsLose());
+            sps.addValue("id", articleLikes.getId());
+        }
+
+        int num = 0;
+        try {
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+}

+ 29 - 0
mhotel/src/com/happy/dto/ArticleCommentDto.java

@@ -0,0 +1,29 @@
+package com.happy.dto;
+
+import lombok.Data;
+
+@Data
+public class ArticleCommentDto {
+    /**
+     * 文章ID
+     */
+    public Integer articleId;
+
+    /**
+     * 上级评论ID
+     * 上级没有评论就给个0过来
+     */
+    public Integer parentId;
+
+    /**
+     * 用户ID
+     */
+    public Integer userId;
+
+
+    /**
+     * 评论内容
+     */
+    public String content;
+
+}

+ 56 - 0
mhotel/src/com/happy/dto/ArticleTweetDto.java

@@ -0,0 +1,56 @@
+package com.happy.dto;
+
+import com.happy.Model.ArticleTweet;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ArticleTweetDto extends ArticleTweet {
+    /**
+     * 视频
+     */
+    public String video;
+
+    /**
+     * 图片集合
+     */
+    public List<String> images;
+
+    /**
+     * 民宿ID
+     */
+    public List<Integer> hotelIds;
+
+    /**
+     * 乡镇ID
+     */
+    public String townId;
+
+    /**
+     * 用户ID
+     */
+    public Integer userId;
+
+    /**
+     * 推文中用户主页下的推文列表状态查询
+     * 全部推文:0
+     * 审核中:1
+     * 驳回:2
+     */
+    /**
+     * 社区首页获取推文分页列表数据的状态
+     * 发现:0
+     * 关注:1
+     * 收藏:2
+     */
+    public Integer type;
+
+    /**
+     * 作者ID
+     */
+    public Integer authorId;
+
+}

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

@@ -0,0 +1,209 @@
+package com.happy.service;
+
+import com.happy.Model.*;
+import com.happy.dto.IPage;
+import com.happy.vo.*;
+
+import java.util.List;
+
+public interface ArticleTweetService {
+    /**
+     * 根据数据ID查询推文数据
+     *
+     * @param id
+     * @return
+     */
+    ArticleTweet queryArticleById(String id);
+
+    /**
+     * 新增推文数据
+     *
+     * @param articleTweet
+     * @return
+     */
+    int insert(ArticleTweet articleTweet);
+
+    /**
+     * 更新推文审批状态
+     *
+     * @param articleTweet
+     * @return
+     */
+    int updateArticleApprove(ArticleTweet articleTweet);
+
+    /**
+     * 批量新增推文附件
+     *
+     * @param articleFileInfos
+     * @return
+     */
+    int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos);
+
+    /**
+     * 描述:根据乡镇ID进行民宿分页查询
+     *
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<HotelVo> queryHotelPage(String sqlx, int page, int rows);
+
+    /**
+     * 描述:根据民宿ID查询民宿数据
+     *
+     * @param sqlx
+     * @return
+     */
+    List<HotelVo> queryHotels(String sqlx);
+
+    /**
+     * 描述:根据民宿ID查询民宿分页数据
+     *
+     * @param sqlx
+     * @return
+     */
+    IPage<HotelVo> queryHotelPageByHotleId(String sqlx, int page, int rows);
+
+    /**
+     * 查询推文文件方法
+     *
+     * @param sqlx
+     * @return
+     */
+    List<FileInfo> queryList(String sqlx);
+
+    /**
+     * 查询是否关注当前用户
+     *
+     * @param parentId
+     * @param userId
+     * @return
+     */
+    UserCollect queryUserCollect(Integer parentId, Integer userId);
+
+    /**
+     * 获取十条以内的点赞人列表数据
+     *
+     * @param articleId
+     * @return
+     */
+    List<LikeListVo> queryArticleLikes(Integer articleId);
+
+    /**
+     * 获取三条评论数据
+     *
+     * @param articleId
+     * @return
+     */
+    List<ArticleCommentVo> queryArticleComment(Integer articleId);
+
+    /**
+     * 根据文章ID获取评论总数
+     *
+     * @param articleId
+     * @return
+     */
+    int queryArticleCommentTotal(Integer articleId);
+
+    /**
+     * 根据文章ID获取一级评论分页数据
+     *
+     * @param articleId
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<ArticleCommentVo> queryCommentPageByArticle(Integer articleId, int page, int rows);
+
+    /**
+     * 根据文章ID获取子级评论数据
+     *
+     * @param articleId
+     * @return
+     */
+    List<ArticleCommentVo> queryCommentsByArticle(Integer articleId);
+
+    /**
+     * 获取主页用户信息
+     *
+     * @param userId
+     * @return
+     */
+    articleUserVo queryUserInfo(Integer userId);
+
+    /**
+     * 获取用户主页下的推文列表分页数据
+     *
+     * @param userId
+     * @param sqlWhere
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<OwnerArticleVo> queryOwnerArticlePage(Integer userId, String sqlWhere, int page, int rows);
+
+    /**
+     * 社区首页推文分页数据
+     * @param townId
+     * @param userId
+     * @param type
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<ArticleListVo> queryArticlesPage(String townId, Integer userId, Integer type, int page, int rows);
+
+    /**
+     * 获取文章收藏数据
+     * @param articleId
+     * @param userId
+     * @return
+     */
+    ArticleCollect queryArticleCollect(Integer articleId, Integer userId);
+
+    /**
+     * 收藏或取消收藏文章
+     * @param articleCollect
+     * @return
+     */
+    int updateArticleCollect(ArticleCollect articleCollect);
+
+    /**
+     * 评论文章
+     * @param articleComment
+     * @return
+     */
+    int insertArticleComment(ArticleComment articleComment);
+
+    /**
+     * 用户关注记录
+     * @param authorId
+     * @param userId
+     * @return
+     */
+    UserCollect queryUserCollectNoLose(Integer authorId, Integer userId);
+
+    /**
+     * 关注或取消关注
+     * @param userCollect
+     * @return
+     */
+    int updateUserCollect(UserCollect userCollect);
+
+
+    /**
+     * 查询用户点赞记录数据
+     * @param articleId
+     * @param userId
+     * @return
+     */
+    ArticleLikes queryArticleLike(Integer articleId, Integer userId);
+
+    /**
+     * 点赞文章
+     * @param articleLikes
+     * @return
+     */
+    int updateArticleLike(ArticleLikes articleLikes);
+}

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

@@ -0,0 +1,215 @@
+package com.happy.service.impl;
+
+import com.happy.Model.*;
+import com.happy.dao.ArticleTweetDao;
+import com.happy.dto.IPage;
+import com.happy.service.ArticleTweetService;
+import com.happy.vo.*;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("ArticleTweetService")
+public class ArticleTweetImplService implements ArticleTweetService {
+
+    @Resource
+    public ArticleTweetDao articleTweetDao;
+
+    @Override
+    public ArticleTweet queryArticleById(String id) {
+        ArticleTweet num = articleTweetDao.queryArticleById(id);
+        return num;
+    }
+
+    @Override
+    public int insert(ArticleTweet articleTweet) {
+        int num = articleTweetDao.insert(articleTweet);
+        return num;
+    }
+
+    @Override
+    public int updateArticleApprove(ArticleTweet articleTweet) {
+        int num = articleTweetDao.updateArticleApprove(articleTweet);
+        return num;
+    }
+
+    @Override
+    public int insertArticleFileBatch(List<ArticleFileInfo> articleFileInfos) {
+        int num = articleTweetDao.insertArticleFileBatch(articleFileInfos);
+        return num;
+    }
+
+    @Override
+    public IPage<HotelVo> queryHotelPage(String sqlx, int page, int rows) {
+        IPage<HotelVo> iPage = new IPage();
+        List<HotelVo> hotelList = articleTweetDao.queryHotelPage(sqlx, page, rows);
+        int total = articleTweetDao.queryHotelTotal(sqlx);
+        iPage.setPageList(hotelList);
+        iPage.setPage(page);
+        iPage.setTotalPage((int) Math.ceil((double) total / rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public List<HotelVo> queryHotels(String sqlx) {
+        List<HotelVo> hotels = articleTweetDao.queryHotels(sqlx);
+        return hotels;
+    }
+
+    @Override
+    public IPage<HotelVo> queryHotelPageByHotleId(String sqlx, int page, int rows) {
+        IPage<HotelVo> iPage = new IPage();
+        List<HotelVo> hotelList = articleTweetDao.queryHotelPageByHotleId(sqlx, page, rows);
+        int total = articleTweetDao.queryHotelTotalByHotleId(sqlx);
+        iPage.setPageList(hotelList);
+        iPage.setPage(page);
+        iPage.setTotalPage((int) Math.ceil((double) total / rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public List<FileInfo> queryList(String sqlx) {
+        List<FileInfo> result = articleTweetDao.queryList(sqlx);
+        return result;
+    }
+
+    @Override
+    public UserCollect queryUserCollect(Integer parentId, Integer userId) {
+        UserCollect result = articleTweetDao.queryUserCollect(parentId, userId);
+        return result;
+    }
+
+    @Override
+    public List<LikeListVo> queryArticleLikes(Integer articleId) {
+        List<LikeListVo> result = articleTweetDao.queryArticleLikes(articleId);
+        return result;
+    }
+
+    @Override
+    public List<ArticleCommentVo> queryArticleComment(Integer articleId) {
+        List<ArticleCommentVo> result = articleTweetDao.queryArticleComment(articleId);
+        return result;
+    }
+
+    @Override
+    public int queryArticleCommentTotal(Integer articleId) {
+        int result = articleTweetDao.queryArticleCommentTotal(articleId);
+        return result;
+    }
+
+    @Override
+    public IPage<ArticleCommentVo> queryCommentPageByArticle(Integer articleId, int page, int rows) {
+        IPage<ArticleCommentVo> iPage = new IPage();
+        List<ArticleCommentVo> commentList = articleTweetDao.queryCommentPageByArticle(articleId, page, rows);
+        int total = articleTweetDao.queryCommentTotalByArticle(articleId);
+        iPage.setPageList(commentList);
+        iPage.setPage(page);
+        iPage.setTotalPage((int) Math.ceil((double) total / rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public List<ArticleCommentVo> queryCommentsByArticle(Integer articleId) {
+        List<ArticleCommentVo> result = articleTweetDao.queryCommentsByArticle(articleId);
+        return result;
+    }
+
+    @Override
+    public articleUserVo queryUserInfo(Integer userId) {
+        articleUserVo result = articleTweetDao.queryUserInfo(userId);
+        return result;
+    }
+
+    @Override
+    public IPage<OwnerArticleVo> queryOwnerArticlePage(Integer userId, String sqlWhere, int page, int rows) {
+        IPage<OwnerArticleVo> iPage = new IPage();
+        List<OwnerArticleVo> commentList = articleTweetDao.queryOwnerArticlePage(userId, sqlWhere, page, rows);
+        int total = articleTweetDao.queryOwnerArticleTotal(userId, sqlWhere);
+        iPage.setPageList(commentList);
+        iPage.setPage(page);
+        iPage.setTotalPage((int) Math.ceil((double) total / rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public IPage<ArticleListVo> queryArticlesPage(String townId, Integer userId, Integer type, int page, int rows) {
+        IPage<ArticleListVo> iPage = new IPage();
+        List<ArticleListVo> commentList = articleTweetDao.queryArticlesPage(townId, userId, type, page, rows);
+        int total = articleTweetDao.queryArticlesTotal(townId, userId, type);
+        iPage.setPageList(commentList);
+        iPage.setPage(page);
+        iPage.setTotalPage((int) Math.ceil((double) total / rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public ArticleCollect queryArticleCollect(Integer articleId, Integer userId) {
+        ArticleCollect result = articleTweetDao.queryArticleCollect(articleId, userId);
+        return result;
+    }
+
+    @Override
+    public int updateArticleCollect(ArticleCollect articleCollect){
+        int result = articleTweetDao.updateArticleCollect(articleCollect);
+        return result;
+    };
+
+    @Override
+    public int insertArticleComment(ArticleComment articleComment){
+        int result = articleTweetDao.insertArticleComment(articleComment);
+        return result;
+    }
+
+    /**
+     * 查询用户关注记录数据
+     * @param authorId
+     * @param userId
+     * @return
+     */
+    public UserCollect queryUserCollectNoLose(Integer authorId, Integer userId){
+        UserCollect result = articleTweetDao.queryUserCollectNoLose(authorId, userId);
+        return result;
+    }
+
+    /**
+     * 关注或取消关注操作
+     * @param userCollect
+     * @return
+     */
+    public int updateUserCollect(UserCollect userCollect){
+        int result = articleTweetDao.updateUserCollect(userCollect);
+        return result;
+    }
+
+    /**
+     * 查询用户点赞记录数据
+     * @param articleId
+     * @param userId
+     * @return
+     */
+    public ArticleLikes queryArticleLike(Integer articleId, Integer userId){
+        ArticleLikes result = articleTweetDao.queryArticleLike(articleId, userId);
+        return result;
+    }
+
+    /**
+     * 点赞文章
+     * @param articleLikes
+     * @return
+     */
+    public int updateArticleLike(ArticleLikes articleLikes){
+        int num = articleTweetDao.updateArticleLike(articleLikes);
+        return num;
+    }
+}

+ 1 - 1
mhotel/src/com/happy/service/impl/WorkflowImplService.java

@@ -51,7 +51,7 @@ public class WorkflowImplService implements WorkflowService {
                     fileInfoList = fileDao.queryList("and link_id = '"+workflow.getLinkId()+"'");
                     fileInfoList = fileDao.queryList("and link_id = '"+workflow.getLinkId()+"'");
                 }
                 }
                 //region
                 //region
-                //2023-10-11 A-jax添加推文流程数据获取逻辑
+                //2023-10-11 A-jax????????????
                 else if(workflow.getType() == 3){
                 else if(workflow.getType() == 3){
                     fileInfoList = articleTweetDao.queryList("and link_id = '"+workflow.getLinkId()+"'");
                     fileInfoList = articleTweetDao.queryList("and link_id = '"+workflow.getLinkId()+"'");
                 }
                 }

+ 54 - 0
mhotel/src/com/happy/vo/ArticleCommentVo.java

@@ -0,0 +1,54 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/11 星期三 17:09
+ * @Description: com.happy.vo
+ * @Version: 1.0
+ */
+@Data
+public class ArticleCommentVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 父级ID
+     */
+    private Integer parentId;
+
+    /**
+     * 评论人ID
+     */
+    private Integer userId;
+
+    /**
+     * 评论人姓名
+     */
+    private String userName;
+
+    /**
+     * 评论人头像
+     */
+    private String image;
+
+    /**
+     * 评论内容
+     */
+    private String content;
+
+    /**
+     * 日期
+     */
+    private String date;
+
+    /**
+     * 评论子级数据
+     */
+    private List<ArticleCommentVo> childrens;
+}

+ 106 - 0
mhotel/src/com/happy/vo/ArticleDetailVo.java

@@ -0,0 +1,106 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ArticleDetailVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 图片集合
+     */
+    private List<String> images;
+
+    /**
+     * 视频
+     */
+    private String video;
+
+    /**
+     * 发布人ID
+     */
+    private Integer userId;
+
+    /**
+     * 发布人名称
+     */
+    private String userName;
+
+    /**
+     * 是否关注
+     * 未关注:0
+     * 已关注:1
+     * 自己的推文:2
+     */
+    private Integer isFollow;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 推文发布日期
+     */
+    private String dateStr;
+
+    /**
+     * 乡镇ID
+     */
+    private String townId;
+
+    /**
+     * 乡镇名称
+     */
+    private String townName;
+
+    /**
+     * 民宿集合数据
+     * 显示勾选的民宿
+     * 然后收藏的显示勾选状态
+     */
+    private List<HotelListVo> hotels;
+
+    /**
+     * 粗略点赞数据
+     */
+    private List<String> likes;
+
+    /**
+     * 点赞人数
+     */
+    private Integer likeNum;
+
+    /**
+     * 评论集合数据
+     */
+    private List<ArticleCommentVo> comments;
+
+    /**
+     * 评论数
+     * 张总说:包含所有子级评论
+     */
+    private Integer commentNum;
+
+    /**
+     * 相关推文
+     * 做个分页接口给出去
+     * 展示该乡镇地址下的相关文章数据
+     */
+    //List<ArticleListVo>
+
+    /**
+     * 文章收藏数
+     */
+    private Integer collectNum;
+}

+ 65 - 0
mhotel/src/com/happy/vo/ArticleListVo.java

@@ -0,0 +1,65 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/12 星期四 10:45
+ * @Description: com.happy.vo
+ * @Version: 1.0
+ */
+@Data
+public class ArticleListVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 图片
+     */
+    private String image;
+
+    /**
+     * 视频
+     */
+    private String video;
+
+    /**
+     * 乡镇ID
+     */
+    private Integer townId;
+
+    /**
+     * 乡镇名称
+     */
+    private String townName;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+
+    /**
+     * 用户名称
+     */
+    private String userName;
+
+    /**
+     * 是否收藏
+     * 未收藏:0
+     * 已收藏:1
+     */
+    private Integer isCollect;
+
+    /**
+     * 收藏数
+     */
+    private Integer collectNum;
+
+}

+ 54 - 0
mhotel/src/com/happy/vo/HotelListVo.java

@@ -0,0 +1,54 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class HotelListVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 民宿名称
+     */
+    private String name;
+
+    /**
+     * 民宿分数
+     */
+    private Double score;
+
+    /**
+     * 图片
+     */
+    private String coverImg;
+
+    /**
+     * 评论数
+     */
+    private Integer comment;
+
+    /**
+     * 是否收藏
+     * 未收藏:0
+     * 已收藏:1
+     */
+    private Integer isCollect;
+
+    /**
+     * 级别
+     * 1.银宿级
+     * 2.金宿级
+     * 3.白金级
+     */
+    private Integer type;
+
+    /**
+     * 价格
+     */
+    private String price;
+
+}

+ 42 - 0
mhotel/src/com/happy/vo/HotelVo.java

@@ -0,0 +1,42 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/10 星期二 10:33
+ * @Description: com.happy.vo
+ * @Version: 1.0
+ */
+@Data
+public class HotelVo {
+    //数据ID
+    private Integer id;
+
+    //民宿名称
+    private String name;
+
+    //民宿分数
+    private Double score;
+
+    //图片
+    private String coverImg;
+
+    /**
+     * 级别
+     * 1.银宿级
+     * 2.金宿级
+     * 3.白金级
+     */
+    private Integer type;
+
+    /**
+     * 评论数
+     */
+    private Integer comment;
+
+    /**
+     * 商户ID
+     */
+    private Integer managerId;
+}

+ 34 - 0
mhotel/src/com/happy/vo/LikeListVo.java

@@ -0,0 +1,34 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class LikeListVo {
+    /**
+     * 用户ID
+     */
+    private Integer id;
+
+    /**
+     * 用户头像
+     */
+    private String image;
+
+    /**
+     * 用户名称
+     */
+    private String name;
+
+    /**
+     * 推文数
+     */
+    private String articleNumber;
+
+    /**
+     * 粉丝数
+     */
+    private String fansNumber;
+
+}

+ 67 - 0
mhotel/src/com/happy/vo/OwnerArticleVo.java

@@ -0,0 +1,67 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/12 星期四 14:14
+ * @Description: com.happy.vo
+ * @Version: 1.0
+ */
+@Data
+public class OwnerArticleVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 图片集合
+     */
+    private List<String> images;
+
+    /**
+     * 视频
+     */
+    private String video;
+
+    /**
+     * 标题
+     */
+    private String title;
+
+    /**
+     * 日期
+     */
+    private String date;
+
+    /**
+     * 乡镇ID
+     */
+    private Integer townId;
+
+    /**
+     * 乡镇名称
+     */
+    private String townName;
+
+    /**
+     * 审核状态
+     * 正在审批:1
+     * 审批通过:2
+     * 拒绝:3
+     */
+    private Integer approve;
+
+    /**
+     * 点赞数
+     */
+    private Integer likeNum;
+
+    /**
+     * 评论数
+     */
+    private Integer commentNum;
+}

+ 18 - 0
mhotel/src/com/happy/vo/TownshipVo.java

@@ -0,0 +1,18 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/10 星期二 10:33
+ * @Description: com.happy.vo
+ * @Version: 1.0
+ */
+@Data
+public class TownshipVo {
+    //数据ID
+    private Integer id;
+
+    //乡镇名称
+    private String name;
+}

+ 47 - 0
mhotel/src/com/happy/vo/articleUserVo.java

@@ -0,0 +1,47 @@
+package com.happy.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/10/12 星期四 14:03
+ * @Description: com.happy.vo
+ * @Version: 1.0
+ */
+@Data
+public class articleUserVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 头像
+     */
+    private String image;
+
+    /**
+     * 用户名称
+     */
+    private String userName;
+
+    /**
+     * 简介
+     */
+    private String descript;
+
+    /**
+     * 粉丝数
+     */
+    private Integer fansNum;
+
+    /**
+     * 关注数
+     */
+    private Integer followNum;
+
+    /**
+     * 获赞数
+     */
+    private Integer likeNum;
+}