This commit is contained in:
sxu 2025-06-16 16:57:14 +08:00
parent fecac82f1f
commit 1d1119c5de
7 changed files with 104 additions and 10 deletions

View File

@ -0,0 +1,49 @@
package com.bonus.common.houqin.enums;
import lombok.Getter;
/**
* @author bonus
*/
@Getter
public enum HttpCodeEnum {
// 成功
SUCCESS(200, "操作成功"),
LEASE_END_TIME_ERROR(500, "需求截止日期不可小于当天,请修改后重新提交"),
//失败
FAIL(500, "操作失败,请联系管理员"),
// 登录
LEASE_ORDER_RECEIVED_NOT_DELETE(1002, "已接单状态,不可删除"),
NEED_LOGIN(401, "需要登录后操作"),
TO_PARAM_NULL(1007, "参数为空"),
NO_OPERATOR_AUTH(403, "无权限操作"),
SYSTEM_ERROR(500, "出现错误"),
USERNAME_EXIST(501, "用户名已存在"),
PHONENUMBER_EXIST(502, "手机号已存在"),
EMAIL_EXIST(503, "邮箱已存在"),
REQUIRE_USERNAME(504, "必需填写用户名"),
CONTENT_NOT_NULL(506, "评论内容不能为空"),
FILE_TYPE_ERROR(507, "文件类型错误"),
USERNAME_NOT_NULL(508, "用户名不能为空"),
NICKNAME_NOT_NULL(509, "昵称不能为空"),
PASSWORD_NOT_NULL(510, "密码不能为空"),
EMAIL_NOT_NULL(511, "邮箱不能为空"),
NICKNAME_EXIST(512, "昵称已存在"),
LOGIN_ERROR(505, "用户名或密码错误"),
NAME_DUPLICATE(1000, "名称重复,请重新输入"),
INVALID_LONGITUDE_FORMAT(1001, "经度格式不正确"),
INVALID_LATITUDE_FORMAT(1002, "纬度格式不正确"),
INVALID_PHONE_FORMAT(1003, "手机号格式不正确"),
REPEATE_ERROR(600, "不允许重复提交,请稍候再试");
private final int code;
private final String msg;
HttpCodeEnum(int code, String errorMessage) {
this.code = code;
this.msg = errorMessage;
}
}

View File

@ -0,0 +1,26 @@
package com.bonus.common.houqin.exceptions;
import com.bonus.common.houqin.enums.HttpCodeEnum;
public class BusinessException extends RuntimeException {
private int code;
//使用枚举构造
public BusinessException(HttpCodeEnum httpCodeEnum){
super(httpCodeEnum.getMsg());
this.code=httpCodeEnum.getCode();
}
//使用自定义消息体
public BusinessException(HttpCodeEnum httpCodeEnum, String msg){
super(msg);
this.code=httpCodeEnum.getCode();
}
//根据异常构造
public BusinessException(HttpCodeEnum httpCodeEnum, Throwable msg){
super(msg);
this.code=httpCodeEnum.getCode();
}
}

View File

@ -3,8 +3,8 @@ package com.bonus.canteen.core.common.aspect;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.bonus.canteen.core.common.annotation.PreventRepeatSubmit; import com.bonus.canteen.core.common.annotation.PreventRepeatSubmit;
import com.bonus.canteen.core.common.utils.RedisCache; import com.bonus.canteen.core.common.utils.RedisCache;
import com.bonus.common.security.enums.HttpCodeEnum; import com.bonus.common.houqin.enums.HttpCodeEnum;
import com.bonus.common.security.exception.BusinessException; import com.bonus.common.houqin.exceptions.BusinessException;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;

View File

@ -13,7 +13,7 @@ import com.bonus.canteen.core.cook.vo.AllocRecipeStallVO;
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO; import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
import com.bonus.canteen.core.cook.vo.CookRecipeVO; import com.bonus.canteen.core.cook.vo.CookRecipeVO;
import com.bonus.common.log.enums.OperaType; import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit; import com.bonus.canteen.core.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -112,7 +112,7 @@ public class CookRecipeController extends BaseController {
* 新增菜品计划信息 * 新增菜品计划信息
*/ */
@ApiOperation(value = "新增菜品计划信息") @ApiOperation(value = "新增菜品计划信息")
//@PreventRepeatSubmit @PreventRepeatSubmit
//@RequiresPermissions("cook:recipe:add") //@RequiresPermissions("cook:recipe:add")
@SysLog(title = "菜品计划信息", businessType = OperaType.INSERT, logType = 1,module = "菜谱管理->新增菜品计划信息") @SysLog(title = "菜品计划信息", businessType = OperaType.INSERT, logType = 1,module = "菜谱管理->新增菜品计划信息")
@PostMapping @PostMapping
@ -128,7 +128,7 @@ public class CookRecipeController extends BaseController {
* 修改菜品计划信息 * 修改菜品计划信息
*/ */
@ApiOperation(value = "修改菜品计划信息") @ApiOperation(value = "修改菜品计划信息")
//@PreventRepeatSubmit @PreventRepeatSubmit
//@RequiresPermissions("cook:recipe:edit") //@RequiresPermissions("cook:recipe:edit")
@SysLog(title = "菜品计划信息", businessType = OperaType.UPDATE, logType = 1,module = "菜谱管理->修改菜品计划信息") @SysLog(title = "菜品计划信息", businessType = OperaType.UPDATE, logType = 1,module = "菜谱管理->修改菜品计划信息")
@PostMapping("/edit") @PostMapping("/edit")

View File

@ -120,6 +120,10 @@ public class SupermarketInfo extends BaseEntity {
@ApiModelProperty(value = "超市收款码链接") @ApiModelProperty(value = "超市收款码链接")
private String payCodeUrl; private String payCodeUrl;
/**
* 删除标志0代表存在 2代表删除
*/
private String delFlag;
public String getImgUrl() { public String getImgUrl() {
return FileUrlUtil.getFileUrl(this.imgUrl); return FileUrlUtil.getFileUrl(this.imgUrl);

View File

@ -2,7 +2,9 @@ package com.bonus.canteen.core.supermarket.service.impl;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
import com.bonus.canteen.core.basic.domain.BasicCanteen;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial; import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
import com.bonus.canteen.core.supermarket.domain.SupermarketProduct; import com.bonus.canteen.core.supermarket.domain.SupermarketProduct;
import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper; import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
@ -89,6 +91,13 @@ public class SupermarketInfoServiceImpl implements ISupermarketInfoService {
public int updateSupermarketInfo(SupermarketInfo supermarketInfo) { public int updateSupermarketInfo(SupermarketInfo supermarketInfo) {
supermarketInfo.setUpdateTime(DateUtils.getNowDate()); supermarketInfo.setUpdateTime(DateUtils.getNowDate());
try { try {
List<SupermarketInfo> allSupermarketList = supermarketInfoMapper.selectSupermarketInfoList(new SupermarketInfo());
List<String> otherSupermarketNameList = allSupermarketList.stream().filter(item -> !item.getSupermarketId().equals(supermarketInfo.getSupermarketId()))
.filter(item -> item.getAreaId().equals(supermarketInfo.getAreaId()))
.map(SupermarketInfo::getSupermarketName).collect(Collectors.toList());
if (otherSupermarketNameList.contains(supermarketInfo.getSupermarketName())) {
throw new ServiceException("该区域超市名称已存在");
}
return supermarketInfoMapper.updateSupermarketInfo(supermarketInfo); return supermarketInfoMapper.updateSupermarketInfo(supermarketInfo);
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException(e.getMessage()); throw new ServiceException(e.getMessage());

View File

@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="mealCode" column="meal_code" /> <result property="mealCode" column="meal_code" />
<result property="ifEnablePayCode" column="if_enable_pay_code" /> <result property="ifEnablePayCode" column="if_enable_pay_code" />
<result property="payCodeUrl" column="pay_code_url" /> <result property="payCodeUrl" column="pay_code_url" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@ -37,7 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
si.warehouse_id, si.address, si.img_url, si.if_print_now, si.app_sale_mode, si.warehouse_id, si.address, si.img_url, si.if_print_now, si.app_sale_mode,
si.min_delivery_time, si.select_time_interval, si.delivery_cost, si.auto_verify_day, si.min_delivery_time, si.select_time_interval, si.delivery_cost, si.auto_verify_day,
si.delivery_way, si.refund_limit_time, si.if_relate_drp, si.meal_code, si.if_enable_pay_code, si.delivery_way, si.refund_limit_time, si.if_relate_drp, si.meal_code, si.if_enable_pay_code,
si.pay_code_url, si.create_by, si.create_time, si.update_by, si.update_time, ba.area_name, swi.warehouse_name si.pay_code_url, si.del_flag, si.create_by, si.create_time, si.update_by, si.update_time,
ba.area_name, swi.warehouse_name
from supermarket_info si from supermarket_info si
left join basic_area ba on si.area_id = ba.area_id left join basic_area ba on si.area_id = ba.area_id
left join supply_warehouse_info swi on swi.warehouse_id = si.warehouse_id left join supply_warehouse_info swi on swi.warehouse_id = si.warehouse_id
@ -45,7 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSupermarketInfoList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketInfo" resultMap="SupermarketInfoResult"> <select id="selectSupermarketInfoList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketInfo" resultMap="SupermarketInfoResult">
<include refid="selectSupermarketInfoVo"/> <include refid="selectSupermarketInfoVo"/>
<where> <where>
si.del_flag = '0'
<if test="supermarketName != null and supermarketName != ''"> and si.supermarket_name like concat('%', #{supermarketName}, '%')</if> <if test="supermarketName != null and supermarketName != ''"> and si.supermarket_name like concat('%', #{supermarketName}, '%')</if>
<if test="areaId != null "> and si.area_id = #{areaId}</if> <if test="areaId != null "> and si.area_id = #{areaId}</if>
<if test="manager != null "> and si.manager = #{manager}</if> <if test="manager != null "> and si.manager = #{manager}</if>
@ -76,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getSupermarketCountByAreaIds" resultType="Integer"> <select id="getSupermarketCountByAreaIds" resultType="Integer">
select count(1) select count(1)
from supermarket_info from supermarket_info
where area_id in where del_flag = '0' and area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")"> <foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId} #{areaId}
</foreach> </foreach>
@ -109,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mealCode != null">meal_code,</if> <if test="mealCode != null">meal_code,</if>
<if test="ifEnablePayCode != null">if_enable_pay_code,</if> <if test="ifEnablePayCode != null">if_enable_pay_code,</if>
<if test="payCodeUrl != null">pay_code_url,</if> <if test="payCodeUrl != null">pay_code_url,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
@ -134,6 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mealCode != null">#{mealCode},</if> <if test="mealCode != null">#{mealCode},</if>
<if test="ifEnablePayCode != null">#{ifEnablePayCode},</if> <if test="ifEnablePayCode != null">#{ifEnablePayCode},</if>
<if test="payCodeUrl != null">#{payCodeUrl},</if> <if test="payCodeUrl != null">#{payCodeUrl},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
@ -163,6 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mealCode != null">meal_code = #{mealCode},</if> <if test="mealCode != null">meal_code = #{mealCode},</if>
<if test="ifEnablePayCode != null">if_enable_pay_code = #{ifEnablePayCode},</if> <if test="ifEnablePayCode != null">if_enable_pay_code = #{ifEnablePayCode},</if>
<if test="payCodeUrl != null">pay_code_url = #{payCodeUrl},</if> <if test="payCodeUrl != null">pay_code_url = #{payCodeUrl},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
@ -172,11 +178,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteSupermarketInfoBySupermarketId" parameterType="Long"> <delete id="deleteSupermarketInfoBySupermarketId" parameterType="Long">
delete from supermarket_info where supermarket_id = #{supermarketId} update supermarket_info set del_flag = '2' where supermarket_id = #{supermarketId}
</delete> </delete>
<delete id="deleteSupermarketInfoBySupermarketIds" parameterType="String"> <delete id="deleteSupermarketInfoBySupermarketIds" parameterType="String">
delete from supermarket_info where supermarket_id in update supermarket_info set del_flag = '2' where supermarket_id in
<foreach item="supermarketId" collection="array" open="(" separator="," close=")"> <foreach item="supermarketId" collection="array" open="(" separator="," close=")">
#{supermarketId} #{supermarketId}
</foreach> </foreach>