UniversalController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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.math.BigDecimal;
  20. import java.util.HashMap;
  21. import java.util.List;
  22. import java.util.Map;
  23. /**
  24. * @ author :TXF
  25. * @ time :2021/10/19 18:06
  26. * 通用接口
  27. */
  28. @RequestMapping("${api.version}/uc")
  29. @RestController
  30. public class UniversalController extends BaseRESTfulController {
  31. @Autowired
  32. UniversalServiceImpl universalService;
  33. @Autowired
  34. UniversalMapper universalMapper;
  35. @Autowired
  36. ColumnDataUtil columnDataUtil;
  37. @ApiOperation(value="查询数据打印提货单接口")
  38. @ApiImplicitParams({
  39. @ApiImplicitParam(name = "mapValue", value = "运输订单号", required = false, dataType = "Map"),
  40. })
  41. @PostMapping("/printTHD")
  42. public RESTfulResult printTiHuoDan(@RequestBody(required=false) Map<String, Object> mapValue){
  43. Map<String, Object> tiHuoDan = universalService.printTiHuoDan((String) mapValue.get("orderNumber"));
  44. return success(tiHuoDan);
  45. }
  46. @ApiModelProperty(value = "模糊查询发货单位")
  47. @ApiImplicitParams({
  48. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  49. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  50. @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal")
  51. })
  52. @PostMapping("/querySupplierByLike")
  53. public RESTfulResult querySupplierByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  54. Integer pageNum,
  55. Integer pageSize,
  56. Integer apiId,
  57. String index) {
  58. if(mapValue == null) {
  59. mapValue = new HashMap<>();
  60. }
  61. if(index != null){
  62. mapValue.put("index","%" + index + "%");
  63. }
  64. List<Map<String, Object>> list = universalMapper.querySupplierByLike(mapValue);
  65. PageHelper.startPage(pageNum, pageSize);
  66. //分页查询数据
  67. List<Map<String, Object>> columnList = universalMapper.querySupplierByLike(mapValue);
  68. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  69. return success(data);
  70. }
  71. @ApiModelProperty(value = "查询所有发货单位")
  72. @ApiImplicitParams({
  73. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  74. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  75. @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal")
  76. })
  77. @PostMapping("/queryAllSupplierByLike")
  78. public RESTfulResult queryAllSupplierByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  79. Integer pageNum,
  80. Integer pageSize,
  81. Integer apiId,
  82. String index) {
  83. if(mapValue == null) {
  84. mapValue = new HashMap<>();
  85. }
  86. if(index != null){
  87. mapValue.put("index","%" + index + "%");
  88. }
  89. List<Map<String, Object>> list = universalMapper.queryAllSupplierByLike(mapValue);
  90. PageHelper.startPage(pageNum, pageSize);
  91. //分页查询数据
  92. List<Map<String, Object>> columnList = universalMapper.queryAllSupplierByLike(mapValue);
  93. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  94. return success(data);
  95. }
  96. @ApiModelProperty(value = "通过物资ID查询该物资的发货单位信息")
  97. @ApiImplicitParams({
  98. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  99. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  100. @ApiImplicitParam(name = "apiId", value = "247", required = false, dataType = "BigDecimal")
  101. })
  102. @PostMapping("/getSupplierMesByMaterialId")
  103. public RESTfulResult getSupplierMesByMaterialId(@RequestBody(required = false) Map<String,Object> mapValue,
  104. Integer pageNum,
  105. Integer pageSize,
  106. Integer apiId,
  107. String index, String materialId) {
  108. if(mapValue == null)
  109. mapValue = new HashMap<>();
  110. if(!"null".equals(materialId))
  111. mapValue.put("materialId",materialId);
  112. if(index != null){
  113. mapValue.put("index","%" + index + "%");
  114. }
  115. List<Map<String, Object>> list = universalMapper.getSupplierMesByMaterialId(mapValue);
  116. PageHelper.startPage(pageNum, pageSize);
  117. //分页查询数据
  118. List<Map<String, Object>> columnList = universalMapper.getSupplierMesByMaterialId(mapValue);
  119. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  120. return success(data);
  121. }
  122. @ApiOperation(value="查询所有空闲的运力信息")
  123. @ApiImplicitParams({
  124. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  125. @ApiImplicitParam(name = "apiId()", value = "动态表头", required = false, dataType = "Integer"),
  126. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  127. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  128. })
  129. @PostMapping("/getAllCapacityByCarrierLike")
  130. public RESTfulResult getAllCapacityByCarrierLike(@RequestBody(required=false) Map<String,Object> mapValue,
  131. Integer apiId,
  132. Integer pageNum,
  133. Integer pageSize,
  134. String carrierSsoId,
  135. String index
  136. ){
  137. if(mapValue == null){
  138. mapValue = new HashMap<>();
  139. }
  140. if(index != null){
  141. mapValue.put("index", "%" + index + "%");
  142. }
  143. if(carrierSsoId != null){
  144. if(!"null".equals(carrierSsoId)){
  145. mapValue.put("carrierSsoId", carrierSsoId);
  146. }
  147. }
  148. //不分页筛选数据
  149. List<Map<String, Object>> allCapacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
  150. PageHelper.startPage(pageNum,pageSize);
  151. //分页数据
  152. List<Map<String, Object>> capacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
  153. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
  154. return success(pageList);
  155. }
  156. @ApiOperation(value="通过订单ID查询订单下所有物资")
  157. @ApiImplicitParams({
  158. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  159. @ApiImplicitParam(name = "apiId(395)", value = "动态表头", required = false, dataType = "Integer"),
  160. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  161. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  162. })
  163. @PostMapping("/getMaterialMesByOrderId")
  164. public RESTfulResult getMaterialMesByOrderId(@RequestBody(required=false) Map<String,Object> mapValue,
  165. Integer apiId,
  166. Integer pageNum,
  167. Integer pageSize,
  168. String orderId
  169. ){
  170. if(mapValue == null){
  171. mapValue = new HashMap<>();
  172. }
  173. if(orderId != null){
  174. mapValue.put("orderId", orderId);
  175. }
  176. //不分页筛选数据
  177. List<Map<String, Object>> allCapacity = universalMapper.getMaterialMesByOrderId(mapValue);
  178. PageHelper.startPage(pageNum,pageSize);
  179. //分页数据
  180. List<Map<String, Object>> capacity = universalMapper.getMaterialMesByOrderId(mapValue);
  181. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
  182. return success(pageList);
  183. }
  184. @ApiModelProperty(value = "通过订单ID查询订单下物资信息")
  185. @PostMapping("/getOrderMaterialMesByOrderId/{orderId}")
  186. public RESTfulResult getMaterialMesByOrderId(@PathVariable("orderId") Integer orderId){
  187. List<Map<String, Object>> mes = universalMapper.getOrderMaterialMesByOrderId(new BigDecimal(orderId));
  188. return success(mes);
  189. }
  190. @ApiModelProperty(value = "模糊查询物资")
  191. @ApiImplicitParams({
  192. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  193. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  194. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  195. })
  196. @PostMapping("/queryAPOMaterialByLike")
  197. public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  198. Integer pageNum,
  199. Integer pageSize,
  200. Integer apiId,
  201. String index) {
  202. if(mapValue == null) {
  203. mapValue = new HashMap<>();
  204. }
  205. if(index != null){
  206. mapValue.put("index", "%" + index + "%");
  207. }
  208. List<Map<String, Object>> list = universalMapper.queryAPOMaterialByLike(mapValue);
  209. PageHelper.startPage(pageNum, pageSize);
  210. //分页查询数据
  211. List<Map<String, Object>> columnList = universalMapper.queryAPOMaterialByLike(mapValue);
  212. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  213. return success(data);
  214. }
  215. @ApiModelProperty(value = "模糊查询卸货点")
  216. @ApiImplicitParams({
  217. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  218. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  219. @ApiImplicitParam(name = "apiId", value = "374", required = false, dataType = "BigDecimal")
  220. })
  221. @PostMapping("/getUnloadingMesByLike")
  222. public RESTfulResult getUnloadingMesByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  223. Integer pageNum,
  224. Integer pageSize,
  225. Integer apiId,
  226. Integer type,
  227. String index) {
  228. if(mapValue == null) {
  229. mapValue = new HashMap<>();
  230. }
  231. if(type != null){
  232. mapValue.put("type", type);
  233. }
  234. if(index != null){
  235. mapValue.put("index", "%" + index + "%");
  236. }
  237. List<Map<String, Object>> list = universalMapper.getUnloadingMesByLike(mapValue);
  238. PageHelper.startPage(pageNum, pageSize);
  239. //分页查询数据
  240. List<Map<String, Object>> columnList = universalMapper.getUnloadingMesByLike(mapValue);
  241. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  242. return success(data);
  243. }
  244. @ApiModelProperty(value = "模糊查询物资")
  245. @ApiImplicitParams({
  246. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  247. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  248. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  249. })
  250. @PostMapping("/queryMaterialByLike")
  251. public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  252. Integer pageNum,
  253. Integer pageSize,
  254. Integer apiId,
  255. String index,
  256. String startNum) {
  257. if(mapValue == null) {
  258. mapValue = new HashMap<>();
  259. }
  260. if(startNum != null){
  261. mapValue.put("startNum", startNum + "%");
  262. }
  263. if(index != null){
  264. mapValue.put("index", "%" + index + "%");
  265. }
  266. List<Map<String, Object>> list = universalMapper.queryMaterialByLike(mapValue);
  267. PageHelper.startPage(pageNum, pageSize);
  268. //分页查询数据
  269. List<Map<String, Object>> columnList = universalMapper.queryMaterialByLike(mapValue);
  270. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  271. return success(data);
  272. }
  273. @ApiModelProperty(value = "模糊查询批次")
  274. @ApiImplicitParams({
  275. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  276. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  277. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  278. })
  279. @PostMapping("/queryBatchByLike")
  280. public RESTfulResult queryBatchByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  281. Integer pageNum,
  282. Integer pageSize,
  283. Integer apiId,
  284. String index) {
  285. if(mapValue == null) {
  286. mapValue = new HashMap<>();
  287. }
  288. if(index != null){
  289. mapValue.put("index", "%" + index + "%");
  290. }
  291. List<Map<String, Object>> list = universalMapper.getBatchAndOrderMes(mapValue);
  292. PageHelper.startPage(pageNum, pageSize);
  293. //分页查询数据
  294. List<Map<String, Object>> columnList = universalMapper.getBatchAndOrderMes(mapValue);
  295. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  296. return success(data);
  297. }
  298. @ApiModelProperty(value = "边输边查承运商")
  299. @PostMapping("/getCarrierMesByLike")
  300. public RESTfulResult getCarrierMesByLike(@RequestParam("index") String index) {
  301. List<Map<String, Object>> list = universalMapper.getCarrierMesByLike(index == null?"":index);
  302. return success(list);
  303. }
  304. @ApiModelProperty(value = "模糊查询收货单位")
  305. @ApiImplicitParams({
  306. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  307. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  308. @ApiImplicitParam(name = "apiId", value = "396", required = false, dataType = "BigDecimal")
  309. })
  310. @PostMapping("/queryConsigneeByLike")
  311. public RESTfulResult queryConsigneeByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  312. Integer pageNum,
  313. Integer pageSize,
  314. Integer apiId,
  315. String index) {
  316. if(mapValue == null) {
  317. mapValue = new HashMap<>();
  318. }
  319. if(index != null){
  320. mapValue.put("index","%" + index + "%");
  321. }
  322. List<Map<String, Object>> list = universalMapper.queryConsigneeByLike(mapValue);
  323. PageHelper.startPage(pageNum, pageSize);
  324. //分页查询数据
  325. List<Map<String, Object>> columnList = universalMapper.queryConsigneeByLike(mapValue);
  326. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  327. return success(data);
  328. }
  329. @ApiModelProperty(value = "模糊查询物资信息")
  330. @ApiImplicitParams({
  331. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  332. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  333. @ApiImplicitParam(name = "apiId", value = "395", required = false, dataType = "BigDecimal")
  334. })
  335. @PostMapping("/selectAllMaterialName")
  336. public RESTfulResult selectAllMaterialName(@RequestBody(required = false) Map<String,Object> mapValue,
  337. Integer pageNum,
  338. Integer pageSize,
  339. Integer apiId,
  340. String index) {
  341. if(mapValue == null) {
  342. mapValue = new HashMap<>();
  343. }
  344. if(index != null){
  345. mapValue.put("index","%" + index + "%");
  346. }
  347. List<Map<String, Object>> list = universalMapper.selectAllMaterialName(mapValue);
  348. PageHelper.startPage(pageNum, pageSize);
  349. //分页查询数据
  350. List<Map<String, Object>> columnList = universalMapper.selectAllMaterialName(mapValue);
  351. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  352. return success(data);
  353. }
  354. @ApiModelProperty(value = "返回sha1加密字符串")
  355. @PostMapping("/sha1DigestUtils")
  356. public String sha1DigestUtils(String text){
  357. return universalService.sha1DigestUtils(text);
  358. }
  359. @ApiModelProperty(value = "查装货卸货点")
  360. @PostMapping("/selectUnloadingPoint")
  361. public List<Map<String, Object>> selectUnloadingPoint() {
  362. return universalMapper.selectUnloadingPoint();
  363. }
  364. @ApiModelProperty(value = "模糊查询承运商")
  365. @ApiImplicitParams({
  366. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  367. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  368. @ApiImplicitParam(name = "apiId", value = "412", required = false, dataType = "BigDecimal")
  369. })
  370. @PostMapping("/getCarrierListByLike")
  371. public RESTfulResult getCarrierListByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  372. Integer apiId,
  373. Integer pageNum,
  374. Integer pageSize,
  375. String index) {
  376. if(index != null){
  377. if(index.length() == 0){
  378. index = null;
  379. }else {
  380. index = "%" + index + "%";
  381. }
  382. }
  383. if (mapValue == null) {
  384. mapValue = new HashMap<>();
  385. }
  386. mapValue.put("index",index);
  387. List<Map<String, Object>> list = universalMapper.getCarrierListByLike(mapValue);
  388. PageHelper.startPage(pageNum, pageSize);
  389. //分页查询数据
  390. List<Map<String, Object>> columnList = universalMapper.getCarrierListByLike(mapValue);
  391. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  392. return success(data);
  393. }
  394. @ApiModelProperty(value = "所有门岗下拉框")
  395. @GetMapping("/getAllGatepost")
  396. public List<Map<String,Object>> getAllGatepost(){
  397. return universalMapper.getAllGatepost();
  398. }
  399. @ApiModelProperty(value = "模糊查询收货单位")
  400. @ApiImplicitParams({
  401. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  402. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  403. @ApiImplicitParam(name = "apiId", value = "418", required = false, dataType = "BigDecimal")
  404. })
  405. @PostMapping("/getConsigneeListByLike")
  406. public RESTfulResult getConsigneeListByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  407. Integer apiId,
  408. Integer pageNum,
  409. Integer pageSize,
  410. String index) {
  411. if(index != null){
  412. if(index.length() == 0){
  413. index = null;
  414. }else {
  415. index = "%" + index + "%";
  416. }
  417. }
  418. if (mapValue == null) {
  419. mapValue = new HashMap<>();
  420. }
  421. mapValue.put("index",index);
  422. List<Map<String, Object>> list = universalMapper.getConsigneeListByLike(mapValue);
  423. PageHelper.startPage(pageNum, pageSize);
  424. //分页查询数据
  425. List<Map<String, Object>> columnList = universalMapper.getConsigneeListByLike(mapValue);
  426. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  427. return success(data);
  428. }
  429. }