package com.steerinfo.dil.controller; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.service.ITmstruckEnfactoryResultService; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; 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.HashMap; import java.util.List; import java.util.Map; /** * TmstruckEnfactoryResult RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-09-08 06:23 * 类描述 * 修订历史: * 日期:2021-09-08 * 作者:TXF * 参考: * 描述:TmstruckEnfactoryResult RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/tmstruckenfactoryresults") public class TmstruckEnfactoryResultController extends BaseRESTfulController { @Autowired ITmstruckEnfactoryResultService tmstruckEnfactoryResultService; @Autowired ESFeign esFeign; @Autowired ColumnDataUtil columnDataUtil; @ApiOperation(value="查询所有的进厂实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId(210)", value = "动态表头", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"), @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"), }) @PostMapping("/getAllEnFactoryResult") public RESTfulResult getAllEnFactoryResult(@RequestBody(required=false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, Integer orderType, String con ){ mapValue.put("orderTypee", orderType); //框计算 if(con != null){ if(!"undefined".equals(con)){ //设置要查询的索引名称 String index="get_enfactory_list"; //获取查询结果 return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con)); } } List> allEnFactoryResult = null; //如果有条件查询则跳过初始化,和创建索引 if(mapValue.size() == 1){ //将查询结果存入索引中 allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue); Map map = new HashMap<>(); //添加索引 map.put("index","get_enfactory_list"); //添加id map.put("indexId","enFactoryId"); allEnFactoryResult.add(map); //新建索引 esFeign.insertIndex(allEnFactoryResult); //删除 allEnFactoryResult.remove(allEnFactoryResult.size()-1); } if(allEnFactoryResult == null) allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue); PageHelper.startPage(pageNum,pageSize); //分页数据 List> enFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allEnFactoryResult,enFactoryResult); return success(pageList); } @ApiOperation(value="通过PDA添加进厂实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号", required = false, dataType = "Map"), }) @PostMapping("/enFactoryResultByPDA") public RESTfulResult enFactoryResultByPDA(@RequestBody(required=false) Map mapValue){ int i = tmstruckEnfactoryResultService.enFactoryResultByPDA(mapValue); return success(i); } @ApiOperation(value="通过门禁进厂") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号 车牌号 进厂时间", required = false, dataType = "Map"), }) @PostMapping("/enFactoryResultByMJ") public RESTfulResult enFactoryResultByMJ(@RequestBody(required=false) Map mapValue){ int i = tmstruckEnfactoryResultService.enFactoryResultByMJ(mapValue); return success(i); } @ApiOperation(value="新增进厂作业实绩:oms远程调用") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "总实绩Id、线路起点", required = false, dataType = "Map"), }) @PostMapping("/addEnFactoryResult") public RESTfulResult addEnFactoryResult(@RequestBody(required=false) Map mapValue){ int i = tmstruckEnfactoryResultService.addEnFactoryResult(mapValue); return success(i); } @ApiOperation(value="通过运输订单id查询物资信息") @ApiImplicitParams({ @ApiImplicitParam(name = "orderId", value = "运输订单id", required = false, dataType = "Integer"), }) @GetMapping("/getMaterial") public RESTfulResult getMaterial(Integer orderId){ List> material = tmstruckEnfactoryResultService.getMaterial(orderId); return success(material); } }