RmsConsigneeController.java 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. package com.steerinfo.dil.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.steerinfo.dil.feign.ESFeign;
  4. import com.steerinfo.dil.model.RmsCapacity;
  5. import com.steerinfo.dil.model.RmsConsignee;
  6. import com.steerinfo.dil.service.impl.RmsConsigneeServiceImpl;
  7. import com.steerinfo.dil.util.BaseRESTfulController;
  8. import com.steerinfo.dil.util.ColumnDataUtil;
  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.text.ParseException;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;
  22. @RestController
  23. @RequestMapping("/${api.version}/rmsconsignee")
  24. public class RmsConsigneeController extends BaseRESTfulController {
  25. @Autowired
  26. RmsConsigneeServiceImpl rmsConsigneeService;
  27. @Autowired
  28. ColumnDataUtil columnDataUtil;
  29. @Autowired
  30. ESFeign esFeign;
  31. @ApiOperation(value = "模糊查询展示客户信息表", notes = "分页查询")
  32. @ApiImplicitParams({
  33. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  34. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  35. @ApiImplicitParam(name = "apiId", value = "407", required = false, dataType = "BigDecimal"),
  36. })
  37. @PostMapping(value = "/getConsigneeList")
  38. public RESTfulResult getConsigneeList(@RequestBody(required = false) Map<String, Object> mapValue,
  39. Integer apiId,
  40. Integer pageNum,
  41. Integer pageSize,
  42. String con
  43. ) {
  44. if (mapValue==null){
  45. mapValue=new HashMap<>();
  46. }
  47. if (con != null && !con.equals("undefined")) {
  48. mapValue.put("con","%" + con + "%");
  49. }
  50. List<Map<String, Object>> listTotal = rmsConsigneeService.getConsigneeList(mapValue);
  51. PageHelper.startPage(pageNum, pageSize);
  52. //分页查询数据
  53. List<Map<String, Object>> columnList = rmsConsigneeService.getConsigneeList(mapValue);
  54. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  55. return success(data);
  56. }
  57. /**
  58. * 新增收货客户
  59. * @param
  60. * @return
  61. */
  62. @ApiOperation(value="创建", notes="根据RmsConsignee对象创建")
  63. @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsConsignee", required = true, dataType = "RmsCapacity")
  64. @PostMapping(value = "/insertConsignee")
  65. public RESTfulResult insertConsignee(@RequestBody Map<String,Object> mapVal) throws ParseException {
  66. int result = rmsConsigneeService.insertConsignee(mapVal);
  67. if(result==-1){
  68. return failed("收货客户已存在");
  69. }
  70. return success(result);
  71. }
  72. /**
  73. * 收货客户注册
  74. * @param
  75. * @return
  76. */
  77. @ApiOperation(value="创建", notes="根据RmsConsignee对象创建")
  78. @ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsConsignee", required = true, dataType = "RmsCapacity")
  79. @PostMapping(value = "/signConsignee")
  80. public RESTfulResult signConsignee(@RequestBody Map<String,Object> mapVal) {
  81. int result = rmsConsigneeService.signConsignee(mapVal);
  82. if(result==-1){
  83. return failed("请到金蝶系统先添加该收获客户");
  84. }
  85. return success(result);
  86. }
  87. /**
  88. * 根据id更新客户信息
  89. * @param
  90. * @return
  91. */
  92. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的rmsConsignee信息来更新详细信息")
  93. @ApiImplicitParams({
  94. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short"),
  95. @ApiImplicitParam(name = "rmsConsignee", value = "详细实体rmsConsignee", required = true, dataType = "RmsConsignee")
  96. })
  97. @PostMapping(value = "/updateConsignee", produces = "application/json;charset=UTF-8")
  98. public RESTfulResult updateConsignee( @RequestBody Map<String,Object> mapVal )throws ParseException{
  99. int result = rmsConsigneeService.updateConsignee(mapVal);
  100. return success(result);
  101. }
  102. /**
  103. * 根据id删除客户信息
  104. * @param id
  105. * @return
  106. */
  107. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  108. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "Short")
  109. @PostMapping(value = "/deleteConsignee/{id}")
  110. public RESTfulResult deleteConsignee(@PathVariable("id") BigDecimal id){
  111. return success(rmsConsigneeService.deleteConsignee(id));
  112. }
  113. /**
  114. * 根据id获取客户信息
  115. * @param id
  116. * @return
  117. */
  118. @ApiOperation(value="获取客户信息详细信息", notes="根据url的id来获取详细信息")
  119. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  120. @PostMapping(value = "/getConsigneeById/{id}")
  121. public RESTfulResult getConsigneeById(@PathVariable("id") BigDecimal id){
  122. List<Map<String,Object>> list= rmsConsigneeService.getConsigneeById(id);
  123. return success(list);
  124. }
  125. /*
  126. *边输边查收货客户父节点
  127. * */
  128. @ApiOperation(value = "边输边查收货客户父节点")
  129. @PostMapping(value = "getConsigneeFarId")
  130. public RESTfulResult getConsigneeFarId(@RequestParam(value ="state") String state){
  131. List<Map<String,Object>> result=rmsConsigneeService.getConsigneeFarId(state);
  132. return success(result);
  133. }
  134. @ApiOperation(value = "batchUpdateConsigneeRole")
  135. @PostMapping("batchUpdateConsigneeRole")
  136. public RESTfulResult batchUpdateConsigneeRole() {
  137. int i = rmsConsigneeService.batchUpdateConsigneeRole();
  138. return success(i);
  139. }
  140. }