UniversalController.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.mapper.UniversalMapper;
  3. import com.steerinfo.dil.service.impl.UniversalServiceImpl;
  4. import com.steerinfo.dil.util.BaseRESTfulController;
  5. import com.steerinfo.dil.util.ColumnDataUtil;
  6. import com.steerinfo.dil.util.PageListAdd;
  7. import com.steerinfo.framework.controller.RESTfulResult;
  8. import com.steerinfo.framework.service.pagehelper.PageHelper;
  9. import io.swagger.annotations.ApiImplicitParam;
  10. import io.swagger.annotations.ApiImplicitParams;
  11. import io.swagger.annotations.ApiModelProperty;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.RequestBody;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RestController;
  18. import java.util.HashMap;
  19. import java.util.List;
  20. import java.util.Map;
  21. /**
  22. * @ author :TXF
  23. * @ time :2021/10/19 18:06
  24. * 通用接口
  25. */
  26. @RequestMapping("${api.version}/uc")
  27. @RestController
  28. public class UniversalController extends BaseRESTfulController {
  29. @Autowired
  30. UniversalServiceImpl selfServiceMachineService;
  31. @Autowired
  32. UniversalMapper universalMapper;
  33. @Autowired
  34. ColumnDataUtil columnDataUtil;
  35. @ApiOperation(value="查询数据打印提货单接口")
  36. @ApiImplicitParams({
  37. @ApiImplicitParam(name = "mapValue", value = "运输订单号", required = false, dataType = "Map"),
  38. })
  39. @PostMapping("/printTHD")
  40. public RESTfulResult printTiHuoDan(@RequestBody(required=false) Map<String, Object> mapValue){
  41. Map<String, Object> tiHuoDan = selfServiceMachineService.printTiHuoDan((String) mapValue.get("orderNumber"));
  42. return success(tiHuoDan);
  43. }
  44. @ApiModelProperty(value = "模糊查询发货单位")
  45. @ApiImplicitParams({
  46. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  47. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  48. @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal")
  49. })
  50. @PostMapping("/querySupplierByLike")
  51. public RESTfulResult querySupplierByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  52. Integer pageNum,
  53. Integer pageSize,
  54. Integer apiId,
  55. String index) {
  56. if(mapValue == null) {
  57. mapValue = new HashMap<>();
  58. }
  59. if(index != null){
  60. mapValue.put("index","%" + index + "%");
  61. }
  62. List<Map<String, Object>> list = universalMapper.querySupplierByLike(mapValue);
  63. PageHelper.startPage(pageNum, pageSize);
  64. //分页查询数据
  65. List<Map<String, Object>> columnList = universalMapper.querySupplierByLike(mapValue);
  66. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  67. return success(data);
  68. }
  69. @ApiModelProperty(value = "通过物资ID查询该物资的发货单位信息")
  70. @ApiImplicitParams({
  71. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  72. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  73. @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal")
  74. })
  75. @PostMapping("/getSupplierMesByMaterialId")
  76. public RESTfulResult getSupplierMesByMaterialId(@RequestBody(required = false) Map<String,Object> mapValue,
  77. Integer pageNum,
  78. Integer pageSize,
  79. Integer apiId,
  80. String index, String materialId) {
  81. if(mapValue == null)
  82. mapValue = new HashMap<>();
  83. if(!"null".equals(materialId))
  84. mapValue.put("materialId",materialId);
  85. if(index != null){
  86. mapValue.put("index","%" + index + "%");
  87. }
  88. List<Map<String, Object>> list = universalMapper.getSupplierMesByMaterialId(mapValue);
  89. PageHelper.startPage(pageNum, pageSize);
  90. //分页查询数据
  91. List<Map<String, Object>> columnList = universalMapper.getSupplierMesByMaterialId(mapValue);
  92. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  93. return success(data);
  94. }
  95. @ApiOperation(value="查询所有空闲的运力信息")
  96. @ApiImplicitParams({
  97. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  98. @ApiImplicitParam(name = "apiId()", value = "动态表头", required = false, dataType = "Integer"),
  99. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  100. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  101. })
  102. @PostMapping("/getAllCapacityByCarrierLike")
  103. public RESTfulResult getAllCapacityByCarrierLike(@RequestBody(required=false) Map<String,Object> mapValue,
  104. Integer apiId,
  105. Integer pageNum,
  106. Integer pageSize,
  107. String index
  108. ){
  109. if(mapValue == null){
  110. mapValue = new HashMap<>();
  111. }
  112. if(index != null){
  113. mapValue.put("index", index + "%");
  114. }
  115. //不分页筛选数据
  116. List<Map<String, Object>> allCapacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
  117. PageHelper.startPage(pageNum,pageSize);
  118. //分页数据
  119. List<Map<String, Object>> capacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
  120. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
  121. return success(pageList);
  122. }
  123. @ApiOperation(value="通过订单ID查询订单下所有物资")
  124. @ApiImplicitParams({
  125. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  126. @ApiImplicitParam(name = "apiId(248)", value = "动态表头", required = false, dataType = "Integer"),
  127. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  128. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  129. })
  130. @PostMapping("/getMaterialMesByOrderId")
  131. public RESTfulResult getMaterialMesByOrderId(@RequestBody(required=false) Map<String,Object> mapValue,
  132. Integer apiId,
  133. Integer pageNum,
  134. Integer pageSize,
  135. String orderId
  136. ){
  137. if(mapValue == null){
  138. mapValue = new HashMap<>();
  139. }
  140. if(orderId != null){
  141. mapValue.put("orderId", orderId);
  142. }
  143. //不分页筛选数据
  144. List<Map<String, Object>> allCapacity = universalMapper.getMaterialMesByOrderId(mapValue);
  145. PageHelper.startPage(pageNum,pageSize);
  146. //分页数据
  147. List<Map<String, Object>> capacity = universalMapper.getMaterialMesByOrderId(mapValue);
  148. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
  149. return success(pageList);
  150. }
  151. @ApiModelProperty(value = "模糊查询物资")
  152. @ApiImplicitParams({
  153. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  154. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  155. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  156. })
  157. @PostMapping("/queryAPOMaterialByLike")
  158. public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  159. Integer pageNum,
  160. Integer pageSize,
  161. Integer apiId,
  162. String index) {
  163. if(mapValue == null) {
  164. mapValue = new HashMap<>();
  165. }
  166. if(index != null){
  167. mapValue.put("index", "%" + index + "%");
  168. }
  169. List<Map<String, Object>> list = universalMapper.queryAPOMaterialByLike(mapValue);
  170. PageHelper.startPage(pageNum, pageSize);
  171. //分页查询数据
  172. List<Map<String, Object>> columnList = universalMapper.queryAPOMaterialByLike(mapValue);
  173. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  174. return success(data);
  175. }
  176. @ApiModelProperty(value = "模糊查询卸货点")
  177. @ApiImplicitParams({
  178. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  179. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  180. @ApiImplicitParam(name = "apiId", value = "374", required = false, dataType = "BigDecimal")
  181. })
  182. @PostMapping("/getUnloadingMesByLike")
  183. public RESTfulResult getUnloadingMesByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  184. Integer pageNum,
  185. Integer pageSize,
  186. Integer apiId,
  187. Integer type,
  188. String index) {
  189. if(mapValue == null) {
  190. mapValue = new HashMap<>();
  191. }
  192. if(type != null){
  193. mapValue.put("type", type);
  194. }
  195. if(index != null){
  196. mapValue.put("index", "%" + index + "%");
  197. }
  198. List<Map<String, Object>> list = universalMapper.getUnloadingMesByLike(mapValue);
  199. PageHelper.startPage(pageNum, pageSize);
  200. //分页查询数据
  201. List<Map<String, Object>> columnList = universalMapper.getUnloadingMesByLike(mapValue);
  202. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  203. return success(data);
  204. }
  205. @ApiModelProperty(value = "模糊查询物资")
  206. @ApiImplicitParams({
  207. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  208. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  209. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  210. })
  211. @PostMapping("/queryMaterialByLike")
  212. public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  213. Integer pageNum,
  214. Integer pageSize,
  215. Integer apiId,
  216. String index,
  217. String startNum) {
  218. if(mapValue == null) {
  219. mapValue = new HashMap<>();
  220. }
  221. if(startNum != null){
  222. mapValue.put("startNum", startNum + "%");
  223. }
  224. if(index != null){
  225. mapValue.put("index", "%" + index + "%");
  226. }
  227. List<Map<String, Object>> list = universalMapper.queryMaterialByLike(mapValue);
  228. PageHelper.startPage(pageNum, pageSize);
  229. //分页查询数据
  230. List<Map<String, Object>> columnList = universalMapper.queryMaterialByLike(mapValue);
  231. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  232. return success(data);
  233. }
  234. }