|
|
@@ -14,6 +14,7 @@ import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.result.PageDataResult;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
+import com.sckw.system.api.model.dto.res.KwsEnterpriseResDto;
|
|
|
import com.sckw.transport.api.model.param.ParkingWalletFeeFreezeParam;
|
|
|
import com.sckw.transport.api.model.vo.ParkingWalletFeeFreezeResult;
|
|
|
import com.sckw.transport.model.*;
|
|
|
@@ -66,6 +67,14 @@ public class ParkingWalletFeeService {
|
|
|
private static final int TRADE_TYPE_UNFREEZE = 5;
|
|
|
/** 钱包明细交易类型:消费(订单完结按实际履约量正式扣减服务费) */
|
|
|
private static final int TRADE_TYPE_CONSUME = 6;
|
|
|
+ /**
|
|
|
+ * 平台服务费供应方企业名称。
|
|
|
+ */
|
|
|
+ private static final String PLATFORM_SERVICE_FEE_SUPPLY_ENTERPRISE_NAME = "四川开物信息技术有限公司";
|
|
|
+ /**
|
|
|
+ * 平台服务费供应方企业类型。
|
|
|
+ */
|
|
|
+ private static final int PLATFORM_SERVICE_FEE_SUPPLY_ENTERPRISE_TYPE = -1;
|
|
|
|
|
|
/**
|
|
|
* 查询汇总服务费
|
|
|
@@ -74,7 +83,7 @@ public class ParkingWalletFeeService {
|
|
|
public ParkingWalletFeeResp queryTotalServerFee(ParkingWalletFeeTotalQueryParam param) {
|
|
|
log.info("查询汇总服务费:{}", JSON.toJSONString(param));
|
|
|
if (param.getSupEntId() != null) {
|
|
|
- param.setSupEntId(551429255406292993L);
|
|
|
+ param.setSupEntId(resolvePlatformServiceFeeSupEntId());
|
|
|
}
|
|
|
|
|
|
//构建查询条件
|
|
|
@@ -157,7 +166,7 @@ public class ParkingWalletFeeService {
|
|
|
public PageDataResult<ParkingWalletFeeResp> pageQueryServerFee(ParkingWalletFeeQueryParam param) {
|
|
|
log.info("分页查询服务费:{}", JSON.toJSONString(param));
|
|
|
if (param.getSupEntId() != null) {
|
|
|
- param.setSupEntId(551429255406292993L);
|
|
|
+ param.setSupEntId(resolvePlatformServiceFeeSupEntId());
|
|
|
}
|
|
|
|
|
|
//构建查询条件
|
|
|
@@ -222,7 +231,7 @@ public class ParkingWalletFeeService {
|
|
|
public void saveServerFee(ParkingWalletFeeSaveParam param) {
|
|
|
log.info("保存服务费,param:{}", JSON.toJSONString(param));
|
|
|
if (param.getSupEntId() != null) {
|
|
|
- param.setSupEntId(551429255406292993L);
|
|
|
+ param.setSupEntId(resolvePlatformServiceFeeSupEntId());
|
|
|
}
|
|
|
|
|
|
KwtParkingWalletFee walletFee = parkingWalletFeeRepository.getById(param.getId());
|
|
|
@@ -264,7 +273,7 @@ public class ParkingWalletFeeService {
|
|
|
public PageDataResult<ParkingWalletFeeBalanceResp> pageQueryServerFeeDetails(ParkingWalletFeeBalanceQueryParam param) {
|
|
|
log.info("分页查询服务费明细:{}", JSON.toJSONString(param));
|
|
|
if (param.getSupEntId() != null) {
|
|
|
- param.setSupEntId(551429255406292993L);
|
|
|
+ param.setSupEntId(resolvePlatformServiceFeeSupEntId());
|
|
|
}
|
|
|
//构建查询条件
|
|
|
LambdaQueryWrapper<KwtParkingWalletFeeBalance> wrapper = buildAndExecuteQuery(param);
|
|
|
@@ -1126,5 +1135,38 @@ public class ParkingWalletFeeService {
|
|
|
return walletFee.getServiceFeeBalance();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 解析平台服务费供应方企业ID。
|
|
|
+ *
|
|
|
+ * @return 平台服务费供应方企业ID
|
|
|
+ */
|
|
|
+ private Long resolvePlatformServiceFeeSupEntId() {
|
|
|
+ try {
|
|
|
+ KwsEnterpriseResDto enterprise = remoteSystemService.findEnterpriseByNameAndType(
|
|
|
+ PLATFORM_SERVICE_FEE_SUPPLY_ENTERPRISE_NAME,
|
|
|
+ PLATFORM_SERVICE_FEE_SUPPLY_ENTERPRISE_TYPE);
|
|
|
+ return resolveEnterpriseIdByName(enterprise, PLATFORM_SERVICE_FEE_SUPPLY_ENTERPRISE_NAME);
|
|
|
+ } catch (BusinessPlatfromException e) {
|
|
|
+ throw e;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询平台固定服务费供应方企业失败,enterpriseName={}", PLATFORM_SERVICE_FEE_SUPPLY_ENTERPRISE_NAME, e);
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "查询平台固定服务费供应方企业失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验企业名称查询结果并提取企业ID。
|
|
|
+ *
|
|
|
+ * @param enterprise 企业信息
|
|
|
+ * @param enterpriseName 企业名称
|
|
|
+ * @return 企业ID
|
|
|
+ */
|
|
|
+ static Long resolveEnterpriseIdByName(KwsEnterpriseResDto enterprise, String enterpriseName) {
|
|
|
+ if (enterprise == null || enterprise.getId() == null) {
|
|
|
+ log.warn("根据企业名称未查询到有效企业,enterpriseName={}", enterpriseName);
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "平台服务费供应方企业不存在:" + enterpriseName);
|
|
|
+ }
|
|
|
+ return enterprise.getId();
|
|
|
+ }
|
|
|
|
|
|
}
|