WmsReboundResultController.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.service.impl.WmsInboundResultServiceImpl;
  4. import com.steerinfo.dil.service.impl.WmsInboundScanResultServiceImpl;
  5. import com.steerinfo.dil.service.impl.WmspReboundResultServiceImpl;
  6. import com.steerinfo.dil.util.BaseRESTfulController;
  7. import com.steerinfo.dil.util.ColumnDataUtil;
  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.ApiOperation;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.PostMapping;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RestController;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;
  22. //退库
  23. @RestController
  24. @RequestMapping("${api.version}/reboundResult")
  25. public class WmsReboundResultController extends BaseRESTfulController {
  26. @Autowired
  27. private WmspReboundResultServiceImpl wmsReboundResultService;
  28. @Autowired
  29. private WmsInboundResultServiceImpl wmsInboundResultService;
  30. @Autowired
  31. private WmsInboundScanResultServiceImpl wmsInboundScanResultService;
  32. @Autowired
  33. ColumnDataUtil columnDataUtil;
  34. @Autowired
  35. ESFeign esFeign;
  36. /**
  37. * 展示退库实绩信息
  38. * @param mapValue
  39. * @param apiId
  40. * @param pageNum
  41. * @param pageSize
  42. * @return
  43. */
  44. @PostMapping("/getWmsReboundResult")
  45. @ApiOperation(value = "展示退库实绩信息")
  46. @ApiImplicitParams({
  47. @ApiImplicitParam(name = "apiId", value = "161", required = false, dataType = "BigDecimal"),
  48. })
  49. public RESTfulResult getWmsReboundResult(@RequestBody(required = false) Map<String, Object> mapValue,
  50. Integer apiId,
  51. Integer pageNum,
  52. Integer pageSize,
  53. String con) {
  54. if(con != null){
  55. if(!"undefined".equals(con)){
  56. String index = "get_wms_reboundResult";
  57. return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
  58. }
  59. }
  60. List<Map<String,Object>>reboundResultList = null;
  61. if(mapValue.size() == 0){
  62. //将查询结果存入索引中
  63. reboundResultList = wmsInboundResultService.getReboundResult(mapValue);
  64. Map<String, Object> inboundResultMap = new HashMap<>();
  65. //添加索引
  66. inboundResultMap.put("index","get_wms_reboundResult");
  67. //添加ID
  68. inboundResultMap.put("indexId","reboundResultId");
  69. reboundResultList.add(inboundResultMap);
  70. //新建索引
  71. esFeign.insertIndex(reboundResultList);
  72. //删除
  73. reboundResultList.remove(reboundResultList.size() -1);
  74. }
  75. if(reboundResultList == null) {
  76. reboundResultList = wmsInboundResultService.getReboundResult(mapValue);
  77. }
  78. /*分页*/
  79. PageHelper.startPage(pageNum, pageSize);
  80. List<Map<String,Object>> columnList = wmsInboundResultService.getReboundResult(mapValue);
  81. PageListAdd pageList = columnDataUtil.tableColumnData(apiId,reboundResultList,columnList);
  82. return success(pageList);
  83. }
  84. //新增退库实绩
  85. @PostMapping("/insertReboundResult")
  86. public RESTfulResult insertReboundResult(@RequestBody List<Map<String, Object>> map){
  87. int a= wmsReboundResultService.addReboundResult(map);
  88. //新增退库扫描实绩
  89. return success(a);
  90. }
  91. //新增退库实绩
  92. @PostMapping("/getReIssuedResult")
  93. public RESTfulResult getReIssuedResult(@RequestBody Map<String, Object> map){
  94. //新增退库扫描实绩
  95. return success(map);
  96. }
  97. }