| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain. TBoard; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.service.TBoardService; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.parameters.P; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TBoardService boardService; |
| | | private final TokenService tokenService; |
| | | private final TOrderMealService orderMealService; |
| | | |
| | | @Autowired |
| | | public TBoardController(TBoardService boardService, TokenService tokenService) { |
| | | public TBoardController(TBoardService boardService, TokenService tokenService, TOrderMealService orderMealService) { |
| | | this. boardService = boardService; |
| | | this.tokenService = tokenService; |
| | | this.orderMealService = orderMealService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TBoard>> list() { |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | return AjaxResult.success( boardService.list(Wrappers.lambdaQuery(TBoard.class) |
| | | .eq(TBoard::getShopId,objectId))); |
| | | List<TBoard> list = boardService.list(Wrappers.lambdaQuery(TBoard.class) |
| | | .eq(TBoard::getShopId, objectId)); |
| | | // 不等于空闲状态的 |
| | | List<Long> ids = list.stream().filter(e -> !e.getStatus().equals(1)).map(TBoard::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TOrderMeal> orderMeals = orderMealService.list(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | .in(TOrderMeal::getBoardId, ids)); |
| | | for (TBoard board : list) { |
| | | List<TOrderMeal> collect = orderMeals.stream().filter(e -> board.getId().equals(e.getBoardId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | | board.setMealType(collect.get(0).getMealType()); |
| | | board.setMealPerson(collect.get(0).getMealPerson()); |
| | | board.setOrderMoney(collect.get(0).getOrderMoney()); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询商品管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TGoodsVO>> pageList(@RequestBody TGoodsQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getRoleType(); |
| | | if(roleType != 1){ |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | } |
| | | return AjaxResult.success(goodsService.pageList(query)); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 添加餐饮管理 |
| | | */ |
| | | @ApiOperation( value = "开台-点菜接口") |
| | | @ApiOperation( value = "开台") |
| | | @PostMapping(value = "/startMeal") |
| | | public AjaxResult<Integer> startMeal(@RequestBody TOrderMeal dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | orderMealService.startMeal(dto); |
| | | return AjaxResult.success(dto.getId()); |
| | | } |
| | | |
| | | /** |
| | | * 添加餐饮管理 |
| | | */ |
| | | @ApiOperation( value = "点菜接口") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Integer> add(@RequestBody TOrderMealDTO dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | orderMealService.add(dto); |
| | | return AjaxResult.success(dto.getId()); |
| | | } |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | |
| | | //注入创建时间 |
| | | if ("createTime".equals(field.getName())) { |
| | | field.setAccessible(true); |
| | | field.set(parameter, new Date()); |
| | | field.set(parameter, LocalDateTime.now()); |
| | | field.setAccessible(false); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | if ("updateTime".equals(field.getName())) { |
| | | field.setAccessible(true); |
| | | field.set(parameter, new Date()); |
| | | field.set(parameter, LocalDateTime.now()); |
| | | field.setAccessible(false); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | if (!SecurityUtils.matchesPassword(dto.getOldPassword(), user.getPassword())) { |
| | | throw new BadCredentialsException("输入原密码不正确"); |
| | | } |
| | | if (dto.getPassword().equals(dto.getConfirmPassword())) { |
| | | if (!dto.getPassword().equals(dto.getConfirmPassword())) { |
| | | throw new BadCredentialsException("两次输入密码不一致"); |
| | | } |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "用餐类型 1=散客 2=宴席") |
| | | @TableField(exist = false) |
| | | private Integer mealType; |
| | | |
| | | @ApiModelProperty(value = "用餐人数") |
| | | @TableField(exist = false) |
| | | private Integer mealPerson; |
| | | |
| | | @ApiModelProperty(value = "订单金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal orderMoney; |
| | | |
| | | } |
| | |
| | | @TableField("generatorId") |
| | | private Long generatorId; |
| | | |
| | | @ApiModelProperty(value = "支付方式 1=现金 2=支付宝 3=微信 4=银行卡 5=其他") |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | |
| | | @ApiModelProperty(value = "销售订单商品") |
| | | @TableField(exist = false) |
| | | private List<TOrderSaleGoods> orderSaleGoods; |
| | |
| | | */ |
| | | List<TOrderMealVO> mealGeneratorExport(TDataGeneratorMealQuery query); |
| | | |
| | | /** |
| | | * 开台 |
| | | * @param dto |
| | | */ |
| | | void startMeal(TOrderMeal dto); |
| | | } |
| | |
| | | @Override |
| | | public void insertOperlog(SysOperLog operLog) |
| | | { |
| | | operLogMapper.insertOperlog(operLog); |
| | | // operLogMapper.insertOperlog(operLog); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 查询餐桌 |
| | | TBoard board = boardService.getById(dto.getBoardId()); |
| | | // 如果菜品为空 |
| | | if(CollectionUtils.isEmpty(dto.getMealOrderGoodsDTOS())){ |
| | | // 开台 |
| | | board.setStatus(BoardEnum.WAITING_ORDER.getCode()); |
| | | this.save(dto); |
| | | }else { |
| | | if(!CollectionUtils.isEmpty(dto.getMealOrderGoodsDTOS())){ |
| | | board.setStatus(BoardEnum.DURING_MEAL.getCode()); |
| | | // 订单金额,订单编号 |
| | | String orderNum = OrderNumConstants.MEAL+CodeGenerateUtils.generateOrderSn(); |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void startMeal(TOrderMeal dto) { |
| | | // 查询餐桌 |
| | | TBoard board = boardService.getById(dto.getBoardId()); |
| | | // 开台 |
| | | board.setStatus(BoardEnum.WAITING_ORDER.getCode()); |
| | | this.save(dto); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.vo.TOrderStockVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | // dto.setStockTotalPrice(sum); |
| | | this.save(dto); |
| | | // 添加商品 |
| | | orderStockGoods.forEach(orderSaleGoods1 -> orderSaleGoods1.setOrderId(dto.getId())); |
| | | orderStockGoods.forEach(orderSaleGoods1 -> { |
| | | orderSaleGoods1.setId(null); |
| | | orderSaleGoods1.setOrderId(dto.getId()); |
| | | }); |
| | | tOrderStockGoodsService.saveBatch(orderStockGoods); |
| | | } |
| | | |
| | |
| | | tOrderStockGoodsService.remove(Wrappers.lambdaQuery(TOrderStockGoods.class) |
| | | .eq(TOrderStockGoods::getOrderId,dto.getId())); |
| | | // 添加商品 |
| | | orderStockGoods.forEach(orderSaleGoods1 -> orderSaleGoods1.setOrderId(dto.getId())); |
| | | orderStockGoods.forEach(orderSaleGoods1 -> { |
| | | orderSaleGoods1.setId(null); |
| | | orderSaleGoods1.setOrderId(dto.getId()); |
| | | }); |
| | | tOrderStockGoodsService.saveBatch(orderStockGoods); |
| | | } |
| | | |
| | |
| | | List<TOrderStockVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | // 查询商品 |
| | | List<Long> orderIds = list.stream().map(TOrderStockVO::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(orderIds)){ |
| | | List<TOrderStockGoods> orderStockGoods = tOrderStockGoodsService.list(Wrappers.lambdaQuery(TOrderStockGoods.class) |
| | | .in(TOrderStockGoods::getOrderId, orderIds)); |
| | | list.forEach(orderSale -> { |
| | | List<TOrderStockGoods> collect = orderStockGoods.stream().filter(orderSaleGoods -> orderSaleGoods.getOrderId().equals(orderSale.getId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | | orderSale.setOrderStockGoods(collect); |
| | | orderSale.setTotalPrice(collect.stream().map(TOrderStockGoods::getCostPrice).reduce(BigDecimal::add).get()); |
| | | } |
| | | }); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | |
| | | @ApiModelProperty(value = "进货单商品") |
| | | private List<TOrderStockGoods> orderStockGoods; |
| | | @ApiModelProperty(value = "总价") |
| | | private BigDecimal totalPrice; |
| | | |
| | | } |
| | |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="removeDays" column="removeDays" /> |
| | | <result property="postType" column="postType" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectRoleVo"> |
| | |
| | | <select id="selectList" resultType="com.ruoyi.common.core.domain.entity.SysRole"> |
| | | select role_id AS roleId, role_name AS roleName, role_key AS roleKey, role_sort AS roleSort, data_scope AS dataScope, |
| | | menu_check_strictly AS menuCheckStrictly, dept_check_strictly AS deptCheckStrictly,status AS status, del_flag AS delFlag, |
| | | create_time AS createTime,create_by AS createBy,postType AS postType,removeDays AS removeDays |
| | | create_time AS createTime,create_by AS createBy |
| | | from sys_role |
| | | <where> |
| | | <if test="query.roleName != null and query.roleName != ''"> |
| | |
| | | <select id="selectListByDelFlag" resultType="com.ruoyi.common.core.domain.entity.SysRole"> |
| | | select role_id AS roleId, role_name AS roleName, role_key AS roleKey, role_sort AS roleSort, data_scope AS dataScope, |
| | | menu_check_strictly AS menuCheckStrictly, dept_check_strictly AS deptCheckStrictly,status AS status, del_flag AS delFlag, |
| | | create_time AS createTime,create_by AS createBy,postType AS postType,removeDays AS removeDays |
| | | create_time AS createTime,create_by AS createBy |
| | | from sys_role where del_flag = 0 |
| | | </select> |
| | | |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="removeDays != null">removeDays,</if> |
| | | <if test="postType != null">postType,</if> |
| | | create_time |
| | | )values( |
| | | <if test="roleId != null and roleId != 0">#{roleId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="removeDays != null">#{removeDays},</if> |
| | | <if test="postType != null">#{postType},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="removeDays != null">removeDays = #{removeDays},</if> |
| | | <if test="postType != null">postType = #{postType},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where role_id = #{roleId} |
| | |
| | | <result column="payMoney" property="payMoney" /> |
| | | <result column="shopId" property="shopId" /> |
| | | <result column="generatorId" property="generatorId" /> |
| | | <result column="payType" property="payType" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId,generatorId |
| | | id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId,generatorId,payType |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TOrderSaleVO"> |
| | | select id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId,generatorId |
| | | select id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId,generatorId,payType |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.orderNum != null and query.orderNum != ''"> |