| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.Device; |
| | | import com.doumee.dao.business.model.YwElectrical; |
| | | import com.doumee.dao.business.model.YwElectricalData; |
| | | import com.doumee.dao.business.dto.YwElectricalEditDTO; |
| | | import com.doumee.dao.business.dto.YwElectricalOperateDTO; |
| | | import com.doumee.service.business.YwElectricalBizService; |
| | | import com.doumee.service.business.YwElectricalService; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | /** |
| | | * 电表设备信息 |
| | | * @author renkang |
| | | * @date 2026/04/03 |
| | | * 电表设备信息Controller定义 |
| | | * @author doumee |
| | | * @date 2026-05-20 15:21:43 |
| | | */ |
| | | @Api(tags = "电表设备信息") |
| | | @Api(tags = "yw_electrical接口") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX + "/business/ywElectrical") |
| | | public class YwElectricalCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private YwElectricalService ywElectricalService; |
| | | |
| | | @Autowired |
| | | private YwElectricalBizService ywElectricalBizService; |
| | | @PreventRepeat |
| | | @ApiOperation("全量同步电表设备接口") |
| | | @PostMapping("/syncAll") |
| | | @CloudRequiredPermission("business:ywelectrical:device") |
| | | public ApiResponse syncHkDevices(@RequestBody YwElectrical ywElectricalData, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | ywElectricalData.setLoginUserInfo(this.getLoginUser(token)); |
| | | String result = ywElectricalService.syncAll(ywElectricalData); |
| | | return ApiResponse.success(result); |
| | | } |
| | | @ApiOperation("执行电表开关闸操作") |
| | | @PostMapping("/controlDo") |
| | | @CloudRequiredPermission("business:ywelectrical:update") |
| | | public ApiResponse controlDo(@RequestBody Device param, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ |
| | | param.setLoginUserInfo(this.getLoginUser(token)); |
| | | ywElectricalService.controlDo(param); |
| | | return ApiResponse.success(null); |
| | | } |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:ywelectrical:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String[] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | ywElectricalService.deleteByIdInBatch(idList, this.getLoginUser(token)); |
| | | ywElectricalService.deleteByIdInBatch(this.getIdList(ids), this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | return ApiResponse.success(ywElectricalService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywelectrical:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<YwElectrical> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | ExcelExporter.build(YwElectrical.class).export(ywElectricalService.findPage(pageWrap).getRecords(), "电表设备信息", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywelectrical:query") |
| | |
| | | return ApiResponse.success(ywElectricalService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywelectrical:exportExcel") |
| | | public void exportExcel(@RequestBody PageWrap<YwElectrical> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | ExcelExporter.build(YwElectrical.class).export(ywElectricalService.findPage(pageWrap).getRecords(), "电表设备信息", response); |
| | | @ApiOperation("编辑详情") |
| | | @GetMapping("/detail/{id}") |
| | | @CloudRequiredPermission("business:ywelectrical:update") |
| | | public ApiResponse<YwElectricalEditDTO> detail(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywElectricalBizService.getDetail(id)); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("保存编辑") |
| | | @PostMapping("/saveDetail") |
| | | @CloudRequiredPermission("business:ywelectrical:update") |
| | | public ApiResponse saveDetail(@RequestBody YwElectricalEditDTO dto, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywElectricalBizService.updateDetail(dto, this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("远程控制信息") |
| | | @GetMapping("/remoteInfo/{id}") |
| | | @CloudRequiredPermission("business:ywelectrical:update") |
| | | public ApiResponse remoteInfo(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywElectricalBizService.getRemoteInfo(id)); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("远程操作") |
| | | @PostMapping("/operate") |
| | | @CloudRequiredPermission("business:ywelectrical:update") |
| | | public ApiResponse<String> operate(@RequestBody YwElectricalOperateDTO dto, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywElectricalBizService.operate(dto, this.getLoginUser(token))); |
| | | } |
| | | } |