Merge remote-tracking branch 'origin/master'

This commit is contained in:
liux 2025-05-06 14:07:54 +08:00
commit 7dd5e6d91d
22 changed files with 266 additions and 21 deletions

View File

@ -10,6 +10,9 @@ import com.bonus.canteen.core.account.domain.AccCard;
* @date 2025-04-20
*/
public interface AccCardMapper {
public int selectAccCardCountByUserId(Long userId);
/**
* 查询人员卡片资料
*

View File

@ -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());
}
}

View File

@ -59,4 +59,6 @@ public interface AllocCanteenMapper {
* @return 结果
*/
public int deleteAllocCanteenByCanteenIds(Long[] canteenIds);
public int selectAllocCanteenCountByAreaIds(Long[] areaIds);
}

View File

@ -62,6 +62,8 @@ public interface AllocStallMapper {
*/
public int deleteAllocStallByStallIds(Long[] stallIds);
public int selectAllocStallCountByCanteenIds(Long[] canteenIds);
public int deleteMealtimeByStallId(Long stallId);
public List<AllocStallMealtime> selectMealtimeByStallId(Long stallId);

View File

@ -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<TreeSelect> 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);
}

View File

@ -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);
}

View File

@ -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());
}
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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));
}
/**

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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<MenuEvaluaDetail> menuEvaluaDetails = menuEvaluaDetailMapper.selectMenuEvaluaDetailList(menuEvaluaDetail);
menuEvaluaOrderVo.setDetailList(menuEvaluaDetails);
MenuEvaluaPicture menuEvaluaPicture = new MenuEvaluaPicture();
menuEvaluaPicture.setEvaluaId(evaluaId);
menuEvaluaPicture.setEvaluaId(menuEvaluaOrder.getEvaluaId());
List<MenuEvaluaPicture> menuEvaluaPictures = menuEvaluaPictureMapper.selectMenuEvaluaPictureList(menuEvaluaPicture);
List<String> 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());
}
}

View File

@ -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();

View File

@ -159,6 +159,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId());
accInfoService.checkAccStatus(accInfoVO);
List<OrderInfo> canteenOrderInfoList = new OrderInfo().of(orderAddParam);
checkDeviceOrderExisting(canteenOrderInfoList);
checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount());
List<OrderInfo> 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<OrderInfo> canteenOrderInfoList = new ShopOrderAddParam().of(orderAddParam);
checkDeviceOrderExisting(canteenOrderInfoList);
List<OrderInfo> orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList);
try {
AccRedisUtils.lockUpdateAccWalletBalance(orderAddParam.getUserId());
@ -197,6 +199,18 @@ public class OrderInfoServiceImpl implements IOrderInfoService
return 1;
}
private void checkDeviceOrderExisting(List<OrderInfo> 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) {

View File

@ -43,13 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAccCardList" parameterType="com.bonus.canteen.core.account.domain.AccCard" resultMap="AccCardResult">
<include refid="selectAccCardVo"/>
<where>
ac.card_status in (1,4,5)
<if test="userId != null "> and ac.user_id = #{userId}</if>
<if test="accId != null "> and ac.acc_id = #{accId}</if>
<if test="cardNum != null "> and ac.card_num = #{cardNum}</if>
<if test="serialNum != null and serialNum != ''"> and ac.serial_num = #{serialNum}</if>
<if test="cardNature != null and cardNature != ''"> and ac.card_nature = #{cardNature}</if>
<if test="cardType != null "> and ac.card_type = #{cardType}</if>
<if test="cardStatus != null "> and ac.card_status = #{cardStatus}</if>
<if test="deposit != null "> and ac.deposit = #{deposit}</if>
<if test="productCost != null "> and ac.product_cost = #{productCost}</if>
<if test="pendProductCost != null "> and ac.pend_product_cost = #{pendProductCost}</if>
@ -64,6 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectAccCardCountByUserId" parameterType="Long" resultType="Integer">
select count(1)
from acc_card
where user_id = #{userId} and card_status in (1,4,5)
</select>
<select id="selectAccCardById" parameterType="Long" resultMap="AccCardResult">
<include refid="selectAccCardVo"/>
where ac.id = #{id}
@ -150,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where acc_id = #{accId} and card_status != 6
where acc_id = #{accId}
</update>
<delete id="deleteAccCardById" parameterType="Long">

View File

@ -172,4 +172,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{canteenId}
</foreach>
</delete>
<select id="selectAllocCanteenCountByAreaIds" resultType="Integer">
select count(1)
from alloc_canteen
where del_flag = 0 and area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
</foreach>
</select>
</mapper>

View File

@ -191,6 +191,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectAllocStallCountByCanteenIds" resultType="Integer">
select count(1)
from alloc_stall
where del_flag = 0 and canteen_id in
<foreach item="canteenId" collection="array" open="(" separator="," close=")">
#{canteenId}
</foreach>
</select>
<delete id="deleteMealtimeByStallId" parameterType="Long">
delete from alloc_stall_mealtime where stall_id = #{stallId}
</delete>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.device.mapper.ParamSettingMapper">
<update id="update">
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}
</update>
<select id="getInfo" resultType="com.bonus.canteen.core.device.vo.ParamSettingVO">
select id,
ip_address as ipAddress,
face_pass_rate as facePassRate,
mqtt_address as mqttAddress,
mqtt_user_name as mqttUserName,
mqtt_pass_word as mqttPassword,
app_id as appId,
app_key as appKey,
photo_prefixes as photoPrefixes,
version
from param_setting
limit 1
</select>
</mapper>

View File

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMenuEvaluaOrderById" parameterType="Long" resultMap="MenuEvaluaOrderResult">
<include refid="selectMenuEvaluaOrderVo"/>
where evalua_id = #{evaluaId}
where ord_id = #{orderId}
</select>
<insert id="insertMenuEvaluaOrder" parameterType="com.bonus.canteen.core.menu.dto.MenuEvaluaOrderAddDTO" useGeneratedKeys="true" keyProperty="evaluaId">
@ -116,4 +116,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{evaluaId}
</foreach>
</delete>
<update id="updateOrderEvaluaStatus" parameterType="Long">
update order_info
set comment_state = 1
where order_id = #{orderId}
</update>
</mapper>