package com.steerinfo.meterwork.meterworkcheckfirstactual.controller;

import com.steerinfo.framework.controller.BaseRESTfulController;
import com.steerinfo.framework.controller.RESTfulResult;
import com.steerinfo.framework.service.pagehelper.PageList;
import com.steerinfo.framework.utils.collection.ListUtils;
import com.steerinfo.meterwork.except.MarkerMetException;
import com.steerinfo.meterwork.meterworkcaractualfirst.model.MeterWorkCarActualFirst;
import com.steerinfo.meterwork.meterworkcheckfirstactual.model.*;
import com.steerinfo.meterwork.meterworkcheckfirstactual.service.IMeterWorkCheckFirstActualService;
import com.steerinfo.meterwork.meterworkdatacount.model.RailwayActualGrossWeightComparison;
import com.steerinfo.meterwork.meterworkshiftreportgroup.model.MeterWorkShiftReportGroup;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/**
 * MeterWorkCheckFirstActual RESTful接口：
 * @author generator
 * @version 1.0-SNAPSHORT 2022-12-23 04:50
 * 类描述
 * 修订历史：
 * 日期：2022-12-23
 * 作者：generator
 * 参考：
 * 描述：MeterWorkCheckFirstActual RESTful接口
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@RestController
@RequestMapping("/${api.version}/meterworkcheckfirstactuals")
public class MeterWorkCheckFirstActualController extends BaseRESTfulController {

    @Autowired
    IMeterWorkCheckFirstActualService meterWorkCheckFirstActualService;

    @ApiOperation(value="获取列表", notes="分页查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcheckfirstactual:view")
    @GetMapping(value = "/")
    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
        PageList<MeterWorkCheckFirstActual> list = meterWorkCheckFirstActualService.queryForPage(parmas, pageNum, pageSize);
        return success(list);
    }

    @ApiOperation(value="获取列表", notes="分页模糊查询")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcheckfirstactual:view")
    @GetMapping(value = "/like/")
    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
        PageList<MeterWorkCheckFirstActual> list = meterWorkCheckFirstActualService.queryLikeForPage(parmas, pageNum, pageSize);
        return success(list);
    }

    @ApiOperation(value="创建", notes="根据MeterWorkCheckFirstActual对象创建")
    @ApiImplicitParam(name = "meterWorkCheckFirstActual", value = "详细实体meterWorkCheckFirstActual", required = true, dataType = "MeterWorkCheckFirstActual")
    //@RequiresPermissions("meterworkcheckfirstactual:create")
    @PostMapping(value = "/")
    public RESTfulResult add(@ModelAttribute MeterWorkCheckFirstActual model){
        MeterWorkCheckFirstActual meterWorkCheckFirstActual = meterWorkCheckFirstActualService.add(model);
        return success(meterWorkCheckFirstActual);
    }

    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
    //@RequiresPermissions("meterworkcheckfirstactual:view")
    @GetMapping(value = "/{id}")
    public RESTfulResult get(@PathVariable String id){
        MeterWorkCheckFirstActual meterWorkCheckFirstActual = meterWorkCheckFirstActualService.getById(id);
        return success(meterWorkCheckFirstActual);
    }

    @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象，并根据传过来的meterWorkCheckFirstActual信息来更新详细信息")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
        @ApiImplicitParam(name = "meterWorkCheckFirstActual", value = "详细实体meterWorkCheckFirstActual", required = true, dataType = "MeterWorkCheckFirstActual")
    })
    //@RequiresPermissions("meterworkcheckfirstactual:update")
    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
    public RESTfulResult update(@PathVariable String id, @RequestBody MeterWorkCheckFirstActual model){
        model.setId(id);
        MeterWorkCheckFirstActual meterWorkCheckFirstActual = meterWorkCheckFirstActualService.modify(model);
        return success(meterWorkCheckFirstActual);
    }

    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
    //@RequiresPermissions("meterworkcheckfirstactual:delete")
    @DeleteMapping(value = "/{id}")//String
    public RESTfulResult delete(@PathVariable String id){
    	List<String> list = Arrays.asList(id.split(","));
    	if(ListUtils.isNotEmpty(list)) {
	    	List<String> ids = ListUtils.convertList(list);
			  meterWorkCheckFirstActualService.delete(ids);
    	}
      return success();
    }

    @ApiOperation(value="新增数据配置", notes="新增数据配置")
    @PostMapping(value = "/addModel")
    public RESTfulResult addModel(@RequestBody MeterWorkCheckFirstActual model){
        RESTfulResult rm = meterWorkCheckFirstActualService.addModel(model);
        return rm;
    }

    @ApiOperation(value = "汽车衡一次计量和结净数据图片与数据核查-获取列表",
                notes = "不分页模糊查询；关键词：startTime、endTime、typeNo（001002001：汽车衡、001019001：静态轨道衡、001019002:动态轨道衡、001019003:静态铁水轨道衡、001019004:动态铁水轨道衡、001019005:吊钩秤）" +
                    "、typeName、valueFlag：0:一次数据、1:净重数据")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/carFirstActualImgDataList")
    public RESTfulResult carFirstImgDataList(@RequestBody(required = false) HashMap parmas) {
        try {
            List<HashMap> list = meterWorkCheckFirstActualService.carFirstActualImgDataList(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "汽车衡净重数据核查数统计-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、baseSpotNo、baseSpotName")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/carActualCountCheckNum")
    public RESTfulResult carActualCountCheckNum(@RequestBody HashMap parmas) {
        try {
            PageList<CarActualCountCheckNum> list = meterWorkCheckFirstActualService.carActualCountCheckNum(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "汽车衡一次数据核查数统计-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、baseSpotNo、baseSpotName")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/carFirstCountCheckNum")
    public RESTfulResult carFirstCountCheckNum(@RequestBody HashMap parmas) {
        try {
            PageList<CarFirstCountCheckNum> list = meterWorkCheckFirstActualService.carFirstCountCheckNum(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "一次数据和结净数据核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、checkId、typeNo、valueFlag")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/likeByDesc")
    public RESTfulResult likeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<MeterWorkCheckFirstActualTemp> list = meterWorkCheckFirstActualService.likeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "汽车衡一次数据核查明细核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/carFirstLikeByDesc")
    public RESTfulResult carFirstLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<CarFirstCountCheckNum> list = meterWorkCheckFirstActualService.carFirstLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "汽车衡净重数据核查明细核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/carActualLikeByDesc")
    public RESTfulResult carActualLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<CarActualCountCheckNum> list = meterWorkCheckFirstActualService.carActualLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "静态轨道衡一次计量和结净数据图片与数据核查-获取列表",
            notes = "不分页模糊查询；关键词：startTime、endTime、typeNo（001002001：汽车衡、001019001：静态轨道衡、001019002:动态轨道衡、001019003:静态铁水轨道衡、001019004:动态铁水轨道衡、001019005:吊钩秤）" +
                    "、typeName、valueFlag：0:一次数据、1:净重数据")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayFirstActualImgDataList")
    public RESTfulResult railwayFirstImgDataList(@RequestBody(required = false) HashMap parmas) {
        try {
            List<HashMap> list = meterWorkCheckFirstActualService.railwayFirstImgDataList(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    //静态轨道衡一次已核查详情
    @ApiOperation(value = "汽车衡一次数据核查数统计-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、baseSpotNo、baseSpotName")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayFirstCountCheckNum")
    public RESTfulResult railwayFirstCountCheckNum(@RequestBody HashMap parmas) {
        try {
            PageList<RailwayFirstCountCheckNum> list = meterWorkCheckFirstActualService.railwayFirstCountCheckNum(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    //静态轨道衡一次未核查详情
    @ApiOperation(value = "汽车衡一次数据核查明细核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayFirstLikeByDesc")
    public RESTfulResult railwayFirstLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<RailwayFirstCountCheckNum> list = meterWorkCheckFirstActualService.railwayFirstLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    //静态轨道衡净重未核查详情
    @ApiOperation(value = "汽车衡净重数据核查数统计-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、baseSpotNo、baseSpotName")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayActualCountCheckNum")
    public RESTfulResult railwayActualCountCheckNum(@RequestBody HashMap parmas) {
        try {
            PageList<RailwayActualCountCheckNum> list = meterWorkCheckFirstActualService.railwayActualCountCheckNum(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "汽车衡净重数据核查明细核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayActualLikeByDesc")
    public RESTfulResult railwayActualLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<RailwayActualCountCheckNum> list = meterWorkCheckFirstActualService.railwayActualLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }


    //静态轨道衡一次数据和净重数据核查明细
    @ApiOperation(value = "一次数据和结净数据核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、checkId、typeNo、valueFlag")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayLikeByDesc")
    public RESTfulResult railwayLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<MeterWorkCheckFirstActualRailwayTemp> list = meterWorkCheckFirstActualService.railwayLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    //动态轨道衡一次已核查详情
    @ApiOperation(value = "汽车衡一次数据核查数统计-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、baseSpotNo、baseSpotName")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayDynamicsFirstCountCheckNum")
    public RESTfulResult railwayDynamicsFirstCountCheckNum(@RequestBody HashMap parmas) {
        try {
            PageList<RailwayFirstCountCheckNum> list = meterWorkCheckFirstActualService.railwayDynamicsFirstCountCheckNum(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    //动态轨道衡一次未核查详情
    @ApiOperation(value = "动态衡一次数据核查明细未核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayDynamicsFirstLikeByDesc")
    public RESTfulResult railwayDynamicsFirstLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<RailwayFirstCountCheckNum> list = meterWorkCheckFirstActualService.railwayDynamicsFirstLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "动态轨道衡一次计量和结净数据图片与数据核查-获取列表",
            notes = "不分页模糊查询；关键词：startTime、endTime、typeNo（001002001：汽车衡、001019001：静态轨道衡、001019002:动态轨道衡、001019003:静态铁水轨道衡、001019004:动态铁水轨道衡、001019005:吊钩秤）" +
                    "、typeName、valueFlag：0:一次数据、1:净重数据")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayDynamicsFirstImgDataList")
    public RESTfulResult railwayDynamicsFirstImgDataList(@RequestBody(required = false) HashMap parmas) {
        try {
            List<HashMap> list = meterWorkCheckFirstActualService.railwayDynamicsFirstImgDataList(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    //动态轨道衡一次数据和净重数据核查明细
    @ApiOperation(value = "一次数据和结净数据核查数明细-获取列表", notes = "关键词：startTime、endTime、pageNum、pageSize、checkId、typeNo、valueFlag")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/railwayDynamicsLikeByDesc")
    public RESTfulResult railwayDynamicsLikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<MeterWorkCheckFirstActualRailwayTemp> list = meterWorkCheckFirstActualService.railwayDynamicsLikeByDesc(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }
}
