AmsshipDeliveryNoticeController.java 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. package com.steerinfo.dil.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.steerinfo.dil.feign.ESFeign;
  4. import com.steerinfo.dil.mapper.AmsshipDeliveryNoticeMapper;
  5. import com.steerinfo.dil.model.AmsshipDeliveryAttorney;
  6. import com.steerinfo.dil.model.AmsshipDeliveryNotice;
  7. import com.steerinfo.dil.model.OmsshipShipmentInstructions;
  8. import com.steerinfo.dil.service.IAmsshipDeliveryNoticeService;
  9. import com.steerinfo.dil.util.BaseRESTfulController;
  10. import com.steerinfo.dil.util.ColumnDataUtil;
  11. import com.steerinfo.dil.util.ImageFileUtils;
  12. import com.steerinfo.dil.util.PageListAdd;
  13. import com.steerinfo.framework.controller.RESTfulResult;
  14. import com.steerinfo.framework.service.pagehelper.PageHelper;
  15. import io.swagger.annotations.ApiImplicitParam;
  16. import io.swagger.annotations.ApiImplicitParams;
  17. import io.swagger.annotations.ApiOperation;
  18. import oracle.jdbc.proxy.annotation.Post;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.http.MediaType;
  21. import org.springframework.web.bind.annotation.*;
  22. import org.springframework.web.multipart.MultipartFile;
  23. import java.util.*;
  24. import java.math.BigDecimal;
  25. /**
  26. * AmsshipDeliveryNotice RESTful接口:
  27. * @author generator
  28. * @version 1.0-SNAPSHORT 2021-08-18 03:54
  29. * 类描述
  30. * 修订历史:
  31. * 日期:2021-08-18
  32. * 作者:generator
  33. * 参考:
  34. * 描述:AmsshipDeliveryNotice RESTful接口
  35. * @see null
  36. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  37. */
  38. @RestController
  39. @RequestMapping("/${api.version}/amsshipdeliverynotices")
  40. public class AmsshipDeliveryNoticeController extends BaseRESTfulController {
  41. @Autowired
  42. IAmsshipDeliveryNoticeService amsshipDeliveryNoticeService;
  43. @Autowired
  44. ColumnDataUtil columnDataUtil;
  45. @Autowired
  46. AmsshipDeliveryNoticeMapper amsshipDeliveryNoticeMapper;
  47. @Autowired
  48. ImageFileUtils imageFileUtils;
  49. @Autowired
  50. ESFeign esFeign;
  51. @ApiOperation(value="展示发货通知单表", notes="分页查询")
  52. @ApiImplicitParams({
  53. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  54. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  55. @ApiImplicitParam(name = "apiId", value = "69", required = false, dataType = "BigDecimal"),
  56. })
  57. @PostMapping(value = "/getshipDeliveryNoticeList")
  58. public RESTfulResult getshipDeliveryNoticeList(@RequestBody(required = false) Map<String,Object> mapVal,
  59. Integer pageNum,
  60. Integer pageSize,
  61. Integer apiId,
  62. Integer status,
  63. String con){
  64. //判断状态值是否为空
  65. if (status!=null){
  66. mapVal.put("status",status);
  67. }
  68. if (con != null && !"null".equals(con)) {
  69. mapVal.put("con", "%" + con + "%");
  70. }
  71. //初始化过滤
  72. List<Map<String, Object>> listTotal = amsshipDeliveryNoticeService.selectShipDeliveryNotice(mapVal);
  73. PageHelper.startPage(pageNum, pageSize);
  74. //分页查询数据
  75. List<Map<String, Object>> columnList = amsshipDeliveryNoticeService.selectShipDeliveryNotice(mapVal);
  76. PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList);
  77. return success(data);
  78. }
  79. //新增
  80. @ApiOperation(value="新增", notes="根据AmsshipDeliveryNotice对象创建")
  81. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "AmsshipDeliveryNotice", paramType = "java.util.Map")
  82. @PostMapping(value = "/insertDeliveryNotice")
  83. public RESTfulResult insertSelective(@RequestBody Map<String,Object> map){
  84. int code=amsshipDeliveryNoticeService.insert(map);
  85. if (code==-1){
  86. return failed("进厂船名重复,请输入唯一的进厂船名");
  87. }
  88. return success(code);
  89. }
  90. // 渲染信息
  91. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  92. @ApiImplicitParams({
  93. @ApiImplicitParam(paramType = "path", name = "noticeId", value = "noticeId", required = true, dataType = "BigDecimal"),
  94. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "AmsshipDeliveryNotice")
  95. })
  96. @PostMapping(value = "/selectByNoticeId/{noticeId}")
  97. public RESTfulResult update(@PathVariable("noticeId") Integer noticeId){
  98. List<Map<String,Object>> amsshipDeliveryNotice =amsshipDeliveryNoticeService.selectByNoticeId(noticeId);
  99. return success(amsshipDeliveryNotice);
  100. }
  101. //得到收货人id
  102. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  103. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  104. @GetMapping(value ="/getResultNumber")
  105. public RESTfulResult getResultNumber(){
  106. List<Map<String,Object>> list= amsshipDeliveryNoticeService.getResultNumber();
  107. return success(list);
  108. }
  109. //得到承运单位
  110. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  111. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  112. @GetMapping(value ="/getCarrier")
  113. public RESTfulResult getCarrier(){
  114. List<Map<String,Object>> list= amsshipDeliveryNoticeService.getcarrier();
  115. return success(list);
  116. }
  117. //得到委托单位
  118. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  119. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  120. @GetMapping(value ="/getShipper")
  121. public RESTfulResult getShipper(){
  122. List<Map<String,Object>> list= amsshipDeliveryNoticeService.getShipper();
  123. return success(list);
  124. }
  125. //删除
  126. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  127. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  128. @PostMapping(value ="/deleteByNoticeId/{noticeId}")
  129. public RESTfulResult deleteByNoticeId(@PathVariable("noticeId") Integer noticeId){
  130. Map<String,Object> mapval=new HashMap<>();
  131. if (noticeId!=null){
  132. mapval.put("noticeId",noticeId);
  133. }
  134. int i = amsshipDeliveryNoticeService.deleteDeliveryNotice(mapval);
  135. return success("删除成功");
  136. }
  137. //修改
  138. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  139. @ApiImplicitParams({
  140. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"),
  141. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice")
  142. })
  143. @PostMapping(value = "/editDeliveryNotice", produces = "application/json;charset=UTF-8")
  144. public RESTfulResult editDeliveryNotice(@RequestBody Map<String,Object> map){
  145. int result=amsshipDeliveryNoticeService.updateAmsDeliveryNotice(map);
  146. return success(result);
  147. }
  148. // 下发
  149. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  150. @ApiImplicitParams({
  151. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"),
  152. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice")
  153. })
  154. @PostMapping(value = "/sendDeliveryNotice/{noticeId}", produces = "application/json;charset=UTF-8")
  155. public RESTfulResult sendDeliveryNotice(@PathVariable("noticeId") Integer noticeId){
  156. Map<String,Object> map=new HashMap<>();
  157. if (noticeId!=null){
  158. map.put("noticeId",noticeId);
  159. }
  160. int i=amsshipDeliveryNoticeService.sendDeliveryNotice(map);
  161. return success("下发成功");
  162. }
  163. // 处理货权转移图片
  164. @PostMapping(value = "/uploadCargoPic",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
  165. public RESTfulResult uploadCargoPic(@RequestParam("file") MultipartFile multipartFile) throws Exception {
  166. String url = imageFileUtils.updateFile(multipartFile);
  167. return success(url);
  168. }
  169. //获取货权转移的图片
  170. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息")
  171. @ApiImplicitParams({
  172. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"),
  173. @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice")
  174. })
  175. @PostMapping(value = "/downLoadDeilveryNotice", produces = "application/json;charset=UTF-8")
  176. public RESTfulResult downLoadDeilveryNotice(@RequestParam Integer noticeId) {
  177. String LoadDeliveryNoticePicture = amsshipDeliveryNoticeService.getLoadDeliveryNotice(noticeId);
  178. String photo = null;
  179. try {
  180. photo = imageFileUtils.downloadFile(LoadDeliveryNoticePicture).toString();
  181. } catch (Exception e) {
  182. e.printStackTrace();
  183. }
  184. return success(photo);
  185. }
  186. }