鞍钢鲅鱼圈能源管控系统后端代码
liriming
2025-05-22 5afaa78542e9e78346696e4f683f49b7f60bd288
新增修改电价接口
已修改5个文件
35 ■■■■■ 文件已修改
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/power/service/PowerPriceMainService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/power/service/impl/PowerPriceMainServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/鞍钢数据接口文档_dev_li.doc 补丁 | 查看 | 原始文档 | blame | 历史
doc/鞍钢数据接口文档_master.doc 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java
@@ -1227,4 +1227,13 @@
    public CommonResult<Boolean> savePowerPriceList(@RequestBody PowerPriceMainDTO mainDTO) {
        return success(powerPriceMainService.save(mainDTO));
    }
    @PostMapping("/power-price/update")
    @Operation(summary = "修改峰谷平电价信息")
    public CommonResult<Boolean> updatePowerPriceList(@RequestBody PowerPriceMainDTO mainDTO) {
        if("".equals(mainDTO.getId()) || mainDTO.getId() == null) {
            return error(GlobalErrorCodeConstants.BAD_REQUEST);
        }
        return success(powerPriceMainService.update(mainDTO));
    }
}
ansteel-biz/src/main/java/com/iailab/module/ansteel/power/service/PowerPriceMainService.java
@@ -14,4 +14,6 @@
    List<PowerPriceMainDTO> list(Map<String, Object> params);
    Boolean save(PowerPriceMainDTO mainDTO);
    Boolean update(PowerPriceMainDTO mainDTO);
}
ansteel-biz/src/main/java/com/iailab/module/ansteel/power/service/impl/PowerPriceMainServiceImpl.java
@@ -81,4 +81,28 @@
        }
        return true;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean update(PowerPriceMainDTO mainDTO) {
        if (!CollectionUtils.isEmpty(mainDTO.getDetList())) {
            PowerPriceMainEntity powerPriceMainEntity = powerPriceMainDao.selectById(mainDTO.getId());
            powerPriceMainEntity.setCreator(SecurityFrameworkUtils.getLoginUser().getId());
            powerPriceMainEntity.setCreateDate(new Date());
            powerPriceMainDao.updateById(powerPriceMainEntity);
            QueryWrapper queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("main_id", powerPriceMainEntity.getId());
            powerPriceDetDao.delete(queryWrapper);
            for (int i = 0; i < mainDTO.getDetList().size(); i++) {
                PowerPriceDetEntity powerPriceDetEntity = ConvertUtils.sourceToTarget(mainDTO.getDetList().get(i), PowerPriceDetEntity.class);
                powerPriceDetEntity.setMainId(powerPriceMainEntity.getId());
                powerPriceDetEntity.setSort(i + 1);
                powerPriceDetDao.insert(powerPriceDetEntity);
            }
        }
        return true;
    }
}
doc/鞍钢数据接口文档_dev_li.doc
Binary files differ
doc/鞍钢数据接口文档_master.doc
Binary files differ