123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- 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.*;
- @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");
-
- @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<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId){
- PageHelper.startPage(pageNum, pageSize);
-
- List<Map<String, Object>> columnList = wmshGridMaterialService.getUnloadPortStockList(mapVal);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
- return success(data);
- }
-
- @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<String,Object> 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<Map<String, Object>> columnList = wmshGridMaterialService.getLoadPortStockList(mapVal);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
- return success(data);
- }
-
- @PostMapping(value = "/getDownPortStockList")
- public RESTfulResult getDownPortStockList(@RequestBody(required = false) Map<String,Object> mapVal){
-
- List<Map<String,Object>> list = wmshGridMaterialService.selectAllShip(mapVal);
-
- Map<String, BigDecimal> types=new HashMap<>();
- for(int i=0;i<list.size();i++){
- Map<String,Object> ship = list.get(i);
- BigDecimal tonnage = DataChange.dataToBigDecimal(ship.get("gmTonnage"));
- if(types.containsKey(ship.get("type")) && tonnage.doubleValue()>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<list.size();i++){
- Map<String,Object> ship = list.get(i);
- ship.put("typeTotalTonnage",types.get(ship.get("type").toString()).setScale(2));
- }
- return success(list);
- }
-
- @PostMapping(value = "/getRunStockList")
- public RESTfulResult getRunStockList(@RequestBody(required = false) Map<String,Object> 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<String,Object> mapVal
- ){
- List<Map<String, Object>> columnList = wmshGridMaterialService.getLoadPortStockList(mapVal);
- return success(columnList);
- }
-
- @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<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- String con){
- if (con!=null&&!"".equals(con)){
- mapVal.put("con",con);
- }
- PageHelper.startPage(pageNum, pageSize);
-
- List<Map<String, Object>> columnList = wmshGridMaterialService.getLoadPortStockByMaterialName(mapVal);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
- return success(data);
- }
-
- @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<String,Object> 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<Map<String, Object>> 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<String,Object> map) {
- int result = wmshGridMaterialService.clearWmshGridMaterial(map);
- return success(result);
- }
- @ApiModelProperty(value = "修改远程调用")
- @PostMapping("/updateWmshGridMaterial")
- public RESTfulResult updateWmshGridMaterial(@RequestBody Map<String,Object> map) {
- int result = wmshGridMaterialService.updateWmshGridMaterial(map);
- return success(result);
- }
- }
|