From 6a9755ef19272956bfedbd0a49756edfc6cef4a1 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 02 Nov 2021 11:08:38 +0800 Subject: [PATCH] add numOfPeople rank --- zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java | 10 +++++ zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml | 46 +++++++++++++++++++++++ zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java | 2 + zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java | 3 + 4 files changed, 60 insertions(+), 1 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java index f3d4d1f..a958918 100644 --- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java +++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java @@ -86,4 +86,14 @@ achieveNew.setT1(rankingDto.getType()); return AjaxResult.buildSuccessInstance(achieveNewDao.selectBeauticianConsumeAchieveRanking(achieveNew)); } + + @ApiOperation(value = "人头数排名", notes = "人头数排名") + @PostMapping(value = "/findNumOfPeopleRanking") + public AjaxResult findNumOfPeopleRanking(@RequestBody RankingDto rankingDto) { + AchieveNew achieveNew = new AchieveNew(); + QueryUtil.setQueryLimitCom(achieveNew); + achieveNew.setDatatime(new Date()); + achieveNew.setT1(rankingDto.getType()); + return AjaxResult.buildSuccessInstance(achieveNewDao.selectNumOfPeopleAchieveRanking(achieveNew)); + } } diff --git a/zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java b/zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java index 3c3d788..428491e 100644 --- a/zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java +++ b/zq-erp/src/main/java/com/matrix/system/app/dto/RankingDto.java @@ -18,11 +18,12 @@ public static final String DAY = "1"; public static final String MONTH = "2"; public static final String YEAR = "3"; + public static final String WEEK = "4"; @ApiModelProperty(value = "数据类型 1-销售 2-消耗", example = "1") private String dataType; - @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜", example = "1") + @ApiModelProperty(value = "排行榜类型 1-日榜 2-月榜 3-年榜 4-周榜", example = "1") private String type; public String getDataType() { diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java index 482ad02..e0bcaa2 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java @@ -91,4 +91,6 @@ IPage<AchieveNewStatisticsVo> achieveNewStatistics(Page<AchieveNewStatisticsVo> page, @Param("record")AchieveNewStatisticsDto queryDto); void setPayMethod(@Param("paymethod") String paymethod, @Param("list") ArrayList<Long> ids); + + List<RankingVo> selectNumOfPeopleAchieveRanking(@Param("record") AchieveNew achieveNew); } \ No newline at end of file diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml index 99190d7..9c23401 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml @@ -989,6 +989,9 @@ <if test='record.t1 == "3" and record.datatime != null'> and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y') </if> + <if test='record.t1 == "4" and record.datatime != null'> + and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u') + </if> </where> group by a.shop_id order by amount desc, a.shop_id @@ -1020,6 +1023,9 @@ </if> <if test='record.t1 == "3" and record.datatime != null'> and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y') + </if> + <if test='record.t1 == "4" and record.datatime != null'> + and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u') </if> </where> group by a.beault_id @@ -1066,6 +1072,9 @@ <if test='record.type == "3" and record.datatime != null'> and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y') </if> + <if test='record.t1 == "4" and record.datatime != null'> + and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u') + </if> </where> group by b.su_id order by amount desc, b.su_id @@ -1092,6 +1101,9 @@ </if> <if test='record.t1 == "3" and record.datatime != null'> and date_format(a.create_time, '%Y') = date_format(#{record.datatime}, '%Y') + </if> + <if test='record.t1 == "4" and record.datatime != null'> + and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u') </if> </where> group by a.shop_id @@ -1193,4 +1205,38 @@ </update> + + <select id="selectNumOfPeopleAchieveRanking" resultType="com.matrix.system.app.vo.RankingVo"> + select + b.su_name name, + b.su_id id, + b.su_photo photo, + sum(number_of_people) amount, + c.shop_short_name shopName + from achieve_new a + inner join sys_users b on a.beault_id=b.su_id + left join sys_shop_info c on a.shop_id=c.ID + <where> + <if test="record.companyId != null"> + and a.company_id=#{record.companyId} + </if> + <if test="record.shopId != null"> + and a.shop_id=#{record.shopId} + </if> + <if test='record.t1 == "1" and record.datatime != null'> + and date_format(datatime, '%Y-%m-%d') = date_format(#{record.datatime}, '%Y-%m-%d') + </if> + <if test='record.t1 == "2" and record.datatime != null'> + and date_format(datatime, '%Y-%m') = date_format(#{record.datatime}, '%Y-%m') + </if> + <if test='record.t1 == "3" and record.datatime != null'> + and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y') + </if> + <if test='record.t1 == "4" and record.datatime != null'> + and date_format(datatime, '%Y-%m-%d %u') = date_format(#{record.datatime}, '%Y-%m-%d %u') + </if> + </where> + group by a.beault_id + order by amount desc + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1