提交 12f463eb 作者: 张开石

1、修改统计纪要模板使用情况接口

父级 8f1afb93
...@@ -45,4 +45,21 @@ public class StatisticsController { ...@@ -45,4 +45,21 @@ public class StatisticsController {
return R.ok(list); return R.ok(list);
} }
/**
* 纪要模板使用情况的统计
* @param searchValue 用户部门或工号
* @param createTimeStart 开始时间
* @param createTimeEnd 结束时间
* @return
*/
@GetMapping("/exportRecordTemplateUsingInfo")
public R exportRecordTemplateUsingInfo(String searchValue,
@RequestParam("createTimeStart") Date createTimeStart,
@RequestParam("createTimeEnd") Date createTimeEnd) {
List<Map<String, String>> list =meetingInfoService.statistics(searchValue, createTimeStart, createTimeEnd);
return R.ok(list);
}
} }
...@@ -2,12 +2,10 @@ package com.cmeeting.mapper.primary; ...@@ -2,12 +2,10 @@ package com.cmeeting.mapper.primary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cmeeting.pojo.MeetingInfo; import com.cmeeting.pojo.MeetingInfo;
import com.cmeeting.vo.MeetingInfoVO;
import com.cmeeting.vo.TencentMeetingVO; import com.cmeeting.vo.TencentMeetingVO;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -20,15 +18,18 @@ public interface MeetingInfoMapper extends BaseMapper<MeetingInfo> { ...@@ -20,15 +18,18 @@ public interface MeetingInfoMapper extends BaseMapper<MeetingInfo> {
/** /**
* 统计 * 统计
*
* @param startTime * @param startTime
* @param endTime * @param endTime
* @param dateList * @param dateList
* @param userIdList
* @return * @return
*/ */
@MapKey("host_uid") @MapKey("host_uid")
List<Map<String, String>> statistics(@Param("startTime") String startTime, List<Map<String, String>> statistics(@Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,
@Param("dateList") List<String> dateList); @Param("dateList") List<String> dateList,
@Param("userIdList") List<String> userIdList);
// List<MeetingInfo> selectList(MeetingInfoVO vo); // List<MeetingInfo> selectList(MeetingInfoVO vo);
......
...@@ -44,9 +44,11 @@ public interface SysUserSysMapper extends BaseMapper<SysUserSync> { ...@@ -44,9 +44,11 @@ public interface SysUserSysMapper extends BaseMapper<SysUserSync> {
/** /**
* 获取用户信息 * 获取用户信息
* @param userIdList *
* @param searchValue
* @return * @return
*/ */
@MapKey("userId") @MapKey("userId")
List<Map<String, String>> selectParamByUserIdList(@Param("userIdList") List<String> userIdList); List<Map<String, String>> selectParamByUserIdList(@Param("tenantId") String tenantId,
@Param("searchValue") String searchValue);
} }
...@@ -10,8 +10,6 @@ import cn.hutool.core.date.DateField; ...@@ -10,8 +10,6 @@ import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
...@@ -86,6 +84,8 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -86,6 +84,8 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
private String tencentAdminUserId; private String tencentAdminUserId;
@Value(value = "${llm.api-addr}") @Value(value = "${llm.api-addr}")
private String llmApiAddr; private String llmApiAddr;
@Value("${permission.tenantId}")
public String permissionTenantId;
@Resource @Resource
private ProcessLogService processLogService; private ProcessLogService processLogService;
@Resource @Resource
...@@ -269,46 +269,45 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -269,46 +269,45 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
List<String> dateList = DateUtil.rangeToList(createTimeStart, createTimeEnd, DateField.DAY_OF_YEAR).stream() List<String> dateList = DateUtil.rangeToList(createTimeStart, createTimeEnd, DateField.DAY_OF_YEAR).stream()
.map(date -> DateUtil.format(date, "yyyy-MM-dd")) .map(date -> DateUtil.format(date, "yyyy-MM-dd"))
.collect(Collectors.toList()); .collect(Collectors.toList());
List<Map<String, String>> userInfoList = sysUserSysMapper.selectParamByUserIdList(permissionTenantId, searchValue);
List<String> userIdList = userInfoList.stream().map(map -> map.get("userId")).collect(Collectors.toList());
String startTime = DateUtil.format(createTimeStart, "yyyy-MM-dd"); String startTime = DateUtil.format(createTimeStart, "yyyy-MM-dd");
String endTime = DateUtil.format(createTimeEnd, "yyyy-MM-dd"); String endTime = DateUtil.format(createTimeEnd, "yyyy-MM-dd");
List<Map<String, String>> list = meetingInfoMapper.statistics(startTime, endTime, dateList); List<Map<String, String>> statisticsList = meetingInfoMapper.statistics(startTime, endTime, dateList, userIdList);
List<String> userIdList = list.stream().map(map -> map.get("userId")).collect(Collectors.toList());
for (Map<String, String> userInfo : userInfoList) {
List<Map<String, String>> userInfoList = sysUserSysMapper.selectParamByUserIdList(userIdList); String userId = userInfo.get("userId");
for (Map<String, String> map : list) { statisticsList.stream().filter(statistics -> statistics.get("userId").equals(userId)).findFirst().ifPresent(userInfo::putAll);
String userId = map.get("userId");
userInfoList.stream().filter(userInfo -> userInfo.get("userId").equals(userId)).findFirst().ifPresent(userInfo -> {
map.put("name", userInfo.get("name"));
map.put("deptName", userInfo.get("deptName"));
});
// 横向加法 // 横向加法
Integer sum = map.values().stream() Integer sum = userInfo.values().stream()
// 小于4是为了和用户编号区分开 // 小于4是为了和用户编号区分开
.filter(value -> NumberUtil.isNumber(value) && value.length() < 4) .filter(value -> NumberUtil.isNumber(value) && value.length() < 4)
.map(value -> Integer.parseInt(value)) .map(value -> Integer.parseInt(value))
.reduce(Integer::sum) .reduce(Integer::sum)
.orElse(0); .orElse(0);
map.put("sum", sum.toString()); userInfo.put("sum", sum.toString());
} }
userInfoList.removeIf(map -> !map.containsKey("host_uid"));
// 初始化一行用来纵向加和 // 初始化一行用来纵向加和
Map<String, String> map = new LinkedHashMap<>(); Map<String, String> lastRowMap = new LinkedHashMap<>();
for (String key : list.get(0).keySet()) { for (String key : userInfoList.get(0).keySet()) {
map.put(key, ""); lastRowMap.put(key, "");
} }
for (Map<String, String> stringMap : list) { for (Map<String, String> stringMap : userInfoList) {
for (Map.Entry<String, String> entry : stringMap.entrySet()) { for (Map.Entry<String, String> entry : stringMap.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
String value = entry.getValue(); String value = entry.getValue();
if (NumberUtil.isNumber(value) && value.length() < 4) { if (NumberUtil.isNumber(value) && value.length() < 4) {
map.put(key, String.valueOf(NumberUtil.add(map.get(key), value))); lastRowMap.put(key, String.valueOf(NumberUtil.add(lastRowMap.get(key), value)));
} }
} }
} }
map.put("userId", "总计"); lastRowMap.put("userId", "总计");
list.add(map); userInfoList.add(lastRowMap);
return list; return userInfoList;
} }
/** /**
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
select meeting_id,sub_meeting_id from cmt_meeting_info select meeting_id,sub_meeting_id from cmt_meeting_info
</select> </select>
<select id="statistics" resultType="java.util.LinkedHashMap"> <select id="statistics" resultType="java.util.LinkedHashMap">
SELECT SELECT
userid.wid as userId, userid.wid as userId,
...@@ -52,9 +51,17 @@ ...@@ -52,9 +51,17 @@
WHERE WHERE
date_format(sync_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime} date_format(sync_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
GROUP BY host_uid, date_format(sync_time, '%Y-%m-%d') GROUP BY host_uid, date_format(sync_time, '%Y-%m-%d')
) AS t ) AS t,
join userid ON userid.tid COLLATE utf8mb4_general_ci = t.host_uid COLLATE utf8mb4_general_ci userid
GROUP BY t.host_uid, userid.wid where
userid.tid COLLATE utf8mb4_general_ci = t.host_uid COLLATE utf8mb4_general_ci
<if test="userIdList.size > 0">
and userid.wid in
<foreach item="userId" collection="userIdList" open="(" separator="," close=")" index="index">
#{userId}
</foreach>
</if>
GROUP BY t.host_uid, userid.wid
</select> </select>
......
...@@ -149,19 +149,17 @@ ...@@ -149,19 +149,17 @@
<select id="selectParamByUserIdList" resultType="java.util.Map"> <select id="selectParamByUserIdList" resultType="java.util.Map">
SELECT SELECT
sys_user_sync.user_id as userId, sys_user_sync_category.`name` as deptName,
sys_user_sync.`name`, sys_user_sync.`name`,
sys_user_sync_category.`name` as deptName sys_user_sync.user_id as userId
FROM FROM
sys_user_sync, sys_user_sync,
sys_user_sync_category sys_user_sync_category
<where> <where>
sys_user_sync.tenant_id = #{tenantId}
and sys_user_sync.dept_id = sys_user_sync_category.dept_id and sys_user_sync.dept_id = sys_user_sync_category.dept_id
<if test="userIdList.size > 0"> <if test="searchValue != null and searchValue != ''">
and sys_user_sync.user_id in and (sys_user_sync.user_id like concat('%',#{searchValue},'%') or sys_user_sync.name like concat('%',#{searchValue},'%') or sys_user_sync_category.name like concat('%',#{searchValue},'%'))
<foreach item="userId" collection="userIdList" index="index" separator="," close=")" open="(">
#{userId}
</foreach>
</if> </if>
</where> </where>
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论