overview统计
This commit is contained in:
@@ -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 = "添加聊天室成员")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -52,4 +52,6 @@ public interface TbWorkcaseMapper {
|
||||
*/
|
||||
long countWorkcases(@Param("filter") TbWorkcaseDTO filter);
|
||||
|
||||
List<TbWorkcaseDTO> countWorkcasesByType(@Param("filter") TbWorkcaseDTO filter);
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user