package com.steerinfo.dil.controller; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.service.ITmstruckReceiptResultService; 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; /** * TmstruckReceiptResult RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-09-10 10:10 * 类描述 * 修订历史: * 日期:2021-09-10 * 作者:generator * 参考: * 描述:TmstruckReceiptResult RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/tmstruckreceiptresults") public class TmstruckReceiptResultController extends BaseRESTfulController { @Autowired ITmstruckReceiptResultService tmstruckReceiptResultService; @Autowired ESFeign esFeign; @Autowired ColumnDataUtil columnDataUtil; @ApiOperation(value="查询收货实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId(107)", 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("/getReceiveResult") public RESTfulResult getReceiveResult(@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_receivee_list";//设置要查询的索引名称 return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果 } } List> allReceiveResult = null; //如果有条件查询则跳过初始化,和创建索引 if(mapValue.size() == 1){ //将查询结果存入索引中 allReceiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue); Map map = new HashMap<>(); //添加索引 map.put("index","get_receivee_list"); //添加id map.put("indexId","receiveId"); allReceiveResult.add(map); //新建索引 esFeign.insertIndex(allReceiveResult); //删除 allReceiveResult.remove(allReceiveResult.size()-1); } if(allReceiveResult == null) allReceiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue); PageHelper.startPage(pageNum,pageSize); //分页数据 List> receiveResult = tmstruckReceiptResultService.getReceiveResult(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReceiveResult,receiveResult); return success(pageList); } @ApiOperation(value="新增钢材到异地库达州站驻港人员确定收货") @PostMapping("/addSteelNzReceiptResult") public RESTfulResult addSteelNzReceiptResult(@RequestBody(required = false) Map map) { int i = tmstruckReceiptResultService.addSteelNzReceiptResult(map); return success(i); } }