UniversalController.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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 = "通过物资ID查询该物资的发货单位信息")
  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("/getSupplierMesByMaterialId")
  78. public RESTfulResult getSupplierMesByMaterialId(@RequestBody(required = false) Map<String,Object> mapValue,
  79. Integer pageNum,
  80. Integer pageSize,
  81. Integer apiId,
  82. String index, String materialId) {
  83. if(mapValue == null)
  84. mapValue = new HashMap<>();
  85. if(!"null".equals(materialId))
  86. mapValue.put("materialId",materialId);
  87. if(index != null){
  88. mapValue.put("index","%" + index + "%");
  89. }
  90. List<Map<String, Object>> list = universalMapper.getSupplierMesByMaterialId(mapValue);
  91. PageHelper.startPage(pageNum, pageSize);
  92. //分页查询数据
  93. List<Map<String, Object>> columnList = universalMapper.getSupplierMesByMaterialId(mapValue);
  94. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  95. return success(data);
  96. }
  97. @ApiOperation(value="查询所有空闲的运力信息")
  98. @ApiImplicitParams({
  99. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  100. @ApiImplicitParam(name = "apiId()", value = "动态表头", required = false, dataType = "Integer"),
  101. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  102. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  103. })
  104. @PostMapping("/getAllCapacityByCarrierLike")
  105. public RESTfulResult getAllCapacityByCarrierLike(@RequestBody(required=false) Map<String,Object> mapValue,
  106. Integer apiId,
  107. Integer pageNum,
  108. Integer pageSize,
  109. String index
  110. ){
  111. if(mapValue == null){
  112. mapValue = new HashMap<>();
  113. }
  114. if(index != null){
  115. mapValue.put("index", index + "%");
  116. }
  117. //不分页筛选数据
  118. List<Map<String, Object>> allCapacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
  119. PageHelper.startPage(pageNum,pageSize);
  120. //分页数据
  121. List<Map<String, Object>> capacity = universalMapper.getAllCapacityByCarrierLike(mapValue);
  122. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
  123. return success(pageList);
  124. }
  125. @ApiOperation(value="通过订单ID查询订单下所有物资")
  126. @ApiImplicitParams({
  127. @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
  128. @ApiImplicitParam(name = "apiId(395)", value = "动态表头", required = false, dataType = "Integer"),
  129. @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
  130. @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
  131. })
  132. @PostMapping("/getMaterialMesByOrderId")
  133. public RESTfulResult getMaterialMesByOrderId(@RequestBody(required=false) Map<String,Object> mapValue,
  134. Integer apiId,
  135. Integer pageNum,
  136. Integer pageSize,
  137. String orderId
  138. ){
  139. if(mapValue == null){
  140. mapValue = new HashMap<>();
  141. }
  142. if(orderId != null){
  143. mapValue.put("orderId", orderId);
  144. }
  145. //不分页筛选数据
  146. List<Map<String, Object>> allCapacity = universalMapper.getMaterialMesByOrderId(mapValue);
  147. PageHelper.startPage(pageNum,pageSize);
  148. //分页数据
  149. List<Map<String, Object>> capacity = universalMapper.getMaterialMesByOrderId(mapValue);
  150. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allCapacity,capacity);
  151. return success(pageList);
  152. }
  153. @ApiModelProperty(value = "通过订单ID查询订单下物资信息")
  154. @PostMapping("/getOrderMaterialMesByOrderId/{orderId}")
  155. public RESTfulResult getMaterialMesByOrderId(@PathVariable("orderId") Integer orderId){
  156. List<Map<String, Object>> mes = universalMapper.getOrderMaterialMesByOrderId(new BigDecimal(orderId));
  157. return success(mes);
  158. }
  159. @ApiModelProperty(value = "模糊查询物资")
  160. @ApiImplicitParams({
  161. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  162. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  163. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  164. })
  165. @PostMapping("/queryAPOMaterialByLike")
  166. public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  167. Integer pageNum,
  168. Integer pageSize,
  169. Integer apiId,
  170. String index) {
  171. if(mapValue == null) {
  172. mapValue = new HashMap<>();
  173. }
  174. if(index != null){
  175. mapValue.put("index", "%" + index + "%");
  176. }
  177. List<Map<String, Object>> list = universalMapper.queryAPOMaterialByLike(mapValue);
  178. PageHelper.startPage(pageNum, pageSize);
  179. //分页查询数据
  180. List<Map<String, Object>> columnList = universalMapper.queryAPOMaterialByLike(mapValue);
  181. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  182. return success(data);
  183. }
  184. @ApiModelProperty(value = "模糊查询卸货点")
  185. @ApiImplicitParams({
  186. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  187. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  188. @ApiImplicitParam(name = "apiId", value = "374", required = false, dataType = "BigDecimal")
  189. })
  190. @PostMapping("/getUnloadingMesByLike")
  191. public RESTfulResult getUnloadingMesByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  192. Integer pageNum,
  193. Integer pageSize,
  194. Integer apiId,
  195. Integer type,
  196. String index) {
  197. if(mapValue == null) {
  198. mapValue = new HashMap<>();
  199. }
  200. if(type != null){
  201. mapValue.put("type", type);
  202. }
  203. if(index != null){
  204. mapValue.put("index", "%" + index + "%");
  205. }
  206. List<Map<String, Object>> list = universalMapper.getUnloadingMesByLike(mapValue);
  207. PageHelper.startPage(pageNum, pageSize);
  208. //分页查询数据
  209. List<Map<String, Object>> columnList = universalMapper.getUnloadingMesByLike(mapValue);
  210. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  211. return success(data);
  212. }
  213. @ApiModelProperty(value = "模糊查询物资")
  214. @ApiImplicitParams({
  215. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  216. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  217. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  218. })
  219. @PostMapping("/queryMaterialByLike")
  220. public RESTfulResult queryMaterialByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  221. Integer pageNum,
  222. Integer pageSize,
  223. Integer apiId,
  224. String index,
  225. String startNum) {
  226. if(mapValue == null) {
  227. mapValue = new HashMap<>();
  228. }
  229. if(startNum != null){
  230. mapValue.put("startNum", startNum + "%");
  231. }
  232. if(index != null){
  233. mapValue.put("index", "%" + index + "%");
  234. }
  235. List<Map<String, Object>> list = universalMapper.queryMaterialByLike(mapValue);
  236. PageHelper.startPage(pageNum, pageSize);
  237. //分页查询数据
  238. List<Map<String, Object>> columnList = universalMapper.queryMaterialByLike(mapValue);
  239. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  240. return success(data);
  241. }
  242. @ApiModelProperty(value = "模糊查询批次")
  243. @ApiImplicitParams({
  244. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  245. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  246. @ApiImplicitParam(name = "apiId", value = "244", required = false, dataType = "BigDecimal")
  247. })
  248. @PostMapping("/queryBatchByLike")
  249. public RESTfulResult queryBatchByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  250. Integer pageNum,
  251. Integer pageSize,
  252. Integer apiId,
  253. String index) {
  254. if(mapValue == null) {
  255. mapValue = new HashMap<>();
  256. }
  257. if(index != null){
  258. mapValue.put("index", "%" + index + "%");
  259. }
  260. List<Map<String, Object>> list = universalMapper.getBatchAndOrderMes(mapValue);
  261. PageHelper.startPage(pageNum, pageSize);
  262. //分页查询数据
  263. List<Map<String, Object>> columnList = universalMapper.getBatchAndOrderMes(mapValue);
  264. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  265. return success(data);
  266. }
  267. @ApiModelProperty(value = "边输边查承运商")
  268. @PostMapping("/getCarrierMesByLike")
  269. public RESTfulResult getCarrierMesByLike(@RequestParam("index") String index) {
  270. if(index != null){
  271. if(index.length() == 0){
  272. index = null;
  273. }else {
  274. index += "%";
  275. }
  276. }
  277. List<Map<String, Object>> list = universalMapper.getCarrierMesByLike(index);
  278. return success(list);
  279. }
  280. @ApiModelProperty(value = "模糊查询收货单位")
  281. @ApiImplicitParams({
  282. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  283. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  284. @ApiImplicitParam(name = "apiId", value = "396", required = false, dataType = "BigDecimal")
  285. })
  286. @PostMapping("/queryConsigneeByLike")
  287. public RESTfulResult queryConsigneeByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  288. Integer pageNum,
  289. Integer pageSize,
  290. Integer apiId,
  291. String index) {
  292. if(mapValue == null) {
  293. mapValue = new HashMap<>();
  294. }
  295. if(index != null){
  296. mapValue.put("index","%" + index + "%");
  297. }
  298. List<Map<String, Object>> list = universalMapper.queryConsigneeByLike(mapValue);
  299. PageHelper.startPage(pageNum, pageSize);
  300. //分页查询数据
  301. List<Map<String, Object>> columnList = universalMapper.queryConsigneeByLike(mapValue);
  302. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  303. return success(data);
  304. }
  305. @ApiModelProperty(value = "模糊查询物资信息")
  306. @ApiImplicitParams({
  307. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  308. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  309. @ApiImplicitParam(name = "apiId", value = "395", required = false, dataType = "BigDecimal")
  310. })
  311. @PostMapping("/selectAllMaterialName")
  312. public RESTfulResult selectAllMaterialName(@RequestBody(required = false) Map<String,Object> mapValue,
  313. Integer pageNum,
  314. Integer pageSize,
  315. Integer apiId,
  316. String index) {
  317. if(mapValue == null) {
  318. mapValue = new HashMap<>();
  319. }
  320. if(index != null){
  321. mapValue.put("index","%" + index + "%");
  322. }
  323. List<Map<String, Object>> list = universalMapper.selectAllMaterialName(mapValue);
  324. PageHelper.startPage(pageNum, pageSize);
  325. //分页查询数据
  326. List<Map<String, Object>> columnList = universalMapper.selectAllMaterialName(mapValue);
  327. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  328. return success(data);
  329. }
  330. @ApiModelProperty(value = "返回MD5加密字符串")
  331. @PostMapping("/sha1DigestUtils")
  332. public String sha1DigestUtils(String text){
  333. return universalService.sha1DigestUtils(text);
  334. //获取当前订单还没有净重的计量实绩
  335. }
  336. @ApiModelProperty(value = "边输边查装货卸货点")
  337. @PostMapping("/selectUnloadingPoint")
  338. public RESTfulResult selectUnloadingPoint(@RequestParam("index") String index) {
  339. if(index != null){
  340. if(index.length() == 0){
  341. index = null;
  342. }else {
  343. index += "%";
  344. }
  345. }
  346. List<Map<String, Object>> list = universalMapper.selectUnloadingPoint(index);
  347. return success(list);
  348. }
  349. @ApiModelProperty(value = "模糊查询承运商")
  350. @ApiImplicitParams({
  351. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  352. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  353. @ApiImplicitParam(name = "apiId", value = "412", required = false, dataType = "BigDecimal")
  354. })
  355. @PostMapping("/getCarrierListByLike")
  356. public RESTfulResult getCarrierListByLike(@RequestBody(required = false) Map<String,Object> mapValue,
  357. Integer apiId,
  358. Integer pageNum,
  359. Integer pageSize,
  360. String index) {
  361. if(index != null){
  362. if(index.length() == 0){
  363. index = null;
  364. }else {
  365. index = "%" + index + "%";
  366. }
  367. }
  368. if (mapValue == null) {
  369. mapValue = new HashMap<>();
  370. }
  371. mapValue.put("index",index);
  372. List<Map<String, Object>> list = universalMapper.getCarrierListByLike(mapValue);
  373. PageHelper.startPage(pageNum, pageSize);
  374. //分页查询数据
  375. List<Map<String, Object>> columnList = universalMapper.getCarrierListByLike(mapValue);
  376. PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
  377. return success(data);
  378. }
  379. }