AmstruckInwardRequirementController.java 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.model.AmstruckInwardRequirement;
  4. import com.steerinfo.dil.service.IAmstruckInwardRequirementService;
  5. import com.steerinfo.dil.util.BaseRESTfulController;
  6. import com.steerinfo.dil.util.ColumnDataUtil;
  7. import com.steerinfo.dil.util.PageListAdd;
  8. import com.steerinfo.framework.controller.RESTfulResult;
  9. import com.steerinfo.framework.service.pagehelper.PageHelper;
  10. import io.swagger.annotations.ApiImplicitParam;
  11. import io.swagger.annotations.ApiImplicitParams;
  12. import io.swagger.annotations.ApiModelProperty;
  13. import io.swagger.models.auth.In;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.math.BigDecimal;
  17. import java.util.Date;
  18. import java.util.HashMap;
  19. import java.util.List;
  20. import java.util.Map;
  21. /**
  22. * AmstruckInwardRequirement RESTful接口:
  23. * @author generator
  24. * @version 1.0-SNAPSHORT 2021-10-25 11:30
  25. * 类描述
  26. * 修订历史:
  27. * 日期:2021-10-25
  28. * 作者:generator
  29. * 参考:
  30. * 描述:AmstruckInwardRequirement RESTful接口
  31. * @see null
  32. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  33. */
  34. @RestController
  35. @RequestMapping("/${api.version}/amstruckinwardrequirement")
  36. public class AmstruckInwardRequirementController extends BaseRESTfulController {
  37. @Autowired
  38. IAmstruckInwardRequirementService amstruckInwardRequirementService;
  39. @Autowired
  40. ColumnDataUtil columnDataUtil;
  41. @Autowired
  42. ESFeign esFeign;
  43. /**
  44. *用车单位提出需求
  45. *新增用车需求
  46. */
  47. @PostMapping("/addTruckRequirement")
  48. public RESTfulResult addTruckRequirement(@RequestBody Map<String,Object> mapValue) {
  49. int result = amstruckInwardRequirementService.insert(mapValue);
  50. return success(result);
  51. }
  52. /*
  53. 新增采购内转需求
  54. */
  55. @PostMapping("/addPurInwardRequirement")
  56. public RESTfulResult addPurInwardRequirement(@RequestBody Map<String,Object>mapValue){
  57. int result = amstruckInwardRequirementService.insertPurInwardRequirement(mapValue);
  58. return success(result);
  59. }
  60. /**
  61. * 删除用车需求
  62. */
  63. @PostMapping("/deleteTruckRequirement/{requirementId}")
  64. public RESTfulResult deleteTruckRequirement(@PathVariable("requirementId") BigDecimal requirementId) {
  65. int result = amstruckInwardRequirementService.deleteTruckRequirement(requirementId);
  66. return success(result);
  67. }
  68. /**
  69. * 修改用车需求/下发用车需求
  70. */
  71. @PostMapping("/updateTruckRequirement")
  72. public RESTfulResult updateTruckRequirement(@RequestBody AmstruckInwardRequirement amstruckInwardRequirement) {
  73. int result = amstruckInwardRequirementService.updateTruckRequirement(amstruckInwardRequirement);
  74. return success(result);
  75. }
  76. /**
  77. * 查询修改渲染
  78. */
  79. @PostMapping("/selectRequirement/{requirementId}")
  80. public RESTfulResult selectRequirement(@PathVariable("requirementId") Integer requirementId) {
  81. List<Map<String,Object>> result = amstruckInwardRequirementService.selectRequirement(requirementId);
  82. return success(result);
  83. }
  84. /**
  85. * 下发需求
  86. */
  87. @PostMapping("/downRequirement")
  88. public RESTfulResult downRequirement(@RequestBody List<Map<String,Object>> requirementIds) {
  89. int result = amstruckInwardRequirementService.downRequirement(requirementIds);
  90. return success(result);
  91. }
  92. /**
  93. * 接收需求
  94. */
  95. @PostMapping("/receiveRequirement/{requirementId}")
  96. public RESTfulResult receiveRequirement(@PathVariable("requirementId") Integer requirementId) {
  97. int result = amstruckInwardRequirementService.receiveRequirement(requirementId);
  98. return success(result);
  99. }
  100. /**
  101. * 展示未下发的用车需求
  102. * @param mapValue
  103. * @param pageNum
  104. * @param pageSize
  105. * @param apiId
  106. * @return
  107. */
  108. @ApiModelProperty(value = "展示用车需求")
  109. @ApiImplicitParams({
  110. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  111. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  112. @ApiImplicitParam(name = "apiId", value = "207(0,1)/250(2)", required = false, dataType = "Integer"),
  113. @ApiImplicitParam(name = "requirementStatus", value = "需求状态", required = false, dataType = "Integer")
  114. })
  115. @PostMapping("/getTruckRequirementList")
  116. public RESTfulResult getTruckRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
  117. Integer pageNum,
  118. Integer pageSize,
  119. Integer apiId,
  120. Integer requirementStatus,
  121. String con) {
  122. if (con != null) {
  123. if (!con.equals("undefined")) {
  124. String index="get_truck_requirement_list2";//设置要查询的索引名称
  125. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  126. }
  127. }
  128. if (mapValue == null) {
  129. mapValue = new HashMap<>();
  130. }
  131. mapValue.put("requirementStatus",requirementStatus);
  132. List<Map<String, Object>> truckRequirementList = null;
  133. if (mapValue.size() == 1) {
  134. //将查询结果存入索引中
  135. truckRequirementList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
  136. Map<String, Object> map1 = new HashMap<>();
  137. //添加索引
  138. map1.put("index","get_truck_requirement_list2");
  139. //添加id
  140. map1.put("indexId","requirementId");
  141. truckRequirementList.add(map1);
  142. //新建索引
  143. esFeign.insertIndex(truckRequirementList);
  144. //删除
  145. truckRequirementList.remove(truckRequirementList.size()-1);
  146. }
  147. if (truckRequirementList == null) {
  148. truckRequirementList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
  149. }
  150. PageHelper.startPage(pageNum, pageSize);
  151. //分页查询数据
  152. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
  153. PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
  154. return success(data);
  155. }
  156. //展示采购内转需求
  157. @PostMapping("/getPurRequirementList")
  158. public RESTfulResult getPurRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
  159. Integer pageNum,
  160. Integer pageSize,
  161. Integer apiId,
  162. Integer requirementStatus,
  163. String con,
  164. String userId,
  165. String carrierSsoId,
  166. String enableStatus,
  167. String planStatus) {
  168. if (con != null) {
  169. if (!con.equals("undefined")) {
  170. String index="get_pur_requirement_list";//设置要查询的索引名称
  171. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  172. }
  173. }
  174. if (mapValue == null) {
  175. mapValue = new HashMap<>();
  176. }
  177. if(userId != null){
  178. mapValue.put("userId",userId);
  179. }
  180. if(carrierSsoId != null){
  181. mapValue.put("carrierSsoId",carrierSsoId);
  182. }
  183. if(enableStatus != null){
  184. mapValue.put("enableStatus",enableStatus);
  185. }
  186. if(planStatus != null){
  187. mapValue.put("planStatus",planStatus);
  188. }
  189. mapValue.put("requirementStatus",requirementStatus);
  190. List<Map<String, Object>> truckRequirementList = null;
  191. if (mapValue.size() == 1) {
  192. //将查询结果存入索引中
  193. truckRequirementList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
  194. Map<String, Object> map1 = new HashMap<>();
  195. //添加索引
  196. map1.put("index","get_pur_requirement_list");
  197. //添加id
  198. map1.put("indexId","purRequirementId");
  199. truckRequirementList.add(map1);
  200. //新建索引
  201. esFeign.insertIndex(truckRequirementList);
  202. //删除
  203. truckRequirementList.remove(truckRequirementList.size()-1);
  204. }
  205. if (truckRequirementList == null) {
  206. truckRequirementList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
  207. }
  208. PageHelper.startPage(pageNum, pageSize);
  209. //分页查询数据
  210. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
  211. PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
  212. return success(data);
  213. }
  214. @ApiModelProperty(value = "展示批次信息")
  215. @ApiImplicitParams({
  216. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  217. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  218. @ApiImplicitParam(name = "apiId", value = "252", required = false, dataType = "Integer"),
  219. })
  220. @PostMapping("/getPurchaseIdByBatch")
  221. public RESTfulResult getPurchaseIdByBatch(@RequestBody(required = false) Map<String,Object> mapValue,
  222. Integer pageNum,
  223. Integer pageSize,
  224. Integer apiId,
  225. String con) {
  226. // if (con != null) {
  227. // if (!con.equals("undefined")) {
  228. // String index="get_purchase_batch";//设置要查询的索引名称
  229. // return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  230. // }
  231. // }
  232. // if (mapValue == null) {
  233. // mapValue = new HashMap<>();
  234. // }
  235. // List<Map<String, Object>> truckRequirementList = null;
  236. // if (mapValue.size() == 0) {
  237. // //将查询结果存入索引中
  238. // truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
  239. // Map<String, Object> map1 = new HashMap<>();
  240. // //添加索引
  241. // map1.put("index","get_purchase_batch");
  242. // //添加id
  243. // map1.put("indexId","purchaseOrderId");
  244. // truckRequirementList.add(map1);
  245. // //新建索引
  246. // esFeign.insertIndex(truckRequirementList);
  247. // //删除
  248. // truckRequirementList.remove(truckRequirementList.size()-1);
  249. // }
  250. // if (truckRequirementList == null) {
  251. // truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
  252. // }
  253. List<Map<String,Object>> truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
  254. PageHelper.startPage(pageNum, pageSize);
  255. //分页查询数据
  256. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
  257. PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
  258. return success(data);
  259. }
  260. //异地库下拉框
  261. @GetMapping("/getOffsetWarehouse")
  262. public RESTfulResult getOffsetWarehouse(){
  263. List<Map<String,Object>> mapList = amstruckInwardRequirementService.getOffsetWareHouse();
  264. return success(mapList);
  265. }
  266. @ApiModelProperty(value = "仓库模代框")
  267. @ApiImplicitParams({
  268. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  269. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  270. @ApiImplicitParam(name = "apiId", value = "251", required = false, dataType = "Integer"),
  271. })
  272. @PostMapping("/getWareHouse")
  273. public RESTfulResult getWareHouse(@RequestBody(required = false) Map<String,Object> mapValue,
  274. Integer pageNum,
  275. Integer pageSize,
  276. Integer apiId,
  277. String con) {
  278. if (con != null) {
  279. if (!con.equals("undefined")) {
  280. String index="get_ware_house";//设置要查询的索引名称
  281. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
  282. }
  283. }
  284. if (mapValue == null) {
  285. mapValue = new HashMap<>();
  286. }
  287. List<Map<String, Object>> truckRequirementList = null;
  288. if (mapValue.size() == 0) {
  289. //将查询结果存入索引中
  290. truckRequirementList = amstruckInwardRequirementService.getWareHouse(mapValue);
  291. Map<String, Object> map1 = new HashMap<>();
  292. //添加索引
  293. map1.put("index","get_ware_house");
  294. //添加id
  295. map1.put("indexId","wareHouseId");
  296. truckRequirementList.add(map1);
  297. //新建索引
  298. esFeign.insertIndex(truckRequirementList);
  299. //删除
  300. truckRequirementList.remove(truckRequirementList.size()-1);
  301. }
  302. if (truckRequirementList == null) {
  303. truckRequirementList = amstruckInwardRequirementService.getWareHouse(mapValue);
  304. }
  305. PageHelper.startPage(pageNum, pageSize);
  306. //分页查询数据
  307. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getWareHouse(mapValue);
  308. PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
  309. return success(data);
  310. }
  311. /**
  312. * 承运商下拉
  313. * @return
  314. */
  315. @GetMapping("/getCapacityType")
  316. public RESTfulResult getCapacityType() {
  317. List<Map<String,Object>> mapList = amstruckInwardRequirementService.getCapacityType();
  318. return success(mapList);
  319. }
  320. /**
  321. * 发货单位下拉
  322. * @return
  323. */
  324. @GetMapping("/getShipperUser")
  325. public RESTfulResult getShipperUser() {
  326. List<Map<String,Object>> mapList = amstruckInwardRequirementService.getShipperUser();
  327. return success(mapList);
  328. }
  329. }