123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.model.AmstruckInwardRequirement;
- import com.steerinfo.dil.service.IAmstruckInwardRequirementService;
- 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.ApiModelProperty;
- import io.swagger.models.auth.In;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.math.BigDecimal;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * AmstruckInwardRequirement RESTful接口:
- * @author generator
- * @version 1.0-SNAPSHORT 2021-10-25 11:30
- * 类描述
- * 修订历史:
- * 日期:2021-10-25
- * 作者:generator
- * 参考:
- * 描述:AmstruckInwardRequirement RESTful接口
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @RestController
- @RequestMapping("/${api.version}/amstruckinwardrequirement")
- public class AmstruckInwardRequirementController extends BaseRESTfulController {
- @Autowired
- IAmstruckInwardRequirementService amstruckInwardRequirementService;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @Autowired
- ESFeign esFeign;
- /**
- *用车单位提出需求
- *新增用车需求
- */
- @PostMapping("/addTruckRequirement")
- public RESTfulResult addTruckRequirement(@RequestBody Map<String,Object> mapValue) {
- int result = amstruckInwardRequirementService.insert(mapValue);
- return success(result);
- }
- /*
- 新增采购内转需求
- */
- @PostMapping("/addPurInwardRequirement")
- public RESTfulResult addPurInwardRequirement(@RequestBody Map<String,Object>mapValue){
- int result = amstruckInwardRequirementService.insertPurInwardRequirement(mapValue);
- return success(result);
- }
- /**
- * 删除用车需求
- */
- @PostMapping("/deleteTruckRequirement/{requirementId}")
- public RESTfulResult deleteTruckRequirement(@PathVariable("requirementId") BigDecimal requirementId) {
- int result = amstruckInwardRequirementService.deleteTruckRequirement(requirementId);
- return success(result);
- }
- /**
- * 修改用车需求/下发用车需求
- */
- @PostMapping("/updateTruckRequirement")
- public RESTfulResult updateTruckRequirement(@RequestBody AmstruckInwardRequirement amstruckInwardRequirement) {
- int result = amstruckInwardRequirementService.updateTruckRequirement(amstruckInwardRequirement);
- return success(result);
- }
- /**
- * 查询修改渲染
- */
- @PostMapping("/selectRequirement/{requirementId}")
- public RESTfulResult selectRequirement(@PathVariable("requirementId") Integer requirementId) {
- List<Map<String,Object>> result = amstruckInwardRequirementService.selectRequirement(requirementId);
- return success(result);
- }
- /**
- * 下发需求
- */
- @PostMapping("/downRequirement")
- public RESTfulResult downRequirement(@RequestBody List<Map<String,Object>> requirementIds) {
- int result = amstruckInwardRequirementService.downRequirement(requirementIds);
- return success(result);
- }
- /**
- * 接收需求
- */
- @PostMapping("/receiveRequirement/{requirementId}")
- public RESTfulResult receiveRequirement(@PathVariable("requirementId") Integer requirementId) {
- int result = amstruckInwardRequirementService.receiveRequirement(requirementId);
- return success(result);
- }
- /**
- * 展示未下发的用车需求
- * @param mapValue
- * @param pageNum
- * @param pageSize
- * @param apiId
- * @return
- */
- @ApiModelProperty(value = "展示用车需求")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "apiId", value = "207(0,1)/250(2)", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "requirementStatus", value = "需求状态", required = false, dataType = "Integer")
- })
- @PostMapping("/getTruckRequirementList")
- public RESTfulResult getTruckRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- Integer requirementStatus,
- String con) {
- if (con != null) {
- if (!con.equals("undefined")) {
- String index="get_truck_requirement_list2";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
- }
- }
- if (mapValue == null) {
- mapValue = new HashMap<>();
- }
- mapValue.put("requirementStatus",requirementStatus);
- List<Map<String, Object>> truckRequirementList = null;
- if (mapValue.size() == 1) {
- //将查询结果存入索引中
- truckRequirementList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
- Map<String, Object> map1 = new HashMap<>();
- //添加索引
- map1.put("index","get_truck_requirement_list2");
- //添加id
- map1.put("indexId","requirementId");
- truckRequirementList.add(map1);
- //新建索引
- esFeign.insertIndex(truckRequirementList);
- //删除
- truckRequirementList.remove(truckRequirementList.size()-1);
- }
- if (truckRequirementList == null) {
- truckRequirementList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
- }
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = amstruckInwardRequirementService.getTruckRequirementList(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
- return success(data);
- }
- //展示采购内转需求
- @PostMapping("/getPurRequirementList")
- public RESTfulResult getPurRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- Integer requirementStatus,
- String con,
- String userId,
- String carrierSsoId,
- String enableStatus,
- String planStatus) {
- if (con != null) {
- if (!con.equals("undefined")) {
- String index="get_pur_requirement_list";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
- }
- }
- if (mapValue == null) {
- mapValue = new HashMap<>();
- }
- if(userId != null){
- mapValue.put("userId",userId);
- }
- if(carrierSsoId != null){
- mapValue.put("carrierSsoId",carrierSsoId);
- }
- if(enableStatus != null){
- mapValue.put("enableStatus",enableStatus);
- }
- if(planStatus != null){
- mapValue.put("planStatus",planStatus);
- }
- mapValue.put("requirementStatus",requirementStatus);
- List<Map<String, Object>> truckRequirementList = null;
- if (mapValue.size() == 1) {
- //将查询结果存入索引中
- truckRequirementList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
- Map<String, Object> map1 = new HashMap<>();
- //添加索引
- map1.put("index","get_pur_requirement_list");
- //添加id
- map1.put("indexId","purRequirementId");
- truckRequirementList.add(map1);
- //新建索引
- esFeign.insertIndex(truckRequirementList);
- //删除
- truckRequirementList.remove(truckRequirementList.size()-1);
- }
- if (truckRequirementList == null) {
- truckRequirementList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
- }
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
- return success(data);
- }
- @ApiModelProperty(value = "展示批次信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "apiId", value = "252", required = false, dataType = "Integer"),
- })
- @PostMapping("/getPurchaseIdByBatch")
- public RESTfulResult getPurchaseIdByBatch(@RequestBody(required = false) Map<String,Object> mapValue,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- String con) {
- // if (con != null) {
- // if (!con.equals("undefined")) {
- // String index="get_purchase_batch";//设置要查询的索引名称
- // return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
- // }
- // }
- // if (mapValue == null) {
- // mapValue = new HashMap<>();
- // }
- // List<Map<String, Object>> truckRequirementList = null;
- // if (mapValue.size() == 0) {
- // //将查询结果存入索引中
- // truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
- // Map<String, Object> map1 = new HashMap<>();
- // //添加索引
- // map1.put("index","get_purchase_batch");
- // //添加id
- // map1.put("indexId","purchaseOrderId");
- // truckRequirementList.add(map1);
- // //新建索引
- // esFeign.insertIndex(truckRequirementList);
- // //删除
- // truckRequirementList.remove(truckRequirementList.size()-1);
- // }
- // if (truckRequirementList == null) {
- // truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
- // }
- List<Map<String,Object>> truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
- return success(data);
- }
- //异地库下拉框
- @GetMapping("/getOffsetWarehouse")
- public RESTfulResult getOffsetWarehouse(){
- List<Map<String,Object>> mapList = amstruckInwardRequirementService.getOffsetWareHouse();
- return success(mapList);
- }
- @ApiModelProperty(value = "仓库模代框")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "apiId", value = "251", required = false, dataType = "Integer"),
- })
- @PostMapping("/getWareHouse")
- public RESTfulResult getWareHouse(@RequestBody(required = false) Map<String,Object> mapValue,
- Integer pageNum,
- Integer pageSize,
- Integer apiId,
- String con) {
- if (con != null) {
- if (!con.equals("undefined")) {
- String index="get_ware_house";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
- }
- }
- if (mapValue == null) {
- mapValue = new HashMap<>();
- }
- List<Map<String, Object>> truckRequirementList = null;
- if (mapValue.size() == 0) {
- //将查询结果存入索引中
- truckRequirementList = amstruckInwardRequirementService.getWareHouse(mapValue);
- Map<String, Object> map1 = new HashMap<>();
- //添加索引
- map1.put("index","get_ware_house");
- //添加id
- map1.put("indexId","wareHouseId");
- truckRequirementList.add(map1);
- //新建索引
- esFeign.insertIndex(truckRequirementList);
- //删除
- truckRequirementList.remove(truckRequirementList.size()-1);
- }
- if (truckRequirementList == null) {
- truckRequirementList = amstruckInwardRequirementService.getWareHouse(mapValue);
- }
- PageHelper.startPage(pageNum, pageSize);
- //分页查询数据
- List<Map<String, Object>> columnList = amstruckInwardRequirementService.getWareHouse(mapValue);
- PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
- return success(data);
- }
- /**
- * 承运商下拉
- * @return
- */
- @GetMapping("/getCapacityType")
- public RESTfulResult getCapacityType() {
- List<Map<String,Object>> mapList = amstruckInwardRequirementService.getCapacityType();
- return success(mapList);
- }
- /**
- * 发货单位下拉
- * @return
- */
- @GetMapping("/getShipperUser")
- public RESTfulResult getShipperUser() {
- List<Map<String,Object>> mapList = amstruckInwardRequirementService.getShipperUser();
- return success(mapList);
- }
- }
|