TmstrainLoadingResultController.java 12 KB

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