袁少华 4 лет назад
Родитель
Сommit
2d62176ebd

+ 5 - 2
src/main/java/org/jeecg/modules/appInterface/FileList.java

@@ -24,11 +24,14 @@ public class FileList {
      * @param path 文件夹的路径
      * @return
      */
-    public static void getAllFileName(String path,ArrayList<String> fileNameList) {
+    public static String getAllFileName(String path,ArrayList<String> fileNameList) {
         //ArrayList<String> files = new ArrayList<String>();
         boolean flag = false;
         File file = new File(path);
         File[] tempList = file.listFiles();
+        if(tempList == null || tempList.length < 1){
+            return "false";
+        }
 
         for (int i = 0; i < tempList.length; i++) {
             if (tempList[i].isFile()) {
@@ -43,7 +46,7 @@ public class FileList {
         }
 
 //        System.out.println(fileNameList);
-        return;
+        return "true";
     }
 
 

+ 50 - 5
src/main/java/org/jeecg/modules/appInterface/controller/FbsWorkingStatisticsController.java

@@ -70,7 +70,7 @@ public class FbsWorkingStatisticsController {
 	 @Value("${jeecg.path.upvedio}")
 	 private String upVedio;
 
-	 public static void main(String[] srg) {
+	 public static void main1(String[] srg) {
 		 String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
 		 //加载JDBC驱动
 		 String dbURL = "jdbc:sqlserver://47.103.119.148;DatabaseName=UFDATA_100_2019";
@@ -594,10 +594,16 @@ public class FbsWorkingStatisticsController {
 	}
 
 	 @RequestMapping(value = "getEsopFileList")
-	 public Result<List<Map<String,Object>>> getEsopFileList(){
+	 public Result<List<Map<String,Object>>> getEsopFileList(String code){
 		 Result<List<Map<String,Object>>> result=new Result<>();
 	 	 ArrayList<String> list = new ArrayList<>();
-		 FileList.getAllFileName(upLoadPath,list);
+		 String par = FileList.getAllFileName(upLoadPath+code,list);
+
+		 if(par.equals("false")){
+			 result.error500("文件为空");
+			 return result;
+		 }
+
 		 List<Map<String,Object>> resuleMap = new ArrayList<>();
 		 try {
 
@@ -625,13 +631,22 @@ public class FbsWorkingStatisticsController {
 		 FileList.getAllFileName(upVedio,list);
 		 List<Map<String,Object>> resuleMap = new ArrayList<>();
 		 try {
-
+			 Collections.sort(list); // 升序排列
 			 for (String o:list){
 				 Map<String,Object> map = new HashMap<>();
 				 map.put("fileName",o);
 				 map.put("fileType",getFileOf(o).toLowerCase());
+				 String fileType = getFileOf(o).toLowerCase();
+				 if(fileType.equals("jpg") || fileType.equals("jpeg") || fileType.equals("png")){
+					 map.put("isImg",true);
+				 }else if(fileType.equals("avi") || fileType.equals("mov") || fileType.equals("rmvb") || fileType.equals("rm")
+						 || fileType.equals("flv") || fileType.equals("mp4") || fileType.equals("3gp")){
+					 map.put("isImg",false);
+				 }else{
+					continue;
+				 }
 				 resuleMap.add(map);
-				 break;
+//				 break;
 			 }
 			 result.setResult(resuleMap);
 			 result.success("操作成功");
@@ -692,4 +707,34 @@ public class FbsWorkingStatisticsController {
 		 return result;
 	 }
 
+
+	 public static void main(String[] args) {
+		 /*Map<String, String> map = new TreeMap<String, String>();
+		 map.put("d", "44");
+		 map.put("b", "2");
+		 map.put("a", "3");
+		 map.put("c", "4");
+
+		 //这里将map.entrySet()转换成list
+		 List<Map.Entry<String,String>> list = new ArrayList<Map.Entry<String,String>>(map.entrySet());
+		 //然后通过比较器来实现排序
+		 Collections.sort(list,new Comparator<Map.Entry<String,String>>() {
+			 //升序排序
+			 public int compare(Map.Entry<String, String> o1,
+								Map.Entry<String, String> o2) {
+				 return o1.getValue().compareTo(o2.getValue());
+			 }
+
+		 });
+
+		 for(Map.Entry<String,String> mapping:list){
+			 System.out.println(mapping.getKey()+":"+mapping.getValue());
+		 }*/
+
+//		 List<Integer> list = Arrays.asList(10,1,6,4,8,7,9,3,2,5);
+//		 Collections.sort(list); // 升序排列
+//		 list.forEach(n ->{System.out.print(n+", ");});
+
+	 }
+
  }

+ 1 - 1
src/main/java/org/jeecg/modules/fbsMomOrder/mapper/xml/FbsMomOrderMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="org.jeecg.modules.fbsMomOrder.mapper.FbsMomOrderMapper">
     <select id="getEsopTaskList" resultType="java.util.HashMap">
 
-        SELECT top 9 b.MoCode orderSheetCode,a.InvCode materialCode,c.cInvName materialName,QualifiedInQty ,Qty qty,
+        SELECT  b.MoCode orderSheetCode,a.InvCode materialCode,c.cInvName materialName,QualifiedInQty ,Qty qty,
          c.cInvStd specs from mom_orderdetail a
         left join mom_order b on a.MoId = b.MoId
         left join Inventory c on a.InvCode = c.cInvCode

+ 107 - 0
src/main/java/org/jeecg/modules/fbsViewAll/controller/FbsViewAllController.java

@@ -0,0 +1,107 @@
+package org.jeecg.modules.fbsViewAll.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.fbsViewAll.entity.FbsViewAll;
+import org.jeecg.modules.fbsViewAll.service.IFbsViewAllService;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+
+ /**
+ * @Title: Controller
+ * @Description: 页面数据
+ * @author: jeecg-boot
+ * @date:   2020-10-31
+ * @version: V1.0
+ */
+@RestController
+@RequestMapping("/fbsViewAll/fbsViewAll")
+@Slf4j
+public class FbsViewAllController {
+	@Autowired
+	private IFbsViewAllService fbsViewAllService;
+	
+	/**
+	 */
+	@GetMapping(value = "/list")
+	public Result<FbsViewAll> queryPageList() {
+		Result<FbsViewAll> result = new Result<FbsViewAll>();
+		QueryWrapper<FbsViewAll> fbsViewAll = new QueryWrapper<>();
+		List<FbsViewAll> list = fbsViewAllService.list(fbsViewAll);
+		if(list.size() < 1){
+			result.setSuccess(true);
+			result.setResult(null);
+			return result;
+		}
+		result.setSuccess(true);
+		result.setResult(list.get(0));
+		return result;
+	}
+	
+	/**
+	  *   添加
+	 * @return
+	 */
+	@RequestMapping(value = "/add")
+	public Result<FbsViewAll> add(@RequestBody Map<String,Object> map) {
+		Result<FbsViewAll> result = new Result<FbsViewAll>();
+		try {
+			fbsViewAllService.delAll();
+			FbsViewAll fbsViewAll = new FbsViewAll();
+			fbsViewAll.setAllFile(map.get("account").toString());
+			fbsViewAllService.save(fbsViewAll);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			e.printStackTrace();
+			log.info(e.getMessage());
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @return
+	 */
+	@RequestMapping(value = "/delete")
+	public Result<FbsViewAll> delete() {
+		Result result = new Result();
+		fbsViewAllService.delAll();
+		result.success("删除成功!");
+		return result;
+	}
+
+	 public static void main(String[] args) {
+		 String str = StringEscapeUtils.unescapeJava("&lt;p&gt;【产品名称】艾酷维多种维生素锌软糖&lt;/p&gt;");
+		 System.out.println(str);
+		 String str2 = StringEscapeUtils.escapeHtml("<p>【产品名称】艾酷维多种维生素锌软糖</p>");
+		 System.out.println(str2);
+	 }
+}

+ 27 - 0
src/main/java/org/jeecg/modules/fbsViewAll/entity/FbsViewAll.java

@@ -0,0 +1,27 @@
+package org.jeecg.modules.fbsViewAll.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 页面数据
+ * @author: jeecg-boot
+ * @date:   2020-10-31
+ * @version: V1.0
+ */
+@Data
+@TableName("fbs_view_all")
+public class FbsViewAll implements Serializable {
+    private static final long serialVersionUID = 1L;
+    
+	/**allFile*/
+	@Excel(name = "allFile", width = 15)
+	private Object allFile;
+}

+ 18 - 0
src/main/java/org/jeecg/modules/fbsViewAll/mapper/FbsViewAllMapper.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.fbsViewAll.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.fbsViewAll.entity.FbsViewAll;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 页面数据
+ * @author: jeecg-boot
+ * @date:   2020-10-31
+ * @version: V1.0
+ */
+public interface FbsViewAllMapper extends BaseMapper<FbsViewAll> {
+    void delAll();
+    int insertAll(Object allFile);
+}

+ 14 - 0
src/main/java/org/jeecg/modules/fbsViewAll/mapper/xml/FbsViewAllMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.fbsViewAll.mapper.FbsViewAllMapper">
+
+    <select id="delAll">
+        DELETE from fbs_view_all
+    </select>
+
+    <insert id="insertAll">
+
+        INSERT into fbs_view_all( all_file ) VALUES (#{allFile})
+
+    </insert>
+</mapper>

+ 17 - 0
src/main/java/org/jeecg/modules/fbsViewAll/service/IFbsViewAllService.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.fbsViewAll.service;
+
+import org.jeecg.modules.fbsViewAll.entity.FbsViewAll;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 页面数据
+ * @author: jeecg-boot
+ * @date:   2020-10-31
+ * @version: V1.0
+ */
+public interface IFbsViewAllService extends IService<FbsViewAll> {
+
+    public void delAll();
+
+    public int insertAll(Object allFile);
+}

+ 31 - 0
src/main/java/org/jeecg/modules/fbsViewAll/service/impl/FbsViewAllServiceImpl.java

@@ -0,0 +1,31 @@
+package org.jeecg.modules.fbsViewAll.service.impl;
+
+import org.jeecg.modules.fbsViewAll.entity.FbsViewAll;
+import org.jeecg.modules.fbsViewAll.mapper.FbsViewAllMapper;
+import org.jeecg.modules.fbsViewAll.service.IFbsViewAllService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import javax.annotation.Resource;
+
+/**
+ * @Description: 页面数据
+ * @author: jeecg-boot
+ * @date:   2020-10-31
+ * @version: V1.0
+ */
+@Service
+public class FbsViewAllServiceImpl extends ServiceImpl<FbsViewAllMapper, FbsViewAll> implements IFbsViewAllService {
+
+    @Resource
+    private FbsViewAllMapper fbsViewAllMapper;
+
+    public void delAll(){
+        fbsViewAllMapper.delAll();
+    }
+
+    public int insertAll(Object allFile){
+        return fbsViewAllMapper.insertAll(allFile);
+    }
+}