OrderChangeApiController.java 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. package com.goafanti.order.controller;
  2. import javax.servlet.http.HttpServletRequest;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.RestController;
  7. import com.goafanti.common.bo.Result;
  8. import com.goafanti.common.constant.ErrorConstants;
  9. import com.goafanti.common.controller.CertifyApiController;
  10. import com.goafanti.order.bo.NewOrderChangeBo;
  11. import com.goafanti.order.service.OrderChangeService;
  12. @RestController
  13. @RequestMapping(value = "/api/admin/orderChange")
  14. public class OrderChangeApiController extends CertifyApiController {
  15. @Autowired
  16. private OrderChangeService orderChangeService;
  17. /**
  18. * 新增变更
  19. */
  20. @RequestMapping(value = "/addOrderChange", method = RequestMethod.POST)
  21. public Result addOrderChange(NewOrderChangeBo t){
  22. Result res = new Result();
  23. if(null==t.getOrderNo()){
  24. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "订单编号"));
  25. return res;
  26. }
  27. if(orderChangeService.checkOderNo(t.getOrderNo())){
  28. res.getError().add(buildError( "", "订单变更未完成"));
  29. return res;
  30. }
  31. res.setData(orderChangeService.addOrderChange(t));
  32. return res;
  33. }
  34. /**
  35. * 订单查看变更详情
  36. */
  37. @RequestMapping(value = "/orderChangeDetails", method = RequestMethod.GET)
  38. public Result orderChangeDetails(String orderNo){
  39. Result res = new Result();
  40. if(null==orderNo){
  41. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "订单编号"));
  42. return res;
  43. }
  44. res.setData(orderChangeService.orderChangeDetails( orderNo));
  45. return res;
  46. }
  47. /**
  48. * id查看变更详情
  49. */
  50. @RequestMapping(value = "/orderChangeDetailsById", method = RequestMethod.GET)
  51. public Result orderChangeDetailsById(Integer id){
  52. Result res = new Result();
  53. if(null==id){
  54. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "订单变更编号"));
  55. return res;
  56. }
  57. res.setData(orderChangeService.orderChangeDetailsById( id));
  58. return res;
  59. }
  60. /**
  61. * 变更修改
  62. */
  63. @RequestMapping(value = "/updateOrderChange", method = RequestMethod.POST)
  64. public Result orderChangeDetails(NewOrderChangeBo t ,Integer changeType){
  65. Result res = new Result();
  66. if(null==t.getId()){
  67. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "订单变更id"));
  68. return res;
  69. }
  70. if (changeType==null) {
  71. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "修改变更类型"));
  72. return res;
  73. }
  74. res.setData(orderChangeService.updateOrderChange(t,changeType));
  75. return res;
  76. }
  77. /**
  78. * 变更审核
  79. */
  80. @RequestMapping(value = "/orderChangeAudit", method = RequestMethod.POST)
  81. public Result orderChangeAudit(String orderNo,String remarks,Integer status,Integer processState){
  82. Result res = new Result();
  83. if(null==orderNo){
  84. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "订单编号", "订单编号"));
  85. return res;
  86. }
  87. if(null==status){//2通过 3驳回
  88. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "审核结果", "审核结果"));
  89. return res;
  90. }
  91. if(null==remarks){
  92. res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "审核批示", "审核批示"));
  93. return res;
  94. }
  95. res.setData(orderChangeService.pushOrderChangeAudit( orderNo, remarks, status, processState));
  96. return res;
  97. }
  98. /**
  99. * 变更日志
  100. */
  101. @RequestMapping(value ="/orderChangeLogList",method = RequestMethod.GET)
  102. public Result orderChangeLogList(String changeId) {
  103. Result res =new Result();
  104. if (null==changeId) {
  105. res.getError().add(buildError("变更id错误", "变更id错误"));
  106. return res;
  107. }
  108. res.data(orderChangeService.selectOrderChangeLogList(changeId));
  109. return res;
  110. }
  111. /**
  112. * 变更文件上传
  113. */
  114. @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  115. public Result uploadRefundOrderFile(HttpServletRequest req,String sign){
  116. Result res = new Result();
  117. //order_refund_file
  118. res.setData(handleFile(res, "/order_change_file/", false, req, sign));
  119. return res;
  120. }
  121. /**
  122. * 变更列表
  123. */
  124. @RequestMapping(value ="/orderChangeList",method = RequestMethod.GET)
  125. public Result orderChangeList(String userName,Integer processState,Integer timeType,String startTime,String endTime,
  126. String depId,String salesmanName,Integer complete,Integer pageSize, Integer pageNo) {
  127. Result res =new Result();
  128. res.data(orderChangeService.selectOrderChangeList( userName, processState, timeType, startTime, endTime,
  129. depId, salesmanName, complete,pageSize, pageNo));
  130. return res;
  131. }
  132. }