TmstrainLoadingResultController.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. package com.steerinfo.dil.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.steerinfo.dil.feign.ColumnDataFeign;
  4. import com.steerinfo.dil.feign.ESFeign;
  5. import com.steerinfo.dil.model.TmstrainLoadingResult;
  6. import com.steerinfo.dil.service.ITmstrainLoadingResultService;
  7. import com.steerinfo.dil.util.ColumnDataUtil;
  8. import com.steerinfo.dil.util.BaseRESTfulController;
  9. import com.steerinfo.dil.util.PageListAdd;
  10. import com.steerinfo.framework.controller.RESTfulResult;
  11. import com.steerinfo.framework.service.pagehelper.PageHelper;
  12. import io.swagger.annotations.ApiImplicitParam;
  13. import io.swagger.annotations.ApiImplicitParams;
  14. import io.swagger.annotations.ApiOperation;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import java.math.BigDecimal;
  18. import java.util.*;
  19. /**
  20. * TmstrainLoadingResult RESTful接口:
  21. *
  22. * @author generator
  23. * @version 1.0-SNAPSHORT 2021-08-30 02:23
  24. * 类描述
  25. * 修订历史:
  26. * 日期:2021-08-30
  27. * 作者:generator
  28. * 参考:
  29. * 描述:TmstrainLoadingResult RESTful接口
  30. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  31. * @see null
  32. */
  33. @RestController
  34. @RequestMapping("/${api.version}/tmstrainloadingresults")
  35. public class TmstrainLoadingResultController extends BaseRESTfulController {
  36. @Autowired
  37. ITmstrainLoadingResultService tmstrainLoadingResultService;
  38. @Autowired
  39. ColumnDataFeign columnDataFeign;
  40. @Autowired
  41. ESFeign esFeign;
  42. @Autowired
  43. ColumnDataUtil columnDataUtil;
  44. @ApiOperation(value = "查询装车作业信息")
  45. @ApiImplicitParams({
  46. @ApiImplicitParam(name = "apiId(58)", value = "表头", required = false, dataType = "Interger")
  47. })
  48. @PostMapping("/getTmstrainWagonLoad")
  49. public RESTfulResult getTmstrainWagonLoad(@RequestBody(required = false) Map<String, Object> mapValue,
  50. Integer apiId,
  51. Integer pageNum,
  52. Integer pageSize,
  53. Integer resultType,
  54. Integer materialId,
  55. Integer supplierId,
  56. String con) {
  57. mapValue.put("resultType", resultType);
  58. mapValue.put("materialId",materialId);
  59. mapValue.put("supplierId",supplierId);
  60. mapValue.put("pageNum",pageNum);
  61. mapValue.put("pageSize",pageSize);
  62. mapValue.put("con",con);
  63. PageHelper.startPage(pageNum, pageSize);
  64. List<Map<String, Object>> tmstrainWagonLoad1 = tmstrainLoadingResultService.getTmstrainWagonLoad(mapValue);
  65. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, tmstrainWagonLoad1);
  66. return success(pageList);
  67. }
  68. /**
  69. * 新增车皮装车作业实绩
  70. *
  71. * @param tmstrainLoadingResult
  72. * @return
  73. */
  74. @ApiOperation(value = "新增车皮装车作业实绩")
  75. @ApiImplicitParams({
  76. @ApiImplicitParam(name = "tmstrainLoadingResult", value = "车皮装车对象", required = false, dataType = "TmstrainLoadingResult")
  77. })
  78. @PostMapping(value = "/insertTmstrainLoadingResult")
  79. public RESTfulResult insertTmstrainLoadingResult(@RequestBody(required = false) TmstrainLoadingResult tmstrainLoadingResult) throws Exception {
  80. int i = tmstrainLoadingResultService.addTmstrainLoadingResult(tmstrainLoadingResult);
  81. return success(i);
  82. }
  83. /**
  84. * 通过主键查询车皮装车作业信息
  85. *
  86. * @param resultId
  87. * @return
  88. */
  89. @ApiOperation(value = "通过主键查询车皮装车作业信息")
  90. @ApiImplicitParams({
  91. @ApiImplicitParam(name = "resultId", value = "车皮装车主键", required = false, dataType = "BigDecimal")
  92. })
  93. @PostMapping(value = "/getTmstrainLoadingResultByResultId/{resultId}")
  94. public RESTfulResult getTmstrainLoadingResultByResultId(@PathVariable("resultId") BigDecimal resultId) {
  95. List<Map<String, Object>> loadingResultByResultId = tmstrainLoadingResultService.getTmstrainLoadingResultByResultId(resultId);
  96. return success(loadingResultByResultId);
  97. }
  98. /**
  99. * 通过主键修改车皮装车作业实绩
  100. *
  101. * @param map
  102. * @return
  103. */
  104. @ApiOperation(value = "通过主键修改车皮装车作业实绩")
  105. @ApiImplicitParams({
  106. @ApiImplicitParam(name = "tmstrainLoadingResult", value = "修改车皮装车map", required = false, dataType = "TmstrainWagonLoadResult")
  107. })
  108. @PostMapping(value = "/upadteTmstrainLoadingResultByResultId")
  109. public RESTfulResult upadteTmstrainLoadingResultByResultId(@RequestBody(required = false) Map<String,Object> map) throws Exception {
  110. int i = tmstrainLoadingResultService.updateTmstrainLoadingResult(map);
  111. if (i==-1){
  112. return failed("车皮号异常");
  113. }else if(i==-2){
  114. return failed("主键异常");
  115. }else if(i==-3){
  116. return failed("类型异常");
  117. }else if(i==-4){
  118. return failed("采购订单号异常");
  119. }
  120. return success(i);
  121. }
  122. /**
  123. * 通过主键删除车皮装车作业实绩
  124. *
  125. * @param resultId
  126. * @return
  127. */
  128. @ApiOperation(value = "通过主键删除车皮装车作业实绩")
  129. @ApiImplicitParams({
  130. @ApiImplicitParam(name = "resultId", value = "主键ID", required = false, dataType = "BigDecimal")
  131. })
  132. @PostMapping(value = "/deleteTmstrainLoadingResultByResultId")
  133. public RESTfulResult deleteTmstrainLoadingResultByResultId(@RequestParam BigDecimal resultId) {
  134. int i = tmstrainLoadingResultService.deleteTmstrainLoadingResultByResultId(resultId);
  135. return success(i);
  136. }
  137. /**
  138. * 获取发站地点名称
  139. *
  140. * @param
  141. * @return
  142. */
  143. @ApiOperation(value = "获取发站地点名称")
  144. @ApiImplicitParams({
  145. })
  146. @GetMapping(value = "/getSendStationName")
  147. public RESTfulResult getSendStationName() {
  148. return success(tmstrainLoadingResultService.getSendStationName());
  149. }
  150. /**
  151. * 获取到站地点名称
  152. *
  153. * @param
  154. * @return
  155. */
  156. @ApiOperation(value = "获取到站地点名称")
  157. @GetMapping(value = "/getArrivalStationName")
  158. public RESTfulResult getArrivalStationName() {
  159. return success(tmstrainLoadingResultService.getArrivalStationName());
  160. }
  161. /**
  162. * 获取批次ID
  163. *
  164. * @param
  165. * @return
  166. */
  167. @ApiOperation(value = "获取批次ID")
  168. @GetMapping(value = "/getBatchId")
  169. public RESTfulResult getBatchId() {
  170. return success(tmstrainLoadingResultService.getBatchId());
  171. }
  172. /**
  173. * 获取装车车皮号
  174. *
  175. * @param
  176. * @return
  177. */
  178. @ApiOperation(value = "获取已装车还未卸车车皮")
  179. @ApiImplicitParams({
  180. @ApiImplicitParam(name = "apiId(213)", value = "表头", required = false, dataType = "Interger")
  181. })
  182. @PostMapping(value = "/getWagonNo/{resultType}")
  183. public RESTfulResult getWagonNo(@PathVariable("resultType") Integer resultType,
  184. @RequestBody(required = false) Map<String, Object> mapValue,
  185. Integer apiId,
  186. Integer pageNum,
  187. Integer pageSize,
  188. String wagon,
  189. String purchaseOrderNum,
  190. String materialName) {
  191. mapValue.put("resultType", resultType);
  192. mapValue.put("wagon",wagon);
  193. mapValue.put("purchaseOrderNum",purchaseOrderNum);
  194. mapValue.put("materialName",materialName);
  195. //不分页筛选数据
  196. PageHelper.startPage(pageNum, pageSize);
  197. //分页数据
  198. List<Map<String, Object>> wagonNo = tmstrainLoadingResultService.getWagonNo(mapValue);
  199. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, wagonNo);
  200. return success(pageList);
  201. }
  202. //内转物流新增装车
  203. @ApiOperation(value = "内转物流新增装车")
  204. @PostMapping(value = "/addTrainLoadResultForConverted")
  205. public RESTfulResult addTrainLoadResultForConverted(@RequestBody(required = false) Map<String, Object> map) {
  206. return success(tmstrainLoadingResultService.addTrainLoadResultForConverted(map));
  207. }
  208. /**
  209. * 内转物流通过主键查询车皮装车作业信息
  210. *
  211. * @param resultId
  212. * @return
  213. */
  214. @ApiOperation(value = "内转物流通过主键查询车皮装车作业信息")
  215. @ApiImplicitParams({
  216. @ApiImplicitParam(name = "resultId", value = "车皮装车主键", required = false, dataType = "BigDecimal")
  217. })
  218. @PostMapping(value = "/selectLoadByResultId/{resultId}")
  219. public RESTfulResult selectLoadByResultId(@PathVariable("resultId") BigDecimal resultId) {
  220. List<Map<String, Object>> loadingResultByResultId = tmstrainLoadingResultService.selectLoadByResultId(resultId);
  221. System.out.println(loadingResultByResultId);
  222. return success(loadingResultByResultId);
  223. }
  224. @ApiOperation(value = "查询车皮物资信息")
  225. @ApiImplicitParams({
  226. @ApiImplicitParam(name = "apiId(259)", value = "表头", required = false, dataType = "Interger")
  227. })
  228. @PostMapping(value = "/getMaterialAndCarByLoadingId")
  229. public RESTfulResult getMaterialAndCarByLoadingId(
  230. @RequestBody(required = false) Map<String, Object> mapValue,
  231. Integer apiId,
  232. Integer pageNum,
  233. Integer pageSize,
  234. Integer loadingId,
  235. Integer unloadingId) {
  236. if(loadingId != null){
  237. mapValue.put("resultId", loadingId);
  238. }
  239. if(unloadingId != null){
  240. mapValue.put("unloadingId", unloadingId);
  241. }
  242. //不分页筛选数据
  243. PageHelper.startPage(pageNum, pageSize);
  244. //分页数据
  245. List<Map<String, Object>> mes = tmstrainLoadingResultService.getMaterialAndCarByLoadingId(mapValue);
  246. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, mes);
  247. return success(pageList);
  248. }
  249. @ApiOperation(value = "国产矿物流新增装车")
  250. @PostMapping(value = "/addDomesticLoadResult")
  251. public RESTfulResult addDomesticLoadResult(@RequestBody(required = false) List<Map<String, Object>> list) throws Exception {
  252. return success(tmstrainLoadingResultService.addDomesticLoadResult(list));
  253. }
  254. @ApiOperation(value = "国产矿物流补录装车信息")
  255. @PostMapping(value = "/updateDomesticLoadResult")
  256. public RESTfulResult updateDomesticLoadResult(@RequestBody(required = false) Map<String, Object> map) {
  257. int i = tmstrainLoadingResultService.updateDomesticLoadResult(map);
  258. if(i==-1){
  259. return success("有委托发送失败,请联系技术人员");
  260. }
  261. return success("发送成功");
  262. }
  263. @ApiOperation(value = "根据物资名和外轮船名查询采购订单号")
  264. @PostMapping(value = "/getPurchaseOrderList")
  265. public RESTfulResult getPurchaseOrderList(@RequestBody(required = false) Map<String, Object> map,
  266. Integer apiId,
  267. Integer pageNum,
  268. Integer pageSize,
  269. String materialName,
  270. String resultForeignShipName) {
  271. if(materialName!=null)
  272. map.put("materialName",materialName);
  273. if(resultForeignShipName!=null)
  274. map.put("resultForeignShipName",resultForeignShipName);
  275. //不分页筛选数据
  276. PageHelper.startPage(pageNum, pageSize);
  277. //分页数据
  278. List<Map<String, Object>> mes = tmstrainLoadingResultService.getPurchaseOrderList(map);
  279. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, mes);
  280. return success(pageList);
  281. }
  282. }