RmsCapacityController.java 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. package com.steerinfo.dil.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.steerinfo.dil.feign.ESFeign;
  4. import com.steerinfo.dil.model.RmsCapacity;
  5. import com.steerinfo.dil.service.impl.RmsCapacityServiceImpl;
  6. import com.steerinfo.dil.util.BaseRESTfulController;
  7. import com.steerinfo.dil.util.ColumnDataUtil;
  8. import com.steerinfo.dil.util.PageListAdd;
  9. import com.steerinfo.framework.controller.RESTfulResult;
  10. import com.steerinfo.framework.service.pagehelper.PageHelper;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. import io.swagger.annotations.ApiOperation;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.math.BigDecimal;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.Map;
  20. /**
  21. * @Description:
  22. * @Author:ZhouZhou
  23. * @CreateTime:2021/11/9 14:28
  24. * @Version:V1.0
  25. */
  26. @RestController
  27. @RequestMapping("/${api.version}/rmscapacity")
  28. public class RmsCapacityController extends BaseRESTfulController {
  29. @Autowired
  30. RmsCapacityServiceImpl rmsCapacityService;
  31. @Autowired
  32. ColumnDataUtil columnDataUtil;
  33. @Autowired
  34. ESFeign esFeign;
  35. /**
  36. * 创建运力信息
  37. * @param
  38. * @return
  39. */
  40. @ApiOperation(value="创建", notes="根据RmsCapacity对象创建")
  41. @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "RmsCapacity")
  42. @PostMapping(value = "/insertCapacity")
  43. public RESTfulResult insertCapacity(@RequestBody(required = false) Map<String,Object> mapValue){
  44. int result = rmsCapacityService.insertCapacity(mapValue);
  45. if (result <= 0){
  46. return failed();
  47. }
  48. return success(result);
  49. }
  50. /**
  51. * 根据id更新运力信息
  52. * @param rmsCapacity
  53. * @return
  54. */
  55. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的rmsCapacity信息来更新详细信息")
  56. @ApiImplicitParams({
  57. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
  58. @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "RmsCapacity")
  59. })
  60. @PostMapping(value = "/updateCapacity", produces = "application/json;charset=UTF-8")
  61. public RESTfulResult updateCapacity( @RequestBody RmsCapacity rmsCapacity){
  62. int result = rmsCapacityService.updateCapacity(rmsCapacity);
  63. return success(result);
  64. }
  65. /**
  66. * 根据id删除运力信息
  67. * @param id
  68. * @return
  69. */
  70. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  71. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
  72. @PostMapping(value = "/deleteCapacity/{id}")
  73. public RESTfulResult deleteCapacity(@PathVariable("id") BigDecimal id){
  74. int s = rmsCapacityService.deleteCapacity(id);
  75. return success(s);
  76. }
  77. /**
  78. * 根据id获取运力信息
  79. * @param id
  80. * @return
  81. */
  82. @ApiOperation(value="获取运力详细信息", notes="根据url的id来获取详细信息")
  83. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  84. @PostMapping(value = "/getCapacityById/{id}")
  85. public RESTfulResult getCapacityById(@PathVariable("id") BigDecimal id){
  86. List<Map<String,Object>> list= rmsCapacityService.getCapacityById(id);
  87. return success(list);
  88. }
  89. /*
  90. * 运力类型下拉框
  91. * */
  92. @GetMapping("/getCapacityTypeId")
  93. public RESTfulResult getCapacityTypeId(){
  94. return success(rmsCapacityService.getCapacityTypeId());
  95. }
  96. /*
  97. * 承运单位下拉框
  98. * */
  99. @GetMapping("/getCarrierId")
  100. public RESTfulResult getCarrierId(){
  101. return success(rmsCapacityService.getCarrierId());
  102. }
  103. /*
  104. *模糊查询运力表
  105. * */
  106. @ApiOperation(value = "模糊查询展示运力表", notes = "分页查询")
  107. @ApiImplicitParams({
  108. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  109. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  110. @ApiImplicitParam(name = "apiId", value = "397", required = false, dataType = "BigDecimal"),
  111. })
  112. @PostMapping(value = "/getCapacityList")
  113. public RESTfulResult getCapacityList(@RequestBody(required = false) Map<String, Object> mapValue,
  114. Integer apiId,
  115. Integer pageNum,
  116. Integer pageSize,
  117. String con,
  118. String carrierSSOId) {
  119. if(carrierSSOId != null){
  120. if(!"null".equals(carrierSSOId)) {
  121. mapValue.put("carrierSSOId", carrierSSOId);
  122. }
  123. }
  124. if(con != null){
  125. if(!"".equals(con)){
  126. mapValue.put("index", con);
  127. }
  128. }
  129. List<Map<String, Object>> listTotal = rmsCapacityService.getCapacityList(mapValue);
  130. PageHelper.startPage(pageNum, pageSize);
  131. //分页查询数据
  132. List<Map<String, Object>> columnList = rmsCapacityService.getCapacityList(mapValue);
  133. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  134. return success(data);
  135. }
  136. //根据carrierSSOId查询承运商
  137. @PostMapping("/getCarrierNameBySSOId")
  138. public RESTfulResult getCarrierNameBySSOId(@RequestParam("carrierSSOId") String carrierSSOId){
  139. Map<String,Object> map=rmsCapacityService.getCarrierNameBySSOId(carrierSSOId);
  140. return success(map);
  141. }
  142. }