package com.ruoyi.web.controller.info;

import java.util.List;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;

import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.info.operating.domain.vo.OperatingPhoneVo;
import com.ruoyi.info.operating.domain.bo.OperatingPhoneBo;
import com.ruoyi.info.operating.service.IOperatingPhoneService;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiOperation;

/**
 * 服务电话Controller
 *
 * @author baifc
 * @date 2025-09-28
 */
@Validated
@Api(value = "服务电话控制器", tags = {"服务电话管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/info/operatingPhone")
public class OperatingPhoneController extends BaseController {

    private final IOperatingPhoneService iOperatingPhoneService;


    /**
     * 分页查询服务电话列表
     */
    @ApiOperation("查询服务电话列表")
    @SaCheckPermission("info:operatingPhone:list")
    @GetMapping("/list")
    public R<List<OperatingPhoneVo>> list() {
        return R.ok(iOperatingPhoneService.queryList(new OperatingPhoneBo()));
    }

    /**
     * 服务电话列表批量编辑
     */
    @ApiOperation("服务电话列表批量编辑")
    @SaCheckPermission("info:operatingPhone:edit")
    @GetMapping("/batchEdit")
    public R<Void> batchEdit(@RequestBody List<OperatingPhoneBo> boList) {
        // 批量修改服务电话
        iOperatingPhoneService.batchEdit(boList);
        return R.ok();
    }

//    /**
//     * 分页查询服务电话列表
//     */
//    @ApiOperation("查询服务电话列表")
//    @SaCheckPermission("info:operatingPhone:list")
//    @GetMapping("/page")
//    public TableDataInfo<OperatingPhoneVo> page(@Validated(QueryGroup.class) OperatingPhoneBo bo, PageQuery pageQuery) {
//        return iOperatingPhoneService.queryPageList(bo, pageQuery);
//    }
//
//    /**
//     * 获取服务电话详细信息
//     */
//    @ApiOperation("获取服务电话详细信息")
//    @SaCheckPermission("info:operatingPhone:query")
//    @GetMapping("/info/{id}")
//    public R<OperatingPhoneVo> getInfo(@ApiParam("主键")
//                                                  @NotNull(message = "主键不能为空")
//                                                  @PathVariable("id") Long id) {
//        return R.ok(iOperatingPhoneService.queryById(id));
//    }
//
//    /**
//     * 新增服务电话
//     */
//    @ApiOperation("新增服务电话")
//    @SaCheckPermission("info:operatingPhone:add")
//    @Log(title = "服务电话", businessType = BusinessType.INSERT)
//    @RepeatSubmit()
//    @PostMapping("/add")
//    public R<Void> add(@Validated(AddGroup.class) @RequestBody OperatingPhoneBo bo) {
//        return toAjax(iOperatingPhoneService.insertByBo(bo) ? 1 : 0);
//    }
//
//    /**
//     * 修改服务电话
//     */
//    @ApiOperation("修改服务电话")
//    @SaCheckPermission("info:operatingPhone:edit")
//    @Log(title = "服务电话", businessType = BusinessType.UPDATE)
//    @RepeatSubmit()
//    @PostMapping("/edit")
//    public R<Void> edit(@Validated(EditGroup.class) @RequestBody OperatingPhoneBo bo) {
//        return toAjax(iOperatingPhoneService.updateByBo(bo) ? 1 : 0);
//    }
//
//    /**
//     * 删除服务电话
//     */
//    @ApiOperation("删除服务电话")
//    @SaCheckPermission("info:operatingPhone:remove")
//    @Log(title = "服务电话", businessType = BusinessType.DELETE)
//    @PostMapping("/del/{ids}")
//    public R<Void> remove(@ApiParam("主键串")
//                                       @NotEmpty(message = "主键不能为空")
//                                       @PathVariable Long[] ids) {
//        return toAjax(iOperatingPhoneService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
//    }
//
//    /**
//     * 导出服务电话列表
//     */
//    @ApiOperation("导出服务电话列表")
//    @SaCheckPermission("info:operatingPhone:export")
//    @Log(title = "服务电话", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(@Validated OperatingPhoneBo bo, HttpServletResponse response) {
//        List<OperatingPhoneVo> list = iOperatingPhoneService.queryList(bo);
//        ExcelUtil.exportExcel(list, "服务电话", OperatingPhoneVo.class, response);
//    }

}
