package com.steerinfo.dil.controller; import com.steerinfo.dil.service.IWmshGridMaterialService; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.DataChange; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.BaseRESTfulController; 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.ApiModelProperty; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; /** * WmshGridMaterial RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-10-09 07:25 * 类描述 * 修订历史: * 日期:2021-10-09 * 作者:generator * 参考: * 描述:WmshGridMaterial RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/wmshgridmaterials") public class WmshGridMaterialController extends BaseRESTfulController { @Autowired IWmshGridMaterialService wmshGridMaterialService; @Autowired ColumnDataUtil columnDataUtil; private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); /** * 展示下游港口港存库库存列表 * @param mapVal * @param pageNum * @param pageSize * @param apiId * @return */ @ApiOperation(value="展示下游港口港存库库存列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "158", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getUnloadPortStockList") public RESTfulResult getUnloadPortStockList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId){ PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = wmshGridMaterialService.getUnloadPortStockList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } /** * 展示万州港港存库库存列表 * @param mapVal * @param pageNum * @param pageSize * @param apiId * @return */ @ApiOperation(value="展示万州港港存库库存列表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "158", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getLoadPortStockList") public RESTfulResult getLoadPortStockList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, String con){ if (con!=null&&!"".equals(con)){ mapVal.put("con",con); } Date now=new Date(); int hour = now.getHours(); if(hour >=8 && hour < 18){ now.setHours(8); }else{ now.setHours(18); } now.setMinutes(0); now.setSeconds(0); mapVal.put("time",now); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = wmshGridMaterialService.getLoadPortStockList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } /** * 获取下游港口库存吨位 * @param mapVal * @return */ @PostMapping(value = "/getDownPortStockList") public RESTfulResult getDownPortStockList(@RequestBody(required = false) Map mapVal){ //查询所有在途的发货通知下的外轮 List> list = wmshGridMaterialService.selectAllShip(mapVal); //遍历获取所有的大类分类及求和 Map types=new HashMap<>(); for(int i=0;i ship = list.get(i); BigDecimal tonnage = DataChange.dataToBigDecimal(ship.get("gmTonnage")); if(types.containsKey(ship.get("type")) && tonnage.doubleValue()>0){ //统计下游港口>0的库存 BigDecimal result=types.get(ship.get("type")).add(tonnage); types.put(ship.get("type").toString(),result); }else{ types.put(ship.get("type").toString(),tonnage); } } //添加结果 for(int i=0;i ship = list.get(i); ship.put("typeTotalTonnage",types.get(ship.get("type").toString()).setScale(2)); } return success(list); } /** * 获取在途库存信息 * @param mapVal * @return */ @PostMapping(value = "/getRunStockList") public RESTfulResult getRunStockList(@RequestBody(required = false) Map mapVal){ return success(wmshGridMaterialService.getRunStockList(mapVal)); } @ApiOperation(value="船舶动态表展示库存吨位", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "158", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/gePortStockList") public RESTfulResult gePortStockList(@RequestBody(required = false) Map mapVal ){ List> columnList = wmshGridMaterialService.getLoadPortStockList(mapVal); return success(columnList); } /** * 展示万州港港存库库存列表 * @param mapVal * @param pageNum * @param pageSize * @param apiId * @return */ @ApiOperation(value="展示万州港当前物资实时库存", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "158", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getLoadPortStockByMaterialName") public RESTfulResult getLoadPortStockByMaterialName(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, String con){ if (con!=null&&!"".equals(con)){ mapVal.put("con",con); } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = wmshGridMaterialService.getLoadPortStockByMaterialName(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } /** * 展示万州港港存库库存列表 * @param mapVal * @param pageNum * @param pageSize * @param apiId * @return */ @ApiOperation(value="展示港存库出库", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "494", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getUnLockPortStock") public RESTfulResult getUnLockPortStock(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, String con, String activeName, String startTime, String endTime){ if (con!=null&&!"".equals(con)){ mapVal.put("con",con); } if (activeName!=null&&!"".equals(activeName)){ mapVal.put("activeName",activeName); } if (startTime!=null&&!"".equals(startTime)){ mapVal.put("startTime",startTime); } if (endTime!=null&&!"".equals(endTime)){ mapVal.put("endTime",endTime); } PageHelper.startPage(pageNum, pageSize); DataChange.queryDataByDateTime(startTime, endTime, mapVal, sdfDateTime);//根据时间段查询数据 //分页查询数据 List> columnList = wmshGridMaterialService.getUnLockPortStock(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList); return success(data); } //清场 @ApiModelProperty(value = "清场远程调用") @ApiImplicitParams({ @ApiImplicitParam(name = "amsContractBreach", value = "违约规则实体", required = false, dataType = "AmsContractBreach"), }) @PostMapping("/clearWmshGridMaterial") public RESTfulResult clearWmshGridMaterial(@RequestBody Map map) { int result = wmshGridMaterialService.clearWmshGridMaterial(map); return success(result); } @ApiModelProperty(value = "修改远程调用") @PostMapping("/updateWmshGridMaterial") public RESTfulResult updateWmshGridMaterial(@RequestBody Map map) { int result = wmshGridMaterialService.updateWmshGridMaterial(map); return success(result); } }