package com.steerinfo.dil.controller; import com.steerinfo.dil.config.ImageFileUtils; import com.steerinfo.dil.feign.OtmsFeign; import com.steerinfo.dil.feign.TmsTruckFeign; 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartRequest; import java.awt.*; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController @RequestMapping("${api.version}/otms") public class OTMSController { @Autowired private OtmsFeign otmsFeign; @Autowired private ImageFileUtils imageFileUtils; @ApiOperation(value="全路径展示接口") @PostMapping("/fullPath") public Object fullPath(@RequestParam("orderNumber") String orderNumber) throws Exception { return otmsFeign.fullPath(orderNumber); } @ApiOperation(value = "在途订单列表") @PostMapping("/getInTransitTransportation") public RESTfulResult getInTransitTransportation(@RequestBody(required=false) Map mapValue, @RequestParam(required = true,defaultValue = "468",name = "apiId")Integer apiId, @RequestParam(required = false,defaultValue = "1",name = "pageNum")Integer pageNum, @RequestParam(required = false,defaultValue = "20",name = "pageSize")Integer pageSize ) { return otmsFeign.getInTransitTransportation(mapValue!=null?mapValue:new HashMap<>(),apiId,pageNum,pageSize); } @ApiOperation(value = "有异常订单列表") @PostMapping("/getHaveAbnormalTruckOrderInfo") public RESTfulResult getHaveAbnormalTruckOrderInfo(@RequestBody(required=false) Map mapValue, @RequestParam(required = true,defaultValue = "468",name = "apiId")Integer apiId, @RequestParam(required = false,defaultValue = "1",name = "pageNum")Integer pageNum, @RequestParam(required = false,defaultValue = "20",name = "pageSize")Integer pageSize ) { return otmsFeign.getHaveAbnormalTruckOrderInfo(mapValue!=null?mapValue:new HashMap<>(),apiId,pageNum,pageSize); } @ApiOperation("已完成订单列表") @ApiImplicitParams({ @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"), @ApiImplicitParam(name = "apiId", value = "动态表头", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer") }) @PostMapping("/getFinishTruckOrderInfo") public RESTfulResult getFinishTruckOrderInfo(@RequestBody(required = false) Map mapValue, @RequestParam(required = false,defaultValue = "468",name = "apiId")Integer apiId, @RequestParam(required = false,defaultValue = "1",name = "pageNum")Integer pageNum, @RequestParam(required = false,defaultValue = "20",name = "pageSize")Integer pageSize ){ return otmsFeign.getFinishTruckOrderInfo(mapValue!=null?mapValue:new HashMap<>(),apiId,pageNum,pageSize); } @ApiOperation(value = "获得抵达实集") @PostMapping(value = "/addtmstruckArrivalResult") public RESTfulResult addtmstruckArrivalResult(@RequestParam("orderNumber") String orderNumber, @RequestParam("resultArrivalAddress")String resultArrivalAddress, MultipartFile file){ return otmsFeign.addtmstruckArrivalResult(orderNumber,resultArrivalAddress,file); } @PostMapping(value = "/addTmstruckReceiptResult") public synchronized RESTfulResult addTmstruckReceiptResult(MultipartRequest request, Integer num, String orderNumber, String resultArrivalAddress, Integer imgcount3, Integer imgcount4) throws Exception { //添加到files数组 List files = new ArrayList<>(); //第一张和第二张必填 files.add(request.getFile("file0")); files.add(request.getFile("file1")); //第三张选填 if (request.getFile("file2")!=null){ files.add(request.getFile("file2")); } //追加的三张,num=6则取到file3,4,5 for(int i=3;i fourFiles=new ArrayList<>(); Map mapValue=new HashMap<>(); for (int i=0;i=3) { fourFiles.add(url); } } mapValue.put("fourFiles",fourFiles); return otmsFeign.addTmstruckReceiptResult(mapValue,num,orderNumber,resultArrivalAddress,imgcount3,imgcount4); } @ApiOperation(value="查询当前报警类型") @PostMapping(value = "/selectWarnSwitch") public RESTfulResult selectWarnSwitch(){ return otmsFeign.selectWarnSwitch(); } @ApiOperation(value="是否开启运输报警状态") @ApiImplicitParams({ @ApiImplicitParam(name = "warnSwitch", value = "运输报警状态", required = false, dataType = "String") }) @PostMapping(value = "/inTransitWarn") public RESTfulResult inTransitWarn(@RequestParam String warnSwitch,@RequestParam String radio){ return otmsFeign.inTransitWarn(warnSwitch,radio); } @ApiOperation(value="获得异常信息") @PostMapping("/getTransportAbnormalInfo") public RESTfulResult getTransportAbnormalInfo(@RequestBody(required=false) Map mapValue, @RequestParam(name = "apiId",defaultValue = "472") Integer apiId, @RequestParam(name = "pageNum") Integer pageNum, @RequestParam(name = "orderNumbers") String orderNumbers, @RequestParam(name = "pageSize") Integer pageSize){ mapValue=mapValue!=null?mapValue:new HashMap<>(); mapValue.put("orderNumbers",orderNumbers); return otmsFeign.getTransportAbnormalInfo(mapValue,apiId,pageNum,pageSize); } @ApiOperation(value="车牌号和时间查询路径") @PostMapping("/fullPathVisualizationByCarNumber") public Object fullPathVisualizationByCarNumber(@RequestBody HashMap mapValue) throws Exception{ return otmsFeign.fullPathVisualizationByCarNumber(mapValue); } @ApiOperation("厂外抵达作业") @PostMapping("/getArrivalResult") public Map getArrivalResult(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String con, String startTime, String endTime){ return otmsFeign.getArrivalResult(mapValue==null?new HashMap<>():mapValue, apiId, pageNum, pageSize,con,startTime,endTime); } @ApiOperation("展示满货箱的照片") @PostMapping("/getArrivalPhoto") public String getArrivalPhoto(@RequestParam String orderNumber){ return otmsFeign.getArrivalPhoto(orderNumber); } @ApiOperation("厂外抵达作业") @PostMapping("/getReceiptResult") public Map getReceiptResult(@RequestBody(required = false) Map mapValue, Integer apiId, Integer pageNum, Integer pageSize, String con, String startTime, String endTime){ return otmsFeign.getReceiptResult(mapValue==null?new HashMap<>():mapValue, apiId, pageNum, pageSize,con,startTime,endTime); } @ApiOperation("展示收货的照片") @PostMapping("/getReceivingPhotoByUrl") public Map getReceivingPhotoByUrl(@RequestParam String orderNumber) throws Exception { Map map=otmsFeign.getReceivingPhotoByUrl(orderNumber); if(map.containsKey("resultEmptyContainerPhoto") && map.get("resultEmptyContainerPhoto")!=null){ String resultEmptyContainerPhoto = (String) imageFileUtils.downloadFile(map.get("resultEmptyContainerPhoto").toString()); map.put("resultEmptyContainerPhoto",resultEmptyContainerPhoto); } if(map.containsKey("resultSignedNotePhoto") && map.get("resultSignedNotePhoto")!=null){ String resultSignedNotePhoto = (String) imageFileUtils.downloadFile(map.get("resultSignedNotePhoto").toString()); map.put("resultSignedNotePhoto",resultSignedNotePhoto); } if(map.containsKey("resultReceiveNotePhoto") && map.get("resultReceiveNotePhoto")!=null){ String resultSignedNotePhoto = (String) imageFileUtils.downloadFile(map.get("resultReceiveNotePhoto").toString()); map.put("resultReceiveNotePhoto",resultSignedNotePhoto); } //追加的图片 if(map.containsKey("otherPhoto1") && map.get("otherPhoto1")!=null){ String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto1").toString()); map.put("otherPhoto1",resultSignedNotePhoto); } if(map.containsKey("otherPhoto2") && map.get("otherPhoto2") !=null){ String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto2").toString()); map.put("otherPhoto2",resultSignedNotePhoto); } if(map.containsKey("otherPhoto3") && map.get("otherPhoto3") !=null){ String resultSignedNotePhoto =(String) imageFileUtils.downloadFile(map.get("otherPhoto3").toString()); map.put("otherPhoto3",resultSignedNotePhoto); } return map; } @GetMapping("/getCurrentLocation") public RESTfulResult getCurrentLocation(@RequestParam("capcityNumber") String capcityNumber) throws Exception{ return otmsFeign.getCurrentLocation(capcityNumber); } //在途订单列表 @PostMapping("/transportationPerformance") public RESTfulResult transportationPerformance(@RequestBody(required = false) Map mapValue, @RequestParam(required = true,defaultValue = "479",name = "apiId")Integer apiId, @RequestParam(required = false,name = "pageNum")Integer pageNum, @RequestParam(required = false,name = "pageSize")Integer pageSize){ return otmsFeign.transportationPerformance(mapValue!=null?mapValue:new HashMap<>(),apiId,pageNum,pageSize); } }