feat:超市大屏
This commit is contained in:
1 parent
b4d245250a
commit
02b841bd3c
14 files changed
+487
-222
No files matched your search
+3
-1
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PanelCanteenDto {
|
||||
public class PanelProductDto {
|
||||
|
||||
private DateRangeTypeEnum dateRangeType = DateRangeTypeEnum.YESTERDAY;
|
||||
|
||||
@@ -21,6 +21,8 @@ public class PanelCanteenDto {
|
||||
|
||||
private List<String> mchTypeCodes;
|
||||
|
||||
private String hourTypeIsNull;
|
||||
|
||||
private String hourType;
|
||||
|
||||
private Long limit;
|
||||
-118
@@ -1,118 +0,0 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.hard;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PanelCanteenVo {
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商家ID
|
||||
*/
|
||||
private Long mchId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String mchName;
|
||||
|
||||
/**
|
||||
* 用餐时间段(早中晚)
|
||||
*/
|
||||
private String hourType;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productStr;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Long personCount;
|
||||
|
||||
/**
|
||||
* 购买次数
|
||||
*/
|
||||
private Long buyCount;
|
||||
|
||||
/**
|
||||
* 购买商品数量
|
||||
*/
|
||||
private Long buyProductCount;
|
||||
|
||||
/**
|
||||
* 购买总金额(分)
|
||||
*/
|
||||
private Long totalPrice;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private LocalDate time;
|
||||
|
||||
/**
|
||||
* 时间字符串
|
||||
*/
|
||||
private LocalDate timeStr;
|
||||
|
||||
/**
|
||||
* 周几
|
||||
*/
|
||||
private String weekStr;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int order;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class HourTypeItemVo {
|
||||
|
||||
private String type;
|
||||
|
||||
private String typeStr;
|
||||
|
||||
private List<PanelCanteenVo> list;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class HourTypeVo {
|
||||
|
||||
/**
|
||||
* 早
|
||||
*/
|
||||
private HourTypeItemVo morning;
|
||||
|
||||
/**
|
||||
* 中
|
||||
*/
|
||||
private HourTypeItemVo noon;
|
||||
|
||||
/**
|
||||
* 晚
|
||||
*/
|
||||
private HourTypeItemVo evening;
|
||||
}
|
||||
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.hard;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.DateRangeTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PanelPorductVo {
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商家ID
|
||||
*/
|
||||
private Long mchId;
|
||||
|
||||
/**
|
||||
* 商家名称
|
||||
*/
|
||||
private String mchName;
|
||||
|
||||
/**
|
||||
* 用餐时间段(早中晚)
|
||||
*/
|
||||
private String hourType;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productStr;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Long personCount;
|
||||
|
||||
/**
|
||||
* 购买次数
|
||||
*/
|
||||
private Long buyCount;
|
||||
|
||||
/**
|
||||
* 购买商品数量
|
||||
*/
|
||||
private Long buyProductCount;
|
||||
|
||||
/**
|
||||
* 购买总金额(分)
|
||||
*/
|
||||
private Long totalPrice;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private LocalDate time;
|
||||
|
||||
/**
|
||||
* 时间字符串
|
||||
*/
|
||||
private LocalDate timeStr;
|
||||
|
||||
/**
|
||||
* 周几
|
||||
*/
|
||||
private String weekStr;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int order;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class ProductTypeItemVo {
|
||||
|
||||
private String type;
|
||||
|
||||
private String typeStr;
|
||||
|
||||
private List<PanelPorductVo> list;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class HourTypeVo {
|
||||
|
||||
/**
|
||||
* 早
|
||||
*/
|
||||
private ProductTypeItemVo morning;
|
||||
|
||||
/**
|
||||
* 中
|
||||
*/
|
||||
private ProductTypeItemVo noon;
|
||||
|
||||
/**
|
||||
* 晚
|
||||
*/
|
||||
private ProductTypeItemVo evening;
|
||||
}
|
||||
|
||||
public static List<PanelPorductVo> generatePanelCanteenList(LocalDateTime[] totalTimeList, DateRangeTypeEnum dateRangeType) {
|
||||
List<PanelPorductVo> dateList = new LinkedList<>();
|
||||
LocalDate startTime = totalTimeList[0].toLocalDate();
|
||||
LocalDate endTime = totalTimeList[1].toLocalDate();
|
||||
LocalDate currentDate = startTime;
|
||||
while (!currentDate.isAfter(endTime)) {
|
||||
PanelPorductVo entity = new PanelPorductVo();
|
||||
entity.setPersonCount(0L);
|
||||
entity.setBuyCount(0L);
|
||||
entity.setBuyProductCount(0L);
|
||||
if (ObjectUtil.equals(dateRangeType, DateRangeTypeEnum.THIS_YEAR)) {
|
||||
entity.setTime(currentDate.withDayOfMonth(1));
|
||||
entity.setWeekStr("");
|
||||
} else {
|
||||
entity.setTime(currentDate);
|
||||
entity.setWeekStr(LocalDateTimeUtil.dayOfWeek(currentDate).toChinese());
|
||||
}
|
||||
dateList.add(entity);
|
||||
if (ObjectUtil.equals(dateRangeType, DateRangeTypeEnum.THIS_YEAR)) {
|
||||
currentDate = currentDate.plusMonths(1);
|
||||
} else {
|
||||
currentDate = currentDate.plusDays(1);
|
||||
}
|
||||
}
|
||||
return dateList;
|
||||
}
|
||||
|
||||
}
|
||||
+16
-16
@@ -2,14 +2,14 @@ package com.bsd.pjcloud.hard.controller.panel;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.DateRangeTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.DateRangeTool;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelCanteenDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderCsVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
@@ -48,53 +48,53 @@ public class PanelCanteenController {
|
||||
|
||||
@PostMapping(value = "/group/by-time-and-hour-type")
|
||||
@Operation(summary = "用餐数据统计(根据时间段和日期分类统计)")
|
||||
public R<PanelCanteenVo.HourTypeVo> groupByTimeAndHourType(@RequestBody PanelCanteenDto dto) {
|
||||
public R<PanelPorductVo.HourTypeVo> groupByTimeAndHourType(@RequestBody PanelProductDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getTotalTimeList())) {
|
||||
dto.setTotalTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(panelCanteenService.groupByTimeAndHourType(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/group/by-time-and-custom-hour")
|
||||
@Operation(summary = "用餐数据统计(根据自定义时间段和日期分类统计)")
|
||||
public R<List<PanelCanteenVo>> groupByTimeAndCustomHour(@RequestBody PanelCanteenDto dto) {
|
||||
public R<List<PanelPorductVo>> groupByTimeAndCustomHour(@RequestBody PanelProductDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getTotalTimeList())) {
|
||||
dto.setTotalTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(panelCanteenService.groupByTimeAndCustomHour(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/mch-pay-person-count")
|
||||
@Operation(summary = "各个食堂的用餐人数")
|
||||
public R<List<PanelCanteenVo>> mchPayPersonCount(@RequestBody PanelCanteenDto dto) {
|
||||
public R<List<PanelPorductVo>> mchPayPersonCount(@RequestBody PanelProductDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getTotalTimeList())) {
|
||||
dto.setTotalTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(panelCanteenService.mchPayPersonCount(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/pay-person-count-trend")
|
||||
@Operation(summary = "各个食堂的用餐人数(趋势)")
|
||||
public R<PanelCanteenVo.HourTypeVo> payPersonCountTrend(@RequestBody PanelCanteenDto dto) {
|
||||
public R<PanelPorductVo.HourTypeVo> payPersonCountTrend(@RequestBody PanelProductDto dto) {
|
||||
dto.setTotalTimeList(new LocalDateTime[]{
|
||||
LocalDateTime.now().minusDays(8).withHour(0).withMinute(0).withSecond(0),
|
||||
LocalDateTime.now().withHour(23).withMinute(59).withSecond(59)
|
||||
});
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(panelCanteenService.groupByTimeAndHourType(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/mch-pay-count-top")
|
||||
@Operation(summary = "排行榜")
|
||||
public R<List<PanelCanteenVo>> mchPayCountTop(@RequestBody PanelCanteenDto dto) {
|
||||
public R<List<PanelPorductVo>> mchPayCountTop(@RequestBody PanelProductDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getTotalTimeList())) {
|
||||
dto.setTotalTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setLimit(5L);
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(panelCanteenService.mchPayCountTop(dto));
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class PanelCanteenController {
|
||||
@Operation(summary = "食堂报表")
|
||||
public R<List<HardOrderCsVo>> canteenReport(@RequestBody HardOrderDto dto) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
List<Long> mchDtoIds = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(dto.getMerchantId())) {
|
||||
List<MchManageVo> mchList = mchService.getByParentId(dto.getMerchantId()).getData();
|
||||
@@ -123,7 +123,7 @@ public class PanelCanteenController {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getCreateTimeList())) {
|
||||
dto.setCreateTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
return R.ok(hardwareOrderService.scopePageList(page, dto, null));
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class PanelCanteenController {
|
||||
|
||||
HardOrderDto dto = new HardOrderDto();
|
||||
dto.setCreateTimeList(localDate);
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType(), MerchantTypeEnum.SUPERMARKET.getType()));
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.CANTEEN.getType()));
|
||||
List<HardOrderVo> list = hardwareOrderService.scopeList(dto, null);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return R.ok();
|
||||
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
package com.bsd.pjcloud.hard.controller.panel;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.DateRangeTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.DateRangeTool;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderCsVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardOrderVo;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderTotalService;
|
||||
import com.bsd.pjcloud.hard.service.PanelShopService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/panel-shop")
|
||||
@Tag(description = "panel-shop", name = "超市统计")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class PanelShopController {
|
||||
|
||||
private final PanelShopService panelShopService;
|
||||
|
||||
private final HardOrderService hardwareOrderService;
|
||||
private final HardOrderTotalService hardOrderTotalService;
|
||||
|
||||
private final RemoteMchService mchService;
|
||||
|
||||
@PostMapping(value = "/mch-pay-count")
|
||||
@Operation(summary = "各个超市的购买数量统计")
|
||||
public R<List<PanelPorductVo>> mchPayPersonCount(@RequestBody PanelProductDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getTotalTimeList())) {
|
||||
dto.setTotalTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
dto.setHourTypeIsNull(YesNoEnum.YES.getCode());
|
||||
return R.ok(panelShopService.mchPayPersonCount(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/mch-pay-count-trend")
|
||||
@Operation(summary = "各个自营超市的统计数据(趋势)")
|
||||
public R<List<PanelPorductVo.ProductTypeItemVo>> mchPayCountTrend(@RequestBody PanelProductDto dto) {
|
||||
dto.setTotalTimeList(new LocalDateTime[]{
|
||||
LocalDateTime.now().minusDays(8).withHour(0).withMinute(0).withSecond(0),
|
||||
LocalDateTime.now().withHour(23).withMinute(59).withSecond(59)
|
||||
});
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
dto.setHourTypeIsNull(YesNoEnum.YES.getCode());
|
||||
return R.ok(panelShopService.mchPayCount(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/report")
|
||||
@Operation(summary = "食堂报表")
|
||||
public R<List<HardOrderCsVo>> canteenReport(@RequestBody HardOrderDto dto) {
|
||||
dto.setOrderStatusCodes(HardOrderStatusEnum.getPaySuccessCodes());
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
List<Long> mchDtoIds = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(dto.getMerchantId())) {
|
||||
List<MchManageVo> mchList = mchService.getByParentId(dto.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
List<Long> mchIds = mchList.stream().map(MchManageVo::getId).toList();
|
||||
mchDtoIds.add(dto.getMerchantId());
|
||||
mchDtoIds.addAll(mchIds);
|
||||
dto.setMerchantId(null);
|
||||
dto.setMchIds(mchDtoIds);
|
||||
}
|
||||
}
|
||||
return R.ok(hardOrderTotalService.listCs(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/new-page")
|
||||
@Operation(summary = "最新的超市数据")
|
||||
public R<Page<HardOrderVo>> newPage(@ParameterObject Page page, @RequestBody HardOrderDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getCreateTimeList())) {
|
||||
dto.setCreateTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
return R.ok(hardwareOrderService.scopePageList(page, dto, null));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/recently")
|
||||
@Operation(summary = "最近超市购买数据")
|
||||
public R<HardOrderVo> recently() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime[] localDate = new LocalDateTime[]{
|
||||
now.minusMinutes(1),
|
||||
now.plusMinutes(1)
|
||||
};
|
||||
HardOrderDto dto = new HardOrderDto();
|
||||
dto.setCreateTimeList(localDate);
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
List<HardOrderVo> list = hardwareOrderService.scopeList(dto, null);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.ok(list.get(0));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/mch-pay-count-top")
|
||||
@Operation(summary = "排行榜")
|
||||
public R<List<PanelPorductVo>> mchPayCountTop(@RequestBody PanelProductDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getDateRangeType()) && ObjectUtil.isEmpty(dto.getTotalTimeList())) {
|
||||
dto.setTotalTimeList(DateRangeTool.transitionDateTypeToDateTimeList(dto.getDateRangeType()));
|
||||
}
|
||||
dto.setLimit(5L);
|
||||
dto.setMchTypeCodes(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
dto.setHourTypeIsNull(YesNoEnum.YES.getCode());
|
||||
return R.ok(panelShopService.mchPayCountTop(dto));
|
||||
}
|
||||
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.bsd.pjcloud.hard.controller.panel;
|
||||
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/panel-mch")
|
||||
@Tag(description = "panel-mch", name = "超市统计")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class PanelSupermarketController {
|
||||
|
||||
}
|
||||
+5
-5
@@ -10,10 +10,10 @@ import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderSumAndCountDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelCanteenDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.manager.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.order.HardOrderEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.*;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
|
||||
@@ -139,12 +139,12 @@ public interface HardOrderMapper extends PjcloudBaseMapper<HardOrderEntity> {
|
||||
/**
|
||||
* 用餐数据统计(根据时间段和日期分类统计)
|
||||
*/
|
||||
List<PanelCanteenVo> groupByTimeAndHourType(@Param("dto") PanelCanteenDto dto);
|
||||
List<PanelPorductVo> groupByTimeAndHourType(@Param("dto") PanelProductDto dto);
|
||||
|
||||
List<PanelCanteenVo> groupByMonthAndHourType(@Param("dto") PanelCanteenDto dto);
|
||||
List<PanelPorductVo> groupByMonthAndHourType(@Param("dto") PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 用餐数据统计(根据商户统计)
|
||||
*/
|
||||
List<PanelCanteenVo> groupByMch(@Param("dto") PanelCanteenDto dto);
|
||||
List<PanelPorductVo> groupByMch(@Param("dto") PanelProductDto dto);
|
||||
}
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelCanteenDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,20 +10,20 @@ public interface PanelCanteenService {
|
||||
/**
|
||||
* 用餐数据统计(根据时间段和日期分类统计)
|
||||
*/
|
||||
PanelCanteenVo.HourTypeVo groupByTimeAndHourType(PanelCanteenDto dto);
|
||||
PanelPorductVo.HourTypeVo groupByTimeAndHourType(PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 各个食堂的用餐人数
|
||||
*/
|
||||
List<PanelCanteenVo> mchPayPersonCount(PanelCanteenDto dto);
|
||||
List<PanelPorductVo> mchPayPersonCount(PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 用餐数据统计(根据自定义时间段和日期分类统计)
|
||||
*/
|
||||
List<PanelCanteenVo> groupByTimeAndCustomHour(PanelCanteenDto dto);
|
||||
List<PanelPorductVo> groupByTimeAndCustomHour(PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 排行榜
|
||||
*/
|
||||
List<PanelCanteenVo> mchPayCountTop(PanelCanteenDto dto);
|
||||
List<PanelPorductVo> mchPayCountTop(PanelProductDto dto);
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PanelShopService {
|
||||
|
||||
/**
|
||||
* 各个超市的购买人数
|
||||
*/
|
||||
List<PanelPorductVo> mchPayPersonCount(PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 各个自营超市的统计数据(趋势)
|
||||
*/
|
||||
List<PanelPorductVo.ProductTypeItemVo> mchPayCount(PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 排行榜
|
||||
*/
|
||||
List<PanelPorductVo> mchPayCountTop(PanelProductDto dto);
|
||||
}
|
||||
+23
-53
@@ -1,26 +1,23 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.panel;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.DateRangeTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardHourTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelCanteenDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.PanelCanteenService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -39,25 +36,25 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
* 用餐数据统计(根据时间段和日期分类统计)
|
||||
*/
|
||||
@Override
|
||||
public PanelCanteenVo.HourTypeVo groupByTimeAndHourType(PanelCanteenDto dto) {
|
||||
public PanelPorductVo.HourTypeVo groupByTimeAndHourType(PanelProductDto dto) {
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
List<PanelCanteenVo> dateList = generatePanelCanteenList(dto.getTotalTimeList(), dto.getDateRangeType());
|
||||
PanelCanteenVo.HourTypeVo result = new PanelCanteenVo.HourTypeVo();
|
||||
List<PanelPorductVo> dateList = PanelPorductVo.generatePanelCanteenList(dto.getTotalTimeList(), dto.getDateRangeType());
|
||||
PanelPorductVo.HourTypeVo result = new PanelPorductVo.HourTypeVo();
|
||||
|
||||
List<HardHourTypeEnum> hourTypeList = List.of(HardHourTypeEnum.MORNING, HardHourTypeEnum.NOONING, HardHourTypeEnum.NIGHT);
|
||||
for (CompletableFuture<Void> voidCompletableFuture : hourTypeList.stream().map(hourType -> CompletableFuture.runAsync(() -> {
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
PanelCanteenDto queryDto = BeanUtil.toBean(dto, PanelCanteenDto.class);
|
||||
PanelProductDto queryDto = BeanUtil.toBean(dto, PanelProductDto.class);
|
||||
queryDto.setHourType(hourType.getType());
|
||||
List<PanelCanteenVo> sqlList = new ArrayList<>();
|
||||
List<PanelPorductVo> sqlList = new ArrayList<>();
|
||||
if (ObjectUtil.equals(dto.getDateRangeType(), DateRangeTypeEnum.THIS_YEAR.getType())) {
|
||||
sqlList = hardOrderMapper.groupByMonthAndHourType(queryDto);
|
||||
} else {
|
||||
sqlList = hardOrderMapper.groupByTimeAndHourType(queryDto);
|
||||
}
|
||||
// 处理查询出来的数据
|
||||
List<PanelCanteenVo> resultList = BeanUtil.copyToList(dateList, PanelCanteenVo.class);
|
||||
for (PanelCanteenVo v : resultList) {
|
||||
List<PanelPorductVo> resultList = BeanUtil.copyToList(dateList, PanelPorductVo.class);
|
||||
for (PanelPorductVo v : resultList) {
|
||||
sqlList.stream().filter(item -> ObjectUtil.equals(item.getTime(), v.getTime())).forEach(target -> {
|
||||
v.setHourType(target.getHourType());
|
||||
v.setPersonCount(target.getPersonCount());
|
||||
@@ -67,7 +64,7 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
});
|
||||
}
|
||||
// 组装数据
|
||||
PanelCanteenVo.HourTypeItemVo vo = PanelCanteenVo.HourTypeItemVo.builder().list(resultList).type(hourType.getType()).typeStr(hourType.getDescription()).build();
|
||||
PanelPorductVo.ProductTypeItemVo vo = PanelPorductVo.ProductTypeItemVo.builder().list(resultList).type(hourType.getType()).typeStr(hourType.getDescription()).build();
|
||||
switch (hourType) {
|
||||
case MORNING:
|
||||
result.setMorning(vo);
|
||||
@@ -89,8 +86,8 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
* 各个食堂的用餐人数
|
||||
*/
|
||||
@Override
|
||||
public List<PanelCanteenVo> mchPayPersonCount(PanelCanteenDto dto) {
|
||||
List<PanelCanteenVo> list = hardOrderMapper.groupByMch(dto);
|
||||
public List<PanelPorductVo> mchPayPersonCount(PanelProductDto dto) {
|
||||
List<PanelPorductVo> list = hardOrderMapper.groupByMch(dto);
|
||||
disposePanelCanteenVoSetMchName(list);
|
||||
return list;
|
||||
}
|
||||
@@ -99,8 +96,8 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
* 用餐数据统计(根据时间段和日期分类统计)
|
||||
*/
|
||||
@Override
|
||||
public List<PanelCanteenVo> groupByTimeAndCustomHour(PanelCanteenDto dto) {
|
||||
List<PanelCanteenVo> result = new ArrayList<>();
|
||||
public List<PanelPorductVo> groupByTimeAndCustomHour(PanelProductDto dto) {
|
||||
List<PanelPorductVo> result = new ArrayList<>();
|
||||
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -120,66 +117,39 @@ public class PanelCanteenServiceImpl implements PanelCanteenService {
|
||||
RequestContextHolder.setRequestAttributes(requestAttributes);
|
||||
|
||||
Integer targetHour = customList.get(0);
|
||||
PanelCanteenDto queryDto = PanelCanteenDto
|
||||
PanelProductDto queryDto = PanelProductDto
|
||||
.builder()
|
||||
.totalTimeList(new LocalDateTime[]{
|
||||
now.withHour(targetHour).withMinute(0).withSecond(0),
|
||||
now.withHour(targetHour).withMinute(59).withSecond(59)
|
||||
})
|
||||
.build();
|
||||
List<PanelCanteenVo> sqlList = hardOrderMapper.groupByTimeAndHourType(queryDto);
|
||||
PanelCanteenVo build = PanelCanteenVo.builder().hourType(customList.get(0) + "-" + customList.get(1)).personCount(0L).order(targetHour).build();
|
||||
List<PanelPorductVo> sqlList = hardOrderMapper.groupByTimeAndHourType(queryDto);
|
||||
PanelPorductVo build = PanelPorductVo.builder().hourType(customList.get(0) + "-" + customList.get(1)).personCount(0L).order(targetHour).build();
|
||||
if (ObjectUtil.isNotEmpty(sqlList)) build.setPersonCount(sqlList.get(0).getPersonCount());
|
||||
result.add(build);
|
||||
})).toList().forEach(CompletableFuture::join);
|
||||
return result.stream().sorted(Comparator.comparingInt(PanelCanteenVo::getOrder)).toList();
|
||||
return result.stream().sorted(Comparator.comparingInt(PanelPorductVo::getOrder)).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 排行榜
|
||||
*/
|
||||
@Override
|
||||
public List<PanelCanteenVo> mchPayCountTop(PanelCanteenDto dto) {
|
||||
List<PanelCanteenVo> list = hardOrderMapper.groupByMch(dto);
|
||||
public List<PanelPorductVo> mchPayCountTop(PanelProductDto dto) {
|
||||
List<PanelPorductVo> list = hardOrderMapper.groupByMch(dto);
|
||||
disposePanelCanteenVoSetMchName(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<PanelCanteenVo> generatePanelCanteenList(LocalDateTime[] totalTimeList, DateRangeTypeEnum dateRangeType) {
|
||||
List<PanelCanteenVo> dateList = new LinkedList<>();
|
||||
LocalDate startTime = totalTimeList[0].toLocalDate();
|
||||
LocalDate endTime = totalTimeList[1].toLocalDate();
|
||||
LocalDate currentDate = startTime;
|
||||
while (!currentDate.isAfter(endTime)) {
|
||||
PanelCanteenVo entity = new PanelCanteenVo();
|
||||
entity.setPersonCount(0L);
|
||||
entity.setBuyCount(0L);
|
||||
entity.setBuyProductCount(0L);
|
||||
if (ObjectUtil.equals(dateRangeType, DateRangeTypeEnum.THIS_YEAR)) {
|
||||
entity.setTime(currentDate.withDayOfMonth(1));
|
||||
entity.setWeekStr("");
|
||||
} else {
|
||||
entity.setTime(currentDate);
|
||||
entity.setWeekStr(LocalDateTimeUtil.dayOfWeek(currentDate).toChinese());
|
||||
}
|
||||
dateList.add(entity);
|
||||
if (ObjectUtil.equals(dateRangeType, DateRangeTypeEnum.THIS_YEAR)) {
|
||||
currentDate = currentDate.plusMonths(1);
|
||||
} else {
|
||||
currentDate = currentDate.plusDays(1);
|
||||
}
|
||||
}
|
||||
return dateList;
|
||||
}
|
||||
|
||||
private void disposePanelCanteenVoSetMchName(List<PanelCanteenVo> list) {
|
||||
private void disposePanelCanteenVoSetMchName(List<PanelPorductVo> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 商户名
|
||||
List<Long> mchIds = list.stream().map(PanelCanteenVo::getMchId).distinct().filter(ObjectUtil::isNotEmpty).toList();
|
||||
List<Long> mchIds = list.stream().map(PanelPorductVo::getMchId).distinct().filter(ObjectUtil::isNotEmpty).toList();
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
Map<Long, MchManageVo> mchMap = CollectionUtils.convertMap(mchList, MchManageVo::getId);
|
||||
for (PanelCanteenVo i : list) {
|
||||
for (PanelPorductVo i : list) {
|
||||
MchManageVo mch = mchMap.get(i.getMchId());
|
||||
if (ObjectUtil.isNotEmpty(mch)) i.setMchName(mch.getName());
|
||||
}
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.panel;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.PanelShopService;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class PanelShopServiceImpl implements PanelShopService {
|
||||
|
||||
private final HardOrderMapper hardOrderMapper;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
/**
|
||||
* 各个超市的购买人数
|
||||
*/
|
||||
@Override
|
||||
public List<PanelPorductVo> mchPayPersonCount(PanelProductDto dto) {
|
||||
List<PanelPorductVo> list = hardOrderMapper.groupByMch(dto);
|
||||
disposePanelCanteenVoSetMchName(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 各个自营超市的统计数据(趋势)
|
||||
*/
|
||||
@Override
|
||||
public List<PanelPorductVo.ProductTypeItemVo> mchPayCount(PanelProductDto dto) {
|
||||
List<PanelPorductVo.ProductTypeItemVo> result = new ArrayList<>();
|
||||
// 处理时间
|
||||
List<PanelPorductVo> dateList = PanelPorductVo.generatePanelCanteenList(dto.getTotalTimeList(), dto.getDateRangeType());
|
||||
// 查询商户
|
||||
MchManageDto mchDto = new MchManageDto();
|
||||
mchDto.setTypesList(List.of(MerchantTypeEnum.SELF_SUPERMARKET.getType()));
|
||||
List<MchManageVo> mchList = remoteMchService.list(mchDto).getData();
|
||||
result = mchList.stream().map(v -> {
|
||||
PanelPorductVo.ProductTypeItemVo entity = new PanelPorductVo.ProductTypeItemVo();
|
||||
entity.setType(String.valueOf(v.getId()));
|
||||
entity.setTypeStr(v.getName());
|
||||
return entity;
|
||||
}).toList();
|
||||
// 查询商户订单
|
||||
List<PanelPorductVo> list = hardOrderMapper.groupByMch(dto);
|
||||
for (PanelPorductVo.ProductTypeItemVo v : result) {
|
||||
List<PanelPorductVo> targetMchTotalList = list.stream().filter(item -> ObjectUtil.equals(v.getType(), String.valueOf(item.getMchId()))).toList();
|
||||
if (ObjectUtil.isEmpty(targetMchTotalList)) continue;
|
||||
// 处理时间
|
||||
List<PanelPorductVo> resultList = BeanUtil.copyToList(dateList, PanelPorductVo.class);
|
||||
for (PanelPorductVo i : resultList) {
|
||||
targetMchTotalList.stream().filter(item -> ObjectUtil.equals(item.getTime(), i.getTime())).forEach(target -> {
|
||||
i.setHourType(target.getHourType());
|
||||
i.setPersonCount(target.getPersonCount());
|
||||
i.setBuyCount(target.getBuyCount());
|
||||
i.setBuyProductCount(target.getBuyProductCount());
|
||||
i.setTotalPrice(target.getTotalPrice());
|
||||
});
|
||||
}
|
||||
v.setList(resultList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排行榜
|
||||
*/
|
||||
@Override
|
||||
public List<PanelPorductVo> mchPayCountTop(PanelProductDto dto) {
|
||||
List<PanelPorductVo> list = hardOrderMapper.groupByMch(dto);
|
||||
disposePanelCanteenVoSetMchName(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void disposePanelCanteenVoSetMchName(List<PanelPorductVo> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 商户名
|
||||
List<Long> mchIds = list.stream().map(PanelPorductVo::getMchId).distinct().filter(ObjectUtil::isNotEmpty).toList();
|
||||
List<MchManageVo> mchList = remoteMchService.getByIds(mchIds).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
Map<Long, MchManageVo> mchMap = CollectionUtils.convertMap(mchList, MchManageVo::getId);
|
||||
for (PanelPorductVo i : list) {
|
||||
MchManageVo mch = mchMap.get(i.getMchId());
|
||||
if (ObjectUtil.isNotEmpty(mch)) i.setMchName(mch.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+8
-6
@@ -550,7 +550,7 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="groupByTimeAndHourType" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo">
|
||||
<select id="groupByTimeAndHourType" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo">
|
||||
select
|
||||
date(o.create_time) as time,
|
||||
o.hour_type as hourType,
|
||||
@@ -584,8 +584,8 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="groupByMonthAndHourType" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo">
|
||||
select
|
||||
<select id="groupByMonthAndHourType" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo">
|
||||
select
|
||||
date(o.create_time) as time,
|
||||
o.hour_type as hourType,
|
||||
SUM(a.product_count) as buyProductCount,
|
||||
@@ -618,7 +618,7 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="groupByMch" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelCanteenVo">
|
||||
<select id="groupByMch" resultType="com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo">
|
||||
select o.merchant_id as mchId,
|
||||
sum(a.product_count) as buyProductCount,
|
||||
SUM(a.total_price) as totalPrice,
|
||||
@@ -626,8 +626,10 @@
|
||||
count(distinct o.user_id) as personCount
|
||||
from hard_car a
|
||||
inner join hard_parent_car p on a.parent_car_id = p.id and p.del_flag = '0'
|
||||
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0' and o.hour_type is not null and
|
||||
o.hour_type not in ('-1', 'null')
|
||||
inner join hard_order o on o.parent_car_id = p.id and o.del_flag = '0'
|
||||
<if test="dto.hourTypeIsNull == null">
|
||||
and o.hour_type is not null and o.hour_type not in ('-1', 'null')
|
||||
</if>
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
<if test="dto.totalTimeList != null and dto.totalTimeList.length == 2">
|
||||
|
||||
+7
@@ -4,9 +4,12 @@ import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,6 +17,10 @@ import java.util.List;
|
||||
@FeignClient(contextId = "remoteMchService", value = ServiceNameConstants.WALLET_SERVICE)
|
||||
public interface RemoteMchService {
|
||||
|
||||
@NoToken
|
||||
@PostMapping("/mch-manage/list")
|
||||
R<List<MchManageVo>> list(@RequestBody MchManageDto body);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mch-manage/get-by-types")
|
||||
R<List<MchManageVo>> getByTypes(@RequestParam List<String> types);
|
||||
|
||||
+7
@@ -54,6 +54,13 @@ public class MchManageController {
|
||||
private final RemoteUserService remoteUserService;
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
@Inner
|
||||
@PostMapping("/list")
|
||||
public R<List<MchManageVo>> remoteList(@RequestBody MchManageDto body) {
|
||||
List<MchManageVo> list = mchManageService.list(body);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-by-types")
|
||||
public R<List<MchManageVo>> getByTypes(@RequestParam List<String> types) {
|
||||
|
||||
Reference in new issue
Block a user