AmsshipDeliveryNoticeController.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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.AmsshipDeliveryAttorney;
  5. import com.steerinfo.dil.model.AmsshipDeliveryNotice;
  6. import com.steerinfo.dil.model.OmsshipShipmentInstructions;
  7. import com.steerinfo.dil.service.IAmsshipDeliveryNoticeService;
  8. import com.steerinfo.dil.util.BaseRESTfulController;
  9. import com.steerinfo.dil.util.ColumnDataUtil;
  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 oracle.jdbc.proxy.annotation.Post;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.*;
  19. import java.util.*;
  20. import java.math.BigDecimal;
  21. /**
  22. * AmsshipDeliveryNotice RESTful接口:
  23. * @author generator
  24. * @version 1.0-SNAPSHORT 2021-08-18 03:54
  25. * 类描述
  26. * 修订历史:
  27. * 日期:2021-08-18
  28. * 作者:generator
  29. * 参考:
  30. * 描述:AmsshipDeliveryNotice RESTful接口
  31. * @see null
  32. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  33. */
  34. @RestController
  35. @RequestMapping("/${api.version}/amsshipdeliverynotices")
  36. public class AmsshipDeliveryNoticeController extends BaseRESTfulController {
  37. @Autowired
  38. IAmsshipDeliveryNoticeService amsshipDeliveryNoticeService;
  39. @Autowired
  40. ColumnDataUtil columnDataUtil;
  41. @Autowired
  42. ESFeign esFeign;
  43. @ApiOperation(value="展示发货通知单表", notes="分页查询")
  44. @ApiImplicitParams({
  45. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  46. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  47. @ApiImplicitParam(name = "apiId", value = "69", required = false, dataType = "BigDecimal"),
  48. })
  49. @PostMapping(value = "/getshipDeliveryNoticeList")
  50. public RESTfulResult getshipDeliveryNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
  51. Integer pageNum,
  52. Integer pageSize,
  53. Integer apiId,
  54. String con){
  55. //框计算
  56. if(con != null){
  57. if(!"undefined".equals(con)){
  58. //设置要查询的索引名称
  59. String index="get_ship_delivery_notice_list";
  60. //获取查询结果
  61. return success(esFeign.getConResult(mapVal,index,apiId,pageNum,pageSize,con));
  62. }
  63. }
  64. //初始化过滤
  65. List<Map<String, Object>> listTotal = null;
  66. //如果有条件查询则跳过初始化,和创建索引
  67. if (mapVal.size() == 0) {
  68. //将查询结果存入索引中
  69. listTotal = amsshipDeliveryNoticeService.selectShipDeliveryNotice(null);
  70. Map<String, Object> map = new HashMap<>();
  71. //添加索引
  72. map.put("index", "get_ship_delivery_notice_list");
  73. //添加id
  74. map.put("indexId", "noticeId");
  75. listTotal.add(map);
  76. //新建索引
  77. String s = JSON.toJSONString(listTotal);
  78. esFeign.insertIndex(listTotal);
  79. //删除
  80. listTotal.remove(listTotal.size() - 1);
  81. }
  82. if (listTotal == null) {
  83. listTotal = amsshipDeliveryNoticeService.selectShipDeliveryNotice(mapVal);
  84. }
  85. PageHelper.startPage(pageNum, pageSize);
  86. //分页查询数据
  87. List<Map<String, Object>> columnList = amsshipDeliveryNoticeService.selectShipDeliveryNotice(mapVal);
  88. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  89. return success(data);
  90. }
  91. //新增
  92. @ApiOperation(value="新增", notes="根据AmsshipDeliveryNotice对象创建")
  93. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "AmsshipDeliveryNotice", paramType = "java.util.Map")
  94. @PostMapping(value = "/insertDeliveryNotice")
  95. public RESTfulResult insertSelective(@RequestBody AmsshipDeliveryNotice amsshipDeliveryNotice){
  96. int code=amsshipDeliveryNoticeService.insert(amsshipDeliveryNotice);
  97. return success(code);
  98. }
  99. // //查询发货通知单信息
  100. // @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  101. // @ApiImplicitParam(paramType = "path", name = "noticeId", value = "noticeId", required = true, dataType = "BigDecimal")
  102. //
  103. // @GetMapping(value = "/{noticeId}")
  104. // public RESTfulResult get(@PathVariable BigDecimal noticeId){
  105. // AmsshipDeliveryNotice amsshipDeliveryNotice = amsshipDeliveryNoticeService.selectByPrimaryKey(noticeId);
  106. // return success(amsshipDeliveryNotice);
  107. // }
  108. // 渲染信息
  109. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  110. @ApiImplicitParams({
  111. @ApiImplicitParam(paramType = "path", name = "noticeId", value = "noticeId", required = true, dataType = "BigDecimal"),
  112. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "AmsshipDeliveryNotice")
  113. })
  114. @PostMapping(value = "/selectByNoticeId/{noticeId}")
  115. public RESTfulResult update(@PathVariable("noticeId") Integer noticeId){
  116. List<Map<String,Object>> amsshipDeliveryNotice =amsshipDeliveryNoticeService.selectByNoticeId(noticeId);
  117. return success(amsshipDeliveryNotice);
  118. }
  119. // 删除详细信息
  120. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  121. @ApiImplicitParam(paramType = "path", name = "id", value = "noticeId", required = true, dataType = "BigDecimal")
  122. //@RequiresPermissions("omsshipshipmentinstructions:delete")
  123. @DeleteMapping(value = "/{noticeId}")//BigDecimal
  124. public RESTfulResult deleteByPrimaryKey(BigDecimal noticeId){
  125. amsshipDeliveryNoticeService.deleteByPrimaryKey(noticeId);
  126. return success();
  127. }
  128. //得到收货人id
  129. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  130. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  131. @GetMapping(value ="/getResultNumber")
  132. public RESTfulResult getResultNumber(){
  133. List<Map<String,Object>> list= amsshipDeliveryNoticeService.getResultNumber();
  134. return success(list);
  135. }
  136. //得到承运单位
  137. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  138. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  139. @GetMapping(value ="/getCarrier")
  140. public RESTfulResult getCarrier(){
  141. List<Map<String,Object>> list= amsshipDeliveryNoticeService.getcarrier();
  142. return success(list);
  143. }
  144. //得到委托单位
  145. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  146. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  147. @GetMapping(value ="/getShipper")
  148. public RESTfulResult getShipper(){
  149. List<Map<String,Object>> list= amsshipDeliveryNoticeService.getShipper();
  150. return success(list);
  151. }
  152. // //得到采购订单号
  153. // @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  154. // @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  155. //
  156. // @GetMapping(value ="/getOrderNo")
  157. // public RESTfulResult getOrderNo(){
  158. // List<Map<String,Object>> list= amsshipDeliveryNoticeService.getOrderNo();
  159. // return success(list);
  160. // }
  161. //删除
  162. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  163. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  164. @PostMapping(value ="/deleteByNoticeId/{noticeId}")
  165. public RESTfulResult deleteByNoticeId(@PathVariable("noticeId") Integer noticeId){
  166. // 初始话对象
  167. AmsshipDeliveryNotice amsshipDeliveryNotice=new AmsshipDeliveryNotice();
  168. // 设置一个新的noticeId
  169. amsshipDeliveryNotice.setNoticeId(new BigDecimal(noticeId));
  170. // 将删除状态设置为1.
  171. Short deleted=1;
  172. // 将设置完的值传回后端
  173. amsshipDeliveryNotice.setDeleted(deleted);
  174. amsshipDeliveryNoticeService.updateByPrimaryKeySelective(amsshipDeliveryNotice);
  175. return success();
  176. }
  177. //修改
  178. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  179. @ApiImplicitParams({
  180. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"),
  181. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice")
  182. })
  183. @PostMapping(value = "/editDeliveryNotice", produces = "application/json;charset=UTF-8")
  184. public RESTfulResult editDeliveryNotice(@RequestBody AmsshipDeliveryNotice amsshipDeliveryNotice){
  185. amsshipDeliveryNoticeService.updateByPrimaryKeySelective(amsshipDeliveryNotice);
  186. System.out.println(amsshipDeliveryNotice);
  187. return success(amsshipDeliveryNotice);
  188. }
  189. // 下发
  190. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  191. @ApiImplicitParams({
  192. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"),
  193. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice")
  194. })
  195. @PostMapping(value = "/sendDeliveryNotice/{noticeId}", produces = "application/json;charset=UTF-8")
  196. public RESTfulResult sendDeliveryNotice(@PathVariable("noticeId") Integer noticeId){
  197. AmsshipDeliveryNotice amsshipDeliveryNotice =new AmsshipDeliveryNotice();
  198. amsshipDeliveryNotice.setNoticeId(new BigDecimal(noticeId));
  199. amsshipDeliveryNotice.setNoticeDistributionStatus("下发");
  200. amsshipDeliveryNoticeService.updateByPrimaryKeySelective(amsshipDeliveryNotice);
  201. System.out.println(amsshipDeliveryNotice);
  202. return success(amsshipDeliveryNotice);
  203. }
  204. }