Kaynağa Gözat

济南联志新增部门统计token,新增限制红包记录查询只能查看本公司

lmx 2 hafta önce
ebeveyn
işleme
6c08ce2287

+ 43 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwPushCountController.java

@@ -10,6 +10,8 @@ import com.fs.common.core.page.TableSupport;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.fastGpt.domain.FastGptPushTokenTotal;
+import com.fs.fastGpt.param.FastGptPushTokenDeptTotalParam;
+import com.fs.fastGpt.vo.FastGptPushTokenDeptTotalVO;
 import com.fs.qw.domain.QwPushCount;
 import com.fs.qw.service.IQwPushCountService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -189,6 +191,47 @@ public class QwPushCountController extends BaseController {
 
 
 
+        list.add(sumTotal); // 将合计行添加到列表末尾
+
+        // 构造返回结果
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(HttpStatus.SUCCESS);
+        rspData.setMsg("查询成功");
+        rspData.setRows(list);
+        rspData.setTotal(total);
+        return rspData;
+    }
+    @PreAuthorize("@ss.hasPermi('qw:qwPushCount:tokenListDept')")
+    @GetMapping("/tokenListDept")
+    public TableDataInfo tokenListDept(FastGptPushTokenDeptTotalParam pushTokenInfo) {
+        List<FastGptPushTokenDeptTotalVO> list = qwPushCountService.selectFastGptPushTokenTotalDeptList(pushTokenInfo);
+
+
+        // 计算总和
+        FastGptPushTokenDeptTotalVO sumTotal = new FastGptPushTokenDeptTotalVO();
+        sumTotal.setCompanyName("合计"); // 假设有一个字段用于显示“合计”标签,具体字段名根据实际情况替换
+        Long sum = list.stream().mapToLong(FastGptPushTokenDeptTotalVO::getCount).sum(); // 假设有一个数字字段需要求和,具体字段名根据实际情况替换
+        sumTotal.setCount(sum); // 设置合计值,具体字段名根据实际情况替换
+
+        // 获取分页参数
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+
+        int total = list.size();
+        // 在内存中进行分页处理
+        if (pageNum != null && pageSize != null) {
+            int fromIndex = (pageNum - 1) * pageSize;
+            int toIndex = Math.min(fromIndex + pageSize, total);
+
+            // 确保索引不越界
+            if (fromIndex < total) {
+                list = list.subList(fromIndex, toIndex);
+            } else {
+                list = new ArrayList<>(); // 返回空列表
+            }
+        }
+
         list.add(sumTotal); // 将合计行添加到列表末尾
 
         // 构造返回结果

+ 7 - 0
fs-company/src/main/java/com/fs/company/controller/course/FsCourseRedPacketLogController.java

@@ -26,6 +26,7 @@ import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.OptionsVO;
 import com.fs.system.service.ISysConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
@@ -56,6 +57,8 @@ public class FsCourseRedPacketLogController extends BaseController
 
     @Autowired
     private IFsUserCoursePeriodService fsUserCoursePeriodService;
+    @Value("${cloud_host.company_name}")
+    private String signProjectName;
     /**
      * 查询短链课程看课记录列表
      */
@@ -76,6 +79,10 @@ public class FsCourseRedPacketLogController extends BaseController
             fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
         }
 
+        if("济南联志健康".equals(signProjectName)){
+            fsCourseRedPacketLog.setCompanyId( loginUser.getCompany().getCompanyId());
+        }
+
         List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
         for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
             if (ObjectUtil.isNotEmpty(fsCourseRedPacketLogListPVO.getPeriodId())){

+ 56 - 0
fs-service/src/main/java/com/fs/fastGpt/param/FastGptPushTokenDeptTotalParam.java

@@ -0,0 +1,56 @@
+package com.fs.fastGpt.param;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.Map;
+
+@Data
+public class FastGptPushTokenDeptTotalParam {
+    private Long id;
+    private Integer type;
+    private Long qwUserId;
+    private Long companyId;
+    private String companyName;
+
+    private Long count;
+    private Integer status;
+
+    private String statTime;
+
+    private Long deptId;
+    /** 搜索值 */
+    private String searchValue;
+
+    /** 创建者 */
+    private String createBy;
+
+    /** 创建时间 */
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新者 */
+    private String updateBy;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 备注 */
+    private String remark;
+
+    /** 开始时间 */
+    @JsonIgnore
+    private String beginTime;
+    /** 结束时间 */
+    @JsonIgnore
+    private String endTime;
+    /** 请求参数 */
+    private Map<String, Object> params;
+}

+ 21 - 0
fs-service/src/main/java/com/fs/fastGpt/vo/FastGptPushTokenDeptTotalVO.java

@@ -0,0 +1,21 @@
+package com.fs.fastGpt.vo;
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class FastGptPushTokenDeptTotalVO {
+    private Long id;
+    private Integer type;
+    private Long qwUserId;
+    private Long companyId;
+    @Excel(name = "公司名称")
+    private String companyName;
+    @Excel(name = "token消耗数")
+    private Long count;
+    private Integer status;
+    @Excel(name = "生成时间")
+    private String statTime;
+    private Long deptId;
+    private String deptName;
+}

+ 3 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwRestrictionPushRecordMapper.java

@@ -2,6 +2,8 @@ package com.fs.qw.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.fastGpt.domain.FastGptPushTokenTotal;
+import com.fs.fastGpt.param.FastGptPushTokenDeptTotalParam;
+import com.fs.fastGpt.vo.FastGptPushTokenDeptTotalVO;
 import com.fs.qw.domain.QwRestrictionPushRecord;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Param;
@@ -57,5 +59,6 @@ public interface QwRestrictionPushRecordMapper extends BaseMapper<QwRestrictionP
 
     List<FastGptPushTokenTotal> selectFastGptPushTokenTotalList(FastGptPushTokenTotal pushTokenInfo);
 
+    List<FastGptPushTokenDeptTotalVO>  selectFastGptPushTokenTotalDeptList(FastGptPushTokenDeptTotalParam pushTokenInfo);
 }
 

+ 4 - 0
fs-service/src/main/java/com/fs/qw/service/IQwPushCountService.java

@@ -2,6 +2,8 @@ package com.fs.qw.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.fastGpt.domain.FastGptPushTokenTotal;
+import com.fs.fastGpt.param.FastGptPushTokenDeptTotalParam;
+import com.fs.fastGpt.vo.FastGptPushTokenDeptTotalVO;
 import com.fs.qw.domain.QwPushCount;
 
 import java.util.List;
@@ -68,4 +70,6 @@ public interface IQwPushCountService extends IService<QwPushCount>{
     int deleteQwPushCountById(Long id);
 
     List<FastGptPushTokenTotal> selectFastGptPushTokenTotalList(FastGptPushTokenTotal pushTokenInfo);
+
+    List<FastGptPushTokenDeptTotalVO> selectFastGptPushTokenTotalDeptList(FastGptPushTokenDeptTotalParam pushTokenInfo);
 }

+ 7 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwPushCountServiceImpl.java

@@ -2,6 +2,8 @@ package com.fs.qw.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.fastGpt.domain.FastGptPushTokenTotal;
+import com.fs.fastGpt.param.FastGptPushTokenDeptTotalParam;
+import com.fs.fastGpt.vo.FastGptPushTokenDeptTotalVO;
 import com.fs.qw.domain.QwPushCount;
 import com.fs.qw.mapper.QwPushCountMapper;
 import com.fs.qw.mapper.QwRestrictionPushRecordMapper;
@@ -114,4 +116,9 @@ public class QwPushCountServiceImpl extends ServiceImpl<QwPushCountMapper, QwPus
     public List<FastGptPushTokenTotal> selectFastGptPushTokenTotalList(FastGptPushTokenTotal pushTokenInfo) {
         return pushRecordMapper.selectFastGptPushTokenTotalList(pushTokenInfo);
     }
+
+    @Override
+    public   List<FastGptPushTokenDeptTotalVO> selectFastGptPushTokenTotalDeptList(FastGptPushTokenDeptTotalParam pushTokenInfo){
+        return pushRecordMapper.selectFastGptPushTokenTotalDeptList(pushTokenInfo);
+    }
 }

+ 31 - 0
fs-service/src/main/resources/mapper/qw/QwRestrictionPushRecordMapper.xml

@@ -41,4 +41,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         group by ft.company_id,ft.stat_time
     </select>
+    <select id="selectFastGptPushTokenTotalDeptList" resultType="com.fs.fastGpt.vo.FastGptPushTokenDeptTotalVO">
+        SELECT
+            ft.id,
+            ft.type,
+            ft.qw_user_id AS qwUserId,
+            ft.company_id AS companyId,
+            t2.company_name AS companyName,
+            t4.dept_id as deptId,
+            t4.dept_name as deptName,
+            ft.STATUS,
+            ft.stat_time statTime,
+            sum( ft.count ) count
+        FROM
+            fastgpt_push_token_total ft
+            left join qw_user t1 on t1.id = ft.qw_user_id
+            LEFT JOIN company_user t3 ON t3.user_id = t1.company_user_id
+            LEFT JOIN company t2 ON t2.company_id = ft.company_id
+            left join company_dept t4 on t4.dept_id = t3.dept_id
+        <where>
+            <if test="type != null" >and `ft.type` = #{type} </if>
+            <if test="qwUserId != null" >and ft.qw_user_id= #{qwUserId} </if>
+            <if test="companyId != null" >and ft.company_id= #{companyId} </if>
+            <if test="deptId != null" >and t4.dept_id= #{deptId} </if>
+            <if test="status != null" >and ft.status= #{status} </if>
+            <if test="beginTime != null and endTime != null" >
+                AND date_format(ft.stat_time,'%Y-%m-%d') &gt;= #{beginTime}
+                AND date_format(ft.stat_time,'%Y-%m-%d') &lt;= #{endTime}
+            </if>
+        </where>
+        group by t4.dept_id,ft.stat_time
+    </select>
 </mapper>