feat:android删除
This commit is contained in:
1 parent
ab5d7bb4dd
commit
a3b0db63b3
11 files changed
+220
-6
No files matched your search
+1
-1
@@ -138,7 +138,7 @@ public class CanteenCategoryController {
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/getAllSimple")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')")
|
||||
// @PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')")
|
||||
public R getAllSimple(@RequestParam(value = "categoryType", required = false) String categoryType,
|
||||
@RequestParam(value = "name", required = false) String name) {
|
||||
LambdaQueryWrapper<CanteenCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
|
||||
+46
-2
@@ -1,18 +1,62 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.order;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardChartLatitudeVo {
|
||||
|
||||
@Schema(description = "早餐、中餐、晚餐")
|
||||
private String hourType;
|
||||
|
||||
/**
|
||||
* 每天的交易量
|
||||
*/
|
||||
private Long dayCount;
|
||||
private Long dayCount = 0L;
|
||||
|
||||
/**
|
||||
* 每天的交易金额
|
||||
*/
|
||||
private Long dayPrice;
|
||||
private Long dayPrice = 0L;
|
||||
|
||||
/**
|
||||
* 每周的交易量
|
||||
*/
|
||||
private Long weekCount = 0L;
|
||||
|
||||
/**
|
||||
* 每周的交易
|
||||
*/
|
||||
private Long weekPrice = 0L;
|
||||
|
||||
/**
|
||||
* 每月的交易金额
|
||||
*/
|
||||
private Long monthCount = 0L;
|
||||
|
||||
/**
|
||||
* 每月的交易金额
|
||||
*/
|
||||
private Long monthPrice = 0L;
|
||||
|
||||
/**
|
||||
* 每年的交易金额
|
||||
*/
|
||||
private Long yearCount = 0L;
|
||||
|
||||
/**
|
||||
* 每年的交易金额
|
||||
*/
|
||||
private Long yearPrice = 0L;
|
||||
|
||||
/**
|
||||
* 全部交易量
|
||||
*/
|
||||
private Long totalCount = 0L;
|
||||
|
||||
/**
|
||||
* 全部交易金额
|
||||
*/
|
||||
private Long totalPrice = 0L;
|
||||
|
||||
}
|
||||
+2
@@ -16,4 +16,6 @@ public class HardOrderSumAndCountDto {
|
||||
|
||||
private Long walletTypeId;
|
||||
|
||||
private List<Long> mchIds;
|
||||
|
||||
}
|
||||
+4
@@ -1,11 +1,15 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.order;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardHourTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardOrderSumAndCountVo {
|
||||
|
||||
@Schema(description = "早餐、中餐、晚餐")
|
||||
private String hourType;
|
||||
|
||||
@Schema(description = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
|
||||
@@ -154,6 +154,12 @@
|
||||
<version>2.0.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.12.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
+4
-3
@@ -8,6 +8,7 @@ import com.bsd.pjcloud.hard.api.dto.async.SyncOfflineReqVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardBindDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardChartLatitudeVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardInvoiceVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.manager.HardManagerVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.android.HardAdUserVo;
|
||||
@@ -116,9 +117,9 @@ public class HardApiController {
|
||||
}
|
||||
|
||||
@GetMapping("/chart-latitude")
|
||||
@Operation(summary = "统计每天、每周、每月、每年")
|
||||
public R<HardChartLatitudeVo> totalChart(@RequestParam String card) {
|
||||
return R.ok(hardApiService.totalChart(card));
|
||||
@Operation(summary = "统计每天、每周、每月、每年的交易人数和次数")
|
||||
public R<List<HardChartLatitudeVo>> chartLatitude(@RequestParam Long merchantId) {
|
||||
return R.ok(hardOrderTotalService.chartLatitude(merchantId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardChartLatitudeVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderSumAndCountDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
@@ -96,5 +97,7 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
|
||||
List<HardOrderSumAndCountVo> sumAndCount(@Param("dto") HardOrderSumAndCountDto dto);
|
||||
|
||||
List<HardOrderSumAndCountVo> sumAndCountTotalByHourType(@Param("dto") HardOrderSumAndCountDto dto);
|
||||
|
||||
HardZyCardSyncVo totalYearMonthDay(@Param("dto") HardOrderDto hardOrderDto);
|
||||
}
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardChartLatitudeVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.android.HardAdUserVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
|
||||
+6
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardChartLatitudeVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.*;
|
||||
@@ -39,4 +40,9 @@ public interface HardOrderTotalService {
|
||||
* 正元统计交易数据同步
|
||||
*/
|
||||
HardZyCardSyncVo totalYearMonthDay(HardOrderDto dto);
|
||||
|
||||
/**
|
||||
* 统计每天、每周、每月、每年的交易人数和次数
|
||||
*/
|
||||
List<HardChartLatitudeVo> chartLatitude(Long merchantId);
|
||||
}
|
||||
+106
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
|
||||
@@ -16,6 +17,7 @@ import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.manager.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.CurrentUserHardTypeInfoDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardChartLatitudeVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderSumAndCountDto;
|
||||
@@ -38,6 +40,13 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -474,4 +483,101 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
|
||||
public HardZyCardSyncVo totalYearMonthDay(HardOrderDto dto) {
|
||||
return hardOrderMapper.totalYearMonthDay(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计每天、每周、每月、每年的交易人数和次数
|
||||
*/
|
||||
@Override
|
||||
public List<HardChartLatitudeVo> chartLatitude(Long merchantId) {
|
||||
List<HardChartLatitudeVo> resultList = new LinkedList<>();
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
HardChartLatitudeVo hardChartLatitudeVo = new HardChartLatitudeVo();
|
||||
hardChartLatitudeVo.setHourType(String.valueOf(i));
|
||||
resultList.add(hardChartLatitudeVo);
|
||||
}
|
||||
HardOrderSumAndCountDto dto = new HardOrderSumAndCountDto();
|
||||
dto.setMchIds(List.of(merchantId));
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPayPrice());
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
// 每天
|
||||
LocalDateTime startOfDay = now.with(LocalTime.MIN);
|
||||
LocalDateTime endOfDay = now.with(LocalTime.MAX);
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> dayTotalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto dayTotalDto = BeanUtil.toBean(dto, HardOrderSumAndCountDto.class);
|
||||
dayTotalDto.setCreateTimeList(new LocalDateTime[]{startOfDay, endOfDay});
|
||||
return hardOrderMapper.sumAndCountTotalByHourType(dayTotalDto);
|
||||
});
|
||||
// 每周
|
||||
LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
||||
LocalDateTime endOfWeek = now.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> weekTotalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto weekTotalDto = BeanUtil.toBean(dto, HardOrderSumAndCountDto.class);
|
||||
weekTotalDto.setCreateTimeList(new LocalDateTime[]{startOfWeek.with(LocalTime.MIN), endOfWeek.with(LocalTime.MAX)});
|
||||
return hardOrderMapper.sumAndCountTotalByHourType(weekTotalDto);
|
||||
});
|
||||
// 每月
|
||||
LocalDate startOfMonth = now.toLocalDate().withDayOfMonth(1);
|
||||
LocalDate endOfMonth = now.toLocalDate().withDayOfMonth(now.toLocalDate().lengthOfMonth());
|
||||
LocalDateTime startOfMonthTime = startOfMonth.atStartOfDay();
|
||||
LocalDateTime endOfMonthTime = endOfMonth.atTime(LocalTime.MAX);
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> monthTotalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto weekTotalDto = BeanUtil.toBean(dto, HardOrderSumAndCountDto.class);
|
||||
weekTotalDto.setCreateTimeList(new LocalDateTime[]{startOfMonthTime, endOfMonthTime});
|
||||
return hardOrderMapper.sumAndCountTotalByHourType(weekTotalDto);
|
||||
});
|
||||
// 每年
|
||||
LocalDate startOfYear = now.toLocalDate().minusYears(1).withDayOfYear(1);
|
||||
LocalDate endOfYear = now.toLocalDate().minusYears(1).withDayOfYear(now.toLocalDate().minusYears(1).lengthOfYear());
|
||||
LocalDateTime startOfYearTime = startOfYear.atStartOfDay();
|
||||
LocalDateTime endOfYearTime = endOfYear.atTime(LocalTime.MAX);
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> yearTotalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto weekTotalDto = BeanUtil.toBean(dto, HardOrderSumAndCountDto.class);
|
||||
weekTotalDto.setCreateTimeList(new LocalDateTime[]{startOfYearTime, endOfYearTime});
|
||||
return hardOrderMapper.sumAndCountTotalByHourType(weekTotalDto);
|
||||
});
|
||||
// 全部
|
||||
CompletableFuture<List<HardOrderSumAndCountVo>> totalListFuture = CompletableFuture.supplyAsync(() -> {
|
||||
HardOrderSumAndCountDto weekTotalDto = BeanUtil.toBean(dto, HardOrderSumAndCountDto.class);
|
||||
return hardOrderMapper.sumAndCountTotalByHourType(weekTotalDto);
|
||||
});
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(dayTotalListFuture, weekTotalListFuture, monthTotalListFuture, yearTotalListFuture, totalListFuture);
|
||||
allFutures.join();
|
||||
List<HardOrderSumAndCountVo> dayTotalList = dayTotalListFuture.join();
|
||||
List<HardOrderSumAndCountVo> weekTotalList = weekTotalListFuture.join();
|
||||
List<HardOrderSumAndCountVo> monthTotalList = monthTotalListFuture.join();
|
||||
List<HardOrderSumAndCountVo> yearTotalList = yearTotalListFuture.join();
|
||||
List<HardOrderSumAndCountVo> totalList = totalListFuture.join();
|
||||
for (HardChartLatitudeVo v : resultList) {
|
||||
// 每天
|
||||
dayTotalList.stream().filter(i -> ObjectUtil.equals(i.getHourType(), v.getHourType())).findFirst().ifPresent(i -> {
|
||||
if (ObjectUtil.isNotEmpty(i.getCount())) v.setDayCount(i.getCount());
|
||||
if (ObjectUtil.isNotEmpty(i.getSum())) v.setDayPrice(i.getSum());
|
||||
});
|
||||
// 每周
|
||||
weekTotalList.stream().filter(i -> ObjectUtil.equals(i.getHourType(), v.getHourType())).findFirst().ifPresent(i -> {
|
||||
if (ObjectUtil.isNotEmpty(i.getCount())) v.setWeekCount(i.getCount());
|
||||
if (ObjectUtil.isNotEmpty(i.getSum())) v.setWeekPrice(i.getSum());
|
||||
});
|
||||
// 每月
|
||||
monthTotalList.stream().filter(i -> ObjectUtil.equals(i.getHourType(), v.getHourType())).findFirst().ifPresent(i -> {
|
||||
if (ObjectUtil.isNotEmpty(i.getCount())) v.setMonthCount(i.getCount());
|
||||
if (ObjectUtil.isNotEmpty(i.getSum())) v.setMonthPrice(i.getSum());
|
||||
});
|
||||
// 每年
|
||||
yearTotalList.stream().filter(i -> ObjectUtil.equals(i.getHourType(), v.getHourType())).findFirst().ifPresent(i -> {
|
||||
if (ObjectUtil.isNotEmpty(i.getCount())) v.setYearCount(i.getCount());
|
||||
if (ObjectUtil.isNotEmpty(i.getSum())) v.setYearPrice(i.getSum());
|
||||
});
|
||||
// 全部
|
||||
totalList.stream().filter(i -> ObjectUtil.equals(i.getHourType(), v.getHourType())).findFirst().ifPresent(i -> {
|
||||
if (ObjectUtil.isNotEmpty(i.getCount())) v.setTotalCount(i.getCount());
|
||||
if (ObjectUtil.isNotEmpty(i.getSum())) v.setTotalPrice(i.getSum());
|
||||
});
|
||||
}
|
||||
// 加入全部统计
|
||||
HardChartLatitudeVo total = BeanUtils.toBean(resultList.get(0), HardChartLatitudeVo.class);
|
||||
total.setHourType("-1");
|
||||
resultList.add(total);
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
+41
@@ -292,10 +292,51 @@
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
|
||||
and a.merchant_id in
|
||||
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by a.user_dept_id
|
||||
</select>
|
||||
|
||||
<select id="sumAndCountTotalByHourType" resultType="com.bsd.pjcloud.hard.api.vo.order.HardOrderSumAndCountVo">
|
||||
select
|
||||
a.hour_type as hourType,
|
||||
COALESCE(sum(a.pay_price), 0) as sum,
|
||||
COALESCE(count(0), 0) as count
|
||||
from hard_order a
|
||||
<where>
|
||||
a.del_flag = 0 and a.hour_type is not null
|
||||
<if test="dto.walletTypeId != null">
|
||||
</if>
|
||||
<if test="dto.orderStatusCodes != null and dto.orderStatusCodes.size() != 0">
|
||||
and a.order_status in
|
||||
<foreach collection="dto.orderStatusCodes" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.getUserDeptIds != null and dto.getUserDeptIds.size() != 0">
|
||||
and a.user_dept_id in
|
||||
<foreach collection="dto.getUserDeptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
|
||||
and a.merchant_id in
|
||||
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by a.hour_type
|
||||
</select>
|
||||
|
||||
<select id="totalYearMonthDay" resultType="com.bsd.pjcloud.hard.api.vo.order.HardZyCardSyncVo">
|
||||
SELECT
|
||||
COALESCE(COUNT(0), 0) AS totalNum,
|
||||
|
||||
Reference in new issue
Block a user