Sfoglia il codice sorgente

物业管理端评论

tjf 3 mesi fa
parent
commit
9064daf6d4
16 ha cambiato i file con 93 aggiunte e 43 eliminazioni
  1. 10 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/residentInfo/ResidentInfoController.java
  2. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/staffTrain/StaffTrainManualController.java
  3. 1 1
      ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
  4. 26 19
      ruoyi-system/src/main/java/com/ruoyi/system/domain/complaintSuggestion/ComplaintSuggestion.java
  5. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/ResidentInfoMapper.java
  6. 1 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IResidentInfoService.java
  7. 0 3
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentIndexServiceImpl.java
  8. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ComplaintSuggestionServiceImpl.java
  9. 5 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ResidentInfoServiceImpl.java
  10. 32 15
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StaffTrainManualServiceImpl.java
  11. 2 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StaffTrainTimeServiceImpl.java
  12. 1 1
      ruoyi-system/src/main/resources/mapper/system/CommentLikesMapper.xml
  13. 1 0
      ruoyi-system/src/main/resources/mapper/system/CommentStarsMapper.xml
  14. 6 2
      ruoyi-system/src/main/resources/mapper/system/ComplaintSuggestionMapper.xml
  15. 3 0
      ruoyi-system/src/main/resources/mapper/system/ResidentInfoMapper.xml
  16. 0 1
      ruoyi-system/src/main/resources/mapper/system/StaffTrainTimeMapper.xml

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/residentInfo/ResidentInfoController.java

@@ -38,6 +38,16 @@ public class ResidentInfoController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询居住人员党员信息
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:residentInfo:count')")
+    @GetMapping("/count")
+    public AjaxResult count(ResidentInfo residentInfo) {
+        return residentInfoService.selectCount(residentInfo);
+
+    }
+
     /**
      * 导出居住人员信息,存储居住人员的详细信息列表
      */

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/staffTrain/StaffTrainManualController.java

@@ -66,7 +66,7 @@ public class StaffTrainManualController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('wuYe:manual:getRead')")
     @PostMapping(value = "/getRead")
-    public AjaxResult getRead(StaffTrainManual staffTrainManual) {
+    public AjaxResult getRead(@RequestBody StaffTrainManual staffTrainManual) {
         return staffTrainManualService.getRead(staffTrainManual);
     }
 

+ 1 - 1
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java

@@ -42,7 +42,7 @@ public class CacheConstants
      */
     public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
     /**
-     * 员工培训手册阅读人员名单 redis key
+     * 员工培训手册阅读人员名单 redis key=read_train:manualId value = [userId+":"+员工姓名]
      */
     public static final String READ_TRAIN = "read_train:";
     /**

+ 26 - 19
ruoyi-system/src/main/java/com/ruoyi/system/domain/complaintSuggestion/ComplaintSuggestion.java

@@ -4,8 +4,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.system.domain.suggestionFj.SuggestionFj;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.util.Date;
 import java.util.List;
@@ -22,6 +20,10 @@ public class ComplaintSuggestion extends BaseEntity
 
     /** 投诉建议ID */
     private Long suggestionId;
+    /**
+     * 用户id
+     */
+    private Long userId;
 
     /** 投诉建议标题,简要描述投诉或建议内容 */
     @Excel(name = "投诉建议标题,简要描述投诉或建议内容")
@@ -63,6 +65,14 @@ public class ComplaintSuggestion extends BaseEntity
      */
     private List<SuggestionFj> suggestionFjList;
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     public List<SuggestionFj> getSuggestionFjList() {
         return suggestionFjList;
     }
@@ -164,22 +174,19 @@ public class ComplaintSuggestion extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("suggestionId", getSuggestionId())
-            .append("title", getTitle())
-            .append("content", getContent())
-            .append("images", getImages())
-            .append("createdTime", getCreatedTime())
-            .append("status", getStatus())
-            .append("replyContent", getReplyContent())
-            .append("type", getType())
-            .append("isPublic", getIsPublic())
-            .append("isDel", getIsDel())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "ComplaintSuggestion{" +
+                "suggestionId=" + suggestionId +
+                ", userId=" + userId +
+                ", title='" + title + '\'' +
+                ", content='" + content + '\'' +
+                ", images='" + images + '\'' +
+                ", createdTime=" + createdTime +
+                ", status='" + status + '\'' +
+                ", replyContent='" + replyContent + '\'' +
+                ", type='" + type + '\'' +
+                ", isPublic='" + isPublic + '\'' +
+                ", isDel='" + isDel + '\'' +
+                ", suggestionFjList=" + suggestionFjList +
+                '}';
     }
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ResidentInfoMapper.java

@@ -29,6 +29,8 @@ public interface ResidentInfoMapper
      */
     public List<ResidentInfo> selectResidentInfoList(ResidentInfo residentInfo);
 
+    public int selectCount(ResidentInfo residentInfo);
+
     /**
      * 新增居住人员信息,存储居住人员的详细信息
      * 

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IResidentInfoService.java

@@ -29,6 +29,7 @@ public interface IResidentInfoService
      * @return 居住人员信息,存储居住人员的详细信息集合
      */
     public List<ResidentInfo> selectResidentInfoList(ResidentInfo residentInfo);
+    public AjaxResult selectCount(ResidentInfo residentInfo);
 
     /**
      * 新增居住人员信息,存储居住人员的详细信息

+ 0 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentIndexServiceImpl.java

@@ -14,7 +14,6 @@ import com.ruoyi.system.mapper.CommentContentMapper;
 import com.ruoyi.system.mapper.CommentIndexMapper;
 import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommentIndexService;
-import com.ruoyi.system.service.ICommunityNewsService;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -38,8 +37,6 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
     @Autowired
     private CommentContentMapper commentContentMapper;
     @Resource
-    private ICommunityNewsService iCommunityNewsService;
-    @Resource
     private CommunityNewsMapper communityNewsMapper;
 
     @Resource

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ComplaintSuggestionServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.system.service.impl;
 
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.complaintSuggestion.ComplaintSuggestion;
 import com.ruoyi.system.domain.suggestionFj.SuggestionFj;
 import com.ruoyi.system.mapper.ComplaintSuggestionMapper;
@@ -67,6 +68,7 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
     public int insertComplaintSuggestion(ComplaintSuggestion complaintSuggestion)
     {
         complaintSuggestion.setCreateTime(DateUtils.getNowDate());
+        complaintSuggestion.setUserId(SecurityUtils.getUserId());
         return complaintSuggestionMapper.insertComplaintSuggestion(complaintSuggestion);
     }
 

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ResidentInfoServiceImpl.java

@@ -58,6 +58,11 @@ public class ResidentInfoServiceImpl implements IResidentInfoService
         return residentInfoMapper.selectResidentInfoList(residentInfo);
     }
 
+    @Override
+    public AjaxResult selectCount(ResidentInfo residentInfo) {
+        return AjaxResult.success(residentInfoMapper.selectCount(residentInfo));
+    }
+
     /**
      * 新增居住人员信息,存储居住人员的详细信息
      * 

+ 32 - 15
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StaffTrainManualServiceImpl.java

@@ -52,22 +52,37 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
         if (staffManage != null) {
             staffName = staffManage.getStaffName();
         }
+        //组装value值
+        String value = SecurityUtils.getUserId() + ":" + staffName;
         if (valueList != null && valueList.size() > 0) {
-            //组装value值
-            String value = SecurityUtils.getUserId() + ":" + staffName;
             //如果value不重复则新增
             if (!valueList.contains(value)) {
                 //阅读名单存储到redis key = read_train:manualId value = userId+":"+员工姓名
                 valueList.add(value);
+                redisCache.deleteObject(READ_TRAIN + manualId);
                 redisCache.setCacheList(READ_TRAIN + manualId, valueList);
                 //新增阅读时间
                 //key = read_train_time:manualId:userId
                 redisCache.setCacheObject(READ_TRAIN_TIME + manualId + ":" + SecurityUtils.getUserId(), DateUtils.getTime());
+            }else {
+                //更新阅读时间
+                //key = read_train_time:manualId:userId
+                redisCache.setCacheObject(READ_TRAIN_TIME + manualId + ":" + SecurityUtils.getUserId(), DateUtils.getTime());
             }
+        }else {
+            //新增第一个阅读人员
+            List<String> stringList = new ArrayList<>();
+            stringList.add(value);
+            redisCache.setCacheList(READ_TRAIN + manualId, stringList);
+            //key = read_train_time:manualId:userId
+            redisCache.setCacheObject(READ_TRAIN_TIME + manualId + ":" + SecurityUtils.getUserId(), DateUtils.getTime());
         }
-        return staffTrainManualMapper.selectStaffTrainManualByManualId(manualId);
+        StaffTrainManual staffTrainManual = staffTrainManualMapper.selectStaffTrainManualByManualId(manualId);
+        Long viewCount = staffTrainManual.getViewCount();
+        staffTrainManual.setViewCount(viewCount+1);
+        staffTrainManualMapper.updateStaffTrainManual(staffTrainManual);
+        return staffTrainManual;
     }
-
     /**
      * 查询员工培训手册列表
      *
@@ -132,7 +147,8 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
     public AjaxResult getRead(StaffTrainManual staffTrainManual) {
         //定义返回值
         List<Map<String, String>> resultList = new ArrayList<>();
-        String searchValue = staffTrainManual.getSearchValue();
+        //String searchValue = staffTrainManual.getSearchValue();
+        String author = staffTrainManual.getAuthor();
         Date searchTime = staffTrainManual.getCreateTime();
         Long manualId = staffTrainManual.getManualId();
 
@@ -142,16 +158,16 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
             for (String value : valueList) {
                 String[] split = value.split(":");
                 //key = read_train:manualId:userId
-                String readTime = redisCache.getCacheObject(READ_TRAIN_TIME + ":" + manualId + ":" + split[0]);
+                String readTime = redisCache.getCacheObject(READ_TRAIN_TIME  + manualId + ":" + split[0]);
                 Map<String, String> map = new HashMap<>(2);
-                if (StringUtils.isBlank(searchValue) && searchTime == null) {
+                if (StringUtils.isBlank(author) && searchTime == null) {
                     map.put("name", split[1]);
                     //key = read_train:manualId:userId
                     map.put("time", readTime);
                     resultList.add(map);
                 }
                 //如果搜索姓名不为空
-                else if (StringUtils.isNotBlank(searchValue)) {
+                else if (StringUtils.isNotBlank(author)) {
                     //如果搜索日期不为空
                     if (searchTime != null) {
                         // 创建日期格式化对象
@@ -162,14 +178,14 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
                         LocalDate date = dateTime.toLocalDate();
                         String formattedDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                         //split[1] = 员工姓名
-                        if (searchValue.equals(split[1]) && sdf.format(searchTime).equals(formattedDate)) {
+                        if (split[1].contains(author) && sdf.format(searchTime).equals(formattedDate)) {
                             map.put("name", split[1]);
                             map.put("time", readTime);
                             resultList.add(map);
                         }
                     } else {
                         //搜索日期为空
-                        if (searchValue.equals(split[1])) {
+                        if (split[1].contains(author)) {
                             map.put("name", split[1]);
                             map.put("time", readTime);
                             resultList.add(map);
@@ -183,8 +199,8 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
                     // 构造仅包含年月日的新时间字符串
                     LocalDate date = dateTime.toLocalDate();
                     String formattedDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                    if (StringUtils.isNotBlank(searchValue)) {
-                        if (searchValue.equals(split[1]) && sdf.format(searchTime).equals(formattedDate)) {
+                    if (StringUtils.isNotBlank(author)) {
+                        if (author.equals(split[1]) && sdf.format(searchTime).equals(formattedDate)) {
                             map.put("name", split[1]);
                             map.put("time", readTime);
                             resultList.add(map);
@@ -196,10 +212,11 @@ public class StaffTrainManualServiceImpl implements IStaffTrainManualService {
                             resultList.add(map);
                         }
                     }
+                }else {
+                    map.put("name", split[1]);
+                    map.put("time", readTime);
+                    resultList.add(map);
                 }
-                map.put("name", split[1]);
-                map.put("time", readTime);
-                resultList.add(map);
             }
         }
         return AjaxResult.success(resultList);

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StaffTrainTimeServiceImpl.java

@@ -65,6 +65,8 @@ public class StaffTrainTimeServiceImpl implements IStaffTrainTimeService {
             int staffTime = staffTrainTimes.get(0).getStaffTime();
             //更新阅读时长
             staffTrainTime.setStaffTime(staffTime + staffTrainTime.getStaffTime());
+            Long trainTimeId = staffTrainTimes.get(0).getTrainTimeId();
+            staffTrainTime.setTrainTimeId(trainTimeId);
             return staffTrainTimeMapper.updateStaffTrainTime(staffTrainTime);
         }
         StaffManage staffManage = SecurityUtils.getLoginUser().getStaffManage();

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/CommentLikesMapper.xml

@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCommentLikesList" parameterType="CommentLikes" resultMap="CommentLikesResult">
         <include refid="selectCommentLikesVo"/>
         <where>
-            del_flag = 'Y'
+            del_flag = 'N'
             <if test="targetId != null "> and target_id = #{targetId}</if>
             <if test="targetType != null  and targetType != ''"> and target_type = #{targetType}</if>
             <if test="userId != null "> and user_id = #{userId}</if>

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/CommentStarsMapper.xml

@@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCommentStarsList" parameterType="CommentStars" resultMap="CommentStarsResult">
         <include refid="selectCommentStarsVo"/>
         <where>
+            and del_flag = 'N'
             <if test="targetId != null "> and target_id = #{targetId}</if>
             <if test="targetType != null  and targetType != ''"> and target_type = #{targetType}</if>
             <if test="targetTitle != null  and targetTitle != ''"> and target_title = #{targetTitle}</if>

+ 6 - 2
ruoyi-system/src/main/resources/mapper/system/ComplaintSuggestionMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="replyContent"    column="reply_content"    />
         <result property="type"    column="type"    />
         <result property="isPublic"    column="is_public"    />
+        <result property="userId"    column="user_id"    />
         <result property="isDel"    column="is_del"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
@@ -23,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectComplaintSuggestionVo">
-        select suggestion_id, title, content, images, created_time, status, reply_content, type, is_public, is_del, create_by, create_time, update_by, update_time, remark from complaint_suggestion
+        select suggestion_id, title, content, images, created_time, status, reply_content, type, is_public, user_id, is_del, create_by, create_time, update_by, update_time, remark from complaint_suggestion
     </sql>
 
     <select id="selectComplaintSuggestionList" parameterType="ComplaintSuggestion" resultMap="ComplaintSuggestionResult">
@@ -37,8 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="replyContent != null  and replyContent != ''"> and reply_content = #{replyContent}</if>
             <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="isPublic != null  and isPublic != ''"> and is_public = #{isPublic}</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
             <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
-            <if test="params.createTime != null  and params.createTime != ''"> AND date_format(create_time,'%Y%m%d') = date_format(#{params.createTime},'%Y%m%d')</if>
         </where>
     </select>
     
@@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="replyContent != null">reply_content,</if>
             <if test="type != null">type,</if>
             <if test="isPublic != null">is_public,</if>
+            <if test="userId != null">user_id,</if>
             <if test="isDel != null">is_del,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
@@ -74,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="replyContent != null">#{replyContent},</if>
             <if test="type != null">#{type},</if>
             <if test="isPublic != null">#{isPublic},</if>
+            <if test="userId != null">#{userId},</if>
             <if test="isDel != null">#{isDel},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -94,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="replyContent != null">reply_content = #{replyContent},</if>
             <if test="type != null">type = #{type},</if>
             <if test="isPublic != null">is_public = #{isPublic},</if>
+            <if test="userId != null">user_id = #{userId},</if>
             <if test="isDel != null">is_del = #{isDel},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/ResidentInfoMapper.xml

@@ -69,6 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectResidentInfoVo"/>
         where user_id = #{userId}
     </select>
+    <select id="selectCount" parameterType="ResidentInfo" resultType="java.lang.Integer">
+        select count(1) from resident_info where resident_appearance = #{residentAppearance}
+    </select>
 
 
     <insert id="insertResidentInfoList">

+ 0 - 1
ruoyi-system/src/main/resources/mapper/system/StaffTrainTimeMapper.xml

@@ -29,7 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="staffName != null  and staffName != ''"> and staff_name like concat('%', #{staffName}, '%')</if>
             <if test="userId != null "> and user_id = #{userId}</if>
             <if test="manualId != null "> and manual_id = #{manualId}</if>
-            <if test="staffTime != null  and staffTime != ''"> and staff_time = #{staffTime}</if>
         </where>
     </select>