47 lines
1.6 KiB
Java
47 lines
1.6 KiB
Java
|
|
package com.cdzy.operations.controller;
|
||
|
|
|
||
|
|
import cn.dev33.satoken.stp.StpUtil;
|
||
|
|
import com.cdzy.common.enums.Code;
|
||
|
|
import com.cdzy.common.ex.EbikeException;
|
||
|
|
import com.cdzy.common.model.response.CommonStaffInfo;
|
||
|
|
import com.cdzy.common.model.response.JsonResult;
|
||
|
|
import com.ebike.feign.clients.UserFeignClient;
|
||
|
|
import com.ebike.feign.model.dto.FeignEbikeOrderStatisticsDto;
|
||
|
|
import jakarta.annotation.Resource;
|
||
|
|
import org.springframework.validation.annotation.Validated;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author yanglei
|
||
|
|
* @since 2026-01-16 15:15
|
||
|
|
*/
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/statistics")
|
||
|
|
public class EbikeStatisticsController {
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private UserFeignClient userFeignClient;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询用户订单统计
|
||
|
|
*
|
||
|
|
* @param dto 参数参数
|
||
|
|
* @return 用户订单数据统计
|
||
|
|
*/
|
||
|
|
@PostMapping("/getOrderStatistics")
|
||
|
|
public JsonResult<?> getOrderStatistics(@RequestBody @Validated FeignEbikeOrderStatisticsDto dto) {
|
||
|
|
Long staffId = StpUtil.getLoginIdAsLong();
|
||
|
|
CommonStaffInfo staffInfo = StpUtil.getSession().getModel(staffId.toString(), CommonStaffInfo.class);
|
||
|
|
dto.setOperatorId(staffInfo.getOperatorId());
|
||
|
|
JsonResult<?> jsonResult = userFeignClient.getOrderStatistics(dto);
|
||
|
|
if (jsonResult.getCode() != Code.SUCCESS) {
|
||
|
|
throw new EbikeException(jsonResult.getMessage());
|
||
|
|
}
|
||
|
|
return JsonResult.success(jsonResult.getData());
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|