更新菜谱发送mq
This commit is contained in:
parent
565e63072b
commit
7062b99647
|
|
@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.bonus.canteen.core.android.vo.CookMealtimeTypeEnum;
|
import com.bonus.canteen.core.android.vo.CookMealtimeTypeEnum;
|
||||||
import com.bonus.canteen.core.common.utils.DateUtil;
|
import com.bonus.canteen.core.common.utils.DateUtil;
|
||||||
import com.bonus.canteen.core.common.utils.MqUtil;
|
import com.bonus.canteen.core.common.utils.MqUtil;
|
||||||
|
import com.bonus.canteen.core.common.utils.RedisUtil;
|
||||||
import com.bonus.canteen.core.cook.domain.CookAppRecipe;
|
import com.bonus.canteen.core.cook.domain.CookAppRecipe;
|
||||||
import com.bonus.canteen.core.cook.domain.CookRecipeDetail;
|
import com.bonus.canteen.core.cook.domain.CookRecipeDetail;
|
||||||
import com.bonus.canteen.core.cook.domain.CookRecipeDishes;
|
import com.bonus.canteen.core.cook.domain.CookRecipeDishes;
|
||||||
|
|
@ -296,9 +297,9 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
// 重新创建详情+菜品数据
|
// 重新创建详情+菜品数据
|
||||||
createRecipeDetails(cookRecipeDTO);
|
createRecipeDetails(cookRecipeDTO);
|
||||||
// 发送mq
|
// 发送mq
|
||||||
List<Integer> deviceInfoList = this.cookRecipeMapper.getDeviceIdByDevice(String.valueOf(cookRecipeDTO.getCanteenId()), String.valueOf(cookRecipeDTO.getStallId()));
|
List<Integer> deviceIds = this.cookRecipeMapper.getDeviceIdByDevice(String.valueOf(cookRecipeDTO.getCanteenId()), String.valueOf(cookRecipeDTO.getStallId()));
|
||||||
if(deviceInfoList !=null && deviceInfoList.size() >0){
|
if(deviceIds !=null && deviceIds.size() >0){
|
||||||
List<String> deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceInfoList);
|
List<String> deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceIds);
|
||||||
for (String deviceSn : deviceSnList){
|
for (String deviceSn : deviceSnList){
|
||||||
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,"update");
|
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,"update");
|
||||||
MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
||||||
|
|
@ -487,13 +488,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//发送mq
|
//发送mq
|
||||||
// if (CookBindTypeEnum.TABLE.key().equals(content.getBindType())) { //TABLE(7, "智慧餐台/消费机")
|
if (CookBindTypeEnum.TABLE.key().equals(content.getBindType())) { //TABLE(7, "智慧餐台/消费机")
|
||||||
// List<String> deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceInfoList);
|
List<String> deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceIds);
|
||||||
// for (String deviceSn : deviceSnList) {
|
for (String deviceSn : deviceSnList) {
|
||||||
// DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0, content.getHandleType().equals(1) ? "update" : "del");
|
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0, content.getHandleType().equals(1) ? "update" : "del");
|
||||||
// MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +546,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new);
|
Long[] cookRecipeDetailArray = cookRecipeDetailIds.stream().toArray(Long[]::new);
|
||||||
cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray);
|
cookRecipeDishesMapper.deleteCookRecipeDishesByCookRecipeDetailIds(cookRecipeDetailArray);
|
||||||
cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray);
|
cookRecipeDetailMapper.deleteCookRecipeDetailByRecipeDetailIds(cookRecipeDetailArray);
|
||||||
return cookRecipeMapper.deleteCookRecipeByRecipeIds(recipeIds);
|
int count = cookRecipeMapper.deleteCookRecipeByRecipeIds(recipeIds);
|
||||||
|
for (int i = 0; i < recipeIds.length; i++) {
|
||||||
|
String redisKey = String.format("yst:%s:recipe:%s:detail:%s", GlobalConstants.TENANT_ID, recipeIds[i], "*");
|
||||||
|
RedisUtil.deleteByPattern(redisKey);
|
||||||
|
MqUtil.sendDataChange(recipeIds[i], LeMqConstant.DataChangeType.REMOVE, LeMqConstant.Topic.DATA_CHANGE_RECIPE);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue