package com.steerinfo.meterwork.meterworkcaractualfirst.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.steerinfo.baseinfo.meterbasematterinfo.model.MeterBaseMatterInfo;
import com.steerinfo.baseinfo.meterbasespotinfo.mapper.MeterBaseSpotInfoMapper;
import com.steerinfo.baseinfo.meterbasespotinfo.model.MeterBaseSpotInfo;
import com.steerinfo.framework.controller.BaseRESTfulController;
import com.steerinfo.framework.controller.RESTfulResult;
import com.steerinfo.framework.service.pagehelper.PageList;
import com.steerinfo.framework.user.UserPayload;
import com.steerinfo.framework.utils.collection.ListUtils;
import com.steerinfo.metermonitor.metermonitornote.model.MeterMonitorNote;
import com.steerinfo.meterwork.dto.*;
import com.steerinfo.meterwork.except.MarkerMetException;
import com.steerinfo.meterwork.meterworkcaractual.model.MeterWorkCarActual;
import com.steerinfo.meterwork.meterworkcaractualfirst.mapper.MeterWorkCarActualFirstMapper;
import com.steerinfo.meterwork.meterworkcaractualfirst.model.MeterWorkCarActualFirst;
import com.steerinfo.meterwork.meterworkcaractualfirst.service.IMeterWorkCarActualFirstService;
import com.steerinfo.meterwork.meterworkprelink.model.MeterWorkPreLink;
import com.steerinfo.meterwork.meterworkrailwayactfirst.model.MeterWorkRailwayActFirst;
import com.steerinfo.pretrack.pretrackscale.model.PreTrackScale;
import com.steerinfo.util.PublicMethod;
import com.steerinfo.util.StringUtils;
import io.swagger.annotations.Api;
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.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * MeterWorkCarActualFirst RESTful接口：
 *
 * @author generator
 * @version 1.0-SNAPSHORT 2020-09-17 11:28
 * 类描述
 * 修订历史：
 * 日期：2020-09-17
 * 作者：generator
 * 参考：
 * 描述：MeterWorkCarActualFirst RESTful接口
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 * @see null
 */
@RestController
@RequestMapping("/${api.version}/meterworkcaractualfirsts")
@Api(value = "/${api.version}/meterworkcaractualfirsts", tags = "计量汽车衡一次数据 - MeterWorkCarActualFirstController")
public class MeterWorkCarActualFirstController extends BaseRESTfulController {

    @Resource
    MeterWorkCarActualFirstMapper meterWorkCarActualFirstMapper;

    @Resource
    MeterBaseSpotInfoMapper meterBaseSpotInfoMapper;

    @Autowired
    IMeterWorkCarActualFirstService meterWorkCarActualFirstService;

    @ApiOperation(value = "获取列表", notes = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @GetMapping(value = "/")
    public RESTfulResult list(@RequestParam HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.queryForPage(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @GetMapping(value = "/like/")
    public RESTfulResult listLike(@RequestParam HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.queryLikeForPage(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @GetMapping(value = "/likeByDesc/")
    public RESTfulResult like(@RequestParam HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.likeByDesc(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/likeByDesc/")
    public RESTfulResult likePost(@RequestBody HashMap parmas) {
        try {

            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.likeByDesc(parmas,
                    Integer.parseInt(parmas.get("pageNum").toString()),
                    Integer.parseInt(parmas.get("pageSize").toString()));
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/like/")
    public RESTfulResult listLikePost(@RequestBody HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.queryLikeForPage(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "不分页模糊查询")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/likeByDesc")
    public RESTfulResult likeByDesc(@RequestBody HashMap parmas) {
        try {
            List<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.likeByValueFlag(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "APP根据车号获取当日的过车数", notes = "模糊查询")
    @PostMapping(value = "/countFirstByCar")
    public RESTfulResult countFirstByCar(@RequestBody HashMap parmas) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.countFirstByCar(parmas);
            return rm;
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/queryForTimeInterval")
    public RESTfulResult queryForTimeInterval(@RequestBody HashMap parmas) {
        try {
            List<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.queryForTimeInterval(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/ApplikeByDesc")
    public RESTfulResult ApplikeByDesc(@RequestBody HashMap parmas) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.ApplikeByDesc(parmas, Integer.parseInt(parmas.get("pageNum").toString()), Integer.parseInt(parmas.get("pagesize").toString()));
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/likeByValueFlag/")
    public RESTfulResult likeByValueFlag(@RequestBody HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.likeByDesc(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "创建", notes = "根据MeterWorkCarActualFirst对象创建")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    //@RequiresPermissions("meterworkcaractualfirst:create")
    @PostMapping(value = "/")
    public RESTfulResult add(@RequestBody MeterWorkCarActualFirst model) {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
            String afl = sdf.format(new Date());
//            String no = meterWorkCarActualFirstMapper.getNewID(afl);
//            model.setActualFirstNo(sdf.format(new Date()) + no);
            String no = PublicMethod.IdCreate(3);
            model.setActualFirstNo(no);
            model.setValueFlag("1");
            if(model.getCreateTime() == null || StringUtils.isEmpty(model.getCreateTime().toString())){
                model.setCreateTime(new Date());
            }
            String userId = null;
            String userName = null;
            try{
                UserPayload payload = UserPayload.getCurrUser();
                userId = payload.getUserCode();
                userName = payload.getUserName();
            }catch(Exception e) {
                userId = "admin";
                userName = "admins";
            }
            model.setCreateManNo(userId);
            model.setCreateManName(userName);
            HashMap<String, Object> obj = new HashMap<>();
            obj.put("baseSpotNo", model.getBaseSpotNo());
            List<MeterBaseSpotInfo> spotModel = meterBaseSpotInfoMapper.selectByParameters(obj);
            if(spotModel.size() >= 1) {
                model.setBaseSpotName(spotModel.get(0).getBaseSpotName());
            }else {
                throw new MarkerMetException(500, "计量点配置表未找到相应的计量点！！");
            }
            MeterWorkCarActualFirst meterWorkCarActualFirst = meterWorkCarActualFirstService.add(model);
            return success(meterWorkCarActualFirst);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "一次数据补入", notes = "根据MeterWorkCarActualFirst对象创建")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    //@RequiresPermissions("meterworkcaractualfirst:create")
    @PostMapping(value = "/firstDataSupplement")
    public RESTfulResult firstDataSupplement(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = new RESTfulResult();
        rm.setFailed();
        try {
            rm = meterWorkCarActualFirstService.firstDataSupplement(model);
        } catch (Exception ex) {
            ex.printStackTrace();
            rm.setMessage("操作异常，请确认！！！>>>>" + ex.getMessage());
        }
        return rm;
    }

    @ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @GetMapping(value = "/{id}")
    public RESTfulResult get(@PathVariable String id) {
        try {
            MeterWorkCarActualFirst meterWorkCarActualFirst = meterWorkCarActualFirstService.getById(id);
            return success(meterWorkCarActualFirst);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "更新详细信息", notes = "根据url的id来指定更新对象，并根据传过来的meterWorkCarActualFirst信息来更新详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
            @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    })
    //@RequiresPermissions("meterworkcaractualfirst:update")
    @PutMapping(value = "/{id}", produces = "application/json;charset=UTF-8")
    public RESTfulResult update(@PathVariable String id, @RequestBody MeterWorkCarActualFirst model) {
        try {
            model.setId(id);
            MeterWorkCarActualFirst meterWorkCarActualFirst = meterWorkCarActualFirstService.modify(model);
            return success(meterWorkCarActualFirst);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
    //@RequiresPermissions("meterworkcaractualfirst:delete")
    @DeleteMapping(value = "/{id}")//String
    public RESTfulResult delete(@PathVariable String id) {
        try {
            List<String> list = Arrays.asList(id.split(","));
            if (ListUtils.isNotEmpty(list)) {
                List<String> ids = ListUtils.convertList(list);
                meterWorkCarActualFirstService.delete(ids);
            }
            return success();
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "新增数据", notes = "根据MeterWorkCarActualFirst对象创建")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    //@RequiresPermissions("meterworkcaractualfirst:create")
    @PostMapping(value = "/add")
    public RESTfulResult chechandadd(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterMonitorNote, MeterWorkCarActual, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            MeterMonitorNote note = com.getTwo();
            MeterWorkCarActualFirst first = com.getOne();
            RESTfulResult res = meterWorkCarActualFirstService.checkandadd(first, note);
           return res;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }


    @ApiOperation(value = "修改数据", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/update")
    public RESTfulResult chechandupdate(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.checkandupdate(model);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("修改失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "修改数据中的车号", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/updateCar")
    public RESTfulResult updateCar(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.checkcarandupdate(model);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("修改失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "数据审核", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/audit")
    public RESTfulResult audit(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.audit(model);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("审核失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "数据反审", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/unaudit")
    public RESTfulResult unaudit(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.unaudit(model);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("审核失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    /*
    // By BourneCao 20211222 和杨秀东确认，不再需要一次计量历史查询表和相关视图

    @ApiOperation(value = "历史查询", notes = "根据传入参数进行查询")
    @GetMapping(value = "/selectView")
    public RESTfulResult selectView(@RequestParam HashMap parmas, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<MeterWorkCarActualFirst> pageInfo = meterWorkCarActualFirstService.selectView(parmas, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }
     */

    @ApiOperation(value = "停用", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/abolish")
    public RESTfulResult abolish(@RequestBody List<MeterWorkCarActualFirst> models) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.abolish(models);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("停用失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "查询一次计量-C#", notes = "根据车号查询未使用和使用中的预报")
    @PostMapping(value = "/queryByFlag")
    public RESTfulResult queryFirst(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = failed();
        if (model.getCarNo() == null || "".equals(model.getCarNo())) {
            rm.setMessage("请传入车号参数");
            return rm;
        }
        try {
            String carNo = model.getCarNo();
            rm = meterWorkCarActualFirstService.queryFirst(carNo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "启用", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/recover")
    public RESTfulResult recover(@RequestBody List<MeterWorkCarActualFirst> models) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.recover(models);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("启用失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        }
        return rm;
    }

    @ApiOperation(value = "解除", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/remove")
    public RESTfulResult remove(@RequestBody List<MeterWorkCarActualFirst> models) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.remove(models);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("解除失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        }
        return rm;
    }

    @ApiOperation(value = "匹配", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/match")
    public RESTfulResult match(@RequestBody MeterWorkCarActualFirstDto model) {
        RESTfulResult rm = new RESTfulResult();
        try {
            rm = meterWorkCarActualFirstService.match(model.getActualFirstNo(), model.getPredictionNo());
//            if (mwcaf != null) {
//                return success(mwcaf);
//            } else {
//                return failed("匹配失败");
//            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            return failed("操作异常");
        } catch (Exception e) {
            e.printStackTrace();
            return failed("操作异常");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "查询毛重数据", notes = "根据传入参数进行查询")
    @GetMapping(value = "/selectTa")
    public RESTfulResult selectTa(@RequestParam HashMap parmas, String weightType, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<MeterWorkCarActualFirst> pageInfo = meterWorkCarActualFirstService.selectTa(parmas, weightType, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "查询皮重数据", notes = "根据传入参数进行查询")
    @GetMapping(value = "/selectNet")
    public RESTfulResult selectNet(@RequestParam String weightType, String carNo, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<MeterWorkCarActualFirst> pageInfo = meterWorkCarActualFirstService.selectNet(weightType, carNo, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "计量员绩效分析", notes = "根据传入参数进行查询")
    @GetMapping(value = "/analysis")
    public RESTfulResult analysis(@RequestParam String startTime, String endTime, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<StaffPerformanceAnalysis> pageInfo = meterWorkCarActualFirstService.analysis(startTime, endTime, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }


    @ApiOperation(value = "衡器计量次数统计", notes = "根据传入参数进行查询")
    @GetMapping(value = "/utensil")
    public RESTfulResult utensil(@RequestParam String startTime, String endTime, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<UtensilDto> pageInfo = meterWorkCarActualFirstService.utensil(startTime, endTime, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "计量业务次数统计", notes = "根据传入参数进行查询")
    @GetMapping(value = "/meterType")
    public RESTfulResult meterType(@RequestParam String baseSpotNo, String startTime, String endTime) {
        RESTfulResult rm = failed();
        try {
            List<MeterTypeDto> rows = meterWorkCarActualFirstService.meterType(baseSpotNo, startTime, endTime);
            return success(rows);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "日计量次数统计趋势", notes = "根据传入参数进行查询")
    @GetMapping(value = "/daily")
    public RESTfulResult daily(@RequestParam String baseSpotNo, String startTime, String endTime) {
        RESTfulResult rm = failed();
        try {
            List<TimesDto> rows = meterWorkCarActualFirstService.daily(baseSpotNo, startTime, endTime);
            return success(rows);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "时段计量次数统计趋势", notes = "根据传入参数进行查询")
    @GetMapping(value = "/period")
    public RESTfulResult period(@RequestParam String baseSpotNo, String startTime, String endTime) {
        RESTfulResult rm = failed();
        try {
            List<TimesDto> rows = meterWorkCarActualFirstService.period(baseSpotNo, startTime, endTime);
            return success(rows);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "获取计量效率具体信息", notes = "根据传入参数进行查询")
    @GetMapping(value = "/detailed")
    public RESTfulResult detailed(@RequestParam String times, String num) {
        RESTfulResult rm = failed();
        try {
            List<MeterWorkCarActualFirst> rows = meterWorkCarActualFirstService.detailed(times, num);
            return success(rows);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "异常过磅", notes = "根据传入参数进行查询")
    @GetMapping(value = "/abnormal")
    public RESTfulResult abnormal(@RequestParam String startTime, String endTime, String baseSpotNo, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<AbnormalDto> pageInfo = meterWorkCarActualFirstService.abnormal(baseSpotNo, startTime, endTime, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "异常过磅获取详细信息", notes = "根据传入参数进行查询")
    @GetMapping(value = "/getByAbnormal")
    public RESTfulResult getByAbnormal(@RequestParam String meterReasonNo, String meterReasonName, Integer pageNum, Integer pageSize) {
        RESTfulResult rm = failed();
        try {
            PageList<MeterWorkCarActualFirst> pageInfo = meterWorkCarActualFirstService.getByAbnormal(meterReasonNo, meterReasonName, pageNum, pageSize);
            return success(pageInfo);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "C#端查询")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    //@RequiresPermissions("meterworkcaractualfirst:create")
    @PostMapping(value = "/doQueryWf")
    public RESTfulResult doQueryWf(@RequestBody MeterWorkCarActualFirst model) {
        RESTfulResult rm = meterWorkCarActualFirstService.doQueryWf(model);
        return rm;
    }

    @ApiOperation(value = "C#端修改")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    //@RequiresPermissions("meterworkcaractualfirst:create")
    @PostMapping(value = "/doUpdateWf")
    public RESTfulResult doUpdateWf(@RequestBody MeterWorkCarActualFirst model) {
        if (model.getMeterWeight() == null || model.getMeterWeight().compareTo(BigDecimal.ZERO) == 0) {
            return failed("过磅重量不能为0");
        }
        RESTfulResult rm = meterWorkCarActualFirstService.doUpdateWf(model);
        return rm;
    }

    @ApiOperation(value = "内倒车辆存储一次计量数据")
    @Transactional
    @PostMapping(value = "/doAddInnerWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddInnerWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            if (com.getOne().getMeterWeight() == null || com.getOne().getMeterWeight().compareTo(BigDecimal.ZERO) == 0) {
                return failed("过磅重量不能为0");
            }
            RESTfulResult rm = meterWorkCarActualFirstService.doAddInnerWf(com.getOne(), com.getSOne(), com.getFour());
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒车辆结净")
    @Transactional
    @PostMapping(value = "/doAddNetInnerWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetInnerWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            if (com.getOne().getMeterWeight() == null || com.getOne().getMeterWeight().compareTo(BigDecimal.ZERO) == 0) {
                return failed("过磅重量不能为0");
            }
            RESTfulResult rm = meterWorkCarActualFirstService.doAddNetInnerWf(com.getOne(), com.getTwo(), com.getSOne(), com.getFour());
            if(!rm.isSucceed()){
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒车辆结净")
    @Transactional
    @PostMapping(value = "/doAddNetNewHZHX", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetNewHZHX(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActualFirst, MeterWorkCarActual, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doAddNetNewHZHX(com.getOne(), com.getThree(),com.getTwo(), com.getSOne(), com.getFour());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "非内倒车辆存储一次计量数据")
    @PostMapping(value = "/doAddWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkPreLink, MeterWorkCarActual, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doAddWf(com.getOne(), com.getTwo(), com.getSOne(), com.getSTwo(), com.getFour());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "非内倒车辆结净")
    @PostMapping(value = "/doAddNetWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doAddNetWf(com.getOne(), com.getTwo(), com.getFour(), com.getThree(), com.getSOne(), com.getSTwo());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "web端补打二维码加密")
    @PostMapping(value = "/encryptionForWeb", produces = "application/json;charset=UTF-8")
    public RESTfulResult encryptionForWeb(@RequestBody String str) throws Exception {
        try {
            JSONObject json = JSONObject.parseObject(str);
            String a = (String) json.get("str");
            String enStr = meterWorkCarActualFirstService.encryption(a);
            return success(enStr);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "终端补打二维码加密")
    @PostMapping(value = "/encryptionForWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult encryptionForWf(@RequestBody MeterWorkCarActualFirst str) throws Exception {
        try {
            String a = str.getActualFirstNo();
            String enStr = meterWorkCarActualFirstService.encryption(a);
            return success(enStr);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "终端补打二维码加密")
    @PostMapping(value = "/encryptionForWfTest", produces = "application/json;charset=UTF-8")
    public RESTfulResult encryptionForWfTest(@RequestBody HashMap param) throws Exception {
        try {
            String carNo = param.get("carNo") == null ? "": param.get("carNo").toString();
            if(StringUtils.isEmpty(carNo)) {
                return failed("车号为空");
            }
            String enStr = meterWorkCarActualFirstService.encryptionTest(carNo);
            return success(enStr);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "终端补打二维码解密")
    @PostMapping(value = "/DecryptionForWfTest", produces = "application/json;charset=UTF-8")
    public RESTfulResult DecryptionForWfTest(@RequestBody HashMap param) throws Exception {
        try {
            String message = param.get("message") == null ? "": param.get("message").toString();
            if(StringUtils.isEmpty(message)) {
                return failed("密文为空");
            }
            RESTfulResult rm  = meterWorkCarActualFirstService.decryptionTest(message);
            return rm;
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "非内倒车辆使用期限皮重结净")
    @PostMapping(value = "/doAddNetByTermWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetByTermWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterMonitorNote, MeterWorkPreLink> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doAddNetByTermWf(com.getOne(), com.getTwo(), com.getThree());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "获取列表", notes = "分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @GetMapping(value = "/queryOrderByTime")
    public RESTfulResult queryOrderByTime(@RequestParam HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.queryOrderByTime(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }


    @ApiOperation(value = "联达车辆存储一次计量数据")
    @PostMapping(value = "/doAddLianDaWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddLianDaWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterMonitorNote, MeterMonitorNote, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doAddLianDaWf(com.getOne(), com.getTwo());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "联达车辆结净")
    @PostMapping(value = "/doAddNetLianDaWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetLianDaWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterMonitorNote, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doAddNetLianDaWf(com.getOne(), com.getTwo(), com.getThree());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "吊钩秤数据生成")
    @PostMapping(value = "/doCraneDbWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doCraneDbWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterMonitorNote, MeterMonitorNote, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doCraneDbWf(com.getOne(), com.getTwo());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "吊钩秤数据生成")
    @PostMapping(value = "/doCraneNetDbWf", produces = "application/json;charset=UTF-8")
    public RESTfulResult doCraneNetDbWf(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterMonitorNote, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            RESTfulResult rr = meterWorkCarActualFirstService.doCraneNetDbWf(com.getOne(), com.getTwo(), com.getThree());
            return rr;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "车号汇总统计汇总-网页", notes = "根据传入时间和车号，查询给定时间段去重车号")
    @GetMapping(value = "/distinctCarNo")
    public RESTfulResult distinctCarNo(@RequestParam HashMap param) {
        RESTfulResult rm = failed();
        try {
//            String carNo = param.get("carNo") == null ? "":param.get("carNo").toString();
//            String startTime = param.get("startTime") == null ? "":param.get("startTime").toString();
//            String endTime = param.get("endTime") == null ? "":param.get("endTime").toString();
//            String baseSpotNo = param.get("baseSpotNo") == null ? "": param.get("baseSpotNo").toString();
//            String matterName = param.get("matterName") == null ? "": param.get("matterName").toString();
//            String predictionNo = param.get("predictionNo") == null ? "": param.get("predictionNo").toString();
//            String forwardingUnitName = param.get("forwardingUnitName") == null ? "": param.get("forwardingUnitName").toString();
//            String receivingUintName = param.get("receivingUintName") == null ? "": param.get("receivingUintName").toString();
//            String valueFlag = param.get("valueFlag") == null ? "":param.get("valueFlag").toString();

//            List<String> rows = meterWorkCarActualFirstService.distinctCarNo(carNo, startTime, endTime, baseSpotNo, matterName, predictionNo, forwardingUnitName,receivingUintName,valueFlag);
            List<String> rows = meterWorkCarActualFirstService.distinctCarNo(param);
            return success(rows);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }
    @ApiOperation(value = "车号汇总统计汇总-网页", notes = "根据传入时间和车号，查询给定时间段去重车号")
    @PostMapping(value = "/distinctCarNo")
    public RESTfulResult distinctCarNoPost(@RequestBody(required = false) HashMap param) {
        RESTfulResult rm = failed();
        try {
//            String carNo = param.get("carNo") == null ? "":param.get("carNo").toString();
//            String startTime = param.get("startTime") == null ? "":param.get("startTime").toString();
//            String endTime = param.get("endTime") == null ? "":param.get("endTime").toString();
//            String baseSpotNo = param.get("baseSpotNo") == null ? "": param.get("baseSpotNo").toString();
//            String matterName = param.get("matterName") == null ? "": param.get("matterName").toString();
//            String predictionNo = param.get("predictionNo") == null ? "": param.get("predictionNo").toString();
//            String forwardingUnitName = param.get("forwardingUnitName") == null ? "": param.get("forwardingUnitName").toString();
//            String receivingUintName = param.get("receivingUintName") == null ? "": param.get("receivingUintName").toString();
//            String valueFlag = param.get("valueFlag") == null ? "":param.get("valueFlag").toString();

//            List<String> rows = meterWorkCarActualFirstService.distinctCarNo(carNo, startTime, endTime, baseSpotNo, matterName, predictionNo, forwardingUnitName,receivingUintName,valueFlag);
            List<String> rows = meterWorkCarActualFirstService.distinctCarNo(param);
            return success(rows);
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "智能终端混装混卸--远程计量")
    @Transactional
    @PostMapping(value = "/doAddNetHZHX", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetHZHX(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual,MeterWorkCarActualFirst, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doAddNetHZHX(com.getOne(), com.getTwo(), com.getThree(), com.getFour());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "双委托结净--远程计量")
    @Transactional
    @PostMapping(value = "/doNetAddTwo", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetAddTwo(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, PreTrackScale, PreTrackScale> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetAddTwo(com.getOne(), com.getTwo(), com.getThree(), com.getFour());
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "混装", notes = "混装")
    //@RequiresPermissions("meterworkcaractual:view")
    @PostMapping(value = "/mixedLoading")
    public RESTfulResult mixedLoading(@RequestBody HashMap parmas) {
        try {
            String actualNo1 = parmas.get("actualNo1").toString();
            String actualNo2 = parmas.get("actualNo2").toString();
            String actualNo3 = parmas.get("actualNo3").toString();
            String predictionNo1 = parmas.get("predictionNo1").toString();
            String predictionNo2 = parmas.get("predictionNo2").toString();
            String msg = meterWorkCarActualFirstService.mixedLoading(actualNo1, actualNo2,actualNo3,predictionNo1,predictionNo2);
            if (msg != "" || !msg.equals("")){
                return failed(null,msg);
            }
            return success();
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "混卸", notes = "混卸")
    //@RequiresPermissions("meterworkcaractual:view")
    @PostMapping(value = "/mixedDischarge")
    public RESTfulResult mixedDischarge(@RequestBody HashMap parmas) {
        try {
            String actualNo1 = parmas.get("actualNo1").toString();
            String actualNo2 = parmas.get("actualNo2").toString();
            String actualNo3 = parmas.get("actualNo3").toString();
            String predictionNo1 = parmas.get("predictionNo1").toString();
            String predictionNo2 = parmas.get("predictionNo2").toString();

            String msg = meterWorkCarActualFirstService.mixedDischarge(actualNo1, actualNo2,actualNo3,predictionNo1,predictionNo2);
            if (msg != "" || !msg.equals("")){
                return failed(null,msg);
            }
            return success();
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "双委托匹配结净", notes = "双委托匹配结净")
    //@RequiresPermissions("meterworkcaractual:view")
    @PostMapping(value = "/doubleEntrustmentMatch")
    public RESTfulResult doubleEntrustmentMatch(@RequestBody HashMap parmas) {
        RESTfulResult rm = failed();
        try {
            String actualNo1 = parmas.get("actualNo1").toString();
            String actualNo2 = parmas.get("actualNo2").toString();
            String predictionNo1 = parmas.get("predictionNo1").toString();
            String predictionNo2 = parmas.get("predictionNo2").toString();

            rm = meterWorkCarActualFirstService.doubleEntrustmentMatch(actualNo1, actualNo2,predictionNo1,predictionNo2);
            return rm;
        } catch (Exception ex) {
            ex.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "期限皮重结净")
    @Transactional
    @PostMapping(value = "/doNetTermTare", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetTermTare(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual,MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetTermTare(com.getOne(), com.getTwo(), com.getSOne());
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "应急计量批量新增")
    @Transactional
    @PostMapping(value = "/addEmergency", produces = "application/json;charset=UTF-8")
    public RESTfulResult addEmergency(@RequestBody List<MeterWorkCarActualFirst> model) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.addEmergency(model);
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "应急计量单个新增")
    @Transactional
    @PostMapping(value = "/addFirstEmergency", produces = "application/json;charset=UTF-8")
    public RESTfulResult addFirstEmergency(@RequestBody MeterWorkCarActualFirst model) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.addFirstEmergency(model);
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "应急计量-两个一次数据编号结净")
    @Transactional
    @PostMapping(value = "/doNetEmergency", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetEmergency(@RequestBody MeterWorkCarActual model) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetEmergency(model);
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "多毛一皮结净")
    @Transactional
    @PostMapping(value = "/doNetAddMuch", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetAddMuch(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual,MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetAddMuch(com.getOne());
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒车辆错误结净")
    @Transactional
    @PostMapping(value = "/doAddNetInnerWfError", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddNetInnerWfError(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doAddNetInnerWfError(com.getOne(), com.getTwo(), com.getSOne(), com.getFour());
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "期限皮结净")
    @Transactional
    @PostMapping(value = "/doNetByFirst", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetByFirst(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActualFirst,PreTrackScale, MeterMonitorNote> com) {
        try {
            MeterWorkCarActualFirst grossModel = com.getOne();
            MeterWorkCarActualFirst tareModel = com.getTwo();
            PreTrackScale scale = com.getThree();
            RESTfulResult rm = meterWorkCarActualFirstService.doNetByFirst(grossModel, tareModel, scale);
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "web端-期限皮结净（可带委托）")
    @Transactional
    @PostMapping(value = "/doNetByTermData", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetByTermData(@RequestBody HashMap<String, Object> params) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetByTermData(params);
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "毛皮转换")
    @Transactional
    @PostMapping(value = "/furConversion")
    public RESTfulResult furConversion(@RequestBody HashMap params) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.furConversion(params);
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "多毛一皮结净")
    @Transactional
    @PostMapping(value = "/doNetAddMuchGross", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetAddMuchGross(@RequestBody CommonCombination<List<MeterWorkCarActualFirst>, MeterWorkCarActualFirst,MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetAddMuchGross(com.getOne(),com.getTwo(),com.getFour());
            if(!rm.isSucceed()) {
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }


    @ApiOperation(value = "内倒双委托---不使用期限皮结净，保存两条一次毛重")
    @PostMapping(value = "/doDoubleAdd", produces = "application/json;charset=UTF-8")
    public RESTfulResult doDoubleAdd(@RequestBody CommonCombination<MeterWorkCarActualFirst, PreTrackScale, PreTrackScale, String> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doDoubleAdd(com.getOne(), com.getTwo(), com.getThree());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒双委托---使用期限皮结净,直接保存四条数据和两个结净")
    @PostMapping(value = "/doTermTareNetDouble", produces = "application/json;charset=UTF-8")
    public RESTfulResult doTermTareNetDouble(@RequestBody CommonCombination<MeterWorkCarActualFirst, PreTrackScale, PreTrackScale, String> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doTermTareNetDouble(com.getOne(), com.getTwo(), com.getThree());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒双委托---保存四条数据和两个结净")
    @PostMapping(value = "/doAddDoubleNet", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddDoubleNet(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActualFirst, PreTrackScale, PreTrackScale> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doAddDoubleNet(com.getTwo(), com.getOne(), com.getThree(), com.getFour());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒双委托---保存四条数据和两个结净")
    @PostMapping(value = "/doTermTareNetDoubleRetain", produces = "application/json;charset=UTF-8")
    public RESTfulResult doTermTareNetDoubleRetain(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActualFirst, PreTrackScale, PreTrackScale> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doTermTareNetDoubleRetain(com.getTwo(), com.getOne(), com.getThree(), com.getFour());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "内倒双委托---保存四条数据和两个结净")
    @PostMapping(value = "/doAddDoubleMuchNet", produces = "application/json;charset=UTF-8")
    public RESTfulResult doAddDoubleMuchNet(@RequestBody CommonCombination<List<MeterWorkCarActualFirst>, MeterWorkCarActualFirst, PreTrackScale, PreTrackScale> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doAddDoubleMuchNet(com.getOne(), com.getTwo());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "多毛一皮结净")
    @Transactional
    @PostMapping(value = "/doNetAddMuchGrossDouble", produces = "application/json;charset=UTF-8")
    public RESTfulResult doNetAddMuchGrossDouble(@RequestBody CommonCombination<List<MeterWorkCarActualFirst>, MeterWorkCarActualFirst,MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doNetAddMuchGrossDouble(com.getOne(),com.getTwo(),com.getFour());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "获取列表", notes = "分页模糊查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
    })
    @GetMapping(value = "/allStateView/")
    public RESTfulResult allStateView(@RequestParam HashMap parmas, Integer pageNum, Integer pageSize) {
        try {
            PageList<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.allStateView(parmas, pageNum, pageSize);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "计量统计明细-获取列表", notes = "不分页模糊查询")
    //@RequiresPermissions("meterworkcaractualfirst:view")
    @PostMapping(value = "/carFirstDataDetail")
    public RESTfulResult carFirstDataDetail(@RequestBody HashMap parmas) {
        try {
            List<MeterWorkCarActualFirst> list = meterWorkCarActualFirstService.carFirstDataDetail(parmas);
            return success(list);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MarkerMetException(500, "操作异常！！");
        }
    }

    @ApiOperation(value = "本地计量-根据两个一次作业编号和备注进行洁净", notes = "关键词：actualFirst1No、actualFirst2No、updateManNo、updateManName、note")
    @PostMapping(value = "/localCleanByFirstNo", produces = "application/json;charset=UTF-8")
    public RESTfulResult localCleanByFirstNo(@RequestBody CommonCombination<MeterWorkCarActual, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.localCleanByFirstNo(com.getOne());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "本地计量-根据一次作业编号和备注进行启用或者作废", notes = "关键词：actualFirstNo、updateManNo、updateManName、note、memo")
    @PostMapping(value = "/localRecoveryOrAbolishByFirstNo", produces = "application/json;charset=UTF-8")
    public RESTfulResult localRecoveryOrAbolishByFirstNo(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.localRecoveryOrAbolishByFirstNo(com.getOne());
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            return failed(null, "操作异常，请确认！");
        }
    }

    @ApiOperation(value = "本地计量-一次数据匹配委托", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/localMatch")
    public RESTfulResult localMatch(@RequestBody MeterWorkCarActualFirstDto model) {
        RESTfulResult rm = new RESTfulResult();
        try {
            rm = meterWorkCarActualFirstService.localMatch(model.getActualFirstNo(), model.getPredictionNo(), model.getUpdateManNo(), model.getUpdateManName());
        } catch (MarkerMetException e) {
            e.printStackTrace();
            return failed("操作异常");
        } catch (Exception e) {
            e.printStackTrace();
            return failed("操作异常");
        } finally {

        }
        return rm;
    }

    @ApiOperation(value = "本地计量-一次数据解除委托", notes = "根据MeterWorkCarActualFirst对象创建")
    @PostMapping(value = "/localRemove")
    public RESTfulResult localRemove(@RequestBody List<MeterWorkCarActualFirst> models) {
        RESTfulResult rm = failed();
        try {
            int num = meterWorkCarActualFirstService.localRemove(models);
            if (num >= 1) {
                return success(num);
            } else {
                return failed("解除失败");
            }
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        }
        return rm;
    }

    //=====================================eason add 2023-04-10针对单机计量===============================
    @ApiOperation(value = "新增数据", notes = "根据MeterWorkCarActualFirst对象创建")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    @PostMapping(value = "/addDj")
    public RESTfulResult addDj(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterMonitorNote, MeterWorkCarActual, MeterMonitorNote> com) {
        RESTfulResult rm = failed();
        try {
            MeterMonitorNote note = com.getTwo();
            MeterWorkCarActualFirst first = com.getOne();
            RESTfulResult res = meterWorkCarActualFirstService.addDj(first, note);
            return res;
        } catch (MarkerMetException e) {
            e.printStackTrace();
            rm.setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            rm.setMessage("操作异常，请确认！");
        } finally {

        }
        return rm;
    }


    @ApiOperation(value = "新增数据", notes = "根据MeterWorkCarActualFirst对象创建")
    @ApiImplicitParam(name = "meterWorkCarActualFirst", value = "详细实体meterWorkCarActualFirst", required = true, dataType = "MeterWorkCarActualFirst")
    @PostMapping(value = "/doAddNetDj")
    public RESTfulResult doAddNetDj(@RequestBody CommonCombination<MeterWorkCarActualFirst, MeterWorkCarActual, MeterWorkPreLink, MeterMonitorNote> com) {
        try {
            RESTfulResult rm = meterWorkCarActualFirstService.doAddNetDj(com.getOne(), com.getTwo(), com.getSOne(), com.getFour());
            if(!rm.isSucceed()){
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return rm;
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return failed(null, "操作异常，请确认！");
        }
    }
}
