RmsCapacityController.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 success(0);
  47. }
  48. if (result == -1) {
  49. return failed(-1);
  50. }
  51. return success(result);
  52. }
  53. /**
  54. * 根据id更新运力信息
  55. * @param rmsCapacity
  56. * @return
  57. */
  58. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的rmsCapacity信息来更新详细信息")
  59. @ApiImplicitParams({
  60. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
  61. @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "RmsCapacity")
  62. })
  63. @PostMapping(value = "/updateCapacity", produces = "application/json;charset=UTF-8")
  64. public RESTfulResult updateCapacity( @RequestBody RmsCapacity rmsCapacity){
  65. int result = rmsCapacityService.updateCapacity(rmsCapacity);
  66. return success(result);
  67. }
  68. /**
  69. * 根据id删除运力信息
  70. * @param id
  71. * @return
  72. */
  73. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  74. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
  75. @PostMapping(value = "/deleteCapacity/{id}")
  76. public RESTfulResult deleteCapacity(@PathVariable("id") BigDecimal id){
  77. int s = rmsCapacityService.deleteCapacity(id);
  78. return success(s);
  79. }
  80. /**
  81. * 根据id获取运力信息
  82. * @param id
  83. * @return
  84. */
  85. @ApiOperation(value="获取运力详细信息", notes="根据url的id来获取详细信息")
  86. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  87. @PostMapping(value = "/getCapacityById/{id}")
  88. public RESTfulResult getCapacityById(@PathVariable("id") BigDecimal id){
  89. List<Map<String,Object>> list= rmsCapacityService.getCapacityById(id);
  90. return success(list);
  91. }
  92. /*
  93. * 运力类型下拉框
  94. * */
  95. @GetMapping("/getCapacityTypeId")
  96. public RESTfulResult getCapacityTypeId(){
  97. return success(rmsCapacityService.getCapacityTypeId());
  98. }
  99. /*
  100. * 承运单位下拉框
  101. * */
  102. @GetMapping("/getCarrierId")
  103. public RESTfulResult getCarrierId(){
  104. return success(rmsCapacityService.getCarrierId());
  105. }
  106. /*
  107. *模糊查询运力表
  108. * */
  109. @ApiOperation(value = "模糊查询展示运力表", notes = "分页查询")
  110. @ApiImplicitParams({
  111. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  112. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  113. @ApiImplicitParam(name = "apiId", value = "397", required = false, dataType = "BigDecimal"),
  114. })
  115. @PostMapping(value = "/getCapacityList")
  116. public RESTfulResult getCapacityList(@RequestBody(required = false) Map<String, Object> mapValue,
  117. Integer apiId,
  118. Integer pageNum,
  119. Integer pageSize,
  120. String con,
  121. String carrierSSOId) {
  122. if(carrierSSOId != null){
  123. if(!"null".equals(carrierSSOId)) {
  124. mapValue.put("carrierSSOId", carrierSSOId);
  125. }
  126. }
  127. if(con != null){
  128. if(!"".equals(con)){
  129. mapValue.put("index", con);
  130. }
  131. }
  132. List<Map<String, Object>> listTotal = rmsCapacityService.getCapacityList(mapValue);
  133. PageHelper.startPage(pageNum, pageSize);
  134. //分页查询数据
  135. List<Map<String, Object>> columnList = rmsCapacityService.getCapacityList(mapValue);
  136. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  137. return success(data);
  138. }
  139. //根据carrierSSOId查询承运商
  140. @PostMapping("/getCarrierNameBySSOId")
  141. public RESTfulResult getCarrierNameBySSOId(@RequestParam("carrierSSOId") String carrierSSOId){
  142. Map<String,Object> map=rmsCapacityService.getCarrierNameBySSOId(carrierSSOId);
  143. return success(map);
  144. }
  145. }