From b72094a519b590ccebb805b5ca6906e380dcb566 Mon Sep 17 00:00:00 2001 From: luodangjia <luodangjia> Date: 星期四, 26 九月 2024 16:01:46 +0800 Subject: [PATCH] 9.24 --- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java index ed71ef3..ebaa424 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyController.java @@ -7,6 +7,7 @@ import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; import com.ruoyi.chargingPile.api.model.*; +import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; @@ -25,6 +26,7 @@ import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.log.enums.OperatorType; import com.ruoyi.common.security.utils.SecurityUtils; +import com.ruoyi.integration.api.feignClient.IntegrationClient; import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.feignClient.SysUserClient; import io.swagger.annotations.Api; @@ -100,9 +102,9 @@ /** * 添加计费策略管理 */ - @Log(title = "添加计费策略", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "添加计费策略") @PostMapping(value = "/add") + @Log(title = "【计费策略】添加计费策略", businessType = BusinessType.INSERT) public AjaxResult<Integer> add(@RequestBody TAccountingStrategyDTO dto) { if(null != dto.getSiteId()){ dto.setAuditStatus(3); @@ -110,6 +112,11 @@ Boolean flag = accountingStrategyDetailService.isStrategy24Hour(dto.getAccountingStrategyDetails()); if(flag){ return AjaxResult.error("计费模板时间设置有误差"); + } + // 判断同阶段是否价格不一致 + Boolean flag1 = accountingStrategyDetailService.isStrategyPriceConsistent(dto.getAccountingStrategyDetails()); + if(!flag1){ + return AjaxResult.error("同阶段费率值需一致"); } Long userId = SecurityUtils.getLoginUser().getUserid(); dto.setUserId(userId); @@ -123,13 +130,18 @@ /** * 修改计费策略 */ - @Log(title = "修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) + @Log(title = "【计费策略】修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "修改计费策略") @PostMapping(value = "/update") public AjaxResult<String> update(@RequestBody TAccountingStrategyDTO dto) { Boolean flag = accountingStrategyDetailService.isStrategy24Hour(dto.getAccountingStrategyDetails()); if(flag){ return AjaxResult.error("计费模板时间设置有误差"); + } + // 判断同阶段是否价格不一致 + Boolean flag1 = accountingStrategyDetailService.isStrategyPriceConsistent(dto.getAccountingStrategyDetails()); + if(!flag1){ + return AjaxResult.error("同阶段费率值需一致"); } // 判断修改的计费策略是否为已通过 if(dto.getAuditStatus() == 3 || dto.getAuditStatus() == 4){ @@ -241,7 +253,7 @@ /** * 删除计费策略 */ - @Log(title = "删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) + @Log(title = "【计费策略】删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) @ApiOperation(tags = {"后台-计费策略"},value = "删除计费策略") @DeleteMapping(value = "/deleteById") public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { @@ -260,7 +272,7 @@ /** * 批量删除计费策略 */ - @Log(title = "批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) + @Log(title = "【计费策略】批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) @ApiOperation(tags = {"后台-计费策略"},value = "批量删除计费策略") @DeleteMapping(value = "/deleteByIds") public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { @@ -293,9 +305,12 @@ return AjaxResult.ok(accountingStrategyService.pageList(query)); } + @Resource + private IntegrationClient integrationClient; @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "审核") @PostMapping(value = "/auth/pass") + @Log(title = "【计费模板审核】审核计费模板", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) public AjaxResult<PageInfo<TAccountingStrategyVO>> authPass(@RequestBody SteategyPassDto steategyPassDto) { TAccountingStrategy byId = accountingStrategyService.getById(steategyPassDto.getId()); Long userId = SecurityUtils.getLoginUser().getUserid(); @@ -316,6 +331,24 @@ byId.setAuditStatus(3); byId.setTwoRemark(steategyPassDto.getRemark()); byId.setTwoAuditTime(LocalDateTime.now()); + + //如果parentId不为空,则将parentId对应的siteId改为现在的,并且将parenId对应的数据删除 + if (byId.getParentId()!=null) { + TAccountingStrategy one = accountingStrategyService.lambdaQuery().eq(TAccountingStrategy::getId, byId.getParentId()).one(); + byId.setSiteId(one.getSiteId()); + //将site表对应的模板id修改为新的这个 + Site byId1 = siteService.getById(one.getSiteId()); + byId1.setAccountingStrategyId(byId.getId()); + siteService.updateById(byId1); + } + + //硬件 + List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, byId.getSiteId()).list(); + for (TChargingPile tChargingPile : list) { + integrationClient.setupBillingModel1(tChargingPile.getCode()); + } + + } }else { byId.setAuditStatus(4); @@ -332,6 +365,7 @@ @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "删除") @DeleteMapping(value = "/delete") + @Log(title = "【计费模板审核】删除计费模板审核", businessType = BusinessType.DELETE) public R delete(String ids) { String[] split = ids.split(","); for (String s : split) { @@ -405,5 +439,18 @@ return R.ok(res); } + + + /** + * 根据id查询数据 + * @param id + * @return + */ + @PostMapping(value = "/getAccountingStrategyById") + public R<TAccountingStrategy> getAccountingStrategyById(@RequestParam("id") Integer id) { + TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); + return R.ok(accountingStrategy); + } + } -- Gitblit v1.7.1