add 新增查询枪均效率分析接口

This commit is contained in:
Lemon
2026-04-07 10:33:47 +08:00
parent f7d541d44a
commit 80a0f2ec22
3 changed files with 156 additions and 14 deletions

View File

@@ -11,6 +11,7 @@ import com.jsowell.pile.dto.ParkingCouponRecordQueryDTO;
import com.jsowell.pile.dto.business.BusinessOperationAnalysisQueryDTO;
import com.jsowell.pile.service.BusinessFinancialService;
import com.jsowell.pile.vo.uniapp.business.BusinessOperationAnalysisVO;
import com.jsowell.pile.vo.uniapp.business.BusinessGunEfficiencyAnalysisVO;
import com.jsowell.pile.vo.web.MerchantOrderReportVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -101,7 +102,9 @@ public class BusinessFinancialController extends BaseController {
logger.info("查询经营分析 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response;
try {
validateBusinessOperationQuery(dto);
if (dto == null) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
BusinessOperationAnalysisVO result = businessFinancialService.getBusinessOperationAnalysis(dto);
response = new RestApiResponse<>(result);
logger.info("查询经营分析成功 startTime:{}, endTime:{}, selectedMetricCode:{}",
@@ -117,18 +120,30 @@ public class BusinessFinancialController extends BaseController {
}
/**
* 校验经营分析查询参数
* 查询枪均效率分析
*
* @param dto 查询参数
* @return 枪均效率分析
*/
private void validateBusinessOperationQuery(BusinessOperationAnalysisQueryDTO dto) {
if (dto == null) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
boolean startTimeBlank = StringUtils.isBlank(dto.getStartTime());
boolean endTimeBlank = StringUtils.isBlank(dto.getEndTime());
if (startTimeBlank ^ endTimeBlank) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
@PostMapping("/gunEfficiencyAnalysis")
public RestApiResponse<?> getBusinessGunEfficiencyAnalysis(@RequestBody BusinessOperationAnalysisQueryDTO dto) {
logger.info("查询枪均效率分析 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response;
try {
if (dto == null) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
BusinessGunEfficiencyAnalysisVO result = businessFinancialService.getBusinessGunEfficiencyAnalysis(dto);
response = new RestApiResponse<>(result);
logger.info("查询枪均效率分析成功 startTime:{}, endTime:{}",
dto.getStartTime(), dto.getEndTime());
} catch (BusinessException e) {
logger.warn("查询枪均效率分析业务异常 code:{}, message:{}", e.getCode(), e.getMessage(), e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("查询枪均效率分析系统异常 params:{}", JSONObject.toJSONString(dto), e);
response = new RestApiResponse<>(e);
}
return response;
}
}