package com.steerinfo.dil.controller; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.service.ITmstruckWeightResultService; 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.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * TmstruckWeightResult RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-09-09 02:21 * 类描述 * 修订历史: * 日期:2021-09-09 * 作者:generator * 参考: * 描述:TmstruckWeightResult RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/tmstruckweightresults") public class TmstruckWeightResultController extends BaseRESTfulController { @Autowired ITmstruckWeightResultService tmstruckWeightResultService; @Autowired ESFeign esFeign; @Autowired ColumnDataUtil columnDataUtil; @ApiOperation(value="新增计量实绩 ") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "总实绩ID、计皮点、计毛点", required = false, dataType = "Map"), }) @PostMapping("/addWeightResult") public RESTfulResult addWeightResult(@RequestBody Map mapValue){ int i = tmstruckWeightResultService.addWeightResult(mapValue); return success(i); } @ApiOperation(value="更新计量实绩 ") @ApiImplicitParams({ @ApiImplicitParam(name = "mapList", value = "计量数据", required = false, dataType = "List"), }) @PostMapping("/updateTruckWeight") public RESTfulResult updateTruckWeight(@RequestBody List> mapList){ int i = tmstruckWeightResultService.updateTruckWeight(mapList); return success(i); } @ApiOperation(value="查询计毛实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId(102)", 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("/getAllJiMaoResult") public RESTfulResult getAllJiMaoResult(@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_jimao_list";//设置要查询的索引名称 return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果 } } List> allJiMaoResult = null; //如果有条件查询则跳过初始化,和创建索引 if(mapValue.size() == 1){ //将查询结果存入索引中 allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue); Map map = new HashMap<>(); //添加索引 map.put("index","get_jimao_list"); //添加id map.put("indexId","jiMaoId"); allJiMaoResult.add(map); //新建索引 esFeign.insertIndex(allJiMaoResult); //删除 allJiMaoResult.remove(allJiMaoResult.size()-1); } if(allJiMaoResult == null){ allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue); } PageHelper.startPage(pageNum,pageSize); //分页数据 List> jiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allJiMaoResult,jiMaoResult); return success(pageList); } @ApiOperation(value="查询计皮实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId(104)", 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("/getAllJiPiResult") public RESTfulResult getAllJiPiResult(@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_jipi_list";//设置要查询的索引名称 return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果 } } //不分页筛选数据 List> allJiPiResult = null; //如果有条件查询则跳过初始化,和创建索引 if(mapValue.size() == 1){ //将查询结果存入索引中 allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue); Map map = new HashMap<>(); //添加索引 map.put("index","get_jipi_list"); //添加id map.put("indexId","jiPiId"); allJiPiResult.add(map); //新建索引 esFeign.insertIndex(allJiPiResult); //删除 allJiPiResult.remove(allJiPiResult.size()-1); } if(allJiPiResult == null){ allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue); } PageHelper.startPage(pageNum,pageSize); //分页数据 List> jiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allJiPiResult,jiPiResult); return success(pageList); } @ApiOperation(value="采集新增计毛实绩 ") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "采集的数据", required = false, dataType = "Map"), }) @PostMapping("/addJiMaoResult") public RESTfulResult addJiMaoResult(@RequestBody Map mapValue){ int i = tmstruckWeightResultService.addJiMaoResult(mapValue); return success(i); } @ApiOperation(value="采集新增计皮实绩 ") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "采集的数据", required = false, dataType = "Map"), }) @PostMapping("/addJiPiResult") public RESTfulResult addJiPiResult(@RequestBody Map mapValue){ int i = tmstruckWeightResultService.addJiPiResult(mapValue); return success(i); } /** *通过运输订单判断下一步是否需要计量,更新汽车衡到计量实绩中 */ @PostMapping("/updateTruckCalculate/{orderId}") public RESTfulResult updateTruckCalculate(@PathVariable("orderId") Integer orderId){ int i =0; return success(i); } }