Parcourir la source

Merge branch 'feature-wcz' of lift-manager/lift-server into develop

wucizhong il y a 5 ans
Parent
commit
151b3c84d1

+ 12 - 10
lift-business-service/src/main/java/cn/com/ty/lift/business/annualinspection/controller/AnnualInspectionController.java

@@ -157,7 +157,7 @@ public class AnnualInspectionController {
             return RestResponse.fail(ValuePool.INSPECTION_EXIST_SAME + message);
         }
 
-        AnnualInspection previousConfirm = annualInspectionService.findPreviousConfirm(entity.getLiftId(), entity.getMtCompanyId());
+        AnnualInspection previousConfirm = annualInspectionService.previousConfirm(entity.getLiftId(), entity.getMtCompanyId());
         if(Objects.nonNull(previousConfirm) && Objects.nonNull(previousConfirm.getPlanDate())){
             LocalDate deadline = previousConfirm.getPlanDate().plusDays(DateUtils.daysOfYear());
             Validate.notTrue(deadline.isBefore(entity.getPlanDate()), ValuePool.inspectionSetPlanDateIllegal(previousConfirm.getPlanDate(), deadline));
@@ -467,13 +467,15 @@ public class AnnualInspectionController {
         Validate.notNull(inspections, ValuePool.INSPECTION_NOT_EXIST);
 
         //压缩文件夹
-        File zipFile;
+        File zipFile = null;
+        File baseDir = null;
         try {
             //获取根目录
             String generateCode = DateUtils.generateCode();
             String dir = StrUtil.join(File.separator, ValuePool.SYSTEM_USER_DIR, "inspection", generateCode);
             String zip = dir + ".zip";
             zipFile = new File(zip);
+            baseDir = new File(dir);
             log.info("dir: {}", dir);
             log.info("zip: {}", zip);
 
@@ -515,10 +517,10 @@ public class AnnualInspectionController {
             log.info("生成zipfile: {}", zip);
             ZipUtil.zip(dir, zip);
         } catch (Exception e) {
-//            FileUtil.del(zipFile);
-//            FileUtil.del(baseDir);
-            log.error("生成文件失败", e);
-            throw Validate.validateException("生成文件失败");
+            FileUtil.del(zipFile);
+            FileUtil.del(baseDir);
+            log.error("生成年检文件失败", e);
+            throw Validate.validateException("生成年检文件失败");
         }
         //下载压缩文件
         if (FileUtil.exist(zipFile)) {
@@ -535,12 +537,12 @@ public class AnnualInspectionController {
                     os.write(buffer, 0, i);
                 }
             } catch (Exception e) {
-                log.error("下载文件失败", e);
-                throw Validate.validateException("下载文件失败");
+                log.error("下载年检文件失败", e);
+                throw Validate.validateException("下载年检文件失败");
             }finally {
                 //删除临时根目录和zip文件
-//                FileUtil.del(zipFile);
-//                FileUtil.del(baseDir);
+                FileUtil.del(zipFile);
+                FileUtil.del(baseDir);
             }
         }
     }

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/annualinspection/service/AnnualInspectionService.java

@@ -117,7 +117,7 @@ public class AnnualInspectionService extends ServiceImpl<AnnualInspectionMapper,
      * @param mtCompanyId 维保公司
      * @return AnnualInspection
      */
-    public AnnualInspection findPreviousConfirm(Long liftId, Long mtCompanyId){
+    public AnnualInspection previousConfirm(Long liftId, Long mtCompanyId){
         LambdaQueryWrapper<AnnualInspection> lambdaQueryWrapper = Wrappers.lambdaQuery();
         lambdaQueryWrapper.eq(AnnualInspection::getLiftId, liftId);
         lambdaQueryWrapper.eq(AnnualInspection::getMtCompanyId, mtCompanyId);

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonController.java

@@ -95,7 +95,7 @@ public class CommonController {
         }
         //2 批量上传
         try {
-            List<String> urls = new ArrayList<>();
+            List<String> urls = new LinkedList<>();
             for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
                 String url = systemConfiguration.build().putObject(entry.getKey(), entry.getValue().getBytes());
                 log.info("upload file complete, file URL: {}", url);

+ 9 - 12
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java

@@ -852,10 +852,7 @@ public class EmergencyRepairController {
         try {
             //获取根目录
             String root = ValuePool.SYSTEM_USER_DIR + File.separator + "repair";
-            String missing = root + File.separator + "missing.jpg";
-
-//            String templates = ResourceUtils.getURL("classpath:templates").getPath();
-//            String missing = templates + File.separator + "missing.jpg";
+            String missing = WordUtil.imageToBase64Str(root + File.separator + "missing.jpg");
             String generateCode = DateUtils.generateCode();
             String dir = root + File.separator + generateCode;
             String zip = dir + ".zip";
@@ -913,7 +910,7 @@ public class EmergencyRepairController {
                     HttpUtil.downloadFile(mainSign, filename);
                     repair.setMainSign(WordUtil.imageToBase64Str(filename));
                 } else {
-                    repair.setMainSign(WordUtil.imageToBase64Str(missing));
+                    repair.setMainSign(missing);
                 }
                 //处理客户签名图片
                 String imgUrl = repair.getImgUrl();
@@ -923,7 +920,7 @@ public class EmergencyRepairController {
                     HttpUtil.downloadFile(imgUrl, filename);
                     repair.setImgUrl(WordUtil.imageToBase64Str(filename));
                 } else {
-                    repair.setImgUrl(WordUtil.imageToBase64Str(missing));
+                    repair.setImgUrl(missing);
                 }
                 //设置急修单参数
                 Map<String, Object> dataMap = new HashMap<>();
@@ -941,8 +938,8 @@ public class EmergencyRepairController {
         } catch (Exception e) {
             FileUtil.del(zipFile);
             FileUtil.del(baseDir);
-            log.error("生成文件失败", e);
-            throw Validate.validateException("生成文件失败");
+            log.error("生成急修文件失败", e);
+            throw Validate.validateException("生成急修文件失败");
         }
         //下载压缩文件
         if (FileUtil.exist(zipFile)) {
@@ -959,12 +956,12 @@ public class EmergencyRepairController {
                     os.write(buffer, 0, i);
                 }
             } catch (Exception e) {
-                log.error("下载文件失败", e);
-                throw Validate.validateException("下载文件失败");
+                log.error("下载急修文件失败", e);
+                throw Validate.validateException("下载急修文件失败");
             } finally {
                 //删除临时根目录和zip文件
-//                FileUtil.del(zipFile);
-//                FileUtil.del(baseDir);
+                FileUtil.del(zipFile);
+                FileUtil.del(baseDir);
             }
         }
     }

+ 66 - 6
lift-business-service/src/main/resources/templates/repair.doc.ftl

@@ -2227,7 +2227,7 @@
 											<w:snapToGrid w:val="off"/>
 											<w:ind w:first-line-chars="0" w:first-line="0"/>
 											<w:rPr>
-												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑"/>
 												<wx:font wx:val="微软雅黑"/>
 												<w:color w:val="414141"/>
 												<w:sz w:val="20"/>
@@ -2242,17 +2242,37 @@
 												<w:sz w:val="20"/>
 												<w:sz-cs w:val="20"/>
 											</w:rPr>
-											<w:t>更换配件:</w:t>
+											<w:t>应收总金额</w:t>
+										</w:r>
+										<w:r wsp:rsidR="00ED4754">
+											<w:rPr>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<wx:font wx:val="微软雅黑"/>
+												<w:color w:val="414141"/>
+												<w:sz w:val="20"/>
+												<w:sz-cs w:val="20"/>
+											</w:rPr>
+											<w:t>:</w:t>
+										</w:r>
+										<w:r>
+											<w:rPr>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<wx:font wx:val="微软雅黑"/>
+												<w:color w:val="414141"/>
+												<w:sz w:val="20"/>
+												<w:sz-cs w:val="20"/>
+											</w:rPr>
+											<w:t>¥${repair.costTotal?string("0.##")}</w:t>
 										</w:r>
 									</w:p>
 									<w:p wsp:rsidR="00ED4754" wsp:rsidRDefault="00ED4754" wsp:rsidP="00ED4754">
-										<w:pPr>
+<w:pPr>
 											<w:pStyle w:val="2"/>
 											<w:adjustRightInd w:val="off"/>
 											<w:snapToGrid w:val="off"/>
 											<w:ind w:first-line-chars="0" w:first-line="0"/>
 											<w:rPr>
-												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑"/>
 												<wx:font wx:val="微软雅黑"/>
 												<w:color w:val="414141"/>
 												<w:sz w:val="20"/>
@@ -2267,7 +2287,27 @@
 												<w:sz w:val="20"/>
 												<w:sz-cs w:val="20"/>
 											</w:rPr>
-											<w:t>配 件 费:</w:t>
+											<w:t>已收总金额</w:t>
+										</w:r>
+										<w:r wsp:rsidR="00ED4754">
+											<w:rPr>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<wx:font wx:val="微软雅黑"/>
+												<w:color w:val="414141"/>
+												<w:sz w:val="20"/>
+												<w:sz-cs w:val="20"/>
+											</w:rPr>
+											<w:t>:</w:t>
+										</w:r>
+										<w:r>
+											<w:rPr>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<wx:font wx:val="微软雅黑"/>
+												<w:color w:val="414141"/>
+												<w:sz w:val="20"/>
+												<w:sz-cs w:val="20"/>
+											</w:rPr>
+											<w:t>¥${repair.payTotal?string("0.##")}</w:t>
 										</w:r>
 									</w:p>
 									<w:p wsp:rsidR="00ED4754" wsp:rsidRPr="006D03BA" wsp:rsidRDefault="00ED4754" wsp:rsidP="00ED4754">
@@ -2292,7 +2332,27 @@
 												<w:sz w:val="20"/>
 												<w:sz-cs w:val="20"/>
 											</w:rPr>
-											<w:t>工 时 费:</w:t>
+											<w:t>开票总金额</w:t>
+										</w:r>
+										<w:r wsp:rsidR="00ED4754">
+											<w:rPr>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<wx:font wx:val="微软雅黑"/>
+												<w:color w:val="414141"/>
+												<w:sz w:val="20"/>
+												<w:sz-cs w:val="20"/>
+											</w:rPr>
+											<w:t>:</w:t>
+										</w:r>
+										<w:r>
+											<w:rPr>
+												<w:rFonts w:ascii="微软雅黑" w:fareast="微软雅黑" w:h-ansi="微软雅黑" w:hint="fareast"/>
+												<wx:font wx:val="微软雅黑"/>
+												<w:color w:val="414141"/>
+												<w:sz w:val="20"/>
+												<w:sz-cs w:val="20"/>
+											</w:rPr>
+											<w:t>¥${repair.invoiceTotal?string("0.##")}</w:t>
 										</w:r>
 									</w:p>
 								</w:txbxContent>

+ 1 - 0
lift-business-service/src/main/resources/templates/重要!!目录说明.txt

@@ -0,0 +1 @@
+本目录为急修单导出临时目录,missing.jpg和repair.doc.ftl是模版文件,不要删除!!!

+ 1 - 1
lift-upload/src/main/java/com/upload/controller/UploadController.java

@@ -47,7 +47,7 @@ public class UploadController {
         }
         //2 批量上传
         try {
-            List<String> urls = new ArrayList<>();
+            List<String> urls = new LinkedList<>();
             for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
                 String url = systemConfiguration.build().putObject(entry.getKey(), entry.getValue().getBytes());
                 log.info("upload file complete, file URL: {}", url);