|
|
@@ -0,0 +1,57 @@
|
|
|
+package com.kym.service.impl;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.kym.common.utils.CommUtil;
|
|
|
+import com.kym.entity.StationFeeRate;
|
|
|
+import com.kym.entity.common.PageBean;
|
|
|
+import com.kym.entity.queryParams.PlatformFeeRateQueryParam;
|
|
|
+import com.kym.mapper.StationFeeRateMapper;
|
|
|
+import com.kym.service.StationFeeRateService;
|
|
|
+import com.kym.service.mybatisplus.MyBaseServiceImpl;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 站点平台费率表 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author skyline
|
|
|
+ * @since 2025-04-18
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class StationFeeRateServiceImpl extends MyBaseServiceImpl<StationFeeRateMapper, StationFeeRate> implements StationFeeRateService {
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void bind(StationFeeRate stationFeeRate) {
|
|
|
+ // 查询站点的绑定数据,将历史数据置为无效,插入新的数据
|
|
|
+ lambdaUpdate()
|
|
|
+ .eq(StationFeeRate::getStationId, stationFeeRate.getStationId())
|
|
|
+ .set(StationFeeRate::getStatus, false)
|
|
|
+ .update();
|
|
|
+ save(stationFeeRate);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public StationFeeRate getStationFeeRate(String stationId) {
|
|
|
+ var res = lambdaQuery()
|
|
|
+ .eq(StationFeeRate::getStationId, stationId)
|
|
|
+ .eq(StationFeeRate::getStatus, true)
|
|
|
+ .one();
|
|
|
+ CommUtil.asserts(res != null, "站点费率配置不存在");
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageBean<StationFeeRate> listStationPlatformFeeRate(PlatformFeeRateQueryParam params) {
|
|
|
+ PageHelper.startPage(params.getPageNum(), params.getPageSize());
|
|
|
+ var res = lambdaQuery()
|
|
|
+ .eq(CommUtil.isNotEmptyAndNull(params.getStationId()), StationFeeRate::getStationId, params.getStationId())
|
|
|
+ .orderByDesc(StationFeeRate::getId)
|
|
|
+ .list();
|
|
|
+ return new PageBean<>(res);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|