Merge branch 'dev' into dev-g

This commit is contained in:
Guoqs
2025-07-04 14:08:42 +08:00
22 changed files with 341 additions and 56 deletions

View File

@@ -25,6 +25,7 @@ import com.jsowell.pile.vo.uniapp.customer.MemberBalanceVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.service.OrderService;
import com.jsowell.service.TempService;
import com.jsowell.thirdparty.platform.dto.PushOrderDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -877,4 +878,35 @@ public class TempController extends BaseController {
}
return response;
}
@PostMapping("/retrySendOrderData2Mq")
public RestApiResponse<?> retrySendOrderData2Mq(@RequestBody QueryOrderDTO dto) {
RestApiResponse<?> response;
try {
tempService.sendOrderData2Mq(dto.getOrderCode());
response = new RestApiResponse<>();
} catch (Exception e) {
logger.error("重试分账接口error,", e);
response = new RestApiResponse<>(e);
}
return response;
}
/**
* 根据时间区间批量推送订单
* @param dto
* @return
*/
@PostMapping("/pushOrderInfoBatch")
public RestApiResponse<?> pushOrderInfoBatch(@RequestBody PushOrderDTO dto) {
RestApiResponse<?> response = null;
try {
tempService.pushOrderInfoBatch(dto);
response = new RestApiResponse<>();
} catch (Exception e) {
logger.error("青海平台推送订单信息 error", e);
}
logger.info("青海平台推送订单信息 result:{}", response);
return response;
}
}

View File

@@ -22,6 +22,7 @@ import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
import com.jsowell.common.enums.adapay.MerchantDelayModeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.*;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
@@ -34,7 +35,13 @@ import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.transaction.service.TransactionService;
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.StationInfoVO;
import com.jsowell.pile.vo.uniapp.business.BusinessOrderDetailInfoVO;
import com.jsowell.pile.vo.web.*;
import com.jsowell.thirdparty.common.CommonService;
import com.jsowell.thirdparty.platform.dto.PushOrderDTO;
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -117,6 +124,15 @@ public class TempService {
@Autowired
private OrderUnsplitRecordService orderUnsplitRecordService;
@Autowired
private ThirdpartySecretInfoService thirdpartySecretInfoService;
@Autowired
private ThirdPartyStationRelationService thirdPartyStationRelationService;
@Autowired
private CommonService commonService;
/**
* 计算订单耗电量
* 内蒙古站点
@@ -1187,5 +1203,55 @@ public class TempService {
logger.info("debugOrder结束, resultMap:{}", JSONObject.toJSONString(resultMap));
return resultMap;
}
public void sendOrderData2Mq(String orderCode) {
// 通过订单编号查询订单信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
if (orderBasicInfo == null || orderDetail == null) {
return;
}
// 发送消息
AfterSettleOrderDTO afterSettleOrderDTO = AfterSettleOrderDTO.builder()
.orderCode(orderBasicInfo.getOrderCode())
.merchantId(orderBasicInfo.getMerchantId())
.stationId(orderBasicInfo.getStationId())
.orderPayAmount(orderBasicInfo.getPayAmount()) // 支付金额
.orderConsumeAmount(orderBasicInfo.getOrderAmount()) // 消费金额
.orderSettleAmount(orderBasicInfo.getSettleAmount()) // 结算金额
.orderElectricityAmount(orderDetail.getTotalElectricityAmount()) // 电费金额
.orderElectricityDiscountAmount(orderDetail.getDiscountElectricityAmount()) // 电费折扣金额
.orderServiceAmount(orderDetail.getTotalServiceAmount()) // 服务费金额
.orderServiceDiscountAmount(orderDetail.getDiscountServiceAmount()) // 服务费折扣金额
.orderRefundAmount(orderBasicInfo.getRefundAmount()) // 退款金额
.build();
rabbitTemplate.convertAndSend(RabbitConstants.YKC_EXCHANGE_NAME, RabbitConstants.QUEUE_CHARGE_ORDER_DATA, afterSettleOrderDTO);
}
/**
* 根据时间区间批量推送订单
* @param dto
* @return
*/
public void pushOrderInfoBatch(PushOrderDTO dto) {
// 根据type查出对接的stationIds
List<StationInfoVO> stationInfoVOS = thirdPartyStationRelationService.selectStationList(dto.getThirdPartyType());
List<String> stationIds = stationInfoVOS.stream()
.map(StationInfoVO::getStationId)
.collect(Collectors.toList());
// 批量查询需要推送的订单
List<OrderBasicInfo> orderInfos = orderBasicInfoService.getOrderBasicInfoByTimeInterval(stationIds, dto.getStartTime(), dto.getEndTime());
if (CollectionUtils.isEmpty(orderInfos)) {
return;
}
orderInfos.forEach(orderBasicInfo -> {
// 推送第三方平台
commonService.commonPushOrderInfoV2(orderBasicInfo);
});
}
}

View File

@@ -7,7 +7,6 @@ import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
@@ -16,7 +15,6 @@ import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
import com.jsowell.pile.dto.FastCreateStationDTO;
import com.jsowell.pile.dto.PushStationInfoDTO;
import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.dto.ThirdPartyStationRelationDTO;
import com.jsowell.pile.dto.amap.EditAmapFlagDTO;
@@ -27,6 +25,7 @@ import com.jsowell.pile.service.ThirdPartySettingInfoService;
import com.jsowell.pile.service.ThirdPartyStationRelationService;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.pile.vo.web.StationSelectVO;
import com.jsowell.service.PileService;
import com.jsowell.thirdparty.amap.service.AMapService;
import com.jsowell.thirdparty.common.CommonService;
@@ -36,7 +35,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/**
* 充电站信息Controller
@@ -89,7 +87,7 @@ public class PileStationInfoController extends BaseController {
public TableDataInfo getStationSelectList(QueryStationDTO dto) {
logger.info("dto:{}", JSON.toJSONString(dto));
startPage();
List<PileStationVO> list = pileStationInfoService.getStationSelectList(dto);
List<StationSelectVO> list = pileStationInfoService.getStationSelectList(dto);
return getDataTable(list);
}