Explorar o código

新增分享查询表,新增限时查看客户档案功能

anderx hai 1 ano
pai
achega
9a1cbb1f98

+ 85 - 0
src/main/java/com/goafanti/common/dao/UserLimitCheckMapper.java

@@ -0,0 +1,85 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.UserLimitCheck;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+
+import java.util.List;
+
+/**
+ * 客户分享查询表(UserLimitCheck)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-07-29 15:00:05
+ */
+public interface UserLimitCheckMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    UserLimitCheck queryById(Integer id);
+
+
+    /**
+     * 查询指定行数据
+     *
+     * @param userLimitCheck 查询条件
+     * @param pageable       分页对象
+     * @return 对象列表
+     */
+    List<UserLimitCheck> findUserLimitCheckList(UserLimitCheck userLimitCheck, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param userLimitCheck 查询条件
+     * @return 总行数
+     */
+    int findUserLimitCheckCount(UserLimitCheck userLimitCheck);
+
+    /**
+     * 新增数据
+     *
+     * @param userLimitCheck 实例对象
+     * @return 影响行数
+     */
+    int insert(UserLimitCheck userLimitCheck);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<UserLimitCheck> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<UserLimitCheck> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<UserLimitCheck> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<UserLimitCheck> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param userLimitCheck 实例对象
+     * @return 影响行数
+     */
+    int update(UserLimitCheck userLimitCheck);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+}
+

+ 120 - 0
src/main/java/com/goafanti/common/mapper/UserLimitCheckMapper.xml

@@ -0,0 +1,120 @@
+<?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">
+<mapper namespace="com.goafanti.common.dao.UserLimitCheckMapper">
+
+    <resultMap type="com.goafanti.common.model.UserLimitCheck" id="UserLimitCheckMap">
+        <result property="id" column="id" jdbcType="INTEGER"/>
+        <result property="uid" column="uid" jdbcType="VARCHAR"/>
+        <result property="checkTime" column="check_time" jdbcType="TIMESTAMP"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="UserLimitCheckAllSql">
+        id, uid, check_time, create_time
+    </sql>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="UserLimitCheckMap">
+        select
+        <include refid="UserLimitCheckAllSql"/>
+        from user_limit_check
+        where id = #{id}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="findUserLimitCheckList" resultMap="UserLimitCheckMap">
+        select
+        <include refid="UserLimitCheckAllSql"/>
+
+        from user_limit_check
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="uid != null and uid != ''">
+                and uid = #{uid}
+            </if>
+            <if test="checkTime != null">
+                and check_time = #{checkTime}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+        </where>
+        <if test="page_sql != null">
+            ${page_sql}
+        </if>
+    </select>
+
+    <!--统计总行数-->
+    <select id="findUserLimitCheckCount" resultType="java.lang.Integer">
+        select count(1)
+        from user_limit_check
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="uid != null and uid != ''">
+                and uid = #{uid}
+            </if>
+            <if test="checkTime != null">
+                and check_time = #{checkTime}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into user_limit_check(uid, check_time, create_time)
+        values (#{uid}, #{checkTime}, #{createTime})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into user_limit_check(uid, check_time, create_time)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.uid}, #{entity.checkTime}, #{entity.createTime})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into user_limit_check(uid, check_time, create_time)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.uid}, #{entity.checkTime}, #{entity.createTime})
+        </foreach>
+        on duplicate key update
+        uid = values(uid),
+        check_time = values(check_time),
+        create_time = values(create_time)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update user_limit_check
+        <set>
+            <if test="uid != null and uid != ''">
+                uid = #{uid},
+            </if>
+            <if test="checkTime != null">
+                check_time = #{checkTime},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from user_limit_check
+        where id = #{id}
+    </delete>
+
+</mapper>
+

+ 62 - 0
src/main/java/com/goafanti/common/model/UserLimitCheck.java

@@ -0,0 +1,62 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 客户分享查询表(UserLimitCheck)实体类
+ *
+ * @author makejava
+ * @since 2024-07-29 15:00:05
+ */
+public class UserLimitCheck implements Serializable {
+    private static final long serialVersionUID = -73811202530017257L;
+
+    private Integer id;
+
+    private String uid;
+    /**
+     * 最后时间
+     */
+    private Date checkTime;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public Date getCheckTime() {
+        return checkTime;
+    }
+
+    public void setCheckTime(Date checkTime) {
+        this.checkTime = checkTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+}
+

+ 3 - 0
src/main/java/com/goafanti/customer/controller/UserArchivesController.java

@@ -114,5 +114,8 @@ public class UserArchivesController  extends BaseController {
 
 
 
+
+
+
 }
 

+ 14 - 0
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -511,5 +511,19 @@ public class AdminReleaseApiController extends CertifyApiController{
 	}
 
 
+	/**
+	 * 分享限时查询
+	 */
+	@RequestMapping(value = "/limitUser",method = RequestMethod.POST)
+	public Result limitUser (String uid){
+		Result res =new Result();
+		int i = publicReleaseService.limitUser(uid);
+		if (i==0){
+			return res().error(buildError(ErrorConstants.PARAM_ERROR,"只有客户归属人可以分享"));
+		}
+		return res.data(i);
+	}
+
+
 
 }

+ 2 - 0
src/main/java/com/goafanti/weChat/service/PublicReleaseService.java

@@ -81,4 +81,6 @@ public interface PublicReleaseService {
 	Object assistUnaudited();
 
     boolean checkPublicReviewer(InputPublicRelease in);
+
+	int limitUser(String uid);
 }

+ 10 - 0
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -975,6 +975,16 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 		return false;
 	}
 
+	@Override
+	public int limitUser(String uid) {
+		User user = userMapper.selectByPrimaryKey(uid);
+		if (!user.getAid().equals(TokenManager.getAdminId())){
+			return 0;
+		}
+
+		return 1;
+	}
+
 	private void updateAdminUserCountPublicRelease(String aid, Date transferTime) {
 		String startTime= DateUtils.formatDate(transferTime,AFTConstants.YYYYMMDD);
 		String endTime=startTime+" 23:59:59";