mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-06 06:57:59 +08:00
Merge branch 'dev' of https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web into dev
This commit is contained in:
@@ -22,10 +22,7 @@ import com.jsowell.pile.service.OrderSplitRecordService;
|
|||||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||||
import com.jsowell.pile.service.PileStationInfoService;
|
import com.jsowell.pile.service.PileStationInfoService;
|
||||||
import com.jsowell.pile.util.UserUtils;
|
import com.jsowell.pile.util.UserUtils;
|
||||||
import com.jsowell.pile.vo.web.OrderListVO;
|
import com.jsowell.pile.vo.web.*;
|
||||||
import com.jsowell.pile.vo.web.SplitAggregateDataVO;
|
|
||||||
import com.jsowell.pile.vo.web.SplitConfigOrderVO;
|
|
||||||
import com.jsowell.pile.vo.web.SplitRecordInfoVO;
|
|
||||||
import com.jsowell.service.OrderService;
|
import com.jsowell.service.OrderService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -364,4 +361,23 @@ public class OrderBasicInfoController extends BaseController {
|
|||||||
logger.info("订单保险金额退款 params:{}, result:{}", JSON.toJSONString(orderBasicInfo), response);
|
logger.info("订单保险金额退款 params:{}, result:{}", JSON.toJSONString(orderBasicInfo), response);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单数量与保险金额时间区统计
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/queryOrderInsuranceAmountByTime")
|
||||||
|
public RestApiResponse<?> queryOrderInsuranceAmountByTime(@RequestBody QueryOrderDTO dto) {
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
OrderCountByTimeVO result = orderBasicInfoService.queryOrderInsuranceAmountByTime(dto);
|
||||||
|
response = new RestApiResponse<>(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("时间区间查询订单统计 error", e);
|
||||||
|
}
|
||||||
|
logger.info("时间区间查询订单统计 result:{}", response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ public class ThreadPoolConfig {
|
|||||||
@Bean(name = "thirdpartyTaskExecutor")
|
@Bean(name = "thirdpartyTaskExecutor")
|
||||||
public ThreadPoolTaskExecutor thirdpartyTaskExecutor() {
|
public ThreadPoolTaskExecutor thirdpartyTaskExecutor() {
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
executor.setMaxPoolSize(corePoolSize_tp);
|
executor.setMaxPoolSize(maxPoolSize_tp);
|
||||||
executor.setCorePoolSize(maxPoolSize_tp);
|
executor.setCorePoolSize(corePoolSize_tp);
|
||||||
executor.setQueueCapacity(queueCapacity_tp);
|
executor.setQueueCapacity(queueCapacity_tp);
|
||||||
executor.setKeepAliveSeconds(keepAliveSeconds_tp);
|
executor.setKeepAliveSeconds(keepAliveSeconds_tp);
|
||||||
// 线程池对拒绝任务(无线程可用)的处理策略
|
// 线程池对拒绝任务(无线程可用)的处理策略
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.jsowell.pile.mapper;
|
package com.jsowell.pile.mapper;
|
||||||
|
|
||||||
import com.alipay.api.domain.ChargeOrderInfo;
|
|
||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import com.jsowell.pile.domain.OrderDetail;
|
import com.jsowell.pile.domain.OrderDetail;
|
||||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
|
||||||
import com.jsowell.pile.domain.UserFrequentedStationInfo;
|
|
||||||
import com.jsowell.pile.dto.*;
|
import com.jsowell.pile.dto.*;
|
||||||
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
import com.jsowell.pile.dto.nanrui.NRQueryOrderDTO;
|
||||||
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
|
import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryOrdersInfoDTO;
|
||||||
@@ -431,4 +428,10 @@ public interface OrderBasicInfoMapper {
|
|||||||
@Param("endTime") String endTime
|
@Param("endTime") String endTime
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按月份统计订单数量和保险金额
|
||||||
|
* @param dto 查询条件,startTime/endTime 必须是 yyyy-MM 拼装后的时间段
|
||||||
|
* @return List<OrderMonthStatVO>
|
||||||
|
*/
|
||||||
|
List<OrderMonthStatVO> selectOrderCountAndInsuranceByMonth(@Param("dto") QueryOrderDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -631,4 +631,6 @@ public interface OrderBasicInfoService{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BusinessOrderDetailInfoVO> getOrderDetailByStationIdsForMonth(List<String> stationIds , String startTime , String endTime);
|
List<BusinessOrderDetailInfoVO> getOrderDetailByStationIdsForMonth(List<String> stationIds , String startTime , String endTime);
|
||||||
|
|
||||||
|
OrderCountByTimeVO queryOrderInsuranceAmountByTime(QueryOrderDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ import javax.annotation.Resource;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -5958,5 +5962,77 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
public List<BusinessOrderDetailInfoVO> getOrderDetailByStationIdsForMonth(List<String> stationIds , String startTime , String endTime) {
|
public List<BusinessOrderDetailInfoVO> getOrderDetailByStationIdsForMonth(List<String> stationIds , String startTime , String endTime) {
|
||||||
return orderBasicInfoMapper.getOrderDetailByStationIdsForMonth(stationIds, startTime, endTime);
|
return orderBasicInfoMapper.getOrderDetailByStationIdsForMonth(stationIds, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单数量与保险金额时间区统计
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OrderCountByTimeVO queryOrderInsuranceAmountByTime(QueryOrderDTO dto) {
|
||||||
|
if (dto == null) {
|
||||||
|
dto = new QueryOrderDTO();
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 处理 startTime
|
||||||
|
if (StringUtils.isNotEmpty(dto.getStartTime())) {
|
||||||
|
YearMonth startMonth = YearMonth.parse(dto.getStartTime(), monthFormatter);
|
||||||
|
dto.setStartTime(startMonth.atDay(1).atStartOfDay().format(dateTimeFormatter));
|
||||||
|
}
|
||||||
|
// 处理 endTime,取下个月月初,保证 < endTime 不丢数据
|
||||||
|
if (StringUtils.isNotEmpty(dto.getEndTime())) {
|
||||||
|
YearMonth endMonth = YearMonth.parse(dto.getEndTime(), monthFormatter);
|
||||||
|
dto.setEndTime(endMonth.plusMonths(1).atDay(1).atStartOfDay().format(dateTimeFormatter));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException("时间格式错误,应为 yyyy-MM");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 默认本月
|
||||||
|
if (StringUtils.isEmpty(dto.getStartTime()) || StringUtils.isEmpty(dto.getEndTime())) {
|
||||||
|
YearMonth currentMonth = YearMonth.now();
|
||||||
|
dto.setStartTime(currentMonth.atDay(1).atStartOfDay().format(dateTimeFormatter));
|
||||||
|
dto.setEndTime(currentMonth.plusMonths(1).atDay(1).atStartOfDay().format(dateTimeFormatter));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询数据库聚合结果
|
||||||
|
List<OrderMonthStatVO> stats = orderBasicInfoMapper.selectOrderCountAndInsuranceByMonth(dto);
|
||||||
|
|
||||||
|
// 封装返回结果
|
||||||
|
BigDecimal totalInsuranceAmount = BigDecimal.ZERO;
|
||||||
|
int totalCount = 0;
|
||||||
|
List<OrderCountByTimeVO.OrderCountByTimeListVO> result = new ArrayList<>();
|
||||||
|
|
||||||
|
for (OrderMonthStatVO stat : stats) {
|
||||||
|
YearMonth ym = YearMonth.parse(stat.getMonth(), monthFormatter);
|
||||||
|
|
||||||
|
OrderCountByTimeVO.OrderCountByTimeListVO vo = new OrderCountByTimeVO.OrderCountByTimeListVO();
|
||||||
|
vo.setStartTime(ym.atDay(1).atStartOfDay().format(dateTimeFormatter));
|
||||||
|
vo.setEndTime(ym.plusMonths(1).atDay(1).atStartOfDay().format(dateTimeFormatter));
|
||||||
|
vo.setCount(stat.getOrderCount());
|
||||||
|
vo.setOrderCount(stat.getOrderCount());
|
||||||
|
BigDecimal insuranceAmount = stat.getInsuranceAmount() == null ? BigDecimal.ZERO : stat.getInsuranceAmount();
|
||||||
|
vo.setInsuranceAmount(totalInsuranceAmount);
|
||||||
|
|
||||||
|
result.add(vo);
|
||||||
|
|
||||||
|
totalCount += stat.getOrderCount();
|
||||||
|
totalInsuranceAmount = totalInsuranceAmount.add(insuranceAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderCountByTimeVO vo = new OrderCountByTimeVO();
|
||||||
|
vo.setOrderCountByTimeList(result);
|
||||||
|
vo.setTotalCount(totalCount);
|
||||||
|
vo.setTotalInsuranceAmount(totalInsuranceAmount);
|
||||||
|
|
||||||
|
|
||||||
|
logger.info("按月统计结果: {}", JSONObject.toJSONString(vo));
|
||||||
|
return vo;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.pile.vo.web;
|
package com.jsowell.pile.vo.web;
|
||||||
|
|
||||||
|
import com.jsowell.common.annotation.Excel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -13,16 +14,36 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
public class OccupyOrderVO {
|
public class OccupyOrderVO {
|
||||||
private String id;
|
private String id;
|
||||||
|
@Excel(name = "占桩订单号")
|
||||||
private String occupyCode;
|
private String occupyCode;
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@Excel(name = "会员ID")
|
||||||
private String memberId;
|
private String memberId;
|
||||||
|
|
||||||
private String stationId;
|
private String stationId;
|
||||||
|
|
||||||
private String plateNumber;
|
private String plateNumber;
|
||||||
|
|
||||||
|
@Excel(name = "站点名称")
|
||||||
private String stationName;
|
private String stationName;
|
||||||
|
|
||||||
|
@Excel(name = "占桩开始时间")
|
||||||
private String startTime;
|
private String startTime;
|
||||||
|
|
||||||
|
@Excel(name = "占桩结束时间")
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@Excel(name = "支付状态")
|
||||||
private String payStatus;
|
private String payStatus;
|
||||||
|
|
||||||
|
@Excel(name = "订单金额")
|
||||||
private BigDecimal orderAmount;
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
@Excel(name = "充电桩编号")
|
||||||
private String pileSn;
|
private String pileSn;
|
||||||
|
|
||||||
|
@Excel(name = "充电桩枪口号")
|
||||||
private String connectorCode;
|
private String connectorCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.jsowell.pile.vo.web;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderMonthStatVO {
|
||||||
|
private String month;
|
||||||
|
private Integer orderCount;
|
||||||
|
private BigDecimal insuranceAmount;
|
||||||
|
}
|
||||||
@@ -3457,4 +3457,21 @@
|
|||||||
AND DATE_ADD(#{endTime,jdbcType=VARCHAR}, INTERVAL 1 DAY)
|
AND DATE_ADD(#{endTime,jdbcType=VARCHAR}, INTERVAL 1 DAY)
|
||||||
ORDER BY t1.create_time DESC
|
ORDER BY t1.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOrderCountAndInsuranceByMonth"
|
||||||
|
parameterType="com.jsowell.pile.dto.QueryOrderDTO"
|
||||||
|
resultType="com.jsowell.pile.vo.web.OrderMonthStatVO">
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT(create_time, '%Y-%m') AS month,
|
||||||
|
COUNT(*) AS orderCount,
|
||||||
|
IFNULL(SUM(insurance_amount), 0) AS insuranceAmount
|
||||||
|
FROM order_basic_info
|
||||||
|
WHERE create_time <![CDATA[ >= ]]> #{dto.startTime}
|
||||||
|
AND create_time <![CDATA[ < ]]> #{dto.endTime}
|
||||||
|
GROUP BY DATE_FORMAT(create_time, '%Y-%m')
|
||||||
|
ORDER BY month ASC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -656,12 +656,10 @@ public class XinDiantuPlatfromServiceImpl implements ThirdPartyPlatformService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String notificationEquipChargeStatus(String orderCode) {
|
public String notificationEquipChargeStatus(String orderCode) {
|
||||||
//判断是否是常畅充平台的订单
|
// boolean flag = isNeedPushToThirdPartyPlatform(orderCode , com.jsowell.common.enums.ThirdPlatformTypeEnum.XIN_DIAN_TU.getOperatorId());
|
||||||
boolean flag = isNeedPushToThirdPartyPlatform(orderCode , ThirdPlatformTypeEnum.CHANG_ZHOU_PLATFORM.getOperatorId());
|
// if (!flag){
|
||||||
if (!flag){
|
// return null;
|
||||||
//表示不是常畅充平台的订单
|
// }
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据订单号查询订单信息
|
// 根据订单号查询订单信息
|
||||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user