TmstrainLoadingResultController.java 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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 mapValue
  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) Map<String,Object> mapValue) {
  86. int i=0;
  87. try{
  88. i = tmstrainLoadingResultService.addTmstrainLoadingResult(mapValue);
  89. }catch (Exception e){
  90. return failed(e.getMessage());
  91. }
  92. return success(i);
  93. }
  94. /**
  95. * 通过主键查询车皮装车作业信息
  96. *
  97. * @param resultId
  98. * @return
  99. */
  100. @ApiOperation(value = "通过主键查询车皮装车作业信息")
  101. @ApiImplicitParams({
  102. @ApiImplicitParam(name = "resultId", value = "车皮装车主键", required = false, dataType = "BigDecimal")
  103. })
  104. @PostMapping(value = "/getTmstrainLoadingResultByResultId/{resultId}")
  105. public RESTfulResult getTmstrainLoadingResultByResultId(@PathVariable("resultId") BigDecimal resultId) {
  106. List<Map<String, Object>> loadingResultByResultId = tmstrainLoadingResultService.getTmstrainLoadingResultByResultId(resultId);
  107. return success(loadingResultByResultId);
  108. }
  109. /**
  110. * 通过主键修改车皮装车作业实绩
  111. *
  112. * @param map
  113. * @return
  114. */
  115. @ApiOperation(value = "通过主键修改车皮装车作业实绩")
  116. @ApiImplicitParams({
  117. @ApiImplicitParam(name = "tmstrainLoadingResult", value = "修改车皮装车map", required = false, dataType = "TmstrainWagonLoadResult")
  118. })
  119. @PostMapping(value = "/upadteTmstrainLoadingResultByResultId")
  120. public RESTfulResult upadteTmstrainLoadingResultByResultId(@RequestBody(required = false) Map<String,Object> map) {
  121. int i=-1;
  122. try{
  123. i = tmstrainLoadingResultService.updateTmstrainLoadingResult(map);
  124. }catch (Exception e){
  125. return failed(e.getMessage());
  126. }
  127. return success(i);
  128. }
  129. /**
  130. * 通过主键删除车皮装车作业实绩
  131. *
  132. * @param resultId
  133. * @return
  134. */
  135. @ApiOperation(value = "通过主键删除车皮装车作业实绩")
  136. @ApiImplicitParams({
  137. @ApiImplicitParam(name = "resultId", value = "主键ID", required = false, dataType = "BigDecimal")
  138. })
  139. @PostMapping(value = "/deleteTmstrainLoadingResultByResultId")
  140. public RESTfulResult deleteTmstrainLoadingResultByResultId(@RequestParam BigDecimal resultId) {
  141. int i = tmstrainLoadingResultService.deleteTmstrainLoadingResultByResultId(resultId);
  142. return success(i);
  143. }
  144. /**
  145. * 获取发站地点名称
  146. *
  147. * @param
  148. * @return
  149. */
  150. @ApiOperation(value = "获取发站地点名称")
  151. @ApiImplicitParams({
  152. })
  153. @GetMapping(value = "/getSendStationName")
  154. public RESTfulResult getSendStationName() {
  155. return success(tmstrainLoadingResultService.getSendStationName());
  156. }
  157. /**
  158. * 获取到站地点名称
  159. *
  160. * @param
  161. * @return
  162. */
  163. @ApiOperation(value = "获取到站地点名称")
  164. @GetMapping(value = "/getArrivalStationName")
  165. public RESTfulResult getArrivalStationName() {
  166. return success(tmstrainLoadingResultService.getArrivalStationName());
  167. }
  168. /**
  169. * 获取批次ID
  170. *
  171. * @param
  172. * @return
  173. */
  174. @ApiOperation(value = "获取批次ID")
  175. @GetMapping(value = "/getBatchId")
  176. public RESTfulResult getBatchId() {
  177. return success(tmstrainLoadingResultService.getBatchId());
  178. }
  179. /**
  180. * 获取装车车皮号
  181. *
  182. * @param
  183. * @return
  184. */
  185. @ApiOperation(value = "获取已装车还未卸车车皮")
  186. @ApiImplicitParams({
  187. @ApiImplicitParam(name = "apiId(213)", value = "表头", required = false, dataType = "Interger")
  188. })
  189. @PostMapping(value = "/getWagonNo/{resultType}")
  190. public RESTfulResult getWagonNo(@PathVariable("resultType") Integer resultType,
  191. @RequestBody(required = false) Map<String, Object> mapValue,
  192. Integer apiId,
  193. Integer pageNum,
  194. Integer pageSize,
  195. String wagon,
  196. String purchaseOrderNum,
  197. String materialName) {
  198. mapValue.put("resultType", resultType);
  199. mapValue.put("wagon",wagon);
  200. mapValue.put("purchaseOrderNum",purchaseOrderNum);
  201. mapValue.put("materialName",materialName);
  202. //不分页筛选数据
  203. PageHelper.startPage(pageNum, pageSize);
  204. //分页数据
  205. List<Map<String, Object>> wagonNo = tmstrainLoadingResultService.getWagonNo(mapValue);
  206. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, wagonNo);
  207. return success(pageList);
  208. }
  209. //内转物流新增装车
  210. @ApiOperation(value = "内转物流新增装车")
  211. @PostMapping(value = "/addTrainLoadResultForConverted")
  212. public RESTfulResult addTrainLoadResultForConverted(@RequestBody(required = false) Map<String, Object> map) {
  213. return success(tmstrainLoadingResultService.addTrainLoadResultForConverted(map));
  214. }
  215. //内转物流新增装车
  216. @ApiOperation(value = "进口矿港存库出库")
  217. @PostMapping(value = "/addWarehouseOutResult")
  218. public RESTfulResult addWarehouseOutResult(@RequestBody(required = false) Map<String, Object> map) {
  219. int result = tmstrainLoadingResultService.addWarehouseOutResult(map);
  220. if (result==-1){
  221. return failed("港存库实时库存不够");
  222. }
  223. return success();
  224. }
  225. /**
  226. * 内转物流通过主键查询车皮装车作业信息
  227. *
  228. * @param resultId
  229. * @return
  230. */
  231. @ApiOperation(value = "内转物流通过主键查询车皮装车作业信息")
  232. @ApiImplicitParams({
  233. @ApiImplicitParam(name = "resultId", value = "车皮装车主键", required = false, dataType = "BigDecimal")
  234. })
  235. @PostMapping(value = "/selectLoadByResultId/{resultId}")
  236. public RESTfulResult selectLoadByResultId(@PathVariable("resultId") BigDecimal resultId) {
  237. List<Map<String, Object>> loadingResultByResultId = tmstrainLoadingResultService.selectLoadByResultId(resultId);
  238. System.out.println(loadingResultByResultId);
  239. return success(loadingResultByResultId);
  240. }
  241. @ApiOperation(value = "查询车皮物资信息")
  242. @ApiImplicitParams({
  243. @ApiImplicitParam(name = "apiId(259)", value = "表头", required = false, dataType = "Interger")
  244. })
  245. @PostMapping(value = "/getMaterialAndCarByLoadingId")
  246. public RESTfulResult getMaterialAndCarByLoadingId(
  247. @RequestBody(required = false) Map<String, Object> mapValue,
  248. Integer apiId,
  249. Integer pageNum,
  250. Integer pageSize,
  251. Integer loadingId,
  252. Integer unloadingId) {
  253. if(loadingId != null){
  254. mapValue.put("resultId", loadingId);
  255. }
  256. if(unloadingId != null){
  257. mapValue.put("unloadingId", unloadingId);
  258. }
  259. //不分页筛选数据
  260. PageHelper.startPage(pageNum, pageSize);
  261. //分页数据
  262. List<Map<String, Object>> mes = tmstrainLoadingResultService.getMaterialAndCarByLoadingId(mapValue);
  263. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, mes);
  264. return success(pageList);
  265. }
  266. @ApiOperation(value = "国产矿物流新增装车")
  267. @PostMapping(value = "/addDomesticLoadResult")
  268. public RESTfulResult addDomesticLoadResult(@RequestBody(required = false) Map<String, Object> mapValue) {
  269. int result=0;
  270. try{
  271. result=tmstrainLoadingResultService.addDomesticLoadResult(mapValue);
  272. }catch (Exception e){
  273. return failed(e.getMessage());
  274. }
  275. return success(result);
  276. }
  277. @ApiOperation(value = "国产矿物流补录装车信息")
  278. @PostMapping(value = "/updateDomesticLoadResult")
  279. public RESTfulResult updateDomesticLoadResult(@RequestBody(required = false) Map<String, Object> map) throws Exception {
  280. int i = tmstrainLoadingResultService.updateDomesticLoadResult(map);
  281. if(i==-1){
  282. return success("有委托发送失败,请联系技术人员");
  283. }
  284. return success("发送成功");
  285. }
  286. @ApiOperation(value = "根据物资名和外轮船名查询采购订单号")
  287. @PostMapping(value = "/getPurchaseOrderList")
  288. public RESTfulResult getPurchaseOrderList(@RequestBody(required = false) Map<String, Object> map,
  289. Integer apiId,
  290. Integer pageNum,
  291. Integer pageSize,
  292. String materialName,
  293. String resultForeignShipName) {
  294. if(materialName!=null)
  295. map.put("materialName",materialName);
  296. if(resultForeignShipName!=null)
  297. map.put("resultForeignShipName",resultForeignShipName);
  298. //不分页筛选数据
  299. PageHelper.startPage(pageNum, pageSize);
  300. //分页数据
  301. List<Map<String, Object>> mes = tmstrainLoadingResultService.getPurchaseOrderList(map);
  302. PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, mes);
  303. return success(pageList);
  304. }
  305. }