| | |
| | | if(Objects.isNull(dto.getDiscount())){ |
| | | accountingStrategyService.update(Wrappers.<TAccountingStrategy>lambdaUpdate().set(TAccountingStrategy::getDiscount, null).eq(TAccountingStrategy::getId, dto.getId())); |
| | | } |
| | | // 历史审核通过的策略在替换旧策略后可能仍保留已删除策略的 parentId。 |
| | | // 这类正式策略再次编辑会被改为待审核子记录,并被计费策略列表过滤掉,先将其恢复为主策略。 |
| | | if (original.getParentId() != null && Objects.equals(original.getAuditStatus(), 3) |
| | | && Objects.isNull(accountingStrategyService.getById(original.getParentId()))) { |
| | | accountingStrategyService.update(Wrappers.<TAccountingStrategy>lambdaUpdate() |
| | | .set(TAccountingStrategy::getParentId, null) |
| | | .eq(TAccountingStrategy::getId, original.getId())); |
| | | original.setParentId(null); |
| | | dto.setParentId(null); |
| | | } |
| | | if (original.getParentId() != null) { |
| | | dto.setParentId(original.getParentId()); |
| | | dto.setSiteId(original.getSiteId()); |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/billingTemplateAudit/audit"}, logical = Logical.OR) |
| | | @RequiresPermissions(value = {"/billingTemplateAudit/audit", "/billingTemplateAudit"}, logical = Logical.OR) |
| | | @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(); |
| | | if (byId.getAuditStatus()==1&&byId.getFirstUserId()!=userId){ |
| | | if (byId.getAuditStatus()==1 && !Objects.equals(byId.getFirstUserId(), userId)){ |
| | | return AjaxResult.error("您不是一级审核人员,无法审核"); |
| | | } |
| | | if (byId.getAuditStatus()==2&&byId.getTwoUserId()!=userId){ |
| | | if (byId.getAuditStatus()==2 && !Objects.equals(byId.getTwoUserId(), userId)){ |
| | | return AjaxResult.error("您不是二级审核人员,无法审核"); |
| | | } |
| | | if (steategyPassDto.getPass()==1){ |
| | |
| | | //如果parentId不为空,则将parentId对应的siteId改为现在的,并且将parenId对应的数据删除 |
| | | if (byId.getParentId()!=null) { |
| | | TAccountingStrategy one = accountingStrategyService.getById(byId.getParentId()); |
| | | byId.setSiteId(one.getSiteId()); |
| | | //将site表对应的模板id修改为新的这个 |
| | | List<Site> list = siteService.lambdaQuery().eq(Site::getAccountingStrategyId, one.getId()).list(); |
| | | if(!list.isEmpty()){ |
| | | for (Site site : list) { |
| | | site.setAccountingStrategyId(byId.getId()); |
| | | if (Objects.nonNull(one)) { |
| | | byId.setSiteId(one.getSiteId()); |
| | | //将site表对应的模板id修改为新的这个 |
| | | List<Site> list = siteService.lambdaQuery().eq(Site::getAccountingStrategyId, one.getId()).list(); |
| | | if(!list.isEmpty()){ |
| | | for (Site site : list) { |
| | | site.setAccountingStrategyId(byId.getId()); |
| | | } |
| | | siteService.updateBatchById(list); |
| | | //推送三方平台 |
| | | List<Integer> siteIds = list.stream().filter(s->1 == s.getIsOpenSynchronization()).map(Site::getId).collect(Collectors.toList()); |
| | | if(!siteIds.isEmpty()){ |
| | | tcecClient.notificationStationChange(siteIds); |
| | | } |
| | | } |
| | | siteService.updateBatchById(list); |
| | | //推送三方平台 |
| | | List<Integer> siteIds = list.stream().filter(s->1 == s.getIsOpenSynchronization()).map(Site::getId).collect(Collectors.toList()); |
| | | if(!siteIds.isEmpty()){ |
| | | tcecClient.notificationStationChange(siteIds); |
| | | } |
| | | accountingStrategyService.removeById(one.getId()); |
| | | } |
| | | accountingStrategyService.removeById(one.getId()); |
| | | // 审核通过后当前记录已成为正式策略,不能继续保留旧策略的 parentId。 |
| | | byId.setParentId(null); |
| | | } |
| | | //硬件 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>() |