AmstruckInwardRequirementController.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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.DataChange;
  8. import com.steerinfo.dil.util.PageListAdd;
  9. import com.steerinfo.framework.controller.RESTfulResult;
  10. import com.steerinfo.framework.service.pagehelper.PageHelper;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. import io.swagger.annotations.ApiModelProperty;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.math.BigDecimal;
  17. import java.text.SimpleDateFormat;
  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. private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  44. /**
  45. *用车单位提出需求
  46. *新增用车需求
  47. */
  48. @PostMapping("/addTruckRequirement")
  49. public RESTfulResult addTruckRequirement(@RequestBody Map<String,Object> mapValue) {
  50. int result = amstruckInwardRequirementService.insert(mapValue);
  51. return success(result);
  52. }
  53. /*
  54. 新增采购内转需求
  55. */
  56. @PostMapping("/addPurInwardRequirement")
  57. public RESTfulResult addPurInwardRequirement(@RequestBody Map<String,Object>mapValue){
  58. int result = amstruckInwardRequirementService.insertPurInwardRequirement(mapValue);
  59. return success(result);
  60. }
  61. /**
  62. * 删除用车需求
  63. */
  64. @PostMapping("/deleteTruckRequirement/{requirementId}")
  65. public RESTfulResult deleteTruckRequirement(@PathVariable("requirementId") BigDecimal requirementId) {
  66. int result = amstruckInwardRequirementService.deleteTruckRequirement(requirementId);
  67. return success(result);
  68. }
  69. /**
  70. * 修改用车需求/下发用车需求
  71. */
  72. @PostMapping("/updateTruckRequirement")
  73. public RESTfulResult updateTruckRequirement(@RequestBody AmstruckInwardRequirement amstruckInwardRequirement) {
  74. int result = amstruckInwardRequirementService.updateTruckRequirement(amstruckInwardRequirement);
  75. return success(result);
  76. }
  77. /**
  78. * 查询修改渲染
  79. */
  80. @PostMapping("/selectRequirement/{requirementId}")
  81. public RESTfulResult selectRequirement(@PathVariable("requirementId") Integer requirementId) {
  82. List<Map<String,Object>> result = amstruckInwardRequirementService.selectRequirement(requirementId);
  83. return success(result);
  84. }
  85. /**
  86. * 下发需求
  87. */
  88. @PostMapping("/downRequirement")
  89. public RESTfulResult downRequirement(@RequestBody List<Map<String,Object>> requirementIds) {
  90. int result = amstruckInwardRequirementService.downRequirement(requirementIds);
  91. return success(result);
  92. }
  93. /**
  94. * 接收需求
  95. */
  96. @PostMapping("/receiveRequirement/{requirementId}")
  97. public RESTfulResult receiveRequirement(@PathVariable("requirementId") Integer requirementId) {
  98. int result = amstruckInwardRequirementService.receiveRequirement(requirementId);
  99. return success(result);
  100. }
  101. /*
  102. 根据需求ID查询需求详情
  103. */
  104. @PostMapping("/getRequirementMaterial/{requirementId}")
  105. public RESTfulResult getRequirementMaterial(@PathVariable("requirementId") Integer requirementId) {
  106. List<Map<String,Object>> listMap = amstruckInwardRequirementService.getRequirementMaterial(requirementId);
  107. return success(listMap);
  108. }
  109. /**
  110. * 展示未下发的用车需求
  111. * @param mapValue
  112. * @param pageNum
  113. * @param pageSize
  114. * @param apiId
  115. * @return
  116. */
  117. @ApiModelProperty(value = "展示用车需求")
  118. @ApiImplicitParams({
  119. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  120. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  121. @ApiImplicitParam(name = "apiId", value = "207(0,1)/250(2)", required = false, dataType = "Integer"),
  122. @ApiImplicitParam(name = "requirementStatus", value = "需求状态", required = false, dataType = "Integer")
  123. })
  124. @PostMapping("/getTruckRequirementList")
  125. public RESTfulResult getTruckRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
  126. Integer pageNum,
  127. Integer pageSize,
  128. Integer apiId,
  129. Integer requirementStatus,
  130. String orgCode,
  131. String index,
  132. String startTime,
  133. String endTime) {
  134. if (mapValue == null) {
  135. mapValue = new HashMap<>();
  136. }
  137. if (orgCode != null && !orgCode.equals("null")) {
  138. String con = "%"+orgCode+"%";
  139. mapValue.put("con",con);
  140. }
  141. if (index != null && !"null".equals(index)) {
  142. mapValue.put("index","%"+index+"%");
  143. }
  144. DataChange.queryDataByDateTime(startTime, endTime, mapValue,sdfDateTime);//根据时间段查询数据
  145. mapValue.put("requirementStatus",requirementStatus);
  146. PageHelper.startPage(pageNum, pageSize);
  147. //分页查询数据
  148. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
  149. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  150. return success(data);
  151. }
  152. //展示采购内转需求
  153. @PostMapping("/getPurRequirementList")
  154. public RESTfulResult getPurRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
  155. Integer pageNum,
  156. Integer pageSize,
  157. Integer apiId,
  158. Integer requirementStatus,
  159. String con,
  160. String userId,
  161. String carrierSsoId,
  162. String enableStatus,
  163. String planStatus,
  164. String startTime,
  165. String endTime,
  166. BigDecimal planId) {
  167. if (mapValue == null) {
  168. mapValue = new HashMap<>();
  169. }
  170. if(userId != null){
  171. mapValue.put("userId",userId);
  172. }
  173. if(carrierSsoId != null){
  174. mapValue.put("carrierSsoId",carrierSsoId);
  175. }
  176. if(enableStatus != null){
  177. mapValue.put("enableStatus",enableStatus);
  178. }
  179. if(planStatus != null){
  180. mapValue.put("planStatus",DataChange.dataToBigDecimal(planStatus));
  181. }
  182. if(con != null && !"null".equals(con)){
  183. mapValue.put("con","%" + con + "%");
  184. }
  185. if(planId != null && !"null".equals(planId)){
  186. mapValue.put("planId", planId);
  187. }
  188. mapValue.put("requirementStatus",requirementStatus);
  189. DataChange.queryDataByDateTime(startTime, endTime, mapValue,sdfDateTime);//根据时间段查询数据
  190. PageHelper.startPage(pageNum, pageSize);
  191. //分页查询数据
  192. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
  193. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  194. return success(data);
  195. }
  196. @ApiModelProperty(value = "展示批次信息")
  197. @ApiImplicitParams({
  198. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  199. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  200. @ApiImplicitParam(name = "apiId", value = "252", required = false, dataType = "Integer"),
  201. })
  202. @PostMapping("/getPurchaseIdByBatch")
  203. public RESTfulResult getPurchaseIdByBatch(@RequestBody(required = false) Map<String,Object> mapValue,
  204. Integer pageNum,
  205. Integer pageSize,
  206. Integer apiId,
  207. String con) {
  208. PageHelper.startPage(pageNum, pageSize);
  209. //分页查询数据
  210. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
  211. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  212. return success(data);
  213. }
  214. //异地库下拉框
  215. @GetMapping("/getOffsetWarehouse")
  216. public RESTfulResult getOffsetWarehouse(){
  217. List<Map<String,Object>> mapList = amstruckInwardRequirementService.getOffsetWareHouse();
  218. return success(mapList);
  219. }
  220. @ApiModelProperty(value = "仓库模代框")
  221. @ApiImplicitParams({
  222. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  223. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  224. @ApiImplicitParam(name = "apiId", value = "251", required = false, dataType = "Integer"),
  225. })
  226. @PostMapping("/getWareHouse")
  227. public RESTfulResult getWareHouse(@RequestBody(required = false) Map<String,Object> mapValue,
  228. Integer pageNum,
  229. Integer pageSize,
  230. Integer apiId,
  231. String con) {
  232. PageHelper.startPage(pageNum, pageSize);
  233. //分页查询数据
  234. List<Map<String, Object>> columnList = amstruckInwardRequirementService.getWareHouse(mapValue);
  235. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  236. return success(data);
  237. }
  238. /**
  239. * 承运商下拉
  240. * @return
  241. */
  242. @GetMapping("/getCapacityType")
  243. public RESTfulResult getCapacityType() {
  244. List<Map<String,Object>> mapList = amstruckInwardRequirementService.getCapacityType();
  245. return success(mapList);
  246. }
  247. /**
  248. * 发货单位下拉
  249. * @return
  250. */
  251. @GetMapping("/getShipperUser")
  252. public RESTfulResult getShipperUser() {
  253. List<Map<String,Object>> mapList = amstruckInwardRequirementService.getShipperUser();
  254. return success(mapList);
  255. }
  256. }