l3能源成本分摊(部分完成留存)
This commit is contained in:
@@ -18,12 +18,18 @@ import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.ems.domain.vo.EmsEnergyRateVo;
|
||||
import com.klp.ems.domain.vo.EmsRateTierVo;
|
||||
import com.klp.ems.domain.vo.EmsRateTimePeriodLinkVo;
|
||||
import com.klp.ems.domain.bo.EmsEnergyRateBo;
|
||||
import com.klp.ems.domain.bo.EmsRateTierBo;
|
||||
import com.klp.ems.domain.bo.EmsRateTimePeriodLinkBo;
|
||||
import com.klp.ems.domain.bo.EmsRateTierPeriodLinkBo;
|
||||
import com.klp.ems.service.IEmsEnergyRateService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
* 能源费率
|
||||
* 支持:固定费率、峰谷分时、阶梯电价、峰谷+阶梯组合
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-09-28
|
||||
@@ -86,14 +92,73 @@ public class EmsEnergyRateController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)
|
||||
* 删除能源费率(级联删除梯度和时段费率)
|
||||
*
|
||||
* @param energyRateIds 主键串
|
||||
*/
|
||||
@Log(title = "能源费率(currency 为 INT:0=CNY,1=USD,2=EUR)", businessType = BusinessType.DELETE)
|
||||
@Log(title = "能源费率", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{energyRateIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] energyRateIds) {
|
||||
return toAjax(iEmsEnergyRateService.deleteWithValidByIds(Arrays.asList(energyRateIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取费率的梯度费率列表
|
||||
*/
|
||||
@GetMapping("/{energyRateId}/tiers")
|
||||
public R<List<EmsRateTierVo>> getRateTiers(@NotNull(message = "费率ID不能为空")
|
||||
@PathVariable Long energyRateId) {
|
||||
return R.ok(iEmsEnergyRateService.getRateTiers(energyRateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取费率的时段费率列表
|
||||
*/
|
||||
@GetMapping("/{energyRateId}/timePeriods")
|
||||
public R<List<EmsRateTimePeriodLinkVo>> getRateTimePeriods(@NotNull(message = "费率ID不能为空")
|
||||
@PathVariable Long energyRateId) {
|
||||
return R.ok(iEmsEnergyRateService.getRateTimePeriods(energyRateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存梯度费率,返回保存后的梯度列表(包含tierId)
|
||||
*/
|
||||
@Log(title = "能源费率梯度", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/{energyRateId}/tiers")
|
||||
public R<List<EmsRateTierVo>> saveTiers(@NotNull(message = "费率ID不能为空") @PathVariable Long energyRateId,
|
||||
@RequestBody List<EmsRateTierBo> tiers) {
|
||||
return R.ok(iEmsEnergyRateService.saveTiers(energyRateId, tiers));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存时段费率
|
||||
*/
|
||||
@Log(title = "能源费率时段", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/{energyRateId}/timePeriods")
|
||||
public R<Void> saveTimePeriods(@NotNull(message = "费率ID不能为空") @PathVariable Long energyRateId,
|
||||
@RequestBody List<EmsRateTimePeriodLinkBo> timePeriods) {
|
||||
return toAjax(iEmsEnergyRateService.saveTimePeriods(energyRateId, timePeriods));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取梯度的峰谷时段费率(用于梯度+峰谷组合模式)
|
||||
*/
|
||||
@GetMapping("/{energyRateId}/tier/{tierId}/periods")
|
||||
public R<List<EmsRateTierPeriodLinkBo>> getTierPeriodLinks(@NotNull(message = "费率ID不能为空") @PathVariable Long energyRateId,
|
||||
@NotNull(message = "梯度ID不能为空") @PathVariable Long tierId) {
|
||||
// 返回该梯度对应的所有时段费率
|
||||
return R.ok(iEmsEnergyRateService.getTierPeriodLinks(tierId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存梯度-时段关联费率(用于梯度+峰谷组合模式)
|
||||
*/
|
||||
@Log(title = "梯度-时段关联费率", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/{energyRateId}/tier/{tierId}/periods")
|
||||
public R<Void> saveTierPeriodLinks(@NotNull(message = "费率ID不能为空") @PathVariable Long energyRateId,
|
||||
@NotNull(message = "梯度ID不能为空") @PathVariable Long tierId,
|
||||
@RequestBody List<EmsRateTierPeriodLinkBo> tierPeriodLinks) {
|
||||
return toAjax(iEmsEnergyRateService.saveTierPeriodLinks(tierId, tierPeriodLinks));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user