package com.njcn.harmonic.controller.upload;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.upload.PmsTemProcessTrackParam;
import com.njcn.harmonic.pojo.po.upload.PmsTemProcessTrackPO;
import com.njcn.harmonic.service.upload.IPmsTemProcessTrackService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 电能质量全过程跟踪数据 前端控制器
 * </p>
 *
 * @author cdf
 * @since 2024-10-09
 */
@RestController
@RequestMapping("/process/pmsTemProcessTrack")
@RequiredArgsConstructor
public class PmsTemProcessTrackController extends BaseController {
    
    private final IPmsTemProcessTrackService iPmsTemProcessTrackService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
    @PostMapping("/addTemProcessTrack")
    @ApiOperation("新增用户")
    public HttpResult<Object> addTemProcessTrack(@RequestBody PmsTemProcessTrackParam param) {
        String methodDescribe = getMethodDescribe("addTemProcessTrack");
        Boolean result = iPmsTemProcessTrackService.addTemProcessTrack(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
    @PostMapping("/updateTemProcessTrack")
    @ApiOperation("修改用户")
    public HttpResult<Object> updateTemProcessTrack(@RequestBody PmsTemProcessTrackParam.UpdatePmsTemProcessTrackParam param) {
        String methodDescribe = getMethodDescribe("updateTemProcessTrack");
        Boolean result = iPmsTemProcessTrackService.updateTemProcessTrack(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }



    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
    @PostMapping("/delTemProcessTrack")
    @ApiOperation("删除用户")
    public HttpResult<Object> delTemProcessTrack(@RequestBody List<String> ids) {
        String methodDescribe = getMethodDescribe("delTemProcessTrack");
        Boolean result = iPmsTemProcessTrackService.delTemProcessTrack(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/pageList")
    @ApiOperation("分页查询用户")
    public HttpResult<Page<PmsTemProcessTrackPO>> pageList(@RequestBody PmsTemProcessTrackParam.QueryPmsTemProcessTrackParam param) {
        String methodDescribe = getMethodDescribe("pageList");
        Page<PmsTemProcessTrackPO> result = iPmsTemProcessTrackService.pageList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getById")
    @ApiOperation("根据id获取详情")
    public HttpResult<PmsTemProcessTrackPO> getById(@RequestBody PmsTemProcessTrackParam.QueryPmsTemProcessTrackParam param) {
        String methodDescribe = getMethodDescribe("getById");
        PmsTemProcessTrackPO result = iPmsTemProcessTrackService.getById(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }




    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/upGw")
    @ApiOperation("上送国网")
    public HttpResult<Boolean> upGw(@RequestBody List<String> ids) {
        String methodDescribe = getMethodDescribe("upGw");
        iPmsTemProcessTrackService.upGw(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
    }

}

