Sfoglia il codice sorgente

红包消耗统计 按销售公司/按员工

三七 1 settimana fa
parent
commit
6d3cdb5a2a

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

@@ -13,6 +13,7 @@ import com.fs.course.mapper.FsUserCourseVideoMapper;
 import com.fs.course.param.FsCourseRedPacketLogParam;
 import com.fs.course.service.IFsUserCoursePeriodService;
 import com.fs.course.vo.FsCourseRedPacketLogListPVO;
+import com.fs.course.vo.FsCourseRedPacketLogListVO;
 import com.fs.framework.web.service.TokenService;
 import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.OptionsVO;
@@ -209,4 +210,37 @@ public class FsCourseRedPacketLogController extends BaseController
         List<OptionsVO> optionsVOS = fsUserCourseVideoMapper.selectFsUserCourseVodeAllList(id);
         return R.ok().put("list", optionsVOS);
     }
+
+
+    /**
+    * 红包消耗统计
+    */
+    @PreAuthorize("@ss.hasPermi('course:courseRedPacketLog:countList')")
+    @PostMapping("/getRedPacketLogCount")
+    public R getRedPacketLogCount(@RequestBody FsCourseRedPacketLogParam fsCourseRedPacketLog){
+
+        PageHelper.startPage(fsCourseRedPacketLog.getPageNum(), fsCourseRedPacketLog.getPageSize());
+
+        List<FsCourseRedPacketLogListVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListCountVO(fsCourseRedPacketLog);
+
+
+        return R.ok().put("data", new PageInfo<>(list));
+    }
+
+
+    /**
+     * 导出短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseRedPacketLog:countExport')")
+    @Log(title = "红包消耗统计导出", businessType = BusinessType.EXPORT)
+    @PostMapping("/countExport")
+    public AjaxResult countExport(@RequestBody FsCourseRedPacketLogParam fsCourseRedPacketLog)
+    {
+
+        List<FsCourseRedPacketLogListVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListCountVO(fsCourseRedPacketLog);
+
+        ExcelUtil<FsCourseRedPacketLogListVO> util = new ExcelUtil<FsCourseRedPacketLogListVO>(FsCourseRedPacketLogListVO.class);
+        return util.exportExcel(list, "红包消耗统计导出");
+    }
+
 }

+ 4 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseRedPacketLogMapper.java

@@ -12,6 +12,7 @@ import com.fs.course.param.CourseRedPacketStatisticsParam;
 import com.fs.course.param.FsCourseRedPacketLogParam;
 import com.fs.course.param.FsUserCourseOrderParam;
 import com.fs.course.vo.FsCourseRedPacketLogListPVO;
+import com.fs.course.vo.FsCourseRedPacketLogListVO;
 import com.fs.course.vo.FsUserCourseOrderListPVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -138,7 +139,7 @@ public interface FsCourseRedPacketLogMapper
             "                <foreach collection=\"maps.userIds\" open=\"(\" close=\")\" separator=\",\" item=\"item\">\n" +
             "                    ${item}\n" +
             "                </foreach>\n" +
-            "            </if>" +
+            "</if>" +
             " order by l.log_id desc  "+
             "</script>"})
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVO(@Param("maps")FsCourseRedPacketLogParam fsCourseRedPacketLog);
@@ -148,6 +149,8 @@ public interface FsCourseRedPacketLogMapper
 
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVONew(FsCourseRedPacketLogParam fsCourseRedPacketLog);
 
+    List<FsCourseRedPacketLogListVO> selectFsCourseRedPacketLogListCountVO(@Param("maps") FsCourseRedPacketLogParam fsCourseRedPacketLog);
+
     @Select("select * from fs_course_red_packet_log where video_id = #{videoId} and user_id = #{userId} order by log_id desc limit 1")
     FsCourseRedPacketLog selectFsCourseRedPacketLogByTemporary(@Param("videoId") Long videoId, @Param("userId")Long userId);
 

+ 5 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseRedPacketLogParam.java

@@ -15,6 +15,7 @@ public class FsCourseRedPacketLogParam implements Serializable {
     private Long userId;
 
     private Long companyId;
+    private List<Long> companyIds;
     private Long companyUserId;
     private String companyUserName;
 
@@ -30,6 +31,10 @@ public class FsCourseRedPacketLogParam implements Serializable {
     private Long periodId;
 
     private Long status;
+    /**
+    * 1 销售公司 2 员工
+    */
+    private Long changeType;
 
     private String phone;
 

+ 2 - 0
fs-service/src/main/java/com/fs/course/service/IFsCourseRedPacketLogService.java

@@ -7,6 +7,7 @@ import com.fs.common.core.domain.R;
 import com.fs.course.domain.FsCourseRedPacketLog;
 import com.fs.course.param.FsCourseRedPacketLogParam;
 import com.fs.course.vo.FsCourseRedPacketLogListPVO;
+import com.fs.course.vo.FsCourseRedPacketLogListVO;
 
 /**
  * 短链课程看课记录Service接口
@@ -70,6 +71,7 @@ public interface IFsCourseRedPacketLogService
 
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVO(FsCourseRedPacketLogParam fsCourseRedPacketLog);
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVONew(FsCourseRedPacketLogParam fsCourseRedPacketLog);
+    List<FsCourseRedPacketLogListVO> selectFsCourseRedPacketLogListCountVO(FsCourseRedPacketLogParam fsCourseRedPacketLog);
 
     /**
      * 查询红包金额数

+ 6 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsCourseRedPacketLogServiceImpl.java

@@ -26,6 +26,7 @@ import com.fs.course.domain.FsCourseWatchLog;
 import com.fs.course.mapper.FsCourseWatchLogMapper;
 import com.fs.course.param.FsCourseRedPacketLogParam;
 import com.fs.course.vo.FsCourseRedPacketLogListPVO;
+import com.fs.course.vo.FsCourseRedPacketLogListVO;
 import com.fs.his.domain.FsUser;
 import com.fs.his.mapper.FsUserMapper;
 import com.fs.his.param.WxSendRedPacketParam;
@@ -198,6 +199,11 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
         return fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogListVONew(fsCourseRedPacketLog);
     }
 
+    @Override
+    public List<FsCourseRedPacketLogListVO> selectFsCourseRedPacketLogListCountVO(FsCourseRedPacketLogParam fsCourseRedPacketLog) {
+        return fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogListCountVO(fsCourseRedPacketLog);
+    }
+
     /**
      * 查询红包金额数
      * @param companyUserId 销售ID

+ 1 - 1
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -138,7 +138,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
     private static final String SHORT_LINK_PREFIX = "/courseH5/pages/course/learning?s=";
     // 排除看课数量限制的公司集合
     private static final Set<String> EXCLUDE_PROJECTS = new HashSet<>(Arrays.asList(
-            "福本源", "宽益堂", "叮当国医", "易行健"
+            "福本源", "宽益堂", "叮当国医", "易行健","河山医院"
     ));
     @Autowired
     ICompanyService companyService;

+ 1 - 0
fs-service/src/main/java/com/fs/course/vo/FsCourseRedPacketLogListPVO.java

@@ -23,6 +23,7 @@ public class FsCourseRedPacketLogListPVO extends BaseEntity
 
     @Excel(name = "会员id")
     private Long userId;
+
     @Excel(name = "会员名称")
     private String fsNickName;
 

+ 49 - 0
fs-service/src/main/java/com/fs/course/vo/FsCourseRedPacketLogListVO.java

@@ -0,0 +1,49 @@
+package com.fs.course.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class FsCourseRedPacketLogListVO {
+
+    private static final long serialVersionUID = 1L;
+
+    private Long logId;
+
+    @Excel(name = "销售公司")
+    private String companyName;
+
+    @Excel(name = "销售编号")
+    private Long companyUserId;
+
+
+    @Excel(name = "销售昵称")
+    private String nickName;
+
+    @Excel(name = "课程id")
+    private Long courseId;
+
+    @Excel(name = "小节id")
+    private Long videoId;
+
+    /** 转帐金额 */
+    @Excel(name = "转帐金额")
+    private BigDecimal amount;
+
+
+    @Excel(name = "部门id")
+    private Long deptId;
+
+    @Excel(name = "部门昵称")
+    private String deptName;
+
+    /** 创建时间 */
+    @Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+}

+ 0 - 1
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -2407,7 +2407,6 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
                             }
                         });
                     }
-
                     QwResult qwResult = qwApiService.sendWelcomeMsg(sendWelcomeMsgParam, corpId);
                     logger.info("发送好友欢迎语的参数:" + sendWelcomeMsgParam+"发送好友欢迎语结果:" + qwResult);
 //                    if (qwResult.getErrcode()==41050||qwResult.getErrcode()==41051){

+ 0 - 2
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -2214,8 +2214,6 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
         //异步给app用户发送消息
         asyncSopTestService.asyncSendMsgBySopAppLink(externalId,setting.getLinkTitle(),setting.getLinkDescribe(),appMsgLink);
 
-
-
         //存短链-
         fsCourseLinkMapper.insertFsCourseLink(link);
 

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

@@ -216,4 +216,66 @@ 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="selectFsCourseRedPacketLogListCountVO"
+            resultType="com.fs.course.vo.FsCourseRedPacketLogListVO">
+
+        SELECT
+        <if test="maps.changeType == 2">
+            l.company_user_id,
+            cu.nick_name,
+            cu.dept_id,
+            cd.dept_name,
+        </if>
+                c.company_name,
+                l.company_id,
+                sum(l.amount) AS amount,
+                l.create_time AS createTime
+        FROM
+                fs_course_red_packet_log l
+                INNER JOIN company c ON c.company_id = l.company_id
+                LEFT JOIN company_user cu on l.company_user_id=cu.user_id
+                LEFT JOIN company_dept cd on cu.dept_id=cd.dept_id
+        WHERE 1=1
+                  and l.create_time &gt;= #{maps.sTime}
+                  AND l.create_time &lt;#{maps.eTime}
+                  AND l.STATUS = 1
+        <if test="maps.companyIds != null and maps.companyIds.size() > 0  and maps.changeType == 1 ">
+            AND l.company_id IN
+            <foreach collection="maps.companyIds" open="(" close=")" separator="," item="item">
+                ${item}
+            </foreach>
+        </if>
+        <if test="maps.courseId != null ">
+            AND l.course_id = #{maps.courseId}
+        </if>
+        <if test="maps.courseId != null ">
+            AND l.videoId = #{maps.videoId}
+        </if>
+        <if test="maps.status != null">
+            and l.status = #{maps.status}
+        </if>
+        <if test="maps.userIds != null and maps.userIds.size() > 0 and maps.changeType == 2 ">
+          AND l.company_user_id IN
+            <foreach collection="maps.userIds" open="(" close=")" separator="," item="item">
+                ${item}
+            </foreach>
+        </if>
+        GROUP BY
+        <choose>
+            <when test="maps.companyIds != null and maps.changeType == 1 ">
+                l.company_id
+            </when>
+            <when test="maps.userIds != null and maps.userIds.size() > 0 and maps.changeType == 2 ">
+                l.company_id, l.company_user_id
+            </when>
+            <otherwise>
+                l.company_id, l.company_user_id  <!-- 默认分组方式 -->
+            </otherwise>
+        </choose>
+
+    </select>
+
+
 </mapper>