Parcourir la source

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
il y a 5 ans
Parent
commit
6725bb8810

+ 2 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldFileController.java

@@ -237,7 +237,7 @@ public class MouldFileController {
      * @return
      */
     @ApiOperation("文档勾选批量下载")
-    @RequestMapping(value = "/downloadfileList", method = RequestMethod.POST)
+    @RequestMapping(value = "/downloadfileList",method=RequestMethod.GET,produces="application/json")
     @ResponseBody
     public HttpRespMsg downloadfileList(UserVO userVO, HttpServletRequest request, HttpServletResponse response) {
         HttpRespMsg msg = new HttpRespMsg();
@@ -261,7 +261,7 @@ public class MouldFileController {
     public HttpRespMsg downloadFileListExcel(UserVO userVO, HttpServletResponse response) {
         HttpRespMsg msg = new HttpRespMsg();
         try {
-            msg = mouldFileService.downloadFileListExcel(userVO, response,downloadPath);
+            msg = mouldFileService.downloadFileListExcel(userVO, response,path);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/MouldOperationDynamicsMapper.java

@@ -19,7 +19,7 @@ import java.util.List;
  */
 public interface MouldOperationDynamicsMapper extends BaseMapper<MouldOperationDynamics> {
 
-    List<MouldOperationDynamics> selectOperationDynamicsList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("userVO") UserVO userVO);
+    List<MouldOperationDynamics> selectOperationDynamicsList(@Param("userVO") UserVO userVO);
 
     List<MouldOperationDynamicsVO> getlist(@Param("list") List<Integer> list, @Param("mouldOperationDynamics")MouldOperationDynamics mouldOperationDynamics);
 

+ 11 - 13
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -672,14 +672,14 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
 //        Date startDate = df1.parse(date1.toString());
         Date endDate2 = calendar.getTime();
 //        Date endDate = df1.parse(date2.toString());
-        SimpleDateFormat dateSdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        SimpleDateFormat dateSdf = new SimpleDateFormat("yyyy-MM-dd");
+//        SimpleDateFormat dateSdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        SimpleDateFormat dateSdf = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat dateSdf2 = new SimpleDateFormat("yyyy年MM月dd+HH时mm分ss秒");
-        String startDate = dateSdf.format(startDate1);
-        String endDate = dateSdf.format(endDate2);
+//        String startDate = dateSdf.format(startDate1);
+//        String endDate = dateSdf.format(endDate2);
         List<MouldOperationDynamics> mouldOperationDynamics = new ArrayList<>();
         if (userVO.getStartTime() != null && userVO.getEndTime() != null) {
-            mouldOperationDynamics = mouldOperationDynamicsMapper.selectOperationDynamicsList(startDate, endDate, userVO);
+            mouldOperationDynamics = mouldOperationDynamicsMapper.selectOperationDynamicsList(userVO);
         }
         for (MouldOperationDynamics dynamic : mouldOperationDynamics) {
             List<String> rowList = new ArrayList<String>();
@@ -702,13 +702,13 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                 rowList.add("模具报废");
             }
             //下载时间
-
             rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(dynamic.getIndate())
             );
             list.add(rowList);
         }
         Mould mould = mouldMapper.selectById(userVO.getMouldId());
-        msg.data = ExcelUtil.exportGeneralExcelByTitleAndList(response, mould.getModelNo() + mould.getModelName() + dateSdf2.format(new Date()), list, downloadPath);
+        String fileUrl = ExcelUtil.exportGeneralExcelByTitleAndList(response, mould.getModelNo() + mould.getModelName() + dateSdf2.format(new Date()), list, downloadPath);
+        msg.data = fileUrl;
         return msg;
     }
 
@@ -734,15 +734,14 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         return msg;
     }
 
-    public void download(HttpServletRequest request, HttpServletResponse response, String downloadPath, Mould vo, List<MouldFile> mouldFiles, String oldFilePath){
+    public String download(HttpServletRequest request, HttpServletResponse response, String downloadPath, Mould vo, List<MouldFile> mouldFiles, String oldFilePath){
         //响应头的设置
-        response.reset();
+//        response.reset();
         response.setCharacterEncoding("utf-8");
         response.setContentType("multipart/form-data");
-
         //设置压缩包的名字
         //解决不同浏览器压缩包名字含有中文时乱码的问题
-        String downloadName = vo.getModelNo() + vo.getModelName()+".zip";
+        String downloadName = vo.getModelNo() +".zip";
         String agent = request.getHeader("USER-AGENT");
         try {
             if (agent.contains("MSIE")||agent.contains("Trident")) {
@@ -754,7 +753,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
             e.printStackTrace();
         }
         response.setHeader("Content-Disposition", "attachment;fileName=\"" + downloadName + "\"");
-
         //设置压缩流:直接写入response,实现边压缩边下载
         ZipOutputStream zipos = null;
         try {
@@ -795,7 +793,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         } catch (IOException e) {
             e.printStackTrace();
         }
-
+        return null;
     }
 
     public Map<String, Object> feedBackDirectMultiDownload(HttpServletRequest request, HttpServletResponse response, String downloadPath, Mould vo, List<MouldFile> mouldFiles, String oldFilePath) throws IOException {

+ 3 - 3
cloud-model/src/main/java/com/hssx/cloudmodel/util/ExcelUtil.java

@@ -131,14 +131,14 @@ public class ExcelUtil {
                     start++;
                 }
             }
-//            OutputStream os = response.getOutputStream();//在线下载
+            OutputStream os = response.getOutputStream();//在线下载
             File dir = null;
             dir = new File(downloadPath);
             // D://cloud/upload 文件上传后所存储的位置,部署到服务器上时配置服务器地址即可
             if (!dir.exists()) {
                 dir.mkdirs();
             }
-            FileOutputStream os = new FileOutputStream(downloadPath+fileName);//保存到本地
+//            FileOutputStream os = new FileOutputStream(downloadPath+fileName);//保存到本地
             workBook.write(os);
             os.flush();
             os.close();
@@ -146,6 +146,6 @@ public class ExcelUtil {
             System.out.println(result);
             e.printStackTrace();
         }
-        return downloadPath+fileName;
+        return "/upload/"+fileName;
     }
 }

+ 3 - 2
cloud-model/src/main/resources/application-prod.properties

@@ -37,8 +37,6 @@ spring.thymeleaf.prefix=classpath:/static/
 # 文件上传路径
 upload.path=E:/staticproject/cloudmodel/upload/
 ######################################################################################################
-# 文件下载路径
-download.path=E:/staticproject/cloudmodel/download/
 # 邀请人员链接前缀
 invitation.url.prefix=http://118.190.47.230:9098/#/invite/
 #######################################################################################################
@@ -51,4 +49,7 @@ spring.datasource.hikari.minimum-idle=3
 spring.datasource.hikari.maximum-pool-size=10
 spring.datasource.hikari.max-lifetime =30000
 spring.datasource.hikari.connection-test-query=SELECT 1
+########################################################################################################
+# 日志
+logging.path=E:/staticproject/cloudmodel/
 

+ 2 - 0
cloud-model/src/main/resources/application-prod.yml

@@ -27,4 +27,6 @@ mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true
     cache-enabled: false
+########################
+
 

+ 1 - 0
cloud-model/src/main/resources/application.properties

@@ -51,4 +51,5 @@ spring.datasource.hikari.minimum-idle=3
 spring.datasource.hikari.maximum-pool-size=10
 spring.datasource.hikari.max-lifetime =30000
 spring.datasource.hikari.connection-test-query=SELECT 1
+logging.path=E:/
 

+ 2 - 2
cloud-model/src/main/resources/mapper/MouldOperationDynamicsMapper.xml

@@ -46,8 +46,8 @@
         <where>
             mould_id = #{userVO.mouldId}
             and content = '下载'
-            <if test="startDate != null and endDate != null">
-                and indate between DATE_FORMAT(#{startDate},'%Y-%m-%d') and DATE_FORMAT(#{endDate},'%Y-%m-%d')
+            <if test="startTime != null and endTime != null">
+                and DATE_FORMAT(indate,'%Y-%m-%d') between #{startTime} and #{endTime}
             </if>
         </where>
     </select>