package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSON; import com.steerinfo.dil.feign.ESFeign; 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.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.web.bind.annotation.*; 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 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, String con){ //框计算 if(con != null){ if(!"undefined".equals(con)){ //设置要查询的索引名称 String index="get_ship_delivery_notice_list"; //获取查询结果 return success(esFeign.getConResult(mapVal,index,apiId,pageNum,pageSize,con)); } } //初始化过滤 List> listTotal = null; //如果有条件查询则跳过初始化,和创建索引 if (mapVal.size() == 0) { //将查询结果存入索引中 listTotal = amsshipDeliveryNoticeService.selectShipDeliveryNotice(null); Map map = new HashMap<>(); //添加索引 map.put("index", "get_ship_delivery_notice_list"); //添加id map.put("indexId", "noticeId"); listTotal.add(map); //新建索引 String s = JSON.toJSONString(listTotal); esFeign.insertIndex(listTotal); //删除 listTotal.remove(listTotal.size() - 1); } if (listTotal == null) { 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 AmsshipDeliveryNotice amsshipDeliveryNotice){ int code=amsshipDeliveryNoticeService.insert(amsshipDeliveryNotice); return success(code); } // //查询发货通知单信息 // @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息") // @ApiImplicitParam(paramType = "path", name = "noticeId", value = "noticeId", required = true, dataType = "BigDecimal") // // @GetMapping(value = "/{noticeId}") // public RESTfulResult get(@PathVariable BigDecimal noticeId){ // AmsshipDeliveryNotice amsshipDeliveryNotice = amsshipDeliveryNoticeService.selectByPrimaryKey(noticeId); // return success(amsshipDeliveryNotice); // } // 渲染信息 @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); } // 删除详细信息 @ApiOperation(value="删除", notes="根据url的id来指定删除对象") @ApiImplicitParam(paramType = "path", name = "id", value = "noticeId", required = true, dataType = "BigDecimal") //@RequiresPermissions("omsshipshipmentinstructions:delete") @DeleteMapping(value = "/{noticeId}")//BigDecimal public RESTfulResult deleteByPrimaryKey(BigDecimal noticeId){ amsshipDeliveryNoticeService.deleteByPrimaryKey(noticeId); return success(); } //得到收货人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") // // @GetMapping(value ="/getOrderNo") // public RESTfulResult getOrderNo(){ // List> list= amsshipDeliveryNoticeService.getOrderNo(); // 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){ // 初始话对象 AmsshipDeliveryNotice amsshipDeliveryNotice=new AmsshipDeliveryNotice(); // 设置一个新的noticeId amsshipDeliveryNotice.setNoticeId(new BigDecimal(noticeId)); // 将删除状态设置为1. Short deleted=1; // 将设置完的值传回后端 amsshipDeliveryNotice.setDeleted(deleted); amsshipDeliveryNoticeService.updateByPrimaryKeySelective(amsshipDeliveryNotice); 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 AmsshipDeliveryNotice amsshipDeliveryNotice){ amsshipDeliveryNoticeService.updateByPrimaryKeySelective(amsshipDeliveryNotice); System.out.println(amsshipDeliveryNotice); return success(amsshipDeliveryNotice); } // 下发 @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){ AmsshipDeliveryNotice amsshipDeliveryNotice =new AmsshipDeliveryNotice(); amsshipDeliveryNotice.setNoticeId(new BigDecimal(noticeId)); amsshipDeliveryNotice.setNoticeDistributionStatus("下发"); amsshipDeliveryNoticeService.updateByPrimaryKeySelective(amsshipDeliveryNotice); System.out.println(amsshipDeliveryNotice); return success(amsshipDeliveryNotice); } }