package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSON; import com.steerinfo.dil.feign.ESFeign; import com.steerinfo.dil.mapper.AmsshipDeliveryNoticeMapper; import com.steerinfo.dil.model.AmsshipDeliveryAttorney; import com.steerinfo.dil.model.AmsshipDeliveryNotice; import com.steerinfo.dil.model.OmsshipShipmentInstructions; import com.steerinfo.dil.service.IAmsshipDeliveryNoticeService; import com.steerinfo.dil.util.BaseRESTfulController; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.ImageFileUtils; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import oracle.jdbc.proxy.annotation.Post; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.*; import java.math.BigDecimal; /** * AmsshipDeliveryNotice RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2021-08-18 03:54 * 类描述 * 修订历史: * 日期:2021-08-18 * 作者:generator * 参考: * 描述:AmsshipDeliveryNotice RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/amsshipdeliverynotices") public class AmsshipDeliveryNoticeController extends BaseRESTfulController { @Autowired IAmsshipDeliveryNoticeService amsshipDeliveryNoticeService; @Autowired ColumnDataUtil columnDataUtil; @Autowired AmsshipDeliveryNoticeMapper amsshipDeliveryNoticeMapper; @Autowired ImageFileUtils imageFileUtils; @Autowired ESFeign esFeign; @ApiOperation(value="展示发货通知单表", notes="分页查询") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"), @ApiImplicitParam(name = "apiId", value = "69", required = false, dataType = "BigDecimal"), }) @PostMapping(value = "/getshipDeliveryNoticeList") public RESTfulResult getshipDeliveryNoticeList(@RequestBody(required = false) Map mapVal, Integer pageNum, Integer pageSize, Integer apiId, Integer status, String con){ //判断状态值是否为空 if (status!=null){ mapVal.put("status",status); } if (con != null && !"null".equals(con)) { mapVal.put("con", "%" + con + "%"); } //初始化过滤 List> listTotal = amsshipDeliveryNoticeService.selectShipDeliveryNotice(mapVal); PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> columnList = amsshipDeliveryNoticeService.selectShipDeliveryNotice(mapVal); PageListAdd data = columnDataUtil.tableColumnData(apiId, listTotal, columnList); return success(data); } //新增 @ApiOperation(value="新增", notes="根据AmsshipDeliveryNotice对象创建") @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "AmsshipDeliveryNotice", paramType = "java.util.Map") @PostMapping(value = "/insertDeliveryNotice") public RESTfulResult insertSelective(@RequestBody Map map){ int code=amsshipDeliveryNoticeService.insert(map); if (code==-1){ return failed("进厂船名重复,请输入唯一的进厂船名"); } return success(code); } // 渲染信息 @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "noticeId", value = "noticeId", required = true, dataType = "BigDecimal"), @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "AmsshipDeliveryNotice") }) @PostMapping(value = "/selectByNoticeId/{noticeId}") public RESTfulResult update(@PathVariable("noticeId") Integer noticeId){ List> amsshipDeliveryNotice =amsshipDeliveryNoticeService.selectByNoticeId(noticeId); return success(amsshipDeliveryNotice); } //得到收货人id @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @GetMapping(value ="/getResultNumber") public RESTfulResult getResultNumber(){ List> list= amsshipDeliveryNoticeService.getResultNumber(); return success(list); } //得到承运单位 @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @GetMapping(value ="/getCarrier") public RESTfulResult getCarrier(){ List> list= amsshipDeliveryNoticeService.getcarrier(); return success(list); } //得到委托单位 @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @GetMapping(value ="/getShipper") public RESTfulResult getShipper(){ List> list= amsshipDeliveryNoticeService.getShipper(); return success(list); } //删除 @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal") @PostMapping(value ="/deleteByNoticeId/{noticeId}") public RESTfulResult deleteByNoticeId(@PathVariable("noticeId") Integer noticeId){ Map mapval=new HashMap<>(); if (noticeId!=null){ mapval.put("noticeId",noticeId); } int i = amsshipDeliveryNoticeService.deleteDeliveryNotice(mapval); return success("删除成功"); } //修改 @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"), @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice") }) @PostMapping(value = "/editDeliveryNotice", produces = "application/json;charset=UTF-8") public RESTfulResult editDeliveryNotice(@RequestBody Map map){ int result=amsshipDeliveryNoticeService.updateAmsDeliveryNotice(map); return success(result); } // 下发 @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"), @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice") }) @PostMapping(value = "/sendDeliveryNotice/{noticeId}", produces = "application/json;charset=UTF-8") public RESTfulResult sendDeliveryNotice(@PathVariable("noticeId") Integer noticeId){ Map map=new HashMap<>(); if (noticeId!=null){ map.put("noticeId",noticeId); } int i=amsshipDeliveryNoticeService.sendDeliveryNotice(map); return success("下发成功"); } // 处理货权转移图片 @PostMapping(value = "/uploadCargoPic",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public RESTfulResult uploadCargoPic(@RequestParam("file") MultipartFile multipartFile) throws Exception { String url = imageFileUtils.updateFile(multipartFile); return success(url); } //获取货权转移的图片 @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的amsshipDeliveryNotice信息来更新详细信息") @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"), @ApiImplicitParam(name = "amsshipDeliveryNotice", value = "详细实体amsshipDeliveryNotice", required = true, dataType = "amsshipDeliveryNotice") }) @PostMapping(value = "/downLoadDeilveryNotice", produces = "application/json;charset=UTF-8") public RESTfulResult downLoadDeilveryNotice(@RequestParam Integer noticeId) { String LoadDeliveryNoticePicture = amsshipDeliveryNoticeService.getLoadDeliveryNotice(noticeId); String photo = null; try { photo = imageFileUtils.downloadFile(LoadDeliveryNoticePicture).toString(); } catch (Exception e) { e.printStackTrace(); } return success(photo); } }