Browse Source

红德堂-新增app注册时间和是否下载app相关代码

Long 4 days ago
parent
commit
46dae60551

+ 12 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsUserController.java

@@ -143,6 +143,12 @@ public class FsUserController extends BaseController
             if (vo.getMobile()!=null){
                 vo.setMobile(vo.getMobile().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
             }
+            // 处理是否已下载app字段
+            if (vo.getAppCreateTime() != null || StringUtils.isNotBlank(vo.getSource()) || StringUtils.isNotBlank(vo.getLoginDevice())) {
+                vo.setIsDownloadApp(1);
+            } else {
+                vo.setIsDownloadApp(0);
+            }
         }
         ExcelUtil<FsUserExportListVO> util = new ExcelUtil<FsUserExportListVO>(FsUserExportListVO.class);
         return util.exportExcel(list, "用户数据");
@@ -168,6 +174,12 @@ public class FsUserController extends BaseController
             if (vo.getMobile()!=null){
                 vo.setMobile(vo.getMobile().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
             }
+            // 处理是否已下载app字段
+            if (vo.getAppCreateTime() != null || StringUtils.isNotBlank(vo.getSource()) || StringUtils.isNotBlank(vo.getLoginDevice())) {
+                vo.setIsDownloadApp(1);
+            } else {
+                vo.setIsDownloadApp(0);
+            }
         }
         ExcelUtil<FsUserExportListVO> util = new ExcelUtil<FsUserExportListVO>(FsUserExportListVO.class);
         return util.exportExcel(list, "用户数据");

+ 16 - 4
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -8,6 +8,7 @@ import org.apache.commons.lang3.StringUtils;
 import com.vdurmont.emoji.EmojiParser;
 import lombok.Data;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -203,11 +204,12 @@ public class FsUser extends BaseEntity
 
     public String getNickName()
     {
-        if(StringUtils.isNotEmpty(nickName)){
-            return EmojiParser.parseToUnicode(nickName);
+        String value = StringUtils.isNotEmpty(nickName) ? nickName : nickname;
+        if(StringUtils.isNotEmpty(value)){
+            return EmojiParser.parseToUnicode(value);
         }
         else{
-            return nickName;
+            return value;
         }
     }
 
@@ -237,7 +239,13 @@ public class FsUser extends BaseEntity
     private String nicknameExact;
 
     public String getNickname() {
-        return nickname;
+        String value = StringUtils.isNotEmpty(nickName) ? nickName : nickname;
+        if(StringUtils.isNotEmpty(value)){
+            return EmojiParser.parseToUnicode(value);
+        }
+        else{
+            return value;
+        }
     }
 
     public void setNickname(String nickname) {
@@ -253,4 +261,8 @@ public class FsUser extends BaseEntity
     private BigDecimal totalCommission;
     // 已提现佣金
     private BigDecimal withdrawFinish;
+
+    // app注册时间
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDateTime appCreateTime;
 }

+ 26 - 5
fs-service/src/main/java/com/fs/his/mapper/FsUserMapper.java

@@ -141,7 +141,10 @@ public interface FsUserMapper
             "    fu.user_id ,\n" +
             "    fp.patient_name ,\n" +
             "    fp.mobile ,\n" +
-            "    fu.is_buy \n" +
+            "    fu.is_buy ,\n" +
+            "    fu.app_create_time ,\n" +
+            "    fu.source ,\n" +
+            "    fu.login_device \n" +
             "FROM fs_user fu\n" +
             "LEFT JOIN company_user_user cuu ON fu.user_id = cuu.user_id\n" +
             "LEFT JOIN company_user cu ON cuu.company_user_id = cu.user_id\n" +
@@ -156,6 +159,12 @@ public interface FsUserMapper
             "            <if test=\"userId != null \"> and fu.user_id = #{userId}</if>\n" +
             "            <if test=\"sTime != null \">  and DATE(fu.create_time) &gt;= DATE(#{sTime})</if>\n" +
             "            <if test=\"eTime != null \">  and DATE(fu.create_time) &lt;= DATE(#{eTime})</if>\n" +
+            "            <if test=\"appCreateTimeStart != null \">  and fu.app_create_time &gt;= #{appCreateTimeStart}</if>\n" +
+            "            <if test=\"appCreateTimeEnd != null \">  and fu.app_create_time &lt;= #{appCreateTimeEnd}</if>\n" +
+            "            <if test=\"isDownloadApp != null \">" +
+            "               <if test=\"isDownloadApp == 1\"> and ((fu.source is not null and fu.source != '') or fu.login_device is not null or fu.app_create_time is not null)</if>\n" +
+            "               <if test=\"isDownloadApp == 0\"> and ((fu.source is null or fu.source = '') and fu.login_device is null and fu.app_create_time is null)</if>\n" +
+            "            </if>\n" +
             "ORDER BY fu.user_id DESC "+
             "</script>"})
     List<FsUserExportListVO> selectFsUserExportListVO(FsUserParam fsUser);
@@ -193,8 +202,14 @@ public interface FsUserMapper
             "            <if test=\"tuiTime != null \"> and f1.tui_time = #{tuiTime}</if>\n" +
             "            <if test=\"userCode != null  and userCode != ''\"> and f1.user_code = #{userCode}</if>\n" +
             "            <if test=\"lastIp != null  and lastIp != ''\"> and f1.last_ip = #{lastIp}</if>\n" +
-            "            <if test=\"sTime != null \">  and DATE(f1.create_time) &gt;= DATE(#{sTime})</if>\n" +
-            "            <if test=\"eTime != null \">  and DATE(f1.create_time) &lt;= DATE(#{eTime})</if>\n" +
+            "            <if test=\"sTime != null \">  and f1.create_time &gt;= #{sTime}</if>\n" +
+            "            <if test=\"eTime != null \">  and f1.create_time &lt;= #{eTime}</if>\n" +
+            "            <if test=\"appCreateTimeStart != null \">  and f1.app_create_time &gt;= #{appCreateTimeStart}</if>\n" +
+            "            <if test=\"appCreateTimeEnd != null \">  and f1.app_create_time &lt;= #{appCreateTimeEnd}</if>\n" +
+            "            <if test=\"isDownloadApp != null \">" +
+            "               <if test=\"isDownloadApp == 1\"> and ((f1.source is not null and f1.source != '') or f1.login_device is not null or f1.app_create_time is not null)</if>\n" +
+            "               <if test=\"isDownloadApp == 0\"> and ((f1.source is null or f1.source = '') and f1.login_device is null and f1.app_create_time is null)</if>\n" +
+            "            </if>\n" +
             "order by f1.user_id desc" +
             "</script>"})
     List<FsUserVO> selectFsUserListVOByComponentsUser(FsUserParam fsUser);
@@ -220,8 +235,14 @@ public interface FsUserMapper
             "            <if test=\"tuiTime != null \"> and f1.tui_time = #{tuiTime}</if>\n" +
             "            <if test=\"userCode != null  and userCode != ''\"> and f1.user_code = #{userCode}</if>\n" +
             "            <if test=\"lastIp != null  and lastIp != ''\"> and f1.last_ip = #{lastIp}</if>\n" +
-            "            <if test=\"sTime != null \">  and DATE(f1.create_time) &gt;= DATE(#{sTime})</if>\n" +
-            "            <if test=\"eTime != null \">  and DATE(f1.create_time) &lt;= DATE(#{eTime})</if>\n" +
+            "            <if test=\"sTime != null \">  and f1.create_time &gt;= #{sTime}</if>\n" +
+            "            <if test=\"eTime != null \">  and f1.create_time &lt;= #{eTime}</if>\n" +
+            "            <if test=\"appCreateTimeStart != null \">  and f1.app_create_time &gt;= #{appCreateTimeStart}</if>\n" +
+            "            <if test=\"appCreateTimeEnd != null \">  and f1.app_create_time &lt;= #{appCreateTimeEnd}</if>\n" +
+            "            <if test=\"isDownloadApp != null \">" +
+            "               <if test=\"isDownloadApp == 1\"> and (f1.source is not null and f1.source != '') or f1.login_device is not null or f1.app_create_time is not null</if>\n" +
+            "               <if test=\"isDownloadApp == 0\"> and (f1.source is null or f1.source = '') and f1.login_device is null and f1.app_create_time is null</if>\n" +
+            "            </if>\n" +
             "order by f1.user_id desc " +
             "</script>"})
     List<FsUserVO> selectFsUserListVOByComponent(FsUserParam fsUser);

+ 11 - 0
fs-service/src/main/java/com/fs/his/param/FsUserParam.java

@@ -79,6 +79,17 @@ public class FsUserParam {
 
     private String source;
 
+    /** APP注册时间-开始 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date appCreateTimeStart;
+
+    /** APP注册时间-结束 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date appCreateTimeEnd;
+
+    /** 是否下载APP (1=已下载, 0=未下载) */
+    private Integer isDownloadApp;
+
     /** 加密的手机号码-用于查询 */
     private String encryptPhone;
 }

+ 6 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsUserServiceImpl.java

@@ -1914,6 +1914,12 @@ public class FsUserServiceImpl implements IFsUserService {
                 }
             }
 
+            // 处理是否已下载app字段
+            if (item.getAppCreateTime() != null || StringUtils.isNotBlank(item.getSource()) || StringUtils.isNotBlank(item.getLoginDevice())) {
+                item.setIsDownloadApp(1);
+            } else {
+                item.setIsDownloadApp(0);
+            }
         }
 
         ExcelUtil<FsUserPageListExportVO> util = new ExcelUtil<>(FsUserPageListExportVO.class);

+ 11 - 0
fs-service/src/main/java/com/fs/his/vo/FsUserExportListVO.java

@@ -30,4 +30,15 @@ public class FsUserExportListVO {
 
     @Excel(name = "备注")
     private String remark;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "APP注册时间", dateFormat = "yyyy-MM-dd")
+    private Date appCreateTime;
+
+    private String source;
+
+    private String loginDevice;
+
+    @Excel(name = "是已下载APP", readConverterExp = "0=未下载,1=已下载")
+    private Integer isDownloadApp;
 }

+ 15 - 0
fs-service/src/main/java/com/fs/his/vo/FsUserVO.java

@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.his.domain.FsUser;
+import com.vdurmont.emoji.EmojiParser;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -168,4 +170,17 @@ public class FsUserVO extends FsUser implements Serializable
 
     @ApiModelProperty(value = "绑定关系表主键ID")
     private Long userCompanyUserId;
+
+    /**
+     * 获取昵称(优先取nickName,如果为空则取nickname)
+     */
+    public String getNickname() {
+        String value = StringUtils.isNotEmpty(this.getNickName()) ? this.getNickName() : nickname;
+        if(StringUtils.isNotEmpty(value)){
+            return EmojiParser.parseToUnicode(value);
+        }
+        else{
+            return value;
+        }
+    }
 }

+ 11 - 0
fs-service/src/main/java/com/fs/hisStore/param/h5/FsUserPageListParam.java

@@ -86,5 +86,16 @@ public class FsUserPageListParam implements Serializable {
     @ApiModelProperty(value = "状态 0小黑屋 1正常 2拉黑")
     private Integer status;
 
+    @ApiModelProperty(value = "APP注册时间-开始")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String appCreateTimeStart;
+
+    @ApiModelProperty(value = "APP注册时间-结束")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String appCreateTimeEnd;
+
+    @ApiModelProperty(value = "是否下载APP 1=已下载 0=未下载")
+    private Integer isDownloadApp;
+
 }
 

+ 10 - 0
fs-service/src/main/java/com/fs/hisStore/vo/h5/FsUserPageListVO.java

@@ -100,4 +100,14 @@ public class FsUserPageListVO {
     @ApiModelProperty(value = "用户-项目-销售ID")
     private Long userCompanyUserId;
 
+    @ApiModelProperty(value = "APP来源")
+    private String source;
+
+    @ApiModelProperty(value = "登录设备")
+    private String loginDevice;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "APP注册时间")
+    private Date appCreateTime;
+
 }

+ 11 - 0
fs-service/src/main/java/com/fs/store/param/h5/FsUserPageListExportParam.java

@@ -95,5 +95,16 @@ public class FsUserPageListExportParam implements Serializable {
      */
     private  String  saleUserId;
 
+    @ApiModelProperty(value = "APP注册时间-开始")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String appCreateTimeStart;
+
+    @ApiModelProperty(value = "APP注册时间-结束")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String appCreateTimeEnd;
+
+    @ApiModelProperty(value = "是否下载APP 1=已下载 0=未下载")
+    private Integer isDownloadApp;
+
 }
 

+ 11 - 0
fs-service/src/main/java/com/fs/store/param/h5/FsUserPageListParam.java

@@ -99,6 +99,17 @@ public class FsUserPageListParam implements Serializable {
      */
     private  String  saleUserId;
 
+    @ApiModelProperty(value = "APP注册时间-开始")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String appCreateTimeStart;
+
+    @ApiModelProperty(value = "APP注册时间-结束")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String appCreateTimeEnd;
+
+    @ApiModelProperty(value = "是否下载APP 1=已下载 0=未下载")
+    private Integer isDownloadApp;
+
 
 }
 

+ 9 - 0
fs-service/src/main/java/com/fs/store/vo/h5/FsUserPageListExportVO.java

@@ -136,4 +136,13 @@ public class FsUserPageListExportVO {
     @Excel(name = "登录设备")
     private String loginDevice;
 
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "App注册时间")
+    @Excel(name = "APP注册时间", dateFormat = "yyyy-MM-dd")
+    private Date appCreateTime;
+
+
+    @ApiModelProperty(value = "是已下载app")
+    @Excel(name = "是已下载APP", readConverterExp = "0=未下载,1=已下载")
+    private Integer isDownloadApp;
 }

+ 4 - 0
fs-service/src/main/java/com/fs/store/vo/h5/FsUserPageListVO.java

@@ -113,4 +113,8 @@ public class FsUserPageListVO {
 
     private String source;//app来源
 
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "APP注册时间")
+    private Date appCreateTime;
+
 }

+ 1 - 1
fs-service/src/main/resources/mapper/company/CompanyTagMapper.xml

@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where ctu.user_id = #{userId}
     </select>
     <select id="findUserTagByUserId" resultType="java.lang.String">
-        select tag_ids from company_tag_user where user_id = ${userId} and company_user_id=${companyUserId} limit 1
+        select tag_ids from company_tag_user where user_id = #{userId} and company_user_id=#{companyUserId} limit 1
     </select>
     <resultMap id="companyTagMap" type="com.fs.company.domain.CompanyTag">
         <id column="tag_id" property="tagId" jdbcType="BIGINT" javaType="java.lang.Long"/>

+ 61 - 3
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="withdrawFinish"    column="withdraw_finish"    />
         <result property="totalCommission"    column="total_commission"    />
         <result property="mayWithdraw"    column="may_withdraw"    />
+        <result property="appCreateTime"    column="app_create_time"    />
     </resultMap>
 
     <sql id="selectFsUserVo">
@@ -384,7 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ucu.company_id,
         ucu.project_id,
         fs_user.integral,
-        if(fs_user.pay_count>0,1,0) as isBuy
+        if(fs_user.pay_count>0,1,0) as isBuy,
+        fs_user.app_create_time
         FROM
         fs_user
         left join fs_user_company_user ucu on ucu.user_id = fs_user.user_id
@@ -401,7 +403,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <when test="companyUserIds != null and companyUserIds.size > 0">
                 AND ucu.company_user_id in
                 <foreach collection="companyUserIds" item="item" index="index" open="(" separator="," close=")">
-                    ${item}
+                    #{item}
                 </foreach>
             </when>
             <when test="companyUserId != null and companyUserId != '' ">
@@ -434,6 +436,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="projectId != null">
                 AND ucu.project_id = #{projectId}
             </if>
+            <if test="appCreateTimeStart != null and appCreateTimeEnd != null">
+                AND fs_user.app_create_time BETWEEN #{appCreateTimeStart} AND #{appCreateTimeEnd}
+            </if>
+            <if test="isDownloadApp != null">
+                <choose>
+                    <when test="isDownloadApp == 1">
+                        and ((fs_user.source is not null and fs_user.source != '') or fs_user.login_device is not null or fs_user.app_create_time is not null)
+                    </when>
+                    <when test="isDownloadApp == 0">
+                        and ((fs_user.source is null or fs_user.source = '') and fs_user.login_device is null and fs_user.app_create_time is null)
+                    </when>
+                </choose>
+            </if>
         </where>
         limit ${(pageNum-1)*pageSize},${pageSize}
     </select>
@@ -480,6 +495,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="projectId != null">
                 AND ucu.project_id = #{projectId}
             </if>
+            <if test="appCreateTimeStart != null and appCreateTimeEnd != null">
+                AND fs_user.app_create_time BETWEEN #{appCreateTimeStart} AND #{appCreateTimeEnd}
+            </if>
+            <if test="isDownloadApp != null">
+                <choose>
+                    <when test="isDownloadApp == 1">
+                        and ((fs_user.source is not null and fs_user.source != '') or fs_user.login_device is not null or fs_user.app_create_time is not null)
+                    </when>
+                    <when test="isDownloadApp == 0">
+                        and ((fs_user.source is null or fs_user.source = '') and fs_user.login_device is null and fs_user.app_create_time is null)
+                    </when>
+                </choose>
+            </if>
         </where>
     </select>
     <update id="transferCompanyUser">
@@ -625,6 +653,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="payCount != null">pay_count,</if>
             <if test="spreadCount != null">spread_count,</if>
             <if test="appId != null">app_id,</if>
+            <if test="appCreateTime != null">app_create_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="nickName != null">#{nickName},</if>
@@ -675,6 +704,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="payCount != null">#{payCount},</if>
             <if test="spreadCount != null">#{spreadCount},</if>
             <if test="appId != null">#{appId},</if>
+            <if test="appCreateTime != null">#{appCreateTime},</if>
          </trim>
     </insert>
 
@@ -735,6 +765,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="orderCount != null">order_count = #{orderCount},</if>
             <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
             <if test="appId != null">app_id = #{appId},</if>
+            <if test="appCreateTime != null">app_create_time = #{appCreateTime},</if>
             <if test="invitedBySalesId != null">invited_by_sales_id = #{invitedBySalesId},</if>
             <if test="withdrawIntegral != null">withdraw_integral = #{withdrawIntegral},</if>
             <if test="withdrawFinish != null">withdraw_finish = #{withdrawFinish},</if>
@@ -2515,6 +2546,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="projectId != null">
                 AND ucu.project_id = #{projectId}
             </if>
+            <if test="appCreateTimeStart != null and appCreateTimeEnd != null">
+                AND fs_user.app_create_time BETWEEN #{appCreateTimeStart} AND #{appCreateTimeEnd}
+            </if>
+            <if test="isDownloadApp != null">
+                <choose>
+                    <when test="isDownloadApp == 1">
+                        and ((fs_user.source is not null and fs_user.source != '') or fs_user.login_device is not null or fs_user.app_create_time is not null)
+                    </when>
+                    <when test="isDownloadApp == 0">
+                        and ((fs_user.source is null or fs_user.source = '') and fs_user.login_device is null and fs_user.app_create_time is null)
+                    </when>
+                </choose>
+            </if>
         </where>
     </select>
 
@@ -2533,7 +2577,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             fs_user.integral,
             if(fs_user.pay_count>0,1,0) as isBuy,
             fs_user.source,
-            fs_user.login_device as loginDevice
+            fs_user.login_device as loginDevice,
+            fs_user.app_create_time
         FROM fs_user
         left join fs_user_company_user ucu on ucu.user_id = fs_user.user_id
         <where>
@@ -2578,6 +2623,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="projectId != null">
                 AND ucu.project_id = #{projectId}
             </if>
+            <if test="appCreateTimeStart != null and appCreateTimeEnd != null">
+                AND fs_user.app_create_time BETWEEN #{appCreateTimeStart} AND #{appCreateTimeEnd}
+            </if>
+            <if test="isDownloadApp != null">
+                <choose>
+                    <when test="isDownloadApp == 1">
+                        and ((fs_user.source is not null and fs_user.source != '') or fs_user.login_device is not null or fs_user.app_create_time is not null)
+                    </when>
+                    <when test="isDownloadApp == 0">
+                        and ((fs_user.source is null or fs_user.source = '') and fs_user.login_device is null and fs_user.app_create_time is null)
+                    </when>
+                </choose>
+            </if>
         </where>
     </select>
 

+ 17 - 0
fs-service/src/main/resources/mapper/hisStore/FsUserScrmMapper.xml

@@ -595,6 +595,9 @@
         fs_user.status,
         fs_user.create_time,
         fs_user.remark,
+        fs_user.source,
+        fs_user.login_device,
+        fs_user.app_create_time,
         ucu.company_user_id,
         ucu.company_id,
         ucu.project_id
@@ -632,6 +635,20 @@
             <if test="projectId != null">
                 AND ucu.project_id = #{projectId}
             </if>
+            <if test="appCreateTimeStart != null and appCreateTimeStart !='' ">
+                AND fs_user.app_create_time &gt;= #{appCreateTimeStart}
+            </if>
+            <if test="appCreateTimeEnd != null and appCreateTimeEnd !='' ">
+                AND fs_user.app_create_time &lt;= #{appCreateTimeEnd}
+            </if>
+            <if test="isDownloadApp != null">
+                <if test="isDownloadApp == 1">
+                    AND (fs_user.source is not null AND fs_user.source != '') OR fs_user.login_device is not NULL OR fs_user.app_create_time is not NULL
+                </if>
+                <if test="isDownloadApp == 0">
+                    AND (fs_user.source IS NULL OR fs_user.source = '') AND fs_user.login_device IS NULL AND fs_user.app_create_time IS NULL
+                </if>
+            </if>
         limit ${(pageNum-1)*pageSize},${pageSize}
     </select>
 

+ 19 - 0
fs-user-app/src/main/java/com/fs/app/controller/AppLoginController2.java

@@ -44,6 +44,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
 import java.util.*;
+import java.time.LocalDateTime;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
@@ -474,6 +475,9 @@ public class AppLoginController2 extends AppBaseController{
             return R.error("密码不正确");
         }
 
+        // 检查是否写入过appCreateTime,没写入则写入
+        checkAppCreateTime(user);
+
         // 发送消息
         threadPoolTaskExecutor.execute(() -> sendMessage(user));
 
@@ -481,6 +485,18 @@ public class AppLoginController2 extends AppBaseController{
 
     }
 
+    /**
+     * 第一次登录写入appCreateTime
+     */
+    private void checkAppCreateTime(FsUser user) {
+        if (user.getAppCreateTime() == null) {
+            FsUser updateUser = new FsUser();
+            updateUser.setUserId(user.getUserId());
+            updateUser.setAppCreateTime(LocalDateTime.now());
+            userMapper.updateFsUser(updateUser);
+        }
+    }
+
     private R handleLoginType3(FsUserLoginParam param) {
         // 根据手机号查询用户
         FsUser user = null;
@@ -699,6 +715,9 @@ public class AppLoginController2 extends AppBaseController{
         }
         updateExistingUserJpushId(user.get(0), map.get("jpushId"));
 
+        // 检查是否写入过appCreateTime,没写入则写入
+        checkAppCreateTime(user.get(0));
+
         // 发送消息
         FsUser finalUser = user.get(0);
         threadPoolTaskExecutor.execute(() -> sendMessage(finalUser));