Ver código fonte

Merge branch 'master' of https://gitee.com/antai-wuliu/ANTAI-API

# Conflicts:
#	src/main/java/com/steerinfo/dil/controller/TMSController.java
#	src/main/java/com/steerinfo/dil/feign/TmsFeign.java
zhangym 2 anos atrás
pai
commit
311847fd09

+ 24 - 0
src/main/java/com/steerinfo/dil/config/WebExceptionHandler.java

@@ -0,0 +1,24 @@
+package com.steerinfo.dil.config;
+
+import com.steerinfo.framework.controller.RESTfulResult;
+import org.apache.log4j.Logger;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@ControllerAdvice
+public class WebExceptionHandler {
+
+    static final Logger log = Logger.getLogger(WebExceptionHandler.class);
+
+    @ExceptionHandler(value =Exception.class)
+    @ResponseBody
+    public RESTfulResult exceptionHandler(Exception e){
+        log.error("全局异常捕获:"+e);
+        e.printStackTrace();
+        if(e instanceof NullPointerException){
+            return new RESTfulResult("500", "操作失败:缺乏必要参数!", e);
+        }
+        return new RESTfulResult("500", "操作失败:"+e.getMessage(), e);
+    }
+}

+ 30 - 1
src/main/java/com/steerinfo/dil/controller/AMScontroller.java

@@ -359,11 +359,16 @@ public class AMScontroller {
             @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
     })
     @PostMapping(value = "/saleAdd")
-    @LogAround(foreignKeys = {"transPlanId"}, foreignKeyTypes = {"采购计划"})
+    @LogAround(foreignKeys = {"transRequirementId"}, foreignKeyTypes = {"销售需求"})
     public Map<String, Object> saleAdd(@RequestBody(required = false) Map<String, Object> map) {
         return amsFeign.saleAdd(map);
     }
 
+    @PostMapping(value = "/readExcel")
+    public RESTfulResult readExcel(MultipartFile file,@RequestParam("userCode") String userCode)  {
+        return amsFeign.readExcel(file, userCode);
+    }
+
     @ApiOperation(value="展示销售需求")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "参数", required = false, dataType = "map"),
@@ -414,6 +419,14 @@ public class AMScontroller {
         return amsFeign.editButton(params);
     }
 
+    @ApiOperation(value = "删除发货单信息", notes = "根据填写的数据将发货单进行删除")
+    @ApiImplicitParam(name = "params", value = "查询内容", required = false, dataType = "HashMap<String, Object>")
+    @PostMapping(value = "/deleteDlivDirno")
+    public RESTfulResult deleteDlivDirno(@RequestBody(required = false) HashMap<String, Object> params) {
+        return amsFeign.deleteDlivDirno(params);
+    }
+
+
     @ApiOperation(value="展示销售合同")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "参数", required = false, dataType = "map"),
@@ -511,4 +524,20 @@ public class AMScontroller {
     public Map<String, Object> salePlanDelete(@RequestBody(required = false) Map<String, Object> map) {
         return amsFeign.salePlanDelete(map);
     }
+
+    @ApiOperation(value = "展示销售计划详情")
+    @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(value = "/getSalePlanList")
+    Map<String, Object> getSalePlanList(@RequestBody(required = false) Map<String, Object> mapValue,
+                                            Integer apiId,
+                                            Integer pageNum,
+                                            Integer pageSize
+    ) {
+        return amsFeign.getSalePlanList(mapValue == null ? new HashMap<>() : mapValue, apiId, pageNum, pageSize);
+    }
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/controller/SystemFileController.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.controller;
 
+import com.google.common.collect.Iterators;
 import com.steerinfo.dil.util.FtpFileUtil;
 import com.steerinfo.dil.util.IDutils;
 import com.steerinfo.framework.controller.BaseRESTfulController;
@@ -260,4 +261,6 @@ public class SystemFileController extends BaseRESTfulController {
         }
 
     }
+
+
 }

+ 321 - 5
src/main/java/com/steerinfo/dil/controller/TMSController.java

@@ -2,9 +2,12 @@ package com.steerinfo.dil.controller;
 
 
 import com.steerinfo.dil.annotaion.LogAround;
+import com.steerinfo.dil.feign.AmsFeign;
+import com.steerinfo.dil.feign.RmsFeign;
 import com.steerinfo.dil.feign.TmsFeign;
 import com.steerinfo.dil.mapper.UniversalMapper;
 import com.steerinfo.dil.util.BaseRESTfulController;
+import com.steerinfo.dil.util.ExcelToolUtils;
 import com.steerinfo.framework.controller.RESTfulResult;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -13,14 +16,16 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import com.steerinfo.dil.util.DataChange;
+import org.springframework.web.multipart.MultipartRequest;
 
 /**
  * @author luobang
@@ -32,6 +37,16 @@ import java.util.concurrent.Callable;
 public class TMSController extends BaseRESTfulController {
     @Autowired
     private TmsFeign tmsFeign;
+
+    @Autowired
+    private AmsFeign amsFeign;
+
+    @Autowired
+    private RmsFeign rmsFeign;
+
+    @Autowired
+    private UniversalMapper universalMapper;
+
     @ApiOperation(value = "车辆实绩")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "map", value = "参数", required = false, dataType = "map"),
@@ -94,6 +109,14 @@ public class TMSController extends BaseRESTfulController {
         return tmsFeign.changeTransOrder(map);
     }
 
+    @ApiOperation(value="司机接收运单")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/receiptOrder")
+    @LogAround(foreignKeys = {"transOrderId"},foreignKeyTypes = {"运输订单"})
+    public Map<String, Object> receiptOrder(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.receiptOrder(map);
+    }
+
     @ApiOperation(value = "查询运输订单")
     @PostMapping("/getTransOrderList")
     public Map<String, Object> getTransOrderList(@RequestBody(required = false) Map<String, Object> map,
@@ -103,6 +126,13 @@ public class TMSController extends BaseRESTfulController {
         return tmsFeign.getTransOrderList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
     }
 
+    @ApiOperation(value="查询运输订单所有运输实绩")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/getTransResult")
+    public Map<String, Object> getTransResult(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.getTransResult(map);
+    }
+
     @ApiOperation(value="同步进厂")
     @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
     @PostMapping(value = "/syncEnfactoryResult")
@@ -127,6 +157,7 @@ public class TMSController extends BaseRESTfulController {
         return tmsFeign.syncWeightResult(map);
     }
 
+<<<<<<< HEAD
     @ApiOperation(value="计时")
     @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
     @PostMapping(value = "/startend")
@@ -150,5 +181,290 @@ public class TMSController extends BaseRESTfulController {
     @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"修改计时"})
     public Map<String, Object> tmstimingresultsUpdate(@RequestBody(required = false) Map<String, Object> map){
         return tmsFeign.tmstimingresultsUpdate(map);
+=======
+
+    @ApiOperation(value="销售派发运输订单")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/saleDispatchOrder")
+    @LogAround(foreignKeys = {"transOrderId"},foreignKeyTypes = {"运输订单"})
+    public Map<String, Object> saleDispatchOrder(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.saleDispatchOrder(map);
+    }
+
+    @ApiOperation(value = "查询销售运输订单")
+    @PostMapping("/getSaleTransOrderList")
+    public Map<String, Object> getSaleTransOrderList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getSaleTransOrderList(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+    @ApiOperation(value="同步质检")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/syncQualityResult")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"质检实绩"})
+    public Map<String, Object> syncQualityResult(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.syncQualityResult(map);
+    }
+    @ApiOperation(value="签到")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/signIn")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"签到实绩"})
+    public Map<String, Object> signIn(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.signIn(map);
+    }
+
+    @ApiOperation(value="换车头")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/replaceFront")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"换车头实绩"})
+    public Map<String, Object> replaceFront(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.replaceFront(map);
+    }
+
+    @ApiOperation(value="装货")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/load")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
+    public Map<String, Object> load(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.load(map);
+    }
+
+    @ApiOperation(value="装货修改")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/loadUpd")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
+    public Map<String, Object> loadUpd(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.loadUpd(map);
+    }
+
+    @ApiOperation(value="卸货")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/unload")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"卸货实绩"})
+    public Map<String, Object> unload(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.unload(map);
+    }
+
+    @ApiOperation(value="卸货修改")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/unloadUpd")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"卸货实绩"})
+    public Map<String, Object> unloadUpd(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.unloadUpd(map);
+    }
+
+    @ApiOperation(value="抵达")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/arrival")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"抵达实绩"})
+    public Map<String, Object> arrival(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.arrival(map);
+    }
+
+    @ApiOperation(value="签收")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/receipt")
+    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"签收实绩"})
+    public Map<String, Object> receipt(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.receipt(map);
+    }
+
+
+    @ApiOperation(value="查询厂内车辆数")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/getCountEnfactory")
+    public Map<String, Object> getCountEnfactory(@RequestBody(required = false) Map<String, Object> map){
+        return tmsFeign.getCountEnfactory(map == null ? new HashMap<>():map);
+    }
+
+    @ApiOperation(value = "查询签到")
+    @PostMapping("/getSignInResultList")
+    public Map<String, Object> getSignInResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                   Integer apiId,
+                                                   Integer pageNum,
+                                                   Integer pageSize) {
+        return tmsFeign.getSignInResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询换车头")
+    @PostMapping("/getReplaceFrontResultList")
+    public Map<String, Object> getReplaceFrontResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                         Integer apiId,
+                                                         Integer pageNum,
+                                                         Integer pageSize) {
+        return tmsFeign.getReplaceFrontResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询进厂")
+    @PostMapping("/getEnfactoryResultList")
+    public Map<String, Object> getEnfactoryResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getEnfactoryResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询出厂")
+    @PostMapping("/getOutfactoryResultList")
+    public Map<String, Object> getTmsOutfactoryResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getOutfactoryResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询装货")
+    @PostMapping("/getLoadResultList")
+    public Map<String, Object> getLoadResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getLoadResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+
+    @ApiOperation(value = "查询卸货")
+    @PostMapping("/getUnloadResultList")
+    public Map<String, Object> getUnloadResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getUnloadResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询计量")
+    @PostMapping("/getWeightResultList")
+    public Map<String, Object> getWeightResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getWeightResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询质检")
+    @PostMapping("/getQualityResultList")
+    public Map<String, Object> getQualityResult(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getQualityResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询抵达")
+    @PostMapping("/getArrivalResultList")
+    public Map<String, Object> getArrivalResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.getArrivalResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value = "查询签收")
+    @PostMapping("/getReceiptResultList")
+    public Map<String, Object> getReceiptResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize){
+            return tmsFeign.getReceiptResultList(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+
+        }
+
+    @ApiOperation(value="采购火运装货作业")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/purchaseTrainLoad")
+//    @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
+    public Map<String, Object> purchaseTrainLoad(@RequestBody MultipartFile file,
+                                                 String materialType,
+                                                 String userId,
+                                                 String userName) throws Exception {
+        File excel =  ExcelToolUtils.multipartFileToFile(file);
+        FileInputStream is = null;
+        String fileName = excel.getName();
+        // 解决fileName兼容性问题
+        int lastindex = fileName.lastIndexOf("\\");
+        fileName = fileName.substring(lastindex + 1);
+        if (fileName != null && fileName.length() > 0) {
+            is = new FileInputStream(excel);
+        }
+        Map<String,Object> map = new HashMap<>();
+        //获取Excel中包含的对象数组
+        List<Map<String,Object>> list = ExcelToolUtils.getExcelList(is, fileName, 0);
+        List<String> capacityIds = new ArrayList<>();
+        for(Map<String,Object> item:list){
+            capacityIds.add(item.get("车号").toString());
+        }
+        map.put("list",list);
+        //校验当前excel是否已经导过
+        if(universalMapper.checkTrainOrder(map) > 0){
+            throw new Exception("存在24小时内的重复运单!不允许重复导入!");
+        }
+        //统计通知单的重量车数和车牌号
+        Set<String>  capacitySet = new HashSet<>();//车牌号
+        for (Map<String,Object> item : list){
+            //通知单统计
+            String requirementNumber = item.get("通知单号").toString();
+            if(map.get("requirementNumber") != null){
+                if(map.get("requirementNumber").equals(requirementNumber)){
+                    //已存在,修改
+                    BigDecimal weight = DataChange.dataToBigDecimal(map.get("weight"));
+                    BigDecimal truckNumber = DataChange.dataToBigDecimal(map.get("truckNumber"));
+                    weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
+                    truckNumber = truckNumber.add(new BigDecimal(1));
+                    map.put("weight",weight);
+                    map.put("truckNumber",truckNumber);
+                }else{
+                    throw new Exception("同一个Excel文件中只允许有一个采购订单号!");
+                }
+            }else{
+                //不存在,新增
+                BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
+                BigDecimal truckNumber = new BigDecimal(1);
+                map.put("requirementNumber",requirementNumber);
+                map.put("weight",weight);
+                map.put("truckNumber",truckNumber);
+            }
+            //车牌号去重
+            capacitySet.add(item.get("车号").toString());
+        }
+        //新增火车运力资源
+        String[] capacities = capacitySet.toArray(new String[0]);//车牌号
+        if(capacities.length != list.size()){
+            throw new Exception("车号不允许重复!");
+        }else{
+            new Runnable(){
+                @Override
+                public void run() {
+                    Map<String,Object> capacityMap = new HashMap<>();
+                    capacityMap.put("capacities",capacities);
+                    capacityMap.put("userId",userId);
+                    capacityMap.put("userName",userName);
+                    rmsFeign.batchInsertCapacityTrain(capacityMap);
+                }
+            }.run();
+        }
+        //新增AMS及TMS
+        map.put("userId",userId);
+        map.put("userName",userName);
+        map.put("materialType",materialType);
+        return tmsFeign.purchaseTrainLoad(map,userId,userName);
+    }
+
+    @ApiOperation(value = "查询采购火运装货")
+    @PostMapping("/purchaseTrainLoadList")
+    public Map<String, Object> purchaseTrainLoadList(@RequestBody(required = false) Map<String, Object> map,
+                                                 Integer apiId,
+                                                 Integer pageNum,
+                                                 Integer pageSize) {
+        return tmsFeign.purchaseTrainLoadList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
+    }
+
+    @ApiOperation(value="更改销售运输订单状态")
+    @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
+    @PostMapping(value = "/changeSaleTransOrder")
+    @LogAround(foreignKeys = {"transOrderId"},foreignKeyTypes = {"销售运输订单"})
+    public Map<String, Object> changeSaleTransOrder(@RequestBody(required = false) Map<String, Object> map) {
+        return tmsFeign.changeSaleTransOrder(map);
+>>>>>>> deadaae9127aedbf357007f7909d98950956f7ce
     }
 }

+ 21 - 0
src/main/java/com/steerinfo/dil/controller/systemOaController.java

@@ -0,0 +1,21 @@
+package com.steerinfo.dil.controller;
+
+
+import com.baomidou.mybatisplus.extension.api.R;
+import com.steerinfo.dil.util.BaseRESTfulController;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.steerinfo.dil.util.HTTPRequestUtils;
+
+import java.io.IOException;
+
+
+@RestController
+@RequestMapping("/${api.version}/systemOaController")
+public class systemOaController extends BaseRESTfulController {
+
+
+
+
+}

+ 16 - 0
src/main/java/com/steerinfo/dil/feign/AmsFeign.java

@@ -6,7 +6,9 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
@@ -81,6 +83,9 @@ public interface AmsFeign {
     @PostMapping(value = "api/v1/ams/amstransplans/purchasePlanUpdate")
     Map<String, Object> purchasePlanUpdate(Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/ams/amstransplans/purchaseTrainPlanAdd")
+    Map<String, Object> purchaseTrainPlanAdd(Map<String,Map<String,Object>> map);
+
     @PostMapping(value = "api/v1/ams/amstransplans/purchasePlanChange")
     Map<String, Object> purchasePlanChange(Map<String, Object> map);
 
@@ -129,6 +134,8 @@ public interface AmsFeign {
 	@PostMapping(value = "api/v1/ams/amstransrequirements/saleAdd")
     Map<String, Object> saleAdd(@RequestBody(required = false) Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/ams/amstransrequirements/readExcel", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    RESTfulResult readExcel(MultipartFile file, @RequestParam("userCode") String userCode);
 
     @PostMapping(value = "api/v1/ams/amstransrequirements/selectDlivDirNo")
     Map<String, Object> selectDlivDirNo(@RequestBody(required = false) HashMap<String, Object> map,
@@ -151,6 +158,9 @@ public interface AmsFeign {
     @PostMapping(value = "api/v1/ams/amsrequirementchilds/editButton")
     RESTfulResult editButton(@RequestBody(required = false) HashMap<String, Object> params);
 
+    @PostMapping(value = "api/v1/ams/amsrequirementchilds/deleteDlivDirno")
+    RESTfulResult deleteDlivDirno(@RequestBody(required = false) HashMap<String, Object> params);
+
     @PostMapping(value = "api/v1/ams/amstransplans/productionPlanAdd")
     Map<String, Object> productionPlanAdd(@RequestBody(required = false)Map<String, Object> map);
     @PostMapping("api/v1/ams/amstransplans/getproductionPlanList")
@@ -175,4 +185,10 @@ public interface AmsFeign {
     @PostMapping(value = "api/v1/ams/amstransplans/salePlanDelete")
     Map<String, Object> salePlanDelete(@RequestBody(required = false)Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/ams/amstransplans/getSalePlanList")
+    Map<String, Object> getSalePlanList(@RequestBody(required = false) Map<String, Object> map,
+                                        @RequestParam Integer apiId,
+                                        @RequestParam Integer pageNum,
+                                        @RequestParam Integer pageSize);
+
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/feign/RmsFeign.java

@@ -204,6 +204,9 @@ public interface RmsFeign {
     @PostMapping(value = "api/v1/rms/rmscapacity/insertCapacity")
     Map<String, Object> insertCapacity(@RequestBody(required = false) Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/rms/rmscapacity/batchInsertCapacityTrain")
+    Map<String, Object> batchInsertCapacityTrain(@RequestBody(required = false) Map<String, Object> map);
+
     //删除运力
     @PostMapping(value = "api/v1/rms/rmscapacity/deleteCapacity")
     Map<String, Object> deleteCapacity(@RequestBody(required = false) Map<String, Object> map);

+ 121 - 0
src/main/java/com/steerinfo/dil/feign/TmsFeign.java

@@ -50,6 +50,12 @@ public interface TmsFeign {
     @PostMapping("api/v1/tms/omstransorders/changeTransOrder")
     Map<String, Object> changeTransOrder(Map<String, Object> map);
 
+    @PostMapping("api/v1/tms/omstransorders/receiptOrder")
+    Map<String, Object> receiptOrder(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/omstransorders/getTransResult")
+    Map<String, Object> getTransResult(Map<String, Object> map);
+
     @PostMapping("api/v1/tms/tmsenfactoryresults/syncEnfactoryResult")
     Map<String, Object> syncEnfactoryResult(Map<String, Object> map);
 
@@ -60,6 +66,7 @@ public interface TmsFeign {
     Map<String, Object> syncWeightResult(Map<String, Object> map);
 
 
+<<<<<<< HEAD
     @PostMapping("api/v1/tms/tmstimingresults/startend")
     Map<String, Object> startend(Map<String, Object> map);
 
@@ -69,10 +76,124 @@ public interface TmsFeign {
 
     @PostMapping("api/v1/tms/tmstimingresults/tmstimingresultsList")
     Map<String, Object> tmstimingresultsList(@RequestBody(required = false) Map<String, Object> map,
+=======
+    @PostMapping("api/v1/tms/omstransorders/saleDispatchOrder")
+    Map<String, Object> saleDispatchOrder(@RequestBody(required = false) Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/omstransorders/getSaleTransOrderList")
+    Map<String, Object> getSaleTransOrderList(@RequestBody(required = false) Map<String, Object> map,
+>>>>>>> deadaae9127aedbf357007f7909d98950956f7ce
+                                          @RequestParam  Integer apiId,
+                                          @RequestParam  Integer pageNum,
+                                          @RequestParam  Integer pageSize);
+
+<<<<<<< HEAD
+=======
+    @PostMapping("api/v1/tms/tmsqualityresults/syncQualityResult")
+    Map<String, Object> syncQualityResult(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmssigninresults/signIn")
+    Map<String, Object> signIn(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmsreplacefrontresults/replaceFront")
+    Map<String, Object> replaceFront(Map<String, Object> map);
+
+
+    @PostMapping("api/v1/tms/tmsloadresults/load")
+    Map<String, Object> load(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmsloadresults/loadUpd")
+    Map<String, Object> loadUpd(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmsunloadresults/unload")
+    Map<String, Object> unload(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmsunloadresults/unloadUpd")
+    Map<String, Object> unloadUpd(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmsarrivalresults/arrival")
+    Map<String, Object> arrival(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmsreceiptresults/receipt")
+    Map<String, Object> receipt(Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/omstransorders/getCountEnfactory")
+    Map<String, Object>  getCountEnfactory(@RequestBody(required = false) Map<String, Object> map);
+
+    @PostMapping("api/v1/tms/tmssigninresults/getSignInResultList")
+    Map<String, Object> getSignInResultList(@RequestBody(required = false) Map<String, Object> map,
+                                            @RequestParam  Integer apiId,
+                                            @RequestParam  Integer pageNum,
+                                            @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsreplacefrontresults/getReplaceFrontResultList")
+    Map<String, Object> getReplaceFrontResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                  @RequestParam  Integer apiId,
+                                                  @RequestParam  Integer pageNum,
+                                                  @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsenfactoryresults/getEnfactoryResultList")
+    Map<String, Object> getEnfactoryResultList(@RequestBody(required = false) Map<String, Object> map,
+                                          @RequestParam  Integer apiId,
+                                          @RequestParam  Integer pageNum,
+                                          @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsoutfactoryresults/getOutfactoryResultList")
+    Map<String, Object> getOutfactoryResultList(@RequestBody(required = false) Map<String, Object> map,
+                                              @RequestParam  Integer apiId,
+                                              @RequestParam  Integer pageNum,
+                                              @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsloadresults/getLoadResultList")
+    Map<String, Object> getLoadResultList(@RequestBody(required = false) Map<String, Object> map,
+                                                   @RequestParam  Integer apiId,
+                                                   @RequestParam  Integer pageNum,
+                                                   @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsloadresults/purchaseTrainLoadList")
+    Map<String, Object> purchaseTrainLoadList(@RequestBody(required = false) Map<String, Object> map,
+                                          @RequestParam  Integer apiId,
+                                          @RequestParam  Integer pageNum,
+                                          @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsunloadresults/getUnloadResultList")
+    Map<String, Object> getUnloadResultList(@RequestBody(required = false) Map<String, Object> map,
                                           @RequestParam  Integer apiId,
                                           @RequestParam  Integer pageNum,
                                           @RequestParam  Integer pageSize);
 
+    @PostMapping("api/v1/tms/tmsweightresults/getWeightResultList")
+    Map<String, Object> getWeightResultList(@RequestBody(required = false) Map<String, Object> map,
+                                            @RequestParam  Integer apiId,
+                                            @RequestParam  Integer pageNum,
+                                            @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsqualityresults/getQualityResultList")
+    Map<String, Object> getQualityResultList(@RequestBody(required = false) Map<String, Object> map,
+                                            @RequestParam  Integer apiId,
+                                            @RequestParam  Integer pageNum,
+                                            @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsarrivalresults/getArrivalResultList")
+    Map<String, Object> getArrivalResultList(@RequestBody(required = false) Map<String, Object> map,
+                                         @RequestParam  Integer apiId,
+                                         @RequestParam  Integer pageNum,
+                                         @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsreceiptresults/getReceiptResultList")
+    Map<String, Object> getReceiptResultList(@RequestBody(required = false) Map<String, Object> map,
+                                         @RequestParam  Integer apiId,
+                                         @RequestParam  Integer pageNum,
+                                         @RequestParam  Integer pageSize);
+
+    @PostMapping("api/v1/tms/tmsloadresults/purchaseTrainLoad")
+    Map<String, Object> purchaseTrainLoad(Map<String, Object> map,
+                                          @RequestParam  String userId,
+                                          @RequestParam  String userName);
+
+    @PostMapping("api/v1/tms/omstransorders/changeSaleTransOrder")
+    Map<String, Object> changeSaleTransOrder(Map<String, Object> map);
+>>>>>>> deadaae9127aedbf357007f7909d98950956f7ce
 }
 
 

+ 2 - 0
src/main/java/com/steerinfo/dil/mapper/UniversalMapper.java

@@ -51,4 +51,6 @@ public interface UniversalMapper {
     List<Map<String, Object>> getColumnAllScheme(Map<String, Object> map);
 
     String getWlUrl();
+
+    int checkTrainOrder(Map<String, Object> map);
 }

+ 507 - 0
src/main/java/com/steerinfo/dil/util/ExcelToolUtils.java

@@ -0,0 +1,507 @@
+package com.steerinfo.dil.util;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDataFormat;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.tomcat.util.http.fileupload.FileItem;
+import org.apache.tomcat.util.http.fileupload.FileItemFactory;
+import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+/**
+ * @Author fubo
+ * @Description  excel导入
+ * @Date 2020/6/10 8:46
+ **/
+public class ExcelToolUtils {
+
+
+    /**
+     * MultipartFile转 FileItem 并删除本地临时文件
+     **/
+    public static FileItem MultipartFileItem(MultipartFile file) throws Exception {
+        File files = multipartFileToFile(file);
+        FileItem fielitem = createFileItem(files, files.getName());
+        delteTempFile(files);
+
+        return fielitem;
+    }
+
+    /*
+      创建FileItem
+       */
+    public static FileItem createFileItem(File file, String fieldName) {
+        FileItemFactory factory = new DiskFileItemFactory(16, null);
+        FileItem item = factory.createItem(fieldName, "text/plain", true, file.getName());
+        int bytesRead = 0;
+        byte[] buffer = new byte[8192];
+        try {
+            FileInputStream fis = new FileInputStream(file);
+            OutputStream os = item.getOutputStream();
+            while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            fis.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return item;
+    }
+
+
+    /**
+     * MultipartFile 转 File
+     *
+     * @param file
+     * @throws Exception
+     */
+    public static File multipartFileToFile(MultipartFile file) throws Exception {
+        File toFile = null;
+        if (file.equals("") || file.getSize() <= 0) {
+            file = null;
+        } else {
+            InputStream ins = null;
+            ins = file.getInputStream();
+            toFile = new File(file.getOriginalFilename());
+            inputStreamToFile(ins, toFile);
+            ins.close();
+        }
+        return toFile;
+    }
+
+    //获取流文件
+    private static void inputStreamToFile(InputStream ins, File file) {
+        try {
+            OutputStream os = new FileOutputStream(file);
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            ins.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 删除本地临时文件
+     *
+     * @param file
+     */
+    public static void delteTempFile(File file) {
+        if (file != null) {
+            File del = new File(file.toURI());
+            del.delete();
+        }
+    }
+
+    private static NumberFormat numberFormat = NumberFormat.getInstance();
+
+    static {
+        numberFormat.setGroupingUsed(false);
+    }
+
+    /**
+     * 解析文件的方法.
+     *
+     * @param inputStream 文件输入流, 要解析的Excel文件输入流
+     * @param fileName    文件名.
+     * @param startRow    从第几行开始读取数据.
+     * @return List<String [ ]> 集合中的一个元素对应一行解析的数据.
+     * 元素为字符串数组类型. 数组中的每个元素对应一列数据.
+     * @throws IOException
+     */
+    public static List<String[]> parseExcel(InputStream inputStream, String fileName, int startRow)
+            throws Exception {
+
+        // 1. 定义excel对象变量
+        Workbook workbook = null;
+
+        //获取后缀
+        String suffix = fileName.substring(fileName.lastIndexOf("."));
+
+        // 2. 判断后缀.决定使用的解析方式. 决定如何创建具体的对象
+        if (".xls".equals(suffix)) {
+            // 2003
+            workbook = new HSSFWorkbook(inputStream);
+        } else if (".xlsx".equals(suffix)) {
+            // 2007
+            workbook = new XSSFWorkbook(inputStream);
+        } else {
+            // 未知内容
+            throw new Exception("请选择xls或者xlsx文件!");
+        }
+
+        // 获取工作表  excel分为若干个表. sheet
+        Sheet sheet = workbook.getSheetAt(0);
+
+        if (sheet == null) {
+            return null;
+        }
+
+        // 获取表格中最后一行的行号
+        int lastRowNum = sheet.getLastRowNum();
+
+        // 最后一行的行号小于startRow
+        if (lastRowNum < startRow) {
+            throw new Exception("请输入数据");
+        }
+
+
+        List<String[]> result = new ArrayList<>();
+
+        // 定义行变量和单元格变量
+        Row row = null;
+        Cell cell = null;
+        // 循环读取
+        try{
+        for (int rowNum = startRow; rowNum <= lastRowNum; rowNum++) {
+            row = sheet.getRow(rowNum);
+            // 获取当前行的第一列和最后一列的标记(列数)
+            short firstCellNum = row.getFirstCellNum();//第一列从0开始
+            short lastCellNum = row.getLastCellNum();//最后一列
+            if (lastCellNum != 0) {
+                String[] rowArray = new String[lastCellNum];
+                for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
+                    cell = row.getCell(cellNum);
+                    // 判断单元格是否有数据
+                    if (cell == null) {
+                        rowArray[cellNum] = null;
+                    } else {
+                        rowArray[cellNum] = parseCell(cell);
+                    }
+                }
+                if(rowArray[0] != null || !rowArray[0].equals("")){
+                    result.add(rowArray);
+                }
+            }
+        }
+
+        } catch (Exception e){
+            throw new Exception("文件存在隐藏行或合并列!");
+        }
+        return result;
+    }
+
+    /**
+     * 解析文件的方法.
+     *
+     * @param inputStream 文件输入流, 要解析的Excel文件输入流
+     * @param fileName    文件名.
+     * @param startRow    从第几行开始读取数据.
+     * @return List<String []> 集合中的一个元素对应一行解析的数据.
+     * 元素为字符串数组类型. 数组中的每个元素对应一列数据.
+     * @throws IOException
+     */
+    public static List<List<String[]>> parseExcels(InputStream inputStream, String fileName, int startRow)
+            throws Exception {
+
+        // 1. 定义excel对象变量
+        Workbook workbook = null;
+
+        //获取后缀
+        String suffix = fileName.substring(fileName.lastIndexOf("."));
+
+        // 2. 判断后缀.决定使用的解析方式. 决定如何创建具体的对象
+        if (".xls".equals(suffix)) {
+            // 2003
+            workbook = new HSSFWorkbook(inputStream);
+        } else if (".xlsx".equals(suffix)) {
+            // 2007
+            workbook = new XSSFWorkbook(inputStream);
+        } else {
+            // 未知内容
+            throw new Exception("请选择xls或者xlsx文件!");
+        }
+        List<List<String[]>> result = new ArrayList<>();
+        for (int k = 0; k < workbook.getNumberOfSheets();k++) {
+            // 获取工作表  excel分为若干个表. sheet
+            Sheet sheet = workbook.getSheetAt(k);
+
+            if (sheet == null) {
+                return null;
+            }
+
+            // 获取表格中最后一行的行号
+            int lastRowNum = sheet.getLastRowNum();
+
+            // 最后一行的行号小于startRow
+            if (lastRowNum < startRow) {
+                throw new Exception("请输入数据");
+            }
+            List<String[]> res = new ArrayList<>();
+            // 定义行变量和单元格变量
+            Row row = null;
+            Cell cell = null;
+            // 循环读取
+            try {
+                for (int rowNum = startRow; rowNum <= lastRowNum; rowNum++) {
+                    row = sheet.getRow(rowNum);
+                    // 获取当前行的第一列和最后一列的标记(列数)
+                    short firstCellNum = row.getFirstCellNum();//第一列从0开始
+                    short lastCellNum = row.getLastCellNum();//最后一列
+                    if (lastCellNum != 0) {
+                        String[] rowArray = new String[lastCellNum];
+                        for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
+                            cell = row.getCell(cellNum);
+                            // 判断单元格是否有数据
+                            if (cell == null) {
+                                rowArray[cellNum] = null;
+                            } else {
+                                rowArray[cellNum] = parseCell(cell);
+                            }
+                        }
+                        res.add(rowArray);
+                        if (rowArray[0] != null && !"".equals(rowArray[0])) {
+                            res.add(rowArray);
+                        }
+                    }
+                }
+                result.add(res);
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new Exception("文件存在隐藏行或合并列!");
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 解析单元格
+     *
+     * @return String 单元格数据
+     */
+    private static String parseCell(Cell cell) {
+        //空返回空
+        if(cell == null){
+            return null;
+        }
+
+        String result = null;
+
+        switch (cell.getCellType()) {
+
+            case HSSFCell.CELL_TYPE_NUMERIC:// 判断单元格的值是否为数字类型
+
+                if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
+                    SimpleDateFormat sdf = null;
+                    if (cell.getCellStyle().getDataFormat() == HSSFDataFormat
+                            .getBuiltinFormat("h:mm")) {
+                        sdf = new SimpleDateFormat("HH:mm");
+                    } else {// 日期
+                        sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    }
+                    Date date = cell.getDateCellValue();
+                    result = sdf.format(date);
+                } else if (cell.getCellStyle().getDataFormat() == 58) {
+                    // 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
+					/*yyyy年m月d日----->31
+					yyyy-MM-dd-----	14
+					yyyy年m月-------	57
+					m月d日  ----------58
+					HH:mm-----------20
+					h时mm分  -------	32*/
+
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                    double value = cell.getNumericCellValue();
+                    Date date = DateUtil
+                            .getJavaDate(value);
+                    result = sdf.format(date);
+                } else {
+                    // 返回数值类型的值
+                    Object inputValue = null;// 单元格值
+                    Long longVal = Math.round(cell.getNumericCellValue());
+                    Double doubleVal = cell.getNumericCellValue();
+                    if (Double.parseDouble(longVal + ".0") == doubleVal) {   //判断是否含有小数位.0
+                        inputValue = longVal;
+                    } else {
+                        inputValue = doubleVal;
+                    }
+                    DecimalFormat df = new DecimalFormat("#.##");    //格式化为四位小数,按自己需求选择;
+                    result = String.valueOf(df.format(inputValue));      //返回String类型
+
+//                    double value = cell.getNumericCellValue();
+//                    CellStyle style = cell.getCellStyle();
+//                    DecimalFormat format = new DecimalFormat("0.00");
+//                    String temp = style.getDataFormatString();
+//                    // 单元格设置成常规
+//                    if (temp.equals("General")) {
+//                        format.applyPattern("#");
+//                    }
+//                    result = format.format(value);
+                }
+                break;
+            case HSSFCell.CELL_TYPE_STRING:// 判断单元格的值是否为String类型
+                result = cell.getRichStringCellValue().toString();
+                break;
+            case HSSFCell.CELL_TYPE_BLANK://判断单元格的值是否为布尔类型
+                result = "";
+            default:
+                result = "";
+                break;
+        }
+
+        return result;
+    }
+
+
+   
+
+  
+   
+
+
+    /**
+     * 生成随机数:当前年月日时分秒+四位随机数
+     *
+     * @return
+     */
+    public static String getRandom() {
+
+        SimpleDateFormat simpleDateFormat;
+
+        simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
+
+        Date date = new Date();
+
+        String str = simpleDateFormat.format(date);//当前年月日
+
+        Random random = new Random();
+
+        int rannum = (int) (random.nextDouble() * (9999 - 1000 + 1)) + 1000;// 获取5位随机数
+
+        return str + rannum;
+    }
+
+
+    /**
+     * 发货单页面生成的随机发货单编号-按前端设定
+     *
+     * @return
+     */
+    public static String Random() {
+
+        SimpleDateFormat simpleDateFormat;
+
+        simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
+
+        Date date = new Date();
+
+        String str = simpleDateFormat.format(date);//当前年月日
+
+        Random random = new Random();
+
+        int rannum = (int) (random.nextDouble() * (99999 - 10000 + 1)) + 10000;// 获取5位随机数
+
+        return "CX-" + str + rannum;
+    }
+
+    //截取字符串中数字-按MEs规则来(前八位位年月日,后面拼编号和英文做辨识)
+    public static String getNumberText(String str){
+        if(StringUtils.isBlank(str)){
+            throw new RuntimeException("参数str不能为空");
+        }
+        StringBuffer number = new StringBuffer("");
+
+        String[] strArray = str.split("");
+        for (String string : strArray) {
+            //if(!StringUtils.isBlank(string) && RegUtils.isNumberText(string)){
+            //    number.append(string);
+            //}
+        }
+        return number.toString()+"XG";
+    }
+
+
+    /**
+     * 获取Excel中的对象数组
+     * @param inputStream
+     * @param fileName
+     * @param startRow 默认0
+     * @return
+     * @throws Exception
+     */
+    public static List<Map<String,Object>> getExcelList(InputStream inputStream, String fileName, int startRow)
+            throws Exception {
+        //构建返回数组
+        List<Map<String,Object>> list = new ArrayList<>();
+        // 1. 创建工作簿
+        Workbook workbook = null;
+        // 2. 根据格式解析文件
+        if (fileName.endsWith(".xls")) {
+            workbook = new HSSFWorkbook(inputStream);
+        }else if(fileName.endsWith(".xlsx")){
+            workbook = new XSSFWorkbook(inputStream);
+        }else {
+            throw new Exception("请选择xls或者xlsx文件!");
+        }
+        for (int sheetIndex = 0; sheetIndex < workbook.getNumberOfSheets();sheetIndex++) {
+            // 获取工作表  excel分为若干个表. sheet
+            Sheet sheet = workbook.getSheetAt(sheetIndex);
+            if (sheet == null) {
+                break;
+            }
+            // 获取表格中最后一行的行号
+            int lastRowNum = sheet.getLastRowNum();
+            if (lastRowNum < startRow) {
+                throw new Exception("第"+sheetIndex+"个工作簿无数据!请检查Excel!");
+            }
+            // 定义行变量和单元格变量
+            Row row = null;
+            Cell cell = null;
+            //获取表头
+            Row titlesRow = sheet.getRow(startRow);
+            // 获取当前行的第一列和最后一列的标记(列数)
+            int firstCellNum = titlesRow.getFirstCellNum();//第一列
+            int lastCellNum = titlesRow.getLastCellNum();//最后一列
+            String[] titles = new String[lastCellNum];
+            if (lastCellNum > firstCellNum) {
+                for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
+                    cell = titlesRow.getCell(cellNum);
+                    // 判断单元格是否有数据
+                    if (cell == null) {
+                        titles[cellNum] = null;
+                    } else {
+                        titles[cellNum] = parseCell(cell);
+                    }
+                }
+            }else {
+                throw new Exception("第"+sheetIndex+"个工作簿无表头数据!请检查Excel!");
+            }
+            try {
+                //遍历除表头外的所有行
+                for (int rowNum = startRow+1; rowNum <= lastRowNum; rowNum++) {
+                    row = sheet.getRow(rowNum);
+                    //遍历行的所有列
+                    Map<String,Object> item = new HashMap<>();
+                    for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
+                        cell = row.getCell(cellNum);
+                        //获取表头对应数据
+                        if (titles[cellNum] != null && !titles[cellNum].equals("")) {
+                            item.put(titles[cellNum],parseCell(cell));
+                        }
+                    }
+                    list.add(item);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new Exception("文件存在隐藏行或合并列!");
+            }
+        }
+        return list;
+    }
+}

+ 172 - 0
src/main/java/com/steerinfo/dil/util/poiutil.java

@@ -0,0 +1,172 @@
+package com.steerinfo.dil.util;
+
+
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
+
+import java.util.*;
+
+
+//导入excle工具类
+
+public class poiutil {
+    private final static String xls = "xls";
+    private final static String xlsx = "xlsx";
+    private final static String DATE_FORMAT = "yyyy/MM/dd";
+
+    //参数说明:  fileName:文件名   projects:对象集合  columnNames: 列名   keys: map中的key
+    public static void start_download(HttpServletResponse response, String fileName, List<?> projects, String[] columnNames, String[] keys) throws IOException {
+
+        //将集合中对象的属性  对应到  List<Map<String,Object>>
+        List<Map<String, Object>> list = createExcelRecord(projects, keys);
+
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        try {
+            //将转换成的Workbook对象通过流形式下载
+            createWorkBook(list, keys, columnNames).write(os);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        byte[] content = os.toByteArray();
+        InputStream is = new ByteArrayInputStream(content);
+        // 设置response参数,可以打开下载页面
+        response.reset();
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setCharacterEncoding("utf-8");
+        response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), StandardCharsets.ISO_8859_1));
+        ServletOutputStream out = response.getOutputStream();
+        BufferedInputStream bis = null;
+        BufferedOutputStream bos = null;
+        try {
+            bis = new BufferedInputStream(is);
+            bos = new BufferedOutputStream(out);
+            byte[] buff = new byte[2048];
+            int bytesRead;
+            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
+                bos.write(buff, 0, bytesRead);
+            }
+        } catch (final IOException e) {
+            throw e;
+        } finally {
+            if (bis != null) bis.close();
+            if (bos != null) bos.close();
+        }
+    }
+
+    private static List<Map<String, Object>> createExcelRecord(List<?> projects, String[] keys) {
+        List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("sheetName", "sheet");
+        listmap.add(map);
+        Object project = null;
+        for (int j = 0; j < projects.size(); j++) {
+            project = projects.get(j);
+            Map<String, Object> mapValue = new HashMap<String, Object>();
+            for (int i = 0; i < keys.length; i++) {
+                mapValue.put(keys[i], getFieldValueByName(keys[i], project));
+            }
+
+            listmap.add(mapValue);
+        }
+        return listmap;
+    }
+
+    /**
+     * 利用反射  根据属性名获取属性值
+     */
+    private static Object getFieldValueByName(String fieldName, Object o) {
+        try {
+            String firstLetter = fieldName.substring(0, 1).toUpperCase();
+            String getter = "get" + firstLetter + fieldName.substring(1);
+            Method method = o.getClass().getMethod(getter);
+            Object value = method.invoke(o);
+            return value;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 创建excel文档对象
+     *
+     * @param keys        list中map的key数组集合
+     * @param columnNames excel的列名
+     */
+    private static Workbook createWorkBook(List<Map<String, Object>> list, String[] keys, String[] columnNames) {
+        // 创建excel工作簿
+        Workbook wb = new XSSFWorkbook();
+
+        // 创建第一个sheet(页),并命名
+        Sheet sheet = wb.createSheet(list.get(0).get("sheetName").toString());
+        // 手动设置列宽。第一个参数表示要为第几列设;,第二个参数表示列的宽度,n为列高的像素数。
+        for (int i = 0; i < keys.length; i++) {
+            sheet.setColumnWidth((short) i, (short) (35.7 * 150));
+        }
+
+        // 创建第一行
+        Row row = sheet.createRow((short) 0);
+
+        // 创建两种单元格格式
+        CellStyle cs = wb.createCellStyle();
+        CellStyle cs2 = wb.createCellStyle();
+
+        // 创建两种字体
+        Font f = wb.createFont();
+        Font f2 = wb.createFont();
+
+        // 创建第一种字体样式(用于列名)
+        f.setFontHeightInPoints((short) 10);
+        f.setColor(IndexedColors.BLACK.getIndex());
+        f.setBold(true);
+
+        // 创建第二种字体样式(用于值)
+        f2.setFontHeightInPoints((short) 10);
+        f2.setColor(IndexedColors.BLACK.getIndex());
+
+        // 设置第一种单元格的样式(用于列名)
+        cs.setFont(f);
+        cs.setBorderLeft(BorderStyle.THIN);
+        cs.setBorderRight(BorderStyle.THIN);
+        cs.setBorderTop(BorderStyle.THIN);
+        cs.setBorderBottom(BorderStyle.THIN);
+        cs.setAlignment(HorizontalAlignment.CENTER);
+
+        // 设置第二种单元格的样式(用于值)
+        cs2.setFont(f2);
+        cs2.setBorderLeft(BorderStyle.THIN);
+        cs2.setBorderRight(BorderStyle.THIN);
+        cs2.setBorderTop(BorderStyle.THIN);
+        cs2.setBorderBottom(BorderStyle.THIN);
+        cs2.setAlignment(HorizontalAlignment.CENTER);
+        //设置列名
+        for (int i = 0; i < columnNames.length; i++) {
+            Cell cell = row.createCell(i);
+            cell.setCellValue(columnNames[i]);
+            cell.setCellStyle(cs);
+        }
+        //设置每行每列的值
+        for (short i = 1; i < list.size(); i++) {
+            // Row 行,Cell 方格 , Row 和 Cell 都是从0开始计数的
+            // 创建一行,在页sheet上
+            Row row1 = sheet.createRow(i);
+            // 在row行上创建一个方格
+            for (short j = 0; j < keys.length; j++) {
+                Cell cell = row1.createCell(j);
+                cell.setCellValue(list.get(i).get(keys[j]) == null ? " " : list.get(i).get(keys[j]).toString());
+                cell.setCellStyle(cs2);
+            }
+        }
+        return wb;
+    }
+
+
+}

+ 1 - 1
src/main/resources/application-dev.yml

@@ -68,7 +68,7 @@ feign:
     config:
       default:  #默认配置,连接时间要短,读取时间要长
         connectTimeout: 1000 #单位毫秒
-        readTimeout: 10000 #单位毫秒
+        readTimeout: 100000 #单位毫秒
 #熔断器
 hystrix:
   command:

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -1,7 +1,7 @@
 api.version: api/v1
 spring:
   profiles:
-    include: ${SPRING_PROFILES:dev}
+    include: ${SPRING_PROFILES:prod}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8

+ 60 - 25
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -124,7 +124,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-           <if test="id!=null and id.size>0">
+           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -140,7 +140,8 @@
             MATERIAL_TYPE_NAME "materialTypeName",
         MATERIAL_TYPE_ID "id",
         MATERIAL_TYPE_ID "value",
-        MATERIAL_TYPE_NAME "label"
+        MATERIAL_TYPE_NAME "label",
+        MATERIAL_TYPE_NAME "text"
         from RMS_MATERIAL_TYPE
         where DELETED = 0
         )
@@ -148,7 +149,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-           <if test="id!=null and id.size>0">
+           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -164,7 +165,8 @@
         EMISSION_STANDARD_NAME "emissionStandardName",
         EMISSION_STANDARD_ID "id",
         EMISSION_STANDARD_ID "value",
-        EMISSION_STANDARD_NAME "label"
+        EMISSION_STANDARD_NAME "label",
+        EMISSION_STANDARD_NAME "text"
         from RMS_EMISSION_STANDARD
         where DELETED = 0
         )
@@ -172,7 +174,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-           <if test="id!=null and id.size>0">
+           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -189,7 +191,8 @@
         OPERATION_POINT_TYPE "operationPointType",
         OPERATION_POINT_ID "id",
         OPERATION_POINT_ID "value",
-        OPERATION_POINT_NAME "label"
+        OPERATION_POINT_NAME "label",
+        OPERATION_POINT_NAME "text"
         from RMS_OPERATION_POINT
         where DELETED = 0
         )
@@ -200,7 +203,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-            <if test="id!=null and id.size>0">
+            <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -217,7 +220,9 @@
         PERSONNEL_POST "personnelPost",
         PERSONNEL_ID "id",
         PERSONNEL_ID "value",
-        PERSONNEL_NAME "label"
+        PERSONNEL_NAME "label",
+        PERSONNEL_NAME "text"
+
         from RMS_PERSONNEL
         where DELETED = 0
         )
@@ -228,7 +233,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-           <if test="id!=null and id.size>0">
+           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -257,7 +262,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-            <if test="id!=null and id.size>0">
+            <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -273,7 +278,8 @@
         RC.JOB_NAME "jobName",
         RC.JOB_ID "id",
         RC.JOB_ID "value",
-        RC.JOB_NAME "label"
+        RC.JOB_NAME "label",
+        RC.JOB_NAME "text"
         from RMS_JOB_INFO RC
         where DELETED = 0
         )
@@ -281,7 +287,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-           <if test="id!=null and id.size>0">
+           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -297,7 +303,8 @@
             RC.TRANS_RANGE_NAME "transrangeName",
         RC.TRANS_RANGE_ID "id",
         RC.TRANS_RANGE_ID "value",
-        RC.TRANS_RANGE_NAME "label"
+        RC.TRANS_RANGE_NAME "label",
+        RC.TRANS_RANGE_NAME "text"
         from RMS_TRANS_RANGE RC
         where DELETED = 0
         )
@@ -305,7 +312,7 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-            <if test="id!=null and id.size>0">
+            <if test="id!=null and id.size>0 and !(index!=null and index!='')">
                 AND "id" in
                 <foreach collection="id" item="item"  open="(" close=")" separator="," >
                     #{item}
@@ -321,7 +328,8 @@
         RC.RULES_CODE "rulesCode",
         RC.RULES_ID "id",
         RC.RULES_ID "value",
-        RC.RULES_CODE "label"
+        RC.RULES_CODE "label",
+        RC.RULES_CODE "text"
         from RMS_DEMAND_RULES RC
         where DELETED = 0
         )
@@ -345,7 +353,8 @@
         RC.CAPACITY_TYPE_NAME "capacityTypeName",
         RC.CAPACITY_TYPE_ID "id",
         RC.CAPACITY_TYPE_ID "value",
-        RC.CAPACITY_TYPE_NAME "label"
+        RC.CAPACITY_TYPE_NAME "label",
+        RC.CAPACITY_TYPE_NAME "text"
         from RMS_CAPACITY_TYPE RC
         where DELETED = 0
         )
@@ -366,17 +375,32 @@
     <select id="getLineByLike" resultType="java.util.Map">
         select * from(
         select
-        RC.LINE_ID "lineId",
-        RC.LINE_NAME "lineName",
-        RC.LINE_ID "id",
-        RC.LINE_ID "value",
-        RC.LINE_NAME "label"
-        from RMS_LINE RC
+        RL.LINE_ID "lineId",
+        RL.LINE_NAME "lineName",
+        RL.LINE_ID "id",
+        RL.LINE_ID "value",
+        RL.LINE_NAME "label",
+        RL.LINE_NAME "text",
+        NVL(RL_TEMP."points",'无') "points"
+        from RMS_LINE RL
+        LEFT JOIN
+        (
+        SELECT
+        RLS .LINE_ID "lineId",
+        listagg (DISTINCT ROP .OPERATION_POINT_NAME, ',') WITHIN GROUP (ORDER BY RLS .LINE_ID) "points"
+        FROM
+        RMS_LINE_STEP RLS
+        LEFT JOIN RMS_STEP_POINT RSP
+        ON RLS .STEP_ID = RSP .STEP_ID
+        LEFT JOIN RMS_OPERATION_POINT ROP
+        ON RSP .OPERATION_POINT_ID = ROP .OPERATION_POINT_ID
+        GROUP BY RLS .LINE_ID
+        ) RL_TEMP ON RL_TEMP ."lineId" = RL .LINE_ID
         where DELETED = 0
         )
         <where>
             <if test="index!=null and index!=''">
-                AND REGEXP_LIKE("label", #{index})
+                AND REGEXP_LIKE("label" || "points", #{index})
             </if>
             <if test="id!=null and !(index!=null and index!='')">
                 AND "id" in
@@ -394,7 +418,8 @@
         RC.MATERIAL_NAME "materialName",
         RC.MATERIAL_ID "id",
         RC.MATERIAL_ID "value",
-        RC.MATERIAL_NAME "label"
+        RC.MATERIAL_NAME "label",
+        RC.MATERIAL_NAME "text"
         from RMS_MATERIAL RC
         where DELETED = 0
         )
@@ -410,7 +435,17 @@
             </if>
         </where>
         FETCH NEXT 100 ROWS ONLY
-
+    </select>
+    <select id="checkTrainOrder" resultType="java.lang.Integer">
+        SELECT COUNT(*)
+        FROM OMS_TRANS_ORDER
+        <where>
+            INSERT_TIME > SYSDATE-1
+            AND CAPACITY_ID IN
+            <foreach collection="list" item="item"  open="(" close=")" separator="," >
+                #{item.车号}
+            </foreach>
+        </where>
     </select>
 
 </mapper>