Selaa lähdekoodia

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

yourName 1 vuosi sitten
vanhempi
commit
b1136e5fe6

+ 44 - 0
src/main/java/com/steerinfo/dil/controller/TMSController.java

@@ -9,17 +9,21 @@ 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.dil.util.Util;
 import com.steerinfo.framework.controller.RESTfulResult;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import oracle.jdbc.proxy.annotation.Post;
+import org.apache.commons.io.FilenameUtils;
 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.io.FileOutputStream;
+import java.io.OutputStreamWriter;
 import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.ParseException;
@@ -951,6 +955,46 @@ public class TMSController extends BaseRESTfulController {
         return tmsFeign.delPleaseApprove(map);
     }
 
+    @PostMapping("/gatepostTransitManager")
+    public Map<String,Object> gatepostTransitManager(@RequestBody Map<String,Object> map) {
+        return tmsFeign.gatepostTransitManager(map);
+    }
+
+
+    @ApiOperation("导入宏瑞综合实绩")
+    @PostMapping("/importComprehensiveResult")
+    public Map<String, Object> importComprehensiveResult(@RequestBody MultipartFile file,
+                                                 String userId,
+                                                 String userName,
+                                                 String resultType) throws Exception {
+        Map<String, Object> map = new HashMap<>();
+        if (file.isEmpty()) {
+            return new HashMap<>();
+        }
+        // 获取源文件名称
+        String originalFilename = file.getOriginalFilename();
+        // 获取源文件后缀名
+        String extension = "." + FilenameUtils.getExtension(originalFilename);
+        // 定义新路径
+        String newPath = "/data/file/result/";
+        String newName = userName + "-" + originalFilename+ Util.RandomCreate(8) + ".xlsx";
+        File dataFile = new File(newPath);
+        if (!dataFile.exists()) {
+            dataFile.mkdirs();
+        }
+        FileOutputStream fileOutputStream = new FileOutputStream(newPath + newName);
+        fileOutputStream.write(file.getBytes());
+        fileOutputStream.flush();
+        fileOutputStream.close();
+        //获取Excel中包含的对象数组
+        List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
+        map.put("list", list);
+        map.put("userId", userId);
+        map.put("userName", userName);
+        map.put("resultType", resultType);
+        map.put("filePath",newPath + newName);
+        return tmsFeign.importComprehensiveResult(map);
+    }
     @ApiOperation(value = "火运大宗销售订单 删除销售运输订单")
     @PostMapping("/changeTransOrderH")
     public Map<String,Object> changeTransOrderH(@RequestBody Map<String,Object> map) {

+ 9 - 6
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -389,16 +389,19 @@ public class UniversalController extends BaseRESTfulController {
         }
         byte[] stream1 = exportExcelFile(columnMaps, listMap);
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Random random = new Random();
-        String path = "/data/file/"+  map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-"
-                + map.get("exclename").toString()+ Util.RandomCreate(8) + ".xlsx";
-        FileOutputStream outputStream1 = new FileOutputStream(new File(path));
+        String path = "/data/file/exportExcel/" + simpleDateFormat.format(new Date()) + "/";
+        File datFile = new File(path);
+        if(!datFile.exists()) {
+            datFile.mkdirs();
+        }
+        String name = map.get("userName") + "-" + map.get("exclename").toString()+ Util.RandomCreate(8) + ".xlsx";
+        FileOutputStream outputStream1 = new FileOutputStream(new File(path + name));
         outputStream1.write(stream1);
         outputStream1.flush();
         outputStream1.close();
         Map<String, Object> response = new HashMap<>();
-        response.put("fileName",map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-" + map.get("exclename").toString() + ".xlsx");
-        response.put("filePath",path);
+        response.put("fileName",name);
+        response.put("filePath",path + name);
         return success(response);
     }
     @ApiModelProperty(value = "边输边查公司单位审批流程使用")

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

@@ -333,11 +333,18 @@ public interface TmsFeign {
     @PostMapping(value = "api/v1/tms/tmspleaseapproves/delPleaseApprove")
     Map<String, Object> delPleaseApprove(Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/tms/tmstransitorders/gatepostTransitManager")
+    Map<String, Object> gatepostTransitManager(Map<String, Object> map);
+
+    @PostMapping(value = "api/v1/tms/tmscomprehensiveresults/importComprehensiveResult")
+    Map<String, Object> importComprehensiveResult(Map<String, Object> map);
+
     @PostMapping(value = "api/v1/tms/omstransorders/changeTransOrderH")
     Map<String, Object> changeTransOrderH(Map<String, Object> map);
 
     @PostMapping(value = "api/v1/tms/omstransorders/updateCarNo")
     Map<String, Object> updateCarNo(Map<String, Object> map);
+
 }
 
 

+ 6 - 0
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -332,6 +332,12 @@
             <if test="sourceFlag != null and sourceFlag !=''">
                 AND ALTERNATE_FIELDS1 = #{sourceFlag}
             </if>
+            <if test="gatepostCodeList != null and gatepostCodeList !='' and gatepostCodeList.size > 0">
+                AND OPERATION_POINT_CODE IN
+            <foreach collection="gatepostCodeList" open="(" close=")" separator="," item="item" index="index">
+                #{item}
+            </foreach>
+            </if>
         </where>
         order by alternate_fields3,LENGTH(OPERATION_POINT_NAME)
         FETCH NEXT 50 ROWS ONLY