overview统计

This commit is contained in:
2026-01-01 16:19:55 +08:00
parent eb15706ccc
commit b53faca120
17 changed files with 425 additions and 40 deletions

View File

@@ -72,6 +72,14 @@ public interface ChatRoomService {
*/
ResultDomain<ChatRoomVO> getChatRoomPage(PageRequest<TbChatRoomDTO> pageRequest, String userId);
/**
* @description 统计聊天室数量
* @param filter 筛选条件
* @author yslg
* @since 2026-01-01
*/
ResultDomain<Long> countChatRooms(TbChatRoomDTO filter);
// ========================= 聊天室成员管理 ==========================
/**

View File

@@ -0,0 +1,29 @@
package org.xyzh.api.workcase.service;
import org.xyzh.api.workcase.dto.TbWordCloudDTO;
import org.xyzh.common.core.domain.ResultDomain;
import org.xyzh.common.core.page.PageRequest;
/**
* @description 词云服务接口
* @filename WordCloudService.java
* @author yslg
* @copyright xyzh
* @since 2025-12-19
*/
public interface WordCloudService {
/**
* 查询词云列表
* @param filter 筛选条件
* @return 词云列表
*/
ResultDomain<TbWordCloudDTO> getWordCloudList(TbWordCloudDTO filter);
/**
* 分页查询词云
* @param pageRequest 分页请求
* @return 词云分页数据
*/
ResultDomain<TbWordCloudDTO> getWordCloudPage(PageRequest<TbWordCloudDTO> pageRequest);
}

View File

@@ -55,6 +55,22 @@ public interface WorkcaseService {
*/
ResultDomain<TbWorkcaseDTO> getWorkcasePage(PageRequest<TbWorkcaseDTO> pageRequest);
/**
* @description 统计各个类型的工单数量
* @param filter
* @author yslg
* @since 2026-01-01
*/
ResultDomain<TbWorkcaseDTO> countWorkcasesByType(TbWorkcaseDTO filter);
/**
* @description 统计工单数量
* @param filter
* @author yslg
* @since 2026-01-01
*/
ResultDomain<Long> countWorkcases(TbWorkcaseDTO filter);
/**
* @description 获取工单详情
* @param workcaseId

View File

@@ -50,6 +50,9 @@ public class BaseDTO implements Serializable {
@Schema(description = "数量限制")
private Integer limit;
@Schema(description = "统计数量")
private Integer count;
@Schema(description = "开始时间")
private Date startTime;

View File

@@ -162,7 +162,7 @@ public class WorkcaseChatController {
if (!vr.isValid()) {
return ResultDomain.failure(vr.getAllErrors());
}
LoginDomain loginDomain = LoginUtil.getCurrentLogin();
String userId = loginDomain.getUser().getUserId();
if("guest".equals(loginDomain.getUser().getStatus())){
@@ -171,6 +171,13 @@ public class WorkcaseChatController {
return chatRoomService.getChatRoomPage(pageRequest, userId);
}
@Operation(summary = "统计聊天室数量")
@PreAuthorize("hasAuthority('workcase:room:view')")
@PostMapping("/room/count")
public ResultDomain<Long> countChatRooms(@RequestBody TbChatRoomDTO filter) {
return chatRoomService.countChatRooms(filter);
}
// ========================= ChatRoom成员管理 =========================
@Operation(summary = "添加聊天室成员")

View File

@@ -19,6 +19,7 @@ import org.xyzh.common.auth.utils.LoginUtil;
import org.xyzh.common.core.domain.LoginDomain;
import org.xyzh.common.core.domain.ResultDomain;
import org.xyzh.common.core.page.PageRequest;
import org.xyzh.common.utils.validation.ValidationParam;
import org.xyzh.common.utils.validation.ValidationResult;
import org.xyzh.common.utils.validation.ValidationUtils;
@@ -26,6 +27,8 @@ import com.alibaba.fastjson2.JSONObject;
import io.swagger.v3.oas.annotations.Operation;
import java.util.Arrays;
import java.util.Date;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
@@ -116,6 +119,49 @@ public class WorkcaseController {
return workcaseService.getWorkcasePage(pageRequest);
}
@Operation(summary = "查询工单问题统计")
@PreAuthorize("hasAuthority('workcase:ticket:view')")
@PostMapping("/category/count")
public ResultDomain<TbWorkcaseDTO> countWorkcasesByType(@RequestBody TbWorkcaseDTO workcase) {
ValidationResult vr = ValidationUtils.validate(workcase, Arrays.asList(
ValidationParam.builder()
.fieldName("startTime")
.fieldLabel("统计开始时间")
.required()
.build(),
// 校验结束时间不为空
ValidationParam.builder()
.fieldName("endTime")
.fieldLabel("统计结束时间")
.required()
.build(),
// 校验开始时间小于结束时间(使用 fieldCompare 比较两个字段)
ValidationUtils.fieldCompare(
"startTime",
"endTime",
"统计时间",
(startTime, endTime) -> {
if (startTime instanceof Date && endTime instanceof Date) {
return ((Date) startTime).before((Date) endTime);
}
return true;
},
"统计开始时间不能晚于结束时间"
)
));
if (!vr.isValid()) {
return ResultDomain.failure(vr.getAllErrors());
}
return workcaseService.countWorkcasesByType(workcase);
}
@Operation(summary = "统计工单数量")
@PreAuthorize("hasAuthority('workcase:ticket:view')")
@PostMapping("/count")
public ResultDomain<Long> countWorkcases(@RequestBody TbWorkcaseDTO workcase) {
return workcaseService.countWorkcases(workcase);
}
// ========================= CRM同步接口 =========================
@Operation(summary = "同步工单到CRM")

View File

@@ -52,4 +52,6 @@ public interface TbWorkcaseMapper {
*/
long countWorkcases(@Param("filter") TbWorkcaseDTO filter);
List<TbWorkcaseDTO> countWorkcasesByType(@Param("filter") TbWorkcaseDTO filter);
}

View File

@@ -219,6 +219,12 @@ public class ChatRoomServiceImpl implements ChatRoomService {
return ResultDomain.success("查询聊天室成功", pageDomain);
}
@Override
public ResultDomain<Long> countChatRooms(TbChatRoomDTO filter) {
long count = chatRoomMapper.countChatRooms(filter);
return ResultDomain.success("查询成功", count);
}
// ========================= 聊天室成员管理 ==========================
@Override

View File

@@ -227,6 +227,18 @@ public class WorkcaseServiceImpl implements WorkcaseService {
return ResultDomain.success("查询成功", pageDomain);
}
@Override
public ResultDomain<TbWorkcaseDTO> countWorkcasesByType(TbWorkcaseDTO filter) {
List<TbWorkcaseDTO> workcases = workcaseMapper.countWorkcasesByType(filter);
return ResultDomain.success("查询成功", workcases);
}
@Override
public ResultDomain<Long> countWorkcases(TbWorkcaseDTO filter) {
long count = workcaseMapper.countWorkcases(filter);
return ResultDomain.success("查询成功", count);
}
// ====================== 同步到CRM和接收 ===================
@Override

View File

@@ -158,6 +158,9 @@
<if test="filter.status != null and filter.status != ''">AND status = #{filter.status}</if>
<if test="filter.guestId != null and filter.guestId != ''">AND guest_id = #{filter.guestId}</if>
<if test="filter.guestName != null and filter.guestName != ''">AND guest_name LIKE CONCAT('%', #{filter.guestName}, '%')</if>
<if test="filter.startTime != null and filter.endTime != null">
AND create_time BETWEEN #{filter.startTime} AND #{filter.endTime}
</if>
AND deleted = false
</where>
</select>

View File

@@ -83,6 +83,9 @@
</if>
</where>
ORDER BY frequency DESC, create_time DESC
<if test="filter.limit != null and filter.limit > 0">
LIMIT #{filter.limit}
</if>
</select>
<select id="selectWordCloudPage" resultMap="BaseResultMap">

View File

@@ -207,4 +207,13 @@
</where>
</select>
<select id="countWorkcasesByType" resultType="org.xyzh.api.workcase.dto.TbWorkcaseDTO">
SELECT type, COUNT(*) as count
FROM workcase.tb_workcase
WHERE create_time BETWEEN #{filter.startTime} AND #{filter.endTime}
AND deleted = false
GROUP BY type
ORDER BY count DESC
</select>
</mapper>