Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
87f66ad049
|
|
@ -215,7 +215,7 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
|||
void updateRecipeByCanteeStallMeal(@Param("recipeId")String recipeId, @Param("canteenId")String canteenId, @Param("stallId")String stallId, @Param("deviceIds")List<Integer> deviceIds);
|
||||
Long getRecipeIdBySn(String machineSn);
|
||||
|
||||
List<MenuAndroidRecipeDetailVO> selectMenuRecipeDetailList(Long recipeId);
|
||||
List<MenuAndroidRecipeDetailVO> selectMenuRecipeDetailLists(Long recipeId);
|
||||
|
||||
List<IssueRecipeDetailCompressVO> selectRecipeDishList(@Param("detailIds") List<Long> detailIds);
|
||||
|
||||
|
|
@ -254,4 +254,6 @@ public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
|||
@Select({"select recipe_id as recipeId from menu_recipe ${ew.customSqlSegment}"})
|
||||
List<Long> selectRecipeIdList(@Param("ew") QueryWrapper<MenuRecipe> recipeType);
|
||||
|
||||
|
||||
List<String> getDeviceSnByIds(@Param("list") List<Integer> deviceInfoList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ public class MenuDishesServiceImpl extends ServiceImpl<MenuDishesMapper, MenuDis
|
|||
throw new ServiceException("菜品基础ID不能为空");
|
||||
}
|
||||
MenuDishes menuDishesOne = menuDishesMapper.getOne(menuDishesDTO);
|
||||
if(menuDishesOne !=null && !String.valueOf(menuDishesOne.getDishesId()).equals(menuDishesDTO.getDishesId())){
|
||||
if(menuDishesOne !=null && String.valueOf(menuDishesOne.getDishesId()).equals(menuDishesDTO.getDishesId())){
|
||||
throw new ServiceException("菜品已存在");
|
||||
}
|
||||
addIds(menuDishesDTO);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ import com.bonus.canteen.core.menu.service.MenuDishesBaseService;
|
|||
import com.bonus.canteen.core.menu.service.MenuDishesSizeService;
|
||||
import com.bonus.canteen.core.menu.vo.*;
|
||||
import com.bonus.canteen.core.utils.*;
|
||||
import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
|
||||
import com.bonus.canteen.core.utils.BnsConstants;
|
||||
import com.bonus.canteen.core.utils.CurrentToNextSunday;
|
||||
import com.bonus.canteen.core.utils.DeviceMqMessage;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDataVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO;
|
||||
import com.bonus.canteen.core.menu.vo.MenuRecipeV2VO;
|
||||
|
|
@ -199,18 +203,20 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
@Override
|
||||
public void bindAppRecipe(MenuRecipeBindDTO content) {
|
||||
MenuRecipe menuRecipe = this.menuRecipeMapper.selectMenuRecipe(content.getRecipeId());
|
||||
if(content.getStallId() !=null && content.getCanteenId() !=null){
|
||||
List<Integer> deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(content.getCanteenId()), String.valueOf(content.getStallId()));
|
||||
if(deviceInfoList == null || deviceInfoList.isEmpty()){
|
||||
List<Integer> deviceInfoList = new ArrayList<>();
|
||||
if(content.getStallId() !=null){
|
||||
deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(content.getStallId()));
|
||||
if(deviceInfoList == null || deviceInfoList.isEmpty() || deviceInfoList.size() == 0){
|
||||
throw new ServiceException(I18n.getMessage("该食堂档口下没有设备信息", new Object[0]));
|
||||
}
|
||||
}
|
||||
List<String> deviceSnList = this.menuRecipeMapper.getDeviceSnByIds(deviceInfoList);
|
||||
MenuRecipeSortEnum sortEnum = MenuRecipeSortEnum.getBindTypeMap().get(content.getBindType());
|
||||
MenuAppRecipe mar = new MenuAppRecipe();
|
||||
mar.setRecipeId(content.getRecipeId());
|
||||
mar.setMealLineId(content.getMealLineId());
|
||||
mar.setBindType(content.getBindType());
|
||||
List<Integer> deviceTypeList = menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()));
|
||||
List<Integer> deviceTypeList = menuRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(menuRecipe.getStallId()));
|
||||
if (ObjectUtil.isEmpty(sortEnum)) {
|
||||
throw new ServiceException(I18n.getMessage("bingType值异常", new Object[0]));
|
||||
} else {
|
||||
|
|
@ -248,6 +254,12 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
this.menuRecipeMapper.updateRecipeByCanteeStallMeal("-1", String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()), deviceTypeList);
|
||||
}
|
||||
}
|
||||
//发送消息
|
||||
//发送mq
|
||||
for (String deviceSn : deviceSnList){
|
||||
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,content.getHandleType().equals(1) ? "update" : "del");
|
||||
MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +466,14 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
result.setMenuRecipe(recipe);
|
||||
result.setAdd(add);
|
||||
this.processResult(result);
|
||||
|
||||
if (!add){
|
||||
List<Integer> deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(dto.getCanteenId()), String.valueOf(dto.getStallId()));
|
||||
List<String> deviceSnList = this.menuRecipeMapper.getDeviceSnByIds(deviceInfoList);
|
||||
for (String deviceSn : deviceSnList){
|
||||
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,"update");
|
||||
MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
||||
}
|
||||
}
|
||||
return recipeId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1309,8 +1328,11 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
//查询菜谱信息
|
||||
MenuRecipe menuRecipe = menuRecipeMapper.getOneById(recipeId);
|
||||
//查询所有的detailsId
|
||||
List<MenuAndroidRecipeDetailVO> menuRecipeDetailList = menuRecipeMapper.selectMenuRecipeDetailList(recipeId);
|
||||
List<MenuAndroidRecipeDetailVO> menuRecipeDetailList = menuRecipeMapper.selectMenuRecipeDetailLists(recipeId);
|
||||
List<Long> detailIds = menuRecipeDetailList.stream().map(MenuAndroidRecipeDetailVO::getDetailId).collect(Collectors.toList());
|
||||
if (ObjectUtil.isEmpty(detailIds)){
|
||||
return issueRecipe;
|
||||
}
|
||||
//查询所有的dishesId
|
||||
List<IssueRecipeDetailCompressVO> recipeDishList = menuRecipeMapper.selectRecipeDishList(detailIds);
|
||||
List<Long> dishesIds = recipeDishList.stream().map(IssueRecipeDetailCompressVO::getDishesId).collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -714,13 +714,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from device_recipe
|
||||
where device_id = (select device_id from device_info where device_sn = #{machineSn} limit 1) limit 1
|
||||
</select>
|
||||
<!-- <select id="selectMenuRecipeDetailList" resultType="com.bonus.canteen.core.menu.vo.MenuAndroidRecipeDetailVO">-->
|
||||
<!-- select-->
|
||||
<!-- detail_id as detailId,-->
|
||||
<!-- mealtime_type as mealTimeType,-->
|
||||
<!-- apply_date as applyData-->
|
||||
<!-- from menu_recipe_detail where recipe_id = #{recipeId} and apply_date >= Date(NOW())-->
|
||||
<!-- </select>-->
|
||||
<select id="selectMenuRecipeDetailLists" resultType="com.bonus.canteen.core.menu.vo.MenuAndroidRecipeDetailVO">
|
||||
select
|
||||
detail_id as detailId,
|
||||
mealtime_type as mealTimeType,
|
||||
apply_date as applyData
|
||||
from menu_recipe_detail where recipe_id = #{recipeId} and apply_date >= Date(NOW())
|
||||
</select>
|
||||
<select id="selectRecipeDishList" resultType="com.bonus.canteen.core.menu.vo.IssueRecipeDetailCompressVO">
|
||||
select
|
||||
detail_id as detailId,
|
||||
|
|
@ -1059,7 +1059,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select a.device_id
|
||||
from device_info a
|
||||
LEFT JOIN device_bind b on a.device_id = b.device_id
|
||||
where b.canteen_id = #{canteenId} and b.stall_id = #{stallId}
|
||||
where b.stall_id = #{stallId}
|
||||
</select>
|
||||
|
||||
|
||||
|
|
@ -1265,6 +1265,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and mrd.apply_date between #{applyStartDate} and #{applyEndDate}
|
||||
order by mrd.apply_date,mrdd.sort_num
|
||||
</select>
|
||||
<select id="getDeviceSnByIds" resultType="java.lang.String">
|
||||
select device_sn
|
||||
from device_info
|
||||
where device_id in
|
||||
<foreach collection="list" item="deviceId" separator="," open="(" close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectDishesNameAndCanteenName" resultType="java.lang.String">
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue