Merge branch 'dev-new' into dev-new-rabbitmq

# Conflicts:
#	jsowell-admin/src/test/java/SpringBootTestController.java
#	jsowell-pile/src/main/java/com/jsowell/pile/service/OrderBasicInfoService.java
#	jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java
This commit is contained in:
Guoqs
2024-12-28 15:15:15 +08:00
54 changed files with 4373 additions and 2540 deletions

View File

@@ -0,0 +1,193 @@
package com.jsowell.api.thirdparty;
import com.alibaba.fastjson2.JSON;
import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.enums.thirdparty.ThirdPartyReturnCodeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.thirdparty.lianlian.common.CommonResult;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
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;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* 广西平台Controller
*
* @author Lemon
* @Date 2024/12/26 9:06:33
*/
@Anonymous
@RestController
@RequestMapping("/guangxi")
public class GuangXiPlatformController extends ThirdPartyBaseController {
private final String platformName = "广西平台";
private final String platformType = ThirdPlatformTypeEnum.GUANG_XI_PLATFORM.getTypeCode();
@Autowired
@Qualifier("guangXiPlatformServiceImpl")
private ThirdPartyPlatformService platformLogic;
/**
* getToken
*/
@PostMapping("/v1/query_token")
public CommonResult<?> queryToken(@RequestBody CommonParamsDTO dto) {
// logger.info("{}-请求令牌 params:{}", platformName, JSON.toJSONString(dto));
try {
Map<String, String> map = platformLogic.queryToken(dto);
logger.info("{}-请求令牌, params:{}, result:{}", platformName, JSON.toJSONString(dto), JSON.toJSONString(map));
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("{}-获取token接口, 异常, params:{}", platformName, JSON.toJSONString(dto), e);
return CommonResult.failed("获取token发生异常");
}
}
/**
* 查询充电站信息
* query_stations_info
*/
@PostMapping("/v1/query_stations_info")
public CommonResult<?> query_stations_info(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("{}-查询充电站信息 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
// 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryStationsInfo(queryStationInfoDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.info("{}-查询充电站信息 error:", platformName, e);
}
return CommonResult.failed("查询充电站信息发生异常");
}
/**
* 查询充电站状态信息
* query_station_status
*/
@PostMapping("/v1/query_station_status")
public CommonResult<?> queryStationStatus(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("{}-查询充电站状态信息 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
// 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryStationStatus(queryStationInfoDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("{}-查询充电站状态信息 error:", platformName, e);
}
return CommonResult.failed("查询充电站状态信息发生异常");
}
/**
* 查询充电站统计信息
* query_station_stats
*/
@PostMapping("/v1/query_station_stats")
public CommonResult<?> queryStationStats(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("{}-查询充电站统计信息 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
// 解析入参
QueryStationInfoDTO queryStationInfoDTO = parseParamsDTO(dto, QueryStationInfoDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryStationStats(queryStationInfoDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("{}-查询充电站统计信息 error:", platformName, e);
}
return CommonResult.failed("查询充电站统计信息发生异常");
}
/**
* 查询已完成订单列表信息接口
* query_finish_orders
*/
@PostMapping("/v1/query_finish_orders")
public CommonResult<?> queryFinishOrders(HttpServletRequest request, @RequestBody CommonParamsDTO dto) {
logger.info("{}-查询已完成订单列表信息接口 params:{}", platformName, JSON.toJSONString(dto));
try {
// 校验令牌
if (!verifyToken(request.getHeader("Authorization"))) {
// 校验失败
return CommonResult.failed(ThirdPartyReturnCodeEnum.TOKEN_ERROR);
}
dto.setPlatformType(platformType);
// 校验签名
if (!verifySignature(dto)) {
// 签名错误
return CommonResult.failed(ThirdPartyReturnCodeEnum.SIGN_ERROR);
}
// 解析入参
QueryStartChargeDTO queryStartChargeDTO = parseParamsDTO(dto, QueryStartChargeDTO.class);
// 执行逻辑
Map<String, String> map = platformLogic.queryFinishOrders(queryStartChargeDTO);
return CommonResult.success(Integer.parseInt(map.get("Ret")), map.get("Msg"), map.get("Data"), map.get("Sig"));
} catch (Exception e) {
logger.error("{}-查询已完成订单列表信息接口 error:", platformName, e);
}
return CommonResult.failed("查询已完成订单列表信息接口 error");
}
}

View File

@@ -8,6 +8,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.jsowell.adapay.common.AdaPayment;
import com.jsowell.adapay.common.PaymentConfirmInfo;
import com.jsowell.adapay.dto.QueryPaymentConfirmDTO;
import com.jsowell.adapay.response.PaymentConfirmResponse;
import com.jsowell.adapay.response.QueryPaymentConfirmDetailResponse;
@@ -373,7 +374,7 @@ public class TempService {
dto.setPaymentId(record.getPaymentId());
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
if (response != null && CollectionUtils.isNotEmpty(response.getPaymentConfirms())) {
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo paymentConfirm : response.getPaymentConfirms()) {
for (PaymentConfirmInfo paymentConfirm : response.getPaymentConfirms()) {
JSONObject jsonObject = JSON.parseObject(paymentConfirm.getDescription());
if (StringUtils.equals(jsonObject.getString("orderCode"), orderCode)) {
// 订单号对的上,累计分账金额
@@ -414,7 +415,7 @@ public class TempService {
.paymentId(paymentId)
.build();
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(build);
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> paymentConfirms = response.getPaymentConfirms();
List<PaymentConfirmInfo> paymentConfirms = response.getPaymentConfirms();
if (CollectionUtils.isEmpty(paymentConfirms)) {
unClearingList.add(clearingBillVO);
} else {
@@ -476,10 +477,10 @@ public class TempService {
if (response == null) {
continue;
}
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
List<PaymentConfirmInfo> confirms = response.getPaymentConfirms();
if (CollectionUtils.isNotEmpty(confirms)) {
// 已经分过账
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
for (PaymentConfirmInfo confirm : confirms) {
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
// 找到orderCode的分账记录
@@ -521,7 +522,7 @@ public class TempService {
queryPaymentConfirmDTO.setPaymentId(paymentId);
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(queryPaymentConfirmDTO);
logger.info("校验未分账的支付单-支付id:{}, 查询到的分账信息:{}", paymentId, JSON.toJSONString(response));
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
List<PaymentConfirmInfo> confirms = response.getPaymentConfirms();
if (CollectionUtils.isEmpty(confirms)) {
logger.info("校验未分账的支付单-支付id:{}没有进行过分账", paymentId);
// 没有配置结算账户的,默认分到本商户
@@ -649,7 +650,7 @@ public class TempService {
return Lists.newArrayList();
}
BigDecimal multiple = new BigDecimal("2");
BigDecimal multiple = new BigDecimal("0.5");
// 查询订单主表数据
List<OrderBasicInfo> orderBasicInfos = orderBasicInfoService.queryOrderList(orderCodeList);
for (OrderBasicInfo orderBasicInfo : orderBasicInfos) {

View File

@@ -54,9 +54,10 @@ public class OrderPileOccupyController extends BaseController {
@PreAuthorize("@ss.hasPermi('pile:occupy:export')")
@Log(title = "占桩订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OrderPileOccupy orderPileOccupy) {
List<OrderPileOccupy> list = orderPileOccupyService.selectOrderPileOccupyList(orderPileOccupy);
ExcelUtil<OrderPileOccupy> util = new ExcelUtil<OrderPileOccupy>(OrderPileOccupy.class);
public void export(HttpServletResponse response, OrderPileOccupyDTO dto) {
// List<OrderPileOccupy> list = orderPileOccupyService.selectOrderPileOccupyList(orderPileOccupy);
List<OccupyOrderVO> list = orderPileOccupyService.getOrderPileOccupyListWithAuth(dto);
ExcelUtil<OccupyOrderVO> util = new ExcelUtil<>(OccupyOrderVO.class);
util.exportExcel(response, list, "占桩订单数据");
}