123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- package com.steerinfo.dil.controller;
- import com.alibaba.fastjson.JSON;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.model.TmsshipShipLocation;
- import com.steerinfo.dil.service.ITmsshipShipLocationService;
- import com.steerinfo.dil.service.impl.TmsshipShipLocationServiceImpl;
- import com.steerinfo.dil.service.impl.TmsshipTotalResultServiceImpl;
- 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 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.util.*;
- import java.math.BigDecimal;
- /**
- * TmsshipShipLocation RESTful接口:
- * @author generator
- * @version 1.0-SNAPSHORT 2021-08-19 08:52
- * 类描述
- * 修订历史:
- * 日期:2021-08-19
- * 作者:generator
- * 参考:
- * 描述:TmsshipShipLocation RESTful接口
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @RestController
- @RequestMapping("/${api.version}/tmsshipshiplocations")
- public class TmsshipShipLocationController extends BaseRESTfulController {
- @Autowired
- TmsshipShipLocationServiceImpl tmsshipShipLocationService;
- @Autowired
- TmsshipTotalResultServiceImpl tmsshipTotalResultService;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @Autowired
- ESFeign esFeign;
- /**
- * 新增位置作业
- * @param map
- * @return
- */
- @ApiOperation(value="新增位置作业", notes="根据TmsshipShipLocation对象创建")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "map",value = "位置作业字段",required = true,paramType = "java.util.Map")
- })
- @PostMapping("/addShipLocation")
- public RESTfulResult addShipLocation(@RequestBody Map<String,Object> map) {
- int code = tmsshipShipLocationService.addShipLocation(map);
- return success(code);
- }
- /**
- * 修改位置作业信息
- * @param tmsshipShipLocation
- * @return
- */
- @ApiOperation(value="修改位置作业信息", notes="根据TmsshipShipLocation对象修改")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "tmsshipShipLocation",value = "位置作业字段",required = true,paramType = "TmsshipShipLocation")
- })
- @PostMapping("/updateShipLocation")
- public RESTfulResult updateShipLocation(@RequestBody TmsshipShipLocation tmsshipShipLocation) {
- int code = tmsshipShipLocationService.updateShipLocation(tmsshipShipLocation);
- return success(code);
- }
- /**
- * 删除位置作业信息
- * @param locationId
- * @return
- */
- @ApiOperation(value="删除位置作业信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "locationId",value = "位置作业字段",required = true,paramType = "BigDecimal")
- })
- @PostMapping("/deleteShipLocation/{locationId}")
- public RESTfulResult deleteShipLocation(@PathVariable("locationId") BigDecimal locationId) {
- int code = tmsshipShipLocationService.deleteShipLocation(locationId);
- return success(code);
- }
- /**
- * 查询位置作业信息
- * @param locationId
- * @return
- */
- @ApiOperation(value="查询位置作业信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapVal",value = "位置作业字段",required = true,paramType = "java.util.Map")
- })
- @PostMapping("/selectShipLocation/{locationId}")
- public RESTfulResult selectShipLocation(@PathVariable("locationId") BigDecimal locationId) {
- TmsshipShipLocation tmsshipShipLocation = tmsshipShipLocationService.selectShipLocation(locationId);
- return success(tmsshipShipLocation);
- }
- /**
- * 查询位置作业信息
- * @param locationId
- * @return
- */
- @ApiOperation(value="查询位置作业信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapVal",value = "位置作业字段",required = true,paramType = "java.util.Map")
- })
- @PostMapping("/getShipLocation/{locationId}")
- public RESTfulResult getShipLocation(@PathVariable("locationId") BigDecimal locationId) {
- List<Map<String,Object>> map = tmsshipShipLocationService.getShipLocation(locationId);
- return success(map);
- }
- /**
- * 展示位置作业信息列表
- * @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 = "59", required = false, dataType = "BigDecimal"),
- })
- @PostMapping(value = "/getShipLocationList")
- public RESTfulResult getShipLocationList(@RequestBody(required = false) Map<String,Object> mapVal,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- String con){
- //框计算
- if(con != null){
- if(!"undefined".equals(con)){
- //设置要查询的索引名称
- String index="get_ship_location_list";
- //获取查询结果
- return success(esFeign.getConResult(mapVal,index,apiId,pageNum,pageSize,con));
- }
- }
- //初始化过滤
- List<Map<String, Object>> detailListTotal = null;
- //如果有条件查询则跳过初始化,和创建索引
- if (mapVal == null) {
- //将查询结果存入索引中
- detailListTotal = tmsshipShipLocationService.selectShipLocationList(null);
- Map<String, Object> map = new HashMap<>();
- //添加索引
- map.put("index", "get_ship_location_list");
- //添加id
- map.put("indexId", "locationId");
- detailListTotal.add(map);
- //新建索引
- String s = JSON.toJSONString(detailListTotal);
- esFeign.insertIndex(detailListTotal);
- //删除
- detailListTotal.remove(detailListTotal.size() - 1);
- }
- if (detailListTotal == null) {
- detailListTotal = tmsshipShipLocationService.selectShipLocationList(mapVal);
- }
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = tmsshipShipLocationService.selectShipLocationList(mapVal);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, detailListTotal, columnList);
- return success(data);
- }
- }
|