package com.zd.system.api.laboratory;

import com.zd.common.core.constant.ServiceNameConstants;
import com.zd.common.core.domain.R;
import com.zd.common.core.enums.HardwareOperate;
import com.zd.common.core.web.domain.AjaxResult;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.system.api.domain.Algorithm;
import com.zd.system.api.factory.RemoteLaboratoryFallbackFactory;
import com.zd.system.api.laboratory.domain.*;
import com.zd.system.api.laboratory.domain.vo.LabGradeManageWorkVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 实验室feign调用服务
 *
 * @Author: zhoupan
 * @Date: 2021/09/06/11:28
 * @Description:
 */
@FeignClient(contextId = "remoteLaboratoryService", value = ServiceNameConstants.LABORATORY_SERVICE, fallbackFactory = RemoteLaboratoryFallbackFactory.class)
public interface RemoteLaboratoryService {

    @ApiOperation(value = "批量获取管理实验室数量-根据用户IDS")
    @GetMapping(value = "/subject/count/{ids}")
    public R<List<LabSubjectVO>> getInfoByUserIds(@PathVariable("ids") String ids);

    @ApiOperation(value = "新增随手拍记录")
    @PostMapping("/photonote")
    public R<Object> addPhotoNote(@RequestBody Map<String, Object> labPhotoNote);


    @ApiOperation(value = "小程序查询登录人接收随手拍统计")
    @GetMapping("/photonote/appReceivePhotoNote")
    public R<Object> appReceivePhotoNote(@RequestBody Map<String, Object> photoNote);

    @ApiOperation(value = "获取随手拍记录列表信息（管理端）")
    @GetMapping("/photonote/getAppList")
    public TableDataInfo getAppList(@RequestBody Map appInfo);

    @ApiOperation(value = "查询登录用户是否是实验室管理员（数据权限）")
    @GetMapping("/subject/my/isadmin")
    public R<Object> isadmin(@RequestBody Map<String, Object> map);

    /**
     * 获取随手拍记录详细信息
     */
    @ApiOperation(value = "获取随手拍记录详细信息")
    @GetMapping(value = "/photonote/getPhotonote/{id}")
    public R<Object> getPhotonoteInfo(@PathVariable("id") Long id);

    @ApiOperation(value = "处理随手拍记录")
    @PostMapping("/photonote/appHandle")
    public R<Object> editPhotoNote(@RequestBody Map appInfo);


    @ApiOperation(value = "离开实验室拍照附件列表")
    @GetMapping("/inspection")
    public R<Object> outSubjectPhoto();

    @ApiOperation(value = "获取签到离开的实验室列表")
    @GetMapping("/inspection/outSubjectList")
    public R<Object> outSubjectList();


    @ApiOperation(value = "新增拍照检查附件")
    @PostMapping("/inspection/savaPhotoFj")
    public R<Object> addPhotoInspection(@RequestBody Map<String,Object> labPhotoInspection);


    @ApiOperation(value = "统计安全准入审批不同信息")
    @GetMapping("/approval/getApprovalCount")
    public R<Object> getApprovalCount(@RequestBody Map<String, Object> approval);


    @ApiOperation(value = "查询安全准入审批记录列表")
    @GetMapping("/approval/getApprovalList")
    public TableDataInfo getApprovalList(@RequestBody Map approval);

    @ApiOperation(value = "查询违规记录列表")
    @GetMapping("/violation/mylist")
    public TableDataInfo getViolationList(Map violation);

    @ApiOperation(value = "查询我的违规记录统计")
    @GetMapping("/workbench/myViolationCount")
    public R<Object> myViolationCount(@RequestBody Map violation);

    @ApiOperation(value = "修改违规记录")
    @PutMapping("/violation")
    public R<Object> editViolation(@RequestBody Map<String, Object> params);

    @ApiOperation(value = "查询我的实验室列表")
    @GetMapping("/workbench/mySubjectList")
    public R<Object> mySubjectList(@RequestBody Map subjectMap);

    /**
     * 获取当前用户学生卡和人脸信息
     */
    @ApiOperation(value = "获取当前用户学生卡和人脸信息")
    @GetMapping(value = "/studentinfo/my")
    public R getMyCardInfo();


    /**
     * 查询实验室下的安全准入资格材料列表
     */
    @ApiOperation(value = "查询实验室下的安全准入资格材料列表")
    @GetMapping(value = "/material/subjectMaterialList")
    public R<Object> subjectMaterialList(@RequestBody Map material);

    /**
     * 小程序查询实验室列表（用户端,管理端）
     */
    @ApiOperation(value = "小程序查询实验室列表（用户端,管理端）")
    @GetMapping(value = "/subject/getSubjectDict")
    public R<Object> getSubjectDict();


    /**
     * 黑名单完成学习规则
     */
    @PostMapping(value = "/blacklist/blacklistLearningRules")
    public R<Object> blacklistLearningRules(@RequestBody Map<String,Object> blackdetailMap);
//
//    /**
//     * 负面清单更改状态
//     */
//
//    @GetMapping("/negativeListRecords/LearningRules")
//    public R negativelistLearningRules(@RequestParam Long violationId,
//                                       @RequestParam int status);

    /**
      * 负面清单更改状态
    */
    @GetMapping("/negativeListRecords/LearningRules/{violationId}/{status}")
    public R negativelistLearningRules(@PathVariable("violationId") Long violationId,
                                       @PathVariable("status") int status);


    /**
     * 获取黑名单惩罚时间区间
     */
    @PostMapping(value = "/blacklist/getBlackTimeArea")
    public R<Object> getBlackTimeArea(@RequestBody Map<String,Object> blackdetailMap);


    /**
     * 查询实验室控制数据列表（小程序使用）
     * 按意见修改为 数据权限&负责人权限
     *
     * @return
     */
    @ApiOperation("查询实验室控制数据列表")
    @GetMapping("/subject/manger/list")
    public R queryMyAadminSubCListVO();

    /**
     * 获取安全准入审批记录详细信息
     */
    @ApiOperation(value = "获取安全准入审批记录详细信息")
    @GetMapping(value = "/approval/{ids}")
    public R<Object> approvalDetail(@PathVariable("ids") String ids);

    /**
     * 小程序安全准入资格提交
     */
    @ApiOperation(value = "小程序安全准入资格提交")
    @PostMapping(value = "/approval/accessReview")
    public R<Object> accessReview(@RequestBody Map<String, Object> labApprovalMap);

    /**
     * 安全准入资格审批(管理端)
     */
    @ApiOperation(value = "安全准入资格审批(管理端)")
    @PutMapping(value = "/approval/appOperation")
    public R<Object> appOperation(@RequestBody Map<String, Object> labApprovalMap);

    /**
     * 小程序安全准入资格拒绝审批(管理端)
     */
    @ApiOperation(value = "小程序安全准入资格拒绝审批(管理端)")
    @PutMapping(value = "/approval/failedOperation")
    public R<Object> failedOperation(@RequestBody Map<String, Object> labApprovalMap);

    /**
     * 小程序人脸识别接口
     */
    @ApiOperation(value = "小程序人脸识别接口")
    @PostMapping(value = "/studentinfo/commit/face" , consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<Object> uploadFace(@RequestPart(value = "file") MultipartFile file);


    @GetMapping("/subject/manger/{ids}/SubTotal/")
    public R<List<TotalByID>> queryBuildingSubTotal(@PathVariable("ids") Long[] ids);

    /**
     * 根据用户查询黑名单列表
     */
    @PostMapping("/blacklist/info/{userId}")
    public R<Object> userBlacklist(@PathVariable("userId") Long userId);

    @RequestMapping("/service/mqtt/send/{num}/{hardwareOperate}")
    public R sends(@PathVariable("num") String num, @PathVariable("hardwareOperate") HardwareOperate hardwareOperate);


    /**
     * 定时器定时查询离开时间超过24小时，记违规
     */
    @PutMapping("/record/outTimeRecord")
    public AjaxResult outTimeRecord();


    /**
     * 定时器定时查询预案向一体机推送的消息，如果超过两小时，需要清理
     */
    @PutMapping("/content/outTimeClearMessage")
    public AjaxResult outTimeClearMessage();


    /**
     * 新增消息发布
     */
    @PostMapping("/content")
    public AjaxResult publishMess(@RequestBody LabMessageContent labMessageContent);


    @ApiOperation(value = "查询安全预警列表 （管理端）")
    @GetMapping("/plan/log/app/subBySensorList")
    public TableDataInfo getSafeWarnList(Map riskPlanAbnormalLog);


    /**
     * 查询违规记录统计
     */
    @ApiOperation(value = "查询安全预警统计 （管理端）")
    @GetMapping("/plan/log/app/subBySensorCount")
    public R<Object> getSafeWarnCount();


    @ApiOperation(value = "查询实验室下的预案列表 （管理端）")
    @GetMapping("/plan/log/app/adminSubByRiskPlan")
    public TableDataInfo getSubByRiskPlan(Map riskPlanAbnormalLog);


    @PostMapping("/algorithm/save")
    public R saveData(Algorithm algorithm);

    /**
     * 小程序查询实验室列表（用户端,管理端）
     */
    @ApiOperation(value = "小程序查询实验室列表（用户端,管理端）")
    @RequestMapping(value = "/subject/check/{id}")
    R<Map<Object, Object>> getCheckInfo(@PathVariable("id") Long id);

    @PostMapping("/violation/userexist/{userId}")
    public R userexist(@PathVariable("userId") Long userId);

    @GetMapping("/violation/userInfo")
    public R getPersonInfo();


    /**
     * 获取违规时间段
     * @param violationId
     * @return
     */
    @GetMapping("/negativeListRecords/getViolationTime")
    public R getViolationTime(Long violationId);

//    /**
//     * 获取做题数量和准确率
//     * @param violationId
//     * @return
//     */
//    @GetMapping("/negativeListRecords/getpracticenum")
//    public R getPracticeNum(@RequestParam Long violationId);


    /**
     * 获取做题数量和准确率
     * @param violationId
     * @return
     */
    @GetMapping("/negativeListRecords/getpracticenum/{violationId}")
    public R getPracticeNum(@PathVariable("violationId") Long violationId);

    /*@GetMapping("/violation/historyList")
    @ApiOperation(value = "查询违规记录列表")
    public TableDataInfo violationhistoryList(@RequestParam(defaultValue = "-1") String overStatus,
                                              @RequestParam(defaultValue = "") String statTime,
                                              @RequestParam(defaultValue = "") String endTime);*/



    @ApiOperation(value = "小程序安全检查记录-按时间分组")
    @GetMapping("/checkRecord/listGroupBy")
    public R<Object> listGroupBy(@RequestBody Map<String, Object> map);

    @ApiOperation(value = "小程序安全检查（根据房间号查询实验室信息）")
    @GetMapping("/checkRecord/selectInfoByRoom")
    public R<Object> selectInfoByRoom(@RequestBody Map<String, Object> map);

    @ApiOperation(value = "小程序安全检查 草稿保存")
    @PostMapping("/checkRecord/addCg")
    public R<Object> addCg(@RequestBody Map<String, Object> map);

    @ApiOperation(value = "小程序安全检查保存")
    @PostMapping("/checkRecord/addTj")
    public R<Object> addTj(@RequestBody Map<String, Object> map);

    @ApiOperation(value = "根据检查项获取 隐患整改集合")
    @GetMapping("/checkRecord/recordDettailsList")
    public R<Object> recordDettailsList(@PathVariable("id") Integer id);

    @ApiOperation(value = "小程序安全检查修改")
    @PostMapping("/checkRecord/edit")
    public R<Object> editCheckRecord(@RequestBody Map<String, Object> map);

    @ApiOperation(value = "修改安全检查隐患列表")
    @PostMapping("/checkRecordDetails/editList")
    public R<Object> editCheckRecordDetailsList(@RequestBody Map<String, Object> map);

    @ApiOperation(value = "根据用户id查询用户信息")
    @GetMapping("/user/info/id/{id}")
    public R<Object> selectUserInfoById(@PathVariable("id") Long id);

    /**
     * 小程序单个 生成整改通知书
     */
    @ApiOperation(value = "生成整改通知书")
    @GetMapping("/checkOption/genNotice/{id}")
    public void genNotice(@PathVariable("id") Long id, HttpServletResponse response);

    /**
     * 小程序单个 生成整改报告
     */
    @ApiOperation(value = "生成整改报告")
    @GetMapping("/checkOption/genReport/{id}")
    public void genReport(@PathVariable("id") Long id, HttpServletResponse response);

    /**
     * 根据楼层获取喇叭列表
     */
    @ApiOperation(value = "根据楼层获取喇叭列表")
    @RequestMapping("/sparseHardware/getSpeakerByFloor/{floorId}")
    public R<Object> getSpeakerByFloor(@PathVariable("floorId") Long floorId);

    /**
     * 根据楼层获取喇叭列表
     */
    @ApiOperation(value = "根据楼层获取喇叭列表")
    @RequestMapping("/sparseHardware/getSpeaker/{floorId}/{subId}")
    public R<Object> getSpeakerBySub(@PathVariable("floorId") Long floorId, @PathVariable("subId") Long subId);

    /**
     * 定时任务分级管控工作过期记录 - 并排列下次工作计划
     */
    @ApiOperation(value = "定时任务分级管控工作过期记录 - 并排列下次工作计划")
    @GetMapping(value = "/gradeManageRecord/workArrange")
    public void workArrange();

    /**
     * 定时任务 早8点 管控工作逾期通知
     */
    @ApiOperation(value = "定时任务 早8点管控工作逾期通知")
    @GetMapping(value = "/gradeManageRecord/workOverdue")
    public void workOverdue();

    /**
     * 定时任务 下午7点 天管控工作执行通知
     */
    @ApiOperation(value = "定时任务 下午7点 管控工作执行通知")
    @GetMapping(value = "/gradeManageRecord/workExecuteByDay")
    public void workExecuteByDay();

    /**
     * 定时任务 早8点 其他管控工作执行通知
     */
    @ApiOperation(value = "定时任务 早8点 管控工作执行通知")
    @GetMapping(value = "/gradeManageRecord/workExecute")
    public void workExecute();

    /**
     * 查询分级管控未完成工作列表
     */
    @PostMapping("/gradeManageWork/havingList")
    @ApiOperation(value = "查询分级管控未完成工作列表")
    public R<List<LabGradeManageWorkVO>> havingList(@RequestBody LabGradeManageRecord labGradeManageRecord);

    /**
     * 查询分级管控已完成工作列表
     */
    @PostMapping("/gradeManageWork/finishList")
    @ApiOperation(value = "查询分级管控已完成工作列表")
    public R<List<LabGradeManageWorkVO>> finishList(@RequestBody LabGradeManageRecord labGradeManageRecord);

    @ApiOperation(value = "完成分级管控工作")
    @PostMapping(value = "/gradeManageWork/finish")
    public R<LabGradeManageRecord> finish(@RequestBody LabGradeManageRecord labGradeManageRecord);

    /**
     * 获取分级管控工作详细信息
     */
    @ApiOperation(value = "获取分级管控工作详细信息")
    @GetMapping(value = "/gradeManageWork/{id}")
    public R<LabGradeManageRecord> getInfo(@PathVariable("id") Long id);

    @PostMapping(value = "/gradeManageWork/queryByMessage")
    public R<LabGradeManageWorkVO> queryByMessage(@RequestBody LabGradeManageRecord labGradeManageRecord);

    /**
     * 安全检查隐患项未整改逾期通知
     */
    @ApiOperation(value = "安全检查隐患项未整改逾期通知")
    @GetMapping(value = "/checkRecord/checkSendMsgBeOverdue")
    public void checkSendMsgBeOverdue();

    /**
     * 一体机logo修改通知
     */
    @ApiOperation(value = "一体机logo修改通知")
    @GetMapping(value = "/onemachine/logoNotice")
    public void logoNotice();

    @PostMapping("/subject/manger/controlByInside")
    public Object controlByInside(@RequestParam("id") Long id ,@RequestParam("type") String type);


    /**
     * 查询机柜绑定柜锁列表
     */
    @ApiOperation(value = "查询机柜绑定柜锁列表")
    @PostMapping("/hardware/getHardwareByLockList")
    R<List <LinkedHashMap <String,String>>> getHardwareByLockList(@RequestBody Map allMap);

    /**
     * 查询识别器管理列表
     */
    @GetMapping("/hardware/list/start")
    @ApiOperation(value = "查询识别器管理列表")
    R<List<RemoteLabHardware>> listStart();

    @PostMapping("/hardware/remote/list")
    R<List<RemoteLabHardware>> remoteList(@RequestBody RemoteLabHardware remoteLabHardware);

    /**
     * 修改识别器状态
     */
    @ApiOperation(value = "修改识别器状态")
    @PutMapping("/hardware/update")
    R<Integer> update(@RequestParam("operate") HardwareOperate operate, @RequestParam("ipAddress") String ipAddress);
}
