Quellcode durchsuchen

Merge branch 'dev' of http://94.191.59.107:3000/wukai/lzga-doc into dev

yxc vor 2 Jahren
Ursprung
Commit
52cac4811b

+ 21 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocShareController.java

@@ -5,6 +5,7 @@ import java.io.IOException;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
+import com.jjt.common.security.utils.SecurityUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -36,6 +37,26 @@ public class DocShareController extends BaseController {
     private IDocShareService docShareService;
 
     /**
+     * 最
+     */
+    @GetMapping("/send")
+    public TableDataInfo send() {
+        startPage();
+        List<DocShare> list = docShareService.selectDocShareSend(SecurityUtils.getUserId());
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询文档分享列表
+     */
+    @GetMapping("/receive")
+    public TableDataInfo receive() {
+        startPage();
+        List<DocShare> list = docShareService.selectDocShareReceive(SecurityUtils.getUserId());
+        return getDataTable(list);
+    }
+
+    /**
      * 查询文档分享列表
      */
     @GetMapping("/list")

+ 83 - 40
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocShare.java

@@ -1,5 +1,6 @@
 package com.jjt.doc.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -9,94 +10,136 @@ import com.jjt.common.core.web.domain.BaseEntity;
 
 /**
  * 文档分享对象 doc_share
- * 
+ *
  * @author wukai
  * @date 2023-04-26
  */
-public class DocShare extends BaseEntity
-{
+public class DocShare extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 文档ID */
+    /**
+     * 文档ID
+     */
     @Excel(name = "文档ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long docId;
 
-    /** 文档年份 */
+    /**
+     * 文档年份
+     */
     @Excel(name = "文档年份")
     private Long docYear;
 
-    /** 是否机密;1.机密  非1.一般 */
+    /**
+     * 是否机密;1.机密  非1.一般
+     */
     @Excel(name = "是否机密;1.机密  非1.一般")
     private String isSecret;
 
-    /** 是否一次性;1.是 非1.否 */
+    /**
+     * 是否一次性;1.是 非1.否
+     */
     @Excel(name = "是否一次性;1.是 非1.否")
     private String onlyOneTime;
 
-    /** 逻辑删除标志;1/非1 */
+    /**
+     * 逻辑删除标志;1/非1
+     */
     @Excel(name = "逻辑删除标志;1/非1")
     private String isDel;
+    /**
+     * 文档名称
+     */
+    @TableField(exist = false)
+    private String docName;
+    /**
+     * 文档类型
+     */
+    @TableField(exist = false)
+    private String docType;
+    /**
+     * 文档类型
+     */
+    @TableField(exist = false)
+    private String docPath;
 
-    public void setDocId(Long docId) 
-    {
+    public String getDocType() {
+        return docType;
+    }
+
+    public void setDocType(String docType) {
+        this.docType = docType;
+    }
+
+    public String getDocPath() {
+        return docPath;
+    }
+
+    public void setDocPath(String docPath) {
+        this.docPath = docPath;
+    }
+
+    public String getDocName() {
+        return docName;
+    }
+
+    public void setDocName(String docName) {
+        this.docName = docName;
+    }
+
+    public void setDocId(Long docId) {
         this.docId = docId;
     }
 
-    public Long getDocId() 
-    {
+    public Long getDocId() {
         return docId;
     }
-    public void setDocYear(Long docYear) 
-    {
+
+    public void setDocYear(Long docYear) {
         this.docYear = docYear;
     }
 
-    public Long getDocYear() 
-    {
+    public Long getDocYear() {
         return docYear;
     }
-    public void setIsSecret(String isSecret) 
-    {
+
+    public void setIsSecret(String isSecret) {
         this.isSecret = isSecret;
     }
 
-    public String getIsSecret() 
-    {
+    public String getIsSecret() {
         return isSecret;
     }
-    public void setOnlyOneTime(String onlyOneTime) 
-    {
+
+    public void setOnlyOneTime(String onlyOneTime) {
         this.onlyOneTime = onlyOneTime;
     }
 
-    public String getOnlyOneTime() 
-    {
+    public String getOnlyOneTime() {
         return onlyOneTime;
     }
-    public void setIsDel(String isDel) 
-    {
+
+    public void setIsDel(String isDel) {
         this.isDel = isDel;
     }
 
-    public String getIsDel() 
-    {
+    public String getIsDel() {
         return isDel;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("docId", getDocId())
-            .append("docYear", getDocYear())
-            .append("isSecret", getIsSecret())
-            .append("onlyOneTime", getOnlyOneTime())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .append("isDel", getIsDel())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("docId", getDocId())
+                .append("docYear", getDocYear())
+                .append("isSecret", getIsSecret())
+                .append("onlyOneTime", getOnlyOneTime())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .append("isDel", getIsDel())
+                .toString();
     }
 }

+ 15 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocShareAccepter.java

@@ -8,6 +8,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 import com.jjt.common.core.annotation.Excel;
 import com.jjt.common.core.web.domain.BaseEntity;
 
+import java.util.Date;
+
 /**
  * 文档分享接收人对象 doc_share_accepter
  *
@@ -56,6 +58,10 @@ public class DocShareAccepter extends BaseEntity {
      */
     @TableField(exist = false)
     private String phonenumber;
+    /**
+     * 分享时间
+     */
+    private Date shareTime;
 
     /**
      * 帐号状态(0正常 1停用)
@@ -63,6 +69,15 @@ public class DocShareAccepter extends BaseEntity {
     @TableField(exist = false)
     private String status;
 
+
+    public Date getShareTime() {
+        return shareTime;
+    }
+
+    public void setShareTime(Date shareTime) {
+        this.shareTime = shareTime;
+    }
+
     public String getUserName() {
         return userName;
     }

+ 25 - 9
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocShareMapper.java

@@ -1,19 +1,19 @@
 package com.jjt.doc.mapper;
 
 import java.util.List;
+
 import com.jjt.doc.domain.DocShare;
 
 /**
  * 文档分享Mapper接口
- * 
+ *
  * @author wukai
  * @date 2023-04-26
  */
-public interface DocShareMapper 
-{
+public interface DocShareMapper {
     /**
      * 查询文档分享
-     * 
+     *
      * @param docId 文档分享主键
      * @return 文档分享
      */
@@ -21,7 +21,7 @@ public interface DocShareMapper
 
     /**
      * 查询文档分享列表
-     * 
+     *
      * @param docShare 文档分享
      * @return 文档分享集合
      */
@@ -29,7 +29,7 @@ public interface DocShareMapper
 
     /**
      * 新增文档分享
-     * 
+     *
      * @param docShare 文档分享
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface DocShareMapper
 
     /**
      * 修改文档分享
-     * 
+     *
      * @param docShare 文档分享
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface DocShareMapper
 
     /**
      * 删除文档分享
-     * 
+     *
      * @param docId 文档分享主键
      * @return 结果
      */
@@ -53,9 +53,25 @@ public interface DocShareMapper
 
     /**
      * 批量删除文档分享
-     * 
+     *
      * @param docIds 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteDocShareByDocIds(Long[] docIds);
+
+    /**
+     * 最近发送文件
+     *
+     * @param uid 用户ID
+     * @return
+     */
+    List<DocShare> selectDocShareSend(Long uid);
+
+    /**
+     * 最近接收文件
+     *
+     * @param uid 用户ID
+     * @return
+     */
+    List<DocShare> selectDocShareReceive(Long uid);
 }

+ 25 - 9
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocShareService.java

@@ -1,19 +1,19 @@
 package com.jjt.doc.service;
 
 import java.util.List;
+
 import com.jjt.doc.domain.DocShare;
 
 /**
  * 文档分享Service接口
- * 
+ *
  * @author wukai
  * @date 2023-04-26
  */
-public interface IDocShareService 
-{
+public interface IDocShareService {
     /**
      * 查询文档分享
-     * 
+     *
      * @param docId 文档分享主键
      * @return 文档分享
      */
@@ -21,7 +21,7 @@ public interface IDocShareService
 
     /**
      * 查询文档分享列表
-     * 
+     *
      * @param docShare 文档分享
      * @return 文档分享集合
      */
@@ -29,7 +29,7 @@ public interface IDocShareService
 
     /**
      * 新增文档分享
-     * 
+     *
      * @param docShare 文档分享
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface IDocShareService
 
     /**
      * 修改文档分享
-     * 
+     *
      * @param docShare 文档分享
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface IDocShareService
 
     /**
      * 批量删除文档分享
-     * 
+     *
      * @param docIds 需要删除的文档分享主键集合
      * @return 结果
      */
@@ -53,9 +53,25 @@ public interface IDocShareService
 
     /**
      * 删除文档分享信息
-     * 
+     *
      * @param docId 文档分享主键
      * @return 结果
      */
     public int deleteDocShareByDocId(Long docId);
+
+    /**
+     * 最近发送文件
+     *
+     * @param uid 用户ID
+     * @return
+     */
+    List<DocShare> selectDocShareSend(Long uid);
+
+    /**
+     * 最近接收文件
+     *
+     * @param uid 用户ID
+     * @return
+     */
+    List<DocShare> selectDocShareReceive(Long uid);
 }

+ 4 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocShareAccepterServiceImpl.java

@@ -1,8 +1,10 @@
 package com.jjt.doc.service.impl;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
+import com.jjt.common.core.utils.DateUtils;
 import org.springframework.stereotype.Service;
 import com.jjt.doc.mapper.DocShareAccepterMapper;
 import com.jjt.doc.domain.DocShareAccepter;
@@ -98,10 +100,12 @@ public class DocShareAccepterServiceImpl implements IDocShareAccepterService {
     @Override
     public int insertShareAccepters(Long docId, Long[] userIds) {
         List<DocShareAccepter> list = new ArrayList<>();
+        Date nowTime = DateUtils.getNowDate();
         for (Long userId : userIds) {
             DocShareAccepter gu = new DocShareAccepter();
             gu.setUserId(userId);
             gu.setDocId(docId);
+            gu.setShareTime(nowTime);
             list.add(gu);
         }
         int r = docShareAccepterMapper.batchShareAccepters(list);

+ 25 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocShareServiceImpl.java

@@ -3,6 +3,7 @@ package com.jjt.doc.service.impl;
 import java.util.List;
 
 import com.jjt.common.core.utils.DateUtils;
+import com.jjt.common.security.utils.SecurityUtils;
 import com.jjt.doc.domain.DocShareAccepter;
 import org.springframework.stereotype.Service;
 import com.jjt.doc.mapper.DocShareMapper;
@@ -35,10 +36,11 @@ public class DocShareServiceImpl implements IDocShareService {
         //如果未找到,则添加一条记录
         if (share == null) {
             share = new DocShare();
+            share.setCreateBy(SecurityUtils.getUserId() + "");
             share.setDocId(docId);
             share.setIsSecret("0");
             share.setOnlyOneTime("0");
-            docShareMapper.insertDocShare(share);
+            this.insertDocShare(share);
         }
         return share;
     }
@@ -63,6 +65,7 @@ public class DocShareServiceImpl implements IDocShareService {
     @Override
     public int insertDocShare(DocShare docShare) {
         docShare.setCreateTime(DateUtils.getNowDate());
+        docShare.setUpdateTime(DateUtils.getNowDate());
         return docShareMapper.insertDocShare(docShare);
     }
 
@@ -99,4 +102,25 @@ public class DocShareServiceImpl implements IDocShareService {
     public int deleteDocShareByDocId(Long docId) {
         return docShareMapper.deleteDocShareByDocId(docId);
     }
+
+    /**
+     * 最近发送文件
+     *
+     * @param uid 用户ID
+     * @return
+     */
+    @Override
+    public List<DocShare> selectDocShareSend(Long uid) {
+        return docShareMapper.selectDocShareSend(uid);
+    }
+
+    /**
+     * 最近接收文件
+     *
+     * @param uid@return
+     */
+    @Override
+    public List<DocShare> selectDocShareReceive(Long uid) {
+        return docShareMapper.selectDocShareReceive(uid);
+    }
 }

+ 4 - 3
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocShareAccepterMapper.xml

@@ -7,10 +7,11 @@
     <resultMap type="DocShareAccepter" id="DocShareAccepterResult">
         <result property="docId" column="DOC_ID"/>
         <result property="userId" column="USER_ID"/>
+        <result property="shareTime" column="SHARE_TIME"/>
     </resultMap>
 
     <sql id="selectDocShareAccepterVo">
-        select DOC_ID, USER_ID
+        select DOC_ID, USER_ID, SHARE_TIME
         from doc_share_accepter
     </sql>
 
@@ -70,9 +71,9 @@
         </trim>
     </insert>
     <insert id="batchShareAccepters">
-        insert into doc_share_accepter(user_id, doc_id) values
+        insert into doc_share_accepter(user_id, doc_id,share_time) values
         <foreach item="item" index="index" collection="list" separator=",">
-            (#{item.userId},#{item.docId})
+            (#{item.userId},#{item.docId},#{item.shareTime})
         </foreach>
     </insert>
 

+ 63 - 31
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocShareMapper.xml

@@ -1,47 +1,77 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.doc.mapper.DocShareMapper">
-    
+
     <resultMap type="DocShare" id="DocShareResult">
-        <result property="docId"    column="DOC_ID"    />
-        <result property="docYear"    column="DOC_YEAR"    />
-        <result property="isSecret"    column="IS_SECRET"    />
-        <result property="onlyOneTime"    column="ONLY_ONE_TIME"    />
-        <result property="createBy"    column="CREATE_BY"    />
-        <result property="createTime"    column="CREATE_TIME"    />
-        <result property="updateBy"    column="UPDATE_BY"    />
-        <result property="updateTime"    column="UPDATE_TIME"    />
-        <result property="remark"    column="REMARK"    />
-        <result property="isDel"    column="IS_DEL"    />
+        <result property="docId" column="DOC_ID"/>
+        <result property="docYear" column="DOC_YEAR"/>
+        <result property="isSecret" column="IS_SECRET"/>
+        <result property="onlyOneTime" column="ONLY_ONE_TIME"/>
+        <result property="createBy" column="CREATE_BY"/>
+        <result property="createTime" column="CREATE_TIME"/>
+        <result property="updateBy" column="UPDATE_BY"/>
+        <result property="updateTime" column="UPDATE_TIME"/>
+        <result property="remark" column="REMARK"/>
+        <result property="isDel" column="IS_DEL"/>
     </resultMap>
 
     <sql id="selectDocShareVo">
-        select DOC_ID, DOC_YEAR, IS_SECRET, ONLY_ONE_TIME, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK, IS_DEL from doc_share
+        select DOC_ID,
+               DOC_YEAR,
+               IS_SECRET,
+               ONLY_ONE_TIME,
+               CREATE_BY,
+               CREATE_TIME,
+               UPDATE_BY,
+               UPDATE_TIME,
+               REMARK,
+               IS_DEL
+        from doc_share
     </sql>
 
     <select id="selectDocShareList" parameterType="DocShare" resultMap="DocShareResult">
         <include refid="selectDocShareVo"/>
-        <where>  
-            <if test="docId != null "> and DOC_ID = #{docId}</if>
-            <if test="docYear != null "> and DOC_YEAR = #{docYear}</if>
-            <if test="isSecret != null  and isSecret != ''"> and IS_SECRET = #{isSecret}</if>
-            <if test="onlyOneTime != null  and onlyOneTime != ''"> and ONLY_ONE_TIME = #{onlyOneTime}</if>
-            <if test="createBy != null  and createBy != ''"> and CREATE_BY = #{createBy}</if>
-            <if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
-            <if test="updateBy != null  and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
-            <if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
-            <if test="remark != null  and remark != ''"> and REMARK = #{remark}</if>
-            <if test="isDel != null  and isDel != ''"> and IS_DEL = #{isDel}</if>
+        <where>
+            <if test="docId != null ">and DOC_ID = #{docId}</if>
+            <if test="docYear != null ">and DOC_YEAR = #{docYear}</if>
+            <if test="isSecret != null  and isSecret != ''">and IS_SECRET = #{isSecret}</if>
+            <if test="onlyOneTime != null  and onlyOneTime != ''">and ONLY_ONE_TIME = #{onlyOneTime}</if>
+            <if test="createBy != null  and createBy != ''">and CREATE_BY = #{createBy}</if>
+            <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
+            <if test="updateBy != null  and updateBy != ''">and UPDATE_BY = #{updateBy}</if>
+            <if test="updateTime != null ">and UPDATE_TIME = #{updateTime}</if>
+            <if test="remark != null  and remark != ''">and REMARK = #{remark}</if>
+            <if test="isDel != null  and isDel != ''">and IS_DEL = #{isDel}</if>
         </where>
     </select>
-    
+
     <select id="selectDocShareByDocId" parameterType="Long" resultMap="DocShareResult">
         <include refid="selectDocShareVo"/>
         where DOC_ID = #{docId}
     </select>
-        
+
+    <select id="selectDocShareSend" resultType="com.jjt.doc.domain.DocShare">
+        select a.doc_id, a.UPDATE_TIME, b.doc_name, b.doc_type, b.doc_path
+        from doc_share a,
+             doc_info b
+        where a.doc_id = b.doc_id
+          and a.CREATE_BY = #{uid}
+        order by a.update_time desc
+    </select>
+    <select id="selectDocShareReceive" resultType="com.jjt.doc.domain.DocShare">
+        select a.doc_id, a.UPDATE_TIME, b.doc_name, b.doc_type, b.doc_path
+        from (select t.*
+              from doc_share t,
+                   doc_share_accepter t1
+              where t.doc_id = t1.doc_id
+                and t1.user_id = #{uid}) a,
+             doc_info b
+        where a.doc_id = b.doc_id
+        order by a.update_time desc
+    </select>
+
     <insert id="insertDocShare" parameterType="DocShare">
         insert into doc_share
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -55,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">UPDATE_TIME,</if>
             <if test="remark != null">REMARK,</if>
             <if test="isDel != null">IS_DEL,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="docId != null">#{docId},</if>
             <if test="docYear != null">#{docYear},</if>
@@ -67,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
             <if test="isDel != null">#{isDel},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateDocShare" parameterType="DocShare">
@@ -87,11 +117,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteDocShareByDocId" parameterType="Long">
-        delete from doc_share where DOC_ID = #{docId}
+        delete
+        from doc_share
+        where DOC_ID = #{docId}
     </delete>
 
     <delete id="deleteDocShareByDocIds" parameterType="String">
-        delete from doc_share where DOC_ID in 
+        delete from doc_share where DOC_ID in
         <foreach item="docId" collection="array" open="(" separator="," close=")">
             #{docId}
         </foreach>