123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 |
- package com.steerinfo.dil.controller;
- import com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONObject;
- import com.steerinfo.dil.gaode.SearchPoint2;
- import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
- import com.steerinfo.dil.service.ITmstruckReceiptResultService;
- import com.steerinfo.dil.service.impl.OffSiteTransportationServiceImpl;
- import com.steerinfo.dil.util.BaseRESTfulController;
- import com.steerinfo.dil.util.ColumnDataUtil;
- import com.steerinfo.dil.util.DataChange;
- import com.steerinfo.dil.util.PageListAdd;
- import com.steerinfo.framework.controller.RESTfulResult;
- import com.steerinfo.framework.service.pagehelper.PageHelper;
- import com.steerinfo.route.config.ImageFileUtils;
- import com.steerinfo.route.service.impl.RouteServiceImpl;
- import com.steerinfo.route.threeRequest.ZhongJiaoXingLu;
- import com.steerinfo.route.util.DataConversionTool;
- import com.steerinfo.route.util.HTTPRequestUtils;
- import com.steerinfo.route.vo.FullPathVisualizationTo.ViewVisualization;
- import com.steerinfo.route.vo.Map.RouteVo;
- import com.steerinfo.route.vo.ResultWarn;
- import com.steerinfo.route.vo.currentLocation.CurrentLocation;
- import com.steerinfo.route.vo.currentLocation.CurrentLocationResult;
- import com.steerinfo.route.vo.resultJson.SearchPoint;
- import io.swagger.annotations.Api;
- 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.beans.factory.annotation.Value;
- import org.springframework.data.redis.core.RedisTemplate;
- import org.springframework.http.MediaType;
- import org.springframework.util.StringUtils;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import org.springframework.web.multipart.MultipartRequest;
- import java.math.BigDecimal;
- import java.net.URLEncoder;
- import java.text.SimpleDateFormat;
- import java.util.*;
- import java.util.concurrent.CompletableFuture;
- import java.util.concurrent.TimeUnit;
- @Api("厂外运输接口")
- @RestController
- @RequestMapping("/${api.version}/pathDisplay")
- public class OffSiteTransportationController extends BaseRESTfulController {
- @Autowired
- private ITmstruckLeaveFactoryResultService tmstruckLeaveFactoryResultService;
- @Autowired
- private RouteServiceImpl routeService;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @Autowired
- ImageFileUtils imageFileUtils;
- @Autowired
- private ZhongJiaoXingLu zhongJiaoXingLu;
- @Value("${str.tengxun.key}")
- private String key;
- @Value("${redis.prefix.order}")
- private String prefixOrder;
- @Value("${redis.prefix.line}")
- private String prefixLine;
- @Value("${redis.prefix.suffix}")
- private String suffix;
- @Autowired
- private RedisTemplate redisTemplate;
- private String gaodeTonken = "6488b963467353c2837c955cbb03104f";
- @Autowired
- ITmstruckReceiptResultService tmstruckReceiptResultService;
- private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- @Autowired
- OffSiteTransportationServiceImpl offSiteTransportationService;
- @ApiOperation("保存路径")
- @PostMapping("/savePath")
- public CompletableFuture<String> savePath() throws Exception {
- Map<String, Object> parem=tmstruckLeaveFactoryResultService.getTruckFactoryResult("WYSDD2022040600045906");
- parem.put("turnOf","0");
- return routeService.createTotalResult(parem);
- //运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
- //初始化请求参数
- // HashMap<String,Object> mapValue=new HashMap<>();
- // mapValue.put("orderNumber","WYSDD2021091000000001");
- // mapValue.put("capacityNumber","豫SB6238");
- // mapValue.put("resultOutGateTime","2021-11-17 14:20:19");
- // mapValue.put("turnOf","0");
- // mapValue.put("shipperName","四川达州钢铁集团有限");
- // mapValue.put("receiveAddress","长沙市");
- // return routeService.createTotalResult(mapValue);
- }
- @ApiOperation("全路径查询")
- @PostMapping("/fullPath")
- public RESTfulResult fullPath(String orderNumber) throws Exception {
- //运输订单号:orderNumber、车牌号:capacityNumber、出厂时间:resultOutGateTime、预警开关:turnOf、发货地址:shipperName、收货地址:receiveAddress
- //初始化请求参数
- //判断订单是否可以查看路径
- // int watch = offSiteTransportationService.checkOrder(orderNumber);
- // if (watch==1){
- HashMap<String,Object> mapValue=new HashMap<>();
- mapValue.put("orderNumber",orderNumber);
- return success(routeService.fullPathVisualization(mapValue).get());
- // }else {
- // return failed("-1");
- // }
- }
- @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("/getInTransitTransportation")
- public RESTfulResult getInTransitTransportation(@RequestBody Map<String,Object> 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
- )
- {
- if(mapValue.containsKey("startTime")&&mapValue.containsKey("endTime")){
- Date startDate=new Date(Long.parseLong(mapValue.get("startTime").toString())) ;
- Date endDate=new Date(Long.parseLong(mapValue.get("endTime").toString())) ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.replace("startTime",startTime1);
- mapValue.replace("endTime",endTime1);
- }else {
- Date startDate=new Date() ;
- Date endDate=new Date() ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.put("startTime",startTime1);
- mapValue.put("endTime",endTime1);
- }
- //执行中
- mapValue.put("orderStatus",5);
- List<Map<String,Object>> filter= offSiteTransportationService.getInTransitTransportation(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- List<Map<String,Object>> list= offSiteTransportationService.getInTransitTransportation(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, filter,list);
- return success(pageList);
- }
- @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("/getHaveAbnormalTruckOrderInfo")
- public RESTfulResult getHaveAbnormalTruckOrderInfo(@RequestBody Map<String,Object> 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
- )
- {
- if(mapValue.containsKey("startTime")&&mapValue.containsKey("endTime")){
- Date startDate=new Date(Long.parseLong(mapValue.get("startTime").toString())) ;
- Date endDate=new Date(Long.parseLong(mapValue.get("endTime").toString())) ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.replace("startTime",startTime1);
- mapValue.replace("endTime",endTime1);
- }else {
- Date startDate=new Date() ;
- Date endDate=new Date() ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.put("startTime",startTime1);
- mapValue.put("endTime",endTime1);
- }
- if (mapValue.containsKey("abnormalType")&&mapValue.get("abnormalType")!=null){
- switch(mapValue.get("abnormalType").toString()){
- case "其他":
- mapValue.put("abnormalType","0");
- break;
- case "偏离":
- mapValue.put("abnormalType","1");
- break;
- case "停车":
- mapValue.put("abnormalType","2");
- break;
- case "离线":
- mapValue.put("abnormalType","3");
- break;
- default:
- mapValue.remove("abnormalType");
- break;
- }
- }
- List<Map<String,Object>> filter= offSiteTransportationService.getHaveAbnormalTruckOrderInfo(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- List<Map<String,Object>> list= offSiteTransportationService.getHaveAbnormalTruckOrderInfo(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, filter,list);
- return success(pageList);
- }
- @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 Map<String,Object> 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
- )
- {
- if(mapValue.containsKey("startTime")&&mapValue.containsKey("endTime")){
- Date startDate=new Date(Long.parseLong(mapValue.get("startTime").toString())) ;
- Date endDate=new Date(Long.parseLong(mapValue.get("endTime").toString())) ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.replace("startTime",startTime1);
- mapValue.replace("endTime",endTime1);
- }else {
- Date startDate=new Date() ;
- Date endDate=new Date() ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.put("startTime",startTime1);
- mapValue.put("endTime",endTime1);
- }
- //已经完成
- mapValue.put("orderStatus",2);
- List<Map<String,Object>> filter= offSiteTransportationService.getInTransitTransportation(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- List<Map<String,Object>> list= offSiteTransportationService.getInTransitTransportation(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, filter,list);
- return success(pageList);
- }
- @PostMapping(value = "/addTmstruckReceiptResult" )
- public synchronized RESTfulResult addTmstruckReceiptResult(@RequestBody Map<String,Object> value , Integer num, String orderNumber, String resultArrivalAddress, Integer imgcount3, Integer imgcount4) throws Exception {
- Map<String,Object> map = new HashMap<String,Object>();
- map.put("orderNumber",orderNumber);
- map.put("resultArrivalAddress",resultArrivalAddress);
- Integer orderStatus = offSiteTransportationService.getOrderStatus(map);
- //判断是否已经结束
- if (orderStatus!=null&&orderStatus==2){
- return failed(-3);
- }
- map.putAll(value);
- //添加入库实绩
- Integer resTfulResult = offSiteTransportationService.addTmstruckReceiptResult(map);
- if (resTfulResult!=4){
- //保存路线
- String redisJson = (String) redisTemplate.opsForValue().get(prefixOrder+":"+orderNumber);
- HashMap mapValue = JSON.parseObject(redisJson, HashMap.class);
- String json = zhongJiaoXingLu.visualRoute(mapValue);
- ViewVisualization to=null;
- if (json!=null){
- //设置60天后过期
- Calendar calendar=Calendar.getInstance();
- long agoTime= calendar.getTime().getTime();
- calendar.add(Calendar.MONTH,2);
- long lateTime= calendar.getTime().getTime();
- long saveTime=(lateTime-agoTime)/1000;
- redisTemplate.opsForValue().set(prefixLine+":"+orderNumber, json, saveTime, TimeUnit.SECONDS);
- //删除订单
- redisTemplate.delete(prefixOrder+":"+orderNumber);
- redisTemplate.delete(prefixOrder+":"+orderNumber+suffix);
- //添加运输距离
- to= (ViewVisualization) JSON.parseObject(json,ViewVisualization.class);
- }else {
- HashMap<String,Object> hashMap=new HashMap();
- hashMap.put("orderNumber",orderNumber);
- Map<String,Object> resultMap= offSiteTransportationService.getStartAndEndCapacityNumber(hashMap);
- if (resultMap!=null){
- json= getPathJSON(resultMap.get("capacityNumber").toString(),resultMap.get("resultOutGateTime").toString());
- if (json!=null&&!json.equals("")){
- to= (ViewVisualization) JSON.parseObject(json,ViewVisualization.class);
- }
- }
- }
- //设置运输距离,并且结束订单
- if (to!=null&&to.getResult()!=null&&to.getResult().getRunDistance()!=null){
- Map<String,Object> ordermap=new HashMap<>();
- ordermap.put("orderNumber",orderNumber);
- ordermap.put("orderMileage",to.getResult().getRunDistance()==null?"1":to.getResult().getRunDistance());
- offSiteTransportationService.insertOrderMileage(ordermap);
- }else {
- if (to!=null&&to.getStatus()==1006){
- Map<String,Object> ordermap=new HashMap<>();
- ordermap.put("orderNumber",orderNumber);
- ordermap.put("orderMileage","-1");
- offSiteTransportationService.insertOrderMileage(ordermap);
- }else if (to!=null&&to.getStatus()==1001){
- Map<String,Object> ordermap=new HashMap<>();
- ordermap.put("orderNumber",orderNumber);
- ordermap.put("orderMileage","1");
- offSiteTransportationService.insertOrderMileage(ordermap);
- } else {
- Map<String,Object> ordermap=new HashMap<>();
- ordermap.put("orderNumber",orderNumber);
- ordermap.put("orderMileage","-1");
- offSiteTransportationService.insertOrderMileage(ordermap);
- }
- }
- //关闭运输订单
- offSiteTransportationService.orderClose(orderNumber);
- }
- return success(resTfulResult);
- }
- //如果内容丢失重新获得
- public String getPathJSON(String capacityNumber,String resultOutGateTime) throws Exception {
- //入网验证
- String netValidationResult = zhongJiaoXingLu.netValidation(capacityNumber);
- Map netValidationMap = (Map) JSONObject.parse(netValidationResult);
- if (Integer.parseInt(netValidationMap.get("status").toString())==1001&&netValidationMap.get("result").toString().equals("yes")){
- String searchPointJson = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address="+ URLEncoder.encode("四川省达州钢铁集团有限责任公司","utf-8")+"&key="+gaodeTonken);
- SearchPoint2 searchPoint= JSON.parseObject(searchPointJson, SearchPoint2.class);
- String searchPointJson2 = HTTPRequestUtils.sendGet("https://restapi.amap.com/v3/geocode/geo", "address="+URLEncoder.encode("四川省达州钢铁集团有限责任公司","utf-8")+"&key="+gaodeTonken);
- SearchPoint2 searchPoint2= JSON.parseObject(searchPointJson2, SearchPoint2.class);
- //运单生成之后保存
- HashMap<String,String> redisMap=new HashMap<>();
- String location = searchPoint.getGeocodes().get(0).getLocation();
- String[] split = StringUtils.split(location, ",");
- String Lng = split[0];
- String Lat = split[1];
- redisMap.put("startLonlat", Lng.substring(0, 9) + "," + Lat.substring(0, 8));
- String location2 = searchPoint2.getGeocodes().get(0).getLocation();
- String[] split2 = StringUtils.split(location2, ",");
- String Lng2 = split2[0];
- String Lat2 = split2[1];
- redisMap.put("endLonlat", Lng2.substring(0, 9) + "," + Lat2.substring(0, 8));
- redisMap.put("vclN", capacityNumber);
- redisMap.put("vco","2");
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
- String qryBtm=resultOutGateTime;
- //获得23小时、45分钟之后的时间
- Date parse = simpleDateFormat.parse(qryBtm);
- //时间添加
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(parse);
- calendar.add(Calendar.HOUR_OF_DAY, 23);
- calendar.add(Calendar.SECOND, 45);
- redisMap.put("qryBtm", qryBtm);
- redisMap.put("qryEtm",simpleDateFormat.format(calendar.getTime()));
- System.out.println(redisMap);
- String json = zhongJiaoXingLu.visualRoute(redisMap);
- System.out.println(json.length()>100?json.substring(0,100):json);
- return json;
- }
- return null;
- }
- public String removeData(){
- offSiteTransportationService.removeDate();
- return "success";
- }
- /**查询是否开启运输报警状态
- * warnSwitch
- * @param
- * @return
- */
- @ApiOperation(value="查询是否开启运输报警状态")
- @ApiImplicitParams({
- })
- @PostMapping(value = "/selectWarnSwitch")
- public RESTfulResult selectWarnSwitch() {
- Map<String,Object> warnSwitch = offSiteTransportationService.selectWarnSwitch();
- return success(warnSwitch);
- }
- /**是否开启运输报警状态
- * warnSwitchaddTmstruckTotalResult
- * @param
- * @returninTransitOrderMileage
- */
- @ApiOperation(value="是否开启运输报警状态")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "warnSwitch", value = "运输报警状态", required = false, dataType = "String")
- })
- @PostMapping(value = "/inTransitWarn")
- public RESTfulResult inTransitWarn(@RequestParam String warnSwitch,@RequestParam String radio) {
- int i = offSiteTransportationService.updateWarnSwitch(warnSwitch,radio);
- return success(i);
- }
- @PostMapping("/abnormalLineWarn")
- public String abnormalLineWarn(@RequestParam(value = "data") String data) throws Exception {
- ResultWarn resultWarn= (ResultWarn) JSON.parseObject(data, ResultWarn.class);
- Map<String, Object> map= DataConversionTool.objectToMap(resultWarn);
- int i= offSiteTransportationService.addTransportationAlarm(map);
- return "success";
- }
- @PostMapping("/parkWarn")
- public String parkWarn(@RequestParam(value = "data",required = false) String data) throws Exception {
- ResultWarn resultWarn= (ResultWarn) JSON.parseObject(data, ResultWarn.class);
- Map<String, Object> map= DataConversionTool.objectToMap(resultWarn);
- int i=offSiteTransportationService.addTransportationAlarm(map);
- return "success";
- }
- @PostMapping("/offLineWarn")
- public String offLineWarn(@RequestParam(value = "data") String data) throws Exception {
- ResultWarn resultWarn= (ResultWarn) JSON.parseObject(data, ResultWarn.class);
- Map<String, Object> map= DataConversionTool.objectToMap(resultWarn);
- int i=offSiteTransportationService.addTransportationAlarm(map);
- return "success";
- }
- @ApiOperation(value="展示运输在途异常信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "apiId(472)", value = "表头", required = false, dataType = "Interger")
- })
- @PostMapping("/getTransportAbnormalInfo")
- public RESTfulResult getTransportAbnormalInfo(@RequestBody(required=false) Map<String,Object> mapValue,
- @RequestParam(name = "apiId",defaultValue = "472") Integer apiId,
- @RequestParam(name = "pageNum") Integer pageNum,
- @RequestParam(name = "pageSize") Integer pageSize){
- List<Map<String, Object>> transportAbnormalInfo = offSiteTransportationService.getTransportAbnormalInfo(mapValue);
- PageHelper.startPage(pageNum,pageSize);
- List<Map<String, Object>> transportAbnormalInfo1 = offSiteTransportationService.getTransportAbnormalInfo(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId,transportAbnormalInfo,transportAbnormalInfo1);
- return success(pageList);
- }
- @ApiOperation(value="查询路径")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "查询条件", required = false, dataType = "HashMap")
- })
- @PostMapping("/fullPathVisualizationByCarNumber")
- public RESTfulResult fullPathVisualizationByCarNumber(@RequestBody HashMap mapValue) throws Exception {
- //判断是否自提
- /*int count = offSiteTransportationService.isSelfMention(mapValue.get("capacityNumber").toString());
- if (count==0){*/
- CompletableFuture<RouteVo> createOrder =routeService.fullPathVisualizationByCarNumber(mapValue);
- return success(createOrder.get());
- /* }else {
- return failed(-1);
- }*/
- }
- @ApiOperation(value="展示抵达实绩信息")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "apiId(470)", value = "表头", required = false, dataType = "Interger")
- })
- @PostMapping("/getReceiptResult")
- public RESTfulResult getReceiptResult(@RequestBody(required=false) Map<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- String startTime,
- String endTime,
- String con){
- if (con != null && (con.equals("") || con.equals("undefined")) ) {
- con = null;
- }
- if (con != null && con.length() != 0) {
- mapValue.put("con","%" + con + "%");
- }
- DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);
- PageHelper.startPage(pageNum,pageSize);
- List<Map<String, Object>> receiptResultInfo = tmstruckReceiptResultService.getReceiptResultInfo(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId,null,receiptResultInfo);
- return success(pageList);
- }
- @PostMapping("/createTotalResult")
- public RESTfulResult createTotalResult(@RequestBody(required=true) Map<String, Object> mapValue) throws Exception {
- //判断是否自提
- int count = offSiteTransportationService.isSelfMention(mapValue.get("capacityNumber").toString());
- if (count==0){
- CompletableFuture<String> totalResult = routeService.createTotalResult(mapValue);
- return success(totalResult);
- }else {
- return failed(-1);
- }
- }
- @GetMapping("/getCurrentLocation")
- public RESTfulResult getCurrentLocation(@RequestParam("capcityNumber") String capcityNumber) throws Exception {
- CurrentLocationResult currentLocationResult = routeService.getCurrentLocation(capcityNumber);
- return success(currentLocationResult);
- }
- //在途订单列表
- @PostMapping("/transportationPerformance")
- public RESTfulResult transportationPerformance(@RequestBody Map<String,Object> mapValue,
- @RequestParam(required = true,defaultValue = "479",name = "apiId")Integer apiId,
- @RequestParam(required = false,name = "pageNum")Integer pageNum,
- @RequestParam(required = false,name = "pageSize")Integer pageSize){
- if(mapValue.containsKey("startTime")&&mapValue.containsKey("endTime")){
- Date startDate=new Date(Long.parseLong(mapValue.get("startTime").toString())) ;
- Date endDate=new Date(Long.parseLong(mapValue.get("endTime").toString())) ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.replace("startTime",startTime1);
- mapValue.replace("endTime",endTime1);
- }else {
- Date startDate=new Date() ;
- Date endDate=new Date() ;
- Calendar ca = Calendar.getInstance();
- ca.setTime(endDate);
- ca.add(Calendar.DATE,1);
- SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
- String startTime1=simpleDateFormat.format(startDate);
- String endTime1=simpleDateFormat.format(ca.getTime());
- mapValue.put("startTime",startTime1);
- mapValue.put("endTime",endTime1);
- }
- //执行中
- List<Map<String,Object>> filter= offSiteTransportationService.transportationPerformance(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- List<Map<String,Object>> list= offSiteTransportationService.transportationPerformance(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, filter,list);
- return success(pageList);
- }
- @GetMapping("/getLocationForAddress")
- public RESTfulResult getAddress(@RequestParam("address") String address) {
- try{
- return success(routeService.getLocationForAddress(address));
- }catch (Exception e){
- e.printStackTrace();
- return failed("没有查询到地址!请检查输入");
- }
- }
- }
|