diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java index c7c4ce8..65a4b0a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java @@ -10,6 +10,9 @@ import com.bonus.canteen.core.account.domain.AccCard; * @date 2025-04-20 */ public interface AccCardMapper { + + public int selectAccCardCountByUserId(Long userId); + /** * 查询人员卡片资料 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java index 5e49341..04d84ab 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.stereotype.Service; import com.bonus.canteen.core.account.mapper.AccCardMapper; import com.bonus.canteen.core.account.domain.AccCard; import com.bonus.canteen.core.account.service.IAccCardService; +import org.springframework.util.CollectionUtils; import static com.bonus.canteen.core.order.constants.OrderStateEnum.CANCEL; @@ -77,11 +78,16 @@ public class AccCardServiceImpl implements IAccCardService { accCard.setUserId(accInfo.getUserId()); accCard.setCardStatus(CardStatusEnum.NORMAL.getKey()); accCard.setCardType(CardTypeEnum.IC_CARD.getKey()); + // 发卡前校验是否卡已存在, 已退卡的可以再发放 + int cardCountByUserId= accCardMapper.selectAccCardCountByUserId(accInfo.getUserId()); + if (cardCountByUserId > 0) { + throw new ServiceException("用户(user_id=" + accInfo.getUserId() + ")已有卡, 不能再次发放"); + } int count = accCardMapper.insertAccCard(accCard); saveAccCardChangeRecord(accCard); return count; } catch (Exception e) { - throw new ServiceException("错误信息描述, " + e.getMessage()); + throw new ServiceException("发卡异常, " + e.getMessage()); } } @@ -138,7 +144,7 @@ public class AccCardServiceImpl implements IAccCardService { } return count; } catch (Exception e) { - throw new ServiceException("错误信息描述, " + e.getMessage()); + throw new ServiceException("更新异常, " + e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java index 40ba2b6..daa92bc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocCanteenMapper.java @@ -59,4 +59,6 @@ public interface AllocCanteenMapper { * @return 结果 */ public int deleteAllocCanteenByCanteenIds(Long[] canteenIds); + + public int selectAllocCanteenCountByAreaIds(Long[] areaIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java index 922d0b4..7a42ef1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/mapper/AllocStallMapper.java @@ -62,6 +62,8 @@ public interface AllocStallMapper { */ public int deleteAllocStallByStallIds(Long[] stallIds); + public int selectAllocStallCountByCanteenIds(Long[] canteenIds); + public int deleteMealtimeByStallId(Long stallId); public List selectMealtimeByStallId(Long stallId); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java index ba220b8..4b147cc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocAreaServiceImpl.java @@ -5,6 +5,8 @@ import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; + +import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper; import com.bonus.canteen.core.common.domain.TreeSelect; import com.bonus.canteen.core.alloc.mapper.AllocAreaMapper; import com.bonus.common.core.exception.ServiceException; @@ -25,6 +27,8 @@ import com.bonus.canteen.core.alloc.service.IAllocAreaService; public class AllocAreaServiceImpl implements IAllocAreaService { @Autowired private AllocAreaMapper allocAreaMapper; + @Autowired + private AllocCanteenMapper allocCanteenMapper; @Override public List selectAreaTreeList(AllocArea area) { @@ -104,6 +108,10 @@ public class AllocAreaServiceImpl implements IAllocAreaService { */ @Override public int deleteAllocAreaByAreaIds(Long[] areaIds) { + int count = allocCanteenMapper.selectAllocCanteenCountByAreaIds(areaIds); + if (count > 0) { + throw new ServiceException("区域含有食堂信息,不能删除"); + } return allocAreaMapper.deleteAllocAreaByAreaIds(areaIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java index 40a912d..51dd96b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.bonus.canteen.core.alloc.domain.*; import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper; +import com.bonus.canteen.core.alloc.mapper.AllocStallMapper; import com.bonus.canteen.core.utils.BnsConstants; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; @@ -28,6 +29,8 @@ import com.bonus.canteen.core.alloc.service.IAllocCanteenService; public class AllocCanteenServiceImpl implements IAllocCanteenService { @Autowired private AllocCanteenMapper allocCanteenMapper; + @Autowired + private AllocStallMapper allocStallMapper; /** * 查询食堂信息 @@ -103,6 +106,10 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService { */ @Override public int deleteAllocCanteenByCanteenIds(Long[] canteenIds) { + int count = allocStallMapper.selectAllocStallCountByCanteenIds(canteenIds); + if (count > 0) { + throw new ServiceException("食堂含有档口信息,不能删除"); + } return allocCanteenMapper.deleteAllocCanteenByCanteenIds(canteenIds); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/ParamSettingController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/ParamSettingController.java new file mode 100644 index 0000000..f425356 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/controller/ParamSettingController.java @@ -0,0 +1,42 @@ +package com.bonus.canteen.core.device.controller; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.db.handler.StringHandler; +import com.bonus.canteen.core.device.service.ParamSettingService; +import com.bonus.canteen.core.device.vo.ParamSettingVO; +import com.bonus.common.core.exception.ServiceException; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.codehaus.groovy.tools.StringHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +@Api(tags = "后台-参数设置") +@RestController +@RequestMapping("/paramSetting") +public class ParamSettingController extends BaseController { + + @Autowired + private ParamSettingService service; + + @ApiOperation("更新参数设置") + @PostMapping({"/update"}) + public AjaxResult updateDevice(@RequestBody @Valid ParamSettingVO dto) { + if (ObjectUtil.isNull(dto.getId()) || ObjectUtil.isEmpty(dto.getId())){ + throw new ServiceException("参数id不能为空"); + } + this.service.update(dto); + return AjaxResult.success(); + } + + @ApiOperation(value = "获取参数") + @PostMapping(value = "/getInfo") + public AjaxResult getInfo() { + return success(service.getInfo()); + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/ParamSettingMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/ParamSettingMapper.java new file mode 100644 index 0000000..9187fcb --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/mapper/ParamSettingMapper.java @@ -0,0 +1,9 @@ +package com.bonus.canteen.core.device.mapper; + +import com.bonus.canteen.core.device.vo.ParamSettingVO; + +public interface ParamSettingMapper { + void update(ParamSettingVO dto); + + ParamSettingVO getInfo(); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/ParamSettingService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/ParamSettingService.java new file mode 100644 index 0000000..240648d --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/ParamSettingService.java @@ -0,0 +1,9 @@ +package com.bonus.canteen.core.device.service; + +import com.bonus.canteen.core.device.vo.ParamSettingVO; + +public interface ParamSettingService { + void update(ParamSettingVO dto); + + ParamSettingVO getInfo(); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/ParamSettingServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/ParamSettingServiceImpl.java new file mode 100644 index 0000000..7e9d2fa --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/service/impl/ParamSettingServiceImpl.java @@ -0,0 +1,22 @@ +package com.bonus.canteen.core.device.service.impl; + +import com.bonus.canteen.core.device.mapper.ParamSettingMapper; +import com.bonus.canteen.core.device.service.ParamSettingService; +import com.bonus.canteen.core.device.vo.ParamSettingVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ParamSettingServiceImpl implements ParamSettingService { + @Autowired + private ParamSettingMapper mapper; + @Override + public void update(ParamSettingVO dto) { + mapper.update(dto); + } + + @Override + public ParamSettingVO getInfo() { + return mapper.getInfo(); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/vo/ParamSettingVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/vo/ParamSettingVO.java new file mode 100644 index 0000000..df01239 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/vo/ParamSettingVO.java @@ -0,0 +1,37 @@ +package com.bonus.canteen.core.device.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.NotBlank; + +@Data +public class ParamSettingVO { + @ApiModelProperty("参数id") + private Integer id; + @ApiModelProperty("IP地址") + @NotBlank(message = "IP地址不能为空") + private String ipAddress; + @ApiModelProperty("人脸识别通过率") + @NotBlank(message = "人脸识别通过率不能为空") + private String facePassRate; + @ApiModelProperty("MQTT地址") + @NotBlank(message = "MQTT地址不能为空") + private String mqttAddress; + @ApiModelProperty("MQTT用户名") + @NotBlank(message = "MQTT用户名不能为空") + private String mqttUserName; + @ApiModelProperty("MQTT密码") + @NotBlank(message = "MQTT密码不能为空") + private String mqttPassword; + @ApiModelProperty("APP_ID") + @NotBlank(message = "人脸引擎APP_ID不能为空") + private String appId; + @ApiModelProperty("APP_KEY") + @NotBlank(message = "人脸引擎APP_KEY不能为空") + private String appKey; + @ApiModelProperty("PHOTO_PREFIXES") + @NotBlank(message = "照片前缀不能为空") + private String photoPrefixes; + @ApiModelProperty("version") + private String version; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuEvaluaOrderController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuEvaluaOrderController.java index 4600f58..9b60b82 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuEvaluaOrderController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuEvaluaOrderController.java @@ -65,14 +65,24 @@ public class MenuEvaluaOrderController extends BaseController { util.exportExcel(response, list, "订单评价数据"); } + /** + * 获取订单评价详细信息 + */ +// @ApiOperation(value = "获取订单评价详细信息") +// //@RequiresPermissions("menu:order:query") +// @GetMapping(value = "/{evaluaId}") +// public AjaxResult getInfo(@PathVariable("evaluaId") Long evaluaId) { +// return success(menuEvaluaOrderService.selectMenuEvaluaOrderById(evaluaId)); +// } + /** * 获取订单评价详细信息 */ @ApiOperation(value = "获取订单评价详细信息") //@RequiresPermissions("menu:order:query") - @GetMapping(value = "/{evaluaId}") - public AjaxResult getInfo(@PathVariable("evaluaId") Long evaluaId) { - return success(menuEvaluaOrderService.selectMenuEvaluaOrderById(evaluaId)); + @GetMapping(value = "/orderId/{orderId}") + public AjaxResult getInfoByOrderId(@PathVariable("orderId") Long orderId) { + return success(menuEvaluaOrderService.selectMenuEvaluaOrderById(orderId)); } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuEvaluaPicture.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuEvaluaPicture.java index a2f6d82..e3b63bb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuEvaluaPicture.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuEvaluaPicture.java @@ -1,5 +1,6 @@ package com.bonus.canteen.core.menu.domain; +import com.bonus.canteen.core.common.utils.FileUrlUtil; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -38,4 +39,7 @@ public class MenuEvaluaPicture extends BaseEntity { private Long revision; + public String getPictureUrl() { + return FileUrlUtil.getFileUrl(pictureUrl); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuEvaluaOrderMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuEvaluaOrderMapper.java index eb7381e..5181257 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuEvaluaOrderMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuEvaluaOrderMapper.java @@ -15,10 +15,10 @@ public interface MenuEvaluaOrderMapper { /** * 查询订单评价 * - * @param evaluaId 订单评价主键 + * @param orderId 订单评价主键 * @return 订单评价 */ - public MenuEvaluaOrder selectMenuEvaluaOrderById(Long evaluaId); + public MenuEvaluaOrder selectMenuEvaluaOrderById(Long orderId); /** * 查询订单评价列表 @@ -59,4 +59,6 @@ public interface MenuEvaluaOrderMapper { * @return 结果 */ public int deleteMenuEvaluaOrderByIds(Long[] evaluaIds); + + public void updateOrderEvaluaStatus(Long orderId); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuEvaluaOrderServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuEvaluaOrderServiceImpl.java index c0c9559..e5b4fe3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuEvaluaOrderServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuEvaluaOrderServiceImpl.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.menu.service.impl; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import com.bonus.canteen.core.menu.domain.MenuEvaluaDetail; @@ -40,22 +41,22 @@ public class MenuEvaluaOrderServiceImpl implements IMenuEvaluaOrderService { /** * 查询订单评价 * - * @param evaluaId 订单评价主键 + * @param orderId 订单评价主键 * @return 订单评价 */ @Override - public MenuEvaluaOrderVo selectMenuEvaluaOrderById(Long evaluaId) { - MenuEvaluaOrder menuEvaluaOrder = menuEvaluaOrderMapper.selectMenuEvaluaOrderById(evaluaId); + public MenuEvaluaOrderVo selectMenuEvaluaOrderById(Long orderId) { + MenuEvaluaOrder menuEvaluaOrder = menuEvaluaOrderMapper.selectMenuEvaluaOrderById(orderId); MenuEvaluaOrderVo menuEvaluaOrderVo = new MenuEvaluaOrderVo(); BeanUtils.copyProperties(menuEvaluaOrder, menuEvaluaOrderVo); MenuEvaluaDetail menuEvaluaDetail = new MenuEvaluaDetail(); - menuEvaluaDetail.setEvaluaId(evaluaId); + menuEvaluaDetail.setEvaluaId(menuEvaluaOrder.getEvaluaId()); List menuEvaluaDetails = menuEvaluaDetailMapper.selectMenuEvaluaDetailList(menuEvaluaDetail); menuEvaluaOrderVo.setDetailList(menuEvaluaDetails); MenuEvaluaPicture menuEvaluaPicture = new MenuEvaluaPicture(); - menuEvaluaPicture.setEvaluaId(evaluaId); + menuEvaluaPicture.setEvaluaId(menuEvaluaOrder.getEvaluaId()); List menuEvaluaPictures = menuEvaluaPictureMapper.selectMenuEvaluaPictureList(menuEvaluaPicture); List pictures = menuEvaluaPictures.stream().map(MenuEvaluaPicture::getPictureUrl).collect(Collectors.toList()); menuEvaluaOrderVo.setPictureList(pictures); @@ -82,6 +83,9 @@ public class MenuEvaluaOrderServiceImpl implements IMenuEvaluaOrderService { */ @Override public int insertMenuEvaluaOrder(MenuEvaluaOrderAddDTO menuEvaluaOrder) { + if (Objects.isNull(menuEvaluaOrder.getOrdId())) { + throw new ServiceException("订单编号不能为空"); + } menuEvaluaOrder.setCreateTime(DateUtils.getNowDate()); menuEvaluaOrder.setCreateBy(SecurityUtils.getUsername()); try { @@ -104,9 +108,10 @@ public class MenuEvaluaOrderServiceImpl implements IMenuEvaluaOrderService { menuEvaluaDetail.setCreateBy(SecurityUtils.getUsername()); menuEvaluaDetailMapper.insertMenuEvaluaDetail(menuEvaluaDetail); } + menuEvaluaOrderMapper.updateOrderEvaluaStatus(menuEvaluaOrder.getOrdId()); return count; } catch (Exception e) { - throw new ServiceException("错误信息描述, " + e.getMessage()); + throw new ServiceException("新增订单评价异常, " + e.getMessage()); } } @@ -122,7 +127,7 @@ public class MenuEvaluaOrderServiceImpl implements IMenuEvaluaOrderService { try { return menuEvaluaOrderMapper.updateMenuEvaluaOrder(menuEvaluaOrder); } catch (Exception e) { - throw new ServiceException("错误信息描述, " + e.getMessage()); + throw new ServiceException("更新订单评价异常, " + e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/nutrition/service/HealthCustMedicalReportService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/nutrition/service/HealthCustMedicalReportService.java index 1a06b2e..3bebc3d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/nutrition/service/HealthCustMedicalReportService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/nutrition/service/HealthCustMedicalReportService.java @@ -63,13 +63,13 @@ public class HealthCustMedicalReportService { Long medicalId = reportEditDTO.getMedicalId(); if (ObjectUtil.isNotEmpty(medicalId)) { if (count > 1L) { - throw new ServiceException(I18n.getMessage("nutrition.report-existing", new Object[0])); + throw new ServiceException("健康监测记录已存在"); } this.deleteMedicalReport(medicalId); } else { if (count > 0L) { - throw new ServiceException(I18n.getMessage("nutrition.report-existing", new Object[0])); + throw new ServiceException("健康监测记录已存在"); } medicalId = Id.next(); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java index f889f81..07fe49e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java @@ -159,6 +159,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); accInfoService.checkAccStatus(accInfoVO); List canteenOrderInfoList = new OrderInfo().of(orderAddParam); + checkDeviceOrderExisting(canteenOrderInfoList); checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount()); List orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); try { @@ -184,6 +185,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); accInfoService.checkAccStatus(accInfoVO); List canteenOrderInfoList = new ShopOrderAddParam().of(orderAddParam); + checkDeviceOrderExisting(canteenOrderInfoList); List orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); try { AccRedisUtils.lockUpdateAccWalletBalance(orderAddParam.getUserId()); @@ -197,6 +199,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService return 1; } + private void checkDeviceOrderExisting(List orderInfoList) { + if(CollUtil.isEmpty(orderInfoList)) { + throw new ServiceException("订单不能为空"); + } + for (OrderInfo orderInfo : orderInfoList) { + OrderInfo orderInfoByOrderId = orderInfoMapper.selectOrderInfoByDeviceOrderId(orderInfo.getDeviceOrderId()); + if(Objects.nonNull(orderInfoByOrderId)) { + throw new ServiceException("该设备订单已存在"); + } + } + } + @Override public void pay(Long orderId) { if(Objects.isNull(orderId) || orderId <= 0) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml index c25a644..8fdcc1b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml @@ -42,14 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + select count(1) + from alloc_canteen + where del_flag = 0 and area_id in + + #{areaId} + + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml index 0c9da8d..f32277d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocStallMapper.xml @@ -191,6 +191,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + delete from alloc_stall_mealtime where stall_id = #{stallId} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/ParamSettingMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/ParamSettingMapper.xml new file mode 100644 index 0000000..e93de56 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/ParamSettingMapper.xml @@ -0,0 +1,33 @@ + + + + + update param_setting + set ip_address = #{ipAddress}, + face_pass_rate = #{facePassRate}, + mqtt_address = #{mqttAddress}, + mqtt_user_name = #{mqttUserName}, + mqtt_pass_word = #{mqttPassword}, + app_id = #{appId}, + app_key = #{appKey}, + photo_prefixes = #{photoPrefixes}, + version = #{version} + 1 + where id = #{id} + + + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuEvaluaOrderMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuEvaluaOrderMapper.xml index 6a1c6dd..d200517 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuEvaluaOrderMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuEvaluaOrderMapper.xml @@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -116,4 +116,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{evaluaId} + + + update order_info + set comment_state = 1 + where order_id = #{orderId} + \ No newline at end of file