UniversalController.java 14 KB

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