Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9466a7eb36
17 files changed
+454
-5
No files matched your search
@@ -0,0 +1,15 @@
|
||||
-- 大屏配置表
|
||||
CREATE TABLE `hard_panel_setting`
|
||||
(
|
||||
`id` bigint(20) NOT NULL COMMENT '主键ID',
|
||||
`nutrition_top_exclude_classify` varchar(1024) NOT NULL COMMENT '营养分析-菜品排行-排除菜品分类',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` varchar(50) DEFAULT NULL COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`del_flag` char(1) DEFAULT '0' COMMENT '是否删除(0=正常 1=删除)',
|
||||
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='大屏配置表';
|
||||
|
||||
+7
@@ -2,6 +2,9 @@ package com.bsd.pjcloud.hard.api.dto.order.app;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 个人菜品喜好排行
|
||||
*/
|
||||
@@ -10,4 +13,8 @@ public class HardAppProductLikeTopDto {
|
||||
|
||||
private Long userId;
|
||||
|
||||
private List<Long> classifyIds;
|
||||
|
||||
private LocalDateTime[] payTimeList;
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.hard.api.dto.panel;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardPanelSettingDto extends HardPanelSettingEntity {
|
||||
|
||||
}
|
||||
+2
@@ -21,6 +21,8 @@ public class PanelProductDto {
|
||||
|
||||
private List<String> mchTypeCodes;
|
||||
|
||||
private List<Long> classifyIds;
|
||||
|
||||
private String hourTypeIsNull;
|
||||
|
||||
private String hourType;
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.bsd.pjcloud.hard.api.entity.panel;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 大屏配置表
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName(value = "hard_panel_setting", autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "大屏配置表")
|
||||
public class HardPanelSettingEntity extends Model<HardPanelSettingEntity> {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 营养分析json配置
|
||||
*/
|
||||
@Schema(description = "营养分析json配置")
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private HardPanelSettingShare.NutritionSetting nutritionSetting;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新者")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否删除(0=正常 1=删除)
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "是否删除(0=正常 1=删除)")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
@Schema(description = "租户编号")
|
||||
private Long tenantId;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.hard.api.entity.panel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HardPanelSettingShare {
|
||||
|
||||
/**
|
||||
* 营养分析配置
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
static public class NutritionSetting {
|
||||
|
||||
/**
|
||||
* 喜爱菜品排行需要排除的菜品分类
|
||||
*/
|
||||
private List<Long> topExcludeCategoryIds;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+15
-5
@@ -19,11 +19,26 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
public class PanelPorductVo {
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String classifyName;
|
||||
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
private Long classifyId;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
/**
|
||||
* 商家ID
|
||||
*/
|
||||
@@ -39,11 +54,6 @@ public class PanelPorductVo {
|
||||
*/
|
||||
private String hourType;
|
||||
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String productStr;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.hard.api.vo.panel;
|
||||
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardPanelSettingVo extends HardPanelSettingEntity {
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.bsd.pjcloud.hard.controller.panel;
|
||||
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.HardPanelSettingDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
import com.bsd.pjcloud.hard.service.HardPanelSettingService;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 大屏配置表
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/hardPanelSetting")
|
||||
@Tag(description = "hardPanelSetting", name = "大屏配置表管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardPanelSettingController {
|
||||
|
||||
private final HardPanelSettingService hardPanelSettingService;
|
||||
|
||||
@Operation(summary = "查询配置", description = "查询配置")
|
||||
@GetMapping("/setting")
|
||||
public R getSetting() {
|
||||
return R.ok(hardPanelSettingService.getSetting());
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "新增或修改", description = "新增或修改")
|
||||
@PostMapping
|
||||
public R<HardPanelSettingEntity> saveOrUpdate(@RequestBody HardPanelSettingDto dto) {
|
||||
return R.ok(hardPanelSettingService.selefSaveOrUpdate(dto));
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.bsd.pjcloud.hard.controller.panel;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.util.DateRangeTool;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.service.PanelNutritionService;
|
||||
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.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.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/panel-nutrition")
|
||||
@Tag(description = "panel-nutrition", name = "营养统计")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class PanelNutritionController {
|
||||
|
||||
private final PanelNutritionService panelNutritionService;
|
||||
|
||||
@PostMapping(value = "/class-count")
|
||||
@Operation(summary = "食堂用餐分类统计")
|
||||
public R<List<PanelPorductVo>> classCount(@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()));
|
||||
return R.ok(panelNutritionService.classCount(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/cuisine-top")
|
||||
@Operation(summary = "菜品喜好排行")
|
||||
public R<List<PanelPorductVo>> cuisineTop(@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()));
|
||||
return R.ok(panelNutritionService.cuisineTop(dto));
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.hard.mapper.panel;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HardPanelSettingMapper extends PjcloudBaseMapper<HardPanelSettingEntity> {
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.HardPanelSettingDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
|
||||
public interface HardPanelSettingService extends IService<HardPanelSettingEntity> {
|
||||
|
||||
/**
|
||||
* 查询配置
|
||||
*/
|
||||
HardPanelSettingEntity getSetting();
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
HardPanelSettingEntity selefSaveOrUpdate(HardPanelSettingDto 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;
|
||||
|
||||
/**
|
||||
* @author liusiyang_dxm
|
||||
* @since 2025/10/14
|
||||
*/
|
||||
public interface PanelNutritionService {
|
||||
|
||||
/**
|
||||
* 食堂用餐分类统计
|
||||
*/
|
||||
List<PanelPorductVo> classCount(PanelProductDto dto);
|
||||
|
||||
/**
|
||||
* 菜品喜好排行
|
||||
*/
|
||||
List<PanelPorductVo> cuisineTop(PanelProductDto dto);
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.panel;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.HardPanelSettingDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
import com.bsd.pjcloud.hard.mapper.panel.HardPanelSettingMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardPanelSettingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 大屏配置表
|
||||
*/
|
||||
@Service
|
||||
public class HardPanelSettingServiceImpl extends ServiceImpl<HardPanelSettingMapper, HardPanelSettingEntity> implements HardPanelSettingService {
|
||||
|
||||
/**
|
||||
* 查询配置
|
||||
*/
|
||||
@Override
|
||||
public HardPanelSettingEntity getSetting() {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@Override
|
||||
public HardPanelSettingEntity selefSaveOrUpdate(HardPanelSettingDto dto) {
|
||||
HardPanelSettingEntity setting = getSetting();
|
||||
if (ObjectUtil.isEmpty(setting)) {
|
||||
baseMapper.insert(dto);
|
||||
} else {
|
||||
dto.setId(setting.getId());
|
||||
baseMapper.updateById(dto);
|
||||
}
|
||||
return setting;
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.panel;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppProductByClassifyDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.app.HardAppProductLikeTopDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.panel.PanelProductDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity;
|
||||
import com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingShare;
|
||||
import com.bsd.pjcloud.hard.api.vo.hard.PanelPorductVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductByClassifyVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.app.HardAppProductLikeTopVo;
|
||||
import com.bsd.pjcloud.hard.mapper.order.HardOrderMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardCanteenTotalService;
|
||||
import com.bsd.pjcloud.hard.service.HardPanelSettingService;
|
||||
import com.bsd.pjcloud.hard.service.PanelNutritionService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class PanelNutritionServiceImpl implements PanelNutritionService {
|
||||
|
||||
private final HardOrderMapper hardOrderMapper;
|
||||
|
||||
private final HardCanteenTotalService canteenTotalService;
|
||||
private final HardPanelSettingService panelSettingService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
/**
|
||||
* 食堂用餐分类统计
|
||||
*/
|
||||
@Override
|
||||
public List<PanelPorductVo> classCount(PanelProductDto dto) {
|
||||
HardAppProductByClassifyDto classDto = new HardAppProductByClassifyDto();
|
||||
classDto.setPayTimeList(dto.getTotalTimeList());
|
||||
List<HardAppProductByClassifyVo> list = canteenTotalService.productByClassify(classDto);
|
||||
return list.stream().map((item) -> {
|
||||
PanelPorductVo entity = new PanelPorductVo();
|
||||
entity.setClassifyId(item.getClassifyId());
|
||||
entity.setClassifyName(item.getClassifyName());
|
||||
entity.setBuyCount(item.getPayCount());
|
||||
entity.setBuyProductCount(item.getTimeCount());
|
||||
entity.setPersonCount(item.getPayUserCount());
|
||||
return entity;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜品喜好排行
|
||||
*/
|
||||
@Override
|
||||
public List<PanelPorductVo> cuisineTop(PanelProductDto dto) {
|
||||
HardAppProductLikeTopDto likeQuery = new HardAppProductLikeTopDto();
|
||||
|
||||
// 查询配置
|
||||
HardPanelSettingEntity setting = panelSettingService.getSetting();
|
||||
if (ObjectUtil.isNotEmpty(setting) && ObjectUtil.isNotEmpty(setting.getNutritionSetting())) {
|
||||
HardPanelSettingShare.NutritionSetting nutritionSetting = setting.getNutritionSetting();
|
||||
if (ObjectUtil.isNotEmpty(nutritionSetting.getTopExcludeCategoryIds())) {
|
||||
likeQuery.setClassifyIds(nutritionSetting.getTopExcludeCategoryIds());
|
||||
}
|
||||
}
|
||||
|
||||
likeQuery.setPayTimeList(dto.getTotalTimeList());
|
||||
List<HardAppProductLikeTopVo> list = canteenTotalService.productLikeTop(likeQuery);
|
||||
return list.stream().map((item) -> {
|
||||
PanelPorductVo entity = new PanelPorductVo();
|
||||
entity.setProductName(item.getProductName());
|
||||
entity.setProductId(item.getProductId());
|
||||
entity.setBuyProductCount(item.getPayCount());
|
||||
return entity;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -375,6 +375,15 @@
|
||||
<if test="dto.userId != null and dto.userId != '' ">
|
||||
and o.user_id = #{dto.userId}
|
||||
</if>
|
||||
<if test="dto.payTimeList != null and dto.payTimeList.length == 2">
|
||||
and o.pay_time between #{dto.payTimeList[0]} and #{dto.payTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.classifyIds != null and dto.classifyIds.size() != 0">
|
||||
and s.category_id not in
|
||||
<foreach collection="dto.classifyIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by a.product_id
|
||||
order by SUM(a.product_count) desc
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?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.bsd.pjcloud.hard.mapper.panel.HardPanelSettingMapper">
|
||||
<resultMap id="hardPanelSettingMap" type="com.bsd.pjcloud.hard.api.entity.panel.HardPanelSettingEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="nutritionTopExcludeClassify" column="nutrition_top_exclude_classify"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user