Explorar el Código

红包代码提交

yjwang hace 6 días
padre
commit
fffe0722b1

+ 18 - 0
fs-admin/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java

@@ -1,6 +1,7 @@
 package com.fs.course.controller;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import cn.hutool.core.util.ObjectUtil;
@@ -90,6 +91,23 @@ public class FsCourseRedPacketLogController extends BaseController
         if (fsCourseRedPacketLog.getPhoneMk()!=null&&fsCourseRedPacketLog.getPhoneMk()!=""){
             fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));
         }
+        Date sTime = fsCourseRedPacketLog.getSTime();
+        Date eTime = fsCourseRedPacketLog.getETime();
+        if (sTime != null && eTime != null) {
+            long diff = eTime.getTime() - sTime.getTime();
+            long threeMonths = 90L * 24 * 60 * 60 * 1000;
+            if (diff > threeMonths) {
+                return AjaxResult.error("导出时间范围不能超过3个月");
+            }
+        } else if (eTime != null) {
+            long diff = eTime.getTime() - System.currentTimeMillis() + Math.abs(System.currentTimeMillis() - eTime.getTime()) * 2;
+            if (diff > 90L * 24 * 60 * 60 * 1000) {
+                return AjaxResult.error("导出时间范围不能超过3个月");
+            }
+        }
+        if (sTime == null && eTime == null) {
+            return AjaxResult.error("请选择导出时间范围");
+        }
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
 

+ 0 - 24
fs-service/src/main/java/com/fs/course/mapper/FsCourseRedPacketLogMapper.java

@@ -106,30 +106,6 @@ public interface FsCourseRedPacketLogMapper
             "</script>"})
     List<FsCourseRedPacketLogListPVO> selectRedPacketLogListVO(@Param("maps") FsCourseRedPacketLogParam param);
 
-    @Select({"<script> " +
-            "select l.*,v.title,u.nick_name as fsNickName,u.avatar as fsAvatar,u.phone,cu.nick_name company_user_name,c.company_name,qu.qw_user_name,fuc.course_name,u.phone as phoneNumber   from fs_course_red_packet_log l  \n" +
-            "left join fs_user_course_video v on v.video_id = l.video_id \n" +
-            "left join fs_user u on u.user_id = l.user_id \n" +
-            "left join fs_user_course fuc on fuc.course_id = l.course_id \n" +
-            "left join company_user cu on cu.user_id=l.company_user_id \n" +
-            "left join company c on c.company_id=l.company_id \n" +
-            "LEFT JOIN qw_user qu on qu.id= l.qw_user_id  " +
-            "where 1=1   " +
-            "<if test = ' maps.userId !=null '> and l.user_id = #{maps.userId} </if>" +
-            "<if test = ' maps.watchLogId !=null '> and l.watch_log_id = #{maps.watchLogId} </if>" +
-            "<if test = ' maps.companyId !=null '> and l.company_id = #{maps.companyId} </if>" +
-            "<if test = ' maps.companyUserId !=null '> and l.company_user_id = #{maps.companyUserId} </if>" +
-            "<if test = ' maps.companyUserName !=null '> and cu.nick_name  like concat('%', #{maps.companyUserName}, '%') </if>" +
-            "<if test = ' maps.nickName !=null '> and u.nick_name  like concat('%', #{maps.nickName}, '%') </if>" +
-            "<if test = ' maps.courseId !=null '> and l.course_id = #{maps.courseId} </if>" +
-            "<if test = ' maps.videoId !=null '> and l.video_id = #{maps.videoId} </if>" +
-            "<if test = ' maps.status !=null '> and l.status = #{maps.status} </if>" +
-            "<if test = \"maps.phone !=null and maps.phone != '' \"> and u.phone = #{maps.phone} </if>" +
-            "<if test = ' maps.qwUserId !=null '> and l.qw_user_id = #{maps.qwUserId} </if>" +
-            "<if test=\"maps.sTime != null \">  and DATE(l.create_time) &gt;= DATE(#{maps.sTime})</if>\n" +
-            "<if test=\"maps.eTime != null \">  and DATE(l.create_time) &lt;= DATE(#{maps.eTime})</if>\n" +
-            " order by l.log_id desc  "+
-            "</script>"})
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVO(@Param("maps")FsCourseRedPacketLogParam fsCourseRedPacketLog);
 
     @Select("SELECT company_id, SUM(amount) as money  FROM fs_course_red_packet_log    WHERE status in (0,1) and create_time >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)   AND create_time < CURDATE()  GROUP BY company_id " )

+ 13 - 11
fs-service/src/main/java/com/fs/course/vo/FsCourseRedPacketLogListPVO.java

@@ -35,15 +35,16 @@ public class FsCourseRedPacketLogListPVO extends BaseEntity
     @Excel(name = "小节名称")
     private String videoName;
 
-    @Excel(name = "记录类型" ,dictType = "sys_course_watch_log_type")
-    private Integer logType;
-
-    @Excel(name = "企微外部联系人id")
-    private String qwExternalContactId;
-
-
-    @Excel(name = "播放时长")
-    private String duration;
+//    @Excel(name = "记录类型" ,dictType = "sys_course_watch_log_type")
+//    @Excel(name = "记录类型")
+//    private Integer logType;
+//
+//    @Excel(name = "企微外部联系人id")
+//    private String qwExternalContactId;
+//
+//
+//    @Excel(name = "播放时长")
+//    private String duration;
 
 
     @Excel(name = "分享人企微userId")
@@ -66,7 +67,7 @@ public class FsCourseRedPacketLogListPVO extends BaseEntity
 
 
     /** 创建时间 */
-    @Excel(name = "创建时间")
+    @Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
@@ -87,7 +88,8 @@ public class FsCourseRedPacketLogListPVO extends BaseEntity
     @Excel(name = "转帐金额")
     private BigDecimal amount;
 
-    @Excel(name = "状态",dictType = "sys_course_red_packet_status")
+//    @Excel(name = "状态",dictType = "sys_course_red_packet_status")
+    @Excel(name = "状态")
     private Integer status;//状态 0 发送中  1  已发送
 
 }

+ 1 - 1
fs-service/src/main/java/com/fs/sop/service/impl/QwSopServiceImpl.java

@@ -1125,7 +1125,7 @@ public class QwSopServiceImpl implements IQwSopService
     private void processEnterpriseWeChatSop(QwSop qwSop,Set<String> addedSet) {
         try{
             //如果是新客对话的sop,则不需要找人入营期
-            if (qwSop.getSendType()==4){
+            if (qwSop.getSendType()==4 || qwSop.getFilterMode() == 2){
                 return;
             }
 

+ 55 - 0
fs-service/src/main/resources/mapper/course/FsCourseRedPacketLogMapper.xml

@@ -212,4 +212,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsCourseRedPacketLogVo"/> where status != 1 and create_time &gt;= #{maps.startTime} and create_time &lt;= #{maps.endTime}
 
     </select>
+
+    <select id="selectFsCourseRedPacketLogListVO" resultType="com.fs.course.vo.FsCourseRedPacketLogListPVO">
+        SELECT
+            l.log_id,
+            l.out_batch_no,
+            l.course_id,
+            l.video_id,
+            l.user_id,
+            l.company_user_id,
+            l.company_id,
+            l.amount,
+            l.status,
+            l.qw_user_id,
+            l.create_time,
+            v.title,
+            u.nick_name AS fsNickName,
+            u.avatar AS fsAvatar,
+            u.phone,
+            cu.nick_name AS company_user_name,
+            c.company_name,
+            qu.qw_user_name,
+            fuc.course_name,
+            v.title AS videoName
+        FROM fs_course_red_packet_log l
+        LEFT JOIN fs_user_course_video v ON v.video_id = l.video_id
+        LEFT JOIN fs_user u ON u.user_id = l.user_id
+        LEFT JOIN fs_user_course fuc ON fuc.course_id = l.course_id
+        LEFT JOIN company_user cu ON cu.user_id = l.company_user_id
+        LEFT JOIN company c ON c.company_id = l.company_id
+        LEFT JOIN qw_user qu ON qu.id = l.qw_user_id
+        <where>
+            <if test="maps.userId != null"> AND l.user_id = #{maps.userId}</if>
+            <if test="maps.watchLogId != null"> AND l.watch_log_id = #{maps.watchLogId}</if>
+            <if test="maps.companyId != null"> AND l.company_id = #{maps.companyId}</if>
+            <if test="maps.companyUserId != null"> AND l.company_user_id = #{maps.companyUserId}</if>
+            <if test="maps.companyUserName != null and maps.companyUserName != ''">
+                AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserName}, '%')
+            </if>
+            <if test="maps.nickName != null and maps.nickName != ''">
+                AND u.nick_name LIKE CONCAT('%', #{maps.nickName}, '%')
+            </if>
+            <if test="maps.courseId != null"> AND l.course_id = #{maps.courseId}</if>
+            <if test="maps.videoId != null"> AND l.video_id = #{maps.videoId}</if>
+            <if test="maps.status != null"> AND l.status = #{maps.status}</if>
+            <if test="maps.phone != null and maps.phone != ''"> AND u.phone = #{maps.phone}</if>
+            <if test="maps.qwUserId != null"> AND l.qw_user_id = #{maps.qwUserId}</if>
+            <if test="maps.sTime != null">
+                AND l.create_time &gt;= #{maps.sTime}
+            </if>
+            <if test="maps.eTime != null">
+                <![CDATA[ AND l.create_time < DATE_ADD(#{maps.eTime}, INTERVAL 1 DAY) ]]>
+            </if>
+        </where>
+        ORDER BY l.log_id DESC
+    </select>
 </mapper>