智慧厨房

This commit is contained in:
gaowdong 2025-06-18 17:41:22 +08:00
parent e7d25adeb8
commit e67266f3af
15 changed files with 148 additions and 37 deletions

View File

@ -2,6 +2,8 @@ package com.bonus.canteen.core.kitchen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.kitchen.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
@ -42,8 +44,8 @@ public class KitchenWasteDealController extends BaseController {
*/
@ApiOperation(value = "查询厨房废弃物处置列表")
//@RequiresPermissions("kitchen:deal:list")
@GetMapping("/list")
public TableDataInfo list(KitchenWasteDeal kitchenWasteDeal) {
@PostMapping("/list")
public TableDataInfo list(@RequestBody @Valid KitchenWasteDeal kitchenWasteDeal) {
startPage();
List<KitchenWasteDeal> list = kitchenWasteDealService.selectKitchenWasteDealList(kitchenWasteDeal);
return getDataTable(list);

View File

@ -2,6 +2,8 @@ package com.bonus.canteen.core.kitchen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.kitchen.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
@ -42,8 +44,8 @@ public class KitchenWasteMealController extends BaseController {
*/
@ApiOperation(value = "查询厨房餐余浪费列表")
//@RequiresPermissions("kitchen:meal:list")
@GetMapping("/list")
public TableDataInfo list(KitchenWasteMeal kitchenWasteMeal) {
@PostMapping("/list")
public TableDataInfo list(@RequestBody @Valid KitchenWasteMeal kitchenWasteMeal) {
startPage();
List<KitchenWasteMeal> list = kitchenWasteMealService.selectKitchenWasteMealList(kitchenWasteMeal);
return getDataTable(list);

View File

@ -86,9 +86,6 @@ public class KitchenDeviceSensorRecord extends BaseEntity {
@ApiModelProperty(value = "食堂名称")
private String canteenName;
@ApiModelProperty(value = "测量结果名称")
private String sensorResultTypeName;
@ApiModelProperty(value = "测量指标类型")
private Integer measureType;

View File

@ -1,6 +1,7 @@
package com.bonus.canteen.core.kitchen.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
@ -81,5 +82,11 @@ public class KitchenWasteDeal extends BaseEntity {
@ApiModelProperty(value = "处理人id")
private Long staffId;
@ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime startDateTime;
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime endDateTime;
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.kitchen.domain;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
@ -50,5 +51,18 @@ public class KitchenWasteMeal extends BaseEntity {
@ApiModelProperty(value = "附件")
private String fileUrl;
@ApiModelProperty(value = "食堂名称")
private String canteenName;
@ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime startDateTime;
@ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime endDateTime;
@Excel(name = "区域Id")
@ApiModelProperty(value = "厨余汇总")
private Long wasteMealCount;
}

View File

@ -0,0 +1,32 @@
package com.bonus.canteen.core.kitchen.domain.constants;
public enum WasteDealTypeEnum {
DISCARD(1, "丢弃"),
NEXT_MEAL_USE(2, "下一餐使用"),
COLLECT_SELLING(3, "集中售卖");
private final Integer key;
private final String desc;
private WasteDealTypeEnum(Integer key, String desc) {
this.key = key;
this.desc = desc;
}
public Integer getKey() {
return this.key;
}
public String getDesc() {
return this.desc;
}
public static String getDescByKey(Integer targetKey) {
for (WasteDealTypeEnum dealTypeEnum : WasteDealTypeEnum.values()) {
if (dealTypeEnum.getKey().equals(targetKey)) {
return dealTypeEnum.getDesc();
}
}
return "";
}
}

View File

@ -5,14 +5,14 @@ import com.bonus.canteen.core.kitchen.domain.KitchenWasteMeal;
/**
* 厨房餐余浪费Mapper接口
*
*
* @author xsheng
* @date 2025-06-16
*/
public interface KitchenWasteMealMapper {
/**
* 查询厨房餐余浪费
*
*
* @param ledgerId 厨房餐余浪费主键
* @return 厨房餐余浪费
*/
@ -20,7 +20,7 @@ public interface KitchenWasteMealMapper {
/**
* 查询厨房餐余浪费列表
*
*
* @param kitchenWasteMeal 厨房餐余浪费
* @return 厨房餐余浪费集合
*/
@ -28,7 +28,7 @@ public interface KitchenWasteMealMapper {
/**
* 新增厨房餐余浪费
*
*
* @param kitchenWasteMeal 厨房餐余浪费
* @return 结果
*/
@ -36,7 +36,7 @@ public interface KitchenWasteMealMapper {
/**
* 修改厨房餐余浪费
*
*
* @param kitchenWasteMeal 厨房餐余浪费
* @return 结果
*/
@ -44,7 +44,7 @@ public interface KitchenWasteMealMapper {
/**
* 删除厨房餐余浪费
*
*
* @param ledgerId 厨房餐余浪费主键
* @return 结果
*/
@ -52,9 +52,17 @@ public interface KitchenWasteMealMapper {
/**
* 批量删除厨房餐余浪费
*
*
* @param ledgerIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteKitchenWasteMealByLedgerIds(Long[] ledgerIds);
/**
* 查询厨房餐余浪费汇总
*
* @param kitchenWasteMeal 厨房餐余浪费
* @return 厨房餐余浪费集合
*/
public List<KitchenWasteMeal> selectKitchenWasteMealListCount(KitchenWasteMeal kitchenWasteMeal);
}

View File

@ -51,27 +51,27 @@ public class KitchenDeviceSensorRecordServiceImpl implements IKitchenDeviceSenso
kitchenDeviceSensorRecordList.forEach(record -> {
if("temperature".equals(record.getMeasureCode()) && StringUtils.isNotBlank(record.getMeasureData())) {
if(new BigDecimal(record.getMeasureData()).compareTo(record.getMeasureMaxValue()) > 0) {
record.setSensorResultTypeName(DeviceSensorResultEnum.TEMPERATURE_HIGH.getDesc());
record.setMeasureData(DeviceSensorResultEnum.TEMPERATURE_HIGH.getDesc());
}else if(new BigDecimal(record.getMeasureData()).compareTo(record.getMeasureMaxValue()) < 0) {
record.setSensorResultTypeName(DeviceSensorResultEnum.TEMPERATURE_LOW.getDesc());
record.setMeasureData(DeviceSensorResultEnum.TEMPERATURE_LOW.getDesc());
} else {
record.setSensorResultTypeName(DeviceSensorResultEnum.NORMAL.getDesc());
record.setMeasureData(DeviceSensorResultEnum.NORMAL.getDesc());
}
}
if("humidity".equals(record.getMeasureCode()) && StringUtils.isNotBlank(record.getMeasureData())) {
if(new BigDecimal(record.getMeasureData()).compareTo(record.getMeasureMaxValue()) > 0) {
record.setSensorResultTypeName(DeviceSensorResultEnum.HUMIDITY_HIGH.getDesc());
record.setMeasureData(DeviceSensorResultEnum.HUMIDITY_HIGH.getDesc());
}else if(new BigDecimal(record.getMeasureData()).compareTo(record.getMeasureMaxValue()) < 0) {
record.setSensorResultTypeName(DeviceSensorResultEnum.HUMIDITY_LOW.getDesc());
record.setMeasureData(DeviceSensorResultEnum.HUMIDITY_LOW.getDesc());
} else {
record.setSensorResultTypeName(DeviceSensorResultEnum.NORMAL.getDesc());
record.setMeasureData(DeviceSensorResultEnum.NORMAL.getDesc());
}
}
if("smoke".equals(record.getMeasureCode()) && StringUtils.isNotBlank(record.getMeasureData())) {
if(new BigDecimal(record.getMeasureData()).compareTo(record.getMeasureMaxValue()) > 0) {
record.setSensorResultTypeName(DeviceSensorResultEnum.SMOKE_HIGH.getDesc());
record.setMeasureData(DeviceSensorResultEnum.SMOKE_HIGH.getDesc());
} else {
record.setSensorResultTypeName(DeviceSensorResultEnum.NORMAL.getDesc());
record.setMeasureData(DeviceSensorResultEnum.NORMAL.getDesc());
}
}
});

View File

@ -101,10 +101,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</if>
<if test="startDateTime != null">
and kdsr.create_time <![CDATA[ >= ]]> #{startDateTime}
and kdsr.device_time <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and kdsr.create_time <![CDATA[ <= ]]> #{endDateTime}
and kdsr.device_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>

View File

@ -58,10 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</if>
<if test="startDateTime != null">
and kscr.create_time <![CDATA[ >= ]]> #{startDateTime}
and kscr.operate_date <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and kscr.create_time <![CDATA[ <= ]]> #{endDateTime}
and kscr.operate_date <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>

View File

@ -86,6 +86,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or bd.dishes_name like CONCAT('%',#{searchValue},'%')
)
</if>
<if test="startDateTime != null">
and ksdr.sample_save_time <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and ksdr.sample_save_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>

View File

@ -59,10 +59,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</if>
<if test="startDateTime != null">
and ksiw.create_time <![CDATA[ >= ]]> #{startDateTime}
and ksiw.record_time <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and ksiw.create_time <![CDATA[ <= ]]> #{endDateTime}
and ksiw.record_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>

View File

@ -58,10 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if test="startDateTime != null">
and ksmc.create_time <![CDATA[ >= ]]> #{startDateTime}
and ksmc.record_time <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and ksmc.create_time <![CDATA[ <= ]]> #{endDateTime}
and ksmc.record_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>

View File

@ -23,7 +23,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectKitchenWasteDealVo">
select waste_id, weight, garbage_name, action_date, device_id, mealtime_type, canteen_id, area_id, deal_type, sale_amount, scene_picture, staff_id, create_by, create_time, update_by, update_time from kitchen_waste_deal
select waste_id, weight, garbage_name, action_date, device_id, mealtime_type,
kwd.canteen_id, kwd.area_id, deal_type, sale_amount, scene_picture, kwd.staff_id,
kwd.create_by, kwd.create_time, kwd.update_by, kwd.update_time
from kitchen_waste_deal kwd
left join basic_canteen bc on kwd.canteen_id = bc.canteen_id
left join kitchen_staff_info ksi on kwd.staff_id = ksi.staff_id
left join sys_user su on ksi.user_id = su.user_id
</sql>
<select id="selectKitchenWasteDealList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteDeal" resultMap="KitchenWasteDealResult">
@ -34,12 +40,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="actionDate != null "> and action_date = #{actionDate}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="mealtimeType != null "> and mealtime_type = #{mealtimeType}</if>
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="canteenId != null "> and kwd.canteen_id = #{canteenId}</if>
<if test="areaId != null "> and kwd.area_id = #{areaId}</if>
<if test="dealType != null "> and deal_type = #{dealType}</if>
<if test="saleAmount != null "> and sale_amount = #{saleAmount}</if>
<if test="scenePicture != null and scenePicture != ''"> and scene_picture = #{scenePicture}</if>
<if test="staffId != null "> and staff_id = #{staffId}</if>
<if test="staffId != null "> and kwd.staff_id = #{staffId}</if>
<if test="startDateTime != null">
and kwd.action_date <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and kwd.action_date <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>

View File

@ -15,10 +15,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="canteenName" column="canteen_name" />
<result property="wasteMealCount" column="waste_meal_count" />
</resultMap>
<sql id="selectKitchenWasteMealVo">
select ledger_id, ledger_time, mealtime_type, canteen_id, area_id, file_url, remark, create_by, create_time, update_by, update_time from kitchen_waste_meal
select ledger_id, ledger_time, mealtime_type, kwm.canteen_id, kwm.area_id, file_url, remark,
kwm.create_by, kwm.create_time, kwm.update_by, kwm.update_time, bc.canteen_name
from kitchen_waste_meal kwm
left join basic_canteen bc on bc.canteen_id = kwm.canteen_id
</sql>
<select id="selectKitchenWasteMealList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteMeal" resultMap="KitchenWasteMealResult">
@ -26,9 +31,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="ledgerTime != null "> and ledger_time = #{ledgerTime}</if>
<if test="mealtimeType != null "> and mealtime_type = #{mealtimeType}</if>
<if test="canteenId != null "> and canteen_id = #{canteenId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="canteenId != null "> and kwm.canteen_id = #{canteenId}</if>
<if test="areaId != null "> and kwm.area_id = #{areaId}</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
<if test="startDateTime != null">
and kwm.ledger_time <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and kwm.ledger_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>
@ -92,4 +103,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{ledgerId}
</foreach>
</delete>
<select id="selectKitchenWasteMealListCount" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenWasteMeal" resultMap="KitchenWasteMealResult">
select ledger_time, mealtime_type, kwm.canteen_id, bc.canteen_name, count(*) as waste_meal_count
from kitchen_waste_meal kwm
left join basic_canteen bc on bc.canteen_id = kwm.canteen_id
group by kwm.ledger_time, kwm.mealtime_type, kwm.canteen_id
<where>
<if test="ledgerTime != null "> and ledger_time = #{ledgerTime}</if>
<if test="mealtimeType != null "> and mealtime_type = #{mealtimeType}</if>
<if test="canteenId != null "> and kwm.canteen_id = #{canteenId}</if>
<if test="areaId != null "> and kwm.area_id = #{areaId}</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
<if test="startDateTime != null">
and kwm.ledger_time <![CDATA[ >= ]]> #{startDateTime}
</if>
<if test="endDateTime != null">
and kwm.ledger_time <![CDATA[ <= ]]> #{endDateTime}
</if>
</where>
</select>
</mapper>