123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- package com.steerinfo.dil.controller;
- import com.alibaba.fastjson.JSON;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.model.RmsCapacity;
- import com.steerinfo.dil.service.impl.RmsCapacityServiceImpl;
- 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 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.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @Description:
- * @Author:ZhouZhou
- * @CreateTime:2021/11/9 14:28
- * @Version:V1.0
- */
- @RestController
- @RequestMapping("/${api.version}/rmscapacity")
- public class RmsCapacityController extends BaseRESTfulController {
- @Autowired
- RmsCapacityServiceImpl rmsCapacityService;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @Autowired
- ESFeign esFeign;
- /**
- * 创建运力信息
- * @param
- * @return
- */
- @ApiOperation(value="创建", notes="根据RmsCapacity对象创建")
- @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "RmsCapacity")
- @PostMapping(value = "/insertCapacity")
- public RESTfulResult insertCapacity(@RequestBody(required = false) Map<String,Object> mapValue){
- int result = rmsCapacityService.insertCapacity(mapValue);
- if (result == 0){
- return success(0);
- }
- if (result == -1) {
- return failed(-1);
- }
- return success(result);
- }
- /**
- * 根据id更新运力信息
- * @param rmsCapacity
- * @return
- */
- @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的rmsCapacity信息来更新详细信息")
- @ApiImplicitParams({
- @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
- @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "RmsCapacity")
- })
- @PostMapping(value = "/updateCapacity", produces = "application/json;charset=UTF-8")
- public RESTfulResult updateCapacity( @RequestBody RmsCapacity rmsCapacity){
- int result = rmsCapacityService.updateCapacity(rmsCapacity);
- return success(result);
- }
- /**
- * 根据id删除运力信息
- * @param id
- * @return
- */
- @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
- @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
- @PostMapping(value = "/deleteCapacity/{id}")
- public RESTfulResult deleteCapacity(@PathVariable("id") BigDecimal id){
- int s = rmsCapacityService.deleteCapacity(id);
- return success(s);
- }
- /**
- * 根据id获取运力信息
- * @param id
- * @return
- */
- @ApiOperation(value="获取运力详细信息", notes="根据url的id来获取详细信息")
- @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
- @PostMapping(value = "/getCapacityById/{id}")
- public RESTfulResult getCapacityById(@PathVariable("id") BigDecimal id){
- List<Map<String,Object>> list= rmsCapacityService.getCapacityById(id);
- return success(list);
- }
- /*
- * 运力类型下拉框
- * */
- @GetMapping("/getCapacityTypeId")
- public RESTfulResult getCapacityTypeId(){
- return success(rmsCapacityService.getCapacityTypeId());
- }
- /*
- * 承运单位下拉框
- * */
- @GetMapping("/getCarrierId")
- public RESTfulResult getCarrierId(){
- return success(rmsCapacityService.getCarrierId());
- }
- /*
- *模糊查询运力表
- * */
- @ApiOperation(value = "模糊查询展示运力表", notes = "分页查询")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "apiId", value = "397", required = false, dataType = "BigDecimal"),
- })
- @PostMapping(value = "/getCapacityList")
- public RESTfulResult getCapacityList(@RequestBody(required = false) Map<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String con,
- String carrierSSOId) {
- if(carrierSSOId != null){
- if(!"null".equals(carrierSSOId)) {
- mapValue.put("carrierSSOId", carrierSSOId);
- }
- }
- if(con != null){
- if(!"".equals(con)){
- mapValue.put("index", con);
- }
- }
- List<Map<String, Object>> listTotal = rmsCapacityService.getCapacityList(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = rmsCapacityService.getCapacityList(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
- return success(data);
- }
- //根据carrierSSOId查询承运商
- @PostMapping("/getCarrierNameBySSOId")
- public RESTfulResult getCarrierNameBySSOId(@RequestParam("carrierSSOId") String carrierSSOId){
- Map<String,Object> map=rmsCapacityService.getCarrierNameBySSOId(carrierSSOId);
- return success(map);
- }
- }
|