parent
d07a6d1072
commit
22fb0cbdcf
|
|
@ -86,4 +86,10 @@ public interface CookNutritionTypeMapper {
|
||||||
* @return 食材小类列表
|
* @return 食材小类列表
|
||||||
*/
|
*/
|
||||||
public List<NutritionTypeVO> selectLittleTypeList(String id);
|
public List<NutritionTypeVO> selectLittleTypeList(String id);
|
||||||
|
/**
|
||||||
|
* 检查是否存在菜品使用了指定的营养类型
|
||||||
|
* @param nutritionTypeIds 营养类型ID数组
|
||||||
|
* @return 存在的数量
|
||||||
|
*/
|
||||||
|
int checkIsExistCook(@Param("nutritionTypeIds") Long[] nutritionTypeIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,11 @@ public class CookNutritionTypeServiceImpl implements ICookNutritionTypeService {
|
||||||
if (code > 0) {
|
if (code > 0) {
|
||||||
throw new ServiceException("删除失败,营养类型下存在子集");
|
throw new ServiceException("删除失败,营养类型下存在子集");
|
||||||
}
|
}
|
||||||
|
// 检查是否有食材使用该营养类型
|
||||||
|
int count = cookNutritionTypeMapper.checkIsExistCook(nutritionTypeIds);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("删除失败,营养类型下存在食材");
|
||||||
|
}
|
||||||
return cookNutritionTypeMapper.deleteCookNutritionTypeByNutritionTypeIds(nutritionTypeIds);
|
return cookNutritionTypeMapper.deleteCookNutritionTypeByNutritionTypeIds(nutritionTypeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
||||||
String currentDate = DateUtils.getDate();
|
String currentDate = DateUtils.getDate();
|
||||||
String yesterday = getLastDate(-1);
|
String yesterday = getLastDate(-1);
|
||||||
//获取上一个有食堂订单的日期
|
//获取上一个有食堂订单的日期
|
||||||
yesterday = getLastDate(lastDay, yesterday);
|
// yesterday = getLastDate(lastDay, yesterday);
|
||||||
// 查询各项数据
|
// 查询各项数据
|
||||||
addSingleItem("今日食堂营业额(元)", currentDate, yesterday, list, 11, TURNOVER);
|
addSingleItem("今日食堂营业额(元)", currentDate, yesterday, list, 11, TURNOVER);
|
||||||
addSingleItem("今日食堂订单量(个)", currentDate, yesterday, list, 11, ORDER);
|
addSingleItem("今日食堂订单量(个)", currentDate, yesterday, list, 11, ORDER);
|
||||||
|
|
@ -135,6 +135,9 @@ public class DataScreeningServiceImpl implements DataScreeningService {
|
||||||
BigDecimal rate = todayNum.subtract(yesterdayNum)
|
BigDecimal rate = todayNum.subtract(yesterdayNum)
|
||||||
.divide(yesterdayNum, 4, RoundingMode.HALF_UP)
|
.divide(yesterdayNum, 4, RoundingMode.HALF_UP)
|
||||||
.multiply(BigDecimal.valueOf(100));
|
.multiply(BigDecimal.valueOf(100));
|
||||||
|
if (rate.compareTo(BigDecimal.valueOf(100)) > 0) {
|
||||||
|
rate = BigDecimal.valueOf(100);
|
||||||
|
}
|
||||||
today.setRate(String.format("%.2f", rate));
|
today.setRate(String.format("%.2f", rate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{nutritionTypeId}
|
#{nutritionTypeId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="checkIsExistCook" resultType="int">
|
||||||
|
select count(1) from cook_nutrition where nutrition_type_id in
|
||||||
|
<foreach item="nutritionTypeId" collection="nutritionTypeIds" open="(" separator="," close=")">
|
||||||
|
#{nutritionTypeId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue