| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | 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; |
| | |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.SteategyPassDto; |
| | | import com.ruoyi.common.core.enums.status.AppUserStatusEnum; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.feignClient.TCECClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.core.context.SecurityContextHolder.getUserId; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2024-08-06 |
| | | */ |
| | | @Api(tags = "计费策略") |
| | | |
| | | @RestController |
| | | @RequestMapping("/t-accounting-strategy") |
| | | public class TAccountingStrategyController { |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private IntegrationClient integrationClient; |
| | | |
| | | @Resource |
| | | private TCECClient tcecClient; |
| | | |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | |
| | | /** |
| | | * 查询计费策略列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/site/add", "/site/update", "/site/accounting_strategy", "/chargingPile/add_charging_gun", "/chargingPile/accountingStrategy", |
| | | "/chargingGun/update", "/accountingStrategy"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "查询计费策略分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TAccountingStrategyVO>> pageList(@RequestBody TAccountingStrategyQuery query) { |
| | |
| | | /** |
| | | * 查询计费策略明细列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/billingTemplateAudit/info", "/site/accounting_strategy", "/chargingGun/select_rate", "/accountingStrategy", |
| | | "/accountingStrategy/select", "/accountingStrategy/update"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理", "管理后台-充电桩信息"},value = "查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailByStrategyId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam("strategyId") Integer strategyId) { |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryAccountingStrategyDetailByStrategyId(strategyId); |
| | | List<TAccountingStrategyDetailVO> list = accountingStrategyDetailService.queryMangementAccountingStrategyDetailByStrategyId(strategyId); |
| | | list.forEach(detail -> { |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getElectrovalence())); |
| | | detail.setTotalPrice(detail.getElectrovalence().add(detail.getServiceCharge())); |
| | | }); |
| | | return AjaxResult.ok(list); |
| | | } |
| | |
| | | /** |
| | | * 添加计费策略管理 |
| | | */ |
| | | @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); |
| | | } |
| | | 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); |
| | | accountingStrategyService.save(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | // TODO 硬件 同步策略到充电桩 |
| | | if(null != dto.getSiteId()){ |
| | | //下发硬件数据 |
| | | List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, dto.getSiteId()).eq(TChargingPile::getDelFlag, 0).list(); |
| | | for (TChargingPile tChargingPile : list) { |
| | | integrationClient.setupBillingModel1(tChargingPile.getCode(), JSON.toJSONString(dto.getAccountingStrategyDetails())); |
| | | } |
| | | } |
| | | return AjaxResult.ok(dto.getId()); |
| | | } |
| | | |
| | | /** |
| | | * 修改计费策略 |
| | | */ |
| | | @Log(title = "修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @RequiresPermissions(value = {"/accountingStrategy/update"}, logical = Logical.OR) |
| | | @Log(title = "【计费策略】修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "修改计费策略") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAccountingStrategyDTO dto) { |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, dto.getId())); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> detail.setAccountingStrategyId(dto.getId())); |
| | | // TODO 硬件 同步策略到充电桩 |
| | | return AjaxResult.ok(accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails())); |
| | | 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(Objects.isNull(dto.getDiscount())){ |
| | | accountingStrategyService.update(Wrappers.<TAccountingStrategy>lambdaUpdate().set(TAccountingStrategy::getDiscount, null).eq(TAccountingStrategy::getId, dto.getId())); |
| | | } |
| | | // 判断修改的计费策略是否为已通过 |
| | | if(null != dto.getAuditStatus() && (dto.getAuditStatus() == 3 || dto.getAuditStatus() == 4)){ |
| | | // 查询是否有下级审核中的策略 |
| | | TAccountingStrategy children = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getParentId, dto.getId()) |
| | | .ne(TAccountingStrategy::getAuditStatus, Arrays.asList(3,4))); |
| | | if(Objects.nonNull(children)){ |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId())); |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | }else { |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | | dto.setUserId(userId); |
| | | dto.setAuditStatus(1); |
| | | dto.setParentId(dto.getId()); |
| | | dto.setId(null); |
| | | accountingStrategyService.save(dto); |
| | | // 添加明细 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = dto.getAccountingStrategyDetails(); |
| | | accountingStrategyDetails.forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(accountingStrategyDetails); |
| | | } |
| | | }else { |
| | | // 删除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, dto.getId())); |
| | | dto.setAuditStatus(1); |
| | | accountingStrategyService.updateById(dto); |
| | | // 添加明细 |
| | | dto.getAccountingStrategyDetails().forEach(detail -> { |
| | | detail.setAccountingStrategyId(dto.getId()); |
| | | detail.setId(null); |
| | | }); |
| | | accountingStrategyDetailService.saveBatch(dto.getAccountingStrategyDetails()); |
| | | } |
| | | |
| | | if(null != dto.getSiteId()){ |
| | | //下发硬件数据 |
| | | List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, dto.getSiteId()).eq(TChargingPile::getDelFlag, 0).list(); |
| | | for (TChargingPile tChargingPile : list) { |
| | | integrationClient.setupBillingModel1(tChargingPile.getCode(), JSON.toJSONString(dto.getAccountingStrategyDetails())); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 查看计费策略详情 |
| | | */ |
| | | @RequiresPermissions(value = {"/site/accounting_strategy", "/accountingStrategy/select", "/accountingStrategy/update"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TAccountingStrategyVO> getDetailById(@RequestParam("id") Integer id) { |
| | |
| | | TAccountingStrategyVO accountingStrategyVO = new TAccountingStrategyVO(); |
| | | BeanUtils.copyProperties(accountingStrategy,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | String firstUserName = sysUserClient.getSysUser(accountingStrategy.getFirstUserId()).getData().getNickName(); |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | if(null != accountingStrategy.getFirstUserId()){ |
| | | String firstUserName = sysUserClient.getSysUser(accountingStrategy.getFirstUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | } |
| | | if(null != accountingStrategy.getTwoUserId()){ |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | return AjaxResult.ok(accountingStrategyVO); |
| | | } |
| | | |
| | | /** |
| | | * 查看计费策略详情-修改后 |
| | | */ |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情修改后children的数据") |
| | | @GetMapping(value = "/getDetailChildrenById") |
| | | public AjaxResult<TAccountingStrategyVO> getDetailChildrenById(@RequestParam("id") Integer id) { |
| | | TAccountingStrategyVO accountingStrategyVO = new TAccountingStrategyVO(); |
| | | // 先查询children对象 |
| | | TAccountingStrategy children = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getParentId, id) |
| | | .orderByDesc(TAccountingStrategy::getCreateTime) |
| | | .last("LIMIT 1")); |
| | | if(Objects.nonNull(children)){ |
| | | BeanUtils.copyProperties(children,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | if(null != children.getFirstUserId()){ |
| | | String firstUserName = sysUserClient.getSysUser(children.getFirstUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | } |
| | | if(null != children.getTwoUserId()){ |
| | | String twoUserName = sysUserClient.getSysUser(children.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | if(null != children.getUserId()){ |
| | | String userName = sysUserClient.getSysUser(children.getUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId()))); |
| | | }else { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(id); |
| | | BeanUtils.copyProperties(accountingStrategy,accountingStrategyVO); |
| | | // 查询用户信息 |
| | | if(null != accountingStrategy.getFirstUserId()){ |
| | | String firstUserName = sysUserClient.getSysUser(accountingStrategy.getFirstUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setFirstUserName(firstUserName); |
| | | } |
| | | if(null != accountingStrategy.getTwoUserId()){ |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | TAccountingStrategy accountingStrategy1 = accountingStrategyService.getById(id); |
| | | if(null != accountingStrategy1.getUserId()){ |
| | | String userName = sysUserClient.getSysUser(accountingStrategy1.getUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id))); |
| | | } |
| | | return AjaxResult.ok(accountingStrategyVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除计费策略 |
| | | */ |
| | | @Log(title = "删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @RequiresPermissions(value = {"/accountingStrategy/del"}, logical = Logical.OR) |
| | | @Log(title = "【计费策略】删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "删除计费策略") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) { |
| | | // 判断策略是否在使用 |
| | | long count = siteService.count(Wrappers.lambdaQuery(Site.class) |
| | | .eq(Site::getAccountingStrategyId, id)); |
| | | if(count>0){ |
| | | return AjaxResult.error("该计费策略正在使用中,无法删除"); |
| | | } |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id)); |
| | |
| | | /** |
| | | * 批量删除计费策略 |
| | | */ |
| | | @Log(title = "批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @RequiresPermissions(value = {"/accountingStrategy/del"}, logical = Logical.OR) |
| | | @Log(title = "【计费策略】批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "批量删除计费策略") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | // 判断策略是否在使用 |
| | | long count = siteService.count(Wrappers.lambdaQuery(Site.class) |
| | | .in(Site::getAccountingStrategyId, Arrays.asList(split))); |
| | | if(count>0){ |
| | | return AjaxResult.error("该计费策略正在使用中,无法删除"); |
| | | } |
| | | // 刪除计费策略明细信息 |
| | | accountingStrategyDetailService.remove(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .in(TAccountingStrategyDetail::getAccountingStrategyId, Arrays.asList(split))); |
| | |
| | | List<TAccountingStrategyVO> list = accountingStrategyService.getPlatformAccountingStrategy(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/billingTemplateAudit"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "查询计费审核分页列表") |
| | | @PostMapping(value = "/auth/pageList") |
| | | public AjaxResult authPageList(@RequestBody TAccountingStrategyQuery query) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | Page<TAccountingStrategy> page = accountingStrategyService.lambdaQuery() |
| | | .in(TAccountingStrategy::getFirstUserId, userid) |
| | | .or().in(TAccountingStrategy::getTwoUserId, userid) |
| | | .page(Page.of(query.getPageCurr(), query.getPageSize())); |
| | | public AjaxResult<PageInfo<TAccountingStrategyVO>> authPageList(@RequestBody TAccountingStrategyQuery query) { |
| | | |
| | | List<TAccountingStrategy> records = page.getRecords(); |
| | | for (TAccountingStrategy record : records) { |
| | | if (record.getAuditStatus()==2){ |
| | | if (record.getFirstUserId().equals(userid)){ |
| | | record.setAuditStatus(3); |
| | | return AjaxResult.ok(accountingStrategyService.pageList1(query)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/billingTemplateAudit/audit"}, 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){ |
| | | return AjaxResult.error("您不是一级审核人员,无法审核"); |
| | | } |
| | | if (byId.getAuditStatus()==2&&byId.getTwoUserId()!=userId){ |
| | | return AjaxResult.error("您不是二级审核人员,无法审核"); |
| | | } |
| | | if (steategyPassDto.getPass()==1){ |
| | | if (byId.getAuditStatus()==1){ |
| | | |
| | | byId.setAuditStatus(2); |
| | | byId.setFirstRemark(steategyPassDto.getRemark()); |
| | | byId.setFirstAuditTime(LocalDateTime.now()); |
| | | |
| | | }else if (byId.getAuditStatus()==2){ |
| | | 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修改为新的这个 |
| | | List<Site> list = siteService.lambdaQuery().eq(Site::getAccountingStrategyId, one.getId()).list(); |
| | | for (Site site : list) { |
| | | site.setAccountingStrategyId(byId.getId()); |
| | | } |
| | | siteService.updateBatchById(list); |
| | | accountingStrategyService.removeById(one.getId()); |
| | | |
| | | //推送三方平台 |
| | | List<Integer> siteIds = list.stream().map(Site::getId).collect(Collectors.toList()); |
| | | tcecClient.notificationStationChange(siteIds); |
| | | |
| | | } |
| | | //硬件 |
| | | |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId.getId())); |
| | | List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, byId.getSiteId()).list(); |
| | | for (TChargingPile tChargingPile : list) { |
| | | integrationClient.setupBillingModel1(tChargingPile.getCode(), JSON.toJSONString(accountingStrategyDetails)); |
| | | } |
| | | } |
| | | }else { |
| | | if (byId.getAuditStatus()==1){ |
| | | |
| | | byId.setFirstRemark(steategyPassDto.getRemark()); |
| | | |
| | | }else if (byId.getAuditStatus()==2){ |
| | | byId.setTwoRemark(steategyPassDto.getRemark()); |
| | | byId.setTwoAuditTime(LocalDateTime.now()); |
| | | } |
| | | |
| | | byId.setAuditStatus(4); |
| | | } |
| | | return AjaxResult.ok(accountingStrategyService.pageList(query)); |
| | | accountingStrategyService.updateById(byId); |
| | | |
| | | return AjaxResult.success(); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "删除") |
| | | @DeleteMapping(value = "/delete") |
| | | @Log(title = "【计费模板审核】删除计费模板审核", businessType = BusinessType.DELETE) |
| | | public R delete(String ids) { |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | accountingStrategyService.removeById(s); |
| | | } |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |