test
This commit is contained in:
parent
7666c27019
commit
267cd50858
|
|
@ -50,6 +50,26 @@ public class AllocMealtimeApi {
|
|||
return mealtimeModelList;
|
||||
}
|
||||
|
||||
public AllocMealtimeModel getAssignTimeMealtime(LocalTime assignTime, Long canteenId, Long stallId) {
|
||||
if (ObjectUtil.isNotNull(stallId) && stallId.equals(0L)) {
|
||||
stallId = null;
|
||||
}
|
||||
|
||||
List<AllocMealtimeModel> mealtimeList = this.listUseAvailableMealtime(canteenId, stallId, (Integer)null);
|
||||
Iterator var5 = mealtimeList.iterator();
|
||||
|
||||
AllocMealtimeModel mealtime;
|
||||
do {
|
||||
if (!var5.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mealtime = (AllocMealtimeModel)var5.next();
|
||||
} while(assignTime.compareTo(mealtime.getStartTime()) < 0 || assignTime.compareTo(mealtime.getEndTime()) > 0);
|
||||
|
||||
return mealtime;
|
||||
}
|
||||
|
||||
public AllocMealtimeMenuModel getAllocMealtimeMenuModel(Long stallId) {
|
||||
List<AllocMealtimeModel> mealtimeModelList = this.listUseAvailableMealtime((Long)null, stallId, (Integer)null);
|
||||
String ifAllowReserveToday = this.globalMetadataApi.getAvailableValue(MetadataModelTypeEnum.ORDER_RESERVE, "ifAllowReserveToday", (Long)null, stallId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
package com.bonus.canteen.core.report.dashboard.constant;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum DashboardDataKeyEnum {
|
||||
TODAY_RECIPE_DISH_NUM("todayRecipeDishNum", "今日菜谱菜品数量"),
|
||||
TODAY_NUM_OF_DINERS("todayNumOfDiners", "今日就餐人数"),
|
||||
TODAY_NUM_OF_DINER_MEAL("todayNumOfDinerMeal", "今日各餐次就餐人数"),
|
||||
DISH_THUMB_RANK("dishThumbRank", "菜品点赞排行榜"),
|
||||
SEVEN_DAY_MOST_POPULAR_STALL("sevenDayMostPopularStall", "近七日最受欢迎档口"),
|
||||
SEVEN_DAY_CONSUMER_STRUCTURE_SEX("sevenDayConsumerStructure-sex", "近七日消费结构-男女"),
|
||||
SEVEN_DAY_CONSUMER_STRUCTURE_MEAL("sevenDayConsumerStructure-meal", "近七日消费结构-各餐次"),
|
||||
SEVEN_DAY_CONSUMER_STRUCTURE_ORG("sevenDayConsumerStructure-org", "近七日消费结构-组织"),
|
||||
SEVEN_DAY_PRICE_SUMMARY("sevenDayPriceSummary", "近七日价位汇总"),
|
||||
FOOD_WASTE("foodWaste", "厨余垃圾统计"),
|
||||
TODAY_DISH_SALE_RANK("todayDishSaleRank", "今日菜品销量排行榜"),
|
||||
SEVEN_DAY_DISH_SALE_RANK("sevenDayDishSaleRank", "近7日菜品销量排行榜"),
|
||||
CURRENT_TIME_MEALTIME("currentTimeMealTime", "当前时间餐次"),
|
||||
CURRENT_TIME_WEATHER("currentTimeWeather", "当前时间天气"),
|
||||
TODAY_NUM_OF_DINER_MEAL_DINGING_RATE("todayNumOfDinersDiningRate", "今日就餐人数-就餐率"),
|
||||
TODAY_MENU_DISPLAY("todayMenuDisplay", "菜谱展示"),
|
||||
TODAY_MOST_POPULAR_STALL("toDayMostPopularStall", "今日最受欢迎档口"),
|
||||
CANTEN_DINING_PEOPLE("dzCanteenDiningPeople", "食堂就餐人数(客流统计)");
|
||||
|
||||
private final String key;
|
||||
private final String desc;
|
||||
|
||||
public static List<String> listKeys() {
|
||||
DashboardDataKeyEnum[] values = values();
|
||||
List<String> keys = new ArrayList(values.length);
|
||||
DashboardDataKeyEnum[] var2 = values;
|
||||
int var3 = values.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
DashboardDataKeyEnum value = var2[var4];
|
||||
keys.add(value.getKey());
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
public static DashboardDataKeyEnum getEnum(String key) {
|
||||
DashboardDataKeyEnum[] var1 = values();
|
||||
int var2 = var1.length;
|
||||
|
||||
for(int var3 = 0; var3 < var2; ++var3) {
|
||||
DashboardDataKeyEnum temp = var1[var3];
|
||||
if (temp.getKey().equals(key)) {
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
private DashboardDataKeyEnum(final String key, final String desc) {
|
||||
this.key = key;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.bonus.canteen.core.report.datascreen.controller;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.bonus.canteen.core.report.datascreen.dto.DatascreenDTO;
|
||||
import com.bonus.canteen.core.report.datascreen.service.DatascreenService;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DsAuthorityCanteenVO;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.houqin.utils.LeRequest;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/datascreen"})
|
||||
@Api(
|
||||
value = "报表中心/数据大屏/前厅版本数据",
|
||||
tags = {"前厅版本数据"}
|
||||
)
|
||||
public class DatascreenController {
|
||||
private static final Logger log = LoggerFactory.getLogger(DatascreenController.class);
|
||||
@Autowired
|
||||
@Lazy
|
||||
private DatascreenService datascreenService;
|
||||
// @Autowired
|
||||
// @Lazy
|
||||
// private DashboardAuthorityService dashboardAuthorityService;
|
||||
// @Autowired
|
||||
// private DashboardService dashboardService;
|
||||
|
||||
@PostMapping({"/getdatascreen"})
|
||||
@ApiOperation("获取数据大屏前厅版本数据内容")
|
||||
public AjaxResult getDatascreenData(@RequestBody DatascreenDTO dto) {
|
||||
List<DsAuthorityCanteenVO> canteenList = new ArrayList();
|
||||
// if (CharSequenceUtil.isNotBlank(content.getAuthorityId())) {
|
||||
// List<DashboardAuthority> authorities = this.dashboardAuthorityService.getDashboardAuthorityBySubject(content.getAuthorityId());
|
||||
// authorities.forEach((authority) -> {
|
||||
// DsAuthorityCanteenVO authorityPair;
|
||||
// if (CharSequenceUtil.isEmpty(authority.getStallIds())) {
|
||||
// authorityPair = new DsAuthorityCanteenVO();
|
||||
// authorityPair.setCanteenId(authority.getCanteenId());
|
||||
// authorityPair.setShopstallId(-1L);
|
||||
// canteenList.add(authorityPair);
|
||||
// } else {
|
||||
// String[] stallIds = authority.getStallIds().split(",");
|
||||
// String[] var4 = stallIds;
|
||||
// int var5 = stallIds.length;
|
||||
//
|
||||
// for(int var6 = 0; var6 < var5; ++var6) {
|
||||
// String stallId = var4[var6];
|
||||
// authorityPair = new DsAuthorityCanteenVO();
|
||||
// authorityPair.setCanteenId(authority.getCanteenId());
|
||||
// authorityPair.setShopstallId(Long.valueOf(stallId));
|
||||
// canteenList.add(authorityPair);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
DsAuthorityCanteenVO dsAuthorityCanteenVO = new DsAuthorityCanteenVO();
|
||||
dsAuthorityCanteenVO.setCanteenId(378928314946949120L);
|
||||
canteenList.add(dsAuthorityCanteenVO);
|
||||
return AjaxResult.success(this.datascreenService.getCurrentMealtimeNum(canteenList));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package com.bonus.canteen.core.report.datascreen.dto;
|
||||
|
||||
import com.bonus.canteen.core.order.common.constants.OrderRefundStateEnum;
|
||||
import com.bonus.canteen.core.order.common.constants.OrderStateEnum;
|
||||
import com.bonus.canteen.core.pay.common.constants.PayStateEnum;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DsAuthorityCanteenVO;
|
||||
import com.bonus.common.houqin.constant.DelFlagEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel
|
||||
public class DatascreenBaseDTO {
|
||||
@ApiModelProperty("食堂档口权限集合")
|
||||
List<DsAuthorityCanteenVO> canteenList;
|
||||
@ApiModelProperty("启用日期")
|
||||
private LocalDate applyDate;
|
||||
@ApiModelProperty("删除状态(正常)")
|
||||
private Integer delFlag;
|
||||
@ApiModelProperty("是否为默认(是)")
|
||||
private Integer isDefault;
|
||||
@ApiModelProperty("开始时间")
|
||||
private LocalDateTime beginTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
private LocalDateTime endTime;
|
||||
@ApiModelProperty("支付状态")
|
||||
private Integer payState;
|
||||
@ApiModelProperty("订单状态-取消")
|
||||
private Integer orderState;
|
||||
@ApiModelProperty("订单退款状态-已退款,部分退款")
|
||||
private Integer orderRefundState;
|
||||
@ApiModelProperty("订单明细退菜状态")
|
||||
private List<Integer> detailStateList;
|
||||
|
||||
public DatascreenBaseDTO() {
|
||||
this.delFlag = DelFlagEnum.DEL_FALSE.key();
|
||||
this.isDefault = DelFlagEnum.DEL_TRUE.key();
|
||||
this.payState = PayStateEnum.PAY_SUCC.getKey();
|
||||
this.orderState = OrderStateEnum.CANCEL.getKey();
|
||||
this.orderRefundState = OrderRefundStateEnum.FINISH.getKey();
|
||||
}
|
||||
|
||||
public List<DsAuthorityCanteenVO> getCanteenList() {
|
||||
return this.canteenList;
|
||||
}
|
||||
|
||||
public LocalDate getApplyDate() {
|
||||
return this.applyDate;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
return this.delFlag;
|
||||
}
|
||||
|
||||
public Integer getIsDefault() {
|
||||
return this.isDefault;
|
||||
}
|
||||
|
||||
public LocalDateTime getBeginTime() {
|
||||
return this.beginTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return this.endTime;
|
||||
}
|
||||
|
||||
public Integer getPayState() {
|
||||
return this.payState;
|
||||
}
|
||||
|
||||
public Integer getOrderState() {
|
||||
return this.orderState;
|
||||
}
|
||||
|
||||
public Integer getOrderRefundState() {
|
||||
return this.orderRefundState;
|
||||
}
|
||||
|
||||
public List<Integer> getDetailStateList() {
|
||||
return this.detailStateList;
|
||||
}
|
||||
|
||||
public void setCanteenList(final List<DsAuthorityCanteenVO> canteenList) {
|
||||
this.canteenList = canteenList;
|
||||
}
|
||||
|
||||
public void setApplyDate(final LocalDate applyDate) {
|
||||
this.applyDate = applyDate;
|
||||
}
|
||||
|
||||
public void setDelFlag(final Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public void setIsDefault(final Integer isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
public void setBeginTime(final LocalDateTime beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public void setEndTime(final LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public void setPayState(final Integer payState) {
|
||||
this.payState = payState;
|
||||
}
|
||||
|
||||
public void setOrderState(final Integer orderState) {
|
||||
this.orderState = orderState;
|
||||
}
|
||||
|
||||
public void setOrderRefundState(final Integer orderRefundState) {
|
||||
this.orderRefundState = orderRefundState;
|
||||
}
|
||||
|
||||
public void setDetailStateList(final List<Integer> detailStateList) {
|
||||
this.detailStateList = detailStateList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.canteen.core.report.datascreen.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel
|
||||
public class DatascreenDTO {
|
||||
@ApiModelProperty("权限id")
|
||||
private String authorityId;
|
||||
@ApiModelProperty("数据模块对应key")
|
||||
private String key;
|
||||
|
||||
public String getAuthorityId() {
|
||||
return this.authorityId;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public void setAuthorityId(final String authorityId) {
|
||||
this.authorityId = authorityId;
|
||||
}
|
||||
|
||||
public void setKey(final String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.canteen.core.report.datascreen.dto.v2;
|
||||
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DsAuthorityCanteenVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class DataScreenBaseDTO {
|
||||
@ApiModelProperty("食堂档口权限集合")
|
||||
List<DsAuthorityCanteenVO> canteenList;
|
||||
@ApiModelProperty("开始时间")
|
||||
private LocalDate startDate;
|
||||
@ApiModelProperty("结束时间")
|
||||
private LocalDate endDate;
|
||||
|
||||
public List<DsAuthorityCanteenVO> getCanteenList() {
|
||||
return this.canteenList;
|
||||
}
|
||||
|
||||
public LocalDate getStartDate() {
|
||||
return this.startDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndDate() {
|
||||
return this.endDate;
|
||||
}
|
||||
|
||||
public DataScreenBaseDTO setCanteenList(final List<DsAuthorityCanteenVO> canteenList) {
|
||||
this.canteenList = canteenList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataScreenBaseDTO setStartDate(final LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataScreenBaseDTO setEndDate(final LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.bonus.canteen.core.report.datascreen.mapper;
|
||||
|
||||
import com.bonus.canteen.core.report.datascreen.dto.DatascreenBaseDTO;
|
||||
import com.bonus.canteen.core.report.datascreen.dto.v2.DataScreenBaseDTO;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DatascreenMapper {
|
||||
Integer getDishesNum(@Param("content") DatascreenBaseDTO content, @Param("canteenList") List<DsAuthorityCanteenVO> canteenList);
|
||||
|
||||
List<DishIntervalNum> getIntervalDishNum(@Param("content") DatascreenBaseDTO content, @Param("canteenList") List<DsAuthorityCanteenVO> canteenList);
|
||||
|
||||
List<TitlePriceNumVO> getDishSaleList(@Param("param") DataScreenBaseDTO content);
|
||||
|
||||
List<TitleValueVO> getDishThumbUp(@Param("delFlag") Integer delFlag, @Param("canteenList") List<DsAuthorityCanteenVO> canteenList);
|
||||
|
||||
Integer selectTodayDishesSaleNum(@Param("canteenList") List<DsAuthorityCanteenVO> canteenList);
|
||||
|
||||
DatascreenMealtimeNumVO getMealNumSum(@Param("canteenList") List<DsAuthorityCanteenVO> canteenList);
|
||||
|
||||
List<TitleValueVO> getStallMealNumList(@Param("param") DataScreenBaseDTO content);
|
||||
|
||||
DatascreenSexConsumNumVO getSexConsumNum(@Param("param") DataScreenBaseDTO content);
|
||||
|
||||
List<TitleValueVO> getOrgConsumNumList(@Param("param") DataScreenBaseDTO content);
|
||||
|
||||
List<DishIntervalNum> getIntervalTypeNum(@Param("param") DataScreenBaseDTO content);
|
||||
|
||||
List<TitleValueVO> getPriceSumList(@Param("param") DataScreenBaseDTO dataScreenBaseDTO);
|
||||
|
||||
List<DatascreeDishesVO> getRecipeDishes(@Param("canteenList") List<DsAuthorityCanteenVO> canteenList);
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.canteen.core.report.datascreen.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DeviceQueryPresentNumVo;
|
||||
import com.bonus.canteen.core.report.model.DevicePassengerFlow;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface DzDevicePassengerFlowMapper extends BaseMapper<DevicePassengerFlow> {
|
||||
|
||||
List<DeviceQueryPresentNumVo> queryPresentNumByCanteenIds(@Param("date") LocalDate dateTime ,
|
||||
@Param("canteenIds") Set<Long> canteenIds,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime")LocalDateTime endTime);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
//package com.bonus.canteen.core.report.datascreen.service;
|
||||
//
|
||||
//public interface DatascreenBussService {
|
||||
// void pushToRedisUserAuthority(String redisName, Object content, Long merchantId, String authorityId);
|
||||
//}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.canteen.core.report.datascreen.service;
|
||||
|
||||
import com.bonus.canteen.core.report.datascreen.dto.DatascreenDTO;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.CurrentMealtimeVO;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DatascreenMealNum;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DsAuthorityCanteenVO;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.TitleValueVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DatascreenService {
|
||||
public List<CurrentMealtimeVO> getCurrentMealtimeNum(List<DsAuthorityCanteenVO> canteenList);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//package com.bonus.canteen.core.report.datascreen.service;
|
||||
//
|
||||
//import com.bonus.canteen.core.allocation.alloc.model.AllocMetadata;
|
||||
//import com.bonus.canteen.core.allocation.api.AllocMetadataApi;
|
||||
//import com.bonus.canteen.core.common.enums.MetadataModelTypeEnum;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.annotation.Lazy;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//@Component
|
||||
//public class DsMetadataService {
|
||||
// @Autowired
|
||||
// @Lazy
|
||||
// private AllocMetadataApi allocMetadataApi;
|
||||
//
|
||||
// public String queryMetadata() {
|
||||
// return this.allocMetadataApi.getMetadataValue(MetadataModelTypeEnum.REPORT, "ifUseDataScreen");
|
||||
// }
|
||||
//
|
||||
// public void saveMetadata(String metadata) {
|
||||
// List<AllocMetadata> payMetadataList = new ArrayList();
|
||||
// AllocMetadata payMetadata = new AllocMetadata(MetadataModelTypeEnum.REPORT, "ifUseDataScreen", metadata, (Long)null, (Long)null);
|
||||
// payMetadataList.add(payMetadata);
|
||||
// this.allocMetadataApi.saveList(payMetadataList);
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
//package com.bonus.canteen.core.report.datascreen.service.impl;
|
||||
//
|
||||
//import cn.hutool.core.text.CharSequenceUtil;
|
||||
//import com.bonus.canteen.core.report.datascreen.service.DatascreenBussService;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.annotation.Lazy;
|
||||
//import org.springframework.data.redis.core.RedisTemplate;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//@Service
|
||||
//public class DatascreenBussServiceImpl implements DatascreenBussService {
|
||||
// private static final Logger log = LoggerFactory.getLogger(DatascreenBussServiceImpl.class);
|
||||
// @Autowired
|
||||
// @Lazy
|
||||
// private RedisTemplate<Object, Object> redisTemplate;
|
||||
//
|
||||
// public void pushToRedisUserAuthority(String redisName, Object content, Long merchantId, String authorityId) {
|
||||
// StringBuilder sbu = new StringBuilder("yst:");
|
||||
// if (CharSequenceUtil.isBlank(authorityId)) {
|
||||
// sbu.append(merchantId).append(":").append("datascreen:").append("user:").append(redisName);
|
||||
// } else {
|
||||
// sbu.append(merchantId).append(":").append("datascreen:").append("user:").append(authorityId).append(":").append(redisName);
|
||||
// }
|
||||
//
|
||||
// this.redisTemplate.opsForValue().set(sbu.toString(), content);
|
||||
// }
|
||||
//}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.bonus.canteen.core.report.datascreen.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.allocation.api.AllocCanteenApi;
|
||||
import com.bonus.canteen.core.allocation.api.AllocMealtimeApi;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.AllocCanteen;
|
||||
import com.bonus.canteen.core.common.enums.AllocMealtimeTypeEnum;
|
||||
import com.bonus.canteen.core.common.utils.TenantContextHolder;
|
||||
import com.bonus.canteen.core.menu.model.AllocMealtimeModel;
|
||||
import com.bonus.canteen.core.report.dashboard.constant.DashboardDataKeyEnum;
|
||||
import com.bonus.canteen.core.report.datascreen.dto.DatascreenDTO;
|
||||
import com.bonus.canteen.core.report.datascreen.dto.v2.DataScreenBaseDTO;
|
||||
import com.bonus.canteen.core.report.datascreen.mapper.DatascreenMapper;
|
||||
import com.bonus.canteen.core.report.datascreen.service.DatascreenService;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DatascreenServiceImpl implements DatascreenService {
|
||||
private static final Logger log = LoggerFactory.getLogger(DatascreenServiceImpl.class);
|
||||
@Autowired
|
||||
@Lazy
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private DatascreenMapper datascreenMapper;
|
||||
@Autowired
|
||||
private AllocMealtimeApi allocMealtimeApi;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AllocCanteenApi allocCanteenApi;
|
||||
@Autowired
|
||||
private DzDevicePassengerFlowServiceImpl dzDevicePassengerFlowService;
|
||||
|
||||
/**
|
||||
* 定制-获取客流量
|
||||
*/
|
||||
public List<CurrentMealtimeVO> getCurrentMealtimeNum(List<DsAuthorityCanteenVO> canteenList) {
|
||||
List<CurrentMealtimeVO> list = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(canteenList)) {
|
||||
return list;
|
||||
}
|
||||
List<Long> canteenIdList = canteenList.stream()
|
||||
.map(DsAuthorityCanteenVO::getCanteenId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<DzDevicePassengerFlowVO> dzDevicePassengerFlowVOList = dzDevicePassengerFlowService.getDevicePassengerFlowData(canteenList.stream().map(DsAuthorityCanteenVO::getCanteenId).collect(Collectors.toSet()));
|
||||
//排序使dzDevicePassengerFlowVOList中的canteenId和canteenIdList中的canteenId顺序一致
|
||||
List<DzDevicePassengerFlowVO> finalDzDevicePassengerFlowVOList = dzDevicePassengerFlowVOList;
|
||||
dzDevicePassengerFlowVOList = canteenIdList.stream().map(canteen -> finalDzDevicePassengerFlowVOList.stream().filter(e -> e.getCanteenId().equals(canteen)).findFirst().orElse(null)).collect(Collectors.toList());
|
||||
dzDevicePassengerFlowVOList.forEach(e -> {
|
||||
CurrentMealtimeVO mealtimeVO = new CurrentMealtimeVO();
|
||||
mealtimeVO.setCanteenId(e.getCanteenId());
|
||||
mealtimeVO.setCanteenName(e.getCanteenName());
|
||||
Integer presentNum = e.getDiningNum() >= 0 ? e.getDiningNum() : 0;
|
||||
mealtimeVO.setMealNum(presentNum);
|
||||
mealtimeVO.setCurrentSeat(e.getRemainingSeats());
|
||||
Integer capacity = e.getRemainingSeats() + presentNum;
|
||||
if (capacity.equals(0)) {
|
||||
mealtimeVO.setBit(BigDecimal.ZERO);
|
||||
} else {
|
||||
if (presentNum > capacity) {
|
||||
mealtimeVO.setBit(BigDecimal.ONE);
|
||||
} else {
|
||||
mealtimeVO.setBit(BigDecimal.valueOf(presentNum).divide(BigDecimal.valueOf(capacity), 3, BigDecimal.ROUND_FLOOR));
|
||||
}
|
||||
}
|
||||
list.add(mealtimeVO);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.bonus.canteen.core.report.datascreen.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.canteen.core.allocation.api.AllocCanteenApi;
|
||||
import com.bonus.canteen.core.allocation.api.AllocMealtimeApi;
|
||||
import com.bonus.canteen.core.allocation.canteen.model.AllocCanteen;
|
||||
import com.bonus.canteen.core.common.utils.LogUtil;
|
||||
import com.bonus.canteen.core.menu.model.AllocMealtimeModel;
|
||||
import com.bonus.canteen.core.report.datascreen.mapper.DzDevicePassengerFlowMapper;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DeviceQueryPresentNumVo;
|
||||
import com.bonus.canteen.core.report.datascreen.vo.DzDevicePassengerFlowVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DzDevicePassengerFlowServiceImpl {
|
||||
@Autowired
|
||||
@Lazy
|
||||
private DzDevicePassengerFlowMapper dzDevicePassengerFlowMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AllocCanteenApi allocCanteenApi;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AllocMealtimeApi allocMealtimeApi;
|
||||
|
||||
public List<DzDevicePassengerFlowVO> getDevicePassengerFlowData(Set<Long> canteenIdList) {
|
||||
List<DzDevicePassengerFlowVO> dzDevicePassengerFlowVOS = CollUtil.newArrayList();
|
||||
List<AllocCanteen> allocCanteens = allocCanteenApi.queryCanteenByCanteenIdList(canteenIdList);
|
||||
AllocMealtimeModel assignTimeMealtime = allocMealtimeApi.getAssignTimeMealtime(LocalTime.now(), null, null);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(assignTimeMealtime)) {
|
||||
LocalDateTime startTime = LocalDateTime.of(LocalDate.now(), assignTimeMealtime.getStartTime());
|
||||
LocalDateTime endTime = LocalDateTime.of(LocalDate.now(), assignTimeMealtime.getEndTime());
|
||||
List<DeviceQueryPresentNumVo> deviceQueryPresentNumVos = dzDevicePassengerFlowMapper.queryPresentNumByCanteenIds(LocalDate.now(),
|
||||
canteenIdList, startTime, endTime);
|
||||
Map<Long, List<DeviceQueryPresentNumVo>> collect = deviceQueryPresentNumVos.stream().collect(Collectors.groupingBy(DeviceQueryPresentNumVo::getCanteenId, Collectors.toList()));
|
||||
for (AllocCanteen allocCanteen : allocCanteens) {
|
||||
DzDevicePassengerFlowVO deviceQueryPresentNumVo = new DzDevicePassengerFlowVO();
|
||||
deviceQueryPresentNumVo.setCanteenId(allocCanteen.getCanteenId());
|
||||
deviceQueryPresentNumVo.setCanteenName(allocCanteen.getCanteenName());
|
||||
if (collect.containsKey(allocCanteen.getCanteenId())) {
|
||||
Integer presentNum = collect.get(allocCanteen.getCanteenId()).get(0).getPresentNum();
|
||||
if (ObjectUtil.isNotEmpty(allocCanteen.getCapacity()) && presentNum > 0) {
|
||||
int remainingSeats = allocCanteen.getCapacity() - presentNum;
|
||||
if (remainingSeats < 0) {
|
||||
deviceQueryPresentNumVo.setRemainingSeats(0);
|
||||
} else {
|
||||
deviceQueryPresentNumVo.setRemainingSeats(remainingSeats);
|
||||
}
|
||||
|
||||
} else if (ObjectUtil.isEmpty(allocCanteen.getCapacity())) {
|
||||
deviceQueryPresentNumVo.setRemainingSeats(0);
|
||||
} else {
|
||||
deviceQueryPresentNumVo.setRemainingSeats(allocCanteen.getCapacity());
|
||||
}
|
||||
deviceQueryPresentNumVo.setDiningNum(collect.get(allocCanteen.getCanteenId()).get(0).getPresentNum());
|
||||
} else {
|
||||
deviceQueryPresentNumVo.setRemainingSeats(ObjectUtil.isEmpty(allocCanteen.getCapacity()) ? 0 : allocCanteen.getCapacity());
|
||||
}
|
||||
dzDevicePassengerFlowVOS.add(deviceQueryPresentNumVo);
|
||||
}
|
||||
LogUtil.info("获取餐厅实时人数成功:", dzDevicePassengerFlowVOS);
|
||||
return dzDevicePassengerFlowVOS;
|
||||
}
|
||||
for (AllocCanteen allocCanteen : allocCanteens) {
|
||||
DzDevicePassengerFlowVO deviceQueryPresentNumVo = new DzDevicePassengerFlowVO();
|
||||
deviceQueryPresentNumVo.setCanteenId(allocCanteen.getCanteenId());
|
||||
deviceQueryPresentNumVo.setCanteenName(allocCanteen.getCanteenName());
|
||||
deviceQueryPresentNumVo.setRemainingSeats(allocCanteen.getCapacity());
|
||||
deviceQueryPresentNumVo.setDiningNum(0);
|
||||
dzDevicePassengerFlowVOS.add(deviceQueryPresentNumVo);
|
||||
}
|
||||
LogUtil.info("获取餐厅实时人数成功:",dzDevicePassengerFlowVOS);
|
||||
return dzDevicePassengerFlowVOS;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CurrentMealtimeVO {
|
||||
|
||||
@ApiModelProperty(value = "食堂id")
|
||||
private Long canteenId;
|
||||
|
||||
@ApiModelProperty(value = "食堂名称")
|
||||
private String canteenName;
|
||||
|
||||
@ApiModelProperty(value = "剩余座位")
|
||||
private Integer currentSeat;
|
||||
|
||||
@ApiModelProperty(value = "就餐人数")
|
||||
private Integer mealNum;
|
||||
|
||||
@ApiModelProperty(value = "比列")
|
||||
private BigDecimal bit;
|
||||
|
||||
@ApiModelProperty(value = "是否在餐次时段 1-是 2-否")
|
||||
private Integer ifInMealTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import com.bonus.canteen.core.common.utils.SysUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class DatascreeDishesDetailVO {
|
||||
@ApiModelProperty("菜品名称")
|
||||
private String dishesName;
|
||||
@ApiModelProperty("菜品图片")
|
||||
private String imageUrl;
|
||||
|
||||
public String getImageUrl() {
|
||||
return SysUtil.getCutFileUrl(this.imageUrl);
|
||||
}
|
||||
|
||||
public String getDishesName() {
|
||||
return this.dishesName;
|
||||
}
|
||||
|
||||
public void setDishesName(final String dishesName) {
|
||||
this.dishesName = dishesName;
|
||||
}
|
||||
|
||||
public void setImageUrl(final String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DatascreeDishesVO {
|
||||
@ApiModelProperty("餐次类型")
|
||||
private Integer mealtimeType;
|
||||
@ApiModelProperty("餐次名称")
|
||||
private String mealtimeName;
|
||||
@ApiModelProperty("菜品信息")
|
||||
private List<DatascreeDishesDetailVO> dishList;
|
||||
|
||||
public Integer getMealtimeType() {
|
||||
return this.mealtimeType;
|
||||
}
|
||||
|
||||
public String getMealtimeName() {
|
||||
return this.mealtimeName;
|
||||
}
|
||||
|
||||
public List<DatascreeDishesDetailVO> getDishList() {
|
||||
return this.dishList;
|
||||
}
|
||||
|
||||
public void setMealtimeType(final Integer mealtimeType) {
|
||||
this.mealtimeType = mealtimeType;
|
||||
}
|
||||
|
||||
public void setMealtimeName(final String mealtimeName) {
|
||||
this.mealtimeName = mealtimeName;
|
||||
}
|
||||
|
||||
public void setDishList(final List<DatascreeDishesDetailVO> dishList) {
|
||||
this.dishList = dishList;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Integer var10000 = this.getMealtimeType();
|
||||
return "DatascreeDishesVO(mealtimeType=" + var10000 + ", mealtimeName=" + this.getMealtimeName() + ", dishList=" + String.valueOf(this.getDishList()) + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public class DatascreenMealNum {
|
||||
@ApiModelProperty("今日就餐人数")
|
||||
private Integer totalCustNum;
|
||||
@ApiModelProperty("今日就餐人次")
|
||||
private Integer totalConsumeNum;
|
||||
@ApiModelProperty("各餐次就餐人次")
|
||||
List<TitleValueVO> todayIntervalMealNum;
|
||||
@ApiModelProperty("就餐率")
|
||||
private BigDecimal diningRate;
|
||||
|
||||
public Integer getTotalCustNum() {
|
||||
return this.totalCustNum;
|
||||
}
|
||||
|
||||
public Integer getTotalConsumeNum() {
|
||||
return this.totalConsumeNum;
|
||||
}
|
||||
|
||||
public List<TitleValueVO> getTodayIntervalMealNum() {
|
||||
return this.todayIntervalMealNum;
|
||||
}
|
||||
|
||||
public BigDecimal getDiningRate() {
|
||||
return this.diningRate;
|
||||
}
|
||||
|
||||
public void setTotalCustNum(final Integer totalCustNum) {
|
||||
this.totalCustNum = totalCustNum;
|
||||
}
|
||||
|
||||
public void setTotalConsumeNum(final Integer totalConsumeNum) {
|
||||
this.totalConsumeNum = totalConsumeNum;
|
||||
}
|
||||
|
||||
public void setTodayIntervalMealNum(final List<TitleValueVO> todayIntervalMealNum) {
|
||||
this.todayIntervalMealNum = todayIntervalMealNum;
|
||||
}
|
||||
|
||||
public void setDiningRate(final BigDecimal diningRate) {
|
||||
this.diningRate = diningRate;
|
||||
}
|
||||
|
||||
public DatascreenMealNum(final Integer totalCustNum, final Integer totalConsumeNum, final List<TitleValueVO> todayIntervalMealNum, final BigDecimal diningRate) {
|
||||
this.totalCustNum = totalCustNum;
|
||||
this.totalConsumeNum = totalConsumeNum;
|
||||
this.todayIntervalMealNum = todayIntervalMealNum;
|
||||
this.diningRate = diningRate;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class DatascreenMealtimeNumVO {
|
||||
@ApiModelProperty("早餐消费人数")
|
||||
private Integer breakfastCustNum;
|
||||
@ApiModelProperty("午餐消费人数")
|
||||
private Integer lunchCustNum;
|
||||
@ApiModelProperty("下午茶消费人数")
|
||||
private Integer afternoonCustNum;
|
||||
@ApiModelProperty("晚餐消费人数")
|
||||
private Integer dinnerCustNum;
|
||||
@ApiModelProperty("夜宵消费人数")
|
||||
private Integer supperCustNum;
|
||||
@ApiModelProperty("合计消费人数")
|
||||
private Integer totalCustNum;
|
||||
@ApiModelProperty("合计消费次数")
|
||||
private Integer totalConsumeNum;
|
||||
|
||||
public Integer getBreakfastCustNum() {
|
||||
return this.breakfastCustNum;
|
||||
}
|
||||
|
||||
public Integer getLunchCustNum() {
|
||||
return this.lunchCustNum;
|
||||
}
|
||||
|
||||
public Integer getAfternoonCustNum() {
|
||||
return this.afternoonCustNum;
|
||||
}
|
||||
|
||||
public Integer getDinnerCustNum() {
|
||||
return this.dinnerCustNum;
|
||||
}
|
||||
|
||||
public Integer getSupperCustNum() {
|
||||
return this.supperCustNum;
|
||||
}
|
||||
|
||||
public Integer getTotalCustNum() {
|
||||
return this.totalCustNum;
|
||||
}
|
||||
|
||||
public Integer getTotalConsumeNum() {
|
||||
return this.totalConsumeNum;
|
||||
}
|
||||
|
||||
public void setBreakfastCustNum(final Integer breakfastCustNum) {
|
||||
this.breakfastCustNum = breakfastCustNum;
|
||||
}
|
||||
|
||||
public void setLunchCustNum(final Integer lunchCustNum) {
|
||||
this.lunchCustNum = lunchCustNum;
|
||||
}
|
||||
|
||||
public void setAfternoonCustNum(final Integer afternoonCustNum) {
|
||||
this.afternoonCustNum = afternoonCustNum;
|
||||
}
|
||||
|
||||
public void setDinnerCustNum(final Integer dinnerCustNum) {
|
||||
this.dinnerCustNum = dinnerCustNum;
|
||||
}
|
||||
|
||||
public void setSupperCustNum(final Integer supperCustNum) {
|
||||
this.supperCustNum = supperCustNum;
|
||||
}
|
||||
|
||||
public void setTotalCustNum(final Integer totalCustNum) {
|
||||
this.totalCustNum = totalCustNum;
|
||||
}
|
||||
|
||||
public void setTotalConsumeNum(final Integer totalConsumeNum) {
|
||||
this.totalConsumeNum = totalConsumeNum;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class DatascreenSexConsumNumVO {
|
||||
@ApiModelProperty("总消费人数")
|
||||
private Integer custNum;
|
||||
@ApiModelProperty("男性人数")
|
||||
private Integer maleNum;
|
||||
@ApiModelProperty("女性人数")
|
||||
private Integer femaleNum;
|
||||
@ApiModelProperty("未知性别人数")
|
||||
private Integer otherNum;
|
||||
|
||||
public Integer getCustNum() {
|
||||
return this.custNum;
|
||||
}
|
||||
|
||||
public Integer getMaleNum() {
|
||||
return this.maleNum;
|
||||
}
|
||||
|
||||
public Integer getFemaleNum() {
|
||||
return this.femaleNum;
|
||||
}
|
||||
|
||||
public Integer getOtherNum() {
|
||||
return this.otherNum;
|
||||
}
|
||||
|
||||
public void setCustNum(final Integer custNum) {
|
||||
this.custNum = custNum;
|
||||
}
|
||||
|
||||
public void setMaleNum(final Integer maleNum) {
|
||||
this.maleNum = maleNum;
|
||||
}
|
||||
|
||||
public void setFemaleNum(final Integer femaleNum) {
|
||||
this.femaleNum = femaleNum;
|
||||
}
|
||||
|
||||
public void setOtherNum(final Integer otherNum) {
|
||||
this.otherNum = otherNum;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class DatascreenTimeInfo {
|
||||
@ApiModelProperty("当前时间")
|
||||
private String currentTime;
|
||||
@ApiModelProperty("当前日期")
|
||||
private String currentDate;
|
||||
@ApiModelProperty("当前餐次")
|
||||
private String currentMealTime;
|
||||
@ApiModelProperty("当前天气")
|
||||
private String currentWeather;
|
||||
|
||||
public String getCurrentTime() {
|
||||
return this.currentTime;
|
||||
}
|
||||
|
||||
public String getCurrentDate() {
|
||||
return this.currentDate;
|
||||
}
|
||||
|
||||
public String getCurrentMealTime() {
|
||||
return this.currentMealTime;
|
||||
}
|
||||
|
||||
public String getCurrentWeather() {
|
||||
return this.currentWeather;
|
||||
}
|
||||
|
||||
public void setCurrentTime(final String currentTime) {
|
||||
this.currentTime = currentTime;
|
||||
}
|
||||
|
||||
public void setCurrentDate(final String currentDate) {
|
||||
this.currentDate = currentDate;
|
||||
}
|
||||
|
||||
public void setCurrentMealTime(final String currentMealTime) {
|
||||
this.currentMealTime = currentMealTime;
|
||||
}
|
||||
|
||||
public void setCurrentWeather(final String currentWeather) {
|
||||
this.currentWeather = currentWeather;
|
||||
}
|
||||
|
||||
|
||||
public DatascreenTimeInfo() {
|
||||
}
|
||||
|
||||
public DatascreenTimeInfo(final String currentTime, final String currentDate, final String currentMealTime, final String currentWeather) {
|
||||
this.currentTime = currentTime;
|
||||
this.currentDate = currentDate;
|
||||
this.currentMealTime = currentMealTime;
|
||||
this.currentWeather = currentWeather;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class DeviceQueryPresentNumVo {
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
@ApiModelProperty("客流量")
|
||||
private Integer presentNum;
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public Integer getPresentNum() {
|
||||
return this.presentNum;
|
||||
}
|
||||
|
||||
public DeviceQueryPresentNumVo setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DeviceQueryPresentNumVo setPresentNum(final Integer presentNum) {
|
||||
this.presentNum = presentNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getCanteenId();
|
||||
return "DeviceQueryPresentNumVo(canteenId=" + var10000 + ", presentNum=" + this.getPresentNum() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import com.bonus.canteen.core.common.enums.AllocMealtimeTypeEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel
|
||||
public class DishIntervalNum {
|
||||
@ApiModelProperty("餐次名称")
|
||||
private String intervalName;
|
||||
@ApiModelProperty("餐次类型-和早中晚对应")
|
||||
private Integer intervalType;
|
||||
@ApiModelProperty("总数")
|
||||
private Integer totalNum;
|
||||
|
||||
public String getIntervalName() {
|
||||
return AllocMealtimeTypeEnum.getDescByKey(this.intervalType);
|
||||
}
|
||||
|
||||
public Integer getIntervalType() {
|
||||
return this.intervalType;
|
||||
}
|
||||
|
||||
public Integer getTotalNum() {
|
||||
return this.totalNum;
|
||||
}
|
||||
|
||||
public void setIntervalName(final String intervalName) {
|
||||
this.intervalName = intervalName;
|
||||
}
|
||||
|
||||
public void setIntervalType(final Integer intervalType) {
|
||||
this.intervalType = intervalType;
|
||||
}
|
||||
|
||||
public void setTotalNum(final Integer totalNum) {
|
||||
this.totalNum = totalNum;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String var10000 = this.getIntervalName();
|
||||
return "DishIntervalNum(intervalName=" + var10000 + ", intervalType=" + this.getIntervalType() + ", totalNum=" + this.getTotalNum() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("大屏食堂配置返回")
|
||||
public class DsAuthorityCanteenVO {
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
@ApiModelProperty("档口id")
|
||||
private Long shopstallId;
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public Long getShopstallId() {
|
||||
return this.shopstallId;
|
||||
}
|
||||
|
||||
public void setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public void setShopstallId(final Long shopstallId) {
|
||||
this.shopstallId = shopstallId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DzDevicePassengerFlowVO {
|
||||
/**
|
||||
* 食堂id
|
||||
*/
|
||||
private Long canteenId;
|
||||
/**
|
||||
* 食堂名称
|
||||
*/
|
||||
private String canteenName;
|
||||
/**
|
||||
* 剩余座位(食堂容纳人数-进场人数)
|
||||
*/
|
||||
private Integer remainingSeats = 0;
|
||||
/**
|
||||
* 就餐人数(进场人数)
|
||||
*/
|
||||
private Integer diningNum = 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel
|
||||
public class TitlePriceNumVO {
|
||||
@ApiModelProperty("名称")
|
||||
private String title;
|
||||
@ApiModelProperty("价格")
|
||||
private String price;
|
||||
@ApiModelProperty("数量")
|
||||
private String number;
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return this.price;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return this.number;
|
||||
}
|
||||
|
||||
public void setTitle(final String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setPrice(final String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public void setNumber(final String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
String var10000 = this.getTitle();
|
||||
return "TitlePriceNumVO(title=" + var10000 + ", price=" + this.getPrice() + ", number=" + this.getNumber() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.canteen.core.report.datascreen.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel
|
||||
public class TitleValueVO {
|
||||
@ApiModelProperty("标题")
|
||||
private String title;
|
||||
@ApiModelProperty("数量/值")
|
||||
private String value;
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setTitle(final String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void setValue(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
package com.bonus.canteen.core.report.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ApiModel("存储客流数据实体")
|
||||
@TableName("device_passenger_flow")
|
||||
public class DevicePassengerFlow {
|
||||
@ApiModelProperty("开始时间")
|
||||
private LocalDateTime startTime;
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime = "";
|
||||
@ApiModelProperty("进入客流数量【由店外到店内经过相机视场】")
|
||||
private Integer enters = 0;
|
||||
@ApiModelProperty("离开客流数量【由店内到店外经过相机视场】")
|
||||
private Integer exits = 0;
|
||||
@ApiModelProperty("店外经过客流数量【由店外进入又离开相机视场】")
|
||||
private Integer passings = 0;
|
||||
@ApiModelProperty("店内折返客流数量【由店内进入相机视场,又离开相机视场回到店内】")
|
||||
private Integer returns = 0;
|
||||
@ApiModelProperty("设备sn")
|
||||
private String serialNumber = "";
|
||||
@ApiModelProperty("设备名称")
|
||||
private String deviceName = "";
|
||||
@ApiModelProperty("设备ip")
|
||||
private String deviceIp = "";
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
@ApiModelProperty("创建日期")
|
||||
private LocalDate createDate;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return this.endTime;
|
||||
}
|
||||
|
||||
public Integer getEnters() {
|
||||
return this.enters;
|
||||
}
|
||||
|
||||
public Integer getExits() {
|
||||
return this.exits;
|
||||
}
|
||||
|
||||
public Integer getPassings() {
|
||||
return this.passings;
|
||||
}
|
||||
|
||||
public Integer getReturns() {
|
||||
return this.returns;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return this.serialNumber;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return this.deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceIp() {
|
||||
return this.deviceIp;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public LocalDate getCreateDate() {
|
||||
return this.createDate;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setStartTime(final LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setEndTime(final String endTime) {
|
||||
this.endTime = endTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setEnters(final Integer enters) {
|
||||
this.enters = enters;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setExits(final Integer exits) {
|
||||
this.exits = exits;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setPassings(final Integer passings) {
|
||||
this.passings = passings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setReturns(final Integer returns) {
|
||||
this.returns = returns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setSerialNumber(final String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setDeviceName(final String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setDeviceIp(final String deviceIp) {
|
||||
this.deviceIp = deviceIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setId(final Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setCreateDate(final LocalDate createDate) {
|
||||
this.createDate = createDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setCreateTime(final LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DevicePassengerFlow setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
<if test="param.keyword != null and param.keyword != ''">
|
||||
AND (
|
||||
c.cust_num = #{param.keyword}
|
||||
OR c.cust_name = #{param.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.mobile = #{param.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler}
|
||||
or c.mobile_suffix = #{param.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.cust_name = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.mobile = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
||||
or c.mobile_suffix = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
||||
)
|
||||
</if>
|
||||
<if test="param.queryDate != null">
|
||||
|
|
@ -87,9 +87,9 @@
|
|||
<if test="param.keyword != null and param.keyword != ''">
|
||||
AND (
|
||||
c.cust_num = #{param.keyword}
|
||||
OR c.cust_name = #{param.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.mobile = #{param.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.mobile_suffix = #{param.keyword,typeHandler=net.xnzn.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.cust_name = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.mobile = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
||||
OR c.mobile_suffix = #{param.keyword,typeHandler=com.bonus.canteen.core.common.encrypt.SM4EncDecHandler}
|
||||
)
|
||||
</if>
|
||||
<if test="param.queryDate != null">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,428 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.report.datascreen.mapper.DatascreenMapper">
|
||||
<select id="getDishesNum" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count( DISTINCT b.dishes_id ) totalNum
|
||||
FROM
|
||||
menu_recipe_detail a
|
||||
LEFT JOIN menu_recipe_dishes b ON a.detail_id = b.detail_id
|
||||
LEFT JOIN menu_recipe c ON c.recipe_id = a.recipe_id
|
||||
WHERE
|
||||
a.apply_date = #{content.applyDate}
|
||||
AND a.del_flag = #{content.delFlag}
|
||||
AND b.del_flag = #{content.delFlag}
|
||||
AND c.del_flag = #{content.delFlag}
|
||||
<if test="canteenList != null and canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(c.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(c.canteen_id = #{canteenList.canteenId} and c.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getIntervalDishNum" resultType="com.bonus.canteen.core.report.datascreen.vo.DishIntervalNum">
|
||||
SELECT
|
||||
a.mealtime_type intervalType,
|
||||
count( DISTINCT b.dishes_id ) totalNum
|
||||
FROM
|
||||
menu_recipe_detail a
|
||||
LEFT JOIN menu_recipe_dishes b ON a.detail_id = b.detail_id
|
||||
LEFT JOIN menu_recipe d ON d.recipe_id = a.recipe_id
|
||||
WHERE
|
||||
a.apply_date = #{content.applyDate}
|
||||
AND a.del_flag = #{content.delFlag}
|
||||
AND b.del_flag = #{content.delFlag}
|
||||
<if test="canteenList != null and canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(d.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(d.canteen_id = #{canteenList.canteenId} and d.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
a.mealtime_type
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDishSaleList" resultType="com.bonus.canteen.core.report.datascreen.vo.TitlePriceNumVO">
|
||||
SELECT
|
||||
oa.*,
|
||||
IFNULL(md.price,'0') AS price
|
||||
FROM (
|
||||
SELECT
|
||||
d.goods_dishes_name AS title,
|
||||
d.goods_dishes_id ,
|
||||
sum( d.quantity ) AS number,
|
||||
CASE
|
||||
d.sales_mode
|
||||
WHEN 2 THEN
|
||||
'g' ELSE '份'
|
||||
END AS unit_name
|
||||
FROM
|
||||
report_analysis_dishes_sale d
|
||||
WHERE
|
||||
d.statistic_date <![CDATA[>=]]> #{param.startDate}
|
||||
AND d.statistic_date <![CDATA[<=]]> #{param.endDate}
|
||||
AND d.detail_type NOT IN (3, 4, 5, 6 )
|
||||
<if test="param.canteenList != null and param.canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="param.canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(d.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(d.canteen_id = #{canteenList.canteenId} and d.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
d.goods_dishes_id,
|
||||
d.goods_dishes_name,
|
||||
d.sales_mode
|
||||
ORDER BY
|
||||
number DESC
|
||||
LIMIT 10
|
||||
) oa LEFT JOIN menu_dishes md ON oa.goods_dishes_id = md.dishes_id
|
||||
</select>
|
||||
|
||||
<select id="getDishThumbUp" resultType="com.bonus.canteen.core.report.datascreen.vo.TitleValueVO">
|
||||
select distinct
|
||||
d.dishes_name as title,
|
||||
d.like_num as value
|
||||
from
|
||||
menu_recipe_detail a
|
||||
left join menu_recipe_dishes b on a.detail_id = b.detail_id
|
||||
left join menu_recipe c on c.recipe_id = a.recipe_id
|
||||
left join menu_dishes d on d.dishes_id = b.dishes_id
|
||||
where
|
||||
a.del_flag = #{delFlag}
|
||||
and b.del_flag = #{delFlag}
|
||||
and c.del_flag = #{delFlag}
|
||||
<if test="canteenList != null and canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(c.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(c.canteen_id = #{canteenList.canteenId} and c.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
order by
|
||||
value desc
|
||||
limit 10
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectTodayDishesSaleNum" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
ifnull(sum( quantity ), 0)
|
||||
FROM
|
||||
report_analysis_dishes_sale
|
||||
WHERE
|
||||
statistic_date = CURDATE()
|
||||
AND sales_mode = 1
|
||||
AND detail_type NOT IN (3,4,5,6)
|
||||
<if test="canteenList != null and canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(canteen_id = #{canteenList.canteenId} and stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getMealNumSum" resultType="com.bonus.canteen.core.report.datascreen.vo.DatascreenMealtimeNumVO">
|
||||
select
|
||||
IFNULL(sum(if(t.mealtime_type = 1, t.consume_num, 0)),0) AS breakfast_cust_num,
|
||||
IFNULL(sum(if(t.mealtime_type = 2, t.consume_num, 0)),0) AS lunch_cust_num,
|
||||
IFNULL(sum(if(t.mealtime_type = 3, t.consume_num, 0)),0) AS afternoon_cust_num,
|
||||
IFNULL(sum(if(t.mealtime_type = 4, t.consume_num, 0)),0) AS dinner_cust_num,
|
||||
IFNULL(sum(if(t.mealtime_type = 5, t.consume_num, 0)),0) AS supper_cust_num,
|
||||
IFNULL(sum(if(t.mealtime_type = -1, t.consume_num, 0)),0) AS other_cust_num,
|
||||
IFNULL(sum(t.cust_num),0) total_cust_num,
|
||||
IFNULL(sum(t.consume_num),0) total_consume_num
|
||||
FROM
|
||||
( SELECT a.mealtime_type, a.cust_num, a.consume_num FROM report_sum_mealtime a WHERE statistic_date = CURDATE()
|
||||
<if test="canteenList != null and canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(canteen_id = #{canteenList.canteenId} and stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
) t
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getStallMealNumList" resultType="com.bonus.canteen.core.report.datascreen.vo.TitleValueVO">
|
||||
SELECT
|
||||
b.stall_name AS title,
|
||||
sum( a.cust_num ) AS value
|
||||
FROM
|
||||
report_sum_mealtime a
|
||||
LEFT JOIN alloc_stall b ON a.stall_id = b.stall_id
|
||||
WHERE
|
||||
b.stall_name is not NULL AND
|
||||
a.statistic_date <![CDATA[>=]]> #{param.startDate}
|
||||
AND a.statistic_date <![CDATA[<=]]> #{param.endDate}
|
||||
<if test="param.canteenList != null and param.canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="param.canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(a.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(a.canteen_id = #{canteenList.canteenId} and a.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
a.stall_id,
|
||||
b.stall_name
|
||||
ORDER BY value DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="getSexConsumNum" resultType="com.bonus.canteen.core.report.datascreen.vo.DatascreenSexConsumNumVO">
|
||||
SELECT
|
||||
IFNULL( sum(if(c.sex = 1,1,0)) , 0 ) AS male_num,
|
||||
IFNULL( sum(if(c.sex = 2,1,0)) , 0 ) AS female_num,
|
||||
IFNULL( count(*) , 0 ) AS cust_num,
|
||||
IFNULL( count(*) - sum(if(c.sex in(1,2),1,0)), 0 ) AS other_num
|
||||
|
||||
FROM(
|
||||
SELECT DISTINCT o.cust_id
|
||||
FROM
|
||||
report_order_info o
|
||||
where
|
||||
o.order_refund_state <![CDATA[<>]]> 2
|
||||
<if test="param.startDate != null">
|
||||
<![CDATA[AND o.pay_time >= concat(#{param.startDate},' 00:00:00')]]>
|
||||
</if>
|
||||
<if test="param.endDate != null">
|
||||
<![CDATA[AND o.pay_time <= concat(#{param.endDate},' 23:59:59.999999999')]]>
|
||||
</if>
|
||||
<if test="param.canteenList != null and param.canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="param.canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(o.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(o.canteen_id = #{canteenList.canteenId} and o.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
) t
|
||||
LEFT JOIN cust_info c ON c.cust_id = t.cust_id
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getOrgConsumNumList" resultType="com.bonus.canteen.core.report.datascreen.vo.TitleValueVO">
|
||||
SELECT
|
||||
g.org_name title,
|
||||
IFNULL( a.VALUE, 0 ) `value`
|
||||
|
||||
FROM
|
||||
cust_org g
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(g.org_full_id,'/', 2 + 1), '/', -1) as SIGNED) as a_org_id,
|
||||
sum( a.cust_num ) `value`
|
||||
|
||||
FROM
|
||||
report_sum_mealtime a
|
||||
LEFT JOIN cust_org g on g.org_id = a.org_id
|
||||
WHERE
|
||||
a.statistic_date <![CDATA[>=]]> #{param.startDate}
|
||||
AND a.statistic_date <![CDATA[<=]]> #{param.endDate}
|
||||
<if test="param.canteenList != null and param.canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="param.canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(a.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(a.canteen_id = #{canteenList.canteenId} and a.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
a_org_id
|
||||
ORDER BY
|
||||
`value`
|
||||
DESC
|
||||
) a ON a.a_org_id = g.org_id
|
||||
WHERE g.org_level = 2
|
||||
ORDER BY `value` desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getIntervalTypeNum" resultType="com.bonus.canteen.core.report.datascreen.vo.DishIntervalNum">
|
||||
SELECT
|
||||
mealtime_type AS intervalType,
|
||||
sum(cust_num) totalNum
|
||||
FROM
|
||||
report_sum_mealtime
|
||||
WHERE
|
||||
mealtime_type != -1 AND
|
||||
statistic_date <![CDATA[>=]]> #{param.startDate}
|
||||
AND statistic_date <![CDATA[<=]]> #{param.endDate}
|
||||
<if test="param.canteenList != null and param.canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="param.canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(canteen_id = #{canteenList.canteenId} and stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY mealtime_type
|
||||
ORDER BY mealtime_type
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPriceSumList" resultType="com.bonus.canteen.core.report.datascreen.vo.TitleValueVO">
|
||||
SELECT
|
||||
a.title,
|
||||
count(*) AS VALUE
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
CASE
|
||||
when real_amount <![CDATA[ >= ]]> 0 and real_amount <![CDATA[ < ]]> 500 then '0-5元'
|
||||
when real_amount <![CDATA[ >= ]]> 500 and real_amount <![CDATA[ < ]]> 1000 then '5-10元'
|
||||
when real_amount <![CDATA[ >= ]]> 1000 and real_amount <![CDATA[ < ]]> 1500 then '10-15元'
|
||||
when real_amount <![CDATA[ >= ]]> 1500 and real_amount <![CDATA[ < ]]> 2000 then '15-20元'
|
||||
when real_amount <![CDATA[ >= ]]> 2000 and real_amount <![CDATA[ < ]]> 2500 then '20-25元'
|
||||
when real_amount <![CDATA[ >= ]]> 2500 and real_amount <![CDATA[ < ]]> 3000 then '25-30元'
|
||||
else '30元以上'
|
||||
END
|
||||
as title,
|
||||
CASE
|
||||
when real_amount <![CDATA[ >= ]]> 0 and real_amount <![CDATA[ < ]]> 500 then 1
|
||||
when real_amount <![CDATA[ >= ]]> 500 and real_amount <![CDATA[ < ]]> 1000 then 2
|
||||
when real_amount <![CDATA[ >= ]]> 1000 and real_amount <![CDATA[ < ]]> 1500 then 3
|
||||
when real_amount <![CDATA[ >= ]]> 1500 and real_amount <![CDATA[ < ]]> 2000 then 4
|
||||
when real_amount <![CDATA[ >= ]]> 2000 and real_amount <![CDATA[ < ]]> 2500 then 5
|
||||
when real_amount <![CDATA[ >= ]]> 2500 and real_amount <![CDATA[ < ]]> 3000 then 6
|
||||
else 7
|
||||
END
|
||||
as seq
|
||||
from report_order_info
|
||||
WHERE
|
||||
<![CDATA[pay_time >= DATE_FORMAT(#{param.startDate},"%Y-%m-%d 00:00:00")]]>
|
||||
<![CDATA[and pay_time <= DATE_FORMAT(#{param.endDate},"%Y-%m-%d 23:59:59")]]>
|
||||
<if test="param.canteenList != null and param.canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="param.canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(canteen_id = #{canteenList.canteenId} and stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
) a GROUP BY a.seq , a.title
|
||||
ORDER BY a.seq
|
||||
</select>
|
||||
|
||||
<select id="getRecipeDishes" resultMap="dishList">
|
||||
SELECT DISTINCT
|
||||
a.mealtime_type,
|
||||
d.dishes_name,
|
||||
d.image_url
|
||||
FROM
|
||||
menu_recipe_detail a
|
||||
LEFT JOIN menu_recipe_dishes b ON a.detail_id = b.detail_id
|
||||
left join menu_recipe c on c.recipe_id = a.recipe_id
|
||||
LEFT JOIN menu_dishes d ON d.dishes_id = b.dishes_id
|
||||
WHERE
|
||||
a.apply_date = DATE(NOW())
|
||||
AND a.del_flag = 2
|
||||
AND b.del_flag = 2
|
||||
and c.del_flag = 2
|
||||
<if test="canteenList != null and canteenList.size > 0">
|
||||
and
|
||||
<foreach collection="canteenList" item="canteenList" separator="or" open="(" close=")">
|
||||
<choose>
|
||||
<when test="canteenList.shopstallId == -1">
|
||||
(c.canteen_id = #{canteenList.canteenId})
|
||||
</when>
|
||||
<when test="canteenList.shopstallId != -1">
|
||||
(c.canteen_id = #{canteenList.canteenId} and c.stall_id=#{canteenList.shopstallId})
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<resultMap id="dishList" type="com.bonus.canteen.core.report.datascreen.vo.DatascreeDishesVO">
|
||||
<result property="mealtimeType" column="mealtime_type"/>
|
||||
<collection property="dishList" ofType="com.bonus.canteen.core.report.datascreen.vo.DatascreeDishesDetailVO">
|
||||
<result property="dishesName" column="dishes_name"/>
|
||||
<result property="imageUrl" column="image_url"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.bonus.canteen.core.report.datascreen.mapper.DzDevicePassengerFlowMapper">
|
||||
|
||||
<select id="queryPresentNumByCanteenIds" resultType="com.bonus.canteen.core.report.datascreen.vo.DeviceQueryPresentNumVo">
|
||||
SELECT dpf.canteen_id AS canteenId, (SUM(enters) - SUM(exits)) AS presentNum
|
||||
FROM device_passenger_flow dpf
|
||||
WHERE dpf.create_date = #{date}
|
||||
<if test="startTime != null" >
|
||||
AND dpf.start_time <![CDATA[>]]> #{startTime}
|
||||
AND dpf.start_time <![CDATA[<]]> #{endTime}
|
||||
</if>
|
||||
<if test="canteenIds!=null">
|
||||
AND dpf.canteen_id in
|
||||
<foreach collection="canteenIds" item="canteenId" open="(" separator="," close=")">
|
||||
#{canteenId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by dpf.canteen_id
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue