mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
📖 CRM:code review 合同金额排行榜、回款金额排行榜
This commit is contained in:
@ -3,8 +3,7 @@ GET {{baseUrl}}/bi/rank/contract-ranKing
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenentId}}
|
||||
|
||||
|
||||
### 回款金额排行榜
|
||||
GET {{baseUrl}}/bi/rank/receivables-ranKing
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenentId}}
|
||||
tenant-id: {{adminTenentId}}
|
@ -19,6 +19,7 @@ import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
// TODO @anhaohao:写了 swagger 注解,不写注释哈
|
||||
/**
|
||||
* @author anhaohao
|
||||
*/
|
||||
@ -50,4 +51,5 @@ public class BiRankingController {
|
||||
public CommonResult<List<BiReceivablesRanKingRespVO>> receivablesRanKing(BiRankReqVO biRankReqVO) {
|
||||
return success(biRankingService.receivablesRanKing(biRankReqVO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bi.controller.admin.ranking.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
// TODO @anhaohao:VO 类有 swagger 注解,不写注释哈
|
||||
/**
|
||||
* 管理后台 - BI 排行榜 Response VO
|
||||
*
|
||||
@ -12,13 +13,14 @@ import lombok.Data;
|
||||
@Data
|
||||
public class BiContractRanKingRespVO {
|
||||
|
||||
// TODO @anhaohao:如果一定返回的字段,需要加 requiredMode = Schema.RequiredMode.REQUIRED, 哈
|
||||
@Schema(description = "金额", example = "1")
|
||||
private Integer price;
|
||||
|
||||
@Schema(description = "姓名", example = "1")
|
||||
private String nickname;
|
||||
|
||||
|
||||
@Schema(description = "部门名称", example = "1")
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO @anhaohao:这个类的命名,还是保持和其它一致使用 ReqVO 结尾;例如说,CrmStatisticsCommonParamReqVO
|
||||
/**
|
||||
* @author anhaohao
|
||||
* bi参数
|
||||
@ -25,17 +26,19 @@ public class BiParams extends PageParam {
|
||||
@Schema(description = "用户IDs")
|
||||
private List<Long> userIds;
|
||||
|
||||
// TODO @anhaohao:这个字段,可以融合到 startTime、endTime 里去,交给前端计算哈;
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
// TODO @anhaohao:还是使用 LocalDateTime
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
// TODO @anhaohao:这个字段,是不是直接只基于 deptId 和 userId 来判断即可哈?
|
||||
@Schema(description = "0 部门 1员工")
|
||||
private Integer isUser = 1;
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ public class BiRankReqVO {
|
||||
@Schema(description = "部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
|
||||
// TODO @anhaohao:这个字段,参考 BiParams 的 type 建议
|
||||
@Schema(description = "分析类型(1.今天 2.昨天 3.本周 4.上周 5.本月 6.上月 7.本季度 8.上季度 9.本年 10 上年)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private String type;
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bi.controller.admin.ranking.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
// TODO @anhaohao:参考 BiContractRanKingRespVO 的建议
|
||||
/**
|
||||
* 管理后台 - BI 排行榜 Response VO
|
||||
*
|
||||
@ -20,4 +21,5 @@ public class BiReceivablesRanKingRespVO {
|
||||
|
||||
@Schema(description = "部门名称", example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
}
|
||||
|
@ -3,5 +3,8 @@
|
||||
* 例如说:报表、图表、数据分析等等
|
||||
* <p>
|
||||
* 1. Controller URL:以 /bi/ 开头,避免和其它 Module 冲突
|
||||
*
|
||||
* TODO @anhaohao:mall 当时独立拆分一个 statistics 模块的原因,是因为 mall 拆分了多个模块,没有模块适合承接统计的能力,所以独立了。
|
||||
* TODO crm 因为没有拆分,所以可以直接放在 crm 模块下面;这样,我们可以在 controller/admin 和 service 下,新建一个 bi 包,专门放置统计的代码。
|
||||
*/
|
||||
package cn.iocoder.yudao.module.bi;
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
*
|
||||
* @author anhaohao
|
||||
*/
|
||||
public interface BiRankingService {
|
||||
public interface BiRankingService { // TODO @anhaohao:第一个方法,和类要有一个空行
|
||||
/**
|
||||
* 合同金额排行榜
|
||||
*
|
||||
|
@ -28,6 +28,7 @@ public class BiTimeUtil {
|
||||
// 解析时间
|
||||
BiTimeEntity biTimeEntity = analyzeTime(biParams);
|
||||
// 解析权限
|
||||
// TODO @anhaohao:涉及到数据的读取,不放在 Util 里,还是搞会到 Service 哈;
|
||||
biTimeEntity.setUserIds(analyzeAuth(biParams));
|
||||
return biTimeEntity;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
resultType="cn.iocoder.yudao.module.bi.controller.admin.ranking.vo.BiContractRanKingRespVO">
|
||||
SELECT IFNULL(SUM(t.price), 0) AS price, su.nickname, t.owner_user_id, dept.name AS deptName
|
||||
FROM crm_contract t
|
||||
<!-- TODO @anhaohao:system_users、system_dept 是不是没用到?尽量不连这 2 个表,微服务下会是独立仓库;如果显示需要,可以在 service 读取后拼接; -->
|
||||
LEFT JOIN system_users AS su ON su.id = t.owner_user_id
|
||||
LEFT JOIN system_dept AS dept ON dept.id = su.dept_id
|
||||
WHERE t.deleted = 0
|
||||
@ -17,10 +18,12 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- TODO @anhaohao:在某个区间的时间,这么做有点浪费性能;一般做法是 beginTime 是开始时间(00:00:00),finalTime 是结束时间(23:59:59),这样实现的; -->
|
||||
AND DATE_FORMAT(t.order_date,'${sqlDateFormat}') between #{beginTime} and #{finalTime}
|
||||
GROUP BY t.owner_user_id
|
||||
ORDER BY price DESC
|
||||
</select>
|
||||
|
||||
<select id="receivablesRanKing"
|
||||
resultType="cn.iocoder.yudao.module.bi.controller.admin.ranking.vo.BiReceivablesRanKingRespVO">
|
||||
SELECT IFNULL(SUM(t.price), 0) AS price, su.nickname, t.owner_user_id, dept.name AS deptName
|
||||
|
Reference in New Issue
Block a user