xuhy
2024-09-13 3d1cf55e874a5b79c74725af946bfe235c3b06fd
修改接口
8个文件已修改
1个文件已添加
87 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderMealController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TShopController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/interceptor/MybatisInterceptor.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/PersonnelStatisticsAndSumVO.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/TOrderMealVO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDataStatisticsController.java
@@ -20,6 +20,7 @@
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -284,7 +285,7 @@
    @ApiOperation( value = "接待人数统计")
    @PostMapping(value = "/personnelStatistics")
    public AjaxResult<List<PersonnelStatisticsVO>> personnelStatistics(@RequestBody TDataStatisticsQuery query) {
    public AjaxResult<PersonnelStatisticsAndSumVO> personnelStatistics(@RequestBody TDataStatisticsQuery query) {
        Long objectId = tokenService.getLoginUser().getObjectId();
        query.setShopId(objectId);
        if(Objects.isNull(query.getTimeType())){
@@ -316,7 +317,16 @@
        }
        query.setStartTime(DateUtils.localDateTimeToDate(startTime));
        query.setEndTime(DateUtils.localDateTimeToDate(endTime));
        return AjaxResult.success(orderMealService.personnelStatistics(query));
        PersonnelStatisticsAndSumVO personnelStatisticsAndSumVO = new PersonnelStatisticsAndSumVO();
        List<PersonnelStatisticsVO> personnelStatisticsVOS = orderMealService.personnelStatistics(query);
        personnelStatisticsAndSumVO.setPersonnelStatisticsVOS(personnelStatisticsVOS);
        if(!CollectionUtils.isEmpty(personnelStatisticsVOS)){
            personnelStatisticsAndSumVO.setPersonCountSum(personnelStatisticsVOS.stream().mapToInt(PersonnelStatisticsVO::getPersonCount).sum());
            // 计算列表中平均金额乘以人数的总和
            personnelStatisticsAndSumVO.setTotalMoney(personnelStatisticsVOS.stream().mapToDouble(personnelStatisticsVO -> personnelStatisticsVO.getAvgAmount().doubleValue() * personnelStatisticsVO.getPersonCount()).sum());
        }
        return AjaxResult.success(personnelStatisticsAndSumVO);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TOrderMealController.java
@@ -5,22 +5,16 @@
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.constant.OrderNumConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.CodeGenerateUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.WebUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.dto.CheckoutDTO;
import com.ruoyi.system.dto.MealOrderGoodsDTO;
import com.ruoyi.system.dto.TOrderMealDTO;
import com.ruoyi.system.export.TOrderMealExportExcel;
import com.ruoyi.system.query.TOrderMealQuery;
import com.ruoyi.system.service.TGoodsService;
import com.ruoyi.system.service.TGoodsTypeService;
import com.ruoyi.system.service.TOrderMealGoodsService;
import com.ruoyi.system.service.TOrderMealService;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.AmountSumVO;
import com.ruoyi.system.vo.TOrderMealVO;
import io.swagger.annotations.Api;
@@ -59,14 +53,16 @@
    private final TOrderMealGoodsService orderMealGoodsService;
    private final TGoodsTypeService goodsTypeService;
    private final TGoodsService goodsService;
    private final TBoardService boardService;
    private final TokenService tokenService;
    @Autowired
    public TOrderMealController(TOrderMealService orderMealService, TOrderMealGoodsService orderMealGoodsService, TGoodsTypeService goodsTypeService, TGoodsService goodsService, TokenService tokenService) {
    public TOrderMealController(TOrderMealService orderMealService, TOrderMealGoodsService orderMealGoodsService, TGoodsTypeService goodsTypeService, TGoodsService goodsService, TBoardService boardService, TokenService tokenService) {
        this.orderMealService = orderMealService;
        this.orderMealGoodsService = orderMealGoodsService;
        this.goodsTypeService = goodsTypeService;
        this.goodsService = goodsService;
        this.boardService = boardService;
        this.tokenService = tokenService;
    }
@@ -107,6 +103,10 @@
            orderMealVO.setGoodsList(goodsList);
        }
        orderMealVO.setOrderMealGoods(list);
        // 查询用餐人数
        TBoard board = boardService.getById(orderMeal.getBoardId());
        orderMealVO.setMaxPerson(board.getMaxPerson());
        orderMealVO.setMinPerson(board.getMinPerson());
        return AjaxResult.success(orderMealVO);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TShopController.java
@@ -66,7 +66,9 @@
    public AjaxResult<String> add(@RequestBody TShopDTO dto) {
        shopService.save(dto);
        // 添加账号
        userService.addAccount(dto);
        Long userId = userService.addAccount(dto);
        dto.setUserId(userId);
        shopService.updateById(dto);
        return AjaxResult.success();
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/interceptor/MybatisInterceptor.java
@@ -78,11 +78,11 @@
                            field.setAccessible(false);
                        }
                    }
                    if ("updateTime".equals(field.getName())) {
                        field.setAccessible(true);
                        field.set(parameter, LocalDateTime.now());
                        field.setAccessible(false);
                    }
//                    if ("updateTime".equals(field.getName())) {
//                        field.setAccessible(true);
//                        field.set(parameter, LocalDateTime.now());
//                        field.setAccessible(false);
//                    }
                } catch (Exception e) {
                    log.error("failed to update data, exception = ", e);
                }
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -265,7 +265,7 @@
     * 添加账号信息
     * @param dto
     */
    void addAccount(TShopDTO dto);
    Long addAccount(TShopDTO dto);
    /**
     * 修改账号信息
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -637,19 +637,20 @@
    }
    @Override
    public void addAccount(TShopDTO dto) {
    public Long addAccount(TShopDTO dto) {
        SysUser sysUser = new SysUser();
        sysUser.setUserName(dto.getAccount());
        sysUser.setNickName(dto.getShopHead());
        if(dto.getShopType() ==1){
        if(dto.getShopType().equals(1)){
            sysUser.setRoleType(2);
            sysUser.setRoleId(9L);
        }else {
            sysUser.setRoleType(3);
            sysUser.setRoleId(2L);
        }
        sysUser.setPassword(SecurityUtils.encryptPassword(dto.getPassword()));
        this.insertUser(sysUser);
        // TODO 自动绑定角色
        return sysUser.getUserId();
    }
    @Override
ruoyi-system/src/main/java/com/ruoyi/system/vo/PersonnelStatisticsAndSumVO.java
New file
@@ -0,0 +1,23 @@
package com.ruoyi.system.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.License;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel(value = "接待人数统计合计VO")
public class PersonnelStatisticsAndSumVO implements Serializable {
    @ApiModelProperty(value = "接待总人数")
    private Integer personCountSum;
    @ApiModelProperty(value = "接待总金额")
    private Double totalMoney;
    @ApiModelProperty(value = "列表")
    private List<PersonnelStatisticsVO> personnelStatisticsVOS;
}
ruoyi-system/src/main/java/com/ruoyi/system/vo/TOrderMealVO.java
@@ -1,5 +1,6 @@
package com.ruoyi.system.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.system.domain.TOrderMeal;
import com.ruoyi.system.domain.TOrderMealGoods;
import io.swagger.annotations.ApiModel;
@@ -22,4 +23,10 @@
    @ApiModelProperty(value = "菜品 列表使用")
    private List<String> goodsList;
    @ApiModelProperty(value = "最小就餐人数")
    private Integer minPerson;
    @ApiModelProperty(value = "最大就餐人数")
    private Integer maxPerson;
}
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -267,6 +267,7 @@
             <if test="status != null and status != ''">status,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             <if test="remark != null and remark != ''">remark,</if>
             <if test="roleType != null and roleType != ''">roleType,</if>
             create_time
         )values(
             <if test="userId != null and userId != ''">#{userId},</if>
@@ -283,6 +284,7 @@
             <if test="status != null and status != ''">#{status},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             <if test="remark != null and remark != ''">#{remark},</if>
             <if test="roleType != null and roleType != ''">#{roleType},</if>
             sysdate()
         )
    </insert>