package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSON; import com.steerinfo.dil.feign.ColumnDataFeign; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.model.TmstrainLoadingResult; import com.steerinfo.dil.service.ITmstrainLoadingResultService; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.DataChange; 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.text.SimpleDateFormat; import java.util.*; /** * TmstrainLoadingResult RESTful接口: * * @author generator * @version 1.0-SNAPSHORT 2021-08-30 02:23 * 类描述 * 修订历史: * 日期:2021-08-30 * 作者:generator * 参考: * 描述:TmstrainLoadingResult RESTful接口 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. * @see null */ @RestController @RequestMapping("/${api.version}/tmstrainloadingresults") public class TmstrainLoadingResultController extends BaseRESTfulController { @Autowired ITmstrainLoadingResultService tmstrainLoadingResultService; @Autowired ColumnDataFeign columnDataFeign; @Autowired ESFeign esFeign; @Autowired ColumnDataUtil columnDataUtil; private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @ApiOperation(value = "查询装车作业信息") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId(58)", value = "表头", required = false, dataType = "Interger") }) @PostMapping("/getTmstrainWagonLoad") public RESTfulResult getTmstrainWagonLoad(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, Integer resultType, Integer materialId, Integer supplierId, String con, String startTime, String endTime) { mapValue.put("resultType", resultType); mapValue.put("materialId",materialId); mapValue.put("supplierId",supplierId); if (con!=null&&!"".equals(con)&&!"null".equals(con)){ mapValue.put("con",con); } DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据 PageHelper.startPage(pageNum, pageSize); List> tmstrainWagonLoad1 = tmstrainLoadingResultService.getTmstrainWagonLoad(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, tmstrainWagonLoad1); return success(pageList); } /** * 新增车皮装车作业实绩 * * @param mapValue * @return */ @ApiOperation(value = "新增车皮装车作业实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "tmstrainLoadingResult", value = "车皮装车对象", required = false, dataType = "TmstrainLoadingResult") }) @PostMapping(value = "/insertTmstrainLoadingResult") public RESTfulResult insertTmstrainLoadingResult(@RequestBody(required = false) Map mapValue) { int i=0; try{ i = tmstrainLoadingResultService.addTmstrainLoadingResult(mapValue); }catch (Exception e){ return failed(e.getMessage()); } return success(i); } /** * 通过主键查询车皮装车作业信息 * * @param resultId * @return */ @ApiOperation(value = "通过主键查询车皮装车作业信息") @ApiImplicitParams({ @ApiImplicitParam(name = "resultId", value = "车皮装车主键", required = false, dataType = "BigDecimal") }) @PostMapping(value = "/getTmstrainLoadingResultByResultId/{resultId}") public RESTfulResult getTmstrainLoadingResultByResultId(@PathVariable("resultId") BigDecimal resultId) { List> loadingResultByResultId = tmstrainLoadingResultService.getTmstrainLoadingResultByResultId(resultId); return success(loadingResultByResultId); } /** * 通过主键修改车皮装车作业实绩 * * @param map * @return */ @ApiOperation(value = "通过主键修改车皮装车作业实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "tmstrainLoadingResult", value = "修改车皮装车map", required = false, dataType = "TmstrainWagonLoadResult") }) @PostMapping(value = "/upadteTmstrainLoadingResultByResultId") public RESTfulResult upadteTmstrainLoadingResultByResultId(@RequestBody(required = false) Map map) { int i=-1; try{ i = tmstrainLoadingResultService.updateTmstrainLoadingResult(map); }catch (Exception e){ return failed(e.getMessage()); } return success(i); } /** * 通过主键删除车皮装车作业实绩 * * @param resultId * @return */ @ApiOperation(value = "通过主键删除车皮装车作业实绩") @ApiImplicitParams({ @ApiImplicitParam(name = "resultId", value = "主键ID", required = false, dataType = "BigDecimal") }) @PostMapping(value = "/deleteTmstrainLoadingResultByResultId") public RESTfulResult deleteTmstrainLoadingResultByResultId(@RequestParam BigDecimal resultId) { int i = tmstrainLoadingResultService.deleteTmstrainLoadingResultByResultId(resultId); return success(i); } /** * 获取发站地点名称 * * @param * @return */ @ApiOperation(value = "获取发站地点名称") @ApiImplicitParams({ }) @GetMapping(value = "/getSendStationName") public RESTfulResult getSendStationName() { return success(tmstrainLoadingResultService.getSendStationName()); } /** * 获取到站地点名称 * * @param * @return */ @ApiOperation(value = "获取到站地点名称") @GetMapping(value = "/getArrivalStationName") public RESTfulResult getArrivalStationName() { return success(tmstrainLoadingResultService.getArrivalStationName()); } /** * 获取批次ID * * @param * @return */ @ApiOperation(value = "获取批次ID") @GetMapping(value = "/getBatchId") public RESTfulResult getBatchId() { return success(tmstrainLoadingResultService.getBatchId()); } /** * 获取装车车皮号 * * @param * @return */ @ApiOperation(value = "获取已装车还未卸车车皮") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId(213)", value = "表头", required = false, dataType = "Interger") }) @PostMapping(value = "/getWagonNo/{resultType}") public RESTfulResult getWagonNo(@PathVariable("resultType") Integer resultType, @RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String wagon, String purchaseOrderNum, String materialName) { mapValue.put("resultType", resultType); mapValue.put("wagon",wagon); mapValue.put("purchaseOrderNum",purchaseOrderNum); mapValue.put("materialName",materialName); //不分页筛选数据 PageHelper.startPage(pageNum, pageSize); //分页数据 List> wagonNo = tmstrainLoadingResultService.getWagonNo(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, wagonNo); return success(pageList); } //内转物流新增装车 @ApiOperation(value = "内转物流新增装车") @PostMapping(value = "/addTrainLoadResultForConverted") public RESTfulResult addTrainLoadResultForConverted(@RequestBody(required = false) Map map) { return success(tmstrainLoadingResultService.addTrainLoadResultForConverted(map)); } //内转物流新增装车 @ApiOperation(value = "进口矿港存库出库") @PostMapping(value = "/addWarehouseOutResult") public RESTfulResult addWarehouseOutResult(@RequestBody(required = false) Map map) { int result = tmstrainLoadingResultService.addWarehouseOutResult(map); if (result==-1){ return failed("港存库实时库存不够"); } return success(); } /** * 内转物流通过主键查询车皮装车作业信息 * * @param resultId * @return */ @ApiOperation(value = "内转物流通过主键查询车皮装车作业信息") @ApiImplicitParams({ @ApiImplicitParam(name = "resultId", value = "车皮装车主键", required = false, dataType = "BigDecimal") }) @PostMapping(value = "/selectLoadByResultId/{resultId}") public RESTfulResult selectLoadByResultId(@PathVariable("resultId") BigDecimal resultId) { List> loadingResultByResultId = tmstrainLoadingResultService.selectLoadByResultId(resultId); System.out.println(loadingResultByResultId); return success(loadingResultByResultId); } @ApiOperation(value = "查询车皮物资信息") @ApiImplicitParams({ @ApiImplicitParam(name = "apiId(259)", value = "表头", required = false, dataType = "Interger") }) @PostMapping(value = "/getMaterialAndCarByLoadingId") public RESTfulResult getMaterialAndCarByLoadingId( @RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, Integer loadingId, Integer unloadingId) { if(loadingId != null){ mapValue.put("resultId", loadingId); } if(unloadingId != null){ mapValue.put("unloadingId", unloadingId); } //不分页筛选数据 PageHelper.startPage(pageNum, pageSize); //分页数据 List> mes = tmstrainLoadingResultService.getMaterialAndCarByLoadingId(mapValue); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, mes); return success(pageList); } @ApiOperation(value = "国产矿物流新增装车") @PostMapping(value = "/addDomesticLoadResult") public RESTfulResult addDomesticLoadResult(@RequestBody(required = false) Map mapValue) { int result=0; try{ result=tmstrainLoadingResultService.addDomesticLoadResult(mapValue); }catch (Exception e){ return failed(e.getMessage()); } return success(result); } @ApiOperation(value = "国产矿物流补录装车信息") @PostMapping(value = "/updateDomesticLoadResult") public RESTfulResult updateDomesticLoadResult(@RequestBody(required = false) Map map) throws Exception { int i = tmstrainLoadingResultService.updateDomesticLoadResult(map); if(i==-1){ return success("有委托发送失败,请联系技术人员"); } return success("发送成功"); } @ApiOperation(value = "根据物资名和外轮船名查询采购订单号") @PostMapping(value = "/getPurchaseOrderList") public RESTfulResult getPurchaseOrderList(@RequestBody(required = false) Map map, Integer apiId, Integer pageNum, Integer pageSize, String materialName, String resultForeignShipName) { if(materialName!=null) map.put("materialName",materialName); if(resultForeignShipName!=null) map.put("resultForeignShipName",resultForeignShipName); //不分页筛选数据 PageHelper.startPage(pageNum, pageSize); //分页数据 List> mes = tmstrainLoadingResultService.getPurchaseOrderList(map); PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, mes); return success(pageList); } }