package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSON; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.model.AmsshipDeliveryAttorney; import com.steerinfo.dil.model.TmsshipLoadShipResult; import com.steerinfo.dil.model.TmsshipShipLocation; import com.steerinfo.dil.service.ITmsshipLoadShipResultService; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; 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 com.steerinfo.framework.service.pagehelper.PageList; import com.steerinfo.framework.utils.collection.ListUtils; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.text.SimpleDateFormat; import java.util.*; import java.math.BigDecimal; /** * TmsshipLoadShipResult RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-08-19 08:47 * 类描述 * 修订历史: * 日期:2021-08-19 * 作者:generator * 参考: * 描述:TmsshipLoadShipResult RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/tmsshiploadshipresults") public class TmsshipLoadShipResultController extends BaseRESTfulController { @Autowired ITmsshipLoadShipResultService tmsshipLoadShipResultService; @Autowired ColumnDataUtil columnDataUtil; @Autowired ESFeign esFeign; private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); /** * 新增装船作业(附带新增装船卸船) * @param map * @return */ @ApiOperation(value="新增装船作业", notes="根据TmsshipLoadShipResult对象创建") @ApiImplicitParams({ @ApiImplicitParam(name = "map",value = "装船作业字段",required = true,paramType = "java.util.Map") }) @PostMapping("/addLoadShip") public RESTfulResult addLoadShip(@RequestBody Map map){ try{ int o = tmsshipLoadShipResultService.insertLoadShip(map); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage()); } return success(0); } /** * 修改装船作业信息 * @param map * @return */ @ApiOperation(value="修改装船作业信息", notes="根据TmsshipLoadShipResult对象修改") @ApiImplicitParams({ @ApiImplicitParam(name = "tmsshipLoadShipResult",value = "装船作业字段",required = true,paramType = "TmsshipLoadShipResult") }) @PostMapping("/updateLoadShip") public RESTfulResult updateLoadShip(@RequestBody Map map) { int code = tmsshipLoadShipResultService.updateLoadShip(map); return success(code); } /** * 修改装船作业信息 * @param map * @return */ @ApiOperation(value="修改装船作业信息", notes="根据TmsshipLoadShipResult对象修改") @ApiImplicitParams({ @ApiImplicitParam(name = "tmsshipLoadShipResult",value = "装船作业字段",required = true,paramType = "TmsshipLoadShipResult") }) @PostMapping("/updateThreeSectionDetails") public RESTfulResult updateThreeSectionDetails(@RequestBody Map map) { int code = tmsshipLoadShipResultService.updateThreeSectionDetails(map); return success(code); } /** * 删除装船作业信息 * @param resultId * @return */ @ApiOperation(value="删除装船作业信息") @ApiImplicitParams({ @ApiImplicitParam(name = "resultId",value = "装船作业字段",required = true,paramType = "BigDecimal") }) @PostMapping("/deleteLoadShip/{resultId}") public RESTfulResult deleteLoadShip(@PathVariable("resultId") BigDecimal resultId) { int code = tmsshipLoadShipResultService.deleteLoadShip(resultId); return success(code); } /** * 查询位置作业信息 * @param reusltId * @return */ @ApiOperation(value="查询位置作业信息") @ApiImplicitParams({ @ApiImplicitParam(name = "reusltId",value = "位置作业字段",required = true,paramType = "java.util.Map") }) @PostMapping("/selectLoadShip/{reusltId}") public RESTfulResult selectLoadShip(@PathVariable("reusltId") BigDecimal reusltId) { TmsshipLoadShipResult tmsshipLoadShipResult = tmsshipLoadShipResultService.selectLoadShip(reusltId); return success(tmsshipLoadShipResult); } /** * 查询装船作业表单 * @param resultId * @return */ @ApiOperation(value="查询装船作业表单") @ApiImplicitParams({ @ApiImplicitParam(name = "resultId",value = "位置作业字段",required = true,paramType = "java.util.Map") }) @PostMapping("/getLoadShip/{resultId}") public RESTfulResult getLoadShip(@PathVariable("resultId") BigDecimal resultId) { List> tmsshipLoadShipResult = tmsshipLoadShipResultService.getLoadShip(resultId); return success(tmsshipLoadShipResult); } /** * 展示装船作业信息列表 * @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 = "63", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getLoadShipList") public RESTfulResult getLoadShipList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, Integer status, String con, String startTime, String endTime){ DataChange.queryDataByDateTime(startTime, endTime, mapVal, sdfDateTime);//根据时间段查询数据 //判断状态值是否为空 if (status!=null){ mapVal.put("status",status); } if (con!=null && !"null".equals(con)){ mapVal.put("con","%" + con + "%"); } List> detailListTotal = tmsshipLoadShipResultService.selectLoadShipList(mapVal); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = tmsshipLoadShipResultService.selectLoadShipList(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, detailListTotal, columnList); return success(data); } }