mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
Merge branch 'dev' into feature-integrated_with_JCPP
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
package com.jsowell.api.uniapp.business;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.business.QueryBusinessOrderDTO;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderBillingInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderQueryResultVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.xml.ws.soap.Addressing;
|
||||
import java.util.List;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -65,4 +66,27 @@ public class BusinessOrderController extends BaseController {
|
||||
logger.info("通过订单编号查询订单各时段计费明细 orderCode:{}, result:{}", orderCode, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运营端小程序查询订单
|
||||
* @param dto 查询条件
|
||||
* @return 订单查询结果
|
||||
*/
|
||||
@PostMapping("/queryBusinessOrder")
|
||||
public RestApiResponse<?> queryBusinessOrder(@RequestBody QueryBusinessOrderDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
BusinessOrderQueryResultVO result = orderBasicInfoService.queryBusinessOrder(dto);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("运营端小程序查询订单 warn", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("运营端小程序查询订单 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("运营端小程序查询订单 params:{}, result:{}", JSONObject.toJSONString(dto), response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,20 @@ package com.jsowell.api.uniapp.business;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.page.TableDataInfo;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.business.StationBusinessAnalyzeInfoDTO;
|
||||
import com.jsowell.pile.dto.business.StationStatisticsInfoDTO;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.service.PileStationInfoService;
|
||||
import com.jsowell.pile.vo.uniapp.business.StationBusinessAnalyzeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.StationStatisticsInfosVO;
|
||||
import com.jsowell.pile.vo.web.StationSelectVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -32,6 +37,23 @@ public class BusinessStationInfoController extends BaseController {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电站下拉列表
|
||||
* @param stationName 站点名称(可选,支持模糊查询)
|
||||
*/
|
||||
@GetMapping("/getStationSelectList")
|
||||
public TableDataInfo getStationSelectList(@RequestParam(required = false) String stationName) {
|
||||
QueryStationDTO dto = new QueryStationDTO();
|
||||
if (StringUtils.isNotBlank(stationName)) {
|
||||
dto.setStationName(stationName);
|
||||
}
|
||||
List<StationSelectVO> list = pileStationInfoService.getStationSelectList(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取站点统计信息
|
||||
* @param dto
|
||||
|
||||
@@ -117,4 +117,15 @@ public class QueryOrderDTO extends BaseEntity {
|
||||
* 排除的站点Id列表
|
||||
*/
|
||||
private List<Integer> excludeStationIdList;
|
||||
|
||||
/**
|
||||
* 启动方式
|
||||
* (0-后管启动;1-用户app启动;2-卡启动;3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动)
|
||||
*/
|
||||
private String startMode;
|
||||
|
||||
/**
|
||||
* 站点名称(用于模糊查询)
|
||||
*/
|
||||
private String stationName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.jsowell.pile.dto.business;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 运营端小程序查询订单DTO
|
||||
*
|
||||
* @author Auto
|
||||
* @Date 2024/12/19
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryBusinessOrderDTO {
|
||||
/**
|
||||
* 站点名称(可选,支持模糊查询)
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 创建时间(可选,格式:yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 结束时间(可选,格式:yyyy-MM-dd HH:mm:ss)
|
||||
*/
|
||||
private String endTime;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 0-未启动;1-充电中;2-待结算;3-待补缴;4-异常;5-可疑;6-订单完成;7-超时关闭
|
||||
*/
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 启动方式
|
||||
* (0-后管启动;1-用户app启动;2-卡启动;3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动)
|
||||
*/
|
||||
private String startMode;
|
||||
|
||||
/**
|
||||
* 页码(默认1)
|
||||
*/
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 每页条数(默认10)
|
||||
*/
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运营端小程序查询枪口信息DTO
|
||||
*
|
||||
@@ -40,4 +42,14 @@ public class QueryConnectorInfoDTO {
|
||||
* 枪口编号
|
||||
*/
|
||||
private String pileConnectorCode;
|
||||
|
||||
/**
|
||||
* 站点Id List
|
||||
*/
|
||||
private List<String> stationIds;
|
||||
|
||||
/**
|
||||
* 运营商id
|
||||
*/
|
||||
private String merchantId;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Repository
|
||||
@@ -345,6 +346,14 @@ public interface OrderBasicInfoMapper {
|
||||
List<OrderVO> getOrderInfoByNXJT(NXJTQueryOrdersInfoDTO dto);
|
||||
|
||||
OrderTotalDataVO getOrderTotalData(QueryOrderDTO dto);
|
||||
|
||||
/**
|
||||
* 统计订单数量和总金额
|
||||
* @param dto 查询条件
|
||||
* @return 统计结果
|
||||
*/
|
||||
OrderStatisticsVO countBusinessOrderStatistics(QueryOrderDTO dto);
|
||||
|
||||
List<OrderBasicInfo> queryRepayOrder(String memberId);
|
||||
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@ import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
||||
import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.nanrui.JiangSuOrderInfoVO;
|
||||
import com.jsowell.pile.dto.business.QueryBusinessOrderDTO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderBillingInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderQueryResultVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PersonPileConnectorSumInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.SendMessageVO;
|
||||
@@ -544,6 +546,13 @@ public interface OrderBasicInfoService{
|
||||
|
||||
BusinessOrderDetailInfoVO getBusinessOrderDetail(String orderCode);
|
||||
|
||||
/**
|
||||
* 运营端小程序查询订单
|
||||
* @param dto 查询条件
|
||||
* @return 订单查询结果
|
||||
*/
|
||||
BusinessOrderQueryResultVO queryBusinessOrder(QueryBusinessOrderDTO dto);
|
||||
|
||||
/**
|
||||
* 根据枪口编号和状态查询订单
|
||||
* @param pileConnectorCode
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -22,6 +24,7 @@ import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.AcquirerEnum;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
@@ -40,6 +43,7 @@ import com.jsowell.common.util.id.SnowflakeIdWorker;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.business.QueryBusinessOrderDTO;
|
||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
|
||||
import com.jsowell.pile.mapper.OrderBasicInfoMapper;
|
||||
@@ -59,8 +63,11 @@ import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.nanrui.JiangSuOrderInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderBillingInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderListVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderQueryResultVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.*;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import com.jsowell.pile.vo.web.OrderStatisticsVO;
|
||||
import com.jsowell.wxpay.common.WeChatPayParameter;
|
||||
import com.jsowell.wxpay.response.WechatPayRefundRequest;
|
||||
import com.jsowell.wxpay.response.WechatPayRefundResponse;
|
||||
@@ -6165,6 +6172,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
return orderBasicInfoMapper.getPlatformProfit(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderCountByTimeVO queryOrderInsuranceAmountByTime(QueryOrderDTO dto) {
|
||||
if (dto == null) {
|
||||
dto = new QueryOrderDTO();
|
||||
@@ -6245,5 +6253,91 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
public List<IndexPlatformProfitVO> getInsuranceAmount(IndexQueryDTO dto) {
|
||||
return orderBasicInfoMapper.getInsuranceAmount(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运营端小程序查询订单
|
||||
* @param dto 查询条件
|
||||
* @return 订单查询结果
|
||||
*/
|
||||
@Override
|
||||
public BusinessOrderQueryResultVO queryBusinessOrder(QueryBusinessOrderDTO dto) {
|
||||
// 获取当前登录账号的运营商权限
|
||||
List<MerchantInfoVO> merchantInfoVOList = UserUtils.getMerchantInfoVOList();
|
||||
if (CollectionUtils.isEmpty(merchantInfoVOList)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
List<String> merchantIds = merchantInfoVOList.stream()
|
||||
.map(MerchantInfoVO::getMerchantId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 根据权限查询站点列表
|
||||
List<PileStationInfo> allStations = pileStationInfoService.getStationInfosByMerchantIds(merchantIds);
|
||||
if (CollectionUtils.isEmpty(allStations)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
|
||||
// 获取所有站点ID列表
|
||||
List<String> stationIdList = allStations.stream()
|
||||
.map(s -> String.valueOf(s.getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建QueryOrderDTO(包含启动方式和站点名称,由SQL进行过滤)
|
||||
QueryOrderDTO queryOrderDTO = QueryOrderDTO.builder()
|
||||
.stationIdList(stationIdList)
|
||||
.startTime(dto.getCreateTime())
|
||||
.endTime(dto.getEndTime())
|
||||
.orderStatus(dto.getOrderStatus())
|
||||
.startMode(dto.getStartMode())
|
||||
.stationName(dto.getStationName())
|
||||
.build();
|
||||
|
||||
// 1. 分页参数处理
|
||||
int pageNum = dto.getPageNum() == null || dto.getPageNum() <= 0 ? 1 : dto.getPageNum();
|
||||
int pageSize = dto.getPageSize() == null || dto.getPageSize() <= 0 ? 10 : dto.getPageSize();
|
||||
|
||||
// 2. 分页查询订单列表
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<OrderListVO> orderListVOS = selectOrderBasicInfoList(queryOrderDTO);
|
||||
PageInfo<OrderListVO> pageInfo = new PageInfo<>(orderListVOS);
|
||||
|
||||
long orderCount = pageInfo.getTotal();
|
||||
|
||||
// 3. 统计总金额(使用聚合 SQL,避免查询所有数据到内存
|
||||
OrderStatisticsVO statistics = orderBasicInfoMapper.countBusinessOrderStatistics(queryOrderDTO);
|
||||
BigDecimal totalOrderAmount = statistics != null && statistics.getOrderAmount() != null
|
||||
? statistics.getOrderAmount() : BigDecimal.ZERO;
|
||||
|
||||
//4. 转换为 BusinessOrderListVO
|
||||
List<BusinessOrderListVO> businessOrderList = orderListVOS.stream()
|
||||
.map(order -> BusinessOrderListVO.builder()
|
||||
.createTime(order.getCreateTime())
|
||||
.startMode(order.getStartMode())
|
||||
.orderCode(order.getOrderCode())
|
||||
.orderAmount(StringUtils.isNotBlank(order.getOrderAmount())
|
||||
? new BigDecimal(order.getOrderAmount()) : BigDecimal.ZERO)
|
||||
.chargingDegree(StringUtils.isNotBlank(order.getChargingDegree())
|
||||
? new BigDecimal(order.getChargingDegree()) : BigDecimal.ZERO)
|
||||
.orderStatus(order.getOrderStatus())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 5. 构建分页响应
|
||||
PageResponse pageResponse = PageResponse.builder()
|
||||
.pageNum(pageNum)
|
||||
.pageSize(pageSize)
|
||||
.total(pageInfo.getTotal())
|
||||
.pages(pageInfo.getPages())
|
||||
.list(businessOrderList)
|
||||
.build();
|
||||
|
||||
// 6. 构建返回结果
|
||||
return BusinessOrderQueryResultVO.builder()
|
||||
.orderCount(orderCount)
|
||||
.orderAmount(totalOrderAmount)
|
||||
.pageResponse(pageResponse)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,13 @@ import com.jsowell.common.enums.ykc.PileStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileConnectorInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
import com.jsowell.pile.dto.QueryConnectorDTO;
|
||||
import com.jsowell.pile.dto.QueryConnectorListDTO;
|
||||
import com.jsowell.pile.dto.UpdateConnectorParkNoDTO;
|
||||
@@ -81,7 +83,7 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileMsgRecordService pileMsgRecordService;
|
||||
@@ -1056,15 +1058,17 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
*/
|
||||
@Override
|
||||
public BusinessConnectorInfoVO getConnectorListByStationAndStatus(QueryConnectorInfoDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
// 获取登录账号信息
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
List<String> stationIds = pileMerchantInfoService.queryByMerchantDeptIds(Lists.newArrayList(String.valueOf(deptId)));
|
||||
String connectorStatus = dto.getConnectorStatus();
|
||||
int pageNum = dto.getPageNum();
|
||||
int pageSize = dto.getPageSize();
|
||||
BusinessConnectorInfoVO vo = new BusinessConnectorInfoVO();
|
||||
// 根据站点id查询枪口列表(有缓存)
|
||||
List<ConnectorInfoVO> uniAppConnectorList = getUniAppConnectorList(Long.parseLong(stationId));
|
||||
// 根据站点ids查询枪口列表(有缓存)
|
||||
List<ConnectorInfoVO> connectorInfoVOS = batchSelectConnectorList(stationIds);
|
||||
// 筛选出枪口编号
|
||||
List<String> pileConnectorCodeList = uniAppConnectorList.stream()
|
||||
List<String> pileConnectorCodeList = connectorInfoVOS.stream()
|
||||
.map(ConnectorInfoVO::getPileConnectorCode)
|
||||
.collect(Collectors.toList());
|
||||
// 批量获取某状态的枪口数量
|
||||
@@ -1082,11 +1086,15 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
vo.setChargingConnectorNum(chargingNum);
|
||||
vo.setFaultConnectorNum(faultNum);
|
||||
|
||||
List<Long> longStationIds = stationIds.stream()
|
||||
.map(Long::parseLong) // 或 s -> Long.parseLong(s)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 根据站点id和枪口状态查询枪口列表
|
||||
QueryConnectorListDTO queryConnectorListDTO = QueryConnectorListDTO.builder()
|
||||
.pageNum(pageNum)
|
||||
.pageSize(pageSize)
|
||||
.stationIdList(Lists.newArrayList(Long.parseLong(stationId)))
|
||||
.stationIdList(longStationIds)
|
||||
.build();
|
||||
List<PileConnectorInfoVO> pileConnectorInfoVOList = getConnectorInfoListByParams(queryConnectorListDTO);
|
||||
if (connectorStatus != null) {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.jsowell.pile.vo.uniapp.business;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 运营端小程序订单列表VO
|
||||
*
|
||||
* @author Auto
|
||||
* @Date 2024/12/19
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class BusinessOrderListVO {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 订单启动方式
|
||||
* 0-后管启动;1-用户app启动;2-卡启动;3-离线卡启动; 4-第三方平台启动; 5-车辆vin码启动; 6-个人桩预约启动
|
||||
*/
|
||||
private String startMode;
|
||||
|
||||
/**
|
||||
* 充电金额(订单金额)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 充电量(度)
|
||||
*/
|
||||
private BigDecimal chargingDegree;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 0-未启动;1-充电中;2-待结算;3-待补缴;4-异常;5-可疑;6-订单完成;7-超时关闭
|
||||
*/
|
||||
private String orderStatus;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.jsowell.pile.vo.uniapp.business;
|
||||
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运营端小程序订单查询结果VO
|
||||
*
|
||||
* @author Auto
|
||||
* @Date 2024/12/19
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class BusinessOrderQueryResultVO {
|
||||
/**
|
||||
* 订单量(笔)
|
||||
*/
|
||||
private Long orderCount;
|
||||
|
||||
/**
|
||||
* 订单金额(元)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 分页信息
|
||||
*/
|
||||
private PageResponse pageResponse;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单统计VO
|
||||
*
|
||||
* @author Auto
|
||||
* @Date 2025/01/20
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class OrderStatisticsVO {
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
private Long orderCount;
|
||||
|
||||
/**
|
||||
* 订单总金额
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
}
|
||||
|
||||
@@ -1997,6 +1997,18 @@
|
||||
#{excludeStationId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="stationIdList != null and stationIdList.size() != 0">
|
||||
and t1.station_id in
|
||||
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
|
||||
#{stationId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="startMode != null and startMode != ''">
|
||||
and t1.start_mode = #{startMode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="stationName != null and stationName != ''">
|
||||
and t3.station_name like concat('%', #{stationName,jdbcType=VARCHAR}, '%')
|
||||
</if>
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
|
||||
@@ -2066,6 +2078,73 @@
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
|
||||
<!--
|
||||
统计订单数量和总金额(用于运营端小程序)
|
||||
使用子查询去重,确保与分页查询 selectOrderBasicInfoList 的条件一致
|
||||
包含相同的 JOIN 条件(order_detail、pile_station_info)和过滤条件
|
||||
-->
|
||||
<select id="countBusinessOrderStatistics" parameterType="com.jsowell.pile.dto.QueryOrderDTO"
|
||||
resultType="com.jsowell.pile.vo.web.OrderStatisticsVO">
|
||||
SELECT
|
||||
COUNT(*) AS orderCount,
|
||||
IFNULL(SUM(order_amount), 0) AS orderAmount
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
t1.order_code,
|
||||
t1.order_amount
|
||||
FROM order_basic_info t1
|
||||
LEFT JOIN member_basic_info t2
|
||||
ON t1.member_id = t2.member_id
|
||||
AND t2.del_flag = '0'
|
||||
JOIN pile_station_info t3
|
||||
ON t1.station_id = t3.id
|
||||
AND t3.del_flag = '0'
|
||||
JOIN order_detail t4
|
||||
ON t4.order_code = t1.order_code
|
||||
AND t4.del_flag = '0'
|
||||
WHERE t1.del_flag = '0'
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND t1.order_status = #{orderStatus,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="merchantId != null and merchantId != ''">
|
||||
AND t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="stationId != null and stationId != ''">
|
||||
AND t1.station_id = #{stationId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND t1.create_time <![CDATA[ >= ]]> #{startTime,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="stationIdList != null and stationIdList.size() != 0">
|
||||
AND t1.station_id IN
|
||||
<foreach collection="stationIdList" item="stationId" open="(" separator="," close=")">
|
||||
#{stationId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="startMode != null and startMode != ''">
|
||||
AND t1.start_mode = #{startMode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="stationName != null and stationName != ''">
|
||||
AND t3.station_name LIKE CONCAT('%', #{stationName,jdbcType=VARCHAR}, '%')
|
||||
</if>
|
||||
<if test="stationDeptIds != null and stationDeptIds.size() != 0">
|
||||
AND t3.dept_id IN
|
||||
<foreach collection="stationDeptIds" item="stationDeptId" open="(" separator="," close=")">
|
||||
#{stationDeptId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="excludeStationIdList != null and excludeStationIdList.size() != 0">
|
||||
AND t1.station_id NOT IN
|
||||
<foreach collection="excludeStationIdList" item="excludeStationId" open="(" separator="," close=")">
|
||||
#{excludeStationId}
|
||||
</foreach>
|
||||
</if>
|
||||
) AS temp
|
||||
</select>
|
||||
|
||||
<select id="selectOrderBasicInfoById" parameterType="Long" resultMap="OrderBasicInfoOrderDetailResult">
|
||||
select a.id,
|
||||
a.order_code,
|
||||
|
||||
@@ -671,6 +671,9 @@
|
||||
#{stationDeptId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.stationName != null and dto.stationName != ''">
|
||||
AND t1.station_name LIKE CONCAT('%', #{dto.stationName,jdbcType=VARCHAR}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getStationInfoForAmap" resultMap="PileStationInfoResult">
|
||||
|
||||
Reference in New Issue
Block a user