feat: 到期提醒和项目进展统计接口
This commit is contained in:
@@ -90,6 +90,13 @@ public class CommentController {
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/latest")
|
||||
@Operation(summary = "获得最新的评论列表")
|
||||
public CommonResult<List<CommentTreeRespVO>> getLatestCommentList() {
|
||||
List<CommentTreeRespVO> list = commentService.getLatestCommentList();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出评论 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('license:comment:export')")
|
||||
|
||||
@@ -21,6 +21,9 @@ public class CommentTreeRespVO {
|
||||
@ExcelProperty("项目ID")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "项目名称", example = "18334")
|
||||
private String projectName;
|
||||
|
||||
@Schema(description = "用户ID", example = "30248")
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@@ -127,6 +127,14 @@ public class LicenseController {
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/list-expiry")
|
||||
@Operation(summary = "获得License到期列表")
|
||||
@PreAuthorize("@ss.hasPermission('license:license:query')")
|
||||
public CommonResult<List<LicenseRespVO>> getLicenseByExpiryDate() {
|
||||
List<LicenseRespVO> licenseHistory = licenseService.getLicenseByExpiryDate();
|
||||
return success(licenseHistory);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出License Excel")
|
||||
@PreAuthorize("@ss.hasPermission('license:license:export')")
|
||||
|
||||
@@ -37,4 +37,6 @@ public interface CommentMapper extends BaseMapperX<CommentDO> {
|
||||
}
|
||||
|
||||
List<CommentTreeRespVO> getCommentList(@Param("projectId") Long projectId);
|
||||
|
||||
List<CommentTreeRespVO> getLatestCommentList();
|
||||
}
|
||||
@@ -7,6 +7,9 @@ import org.agt.module.license.controller.admin.license.vo.LicensePageReqVO;
|
||||
import org.agt.module.license.dal.dataobject.license.LicenseDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* License Mapper
|
||||
*
|
||||
@@ -31,6 +34,13 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
|
||||
.orderByDesc(LicenseDO::getApplicationTime));
|
||||
}
|
||||
|
||||
default List<LicenseDO> selectListByExpiryDate() {
|
||||
return selectList(new LambdaQueryWrapperX<LicenseDO>()
|
||||
.gt(LicenseDO::getExpiryDate, LocalDateTime.now())
|
||||
.last("limit 10")
|
||||
.orderByDesc(LicenseDO::getApplicationTime));
|
||||
}
|
||||
|
||||
default LicenseDO selectBySn(String sn) {
|
||||
return selectOne(LicenseDO::getSerialNo, sn);
|
||||
}
|
||||
|
||||
@@ -54,4 +54,6 @@ public interface CommentService {
|
||||
List<CommentDO> getCommentList(CommentListReqVO listReqVO);
|
||||
|
||||
List<CommentTreeRespVO> getCommentTree(Long projectId, Boolean sort);
|
||||
|
||||
List<CommentTreeRespVO> getLatestCommentList();
|
||||
}
|
||||
@@ -165,6 +165,12 @@ public class CommentServiceImpl implements CommentService {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommentTreeRespVO> getLatestCommentList() {
|
||||
return commentMapper.getLatestCommentList();
|
||||
}
|
||||
|
||||
|
||||
public static List<CommentTreeRespVO> getChildren(CommentTreeRespVO root, List<CommentTreeRespVO> all, int i) {
|
||||
return all.stream().filter(c -> Objects.equals(c.getParentId(), root.getId()))
|
||||
.peek(c -> {
|
||||
|
||||
@@ -80,6 +80,8 @@ public interface LicenseService {
|
||||
*/
|
||||
PageResult<LicenseRespVO> getLicensePage(LicensePageReqVO pageReqVO);
|
||||
|
||||
List<LicenseRespVO> getLicenseByExpiryDate();
|
||||
|
||||
/**
|
||||
* 校验License的sn是否唯一
|
||||
*
|
||||
|
||||
@@ -562,6 +562,13 @@ public class LicenseServiceImpl implements LicenseService {
|
||||
return voPageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LicenseRespVO> getLicenseByExpiryDate() {
|
||||
List<LicenseDO> licenseDOS = licenseMapper.selectListByExpiryDate();
|
||||
return BeanUtils.toBean(licenseDOS, LicenseRespVO.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean validateLicenseSnUnique(String sn, Long id) {
|
||||
if (StrUtil.isBlank(sn)) {
|
||||
|
||||
@@ -24,5 +24,36 @@
|
||||
c.update_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getLatestCommentList" resultType="org.agt.module.license.controller.admin.comment.vo.CommentTreeRespVO">
|
||||
SELECT
|
||||
c.*,
|
||||
u.nickname author,
|
||||
u.avatar,
|
||||
p.`name` project_name
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
c.project_id,
|
||||
max( c.update_time ) max_update_time
|
||||
FROM
|
||||
crm_comment c
|
||||
LEFT JOIN system_users u ON c.user_id = u.id
|
||||
AND u.deleted = 0
|
||||
WHERE
|
||||
c.deleted = 0
|
||||
GROUP BY
|
||||
c.project_id
|
||||
) g
|
||||
LEFT JOIN crm_comment c ON g.project_id = c.project_id
|
||||
AND g.max_update_time = c.update_time
|
||||
AND c.deleted = 0
|
||||
LEFT JOIN system_users u ON c.user_id = u.id
|
||||
AND u.deleted = 0
|
||||
LEFT JOIN crm_project p ON c.project_id = p.id
|
||||
AND p.deleted = 0
|
||||
ORDER BY
|
||||
c.update_time DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user