Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3cb9a5023e
|
|
@ -85,7 +85,7 @@ public class AccCardHisController extends BaseController {
|
|||
try {
|
||||
return toAjax(accCardHisService.insertAccCardHis(accCardHis));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class AppletRecipeH5Controller extends BaseController {
|
|||
startPage();
|
||||
return getDataTable(this.appletRecipeH5Service.getWeekRecipeDetailList(content));
|
||||
} catch (Exception e) {
|
||||
return getDataTable(null);
|
||||
throw new RuntimeException(e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class MenuDishesController extends BaseController {
|
|||
try {
|
||||
return toAjax(menuDishesService.insertMenuDishes(menuDishes));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
//MenuDishesDTO
|
||||
|
|
@ -105,7 +105,7 @@ public class MenuDishesController extends BaseController {
|
|||
try {
|
||||
return toAjax(menuDishesService.addMenuDishes(menuDishesDTO));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class MenuMaterialController extends BaseController {
|
|||
try {
|
||||
return toAjax(menuMaterialService.insertMenuMaterial(menuMaterial));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ public class MenuMaterialController extends BaseController {
|
|||
try {
|
||||
return toAjax(menuMaterialService.updateMenuMaterial(menuMaterial));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error( e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class MenuNutritionTypeController extends BaseController {
|
|||
try {
|
||||
return toAjax(menuNutritionTypeService.insertMenuNutritionType(menuNutritionType));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ public class MenuNutritionTypeController extends BaseController {
|
|||
try {
|
||||
return toAjax(menuNutritionTypeService.updateMenuNutritionType(menuNutritionType));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.bonus.common.security.annotation.Logical;
|
|||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import net.bytebuddy.implementation.bytecode.Throw;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -188,8 +189,12 @@ public class MenuRecipeController extends BaseController {
|
|||
@ApiOperation("批量导入菜谱中的菜品信息")
|
||||
@Transactional
|
||||
public AjaxResult recipeImportDishes(@RequestParam("file") MultipartFile excel, @RequestParam("recipeId") Long recipeId) {
|
||||
try{
|
||||
return ObjectUtil.isNull(excel) ? AjaxResult.error("请选择导入文件 ^_^") :
|
||||
AjaxResult.success(this.menuRecipeService.recipeImportDishes(excel, recipeId));
|
||||
}catch (Exception e){
|
||||
throw new ServiceException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping({"/generateRecipe"})
|
||||
|
|
|
|||
|
|
@ -96,4 +96,5 @@ public interface MenuDishesMapper extends BaseMapper<MenuDishes> {
|
|||
MenuDishes getDishMessageByDishesId(String dishesId);
|
||||
|
||||
List<MapBean> getDishesType(MapBean mapBean);
|
||||
List<MapBean> getDishesTypeByList(@Param("key")String key,@Param("keyList")List<String> keyList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bonus.canteen.core.android.vo.UserInfoVo;
|
||||
import com.bonus.canteen.core.menu.domain.MapBean;
|
||||
import com.bonus.canteen.core.menu.domain.MenuRecipe;
|
||||
import com.bonus.canteen.core.menu.domain.MenuRecipeDetail;
|
||||
import com.bonus.canteen.core.menu.domain.MenuRecipeDishes;
|
||||
|
|
@ -31,6 +32,7 @@ import com.bonus.common.houqin.utils.id.Id;
|
|||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -60,6 +62,9 @@ public class AppletRecipeH5ServiceImpl extends ServiceImpl<MenuRecipeMapper, Men
|
|||
@Resource
|
||||
private MenuRecipeMapper menuRecipeMapper;
|
||||
|
||||
@Resource
|
||||
private MenuDishesMapper menuDishesMapper;
|
||||
|
||||
@Override
|
||||
public List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content) {
|
||||
//人员范围 暂时不用
|
||||
|
|
@ -123,7 +128,19 @@ public class AppletRecipeH5ServiceImpl extends ServiceImpl<MenuRecipeMapper, Men
|
|||
// } else {
|
||||
// appletDishesDetailVO.setIsFavorites(2);
|
||||
// }
|
||||
|
||||
if(appletDishesDetailVO != null && appletDishesDetailVO.getDishesDetailList() !=null && appletDishesDetailVO.getDishesDetailList().size()>0){
|
||||
String tasteIds = appletDishesDetailVO.getDishesDetailList().get(0).getTasteIds();
|
||||
if(!StringHelper.isNullOrEmptyString(tasteIds)){
|
||||
List<String> list = Arrays.asList(tasteIds.split(","));
|
||||
List<MapBean> mapBean = menuDishesMapper.getDishesTypeByList("dishes_taste",list);
|
||||
System.err.println("mapBean="+mapBean);
|
||||
String result = mapBean.stream()
|
||||
.map(MapBean::getKey) // 提取每个 MapBean 的 key
|
||||
.collect(Collectors.joining(",")); // 用逗号连
|
||||
appletDishesDetailVO.getDishesDetailList().get(0).setTasteIds(result);
|
||||
}
|
||||
// return menuDishesMapper.getDishesType(mapBean);
|
||||
}
|
||||
Long dishesId = ((AppletDishesSizeV2VO) appletDishesDetailVO.getDishesDetailList().get(0)).getDishesId();
|
||||
List materialList;
|
||||
if (appletDishesDetailVO.getMealType() == 1) {
|
||||
|
|
@ -150,6 +167,7 @@ public class AppletRecipeH5ServiceImpl extends ServiceImpl<MenuRecipeMapper, Men
|
|||
|
||||
@Override
|
||||
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
|
||||
try{
|
||||
List<Long> recipeIdList = Lists.newArrayList();
|
||||
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
|
||||
if (ObjectUtil.isNull(content.getRecipeId())) {
|
||||
|
|
@ -208,6 +226,10 @@ public class AppletRecipeH5ServiceImpl extends ServiceImpl<MenuRecipeMapper, Men
|
|||
return s2.getMealtimeType() - s1.getMealtimeType();
|
||||
}));
|
||||
return resultList;
|
||||
}catch (Exception e){
|
||||
throw new ServiceException(e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import com.google.common.collect.Lists;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -268,7 +269,7 @@ public class MenuDishesServiceImpl extends ServiceImpl<MenuDishesMapper, MenuDis
|
|||
throw new ServiceException("菜品已存在");
|
||||
}
|
||||
menuDishesOne = menuDishesMapper.getOneByNum(menuDishesDTO);
|
||||
if(menuDishesOne !=null && menuDishesOne.getDishesId() != Long.parseLong(menuDishesDTO.getDishesId())){
|
||||
if(menuDishesOne !=null && !StringHelper.isNullOrEmptyString(menuDishesDTO.getDishesNum())){
|
||||
throw new ServiceException("编号已存在");
|
||||
}
|
||||
Long dishesId = Id.next();
|
||||
|
|
|
|||
|
|
@ -70,9 +70,17 @@ public class MenuNutritionServiceImpl implements IMenuNutritionService {
|
|||
*/
|
||||
@Override
|
||||
public int insertMenuNutrition(MenuNutrition menuNutrition) {
|
||||
MenuNutrition existMenuNutrition = menuNutritionMapper.queryIfExistMenuNutrition(menuNutrition);
|
||||
if (Objects.nonNull(existMenuNutrition)) {
|
||||
throw new ServiceException("应用编码或名称重复");
|
||||
// MenuNutrition existMenuNutrition = menuNutritionMapper.queryIfExistMenuNutrition(menuNutrition);
|
||||
// if (Objects.nonNull(existMenuNutrition)) {
|
||||
// throw new ServiceException("应用编码或名称重复");
|
||||
// }
|
||||
MenuNutrition getOneByCode =menuNutritionMapper.getOneByCode(menuNutrition);
|
||||
if(getOneByCode != null){
|
||||
throw new ServiceException("营养编码重复");
|
||||
}
|
||||
MenuNutrition getOneByName =menuNutritionMapper.getOneByName(menuNutrition);
|
||||
if(getOneByName != null){
|
||||
throw new ServiceException("营养名称重复");
|
||||
}
|
||||
menuNutrition.setNutritionId(Id.next());
|
||||
menuNutrition.setCreateBy(SecurityUtils.getUsername());
|
||||
|
|
|
|||
|
|
@ -1417,9 +1417,10 @@ private IMenuRecipeDetailService menuRecipeDetailService;
|
|||
@Override
|
||||
public Set<String> recipeImportDishes(MultipartFile excel, Long recipeId) {
|
||||
ExcelReader excelReader = null;
|
||||
try {
|
||||
Set<String> notImportDishesNames = new HashSet();
|
||||
List<MenuRecipeImportListener> listeners = new ArrayList();
|
||||
try {
|
||||
|
||||
excelReader = EasyExcel.read(excel.getInputStream()).build();
|
||||
List<ReadSheet> readSheets = excelReader.excelExecutor().sheetList();
|
||||
for (ReadSheet readSheet : readSheets) {
|
||||
|
|
@ -1437,14 +1438,16 @@ private IMenuRecipeDetailService menuRecipeDetailService;
|
|||
.flatMap(listener -> listener.getNotImportDishesNames().stream())
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}catch (Exception var16) {
|
||||
log.error("导入菜品失败", var16);
|
||||
|
||||
return notImportDishesNames;
|
||||
}catch (Exception e) {
|
||||
// log.error("导入菜品失败", e);
|
||||
throw new ServiceException(e.toString());
|
||||
} finally {
|
||||
if (excelReader != null) {
|
||||
excelReader.finish();
|
||||
}
|
||||
|
||||
}
|
||||
return notImportDishesNames;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.canteen.core.utils.BigDecimalSerializer;
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
|
@ -88,6 +89,14 @@ public class AppletDishesSizeV2VO {
|
|||
@ApiModelProperty("钠NRV(mg/100g)")
|
||||
private BigDecimal sodiumNrv;
|
||||
|
||||
@Getter
|
||||
@ApiModelProperty("餐品口味")
|
||||
private String tasteIds;
|
||||
|
||||
public void setTasteIds(String tasteIds) {
|
||||
this.tasteIds = tasteIds;
|
||||
}
|
||||
|
||||
public Integer getMonthlySales() {
|
||||
return (Integer)Optional.ofNullable(this.monthlySales).orElse(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,10 @@ public class SupermarketDeviceController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "查询 - 双屏超市收银机")
|
||||
@SysLog(title = "超市", businessType = OperaType.INSERT, logType = 1,module = "商超管理->查询 -双屏超市收银机")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody DeviceDTO dto) {
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceDTO dto) {
|
||||
try {
|
||||
startPage();
|
||||
return getDataTable(supermarketDeviceService.selectSupermarketDevice(dto));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("系统错误, " + e.getMessage());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.canteen.core.utils.excel;
|
||||
|
||||
import com.bonus.canteen.core.menu.domain.MenuDishes;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author xliu
|
||||
* @date 2025/5/9 11:20
|
||||
*/
|
||||
public class DifferenceCalculator {
|
||||
public static Set<String> calculateDifference(Set<String> stringSet, List<MenuDishes> menuDishesList) {
|
||||
// 从menuDishesList中提取所有dishesName的集合
|
||||
Set<String> menuDishesNames = menuDishesList.stream()
|
||||
.map(MenuDishes::getDishesName)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 计算差集:stringSet中有而menuDishesNames中没有的元素
|
||||
Set<String> difference = new HashSet<>(stringSet);
|
||||
difference.removeAll(menuDishesNames);
|
||||
|
||||
return difference;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import com.bonus.canteen.core.menu.dto.ImportRecipeDishesDto;
|
|||
import com.bonus.canteen.core.menu.service.IMenuDishesService;
|
||||
import com.bonus.canteen.core.menu.service.IMenuRecipeDetailService;
|
||||
import com.bonus.canteen.core.menu.service.IMenuRecipeDishesService;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -102,6 +103,7 @@ public class MenuRecipeImportListener extends AnalysisEventListener<Map<Integer,
|
|||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
try {
|
||||
HashSet<LocalDate> dates = new HashSet(this.dateMap.values());
|
||||
if (!dates.isEmpty()) {
|
||||
IMenuRecipeDetailService menuRecipeDetailService = SpringContextHolder.getBean(IMenuRecipeDetailService.class);
|
||||
|
|
@ -112,6 +114,12 @@ public class MenuRecipeImportListener extends AnalysisEventListener<Map<Integer,
|
|||
if (!this.dishesNames.isEmpty()) {
|
||||
IMenuDishesService menuDishesService = SpringContextHolder.getBean(IMenuDishesService.class);
|
||||
List<MenuDishes> menuDishesList = menuDishesService.getByNames(this.dishesNames);
|
||||
|
||||
Set<String> difference = DifferenceCalculator.calculateDifference(this.dishesNames, menuDishesList);
|
||||
System.out.println("差集结果: " + difference);
|
||||
if (difference != null && difference.size() > 0) {
|
||||
throw new ServiceException("以下菜品不存在:" + difference);
|
||||
}
|
||||
Map<String, MenuDishes> nameMap = menuDishesList.stream().collect(Collectors.groupingBy(MenuDishes::getDishesName, Collectors.collectingAndThen(Collectors.toList(), (list) -> {
|
||||
return list.get(0);
|
||||
})));
|
||||
|
|
@ -154,6 +162,9 @@ public class MenuRecipeImportListener extends AnalysisEventListener<Map<Integer,
|
|||
}
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||
|
|
@ -162,4 +173,5 @@ public class MenuRecipeImportListener extends AnalysisEventListener<Map<Integer,
|
|||
return seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="cholesterol" column="cholesterol"/>
|
||||
<result property="calcium" column="calcium"/>
|
||||
<result property="sodium" column="sodium"/>
|
||||
<result property="tasteIds" column="taste_id"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
|
|
@ -97,7 +98,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
md.dietary_fiber,
|
||||
md.cholesterol,
|
||||
md.calcium,
|
||||
md.sodium
|
||||
md.sodium,
|
||||
md.taste_id
|
||||
from
|
||||
menu_dishes_base mdb
|
||||
left join menu_dishes md on mdb.base_dishes_id = md.base_dishes_id
|
||||
|
|
|
|||
|
|
@ -387,6 +387,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select dict_label as `key`,dict_value as `value` from sys_dict_data where is_default ='Y' and dict_type = #{key} order by dict_sort
|
||||
</select>
|
||||
|
||||
<select id="getDishesTypeByList" resultType="com.bonus.canteen.core.menu.domain.MapBean" >
|
||||
select dict_label as `key`,dict_value as `value` from sys_dict_data where is_default ='Y'
|
||||
and dict_type = #{key}
|
||||
and dict_value in
|
||||
<foreach collection="keyList" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by dict_sort
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getOneByName" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO" resultMap="MenuDishesResult">
|
||||
select * from menu_dishes where area_id = #{areaId} and (
|
||||
|
|
@ -395,9 +406,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getOneByNum" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO" resultMap="MenuDishesResult">
|
||||
select * from menu_dishes where area_id = #{areaId} and (
|
||||
dishes_num =#{dishesNum}
|
||||
) limit 1
|
||||
select * from menu_dishes where area_id = #{areaId}
|
||||
<if test="dishesNum !=null and dishesNum !=''">
|
||||
and dishes_num =#{dishesNum}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="addMenuDishesBase" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesDTO">
|
||||
|
|
|
|||
|
|
@ -33,7 +33,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN alloc_area aaa ON aaa.area_id = aa.parent_id
|
||||
LEFT JOIN supermarket_info ac ON db.canteen_id = ac.supermarket_id
|
||||
where di.device_type = 53
|
||||
<if test=""></if>
|
||||
<if test="keyWord !=null and keyWord !='' ">
|
||||
and ( di.device_name LIKE CONCAT( '%', #{keyWord}, '%' )
|
||||
OR di.device_num LIKE CONCAT( '%', #{keyWord}, '%' )
|
||||
OR di.device_sn LIKE CONCAT( '%', #{keyWord}, '%' )
|
||||
OR di.device_ip LIKE CONCAT( '%', #{keyWord}, '%' )
|
||||
OR di.device_mac LIKE CONCAT( '%', #{keyWord}, '%' )
|
||||
OR di.device_gateway LIKECONCAT( '%', #{keyWord}, '%' )
|
||||
)
|
||||
</if>
|
||||
<if test="areaId !=null and areaId !=''">
|
||||
and aa.area_id = #{areaId}
|
||||
</if>
|
||||
<if test="canteenId !=null and canteenId !=''">
|
||||
and ac.supermarket_id = #{canteenId}
|
||||
</if>
|
||||
GROUP BY
|
||||
di.device_id
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue