package com.chinaitop.depot.business.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.chinaitop.depot.business.model.BusinessMergeNotice; import com.chinaitop.depot.business.model.BusinessMergeNoticeDetail; import com.chinaitop.depot.business.service.BusinessMergeNoticeService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @RestController @RequestMapping(value="/depot/business/businessMergeNotice") @Api(value= "BusinessMergeNoticeController", description = "合并通知单管理") public class BusinessMergeNoticeController { @Resource private BusinessMergeNoticeService businessMergeNoticeService; @RequestMapping(value="/findByHtbhCondition",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET) @ApiOperation(value="根据合同编号获取通知单数据列表", notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "htbh", value = "合同编号", required=true, paramType = "query"), @ApiImplicitParam(name = "orgId", value = "库ID", required=true, paramType = "query") }) public List findByHtbhCondition(String htbh, Integer orgId) { List list = null; try { list = businessMergeNoticeService.findByHtbhCondition(htbh, orgId); } catch (Exception e) { e.printStackTrace(); } return list; } @RequestMapping(value="/save",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST) @ApiOperation(value="保存", notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "x_arr", value = "目标通知单对象", required=true, paramType = "form"), @ApiImplicitParam(name = "y_arr", value = "原通知单对象", required=true, paramType = "form") }) public Map save(String x_arr, String y_arr) { Map map = new HashMap<>(); try { businessMergeNoticeService.save(x_arr, y_arr); map.put("status", "200"); map.put("msg", "操作成功"); } catch (Exception e) { map.put("status", "500"); map.put("msg", e.getMessage()); e.printStackTrace(); } return map; } @RequestMapping(value="/findByIdList",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET) @ApiOperation(value="查看详情", notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主表ID", required=true, paramType = "query") }) public Map findByIdList(String id) { Map map = new HashMap<>(); try { map = businessMergeNoticeService.findByIdList(id); map.put("status", 200); } catch (Exception e) { map.put("status", "500"); map.put("msg", e.getMessage()); e.printStackTrace(); } return map; } @RequestMapping(value="/findByPageList",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET) @ApiOperation(value="合并通知单列表查询", notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"), @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"), @ApiImplicitParam(name = "htbh", value = "客户编号", paramType = "query"), @ApiImplicitParam(name = "khmc", value = "客户名称", paramType = "query"), @ApiImplicitParam(name = "ch", value = "仓房ID", paramType = "query"), @ApiImplicitParam(name = "orgId", value = "库ID", required=true, paramType = "query") }) public PageInfo findByPageList(Integer pageNum, Integer pageSize, String htbh, String khmc, Integer ch, Integer orgId) { PageInfo pageInfo = null; try { if (null != pageNum && null != pageSize) { PageHelper.startPage(pageNum, pageSize); } List list = businessMergeNoticeService.findByList(orgId, htbh, khmc, ch); pageInfo = new PageInfo<>(list); } catch (Exception e) { e.printStackTrace(); } return pageInfo; } @RequestMapping(value="/findByTzdidQueryList",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET) @ApiOperation(value="按照通知单ID查询通知单合并记录", notes = "") @ApiImplicitParams({ @ApiImplicitParam(name = "tzdid", value = "通知单ID", required=true, paramType = "query") }) public List findByTzdidQueryList(String tzdid) { List list = null; try { list = businessMergeNoticeService.findByTzdidQueryList(tzdid); } catch (Exception e) { e.printStackTrace(); } return list; } }