UniversalController.java 23 KB

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