Переглянути джерело

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java
sangwenwei 1 рік тому
батько
коміт
c7ef531a33
100 змінених файлів з 30725 додано та 2594 видалено
  1. 90 0
      src/main/java/com/jeeplus/common/bos/BosController.java
  2. 42 0
      src/main/java/com/jeeplus/common/utils/FtlUtils.java
  3. 466 383
      src/main/java/com/jeeplus/common/utils/excel/ImportExcelNew.java
  4. 34 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceAlterDao.java
  5. 147 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceDao.java
  6. 51 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceDetailDao.java
  7. 18 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceReceiptDao.java
  8. 32 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceReturnDao.java
  9. 781 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoice.java
  10. 430 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceAlter.java
  11. 552 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceDetail.java
  12. 110 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceProjectRelation.java
  13. 48 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceReceipt.java
  14. 240 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceReturn.java
  15. 249 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceReturnAlter.java
  16. 801 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceAlterService.java
  17. 766 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceDetailService.java
  18. 794 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceReturnService.java
  19. 3578 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceService.java
  20. 1487 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/web/FilialeWorkInvoiceController.java
  21. 459 0
      src/main/java/com/jeeplus/modules/filialeWorkInvoice/web/FilialeWorkInvoiceReturnController.java
  22. 4 4
      src/main/java/com/jeeplus/modules/projectAccessory/service/ProjectTemplateService.java
  23. 7 0
      src/main/java/com/jeeplus/modules/projectcontentinfo/dao/ProjectReportDataDao.java
  24. 11 1
      src/main/java/com/jeeplus/modules/projectcontentinfo/service/ProjectReportDataService.java
  25. 4 4
      src/main/java/com/jeeplus/modules/projectrecord/service/AdminProjectReportedImportService.java
  26. 1 1
      src/main/java/com/jeeplus/modules/projectrecord/service/ProjectRecordsService.java
  27. 1 1
      src/main/java/com/jeeplus/modules/projectrecord/service/ProjectReportedImportService.java
  28. 84 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectMessageElectronicSealDao.java
  29. 14 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectRecordsDao.java
  30. 13 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectRecordsReportedDao.java
  31. 3 1
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/PresignCallBack.java
  32. 9 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ProjectApprovalSignature.java
  33. 9 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ProjectReportSignature.java
  34. 108 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ProjectReportSignatureInfo.java
  35. 146 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecords.java
  36. 21 1
      src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecordsExport.java
  37. 3 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/ProjectPaperFilingService.java
  38. 14 4
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageAllService.java
  39. 1965 972
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageElectronicSealService.java
  40. 15 14
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageNewService.java
  41. 1333 565
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageService.java
  42. 231 7
      src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectRecordsService.java
  43. 278 98
      src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/ApprovalThread.java
  44. 374 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/InternalAuditSignatureThread.java
  45. 1 1
      src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/SignatureThread.java
  46. 2 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectMessageController.java
  47. 2 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectMessageNewController.java
  48. 4 4
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectRecordsController.java
  49. 13 7
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageController.java
  50. 642 33
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageElectronicSealController.java
  51. 2 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageNewController.java
  52. 3 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectRecordsController.java
  53. 202 0
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureCallBackController.java
  54. 44 3
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureOldMessageDisposeController.java
  55. 1 1
      src/main/java/com/jeeplus/modules/ruralprojectrecords/web/yanChengSignature/RuralProjectMessageElectronicSealYCController.java
  56. 22 0
      src/main/java/com/jeeplus/modules/statement/service/StatementCompanyComprehensiveService.java
  57. 8 0
      src/main/java/com/jeeplus/modules/sys/dao/OfficeDao.java
  58. 7 0
      src/main/java/com/jeeplus/modules/sys/dao/UserDao.java
  59. 47 0
      src/main/java/com/jeeplus/modules/sys/service/OfficeService.java
  60. 16 0
      src/main/java/com/jeeplus/modules/sys/service/SystemService.java
  61. 6 0
      src/main/java/com/jeeplus/modules/sys/web/HelpController.java
  62. 100 0
      src/main/java/com/jeeplus/modules/sys/web/OfficeController.java
  63. 51 8
      src/main/java/com/jeeplus/modules/sys/web/RegisterController.java
  64. 52 16
      src/main/java/com/jeeplus/modules/sys/web/UserController.java
  65. 87 0
      src/main/java/com/jeeplus/modules/sys/web/WorkattachmentController.java
  66. 1 0
      src/main/java/com/jeeplus/modules/tools/utils/HttpPostTool.java
  67. 1 0
      src/main/java/com/jeeplus/modules/workclientinfo/web/WorkClientInfoController.java
  68. 5 0
      src/main/java/com/jeeplus/modules/workcontractinfo/dao/WorkContractInfoDao.java
  69. 146 0
      src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkContractInfo.java
  70. 54 1
      src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java
  71. 42 7
      src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractInfoController.java
  72. 3 1
      src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullManageService.java
  73. 13 0
      src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullManageController.java
  74. 12 0
      src/main/java/com/jeeplus/modules/workinvoice/dao/WorkInvoiceDao.java
  75. 29 0
      src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java
  76. 12 0
      src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoiceExport.java
  77. 643 44
      src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java
  78. 113 6
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllController.java
  79. 72 18
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllTwoController.java
  80. 325 13
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java
  81. 97 7
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceTwoController.java
  82. 3 0
      src/main/java/com/jeeplus/modules/workprojectnotify/service/WorkProjectNotifyRecoverService.java
  83. 438 316
      src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java
  84. 15 0
      src/main/java/com/jeeplus/modules/workreimbursement/dao/WorkReimbursementDao.java
  85. 109 0
      src/main/java/com/jeeplus/modules/workreimbursement/entity/ReimbursementElectronicInvoiceVATTaxes.java
  86. 121 0
      src/main/java/com/jeeplus/modules/workreimbursement/entity/ReimbursementVATTax.java
  87. 45 0
      src/main/java/com/jeeplus/modules/workreimbursement/entity/WorkReimbursement.java
  88. 622 6
      src/main/java/com/jeeplus/modules/workreimbursement/service/WorkReimbursementNewService.java
  89. 234 3
      src/main/java/com/jeeplus/modules/workreimbursement/service/WorkReimbursementService.java
  90. 26 0
      src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementAllController.java
  91. 131 14
      src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementController.java
  92. 69 3
      src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementNewController.java
  93. 4021 0
      src/main/resources/freemarker/projectHSSignature.ftl
  94. 2480 0
      src/main/resources/freemarker/projectInternalAuditSignature.ftl
  95. 0 23
      src/main/resources/freemarker/projectSignature.ftl
  96. 12 3
      src/main/resources/jeeplus.properties
  97. 456 0
      src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceAlterDao.xml
  98. 2623 0
      src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceDao.xml
  99. 617 0
      src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceDetailDao.xml
  100. 0 0
      src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceReceiptDao.xml

+ 90 - 0
src/main/java/com/jeeplus/common/bos/BosController.java

@@ -4,6 +4,7 @@ import com.jeeplus.common.config.Global;
 import com.jeeplus.common.oss.OSSClientUtil;
 import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.FtlUtils;
+import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.modules.iim.entity.LayFileJsonData;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.utils.SftpClientUtil;
@@ -382,6 +383,26 @@ public class BosController {
         return srcFile;
     }
 
+
+    /**
+     * File转MultipartFile
+     * @param file
+     * @return
+     */
+    public static MultipartFile transformFile(File file){
+        InputStream inputStream = null;
+        MultipartFile multipartFile = null;
+        try {
+            inputStream = new FileInputStream(file);
+            multipartFile = new MockMultipartFile(file.getName(), inputStream);
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return multipartFile;
+    }
+
     public static String datePath(){
 
         Calendar date = Calendar.getInstance();
@@ -495,4 +516,73 @@ public class BosController {
             e.printStackTrace();
         }
     }
+
+
+    @RequestMapping("temporaryFileUpload")
+    @ResponseBody
+    public Map temporaryFileUpload(HttpServletRequest request, MultipartFile file,String filePath, MultipartHttpServletRequest multiRequest){
+        Map map = new HashMap();
+        String storeAs = request.getParameter("storeAs");
+        // 文件存储方式(0:本地服务器存储。1:云端存储)
+        if("1".equals(uploadMode)){
+            try {
+                //MultipartFile转File
+                File srcFile = transformMultipartFile(file);
+                String path = directory+"/"+storeAs+datePath()+"/"+ System.currentTimeMillis()+srcFile.getName();
+                BOSClientUtil bosClientUtil = new BOSClientUtil();
+                InputStream inputStream = file.getInputStream();
+                String upload = bosClientUtil.upload(path, inputStream);
+                if(srcFile.exists()){
+                    srcFile.delete();
+                }
+                map.put("msg","上传成功");
+                map.put("code","1");
+                map.put("url",upload);
+            }catch (Exception e){
+                map.put("msg","上传失败");
+                map.put("code","0");
+                logger.error("Exception e:"+e);
+            }
+        }else if("2".equals(uploadMode)){
+            File newFile = new File(filePath);
+            //File转MultipartFile文件
+            SftpClientUtil sftpClientUtil = new SftpClientUtil();
+            MultipartFile mFile = sftpClientUtil.transformFile(newFile);
+            //文件上传oss
+            String uploadPath = null;
+            try {
+                uploadPath = ResponseUtil.uploadOss(mFile, "reportRecord");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }finally {
+                newFile.delete();
+            }
+            map.put("code", "1");
+            map.put("url", uploadPath);
+
+            map.put("name", newFile.getName());
+
+        }else{
+
+            try {
+                //MultipartFile转File
+                File srcFile = transformMultipartFile(file);
+                SftpClientUtil fileUploadUtil = new SftpClientUtil();
+                String uploadPath = "/" + storeAs + datePath();
+                String uploadFile = fileUploadUtil.uploadFile(uploadPath, srcFile, srcFile.getName());
+                if(srcFile.exists()){
+                    srcFile.delete();
+                }
+                map.put("msg","上传成功");
+                map.put("code","1");
+                map.put("url","/a/workfullmanage/workFullManage/downLoadAttach?file=" + uploadFile);
+            } catch (Exception e) {
+                logger.error("Exception e:"+e);
+                e.printStackTrace();
+                map.put("msg","上传失败");
+                map.put("code","0");
+            }
+        }
+        return map;
+    }
 }

+ 42 - 0
src/main/java/com/jeeplus/common/utils/FtlUtils.java

@@ -8,6 +8,7 @@ import org.dom4j.Element;
 import org.dom4j.io.OutputFormat;
 import org.dom4j.io.SAXReader;
 import org.dom4j.io.XMLWriter;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.*;
 import java.util.ArrayList;
@@ -204,4 +205,45 @@ public class FtlUtils {
         return bos.toString("UTF-8");
     }
 
+    /**
+     * MultipartFile转File
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public static File transformMultipartFile( MultipartFile file) throws IOException {
+        File srcFile = null;
+        //MultipartFile转File
+        if (file.equals("") || file.getSize() <= 0) {
+            file = null;
+        } else {
+            InputStream ins = null;
+            ins = file.getInputStream();
+            srcFile = new File(file.getOriginalFilename());
+            inputStreamToFile(ins, srcFile);
+            ins.close();
+        }
+        return srcFile;
+    }
+
+    /**
+     * 获取流文件
+     * @param ins
+     * @param file
+     */
+    public 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();
+        }
+    }
+
 }

+ 466 - 383
src/main/java/com/jeeplus/common/utils/excel/ImportExcelNew.java

@@ -114,12 +114,13 @@ public class ImportExcelNew {
 	 * 构造函数
 	 * @param headerNum 标题行号,数据行号=标题行号+1
 	 * @param sheetIndex 工作表编号
+	 * @param type 数据来源(js:江苏;sh:上海)
 	 * @throws InvalidFormatException
 	 * @throws IOException
 	 */
-	public List ImportExcelNew(MultipartFile multipartFile, int headerNum, int sheetIndex)
+	public List ImportExcelNews(MultipartFile multipartFile, int headerNum, int sheetIndex, String type)
 			throws InvalidFormatException, IOException {
-		return this.list(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
+		return this.list(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex, type);
 	}
 
 
@@ -127,10 +128,25 @@ public class ImportExcelNew {
 	 * 构造函数
 	 * @param headerNum 标题行号,数据行号=标题行号+1
 	 * @param sheetIndex 工作表编号
+	 * @param type 数据来源(nsbg:内审报告)
 	 * @throws InvalidFormatException
 	 * @throws IOException
 	 */
-	public List list(String fileName, InputStream is, int headerNum, int sheetIndex)
+	public List ImportExcelNSBGNews(MultipartFile multipartFile, int headerNum, int sheetIndex, String type)
+			throws IOException {
+		return this.nsbgList(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex, type);
+	}
+
+
+	/**
+	 * 构造函数
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @param type 数据来源(js:江苏;sh:上海)
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public List list(String fileName, InputStream is, int headerNum, int sheetIndex, String type)
 			throws NullPointerException, IOException {
 		if (StringUtils.isBlank(fileName)){
 			throw new RuntimeException("导入文档为空!");
@@ -156,65 +172,165 @@ public class ImportExcelNew {
 		if(lastCellNum<3){
 			throw new RuntimeException("当前表格无数据!");
 		}else{
-			for(int i=2;i<lastCellNum;i++){ //第三列   0,1,2
-				//到每一列   获取对应行单元格数据
-                ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
-                if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
-                    projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
-                    if(sheet.getRow(1).getCell(i) != null) {
-                    	if(sheet.getRow(1).getCell(i).getCellType() == 0) {
-							BigDecimal bd = new BigDecimal(sheet.getRow(1).getCell(i).toString());
-							projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
-						}else {
-							throw new RuntimeException("请填写正确的金额!");
+			if ("sh".equals(type)){
+				for(int i=2;i<lastCellNum;i++){ //第三列   0,1,2
+					//到每一列   获取对应行单元格数据
+					ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
+					if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
+						projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
+
+
+
+						if(sheet.getRow(1).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectAccountNumber(sheet.getRow(1).getCell(i).toString());
 						}
-					}
-					if(sheet.getRow(2).getCell(i) != null) {
-						if(sheet.getRow(2).getCell(i).getCellType() == 0) {
-							BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
-							projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
-						}else {
-							throw new RuntimeException("请填写正确的金额!");
+
+						if(sheet.getRow(2).getCell(i) != null) {
+							if(sheet.getRow(2).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
+								projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
 						}
-					}
-					if(sheet.getRow(3).getCell(i) != null) {
-						if(sheet.getRow(3).getCell(i).getCellType() == 0) {
-							BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
-							projectReportSignatureInfo.setConstructionUnitAssessmentFee(bd.toPlainString());
-						}else {
-							throw new RuntimeException("请填写正确的金额!");
+						if(sheet.getRow(3).getCell(i) != null) {
+							if(sheet.getRow(3).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
+								projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
 						}
-					}
-					if(sheet.getRow(4).getCell(i) != null) {
-						if(sheet.getRow(4).getCell(i).getCellType() == 0) {
-							BigDecimal bd = new BigDecimal(sheet.getRow(4).getCell(i).toString());
-							projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee(bd.toPlainString());
-						}else {
-							throw new RuntimeException("请填写正确的金额!");
+						if(sheet.getRow(4).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectName(sheet.getRow(4).getCell(i).toString());
 						}
-					}
-					if(sheet.getRow(5).getCell(i) != null) {
-						projectReportSignatureInfo.setConstructionUnit(sheet.getRow(5).getCell(i).toString());
-					}
-					if(sheet.getRow(6).getCell(i) != null) {
-						projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(6).getCell(i).toString());
-					}
-					if(sheet.getRow(7).getCell(i) != null) {
-						projectReportSignatureInfo.setDescriptionOfExceedingTheContractAmount(sheet.getRow(7).getCell(i).toString());
-					}
-					if(sheet.getRow(8).getCell(i) != null) {
-						projectReportSignatureInfo.setDescriptionOfSpecialMatters(sheet.getRow(8).getCell(i).toString());
-					}
-					if(sheet.getRow(9).getCell(i) != null) {
-						if(sheet.getRow(9).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(9).getCell(i))) {
-								projectReportSignatureInfo.setStampDate(sheet.getRow(9).getCell(i).getDateCellValue());
+						if(sheet.getRow(5).getCell(i) != null) {
+							projectReportSignatureInfo.setDevelopmentOrganization(sheet.getRow(5).getCell(i).toString());
+						}
+						if(sheet.getRow(6).getCell(i) != null) {
+							projectReportSignatureInfo.setConstructionUnit(sheet.getRow(6).getCell(i).toString());
+						}
+
+						if(sheet.getRow(7).getCell(i) != null) {
+							projectReportSignatureInfo.setContractDate(sheet.getRow(7).getCell(i).toString());
+						}
+						//工程概况
+						if(sheet.getRow(8).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectProfile(sheet.getRow(8).getCell(i).toString());
+						}
+
+						if(sheet.getRow(9).getCell(i) != null) {
+							projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(9).getCell(i).toString());
+						}
+
+						if(sheet.getRow(10).getCell(i) != null) {
+							if(sheet.getRow(10).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(10).getCell(i))) {
+									projectReportSignatureInfo.setStampDate(sheet.getRow(10).getCell(i).getDateCellValue());
+								}
 							}
 						}
+						if(sheet.getRow(11).getCell(i) != null) {
+							projectReportSignatureInfo.setPrintQuantity(sheet.getRow(11).getCell(i).toString());
+						}
+						if(sheet.getRow(12).getCell(i) != null) {
+							if(sheet.getRow(12).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(12).getCell(i))) {
+									projectReportSignatureInfo.setAgreedStartDate(sheet.getRow(12).getCell(i).getDateCellValue());
+								}
+							}
+						}
+						if(sheet.getRow(13).getCell(i) != null) {
+							if(sheet.getRow(13).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(13).getCell(i))) {
+									projectReportSignatureInfo.setAgreedEndDate(sheet.getRow(13).getCell(i).getDateCellValue());
+								}
+							}
+						}
+
+						if(sheet.getRow(14).getCell(i) != null) {
+							projectReportSignatureInfo.setConsultant(sheet.getRow(14).getCell(i).toString());
+						}
+						if(sheet.getRow(15).getCell(i) != null) {
+							projectReportSignatureInfo.setSelfCalibrationOpinion(sheet.getRow(15).getCell(i).toString());
+						}
+						if(sheet.getRow(16).getCell(i) != null) {
+							projectReportSignatureInfo.setReviewOpinion(sheet.getRow(16).getCell(i).toString());
+						}
+						if(sheet.getRow(17).getCell(i) != null) {
+							projectReportSignatureInfo.setSettlementPricingBasisDocument(sheet.getRow(17).getCell(i).toString());
+						}
+						if(sheet.getRow(18).getCell(i) != null) {
+							projectReportSignatureInfo.setCalculateValuationBasisDocument(sheet.getRow(18).getCell(i).toString());
+						}
+						projectReportSignatureInfo.setType("2");
+						projectReportSignatureInfo.preInsert();
+						list.add(projectReportSignatureInfo);
+					}else {
+						return list;
 					}
-					if(sheet.getRow(10).getCell(i) != null) {
-						projectReportSignatureInfo.setPrintQuantity(sheet.getRow(10).getCell(i).toString());
-					}
+				}
+
+			}else if("js".equals(type)) {
+				for(int i=2;i<lastCellNum;i++){ //第三列   0,1,2
+					//到每一列   获取对应行单元格数据
+					ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
+					if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
+						projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
+						if(sheet.getRow(1).getCell(i) != null) {
+							if(sheet.getRow(1).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(1).getCell(i).toString());
+								projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						if(sheet.getRow(2).getCell(i) != null) {
+							if(sheet.getRow(2).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
+								projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						if(sheet.getRow(3).getCell(i) != null) {
+							if(sheet.getRow(3).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
+								projectReportSignatureInfo.setConstructionUnitAssessmentFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						if(sheet.getRow(4).getCell(i) != null) {
+							if(sheet.getRow(4).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(4).getCell(i).toString());
+								projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						if(sheet.getRow(5).getCell(i) != null) {
+							projectReportSignatureInfo.setConstructionUnit(sheet.getRow(5).getCell(i).toString());
+						}
+						if(sheet.getRow(6).getCell(i) != null) {
+							projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(6).getCell(i).toString());
+						}
+						if(sheet.getRow(7).getCell(i) != null) {
+							projectReportSignatureInfo.setDescriptionOfExceedingTheContractAmount(sheet.getRow(7).getCell(i).toString());
+						}
+						if(sheet.getRow(8).getCell(i) != null) {
+							projectReportSignatureInfo.setDescriptionOfSpecialMatters(sheet.getRow(8).getCell(i).toString());
+						}
+						if(sheet.getRow(9).getCell(i) != null) {
+							if(sheet.getRow(9).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(9).getCell(i))) {
+									projectReportSignatureInfo.setStampDate(sheet.getRow(9).getCell(i).getDateCellValue());
+								}
+							}
+						}
+						if(sheet.getRow(10).getCell(i) != null) {
+							projectReportSignatureInfo.setPrintQuantity(sheet.getRow(10).getCell(i).toString());
+						}
 					/*if(sheet.getRow(11).getCell(i) != null) {
 						if(sheet.getRow(11).getCell(i).getCellType()==0) {
 							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
@@ -222,29 +338,29 @@ public class ImportExcelNew {
 							}
 						}
 					}*/
-					if(sheet.getRow(11).getCell(i) != null) {
-						if(sheet.getRow(11).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
-								projectReportSignatureInfo.setAgreedStartDate(sheet.getRow(11).getCell(i).getDateCellValue());
+						if(sheet.getRow(11).getCell(i) != null) {
+							if(sheet.getRow(11).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(11).getCell(i))) {
+									projectReportSignatureInfo.setAgreedStartDate(sheet.getRow(11).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(12).getCell(i) != null) {
-						if(sheet.getRow(12).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(12).getCell(i))) {
-								projectReportSignatureInfo.setAgreedEndDate(sheet.getRow(12).getCell(i).getDateCellValue());
+						if(sheet.getRow(12).getCell(i) != null) {
+							if(sheet.getRow(12).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(12).getCell(i))) {
+									projectReportSignatureInfo.setAgreedEndDate(sheet.getRow(12).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(13).getCell(i) != null) {
-						projectReportSignatureInfo.setConsultant(sheet.getRow(13).getCell(i).toString());
-					}
-					if(sheet.getRow(14).getCell(i) != null) {
-						projectReportSignatureInfo.setSelfCalibrationOpinion(sheet.getRow(14).getCell(i).toString());
-					}
-					if(sheet.getRow(15).getCell(i) != null) {
-						projectReportSignatureInfo.setReviewOpinion(sheet.getRow(15).getCell(i).toString());
-					}
+						if(sheet.getRow(13).getCell(i) != null) {
+							projectReportSignatureInfo.setConsultant(sheet.getRow(13).getCell(i).toString());
+						}
+						if(sheet.getRow(14).getCell(i) != null) {
+							projectReportSignatureInfo.setSelfCalibrationOpinion(sheet.getRow(14).getCell(i).toString());
+						}
+						if(sheet.getRow(15).getCell(i) != null) {
+							projectReportSignatureInfo.setReviewOpinion(sheet.getRow(15).getCell(i).toString());
+						}
 					/*if(sheet.getRow(17).getCell(i) != null) {
 						if(sheet.getRow(17).getCell(i).getCellType()==0) {
 							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(17).getCell(i))) {
@@ -280,142 +396,302 @@ public class ImportExcelNew {
 							}
 						}
 					}*/
-					if(sheet.getRow(16).getCell(i) != null) {
-						projectReportSignatureInfo.setProjectScaleContentScope(sheet.getRow(16).getCell(i).toString());
-					}
-					if(sheet.getRow(17).getCell(i) != null) {
-						projectReportSignatureInfo.setMainContentsOfProject(sheet.getRow(17).getCell(i).toString());
-					}
-					if(sheet.getRow(18).getCell(i) != null) {
-						if(sheet.getRow(18).getCell(i).getCellType() == 0) {
-							BigDecimal bd = new BigDecimal(sheet.getRow(18).getCell(i).toString());
-							projectReportSignatureInfo.setTotalContractPrice(bd.toPlainString());
-						}else {
-							throw new RuntimeException("请填写正确的金额!");
+						if(sheet.getRow(16).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectScaleContentScope(sheet.getRow(16).getCell(i).toString());
+						}
+						if(sheet.getRow(17).getCell(i) != null) {
+							projectReportSignatureInfo.setMainContentsOfProject(sheet.getRow(17).getCell(i).toString());
+						}
+						if(sheet.getRow(18).getCell(i) != null) {
+							if(sheet.getRow(18).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(18).getCell(i).toString());
+								projectReportSignatureInfo.setTotalContractPrice(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
 						}
-					}
-					if(sheet.getRow(19).getCell(i) != null) {
-						if(sheet.getRow(19).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(19).getCell(i))) {
-								projectReportSignatureInfo.setContractStartDate(sheet.getRow(19).getCell(i).getDateCellValue());
+						if(sheet.getRow(19).getCell(i) != null) {
+							if(sheet.getRow(19).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(19).getCell(i))) {
+									projectReportSignatureInfo.setContractStartDate(sheet.getRow(19).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(20).getCell(i) != null) {
-						if(sheet.getRow(20).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(20).getCell(i))) {
-								projectReportSignatureInfo.setContractEndDate(sheet.getRow(20).getCell(i).getDateCellValue());
+						if(sheet.getRow(20).getCell(i) != null) {
+							if(sheet.getRow(20).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(20).getCell(i))) {
+									projectReportSignatureInfo.setContractEndDate(sheet.getRow(20).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(21).getCell(i) != null) {
-						if(sheet.getRow(21).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(21).getCell(i))) {
-								projectReportSignatureInfo.setActualStartDate(sheet.getRow(21).getCell(i).getDateCellValue());
+						if(sheet.getRow(21).getCell(i) != null) {
+							if(sheet.getRow(21).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(21).getCell(i))) {
+									projectReportSignatureInfo.setActualStartDate(sheet.getRow(21).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(22).getCell(i) != null) {
-						if(sheet.getRow(22).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(22).getCell(i))) {
-								projectReportSignatureInfo.setActualEndDate(sheet.getRow(22).getCell(i).getDateCellValue());
+						if(sheet.getRow(22).getCell(i) != null) {
+							if(sheet.getRow(22).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(22).getCell(i))) {
+									projectReportSignatureInfo.setActualEndDate(sheet.getRow(22).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(23).getCell(i) != null) {
-						if(sheet.getRow(23).getCell(i).getCellType()==0) {
-							if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(23).getCell(i))) {
-								projectReportSignatureInfo.setCompletionAcceptanceDate(sheet.getRow(23).getCell(i).getDateCellValue());
+						if(sheet.getRow(23).getCell(i) != null) {
+							if(sheet.getRow(23).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(23).getCell(i))) {
+									projectReportSignatureInfo.setCompletionAcceptanceDate(sheet.getRow(23).getCell(i).getDateCellValue());
+								}
 							}
 						}
-					}
-					if(sheet.getRow(24).getCell(i) != null) {
-						projectReportSignatureInfo.setDesignUnit(sheet.getRow(24).getCell(i).toString());
-					}
-					if(sheet.getRow(25).getCell(i) != null) {
-						projectReportSignatureInfo.setConstructionControlUnit(sheet.getRow(25).getCell(i).toString());
-					}
-					if(sheet.getRow(26).getCell(i) != null) {
-						projectReportSignatureInfo.setFollowUpAuditUnit(sheet.getRow(26).getCell(i).toString());
-					}
+						if(sheet.getRow(24).getCell(i) != null) {
+							projectReportSignatureInfo.setDesignUnit(sheet.getRow(24).getCell(i).toString());
+						}
+						if(sheet.getRow(25).getCell(i) != null) {
+							projectReportSignatureInfo.setConstructionControlUnit(sheet.getRow(25).getCell(i).toString());
+						}
+						if(sheet.getRow(26).getCell(i) != null) {
+							projectReportSignatureInfo.setFollowUpAuditUnit(sheet.getRow(26).getCell(i).toString());
+						}
 
-					if(sheet.getRow(27).getCell(i) != null) {
-						projectReportSignatureInfo.setContractName(sheet.getRow(27).getCell(i).toString());
-					}
-					if(sheet.getRow(28).getCell(i) != null) {
-						projectReportSignatureInfo.setContractDetails(sheet.getRow(28).getCell(i).toString());
-					}
-					if(sheet.getRow(29).getCell(i) != null) {
-						projectReportSignatureInfo.setContractDate(sheet.getRow(29).getCell(i).toString());
-					}
+						if(sheet.getRow(27).getCell(i) != null) {
+							projectReportSignatureInfo.setContractName(sheet.getRow(27).getCell(i).toString());
+						}
+						if(sheet.getRow(28).getCell(i) != null) {
+							projectReportSignatureInfo.setContractDetails(sheet.getRow(28).getCell(i).toString());
+						}
+						if(sheet.getRow(29).getCell(i) != null) {
+							projectReportSignatureInfo.setContractDate(sheet.getRow(29).getCell(i).toString());
+						}
 
 
 
-					if(sheet.getRow(30).getCell(i) != null) {
-						projectReportSignatureInfo.setEngineeringDesignChangeOrder(sheet.getRow(30).getCell(i).toString());
-					}
-					if(sheet.getRow(31).getCell(i) != null) {
-						projectReportSignatureInfo.setConfirmationSheetOfQuantities(sheet.getRow(31).getCell(i).toString());
-					}
-					if(sheet.getRow(32).getCell(i) != null) {
-						projectReportSignatureInfo.setProjectVisa(sheet.getRow(32).getCell(i).toString());
-					}
+						if(sheet.getRow(30).getCell(i) != null) {
+							projectReportSignatureInfo.setEngineeringDesignChangeOrder(sheet.getRow(30).getCell(i).toString());
+						}
+						if(sheet.getRow(31).getCell(i) != null) {
+							projectReportSignatureInfo.setConfirmationSheetOfQuantities(sheet.getRow(31).getCell(i).toString());
+						}
+						if(sheet.getRow(32).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectVisa(sheet.getRow(32).getCell(i).toString());
+						}
 
-					if(sheet.getRow(33).getCell(i) != null) {
-						projectReportSignatureInfo.setQualityPriceConfirmationOfEngineeringMaterials(sheet.getRow(33).getCell(i).toString());
-					}
-					if(sheet.getRow(34).getCell(i) != null) {
-						projectReportSignatureInfo.setListmaterialsEquipmentByA(sheet.getRow(34).getCell(i).toString());
-					}
-					if(sheet.getRow(35).getCell(i) != null) {
-						projectReportSignatureInfo.setProjectRewardAndDamages(sheet.getRow(35).getCell(i).toString());
-					}
+						if(sheet.getRow(33).getCell(i) != null) {
+							projectReportSignatureInfo.setQualityPriceConfirmationOfEngineeringMaterials(sheet.getRow(33).getCell(i).toString());
+						}
+						if(sheet.getRow(34).getCell(i) != null) {
+							projectReportSignatureInfo.setListmaterialsEquipmentByA(sheet.getRow(34).getCell(i).toString());
+						}
+						if(sheet.getRow(35).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectRewardAndDamages(sheet.getRow(35).getCell(i).toString());
+						}
 
 
-					if(sheet.getRow(36).getCell(i) != null) {
-						projectReportSignatureInfo.setCharge(sheet.getRow(36).getCell(i).toString());
-					}
-					if(sheet.getRow(37).getCell(i) != null) {
-						projectReportSignatureInfo.setTaxes(sheet.getRow(37).getCell(i).toString());
-					}
-					if(sheet.getRow(38).getCell(i) != null) {
-						projectReportSignatureInfo.setDurationDifferenceCausesAndResponsibilities(sheet.getRow(38).getCell(i).toString());
-					}
-					if(sheet.getRow(39).getCell(i) != null) {
-						projectReportSignatureInfo.setQualityDifferenceCausesAndResponsibilities(sheet.getRow(39).getCell(i).toString());
-					}
-					if(sheet.getRow(40).getCell(i) != null) {
-						projectReportSignatureInfo.setOtherContentsAndExpenses(sheet.getRow(40).getCell(i).toString());
-					}
-					if(sheet.getRow(41).getCell(i) != null) {
-						projectReportSignatureInfo.setProjectCostConsultingContract(sheet.getRow(41).getCell(i).toString());
-					}
-					if(sheet.getRow(42).getCell(i) != null) {
-						projectReportSignatureInfo.setSettlementPricingBasisDocument(sheet.getRow(42).getCell(i).toString());
-					}
-					if(sheet.getRow(43).getCell(i) != null) {
-						projectReportSignatureInfo.setMaterialsAndEquipmentByA(sheet.getRow(43).getCell(i).toString());
-					}
-					if(sheet.getRow(44).getCell(i) != null) {
-						projectReportSignatureInfo.setaMaterialsByB(sheet.getRow(44).getCell(i).toString());
-					}
-					if(sheet.getRow(45).getCell(i) != null) {
-						projectReportSignatureInfo.setRewardAndPunishmentFees(sheet.getRow(45).getCell(i).toString());
-					}
-					if(sheet.getRow(46).getCell(i) != null) {
-						projectReportSignatureInfo.setWaterAndElectricityFeesHandleSituation(sheet.getRow(46).getCell(i).toString());
-					}
-					if(sheet.getRow(47).getCell(i) != null) {
-						projectReportSignatureInfo.setConstructionQualityWarrantyDeposit(sheet.getRow(47).getCell(i).toString());
+						if(sheet.getRow(36).getCell(i) != null) {
+							projectReportSignatureInfo.setCharge(sheet.getRow(36).getCell(i).toString());
+						}
+						if(sheet.getRow(37).getCell(i) != null) {
+							projectReportSignatureInfo.setTaxes(sheet.getRow(37).getCell(i).toString());
+						}
+						if(sheet.getRow(38).getCell(i) != null) {
+							projectReportSignatureInfo.setDurationDifferenceCausesAndResponsibilities(sheet.getRow(38).getCell(i).toString());
+						}
+						if(sheet.getRow(39).getCell(i) != null) {
+							projectReportSignatureInfo.setQualityDifferenceCausesAndResponsibilities(sheet.getRow(39).getCell(i).toString());
+						}
+						if(sheet.getRow(40).getCell(i) != null) {
+							projectReportSignatureInfo.setOtherContentsAndExpenses(sheet.getRow(40).getCell(i).toString());
+						}
+						if(sheet.getRow(41).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectCostConsultingContract(sheet.getRow(41).getCell(i).toString());
+						}
+						if(sheet.getRow(42).getCell(i) != null) {
+							projectReportSignatureInfo.setSettlementPricingBasisDocument(sheet.getRow(42).getCell(i).toString());
+						}
+						if(sheet.getRow(43).getCell(i) != null) {
+							projectReportSignatureInfo.setMaterialsAndEquipmentByA(sheet.getRow(43).getCell(i).toString());
+						}
+						if(sheet.getRow(44).getCell(i) != null) {
+							projectReportSignatureInfo.setaMaterialsByB(sheet.getRow(44).getCell(i).toString());
+						}
+						if(sheet.getRow(45).getCell(i) != null) {
+							projectReportSignatureInfo.setRewardAndPunishmentFees(sheet.getRow(45).getCell(i).toString());
+						}
+						if(sheet.getRow(46).getCell(i) != null) {
+							projectReportSignatureInfo.setWaterAndElectricityFeesHandleSituation(sheet.getRow(46).getCell(i).toString());
+						}
+						if(sheet.getRow(47).getCell(i) != null) {
+							projectReportSignatureInfo.setConstructionQualityWarrantyDeposit(sheet.getRow(47).getCell(i).toString());
+						}
+						if(sheet.getRow(48).getCell(i) != null) {
+							projectReportSignatureInfo.setTaxDifferenceCalculationAndProcessing(sheet.getRow(48).getCell(i).toString());
+						}
+						projectReportSignatureInfo.setType("1");
+						projectReportSignatureInfo.preInsert();
+						list.add(projectReportSignatureInfo);
+					}else {
+						return list;
 					}
-					if(sheet.getRow(48).getCell(i) != null) {
-						projectReportSignatureInfo.setTaxDifferenceCalculationAndProcessing(sheet.getRow(48).getCell(i).toString());
+				}
+			}
+		}
+
+		log.debug("Initialize success.");
+		return list;
+	}
+
+	/**
+	 * 构造函数
+	 * @param headerNum 标题行号,数据行号=标题行号+1
+	 * @param sheetIndex 工作表编号
+	 * @param type 数据来源(nsbg:内审报告)
+	 * @throws InvalidFormatException
+	 * @throws IOException
+	 */
+	public List nsbgList(String fileName, InputStream is, int headerNum, int sheetIndex, String type)
+			throws NullPointerException, IOException {
+		if (StringUtils.isBlank(fileName)){
+			throw new RuntimeException("导入文档为空!");
+		}else if(fileName.toLowerCase().endsWith("xls")){
+			this.wb = new HSSFWorkbook(is);
+		}else if(fileName.toLowerCase().endsWith("xlsx")){
+			this.wb = new XSSFWorkbook(is);
+		}else{
+			throw new RuntimeException("文档格式不正确!");
+		}
+		if (this.wb.getNumberOfSheets()<sheetIndex){
+			throw new RuntimeException("文档中没有工作表!");
+		}
+		this.sheet = this.wb.getSheetAt(sheetIndex);
+		this.headerNum = headerNum;
+
+		int firstRowNum = sheet.getFirstRowNum();
+		Row firstRow = sheet.getRow(firstRowNum);
+		int lastCellNum = firstRow.getLastCellNum();
+
+		List<ProjectReportSignatureInfo> list = new ArrayList<ProjectReportSignatureInfo>();
+
+		if(lastCellNum<2){
+			throw new RuntimeException("当前表格无数据!");
+		}else{
+			if ("nsbg".equals(type)){	//内审报告数据
+				for(int i=1;i<lastCellNum;i++){ //第二列   0,1
+					//到每一列   获取对应行单元格数据
+					ProjectReportSignatureInfo projectReportSignatureInfo = new ProjectReportSignatureInfo();
+					if(null != sheet.getRow(0).getCell(i) && StringUtils.isNotBlank(sheet.getRow(0).getCell(i).toString())) {
+						projectReportSignatureInfo.setProjectReportId(sheet.getRow(0).getCell(i).toString());
+
+						//送审额
+						if(sheet.getRow(1).getCell(i) != null) {
+							if(sheet.getRow(1).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(1).getCell(i).toString());
+								projectReportSignatureInfo.setSubmitFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						//审定额
+						if(sheet.getRow(2).getCell(i) != null) {
+							if(sheet.getRow(2).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(2).getCell(i).toString());
+								projectReportSignatureInfo.setAuthorizeFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						//核减额
+						if(StringUtils.isNotBlank(projectReportSignatureInfo.getSubmitFee()) && StringUtils.isNotBlank(projectReportSignatureInfo.getAuthorizeFee())){
+							//核减额 = 送审核-审定额
+							BigDecimal submitFeeB = new BigDecimal(projectReportSignatureInfo.getSubmitFee());
+							BigDecimal authorizeFeeB = new BigDecimal(projectReportSignatureInfo.getAuthorizeFee());
+							BigDecimal decreaseInAccountingFeeB= submitFeeB.subtract(authorizeFeeB).setScale(2,BigDecimal.ROUND_HALF_UP);
+							projectReportSignatureInfo.setDecreaseInAccountingFee(decreaseInAccountingFeeB.toString());
+						}else{
+							projectReportSignatureInfo.setDecreaseInAccountingFee("0");
+						}
+						//施工单位考核费
+						if(sheet.getRow(3).getCell(i) != null) {
+							if(sheet.getRow(3).getCell(i).getCellType() == 0) {
+								BigDecimal bd = new BigDecimal(sheet.getRow(3).getCell(i).toString());
+								projectReportSignatureInfo.setConstructionUnitAssessmentFee(bd.toPlainString());
+							}else {
+								throw new RuntimeException("请填写正确的金额!");
+							}
+						}
+						//扣除考核费后审定金额
+						//authorizeFeeDeductAssessmentFee
+						if(StringUtils.isNotBlank(projectReportSignatureInfo.getAuthorizeFee()) && StringUtils.isNotBlank(projectReportSignatureInfo.getConstructionUnitAssessmentFee())){
+							//扣除考核费后审定金额 = 审定额-施工单位考核费
+							BigDecimal authorizeFeeB = new BigDecimal(projectReportSignatureInfo.getAuthorizeFee());
+							BigDecimal constructionUnitAssessmentFeeB = new BigDecimal(projectReportSignatureInfo.getConstructionUnitAssessmentFee());
+							BigDecimal authorizeFeeDeductAssessmentFeeB= authorizeFeeB.subtract(constructionUnitAssessmentFeeB).setScale(2,BigDecimal.ROUND_HALF_UP);
+							projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee(authorizeFeeDeductAssessmentFeeB.toString());
+						}else{
+							projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee("0");
+						}
+
+
+						//审计开始时间
+						if(sheet.getRow(4).getCell(i) != null) {
+							if(sheet.getRow(4).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(4).getCell(i))) {
+									projectReportSignatureInfo.setAuditStartDate(sheet.getRow(4).getCell(i).getDateCellValue());
+								}
+							}
+						}
+						//审计结束时间
+						if(sheet.getRow(5).getCell(i) != null) {
+							if(sheet.getRow(5).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(5).getCell(i))) {
+									projectReportSignatureInfo.setAuditEndDate(sheet.getRow(5).getCell(i).getDateCellValue());
+								}
+							}
+						}
+						//工程审计项目
+						if(sheet.getRow(6).getCell(i) != null) {
+							projectReportSignatureInfo.setProjectName(sheet.getRow(6).getCell(i).toString());
+						}
+						//工程内容
+						if(sheet.getRow(7).getCell(i) != null) {
+							projectReportSignatureInfo.setMainContentsOfProject(sheet.getRow(7).getCell(i).toString());
+						}
+						//施工单位
+						if(sheet.getRow(8).getCell(i) != null) {
+							projectReportSignatureInfo.setConstructionUnit(sheet.getRow(8).getCell(i).toString());
+						}
+						//工程开始时间
+						if(sheet.getRow(9).getCell(i) != null) {
+							if(sheet.getRow(9).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(9).getCell(i))) {
+									projectReportSignatureInfo.setProjectStartDate(sheet.getRow(9).getCell(i).getDateCellValue());
+								}
+							}
+						}
+						//工程竣工时间
+						if(sheet.getRow(10).getCell(i) != null) {
+							if(sheet.getRow(10).getCell(i).getCellType()==0) {
+								if (HSSFDateUtil.isCellDateFormatted(sheet.getRow(10).getCell(i))) {
+									projectReportSignatureInfo.setProjectEndDate(sheet.getRow(10).getCell(i).getDateCellValue());
+								}
+							}
+						}
+						//特殊事项说明
+						if(sheet.getRow(11).getCell(i) != null) {
+							projectReportSignatureInfo.setDescriptionOfSpecialMatters(sheet.getRow(11).getCell(i).toString());
+						}
+						//核减情况说明
+						if(sheet.getRow(12).getCell(i) != null) {
+							projectReportSignatureInfo.setDescriptionOfDeduction(sheet.getRow(12).getCell(i).toString());
+						}
+						projectReportSignatureInfo.setType("3");
+						projectReportSignatureInfo.preInsert();
+						list.add(projectReportSignatureInfo);
+					}else {
+						return list;
 					}
-					projectReportSignatureInfo.preInsert();
-                    list.add(projectReportSignatureInfo);
-                }else {
-                    return list;
-                }
+				}
+
 			}
 		}
 
@@ -711,194 +987,6 @@ public class ImportExcelNew {
 		return dataList;
 	}
 
-	/**
-	 * 客户的报表数据
-	 * @return
-	 * @throws InstantiationException
-	 * @throws IllegalAccessException
-	 *//*
-	public <E> Map<Object,Object> getClientDataList(Class<E> cls, int... groups) throws InstantiationException, IllegalAccessException{
-		HashMap<Object, Object> map = Maps.newHashMap();
-		List<Object[]> annotationList = Lists.newArrayList();
-		// Get annotation field
-		Field[] fs = cls.getDeclaredFields();
-		for (Field f : fs){
-			ExcelField ef = f.getAnnotation(ExcelField.class);
-			if (ef != null && (ef.type()==0 || ef.type()==2)){
-				if (groups!=null && groups.length>0){
-					boolean inGroup = false;
-					for (int g : groups){
-						if (inGroup){
-							break;
-						}
-						for (int efg : ef.groups()){
-							if (g == efg){
-								inGroup = true;
-								annotationList.add(new Object[]{ef, f});
-								break;
-							}
-						}
-					}
-				}else{
-					annotationList.add(new Object[]{ef, f});
-				}
-			}
-		}
-		// Get annotation method
-		Method[] ms = cls.getDeclaredMethods();
-		for (Method m : ms){
-			ExcelField ef = m.getAnnotation(ExcelField.class);
-			if (ef != null && (ef.type()==0 || ef.type()==2)){
-				if (groups!=null && groups.length>0){
-					boolean inGroup = false;
-					for (int g : groups){
-						if (inGroup){
-							break;
-						}
-						for (int efg : ef.groups()){
-							if (g == efg){
-								inGroup = true;
-								annotationList.add(new Object[]{ef, m});
-								break;
-							}
-						}
-					}
-				}else{
-					annotationList.add(new Object[]{ef, m});
-				}
-			}
-		}
-		// Field sorting
-		Collections.sort(annotationList, new Comparator<Object[]>() {
-			public int compare(Object[] o1, Object[] o2) {
-				return new Integer(((ExcelField)o1[0]).sort()).compareTo(
-						new Integer(((ExcelField)o2[0]).sort()));
-			};
-		});
-		//log.debug("Import column count:"+annotationList.size());
-		// Get excel data
-		List<E> dataList = Lists.newArrayList();
-		List<String> errList = Lists.newArrayList();
-		for (int i = this.getDataRowNum(); i < this.getLastDataRowNum(); i++) {
-			E e = (E)cls.newInstance();
-			int column = 0;
-			Row row = this.getRow(i);
-			StringBuilder sb = new StringBuilder();
-			String errMsg = "";
-			for (Object[] os : annotationList){
-				Object val = this.getCellValue(row, column++);
-				if (val != null){
-					ExcelField ef = (ExcelField)os[0];
-					// If is dict type, get dict value
-					if (StringUtils.isNotBlank(ef.dictType())){
-						val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
-						//log.debug("Dictionary type value: ["+i+","+colunm+"] " + val);
-					}
-					// Get param type and type cast
-					Class<?> valType = Class.class;
-					if (os[1] instanceof Field){
-						valType = ((Field)os[1]).getType();
-					}else if (os[1] instanceof Method){
-						Method method = ((Method)os[1]);
-						if ("get".equals(method.getName().substring(0, 3))){
-							valType = method.getReturnType();
-						}else if("set".equals(method.getName().substring(0, 3))){
-							valType = ((Method)os[1]).getParameterTypes()[0];
-						}
-					}
-					//log.debug("Import value type: ["+i+","+column+"] " + valType);
-					try {
-						//如果导入的java对象,需要在这里自己进行变换。
-						if (valType == String.class){
-							String s = String.valueOf(val.toString());
-							if(StringUtils.endsWith(s, ".0")){
-								val = StringUtils.substringBefore(s, ".0");
-							}else{
-								val = String.valueOf(val.toString());
-							}
-						}else if (valType == Integer.class){
-							val = Double.valueOf(val.toString()).intValue();
-						}else if (valType == Long.class){
-							val = Double.valueOf(val.toString()).longValue();
-						}else if (valType == Double.class){
-							val = Double.valueOf(val.toString());
-						}else if (valType == Float.class){
-							val = Float.valueOf(val.toString());
-						}else if (valType == Date.class){
-							SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
-							val=sdf.parse(val.toString());
-						}else if (valType == User.class){
-							val = UserUtils.getByUserName(val.toString());
-						}else if (valType == Office.class){
-							val = UserUtils.getByOfficeName(val.toString());
-						}else if (valType == Area.class){
-							val = UserUtils.getByAreaName(val.toString());
-						}else{
-							if (ef.fieldType() != Class.class){
-								val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
-							}else{
-								val = Class.forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
-										"fieldtype."+valType.getSimpleName()+"Type")).getMethod("getValue", String.class).invoke(null, val.toString());
-							}
-						}
-					} catch (Exception ex) {
-						log.info("Get cell value ["+i+","+column+"] error: " + ex.toString());
-						val = null;
-					}
-					if(column == 1 || column == 2 || column == 3
-							|| column == 4 || column == 5 || column == 6 || column == 7
-							|| column == 8 || column == 9 || column == 10){
-						if(val == null || val == ""){
-							errMsg += "第+i+条,第"+column+"列数据不能为空";
-						}
-					}
-					// set entity value
-					if (os[1] instanceof Field){
-						if(Strings.isNullOrEmpty(errMsg)){
-							Reflections.invokeSetter(e, ((Field)os[1]).getName(), val);
-						}
-
-					}else if (os[1] instanceof Method){
-						String mthodName = ((Method)os[1]).getName();
-						if ("get".equals(mthodName.substring(0, 3))){
-							mthodName = "set"+StringUtils.substringAfter(mthodName, "get");
-						}
-						if(Strings.isNullOrEmpty(errMsg)){
-							Reflections.invokeMethod(e, mthodName, new Class[] {valType}, new Object[] {val});
-						}
-					}
-				}
-				sb.append(val+", ");
-			}
-			if(!"".equals(errMsg)){
-				errList.add(errMsg);
-			}else{
-				dataList.add(e);
-			}
-			log.debug("Read success: ["+i+"] "+sb.toString());
-		}
-		map.put("dataList",dataList);
-		map.put("errList",errList);
-		return map;
-	}*/
-
-//	/**
-//	 * 导入测试
-//	 */
-//	public static void main(String[] args) throws Throwable {
-//
-//		ImportExcel ei = new ImportExcel("target/export.xlsx", 1);
-//
-//		for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
-//			Row row = ei.getRow(i);
-//			for (int j = 0; j < ei.getLastCellNum(); j++) {
-//				Object val = ei.getCellValue(row, j);
-//				System.out.print(val+", ");
-//			}
-//			System.out.print("\n");
-//		}
-//
-//	}
     public static String replaceBlank(String str) {
         String dest = "";
         if (str!=null) {
@@ -908,9 +996,4 @@ public class ImportExcelNew {
         }
         return dest;
     }
-
- /*   public static void main(String[] args) {
-        replaceBlank("桩基框架-剪力墙结构\n" +
-                "(主体部分)空间钢桁架结构(屋顶部分)");
-    }*/
 }

+ 34 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceAlterDao.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceAlter;
+import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+
+import java.util.List;
+
+/**
+ * 开票管理DAO接口
+ * @author 孟祥越
+ * @version 2017-05-05
+ */
+@MyBatisDao
+public interface FilialeWorkInvoiceAlterDao extends CrudDao<FilialeWorkInvoiceAlter> {
+
+	public List<WorkClientInfo> findListByclient(WorkClientInfo client);
+	public List<WorkBidProject> findListByproject(WorkBidProject project);
+	
+	public FilialeWorkInvoiceAlter getByProcInsId(String procInsId);
+	
+	/**
+	 * 更新流程实例ID
+	 * @param
+	 * @return
+	 */
+	public int updateProcessInstanceId(FilialeWorkInvoiceAlter workInvoice);
+	
+}

+ 147 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceDao.java

@@ -0,0 +1,147 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoice;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceProjectRelation;
+import com.jeeplus.modules.statement.entity.StatementCompanyComprehensiveInfo;
+import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 开票管理DAO接口
+ * @author 孟祥越
+ * @version 2017-05-05
+ */
+@MyBatisDao
+public interface FilialeWorkInvoiceDao extends CrudDao<FilialeWorkInvoice> {
+	/**
+	 * 新的查询方法
+	 * @param workInvoice
+	 * @return
+	 */
+	public List<FilialeWorkInvoice> findListNew(FilialeWorkInvoice workInvoice);
+	/**
+	 * 分页查询总数
+	 * @param workInvoice
+	 * @return
+	 */
+	public Integer queryCountNew(FilialeWorkInvoice workInvoice);
+
+	public List<WorkClientInfo> findListByclient(WorkClientInfo client);
+	public List<WorkBidProject> findListByproject(WorkBidProject project);
+
+	public FilialeWorkInvoice getByProcInsId(String procInsId);
+
+	/**
+	 * 更新流程实例ID
+	 * @param
+	 * @return
+	 */
+	public int updateProcessInstanceId(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 修改日期信息
+	 * @param workInvoice
+	 * @return
+	 */
+	public int updateDate(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 删除作废操作
+	 * @param workInvoice
+	 */
+	void cancellationDelete(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 财务收款操作
+	 * @param workInvoice
+	 */
+	void receiptMoney(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 财务部分收款操作
+	 * @param workInvoice
+	 */
+	void updateInvoiceReceipt(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 撤回财务确认收款操作
+	 * @param workInvoice
+	 */
+	void cancelReceiptMoney(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 根据开票id查询所有开票项目 关联信息
+	 * @param invoiceId
+	 * @return
+	 */
+	List<FilialeWorkInvoiceProjectRelation> getProjectRelation(String invoiceId);
+
+	/**
+	 * 根据开票id删除所有开票项目 关联信息
+	 * @param invoiceId
+	 * @return
+	 */
+	int deleteProjectRelation(String invoiceId);
+
+	/**
+	 * 新增开票和项目关联信息
+	 * @param projectRelation
+	 * @return
+	 */
+	int insertProjectRelation(FilialeWorkInvoiceProjectRelation projectRelation);
+
+	/**
+	 * 查询已通过的所有发票的开票金额总和
+	 * @param workInvoice
+	 * @return
+	 */
+	String getSumMoney(FilialeWorkInvoice workInvoice);
+
+	/**
+	 * 导出数据查询
+	 * @param workInvoice
+	 * @return
+	 */
+	List<FilialeWorkInvoice> findListOnExport(FilialeWorkInvoice workInvoice);
+
+	List<FilialeWorkInvoice> findListExport(FilialeWorkInvoice workInvoice);
+
+	List<FilialeWorkInvoice> findMapList(FilialeWorkInvoice workInvoice);
+	Integer queryMapCount(FilialeWorkInvoice workInvoice);
+
+
+	/**
+	 * 根据项目id查询该项目所有发票记录信息以及发票状态
+	 * @param projectId
+	 * @return
+	 */
+	Integer getProjectRelationListByProjectId(String projectId);
+
+	//公司级 查询开票报表
+	List<FilialeWorkInvoice> findBillingReportPage(@Param("FilialeWorkInvoice") FilialeWorkInvoice workInvoice,@Param("officeIdd") String officeIdd, @Param("beginDate")String beginDate, @Param("endDate")String endDate,@Param("newlyAdded")String newlyAdded,@Param("collectionThisMonth")String collectionThisMonth);
+
+	//公司级 查询开票报表的条数
+	Integer findBillingReportPageCount(@Param("FilialeWorkInvoice") FilialeWorkInvoice workInvoice,@Param("officeIdd") String officeIdd, @Param("beginDate")String beginDate, @Param("endDate")String endDate,@Param("newlyAdded")String newlyAdded,@Param("collectionThisMonth")String collectionThisMonth);
+
+
+	//部门级 查询开票报表
+	List<FilialeWorkInvoice> findDepartmentBillingReportPage(@Param("FilialeWorkInvoice") FilialeWorkInvoice workInvoice, @Param("statementCompanyComprehensiveInfo")StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo, @Param("officeIdd") String officeIdd, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("newlyAdded")String newlyAdded, @Param("collectionThisMonth")String collectionThisMonth);
+
+	//部门级 查询开票报表的条数
+	Integer findDepartmentBillingReportPageCount(@Param("FilialeWorkInvoice") FilialeWorkInvoice workInvoice, @Param("statementCompanyComprehensiveInfo")StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo, @Param("officeIdd") String officeIdd, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("newlyAdded")String newlyAdded, @Param("collectionThisMonth")String collectionThisMonth);
+
+	/**
+	 * 获取发票开户银行信息
+	 * @param bankName
+	 * @return
+	 */
+	String getBankNameByNameOrId(String bankName);
+}

+ 51 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceDetailDao.java

@@ -0,0 +1,51 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceDetail;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 发票明细DAO接口
+ * @author lw
+ * @version 2018-05-09
+ */
+@MyBatisDao
+public interface FilialeWorkInvoiceDetailDao extends CrudDao<FilialeWorkInvoiceDetail> {
+    //展示带退票标记的列表
+    public List<FilialeWorkInvoiceDetail> findLists(FilialeWorkInvoiceDetail workInvoiceDetail);
+    //发票变更展示明细列表
+    public List<FilialeWorkInvoiceDetail> afindList(FilialeWorkInvoiceDetail workInvoiceDetail);
+    List<FilialeWorkInvoiceDetail> findListWithDept(FilialeWorkInvoiceDetail invoice);
+
+    List<FilialeWorkInvoiceDetail> findListReturn(FilialeWorkInvoiceDetail invoice);
+
+    List<FilialeWorkInvoiceDetail> findByCode(FilialeWorkInvoiceDetail invoice);
+    void updateByCode(FilialeWorkInvoiceDetail invoice);
+    /**
+     * 更新流程实例ID
+     * @return
+     */
+    public int updateProcessInstanceId(FilialeWorkInvoiceDetail workInvoiceDetail);
+
+    /**
+     * 根据流程实例ID获取
+     * @param processInstanceId
+     * @return
+     */
+    public FilialeWorkInvoiceDetail getByProcessInstanceId(String processInstanceId);
+
+    List<FilialeWorkInvoiceDetail> findPageByCompany(FilialeWorkInvoiceDetail invoice);
+    List<FilialeWorkInvoiceDetail> findListByContractInfo(FilialeWorkInvoiceDetail invoice);
+
+    void updateSettleFlag(FilialeWorkInvoiceDetail invoice);
+
+    int countByNumber(String number);
+
+    int countByNumAndComp(@Param("invoiceNum") String invoiceNum, @Param("comId") String comId);
+}

+ 18 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceReceiptDao.java

@@ -0,0 +1,18 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceReceipt;
+
+/**
+ * 开票管理DAO接口
+ * @author 孟祥越
+ * @version 2017-05-05
+ */
+@MyBatisDao
+public interface FilialeWorkInvoiceReceiptDao extends CrudDao<FilialeWorkInvoiceReceipt> {
+
+}

+ 32 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/dao/FilialeWorkInvoiceReturnDao.java

@@ -0,0 +1,32 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.dao;
+
+import com.jeeplus.common.persistence.CrudDao;
+import com.jeeplus.common.persistence.annotation.MyBatisDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceReturn;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 退票管理DAO接口
+ * @author lw
+ * @version 2018-06-15
+ */
+@MyBatisDao
+public interface FilialeWorkInvoiceReturnDao extends CrudDao<FilialeWorkInvoiceReturn> {
+    /**
+     * 更新流程实例ID
+     * @return
+     */
+    public int updateProcessInstanceId(FilialeWorkInvoiceReturn workInvoiceReturn);
+
+    /**
+     * 根据流程实例ID获取
+     * @param processInstanceId
+     * @return
+     */
+    public FilialeWorkInvoiceReturn getByProcessInstanceId(String processInstanceId);
+
+    int countByNumAndComp(@Param("invoiceNum") String invoiceNum, @Param("comId") String comId);
+}

+ 781 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoice.java

@@ -0,0 +1,781 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
+import com.jeeplus.modules.sys.entity.Area;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 开票管理Entity
+ * @author
+ * @version
+ */
+public class FilialeWorkInvoice extends ActEntity<FilialeWorkInvoice> {
+
+    public static final String SERIAL_BIZCODE = "3";//编号模板类型
+
+	private static final long serialVersionUID = 1L;
+	private String number;		// 发票申请编号
+	private String processInstanceId; // 流程实例编号
+	private WorkClientInfo client;		// 实际开票单位
+	private ProjectRecords project;		// 开票项目(来源项目登记)
+	private String projectName;		// 项目名称
+	private String reportNumber;		// 报告号
+	private Double money;		// 价税合计
+	private String moneyStr;		// 价税合计(String)
+	private String invoiceType;		// 发票类型
+	private String invoiceTypeStr;		// 发票类型Str
+	private String chargeType;		// 收款类型
+	private String billingContent;		// 开票内容
+	private String content;		// 开票内容要求
+	private User drawer;		// 开票经办人(暂时弃用)
+	private Office office;		// 所属部门
+	private Integer invoiceNumber;		// 发票编号(暂时弃用)
+	private Date invoiceDate;		// 开票日期
+	private Date takeDate;          //领票日期
+	private String drawerName;      //开票人(发票管理员名称)
+	private String invoiceRemarks;		// 开票备注
+	private String isInvoice;		// 是否开票
+	private String isCharge;		// 是否收款
+	private String isInvalid;		// 是否作废
+	private String invoiceState;    //发票状态
+	private String orUnicode;       //纳税人识别号
+	private String address;         //地址
+	private String telephone;        //电话
+	private String bank;              //开户银行
+	private String bankNumber;        //银行账号
+	private String cancleReason; //作废原因
+	private String companyId; //提交人的公司编号
+	private String officeId;
+	private String officeName;
+	private String submitterId;		// 发票登记人id
+	private String submitterName;		// 发票登记人名称
+	private String ext;//1总公司-上级公司0分公司-本公司
+	private String contractDate;
+	private String province; //省份
+	private String home;
+	private Date beginContractDate;		// 开始
+	private Date endContractDate;		// 结束
+	private Date receiptMoneyDate;		// 收款日期
+	private String receiptMoney;		// 是否收款
+	private String cancellation;		// 作废判断
+	private String adminFlag;		// 管理员判断
+	private String cancellationRemark;		// 作废原因
+	private List<FilialeWorkInvoiceDetail> workAccountList = Lists.newArrayList();//发票明细
+	private List<FilialeWorkInvoiceReceipt> workReceiptList;//收款明细
+	private List<FilialeWorkInvoiceProjectRelation> workInvoiceProjectRelationList;//开票和项目关系表
+	private Integer notifyFlag; //代办判定条件
+	private String notifyId; //代办判定条件
+	private String widNumber; //发票号
+	private String widTotalMoney; //发票金额
+	private Double widTotalMoneyD; //发票金额
+	private Area area = new Area();		// 对账地区
+
+
+	private String accountCheckingUserId; //对账人id
+	private String accountCheckingUserName; //对账人名称
+	private List<Workattachment> workAttachments;//附件
+
+	private Integer projectFlag ;	//1:项目,0:非项目
+	private Date receiptBeginDate ;	//收款开始时间
+	private Date receiptEndDate ;	//收款结束时间
+
+	private String newDrawer;    		//开票人状态
+	private String newDrawerId;    		//开票人id
+	private String newDrawerName;    	//开票人名称
+	private String actualDrawerId;    		//实际开票人id
+	private String actualDrawerEmailAddress;    		//实际开票人邮箱
+	private String actualDrawerName;    	//实际开票人名称
+	private String proceedsMoney;    	//收款总收入
+	private String noProceedsMoney;    	//剩余应收款费用
+	private Integer workReceiptCount;    	//收款数据量
+	private Double receiptMoneyD; //已收款金额
+	private Double notReceiptMoneyD; //未收款金额
+	@Override
+	@ExcelField(title="经办人", fieldType=User.class, value="createBy.name", align=2, sort=7)
+	public User getCreateBy() {
+		return createBy;
+	}
+
+	@Override
+	public void setCreateBy(User createBy) {
+		this.createBy = createBy;
+	}
+
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public String getCancleReason() {
+		return cancleReason;
+	}
+
+	public void setCancleReason(String cancleReason) {
+		this.cancleReason = cancleReason;
+	}
+
+	public String getBank() {
+		return bank;
+	}
+
+	public void setBank(String bank) {
+		this.bank = bank;
+	}
+
+	public String getBankNumber() {
+		return bankNumber;
+	}
+
+	public void setBankNumber(String bankNumber) {
+		this.bankNumber = bankNumber;
+	}
+
+	@ExcelField(title="发票状态", align=2, sort=17 ,dictType = "invoice_audit_state")
+	public String getInvoiceState() {
+		return invoiceState;
+	}
+
+	public void setInvoiceState(String invoiceState) {
+		this.invoiceState = invoiceState;
+	}
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public Date getTakeDate() {
+		return takeDate;
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public Date getBeginContractDate() {
+		return beginContractDate;
+	}
+
+	public void setBeginContractDate(Date beginContractDate) {
+		this.beginContractDate = beginContractDate;
+	}
+
+	public Date getEndContractDate() {
+		return endContractDate;
+	}
+
+	public void setEndContractDate(Date endContractDate) {
+		this.endContractDate = endContractDate;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+
+	public void setTakeDate(Date takeDate) {
+		this.takeDate = takeDate;
+	}
+
+
+	@ExcelField(title="开票人", align=2, sort=9)
+	public String getDrawerName() {
+		return drawerName;
+	}
+
+	public void setDrawerName(String drawerName) {
+		this.drawerName = drawerName;
+	}
+
+	public FilialeWorkInvoice() {
+		super();
+	}
+
+	public FilialeWorkInvoice(String id){
+		super(id);
+	}
+
+	@ExcelField(title="开票号", align=2, sort=3)
+	public String getNumber() {
+		return number;
+	}
+
+	public String getContractDate() {
+		return contractDate;
+	}
+
+	public void setContractDate(String contractDate) {
+		this.contractDate = contractDate;
+	}
+
+	public void setNumber(String number) {
+		this.number = number;
+	}
+
+	@ExcelField(title="开票单位", fieldType=WorkClientInfo.class, value="client.name",align=2, sort=5)
+	public WorkClientInfo getClient() {
+		return client;
+	}
+
+	public void setClient(WorkClientInfo client) {
+		this.client = client;
+	}
+
+	@ExcelField(title="项目名称",align=2, sort=1)
+	public String getProjectName() {
+		return projectName;
+	}
+
+	public ProjectRecords getProject() {
+		return project;
+	}
+
+	public List<FilialeWorkInvoiceDetail> getWorkAccountList() {
+		return workAccountList;
+	}
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public void setWorkAccountList(List<FilialeWorkInvoiceDetail> workAccountList) {
+		this.workAccountList = workAccountList;
+	}
+
+	@ExcelField(title="纳税人识别号",align=2, sort=6)
+	public String getOrUnicode() {
+		return orUnicode;
+	}
+
+	public void setOrUnicode(String orUnicode) {
+		this.orUnicode = orUnicode;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+	public String getTelephone() {
+		return telephone;
+	}
+
+	public void setTelephone(String telephone) {
+		this.telephone = telephone;
+	}
+
+	public void setProject(ProjectRecords project) {
+		this.project = project;
+	}
+
+	public void setProjectName(String projectName) {
+		this.projectName = projectName;
+	}
+
+
+	public Double getMoney() {
+		return money;
+	}
+
+	public void setMoney(Double money) {
+		this.money = money;
+	}
+
+	@ExcelField(title="开票总金额", align=2, sort=10)
+	public String getMoneyStr() {
+		return moneyStr;
+	}
+
+	public void setMoneyStr(String moneyStr) {
+		this.moneyStr = moneyStr;
+	}
+
+	@ExcelField(title="发票类型", dictType="invoice_type", align=2, sort=13)
+	public String getInvoiceType() {
+		return invoiceType;
+	}
+
+	public void setInvoiceType(String invoiceType) {
+		this.invoiceType = invoiceType;
+	}
+
+	@ExcelField(title="收款类型", dictType="charge_type", align=2, sort=14)
+	public String getChargeType() {
+		return chargeType;
+	}
+
+	public void setChargeType(String chargeType) {
+		this.chargeType = chargeType;
+	}
+
+
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+
+	public User getDrawer() {
+		return drawer;
+	}
+
+	public void setDrawer(User drawer) {
+		this.drawer = drawer;
+	}
+
+	@ExcelField(title="经办人部门", fieldType=Office.class, value="office.name", align=2, sort=8)
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+
+
+	public Integer getInvoiceNumber() {
+		return invoiceNumber;
+	}
+
+	public void setInvoiceNumber(Integer invoiceNumber) {
+		this.invoiceNumber = invoiceNumber;
+	}
+
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="开票日期", align=2, sort=15)
+	public Date getInvoiceDate() {
+		return invoiceDate;
+	}
+
+	public void setInvoiceDate(Date invoiceDate) {
+		this.invoiceDate = invoiceDate;
+	}
+
+	//@ExcelField(title="开票备注", align=2, sort=13)
+	public String getInvoiceRemarks() {
+		return invoiceRemarks;
+	}
+
+	public void setInvoiceRemarks(String invoiceRemarks) {
+		this.invoiceRemarks = invoiceRemarks;
+	}
+
+	//@ExcelField(title="是否开票", align=2, sort=14)
+	public String getIsInvoice() {
+		return isInvoice;
+	}
+
+	public void setIsInvoice(String isInvoice) {
+		this.isInvoice = isInvoice;
+	}
+
+
+	public String getIsCharge() {
+		return isCharge;
+	}
+
+	public void setIsCharge(String isCharge) {
+		this.isCharge = isCharge;
+	}
+
+	//@ExcelField(title="是否作废", align=2, sort=16)
+	public String getIsInvalid() {
+		return isInvalid;
+	}
+
+	public void setIsInvalid(String isInvalid) {
+		this.isInvalid = isInvalid;
+	}
+
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public String getExt() {
+		return ext;
+	}
+
+	public void setExt(String ext) {
+		this.ext = ext;
+	}
+
+	@ExcelField(title="开票内容", mainDictType="billing_content", align=2, sort=12)
+	public String getBillingContent() {
+		return billingContent;
+	}
+
+	public void setBillingContent(String billingContent) {
+		this.billingContent = billingContent;
+	}
+
+	public String getInvoiceTypeStr() {
+		return invoiceTypeStr;
+	}
+
+	public void setInvoiceTypeStr(String invoiceTypeStr) {
+		this.invoiceTypeStr = invoiceTypeStr;
+	}
+
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="收款日期", align=2, sort=16)
+	public Date getReceiptMoneyDate() {
+		return receiptMoneyDate;
+	}
+
+	public void setReceiptMoneyDate(Date receiptMoneyDate) {
+		this.receiptMoneyDate = receiptMoneyDate;
+	}
+
+	@ExcelField(title="是否收款", align=2, sort=18)
+	public String getReceiptMoney() {
+		return receiptMoney;
+	}
+
+	public void setReceiptMoney(String receiptMoney) {
+		this.receiptMoney = receiptMoney;
+	}
+
+	public String getCancellation() {
+		return cancellation;
+	}
+
+	public void setCancellation(String cancellation) {
+		this.cancellation = cancellation;
+	}
+
+	public String getAdminFlag() {
+		return adminFlag;
+	}
+
+	public void setAdminFlag(String adminFlag) {
+		this.adminFlag = adminFlag;
+	}
+
+	public String getCancellationRemark() {
+		return cancellationRemark;
+	}
+
+	public void setCancellationRemark(String cancellationRemark) {
+		this.cancellationRemark = cancellationRemark;
+	}
+
+	public String getOfficeName() {
+		return officeName;
+	}
+
+	public void setOfficeName(String officeName) {
+		this.officeName = officeName;
+	}
+
+	public String getSubmitterId() {
+		return submitterId;
+	}
+
+	public void setSubmitterId(String submitterId) {
+		this.submitterId = submitterId;
+	}
+
+	public String getSubmitterName() {
+		return submitterName;
+	}
+
+	public void setSubmitterName(String submitterName) {
+		this.submitterName = submitterName;
+	}
+
+	public List<FilialeWorkInvoiceReceipt> getWorkReceiptList() {
+		return workReceiptList;
+	}
+
+	public void setWorkReceiptList(List<FilialeWorkInvoiceReceipt> workReceiptList) {
+		this.workReceiptList = workReceiptList;
+	}
+
+	public Integer getNotifyFlag() {
+		return notifyFlag;
+	}
+
+	public void setNotifyFlag(Integer notifyFlag) {
+		this.notifyFlag = notifyFlag;
+	}
+
+	public String getNotifyId() {
+		return notifyId;
+	}
+
+	public void setNotifyId(String notifyId) {
+		this.notifyId = notifyId;
+	}
+
+	public List<FilialeWorkInvoiceProjectRelation> getWorkInvoiceProjectRelationList() {
+		return workInvoiceProjectRelationList;
+	}
+
+	public void setWorkInvoiceProjectRelationList(List<FilialeWorkInvoiceProjectRelation> workInvoiceProjectRelationList) {
+		this.workInvoiceProjectRelationList = workInvoiceProjectRelationList;
+	}
+
+	public String getAccountCheckingUserId() {
+		return accountCheckingUserId;
+	}
+
+	public void setAccountCheckingUserId(String accountCheckingUserId) {
+		this.accountCheckingUserId = accountCheckingUserId;
+	}
+
+	public String getAccountCheckingUserName() {
+		return accountCheckingUserName;
+	}
+
+	public void setAccountCheckingUserName(String accountCheckingUserName) {
+		this.accountCheckingUserName = accountCheckingUserName;
+	}
+
+	@ExcelField(title="发票编号", align=2, sort=4)
+	public String getWidNumber() {
+		return widNumber;
+	}
+
+	public void setWidNumber(String widNumber) {
+		this.widNumber = widNumber;
+	}
+	@ExcelField(title="发票金额", align=2, sort=11)
+	public String getWidTotalMoney() {
+		return widTotalMoney;
+	}
+
+	public void setWidTotalMoney(String widTotalMoney) {
+		this.widTotalMoney = widTotalMoney;
+	}
+
+	public Area getArea() {
+		return area;
+	}
+
+	public void setArea(Area area) {
+		this.area = area;
+	}
+
+	public List<Workattachment> getWorkAttachments() {
+		return workAttachments;
+	}
+
+	public void setWorkAttachments(List<Workattachment> workAttachments) {
+		this.workAttachments = workAttachments;
+	}
+
+	@ExcelField(title="报告号", align=2, sort=2)
+	public String getReportNumber() {
+		return reportNumber;
+	}
+
+	public void setReportNumber(String reportNumber) {
+		this.reportNumber = reportNumber;
+	}
+
+	public Integer getProjectFlag() {
+		return projectFlag;
+	}
+
+	public void setProjectFlag(Integer projectFlag) {
+		this.projectFlag = projectFlag;
+	}
+
+	public Date getReceiptBeginDate() {
+		return receiptBeginDate;
+	}
+
+	public void setReceiptBeginDate(Date receiptBeginDate) {
+		this.receiptBeginDate = receiptBeginDate;
+	}
+
+	public Date getReceiptEndDate() {
+		return receiptEndDate;
+	}
+
+	public void setReceiptEndDate(Date receiptEndDate) {
+		this.receiptEndDate = receiptEndDate;
+	}
+
+	public String getNewDrawerId() {
+		return newDrawerId;
+	}
+
+	public void setNewDrawerId(String newDrawerId) {
+		this.newDrawerId = newDrawerId;
+	}
+
+	public String getNewDrawerName() {
+		return newDrawerName;
+	}
+
+	public void setNewDrawerName(String newDrawerName) {
+		this.newDrawerName = newDrawerName;
+	}
+
+	public String getNewDrawer() {
+		return newDrawer;
+	}
+
+	public void setNewDrawer(String newDrawer) {
+		this.newDrawer = newDrawer;
+	}
+
+	public String getActualDrawerId() {
+		return actualDrawerId;
+	}
+
+	public void setActualDrawerId(String actualDrawerId) {
+		this.actualDrawerId = actualDrawerId;
+	}
+
+	public String getActualDrawerEmailAddress() {
+		return actualDrawerEmailAddress;
+	}
+
+	public void setActualDrawerEmailAddress(String actualDrawerEmailAddress) {
+		this.actualDrawerEmailAddress = actualDrawerEmailAddress;
+	}
+
+	public String getActualDrawerName() {
+		return actualDrawerName;
+	}
+
+	public void setActualDrawerName(String actualDrawerName) {
+		this.actualDrawerName = actualDrawerName;
+	}
+
+	public String getProceedsMoney() {
+		return proceedsMoney;
+	}
+
+	public void setProceedsMoney(String proceedsMoney) {
+		this.proceedsMoney = proceedsMoney;
+	}
+
+	public String getNoProceedsMoney() {
+		return noProceedsMoney;
+	}
+
+	public void setNoProceedsMoney(String noProceedsMoney) {
+		this.noProceedsMoney = noProceedsMoney;
+	}
+
+	public Integer getWorkReceiptCount() {
+		return workReceiptCount;
+	}
+
+	public void setWorkReceiptCount(Integer workReceiptCount) {
+		this.workReceiptCount = workReceiptCount;
+	}
+
+	public Double getWidTotalMoneyD() {
+		return widTotalMoneyD;
+	}
+
+	public void setWidTotalMoneyD(Double widTotalMoneyD) {
+		this.widTotalMoneyD = widTotalMoneyD;
+	}
+
+	public Double getReceiptMoneyD() {
+		return receiptMoneyD;
+	}
+
+	public void setReceiptMoneyD(Double receiptMoneyD) {
+		this.receiptMoneyD = receiptMoneyD;
+	}
+
+	public Double getNotReceiptMoneyD() {
+		return notReceiptMoneyD;
+	}
+
+	public void setNotReceiptMoneyD(Double notReceiptMoneyD) {
+		this.notReceiptMoneyD = notReceiptMoneyD;
+	}
+}

+ 430 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceAlter.java

@@ -0,0 +1,430 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 开票管理Entity
+ * @author
+ * @version
+ */
+public class FilialeWorkInvoiceAlter extends ActEntity<FilialeWorkInvoiceAlter> {
+
+    public static final String SERIAL_BIZCODE = "3";//编号模板类型
+
+	private static final long serialVersionUID = 1L;
+	private String number;		// 发票申请编号
+	private String processInstanceId; // 流程实例编号
+	private WorkClientInfo client;		// 实际开票单位
+	private ProjectRecords project;		// 开票项目(来源项目登记)
+	private String projectName;		// 项目名称
+	private Double money;		// 价税合计
+	private String invoiceType;		// 发票类型
+	private String chargeType;		// 收款类型
+	private String content;		// 开票内容要求
+	private User drawer;		// 开票经办人(暂时弃用)
+	private Office office;		// 所属部门
+	private Integer invoiceNumber;		// 发票编号(暂时弃用)
+	private Date invoiceDate;		// 开票日期
+	private Date takeDate;          //领票日期
+	private String drawerName;      //开票人(发票管理员名称)
+	private String invoiceRemarks;		// 开票备注
+	private String isInvoice;		// 是否开票
+	private String isCharge;		// 是否收款
+	private String isInvalid;		// 是否作废
+	private String invoiceState;    //发票状态
+	private String orUnicode;       //纳税人识别号
+	private String address;         //地址
+	private String telephone;        //电话
+	private String bank;              //开户银行
+	private String bankNumber;        //银行账号
+	private String cancleReason; //作废原因
+	private String companyId; //提交人的公司编号
+	private String officeId;
+	private String ext;//1总公司0分公司
+	private String contractDate;
+	private String province; //省份
+	private String home;
+	private FilialeWorkInvoice workInvoice;     //变更前数据主键
+	private Date beginContractDate;		// 开始
+	private Date endContractDate;		// 结束
+	private List<FilialeWorkInvoiceDetail> workAccountList = Lists.newArrayList();//发票明细
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+
+	public String getCancleReason() {
+		return cancleReason;
+	}
+
+	public void setCancleReason(String cancleReason) {
+		this.cancleReason = cancleReason;
+	}
+
+	public String getBank() {
+		return bank;
+	}
+
+	public void setBank(String bank) {
+		this.bank = bank;
+	}
+
+	public String getBankNumber() {
+		return bankNumber;
+	}
+
+	public void setBankNumber(String bankNumber) {
+		this.bankNumber = bankNumber;
+	}
+
+	@ExcelField(title="发票状态", align=2, sort=12)
+	public String getInvoiceState() {
+		return invoiceState;
+	}
+
+	public void setInvoiceState(String invoiceState) {
+		this.invoiceState = invoiceState;
+	}
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public Date getTakeDate() {
+		return takeDate;
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+
+	public void setTakeDate(Date takeDate) {
+		this.takeDate = takeDate;
+	}
+
+	public String getDrawerName() {
+		return drawerName;
+	}
+
+	public void setDrawerName(String drawerName) {
+		this.drawerName = drawerName;
+	}
+
+	public FilialeWorkInvoiceAlter() {
+		super();
+	}
+
+	public Date getBeginContractDate() {
+		return beginContractDate;
+	}
+
+	public void setBeginContractDate(Date beginContractDate) {
+		this.beginContractDate = beginContractDate;
+	}
+
+	public Date getEndContractDate() {
+		return endContractDate;
+	}
+
+	public void setEndContractDate(Date endContractDate) {
+		this.endContractDate = endContractDate;
+	}
+
+	public FilialeWorkInvoiceAlter(String id){
+		super(id);
+	}
+
+	@ExcelField(title="开票号", align=2, sort=1)
+	public String getNumber() {
+		return number;
+	}
+
+	public String getContractDate() {
+		return contractDate;
+	}
+
+	public void setContractDate(String contractDate) {
+		this.contractDate = contractDate;
+	}
+
+	public void setNumber(String number) {
+		this.number = number;
+	}
+	
+	@ExcelField(title="开票单位", fieldType=WorkClientInfo.class, value="client.name",align=2, sort=4)
+	public WorkClientInfo getClient() {
+		return client;
+	}
+
+	public void setClient(WorkClientInfo client) {
+		this.client = client;
+	}
+
+	public FilialeWorkInvoice getWorkInvoice() {
+		return workInvoice;
+	}
+
+	public void setWorkInvoice(FilialeWorkInvoice workInvoice) {
+		this.workInvoice = workInvoice;
+	}
+
+	@ExcelField(title="项目名称",align=2, sort=2)
+	public String getProjectName() {
+		return projectName;
+	}
+
+	public ProjectRecords getProject() {
+		return project;
+	}
+
+	public List<FilialeWorkInvoiceDetail> getWorkAccountList() {
+		return workAccountList;
+	}
+
+	public String getProvince() {
+		return province;
+	}
+
+	public void setProvince(String province) {
+		this.province = province;
+	}
+
+	public void setWorkAccountList(List<FilialeWorkInvoiceDetail> workAccountList) {
+		this.workAccountList = workAccountList;
+	}
+
+	public void setProject(ProjectRecords project) {
+		this.project = project;
+	}
+
+	public void setProjectName(String projectName) {
+		this.projectName = projectName;
+	}
+
+	public String getOrUnicode() {
+		return orUnicode;
+	}
+
+	public void setOrUnicode(String orUnicode) {
+		this.orUnicode = orUnicode;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+	public String getTelephone() {
+		return telephone;
+	}
+
+	public void setTelephone(String telephone) {
+		this.telephone = telephone;
+	}
+
+	@ExcelField(title="开票金额", align=2, sort=7)
+	public Double getMoney() {
+		return money;
+	}
+
+	public void setMoney(Double money) {
+		this.money = money;
+	}
+	
+	@ExcelField(title="发票类型", dictType="invoice_type", align=2, sort=10)
+	public String getInvoiceType() {
+		return invoiceType;
+	}
+
+	public void setInvoiceType(String invoiceType) {
+		this.invoiceType = invoiceType;
+	}
+	
+	@ExcelField(title="收款类型", dictType="charge_type", align=2, sort=9)
+	public String getChargeType() {
+		return chargeType;
+	}
+
+	public void setChargeType(String chargeType) {
+		this.chargeType = chargeType;
+	}
+	
+	@ExcelField(title="开票内容", dictType="invoice_type", align=2, sort=8)
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+	
+	@ExcelField(title="开票经办人", fieldType=User.class, value="drawer.name", align=2, sort=5)
+	public User getDrawer() {
+		return drawer;
+	}
+
+	public void setDrawer(User drawer) {
+		this.drawer = drawer;
+	}
+	
+	@ExcelField(title="开票经办人部门", fieldType=Office.class, value="office.name", align=2, sort=6)
+	public Office getOffice() {
+		return office;
+	}
+
+	public void setOffice(Office office) {
+		this.office = office;
+	}
+	
+	@ExcelField(title="发票编号", align=2, sort=3)
+	public Integer getInvoiceNumber() {
+		return invoiceNumber;
+	}
+
+	public void setInvoiceNumber(Integer invoiceNumber) {
+		this.invoiceNumber = invoiceNumber;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="开票日期", align=2, sort=11)
+	public Date getInvoiceDate() {
+		return invoiceDate;
+	}
+
+	public void setInvoiceDate(Date invoiceDate) {
+		this.invoiceDate = invoiceDate;
+	}
+	
+	//@ExcelField(title="开票备注", align=2, sort=13)
+	public String getInvoiceRemarks() {
+		return invoiceRemarks;
+	}
+
+	public void setInvoiceRemarks(String invoiceRemarks) {
+		this.invoiceRemarks = invoiceRemarks;
+	}
+	
+	//@ExcelField(title="是否开票", align=2, sort=14)
+	public String getIsInvoice() {
+		return isInvoice;
+	}
+
+	public void setIsInvoice(String isInvoice) {
+		this.isInvoice = isInvoice;
+	}
+	
+	@ExcelField(title="收款状态", align=2, sort=13)
+	public String getIsCharge() {
+		return isCharge;
+	}
+
+	public void setIsCharge(String isCharge) {
+		this.isCharge = isCharge;
+	}
+	
+	//@ExcelField(title="是否作废", align=2, sort=16)
+	public String getIsInvalid() {
+		return isInvalid;
+	}
+
+	public void setIsInvalid(String isInvalid) {
+		this.isInvalid = isInvalid;
+	}
+
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	public String getExt() {
+		return ext;
+	}
+
+	public void setExt(String ext) {
+		this.ext = ext;
+	}
+}

+ 552 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceDetail.java

@@ -0,0 +1,552 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workinvoice.entity.WorkInvoice;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * 发票明细Entity
+ * @author lw
+ * @version 2018-05-09
+ */
+public class FilialeWorkInvoiceDetail extends ActEntity<FilialeWorkInvoiceDetail> {
+	public static final String SERIAL_BIZCODE = "4";//编号模板类型
+
+	private static final long serialVersionUID = 1L;
+	private String number;		// 发票号
+	private String code;         //发票代码
+	private String totalMoney;		// 价税合计
+    @JsonIgnore
+	private String totalMoneyStr;		// 价税合计
+	private String tax;		// 税率
+	private String taxMoney;		// 金额 开票金额
+    @JsonIgnore
+	private String taxMoneyStr;		// 金额 开票金额
+	private String taxRate;		// 税额
+    @JsonIgnore
+	private String taxRateStr;		// 税额
+	private String incomeMoney;		// 登记金额 收款金额
+    @JsonIgnore
+	private String incomeMoneyStr;		// 登记金额 收款金额
+	private String state;		// 发票状态
+	private String backSign;		// 被退标记
+	private String backNumber;		// 被退票号
+	private String backCode;        //被退代码
+	private Date date;		// 开票日期
+	private String invoiceId;		// 发票主键
+	private String ainvoiceId;       //变更发票主键
+	private String sign;       //操作标记
+	private FilialeWorkInvoice workInvoice; //发票
+    private String[] exclusiveIds;
+    private String comId;
+    private String officeId;
+	private String home;
+	private String settleFlag;
+	private Date beginContractDate;		// 开始
+	private Date endContractDate;		// 结束
+	private String returnNumbers;       //作废-申请编号
+	private String returnId;             //作废-原明细Id
+	//导出功能-属性
+	private String invoiceExt;//0分公司开票 1总公司开票
+	private String invoiceInvoiceType;  //发票类型1专票2普票
+	private String invoiceClientName;   //实际开票单位
+	private String invoiceOrUnicode;    //纳税人识别号
+	private String invoiceContent;      //开票内容要求
+	private String invoiceRemarks;      //备注
+	private String invocieNumber;      //申请编号
+	private String invoiceDrawerName;  //开票人
+	private String invoiceOfficeName;  //所属部门
+	private String contractNum ;       //合同编号
+	private String contractName;       //合同名称
+	private String contractClientName; //主委托方
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+    /*暂弃*/
+	private String returnNumber;     //退票申请编号
+	private String returnReason;     //退票原因
+	private String returnCancle;     //作废退票(1退票2作废)
+	private String returnSign;      //原票是否退回(1是2否)
+	private Date returnDate;         //退票时间
+	private String returnUser;       //退票人
+	private String processInstanceId; // 流程实例编号
+	private String status;             //状态
+
+	public FilialeWorkInvoiceDetail() {
+		super();
+	}
+
+	public FilialeWorkInvoiceDetail(String id){
+		super(id);
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+	@ExcelField(title="发票代码", align=2, sort=6)
+	public String getCode() {
+		return code;
+	}
+
+	@ExcelField(title="发票号", align=2, sort=7)
+	public String getNumber() {
+		return number;
+	}
+
+
+	public String getTotalMoney() {
+		return totalMoney;
+	}
+	@ExcelField(title="价税合计", align=2, sort=8)
+	public String getTotalMoneyStr() {
+		return UserUtils.getDecimalFormat(new BigDecimal(this.totalMoney));
+	}
+	@ExcelField(title="税率", align=2, sort=9)
+	public String getTax() {
+		return tax;
+	}
+
+
+	public String getTaxMoney() {
+		return taxMoney;
+	}
+	@ExcelField(title="金额", align=2, sort=10)
+	public String getTaxMoneyStr() {
+		return UserUtils.getDecimalFormat(new BigDecimal(this.taxMoney));
+	}
+	@ExcelField(title="税额", align=2, sort=11)
+	public String getTaxRateStr() {
+		return UserUtils.getDecimalFormat(new BigDecimal(this.taxRate));
+	}
+
+	public String getTaxRate() {
+		return taxRate;
+	}
+
+	public String getReturnId() {
+		return returnId;
+	}
+
+	public void setReturnId(String returnId) {
+		this.returnId = returnId;
+	}
+
+	public String getIncomeMoney() {
+		return incomeMoney;
+	}
+	@ExcelField(title="累计登记金额", align=2, sort=12)
+	public String getIncomeMoneyStr() {
+		return UserUtils.getDecimalFormat(new BigDecimal(this.incomeMoney));
+	}
+	@ExcelField(title="开票日期", align=2, sort=13)
+	public Date getDate() {
+		return date;
+	}
+
+	@ExcelField(title="总/分公司开票", align=2, sort=14,dictType = "ext_type")
+	public String getInvoiceExt() { return invoiceExt; }
+
+	@ExcelField(title="发票类型", align=2, sort=15,dictType = "invoice_type")
+	public String getInvoiceInvoiceType() { return invoiceInvoiceType; }
+
+	@ExcelField(title="实际开票单位", align=2, sort=16)
+	public String getInvoiceClientName() { return invoiceClientName; }
+
+	@ExcelField(title="纳税人识别号", align=2, sort=17)
+	public String getInvoiceOrUnicode() { return invoiceOrUnicode; }
+
+	@ExcelField(title="开票内容要求", align=2, sort=18)
+	public String getInvoiceContent() { return invoiceContent; }
+
+	public String getReturnNumbers() {
+		return returnNumbers;
+	}
+
+	public void setReturnNumbers(String returnNumbers) {
+		this.returnNumbers = returnNumbers;
+	}
+
+	public String getBackCode() {
+		return backCode;
+	}
+
+	public void setBackCode(String backCode) {
+		this.backCode = backCode;
+	}
+
+	@ExcelField(title="备注", align=2, sort=19)
+	public String getInvoiceRemarks() { return invoiceRemarks; }
+
+	@ExcelField(title="发票状态", align=2, sort=20)
+	public String getState() {
+		return state;
+	}
+
+	@ExcelField(title="被退标记", align=2, sort=21)
+	public String getBackSign() {
+		return backSign;
+	}
+
+	@ExcelField(title="被退票号", align=2, sort=22)
+	public String getBackNumber() {
+		return backNumber;
+	}
+
+	@ExcelField(title="申请编号", align=2, sort=23)
+	public String getInvocieNumber() { return invocieNumber; }
+
+	@ExcelField(title="开票人", align=2, sort=24)
+	public String getInvoiceDrawerName() { return invoiceDrawerName; }
+
+	@ExcelField(title="所属部门", align=2, sort=25)
+	public String getInvoiceOfficeName() { return invoiceOfficeName; }
+
+	@ExcelField(title="合同编号", align=2, sort=26)
+	public String getContractNum() { return contractNum; }
+
+	@ExcelField(title="合同名称", align=2, sort=27)
+	public String getContractName() { return contractName; }
+
+	@ExcelField(title="主委托方", align=2, sort=28)
+	public String getContractClientName() { return contractClientName; }
+
+	public void setNumber(String number) {
+		this.number = number;
+	}
+	
+	public void setTotalMoney(String totalMoney) {
+		this.totalMoney = totalMoney;
+	}
+	
+	public void setTax(String tax) {
+		this.tax = tax;
+	}
+
+	public void setTaxMoney(String taxMoney) {
+		this.taxMoney = taxMoney;
+	}
+
+	public void setTaxRate(String taxRate) {
+		this.taxRate = taxRate;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public void setInvoiceExt(String invoiceExt) {
+		this.invoiceExt = invoiceExt;
+	}
+
+	public void setInvoiceInvoiceType(String invoiceInvoiceType) {
+		this.invoiceInvoiceType = invoiceInvoiceType;
+	}
+
+	public void setInvoiceClientName(String invoiceClientName) {
+		this.invoiceClientName = invoiceClientName;
+	}
+
+	public void setInvoiceOrUnicode(String invoiceOrUnicode) {
+		this.invoiceOrUnicode = invoiceOrUnicode;
+	}
+
+	public void setInvoiceContent(String invoiceContent) {
+		this.invoiceContent = invoiceContent;
+	}
+
+
+
+	public void setInvoiceRemarks(String invoiceRemarks) {
+		this.invoiceRemarks = invoiceRemarks;
+	}
+
+
+
+	public void setInvocieNumber(String invocieNumber) {
+		this.invocieNumber = invocieNumber;
+	}
+
+
+
+	public void setInvoiceDrawerName(String invoiceDrawerName) {
+		this.invoiceDrawerName = invoiceDrawerName;
+	}
+
+
+
+	public void setInvoiceOfficeName(String invoiceOfficeName) {
+		this.invoiceOfficeName = invoiceOfficeName;
+	}
+
+
+	public void setContractNum(String contractNum) {
+		this.contractNum = contractNum;
+	}
+
+
+	public void setTaxMoneyStr(String taxMoneyStr) {
+		this.taxMoneyStr = taxMoneyStr;
+	}
+
+
+
+	public void setTaxRateStr(String taxRateStr) {
+		this.taxRateStr = taxRateStr;
+	}
+
+	public void setContractName(String contractName) {
+		this.contractName = contractName;
+	}
+
+
+
+	public void setTotalMoneyStr(String totalMoneyStr) {
+		this.totalMoneyStr = totalMoneyStr;
+	}
+
+
+	public void setIncomeMoneyStr(String incomeMoneyStr) {
+		this.incomeMoneyStr = incomeMoneyStr;
+	}
+
+	public void setContractClientName(String contractClientName) {
+		this.contractClientName = contractClientName;
+	}
+
+	public String getAinvoiceId() {
+		return ainvoiceId;
+	}
+
+	public void setAinvoiceId(String ainvoiceId) {
+		this.ainvoiceId = ainvoiceId;
+	}
+
+	public void setIncomeMoney(String incomeMoney) {
+		this.incomeMoney = incomeMoney;
+	}
+	
+
+
+	public void setState(String state) {
+		this.state = state;
+	}
+
+	public String getReturnNumber() {
+		return returnNumber;
+	}
+
+	public Date getBeginContractDate() {
+		return beginContractDate;
+	}
+
+	public void setBeginContractDate(Date beginContractDate) {
+		this.beginContractDate = beginContractDate;
+	}
+
+	public Date getEndContractDate() {
+		return endContractDate;
+	}
+
+	public void setEndContractDate(Date endContractDate) {
+		this.endContractDate = endContractDate;
+	}
+
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	public void setReturnNumber(String returnNumber) {
+		this.returnNumber = returnNumber;
+	}
+
+	public String getReturnReason() {
+		return returnReason;
+	}
+
+	public void setReturnReason(String returnReason) {
+		this.returnReason = returnReason;
+	}
+
+	public String getReturnCancle() {
+		return returnCancle;
+	}
+
+	public void setReturnCancle(String returnCancle) {
+		this.returnCancle = returnCancle;
+	}
+
+	public String getReturnSign() {
+		return returnSign;
+	}
+
+	public void setReturnSign(String returnSign) {
+		this.returnSign = returnSign;
+	}
+
+	public Date getReturnDate() {
+		return returnDate;
+	}
+
+	public void setReturnDate(Date returnDate) {
+		this.returnDate = returnDate;
+	}
+
+	public String getReturnUser() {
+		return returnUser;
+	}
+
+	public void setReturnUser(String returnUser) {
+		this.returnUser = returnUser;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+
+
+	public void setBackSign(String backSign) {
+		this.backSign = backSign;
+	}
+	
+
+
+	public void setBackNumber(String backNumber) {
+		this.backNumber = backNumber;
+	}
+
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getSign() {
+		return sign;
+	}
+
+	public void setSign(String sign) {
+		this.sign = sign;
+	}
+
+	public FilialeWorkInvoice getWorkInvoice() {
+		return workInvoice;
+	}
+
+	public void setWorkInvoice(FilialeWorkInvoice workInvoice) {
+		this.workInvoice = workInvoice;
+	}
+
+
+
+	public void setDate(Date date) {
+		this.date = date;
+	}
+	
+	public String getInvoiceId() {
+		return invoiceId;
+	}
+
+	public void setInvoiceId(String invoiceId) {
+		this.invoiceId = invoiceId;
+	}
+
+    public String[] getExclusiveIds() {
+        return exclusiveIds;
+    }
+
+    public void setExclusiveIds(String[] exclusiveIds) {
+        this.exclusiveIds = exclusiveIds;
+    }
+
+    public String getComId() {
+        return comId;
+    }
+
+    public void setComId(String comId) {
+        this.comId = comId;
+    }
+
+    public String getOfficeId() {
+        return officeId;
+    }
+
+    public void setOfficeId(String officeId) {
+        this.officeId = officeId;
+    }
+
+    public String getSettleFlag() {
+        return settleFlag;
+    }
+
+    public void setSettleFlag(String settleFlag) {
+        this.settleFlag = settleFlag;
+    }
+}

+ 110 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceProjectRelation.java

@@ -0,0 +1,110 @@
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+import com.jeeplus.common.persistence.DataEntity;
+
+/**
+ * 开票和项目关系表
+ * @author: 徐滕
+ * @create: 2021-05-11 15:44
+ **/
+public class FilialeWorkInvoiceProjectRelation extends DataEntity<FilialeWorkInvoice> {
+    private String invoiceId;       //开票编号
+    private String projectId;       //项目id
+    private String projectName;     //项目名称
+    private String workContractName;    //合同名称
+    private String projectNum;     //项目编号
+    private String clientName;  //委托方
+    private String reportDataNum;   //报告号
+    private Integer isProject;  //是否是项目开票
+    private String details;     //非项目-开票详情
+    private String contractId;     //非项目-合同id
+    private String invoiceState;     //开票状态
+
+    public String getInvoiceId() {
+        return invoiceId;
+    }
+
+    public void setInvoiceId(String invoiceId) {
+        this.invoiceId = invoiceId;
+    }
+
+    public String getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(String projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public String getWorkContractName() {
+        return workContractName;
+    }
+
+    public void setWorkContractName(String workContractName) {
+        this.workContractName = workContractName;
+    }
+
+    public String getProjectNum() {
+        return projectNum;
+    }
+
+    public void setProjectNum(String projectNum) {
+        this.projectNum = projectNum;
+    }
+
+    public String getClientName() {
+        return clientName;
+    }
+
+    public void setClientName(String clientName) {
+        this.clientName = clientName;
+    }
+
+    public String getReportDataNum() {
+        return reportDataNum;
+    }
+
+    public void setReportDataNum(String reportDataNum) {
+        this.reportDataNum = reportDataNum;
+    }
+
+    public Integer getIsProject() {
+        return isProject;
+    }
+
+    public void setIsProject(Integer isProject) {
+        this.isProject = isProject;
+    }
+
+    public String getDetails() {
+        return details;
+    }
+
+    public void setDetails(String details) {
+        this.details = details;
+    }
+
+    public String getContractId() {
+        return contractId;
+    }
+
+    public void setContractId(String contractId) {
+        this.contractId = contractId;
+    }
+
+    public String getInvoiceState() {
+        return invoiceState;
+    }
+
+    public void setInvoiceState(String invoiceState) {
+        this.invoiceState = invoiceState;
+    }
+}

+ 48 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceReceipt.java

@@ -0,0 +1,48 @@
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+import com.jeeplus.common.persistence.DataEntity;
+
+/**
+ * @author: 大猫
+ * @create: 2020-12-07 14:56
+ **/
+public class FilialeWorkInvoiceReceipt extends DataEntity<FilialeWorkInvoiceReceipt> {
+    private static final long serialVersionUID = 1L;
+
+    private String invoiceId;   //发票id
+    private String companyName;  //公司名称
+    private Double money;   //汇款金额
+    private String receiptDate;  //汇款时间
+
+    public String getInvoiceId() {
+        return invoiceId;
+    }
+
+    public void setInvoiceId(String invoiceId) {
+        this.invoiceId = invoiceId;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public Double getMoney() {
+        return money;
+    }
+
+    public void setMoney(Double money) {
+        this.money = money;
+    }
+
+    public String getReceiptDate() {
+        return receiptDate;
+    }
+
+    public void setReceiptDate(String receiptDate) {
+        this.receiptDate = receiptDate;
+    }
+}

+ 240 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceReturn.java

@@ -0,0 +1,240 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * 退票管理Entity
+ * @version 2018-06-15
+ * @author lw
+ */
+public class FilialeWorkInvoiceReturn extends ActEntity<FilialeWorkInvoiceReturn> {
+	public static final String SERIAL_BIZCODE = "4";//编号模板类型
+
+	private static final long serialVersionUID = 1L;
+	private String processInstanceId;		// 实例流程id
+	private String officeId;		// 部门id
+	private String companyId;		// 公司Id
+	private String status;		// 状态
+	private FilialeWorkInvoiceDetail invoiceDetail;		// 发票明细主键
+	private String returnNumber;      //退票申请编号
+	private String reason;		// 退票原因
+	private String cancleReturn;		// 作废/退票
+	private String returnType;		// 原票是否退回
+	private String code;		// 发票代码
+	private String number;		// 发票号
+	private String uname;		// 退票人
+	private Date returnDate;		// 退票日期
+	private String home;
+	private Date beginContractDate;		// 开始
+	private Date endContractDate;		// 结束
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public FilialeWorkInvoiceReturn() {
+		super();
+	}
+
+	public FilialeWorkInvoiceReturn(String id){
+		super(id);
+	}
+
+	@ExcelField(title="实例流程id", align=2, sort=7)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+	
+	@ExcelField(title="部门id", align=2, sort=8)
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+	
+	@ExcelField(title="公司Id", align=2, sort=9)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="状态", align=2, sort=10)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public FilialeWorkInvoiceDetail getInvoiceDetail() {
+		return invoiceDetail;
+	}
+
+	public void setInvoiceDetail(FilialeWorkInvoiceDetail invoiceDetail) {
+		this.invoiceDetail = invoiceDetail;
+	}
+
+	public String getReturnNumber() {
+		return returnNumber;
+	}
+
+	public void setReturnNumber(String returnNumber) {
+		this.returnNumber = returnNumber;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public Date getBeginContractDate() {
+		return beginContractDate;
+	}
+
+	public void setBeginContractDate(Date beginContractDate) {
+		this.beginContractDate = beginContractDate;
+	}
+
+	public Date getEndContractDate() {
+		return endContractDate;
+	}
+
+	public void setEndContractDate(Date endContractDate) {
+		this.endContractDate = endContractDate;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	@ExcelField(title="退票原因", align=2, sort=12)
+	public String getReason() {
+		return reason;
+	}
+
+	public void setReason(String reason) {
+		this.reason = reason;
+	}
+	
+	@ExcelField(title="作废/退票", align=2, sort=13)
+	public String getCancleReturn() {
+		return cancleReturn;
+	}
+
+	public void setCancleReturn(String cancleReturn) {
+		this.cancleReturn = cancleReturn;
+	}
+	
+	@ExcelField(title="原票是否退回", align=2, sort=14)
+	public String getReturnType() {
+		return returnType;
+	}
+
+	public void setReturnType(String returnType) {
+		this.returnType = returnType;
+	}
+	
+	@ExcelField(title="发票代码", align=2, sort=15)
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+	
+	@ExcelField(title="发票号", align=2, sort=16)
+	public String getNumber() {
+		return number;
+	}
+
+	public void setNumber(String number) {
+		this.number = number;
+	}
+	
+	@ExcelField(title="退票人", align=2, sort=17)
+	public String getUname() {
+		return uname;
+	}
+
+	public void setUname(String uname) {
+		this.uname = uname;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="退票日期", align=2, sort=18)
+	public Date getReturnDate() {
+		return returnDate;
+	}
+
+	public void setReturnDate(Date returnDate) {
+		this.returnDate = returnDate;
+	}
+	
+}

+ 249 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/entity/FilialeWorkInvoiceReturnAlter.java

@@ -0,0 +1,249 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.common.persistence.ActEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * 退票管理Entity
+ * @version 2018-06-15
+ * @author lw
+ */
+public class FilialeWorkInvoiceReturnAlter extends ActEntity<FilialeWorkInvoiceReturnAlter> {
+	public static final String SERIAL_BIZCODE = "4";//编号模板类型
+
+	private static final long serialVersionUID = 1L;
+	private String processInstanceId;		// 实例流程id
+	private String officeId;		// 部门id
+	private String companyId;		// 公司Id
+	private String status;		// 状态
+	private FilialeWorkInvoiceDetail invoiceDetail;		// 发票明细主键
+	private String returnNumber;      //退票申请编号
+	private String reason;		// 退票原因
+	private String cancleReturn;		// 作废/退票
+	private String returnType;		// 原票是否退回
+	private String code;		// 发票代码
+	private String number;		// 发票号
+	private String uname;		// 退票人
+	private Date returnDate;		// 退票日期
+	private String home;
+	private FilialeWorkInvoiceReturn workInvoiceReturn;      //变更前数据
+	private Date beginContractDate;		// 开始
+	private Date endContractDate;		// 结束
+	// 流程任务
+	private Task task;
+	private Map<String, Object> variables;
+	// 运行中的流程实例
+	private ProcessInstance processInstance;
+	// 历史的流程实例
+	private HistoricProcessInstance historicProcessInstance;
+	// 流程定义
+	private ProcessDefinition processDefinition;
+
+	public FilialeWorkInvoiceReturnAlter() {
+		super();
+	}
+
+	public FilialeWorkInvoiceReturnAlter(String id){
+		super(id);
+	}
+
+	@ExcelField(title="实例流程id", align=2, sort=7)
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+	
+	@ExcelField(title="部门id", align=2, sort=8)
+	public String getOfficeId() {
+		return officeId;
+	}
+
+	public void setOfficeId(String officeId) {
+		this.officeId = officeId;
+	}
+	
+	@ExcelField(title="公司Id", align=2, sort=9)
+	public String getCompanyId() {
+		return companyId;
+	}
+
+	public void setCompanyId(String companyId) {
+		this.companyId = companyId;
+	}
+	
+	@ExcelField(title="状态", align=2, sort=10)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public FilialeWorkInvoiceDetail getInvoiceDetail() {
+		return invoiceDetail;
+	}
+
+	public Date getBeginContractDate() {
+		return beginContractDate;
+	}
+
+	public void setBeginContractDate(Date beginContractDate) {
+		this.beginContractDate = beginContractDate;
+	}
+
+	public Date getEndContractDate() {
+		return endContractDate;
+	}
+
+	public void setEndContractDate(Date endContractDate) {
+		this.endContractDate = endContractDate;
+	}
+
+	public void setInvoiceDetail(FilialeWorkInvoiceDetail invoiceDetail) {
+		this.invoiceDetail = invoiceDetail;
+	}
+
+	public String getReturnNumber() {
+		return returnNumber;
+	}
+
+	public FilialeWorkInvoiceReturn getWorkInvoiceReturn() {
+		return workInvoiceReturn;
+	}
+
+	public void setWorkInvoiceReturn(FilialeWorkInvoiceReturn workInvoiceReturn) {
+		this.workInvoiceReturn = workInvoiceReturn;
+	}
+
+	public void setReturnNumber(String returnNumber) {
+		this.returnNumber = returnNumber;
+	}
+
+	public Task getTask() {
+		return task;
+	}
+
+	public void setTask(Task task) {
+		this.task = task;
+	}
+
+	public String getHome() {
+		return home;
+	}
+
+	public void setHome(String home) {
+		this.home = home;
+	}
+
+	public Map<String, Object> getVariables() {
+		return variables;
+	}
+
+	public void setVariables(Map<String, Object> variables) {
+		this.variables = variables;
+	}
+
+	public ProcessInstance getProcessInstance() {
+		return processInstance;
+	}
+
+	public void setProcessInstance(ProcessInstance processInstance) {
+		this.processInstance = processInstance;
+	}
+
+	public HistoricProcessInstance getHistoricProcessInstance() {
+		return historicProcessInstance;
+	}
+
+	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
+		this.historicProcessInstance = historicProcessInstance;
+	}
+
+	public ProcessDefinition getProcessDefinition() {
+		return processDefinition;
+	}
+
+	public void setProcessDefinition(ProcessDefinition processDefinition) {
+		this.processDefinition = processDefinition;
+	}
+
+	@ExcelField(title="退票原因", align=2, sort=12)
+	public String getReason() {
+		return reason;
+	}
+
+	public void setReason(String reason) {
+		this.reason = reason;
+	}
+	
+	@ExcelField(title="作废/退票", align=2, sort=13)
+	public String getCancleReturn() {
+		return cancleReturn;
+	}
+
+	public void setCancleReturn(String cancleReturn) {
+		this.cancleReturn = cancleReturn;
+	}
+	
+	@ExcelField(title="原票是否退回", align=2, sort=14)
+	public String getReturnType() {
+		return returnType;
+	}
+
+	public void setReturnType(String returnType) {
+		this.returnType = returnType;
+	}
+	
+	@ExcelField(title="发票代码", align=2, sort=15)
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+	
+	@ExcelField(title="发票号", align=2, sort=16)
+	public String getNumber() {
+		return number;
+	}
+
+	public void setNumber(String number) {
+		this.number = number;
+	}
+	
+	@ExcelField(title="退票人", align=2, sort=17)
+	public String getUname() {
+		return uname;
+	}
+
+	public void setUname(String uname) {
+		this.uname = uname;
+	}
+	
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="退票日期", align=2, sort=18)
+	public Date getReturnDate() {
+		return returnDate;
+	}
+
+	public void setReturnDate(Date returnDate) {
+		this.returnDate = returnDate;
+	}
+	
+}

+ 801 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceAlterService.java

@@ -0,0 +1,801 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.service;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.filialeWorkInvoice.dao.FilialeWorkInvoiceAlterDao;
+import com.jeeplus.modules.filialeWorkInvoice.dao.FilialeWorkInvoiceDetailDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoice;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceAlter;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceDetail;
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
+import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
+import com.jeeplus.modules.serialnum.service.SerialNumTplService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
+import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
+import com.jeeplus.modules.workinvoice.entity.WorkInvoice;
+import com.jeeplus.modules.workinvoice.service.WorkInvoiceService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.activiti.engine.*;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 开票管理Service
+ * @author 孟祥越
+ * @version 2017-05-05
+ */
+@Service
+@Transactional(readOnly = true)
+@Lazy
+public class FilialeWorkInvoiceAlterService extends CrudService<FilialeWorkInvoiceAlterDao, FilialeWorkInvoiceAlter> {
+
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private OfficeService officeService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private FilialeWorkInvoiceDetailDao workInvoiceDetailDao;
+	@Autowired
+	private WorkActivityProcessDao workActivityProcessDao;
+	@Autowired
+	private WorkInvoiceService workInvoiceService;
+
+	@Autowired
+	protected TaskService taskService;
+	@Autowired
+	protected HistoryService historyService;
+	@Autowired
+	protected RepositoryService repositoryService;
+	@Autowired
+	protected WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	protected FilialeWorkInvoiceAlterDao workInvoiceAlterDao;
+
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	protected WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	protected ProjectRecordsService projectRecordsService;
+	@Autowired
+	@Lazy
+	protected FilialeWorkInvoiceDetailService workInvoiceDetailService;
+	@Autowired
+	protected SerialNumTplService serialNumTplService;
+	@Autowired
+	protected FilialeWorkInvoiceService invoiceService;
+
+	@Autowired
+	protected WorkProjectNotifyService workProjectNotifyService;
+	public FilialeWorkInvoiceAlter getByProcInsId(String procInsId) {
+		return dao.getByProcInsId(procInsId);
+	}
+	
+	public FilialeWorkInvoiceAlter get(String id) {
+		FilialeWorkInvoiceAlter workInvoice = new FilialeWorkInvoiceAlter();
+		if(StringUtils.isNotBlank(id)){
+			workInvoice = super.get(id);
+		}
+		if(workInvoice!=null){
+			if(StringUtils.isNotBlank(workInvoice.getProcessInstanceId())){
+				workInvoice.setAct(getByAct(workInvoice.getProcessInstanceId()));
+			}
+			if(workInvoice.getProject()!=null){
+				ProjectRecords project = projectRecordsService.getRuralInfo(workInvoice.getProject().getId());
+				workInvoice.setProject(project);
+			}
+			if(StringUtils.isNotBlank(workInvoice.getId())){
+				FilialeWorkInvoiceDetail workInvoiceDetail = new FilialeWorkInvoiceDetail();
+				workInvoiceDetail.setAinvoiceId(workInvoice.getId());
+				List<FilialeWorkInvoiceDetail> list = workInvoiceDetailDao.afindList(workInvoiceDetail);
+				workInvoice.setWorkAccountList(list);
+			}
+		}
+		return workInvoice;
+	}
+	public Act getByAct(String processInstanceId){
+		Act act = new Act();
+		HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+		ProcessInstance processInstance = actTaskService.getProcIns(processInstanceId);
+		if (processInstance!=null) {
+			List<Task> taskList = actTaskService.getCurrentTaskList(processInstance);
+			if(taskList!=null && taskList.size()>1){
+				for (Task taskInfok:taskList) {
+					if (taskInfok.getAssignee().equals(UserUtils.getUser().getId())) {
+						act.setTaskId(taskInfok.getId());
+						act.setTaskName(taskInfok.getName());
+						act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+						act.setProcDefId(taskInfok.getProcessDefinitionId());
+						act.setProcInsId(taskInfok.getProcessInstanceId());
+						act.setTask(taskInfok);
+					}
+				}
+			}else {
+				Task task = actTaskService.getCurrentTaskInfo(processInstance);
+				act.setTaskId(task.getId());
+				act.setTaskName(task.getName());
+				act.setTaskDefKey(task.getTaskDefinitionKey());
+				act.setProcDefId(task.getProcessDefinitionId());
+				act.setProcInsId(task.getProcessInstanceId());
+				act.setTask(task);
+			}
+		}
+		return  act;
+		/*if (processInstance!=null) {
+			Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+			Act act = new Act();
+			act.setTaskId(taskInfok.getId());
+			act.setTaskName(taskInfok.getName());
+			act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+			act.setProcDefId(taskInfok.getProcessDefinitionId());
+			act.setProcInsId(taskInfok.getProcessInstanceId());
+			act.setTask(taskInfok);
+			return act;
+		}else {
+			return null;
+		}*/
+	}
+	public List<FilialeWorkInvoiceAlter> findList(FilialeWorkInvoiceAlter workInvoice) {
+		return super.findList(workInvoice);
+	}
+	
+	public Page<FilialeWorkInvoiceAlter> findPage(Page<FilialeWorkInvoiceAlter> page, FilialeWorkInvoiceAlter workInvoice) {
+		workInvoice.getSqlMap().put("dsf", dataScopeFilter(workInvoice.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_INVOICERETURNALTER.getValue()));
+		workInvoice.setPage(page);
+		page.setList(findList(workInvoice));
+		return page;
+
+	}
+
+	/**
+	 * 暂存
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public  void save(FilialeWorkInvoiceAlter workInvoice){
+		super.save(workInvoice);
+		updateWorkInvoiceInfo(workInvoice);
+	}
+
+	@Transactional(readOnly = false)
+	public void updateWorkInvoiceInfo(FilialeWorkInvoiceAlter workInvoice) {
+		try {
+		for (FilialeWorkInvoiceDetail buyDetails : workInvoice.getWorkAccountList()){
+			if (buyDetails.getId() == null){
+				continue;
+			}
+			if (buyDetails.DEL_FLAG_NORMAL.equals(buyDetails.getDelFlag())){
+				buyDetails.setAinvoiceId(workInvoice.getId());
+				buyDetails.setComId(workInvoice.getCompanyId());
+				buyDetails.setOfficeId(workInvoice.getOffice().getId());
+				if(workInvoice.getInvoiceDate()!=null){
+					buyDetails.setDate(workInvoice.getInvoiceDate());
+				}else{
+					buyDetails.setDate(workInvoice.getUpdateDate());
+				}
+				if (StringUtils.isBlank(buyDetails.getId())){
+					buyDetails.preInsert();
+					workInvoiceDetailDao.insert(buyDetails);
+				}else{
+					if(buyDetails!=null){
+						FilialeWorkInvoiceDetail w1 = workInvoiceDetailDao.get(buyDetails.getId());//从数据库取出记录的值
+						MyBeanUtils.copyBeanNotNull2Bean(buyDetails, w1);//将编辑表单中的非NULL值覆盖数据库记录中的值
+						buyDetails.preUpdate();
+						workInvoiceDetailDao.update(w1);
+					}
+				}
+			}else{
+				workInvoiceDetailDao.delete(buyDetails);
+			}
+		}
+		}catch (Exception e){
+			logger.info(e.getMessage());
+		}
+	}
+
+	/**
+	 * 提交存储
+	 * @param workInvoice
+	 * @param variables
+	 */
+	@Transactional(readOnly = false)
+	public String save(FilialeWorkInvoiceAlter workInvoice, Map<String, Object> variables, String processInstanceId) {
+		super.save(workInvoice);
+		String  str ="";
+		//所属部门
+		Office office = officeService.get(workInvoice.getOffice().getId());
+		String userName = UserUtils.get(workInvoice.getCreateBy().getId()).getName();
+		str = "发票申请编号:"+workInvoice.getNumber()+",实际开票单位:"+workInvoice.getClient().getName()+",创建人:"+userName+",所属部门:"+office.getName();
+		String title = "实际开票单位:"+workInvoice.getClient().getName();
+		updateWorkInvoiceInfo(workInvoice);
+		// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+		identityService.setAuthenticatedUserId(UserUtils.getUser().getId());
+		// 启动流程
+		String businessKey = workInvoice.getId().toString();
+		WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c822345lp000050905",officeService.get(workInvoice.getOfficeId()));//menuid
+		// 启动流程
+		String processType = workActivityMenu.getProcessType();
+		StringBuffer buffer = new StringBuffer();
+		Activity activity = new Activity();
+		WorkProjectNotify workProjectNotify = UtilNotify
+				.saveNotify(workInvoice.getId(),
+						null,
+						workInvoice.getCompanyId(),
+						title,
+						str,
+						"48",
+						"0",
+						"待审批",
+						""
+				);
+		List<User> users = new ArrayList<>();
+		List<User> cwzgs = new ArrayList<>();
+		if(workInvoice!=null){
+			//总公司开票
+			if("1".equals(workInvoice.getExt())){
+				cwzgs = UserUtils.getByRoleActivityEnname("cwzg",1,office.getId(),"5",workInvoice.getCreateBy());
+			} else if("0".equals(workInvoice.getExt())){
+				cwzgs = UserUtils.getByRoleActivityEnname("cwzg",3,office.getId(),"5",workInvoice.getCreateBy());
+			}
+		}
+		if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+			workProjectNotify.setNotifyRole("");
+			workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+			List<Activity> activities = workActivityMenu.getActivities();
+			for (Activity a : activities) {
+				String encount = a.getEncount();
+				String enlist = a.getEnlist();
+				if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+					List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
+					if (enusers.size()==0){
+						workInvoice.setInvoiceState("1");//暂存
+						this.save(workInvoice);
+						return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
+					}
+					variables.put(enlist, enusers);
+					variables.put(encount, enusers.size());
+				}
+				if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+					activity = a;
+				}
+			}
+			buffer.append(activity.getRole().getEnname());
+			if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+				//角色审批
+				if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+					users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
+				}
+				//人员审批
+				if (StringUtils.isNotBlank(activity.getUser().getId())) {
+					users.add(activity.getUser());
+				}
+			}
+			workProjectNotify.setId("");
+		} else {
+			if (cwzgs.size()==0){
+				workInvoice.setInvoiceState("1");//暂存
+				this.save(workInvoice);
+			}
+			if (cwzgs.size()==0){
+				return "流程审批人不能为空,角色财务主管下无用户,请联系管理员!";
+			}
+			variables.put("cwzgcount",cwzgs.size());
+			variables.put("cwzgList",cwzgs);
+			processType = "workinvoicealter";
+			users.addAll(cwzgs);
+		}
+		for (User user : users){
+			workProjectNotify.setUser(user);
+			workProjectNotify.setId("");
+			workProjectNotifyService
+					.save(workProjectNotify);
+			Map<String,Object> extras = new HashMap<>();
+			extras.put("type","7001");
+			extras.put("id",workProjectNotify.getId());
+			extras.put("procDefKey","48");
+			UserUtils.pushInfoToApp(title,str,extras,user.getId());
+			UserUtils.pushIm(user.getId(),str);
+		}
+		variables.put("type", processType);
+		variables.put("busId", businessKey);
+		variables.put("title", "发票申请编号:" + workInvoice.getNumber());//设置标题;
+
+		ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+		workInvoice.setProcessInstance(processInstance);
+		if (StringUtils.isNotBlank(processInstanceId)) {
+			workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+			workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+			workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+		}
+		// 更新流程实例ID
+		workInvoice.setProcessInstanceId(processInstance.getId());
+		workInvoiceAlterDao.updateProcessInstanceId(workInvoice);
+		List<Activity> list = workActivityMenu.getActivities();
+		if (list != null && list.size() != 0) {
+			workActivityProcessService.saveList(list, processInstance.getId());
+		} else {
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessKey("workinvoicealter");
+			workActivityProcess.setCount(1);
+			workActivityProcess.setProcessInstanceId(processInstance.getId());
+			workActivityProcess.setIsApproval("0");
+			workActivityProcessService.save(workActivityProcess);
+			workActivityProcessService.insertAuditsByType(cwzgs,processInstance.getId(),1,1);
+		}
+		logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+				ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+		return "";
+	}
+
+	@Transactional(readOnly = false)
+	public void delete(FilialeWorkInvoiceAlter workInvoice) {
+		super.delete(workInvoice);
+		for (FilialeWorkInvoiceDetail workAccount : workInvoice.getWorkAccountList()){
+			workInvoiceDetailDao.delete(workAccount);
+		}
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workInvoice.getId());
+		workProjectNotifyService.readByNotifyId(notify);
+		if(workInvoice.getWorkInvoice()!= null){
+			if(StringUtils.isNotBlank(workInvoice.getWorkInvoice().getId())){
+				WorkInvoice w = workInvoiceService.get(workInvoice.getWorkInvoice().getId());
+				w.setInvoiceState("5");
+				workInvoiceService.save(w);
+			}
+		}
+	}
+	
+	public Page<WorkClientInfo> findPageByclient(Page<WorkClientInfo> page, WorkClientInfo client) {
+		client.setPage(page);
+		page.setList(dao.findListByclient(client));
+		return page;
+	}
+	public Page<WorkBidProject> findPageByproject(Page<WorkBidProject> page, WorkBidProject project) {
+		project.setPage(page);
+		page.setList(dao.findListByproject(project));
+		return page;
+	}
+
+	/**
+	 * 审核流程
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public String auditSave(FilialeWorkInvoiceAlter workInvoice,List<User> auditUsers) {
+		String  str ="";
+		//所属部门
+		Office office = officeService.get(workInvoice.getOffice().getId());
+		String userName = UserUtils.get(workInvoice.getCreateBy().getId()).getName();
+		str = "发票申请编号:"+workInvoice.getNumber()+",实际开票单位:"+workInvoice.getClient().getName()+",创建人:"+userName+",所属部门:"+office.getName();
+		String title = "实际开票单位:"+workInvoice.getClient().getName();
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		if (!"modifyApply".equals(taskDefKey)) {
+			actTaskService.claim(workInvoice.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else {
+			workInvoice.getAct().setFlag("yes");
+			updateWorkInvoiceInfo(workInvoice);
+		}
+		String comment = "";
+		if (workInvoice.getInvoiceState().equals("4")){
+			comment = ("yes".equals(workInvoice.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+		}else {
+			comment = ("yes".equals(workInvoice.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoice.getAct().getComment();
+		}
+		//yes 的时候状态为审核通过 否则为未通过
+		//2 审核中 4 驳回
+		workInvoice.setInvoiceState(("yes".equals(workInvoice.getAct().getFlag()) ? "2" : "4"));
+		Map<String, Object> vars = Maps.newHashMap();
+		//业务逻辑对应的条件表达式
+		String exp = "";
+		String taskCount = "";
+		String notifyRole = "";
+		int key = 0;
+		String enname = "";
+		List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoice.getProcessInstanceId());
+		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+		if (activitieList != null && activitieList.size() != 0) {
+			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+			workActivityMenu.setActivities(activitieList);
+		}
+
+		WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+		WorkActivityProcess selectProcess = new WorkActivityProcess();
+		selectProcess.setProcessInstanceId(workInvoice.getProcessInstanceId());
+		List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+		List<Activity> activities = workActivityMenu.getActivities();
+		if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workinvoicealter")) {
+			key = 1;
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+					taskCount = activityProcess.getCount()+"";
+					workActivityProcess = activityProcess;
+					if (!workActivityProcess.getIsApproval().equals("0")) {
+						workActivityProcess.setId("");
+					}
+					exp = "pass";
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("4");
+						workActivityProcess.setIsApproval("2");
+						String returnBack = "-1";
+						for (Activity activity : activities) {
+							if (activity.getCount() == activityProcess.getCount()) {
+								notifyRole = activity.getName();
+								returnBack = activity.getReturnBack();
+								break;
+							}
+						}
+						if (returnBack.equals("0")) {
+							workActivityProcess.setId("");
+						}
+
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+				}else if(taskDefKey.equals("modifyApply")){
+					notifyRole = "调整申请";
+					taskCount = "0";
+					exp = "pass";
+					workActivityProcess.setId("");
+					workActivityProcess.setCount(0);
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("3");
+						workActivityProcess.setIsApproval("2");
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+					break;
+				}
+			}
+		} else {
+			workActivityMenu.setProcessType("workinvoicealter");
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				String count = activityProcess.getCount() + "";
+				workActivityProcess = activityProcess;
+				if (!workActivityProcess.getIsApproval().equals("0")) {
+					workActivityProcess.setId("");
+				}
+				// 审核环节
+				if ("cwzg".equals(taskDefKey) && count.contains("1")) {
+					taskCount = "1";
+					exp = "pass";
+					if ("yes".equals(workInvoice.getAct().getFlag()) &&("1").equals(workInvoice.getExt())) {
+						notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+					}else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				} else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+					notifyRole = "财务主管";
+					taskCount = "0";
+					exp = "pass";
+					workActivityProcess.setCount(0);
+					enname = "cwzg";
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("3");
+					}
+					break;
+				} else if ("apply_end".equals(taskDefKey)) {
+				}
+
+			}
+		}
+		// 设置意见
+		workInvoice.getAct().setComment(("yes".equals(workInvoice.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workInvoice.getAct().getComment());
+		workInvoice.preUpdate();
+		// 提交流程任务
+		vars.put(exp, "yes".equals(workInvoice.getAct().getFlag()) ? true : false);
+		vars.put("passs", true);
+		workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workInvoice.getProcessInstanceId(),taskDefKey,"modifyApply",workInvoice.getAct().getFlag(),comment, activities);
+		// 提交流程任务
+		actTaskService.complete(workInvoice.getAct().getTaskId(), workInvoice.getAct().getProcInsId(), workInvoice.getAct().getComment(), vars);
+		boolean state = actTaskService.isProcessEnd(workInvoice.getAct().getProcInsId());
+		List<User> users = new ArrayList<>();
+		List<User> userList = new ArrayList<>();
+		if (!state) {
+			str = "发票申请编号:"+workInvoice.getNumber()+",实际开票单位:"+workInvoice.getClient().getName();
+			title = "实际开票单位:"+workInvoice.getClient().getName();
+			users.add(workInvoice.getCreateBy());
+			if ("yes".equals(workInvoice.getAct().getFlag())) {
+				workInvoice.setInvoiceState("5");
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				workProjectNotifyService
+						.save(UtilNotify
+								.saveNotify(workInvoice.getId(),
+										workInvoice.getCreateBy(),
+										workInvoice.getCompanyId(),
+										title,
+										str,
+										"48",
+										"0",
+										"待通知",
+										notifyRole));
+
+			} else {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				if (StringUtils.isNotBlank(workInvoice.getInvoiceState()) && !workInvoice.getInvoiceState().equals("3")){
+					workInvoice.setInvoiceState("4");
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoice.getId(),
+											workInvoice.getCreateBy(),
+											workInvoice.getCompanyId(),
+											title,
+											str,
+											"48",
+											"0",
+											"待通知",
+											notifyRole));
+				}
+			}
+			workActivityProcessService.deleteProcessIdAuditUsers(workInvoice.getProcessInstanceId());
+		} else {
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workinvoicealter")) {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				WorkProjectNotify workProjectNotify = UtilNotify
+						.saveNotify(workInvoice.getId(),
+								new User(),
+								workInvoice.getCompanyId(),
+								title,
+								str,
+								"48",
+								"0",
+								"待审批",
+								notifyRole);
+				List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+						activities,
+						workProjectNotify,
+						taskDefKey,
+						workInvoice.getAct().getFlag(),
+						taskCount,
+						workInvoice.getCreateBy(),
+						workInvoice.getOfficeId(),
+						"5");
+				for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+					users.add(workProjectNotify1.getUser());
+					workProjectNotify1.setId("");
+					workProjectNotify1.setIsNewRecord(false);
+					workProjectNotifyService
+							.save(workProjectNotify1);
+					if (!"modifyApply".equals(taskDefKey)){
+						Map<String,Object> extras = new HashMap<>();
+						extras.put("type","7001");
+						extras.put("id",workProjectNotify.getId());
+						extras.put("procDefKey","48");
+						UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+					}
+				}
+
+			} else {
+				if (!"yes".equals(workInvoice.getAct().getFlag())) {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoice.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoice.getId(),
+											workInvoice.getCreateBy(),
+											workInvoice.getCompanyId(),
+											title,
+											str,
+											"48",
+											"0",
+											"重新申请",
+											notifyRole));
+					users.add( workInvoice.getCreateBy());
+				} else {
+					if (StringUtils.isNotBlank(enname)) {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoice.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						WorkProjectNotify workProjectNotify = UtilNotify
+								.saveNotify(workInvoice.getId(),
+										new User(),
+										workInvoice.getCompanyId(),
+										title,
+										str,
+										"48",
+										"0",
+										"待审批",
+										notifyRole);
+						for (User user1:auditUsers){
+							users.add(user1);
+							workProjectNotify.setUser(user1);
+							workProjectNotify.setId("");
+							workProjectNotify.setIsNewRecord(false);
+							workProjectNotifyService
+									.save(workProjectNotify);
+							if (!"modifyApply".equals(taskDefKey)){
+								Map<String,Object> extras = new HashMap<>();
+								extras.put("type","7001");
+								extras.put("id",workProjectNotify.getId());
+								extras.put("procDefKey","48");
+								UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+
+							}
+						}
+					}else {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoice.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						users.addAll(userList);
+						users.add(workInvoice.getCreateBy());
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workInvoice.getId(),
+												workInvoice.getCreateBy(),
+												workInvoice.getCompanyId(),
+												title,
+												str,
+												"48",
+												"0",
+												"重新申请",
+												notifyRole));
+					}
+				}
+			}
+		}
+		if (users!=null && users.size()!=0) {
+			for (User u : users) {
+				UserUtils.pushIm(u.getId(),str);
+			}
+		}
+		if (userList!=null && userList.size()!=0) {
+			for (User u : userList) {
+				UserUtils.pushMeIm(u.getId());
+			}
+		}
+		workInvoiceAlterDao.update(workInvoice);
+		if("5".equals(workInvoice.getInvoiceState())){
+			if(workInvoice.getWorkInvoice()!=null){
+				FilialeWorkInvoice workInvoice1 = invoiceService.get(workInvoice.getWorkInvoice().getId());
+				workInvoice1.setInvoiceState("5");
+				invoiceService.save(workInvoice1);
+				List<FilialeWorkInvoiceDetail> list2 = workInvoice1.getWorkAccountList();
+				if(list2!=null && list2.size()>0){
+					for (FilialeWorkInvoiceDetail w:
+						 list2) {
+						workInvoiceDetailService.delete(w);
+					}
+				}
+				if(StringUtils.isNotBlank(workInvoice.getId())){
+					FilialeWorkInvoiceDetail workInvoiceDetail = new FilialeWorkInvoiceDetail();
+					workInvoiceDetail.setAinvoiceId(workInvoice.getId());
+					List<FilialeWorkInvoiceDetail> list = workInvoiceDetailDao.afindList(workInvoiceDetail);
+					for(FilialeWorkInvoiceDetail workInvoiceDetail1 : list){
+						workInvoiceDetail1.setInvoiceId(workInvoice.getWorkInvoice().getId());
+						workInvoiceDetailService.save(workInvoiceDetail1);
+					}
+				}
+			}
+		}
+		return "保存审核意见成功!";
+	}
+
+
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public FilialeWorkInvoiceAlter getByProcessInstanceId(String processInstanceId) {
+		FilialeWorkInvoiceAlter workInvoice = dao.getByProcInsId(processInstanceId);
+		if(workInvoice!=null&&!workInvoice.equals("")){
+			if(workInvoice.getCreateBy()!=null&&!workInvoice.getCreateBy().equals("")){
+			if(StringUtils.isNotBlank(workInvoice.getCreateBy().getId())){
+				User u = UserUtils.get(workInvoice.getCreateBy().getId());
+				if(u!=null &&!u.equals("")){
+					workInvoice.setCreateBy(u);
+				}
+			}
+			}
+		}
+		return workInvoice;
+	}
+	@Transactional(readOnly = false)
+	public void update(FilialeWorkInvoiceAlter workInvoice) {
+		workInvoice.preUpdate();
+		dao.update(workInvoice);
+	}
+
+	/**
+	 * 强制撤销
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public void cancelInvalidate(FilialeWorkInvoiceAlter workInvoice) {
+		String invalidateProcessInstanceId = workInvoice.getProcessInstanceId();
+		try {
+			//将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
+			WorkActivityProcess process = new WorkActivityProcess();
+			process.setProcessInstanceId(workInvoice.getProcessInstanceId());
+			process.setIsApproval("0");
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(workInvoice.getProcessInstanceId());
+			List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
+			WorkProjectNotify notify = new WorkProjectNotify();
+			notify.setNotifyId(workInvoice.getId());
+			workProjectNotifyService.readByNotifyId(notify);
+			if (processList != null && processList.size() > 0) {
+				for (int i = 0; i < processList.size(); i++) {
+					WorkActivityProcess p = processList.get(i);
+					if (StringUtils.isNotBlank(p.getIsApproval()) && "0".equals(p.getIsApproval())) {
+						p.setDelFlag("1");
+						p.setIsApproval("-1");
+						workActivityProcessDao.updateDelFlagAndIsApproval(p);
+					}
+				}
+				WorkActivityProcess pro = new WorkActivityProcess();
+				pro.setId("");
+				pro.preInsert();
+				pro.setDelFlag("0");
+				pro.setRemarks("[强制撤销]");
+				pro.setProcessKey(processList.get(0).getProcessKey());
+				pro.setIsApproval("1");
+				pro.setProcessInstanceId(processList.get(0).getProcessInstanceId());
+				pro.setCount(0);
+				workActivityProcessDao.insert(pro);
+			}
+			//结束该流程,设为"撤销"状态
+			actTaskService.endProcessInstance(invalidateProcessInstanceId, "发票变更申请-撤销");
+			workInvoice.setInvoiceState("3");
+			workInvoice.preUpdate();
+			workInvoiceAlterDao.update(workInvoice);
+		} catch (ActivitiObjectNotFoundException e) {
+			logger.error("Exception e:"+e);
+			System.err.println("撤销发票变更申请异常,因为这个流程已不存在!");
+			e.printStackTrace();
+		} catch (Exception e) {
+			logger.error("Exception e:"+e);
+			e.printStackTrace();
+		}
+	}
+}

+ 766 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceDetailService.java

@@ -0,0 +1,766 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.service;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.filialeWorkInvoice.dao.FilialeWorkInvoiceDetailDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoice;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceDetail;
+import com.jeeplus.modules.serialnum.service.SerialNumTplService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.IdentityService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 发票明细Service
+ * @author lw
+ * @version 2018-05-09
+ */
+@Service
+@Transactional(readOnly = true)
+public class FilialeWorkInvoiceDetailService extends CrudService<FilialeWorkInvoiceDetailDao, FilialeWorkInvoiceDetail> {
+	@Autowired
+	@Lazy
+	private FilialeWorkInvoiceService workInvoiceService;
+	@Autowired
+	private HistoryService historyService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private FilialeWorkInvoiceDetailDao workInvoiceDetailDao;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private WorkActivityProcessDao workActivityProcessDao;
+	@Autowired
+	private SerialNumTplService serialNumTplService;
+
+
+	public FilialeWorkInvoiceDetail get(String id) {
+		FilialeWorkInvoiceDetail workInvoiceDetail = super.get(id);
+		if(workInvoiceDetail!=null){
+			String wId = workInvoiceDetail.getInvoiceId();
+			if(StringUtils.isNotBlank(wId)){
+				FilialeWorkInvoice workInvoice = workInvoiceService.get(wId);
+				if(workInvoice!=null){
+					workInvoiceDetail.setWorkInvoice(workInvoice);
+				}
+			}
+		}
+		return workInvoiceDetail;
+	}
+	
+	public List<FilialeWorkInvoiceDetail> findList(FilialeWorkInvoiceDetail workInvoiceDetail) {
+		return super.findList(workInvoiceDetail);
+	}
+	
+	public Page<FilialeWorkInvoiceDetail> findPage(Page<FilialeWorkInvoiceDetail> page, FilialeWorkInvoiceDetail workInvoiceDetail) {
+		return super.findPage(page, workInvoiceDetail);
+	}
+	public Page<FilialeWorkInvoiceDetail> findPages(Page<FilialeWorkInvoiceDetail> page, FilialeWorkInvoiceDetail workInvoiceDetail) {
+		workInvoiceDetail.getSqlMap().put("dsf", dataScopeFilter(workInvoiceDetail.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_INVOICEDETAIL.getValue()));
+		workInvoiceDetail.setPage(page);
+		page.setList(dao.findLists(workInvoiceDetail));
+		return page;
+	}
+	@Transactional(readOnly = false)
+	public void save(FilialeWorkInvoiceDetail workInvoiceDetail) {
+		super.save(workInvoiceDetail);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(FilialeWorkInvoiceDetail workInvoiceDetail) {
+		super.delete(workInvoiceDetail);
+	}
+
+	@Transactional(readOnly = false)
+	public void deletes(FilialeWorkInvoiceDetail workInvoiceDetail) {
+		//清空退票信息实现逻辑删除退票申请
+		workInvoiceDetail.setSign(null);
+		workInvoiceDetail.setProcessInstanceId(null);
+		workInvoiceDetail.setReturnNumber(null);
+		workInvoiceDetail.setReturnReason(null);
+		workInvoiceDetail.setReturnCancle(null);
+		workInvoiceDetail.setReturnSign(null);
+		workInvoiceDetail.setReturnDate(null);
+		workInvoiceDetail.setReturnUser(null);
+		workInvoiceDetail.setStatus(null);
+		super.save(workInvoiceDetail);
+	}
+
+    public Page<FilialeWorkInvoiceDetail> findPageWithDept(Page<FilialeWorkInvoiceDetail> workInvoiceDetailPage, FilialeWorkInvoiceDetail invoice) {
+	    invoice.setPage(workInvoiceDetailPage);
+	    workInvoiceDetailPage.setList(dao.findListWithDept(invoice));
+        return workInvoiceDetailPage;
+    }
+	public Page<FilialeWorkInvoiceDetail> findPageReturn(Page<FilialeWorkInvoiceDetail> workInvoiceDetailPage, FilialeWorkInvoiceDetail invoice) {
+		invoice.getSqlMap().put("dsf", dataScopeFilter(invoice.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_INVOICEDETAIL.getValue()));
+		invoice.setPage(workInvoiceDetailPage);
+		workInvoiceDetailPage.setList(dao.findListReturn(invoice));
+		return workInvoiceDetailPage;
+	}
+    public int updateIncomeMoney(FilialeWorkInvoiceDetail invoice) {
+	    invoice.preUpdate();
+        return dao.update(invoice);
+    }
+
+	/**
+	 * 提交存储
+	 * @param
+	 * @param variables
+	 */
+	@Transactional(readOnly = false)
+	public String saves(FilialeWorkInvoiceDetail workInvoiceDetail,Map<String, Object> variables,String processInstanceId) {
+		try {
+			if(StringUtils.isBlank(workInvoiceDetail.getReturnNumber())) {
+				workInvoiceDetail.setReturnNumber(serialNumTplService.genSerialNum(UserUtils.get(workInvoiceDetail.getCreateBy().getId()).getCompany(), workInvoiceDetail.SERIAL_BIZCODE));
+			}
+			User user = UserUtils.getUser();
+			super.save(workInvoiceDetail);
+			FilialeWorkInvoice workInvoice = new FilialeWorkInvoice();
+			if(workInvoiceDetail.getWorkInvoice()!=null){
+				if(StringUtils.isNotBlank(workInvoiceDetail.getWorkInvoice().getId())){
+					workInvoice = workInvoiceService.get(workInvoiceDetail.getWorkInvoice().getId());
+				}
+			}
+			String str =  "退票申请人:"+UserUtils.get(workInvoiceDetail.getCreateBy().getId()).getName()+",退票发票号:"+workInvoiceDetail.getNumber();
+			// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+			identityService.setAuthenticatedUserId(user.getId());
+			// 启动流程
+			String businessKey = workInvoiceDetail.getId().toString();
+			Office office = UserUtils.getSelectOffice();
+			WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c82bdea9uiopc750906", office);//menuid
+			// 启动流程
+			String processType = workActivityMenu.getProcessType();
+			StringBuffer buffer = new StringBuffer();
+			Activity activity = new Activity();
+			WorkProjectNotify workProjectNotify = UtilNotify
+					.saveNotify(workInvoiceDetail.getId(),
+							null,
+							workInvoiceDetail.getComId(),
+							"退票申请人:"+UserUtils.get(workInvoiceDetail.getCreateBy().getId()).getName()+",退票发票号:"+workInvoiceDetail.getNumber(),
+							str,
+							"40",
+							"0",
+							"待审批",
+							""
+					);
+			List<User> users = new ArrayList<>();
+			if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+				workProjectNotify.setNotifyRole("");
+				workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+				List<Activity> activities = workActivityMenu.getActivities();
+				for (Activity a : activities) {
+					String encount = a.getEncount();
+					String enlist = a.getEnlist();
+					if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+						List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"6",workInvoiceDetail.getCreateBy());
+						if (enusers.size()==0){
+							this.deletes(workInvoiceDetail);
+							return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
+						}
+						variables.put(enlist, enusers);
+						variables.put(encount, enusers.size());
+					}
+					if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+						activity = a;
+					}
+				}
+				buffer.append(activity.getRole().getEnname());
+				if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+					//角色审批
+					if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+						users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"6",workInvoiceDetail.getCreateBy());
+					}
+					//人员审批
+					if (StringUtils.isNotBlank(activity.getUser().getId())) {
+						users.add(activity.getUser());
+					}
+				}
+				workProjectNotify.setId("");
+			} else {
+				List<User> fpglys = new ArrayList<>();
+				List<User> zgkjs = new ArrayList<>();
+				List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"6",workInvoiceDetail.getCreateBy());
+				List<User> fglds = UserUtils.getByRoleActivityEnname("fgld",2,office.getId(),"6",workInvoiceDetail.getCreateBy());
+				if(workInvoice!=null){
+					//1总公司0分公司
+					if("1".equals(workInvoice.getExt())){
+						fpglys = UserUtils.getByRoleActivityEnname("fpgly",1,office.getId(),"6",workInvoiceDetail.getCreateBy());
+						zgkjs = UserUtils.getByRoleActivityEnname("zghj",1,office.getId(),"6",workInvoiceDetail.getCreateBy());
+					}else if("0".equals(workInvoice.getExt())){
+						fpglys = UserUtils.getByRoleActivityEnname("fpgly",3,office.getId(),"6",workInvoiceDetail.getCreateBy());
+						zgkjs = UserUtils.getByRoleActivityEnname("zghj",3,office.getId(),"6",workInvoiceDetail.getCreateBy());
+					}
+				}
+				variables.put("bmzrList", bmzrs);
+				variables.put("fgldList", fglds);
+				variables.put("fpglyList", fpglys);
+				variables.put("zgkjList", zgkjs);
+				if (bmzrs.size()==0 || fglds.size()==0 || fpglys.size()==0 || zgkjs.size()==0){
+					this.deletes(workInvoiceDetail);
+				}
+				if (bmzrs.size()==0){
+					return "流程审批人不能为空,角色部门负责人下无用户,请联系管理员!";
+				}
+				if (fglds.size()==0){
+					return "流程审批人不能为空,角色分管领导下无用户,请联系管理员!";
+				}
+				if (fpglys.size()==0){
+					return "流程审批人不能为空,角色发票管理员下无用户,请联系管理员!";
+				}
+				if (zgkjs.size()==0){
+					return "流程审批人不能为空,角色主管会计下无用户,请联系管理员!";
+				}
+				variables.put("bmzrcount",bmzrs.size());
+				variables.put("fgldcount",fglds.size());
+				variables.put("fpglycount",fpglys.size());
+				variables.put("zgkjcount",zgkjs.size());
+				processType = "workinvoicereturn";
+				users.addAll(bmzrs);
+			}
+			for (User u : users){
+				workProjectNotify.setUser(u);
+				workProjectNotify.setId("");
+				workProjectNotifyService
+						.save(workProjectNotify);
+				/*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(u.getId());
+				for (WebSocket toUserConn:toUserConns) {
+					String message = "{\"to\":\""+u.getId()+"\"," +
+							"\"msg\":\"审批信息 申请人:" + user.getName() + ",发票单号:"+ workInvoiceDetail.getNumber() + " 待审批!\"," +
+							"\"useType\":\"sys\"}";
+					ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+				}*/
+				UserUtils.pushIm(u.getId(),"申请人:"+ user.getName()+",发票单号:"+workInvoiceDetail.getNumber());
+			}
+			variables.put("type", processType);
+			variables.put("busId", businessKey);
+			variables.put("title", "审批单:" + workInvoiceDetail.getNumber());//设置标题;
+
+			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+			workInvoiceDetail.setProcessInstance(processInstance);
+			if (StringUtils.isNotBlank(processInstanceId)) {
+				workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+				workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+			}
+			// 更新流程实例ID
+			workInvoiceDetail.setProcessInstanceId(processInstance.getId());
+			workInvoiceDetailDao.updateProcessInstanceId(workInvoiceDetail);
+			List<Activity> list = workActivityMenu.getActivities();
+			if (list != null && list.size() != 0) {
+				workActivityProcessService.saveList(list, processInstance.getId());
+			} else {
+				WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+				workActivityProcess.setProcessKey("workinvoicereturn");
+				workActivityProcess.setCount(1);
+				workActivityProcess.setProcessInstanceId(processInstance.getId());
+				workActivityProcess.setIsApproval("0");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcess.setCount(2);
+				workActivityProcess.setId("");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcess.setCount(3);
+				workActivityProcess.setId("");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcess.setCount(4);
+				workActivityProcess.setId("");
+				workActivityProcessService.save(workActivityProcess);
+			}
+			logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+					ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+		}catch (Exception e){
+			logger.info("Exception e:"+e);
+			return "Exception e:"+e;
+		}
+		return "";
+	}
+
+	/**
+	 * 审核流程
+	 * @param
+	 */
+	@Transactional(readOnly = false)
+	public String auditSave(FilialeWorkInvoiceDetail workInvoiceDetail) {
+		try {
+			String str =  "退票申请人:"+UserUtils.get(workInvoiceDetail.getCreateBy().getId()).getName()+",退票发票号:"+workInvoiceDetail.getNumber();
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workInvoiceDetail.getAct().getTaskDefKey();
+			if (!"modifyApply".equals(taskDefKey) && !taskDefKey.contains("audit")) {
+				actTaskService.claim(workInvoiceDetail.getAct().getTaskId(), UserUtils.getUser().getId());
+			}else {
+				workInvoiceDetail.getAct().setFlag("yes");
+			}
+			String comment = "";
+			if (workInvoiceDetail.getStatus().equals("4")){
+				comment = ("yes".equals(workInvoiceDetail.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+			}else {
+				comment = ("yes".equals(workInvoiceDetail.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoiceDetail.getAct().getComment();
+			}
+			//yes 的时候状态为审核通过 否则为未通过
+			//1 审核中 2 未通过
+			workInvoiceDetail.setStatus(("yes".equals(workInvoiceDetail.getAct().getFlag()) ? "2" : "4"));
+			String buffer = UserUtils.getRoleActivityEnname(UserUtils.getSelectCompany().getId(),workInvoiceDetail.getCreateBy());
+			Map<String, Object> vars = Maps.newHashMap();
+			//业务逻辑对应的条件表达式
+			String exp = "";
+			String taskCount = "";
+			String notifyRole = "";
+			int key = 0;
+			String enname = "";
+			List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoiceDetail.getProcessInstanceId());
+			WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+			if (activitieList != null && activitieList.size() != 0) {
+				workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+				workActivityMenu.setActivities(activitieList);
+			}
+
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			WorkActivityProcess selectProcess = new WorkActivityProcess();
+			selectProcess.setProcessInstanceId(workInvoiceDetail.getProcessInstanceId());
+			List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+			List<Activity> activities = workActivityMenu.getActivities();
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workinvoicereturn")) {
+				key = 1;
+				for (int i = 0; i < workActivityProcesses.size(); i++) {
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+						taskCount = activityProcess.getCount()+"";
+						workActivityProcess = activityProcess;
+						if (!workActivityProcess.getIsApproval().equals("0")) {
+							workActivityProcess.setId("");
+						}
+						exp = "pass";
+						if (!"yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							workInvoiceDetail.setStatus("4");
+							str += " 被驳回!";
+							workActivityProcess.setIsApproval("2");
+							String returnBack = "-1";
+							for (Activity activity : activities) {
+								if (activity.getCount() == activityProcess.getCount()) {
+									notifyRole = activity.getName();
+									returnBack = activity.getReturnBack();
+									break;
+								}
+							}
+							if (returnBack.equals("0")) {
+								workActivityProcess.setId("");
+							}
+
+						} else {
+							str += " 待审批!";
+							workActivityProcess.setIsApproval("1");
+						}
+					}else if(taskDefKey.equals("modifyApply")){
+						notifyRole = "调整申请";
+						taskCount = "0";
+						exp = "pass";
+						workActivityProcess.setId("");
+						workActivityProcess.setCount(0);
+						if (!"yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							workInvoiceDetail.setStatus("3");
+							str += " 已撤销!";
+							workActivityProcess.setIsApproval("2");
+						} else {
+							str += " 重新申请!";
+							workActivityProcess.setIsApproval("1");
+						}
+						break;
+					}
+				}
+			} else {
+				workActivityMenu.setProcessType("workinvoicereturn");
+				for (int i = 0; i < workActivityProcesses.size(); i++) {
+					WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+					String count = activityProcess.getCount() + "";
+					workActivityProcess = activityProcess;
+					if (!workActivityProcess.getIsApproval().equals("0")) {
+						workActivityProcess.setId("");
+					}
+					// 审核环节
+					if ("bmzr".equals(taskDefKey) && count.contains("1")) {
+						taskCount = "1";
+						exp = "pass";
+						if ("yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							notifyRole = "分管领导审核";
+							workActivityProcess.setIsApproval("1");
+							str += " 待审批!";
+							enname = buffer + "fgld";
+						} else {
+							notifyRole = "调整申请";
+							workActivityProcess.setIsApproval("2");
+							str += " 被驳回!";
+						}
+						break;
+					} else if ("fgld".equals(taskDefKey) && count.contains("2")) {
+						taskCount = "2";
+						exp = "pass";
+						if ("yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							workActivityProcess.setIsApproval("1");
+							notifyRole = "发票管理员审核";
+							str += " 待审批!";
+							enname = buffer + "fpgly";
+						} else {
+							notifyRole = "调整申请";
+							workActivityProcess.setIsApproval("2");
+							str += " 被驳回!";
+						}
+						break;
+					} else if ("fpgly".equals(taskDefKey) && count.contains("3")) {
+						taskCount = "3";
+						exp = "pass";
+						if ("yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							workActivityProcess.setIsApproval("1");
+							notifyRole = "主管会计审核";
+							str += " 待审批!";
+							enname = buffer + "zghj";
+						} else {
+							notifyRole = "调整申请";
+							workActivityProcess.setIsApproval("2");
+							str += " 被驳回!";
+						}
+						break;
+					} else if ("zgkj".equals(taskDefKey) && count.contains("4")) {
+						taskCount = "4";
+						exp = "pass";
+						if ("yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							workActivityProcess.setIsApproval("1");
+							notifyRole = "审核通过";
+							str += " 待审批!";
+						} else {
+							notifyRole = "调整申请";
+							workActivityProcess.setIsApproval("2");
+							str += " 被驳回!";
+						}
+						break;
+					}  else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+						taskCount = "0";
+						exp = "pass";
+						workActivityProcess.setCount(0);
+						enname = buffer + "bmzr";
+						if (!"yes".equals(workInvoiceDetail.getAct().getFlag())) {
+							workInvoiceDetail.setStatus("3");
+						}
+						str += " 待审批!";
+						break;
+					} else if ("apply_end".equals(taskDefKey)) {
+					}
+
+				}
+			}
+			// 设置意见
+			workInvoiceDetail.getAct().setComment(("yes".equals(workInvoiceDetail.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workInvoiceDetail.getAct().getComment());
+			workInvoiceDetail.preUpdate();
+			// 提交流程任务
+			vars.put(exp, "yes".equals(workInvoiceDetail.getAct().getFlag()) ? true : false);
+			vars.put("passs", true);
+			workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workInvoiceDetail.getProcessInstanceId(),taskDefKey,"modifyApply",workInvoiceDetail.getAct().getFlag(),comment, activities);
+			// 提交流程任务
+			actTaskService.complete(workInvoiceDetail.getAct().getTaskId(), workInvoiceDetail.getAct().getProcInsId(), workInvoiceDetail.getAct().getComment(), vars);
+			boolean state = actTaskService.isProcessEnd(workInvoiceDetail.getAct().getProcInsId());
+			List<User> users = new ArrayList<>();
+			String title = "";
+			if (!state) {
+				users.add(workInvoiceDetail.getCreateBy());
+				if ("yes".equals(workInvoiceDetail.getAct().getFlag())) {
+					title = "您的退票申请:"+workInvoiceDetail.getNumber()+"审核:已通过!";
+					workInvoiceDetail.setStatus("5");
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoiceDetail.getId());
+					List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+					users.addAll(userList);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoiceDetail.getId(),
+											workInvoiceDetail.getCreateBy(),
+											workInvoiceDetail.getComId(),
+											title,
+											str,
+											"40",
+											"0",
+											"待通知",
+											""));
+
+				} else {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoiceDetail.getId());
+					List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+					users.addAll(userList);
+					if (StringUtils.isNotBlank(workInvoiceDetail.getStatus()) && !workInvoiceDetail.getStatus().equals("3")){
+						title = "您的退票申请:"+workInvoiceDetail.getNumber()+"审核:被驳回!";
+						workInvoiceDetail.setStatus("4");
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workInvoiceDetail.getId(),
+												workInvoiceDetail.getCreateBy(),
+												workInvoiceDetail.getComId(),
+												title,
+												str,
+												"40",
+												"0",
+												"待通知",
+												""));
+					}
+				}
+			} else {
+				if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workinvoicereturn")) {
+					title = "退票申请人:"+UserUtils.get(workInvoiceDetail.getCreateBy().getId()).getName()+",退票发票号:"+workInvoiceDetail.getNumber()+" 待审批!";
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoiceDetail.getId());
+					List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+					users.addAll(userList);
+					WorkProjectNotify workProjectNotify = UtilNotify
+							.saveNotify(workInvoiceDetail.getId(),
+									new User(),
+									workInvoiceDetail.getComId(),
+									title,
+									str,
+									"40",
+									"0",
+									"待审批",
+									"");
+					List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+							activities,
+							workProjectNotify,
+							taskDefKey,
+							workInvoiceDetail.getAct().getFlag(),
+							taskCount,
+							workInvoiceDetail.getCreateBy(),
+							workInvoiceDetail.getOfficeId(),
+							"6");
+					for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+						users.add(workProjectNotify1.getUser());
+						workProjectNotify1.setId("");
+						workProjectNotify1.setIsNewRecord(false);
+						workProjectNotifyService
+								.save(workProjectNotify1);
+					}
+
+				} else {
+					if (!"yes".equals(workInvoiceDetail.getAct().getFlag())) {
+						title = "您的退票申请单:"+workInvoiceDetail.getNumber()+"被驳回,请重新申请!";
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoiceDetail.getId());
+						List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+						users.addAll(userList);
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workInvoiceDetail.getId(),
+												workInvoiceDetail.getCreateBy(),
+												workInvoiceDetail.getComId(),
+												title,
+												str,
+												"40",
+												"0",
+												"重新申请",
+												""));
+						users.add( workInvoiceDetail.getCreateBy());
+					} else {
+						if (StringUtils.isNotBlank(enname)) {
+							title = "退票申请人:"+UserUtils.get(workInvoiceDetail.getCreateBy().getId()).getName()+",退票发票号:"+workInvoiceDetail.getNumber()+" 待审批!";
+							WorkProjectNotify notify = new WorkProjectNotify();
+							notify.setNotifyId(workInvoiceDetail.getId());
+							List<User> userList1 = workProjectNotifyService.readByNotifyId(notify);
+							users.addAll(userList1);
+							WorkProjectNotify workProjectNotify = UtilNotify
+									.saveNotify(workInvoiceDetail.getId(),
+											new User(),
+											workInvoiceDetail.getComId(),
+											title,
+											str,
+											"40",
+											"0",
+											"待审批",
+											"");
+							List<User> userList = UserUtils.getByRoleActivityEnnames(enname,workInvoiceDetail.getOfficeId(),"6",workInvoiceDetail.getCreateBy());
+							for (User user1:userList){
+								users.add(user1);
+								workProjectNotify.setUser(user1);
+								workProjectNotify.setId("");
+								workProjectNotify.setIsNewRecord(false);
+								workProjectNotifyService
+										.save(workProjectNotify);
+							}
+						}else {
+							title = "您的退票申请单:"+workInvoiceDetail.getNumber()+"被驳回,请重新申请!";
+							WorkProjectNotify notify = new WorkProjectNotify();
+							notify.setNotifyId(workInvoiceDetail.getId());
+							List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+							users.addAll(userList);
+							users.add(workInvoiceDetail.getCreateBy());
+							workProjectNotifyService
+									.save(UtilNotify
+											.saveNotify(workInvoiceDetail.getId(),
+													workInvoiceDetail.getCreateBy(),
+													workInvoiceDetail.getComId(),
+													title,
+													str,
+													"40",
+													"0",
+													"重新申请",
+													""));
+						}
+					}
+				}
+			}
+			if (StringUtils.isNotBlank(title) && users!=null && users.size()!=0) {
+				for (User u : users) {
+					/*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(u.getId());
+					for (WebSocket toUserConn : toUserConns) {
+						String message = "{\"to\":\""+u.getId()+"\"," +
+								"\"msg\":\"审批信息 "+title+"\"," +
+								"\"useType\":\"sys\"}";
+						ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+					}*/
+					UserUtils.pushIm(u.getId(),title);
+
+				}
+			}
+			workInvoiceDetailDao.update(workInvoiceDetail);
+			return "保存审核意见成功!";
+		}catch (ActivitiObjectNotFoundException e){
+			logger.error("ActivitiObjectNotFoundException e:"+e);
+			return "流程已审批,不能重新审批!";
+		}catch (Exception e){
+			logger.error("Exception e:"+e);
+			return "保存审核意见失败!!";
+		}
+	}
+
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public FilialeWorkInvoiceDetail getByProcessInstanceId(String processInstanceId) {
+		FilialeWorkInvoiceDetail workInvoiceDetail = workInvoiceDetailDao.getByProcessInstanceId(processInstanceId);
+		return workInvoiceDetail;
+	}
+
+	@Transactional(readOnly = false)
+	public void cancelInvalidate(FilialeWorkInvoiceDetail workInvoiceDetail) {
+		String invalidateProcessInstanceId = workInvoiceDetail.getProcessInstanceId();
+		try {
+			//将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
+			WorkActivityProcess process = new WorkActivityProcess();
+			process.setProcessInstanceId(workInvoiceDetail.getProcessInstanceId());
+			process.setIsApproval("0");
+			//List<WorkActivityProcess> processList1 = workActivityProcessService.findByProcInsId(process);
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(workInvoiceDetail.getProcessInstanceId());
+			List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
+			WorkProjectNotify notify = new WorkProjectNotify();
+			notify.setNotifyId(workInvoiceDetail.getId());
+			List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+			if (userList!=null && userList.size()!=0) {
+				for (User u : userList) {
+					User user = UserUtils.get(u.getId());
+					/*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(u.getId());
+					for (WebSocket toUserConn : toUserConns) {
+						String message = "{\"to\":\""+u.getId()+"\"," +
+								"\"msg\":\"审批信息 退票申请人:"+ user.getName()+",退票发票单号:"+workInvoiceDetail.getNumber() +" 强制撤销!\"," +
+								"\"useType\":\"sys\"}";
+						ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+					}*/
+					UserUtils.pushIm(u.getId(),"退票申请人:"+ user.getName()+",退票发票单号:"+workInvoiceDetail.getNumber() +" 强制撤销!");
+
+				}
+			}
+			if(processList!=null && processList.size()>0){
+				for (int i =0;i<processList.size();i++) {
+					WorkActivityProcess p = processList.get(i);
+					if(StringUtils.isNotBlank(p.getIsApproval()) && "0".equals(p.getIsApproval())){
+						p.setDelFlag("1");
+						p.setIsApproval("-1");
+						workActivityProcessDao.updateDelFlagAndIsApproval(p);
+					}
+				}
+				WorkActivityProcess pro = new WorkActivityProcess();
+				pro.setId("");
+				pro.preInsert();
+				pro.setDelFlag("0");
+				pro.setRemarks("[强制撤销]");
+				pro.setProcessKey(processList.get(0).getProcessKey());
+				pro.setIsApproval("1");
+				pro.setProcessInstanceId(processList.get(0).getProcessInstanceId());
+				pro.setCount(0);
+				workActivityProcessDao.insert(pro);
+			}
+
+			//结束该流程,设为"撤销"状态
+			actTaskService.endProcessInstance(invalidateProcessInstanceId,"报销-强制撤销");
+			workInvoiceDetail.setStatus("3");
+			workInvoiceDetail.preUpdate();
+			workInvoiceDetailDao.update(workInvoiceDetail);
+
+		}catch (ActivitiObjectNotFoundException e){
+			logger.error("Exception e:"+e);
+			System.err.println("撤销异常,因为这个流程已不存在!");
+			e.printStackTrace();
+		}
+		catch (Exception e) {
+			logger.error("Exception e:"+e);
+			e.printStackTrace();
+		}
+
+	}
+
+    public Page<FilialeWorkInvoiceDetail> findPageByCompany(Page<FilialeWorkInvoiceDetail> workInvoiceDetailPage, FilialeWorkInvoiceDetail invoice) {
+        invoice.setPage(workInvoiceDetailPage);
+        List<FilialeWorkInvoiceDetail> invoiceDetails = dao.findPageByCompany(invoice);
+        workInvoiceDetailPage.setList(invoiceDetails);
+        return workInvoiceDetailPage;
+    }
+
+    public void updateSettleFlag(FilialeWorkInvoiceDetail invoice) {
+        dao.updateSettleFlag(invoice);
+    }
+
+	public int countByNumber(String number) {
+		return dao.countByNumber(number);
+	}
+
+    public int countByNumAndComp(String invoiceNum, String comId) {
+        return dao.countByNumAndComp(invoiceNum,comId);
+    }
+}

+ 794 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceReturnService.java

@@ -0,0 +1,794 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.service;
+
+import com.google.common.collect.Maps;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.MenuStatusEnum;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.filialeWorkInvoice.dao.FilialeWorkInvoiceReturnDao;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoice;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceDetail;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceReturn;
+import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
+import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
+import com.jeeplus.modules.serialnum.service.SerialNumTplService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
+import com.jeeplus.modules.workactivity.entity.Activity;
+import com.jeeplus.modules.workactivity.entity.WorkActivityProcess;
+import com.jeeplus.modules.workactivity.service.ActivityService;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workactivitymenu.entity.WorkActivityMenu;
+import com.jeeplus.modules.workactivitymenu.service.WorkActivityMenuService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.activiti.engine.ActivitiObjectNotFoundException;
+import org.activiti.engine.IdentityService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 退票管理Service
+ * @author lw
+ * @version 2018-06-15
+ */
+@Service
+@Transactional(readOnly = true)
+public class FilialeWorkInvoiceReturnService extends CrudService<FilialeWorkInvoiceReturnDao, FilialeWorkInvoiceReturn> {
+	@Autowired
+	private SerialNumTplService serialNumTplService;
+	@Autowired
+	private IdentityService identityService;
+	@Autowired
+	private WorkActivityMenuService workActivityMenuService;
+	@Autowired
+	private FilialeWorkInvoiceService workInvoiceService;
+	@Autowired
+	private WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	private RuntimeService runtimeService;
+	@Autowired
+	private WorkActivityProcessService workActivityProcessService;
+	@Autowired
+	private FilialeWorkInvoiceReturnDao workInvoiceReturnDao;
+	@Autowired
+	private ActTaskService actTaskService;
+	@Autowired
+	private ActivityService activityService;
+	@Autowired
+	private WorkActivityProcessDao workActivityProcessDao;
+	@Autowired
+	private FilialeWorkInvoiceDetailService workInvoiceDetailService;
+	@Autowired
+	private ProjectRecordsService projectRecordsService;
+	@Autowired
+	private OfficeService officeService;
+
+
+	public FilialeWorkInvoiceReturn get(String id) {
+		FilialeWorkInvoiceReturn workInvoiceReturn = super.get(id);
+		if(workInvoiceReturn!=null){
+			String wId = workInvoiceReturn.getInvoiceDetail().getId();
+			if(StringUtils.isNotBlank(wId)){
+				FilialeWorkInvoiceDetail workInvoiceDetail = workInvoiceDetailService.get(wId);
+				if(workInvoiceDetail!=null){
+					if(workInvoiceDetail.getWorkInvoice()!=null){
+						String wId2 = workInvoiceDetail.getWorkInvoice().getId();
+						if(StringUtils.isNotBlank(wId2)){
+							FilialeWorkInvoice workInvoice = workInvoiceService.get(wId2);
+							if(workInvoice!=null){
+								workInvoiceDetail.setWorkInvoice(workInvoice);
+								if(workInvoice.getProject()!=null){
+									ProjectRecords projectRecords = workInvoice.getProject();
+										if(projectRecords!=null){
+											//设置项目组成员
+											projectRecordsService.queryUserNames(projectRecords);
+
+									}
+								}
+							}
+						}
+					}
+					workInvoiceReturn.setInvoiceDetail(workInvoiceDetail);
+				}
+			}
+		}
+		return workInvoiceReturn;
+	}
+	
+	public List<FilialeWorkInvoiceReturn> findList(FilialeWorkInvoiceReturn workInvoiceReturn) {
+		return super.findList(workInvoiceReturn);
+	}
+	
+	public Page<FilialeWorkInvoiceReturn> findPage(Page<FilialeWorkInvoiceReturn> page, FilialeWorkInvoiceReturn workInvoiceReturn) {
+		workInvoiceReturn.getSqlMap().put("dsf", dataScopeFilter(workInvoiceReturn.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_INVOICERETURN.getValue()));
+		workInvoiceReturn.setPage(page);
+		page.setList(findList(workInvoiceReturn));
+		return page;
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(FilialeWorkInvoiceReturn workInvoiceReturn) {
+		if (StringUtils.isBlank(workInvoiceReturn.getReturnNumber())) {
+			User user = UserUtils.getUser();
+			workInvoiceReturn.setReturnNumber(serialNumTplService.genSerialNum(user.getCompany(), workInvoiceReturn.SERIAL_BIZCODE));
+		}
+		super.save(workInvoiceReturn);
+	}
+
+	@Transactional(readOnly = false)
+	public String save(FilialeWorkInvoiceReturn workInvoiceReturn, Map<String, Object> variables, String processInstanceId) {
+		try {
+			User user = UserUtils.getUser();
+			if (StringUtils.isBlank(workInvoiceReturn.getReturnNumber())) {
+				workInvoiceReturn.setReturnNumber(serialNumTplService.genSerialNum(user.getCompany(), workInvoiceReturn.SERIAL_BIZCODE));
+			}
+			FilialeWorkInvoice workInvoice = new FilialeWorkInvoice();
+			Office office = officeService.get(workInvoiceReturn.getOfficeId());
+			if(workInvoiceReturn.getInvoiceDetail()!=null){
+				if(workInvoiceReturn.getInvoiceDetail().getWorkInvoice()!=null){
+					if(StringUtils.isNotBlank(workInvoiceReturn.getInvoiceDetail().getWorkInvoice().getId())){
+						workInvoice = workInvoiceService.get(workInvoiceReturn.getInvoiceDetail().getWorkInvoice());
+						if(workInvoice!=null && workInvoice.getOffice()!=null){
+							String oId = workInvoice.getOffice().getId();
+							if(StringUtils.isNotBlank(oId)){
+								office = officeService.get(oId);
+							}
+						}
+					}
+				}
+			}
+			super.save(workInvoiceReturn);
+			String str =  "被退票号:"+workInvoiceReturn.getInvoiceDetail().getNumber()+",实际开票单位:"+workInvoice.getClient().getName()+",申请人:"+user.getName()+",所属部门:"+office.getName();
+			String title = "实际开票单位:"+workInvoice.getClient().getName();
+			// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+			identityService.setAuthenticatedUserId(user.getId());
+			String businessKey = workInvoiceReturn.getId().toString();
+			WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c82bdea9uiopc750906", office);//menuid
+			// 启动流程
+			String processType = workActivityMenu.getProcessType();
+			StringBuffer buffer = new StringBuffer();
+			Activity activity = new Activity();
+			WorkProjectNotify workProjectNotify = UtilNotify
+					.saveNotify(workInvoiceReturn.getId(),
+							null,
+							workInvoiceReturn.getCompanyId(),
+							title,
+							str,
+							"40",
+							"0",
+							"待审批",
+							""
+					);
+			List<User> users = new ArrayList<>();
+			List<User> fpglys = new ArrayList<>();
+			List<User> zgkjs = new ArrayList<>();
+			List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"6",workInvoiceReturn.getCreateBy());
+			if(workInvoice!=null){
+				//1总公司0分公司
+				if("1".equals(workInvoice.getExt())){
+					fpglys = UserUtils.getByRoleActivityEnname("fpgly",1,office.getId(),"6",workInvoiceReturn.getCreateBy());
+					zgkjs = UserUtils.getByRoleActivityEnname("zghj",1,office.getId(),"6",workInvoiceReturn.getCreateBy());
+				}else if("0".equals(workInvoice.getExt())){
+					fpglys = UserUtils.getByRoleActivityEnname("fpgly",3,office.getId(),"6",workInvoiceReturn.getCreateBy());
+					zgkjs = UserUtils.getByRoleActivityEnname("zghj",3,office.getId(),"6",workInvoiceReturn.getCreateBy());
+				}
+			}
+			if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+				workProjectNotify.setNotifyRole("");
+				workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+				List<Activity> activities = workActivityMenu.getActivities();
+				for (Activity a : activities) {
+					String encount = a.getEncount();
+					String enlist = a.getEnlist();
+					if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+						List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"6",workInvoiceReturn.getCreateBy());
+						if (enusers.size()==0){
+							workInvoiceReturn.setStatus("1");
+							this.save(workInvoiceReturn);
+							return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
+						}
+						variables.put(enlist, enusers);
+						variables.put(encount, enusers.size());
+					}
+					if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+						activity = a;
+					}
+				}
+				buffer.append(activity.getRole().getEnname());
+				if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+					//角色审批
+					if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+						users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"6",workInvoiceReturn.getCreateBy());
+					}
+					//人员审批
+					if (StringUtils.isNotBlank(activity.getUser().getId())) {
+						users.add(activity.getUser());
+					}
+				}
+				workProjectNotify.setId("");
+			} else {
+
+				/*variables.put("fgldList", fglds);
+				variables.put("fpglyList", fpglys);
+				variables.put("zgkjList", zgkjs);*/
+				if (bmzrs.size()==0){
+					workInvoiceReturn.setStatus("1");
+					this.save(workInvoiceReturn);
+				}
+				if (bmzrs.size()==0){
+					return "流程审批人不能为空,角色部门负责人下无用户,请联系管理员!";
+				}
+				/*if (fglds.size()==0){
+					return "流程审批人不能为空,角色分管领导下无用户,请联系管理员!";
+				}
+				if (fpglys.size()==0){
+					return "流程审批人不能为空,角色发票管理员下无用户,请联系管理员!";
+				}
+				if (zgkjs.size()==0){
+					return "流程审批人不能为空,角色主管会计下无用户,请联系管理员!";
+				}*/
+				/*variables.put("fgldcount",fglds.size());
+				variables.put("fpglycount",fpglys.size());
+				variables.put("zgkjcount",zgkjs.size());*/
+				variables.put("bmzrcount",bmzrs.size());
+				variables.put("bmzrList",bmzrs);
+				processType = "workinvoicereturn";
+				users.addAll(bmzrs);
+			}
+			for (User u : users){
+				workProjectNotify.setUser(u);
+				workProjectNotify.setId("");
+				workProjectNotifyService
+						.save(workProjectNotify);
+				/*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(u.getId());
+				for (WebSocket toUserConn:toUserConns) {
+					String message = "{\"to\":\""+u.getId()+"\"," +
+							"\"msg\":\"审批信息 申请人:" + user.getName() + ",退票申请编号:"+workInvoiceReturn.getReturnNumber() + " 待审批!\"," +
+							"\"useType\":\"sys\"}";
+					ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+				}*/
+				Map<String,Object> extras = new HashMap<>();
+				extras.put("type","7002");
+				extras.put("id",workProjectNotify.getId());
+				extras.put("procDefKey","40");
+				UserUtils.pushInfoToApp(title,str,extras,u.getId());
+				UserUtils.pushIm(u.getId(),str);
+			}
+			variables.put("type", processType);
+			variables.put("busId", businessKey);
+			variables.put("title", "审批单:" + workInvoiceReturn.getNumber());//设置标题;
+
+			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+			workInvoiceReturn.setProcessInstance(processInstance);
+			if (StringUtils.isNotBlank(processInstanceId)) {
+				workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+				workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+				workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+			}
+			// 更新流程实例ID
+			workInvoiceReturn.setProcessInstanceId(processInstance.getId());
+			workInvoiceReturnDao.updateProcessInstanceId(workInvoiceReturn);
+			List<Activity> list = workActivityMenu.getActivities();
+			if (list != null && list.size() != 0) {
+				workActivityProcessService.saveList(list, processInstance.getId());
+			} else {
+				WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+				workActivityProcess.setProcessKey("workinvoicereturn");
+				workActivityProcess.setCount(1);
+				workActivityProcess.setProcessInstanceId(processInstance.getId());
+				workActivityProcess.setIsApproval("0");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcess.setCount(2);
+				workActivityProcess.setId("");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcess.setCount(3);
+				workActivityProcess.setId("");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcessService.insertAuditsByType(bmzrs,processInstance.getId(),1,1);
+				workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),2,0);
+				workActivityProcessService.insertAuditsByType(zgkjs,processInstance.getId(),3,0);
+
+			}
+			logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+					ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+		}catch (Exception e){
+			logger.info("Exception e:"+e);
+			return "Exception e:"+e;
+		}
+		return "";
+	}
+	@Transactional(readOnly = false)
+	public void delete(FilialeWorkInvoiceReturn workInvoiceReturn) {
+		super.delete(workInvoiceReturn);
+		WorkProjectNotify notify = new WorkProjectNotify();
+		notify.setNotifyId(workInvoiceReturn.getId());
+		List<User> users = workProjectNotifyService.readByNotifyId(notify);
+		if (users!=null && users.size()!=0){
+			for (User user:users){
+				UserUtils.pushMeIm(user.getId());
+			}
+		}
+	}
+
+	/**
+	 * 审核流程
+	 * @param
+	 */
+	@Transactional(readOnly = false)
+	public String auditSave(FilialeWorkInvoiceReturn workInvoiceReturn,List<User> auditUsers) {
+		FilialeWorkInvoice workInvoice = new FilialeWorkInvoice();
+		Office office = officeService.get(workInvoiceReturn.getOfficeId());
+		if(workInvoiceReturn.getInvoiceDetail()!=null){
+			if(workInvoiceReturn.getInvoiceDetail().getWorkInvoice()!=null){
+				if(StringUtils.isNotBlank(workInvoiceReturn.getInvoiceDetail().getWorkInvoice().getId())){
+					workInvoice = workInvoiceService.get(workInvoiceReturn.getInvoiceDetail().getWorkInvoice());
+					if(workInvoice!=null && workInvoice.getOffice()!=null){
+						String oId = workInvoice.getOffice().getId();
+						if(StringUtils.isNotBlank(oId)){
+							office = officeService.get(oId);
+						}
+					}
+				}
+			}
+		}
+		super.save(workInvoiceReturn);
+		String userName = UserUtils.get(workInvoiceReturn.getCreateBy().getId()).getName();
+		String str =  "被退票号:"+workInvoiceReturn.getInvoiceDetail().getNumber()+",实际开票单位:"+workInvoice.getClient().getName()+",申请人:"+userName+",所属部门:"+office.getName();
+		String title = "实际开票单位:"+workInvoice.getClient().getName();
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workInvoiceReturn.getAct().getTaskDefKey();
+		if (!"modifyApply".equals(taskDefKey) && !taskDefKey.contains("audit")) {
+			actTaskService.claim(workInvoiceReturn.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else {
+			workInvoiceReturn.getAct().setFlag("yes");
+		}
+		String comment = "";
+		if (workInvoiceReturn.getStatus().equals("4")){
+			comment = ("yes".equals(workInvoiceReturn.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+		}else {
+			comment = ("yes".equals(workInvoiceReturn.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoiceReturn.getAct().getComment();
+		}
+		//yes 的时候状态为审核通过 否则为未通过
+		//1 审核中 2 未通过
+		workInvoiceReturn.setStatus(("yes".equals(workInvoiceReturn.getAct().getFlag()) ? "2" : "4"));
+		Map<String, Object> vars = Maps.newHashMap();
+		//业务逻辑对应的条件表达式
+		String exp = "";
+		String taskCount = "";
+		String notifyRole = "";
+		int key = 0;
+		String enname = "";
+		List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoiceReturn.getProcessInstanceId());
+		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+		if (activitieList != null && activitieList.size() != 0) {
+			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+			workActivityMenu.setActivities(activitieList);
+		}
+
+		WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+		WorkActivityProcess selectProcess = new WorkActivityProcess();
+		selectProcess.setProcessInstanceId(workInvoiceReturn.getProcessInstanceId());
+		List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+		List<Activity> activities = workActivityMenu.getActivities();
+		if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workinvoicereturn")) {
+			key = 1;
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+					taskCount = activityProcess.getCount()+"";
+					workActivityProcess = activityProcess;
+					if (!workActivityProcess.getIsApproval().equals("0")) {
+						workActivityProcess.setId("");
+					}
+					exp = "pass";
+					if (!"yes".equals(workInvoiceReturn.getAct().getFlag())) {
+						workInvoiceReturn.setStatus("4");
+						workActivityProcess.setIsApproval("2");
+						String returnBack = "-1";
+						for (Activity activity : activities) {
+							if (activity.getCount() == activityProcess.getCount()) {
+								notifyRole = activity.getName();
+								returnBack = activity.getReturnBack();
+								break;
+							}
+						}
+						if (returnBack.equals("0")) {
+							workActivityProcess.setId("");
+						}
+
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+				}else if(taskDefKey.equals("modifyApply")){
+					notifyRole = "调整申请";
+					taskCount = "0";
+					exp = "pass";
+					workActivityProcess.setId("");
+					workActivityProcess.setCount(0);
+					if (!"yes".equals(workInvoiceReturn.getAct().getFlag())) {
+						workInvoiceReturn.setStatus("3");
+						workActivityProcess.setIsApproval("2");
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+					break;
+				}
+			}
+		} else {
+			workActivityMenu.setProcessType("workinvoicereturn");
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				String count = activityProcess.getCount() + "";
+				workActivityProcess = activityProcess;
+				if (!workActivityProcess.getIsApproval().equals("0")) {
+					workActivityProcess.setId("");
+				}
+				// 审核环节
+				if ("bmzr".equals(taskDefKey) && count.contains("1")) {
+					taskCount = "1";
+					exp = "pass";
+					if ("yes".equals(workInvoiceReturn.getAct().getFlag())) {
+						workActivityProcessService.insertAuditsByType(auditUsers,workInvoiceReturn.getProcessInstanceId(),2,1);
+						notifyRole = "发票管理员审核";
+						workActivityProcess.setIsApproval("1");
+						enname = "fpgly";
+						vars.put("fpglyList", auditUsers);
+						vars.put("fpglycount",auditUsers.size());
+					} else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				} else if ("fpgly".equals(taskDefKey) && count.contains("2")) {
+					taskCount = "2";
+					exp = "pass";
+					if ("yes".equals(workInvoiceReturn.getAct().getFlag())) {
+						workActivityProcessService.insertAuditsByType(auditUsers,workInvoiceReturn.getProcessInstanceId(),3,1);
+						workActivityProcess.setIsApproval("1");
+						notifyRole = "主管会计审核";
+						enname = "zgkj";
+						vars.put("zgkjList", auditUsers);
+						vars.put("zgkjcount",auditUsers.size());
+					} else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				} else if ("zgkj".equals(taskDefKey) && count.contains("3")) {
+					taskCount = "3";
+					exp = "pass";
+					if ("yes".equals(workInvoiceReturn.getAct().getFlag())) {
+						workActivityProcess.setIsApproval("1");
+						notifyRole = "审核通过";
+					} else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				}  else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+					taskCount = "0";
+					exp = "pass";
+					workActivityProcess.setCount(0);
+					enname = "bmzr";
+					if (!"yes".equals(workInvoiceReturn.getAct().getFlag())) {
+						workInvoiceReturn.setStatus("3");
+					}
+					break;
+				} else if ("apply_end".equals(taskDefKey)) {
+				}
+
+			}
+		}
+		// 设置意见
+		workInvoiceReturn.getAct().setComment(("yes".equals(workInvoiceReturn.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workInvoiceReturn.getAct().getComment());
+		workInvoiceReturn.preUpdate();
+		// 提交流程任务
+		vars.put(exp, "yes".equals(workInvoiceReturn.getAct().getFlag()) ? true : false);
+		vars.put("passs", true);
+		workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workInvoiceReturn.getProcessInstanceId(),taskDefKey,"modifyApply",workInvoiceReturn.getAct().getFlag(),comment, activities);
+		// 提交流程任务
+		actTaskService.complete(workInvoiceReturn.getAct().getTaskId(), workInvoiceReturn.getAct().getProcInsId(), workInvoiceReturn.getAct().getComment(), vars);
+		boolean state = actTaskService.isProcessEnd(workInvoiceReturn.getAct().getProcInsId());
+		List<User> users = new ArrayList<>();
+		List<User> userList = new ArrayList<>();
+		if (!state) {
+			str =  "被退票号:"+workInvoiceReturn.getInvoiceDetail().getNumber()+",实际开票单位:"+workInvoice.getClient().getName();
+			title = "实际开票单位:"+workInvoice.getClient().getName();
+			users.add(workInvoiceReturn.getCreateBy());
+			if ("yes".equals(workInvoiceReturn.getAct().getFlag())) {
+				workInvoiceReturn.setStatus("5");
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoiceReturn.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				workProjectNotifyService
+						.save(UtilNotify
+								.saveNotify(workInvoiceReturn.getId(),
+										workInvoiceReturn.getCreateBy(),
+										workInvoiceReturn.getCompanyId(),
+										title,
+										str,
+										"40",
+										"0",
+										"待通知",
+										notifyRole));
+
+			} else {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoiceReturn.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				if (StringUtils.isNotBlank(workInvoiceReturn.getStatus()) && !workInvoiceReturn.getStatus().equals("3")){
+					workInvoiceReturn.setStatus("4");
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoiceReturn.getId(),
+											workInvoiceReturn.getCreateBy(),
+											workInvoiceReturn.getCompanyId(),
+											title,
+											str,
+											"40",
+											"0",
+											"待通知",
+											notifyRole));
+				}
+			}
+			workActivityProcessService.deleteProcessIdAuditUsers(workInvoiceReturn.getProcessInstanceId());
+		} else {
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("workinvoicereturn")) {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoiceReturn.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				WorkProjectNotify workProjectNotify = UtilNotify
+						.saveNotify(workInvoiceReturn.getId(),
+								new User(),
+								workInvoiceReturn.getCompanyId(),
+								title,
+								str,
+								"40",
+								"0",
+								"待审批",
+								notifyRole);
+				List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+						activities,
+						workProjectNotify,
+						taskDefKey,
+						workInvoiceReturn.getAct().getFlag(),
+						taskCount,
+						workInvoiceReturn.getCreateBy(),
+						office.getId(),
+						"6");
+				for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+					users.add(workProjectNotify1.getUser());
+					workProjectNotify1.setId("");
+					workProjectNotify1.setIsNewRecord(false);
+					workProjectNotifyService
+							.save(workProjectNotify1);
+					if (!"modifyApply".equals(taskDefKey)){
+						Map<String,Object> extras = new HashMap<>();
+						if ("fpgly".equals(taskDefKey) || "zgkj".equals(taskDefKey) ){
+							extras.put("type","7001");
+						}else {
+							extras.put("type","7002");
+						}
+						extras.put("id",workProjectNotify.getId());
+						extras.put("procDefKey","40");
+						UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+					}
+				}
+
+			} else {
+				if (!"yes".equals(workInvoiceReturn.getAct().getFlag())) {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoiceReturn.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoiceReturn.getId(),
+											workInvoiceReturn.getCreateBy(),
+											workInvoiceReturn.getCompanyId(),
+											title,
+											str,
+											"40",
+											"0",
+											"重新申请",
+											notifyRole));
+					users.add( workInvoiceReturn.getCreateBy());
+				} else {
+					if (StringUtils.isNotBlank(enname)) {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoiceReturn.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						WorkProjectNotify workProjectNotify = UtilNotify
+								.saveNotify(workInvoiceReturn.getId(),
+										new User(),
+										workInvoiceReturn.getCompanyId(),
+										title,
+										str,
+										"40",
+										"0",
+										"待审批",
+										notifyRole);
+						for (User user1:auditUsers){
+							users.add(user1);
+							workProjectNotify.setUser(user1);
+							workProjectNotify.setId("");
+							workProjectNotify.setIsNewRecord(false);
+							workProjectNotifyService
+									.save(workProjectNotify);
+							if (!"modifyApply".equals(taskDefKey)){
+								Map<String,Object> extras = new HashMap<>();
+								if ("fpgly".equals(taskDefKey) || "zgkj".equals(taskDefKey) ){
+									extras.put("type","7001");
+								}else {
+									extras.put("type","7002");
+								}
+								extras.put("id",workProjectNotify.getId());
+								extras.put("procDefKey","40");
+								UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+							}
+						}
+					}else {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoiceReturn.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						users.addAll(userList);
+						users.add(workInvoiceReturn.getCreateBy());
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workInvoiceReturn.getId(),
+												workInvoiceReturn.getCreateBy(),
+												workInvoiceReturn.getCompanyId(),
+												title,
+												str,
+												"40",
+												"0",
+												"重新申请",
+												notifyRole));
+					}
+				}
+			}
+		}
+		if (users!=null && users.size()!=0) {
+			for (User u : users) {
+				UserUtils.pushIm(u.getId(),str);
+			}
+		}
+		if (userList!=null && userList.size()!=0) {
+			for (User u : userList) {
+				UserUtils.pushMeIm(u.getId());
+			}
+		}
+		workInvoiceReturnDao.update(workInvoiceReturn);
+		if("5".equals(workInvoiceReturn.getStatus())){
+			if(workInvoiceReturn.getInvoiceDetail()!=null){
+				String wid = workInvoiceReturn.getInvoiceDetail().getId();
+				FilialeWorkInvoiceDetail workInvoiceDetail = workInvoiceDetailService.get(wid);
+				//作废
+				if("2".equals(workInvoiceReturn.getCancleReturn())){
+					workInvoiceDetail.setState("作废");
+					workInvoiceDetailService.save(workInvoiceDetail);
+				}else{
+					//退票
+					workInvoiceDetail.setBackSign("被退");//被退标记置为1
+					workInvoiceDetailService.save(workInvoiceDetail);
+					//冲销发票
+					FilialeWorkInvoiceDetail invoiceDetail = new FilialeWorkInvoiceDetail();
+					invoiceDetail.setBackNumber(workInvoiceDetail.getNumber());
+					invoiceDetail.setBackCode(workInvoiceDetail.getCode());
+					invoiceDetail.setState("正常");
+					invoiceDetail.setBackSign("冲销");
+					invoiceDetail.setComId(workInvoiceDetail.getComId());
+					invoiceDetail.setOfficeId(workInvoiceDetail.getOfficeId());
+					invoiceDetail.setNumber(workInvoiceReturn.getNumber());
+					invoiceDetail.setCode(workInvoiceReturn.getCode());
+					invoiceDetail.setReturnId(workInvoiceDetail.getId());
+					invoiceDetail.setTotalMoney("-"+workInvoiceDetail.getTotalMoney());
+					invoiceDetail.setTax(workInvoiceDetail.getTax());
+					invoiceDetail.setTaxMoney("-"+workInvoiceDetail.getTaxMoney());
+					invoiceDetail.setTaxRate("-"+workInvoiceDetail.getTaxRate());
+					invoiceDetail.setIncomeMoney("-"+workInvoiceDetail.getIncomeMoney());
+					invoiceDetail.setInvoiceId(workInvoiceDetail.getInvoiceId());
+					invoiceDetail.setDate(workInvoiceDetail.getDate());
+					invoiceDetail.setId("");
+					workInvoiceDetailService.save(invoiceDetail);
+				}
+			}
+		}
+		return "保存审核意见成功!";
+	}
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public FilialeWorkInvoiceReturn getByProcessInstanceId(String processInstanceId) {
+		FilialeWorkInvoiceReturn workInvoiceReturn = workInvoiceReturnDao.getByProcessInstanceId(processInstanceId);
+		return workInvoiceReturn;
+	}
+
+	@Transactional(readOnly = false)
+	public void cancelInvalidate(FilialeWorkInvoiceReturn workInvoiceReturn) {
+		String invalidateProcessInstanceId = workInvoiceReturn.getProcessInstanceId();
+		try {
+			//将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
+			WorkActivityProcess process = new WorkActivityProcess();
+			process.setProcessInstanceId(workInvoiceReturn.getProcessInstanceId());
+			process.setIsApproval("0");
+			//List<WorkActivityProcess> processList1 = workActivityProcessService.findByProcInsId(process);
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(workInvoiceReturn.getProcessInstanceId());
+			List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
+			WorkProjectNotify notify = new WorkProjectNotify();
+			notify.setNotifyId(workInvoiceReturn.getId());
+			List<User> userList = workProjectNotifyService.readByNotifyId(notify);
+			if (userList!=null && userList.size()!=0) {
+				for (User u : userList) {
+					User user = UserUtils.get(u.getId());
+					/*List<WebSocket> toUserConns = ChatServerPool.getWebSocketByUser(u.getId());
+					for (WebSocket toUserConn : toUserConns) {
+						String message = "{\"to\":\""+u.getId()+"\"," +
+								"\"msg\":\"审批信息 退票申请人:"+ user.getName()+",退票申请编号:"+workInvoiceReturn.getReturnNumber() +" 强制撤销!\"," +
+								"\"useType\":\"sys\"}";
+						ChatServerPool.sendMessageToUser(toUserConn, message);//同时向本人发送消息
+					}*/
+					UserUtils.pushIm(u.getId(),"退票申请人:"+ user.getName()+",退票申请编号:"+workInvoiceReturn.getReturnNumber() +" 强制撤销!");
+				}
+			}
+			if(processList!=null && processList.size()>0){
+				for (int i =0;i<processList.size();i++) {
+					WorkActivityProcess p = processList.get(i);
+					if(StringUtils.isNotBlank(p.getIsApproval()) && "0".equals(p.getIsApproval())){
+						p.setDelFlag("1");
+						p.setIsApproval("-1");
+						workActivityProcessDao.updateDelFlagAndIsApproval(p);
+					}
+				}
+				WorkActivityProcess pro = new WorkActivityProcess();
+				pro.setId("");
+				pro.preInsert();
+				pro.setDelFlag("0");
+				pro.setRemarks("[强制撤销]");
+				pro.setProcessKey(processList.get(0).getProcessKey());
+				pro.setIsApproval("1");
+				pro.setProcessInstanceId(processList.get(0).getProcessInstanceId());
+				pro.setCount(0);
+				workActivityProcessDao.insert(pro);
+			}
+
+			//结束该流程,设为"撤销"状态
+			actTaskService.endProcessInstance(invalidateProcessInstanceId,"报销-强制撤销");
+			workInvoiceReturn.setStatus("3");
+			workInvoiceReturn.preUpdate();
+			workInvoiceReturnDao.update(workInvoiceReturn);
+
+		}catch (ActivitiObjectNotFoundException e){
+			System.err.println("撤销异常,因为这个流程已不存在!");
+			e.printStackTrace();
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+    public int countByNumAndComp(String invoiceNum, String comId) {
+        return dao.countByNumAndComp(invoiceNum,comId);
+    }
+}

Різницю між файлами не показано, бо вона завелика
+ 3578 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/service/FilialeWorkInvoiceService.java


Різницю між файлами не показано, бо вона завелика
+ 1487 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/web/FilialeWorkInvoiceController.java


+ 459 - 0
src/main/java/com/jeeplus/modules/filialeWorkInvoice/web/FilialeWorkInvoiceReturnController.java

@@ -0,0 +1,459 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.filialeWorkInvoice.web;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.persistence.Page;
+import com.jeeplus.common.utils.DateUtils;
+import com.jeeplus.common.utils.MyBeanUtils;
+import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.excel.ExportExcel;
+import com.jeeplus.common.utils.excel.ImportExcel;
+import com.jeeplus.common.web.BaseController;
+import com.jeeplus.modules.act.entity.Act;
+import com.jeeplus.modules.act.service.ActTaskService;
+import com.jeeplus.modules.act.utils.ActUtils;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoice;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceReturn;
+import com.jeeplus.modules.filialeWorkInvoice.entity.FilialeWorkInvoiceReturnAlter;
+import com.jeeplus.modules.filialeWorkInvoice.service.FilialeWorkInvoiceReturnService;
+import com.jeeplus.modules.filialeWorkInvoice.service.FilialeWorkInvoiceService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import org.activiti.engine.HistoryService;
+import org.activiti.engine.RuntimeService;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.history.HistoricProcessInstance;
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.shiro.authz.annotation.Logical;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 退票管理Controller
+ * @author lw
+ * @version 2018-06-15
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/filialeWorkInvoiceReturn/filialeWorkInvoiceReturn")
+public class FilialeWorkInvoiceReturnController extends BaseController {
+
+	@Autowired
+	private FilialeWorkInvoiceReturnService workInvoiceReturnService;
+	@Autowired
+	protected RuntimeService runtimeService;
+
+	@Autowired
+	protected TaskService taskService;
+
+	@Autowired
+	private ActTaskService actTaskService;
+
+	@Autowired
+	private HttpServletRequest request;
+	@Autowired
+	private HistoryService historyService;
+
+	@Autowired
+	private FilialeWorkInvoiceService workInvoiceService;
+	@ModelAttribute
+	public FilialeWorkInvoiceReturn get(@RequestParam(required=false) String id) {
+		FilialeWorkInvoiceReturn entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = workInvoiceReturnService.get(id);
+		}
+		if (entity == null){
+			entity = new FilialeWorkInvoiceReturn();
+		}
+		return entity;
+	}
+	
+	/**
+	 * 退票管理列表页面
+	 */
+	@RequiresPermissions("workinvoicereturn:workInvoiceReturn:list")
+	@RequestMapping(value = {"list", ""})
+	public String list(FilialeWorkInvoiceReturn workInvoiceReturn, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<FilialeWorkInvoiceReturn> page = workInvoiceReturnService.findPage(new Page<FilialeWorkInvoiceReturn>(request, response), workInvoiceReturn);
+		model.addAttribute("page", page);
+		return "modules/workinvoicereturn/workInvoiceReturnList";
+	}
+
+	/**
+	 * 查看,增加,编辑退票管理表单页面
+	 */
+	//@RequiresPermissions(value={"workinvoicereturn:workInvoiceReturn:view","workinvoicereturn:workInvoiceReturn:add","workinvoicereturn:workInvoiceReturn:edit"},logical=Logical.OR)
+	@RequestMapping(value = "form")
+	public String form(FilialeWorkInvoiceReturn workInvoiceReturn, Model model) {
+		String view = "workInvoiceReturnForm";
+		Office office = UserUtils.getSelectOffice();
+		String tabId = request.getParameter("tabId");
+		if("1".equals(tabId)){
+			view = "workInvoiceReturnView";
+		}else if("3".equals(tabId)){
+			ProcessInstance processInstance = actTaskService.getProcIns(workInvoiceReturn.getProcessInstanceId());
+			if (processInstance!=null) {
+				Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+				Act act = new Act();
+				act.setTaskId(taskInfok.getId());
+				act.setTaskName(taskInfok.getName());
+				act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+				act.setProcDefId(taskInfok.getProcessDefinitionId());
+				act.setProcInsId(taskInfok.getProcessInstanceId());
+				act.setTask(taskInfok);
+				workInvoiceReturn.setAct(act);
+				view = "workInvoiceReturnModify";
+			}
+		}
+		// 环节编号
+		String taskDefKey = workInvoiceReturn.getAct().getTaskDefKey();
+		if (StringUtils.isNotBlank(taskDefKey) && !taskDefKey.equals("modifyApply")&& !taskDefKey.equals("fpgly")){
+			view = "workInvoiceReturnAudit";
+		}else if(StringUtils.isNotBlank(taskDefKey) && "fpgly".equals(taskDefKey)){
+			if(workInvoiceReturn.getReturnDate()==null){
+				workInvoiceReturn.setReturnDate(new Date());
+			}
+			view = "workInvoiceReturnfpglyAudit";
+		}
+		if(StringUtils.isBlank(workInvoiceReturn.getUname())){
+			workInvoiceReturn.setUname(UserUtils.getUser().getName());
+		}
+		model.addAttribute("workInvoiceReturn", workInvoiceReturn);
+		return "modules/workinvoicereturn/"+view;
+	}
+	@RequestMapping(value = "store")
+	public String store(FilialeWorkInvoiceReturn workInvoiceReturn,
+						Model model,
+						RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workInvoiceReturn)){
+			return form(workInvoiceReturn, model);
+		}
+
+		User user = workInvoiceReturn.getCreateBy();
+		String submitter = "";
+		if(user != null){
+			submitter = user.getId();
+		}
+		String sta = workInvoiceReturn.getStatus();
+		if(!UserUtils.getUser().getId().equals(submitter) && !Strings.isNullOrEmpty(submitter) && sta != null){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+		}
+		workInvoiceReturn.setStatus("1"); //暂存状态
+		workInvoiceReturn.setCompanyId(UserUtils.getSelectCompany().getId());
+		workInvoiceReturn.setOfficeId(UserUtils.getSelectOffice().getId());
+		if (StringUtils.isNotBlank(workInvoiceReturn.getProcessInstanceId()) && workInvoiceReturn.getProcessInstanceId().equals("NULL")){
+			workInvoiceReturn.setProcessInstanceId("");
+		}
+		if(!workInvoiceReturn.getIsNewRecord()){//编辑表单保存
+			FilialeWorkInvoiceReturn t = workInvoiceReturnService.get(workInvoiceReturn.getId());//从数据库取出记录的值
+			MyBeanUtils.copyBeanNotNull2Bean(workInvoiceReturn, t);//将编辑表单中的非NULL值覆盖数据库记录中的值
+			workInvoiceReturnService.save(t);//保存
+		}else{//新增表单保存
+			workInvoiceReturnService.save(workInvoiceReturn);//保存
+		}
+		addMessage(redirectAttributes, "退票申请暂存成功");
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+	}
+	/**
+	 * 保存退票管理
+	 */
+	@RequestMapping(value = "save")
+	public String save(FilialeWorkInvoiceReturn workInvoiceReturn, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workInvoiceReturn)){
+			return form(workInvoiceReturn, model);
+		}
+		User user = workInvoiceReturn.getCreateBy();
+		String sta = workInvoiceReturn.getStatus();
+		if(user!=null && !UserUtils.getUser().getId().equals(user.getId()) && StringUtils.isNotBlank(user.getId())){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+		}
+		//状态设置为审核中
+		workInvoiceReturn.setStatus("2");
+		String processInstanceId ="";
+		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(sta) && "3".equals(sta)){
+			processInstanceId = workInvoiceReturnService.get(workInvoiceReturn.getId()).getProcessInstanceId();
+		}
+//		try {
+			Map<String, Object> variables = Maps.newHashMap();
+			workInvoiceReturn.setCompanyId(UserUtils.getSelectCompany().getId());
+			workInvoiceReturn.setOfficeId(UserUtils.getSelectOffice().getId());
+			String str = workInvoiceReturnService.save(workInvoiceReturn, variables,processInstanceId);
+			if (StringUtils.isNotBlank(str)){
+				addMessage(redirectAttributes, "退票申请提交失败:"+str);
+			}else {
+				addMessage(redirectAttributes, "退票申请已经提交");
+			}
+
+//		} catch (Exception e) {
+//			addMessage(redirectAttributes, "退票申请提交失败!");
+//			addMessage(redirectAttributes, "系统内部错误");
+//		}
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+	}
+	
+	/**
+	 * 删除退票管理
+	 */
+	@RequiresPermissions("workinvoicereturn:workInvoiceReturn:del")
+	@RequestMapping(value = "delete")
+	public String delete(FilialeWorkInvoiceReturn workInvoiceReturn, RedirectAttributes redirectAttributes) {
+		workInvoiceReturnService.delete(workInvoiceReturn);
+		addMessage(redirectAttributes, "删除退票管理成功");
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+	}
+	@RequiresPermissions(value={"workinvoicereturn:workInvoiceReturn:alteredit"},logical= Logical.OR)
+	@RequestMapping(value = "alterForm")
+	public String alterForm(FilialeWorkInvoiceReturn workInvoiceReturn, Model model) {
+		String id = workInvoiceReturn.getId();
+		FilialeWorkInvoiceReturnAlter workInvoiceReturnAlter = new FilialeWorkInvoiceReturnAlter();
+		workInvoiceReturnAlter.setWorkInvoiceReturn(workInvoiceReturn);
+		try {
+			org.apache.commons.beanutils.BeanUtils.copyProperties(workInvoiceReturnAlter,workInvoiceReturn);
+			workInvoiceReturnAlter.setId(null);
+		} catch (IllegalAccessException e) {
+			e.printStackTrace();
+		} catch (InvocationTargetException e) {
+			e.printStackTrace();
+		}
+		workInvoiceReturnAlter.setCreateBy(UserUtils.getUser());
+		workInvoiceReturnAlter.setCreateDate(new Date());
+		model.addAttribute("workInvoiceReturnAlter", workInvoiceReturnAlter);
+		return "modules/workinvoicereturnalter/workInvoiceReturnAlterForm";
+	}
+
+	@RequestMapping(value = "saveAudit")
+	public String saveAudit(FilialeWorkInvoiceReturn workInvoiceReturn, Model model,
+							RedirectAttributes redirectAttributes) {
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workInvoiceReturn.getAct().getTaskDefKey();
+		String flag = workInvoiceReturn.getAct().getFlag();
+		List<User> users = null;
+		String oId = null;
+		FilialeWorkInvoice workInvoice = new FilialeWorkInvoice();
+		if(workInvoiceReturn.getInvoiceDetail()!=null){
+			if(workInvoiceReturn.getInvoiceDetail().getWorkInvoice()!=null){
+				if(StringUtils.isNotBlank(workInvoiceReturn.getInvoiceDetail().getWorkInvoice().getId())){
+					workInvoice = workInvoiceService.get(workInvoiceReturn.getInvoiceDetail().getWorkInvoice());
+					if(workInvoice!=null && workInvoice.getOffice()!=null){
+						oId = workInvoice.getOffice().getId();
+					}
+				}
+			}
+		}
+		if ("bmzr".equals(taskDefKey)) {
+			users = UserUtils.getByProssType(workInvoiceReturn.getProcessInstanceId(), 2);
+			if (users == null) {
+				if(workInvoice!=null) {
+					//1总公司0分公司
+					if ("1".equals(workInvoice.getExt())) {
+						users = UserUtils.getByRoleActivityEnname("fpgly", 1, oId, "6", workInvoiceReturn.getCreateBy());
+					} else if ("0".equals(workInvoice.getExt())) {
+						users = UserUtils.getByRoleActivityEnname("fpgly", 3,oId, "6", workInvoiceReturn.getCreateBy());
+					}
+				}
+			}
+		} else if ("fpgly".equals(taskDefKey)) {
+			users = UserUtils.getByProssType(workInvoiceReturn.getProcessInstanceId(), 3);
+			if (users == null){
+				if(workInvoice!=null){
+					//1总公司0分公司
+					if("1".equals(workInvoice.getExt())){
+						users = UserUtils.getByRoleActivityEnname("zghj",1,oId,"6",workInvoiceReturn.getCreateBy());
+					}else if("0".equals(workInvoice.getExt())){
+						users = UserUtils.getByRoleActivityEnname("zghj",3,oId,"6",workInvoiceReturn.getCreateBy());
+					}
+				}
+			}
+		} else if ("zgkj".equals(taskDefKey)) {
+			users = UserUtils.getByProssType(workInvoiceReturn.getProcessInstanceId(), 1);
+		} else if ("modifyApply".equals(taskDefKey)) {
+			users = UserUtils.getByProssType(workInvoiceReturn.getProcessInstanceId(), 1);
+		}
+		if ("yes".equals(flag) && (users==null || users.size()==0)){
+			addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+		}else {
+			String str = workInvoiceReturnService.auditSave(workInvoiceReturn,users);
+			addMessage(redirectAttributes, str);
+		}
+		if (StringUtils.isNotBlank(workInvoiceReturn.getHome()) && "home".equals(workInvoiceReturn.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+		}
+	}
+	/**
+	 * 批量删除退票管理
+	 */
+	@RequiresPermissions("workinvoicereturn:workInvoiceReturn:del")
+	@RequestMapping(value = "deleteAll")
+	public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
+		String idArray[] =ids.split(",");
+		for(String id : idArray){
+			workInvoiceReturnService.delete(workInvoiceReturnService.get(id));
+		}
+		addMessage(redirectAttributes, "删除退票管理成功");
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+	}
+	
+	/**
+	 * 导出excel文件
+	 */
+	@RequiresPermissions("workinvoicereturn:workInvoiceReturn:export")
+    @RequestMapping(value = "export", method=RequestMethod.POST)
+    public String exportFile(FilialeWorkInvoiceReturn workInvoiceReturn, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "退票管理"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+            Page<FilialeWorkInvoiceReturn> page = workInvoiceReturnService.findPage(new Page<FilialeWorkInvoiceReturn>(request, response, -1), workInvoiceReturn);
+    		new ExportExcel("退票管理", FilialeWorkInvoiceReturn.class).setDataList(page.getList()).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出退票管理记录失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+    }
+
+	/**
+	 * 导入Excel数据
+
+	 */
+	@RequiresPermissions("workinvoicereturn:workInvoiceReturn:import")
+    @RequestMapping(value = "import", method=RequestMethod.POST)
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+		try {
+			int successNum = 0;
+			int failureNum = 0;
+			StringBuilder failureMsg = new StringBuilder();
+			ImportExcel ei = new ImportExcel(file, 1, 0);
+			List<FilialeWorkInvoiceReturn> list = ei.getDataList(FilialeWorkInvoiceReturn.class);
+			for (FilialeWorkInvoiceReturn workInvoiceReturn : list){
+				try{
+					workInvoiceReturnService.save(workInvoiceReturn);
+					successNum++;
+				}catch(ConstraintViolationException ex){
+					failureNum++;
+				}catch (Exception ex) {
+					failureNum++;
+				}
+			}
+			if (failureNum>0){
+				failureMsg.insert(0, ",失败 "+failureNum+" 条退票管理记录。");
+			}
+			addMessage(redirectAttributes, "已成功导入 "+successNum+" 条退票管理记录"+failureMsg);
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入退票管理失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+    }
+	
+	/**
+	 * 下载导入退票管理数据模板
+	 */
+	@RequiresPermissions("workinvoicereturn:workInvoiceReturn:import")
+    @RequestMapping(value = "import/template")
+    public String importFileTemplate(HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+            String fileName = "退票管理数据导入模板.xlsx";
+    		List<FilialeWorkInvoiceReturn> list = Lists.newArrayList();
+    		new ExportExcel("退票管理数据", FilialeWorkInvoiceReturn.class, 1).setDataList(list).write(response, fileName).dispose();
+    		return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导入模板下载失败!失败信息:"+e.getMessage());
+		}
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+    }
+
+	/**
+	 * 审核信息
+	 * @param response
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "applyOnLeave")
+	public String applyOnCompany(Act act, HttpServletResponse response, Model model) {
+		// 获取流程XML上的表单KEY
+		String formKey = "/workinvoicereturn/workInvoiceReturn/form";
+		// 获取流程实例对象
+		if (act.getProcInsId() != null){
+			if(actTaskService.getProcIns(act.getProcInsId())!=null){
+				act.setProcIns(actTaskService.getProcIns(act.getProcInsId()));
+			}else{
+				act.setFinishedProcIns(actTaskService.getFinishedProcIns(act.getProcInsId()));
+			}
+		}
+		return "redirect:" + ActUtils.getFormUrl(formKey, act);
+	}
+
+	/**
+	 * 读取单个实体流程
+	 * @return
+	 */
+	@RequestMapping(value = "getProcessOne")
+	public String getProcessOne(FilialeWorkInvoiceReturn workInvoiceReturn,Model model) {
+		model.addAttribute("processInstanceId", workInvoiceReturn.getProcessInstanceId());
+		return "modules/workinvoicereturn/workInvoiceReturnTask";
+	}
+	@RequestMapping("cancelInvalidate")
+	public String cancelInvalidate(FilialeWorkInvoiceReturn workInvoiceReturn,RedirectAttributes redirectAttributes){
+		Act act = getByAct(workInvoiceReturn.getProcessInstanceId());
+		if("zgkj".equals(act.getTaskDefKey())){
+			addMessage(redirectAttributes, "流程已到会计出审批,无法撤回该申请");
+			return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+		}
+		workInvoiceReturnService.cancelInvalidate(workInvoiceReturn);
+		return "redirect:"+Global.getAdminPath()+"/workinvoicereturn/workInvoiceReturn/?repage";
+	}
+	public Act getByAct(String processInstanceId){
+		Act act = new Act();
+		HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+		ProcessInstance processInstance = actTaskService.getProcIns(processInstanceId);
+		if (processInstance!=null) {
+			List<Task> taskList = actTaskService.getCurrentTaskList(processInstance);
+			if(taskList!=null && taskList.size()>1){
+				for (Task taskInfok:taskList) {
+					if (taskInfok.getAssignee().equals(UserUtils.getUser().getId())) {
+						act.setTaskId(taskInfok.getId());
+						act.setTaskName(taskInfok.getName());
+						act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+						act.setProcDefId(taskInfok.getProcessDefinitionId());
+						act.setProcInsId(taskInfok.getProcessInstanceId());
+						act.setTask(taskInfok);
+					}
+				}
+			}else {
+				Task task = actTaskService.getCurrentTaskInfo(processInstance);
+				act.setTaskId(task.getId());
+				act.setTaskName(task.getName());
+				act.setTaskDefKey(task.getTaskDefinitionKey());
+				act.setProcDefId(task.getProcessDefinitionId());
+				act.setProcInsId(task.getProcessInstanceId());
+				act.setTask(task);
+			}
+		}
+		return  act;
+	}
+
+}

+ 4 - 4
src/main/java/com/jeeplus/modules/projectAccessory/service/ProjectTemplateService.java

@@ -381,7 +381,7 @@ public class ProjectTemplateService extends TreeService<ProjectTemplateDao, Proj
                                            String engineeringId, RuralProjectRecords projectRecords, Projectcontentinfo projectcontentinfo,String screenType){
         //创建报告文件、依据性文件、其他文件必填列表以及数据父节点的value值集合
 
-        if(screenType.contains("1000")){
+        if(screenType.contains("1000") && "2".equals(projectRecords.getProjectType())){
             BigDecimal submitScale = projectRecords.getSubmitScale();
             // 送审金额大于等于1000万时
             if(submitScale.compareTo(BigDecimal.valueOf(1000))!=-1){
@@ -466,7 +466,7 @@ public class ProjectTemplateService extends TreeService<ProjectTemplateDao, Proj
                                            String engineeringId, RuralProjectRecords projectRecords, ProjectMaterialDefectRecord projectcontentinfo,String screenType){
         //创建报告文件、依据性文件、其他文件必填列表以及数据父节点的value值集合
 
-        if(screenType.contains("1000")){
+        if(screenType.contains("1000") && "2".equals(projectRecords.getProjectType())){
             BigDecimal submitScale = projectRecords.getSubmitScale();
             // 送审金额大于等于1000万时
             if(submitScale.compareTo(BigDecimal.valueOf(1000))!=-1){
@@ -551,7 +551,7 @@ public class ProjectTemplateService extends TreeService<ProjectTemplateDao, Proj
                                        String engineeringId, RuralProjectRecords projectRecords, RuralProjectcontentinfo projectcontentinfo,String screenType){
         //创建报告文件、依据性文件、其他文件必填列表以及数据父节点的value值集合
 
-        if(screenType.contains("1000")){
+        if(screenType.contains("1000") && "2".equals(projectRecords.getProjectType())){
             BigDecimal submitScale = projectRecords.getSubmitScale();
             // 送审金额大于等于1000万时
             if(submitScale.compareTo(BigDecimal.valueOf(1000))!=-1){
@@ -636,7 +636,7 @@ public class ProjectTemplateService extends TreeService<ProjectTemplateDao, Proj
                                        String engineeringId, RuralProjectRecords projectRecords, ProjectReportRecord projectcontentinfo,String screenType){
         //创建报告文件、依据性文件、其他文件必填列表以及数据父节点的value值集合
 
-        if("1000".equals(screenType)){
+        if("1000".equals(screenType) && "2".equals(projectRecords.getProjectType())){
             BigDecimal submitScale = projectRecords.getSubmitScale();
             // 送审金额大于等于1000万时
             if(submitScale.compareTo(BigDecimal.valueOf(1000))!=-1){

+ 7 - 0
src/main/java/com/jeeplus/modules/projectcontentinfo/dao/ProjectReportDataDao.java

@@ -164,6 +164,13 @@ public interface ProjectReportDataDao extends CrudDao<ProjectReportData> {
     Integer updateReportSignatureInfo(RuralProjectRecords records);
 
     /**
+     * 修改内审报告签章 项目中的信息
+     * @param records
+     * @return
+     */
+    Integer updateReportInternalAuditSignatureInfo(RuralProjectRecords records);
+
+    /**
      * 修改质量复核签章 项目中的信息
      * @param records
      * @return

+ 11 - 1
src/main/java/com/jeeplus/modules/projectcontentinfo/service/ProjectReportDataService.java

@@ -1667,7 +1667,7 @@ public class ProjectReportDataService extends CrudService<ProjectReportDataDao,
 	}
 
 	/**
-	 * 修改报告签章 项目的信息
+	 * 修改报告签章 项目的信息
 	 * @param records
 	 * @return
 	 */
@@ -1675,6 +1675,16 @@ public class ProjectReportDataService extends CrudService<ProjectReportDataDao,
 	public void updateReportSignatureInfo(RuralProjectRecords records) {
 		dao.updateReportSignatureInfo(records);
 	}
+
+	/**
+	 * 修改内审报告签章 项目中的信息
+	 * @param records
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public void updateReportInternalAuditSignatureInfo(RuralProjectRecords records) {
+		dao.updateReportInternalAuditSignatureInfo(records);
+	}
 	/**
 	 * 修改报告签章 项目重的信息
 	 * @param records

+ 4 - 4
src/main/java/com/jeeplus/modules/projectrecord/service/AdminProjectReportedImportService.java

@@ -421,7 +421,7 @@ public class AdminProjectReportedImportService extends CrudService<AdminProjectR
         if(StringUtils.isNotBlank(reported.getReportStatus())){
             oldStatus = Integer.parseInt(reported.getReportStatus());
         }
-        reported.setReportStatus(String.valueOf(ProjectStatusEnum.SIGNED.getValue()));
+        //reported.setReportStatus(String.valueOf(ProjectStatusEnum.SIGNED.getValue()));
         //查询是否已经上报项目信息
         if (StringUtils.isBlank(reported.getId())){
             reported.setCompany(UserUtils.getSelectCompany());
@@ -431,7 +431,7 @@ public class AdminProjectReportedImportService extends CrudService<AdminProjectR
             reported.setId(reported.getProjectId());
             dao.insert(reported);
         }else{
-            reported.preUpdate();
+            //reported.preUpdate();
             dao.update(reported);
         }
         //删除上报咨询员信息
@@ -496,9 +496,9 @@ public class AdminProjectReportedImportService extends CrudService<AdminProjectR
         //发送请求
         String returnResult = HttpPostTool.doPost(url, encryptByAes);
         HashMap hashMap = JSON.parseObject(returnResult, HashMap.class);
-        /*if(!"1".equals(hashMap.get("code"))){
+        if(!"1".equals(hashMap.get("code"))){
             return "上报失败:" + hashMap.get("msg").toString();
-        }*/
+        }
         //修改项目上报表中状态
         reported.setReportStatus(String.valueOf(ProjectStatusEnum.SIGNED.getValue()));
         reported.preUpdate();

+ 1 - 1
src/main/java/com/jeeplus/modules/projectrecord/service/ProjectRecordsService.java

@@ -1061,7 +1061,7 @@ public class ProjectRecordsService extends CrudService<ProjectRecordsDao, Projec
 						notifyRole = "审批通过";
 						//首先根据项目id查询是否已经存在报告号,若没有则生成对应报告号,否则不进行生成新的报告号
 						ReportNum reportNumber = projectReportNumDao.getByProjectId(projectRecords.getId());
-						if(null != reportNumber && StringUtils.isNotBlank(reportNumber.getNum())){
+						if(null == reportNumber){
 							//审批通过则需要给该项目添加一个报告前缀信息
 							String num = serialNumTplService.genSerialNum(UserUtils.getUser().getCompany(), "92");
 							ReportNum reportNum = new ReportNum();

+ 1 - 1
src/main/java/com/jeeplus/modules/projectrecord/service/ProjectReportedImportService.java

@@ -164,7 +164,7 @@ public class ProjectReportedImportService extends CrudService<ProjectReportedImp
         projectReportedImport.setProjectType("81");     //项目类型
         projectReportedImport.setPorjectStruct("099");  //工程结构
         projectReportedImport.setGCGMValue("50");       //建筑规模
-        projectReportedImport.setGCGMValueParameter("项");//建筑规模
+        projectReportedImport.setGCGMValueParameter("1项");//建筑规模
         projectReportedImport.setPorjectUse("09");      //工程用途
 
         projectReportedImport.setOffice(UserUtils.getSelectOffice());

+ 84 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectMessageElectronicSealDao.java

@@ -49,12 +49,25 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
      * @return
      */
     ProjectReportSignature getProjectReportSignature(String projectId);
+
+    /**
+     * 根据项目id查询报告签章是否存在送审信息(内审)
+     * @param projectId
+     * @return
+     */
+    ProjectReportSignature getProjectReportInternalAudit(String projectId);
     /**
      * 根据id查询报告签章是否存在送审信息
      * @param id
      * @return
      */
     ProjectReportSignature getProjectReportSignatureById(String id);
+    /**
+     * 根据id查询报告签章是否存在送审信息(内审)
+     * @param id
+     * @return
+     */
+    ProjectReportSignature getProjectReportInternalAuditSignatureById(String id);
 
     /**
      * 报告签章申请新增
@@ -64,12 +77,26 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
     Integer insertReportSignature(ProjectReportSignature projectApprovalSignature);
 
     /**
+     * 报告签章申请新增(内审)
+     * @param projectApprovalSignature
+     * @return
+     */
+    Integer insertReportInternalAuditSignature(ProjectReportSignature projectApprovalSignature);
+
+    /**
      * 报告签章申请修改
      * @param projectApprovalSignature
      * @return
      */
     Integer updateReportSignature(ProjectReportSignature projectApprovalSignature);
 
+    /**
+     * 报告签章申请修改(内审)
+     * @param projectApprovalSignature
+     * @return
+     */
+    Integer updateReportInternalAuditSignature(ProjectReportSignature projectApprovalSignature);
+
     //根据咨询员name查询咨询员的user_id
     /**
      * 根据咨询员name查询咨询员的user_id
@@ -86,6 +113,20 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
     List<String> getProjectReportIdByReportId(@Param("reportIdList") List<String> reportIdList);
 
     /**
+     * 根据报告号idlist查询数量(内审或内咨字报告)
+     * @param reportIdList
+     * @return
+     */
+    List<String> getInternalAuditProjectReportIdByReportId(@Param("reportIdList") List<String> reportIdList);
+
+    /**
+     * 根据报告号idlist查询数量(已完成质量复核的报告数据)
+     * @param reportIdList
+     * @return
+     */
+    List<String> getAccomplishStatusProjectReportByReportId(@Param("reportIdList") List<String> reportIdList);
+
+    /**
      * 根据报告号查询签章数据表数据量
      * @param reportIdList
      * @return
@@ -93,6 +134,13 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
     List<ProjectReportSignatureInfo> getInfoByReportId(@Param("reportIdList") List<String> reportIdList);
 
     /**
+     * 根据报告号查询签章数据表数据量
+     * @param reportIdList
+     * @return
+     */
+    List<ProjectReportSignatureInfo> getInternalAuditInfoByReportId(@Param("reportIdList") List<String> reportIdList);
+
+    /**
      * 批量添加
      * @param list
      * @return
@@ -100,6 +148,13 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
     void insertByList(List<ProjectReportSignatureInfo> list);
 
     /**
+     * 批量添加
+     * @param list
+     * @return
+     */
+    void insertInternalAuditByList(List<ProjectReportSignatureInfo> list);
+
+    /**
      * 根据项目id查询到的报告号查询project_report_signature_info表的信息
      * @param projectId
      * @return
@@ -107,6 +162,13 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
     ProjectReportSignatureInfo findProjectReportSignatureInfoByProjectId(String projectId);
 
     /**
+     * 根据项目id查询到的报告号查询project_report_internal_audit_info表的信息
+     * @param projectId
+     * @return
+     */
+    ProjectReportSignatureInfo findProjectReportInternalAuditInfoByProjectId(String projectId);
+
+    /**
     * 根据id查询咨询员
     * @param consultantId
     * @return
@@ -121,9 +183,31 @@ public interface RuralProjectMessageElectronicSealDao extends CrudDao<ProjectRep
     void updateProjectReportSignatureInfo(ProjectReportSignatureInfo projectReportSignatureInfo);
 
     /**
+     *  更新(内审报告)
+     * @param projectReportSignatureInfo
+     * @return
+     * */
+    void updateProjectReportInternalAuditInfo(ProjectReportSignatureInfo projectReportSignatureInfo);
+
+    /**
      * 根据name查询咨询员id
      * @param consultantName
      * @return
      * */
     String findZXYByName(String consultantName);
+
+    /**
+     * 根据项目类型筛选报告信息是否符合(上海要对应项目类型中的:工程审价(上海);其他的均为江苏项目)
+     * @param reportIdList
+     * @param type  报告信息类型(js:江苏;sh:上海)
+     * @return
+     */
+    List<String> getProjectReportIdByReportIdAndType(@Param("reportIdList") List<String> reportIdList,@Param("type")String type);
+
+    /**
+     * 根据报告号查询内审报告信息
+     * @param reportNumber
+     * @return
+     */
+    ProjectReportSignatureInfo getInternalAuditByReportNumber(String reportNumber);
 }

+ 14 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectRecordsDao.java

@@ -292,6 +292,13 @@ public interface RuralProjectRecordsDao extends CrudDao<RuralProjectRecords> {
     RuralProjectRecords getSignatureByDocumentId(String documentId);
 
     /**
+     * 根据签章的documentId查询报告信息
+     * @param documentId
+     * @return
+     */
+    RuralProjectRecords getReportInternalAuditSignatureByDocumentId(String documentId);
+
+    /**
      * 根据签章documentId查询审定(内)信息
      * @param documentId
      * @return
@@ -441,6 +448,13 @@ public interface RuralProjectRecordsDao extends CrudDao<RuralProjectRecords> {
     Integer updateProjectPaperFilingOnOverDue(@Param("id") String id, @Param("status") String status);
 
     /**
+     * 修改A类纸质归档状态为超期状态
+     * @param id
+     * @return
+     */
+    Integer updateProjectPaperFiling(@Param("id") String id, @Param("status") String status);
+
+    /**
      * 修改B类批量归档状态为超期状态
      * @param id
      * @return

+ 13 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/dao/RuralProjectRecordsReportedDao.java

@@ -63,4 +63,17 @@ public interface RuralProjectRecordsReportedDao extends CrudDao<RuralProjectReco
     void updateStatusById(RuralProjectRecordsReported reported);
 
     void updateProcessIdAndStatus(RuralProjectRecordsReported reported);
+
+    /**
+     * 根据项目id查询上报信息
+     * @param projectId
+     * @return
+     */
+    RuralProjectRecordsReported getByProjectId(String projectId);
+
+    /**
+     * 修改上报数据中的咨询标的额
+     * @param reported
+     */
+    void updateZiXunBDE(RuralProjectRecordsReported reported);
 }

+ 3 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/PresignCallBack.java

@@ -1,11 +1,13 @@
 package com.jeeplus.modules.ruralprojectrecords.entity;
 
+import java.io.Serializable;
+
 /**
  * 预签署回调参数表
  * @author: 大猫
  * @create: 2021-11-04 09:27
  **/
-public class PresignCallBack {
+public class PresignCallBack implements Serializable {
     private String contractId;  //文件编号
     private String documentId;  //文档ID
     private String tenantId;    //签署方编号

+ 9 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ProjectApprovalSignature.java

@@ -17,6 +17,7 @@ public class ProjectApprovalSignature extends ActEntity<ProjectApprovalSignature
     private String processInstanceId;   //流程编号
     private Office company;
     private Office office;
+    private String signatureType;		//苏州审定单选择类型(1:崇明;2:金山;3:自定义)
     private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
 
     public String getProjectId() {
@@ -66,4 +67,12 @@ public class ProjectApprovalSignature extends ActEntity<ProjectApprovalSignature
     public void setWorkAttachments(List<WorkClientAttachment> workAttachments) {
         this.workAttachments = workAttachments;
     }
+
+    public String getSignatureType() {
+        return signatureType;
+    }
+
+    public void setSignatureType(String signatureType) {
+        this.signatureType = signatureType;
+    }
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ProjectReportSignature.java

@@ -13,6 +13,7 @@ public class ProjectReportSignature extends ActEntity<ProjectReportSignature> {
     private String processInstanceId;   //流程编号
     private Office company;
     private Office office;
+    private String signatureType;		//苏州审定单选择类型(1:江苏;2:上海;)
 
     public String getProjectId() {
         return projectId;
@@ -53,4 +54,12 @@ public class ProjectReportSignature extends ActEntity<ProjectReportSignature> {
     public void setOffice(Office office) {
         this.office = office;
     }
+
+    public String getSignatureType() {
+        return signatureType;
+    }
+
+    public void setSignatureType(String signatureType) {
+        this.signatureType = signatureType;
+    }
 }

+ 108 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/ProjectReportSignatureInfo.java

@@ -68,6 +68,25 @@ public class ProjectReportSignatureInfo extends ActEntity<ProjectReportSignature
 	private String constructionQualityWarrantyDeposit;//工程质量保修金处理情况
 	private String taxDifferenceCalculationAndProcessing;//税金差额计算处理
 
+	private String projectAccountNumber;	//工程账号
+	private String projectName;	//工程名称
+	private String developmentOrganization;	//建设单位
+	private String calculateValuationBasisDocument;	//计算计价依据文件
+
+
+	private Date auditStartDate;    //审计开始日期
+	private Date auditEndDate;      //审计结束日期
+	private Date projectStartDate;    //工程开始日期
+	private Date projectEndDate;      //工程结束日期
+	private String decreaseInAccountingFee;      //核减额
+
+
+	private String projectProfile;	//工程概况
+
+
+	private String type;	//类型(1:江苏;2:上海;3:内审报告)
+
+
 
 	public String getProjectReportId() {
 		return projectReportId;
@@ -460,4 +479,93 @@ public class ProjectReportSignatureInfo extends ActEntity<ProjectReportSignature
 	public void setTaxDifferenceCalculationAndProcessing(String taxDifferenceCalculationAndProcessing) {
 		this.taxDifferenceCalculationAndProcessing = taxDifferenceCalculationAndProcessing;
 	}
+
+
+	public String getProjectAccountNumber() {
+		return projectAccountNumber;
+	}
+
+	public void setProjectAccountNumber(String projectAccountNumber) {
+		this.projectAccountNumber = projectAccountNumber;
+	}
+
+	public String getProjectName() {
+		return projectName;
+	}
+
+	public void setProjectName(String projectName) {
+		this.projectName = projectName;
+	}
+
+	public String getDevelopmentOrganization() {
+		return developmentOrganization;
+	}
+
+	public void setDevelopmentOrganization(String developmentOrganization) {
+		this.developmentOrganization = developmentOrganization;
+	}
+
+	public String getCalculateValuationBasisDocument() {
+		return calculateValuationBasisDocument;
+	}
+
+	public void setCalculateValuationBasisDocument(String calculateValuationBasisDocument) {
+		this.calculateValuationBasisDocument = calculateValuationBasisDocument;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public Date getAuditStartDate() {
+		return auditStartDate;
+	}
+
+	public void setAuditStartDate(Date auditStartDate) {
+		this.auditStartDate = auditStartDate;
+	}
+
+	public Date getAuditEndDate() {
+		return auditEndDate;
+	}
+
+	public void setAuditEndDate(Date auditEndDate) {
+		this.auditEndDate = auditEndDate;
+	}
+
+	public Date getProjectStartDate() {
+		return projectStartDate;
+	}
+
+	public void setProjectStartDate(Date projectStartDate) {
+		this.projectStartDate = projectStartDate;
+	}
+
+	public Date getProjectEndDate() {
+		return projectEndDate;
+	}
+
+	public void setProjectEndDate(Date projectEndDate) {
+		this.projectEndDate = projectEndDate;
+	}
+
+	public String getDecreaseInAccountingFee() {
+		return decreaseInAccountingFee;
+	}
+
+	public void setDecreaseInAccountingFee(String decreaseInAccountingFee) {
+		this.decreaseInAccountingFee = decreaseInAccountingFee;
+	}
+
+	public String getProjectProfile() {
+		return projectProfile;
+	}
+
+	public void setProjectProfile(String projectProfile) {
+		this.projectProfile = projectProfile;
+	}
 }

+ 146 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecords.java

@@ -228,6 +228,7 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	private String ZiXunShouRu;   //咨询收入
 	private String zaoJiaShiZhengHao;   //造价师注册证号
 	private String attachmentProjectSort;   //项目类别
+	private String attachmentProjectSortKey;   //项目类别
 	private String checkProcessInstanceId;   //检查流程id
 	private Integer checkStatus;   //检查状态
 	private String bzshbUserId; //总审用户id
@@ -393,6 +394,23 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	private Date reportedEndDate;		//上报审核结束时间
 
 
+	private String reportInternalAuditStatus;		//内审报告审核状态
+	private String priaiId;		//内审报告id
+	private String reportInternalAuditSignatureProcessInstanceId; //内审报告签章申请流程id
+
+	private Integer reportInternalAuditSignatureFlag;		//是否内审报告签章(1为已签章)
+	private String reportInternalAuditSignatureUrl;		//内审报告签章id
+	private Integer reportInternalAuditSignatureUrlFlag;		//内审报告签章url状态
+	private String reportInternalAuditSignatureDocumentId;		//内审报告签章documentid
+	private String reportInternalAuditSignatureContractId;		//内审报告签章contractid
+	private String reportInternalAuditSignatureInvalidDocumentId;		//内审报告无效的签章documentid
+	private String reportInternalAuditSignatureFileName;		//内审报告签章文件名称
+	private User reportInternalAuditSignatureUploadFileUser;		//内审报告签章文件上传人信息
+	private Date reportInternalAuditSignatureUploadDate;		//内审报告签章文件上传时间
+	private String internalAuditFlag;		//内审报告判定条件
+	private String beginSubmitScale;	//送审规模(开始)
+	private String endSubmitScale;	//送审规模(结束)
+
 
 	private List<String> civilProjectList = Lists.newArrayList();
 	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
@@ -1230,6 +1248,14 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 		this.attachmentProjectSort = attachmentProjectSort;
 	}
 
+	public String getAttachmentProjectSortKey() {
+		return attachmentProjectSortKey;
+	}
+
+	public void setAttachmentProjectSortKey(String attachmentProjectSortKey) {
+		this.attachmentProjectSortKey = attachmentProjectSortKey;
+	}
+
 	public String getCheckProcessInstanceId() {
 		return checkProcessInstanceId;
 	}
@@ -2527,4 +2553,124 @@ public class RuralProjectRecords extends ActEntity<RuralProjectRecords> {
 	public void setReportedEndDate(Date reportedEndDate) {
 		this.reportedEndDate = reportedEndDate;
 	}
+
+	public String getReportInternalAuditStatus() {
+		return reportInternalAuditStatus;
+	}
+
+	public void setReportInternalAuditStatus(String reportInternalAuditStatus) {
+		this.reportInternalAuditStatus = reportInternalAuditStatus;
+	}
+
+	public String getPriaiId() {
+		return priaiId;
+	}
+
+	public void setPriaiId(String priaiId) {
+		this.priaiId = priaiId;
+	}
+
+	public String getReportInternalAuditSignatureProcessInstanceId() {
+		return reportInternalAuditSignatureProcessInstanceId;
+	}
+
+	public void setReportInternalAuditSignatureProcessInstanceId(String reportInternalAuditSignatureProcessInstanceId) {
+		this.reportInternalAuditSignatureProcessInstanceId = reportInternalAuditSignatureProcessInstanceId;
+	}
+
+	public Integer getReportInternalAuditSignatureFlag() {
+		return reportInternalAuditSignatureFlag;
+	}
+
+	public void setReportInternalAuditSignatureFlag(Integer reportInternalAuditSignatureFlag) {
+		this.reportInternalAuditSignatureFlag = reportInternalAuditSignatureFlag;
+	}
+
+	public String getReportInternalAuditSignatureUrl() {
+		return reportInternalAuditSignatureUrl;
+	}
+
+	public void setReportInternalAuditSignatureUrl(String reportInternalAuditSignatureUrl) {
+		this.reportInternalAuditSignatureUrl = reportInternalAuditSignatureUrl;
+	}
+
+	public Integer getReportInternalAuditSignatureUrlFlag() {
+		return reportInternalAuditSignatureUrlFlag;
+	}
+
+	public void setReportInternalAuditSignatureUrlFlag(Integer reportInternalAuditSignatureUrlFlag) {
+		this.reportInternalAuditSignatureUrlFlag = reportInternalAuditSignatureUrlFlag;
+	}
+
+	public String getReportInternalAuditSignatureDocumentId() {
+		return reportInternalAuditSignatureDocumentId;
+	}
+
+	public void setReportInternalAuditSignatureDocumentId(String reportInternalAuditSignatureDocumentId) {
+		this.reportInternalAuditSignatureDocumentId = reportInternalAuditSignatureDocumentId;
+	}
+
+	public String getReportInternalAuditSignatureContractId() {
+		return reportInternalAuditSignatureContractId;
+	}
+
+	public void setReportInternalAuditSignatureContractId(String reportInternalAuditSignatureContractId) {
+		this.reportInternalAuditSignatureContractId = reportInternalAuditSignatureContractId;
+	}
+
+	public String getReportInternalAuditSignatureInvalidDocumentId() {
+		return reportInternalAuditSignatureInvalidDocumentId;
+	}
+
+	public void setReportInternalAuditSignatureInvalidDocumentId(String reportInternalAuditSignatureInvalidDocumentId) {
+		this.reportInternalAuditSignatureInvalidDocumentId = reportInternalAuditSignatureInvalidDocumentId;
+	}
+
+	public String getReportInternalAuditSignatureFileName() {
+		return reportInternalAuditSignatureFileName;
+	}
+
+	public void setReportInternalAuditSignatureFileName(String reportInternalAuditSignatureFileName) {
+		this.reportInternalAuditSignatureFileName = reportInternalAuditSignatureFileName;
+	}
+
+	public User getReportInternalAuditSignatureUploadFileUser() {
+		return reportInternalAuditSignatureUploadFileUser;
+	}
+
+	public void setReportInternalAuditSignatureUploadFileUser(User reportInternalAuditSignatureUploadFileUser) {
+		this.reportInternalAuditSignatureUploadFileUser = reportInternalAuditSignatureUploadFileUser;
+	}
+
+	public Date getReportInternalAuditSignatureUploadDate() {
+		return reportInternalAuditSignatureUploadDate;
+	}
+
+	public void setReportInternalAuditSignatureUploadDate(Date reportInternalAuditSignatureUploadDate) {
+		this.reportInternalAuditSignatureUploadDate = reportInternalAuditSignatureUploadDate;
+	}
+
+	public String getInternalAuditFlag() {
+		return internalAuditFlag;
+	}
+
+	public void setInternalAuditFlag(String internalAuditFlag) {
+		this.internalAuditFlag = internalAuditFlag;
+	}
+
+	public String getBeginSubmitScale() {
+		return beginSubmitScale;
+	}
+
+	public void setBeginSubmitScale(String beginSubmitScale) {
+		this.beginSubmitScale = beginSubmitScale;
+	}
+
+	public String getEndSubmitScale() {
+		return endSubmitScale;
+	}
+
+	public void setEndSubmitScale(String endSubmitScale) {
+		this.endSubmitScale = endSubmitScale;
+	}
 }

+ 21 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/entity/RuralProjectRecordsExport.java

@@ -317,6 +317,8 @@ public class RuralProjectRecordsExport extends ActEntity<RuralProjectRecordsExpo
 	private String caseStatus;				//案例项目的状态
 	private String caseProcessId;			//案例项目的流程id
 	private Double ziXunBDE;			//上报中的咨询标的额
+	private String filingBoxNum;			//B类项目盒号
+	private String ppfFileNum;			//A类项目盒号
 
 
 
@@ -1512,6 +1514,7 @@ public class RuralProjectRecordsExport extends ActEntity<RuralProjectRecordsExpo
 	}
 
 
+	@ExcelField(title="送审规模(万元)", align=2, sort=10)
 	public BigDecimal getSubmitScale() {
 		return submitScale;
 	}
@@ -1861,7 +1864,6 @@ public class RuralProjectRecordsExport extends ActEntity<RuralProjectRecordsExpo
 		this.reportTwoAuditDate = reportTwoAuditDate;
 	}
 
-	@ExcelField(title="项目规模", align=2, sort=10)
 	public String getProjectScale() {
 		return projectScale;
 	}
@@ -2250,6 +2252,7 @@ public class RuralProjectRecordsExport extends ActEntity<RuralProjectRecordsExpo
 		this.ziXunBDE = ziXunBDE;
 	}
 
+	@ExcelField(title="项目等级", align=2, sort=10)
 	public String getSubmitMoneyStr() {
 		return submitMoneyStr;
 	}
@@ -2323,4 +2326,21 @@ public class RuralProjectRecordsExport extends ActEntity<RuralProjectRecordsExpo
 	public void setProjectReportRecordAuditDate(Date projectReportRecordAuditDate) {
 		this.projectReportRecordAuditDate = projectReportRecordAuditDate;
 	}
+
+	@ExcelField(title="归档盒号", align=2, sort=26)
+	public String getFilingBoxNum() {
+		return filingBoxNum;
+	}
+
+	public void setFilingBoxNum(String filingBoxNum) {
+		this.filingBoxNum = filingBoxNum;
+	}
+
+	public String getPpfFileNum() {
+		return ppfFileNum;
+	}
+
+	public void setPpfFileNum(String ppfFileNum) {
+		this.ppfFileNum = ppfFileNum;
+	}
 }

+ 3 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/ProjectPaperFilingService.java

@@ -194,6 +194,9 @@ public class ProjectPaperFilingService extends CrudService<ProjectPaperFilingDao
             workActivityProcessService.insert(workActivityProcess);
             workActivityProcessService.insertAuditsByType(bggdglys,processInstance.getId(),1,1);
         }
+        //修改向目标中纸质归档状态值
+        record.setPaperFilingStatus(paperFiling.getStatus().toString());
+        ruralProjectRecordsService.updateProjectPaperFiling(record);
         return "true";
     }
     /**

+ 14 - 4
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageAllService.java

@@ -1328,10 +1328,17 @@ public class RuralProjectMessageAllService extends CrudService<RuralProjectMessa
             projectRecords.setEndingCount(endingCount);
         }
         if(null!= projectRecords.getOffice() && StringUtils.isNotBlank(projectRecords.getOffice().getId())){
-            //查询该选择节点下所有的部门Id
-            List<String> officeIdList = officeService.getChildrenOffice(projectRecords.getOffice().getId());
-            officeIdList.add(projectRecords.getOffice().getId());
-            projectRecords.setOfficeIdList(officeIdList);
+            if("一部本部".equals(projectRecords.getOffice().getId())){
+                List<String> officeIdList = Lists.newArrayList();
+                Office office = officeService.getByName("工程一部");
+                officeIdList.add(office.getId());
+                projectRecords.setOfficeIdList(officeIdList);
+            }else{
+                //查询该选择节点下所有的部门Id
+                List<String> officeIdList = officeService.getChildrenOffice(projectRecords.getOffice().getId());
+                officeIdList.add(projectRecords.getOffice().getId());
+                projectRecords.setOfficeIdList(officeIdList);
+            }
         }
         page.setCountFlag(false);
         projectRecords.setPage(page);
@@ -1449,6 +1456,9 @@ public class RuralProjectMessageAllService extends CrudService<RuralProjectMessa
 
                     }
                 } else if ("2".equals(info.getSubmitMoney())){
+                    if(StringUtils.isNotBlank(info.getPpfFileNum())){
+                        info.setFilingBoxNum(info.getPpfFileNum());
+                    }
                     //设置电子未归档天数
                     if (null != info.getTwoAuditPassDate() && 5 != info.getProjectReportRecordStatus()
                             && 7!= info.getProjectReportRecordStatus()){

Різницю між файлами не показано, бо вона завелика
+ 1965 - 972
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageElectronicSealService.java


+ 15 - 14
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageNewService.java

@@ -805,8 +805,8 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
         }
         ProjectRecords projectRecords = dao.getRuralProjectRecords(projectReportData.getProject().getId());
         Office recordsOffice =officeService.get(projectRecords.getOffice());
-        String title = "项目【"+projectRecords.getProjectName()+"】报告质量复核待审批";
-        String str =  "项目【"+projectRecords.getProjectName()+"】报告质量复核待审批";
+        String title = "项目【"+projectRecords.getProjectName()+"】报告审定(内)签章待审批";
+        String str =  "项目【"+projectRecords.getProjectName()+"】报告审定(内)签章待审批";
         // 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
         identityService.setAuthenticatedUserId(user.getId());
         // 启动流程
@@ -1775,11 +1775,11 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
             }else{
                 if ("yes".equals(flag)) {
 
-                    String titleStr = "项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
-                    String content = "项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
+                    String titleStr = "项目【"+projectRecords.getProjectName()+"】报告审定(内)签章审批通过";
+                    String content = "项目【"+projectRecords.getProjectName()+"】报告审定(内)签章审批通过";
                     if(StringUtils.isNotBlank(projectReportData.getNumber())){
-                        titleStr = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
-                        content = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
+                        titleStr = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告审定(内)签章审批通过";
+                        content = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告审定(内)签章审批通过";
                     }
                     str =  "报告名称:"+projectReportData.getName()+",工作内容类型:"+ WorkContentTypeController.getContentTypeName(projectReportData.getType(),"")+",项目所属部门:"+recordsOffice.getName();
                     projectReportData.setStatus("5");
@@ -1868,11 +1868,11 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
 
             } else {
                 if (!"yes".equals(flag)) {//报告驳回待办提醒
-                    title = "项目【"+ projectRecords.getProjectName()+"】新增报告质量复核被驳回";
-                    str = "项目【"+ projectRecords.getProjectName()+"】新增报告质量复核被驳回,请选择重新申请或删除报告";
+                    title = "项目【"+ projectRecords.getProjectName()+"】新增报告审定(内)签章被驳回";
+                    str = "项目【"+ projectRecords.getProjectName()+"】新增报告审定(内)签章被驳回,请选择重新申请或删除报告";
                     if(StringUtils.isNotBlank(projectReportData.getNumber())){
-                        title = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】新增报告质量复核被驳回";
-                        str = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】新增报告质量复核被驳回,请选择重新申请或删除报告";
+                        title = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】新增报告审定(内)签章被驳回";
+                        str = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】新增报告审定(内)签章被驳回,请选择重新申请或删除报告";
                     }
                     WorkProjectNotify notify = new WorkProjectNotify();
                     notify.setNotifyId(projectReportData.getId());
@@ -1891,11 +1891,11 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
                     users.add( projectReportData.getCreateBy());
                 } else {
                     if (com.jeeplus.common.utils.StringUtils.isNotBlank(enname)) {//驳回重新申请待办信息
-                        str = "项目【"+ projectRecords.getProjectName()+"】报告质量复核待审批";
-                        title = "项目【"+ projectRecords.getProjectName()+"】报告质量复核待审批";
+                        str = "项目【"+ projectRecords.getProjectName()+"】报告审定(内)签章待审批";
+                        title = "项目【"+ projectRecords.getProjectName()+"】报告审定(内)签章待审批";
                         if(StringUtils.isNotBlank(projectReportData.getNumber())){
-                            title = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核待审批";
-                            str = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核待审批";
+                            title = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告审定(内)签章待审批";
+                            str = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告审定(内)签章待审批";
                         }
                         WorkProjectNotify notify = new WorkProjectNotify();
                         notify.setNotifyId(projectReportData.getId());
@@ -3545,6 +3545,7 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
         RuralProjectRecords records = new RuralProjectRecords();
         records.setId(reported.getId());
         records.setReportedState(String.valueOf(projectStatus.getValue()));
+        records.setTotalFees(Double.valueOf(reported.getZiXunBDE()));
         dao.updateReported(records);
 
         return null;

Різницю між файлами не показано, бо вона завелика
+ 1333 - 565
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageService.java


+ 231 - 7
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectRecordsService.java

@@ -36,11 +36,9 @@ import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectreportnum.service.ProjectReportNumService;
 import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectClientLinkmanDao;
 import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectRecordsDao;
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectRecordsReportedDao;
 import com.jeeplus.modules.ruralprojectrecords.dao.RuralWorkProjectUserDao;
-import com.jeeplus.modules.ruralprojectrecords.entity.ImportBRuralProjectRecords;
-import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
-import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecordsExport;
-import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectcontentinfo;
+import com.jeeplus.modules.ruralprojectrecords.entity.*;
 import com.jeeplus.modules.ruralprojectrecords.enums.ProjectStatusEnum;
 import com.jeeplus.modules.serialnum.service.SerialNumTplService;
 import com.jeeplus.modules.statement.entity.StatementCompanyComprehensiveInfo;
@@ -99,6 +97,7 @@ import java.math.BigDecimal;
 import java.net.URI;
 import java.net.URLEncoder;
 import java.nio.charset.Charset;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.*;
 import java.util.*;
@@ -193,6 +192,8 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 	@Autowired
 	private RuralProjectRecordsDao ruralProjectRecordsDao;
 	@Autowired
+	private RuralProjectRecordsReportedDao ruralProjectRecordsReportedDao;
+	@Autowired
 	private ProjectMaterialChooseService chooseService;
 //	@Autowired
 //	private RuralProjectRecordsService projectRecordsService;
@@ -434,6 +435,33 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 			//查询报告文件、依据性文件、其他文件必填列表以及数据
 			List<MainDictDetail> projectSortList = projectSortList();
 
+			//查询超期时间天数
+			List<MainDictDetail> adventCount = DictUtils.getMainDictListOnProjectAdvent("advent_count");
+			//查询超期时间天数(电子归档)
+			List<MainDictDetail> adventRecordCount = DictUtils.getMainDictListOnProjectAdvent("advent_record_count");
+			//查询超期时间天数(A类纸质归档)
+			List<MainDictDetail> adventRecordACount = DictUtils.getMainDictListOnProjectAdvent("advent_record_A_count");
+			//查询超期时间天数(B类纸质归档)
+			List<MainDictDetail> adventRecordBCount = DictUtils.getMainDictListOnProjectAdvent("advent_record_B_count");
+
+			Integer endingAdventRecordCount = 0;
+			if(adventRecordCount.size()>0){
+				//获取超期时间天数(电子归档)转int
+				endingAdventRecordCount = Integer.parseInt(adventRecordCount.get(0).getLabel());
+			}
+			Integer endingAdventRecordACount = 0;
+			if(adventRecordACount.size()>0){
+				//获取超期时间天数(A类纸质归档)转int
+				endingAdventRecordACount = Integer.parseInt(adventRecordACount.get(0).getLabel());
+			}
+			Integer endingAdventRecordBCount = 0;
+			if(adventRecordBCount.size()>0){
+				//获取超期时间天数(A类纸质归档)转int
+				endingAdventRecordBCount = Integer.parseInt(adventRecordBCount.get(0).getLabel());
+			}
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+			Date date = new Date();
+
 			for (RuralProjectRecords info : recordsList) {
 				if (StringUtils.isNotBlank(info.getProjectType())){
 					if("1".equals(info.getProjectType())){  //工程咨询
@@ -457,6 +485,149 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 						}
 					}
 				}
+
+				//判断是A类还是B类 2是A类1是B类
+				if ("1".equals(info.getSubmitMoney())){
+					//设置电子未归档天数
+					if (null != info.getPrdAuditDate() && 5 != info.getProjectReportRecordStatus()
+							&& 7!= info.getProjectReportRecordStatus()){
+						try {
+							Date date2 = format.parse(info.getPrdAuditDate());
+							Long dateTimeLong = date.getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong)/(24*60*60*1000);
+							endTime = endTime - endingAdventRecordCount;
+							info.setNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}else if (null != info.getPrdAuditDate() && (5 == info.getProjectReportRecordStatus()
+							|| 7 == info.getProjectReportRecordStatus()) && null != info.getProjectReportRecordAuditDate()) {
+						try {
+							Date date2 = format.parse(info.getPrdAuditDate());
+							//获取电子归档审核通过时间
+							Long dateTimeLong = info.getProjectReportRecordAuditDate().getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong) / (24 * 60 * 60 * 1000);
+							endTime = endTime - endingAdventRecordCount;
+							info.setNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}
+
+					//设置纸质未归档天数
+					if (null != info.getPrdAuditDate()
+							&& !"5".equals(info.getPaperFilingStatus())
+							&& !"7".equals(info.getPaperFilingStatus()) && !"10".equals(info.getPaperFilingStatus())){
+						try {
+							Date date2 = format.parse(info.getPrdAuditDate());
+							Long dateTimeLong = date.getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong)/(24*60*60*1000);
+							endTime = endTime - endingAdventRecordBCount;
+							info.setPaperNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}else if(null != info.getPrdAuditDate()
+							&& ("5".equals(info.getPaperFilingStatus())
+							|| "10".equals(info.getPaperFilingStatus())) && null != info.getFilingBatchAuditPassDate()) {
+						try {
+							Date date2 = format.parse(info.getPrdAuditDate());
+							//获取电子归档审核通过时间
+							Long dateTimeLong = info.getFilingBatchAuditPassDate().getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong) / (24 * 60 * 60 * 1000);
+							endTime = endTime - endingAdventRecordBCount;
+							info.setPaperNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+
+					}
+				} else if ("2".equals(info.getSubmitMoney())){
+					//设置电子未归档天数
+					if (null != info.getTwoAuditPassDate() && 5 != info.getProjectReportRecordStatus()
+							&& 7!= info.getProjectReportRecordStatus()){
+						try {
+							Date date2 = format.parse(info.getTwoAuditPassDate());
+							Long dateTimeLong = date.getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong)/(24*60*60*1000);
+							if("0".equals(info.getProjectReportRecordStatus()) && endTime >0){
+								info.setPaperFilingStatus("6");
+							}else if("5".equals(info.getProjectReportRecordStatus()) && endTime >0){
+								info.setPaperFilingStatus("7");
+							}
+							endTime = endTime - endingAdventRecordCount;
+							info.setNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}else if (null != info.getTwoAuditPassDate() && (5 == info.getProjectReportRecordStatus()
+							|| 7 == info.getProjectReportRecordStatus()) && null != info.getProjectReportRecordAuditDate()) {
+						try {
+							Date date2 = format.parse(info.getTwoAuditPassDate());
+							//获取电子归档审核通过时间
+							Long dateTimeLong = info.getProjectReportRecordAuditDate().getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong) / (24 * 60 * 60 * 1000);
+							if("0".equals(info.getProjectReportRecordStatus()) && endTime >0){
+								info.setPaperFilingStatus("6");
+							}else if("5".equals(info.getProjectReportRecordStatus()) && endTime >0){
+								info.setPaperFilingStatus("7");
+							}
+							endTime = endTime - endingAdventRecordCount;
+							info.setNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}
+
+					//设置纸质未归档天数
+					if (null != info.getTwoAuditPassDate()
+							&& !"5".equals(info.getPaperFilingStatus()) &&
+							!"7".equals(info.getPaperFilingStatus()) && !"10".equals(info.getPaperFilingStatus())){
+						try {
+							Date date2 = format.parse(info.getTwoAuditPassDate());
+							Long dateTimeLong = date.getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong)/(24*60*60*1000);
+							if("0".equals(info.getPaperFilingStatus()) && endTime >0){
+								info.setPaperFilingStatus("6");
+							}else if("5".equals(info.getPaperFilingStatus()) && endTime >0){
+								info.setPaperFilingStatus("7");
+							}
+							endTime = endTime - endingAdventRecordACount;
+							info.setPaperNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}else if (null != info.getTwoAuditPassDate() && (5 == info.getProjectReportRecordStatus()
+							|| 7 == info.getProjectReportRecordStatus()) && null != info.getPaperFilingAuditPassDate()) {
+						try {
+							Date date2 = format.parse(info.getTwoAuditPassDate());
+							//获取电子归档审核通过时间
+							Long dateTimeLong = info.getPaperFilingAuditPassDate().getTime();
+							Long date2TimeLong = date2.getTime();
+							//计算未归档天数
+							Long endTime = (dateTimeLong - date2TimeLong) / (24 * 60 * 60 * 1000);
+							endTime = endTime - endingAdventRecordACount;
+							info.setPaperNoArchivedDays(endTime.toString());
+						} catch (ParseException e) {
+							e.printStackTrace();
+						}
+					}
+				}
+
 			}
 		}
 
@@ -605,7 +776,7 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 					}
 				} else if ("2".equals(projectRecords.getProjectType())) {	//造价审核
 					//预算审核、结算审核、分包审核 需要纸质归档
-					if ("2".equals(projectRecords.getAttachmentProjectSort()) || "4".equals(projectRecords.getAttachmentProjectSort()) || "7".equals(projectRecords.getAttachmentProjectSort()) || "9".equals(projectRecords.getAttachmentProjectSort())) {
+					if ("2".equals(projectRecords.getAttachmentProjectSort()) || "4".equals(projectRecords.getAttachmentProjectSort()) || "7".equals(projectRecords.getAttachmentProjectSort()) || "20".equals(projectRecords.getAttachmentProjectSort()) || "10".equals(projectRecords.getAttachmentProjectSort())) {
 						assert createBy != null;
 						projectRecords.setPaperFilingStatus("");
 						projectRecords.setProjectId(serialNumTplService.genSerialNum(createBy.getCompany(), RuralProjectRecords.SERIAL_COST_BIZCODE));
@@ -627,7 +798,7 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 				}
 				break;
 			case "2":
-				if("5".equals(projectRecords.getAttachmentProjectSort()) || "6".equals(projectRecords.getAttachmentProjectSort()) || "8".equals(projectRecords.getAttachmentProjectSort()) || "9".equals(projectRecords.getAttachmentProjectSort())){
+				if("5".equals(projectRecords.getAttachmentProjectSort()) || "6".equals(projectRecords.getAttachmentProjectSort()) || "8".equals(projectRecords.getAttachmentProjectSort()) || "20".equals(projectRecords.getAttachmentProjectSort()) || "10".equals(projectRecords.getAttachmentProjectSort())){
 					projectRecords.setReportedState("10");
 				}else{
 					projectRecords.setReportedState(null);
@@ -790,6 +961,17 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 		//保存委托方联系人1
 		List<WorkClientLinkman> workClientLinkmanList = projectRecords.getWorkClientLinkmanList();
 		this.saveLinkmanInfos(projectRecords.getId(), workClientLinkmanList, 1);
+
+		//判断是否为咨询项目,若是咨询项目判断是否存在上报数据,若存在则修改上报数据中的标的额
+		if("1".equals(projectRecords.getProjectType()) && null != projectRecords.getTotalFees()){
+			//根据项目id查询上报信息
+			RuralProjectRecordsReported projectRecordsReported = ruralProjectRecordsReportedDao.getByProjectId(projectRecords.getId());
+			if(null != projectRecordsReported){
+				projectRecordsReported.setZiXunBDE(String.valueOf(projectRecords.getTotalFees()));
+				//修改咨询标的额金额
+				ruralProjectRecordsReportedDao.updateZiXunBDE(projectRecordsReported);
+			}
+		}
 	}
 
 
@@ -3021,10 +3203,13 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 				projectReportData.setConditionType("1003");
 			}*/
 
+			//ProjectType 1.工程咨询 2.造价审核
 			switch (projectRecords.getProjectType()){
 				case "1":
 					if("8".equals(projectRecords.getAttachmentProjectSort())){
 						projectReportData.setConditionType("1006");
+					} else if("10".equals(projectRecords.getAttachmentProjectSort())){
+						projectReportData.setConditionType("1008");
 					}else{
 						projectReportData.setConditionType("10");
 					}
@@ -3034,7 +3219,7 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 						projectReportData.setConditionType("1005");
 					}else if("8".equals(projectRecords.getAttachmentProjectSort())){
 						projectReportData.setConditionType("1007");
-					}else if("9".equals(projectRecords.getAttachmentProjectSort())){
+					}else if("20".equals(projectRecords.getAttachmentProjectSort())){
 						projectReportData.setConditionType(RuralProjectRecords.SHANGHAI_COORDINATE_BIZCODE);
 					}
 					else{
@@ -3165,6 +3350,10 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 		List<RuralProjectRecords> projectRecordsList = dao.getProjectRecordListByAdvent(projectRecords);
 		projectRecordsList.addAll(projectRecordsExamineList);
 		for (RuralProjectRecords info: projectRecordsList) {
+			//判定 若项目类别为 数字化项目审核 则不进行考核
+			if("10".equals(info.getAttachmentProjectSort()) && "2".equals(info.getProjectType())){
+				continue;
+			}
 			String notifyStr = null;
 			String titleStr = null;
 			//如果当前时间大于过期时间
@@ -3361,6 +3550,8 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 				reportData.setStatus("1");
 				projectReportDataDao.updateStatus(reportData);
 			}
+			//删除原质量复核咨询员信息
+			projectcontentinfoDao.deleteConsultant(ruralProjectRecords.getId());
 		}
 		ProjectReportDataTwo projectReportDataTwo=projectReportDataTwoDao.getProjectReportDataTwoByProjectId(ruralProjectRecords.getId());
 		if (null != projectReportDataTwo){
@@ -3813,6 +4004,16 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 	}
 
 	/**
+	 * 根据签章documentId查询报告信息
+	 * @param documentId
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public RuralProjectRecords getReportInternalAuditSignatureByDocumentId(String documentId) {
+		return dao.getReportInternalAuditSignatureByDocumentId(documentId);
+	}
+
+	/**
 	 * 根据签章documentId查询审定(内)信息
 	 * @param documentId
 	 * @return
@@ -5240,6 +5441,10 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 		List<RuralProjectRecords> paperArchiveProjectReportedList = dao.getPaperArchiveProjectReportedList(projectRecords);
 
 		for (RuralProjectRecords info: paperArchiveProjectReportedList) {
+			//判定 若项目类别为 数字化项目审核 则不进行考核
+			if("10".equals(info.getAttachmentProjectSort()) && "2".equals(info.getProjectType())){
+				continue;
+			}
 			String notifyStr = null;
 			String titleStr = null;
 			//如果当前时间大于过期时间
@@ -5319,6 +5524,10 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 
 
 		for (RuralProjectRecords info: batchArchiveProjectReportedList) {
+			//判定 若项目类别为 数字化项目审核 则不进行考核
+			if("10".equals(info.getAttachmentProjectSort()) && "2".equals(info.getProjectType())){
+				continue;
+			}
 			String notifyStr = null;
 			String titleStr = null;
 			//如果当前时间大于过期时间
@@ -5388,6 +5597,11 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 	public void getJudgeAdvanceWeekNotice() {
 		List<RuralProjectRecords> judgeAdvanceWeekNotice = dao.findJudgeAdvanceWeekNotice();
 		for (RuralProjectRecords info : judgeAdvanceWeekNotice) {
+			//判定 若项目类别为 数字化项目审核 则不进行考核
+			if("10".equals(info.getAttachmentProjectSort()) && "2".equals(info.getProjectType())){
+				continue;
+			}
+
 			String notifyStr = null;
 			String titleStr = null;
 			//如果当前时间大于过期时间
@@ -5526,4 +5740,14 @@ public class RuralProjectRecordsService extends CrudService<RuralProjectRecordsD
 	public void updateProjectPaperFilingOnOverDue(RuralProjectRecords records){
 		dao.updateProjectPaperFilingOnOverDue(records.getId(),records.getPaperFilingStatus());
 	}
+
+
+	/**
+	 * 根据项目id修改纸质归档状态类型
+	 * @return
+	 */
+	@Transactional(readOnly = false)
+	public void updateProjectPaperFiling(RuralProjectRecords records){
+		dao.updateProjectPaperFiling(records.getId(),records.getPaperFilingStatus());
+	}
 }

+ 278 - 98
src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/ApprovalThread.java

@@ -13,6 +13,7 @@ import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.enums.ProjectStatusEnum;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
 import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.UserUtils;
@@ -85,117 +86,294 @@ public class ApprovalThread extends Thread {
             workClientAttachment.setAttachmentFlag("144");
             workClientAttachment.setAttachmentId(ruralProjectRecords.getId());
             List<Workattachment> fileList = workattachmentService.findList(workClientAttachment);
+
+            //创建一个用于存放签章文件documentId的集合
+            List<String> documentList = Lists.newArrayList();
+
             if(fileList.size()>0){
-                Workattachment workattachment = fileList.get(0);
-                if(StringUtils.isBlank(workattachment.getUrl())){
-                    disposeResult = "审定单文件存储路径为空,无法进行签章操作,请驳回后重新上传审定单";
-                    bool = false;
-                    notification(bool,disposeResult,"","","");
-                }
-                //下载审定单文件
-                String path = null;
-                if(System.getProperty("os.name").toLowerCase().contains("win")){
-                    path = "D:/attachment-file/";
-                }else{
-                    path = "/attachment-file/";
-                }
-                String file = workattachment.getUrl();
-                file = file.replace("amp;","");
-                String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
-                String aliyunUrl = Global.getAliyunUrl();
-                String aliDownloadUrl = Global.getAliDownloadUrl();
-                String cons = "";
-                if (file.contains(aliyunUrl)){
-                    cons = aliyunUrl;
-                }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
-                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
-                }else {
-                    cons = aliDownloadUrl;
-                }
-                String ossKey = file.split(cons+"/")[1];
-                new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
-                //将下载下来的文件转换为file文件
-                File srcFile = new File(path+fileName);
-                File verticalInvalidFile = new File(path+fileName);
-                deleteFile = path+fileName;
-
-                //截取文件名称
-                String srcFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
-                //截取文件后缀名
-                String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
-                if(!"doc".equals(substring.toLowerCase()) && !"docx".equals(substring.toLowerCase()) && !"pdf".equals(substring.toLowerCase())){
-                    disposeResult = "请上传doc、docx或者pdf的文件进行签章操作";
-                    bool = false;
-                    notification(bool,disposeResult,"","","");
-                }
-                //获取真签单的documentId
-                HashMap hashMap = SignaturePostUtil.getDocument(srcFile);
-                String code = hashMap.get("code").toString();
-
-                if("0".equals(code)){
-                    String result = hashMap.get("result").toString();
-                    HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
-                    documentId =  documentIdMap.get("documentId").toString();
-                    if("".equals(documentId)){
+                //判定是否为内审项目
+                if(("1".equals(ruralProjectRecords.getProjectType()) && "8".equals(ruralProjectRecords.getAttachmentProjectSort())) ||
+                        ("2".equals(ruralProjectRecords.getProjectType()) && ("5".equals(ruralProjectRecords.getAttachmentProjectSort())) || "6".equals(ruralProjectRecords.getAttachmentProjectSort()))){
+
+
+                    //循环遍历附件信息,并将附件信息的信息生成documentId用于生成签章contractId
+                    for (Workattachment workattachment : fileList) {
+                        if(StringUtils.isBlank(workattachment.getUrl())){
+                            bool = false;
+                            disposeResult =  "内审报告签章文件存储路径为空,无法进行签章操作,请驳回后重新上传盖章文件";
+                            notification(bool,disposeResult,"","","");
+                        }else{
+                            if(StringUtils.isBlank(workattachment.getUrl())){
+                                bool = false;
+                                disposeResult =  "内审报告签章文件存储路径为空,无法进行签章操作,请驳回后重新上传盖章文件";
+                                notification(bool,disposeResult,"","","");
+                            }else {
+                                //下载审定单文件
+                                String path = null;
+                                if(System.getProperty("os.name").toLowerCase().contains("win")){
+                                    path = "D:/attachment-file/";
+                                }else{
+                                    path = "/attachment-file/";
+                                }
+                                String file = workattachment.getUrl();
+                                file = file.replace("amp;","");
+                                String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                                String aliyunUrl = Global.getAliyunUrl();
+                                String aliDownloadUrl = Global.getAliDownloadUrl();
+                                String cons = "";
+                                if (file.contains(aliyunUrl)){
+                                    cons = aliyunUrl;
+                                }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                                }else {
+                                    cons = aliDownloadUrl;
+                                }
+                                String ossKey = file.split(cons+"/")[1];
+                                new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
+                                //将下载下来的文件转换为file文件
+                                File srcFile = new File(path+fileName);
+                                deleteFile = path+fileName;
+
+                                //截取文件后缀名
+                                String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+                                if(!"doc".equals(substring.toLowerCase()) && !"docx".equals(substring.toLowerCase()) && !"pdf".equals(substring.toLowerCase())){
+                                    disposeResult =  "请上传doc、docx或者pdf的文件进行签章操作";
+                                    bool = false;
+                                    notification(bool,disposeResult,"","","");
+                                }else{
+
+                                    //获取真签单的documentId
+                                    HashMap hashMap = SignaturePostUtil.getDocument(srcFile);
+                                    String code = hashMap.get("code").toString();
+
+                                    if("0".equals(code)){
+                                        String result = hashMap.get("result").toString();
+                                        HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
+                                        documentId =  documentIdMap.get("documentId").toString();
+                                        if("".equals(documentId)){
+                                            disposeResult =  "签章文件创建失败,签章文件存在问题";
+                                            bool = false;
+                                            notification(bool,disposeResult,"","","");
+                                        }else{
+                                            documentList.add(documentId);
+                                        }
+                                    }else{
+                                        String message = hashMap.get("message").toString();
+                                        disposeResult =  message;
+                                        bool = false;
+                                        notification(bool,disposeResult,"","","");
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                    Workattachment workattachment = fileList.get(0);
+                    if(StringUtils.isBlank(workattachment.getUrl())){
+                        disposeResult = "审定单文件存储路径为空,无法进行签章操作,请驳回后重新上传审定单";
                         bool = false;
-                        disposeResult = "签章文件创建失败";
                         notification(bool,disposeResult,"","","");
+                    }
+                    //下载审定单文件
+                    String path = null;
+                    if(System.getProperty("os.name").toLowerCase().contains("win")){
+                        path = "D:/attachment-file/";
                     }else{
+                        path = "/attachment-file/";
+                    }
+                    String file = workattachment.getUrl();
+                    file = file.replace("amp;","");
+                    String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                    String aliyunUrl = Global.getAliyunUrl();
+                    String aliDownloadUrl = Global.getAliDownloadUrl();
+                    String cons = "";
+                    if (file.contains(aliyunUrl)){
+                        cons = aliyunUrl;
+                    }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                        cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                    }else {
+                        cons = aliDownloadUrl;
+                    }
+                    String ossKey = file.split(cons+"/")[1];
+                    new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
+                    //将下载下来的文件转换为file文件
+                    File srcFile = new File(path+fileName);
+                    File verticalInvalidFile = new File(path+fileName);
+                    //截取文件名称
+                    String srcFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
+
+
+
+                    if(documentList.size()>0){
                         //获取竖版假(空白)签单的documentId
                         String verticalInvalidDocumentId = SignaturePostUtil.getVerticalInvalidDocument(verticalInvalidFile.getName(),verticalInvalidFile);
-                        if("".equals(verticalInvalidDocumentId)){
+
+                        //先将数据进行保存
+                        //签章完成则进行数据的保存
+                        ruralProjectRecords.setReportInternalAuditSignatureFlag(0);
+                        ruralProjectRecords.setReportInternalAuditSignatureDocumentId(String.join(",", documentList));
+                        ruralProjectRecords.setReportInternalAuditSignatureContractId("");
+                        ruralProjectRecords.setReportInternalAuditSignatureFileName("报告号:" + projectReportData.getNumber() + ruralProjectRecords.getProjectName() + "内审签章文件");
+                        ruralProjectRecords.setReportInternalAuditSignatureUploadFileUser(UserUtils.getUser());
+                        ruralProjectRecords.setReportInternalAuditSignatureUploadDate(new Date());
+                        //修改签章对应信息文件
+                        projectReportDataService.updateReportInternalAuditSignatureInfo(ruralProjectRecords);
+
+
+                        //签章完成则进行数据的保存
+                        projectReportData.setSignatureFlag(0);
+                        projectReportData.setSignatureDocumentId(String.join(",", documentList));
+                        projectReportData.setSignatureInvalidDocumentId(verticalInvalidDocumentId);
+                        projectReportData.setSignatureContractId("");
+                        projectReportData.setSignatureFileName(srcFileName);
+                        projectReportData.setSignatureUploadFileUser(UserUtils.getUser());
+                        projectReportData.setSignatureUploadDate(new Date());
+                        //修改签章对应信息文件
+                        projectReportDataService.updateSignatureInfo(projectReportData);
+
+
+                        List<String> invalidDocumentList = Lists.newArrayList();
+                        documentList.add(verticalInvalidDocumentId);
+                        invalidDocumentList.add(verticalInvalidDocumentId);
+                        //将空白单的documentId存入数据库种
+                        projectReportData.setSignatureInvalidDocumentId(String.join(",", invalidDocumentList));
+
+
+                        //根据项目id 和 documentId生成合同id
+                        long s1 = System.currentTimeMillis();
+                        HashMap contractIdHashMap = ruralProjectMessageService.getSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"",projectReportSignature.getSignatureType());
+                        String contractIdCode = contractIdHashMap.get("code").toString();
+                        String contractId = "";
+                        if("0".equals(contractIdCode)){
+                            contractId = contractIdHashMap.get("contractId").toString();
+                            if("".equals(contractId)){
+                                disposeResult =  "签章文件创建失败";
+                                bool = false;
+                                notification(bool,disposeResult,"","","");
+                            }
+                        }else{
+                            disposeResult =  contractIdHashMap.get("message").toString();
+                            bool = false;
+                            notification(bool,disposeResult,"","","");
+                        }
+                        long s2 = System.currentTimeMillis();
+                        System.out.println("创建签章合同用时:" + (s2-s1));
+                    }else{
+                        String message = "签章文件创建失败,签章文件存在问题";
+                        disposeResult =  message;
+                        bool = false;
+                        notification(bool,disposeResult,"","","");
+                    }
+                }else{
+                    Workattachment workattachment = fileList.get(0);
+                    if(StringUtils.isBlank(workattachment.getUrl())){
+                        disposeResult = "审定单文件存储路径为空,无法进行签章操作,请驳回后重新上传审定单";
+                        bool = false;
+                        notification(bool,disposeResult,"","","");
+                    }
+                    //下载审定单文件
+                    String path = null;
+                    if(System.getProperty("os.name").toLowerCase().contains("win")){
+                        path = "D:/attachment-file/";
+                    }else{
+                        path = "/attachment-file/";
+                    }
+                    String file = workattachment.getUrl();
+                    file = file.replace("amp;","");
+                    String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                    String aliyunUrl = Global.getAliyunUrl();
+                    String aliDownloadUrl = Global.getAliDownloadUrl();
+                    String cons = "";
+                    if (file.contains(aliyunUrl)){
+                        cons = aliyunUrl;
+                    }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                        cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                    }else {
+                        cons = aliDownloadUrl;
+                    }
+                    String ossKey = file.split(cons+"/")[1];
+                    new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
+                    //将下载下来的文件转换为file文件
+                    File srcFile = new File(path+fileName);
+                    File verticalInvalidFile = new File(path+fileName);
+                    deleteFile = path+fileName;
+
+                    //截取文件名称
+                    String srcFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
+                    //截取文件后缀名
+                    String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+                    if(!"doc".equals(substring.toLowerCase()) && !"docx".equals(substring.toLowerCase()) && !"pdf".equals(substring.toLowerCase())){
+                        disposeResult = "请上传doc、docx或者pdf的文件进行签章操作";
+                        bool = false;
+                        notification(bool,disposeResult,"","","");
+                    }
+                    //获取真签单的documentId
+                    HashMap hashMap = SignaturePostUtil.getDocument(srcFile);
+                    String code = hashMap.get("code").toString();
+
+                    if("0".equals(code)){
+                        String result = hashMap.get("result").toString();
+                        HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
+                        documentId =  documentIdMap.get("documentId").toString();
+                        if("".equals(documentId)){
                             bool = false;
-                            disposeResult = "竖版模板文件创建失败";
+                            disposeResult = "签章文件创建失败";
                             notification(bool,disposeResult,"","","");
                         }else{
-                            //签章完成则进行数据的保存
-                            projectReportData.setSignatureFlag(0);
-                            projectReportData.setSignatureDocumentId(documentId);
-                            projectReportData.setSignatureInvalidDocumentId(verticalInvalidDocumentId);
-                            projectReportData.setSignatureContractId("");
-                            projectReportData.setSignatureFileName(srcFileName);
-                            projectReportData.setSignatureUploadFileUser(UserUtils.getUser());
-                            projectReportData.setSignatureUploadDate(new Date());
-                            //修改签章对应信息文件
-                            projectReportDataService.updateSignatureInfo(projectReportData);
-
-
-                            List<String> documentList = Lists.newArrayList();
-                            List<String> invalidDocumentList = Lists.newArrayList();
-                            documentList.add(documentId);
-                            documentList.add(verticalInvalidDocumentId);
-                            //documentList.add(acrossInvalidDocumentId);
-                            invalidDocumentList.add(verticalInvalidDocumentId);
-                            //invalidDocumentList.add(acrossInvalidDocumentId);
-                            //将空白单的documentId存入数据库种
-                            projectReportData.setSignatureInvalidDocumentId(String.join(",", invalidDocumentList));
-                            //根据项目id 和 documentId生成合同id
-                            HashMap contractIdHashMap = ruralProjectMessageService.getSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"");
-                            String contractIdCode = contractIdHashMap.get("code").toString();
-                            String contractId = "";
-                            if("0".equals(contractIdCode)){
-                                contractId = contractIdHashMap.get("contractId").toString();
-                                if("".equals(contractId)){
-                                    disposeResult = "签章文件创建失败";
+                            //获取竖版假(空白)签单的documentId
+                            String verticalInvalidDocumentId = SignaturePostUtil.getVerticalInvalidDocument(verticalInvalidFile.getName(),verticalInvalidFile);
+                            if("".equals(verticalInvalidDocumentId)){
+                                bool = false;
+                                disposeResult = "竖版模板文件创建失败";
+                                notification(bool,disposeResult,"","","");
+                            }else{
+                                //签章完成则进行数据的保存
+                                projectReportData.setSignatureFlag(0);
+                                projectReportData.setSignatureDocumentId(documentId);
+                                projectReportData.setSignatureInvalidDocumentId(verticalInvalidDocumentId);
+                                projectReportData.setSignatureContractId("");
+                                projectReportData.setSignatureFileName(srcFileName);
+                                projectReportData.setSignatureUploadFileUser(UserUtils.getUser());
+                                projectReportData.setSignatureUploadDate(new Date());
+                                //修改签章对应信息文件
+                                projectReportDataService.updateSignatureInfo(projectReportData);
+
+
+                                List<String> invalidDocumentList = Lists.newArrayList();
+                                documentList.add(documentId);
+                                documentList.add(verticalInvalidDocumentId);
+                                //documentList.add(acrossInvalidDocumentId);
+                                invalidDocumentList.add(verticalInvalidDocumentId);
+                                //invalidDocumentList.add(acrossInvalidDocumentId);
+                                //将空白单的documentId存入数据库种
+                                projectReportData.setSignatureInvalidDocumentId(String.join(",", invalidDocumentList));
+                                //根据项目id 和 documentId生成合同id
+                                HashMap contractIdHashMap = ruralProjectMessageService.getSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"",projectReportSignature.getSignatureType());
+                                String contractIdCode = contractIdHashMap.get("code").toString();
+                                String contractId = "";
+                                if("0".equals(contractIdCode)){
+                                    contractId = contractIdHashMap.get("contractId").toString();
+                                    if("".equals(contractId)){
+                                        disposeResult = "签章文件创建失败";
+                                        bool = false;
+                                        notification(bool,disposeResult,"","","");
+                                    }
+                                }else{
                                     bool = false;
+                                    disposeResult = contractIdHashMap.get("message").toString();
                                     notification(bool,disposeResult,"","","");
                                 }
-                            }else{
-                                bool = false;
-                                disposeResult = contractIdHashMap.get("message").toString();
-                                notification(bool,disposeResult,"","","");
                             }
-                        }
 
+                        }
+                    }else{
+                        String message = hashMap.get("message").toString();
+                        bool = false;
+                        disposeResult = message;
+                        notification(bool,disposeResult,"","","");
                     }
-                }else{
-                    String message = hashMap.get("message").toString();
-                    bool = false;
-                    disposeResult = message;
-                    notification(bool,disposeResult,"","","");
-                }
 
-                //进行静默签署
+                    //进行静默签署
                                 /*HashMap signbyCompanyHashMap = ruralProjectMessageService.signbyCompany(contractId, documentList);
                                 if(null != signbyCompanyHashMap){
                                     String signbyCompany = signbyCompanyHashMap.get("code").toString();
@@ -203,9 +381,11 @@ public class ApprovalThread extends Thread {
                                         disposeResult = signbyCompanyHashMap.get("message").toString();
                                     }
                                 }*/
-                //将documentId 和contractId存储到质量复核对应的数据种
-                //签章完成则进行数据的保存
-                //notification(bool,disposeResult,documentId,contractId,srcFileName);
+                    //将documentId 和contractId存储到质量复核对应的数据种
+                    //签章完成则进行数据的保存
+                    //notification(bool,disposeResult,documentId,contractId,srcFileName);
+                }
+
             }else{
                 disposeResult = "审定单文件未找到,无法进行签章操作";
                 bool = false;

+ 374 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/InternalAuditSignatureThread.java

@@ -0,0 +1,374 @@
+package com.jeeplus.modules.ruralprojectrecords.thread;
+
+import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Lists;
+import com.jeeplus.common.config.Global;
+import com.jeeplus.common.oss.OSSClientUtil;
+import com.jeeplus.common.utils.SpringContextHolder;
+import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
+import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
+import com.jeeplus.modules.ruralprojectrecords.dao.RuralProjectMessageElectronicSealDao;
+import com.jeeplus.modules.ruralprojectrecords.entity.ProjectReportSignature;
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
+import com.jeeplus.modules.ruralprojectrecords.enums.ProjectStatusEnum;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageService;
+import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.tools.utils.SignaturePostUtil;
+import com.jeeplus.modules.workactivity.service.WorkActivityProcessService;
+import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
+import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.File;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * 报告签章线程信息
+ * @author: 徐滕
+ * @create: 2021-12-07 16:36
+ **/
+public class InternalAuditSignatureThread extends Thread {
+
+    private ProjectReportDataService projectReportDataService = SpringContextHolder.getBean(ProjectReportDataService.class);
+    private WorkattachmentService workattachmentService = SpringContextHolder.getBean(WorkattachmentService.class);
+    private RuralProjectMessageService ruralProjectMessageService = SpringContextHolder.getBean(RuralProjectMessageService.class);
+    private WorkActivityProcessService workActivityProcessService = SpringContextHolder.getBean(WorkActivityProcessService.class);
+    private WorkProjectNotifyService workProjectNotifyService = SpringContextHolder.getBean(WorkProjectNotifyService.class);
+    private RuralProjectMessageElectronicSealDao dao = SpringContextHolder.getBean(RuralProjectMessageElectronicSealDao.class);
+
+    private RuralProjectRecords ruralProjectRecords;
+    private ProjectReportSignature projectReportSignature;
+    private ProjectReportData projectReportData;
+    private Office office;
+    String documentId = "";
+
+
+    public InternalAuditSignatureThread(RuralProjectRecords ruralProjectRecords, ProjectReportSignature projectReportSignature, ProjectReportData projectReportData, Office office)
+    {
+        this.ruralProjectRecords = ruralProjectRecords;
+        this.projectReportSignature = projectReportSignature;
+        this.projectReportData = projectReportData;
+        this.office = office;
+    }
+
+    public void run(){
+        Boolean bool = true;
+        String disposeResult = "";
+        //下载审定单文件
+        String deleteFile = null;
+        try {
+            //进行签章调用
+            //根据项目id查询是否已经提交过了审定单签章
+            if(null == ruralProjectRecords){
+                bool = false;
+                disposeResult =  "查询不到该项目信息";
+                notification(bool,disposeResult,"","","");
+            }
+            if(null!= ruralProjectRecords.getReportSignatureFlag() && 1 == ruralProjectRecords.getReportSignatureFlag()){
+                bool = false;
+                disposeResult =  "该项目已经报告盖章完成";
+                notification(bool,disposeResult,"","","");
+            }
+            if(StringUtils.isBlank(ruralProjectRecords.getProjectMasterId())){
+                bool = false;
+                disposeResult =  "项目负责人为空,无法进行签章";
+                notification(bool,disposeResult,"","","");
+            }
+
+            //根据项目id和附件类型的
+            Workattachment workClientAttachment = new Workattachment();
+            workClientAttachment.setAttachmentFlag("147");
+            workClientAttachment.setAttachmentId(ruralProjectRecords.getId());
+            List<Workattachment> fileList = workattachmentService.findList(workClientAttachment);
+            if(fileList.size()>0){
+                Workattachment workattachment = fileList.get(0);
+                if(StringUtils.isBlank(workattachment.getUrl())){
+                    bool = false;
+                    disposeResult =  "内审报告签章文件存储路径为空,无法进行签章操作,请驳回后重新上传盖章文件";
+                    notification(bool,disposeResult,"","","");
+                }
+                //下载审定单文件
+                String path = null;
+                if(System.getProperty("os.name").toLowerCase().contains("win")){
+                    path = "D:/attachment-file/";
+                }else{
+                    path = "/attachment-file/";
+                }
+                String file = workattachment.getUrl();
+                file = file.replace("amp;","");
+                String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                String aliyunUrl = Global.getAliyunUrl();
+                String aliDownloadUrl = Global.getAliDownloadUrl();
+                String cons = "";
+                if (file.contains(aliyunUrl)){
+                    cons = aliyunUrl;
+                }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                }else {
+                    cons = aliDownloadUrl;
+                }
+                String ossKey = file.split(cons+"/")[1];
+                new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
+                //将下载下来的文件转换为file文件
+                File srcFile = new File(path+fileName);
+                deleteFile = path+fileName;
+
+                //截取文件名称
+                String srcFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
+                //截取文件后缀名
+                String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+                if(!"doc".equals(substring.toLowerCase()) && !"docx".equals(substring.toLowerCase()) && !"pdf".equals(substring.toLowerCase())){
+                    disposeResult =  "请上传doc、docx或者pdf的文件进行签章操作";
+                    bool = false;
+                    notification(bool,disposeResult,"","","");
+                }else{
+
+                    //获取真签单的documentId
+                    HashMap hashMap = SignaturePostUtil.getDocument(srcFile);
+                    String code = hashMap.get("code").toString();
+
+                    if("0".equals(code)){
+                        String result = hashMap.get("result").toString();
+                        HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
+                        documentId =  documentIdMap.get("documentId").toString();
+                        if("".equals(documentId)){
+                            disposeResult =  "签章文件创建失败";
+                            bool = false;
+                            notification(bool,disposeResult,"","","");
+                        }else{
+                            //先将数据进行保存
+                            //签章完成则进行数据的保存
+                            ruralProjectRecords.setReportInternalAuditSignatureFlag(0);
+                            ruralProjectRecords.setReportInternalAuditSignatureDocumentId(documentId);
+                            ruralProjectRecords.setReportInternalAuditSignatureContractId("");
+                            ruralProjectRecords.setReportInternalAuditSignatureFileName(srcFileName);
+                            ruralProjectRecords.setReportInternalAuditSignatureUploadFileUser(UserUtils.getUser());
+                            ruralProjectRecords.setReportInternalAuditSignatureUploadDate(new Date());
+                            //修改签章对应信息文件
+                            projectReportDataService.updateReportInternalAuditSignatureInfo(ruralProjectRecords);
+
+
+
+                            List<String> documentList = Lists.newArrayList();
+                            documentList.add(documentId);
+                            //根据项目id 和 documentId生成合同id
+                            long s1 = System.currentTimeMillis();
+                            User principalUser = UserUtils.getByUserName("姜亚亚");
+                            HashMap contractIdHashMap = ruralProjectMessageService.getReportInternalAuditSignatureContractId(ruralProjectRecords.getId(), documentList,principalUser.getId(),"",projectReportSignature.getSignatureType());
+                            String contractIdCode = contractIdHashMap.get("code").toString();
+                            String contractId = "";
+                            if("0".equals(contractIdCode)){
+                                contractId = contractIdHashMap.get("contractId").toString();
+                                if("".equals(contractId)){
+                                    disposeResult =  "签章文件创建失败";
+                                    bool = false;
+                                    notification(bool,disposeResult,"","","");
+                                }
+                            }else{
+                                disposeResult =  contractIdHashMap.get("message").toString();
+                                bool = false;
+                                notification(bool,disposeResult,"","","");
+                            }
+                            long s2 = System.currentTimeMillis();
+                            System.out.println("创建签章合同用时:" + (s2-s1));
+                        }
+                    }else{
+                        String message = hashMap.get("message").toString();
+                        disposeResult =  message;
+                        bool = false;
+                        notification(bool,disposeResult,"","","");
+                    }
+                }
+
+
+
+
+                //进行静默签署
+                /*long s3 = System.currentTimeMillis();
+                HashMap signbyCompanyHashMap = ruralProjectMessageService.signbyCompanyByKeyWord(contractId,documentList);
+                if(null != signbyCompanyHashMap){
+                    String signbyCompanyCode = signbyCompanyHashMap.get("code").toString();
+                    String signbyCompanyMessage = signbyCompanyHashMap.get("message").toString();
+                    if(!"0".equals(signbyCompanyCode) && (!"3001009".equals(signbyCompanyCode) || !"文件状态不是“签署中”".equals(signbyCompanyMessage))){
+                        disposeResult =  signbyCompanyMessage;
+                        bool = false;
+                    }
+                }
+                long s4 = System.currentTimeMillis();
+                System.out.println("进行静默签署用时:" + (s4-s3));*/
+                //notification(bool,disposeResult,documentId,contractId,srcFileName);
+                //将documentId 和contractId存储到质量复核对应的数据种
+            }else{
+                disposeResult =  "报告文件未找到,无法进行签章操作";
+                bool = false;
+                notification(bool,disposeResult,"","","");
+            }
+        }catch (Exception e){
+            if(StringUtils.isBlank(documentId)){
+                bool = false;
+                disposeResult = e.getMessage();
+                notification(bool,disposeResult,"","","");
+            }
+        }finally {
+            if(StringUtils.isNotBlank(deleteFile)){
+                //根据路径创建文件对象
+                File file = new File(deleteFile);
+                //路径是个文件且不为空时删除文件
+                if(file.isFile()&&file.exists()){
+                    file.delete();
+                }
+            }
+        }
+
+    }
+
+    private void notification(Boolean bool,String disposeResult,String documentId,String contractId,String srcFileName){
+        if(bool){
+            //users.add(projectReportSignature.getCreateBy());
+            //审核完成提示框
+            String title = "报告号【"+projectReportData.getNumber()+"】报告签章审批登记完成";
+            String content = "报告号【"+projectReportData.getNumber()+"】报告签章审批登记完成,项目编号:"+ruralProjectRecords.getProjectId();
+            if ("yes".equals(projectReportSignature.getAct().getFlag())) {
+                projectReportSignature.setStatus(ProjectStatusEnum.SIGNED.getValue());
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(projectReportSignature.getId());
+                //userList = workProjectNotifyService.readByNotifyId(notify);
+                //users.add(projectReportSignature.getCreateBy());
+                workProjectNotifyService
+                        .save(UtilNotify
+                                .saveNotify(projectReportSignature.getId(),
+                                        projectReportSignature.getCreateBy(),
+                                        projectReportSignature.getCompany().getId(),
+                                        title,
+                                        content,
+                                        "145",
+                                        "0",
+                                        "待通知",
+                                        "审批通过"));
+                //给苏州质控中的人员发送通知
+                List<User> szzks = UserUtils.getByRoleActivityEnname("szzk",3,office.getId(),"4",projectReportSignature.getCreateBy());
+                for (User szzk: szzks) {
+                    if(StringUtils.isNotBlank(szzk.getId())){
+                        workProjectNotifyService
+                                .save(UtilNotify
+                                        .saveNotify(projectReportSignature.getId(),
+                                                szzk,
+                                                projectReportSignature.getCompany().getId(),
+                                                title,
+                                                content,
+                                                "145",
+                                                "0",
+                                                "待通知",
+                                                "审批通过"));
+                    }
+                }
+
+            } else {
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(projectReportSignature.getId());
+                //userList = workProjectNotifyService.readByNotifyId(notify);
+                //users.add(projectReportSignature.getCreateBy());
+                if (projectReportSignature.getStatus()!= ProjectStatusEnum.RECALL.getValue()){
+                    projectReportSignature.setStatus(ProjectStatusEnum.REJECTED.getValue());
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(projectReportSignature.getId(),
+                                            projectReportSignature.getCreateBy(),
+                                            projectReportSignature.getCompany().getId(),
+                                            title,
+                                            content,
+                                            "145",
+                                            "0",
+                                            "待通知",
+                                            "审批通过"));
+                }
+            }
+            workActivityProcessService.deleteProcessIdAuditUsers(projectReportSignature.getProcessInstanceId());
+
+            //签章完成则进行数据的保存
+            ruralProjectRecords.setReportSignatureFlag(1);
+            ruralProjectRecords.setReportSignatureDocumentId(documentId);
+            ruralProjectRecords.setReportSignatureContractId(contractId);
+            ruralProjectRecords.setReportSignatureFileName(srcFileName);
+            ruralProjectRecords.setReportSignatureUploadFileUser(UserUtils.getUser());
+            ruralProjectRecords.setReportSignatureUploadDate(new Date());
+            //修改签章对应信息文件
+            projectReportDataService.updateReportSignatureInfo(ruralProjectRecords);
+
+            projectReportSignature.setStatus(5);
+            dao.updateReportSignature(projectReportSignature);
+        }else{
+            //users.add(projectReportSignature.getCreateBy());
+            //审核完成提示框
+            String title = "报告号【"+projectReportData.getNumber()+"】报告签章失败。原因:"+ disposeResult;
+            String content = "报告号【"+projectReportData.getNumber()+"】报告签章失败。原因:"+ disposeResult;
+            if ("yes".equals(projectReportSignature.getAct().getFlag())) {
+                projectReportSignature.setStatus(ProjectStatusEnum.SIGNED.getValue());
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(projectReportSignature.getId());
+                //userList = workProjectNotifyService.readByNotifyId(notify);
+                //users.add(projectReportSignature.getCreateBy());
+                workProjectNotifyService
+                        .save(UtilNotify
+                                .saveNotify(projectReportSignature.getId(),
+                                        projectReportSignature.getCreateBy(),
+                                        projectReportSignature.getCompany().getId(),
+                                        title,
+                                        content,
+                                        "145",
+                                        "0",
+                                        "待通知",
+                                        "审批通过"));
+                //给苏州质控中的人员发送通知
+                List<User> szzks = UserUtils.getByRoleActivityEnname("szzk",3,office.getId(),"4",projectReportSignature.getCreateBy());
+                for (User szzk: szzks) {
+                    if(StringUtils.isNotBlank(szzk.getId())){
+                        workProjectNotifyService
+                                .save(UtilNotify
+                                        .saveNotify(projectReportSignature.getId(),
+                                                szzk,
+                                                projectReportSignature.getCompany().getId(),
+                                                title,
+                                                content,
+                                                "145",
+                                                "0",
+                                                "待通知",
+                                                "审批通过"));
+                    }
+                }
+            } else {
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(projectReportSignature.getId());
+                //userList = workProjectNotifyService.readByNotifyId(notify);
+                //users.add(projectReportSignature.getCreateBy());
+                if (projectReportSignature.getStatus()!= ProjectStatusEnum.RECALL.getValue()){
+                    projectReportSignature.setStatus(ProjectStatusEnum.REJECTED.getValue());
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(projectReportSignature.getId(),
+                                            projectReportSignature.getCreateBy(),
+                                            projectReportSignature.getCompany().getId(),
+                                            title,
+                                            content,
+                                            "145",
+                                            "0",
+                                            "待通知",
+                                            "审批通过"));
+                }
+            }
+            workActivityProcessService.deleteProcessIdAuditUsers(projectReportSignature.getProcessInstanceId());
+
+            projectReportSignature.setStatus(1);
+            dao.updateReportSignature(projectReportSignature);
+        }
+
+
+    }
+}

+ 1 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/SignatureThread.java

@@ -160,7 +160,7 @@ public class SignatureThread extends Thread {
                             documentList.add(documentId);
                             //根据项目id 和 documentId生成合同id
                             long s1 = System.currentTimeMillis();
-                            HashMap contractIdHashMap = ruralProjectMessageService.getReportSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"");
+                            HashMap contractIdHashMap = ruralProjectMessageService.getReportSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"",projectReportSignature.getSignatureType());
                             String contractIdCode = contractIdHashMap.get("code").toString();
                             String contractId = "";
                             if("0".equals(contractIdCode)){

+ 2 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectMessageController.java

@@ -1583,6 +1583,8 @@ public class RuralCostProjectMessageController extends BaseController {
                 for (MainDictDetail mainDictDetail:mainDictDetails){
                     if (mainDictDetail.getValue().equals(workStaff.getMajor())){
                         workStaffCertificate.setMajor(mainDictDetail.getLabel());
+                        workStaffCertificate.setIdCard(workStaffBasicInfo.getIdCard());
+                        return workStaffCertificate;
                     }
                 }
             }

+ 2 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectMessageNewController.java

@@ -1952,6 +1952,8 @@ public class RuralCostProjectMessageNewController extends BaseController {
                 addMessage(redirectAttributes, "重新申请失败:上报管理员已关闭上报功能");
                 if (StringUtils.isNotBlank(reported.getHome()) && "home".equals(reported.getHome())){
                     return "redirect:" + Global.getAdminPath() + "/home/?repage";
+                }else if (StringUtils.isNotBlank(reported.getHome()) && "notifyList".equals(reported.getHome())){
+                    return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
                 }else {
                     return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralCostProjectMessage/?repage";
                 }

+ 4 - 4
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralCostProjectRecordsController.java

@@ -149,14 +149,14 @@ public class RuralCostProjectRecordsController extends BaseController {
 		Page<RuralProjectRecords> page = projectRecordsService.findPage(new Page<RuralProjectRecords>(request, response), projectRecords);
 
 		//查询所有和当前登陆人有关的项目的审核
-		WorkProjectNotify workProjectNotify = new WorkProjectNotify();
+		/*WorkProjectNotify workProjectNotify = new WorkProjectNotify();
 		workProjectNotify.setUser(UserUtils.getUser());
 		workProjectNotify.setCompanyId(UserUtils.getSelectCompany().getId());
 		workProjectNotify.setRemarks("待审批");
 		//添加项目对应编号
 		workProjectNotify.setType("39");
 		//查询所有需要当前登录人进行处理的项目信息
-		List<WorkProjectNotify> notifyList = workProjectNotifyService.findList(workProjectNotify);
+		List<WorkProjectNotify> notifyList = workProjectNotifyService.findList(workProjectNotify);*/
 
         //无合同状态下,获取委托方的名称
 		List<RuralProjectRecords> list = page.getList();
@@ -191,7 +191,7 @@ public class RuralCostProjectRecordsController extends BaseController {
 
 			//处理需要审批的项目信息
 			records1.setNotifyFlag(null);
-			for (WorkProjectNotify notify: notifyList) {
+			/*for (WorkProjectNotify notify: notifyList) {
 				if(notify.getNotifyId().equals(records1.getId())){
 					records1.setNotifyId(notify.getId());
 					if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
@@ -199,7 +199,7 @@ public class RuralCostProjectRecordsController extends BaseController {
 					}
 					break;
 				}
-			}
+			}*/
 		}
 		//查询工程类型
 		if (projectRecords.getEngineeringType()!=null){

+ 13 - 7
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageController.java

@@ -1884,7 +1884,7 @@ public class RuralProjectMessageController extends BaseController {
             //将空白单的documentId存入数据库种
             projectReportData.setSignatureInvalidDocumentId(String.join(",", invalidDocumentList));
             //根据项目id 和 documentId生成合同id
-            HashMap contractIdHashMap = ruralProjectMessageService.getSignatureContractId(projectId, documentList,principalUserId,generalManagerUserId);
+            HashMap contractIdHashMap = ruralProjectMessageService.getSignatureContractId(projectId, documentList,principalUserId,generalManagerUserId,"3");
             String contractIdCode = contractIdHashMap.get("code").toString();
             String contractId = "";
             if("0".equals(contractIdCode)){
@@ -2011,9 +2011,15 @@ public class RuralProjectMessageController extends BaseController {
             List<String> documentList = Lists.newArrayList();
             documentList.add(documentId);
 
-
+            String signatureType = "";
+            if(StringUtils.isNotBlank(records.getProjectType()) && "2".equals(records.getProjectType())
+                    && StringUtils.isNotBlank(records.getAttachmentProjectSort()) && "20".equals(records.getAttachmentProjectSort())){
+                signatureType = "2";
+            }else{
+                signatureType = "1";
+            }
             //根据项目id 和 documentId生成合同id
-            HashMap contractIdHashMap = ruralProjectMessageService.getReportSignatureContractId(projectId, documentList,principalUserId,"");
+            HashMap contractIdHashMap = ruralProjectMessageService.getReportSignatureContractId(projectId, documentList,principalUserId,"",signatureType);
             String contractIdCode = contractIdHashMap.get("code").toString();
             String contractId = "";
             if("0".equals(contractIdCode)){
@@ -2028,21 +2034,21 @@ public class RuralProjectMessageController extends BaseController {
             }
 
             //进行静默签署
-            HashMap signbyCompanyHashMap = ruralProjectMessageService.signbyCompanyByKeyWord(contractId, documentList);
+            /*HashMap signbyCompanyHashMap = ruralProjectMessageService.signbyCompanyByKeyWord(contractId, documentList);
             if(null != signbyCompanyHashMap){
                 String signbyCompany = signbyCompanyHashMap.get("code").toString();
                 if(!"0".equals(signbyCompany)){
                     map.put("str",signbyCompanyHashMap.get("message").toString());
                     return map;
                 }
-            }
+            }*/
 
             //获取contractUrl路径
-            /*String contractUrl = ruralProjectMessageService.getSignatureContractUrl(contractId);
+            String contractUrl = ruralProjectMessageService.getSignatureContractUrl(contractId);
             if("".equals(contractUrl)){
                 map.put("str","签章文件创建失败");
                 return map;
-            }*/
+            }
             //将documentId 和contractId存储到质量复核对应的数据种
             //签章完成则进行数据的保存
             records.setReportSignatureFlag(1);

+ 642 - 33
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageElectronicSealController.java

@@ -1,5 +1,7 @@
 package com.jeeplus.modules.ruralprojectrecords.web;
 
+import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Maps;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.oss.OSSClientUtil;
 import com.jeeplus.common.persistence.Page;
@@ -16,15 +18,16 @@ import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
 import com.jeeplus.modules.projectrecord.entity.ProjectPlanInfo;
 import com.jeeplus.modules.ruralprojectrecords.entity.*;
 import com.jeeplus.modules.ruralprojectrecords.enums.ProjectStatusEnum;
-import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageAllService;
-import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageElectronicSealService;
-import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageNewService;
-import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
+import com.jeeplus.modules.ruralprojectrecords.service.*;
+import com.jeeplus.modules.ruralprojectrecords.utils.FileUtil;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.UserService;
+import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
+import com.jeeplus.modules.tools.utils.SignaturePostUtil;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
 import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
 import freemarker.template.Configuration;
@@ -42,6 +45,7 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import org.springframework.web.multipart.MultipartFile;
+import redis.clients.jedis.Jedis;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -79,11 +83,15 @@ public class RuralProjectMessageElectronicSealController extends BaseController
     @Autowired
     private RuralProjectMessageNewService ruralProjectMessageService;
     @Autowired
+    private RuralProjectMessageService projectMessageService;
+    @Autowired
     private ProjectReportDataService projectReportDataService;
     @Autowired
     private ActTaskService actTaskService;
     @Autowired
     private RuralProjectRecordsService ruralProjectRecordsService;
+    @Autowired
+    private WorkattachmentService workattachmentService;
 
     @ModelAttribute
     public RuralProjectRecords get(@RequestParam(required=false) String id) {
@@ -125,7 +133,6 @@ public class RuralProjectMessageElectronicSealController extends BaseController
             typeList.add("1");
             typeList.add("2");
         }else {
-            oldProjectSort=projectRecords.getAttachmentProjectSort();
             String attachmentProjectSort=projectRecords.getAttachmentProjectSort();
             typeList.add(attachmentProjectSort.split("-")[0]);
             projectRecords.setAttachmentProjectSort(attachmentProjectSort.split("-")[1]);
@@ -139,12 +146,6 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         projectRecords.setSubmitMoney("1");
         Page<RuralProjectRecords> page = ruralProjectMessageAllService.findSignaturePage(new Page<RuralProjectRecords>(request, response), projectRecords);
         model.addAttribute("page", page);
-        /*if(null != projectRecords.getWorkContractInfo()){
-            model.addAttribute("workContractInfoName", projectRecords.getWorkContractInfo().getName());
-            if(null != projectRecords.getWorkContractInfo().getClient()){
-                model.addAttribute("workContractInfoClientName", projectRecords.getWorkContractInfo().getClient().getName());
-            }
-        }*/
         //无合同状态下,获取委托方的名称
         List<RuralProjectRecords> list = page.getList();
         for (int i = 0; i < list.size(); i++) {
@@ -182,6 +183,24 @@ public class RuralProjectMessageElectronicSealController extends BaseController
             }else{
                 records1.setApprovalSignatureUrlFlag(0);
             }
+
+            if(StringUtils.isNotBlank(records1.getReportInternalAuditSignatureUrl())){
+                records1.setReportInternalAuditSignatureUrlFlag(1);
+                //处理文件路径
+                //如果文件路径中包含 /xg-qz 则表示文件存储在签章的对应文件库中需要单独进行处理
+                if(records1.getReportInternalAuditSignatureUrl().contains("/xg-qz")){
+                    if(StringUtils.isNotBlank(records1.getReportInternalAuditSignatureUrl())){
+                        String signatureUrl = records1.getReportInternalAuditSignatureUrl().replace("/xg-qz","");
+                        records1.setReportInternalAuditSignatureUrl(signatureUrl);
+                    }
+                    records1.setReportInternalAuditSignatureUrl(new OSSClientUtil().getQzFileTemporaryLookUrl(aliyunUrl + records1.getReportInternalAuditSignatureUrl()));
+                }else{
+                    records1.setReportInternalAuditSignatureUrl(new OSSClientUtil().getFileTemporaryLookUrl(aliyunUrl + records1.getReportInternalAuditSignatureUrl()));
+                }
+            }else{
+                records1.setReportInternalAuditSignatureUrlFlag(0);
+            }
+
             if (records1.getWorkContractInfo() == null) {
                 projectRecordsService.queryLinkmanInfos(records1);
                 if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
@@ -195,22 +214,30 @@ public class RuralProjectMessageElectronicSealController extends BaseController
             //将生成的文件上传到阿里云中
             ruralProjectMessageElectronicSealService.getFile(records1);
         }
+
+        for (RuralProjectRecords records : list) {
+            records.setInternalAuditFlag("0");
+            switch (records.getProjectType()){
+                case "1":   //工程咨询
+                    //项目为工程咨询的且项目类型为8的为内审字项目(需要进行内审报告签发)
+                    if(StringUtils.isNotBlank(records.getAttachmentProjectSort()) && records.getAttachmentProjectSort().equals("8")){
+                        records.setInternalAuditFlag("1");
+                    }
+                    break;
+
+                case "2":   //造价审核
+                    //项目为造价审核的且项目类型为5、6的为内审字项目(需要进行内审报告签发)
+                    if(StringUtils.isNotBlank(records.getAttachmentProjectSort()) && (records.getAttachmentProjectSort().equals("5") || records.getAttachmentProjectSort().equals("6"))){
+                        records.setInternalAuditFlag("1");
+                    }
+                    break;
+            }
+        }
         if(StringUtils.isNotBlank(oldSubmitMoney)){
             projectRecords.setSubmitMoney(oldSubmitMoney);
         }
-        //查询工程类型
-        /*if (projectRecords.getEngineeringType()!=null){
-            ProjectEngineeringInfo engineeringInfo=engineeringService.get(projectRecords.getEngineeringType());
-            model.addAttribute("engineeringInfo", engineeringInfo);
-        }*/
         model.addAttribute("beginDate", projectRecords.getBeginDate());
         model.addAttribute("endDate", projectRecords.getEndDate());
-        //计算营业总收入
-        //model.addAttribute("moneyAll", ruralProjectMessageAllService.getMoneyAll(projectRecords));
-        /*model.addAttribute("reportSwitch", BaseController.REPORTSWITCH);
-        if (StringUtils.isNotBlank(oldProjectSort)){
-            model.addAttribute("oldProjectSort", oldProjectSort);
-        }*/
         return "modules/ruralprojectrecords/ruralporjectmessage/electronicSeal/ruralProjectMessageElectronicSealList";
     }
 
@@ -257,17 +284,77 @@ public class RuralProjectMessageElectronicSealController extends BaseController
             BigDecimal bd5 = new BigDecimal(projectReportSignatureInfo.getAuthorizeFeeDeductAssessmentFee());
             projectReportSignatureInfo.setAuthorizeFeeDeductAssessmentFee(bd5.toPlainString());
         }
-
         model.addAttribute("projectReportSignatureInfo",projectReportSignatureInfo);
+
+        switch (projectReportSignatureInfo.getType()){
+            case "1":
+                return "modules/ruralprojectrecords/electronicSeal/ruralProjectReportSignatureInfoForm";
+            case "2":
+                return "modules/ruralprojectrecords/electronicSeal/ruralProjectReportHSSignatureInfoForm";
+        }
         return "modules/ruralprojectrecords/electronicSeal/ruralProjectReportSignatureInfoForm";
     }
 
 
+    /**
+     * 查看,增加,编辑内审报告信息
+     */
+    @RequestMapping(value = "internalAuditForm")
+    public String internalAuditForm(@RequestParam(value = "id") String id, Model model) {
+        //查询到显示信息
+        ProjectReportSignatureInfo projectReportInternalAuditInfo = ruralProjectMessageElectronicSealService.findProjectReportInternalAuditInfoByProjectId(id);
+        /*if(null == projectReportSignatureInfo){
+            projectReportSignatureInfo = new ProjectReportSignatureInfo();
+            model.addAttribute("consultantName","");
+        }else{*/
+            //根据id查咨询员名称
+            String consultantName = ruralProjectMessageElectronicSealService.findZXYById(projectReportInternalAuditInfo.getConsultant());
+            model.addAttribute("consultantName",consultantName);
+        /*}*/
+        //将数据库拿到的科学计数法的数据转换成正常写法
+        //送审金额
+        if(null != projectReportInternalAuditInfo.getSubmitFee() && !projectReportInternalAuditInfo.getSubmitFee().equals("")) {
+            BigDecimal bd2 = new BigDecimal(projectReportInternalAuditInfo.getSubmitFee());
+            projectReportInternalAuditInfo.setSubmitFee(bd2.toPlainString());
+        }
+        //审定金额
+        if(null != projectReportInternalAuditInfo.getAuthorizeFee() && !projectReportInternalAuditInfo.getAuthorizeFee().equals("")) {
+            BigDecimal bd3 = new BigDecimal(projectReportInternalAuditInfo.getAuthorizeFee());
+            projectReportInternalAuditInfo.setAuthorizeFee(bd3.toPlainString());
+        }
+        //核减金额
+        if(null != projectReportInternalAuditInfo.getDecreaseInAccountingFee() && !projectReportInternalAuditInfo.getDecreaseInAccountingFee().equals("")) {
+            BigDecimal bd6 = new BigDecimal(projectReportInternalAuditInfo.getDecreaseInAccountingFee());
+            projectReportInternalAuditInfo.setDecreaseInAccountingFee(bd6.toPlainString());
+        }
+        //施工单位考核费
+        if(null != projectReportInternalAuditInfo.getConstructionUnitAssessmentFee() && !projectReportInternalAuditInfo.getConstructionUnitAssessmentFee().equals("")) {
+            BigDecimal bd4 = new BigDecimal(projectReportInternalAuditInfo.getConstructionUnitAssessmentFee());
+            projectReportInternalAuditInfo.setConstructionUnitAssessmentFee(bd4.toPlainString());
+        }
+        //扣除考核费后审定金额
+        if(null != projectReportInternalAuditInfo.getAuthorizeFeeDeductAssessmentFee() && !projectReportInternalAuditInfo.getAuthorizeFeeDeductAssessmentFee().equals("")) {
+            BigDecimal bd5 = new BigDecimal(projectReportInternalAuditInfo.getAuthorizeFeeDeductAssessmentFee());
+            projectReportInternalAuditInfo.setAuthorizeFeeDeductAssessmentFee(bd5.toPlainString());
+        }
+        model.addAttribute("projectReportInternalAuditInfo",projectReportInternalAuditInfo);
+
+        return "modules/ruralprojectrecords/electronicSeal/ruralProjectReportNSBGSignatureInfoForm";
+    }
+
+
     //@RequiresPermissions("ruralProject:electronicSeal:approvalForm")
     @RequestMapping(value="approvalForm")
     public String approvalForm(RuralProjectRecords projectRecords, Model model){
         if (projectRecords!=null&& StringUtils.isNotBlank(projectRecords.getId())) {
             projectRecords = projectRecordsService.get(projectRecords.getId());
+
+            //判定是否为工程造价(上海)项目
+            if("2".equals(projectRecords.getProjectType()) && "20".equals(projectRecords.getAttachmentProjectSort())){
+                model.addAttribute("approvalType",1);
+            }else{
+                model.addAttribute("approvalType",0);
+            }
             projectRecordsService.queryProjectDetailBySignature(projectRecords,"144");
             ProjectPlanInfo projectPlanInfo = new ProjectPlanInfo();
             projectPlanInfo.setProjectId(projectRecords.getId());
@@ -288,6 +375,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
                 //处理项目类别
                 for (MainDictDetail info: mainDictList) {
                     if(projectRecords.getAttachmentProjectSort().equals(info.getValue())){
+                        projectRecords.setAttachmentProjectSortKey(projectRecords.getAttachmentProjectSort());
                         projectRecords.setAttachmentProjectSort(info.getLabel());
                         break;
                     }
@@ -314,6 +402,14 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         if (null!=reported){
             model.addAttribute("reportedId",reported.getId());
         }
+
+        //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+        ProjectApprovalSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectApprovalSignature(projectRecords.getId());
+        if(null != projectApprovalSignature && StringUtils.isNotBlank(projectApprovalSignature.getSignatureType())){
+            model.addAttribute("signatureType",projectApprovalSignature.getSignatureType());
+        }else{
+            model.addAttribute("signatureType","");
+        }
         //查询所有的工程类型
         List<ProjectEngineeringInfo> engineeringInfos=engineeringService.findList(new ProjectEngineeringInfo());
         model.addAttribute("engineeringInfo",engineeringInfos);
@@ -322,9 +418,15 @@ public class RuralProjectMessageElectronicSealController extends BaseController
 
     /**
      * 保存审定单签章送审信息
+     * @param projectRecords
+     * @param signatureType    苏州审定单选择类型(1:崇明;2:金山;3:自定义)
+     * @param model
+     * @param redirectAttributes
+     * @return
+     * @throws Exception
      */
     @RequestMapping(value = "approvalSave")
-    public String approvalSave(RuralProjectRecords projectRecords, Model model, RedirectAttributes redirectAttributes) throws Exception {
+    public String approvalSave(RuralProjectRecords projectRecords, String signatureType, Model model, RedirectAttributes redirectAttributes) throws Exception {
         try {
             //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
             ProjectApprovalSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectApprovalSignature(projectRecords.getId());
@@ -338,6 +440,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
                     addMessage(redirectAttributes, "审定单签章申请已登记完成,无法再次送审");
                     return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
                 }
+                projectApprovalSignature.setSignatureType(signatureType);
                 projectApprovalSignature.setWorkAttachments(projectRecords.getWorkAttachments());
                 ruralProjectMessageElectronicSealService.approvalSave(projectApprovalSignature);//保存
             }else{
@@ -345,6 +448,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
                 projectApprovalSignature.setProjectId(projectRecords.getId());
                 projectApprovalSignature.setStatus(ProjectStatusEnum.IN_APRL.getValue());
                 projectApprovalSignature.setWorkAttachments(projectRecords.getWorkAttachments());
+                projectApprovalSignature.setSignatureType(signatureType);
                 ruralProjectMessageElectronicSealService.approvalSave(projectApprovalSignature);//保存
             }
             addMessage(redirectAttributes, "保存审定单签章申请成功");
@@ -363,7 +467,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
      * @return
      */
     @RequestMapping("approvalSaveAudit")
-    public String approvalSaveAudit(RuralProjectRecords projectRecords, Model model, RedirectAttributes redirectAttributes,Integer saveAuditFlag)  {
+    public String approvalSaveAudit(RuralProjectRecords projectRecords, String signatureType, Model model, RedirectAttributes redirectAttributes,Integer saveAuditFlag)  {
         String home = projectRecords.getHome();
         try {
             String taskDefKey = projectRecords.getAct().getTaskDefKey();
@@ -378,6 +482,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
             }else {
                 //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
                 ProjectApprovalSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectApprovalSignature(projectRecords.getId());
+                projectApprovalSignature.setSignatureType(signatureType);
                 projectApprovalSignature.setAct(projectRecords.getAct());
                 if(null != saveAuditFlag) {
                     if (projectApprovalSignature.getStatus() != 4 && projectApprovalSignature.getStatus() != 5) {
@@ -428,6 +533,21 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
         ProjectApprovalSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectApprovalSignature(projectRecords.getId());
         projectRecords = projectRecordsService.get(projectRecords.getId());
+
+        //判定是否为工程造价(上海)项目
+        if("2".equals(projectRecords.getProjectType()) && "20".equals(projectRecords.getAttachmentProjectSort())){
+            model.addAttribute("approvalType",1);
+        }else{
+            model.addAttribute("approvalType",0);
+        }
+
+        //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+        if(null != projectApprovalSignature && StringUtils.isNotBlank(projectApprovalSignature.getSignatureType())){
+            model.addAttribute("signatureType",projectApprovalSignature.getSignatureType());
+        }else{
+            model.addAttribute("signatureType","");
+        }
+
         projectRecordsService.queryProjectDetailBySignature(projectRecords,"144");
         projectRecords.setProcessInstanceId(projectApprovalSignature.getProcessInstanceId());
         projectRecords.setProjectStatus(projectApprovalSignature.getStatus());
@@ -556,6 +676,64 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         return "modules/ruralprojectrecords/electronicSeal/ruralProjectRecordsReportSignatureForm";
     }
 
+
+    //@RequiresPermissions("ruralProject:electronicSeal:reportSignatureForm")
+    @RequestMapping(value="internalAuditReportSignatureForm")
+    public String internalAuditReportSignatureForm(RuralProjectRecords projectRecords, Model model){
+        if (projectRecords!=null&& StringUtils.isNotBlank(projectRecords.getId())) {
+            projectRecords = projectRecordsService.get(projectRecords.getId());
+            projectRecordsService.queryProjectDetailBySignature(projectRecords,"147");
+            ProjectPlanInfo projectPlanInfo = new ProjectPlanInfo();
+            projectPlanInfo.setProjectId(projectRecords.getId());
+            if(null != projectRecords.getWorkContractInfo()){
+                if(null != projectRecords.getWorkContractInfo().getContractTypeDoc()){
+                    projectRecords.getWorkContractInfo().setContractType(DictUtils.getMainDictLabel(String.valueOf(projectRecords.getWorkContractInfo().getContractTypeDoc()),"contract_info_type",""));
+                }
+            }
+            List<MainDictDetail> mainDictList = com.google.common.collect.Lists.newArrayList();
+            //工程咨询
+            if("1".equals(projectRecords.getProjectType())){
+                mainDictList = DictUtils.getMainDictList("attachment_project_sort");
+                //造价审核
+            } else if("2".equals(projectRecords.getProjectType())){
+                mainDictList = DictUtils.getMainDictList("attachment_project_sort_cost");
+            }
+            if(StringUtils.isNotBlank(projectRecords.getAttachmentProjectSort())){
+                //处理项目类别
+                for (MainDictDetail info: mainDictList) {
+                    if(projectRecords.getAttachmentProjectSort().equals(info.getValue())){
+                        projectRecords.setAttachmentProjectSort(info.getLabel());
+                        break;
+                    }
+                }
+            }
+
+            //查询项目报告信息
+            ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(projectRecords.getId());
+            //如果项目报告不为空,则查询项目线上归档信息
+            if(null != projectReportData){
+                ProjectReportRecord projectReportRecord = ruralProjectMessageService.getProjectReportRecord(projectReportData.getId());
+                if(null != projectReportRecord){
+                    model.addAttribute("projectId", projectRecords.getId());
+                }else{
+                    model.addAttribute("projectId", "");
+                }
+            }
+
+            model.addAttribute("flagProjectReportData",projectReportData);
+
+        }
+        model.addAttribute("projectRecords", projectRecords);
+        RuralProjectRecordsReported reported = ruralProjectMessageService.getRuralProjectRecordsReported(projectRecords.getId());
+        if (null!=reported){
+            model.addAttribute("reportedId",reported.getId());
+        }
+        //查询所有的工程类型
+        List<ProjectEngineeringInfo> engineeringInfos=engineeringService.findList(new ProjectEngineeringInfo());
+        model.addAttribute("engineeringInfo",engineeringInfos);
+        return "modules/ruralprojectrecords/electronicSeal/ruralProjectRecordsInternalAuditReportSignatureForm";
+    }
+
     /**
      * 保存报告签章送审信息
      */
@@ -590,6 +768,39 @@ public class RuralProjectMessageElectronicSealController extends BaseController
     }
 
     /**
+     * 保存报告签章送审信息
+     */
+    @RequestMapping(value = "reportInternalAuditSignatureSave")
+    public String reportInternalAuditSignatureSave(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes) {
+        try {
+            //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+            ProjectReportSignature projectInternalAuditSignature = ruralProjectMessageElectronicSealService.getProjectReportInternalAudit(projectRecords.getId());
+            if(null != projectInternalAuditSignature){
+                if(projectInternalAuditSignature.getStatus() == 3 || projectInternalAuditSignature.getStatus() == 1) {
+                    //projectApprovalSignature.setStatus(ProjectStatusEnum.IN_APRL.getValue());
+                }else if(projectInternalAuditSignature.getStatus() == 2){
+                    addMessage(redirectAttributes, "内审报告签章申请已送审,无法重复送审");
+                    return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+                }else if(projectInternalAuditSignature.getStatus() == 5){
+                    addMessage(redirectAttributes, "内审报告签章申请已登记完成,无法再次送审");
+                    return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+                }
+                ruralProjectMessageElectronicSealService.reportInternalAuditSignatureSave(projectInternalAuditSignature);//保存
+            }else{
+                projectInternalAuditSignature = new ProjectReportSignature();
+                projectInternalAuditSignature.setProjectId(projectRecords.getId());
+                projectInternalAuditSignature.setStatus(ProjectStatusEnum.IN_APRL.getValue());
+                ruralProjectMessageElectronicSealService.reportInternalAuditSignatureSave(projectInternalAuditSignature);//保存
+            }
+            addMessage(redirectAttributes, "保存报告签章申请成功");
+        }catch (Exception e){
+            logger.error("保存报告签章申请异常:",e);
+            addMessage(redirectAttributes, "保存报告签章申请异常:"+e.getMessage());
+        }
+        return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+    }
+
+    /**
      * 审批
      * @param projectRecords
      * @param redirectAttributes
@@ -656,6 +867,79 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         }
     }
 
+    /**
+     * 审批(内审报告审批)
+     * @param projectRecords
+     * @param redirectAttributes
+     * @return
+     */
+    @RequestMapping("reportInternalAuditSignatureSaveAudit")
+    public String reportInternalAuditSignatureSaveAudit(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes,Integer saveAuditFlag)  {
+        String home = projectRecords.getHome();
+        try {
+            String taskDefKey = projectRecords.getAct().getTaskDefKey();
+            //当状态为未通过时,重新修改数据
+            if ("modifyApply".equals(taskDefKey)) {
+                projectRecords.getAct().setComment("重新申请");
+            }
+            List<User> users = UserUtils.getByProssType(projectRecords.getProcessInstanceId(),1);
+            if ("szzk".equals(taskDefKey)){
+                users = UserUtils.getByProssType(projectRecords.getProcessInstanceId(),2);
+                if (users==null )
+                    users = UserUtils.getByRoleActivityEnname("bmzr",2,projectRecords.getOffice().getId(),"2",projectRecords.getCreateBy());
+            }else  if ("bmzr".equals(taskDefKey)){
+                users = UserUtils.getByProssType(projectRecords.getProcessInstanceId(),2);
+                if (users==null )
+                    users = UserUtils.getByRoleActivityEnname("bmzr",2,projectRecords.getOffice().getId(),"2",projectRecords.getCreateBy());
+            }else if ("modifyApply".equals(taskDefKey)){
+                users = UserUtils.getByProssType(projectRecords.getProcessInstanceId(),1);
+            }
+            String flag = projectRecords.getAct().getFlag();
+            if ("yes".equals(flag) && (users==null || users.size()==0)){
+                addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+            }else {
+                //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+                ProjectReportSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectReportInternalAudit(projectRecords.getId());
+                projectApprovalSignature.setAct(projectRecords.getAct());
+                if(null != saveAuditFlag) {
+                    if (projectApprovalSignature.getStatus() != 4 && projectApprovalSignature.getStatus() != 5) {
+                        addMessage(redirectAttributes, "内审报告签章申请已送审,请勿重复送审");
+                        if (StringUtils.isNotBlank(home) && "home".equals(home)) {
+                            return "redirect:" + Global.getAdminPath() + "/home/?repage";
+                        }else if (StringUtils.isNotBlank(projectRecords.getHome()) && "notifyList".equals(projectRecords.getHome())){
+                            return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
+                        } else {
+                            return "redirect:" + Global.getAdminPath() + "/ruralProject/electronicSeal/?repage";
+                        }
+                    }
+                }
+                if(projectApprovalSignature.getStatus() == 5){
+                    addMessage(redirectAttributes, "内审报告签章申请已登记完成,无法再次送审");
+                    if (StringUtils.isNotBlank(home) && "home".equals(home)){
+                        return "redirect:" + Global.getAdminPath() + "/home/?repage";
+                    }else if (StringUtils.isNotBlank(projectRecords.getHome()) && "notifyList".equals(projectRecords.getHome())){
+                        return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
+                    }else {
+                        return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+                    }
+                }
+                String str = ruralProjectMessageElectronicSealService.reportInternalAuditSignatureSaveAudit(projectApprovalSignature,users);
+                addMessage(redirectAttributes, str);
+            }
+        }catch (Exception e){
+            addMessage(redirectAttributes, "内审报告签章申请审批失败");
+            logger.error("Exception e:"+e);
+        }
+
+        if (StringUtils.isNotBlank(home) && "home".equals(home)){
+            return "redirect:" + Global.getAdminPath() + "/home/?repage";
+        }else if (StringUtils.isNotBlank(projectRecords.getHome()) && "notifyList".equals(projectRecords.getHome())){
+            return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
+        }else {
+            return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+        }
+    }
+
 
     @RequestMapping(value = "reportSignatureModify")
     public String reportSignatureModify(RuralProjectRecords projectRecords, Model model) {
@@ -704,6 +988,53 @@ public class RuralProjectMessageElectronicSealController extends BaseController
     }
 
 
+    @RequestMapping(value = "reportInternalAuditSignatureModify")
+    public String reportInternalAuditSignatureModify(RuralProjectRecords projectRecords, Model model) {
+        //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+        ProjectReportSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectReportInternalAudit(projectRecords.getId());
+        projectRecords = projectRecordsService.get(projectRecords.getId());
+        projectRecordsService.queryProjectDetail(projectRecords);
+        projectRecords.setProcessInstanceId(projectApprovalSignature.getProcessInstanceId());
+        projectRecords.setProjectStatus(projectApprovalSignature.getStatus());
+        ProcessInstance processInstance = actTaskService.getProcIns(projectRecords.getProcessInstanceId());
+        if (processInstance!=null) {
+            Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+            Act act = new Act();
+            act.setTaskId(taskInfok.getId());
+            act.setTaskName(taskInfok.getName());
+            act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+            act.setProcDefId(taskInfok.getProcessDefinitionId());
+            act.setProcInsId(taskInfok.getProcessInstanceId());
+            act.setTask(taskInfok);
+            projectRecords.setAct(act);
+        }
+
+        //查询所有的工程类型
+        List<ProjectEngineeringInfo> engineeringInfos=engineeringService.findList(new ProjectEngineeringInfo());
+
+        //处理项目类别
+        List<MainDictDetail> mainDictList = com.google.common.collect.Lists.newArrayList();
+        if("1".equals(projectRecords.getProjectType())){
+            mainDictList = DictUtils.getMainDictList("attachment_project_sort");
+        }else if("2".equals(projectRecords.getProjectType())){
+            mainDictList = DictUtils.getMainDictList("attachment_project_sort_cost");
+        }
+        for (MainDictDetail info: mainDictList) {
+            if(projectRecords.getAttachmentProjectSort().equals(info.getValue())){
+                projectRecords.setAttachmentProjectSort(info.getLabel());
+                break;
+            }
+        }
+        //查询工程类型信息
+        ProjectEngineeringInfo engineeringInfo=engineeringService.get(projectRecords.getEngineeringType());
+        model.addAttribute("engInfo", engineeringInfo);
+        model.addAttribute("engineeringInfo",engineeringInfos);
+        model.addAttribute("processInstanceId", projectRecords.getProcessInstanceId());
+        model.addAttribute("projectRecords", projectRecords);
+        return "modules/ruralprojectrecords/electronicSeal/ruralProjectRecordsReportInternalAuditSignatureModify";
+    }
+
+
     @RequestMapping(value = "reportSignatureRevoke")
     public String reportSignatureRevoke(HttpServletRequest request, RedirectAttributes redirectAttributes) {
         HashMap<String, String> requestMap = findRequestMap(request);
@@ -727,6 +1058,29 @@ public class RuralProjectMessageElectronicSealController extends BaseController
 
 
 
+    @RequestMapping(value = "reportInternalAuditSignatureRevoke")
+    public String reportInternalAuditSignatureRevoke(HttpServletRequest request, RedirectAttributes redirectAttributes) {
+        HashMap<String, String> requestMap = findRequestMap(request);
+        String id = requestMap.get("id");
+        try {
+            //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+            ProjectReportSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectReportInternalAudit(id);
+
+            if("5".equals(projectApprovalSignature.getStatus())){
+                addMessage(redirectAttributes, "内审报告签章申请已审批通过,无法撤回");
+                return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+            }
+            ruralProjectMessageElectronicSealService.cancelReportInternalAuditSignatureProcess(projectApprovalSignature);
+            addMessage(redirectAttributes, "撤回该内审报告签章申请审批成功");
+        }catch (Exception e){
+            logger.info(e.getMessage());
+            addMessage(redirectAttributes, "撤回该内审报告签章申请审批失败");
+        }
+        return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+    }
+
+
+
 
 
 
@@ -747,6 +1101,7 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         Map<String,Object> data = ruralProjectMessageElectronicSealService.disposeProjectReportdata(projectReportData);
         String projectName = (String) data.get("projectName");
         String number = (String) data.get("number");
+        String type = (String) data.get("type");
 
         //模板对象
         Template template=null;
@@ -756,7 +1111,11 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         try {
             cfg.setDirectoryForTemplateLoading(path);
             //选择对应的ftl文件
-            template = cfg.getTemplate("projectSignature.ftl","UTF-8");
+            if("1".equals(type)){
+                template = cfg.getTemplate("projectSignature.ftl","UTF-8");
+            }else if("2".equals(type)){
+                template = cfg.getTemplate("projectHSSignature.ftl","UTF-8");
+            }
             File docFile = new File("报告号【"+number + "】报告签章.doc");
             FreemarkerUtil.generateFile(data,template,docFile);
             ResponseUtil.docResponse("报告号【"+number + "】项目名称:" + projectName + " 报告签章.doc",docFile,response);
@@ -778,21 +1137,78 @@ public class RuralProjectMessageElectronicSealController extends BaseController
 
     }
 
+
+
+    /**
+     * 下载工程造价咨询质量控制流程单信息
+     * @param response
+     * @param projectReportData
+     */
+    @RequestMapping(value="downloadProjectInternalAuditSignatureControl")
+    @ResponseBody
+    public void downloadProjectInternalAuditSignatureControl(HttpServletResponse response, ProjectReportData projectReportData)  {
+        Map<String,Object> data = ruralProjectMessageElectronicSealService.disposeProjectInternalAuditReportdata(projectReportData);
+        String projectName = (String) data.get("projectName");
+        String number = (String) data.get("reportNumber");
+        String type = (String) data.get("type");
+
+        //模板对象
+        Template template=null;
+        //freemaker模板路径
+        File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
+        Configuration cfg = new Configuration();
+        try {
+            cfg.setDirectoryForTemplateLoading(path);
+            //选择对应的ftl文件
+            if("3".equals(type)){
+                template = cfg.getTemplate("projectInternalAuditSignature.ftl","UTF-8");
+            }
+            File docFile = new File("报告号【"+number + "】内审报告签章.doc");
+            FreemarkerUtil.generateFile(data,template,docFile);
+            ResponseUtil.docResponse("报告号【"+number + "】项目名称:" + projectName + " 内审报告签章.doc",docFile,response);
+            //将生成的文件上传到阿里云中
+            ruralProjectMessageElectronicSealService.uploadOss(projectReportData,docFile);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally {
+
+            //获取tomcat的路径
+            String tomcatFilePath=System.getProperty("catalina.home");
+            //删除tomcat目录下的处理后的文件信息
+            File tomcatFile = new File(tomcatFilePath+"/bin/"+"报告号【"+number + "】内审报告签章.doc");
+            if (tomcatFile.isFile()) {
+                tomcatFile.delete();
+            }
+        }
+
+
+    }
+
     /**
      * 导入造价审核B类项目数据
      */
     @RequiresPermissions("ruralProject:ruralProjectMessageAll:importB")
     @RequestMapping(value = "importB", method=RequestMethod.POST)
-    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
+    public String importFile(MultipartFile file, RedirectAttributes redirectAttributes,String concealType) {
         try {
             ImportExcelNew importExcelNew = new ImportExcelNew();
-            List<ProjectReportSignatureInfo> list = importExcelNew.ImportExcelNew(file,1,0);  //只处理file 1不要也可以,0为sheet编号
-
+            List<ProjectReportSignatureInfo> list = Lists.newArrayList();
+            switch (concealType){
+                case "js":
+                    list = importExcelNew.ImportExcelNews(file,1,0, concealType);  //只处理file 1不要也可以,0为sheet编号
+                    break;
+                case "sh":
+                    list =importExcelNew.ImportExcelNews(file,1,0, concealType);  //只处理file 1不要也可以,0为sheet编号
+                    break;
+                case "nsbg":
+                    list = importExcelNew.ImportExcelNSBGNews(file,1,0, concealType);  //只处理file 1不要也可以,0为sheet编号
+                    break;
+            }
             //对数据进行处理
-            String resultStr = ruralProjectMessageElectronicSealService.disposeImportBRuralProjectRecords(list);
+            String resultStr = ruralProjectMessageElectronicSealService.disposeImportBRuralProjectRecords(list,concealType);
             addMessage(redirectAttributes, resultStr);
         } catch (Exception e) {
-            addMessage(redirectAttributes, "导入B类项目失败!失败信息:"+e.getMessage());
+            addMessage(redirectAttributes, "导入数据信息失败!失败信息:"+e.getMessage());
         }
         return "redirect:"+ Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
     }
@@ -801,10 +1217,22 @@ public class RuralProjectMessageElectronicSealController extends BaseController
      * 下载导入造价审核B类项目数据模板
      */
     @RequestMapping(value = "importB/template")
-    public String importFileTemplateB(HttpServletResponse response, HttpServletRequest request) {
+    public String importFileTemplateB(HttpServletResponse response, HttpServletRequest request,String type) {
         try {
             ThisLocalityDownloadUtil download = new ThisLocalityDownloadUtil();
-            download.download("签章导入数据模板.xlsx",request,response);  //自制的导入模板
+            if(StringUtils.isNotBlank(type)){
+                switch (type){
+                    case "js":
+                        download.download("签章导入数据模板.xlsx",request,response);  //自制的导入模板
+                        break;
+                    case "sh":
+                        download.download("上海签章导入数据模板.xlsx",request,response);  //自制的导入模板
+                        break;
+                    case "nsbg":
+                        download.download("内审报告导入数据模板.xlsx",request,response);  //自制的导入模板
+                        break;
+                }
+            }
         } catch (Exception e) {
             logger.error("导入数据模板下载失败!",e);
         }
@@ -834,4 +1262,185 @@ public class RuralProjectMessageElectronicSealController extends BaseController
         addMessage(redirectAttributes, "报告签章信息修改成功");
         return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
     }
+
+    /**
+     * 报告签章信息保存
+     */
+//    @RequiresPermissions(value={"ruralProject:ruralCostProjectRecords:add","ruralProject:ruralCostProjectRecords:edit"},logical= Logical.OR)
+    @Transactional(readOnly = false)
+    @RequestMapping(value = "internalAuditSave")
+    public String internalAuditSave(ProjectReportSignatureInfo projectReportSignatureInfo, RedirectAttributes redirectAttributes) {
+        //修改
+        ruralProjectMessageElectronicSealService.updateProjectReportInternalAuditInfo(projectReportSignatureInfo);
+
+
+        addMessage(redirectAttributes, "内审报告签章信息修改成功");
+        return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
+    }
+
+
+
+    @RequestMapping(value = "getManualSignatureUrl")
+    @ResponseBody
+    public HashMap<String, Object> getManualSignatureUrl( String projectId, RedirectAttributes redirectAttributes) {
+        HashMap<String, Object> map = Maps.newHashMap();
+        map.put("contractUrl","");
+        map.put("success",false);
+        try {
+
+            //根据项目id查询是否已经提交过了报告签章
+            RuralProjectRecords records = projectRecordsService.get(projectId);
+            ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(records.getId());
+            if(null == records){
+                map.put("str","查询不到该项目信息");
+                map.put("success",false);
+                return map;
+            }
+            if(null!= records.getReportSignatureFlag() && 1 == records.getReportSignatureFlag()){
+                map.put("str","该项目已经报告盖章完成");
+                map.put("success",false);
+                return map;
+            }
+            Workattachment workClientAttachment = new Workattachment();
+            workClientAttachment.setAttachmentFlag("144");
+            workClientAttachment.setAttachmentId(projectId);
+            List<Workattachment> fileList = workattachmentService.findList(workClientAttachment);
+
+            //下载审定单文件
+            if(fileList.size()>0){
+                Workattachment workattachment = fileList.get(0);
+                if(org.apache.commons.lang3.StringUtils.isBlank(workattachment.getUrl())){
+                    map.put("str","审定单文件存储路径为空,无法进行签章操作,请驳回后重新上传审定单");
+                    map.put("success",false);
+                    return map;
+                }
+                //下载审定单文件
+                String path = null;
+                if(System.getProperty("os.name").toLowerCase().contains("win")){
+                    path = "D:/attachment-file/";
+                }else{
+                    path = "/attachment-file/";
+                }
+                String file = workattachment.getUrl();
+                file = file.replace("amp;","");
+                String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                String aliyunUrl = Global.getAliyunUrl();
+                String aliDownloadUrl = Global.getAliDownloadUrl();
+                String cons = "";
+                if (file.contains(aliyunUrl)){
+                    cons = aliyunUrl;
+                }else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+                    cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                }else {
+                    cons = aliDownloadUrl;
+                }
+                String ossKey = file.split(cons+"/")[1];
+                new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
+                //将下载下来的文件转换为file文件
+                File srcFile = new File(path+fileName);
+
+                //截取文件后缀名
+                String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+                if(!"doc".equals(substring.toLowerCase()) && !"docx".equals(substring.toLowerCase()) && !"pdf".equals(substring.toLowerCase())){
+                    map.put("str","请上传doc、docx或者pdf的文件进行签章操作");
+                    map.put("success",false);
+                    return map;
+                }
+
+                //获取真签单的documentId
+                HashMap hashMap = SignaturePostUtil.getDocument(srcFile);
+                String code = hashMap.get("code").toString();
+                String documentId = "";
+                if("0".equals(code)){
+                    String result = hashMap.get("result").toString();
+                    HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
+                    documentId =  documentIdMap.get("documentId").toString();
+                    if("".equals(documentId)){
+                        map.put("str","签章文件创建失败");
+                        map.put("success",false);
+                        return map;
+                    }
+                }else{
+                    String message = hashMap.get("message").toString();
+                    map.put("str",message);
+                    return map;
+                }
+                List<String> documentList = com.google.common.collect.Lists.newArrayList();
+                documentList.add(documentId);
+
+
+                //根据项目id 和 documentId生成合同id
+                HashMap contractIdHashMap = projectMessageService.getManualSignatureContractId(projectId, documentList,records.getProjectMasterId(),"","3");
+                String contractIdCode = contractIdHashMap.get("code").toString();
+                String contractId = "";
+                if("0".equals(contractIdCode)){
+                    contractId = contractIdHashMap.get("contractId").toString();
+                    if("".equals(contractId)){
+                        map.put("str","签章文件创建失败");
+                        map.put("success",false);
+                        return map;
+                    }
+                }else{
+                    map.put("str",contractIdHashMap.get("message").toString());
+                }
+
+
+                //获取contractUrl路径
+                String contractUrl = projectMessageService.getSignatureContractUrl(contractId);
+                if("".equals(contractUrl)){
+                    map.put("str","签章文件创建失败");
+                    map.put("success",false);
+                    return map;
+                }else{
+
+                    //修改报告信息中对应的签章contractId
+                    projectReportData.setSignatureDocumentId(documentId);
+                    projectReportData.setSignatureContractId(contractId);
+
+                    projectReportData.setSignatureUploadFileUser(UserUtils.getUser());
+                    projectReportData.setSignatureUploadDate(new Date());
+                    //修改签章对应信息文件
+                    projectReportDataService.updateSignatureInfo(projectReportData);
+
+                    map.put("contractUrl",contractUrl);
+                    map.put("success",true);
+                    return map;
+                }
+            }
+
+            map.put("contractUrl","");
+            map.put("str","审定单签章成功");
+        } catch (Exception e) {
+            addMessage(redirectAttributes, "报告签章失败");
+        }
+
+
+        return map;
+    }
+
+
+    @RequestMapping(value = "getManualSignatureStatus")
+    @ResponseBody
+    public Map<String, Object> getManualSignatureStatus( String projectId, RedirectAttributes redirectAttributes) {
+        Map<String, Object> map = new HashMap();
+        map.put("success",false);
+
+        //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+        ProjectApprovalSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectApprovalSignature(projectId);
+
+        Jedis jedis = null;
+        try {
+            jedis = JedisUtils.getResource();
+            String status = jedis.get("customApprovalCallBackAccomplishStatus" + projectApprovalSignature.getId());
+            map.put("success",status);
+        } catch (Exception e) {
+            logger.error("getApprovalCallBackAccomplish", e);
+        } finally {
+            JedisUtils.returnResource(jedis);
+        }
+
+        return map;
+    }
+
+
 }

+ 2 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageNewController.java

@@ -1471,6 +1471,8 @@ public class RuralProjectMessageNewController extends BaseController {
             ProjectReportData projectReportData = projectReportDataService.getOnRural(projectcontentinfo1.getInfoId());
             records.setReportData(projectReportData);
             reported = ruralProjectMessageService.disposeData(records);
+            //将项目中的咨询标的额添加到上报数据中
+            reported.setZiXunBDE(String.valueOf(records.getTotalFees()));
 
             //合同价送审价审定价处理
             if(StringUtils.isNotBlank(reported.getHeTongJia())){

+ 3 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectRecordsController.java

@@ -242,6 +242,9 @@ public class RuralProjectRecordsController extends BaseController {
 				model.addAttribute("projectStartDate", "");
 				model.addAttribute("projectEndDate", "");
 			}
+			//根据归属部门Id查询归属部门名称显示
+			String belongingDepartmentName = projectRecordsService.getBelongingDepartmentNameByBelongingDepartment(projectRecords.getBelongingDepartment());
+			model.addAttribute("belongingDepartmentName",belongingDepartmentName);
 		}else {
 		    projectRecords.setCreateBy(UserUtils.getUser());
 		    projectRecords.setCreateDate(new Date());

+ 202 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureCallBackController.java

@@ -2,6 +2,7 @@ package com.jeeplus.modules.ruralprojectrecords.web;
 
 import com.alibaba.fastjson.JSON;
 import com.jeeplus.common.config.Global;
+import com.jeeplus.common.utils.JedisUtils;
 import com.jeeplus.common.utils.SpringContextHolder;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.web.BaseController;
@@ -26,6 +27,7 @@ import org.activiti.engine.HistoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
+import redis.clients.jedis.Jedis;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -207,6 +209,42 @@ public class RuralProjectSignatureCallBackController extends BaseController {
         return null;
     }
 
+    @RequestMapping(value = "/getApprovalCallBackAccomplish", method= RequestMethod.POST)
+    public String getApprovalCallBackAccomplish(PresignCallBack presignCallBack, HttpServletResponse response) {
+
+        //根据contractId查询对应的报告信息
+        String[] documentIds = presignCallBack.getDocumentId().split(",");
+        ProjectReportData projectReportData = null;
+        if(documentIds.length>0){
+            projectReportData = projectReportDataService.getProjectReportDataByDocumentId(documentIds[0]);
+        }else{
+            return null;
+        }
+
+        if(null == projectReportData){
+            return null;
+        }
+
+        //根据项目id查询对应的审定单数据状态是否是已经被送审或者 是否存在值
+        ProjectApprovalSignature projectApprovalSignature = ruralProjectMessageElectronicSealService.getProjectApprovalSignature(projectReportData.getProject().getId());
+
+        String json = JSON.toJSONString(presignCallBack);
+        Jedis jedis = null;
+        try {
+            jedis = JedisUtils.getResource();
+            //将页面签数据转json保存到redis中,并设置有效时间为1天
+            jedis.set("customApprovalCallBackAccomplish" + projectApprovalSignature.getId(),json);
+            jedis.expire("customApprovalCallBackAccomplish" + projectApprovalSignature.getId(), 86400);
+            jedis.set("customApprovalCallBackAccomplishStatus" + projectApprovalSignature.getId(),"true");
+            jedis.expire("customApprovalCallBackAccomplishStatus" + projectApprovalSignature.getId(),86400);
+        } catch (Exception e) {
+            logger.error("getApprovalCallBackAccomplish", e);
+        } finally {
+            JedisUtils.returnResource(jedis);
+        }
+        return null;
+    }
+
 
     /**
      * 审定单签章回调操作(盐城)
@@ -501,6 +539,170 @@ public class RuralProjectSignatureCallBackController extends BaseController {
         return null;
     }
 
+/**
+     * 内审报告签章签署完成回调操作
+     * @param presignCallBack  回调参数
+     * @return
+     */
+    @RequestMapping(value = "/getReportInternalAuditSignatureCoordinates", method=RequestMethod.POST)
+    public String getReportInternalAuditSignatureCoordinates(PresignCallBack presignCallBack, HttpServletRequest request , HttpServletResponse response) {
+        long t1 = System.currentTimeMillis();
+        //根据contractId查询对应的报告信息
+        String[] documentIds = presignCallBack.getDocumentId().split(",");
+        //根据contractId查询对应的报告信息
+        RuralProjectRecords records = projectRecordsService.getReportInternalAuditSignatureByDocumentId(documentIds[0]);
+        if(null == records){
+            return null;
+        }
+        ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(records.getId());
+        ProjectReportSignature projectReportSignature = ruralProjectMessageElectronicSealService.getProjectReportInternalAudit(records.getId());
+        //如果没有返回contractId 则进行数据暂存处理
+        if(StringUtils.isBlank(presignCallBack.getContractId())){
+            String title = "报告号【"+projectReportData.getNumber()+"】内审报告签章失败。请重新签章";
+            String content = "报告号【"+projectReportData.getNumber()+"】内审报告签章失败。请重新签章";
+            if ("yes".equals(projectReportSignature.getAct().getFlag())) {
+                projectReportSignature.setStatus(ProjectStatusEnum.TSTORE.getValue());
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(projectReportSignature.getId());
+                //查询是否已经进行发送通知,没有发送则进行发送,否则  直接跳过
+                List<WorkProjectNotify> byTitle = workProjectNotifyService.getByTitle(title);
+                if(byTitle.size() == 0) {
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(projectReportSignature.getId(),
+                                            projectReportSignature.getCreateBy(),
+                                            projectReportSignature.getCompany().getId(),
+                                            title,
+                                            content,
+                                            "147",
+                                            "0",
+                                            "待通知",
+                                            "审批通过"));
+                    //给苏州质控中的人员发送通知
+                    List<User> szzks = UserUtils.getByRoleActivityEnname("XHMDZGS1551886525850szzk",3,projectReportSignature.getOffice().getId(),"4",projectReportSignature.getCreateBy());
+                    for (User szzk: szzks) {
+                        if(org.apache.commons.lang3.StringUtils.isNotBlank(szzk.getId())){
+                            workProjectNotifyService
+                                    .save(UtilNotify
+                                            .saveNotify(projectReportSignature.getId(),
+                                                    szzk,
+                                                    projectReportSignature.getCompany().getId(),
+                                                    title,
+                                                    content,
+                                                    "147",
+                                                    "0",
+                                                    "待通知",
+                                                    "审批通过"));
+                        }
+                    }
+                }
+
+            }
+
+            workActivityProcessService.deleteProcessIdAuditUsers(projectReportSignature.getProcessInstanceId());
+
+            projectReportSignature.setStatus(1);
+            dao.updateReportInternalAuditSignature(projectReportSignature);
+            return null;
+
+        }
+        //修改签章信息
+
+        //签章完成则进行数据的保存
+        records.setReportInternalAuditSignatureFlag(1);
+        records.setReportInternalAuditSignatureDocumentId(documentIds[0]);
+        records.setReportInternalAuditSignatureContractId(presignCallBack.getContractId());
+        records.setReportInternalAuditSignatureUploadDate(new Date());
+        //对文件回调路径进行处理并保存
+        String signatureUrl = null;
+        if(StringUtils.isNotBlank(presignCallBack.getStoragePath())){
+            signatureUrl = presignCallBack.getStoragePath().replace("oss:/","");
+            records.setReportInternalAuditSignatureUrl(signatureUrl);
+        }
+        //修改签章对应信息文件
+        projectReportDataService.updateReportInternalAuditSignatureInfo(records);
+
+        //发送通知
+        String title = "报告号【"+projectReportData.getNumber()+"】内审报告签章审批登记完成";
+        String content = "报告号【"+projectReportData.getNumber()+"】内审报告签章审批登记完成,项目编号:"+records.getProjectId();
+        projectReportSignature.setStatus(ProjectStatusEnum.SIGNED.getValue());
+        WorkProjectNotify notify = new WorkProjectNotify();
+        notify.setNotifyId(projectReportSignature.getId());
+        //查询是否已经进行发送通知,没有发送则进行发送,否则  直接跳过
+        List<WorkProjectNotify> byTitle = workProjectNotifyService.getByTitle(title);
+        if(byTitle.size() == 0) {
+            workProjectNotifyService
+                    .save(UtilNotify
+                            .saveNotify(projectReportSignature.getId(),
+                                    projectReportSignature.getCreateBy(),
+                                    projectReportSignature.getCompany().getId(),
+                                    title,
+                                    content,
+                                    "147",
+                                    "0",
+                                    "待通知",
+                                    "审批通过"));
+            //给苏州质控中的人员发送通知
+            List<User> szzks = UserUtils.getByRoleActivityEnnameSignature("XHMDZGS1551886525850szzk",3,projectReportSignature.getOffice().getId(),"4",projectReportSignature.getCreateBy());
+            for (User szzk: szzks) {
+                if(org.apache.commons.lang3.StringUtils.isNotBlank(szzk.getId())){
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(projectReportSignature.getId(),
+                                            szzk,
+                                            projectReportSignature.getCompany().getId(),
+                                            title,
+                                            content,
+                                            "147",
+                                            "0",
+                                            "待通知",
+                                            "审批通过"));
+                }
+            }
+
+            workActivityProcessService.deleteProcessIdAuditUsers(projectReportSignature.getProcessInstanceId());
+
+
+        }
+        projectReportSignature.setStatus(5);
+        dao.updateReportInternalAuditSignature(projectReportSignature);
+
+
+
+        long t2 = System.currentTimeMillis();
+        System.out.println("报告签章回调运行耗时:" + (t2-t1) + " 毫秒");
+
+        if(StringUtils.isNotBlank(signatureUrl)) {
+            String fileName = signatureUrl.substring(signatureUrl.lastIndexOf("/")+1,signatureUrl.length());
+            //将文件存储到对应的档案信息中的“咨询报告书正文”中
+            WorkClientAttachment attchment = new WorkClientAttachment();
+            attchment.setProjectId(records.getId());
+            attchment.setAttachmentId("6c68d29ea00e4cdb8cf17fb54ee30f0f");
+            attchment.setDivIdType("internalAuditSignature");
+            //删除原有的数据信息
+            workattachmentService.deleteByAttachIdAndProject(attchment);
+            //查询原有文件的数据量
+            Integer fileCount = workattachmentService.getAttachmentCountByAttachmentIdAndProjectId(attchment);
+            if (null == fileCount) {
+                fileCount = 0;
+            }
+            fileCount = fileCount + 1;
+            String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
+            attchment.setFileSize("");
+            User user = UserUtils.get(records.getCreateBy().getId());
+            attchment.setCreateBy(user);
+            attchment.setUpdateBy(user);
+            attchment.setUrl(signatureUrl);
+            attchment.setType(fileSuffix);
+            attchment.setAttachmentUser(records.getCreateBy().getId());
+            attchment.setAttachmentName(fileName);
+            attchment.setAttachmentFlag("100");
+            attchment.setSort(fileCount.toString());
+            workattachmentService.insertOnWorkClientAttachment(attchment);
+        }
+        return null;
+    }
+
 
     /**
      * 报告签章签署完成回调操作(盐城)

Різницю між файлами не показано, бо вона завелика
+ 44 - 3
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureOldMessageDisposeController.java


+ 1 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/yanChengSignature/RuralProjectMessageElectronicSealYCController.java

@@ -804,7 +804,7 @@ public class RuralProjectMessageElectronicSealYCController extends BaseControlle
     public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) {
         try {
             ImportExcelNew importExcelNew = new ImportExcelNew();
-            List<ProjectReportSignatureInfo> list = importExcelNew.ImportExcelNew(file,1,0);  //只处理file 1不要也可以,0为sheet编号
+            List<ProjectReportSignatureInfo> list = importExcelNew.ImportExcelNews(file,1,0,"");  //只处理file 1不要也可以,0为sheet编号
 
             //对数据进行处理
             String resultStr = ruralProjectMessageElectronicSealYCService.disposeImportBRuralProjectRecords(list);

+ 22 - 0
src/main/java/com/jeeplus/modules/statement/service/StatementCompanyComprehensiveService.java

@@ -2880,6 +2880,28 @@ public class StatementCompanyComprehensiveService extends CrudService<StatementC
     }
 
     /**
+     * 部门级信息处理
+     * @param bigDateType 状态1(0:年;1:季度;2:月份)
+     * @param smallDateType 状态2(针对状态1进行精确所在指定季度或者月份)
+     */
+    public void disposeRegainProjectDataStatementOffice(Integer year,Integer bigDateType,Integer smallDateType){
+        Calendar cal = Calendar.getInstance();
+        //获取当前年份
+        if(null == year){
+            year = cal.get(Calendar.YEAR);
+        }
+
+        Map<String, String> dateMap = getDateNew(bigDateType, smallDateType,year);
+        //开始时间
+        String beginDate = dateMap.get("beginDate");
+        //结束时间
+        String endDate = dateMap.get("endDate");
+        String statementDate = dateMap.get("statementDate");
+        //部门级项目处理
+        disposeStatementOfficeProject(year,beginDate,endDate,statementDate,bigDateType, smallDateType);
+    }
+
+    /**
      * 部门级项目月报/季报/年报汇总方法
      * @param beginDate 开始时间
      * @param endDate 结束时间

+ 8 - 0
src/main/java/com/jeeplus/modules/sys/dao/OfficeDao.java

@@ -105,4 +105,12 @@ public interface OfficeDao extends TreeDao<Office> {
 	 */
 	List<Office> findByBelongingDepartment(Office office);
 
+
+	/**
+	 * 根据parentId查询所有子节点信息
+	 * @param id
+	 * @return
+	 */
+	List<Office> getChildrenOfficeById(String id);
+
 }

+ 7 - 0
src/main/java/com/jeeplus/modules/sys/dao/UserDao.java

@@ -306,4 +306,11 @@ public interface UserDao extends CrudDao<User> {
 	 * @return
 	 */
 	List<String> getAuditUserListByRelevanceUserId(@Param("relevanceUserId") String relevanceUserId);
+
+	/**
+	 * 通过OfficeId获取用户列表,仅返回用户id和name(树查询用户时用)
+	 * @param user
+	 * @return
+	 */
+	public List<User> findUserByOfficeIdAndNameAndOfficeIdList(@Param("user")User user,@Param("officeIdList")List<String> officeIdList);
 }

+ 47 - 0
src/main/java/com/jeeplus/modules/sys/service/OfficeService.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.modules.sys.service;
 
+import com.google.common.collect.Lists;
 import com.jeeplus.common.service.BaseService;
 import com.jeeplus.common.service.TreeService;
 import com.jeeplus.common.utils.JedisUtils;
@@ -366,4 +367,50 @@ public class OfficeService extends TreeService<OfficeDao, Office> {
 		List<String> offices = officeDao.getChildrenOffice(parentId);
 		return offices;
 	}
+
+	/**
+	 * 根据父节点查询包含父节点的所有部门信息
+	 * @param parentId
+	 * @return
+	 */
+	public List<Office> getChildrenOfficeById(String parentId){
+		List<Office> offices = officeDao.getChildrenOfficeById(parentId);
+		return offices;
+	}
+
+
+
+	@Transactional(readOnly = true)
+	public List<Office> getTreeOffice(String id){
+		List<Office> officeList = Lists.newArrayList();
+		Office office = this.get(id);
+		officeList.add(office);
+		if(null != office.getParent() && StringUtils.isNotBlank(office.getParent().getId()) && !"0".equals(office.getParent().getId())){
+			List<Office> childrenOffice = this.getChildrenOfficeById(id);
+			officeList.addAll(childrenOffice);
+			List<Office> treeOffice = getTreeOffice(office.getParent().getId());
+			officeList.addAll(treeOffice);
+		}
+		return officeList;
+	}
+
+	@Transactional(readOnly = true)
+	public List<Office> getTreeOfficeByName(String name,List<Office> list){
+		List<Office> officeList = Lists.newArrayList();
+		List<Office> returnOfficeList = Lists.newArrayList();
+		for (Office office : list) {
+			if(office.getName().contains(name)){
+				officeList.add(office);
+			}
+		}
+		if(officeList.size()>0){
+			for (Office office : officeList) {
+				List<Office> treeOffice = this.getTreeOffice(office.getParent().getId());
+				returnOfficeList.add(office);
+				returnOfficeList.addAll(treeOffice);
+			}
+		}
+		
+		return returnOfficeList;
+	}
 }

+ 16 - 0
src/main/java/com/jeeplus/modules/sys/service/SystemService.java

@@ -317,6 +317,22 @@ public class SystemService extends BaseService implements InitializingBean {
                 UserUtils.USER_CACHE_LIST_BY_OFFICE_ID_ +  list);
         return list;
     }
+
+    /**
+     * 通过用户name获取用户列表,仅返回用户id和name(树查询用户时用)
+     *
+     * @return
+     */
+    public List<User> findUserByNameAndOfficeIdList(String selectName,List<String> officeIdList) {
+
+        User user = new User();
+        user.setName(selectName);
+        if(!UserUtils.getSelectCompany().getId().equals("1")) {
+            user.setCompany(UserUtils.getSelectCompany());
+        }
+        List<User> list = userDao.findUserByOfficeIdAndNameAndOfficeIdList(user,officeIdList);
+        return list;
+    }
     /**
      * 通过部门ID获取用户列表,仅返回用户id和name(树查询用户时用  上报使用)
      *

+ 6 - 0
src/main/java/com/jeeplus/modules/sys/web/HelpController.java

@@ -143,6 +143,12 @@ public class HelpController extends BaseController {
                 if(content.contains("{thisMonth}")){
                     content = content.replaceAll("\\{thisMonth}",String.valueOf(thisMonth)+"月 ");
                 }
+                if(content.contains("&lt;")){
+                    content = content.replaceAll("&lt;","<");
+                }
+                if(content.contains("&gt;")){
+                    content = content.replaceAll("&gt;",">");
+                }
             }
         }
         map.put("title", title);

+ 100 - 0
src/main/java/com/jeeplus/modules/sys/web/OfficeController.java

@@ -613,8 +613,108 @@ public class OfficeController extends BaseController {
             }
         }
         return mapList;
+
+    }
+    /**
+     * 获取机构JSON数据。
+     *
+     * @param extId    排除的ID
+     * @param type     类型(1:公司;2:部门/小组/其它:3:用户)
+     * @param grade    显示级别
+     * @param response
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping(value = "treeDataByLoginUser")
+    public List<Map<String, Object>> treeDataByLoginUser(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false) String selectName,
+                                                 @RequestParam(required = false) Long grade, @RequestParam(required = false) Boolean isAll, HttpServletResponse response) {
+        List<Map<String, Object>> mapList = Lists.newArrayList();
+        Office office = new Office();
+        office.setParentIds(UserUtils.getSelectCompany().getId());
+        HashSet<Map<String, Object>> mapSet = new HashSet<>();
+        //查询当前登陆人所有有关部门
+        List<Office> list = officeService.getTreeOffice(UserUtils.getSelectOffice().getId());
+        if ("2".equals(type) && StringUtils.isNotBlank(selectName)){
+            //存放部门搜索添加
+            List<Office> treeOfficeList = officeService.getTreeOfficeByName(selectName, list);
+            list = treeOfficeList;
+        }
+        //List<Office> list = officeService.findByParentIdsLike(office);
+        for (int i = 0; i < list.size(); i++) {
+            Office e = list.get(i);
+            if ((StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1))
+                    && (type == null || (type != null && (type.equals("1") ? type.equals(e.getType()) : true)))
+                    && (grade == null || (grade != null && Integer.parseInt(e.getGrade()) <= grade.intValue()))
+                    && Global.YES.equals(e.getUseable())) {
+                Map<String, Object> map = Maps.newHashMap();
+                map.put("id", e.getId());
+                map.put("pId", e.getParentId());
+                map.put("pIds", e.getParentIds());
+                map.put("name", e.getTopCompany());
+                map.put("selectName", selectName);
+                if (type != null && ("3".equals(type) || "4".equals(type) || "5".equals(type))) {
+                    map.put("isParent", true);
+                }
+                if("4".equals(type)){
+                    //根据参数获取信息
+                    List<User> listUser = systemService.treeDataByNameOnReported(e.getId(),selectName);
+                    if(listUser.size()>0) {
+                        mapSet.add(map);
+                    }
+                }else if("5".equals(type)){
+                    //获取一级二级造价师信息
+                    List<User> listUser = systemService.findUserByOfficeIdAndNameOnReportedZXY(e.getId(),selectName);
+                    if(listUser.size()>0) {
+                        mapSet.add(map);
+                    }
+                }
+                mapList.add(map);
+            }
+        }
+
+        if("4".equals(type) || "5".equals(type)){
+            List<Map<String,Object>> mapList1=new ArrayList<>(mapSet);
+            return mapList1;
+        }
+        if(!"2".equals(type) && !"6".equals(type)){
+            List<User> userList= new ArrayList<>();
+            List<String> officeIdList = Lists.newArrayList();
+            for (Office office1 : list) {
+                officeIdList.add(office1.getId());
+            }
+            //判定参数必须存在
+            if (StringUtils.isNotBlank(selectName)){
+                userList = systemService.findUserByNameAndOfficeIdList(selectName,officeIdList);
+                if (0 != userList.size()){
+                    Iterator it = mapList.iterator();
+                    while (it.hasNext()){
+                        Map<String, Object> str = (Map)it.next();
+                        for (User user:userList){
+                            String id=str.get("id").toString();
+                            String idd=user.getOffice().getId();
+                            if(id.equals(idd)){
+                                Map<String, Object> map = Maps.newHashMap();
+                                map.put("id", str.get("id"));
+                                map.put("pId",  str.get("pId"));
+                                map.put("pIds", str.get("pIds"));
+                                map.put("name",  str.get("name"));
+                                map.put("selectName", selectName);
+                                if (type != null && "3".equals(type)) {
+                                    map.put("isParent", true);
+                                }
+                                mapSet.add(map);
+                            }
+                        }
+                    }
+                    List<Map<String,Object>> mapList1=new ArrayList<>(mapSet);
+                    return mapList1;
+                }
+            }
+        }
+        return mapList;
     }
 
+
     /**
      * 获取工程一到五部及五部附属的JSON数据。
      *

+ 51 - 8
src/main/java/com/jeeplus/modules/sys/web/RegisterController.java

@@ -9,10 +9,7 @@ import com.jeeplus.common.utils.JedisUtils;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.sys.dao.UserDao;
-import com.jeeplus.modules.sys.entity.MainDictDetail;
-import com.jeeplus.modules.sys.entity.Office;
-import com.jeeplus.modules.sys.entity.SystemConfig;
-import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.*;
 import com.jeeplus.modules.sys.service.OfficeService;
 import com.jeeplus.modules.sys.service.SystemConfigService;
 import com.jeeplus.modules.sys.service.SystemService;
@@ -20,13 +17,12 @@ import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.utils.ErrorCode;
 import net.sf.json.JSONObject;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import redis.clients.jedis.Jedis;
 
@@ -34,6 +30,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 用户Controller
@@ -426,6 +423,52 @@ public class RegisterController extends BaseController {
 			return "false";
 		}
 	}
+	/**
+	 * web端ajax验证密码是否正确
+	 */
+	@ResponseBody
+	@RequestMapping(value = "validatePasswordPublic")
+	public String validatePasswordPublic(HttpServletRequest request,
+										 @RequestBody String data) {
+//		User user1 = new User();
+//		user1.setName(loginName);
+//		List<User> list = userDao.getByName(user1);
+//		if(list != null && list.size()>1){
+//			return "cf";
+//		}
+		data = data.replaceAll("\\{","");
+		data = data.replaceAll("}","");
+		data = data.replaceAll(" ","");
+		Map map = new HashMap<>();
+		String[] keyValuePairs = data.split(",");
+		for(String pair : keyValuePairs){
+			String[] entry = pair.split("=");
+			map.put(entry[0],entry[1]);
+		}
+		String loginName = (String) map.get("loginName");
+		String password = (String) map.get("password");
+		password = DigestUtils.md5Hex(password);
+		User user = UserUtils.getByLoginName(loginName);
+		if (user ==null || org.apache.commons.lang3.StringUtils.isBlank(user.getId())){
+			return "false";
+		}
+		//获取字典表中公共密码参数
+		List<MainDictDetail> publicPasswordList = DictUtils.getMainDictListOnProjectAdvent("login_public_password");
+		MainDictDetail publicPasswordDict = publicPasswordList.get(0);
+		String publicPassword = publicPasswordDict.getLabel();
+		//对公共密码进行加密
+		publicPassword = SystemService.encrypeString(publicPassword);
+		publicPassword = SystemService.entryptPassword(publicPassword);
+		//password = SystemService.encrypeString(password);
+		//判断 当前登陆人登陆密码和数据库的是否一样或者 登陆密码是否为字典表中通用登陆密码
+		if (SystemService.validatePassword(password, user.getPassword()) || SystemService.validatePassword(password, publicPassword) ) {
+			return "true";
+		} else {
+			return "false";
+		}
+	}
+
+
 
 
 	@ResponseBody

+ 52 - 16
src/main/java/com/jeeplus/modules/sys/web/UserController.java

@@ -939,24 +939,26 @@ public class UserController extends BaseController {
     public List<Map<String, Object>> treeData(@RequestParam(required=false) String projectId,@RequestParam(required=false) String officeId,@RequestParam(required = false) String selectName, HttpServletResponse response) {
         List<Map<String, Object>> mapList = Lists.newArrayList();
         if(StringUtils.isBlank(projectId)){
-            List<User> list = systemService.findUserByOfficeId(officeId);
-            for (int i=0; i<list.size(); i++){
-                User e = list.get(i);
-                Map<String, Object> map = Maps.newHashMap();
-                map.put("id", "u_"+e.getId());
-                map.put("pId", officeId);
-                String name = StringUtils.replace(e.getName(), " ", "");
-                name = StringEscapeUtils.unescapeHtml4(name);
-                String officeName = StringUtils.replace(e.getOffice().getName(), " ", "");
-                officeName = StringEscapeUtils.unescapeHtml4(officeName);
-                map.put("name", name);
-                map.put("officeId", officeName);
-                if(StringUtils.isNotBlank(selectName)){
-                    if(name.contains(selectName)){
+            if(StringUtils.isNotBlank(officeId)){
+                List<User> list = systemService.findUserByOfficeId(officeId);
+                for (int i=0; i<list.size(); i++){
+                    User e = list.get(i);
+                    Map<String, Object> map = Maps.newHashMap();
+                    map.put("id", "u_"+e.getId());
+                    map.put("pId", officeId);
+                    String name = StringUtils.replace(e.getName(), " ", "");
+                    name = StringEscapeUtils.unescapeHtml4(name);
+                    String officeName = StringUtils.replace(e.getOffice().getName(), " ", "");
+                    officeName = StringEscapeUtils.unescapeHtml4(officeName);
+                    map.put("name", name);
+                    map.put("officeId", officeName);
+                    if(StringUtils.isNotBlank(selectName)){
+                        if(name.contains(selectName)){
+                            mapList.add(map);
+                        }
+                    }else{
                         mapList.add(map);
                     }
-                }else{
-                    mapList.add(map);
                 }
             }
         }else{
@@ -1551,4 +1553,38 @@ public class UserController extends BaseController {
         return ajaxJson;
     }
 
+
+    /**
+     * 修改个人用户密码
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = "adminModifyPwdForm")
+    public String adminModifyPwdForm(String userId, Model model,HttpServletRequest request) {
+
+        model.addAttribute("userId", userId);
+        return "modules/sys/adminModifyPwdForm";
+    }
+
+
+    /**
+     * 修改用户密码
+     * @param newPassword
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = "adminModifyPwd")
+    public String adminModifyPwd(String userId, String newPassword, Model model,HttpServletRequest request) {
+        User user = UserUtils.getByUserId(userId);
+        if (StringUtils.isNotBlank(newPassword)){
+            newPassword = SystemService.encrypeString(newPassword);
+
+            NewPassword psd = new NewPassword().newpassword(newPassword);
+            systemService.updatePasswordById(user.getId(), user.getLoginName(), newPassword);
+            model.addAttribute("message", "修改密码成功");
+            return "redirect:"+Global.getAdminPath()+"/workstaff/workStaffBasicInfo/?repage";
+        };
+        return "redirect:"+Global.getAdminPath()+"/workstaff/workStaffBasicInfo/?repage";
+    }
+
 }

+ 87 - 0
src/main/java/com/jeeplus/modules/sys/web/WorkattachmentController.java

@@ -21,6 +21,7 @@ import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.utils.SftpClientUtil;
+import com.jeeplus.modules.workreimbursement.service.WorkReimbursementService;
 import org.apache.shiro.authz.annotation.Logical;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,6 +35,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
+import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -56,6 +58,9 @@ public class WorkattachmentController extends BaseController {
 	@Autowired
 	private ProjectMaterialStorageService projectMaterialStorageService;
 
+	@Autowired
+	private WorkReimbursementService workReimbursementService;
+
 	@ModelAttribute
 	public Workattachment get(@RequestParam(required=false) String id) {
 		Workattachment entity = null;
@@ -282,6 +287,88 @@ public class WorkattachmentController extends BaseController {
 	}
 
 	/**
+	 *  单个删除阿里云上的文件,同时更新相关对象的附件信息
+	 *  阿里云文件地址http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/attachment-file/workBidingDocument/3fcf03e37b3ba0fd5c7821998e392395.doc
+	 *  其中阿里云删除接口所需的参数 key 指的是 attachment-file/workBidingDocument/3fcf03e37b3ba0fd5c7821998e392395.doc
+	 *  电子发票报销专用,需下载文件并对文件进行分析,获取对应
+	 * @return
+	 */
+	@RequestMapping("/deleteFileFromAliyunByInvoiceReimbursement")
+	@ResponseBody
+	public HashMap<Object, Object> deleteFileFromAliyunByInvoiceReimbursement(String id,String type,String url,Model model){
+		HashMap<Object, Object> map = Maps.newHashMap();
+
+
+		if(StringUtils.isNotBlank(id)) {
+			Workattachment workattachment = workattachmentService.get(id);
+			if("1".equals(uploadMode) || "2".equals(uploadMode)) {
+				String fileUrl = "";
+				if(null != workattachment && StringUtils.isNotBlank(workattachment.getUrl())){
+					fileUrl = workattachment.getUrl();
+				}else{
+					fileUrl = url;
+				}
+				//根据url下载文件到指定文件夹。
+				//下载审定单文件
+				String path = null;
+				if(System.getProperty("os.name").toLowerCase().contains("win")){
+					path = "D:/attachment-file/";
+				}else{
+					path = "/attachment-file/";
+				}
+				String file = fileUrl;
+				file = file.replace("amp;","");
+				String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+
+				String aliyunUrl = Global.getAliyunUrl();
+				String aliDownloadUrl = Global.getAliDownloadUrl();
+				String cons = "";
+				if (file.contains(aliyunUrl)){
+					cons = aliyunUrl;
+				}else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+					cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+				}else {
+					cons = aliDownloadUrl;
+				}
+				if(!file.contains(cons)){
+					file = cons + file;
+				}
+				String ossKey = file.split(cons+"/")[1];
+				new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
+
+				File file1 = new File(path+fileName);
+				try{
+					Map<String, Object> stringObjectMap = workReimbursementService.disposeXmlFile(file1,"");
+					map.putAll(stringObjectMap);
+				}catch (Exception e){
+					e.printStackTrace();
+				}finally {
+					file1.delete();
+				}
+
+				workattachmentService.deleteFileFromAliyun(workattachment, workattachment == null ? url : workattachment.getUrl());
+			}else{
+				SftpClientUtil sftpClientUtil=new SftpClientUtil();
+				try {
+					if(null != workattachment){
+						sftpClientUtil.delete(workattachment.getUrl());
+					}else{
+						sftpClientUtil.delete(url);
+						}
+
+						if(workattachment != null){
+							workattachmentService.delete(workattachment);
+						}
+					} catch (Exception e) {
+						e.printStackTrace();
+					}
+				}
+			}
+			map.put("str","success");
+		return map;
+	}
+
+	/**
 	 * 删除附件信息
 	 */
 	@RequiresPermissions("sys:workattachment:del")

+ 1 - 0
src/main/java/com/jeeplus/modules/tools/utils/HttpPostTool.java

@@ -205,6 +205,7 @@ public class HttpPostTool {
             jsonObject = JSONObject.fromObject(buffer.toString());
         } catch (Exception e) {
             e.printStackTrace();
+            System.out.println("上报接口错误:" + e);
         } finally {
             System.out.println(jsonObject.toString());
         }

+ 1 - 0
src/main/java/com/jeeplus/modules/workclientinfo/web/WorkClientInfoController.java

@@ -829,6 +829,7 @@ public class WorkClientInfoController extends BaseController {
 		if(StringUtils.isBlank(keyword)){
 			return null;
 		}
+		String s = TicketQueryUtils.enterpriseSearchByName(keyword);
 		return  TicketQueryUtils.enterpriseSearchByName(keyword);
 	}
 

+ 5 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/dao/WorkContractInfoDao.java

@@ -130,4 +130,9 @@ public interface WorkContractInfoDao extends CrudDao<WorkContractInfo> {
     List<WorkContractInfo> findDepartmentContractStatementPageOverdue(@Param("workContractInfo")WorkContractInfo workContractInfo, @Param("statementCompanyComprehensiveInfo")StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo,@Param("officeIdd")String officeIdd,@Param("beginDate")String beginDate,@Param("endDate") String endDate);
     //部门级 查询超期合同信息的条数
     Integer findDepartmentContractStatementPageOverdueCount(StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo);
+
+
+    List<WorkContractInfo> getWorkContractStatisticDetailList(@Param("workContractInfo")WorkContractInfo workContractInfo);
+
+    Integer getWorkContractStatisticDetailListCount(WorkContractInfo workContractInfo);
 }

+ 146 - 0
src/main/java/com/jeeplus/modules/workcontractinfo/entity/WorkContractInfo.java

@@ -111,6 +111,7 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	private AlterInfo alterInfo;
 	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
 	private List<WorkClientAttachment> workAttachmentAlters = Lists.newArrayList();
+	private List<WorkClientAttachment> workAttachmentLetterOfAcceptances = Lists.newArrayList();	//中标通知书文件
 	private String invalidateProcessInstanceId; //合同作废流程id
 	private String invalidateStatus ; //合同作废状态(invalidate_status:0未开启,1进行中,2已作废3驳回4撤回)
 	private String invalidateUserId ; //合同作废发起人id
@@ -167,6 +168,23 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	private String createNameStr;   //创建人
 	private String createOffice;   //创建人部门
 	private String createId;     //创建人id
+	private String letterOfAcceptanceFlag;     //是否上传审定单
+	private String letterOfAcceptanceRemarks;     //中标通知书描述说明
+
+
+	private String projectId;     //项目id
+	private String projectNumber;     //项目编号
+	private String reportNumber;     //报告号
+	private String invoiceId;     //发票id
+	private String invoiceNumber;     //发票编号
+	private String projectMasterName;     //项目负责人
+	private Date invoiceDate;     //开票时间
+	private String invoiceState;     //开票审核状态
+	private String invoiceStateStr;     //开票审核状态Str
+	private String invoiceMoney;     //开票金额
+	private String chargeType;     //开票收款类型
+	private String chargeTypeStr;     //开票收款类型Str
+	private String isProject;     //是否关联项目(0:否;1:是)
 
 	public String getBeginInvestmentAmount() {
 		return beginInvestmentAmount;
@@ -1236,4 +1254,132 @@ public class WorkContractInfo extends ActEntity<WorkContractInfo> {
 	public void setCreateId(String createId) {
 		this.createId = createId;
 	}
+
+	public List<WorkClientAttachment> getWorkAttachmentLetterOfAcceptances() {
+		return workAttachmentLetterOfAcceptances;
+	}
+
+	public void setWorkAttachmentLetterOfAcceptances(List<WorkClientAttachment> workAttachmentLetterOfAcceptances) {
+		this.workAttachmentLetterOfAcceptances = workAttachmentLetterOfAcceptances;
+	}
+
+	public String getLetterOfAcceptanceFlag() {
+		return letterOfAcceptanceFlag;
+	}
+
+	public void setLetterOfAcceptanceFlag(String letterOfAcceptanceFlag) {
+		this.letterOfAcceptanceFlag = letterOfAcceptanceFlag;
+	}
+
+	public String getLetterOfAcceptanceRemarks() {
+		return letterOfAcceptanceRemarks;
+	}
+
+	public void setLetterOfAcceptanceRemarks(String letterOfAcceptanceRemarks) {
+		this.letterOfAcceptanceRemarks = letterOfAcceptanceRemarks;
+	}
+
+	public String getProjectId() {
+		return projectId;
+	}
+
+	public void setProjectId(String projectId) {
+		this.projectId = projectId;
+	}
+
+	public String getProjectNumber() {
+		return projectNumber;
+	}
+
+	public void setProjectNumber(String projectNumber) {
+		this.projectNumber = projectNumber;
+	}
+
+	public String getReportNumber() {
+		return reportNumber;
+	}
+
+	public void setReportNumber(String reportNumber) {
+		this.reportNumber = reportNumber;
+	}
+
+	public String getInvoiceId() {
+		return invoiceId;
+	}
+
+	public void setInvoiceId(String invoiceId) {
+		this.invoiceId = invoiceId;
+	}
+
+	public String getInvoiceNumber() {
+		return invoiceNumber;
+	}
+
+	public void setInvoiceNumber(String invoiceNumber) {
+		this.invoiceNumber = invoiceNumber;
+	}
+
+	public String getProjectMasterName() {
+		return projectMasterName;
+	}
+
+	public void setProjectMasterName(String projectMasterName) {
+		this.projectMasterName = projectMasterName;
+	}
+
+	public Date getInvoiceDate() {
+		return invoiceDate;
+	}
+
+	public void setInvoiceDate(Date invoiceDate) {
+		this.invoiceDate = invoiceDate;
+	}
+
+	public String getInvoiceMoney() {
+		return invoiceMoney;
+	}
+
+	public void setInvoiceMoney(String invoiceMoney) {
+		this.invoiceMoney = invoiceMoney;
+	}
+
+	public String getChargeType() {
+		return chargeType;
+	}
+
+	public void setChargeType(String chargeType) {
+		this.chargeType = chargeType;
+	}
+
+	public String getInvoiceState() {
+		return invoiceState;
+	}
+
+	public void setInvoiceState(String invoiceState) {
+		this.invoiceState = invoiceState;
+	}
+
+	public String getInvoiceStateStr() {
+		return invoiceStateStr;
+	}
+
+	public void setInvoiceStateStr(String invoiceStateStr) {
+		this.invoiceStateStr = invoiceStateStr;
+	}
+
+	public String getChargeTypeStr() {
+		return chargeTypeStr;
+	}
+
+	public void setChargeTypeStr(String chargeTypeStr) {
+		this.chargeTypeStr = chargeTypeStr;
+	}
+
+	public String getIsProject() {
+		return isProject;
+	}
+
+	public void setIsProject(String isProject) {
+		this.isProject = isProject;
+	}
 }

+ 54 - 1
src/main/java/com/jeeplus/modules/workcontractinfo/service/WorkContractInfoService.java

@@ -165,6 +165,10 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 			workClientAttachment.setAttachmentId(id);
 			workClientAttachment.setAttachmentFlag("44");
 			workContractInfo.setWorkAttachments(workattachmentService.getAttachmentList(workClientAttachment));
+			WorkClientAttachment workClientAttachmentLetterOfAcceptance = new WorkClientAttachment();
+			workClientAttachmentLetterOfAcceptance.setAttachmentId(id);
+			workClientAttachmentLetterOfAcceptance.setAttachmentFlag("45");
+			workContractInfo.setWorkAttachmentLetterOfAcceptances(workattachmentService.getAttachmentList(workClientAttachmentLetterOfAcceptance));
 			WorkClientAttachment workClientAttachment2 = new WorkClientAttachment();
 			workClientAttachment2.setAttachmentId(id);
 			workClientAttachment2.setAttachmentFlag("81");
@@ -237,6 +241,7 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 			workContractInfo.setUploadMode(uploadMode);
 			//数据处理(如果为阿里云文件服务器,则对查看的路径进行处理)
 			workattachmentService.clientAttachmentManageOnUrl(workContractInfo.getWorkAttachments());
+			workattachmentService.clientAttachmentManageOnUrl(workContractInfo.getWorkAttachmentLetterOfAcceptances());
 		}
 		return workContractInfo;
 	}
@@ -586,7 +591,11 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 			}
 			if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())){
 				workClientAttachment.setAttachmentId(workContractInfo.getId());
-				workClientAttachment.setAttachmentFlag("44");
+				if(StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag())){
+					workClientAttachment.setAttachmentFlag(workClientAttachment.getAttachmentFlag());
+				}else{
+					workClientAttachment.setAttachmentFlag("44");
+				}
 				workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
 				if (StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())){
 					workattachmentService.insertOnWorkClientAttachment(workClientAttachment);
@@ -4153,4 +4162,48 @@ public class WorkContractInfoService extends CrudService<WorkContractInfoDao, Wo
 		page.setList(list);
 		return page;
 	}
+
+	/**
+	 * 根据合同查看合同下的所有项目以及开票信息
+	 * @param page
+	 * @param workContractInfo
+	 * @return
+	 */
+	public Page<WorkContractInfo> getWorkContractStatisticDetailList(Page<WorkContractInfo> page, WorkContractInfo workContractInfo) {
+
+		//为了方便后台 limit 的显示,将页面传入的page暂存
+		Integer oldPageNo = page.getPageNo();
+		if((page.getPageNo()-1) >= 0) {
+			page.setPageNo((page.getPageNo() - 1) * page.getPageSize());
+		}
+		int count = dao.getWorkContractStatisticDetailListCount(workContractInfo);
+		page.setCount(count);
+		workContractInfo.setPage(page);
+		List<WorkContractInfo> list = dao.getWorkContractStatisticDetailList(workContractInfo);
+		List<MainDictDetail> receiptTypeList = DictUtils.getMainDictList("receipt_type");
+
+		for (WorkContractInfo info : list) {
+			if (StringUtils.isNotBlank(info.getInvoiceState())){
+				if("5".equals(info.getInvoiceState())){
+					info.setInvoiceStateStr("已开票");
+				}else if (!"0".equals(info.getInvoiceState())) {
+					info.setInvoiceStateStr("开票中");
+				}else{
+					info.setInvoiceStateStr("未开票");
+				}
+			}
+
+			for (MainDictDetail dictDetail: receiptTypeList) {
+				if(StringUtils.isNotBlank(info.getChargeType()) && info.getChargeType().equals(dictDetail.getValue())){
+					info.setChargeTypeStr(dictDetail.getLabel());
+					break;
+				}
+			}
+		}
+		page.setCountFlag(false);
+		page.setPageNo(oldPageNo);
+
+		page.setList(list);
+		return page;
+	}
 }

+ 42 - 7
src/main/java/com/jeeplus/modules/workcontractinfo/web/WorkContractInfoController.java

@@ -22,6 +22,7 @@ import com.jeeplus.modules.act.service.ActTaskService;
 import com.jeeplus.modules.act.utils.ActUtils;
 import com.jeeplus.modules.alterinfo.entity.AlterInfo;
 import com.jeeplus.modules.alterinfo.service.AlterInfoService;
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
 import com.jeeplus.modules.sys.entity.User;
@@ -957,7 +958,7 @@ public class WorkContractInfoController extends BaseController {
                 List<WorkClientAttachment> list1 = new ArrayList<>();
                 List<WorkClientAttachment> list2 = new ArrayList<>();
                 for (WorkClientAttachment workClientAttachment:list){
-                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                         list1.add(workClientAttachment);
                     }else {
                         list2.add(workClientAttachment);
@@ -1009,7 +1010,7 @@ public class WorkContractInfoController extends BaseController {
                 List<WorkClientAttachment> list1 = new ArrayList<>();
                 List<WorkClientAttachment> list2 = new ArrayList<>();
                 for (WorkClientAttachment workClientAttachment:list){
-                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                         //  flag = 44 代表合同附件 ,
                         list1.add(workClientAttachment);
                     }else {
@@ -1078,7 +1079,7 @@ public class WorkContractInfoController extends BaseController {
                 List<WorkClientAttachment> list1 = new ArrayList<>();
                 List<WorkClientAttachment> list2 = new ArrayList<>();
                 for (WorkClientAttachment workClientAttachment:list){
-                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                         list1.add(workClientAttachment);
                     }else {
                         list2.add(workClientAttachment);
@@ -1130,7 +1131,7 @@ public class WorkContractInfoController extends BaseController {
                 List<WorkClientAttachment> list1 = new ArrayList<>();
                 List<WorkClientAttachment> list2 = new ArrayList<>();
                 for (WorkClientAttachment workClientAttachment:list){
-                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                    if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                         //  flag = 44 代表合同附件 ,
                         list1.add(workClientAttachment);
                     }else {
@@ -1213,7 +1214,7 @@ public class WorkContractInfoController extends BaseController {
             List<WorkClientAttachment> list1 = new ArrayList<>();
             List<WorkClientAttachment> list2 = new ArrayList<>();
             for (WorkClientAttachment workClientAttachment:list){
-                if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                     list1.add(workClientAttachment);
                 }else {
                     list2.add(workClientAttachment);
@@ -1259,7 +1260,7 @@ public class WorkContractInfoController extends BaseController {
             List<WorkClientAttachment> list1 = new ArrayList<>();
             List<WorkClientAttachment> list2 = new ArrayList<>();
             for (WorkClientAttachment workClientAttachment:list){
-                if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+                if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                     list1.add(workClientAttachment);
                 }else {
                     list2.add(workClientAttachment);
@@ -1306,7 +1307,7 @@ public class WorkContractInfoController extends BaseController {
         List<WorkClientAttachment> list = workContractInfo.getWorkAttachments();
         List<WorkClientAttachment> list1 = new ArrayList<>();
         for (WorkClientAttachment workClientAttachment:list){
-            if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && workClientAttachment.getAttachmentFlag().equals("44")){
+            if (StringUtils.isNotBlank(workClientAttachment.getAttachmentFlag()) && (workClientAttachment.getAttachmentFlag().equals("44") || workClientAttachment.getAttachmentFlag().equals("45"))){
                 list1.add(workClientAttachment);
             }
         }
@@ -2326,4 +2327,38 @@ public class WorkContractInfoController extends BaseController {
         }
         return "redirect:" + Global.getAdminPath() + "/workcontractinfo/workContractInfo/workContractList/?repage";
     }
+
+    /**
+     * 根据合同查看合同下的所有项目以及开票信息
+     * 传参:合同id
+     * @param workContractInfo
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = "getWorkContractStatisticDetailList")
+    public String getWorkContractStatisticDetailList(WorkContractInfo workContractInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
+
+        System.out.println(workContractInfo.getId());
+        Page<WorkContractInfo> page = workContractInfoService.getWorkContractStatisticDetailList(new Page<WorkContractInfo>(request, response), workContractInfo);
+
+        if(StringUtils.isNotBlank(workContractInfo.getCreateNameStr())){
+            model.addAttribute("createName", workContractInfo.getCreateNameStr());
+        }
+
+        //进行查询之后进行任何操作,返回还是查询之后的数据页面
+        /*if (StringUtils.isNotBlank(workContractInfo.getToflag())){
+            if (workContractInfo.getToflag().equals("1")){
+                request.getSession().removeAttribute("searchContractInfo");
+                WorkContractInfo search=workContractInfo;
+                request.getSession().setAttribute("searchContractInfo",search);
+            }
+        }else{
+            if (request.getSession().getAttribute("searchContractInfo")!=null){
+                workContractInfo= (WorkContractInfo) request.getSession().getAttribute("searchContractInfo");
+                model.addAttribute("workContractInfo", workContractInfo);
+            }
+        }*/
+        model.addAttribute("page", page);
+        return "modules/workcontractinfo/WorkContractStatisticDetailList";
+    }
 }

+ 3 - 1
src/main/java/com/jeeplus/modules/workfullmanage/service/WorkFullManageService.java

@@ -830,9 +830,11 @@ public class WorkFullManageService extends CrudService<WorkFullManageDao, WorkFu
 				}
 
 				for (MainDictDetail type : certificateType) {
-					if(consultantUserConsultant.getZhucezigezhKey().equals(type.getValue())){
+					if(StringUtils.isNotBlank(consultantUserConsultant.getZhucezigezhKey()) && consultantUserConsultant.getZhucezigezhKey().equals(type.getValue())){
 						data.put("consultantQualification1",type.getLabel());
 						break;
+					}else{
+						data.put("consultantQualification1","");
 					}
 				}
 			}

+ 13 - 0
src/main/java/com/jeeplus/modules/workfullmanage/web/WorkFullManageController.java

@@ -1318,6 +1318,7 @@ public class WorkFullManageController extends BaseController {
 				data.put("consultantName"+i,"");
 				data.put("consultantProfession"+i,"");
 				data.put("consultantQualification"+i,"");
+				data.put("handSignature1",blankBase64);
 			}
 		}
 		//查询陈红星陈总的用户信息
@@ -1340,7 +1341,16 @@ public class WorkFullManageController extends BaseController {
 				info.setZixunyuanName("");
 			}
 		}
+		for (RuralReportConsultant consultant : consultantList) {
+			if(StringUtils.isNotBlank(consultant.getAuditOpinion())){
+				if(consultant.getAuditOpinion().contains("&sup2;")){
+					String auditOpinion = consultant.getAuditOpinion().replaceAll("&sup2;","²");
+					consultant.setAuditOpinion(auditOpinion);
+				}
+			}
+		}
 		data.put("list",consultantList);
+
 		/*if(null != projectReportData.getPrincipalDate()){
 			//专业咨询员
 			data.put("consultantName",currentConsultant.getZixunyuanName());
@@ -1364,6 +1374,8 @@ public class WorkFullManageController extends BaseController {
 			if(org.apache.commons.lang3.StringUtils.isNotBlank(currentConsultant.getZixunyuan())){
 				String base64String = workFullManageService.base64String(currentConsultant.getZixunyuan());
 				data.put("handSignature2",base64String);
+			}else{
+				data.put("handSignature2",blankBase64);
 			}
 
 			if(StringUtils.isBlank(currentConsultant.getAuditOpinion())){
@@ -1381,6 +1393,7 @@ public class WorkFullManageController extends BaseController {
 			data.put("projectYear","");
 			data.put("projectMonth","");
 			data.put("projectDay","");
+			data.put("handSignature2",blankBase64);
 		}
 
 		if("1".equals(ruralProjectRecords.getSubmitMoney())){

+ 12 - 0
src/main/java/com/jeeplus/modules/workinvoice/dao/WorkInvoiceDao.java

@@ -138,5 +138,17 @@ public interface WorkInvoiceDao extends CrudDao<WorkInvoice> {
 	//部门级 查询开票报表的条数
 	Integer findDepartmentBillingReportPageCount(@Param("WorkInvoice") WorkInvoice workInvoice, @Param("statementCompanyComprehensiveInfo")StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo, @Param("officeIdd") String officeIdd, @Param("beginDate")String beginDate, @Param("endDate")String endDate, @Param("newlyAdded")String newlyAdded, @Param("collectionThisMonth")String collectionThisMonth);
 
+	/**
+	 * 获取发票开户银行信息
+	 * @param bankName
+	 * @return
+	 */
+	String getBankNameByNameOrId(String bankName);
 
+	/**
+	 * 修改电子发票上传结果
+	 * @param workInvoice
+	 * @return
+	 */
+	Integer updateElectronicInvoiceFlag(WorkInvoice workInvoice);
 }

+ 29 - 0
src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java

@@ -93,6 +93,7 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 
 	private String accountCheckingUserId; //对账人id
 	private String accountCheckingUserName; //对账人名称
+	private String accountCheckingArea; //对账地区
 	private List<Workattachment> workAttachments;//附件
 
 	private Integer projectFlag ;	//1:项目,0:非项目
@@ -103,12 +104,16 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 	private String newDrawerId;    		//开票人id
 	private String newDrawerName;    	//开票人名称
 	private String actualDrawerId;    		//实际开票人id
+	private String actualDrawerEmailAddress;    		//实际开票人邮箱
 	private String actualDrawerName;    	//实际开票人名称
 	private String proceedsMoney;    	//收款总收入
 	private String noProceedsMoney;    	//剩余应收款费用
 	private Integer workReceiptCount;    	//收款数据量
 	private Double receiptMoneyD; //已收款金额
 	private Double notReceiptMoneyD; //未收款金额
+
+	private Integer electronicInvoiceFlag ;	//是否已经上传电子发票信息(0:未上传;1:已上传)
+
 	@Override
 	@ExcelField(title="经办人", fieldType=User.class, value="createBy.name", align=2, sort=7)
 	public User getCreateBy() {
@@ -716,6 +721,14 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 		this.actualDrawerId = actualDrawerId;
 	}
 
+	public String getActualDrawerEmailAddress() {
+		return actualDrawerEmailAddress;
+	}
+
+	public void setActualDrawerEmailAddress(String actualDrawerEmailAddress) {
+		this.actualDrawerEmailAddress = actualDrawerEmailAddress;
+	}
+
 	public String getActualDrawerName() {
 		return actualDrawerName;
 	}
@@ -771,4 +784,20 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 	public void setNotReceiptMoneyD(Double notReceiptMoneyD) {
 		this.notReceiptMoneyD = notReceiptMoneyD;
 	}
+
+	public Integer getElectronicInvoiceFlag() {
+		return electronicInvoiceFlag;
+	}
+
+	public void setElectronicInvoiceFlag(Integer electronicInvoiceFlag) {
+		this.electronicInvoiceFlag = electronicInvoiceFlag;
+	}
+
+	public String getAccountCheckingArea() {
+		return accountCheckingArea;
+	}
+
+	public void setAccountCheckingArea(String accountCheckingArea) {
+		this.accountCheckingArea = accountCheckingArea;
+	}
 }

+ 12 - 0
src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoiceExport.java

@@ -92,6 +92,7 @@ public class WorkInvoiceExport extends ActEntity<WorkInvoiceExport> {
 
 	private String accountCheckingUserId; //对账人id
 	private String accountCheckingUserName; //对账人名称
+	private String accountCheckingArea; //对账地区
 	private List<Workattachment> workAttachments;//附件
 	private Double receiptMoneyD; //已收款金额
 	private Double notReceiptMoneyD; //未收款金额
@@ -470,6 +471,7 @@ public class WorkInvoiceExport extends ActEntity<WorkInvoiceExport> {
 		this.ext = ext;
 	}
 
+	@ExcelField(title="开票内容", align=2, sort=10)
 	public String getBillingContent() {
 		return billingContent;
 	}
@@ -601,6 +603,16 @@ public class WorkInvoiceExport extends ActEntity<WorkInvoiceExport> {
 		this.accountCheckingUserName = accountCheckingUserName;
 	}
 
+	@ExcelField(title="对账地区", align=2, sort=17)
+	public String getAccountCheckingArea() {
+		return accountCheckingArea;
+	}
+
+	public void setAccountCheckingArea(String accountCheckingArea) {
+		this.accountCheckingArea = accountCheckingArea;
+	}
+
+
 	@ExcelField(title="发票编号", align=2, sort=11)
 	public String getWidNumber() {
 		return widNumber;

+ 643 - 44
src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java

@@ -483,21 +483,19 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		if(null != workInvoice.getWorkInvoiceProjectRelationList()){
 			for (WorkInvoiceProjectRelation projectRelation : workInvoice.getWorkInvoiceProjectRelationList()) {
 				//处理开票是非项目还是项目开票
-				if(null==projectRelation.getIsProject() || 1==projectRelation.getIsProject()){
+				if(StringUtils.isNotBlank(projectRelation.getProjectId())){
 					if (WorkInvoiceReceipt.DEL_FLAG_NORMAL.equals(projectRelation.getDelFlag())) {
-						if (StringUtils.isNotBlank(projectRelation.getProjectId())) {
-							ProjectRecords projectRecords = projectRecordsService.getRuralMasters(projectRelation.getProjectId());
-							if (null != projectRecords) {
-								projectNameList.add(projectRecords.getProjectName());
-							}
+						ProjectRecords projectRecords = projectRecordsService.getRuralMasters(projectRelation.getProjectId());
+						if (null != projectRecords) {
+							projectNameList.add(projectRecords.getProjectName());
 						}
+
 					}
-				}else if(projectRelation.getIsProject()==2){
+				}else{
 					if(projectNameList.contains("非项目发票")){
 						continue;
 					}
 					projectNameList.add("其它:"+projectRelation.getDetails().replaceAll("\\r|\\n*",""));
-
 				}
 
 			}
@@ -704,6 +702,42 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 			}
 		}
 	}
+
+
+	@Transactional(readOnly = false)
+	public String electronicInvoiceSave(WorkInvoice workInvoice){
+		//附件保存
+		List<Workattachment> workattachments = workInvoice.getWorkAttachments();
+		if (workattachments!=null && workattachments.size()!=0) {
+			for (Workattachment workattachment : workattachments) {
+				if (workattachment.getId() == null) {
+					continue;
+				}
+				if (workattachment.DEL_FLAG_NORMAL.equals(workattachment.getDelFlag())) {
+					workattachment.setAttachmentId(workInvoice.getId());
+					workattachment.setAttachmentFlag("115");
+					workattachment.setAttachmentUser(UserUtils.getUser().getId());
+					if (StringUtils.isBlank(workattachment.getId()) || "null".equals(workattachment.getId())) {
+						workattachmentService.insertOnWorkAttachment(workattachment);
+					} else {
+						workattachmentService.updateOnWorkAttachment(workattachment);
+					}
+				} else {
+					workattachmentService.delete(workattachment);
+				}
+			}
+		}
+		//查询该发票数据下是否存在附件信息(若存在,则表示已经上传电子发票附件信息)
+		List<Workattachment> attachmentList = workattachmentService.getListByAttachmentIdAndFlag(workInvoice.getId(), "115");
+		if(attachmentList.size()>0){
+			workInvoice.setElectronicInvoiceFlag(1);
+		}else{
+			workInvoice.setElectronicInvoiceFlag(0);
+		}
+		dao.updateElectronicInvoiceFlag(workInvoice);
+		return "电子发票上传成功";
+	}
+
 	/**
 	 * 分公司提交存储
 	 * @param workInvoice
@@ -874,6 +908,178 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 					ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
 		return "";
 	}
+	/**
+	 * 非项目发票流程创建
+	 * @param workInvoice
+	 * @param variables
+	 */
+	@Transactional(readOnly = false)
+	public String saveNotProjectBranch(WorkInvoice workInvoice,Map<String, Object> variables,String processInstanceId) {
+		long s1=System.currentTimeMillis();
+		if (StringUtils.isBlank(workInvoice.getNumber())) {
+			synchronized (SYN_BYTE) {
+				workInvoice.setNumber(serialNumTplService.genSerialNum(UserUtils.getSelectCompany(), WorkInvoice.SERIAL_BIZCODE));
+			}
+		}
+		String officeId = UserUtils.getUser().getOffice().getId();
+		Office office = officeService.get(officeId);
+		workInvoice.setOffice(office);
+		long s2=System.currentTimeMillis();
+			super.save(workInvoice);
+		//保存附件
+		this.saveAttachments(workInvoice);
+		long s3=System.currentTimeMillis();
+		String str = "";
+		//所属部门
+
+		String userName = UserUtils.get(workInvoice.getCreateBy().getId()).getName();
+		//项目名称获取
+		List<String> projectNameList = getProjectNameList(workInvoice);
+		String projectNameStr = String.join(",", projectNameList);
+		//ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
+		String title = "项目【"+ projectNameStr +"】发票申请待审批";
+		str = "发票金额:" + workInvoice.getMoney() + "(元)。项目【"+ projectNameStr +"】发票申请待审批,发票申请编号:"+workInvoice.getNumber();
+
+		long s4=System.currentTimeMillis();
+		//开票明细处理
+		updateWorkInvoiceInfo(workInvoice);
+		//开票与项目关系处理
+		updateWorkInvoiceProjectRelationInfo(workInvoice);
+		long s5=System.currentTimeMillis();
+			// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+			identityService.setAuthenticatedUserId(UserUtils.getUser().getId());
+			// 启动流程
+			String businessKey = workInvoice.getId().toString();
+			WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c82bdea00005c750905",officeService.get(workInvoice.getOfficeId()));
+			// 启动流程
+			String processType = workActivityMenu.getProcessType();
+			StringBuffer buffer = new StringBuffer();
+			Activity activity = new Activity();
+			WorkProjectNotify workProjectNotify = UtilNotify
+					.saveNotify(workInvoice.getId(),
+							null,
+							workInvoice.getCompanyId(),
+							title,
+							str,
+							"213", //对应之后的判断
+							"0",
+							"待审批",
+							""  //通知角色
+					);
+		long s6=System.currentTimeMillis();
+			List<User> users = new ArrayList<>();
+		//获取部门主任
+			List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"5",workInvoice.getCreateBy());
+		//获取总经理
+			//List<User> zjls = UserUtils.getByRoleActivityEnname("zjl",3,office.getId(),"5",workInvoice.getCreateBy());
+		//财务员工
+		List<User> fpglys = UserUtils.getByRoleActivityEnname("cwygevod",3,office.getId(),"5",workInvoice.getCreateBy());
+		long s7=System.currentTimeMillis();
+			if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+				workProjectNotify.setNotifyRole("");
+				workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+				List<Activity> activities = workActivityMenu.getActivities();
+				for (Activity a : activities) {
+					String encount = a.getEncount();
+					String enlist = a.getEnlist();
+					if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+						List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
+						if (enusers.size()==0){
+							workInvoice.setInvoiceState("1");//暂存
+							this.save(workInvoice);
+							return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
+						}
+						variables.put(enlist, enusers);
+						variables.put(encount, enusers.size());
+					}
+					if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+						activity = a;
+					}
+				}
+				buffer.append(activity.getRole().getEnname());
+				if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+					//角色审批
+					if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+						users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"5",workInvoice.getCreateBy());
+					}
+					//人员审批
+					if (StringUtils.isNotBlank(activity.getUser().getId())) {
+						users.add(activity.getUser());
+					}
+				}
+				workProjectNotify.setId("");
+			} else {
+				//variables.put("fpglyList", fpglys);
+				if (bmzrs.size()==0 ){
+					workInvoice.setInvoiceState("1");//暂存
+					this.save(workInvoice);
+				}
+				if (bmzrs.size()==0){
+					return "流程审批人不能为空,部门主任下无用户,请联系管理员!";
+				}
+				//variables.put("fpglycount",fpglys.size());
+				variables.put("bmzrcount",bmzrs.size());
+				variables.put("bmzrList",bmzrs);
+				processType = "newWorkInvoiceNotProject";
+				users.addAll(bmzrs);
+			}
+			for (User user : users){
+				workProjectNotify.setUser(user);
+				workProjectNotify.setId("");
+				workProjectNotifyService
+						.save(workProjectNotify);
+				Map<String,Object> extras = new HashMap<>();
+				extras.put("type","7002");
+				extras.put("id",workProjectNotify.getId());
+				extras.put("procDefKey","213");
+				UserUtils.pushInfoToApp(title,str,extras,user.getId());
+				UserUtils.pushIm(user.getId(),str);
+			}
+			variables.put("type", processType);
+			variables.put("busId", businessKey);
+			variables.put("title", "发票申请编号:" + workInvoice.getNumber());//设置标题;
+		long s8=System.currentTimeMillis();
+			ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+			workInvoice.setProcessInstance(processInstance);
+		long s9=System.currentTimeMillis();
+			if (StringUtils.isNotBlank(processInstanceId)) {
+				workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+				workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+				workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+			}
+		long s10=System.currentTimeMillis();
+			// 更新流程实例ID
+			workInvoice.setProcessInstanceId(processInstance.getId());
+			workInvoiceDao.updateProcessInstanceId(workInvoice);
+		//通知添加流程实例ID
+		workProjectNotify.setProcessInstanceId(processInstance.getId());
+		workProjectNotify.setWapBeginDate(new Date());
+		workProjectNotifyService.save(workProjectNotify);
+			List<Activity> list = workActivityMenu.getActivities();
+		long s11=System.currentTimeMillis();
+			if (list != null && list.size() != 0) {
+				workActivityProcessService.saveList(list, processInstance.getId());
+			} else {
+				WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+				workActivityProcess.setProcessKey("newWorkInvoiceNotProject");
+				workActivityProcess.setCount(1);
+				workActivityProcess.setProcessInstanceId(processInstance.getId());
+				workActivityProcess.setIsApproval("0");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcess.setCount(2);
+				workActivityProcess.setId("");
+				workActivityProcessService.save(workActivityProcess);
+				workActivityProcessService.insertAuditsByType(bmzrs,processInstance.getId(),1,1);
+				workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),2,0);
+			}
+		long s12=System.currentTimeMillis();
+		logger.info("发票送审-------生成发票编号:"+(s2-s1)+"  保存发票信息:"+(s3-s2)+"  保存发票明细数据:"+(s5-s4)
+				+"  查询角色人员:"+(s7-s6)+"  流程启动:"+(s9-s8)+"  workActivityProcessService.updateProcessInstanceId:"+(s10-s9)
+				+"  查询角色人员:"+(s12-s11)+"  总时间:"+(s12-s1));
+			logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+					ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+		return "";
+	}
 
 
 	/**
@@ -1484,10 +1690,17 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 			String enname = "";
 			List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoice.getProcessInstanceId());
 			WorkActivityMenu workActivityMenu = new WorkActivityMenu();
-			if (activitieList != null && activitieList.size() != 0) {
-				workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
-				workActivityMenu.setActivities(activitieList);
+		if (activitieList != null && activitieList.size() != 0) {
+			Iterator<Activity> iterator = activitieList.iterator();
+			while (iterator.hasNext()){
+				Activity activityInfo = iterator.next();
+				if (!"newWorkInvoiceBranch".equals(activityInfo.getProcessKey())){
+					iterator.remove();
+				}
 			}
+			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+			workActivityMenu.setActivities(activitieList);
+		}
 
 		//项目名称获取
 		List<String> projectNameList = getProjectNameList(workInvoice);
@@ -1842,6 +2055,13 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoice.getProcessInstanceId());
 		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
 		if (activitieList != null && activitieList.size() != 0) {
+			Iterator<Activity> iterator = activitieList.iterator();
+			while (iterator.hasNext()){
+				Activity activityInfo = iterator.next();
+				if (!"newWorkInvoiceExamine".equals(activityInfo.getProcessKey())){
+					iterator.remove();
+				}
+			}
 			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
 			workActivityMenu.setActivities(activitieList);
 		}
@@ -2162,47 +2382,415 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		return "保存审核意见成功!";
 	}
 
+
 	/**
-	 * 获取流程详细信息
-	 * @param processInstanceId
-	 */
-	@SuppressWarnings("unchecked")
-	public WorkInvoice getByProcessInstanceId(String processInstanceId) {
-		WorkInvoice workInvoice = dao.getByProcInsId(processInstanceId);
-		if(workInvoice!=null&&!workInvoice.equals("")){
-			if(workInvoice.getCreateBy()!=null&&!workInvoice.getCreateBy().equals("")){
-				if(StringUtils.isNotBlank(workInvoice.getCreateBy().getId())){
-					User u = UserUtils.get(workInvoice.getCreateBy().getId());
-					if(u!=null &&!u.equals("")){
-						workInvoice.setCreateBy(u);
-					}
-				}
-			}
-		}
-		return workInvoice;
-	}
-	@Transactional(readOnly = false)
-	public void update(WorkInvoice workInvoice) {
-		workInvoice.preUpdate();
-		dao.update(workInvoice);
-	}
-	/**
-	 * 作废审核审批保存
+	 * 审核流程
 	 * @param workInvoice
 	 */
 	@Transactional(readOnly = false)
-	public void cancleSave(WorkInvoice workInvoice) {
-		String userId = UserUtils.getUser().getId();
-		actTaskService.claim(workInvoice.getAct().getTaskId(), userId);
-		// 设置意见
-		workInvoice.getAct().setComment(("yes".equals(workInvoice.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoice.getAct().getComment());
+	public String saveWorkInvoiceNotProjectAudit(WorkInvoice workInvoice,List<User> auditUsers) {
+		//所属部门
+		Office office = officeService.get(workInvoice.getOffice().getId());
+		String userName = UserUtils.get(workInvoice.getCreateBy().getId()).getName();
+		String  str = "发票申请编号:"+workInvoice.getNumber()+",实际开票单位:"+workInvoice.getClient().getName()+",创建人:"+userName+",所属部门:"+office.getName();
+		String title = "实际开票单位:"+workInvoice.getClient().getName();
 		// 对不同环节的业务逻辑进行操作
 		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		if("fpgly".equals(taskDefKey)){
+			updateWorkInvoiceInfo(workInvoice);
+			actTaskService.claim(workInvoice.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else if (!"modifyApply".equals(taskDefKey)) {
+			actTaskService.claim(workInvoice.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else {
+			workInvoice.getAct().setFlag("yes");
+		}
+		String comment = "";
+		if (workInvoice.getInvoiceState().equals("4")){
+			comment = ("yes".equals(workInvoice.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+		}else {
+			comment = ("yes".equals(workInvoice.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoice.getAct().getComment();
+		}
+		//yes 的时候状态为审核通过 否则为未通过
+		//2 审核中 4 驳回
+		workInvoice.setInvoiceState(("yes".equals(workInvoice.getAct().getFlag()) ? "2" : "4"));
+		Map<String, Object> vars = Maps.newHashMap();
 		//业务逻辑对应的条件表达式
 		String exp = "";
-		// 审核环节
-		if ("auditcancle".equals(taskDefKey)) {
-			exp = "pass";
+		String taskCount = "";
+		String notifyRole = "";
+		int key = 0;
+		String enname = "";
+		List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoice.getProcessInstanceId());
+		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+		if (activitieList != null && activitieList.size() != 0) {
+			Iterator<Activity> iterator = activitieList.iterator();
+			while (iterator.hasNext()){
+				Activity activityInfo = iterator.next();
+				if (!"newWorkInvoiceNotProject".equals(activityInfo.getProcessKey())){
+					iterator.remove();
+				}
+			}
+			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+			workActivityMenu.setActivities(activitieList);
+		}
+
+		//项目名称获取
+		List<String> projectNameList = getProjectNameList(workInvoice);
+		String projectNameStr = String.join(",", projectNameList);
+		WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+		WorkActivityProcess selectProcess = new WorkActivityProcess();
+		selectProcess.setProcessInstanceId(workInvoice.getProcessInstanceId());
+		List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+		List<Activity> activities = workActivityMenu.getActivities();
+		if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newWorkInvoiceNotProject")) {
+			key = 1;
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+					taskCount = activityProcess.getCount()+"";
+					workActivityProcess = activityProcess;
+					if (!workActivityProcess.getIsApproval().equals("0")) {
+						workActivityProcess.setId("");
+					}
+					exp = "pass";
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("4");
+						workActivityProcess.setIsApproval("2");
+						String returnBack = "-1";
+						for (Activity activity : activities) {
+							if (activity.getCount() == activityProcess.getCount()) {
+								notifyRole = activity.getName();
+								returnBack = activity.getReturnBack();
+								break;
+							}
+						}
+						if (returnBack.equals("0")) {
+							workActivityProcess.setId("");
+						}
+
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+				}else if(taskDefKey.equals("modifyApply")){
+					taskCount = "0";
+					notifyRole = "调整申请";
+					exp = "pass";
+					workActivityProcess.setId("");
+					workActivityProcess.setCount(0);
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("3");
+						workActivityProcess.setIsApproval("2");
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+					break;
+				}
+			}
+		} else {
+			workActivityMenu.setProcessType("newWorkInvoiceNotProject");
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				String count = activityProcess.getCount() + "";
+				workActivityProcess = activityProcess;
+				if (!workActivityProcess.getIsApproval().equals("0")) {
+					workActivityProcess.setId("");
+				}
+				// 审核环节
+				if ("bmzr".equals(taskDefKey) && count.contains("1")) {
+					taskCount = "1";
+					exp = "pass";
+					if ("yes".equals(workInvoice.getAct().getFlag()) &&("0").equals(workInvoice.getExt())) {
+						workActivityProcessService.insertAuditsByType(auditUsers,workInvoice.getProcessInstanceId(),2,1);
+						//分公司流程
+						notifyRole = "财务部门审批";
+						//notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+						enname = "fpgly";
+						vars.put("fpglyList", auditUsers);
+						vars.put("fpglycount",auditUsers.size());
+					}else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				}
+				if ("fpgly".equals(taskDefKey) && count.contains("2")) {
+					taskCount = "2";
+					exp = "pass";
+					if ("yes".equals(workInvoice.getAct().getFlag()) &&("0").equals(workInvoice.getExt())) {
+						workActivityProcessService.insertAuditsByType(auditUsers,workInvoice.getProcessInstanceId(),2,1);
+						//分公司流程
+						//notifyRole = "财务主任审批";
+						notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+							/*enname = "fpgly";
+							vars.put("fpglyList", auditUsers);
+							vars.put("fpglycount",auditUsers.size());*/
+					}else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				}  /*else if ("fpgly".equals(taskDefKey) && count.contains("2")) {
+					taskCount = "2";
+					exp = "pass";
+					if ("yes".equals(workInvoice.getAct().getFlag())) {
+						notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+					} else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				}*/  else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+					taskCount = "0";
+					notifyRole = "部门主任审批";
+					exp = "pass";
+					workActivityProcess.setCount(0);
+					enname = "bmzr";
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("3");
+					}
+					break;
+				} else if ("apply_end".equals(taskDefKey)) {
+				}
+
+			}
+		}
+		// 设置意见
+		workInvoice.getAct().setComment(("yes".equals(workInvoice.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workInvoice.getAct().getComment());
+		workInvoice.preUpdate();
+		// 提交流程任务
+		vars.put(exp, "yes".equals(workInvoice.getAct().getFlag()) ? true : false);
+		vars.put("passs", true);
+		workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workInvoice.getProcessInstanceId(),taskDefKey,"modifyApply",workInvoice.getAct().getFlag(),comment, activities);
+		// 提交流程任务
+		actTaskService.complete(workInvoice.getAct().getTaskId(), workInvoice.getAct().getProcInsId(), workInvoice.getAct().getComment(), vars);
+		boolean state = actTaskService.isProcessEnd(workInvoice.getAct().getProcInsId());
+		List<User> users = new ArrayList<>();
+		List<User> userList = new ArrayList<>();
+		//ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
+		if (!state) {
+			users.add(workInvoice.getCreateBy());
+			if ("yes".equals(workInvoice.getAct().getFlag())) {
+				title = "项目【"+ projectNameStr +"】发票申请通过";
+				str = "项目【"+ projectNameStr +"】发票申请通过,发票申请编号:"+workInvoice.getNumber();
+				workInvoice.setInvoiceState("5");
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				workProjectNotifyService
+						.save(UtilNotify
+								.saveNotify(workInvoice.getId(),
+										workInvoice.getCreateBy(),
+										workInvoice.getCompanyId(),
+										title,
+										str,
+										"213",
+										"0",
+										"待通知",
+										notifyRole));
+
+			} else {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				if (StringUtils.isNotBlank(workInvoice.getInvoiceState()) && !workInvoice.getInvoiceState().equals("3")){
+					workInvoice.setInvoiceState("4");
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoice.getId(),
+											workInvoice.getCreateBy(),
+											workInvoice.getCompanyId(),
+											title,
+											str,
+											"213",
+											"0",
+											"待通知",
+											notifyRole));
+				}
+			}
+			workActivityProcessService.deleteProcessIdAuditUsers(workInvoice.getProcessInstanceId());
+		} else {
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newWorkInvoiceNotProject")) {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				WorkProjectNotify workProjectNotify = UtilNotify
+						.saveNotify(workInvoice.getId(),
+								new User(),
+								workInvoice.getCompanyId(),
+								title,
+								str,
+								"213",
+								"0",
+								"待审批",
+								notifyRole);
+				List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+						activities,
+						workProjectNotify,
+						taskDefKey,
+						workInvoice.getAct().getFlag(),
+						taskCount,
+						workInvoice.getCreateBy(),
+						workInvoice.getOfficeId(),
+						"5");
+				for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+					users.add(workProjectNotify1.getUser());
+					workProjectNotify1.setId("");
+					workProjectNotify1.setIsNewRecord(false);
+					workProjectNotifyService
+							.save(workProjectNotify1);
+					if (!"modifyApply".equals(taskDefKey)){
+						Map<String,Object> extras = new HashMap<>();
+						if ("fpgly".equals(taskDefKey) ){
+							extras.put("type","7001");
+						}else {
+							extras.put("type","7002");
+						}
+						extras.put("id",workProjectNotify.getId());
+						extras.put("procDefKey","213");
+						UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+
+					}
+				}
+
+			} else {
+				if (!"yes".equals(workInvoice.getAct().getFlag())) {//驳回待办提醒
+					title = "项目【"+ projectNameStr +"】发票申请被驳回";
+					str = "项目【"+ projectNameStr +"】发票申请被驳回,请选择重新申请或作废";
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoice.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoice.getId(),
+											workInvoice.getCreateBy(),
+											workInvoice.getCompanyId(),
+											title,
+											str,
+											"213",
+											"0",
+											"重新申请",
+											notifyRole));
+					users.add( workInvoice.getCreateBy());
+				} else {
+					if (StringUtils.isNotBlank(enname)) {//驳回重新申请待办
+						title = "项目【"+ projectNameStr +"】发票申请,待审批";
+						str = "项目【"+ projectNameStr +"】发票申请,待审批,发票申请编号:"+workInvoice.getNumber();;
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoice.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						WorkProjectNotify workProjectNotify = UtilNotify
+								.saveNotify(workInvoice.getId(),
+										new User(),
+										workInvoice.getCompanyId(),
+										title,
+										str,
+										"213",
+										"0",
+										"待审批",
+										notifyRole);
+						for (User user1:auditUsers){
+							users.add(user1);
+							workProjectNotify.setUser(user1);
+							workProjectNotify.setId("");
+							workProjectNotify.setIsNewRecord(false);
+							workProjectNotifyService
+									.save(workProjectNotify);
+							if (!"modifyApply".equals(taskDefKey)){
+								Map<String,Object> extras = new HashMap<>();
+								if ("fpgly".equals(taskDefKey)){
+									extras.put("type","7001");
+								}else {
+									extras.put("type","7002");
+								}
+								extras.put("id",workProjectNotify.getId());
+								extras.put("procDefKey","213");
+								UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+
+							}
+						}
+					}else {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoice.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						users.addAll(userList);
+						users.add(workInvoice.getCreateBy());
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workInvoice.getId(),
+												workInvoice.getCreateBy(),
+												workInvoice.getCompanyId(),
+												title,
+												str,
+												"213",
+												"0",
+												"重新申请",
+												notifyRole));
+					}
+				}
+			}
+		}
+		if (users!=null && users.size()!=0) {
+			for (User u : users) {
+				UserUtils.pushIm(u.getId(),str);
+			}
+		}
+		if (userList!=null && userList.size()!=0) {
+			for (User u : userList) {
+				UserUtils.pushMeIm(u.getId());
+			}
+		}
+		workInvoiceDao.update(workInvoice);
+		//开票与项目关系处理
+		updateWorkInvoiceProjectRelationInfo(workInvoice);
+		//附件处理
+		this.saveAttachments(workInvoice);
+		return "保存审核意见成功!";
+	}
+
+	/**
+	 * 获取流程详细信息
+	 * @param processInstanceId
+	 */
+	@SuppressWarnings("unchecked")
+	public WorkInvoice getByProcessInstanceId(String processInstanceId) {
+		WorkInvoice workInvoice = dao.getByProcInsId(processInstanceId);
+		if(workInvoice!=null&&!workInvoice.equals("")){
+			if(workInvoice.getCreateBy()!=null&&!workInvoice.getCreateBy().equals("")){
+				if(StringUtils.isNotBlank(workInvoice.getCreateBy().getId())){
+					User u = UserUtils.get(workInvoice.getCreateBy().getId());
+					if(u!=null &&!u.equals("")){
+						workInvoice.setCreateBy(u);
+					}
+				}
+			}
+		}
+		return workInvoice;
+	}
+	@Transactional(readOnly = false)
+	public void update(WorkInvoice workInvoice) {
+		workInvoice.preUpdate();
+		dao.update(workInvoice);
+	}
+	/**
+	 * 作废审核审批保存
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public void cancleSave(WorkInvoice workInvoice) {
+		String userId = UserUtils.getUser().getId();
+		actTaskService.claim(workInvoice.getAct().getTaskId(), userId);
+		// 设置意见
+		workInvoice.getAct().setComment(("yes".equals(workInvoice.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoice.getAct().getComment());
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		//业务逻辑对应的条件表达式
+		String exp = "";
+		// 审核环节
+		if ("auditcancle".equals(taskDefKey)) {
+			exp = "pass";
 		}// 未知环节,直接返回
 		else {
 			return;
@@ -2576,6 +3164,13 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoice.getProcessInstanceId());
 		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
 		if (activitieList != null && activitieList.size() != 0) {
+			Iterator<Activity> iterator = activitieList.iterator();
+			while (iterator.hasNext()){
+				Activity activityInfo = iterator.next();
+				if (!"newWorkInvoiceBranch".equals(activityInfo.getProcessKey())){
+					iterator.remove();
+				}
+			}
 			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
 			workActivityMenu.setActivities(activitieList);
 		}
@@ -3016,4 +3611,8 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 
 	}
 
+	public String getBankNameByNameOrId(String bankName){
+		return dao.getBankNameByNameOrId(bankName);
+	}
+
 }

+ 113 - 6
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllController.java

@@ -21,6 +21,7 @@ import com.jeeplus.modules.act.utils.ActUtils;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
@@ -41,6 +42,7 @@ import com.jeeplus.modules.workcontractinfo.entity.WorkContractInfo;
 import com.jeeplus.modules.workcontractinfo.service.WorkContractInfoService;
 import com.jeeplus.modules.workinvoice.entity.WorkInvoice;
 import com.jeeplus.modules.workinvoice.entity.WorkInvoiceExport;
+import com.jeeplus.modules.workinvoice.entity.WorkInvoiceProjectRelation;
 import com.jeeplus.modules.workinvoice.entity.WorkInvoiceReceipt;
 import com.jeeplus.modules.workinvoice.service.WorkInvoiceAllService;
 import com.jeeplus.modules.workinvoice.service.WorkInvoiceService;
@@ -117,6 +119,8 @@ public class WorkInvoiceAllController extends BaseController {
 	private ActivityService activityService;
 	@Autowired
 	private WorkInvoiceService invoiceService;
+	@Autowired
+	protected RuralProjectRecordsService ruralProjectRecordsService;
 
 	@Autowired
 	private HttpServletRequest request;
@@ -283,6 +287,66 @@ public class WorkInvoiceAllController extends BaseController {
 			return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
 		}
 	}
+
+	/**
+	 * 发票审批(审定(内))
+	 * @param
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "saveWorkInvoiceNotProjectAudit")
+	public String saveWorkInvoiceNotProjectAudit(WorkInvoice workInvoice, Model model,
+												 RedirectAttributes redirectAttributes) {
+		try{
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workInvoice.getAct().getTaskDefKey();
+			List<User> users = null;
+			//所属部门
+			Office office = officeService.get(workInvoice.getOffice().getId());
+			if ("bmzr".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwygevod",3,office.getId(),"5",workInvoice.getCreateBy());
+			}else  if ("scbzr".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwzg",1,office.getId(),"5",workInvoice.getCreateBy());
+			}else  if ("zjl".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwygevod",3,office.getId(),"5",workInvoice.getCreateBy());
+			}else  if ("fpgly".equals(taskDefKey)){
+				if(("1").equals(workInvoice.getExt())) {
+					users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 3);
+				}else{
+					users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),1);
+				}
+			}else if ("modifyApply".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 1);
+			}
+			String flag = workInvoice.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = invoiceService.saveWorkInvoiceNotProjectAudit(workInvoice,users);
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			addMessage(redirectAttributes, "审批失败:");
+			logger.error("Exception e:"+e);
+		}
+
+		if (StringUtils.isNotBlank(workInvoice.getHome()) && "home".equals(workInvoice.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else if (StringUtils.isNotBlank(workInvoice.getHome()) && "notifyList".equals(workInvoice.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+		}
+	}
+
+
+
 	/**
 	 * 查看,增加,编辑开票管理表单页面
 	 */
@@ -309,6 +373,11 @@ public class WorkInvoiceAllController extends BaseController {
 					break;
 				}
 			}
+			//获取发票开户银行信息
+			String bankName = invoiceService.getBankNameByNameOrId(workInvoice.getBank());
+			if(StringUtils.isNotBlank(bankName)){
+				workInvoice.setBank(bankName);
+			}
 			view = "workInvoiceView";
 		}else if("3".equals(tabId)){
 			List<MainDictDetail> billingContentList = DictUtils.getMainDictList("billing_content");
@@ -338,9 +407,29 @@ public class WorkInvoiceAllController extends BaseController {
 				workInvoice.setAct(act);
 				view = "workInvoiceAllModify";
 			}
+			//获取发票项目信息
+			List<WorkInvoiceProjectRelation> workInvoiceProjectRelationList = workInvoice.getWorkInvoiceProjectRelationList();
+			List<String> projectIdList = Lists.newArrayList();
+			//获取项目id并查询所有包含项目id的项目信息
+			for (WorkInvoiceProjectRelation projectInfo: workInvoiceProjectRelationList) {
+				if(StringUtils.isNotBlank(projectInfo.getProjectId())){
+					projectIdList.add(projectInfo.getProjectId());
+				}
+			}
+
+			if(projectIdList.size()>0){
+				//根据项目id查询项目信息中的项目类别
+				String projectSortCostInfo = ruralProjectRecordsService.getProjectSortCostInfo(projectIdList);
+				//如果项目类别中包含审定(内)即 8 则需要进行部门主任审核
+				if(null != projectSortCostInfo && projectSortCostInfo.contains("8")){
+					view = "workInvoiceExamineModify";
+				}
+			}else{
+				view = "workInvoiceNotProjectModify";
+			}
 		}
 		// 环节编号
-		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		/*String taskDefKey = workInvoice.getAct().getTaskDefKey();
 		if (StringUtils.isNotBlank(taskDefKey) && ("bmzr".equals(taskDefKey) ||
 				"scbzr".equals(taskDefKey))){
 			view = "workInvoiceAudit";
@@ -350,12 +439,16 @@ public class WorkInvoiceAllController extends BaseController {
 			view = "workInvoiceAuditEnd";//发票管理员操作发票明细页面
 		}else if (StringUtils.isNotBlank(taskDefKey) && !taskDefKey.equals("modifyApply")){
 			view = "workInvoiceAudit";
-		}
+		}*/
 
 		if (StringUtils.isBlank(workInvoice.getId())){
 			//workInvoice.setNumber(IdGen.uuid());
 			//workInvoice.setInvoiceNumber( (int)((Math.random()*9+1)*100000));
 			workInvoice.setInvoiceDate(new Date());
+			User user = UserUtils.getUser();
+			workInvoice.setActualDrawerId(user.getId());
+			workInvoice.setActualDrawerEmailAddress(user.getEmail());
+			workInvoice.setActualDrawerName(user.getName());
 		}
 
 		//已收款处理
@@ -387,6 +480,7 @@ public class WorkInvoiceAllController extends BaseController {
 			}
 		}
 
+		model.addAttribute("showFlag", "3");
 		model.addAttribute("workInvoice", workInvoice);
 		return "modules/workinvoice/" + view;
 	}
@@ -796,12 +890,25 @@ public class WorkInvoiceAllController extends BaseController {
             Page<WorkInvoice> page = workInvoiceService.findListExport(new Page<WorkInvoice>(request, response, -1), workInvoice);
 			List<WorkInvoice> workInvoiceList = page.getList();
 			invoiceService.disposeListExport(workInvoiceList);
-			/*for (WorkInvoice invoice: workInvoiceList) {
-				invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
+			List<MainDictDetail> billingContentList = DictUtils.getMainDictList("billing_content");
+			for (MainDictDetail dictDetail: billingContentList) {
+				if(workInvoice.getBillingContent().equals(dictDetail.getValue())){
+					workInvoice.setBillingContent(dictDetail.getLabel());
+					break;
+				}
+			}
+			for (WorkInvoice invoice: workInvoiceList) {
+				for (MainDictDetail dictDetail: billingContentList) {
+					if(invoice.getBillingContent().equals(dictDetail.getValue())){
+						invoice.setBillingContent(dictDetail.getLabel());
+						break;
+					}
+				}
+				/*invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
 				List<String> projectNameList = workInvoiceService.getProjectNameList(invoice);
 				String projectNameStr = String.join(",", projectNameList);
-				invoice.setProjectName(projectNameStr);
-			}*/
+				invoice.setProjectName(projectNameStr);*/
+			}
             new ExportExcel("发票管理", WorkInvoiceExport.class).setDataList(page.getList()).write(response, fileName).dispose();
     		return null;
 		} catch (Exception e) {

+ 72 - 18
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllTwoController.java

@@ -21,6 +21,7 @@ import com.jeeplus.modules.act.utils.ActUtils;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
@@ -117,6 +118,8 @@ public class WorkInvoiceAllTwoController extends BaseController {
 	private ActivityService activityService;
 	@Autowired
 	private WorkInvoiceService invoiceService;
+	@Autowired
+	protected RuralProjectRecordsService ruralProjectRecordsService;
 
 	@Autowired
 	private HttpServletRequest request;
@@ -284,26 +287,52 @@ public class WorkInvoiceAllTwoController extends BaseController {
 					break;
 				}
 			}
+			//获取发票开户银行信息
+			String bankName = invoiceService.getBankNameByNameOrId(workInvoice.getBank());
+			if(StringUtils.isNotBlank(bankName)){
+				workInvoice.setBank(bankName);
+			}
 			view = "workInvoiceView";
 		}else if("3".equals(tabId)){
-			List<MainDictDetail> billingContentList = DictUtils.getMainDictList("billing_content");
-			for (MainDictDetail dictDetail: billingContentList) {
-				if(workInvoice.getBillingContent().equals(dictDetail.getValue())){
-					workInvoice.setBillingContent(dictDetail.getLabel());
-					break;
+			ProcessInstance processInstance = actTaskService.getProcIns(workInvoice.getProcessInstanceId());
+			if (processInstance!=null) {
+				Task taskInfok = actTaskService.getCurrentTaskInfo(processInstance);
+				Act act = new Act();
+				act.setTaskId(taskInfok.getId());
+				act.setTaskName(taskInfok.getName());
+				act.setTaskDefKey(taskInfok.getTaskDefinitionKey());
+				act.setProcDefId(taskInfok.getProcessDefinitionId());
+				act.setProcInsId(taskInfok.getProcessInstanceId());
+				act.setTask(taskInfok);
+				workInvoice.setAct(act);
+				view = "workInvoiceTwoModify";
+
+
+				//获取发票项目信息
+				List<WorkInvoiceProjectRelation> workInvoiceProjectRelationList = workInvoice.getWorkInvoiceProjectRelationList();
+				List<String> projectIdList = Lists.newArrayList();
+				//获取项目id并查询所有包含项目id的项目信息
+				for (WorkInvoiceProjectRelation projectInfo: workInvoiceProjectRelationList) {
+					if(StringUtils.isNotBlank(projectInfo.getProjectId())){
+						projectIdList.add(projectInfo.getProjectId());
+					}
 				}
-			}
-			List<MainDictDetail> receiptTypeList = DictUtils.getMainDictList("receipt_type");
-			for (MainDictDetail dictDetail: receiptTypeList) {
-				if(workInvoice.getChargeType().equals(dictDetail.getValue())){
-					workInvoice.setChargeType(dictDetail.getLabel());
-					break;
+
+				if(projectIdList.size()>0){
+					//根据项目id查询项目信息中的项目类别
+					String projectSortCostInfo = ruralProjectRecordsService.getProjectSortCostInfo(projectIdList);
+					//如果项目类别中包含审定(内)即 8 则需要进行部门主任审核
+					if(null != projectSortCostInfo && projectSortCostInfo.contains("8")){
+						view = "workInvoiceExamineModify";
+					}
+				}else{
+					view = "workInvoiceNotProjectModify";
 				}
+
 			}
-			view = "workInvoiceAllTwoModify";
 		}
 		// 环节编号
-		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		/*String taskDefKey = workInvoice.getAct().getTaskDefKey();
 		if (StringUtils.isNotBlank(taskDefKey) && ("bmzr".equals(taskDefKey) ||
 				"scbzr".equals(taskDefKey))){
 			view = "workInvoiceAudit";
@@ -313,13 +342,19 @@ public class WorkInvoiceAllTwoController extends BaseController {
 			view = "workInvoiceAuditEnd";//发票管理员操作发票明细页面
 		}else if (StringUtils.isNotBlank(taskDefKey) && !taskDefKey.equals("modifyApply")){
 			view = "workInvoiceAudit";
-		}
+		}*/
 
 		if (StringUtils.isBlank(workInvoice.getId())){
 			//workInvoice.setNumber(IdGen.uuid());
 			//workInvoice.setInvoiceNumber( (int)((Math.random()*9+1)*100000));
 			workInvoice.setInvoiceDate(new Date());
+			User user = UserUtils.getUser();
+			workInvoice.setActualDrawerId(user.getId());
+			workInvoice.setActualDrawerEmailAddress(user.getEmail());
+			workInvoice.setActualDrawerName(user.getName());
 		}
+
+		model.addAttribute("showFlag", "2");
 		model.addAttribute("workInvoice", workInvoice);
 		return "modules/workinvoice/" + view;
 	}
@@ -707,12 +742,25 @@ public class WorkInvoiceAllTwoController extends BaseController {
 			String fileName = "发票一览表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
 			Page<WorkInvoice> page = workInvoiceService.findListExport(new Page<WorkInvoice>(request, response, -1), workInvoice);
 			List<WorkInvoice> workInvoiceList = page.getList();
-			/*for (WorkInvoice invoice: workInvoiceList) {
-				invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
+			List<MainDictDetail> billingContentList = DictUtils.getMainDictList("billing_content");
+			for (MainDictDetail dictDetail: billingContentList) {
+				if(workInvoice.getBillingContent().equals(dictDetail.getValue())){
+					workInvoice.setBillingContent(dictDetail.getLabel());
+					break;
+				}
+			}
+			for (WorkInvoice invoice: workInvoiceList) {
+				for (MainDictDetail dictDetail: billingContentList) {
+					if(invoice.getBillingContent().equals(dictDetail.getValue())){
+						invoice.setBillingContent(dictDetail.getLabel());
+						break;
+					}
+				}
+				/*invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
 				List<String> projectNameList = workInvoiceService.getProjectNameList(invoice);
 				String projectNameStr = String.join(",", projectNameList);
-				invoice.setProjectName(projectNameStr);
-			}*/
+				invoice.setProjectName(projectNameStr);*/
+			}
 			new ExportExcel("发票一览表", WorkInvoiceExport.class).setDataList(page.getList()).write(response, fileName).dispose();
 			return null;
 		} catch (Exception e) {
@@ -1374,6 +1422,12 @@ public class WorkInvoiceAllTwoController extends BaseController {
 				break;
 			}
 		}
+
+		//获取发票开户银行信息
+		String bankName = invoiceService.getBankNameByNameOrId(workInvoice.getBank());
+		if(StringUtils.isNotBlank(bankName)){
+			workInvoice.setBank(bankName);
+		}
 		model.addAttribute("workInvoice", workInvoice);
 		model.addAttribute("view", workInvoice.getHome());
 		return "modules/workinvoice/workInvoiceModifyInfo";

+ 325 - 13
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java

@@ -6,8 +6,11 @@ package com.jeeplus.modules.workinvoice.web;
 import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.jeeplus.common.bos.BOSClientUtil;
 import com.jeeplus.common.config.Global;
+import com.jeeplus.common.json.AjaxJson;
 import com.jeeplus.common.mapper.JsonMapper;
+import com.jeeplus.common.oss.OSSClientUtil;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.utils.DateUtils;
 import com.jeeplus.common.utils.MyBeanUtils;
@@ -23,6 +26,7 @@ import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
@@ -69,6 +73,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.URLDecoder;
@@ -83,6 +90,11 @@ import java.util.*;
 @RequestMapping(value = "${adminPath}/workinvoice/workInvoice")
 public class WorkInvoiceController extends BaseController {
 
+	/**
+	 * 阿里云文件服务器前缀
+	 */
+	private final static String aliyunUrl = Global.getConfig("aliyunUrl");
+
 	@Autowired
 	private WorkInvoiceService workInvoiceService;
 	@Autowired
@@ -116,6 +128,8 @@ public class WorkInvoiceController extends BaseController {
 	private ActTaskService actTaskService;
 	@Autowired
 	private ActivityService activityService;
+	@Autowired
+	protected RuralProjectRecordsService ruralProjectRecordsService;
 
 	@Autowired
 	private HttpServletRequest request;
@@ -273,7 +287,7 @@ public class WorkInvoiceController extends BaseController {
 	 * @return
 	 */
 	@RequestMapping(value = "saveExamineAudit")
-	public String saveExamineAudit(WorkInvoice workInvoice, Model model,
+	public String saveExamineAudit(WorkInvoice workInvoice,String showFlag, Model model,
 								   RedirectAttributes redirectAttributes) {
 		try{
 			// 对不同环节的业务逻辑进行操作
@@ -315,7 +329,88 @@ public class WorkInvoiceController extends BaseController {
 		}else if (StringUtils.isNotBlank(workInvoice.getHome()) && "notifyList".equals(workInvoice.getHome())){
 			return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
 		}else {
-			return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+			switch (showFlag){
+				case "1":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+				case "2":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+				case "3":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+				default:
+					return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+			}
+		}
+	}
+
+	/**
+	 * 发票审批(审定(内))
+	 * @param
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "saveWorkInvoiceNotProjectAudit")
+	public String saveWorkInvoiceNotProjectAudit(WorkInvoice workInvoice,String showFlag, Model model,
+								   RedirectAttributes redirectAttributes) {
+		try{
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workInvoice.getAct().getTaskDefKey();
+			List<User> users = null;
+			//所属部门
+			Office office = officeService.get(workInvoice.getOffice().getId());
+			if ("bmzr".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwygevod",3,office.getId(),"5",workInvoice.getCreateBy());
+			}else  if ("scbzr".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwzg",1,office.getId(),"5",workInvoice.getCreateBy());
+			}else  if ("zjl".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwygevod",3,office.getId(),"5",workInvoice.getCreateBy());
+			}else  if ("fpgly".equals(taskDefKey)){
+				if(("1").equals(workInvoice.getExt())) {
+					users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 3);
+				}else{
+					users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),1);
+				}
+			}else if ("modifyApply".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 1);
+			}
+			String flag = workInvoice.getAct().getFlag();
+			if ("yes".equals(flag) && (users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = workInvoiceService.saveWorkInvoiceNotProjectAudit(workInvoice,users);
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			addMessage(redirectAttributes, "审批失败:");
+			logger.error("Exception e:"+e);
+		}
+
+		if (StringUtils.isNotBlank(workInvoice.getHome()) && "home".equals(workInvoice.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else if (StringUtils.isNotBlank(workInvoice.getHome()) && "notifyList".equals(workInvoice.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
+		}else {
+			switch (showFlag){
+				case "1":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+				case "2":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+				case "3":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+				default:
+					return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+			}
 		}
 	}
 
@@ -345,6 +440,11 @@ public class WorkInvoiceController extends BaseController {
 					break;
 				}
 			}
+			//获取发票开户银行信息
+			String bankName = workInvoiceService.getBankNameByNameOrId(workInvoice.getBank());
+			if(StringUtils.isNotBlank(bankName)){
+				workInvoice.setBank(bankName);
+			}
 			view = "workInvoiceView";
 		}else if("3".equals(tabId)){
 			ProcessInstance processInstance = actTaskService.getProcIns(workInvoice.getProcessInstanceId());
@@ -416,7 +516,7 @@ public class WorkInvoiceController extends BaseController {
 	 * 保存开票管理
 	 */
 	@RequestMapping(value = "save")
-	public String save(WorkInvoice workInvoice, Model model, RedirectAttributes redirectAttributes) throws Exception{
+	public String save(WorkInvoice workInvoice,String showFlag, Model model, RedirectAttributes redirectAttributes) throws Exception{
 		if (!beanValidator(model, workInvoice)){
 			return form(workInvoice, model);
 		}
@@ -425,7 +525,20 @@ public class WorkInvoiceController extends BaseController {
 		String invoiceState = workInvoice.getInvoiceState();
 		if(user!=null && !UserUtils.getUser().getId().equals(user.getId()) && StringUtils.isNotBlank(user.getId())){
 			addMessage(redirectAttributes, "您不是申请人,无法修改");
-			return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+			switch (showFlag){
+				case "1":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+				case "2":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+				case "3":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+				default:
+					return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+
+			}
 		}
 		//启动流程
 		workInvoice.setInvoiceState("2");
@@ -444,12 +557,28 @@ public class WorkInvoiceController extends BaseController {
 			String str = "";
 			//默认添加为分公司
 			workInvoice.setExt("0");
+
+			//获取发票项目信息
+			List<WorkInvoiceProjectRelation> workInvoiceProjectRelationList = workInvoice.getWorkInvoiceProjectRelationList();
+			List<String> projectIdList = Lists.newArrayList();
+			//获取项目id并查询所有包含项目id的项目信息
+			for (WorkInvoiceProjectRelation projectInfo: workInvoiceProjectRelationList) {
+				if(StringUtils.isNotBlank(projectInfo.getProjectId())){
+					projectIdList.add(projectInfo.getProjectId());
+				}
+			}
 			//1总公司0分公司
-			if("1".equals(workInvoice.getExt())){
-				//str = workInvoiceService.save(workInvoice, variables,processInstanceId);
-				str = workInvoiceService.saveBranch(workInvoice, variables,processInstanceId);
-			}else if("0".equals(workInvoice.getExt())){
-				str = workInvoiceService.saveBranch(workInvoice, variables,processInstanceId);
+			if(projectIdList.size()>0){
+				//根据项目id查询项目信息中的项目类别
+				String projectSortCostInfo = ruralProjectRecordsService.getProjectSortCostInfo(projectIdList);
+				//如果项目类别中包含审定(内)即 8 则需要进行部门主任审核
+				if(null != projectSortCostInfo && projectSortCostInfo.contains("8")){
+					str = workInvoiceService.saveBranchExamine(workInvoice, variables,processInstanceId);
+				}else{
+					str = workInvoiceService.saveBranch(workInvoice, variables,processInstanceId);
+				}
+			}else{
+				str = workInvoiceService.saveNotProjectBranch(workInvoice, variables,processInstanceId);
 			}
 
 			if(StringUtils.isNotBlank(workInvoice.getExt())){
@@ -466,7 +595,19 @@ public class WorkInvoiceController extends BaseController {
 			addMessage(redirectAttributes, "系统内部错误");
 			logger.error("Exception e:"+e);
 		}
-		return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+		switch (showFlag){
+			case "1":
+				return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+			case "2":
+				return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+			case "3":
+				return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+			default:
+				return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+		}
 	}
 
 
@@ -637,7 +778,7 @@ public class WorkInvoiceController extends BaseController {
 	 * 保存开票管理
 	 */
 	@RequestMapping(value = "store")
-	public String store(WorkInvoice workInvoice, Model model, RedirectAttributes redirectAttributes) throws Exception{
+	public String store(WorkInvoice workInvoice,String showFlag, Model model, RedirectAttributes redirectAttributes) throws Exception{
 		if (!beanValidator(model, workInvoice)){
 			return form(workInvoice, model);
 		}
@@ -649,7 +790,19 @@ public class WorkInvoiceController extends BaseController {
 		String sta = workInvoice.getInvoiceState();
 		if(!UserUtils.getUser().getId().equals(submitter) && !Strings.isNullOrEmpty(submitter) && sta != null){
 			addMessage(redirectAttributes, "您不是申请人,无法修改");
-			return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+			switch (showFlag){
+				case "1":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+				case "2":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+				case "3":
+					return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+				default:
+					return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+			}
 		}
 		if(!workInvoice.getIsNewRecord()){//编辑表单保存
 			WorkInvoice t = workInvoiceService.get(workInvoice.getId());//从数据库取出记录的值
@@ -666,7 +819,19 @@ public class WorkInvoiceController extends BaseController {
 			workInvoiceService.save(workInvoice);//保存
 		}
 		addMessage(redirectAttributes, "保存发票成功");
-		return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+		switch (showFlag){
+			case "1":
+				return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+			case "2":
+				return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+			case "3":
+				return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+			default:
+				return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+		}
 	}
 
 	/**
@@ -889,6 +1054,56 @@ public class WorkInvoiceController extends BaseController {
 		model.addAttribute("page",page);
 		return "modules/sys/gridinvoiceproject";
 	}
+	/**
+	 * 选择开票项目
+	 */
+	@RequestMapping(value = "selectnotproject")
+	public String selectnotproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,Integer isProjectFalg,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
+		project.setCompany(UserUtils.getSelectCompany());
+		project.setProjectStatus(ProjectStatusEnum.SIGNED.getValue());//已签状态
+		//project.setLeaderNameStr(UserUtils.getUser().getName());
+		Page<ProjectRecords> page = projectRecordsService.ruralFindPage(new Page<ProjectRecords>(request, response), project);
+		List<ProjectRecords> list = page.getList();
+		for (ProjectRecords info: list) {
+			if("1".equals(info.getInvoiceFlag())){
+				switch (info.getInvoiceStatus()){
+					case "5":
+						info.setInvoiceFlag("已开票");
+						break;
+					case "1":
+					case "2":
+					case "3":
+					case "4":
+						info.setInvoiceFlag("开票中");
+						break;
+					default:
+						info.setInvoiceFlag("");
+				}
+			}
+		}
+		try {
+			fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
+			fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
+			searchLabel = URLDecoder.decode(searchLabel, "UTF-8");
+			searchKey = URLDecoder.decode(searchKey, "UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+			logger.error("Exception e:"+e);
+		}
+		model.addAttribute("labelNames", fieldLabels.split("\\|"));
+		model.addAttribute("labelValues", fieldKeys.split("\\|"));
+		model.addAttribute("fieldLabels", fieldLabels);
+		model.addAttribute("fieldKeys", fieldKeys);
+		model.addAttribute("url", url);
+		model.addAttribute("searchLabel", searchLabel);
+		model.addAttribute("searchKey", searchKey);
+		project.setDetails(details);
+		model.addAttribute("obj", project);
+		model.addAttribute("isProject", isProject);
+		model.addAttribute("isProjectFalg", isProjectFalg);
+		model.addAttribute("page",page);
+		return "modules/sys/gridinvoicenotproject";
+	}
 
 	/**
 	 * 选择开票项目
@@ -1398,4 +1613,101 @@ public class WorkInvoiceController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
 	}
 
+
+	/**
+	 * 截图模块跳转接口
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "workInvoiceImageEdit")
+	public String workInvoiceImageEdit(Model model) {
+		User currentUser = UserUtils.getUser();
+		model.addAttribute("user", currentUser);
+		model.addAttribute("Global", new Global());
+		return "modules/workinvoice/workInvoiceImageEdit";
+	}
+
+	/**
+	 * 开票截图显示编辑保存
+	 * @param request
+	 * @param response
+	 * @return
+	 * @throws IOException
+	 * @throws IllegalStateException
+	 */
+	@RequestMapping(value = "imageUpload")
+	@ResponseBody
+	public Map imageUpload( HttpServletRequest request, HttpServletResponse response,MultipartFile file) {
+		Map<String,Object> map = new HashMap<>();
+		User currentUser = UserUtils.getUser();
+		String imgName = System.currentTimeMillis() + "发票文件.png";
+		try{
+			if(file != null && file.getSize()>0){
+				String path = new StringBuilder("/temporary/").append(datePath())
+						.append(imgName).append(".png").toString();
+				String filePath = new StringBuilder("attachment-file/temporary/").append(datePath()).toString();
+				InputStream inputStream = file.getInputStream();
+				String url = "";
+				OSSClientUtil ossClientUtil = new OSSClientUtil();
+				ossClientUtil.uploadFile2OSS(inputStream,filePath,imgName);
+				url = "/" + filePath+imgName;
+				url = aliyunUrl + url;
+				//将图片下载保存到本地临时地址中
+				String phonepath = null;
+				if(System.getProperty("os.name").toLowerCase().contains("win")){
+					phonepath = "D:/attachment-file/" + "发票文件/" + currentUser.getName()+"/";
+				}else{
+					phonepath = "/attachment-file/" + "发票文件/" + currentUser.getName()+"/";
+				}
+
+				// 创建File对象
+				File folder = new File(phonepath);
+
+				// 判断文件夹是否存在并且是文件夹
+				if (folder.exists() && folder.isDirectory()) {
+					System.out.println("文件夹存在");
+				} else {
+					System.out.println("文件夹不存在");
+					folder.mkdirs();
+				}
+
+
+				String fileUrl = url;
+				fileUrl = fileUrl.replace("amp;","");
+				String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1, fileUrl.length());
+				String aliyunUrl = Global.getAliyunUrl();
+				String aliDownloadUrl = Global.getAliDownloadUrl();
+				String cons = "";
+				if (fileUrl.contains(aliyunUrl)){
+					cons = aliyunUrl;
+				}else if (fileUrl.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
+					cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+				}else {
+					cons = aliDownloadUrl;
+				}
+				String ossKey = fileUrl.split(cons+"/")[1];
+				new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,phonepath+fileName);
+				//将下载下来的文件转换为file文件
+				File verticalInvalidFile = new File(phonepath+fileName);
+				map.put("file",verticalInvalidFile);
+				map.put("fileName",imgName);
+				map.put("url",url);
+			}
+		}catch (Exception e){
+			logger.error("转存发票截图异常:",e);
+		}
+		return map;
+	}
+
+
+
+	public static String datePath(){
+
+		Calendar date = Calendar.getInstance();
+		String year = String.valueOf(date.get(Calendar.YEAR));
+		String month = String.valueOf(date.get(Calendar.MONTH)+1);
+		String day = String.valueOf(date.get(Calendar.DAY_OF_MONTH));
+		String path = year+"/"+month+"/"+day + "/";
+		return path;
+	}
 }

+ 97 - 7
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceTwoController.java

@@ -308,6 +308,11 @@ public class WorkInvoiceTwoController extends BaseController {
 					break;
 				}
 			}
+			//获取发票开户银行信息
+			String bankName = workInvoiceService.getBankNameByNameOrId(workInvoice.getBank());
+			if(StringUtils.isNotBlank(bankName)){
+				workInvoice.setBank(bankName);
+			}
 			view = "workInvoiceView";
 		}else if("3".equals(tabId)){
 			ProcessInstance processInstance = actTaskService.getProcIns(workInvoice.getProcessInstanceId());
@@ -341,12 +346,14 @@ public class WorkInvoiceTwoController extends BaseController {
 					if(null != projectSortCostInfo && projectSortCostInfo.contains("8")){
 						view = "workInvoiceExamineModify";
 					}
+				}else{
+					view = "workInvoiceNotProjectModify";
 				}
 
 			}
 		}
 		// 环节编号
-		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		/*String taskDefKey = workInvoice.getAct().getTaskDefKey();
 		if (StringUtils.isNotBlank(taskDefKey) && ("bmzr".equals(taskDefKey) ||
 				"scbzr".equals(taskDefKey))){
 			view = "workInvoiceAudit";
@@ -356,12 +363,16 @@ public class WorkInvoiceTwoController extends BaseController {
 			view = "workInvoiceAuditEnd";//发票管理员操作发票明细页面
 		}else if (StringUtils.isNotBlank(taskDefKey) && !taskDefKey.equals("modifyApply")){
 			view = "workInvoiceAudit";
-		}
+		}*/
 
 		if (StringUtils.isBlank(workInvoice.getId())){
 			//workInvoice.setNumber(IdGen.uuid());
 			//workInvoice.setInvoiceNumber( (int)((Math.random()*9+1)*100000));
 			workInvoice.setInvoiceDate(new Date());
+			User user = UserUtils.getUser();
+			workInvoice.setActualDrawerId(user.getId());
+			workInvoice.setActualDrawerEmailAddress(user.getEmail());
+			workInvoice.setActualDrawerName(user.getName());
 		}
 		//可能有问题,是否需要判断vew*
 //		if(StringUtils.isNotBlank(workInvoice.getNewDrawerId()) && workInvoice.getNewDrawerId() != ""){
@@ -370,6 +381,7 @@ public class WorkInvoiceTwoController extends BaseController {
 //			view = "workInvoiceTwoForm2";
 //		}
 
+		model.addAttribute("showFlag", "1");
 		model.addAttribute("workInvoice", workInvoice);
 		return "modules/workinvoice/" + view;
 	}
@@ -471,7 +483,7 @@ public class WorkInvoiceTwoController extends BaseController {
 					str = workInvoiceService.saveBranch(workInvoice, variables,processInstanceId);
 				}
 			}else{
-				str = workInvoiceService.saveBranch(workInvoice, variables,processInstanceId);
+				str = workInvoiceService.saveNotProjectBranch(workInvoice, variables,processInstanceId);
 			}
 
 			//1总公司0分公司
@@ -499,6 +511,63 @@ public class WorkInvoiceTwoController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
 	}
 
+	/**
+	 * 保存开票发票信息
+	 */
+	@RequestMapping(value = "electronicInvoiceSave")
+	public String electronicInvoiceSave(WorkInvoice workInvoice, Model model, RedirectAttributes redirectAttributes) throws Exception{
+		if (!beanValidator(model, workInvoice)){
+			return form(workInvoice, model);
+		}
+
+		User user = workInvoice.getCreateBy();
+		String invoiceState = workInvoice.getInvoiceState();
+		if(user!=null && !UserUtils.getUser().getId().equals(user.getId()) && StringUtils.isNotBlank(user.getId())){
+			addMessage(redirectAttributes, "您不是申请人,无法修改");
+			return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+		}
+		if(!"5".equals(invoiceState)){
+			addMessage(redirectAttributes, "当前发票信息状态下,无法上传电子发票信息");
+			return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+		}
+
+		String str = "";
+
+		try {
+			if(workInvoice.getWorkAttachments().size()>0){
+				str = workInvoiceService.electronicInvoiceSave(workInvoice);
+			}
+
+			if (StringUtils.isNotBlank(str)){
+				addMessage(redirectAttributes, "发票信息导入失败:"+str);
+			}else {
+				addMessage(redirectAttributes, "发票信息导入成功");
+			}
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "系统内部错误");
+			logger.error("Exception e:"+e);
+		}
+		return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+	}
+
+
+	/**
+	 * 查看,增加,编辑开票管理表单页面
+	 */
+	@RequestMapping(value = "electronicInvoiceForm")
+	public String electronicInvoiceForm(WorkInvoice workInvoice, Model model) {
+		String view = "workInvoiceUploadElectronicInvoiceForm";
+		if(StringUtils.isNotBlank(workInvoice.getBank())){
+			//获取发票开户银行信息
+			String bankName = workInvoiceService.getBankNameByNameOrId(workInvoice.getBank());
+			if(StringUtils.isNotBlank(bankName)){
+				workInvoice.setBank(bankName);
+			}
+		}
+		model.addAttribute("workInvoice", workInvoice);
+		return "modules/workinvoice/workInvoiceUploadElectronicInvoiceForm";
+	}
+
 
 	/**
 	 * 查看,增加,编辑开票管理表单页面
@@ -542,6 +611,13 @@ public class WorkInvoiceTwoController extends BaseController {
 			//workInvoice.setInvoiceNumber( (int)((Math.random()*9+1)*100000));
 			workInvoice.setInvoiceDate(new Date());
 		}
+		if(StringUtils.isNotBlank(workInvoice.getBank())){
+			//获取发票开户银行信息
+			String bankName = workInvoiceService.getBankNameByNameOrId(workInvoice.getBank());
+			if(StringUtils.isNotBlank(bankName)){
+				workInvoice.setBank(bankName);
+			}
+		}
 		model.addAttribute("workInvoice", workInvoice);
 		return "modules/workinvoice/" + view;
 	}
@@ -779,12 +855,26 @@ public class WorkInvoiceTwoController extends BaseController {
             Page<WorkInvoice> page = workInvoiceService.findListExport(new Page<WorkInvoice>(request, response, -1), workInvoice);
 			List<WorkInvoice> workInvoiceList = page.getList();
 			workInvoiceService.disposeListExport(workInvoiceList);
-			/*for (WorkInvoice invoice: workInvoiceList) {
-				invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
+
+			List<MainDictDetail> billingContentList = DictUtils.getMainDictList("billing_content");
+			for (MainDictDetail dictDetail: billingContentList) {
+				if(workInvoice.getBillingContent().equals(dictDetail.getValue())){
+					workInvoice.setBillingContent(dictDetail.getLabel());
+					break;
+				}
+			}
+			for (WorkInvoice invoice: workInvoiceList) {
+				for (MainDictDetail dictDetail: billingContentList) {
+					if(invoice.getBillingContent().equals(dictDetail.getValue())){
+						invoice.setBillingContent(dictDetail.getLabel());
+						break;
+					}
+				}
+				/*invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
 				List<String> projectNameList = workInvoiceService.getProjectNameList(invoice);
 				String projectNameStr = String.join(",", projectNameList);
-				invoice.setProjectName(projectNameStr);
-			}*/
+				invoice.setProjectName(projectNameStr);*/
+			}
     		new ExportExcel("发票一览表", WorkInvoiceExport.class).setDataList(page.getList()).write(response, fileName).dispose();
     		return null;
 		} catch (Exception e) {

+ 3 - 0
src/main/java/com/jeeplus/modules/workprojectnotify/service/WorkProjectNotifyRecoverService.java

@@ -41,6 +41,9 @@ public class WorkProjectNotifyRecoverService extends CrudService<WorkProjectNoti
         page.setCountFlag(false);
         workProjectNotifyRecover.setPage(page);
         List<WorkProjectNotifyRecover> list = findList(workProjectNotifyRecover);
+        for (WorkProjectNotifyRecover projectNotifyRecover : list) {
+            projectNotifyRecover.setExceptionDetails(projectNotifyRecover.getExceptionDetails().replaceAll("\r","").replaceAll("\n",""));
+        }
         page.setList(list);
         return page;
     }

Різницю між файлами не показано, бо вона завелика
+ 438 - 316
src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java


+ 15 - 0
src/main/java/com/jeeplus/modules/workreimbursement/dao/WorkReimbursementDao.java

@@ -11,6 +11,7 @@ import com.jeeplus.modules.statement.entity.StatementCompanyComprehensiveInfo;
 import com.jeeplus.modules.workbidproject.entity.WorkBidProject;
 import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
 import com.jeeplus.modules.workproject.entity.WorkProject;
+import com.jeeplus.modules.workreimbursement.entity.ReimbursementVATTax;
 import com.jeeplus.modules.workreimbursement.entity.WorkReimbursement;
 import org.apache.ibatis.annotations.Param;
 
@@ -55,4 +56,18 @@ public interface WorkReimbursementDao extends CrudDao<WorkReimbursement> {
 	//部门级 报销表条数
 	Integer findDepartmentReimbursementReportPageCount(@Param("workReimbursement")WorkReimbursement workReimbursement, @Param("statementCompanyComprehensiveInfo")StatementCompanyComprehensiveInfo statementCompanyComprehensiveInfo, @Param("officeIdd") String officeIdd, @Param("beginDate")String beginDate, @Param("endDate")String endDate);
 
+	/**
+	 * 查询电子发票报销
+	 * @param idList
+	 * @return
+	 */
+	List<ReimbursementVATTax> getElectronicInvoiceList(@Param("idList") List<String> idList);
+
+	/**
+	 * 根据电子发票号码查询电子发票信息
+	 * @param invoiceNumber
+	 * @return
+	 */
+	ReimbursementVATTax getEffectiveDataByinvoiceNumber(@Param("invoiceNumber")String invoiceNumber, @Param("id")String id);
+
 }

+ 109 - 0
src/main/java/com/jeeplus/modules/workreimbursement/entity/ReimbursementElectronicInvoiceVATTaxes.java

@@ -0,0 +1,109 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.workreimbursement.entity;
+
+
+import com.jeeplus.common.persistence.DataEntity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 财务报销Entity
+ * @author 孟祥越
+ * @version 2017-05-02
+ */
+public class ReimbursementElectronicInvoiceVATTaxes extends DataEntity<ReimbursementElectronicInvoiceVATTaxes> {
+
+	private static final long serialVersionUID = 1L;
+	private String invoiceType;		// 发票类型
+	private String invoiceNumber;		// 发票号
+	private Date invoiceDate;		// 开票日期
+	private String invoiceUnit;		// 开票单位
+	private String projectName;		// 项目名称
+	private BigDecimal money;		// 金额
+	private BigDecimal taxAmount;		// 税额
+	private BigDecimal sumMoney;		// 价税合计
+
+	public BigDecimal getMoney() {
+		return money;
+	}
+
+	public void setMoney(BigDecimal money) {
+		this.money = money;
+	}
+
+	public BigDecimal getSumMoney() {
+		return sumMoney;
+	}
+
+	public void setSumMoney(BigDecimal sumMoney) {
+		this.sumMoney = sumMoney;
+	}
+
+	private WorkReimbursement workReimbursement;		// 报销单主键 父类
+
+	public ReimbursementElectronicInvoiceVATTaxes() {
+		super();
+	}
+	public ReimbursementElectronicInvoiceVATTaxes(WorkReimbursement workReimbursement){
+		this.workReimbursement = workReimbursement;
+	}
+
+	public String getInvoiceNumber() {
+		return invoiceNumber;
+	}
+
+	public void setInvoiceNumber(String invoiceNumber) {
+		this.invoiceNumber = invoiceNumber;
+	}
+
+	public BigDecimal getTaxAmount() {
+		return taxAmount;
+	}
+
+	public void setTaxAmount(BigDecimal taxAmount) {
+		this.taxAmount = taxAmount;
+	}
+
+	public WorkReimbursement getWorkReimbursement() {
+		return workReimbursement;
+	}
+
+	public void setWorkReimbursement(WorkReimbursement workReimbursement) {
+		this.workReimbursement = workReimbursement;
+	}
+
+	public String getInvoiceType() {
+		return invoiceType;
+	}
+
+	public void setInvoiceType(String invoiceType) {
+		this.invoiceType = invoiceType;
+	}
+
+	public Date getInvoiceDate() {
+		return invoiceDate;
+	}
+
+	public void setInvoiceDate(Date invoiceDate) {
+		this.invoiceDate = invoiceDate;
+	}
+
+	public String getInvoiceUnit() {
+		return invoiceUnit;
+	}
+
+	public void setInvoiceUnit(String invoiceUnit) {
+		this.invoiceUnit = invoiceUnit;
+	}
+
+	public String getProjectName() {
+		return projectName;
+	}
+
+	public void setProjectName(String projectName) {
+		this.projectName = projectName;
+	}
+}

+ 121 - 0
src/main/java/com/jeeplus/modules/workreimbursement/entity/ReimbursementVATTax.java

@@ -4,9 +4,12 @@
 package com.jeeplus.modules.workreimbursement.entity;
 
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.jeeplus.common.persistence.DataEntity;
+import com.jeeplus.common.utils.excel.annotation.ExcelField;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 财务报销Entity
@@ -16,12 +19,28 @@ import java.math.BigDecimal;
 public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 
 	private static final long serialVersionUID = 1L;
+	private String indexNumber;        //序号
 	private String invoiceCode;		// 发票代码
 	private String invoiceNumber;		// 发票号
 	private BigDecimal taxAmount;		// 税额
 	private BigDecimal money;		// 发票号
 	private BigDecimal sumMoney;		// 税额
 
+	private String invoiceType;		// 发票类型
+	private String invoiceTypeStr;		// 发票类型
+	private Date invoiceDate;		// 开票日期
+	private String invoiceDateStr;		// 开票日期Str
+	private String invoiceUnit;		// 开票单位
+	private String reimbursementType;		// 报销类型(0:普通报销,1:电子发票报销)
+	private String invoiceProjectName;		// 发票项目名
+
+
+	private String submitterName;		// 报销人
+	private String submitterDate;		// 报销时间
+
+	private String remarks;
+
+	@ExcelField(title="金额", align=2, sort=7)
 	public BigDecimal getMoney() {
 		return money;
 	}
@@ -30,6 +49,7 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 		this.money = money;
 	}
 
+	@ExcelField(title="合计", align=2, sort=9)
 	public BigDecimal getSumMoney() {
 		return sumMoney;
 	}
@@ -55,6 +75,7 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 		this.invoiceCode = invoiceCode;
 	}
 
+	@ExcelField(title="发票号码", align=2, sort=3)
 	public String getInvoiceNumber() {
 		return invoiceNumber;
 	}
@@ -63,6 +84,7 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 		this.invoiceNumber = invoiceNumber;
 	}
 
+	@ExcelField(title="税额", align=2, sort=8)
 	public BigDecimal getTaxAmount() {
 		return taxAmount;
 	}
@@ -78,4 +100,103 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 	public void setWorkReimbursement(WorkReimbursement workReimbursement) {
 		this.workReimbursement = workReimbursement;
 	}
+
+	@ExcelField(title="发票类型", align=2, sort=2)
+	public String getInvoiceType() {
+		return invoiceType;
+	}
+
+	public void setInvoiceType(String invoiceType) {
+		this.invoiceType = invoiceType;
+	}
+
+	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	@ExcelField(title="开票日期", align=2, sort=4)
+	public Date getInvoiceDate() {
+		return invoiceDate;
+	}
+
+	public void setInvoiceDate(Date invoiceDate) {
+		this.invoiceDate = invoiceDate;
+	}
+
+	@ExcelField(title="开票单位", align=2, sort=5)
+	public String getInvoiceUnit() {
+		return invoiceUnit;
+	}
+
+	public void setInvoiceUnit(String invoiceUnit) {
+		this.invoiceUnit = invoiceUnit;
+	}
+
+	public String getReimbursementType() {
+		return reimbursementType;
+	}
+
+	public void setReimbursementType(String reimbursementType) {
+		this.reimbursementType = reimbursementType;
+	}
+
+	public String getInvoiceDateStr() {
+		return invoiceDateStr;
+	}
+
+	public void setInvoiceDateStr(String invoiceDateStr) {
+		this.invoiceDateStr = invoiceDateStr;
+	}
+
+	public String getInvoiceTypeStr() {
+		return invoiceTypeStr;
+	}
+
+	public void setInvoiceTypeStr(String invoiceTypeStr) {
+		this.invoiceTypeStr = invoiceTypeStr;
+	}
+
+	@ExcelField(title="项目名称", align=2, sort=6)
+	public String getInvoiceProjectName() {
+		return invoiceProjectName;
+	}
+
+	public void setInvoiceProjectName(String invoiceProjectName) {
+		this.invoiceProjectName = invoiceProjectName;
+	}
+
+	@ExcelField(title="序号", align=2, sort=1)
+	public String getIndexNumber() {
+		return indexNumber;
+	}
+
+	public void setIndexNumber(String indexNumber) {
+		this.indexNumber = indexNumber;
+	}
+
+	@ExcelField(title="报销人", align=2, sort=10)
+	public String getSubmitterName() {
+		return submitterName;
+	}
+
+	public void setSubmitterName(String submitterName) {
+		this.submitterName = submitterName;
+	}
+
+	@ExcelField(title="报销日期", align=2, sort=11)
+	public String getSubmitterDate() {
+		return submitterDate;
+	}
+
+	public void setSubmitterDate(String submitterDate) {
+		this.submitterDate = submitterDate;
+	}
+
+	@ExcelField(title="备注", align=2, sort=12)
+	@Override
+	public String getRemarks() {
+		return remarks;
+	}
+
+	@Override
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
 }

+ 45 - 0
src/main/java/com/jeeplus/modules/workreimbursement/entity/WorkReimbursement.java

@@ -75,6 +75,8 @@ public class WorkReimbursement extends ActEntity<WorkReimbursement> {
 	private Date accomplishDate;		//审核通过时间
 	private String sourceType;		// 报销类型
 	private String comment; // 意见
+	private String reimbursementType; // 报销类型
+	private String reimbursementTypeStr; // 报销类型Str
 
 	public String getComment() {
 		return comment;
@@ -138,6 +140,7 @@ public class WorkReimbursement extends ActEntity<WorkReimbursement> {
 	private String bankNo;//银行账号
 	private List<WorkAccount> workAccountList = Lists.newArrayList();		// 子表列表
 	private List<ReimbursementVATTax> reimbursementVATTaxes = Lists.newArrayList();		// 子表列表
+	private List<ReimbursementVATTax> reimbursementElectronicInvoiceVATTaxes = Lists.newArrayList();		// 子表列表
 	private List<WorkReimbursementBack> reimbursementBackList = Lists.newArrayList();		// 子表列表
 	public String getUserName() {
 		return userName;
@@ -170,6 +173,16 @@ public class WorkReimbursement extends ActEntity<WorkReimbursement> {
 	// 流程定义
 	private ProcessDefinition processDefinition;
 	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();
+	private List<WorkClientAttachment> workAttachmentInvoiceReimbursements = Lists.newArrayList();
+
+	public List<WorkClientAttachment> getWorkAttachmentInvoiceReimbursements() {
+		return workAttachmentInvoiceReimbursements;
+	}
+
+	public void setWorkAttachmentInvoiceReimbursements(List<WorkClientAttachment> workAttachmentInvoiceReimbursements) {
+		this.workAttachmentInvoiceReimbursements = workAttachmentInvoiceReimbursements;
+	}
+
 	public List<WorkClientAttachment> getWorkAttachments() {
 		return workAttachments;
 	}
@@ -337,6 +350,14 @@ public class WorkReimbursement extends ActEntity<WorkReimbursement> {
 		this.reimbursementVATTaxes = reimbursementVATTaxes;
 	}
 
+	public List<ReimbursementVATTax> getReimbursementElectronicInvoiceVATTaxes() {
+		return reimbursementElectronicInvoiceVATTaxes;
+	}
+
+	public void setReimbursementElectronicInvoiceVATTaxes(List<ReimbursementVATTax> reimbursementElectronicInvoiceVATTaxes) {
+		this.reimbursementElectronicInvoiceVATTaxes = reimbursementElectronicInvoiceVATTaxes;
+	}
+
 	public String getProcessInstanceId() {
 		return processInstanceId;
 	}
@@ -630,4 +651,28 @@ public class WorkReimbursement extends ActEntity<WorkReimbursement> {
 	public void setSourceType(String sourceType) {
 		this.sourceType = sourceType;
 	}
+
+	public String getReimbursementType() {
+		return reimbursementType;
+	}
+
+	public void setReimbursementType(String reimbursementType) {
+		this.reimbursementType = reimbursementType;
+	}
+
+	public String getAccountType() {
+		return accountType;
+	}
+
+	public void setAccountType(String accountType) {
+		this.accountType = accountType;
+	}
+
+	public String getReimbursementTypeStr() {
+		return reimbursementTypeStr;
+	}
+
+	public void setReimbursementTypeStr(String reimbursementTypeStr) {
+		this.reimbursementTypeStr = reimbursementTypeStr;
+	}
 }

+ 622 - 6
src/main/java/com/jeeplus/modules/workreimbursement/service/WorkReimbursementNewService.java

@@ -410,9 +410,184 @@ public class WorkReimbursementNewService extends CrudService<WorkReimbursementDa
                 ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
         return "";
     }
+
+
+
+    /**
+     * 电子发票报销保存方法
+     * @param workReimbursement
+     * @param variables
+     */
+    @Transactional(readOnly = false)
+    public String electronicInvoiceReimbursementSave(WorkReimbursement workReimbursement,Map<String, Object> variables,String processInstanceId) {
+        User user = UserUtils.getUser();
+        if (StringUtils.isBlank(workReimbursement.getNumber())) {
+            synchronized (SYN_BYTE) {
+                workReimbursement.setNumber(serialNumTplService.genSerialNum(user.getCompany(), WorkReimbursement.SERIAL_BIZCODE));
+            }
+        }
+        super.save(workReimbursement);
+        String str = "";
+        Office office = officeService.get(workReimbursement.getOfficeId());
+
+        str = "报销【" + workReimbursement.getNumber() + "】申请待审批,经办人:" + user.getName()+",总金额:"+workReimbursement.getMoney();
+        String title = "报销【" + workReimbursement.getNumber() + "】申请待审批";
+        updateWorkReimbursementInfo(workReimbursement);
+        // 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
+        identityService.setAuthenticatedUserId(user.getId());
+        // 启动流程
+        String businessKey = workReimbursement.getId().toString();
+        WorkActivityMenu workActivityMenu = workActivityMenuService.findByParentAndOffice("ggh3125f1f194c82bdea93555c750906", office);
+        // 启动流程
+        String processType = workActivityMenu.getProcessType();
+        StringBuffer buffer = new StringBuffer();
+        Activity activity = new Activity();
+        WorkProjectNotify workProjectNotify = UtilNotify
+                .saveNotify(workReimbursement.getId(),
+                        null,
+                        workReimbursement.getCompanyId(),
+                        title,
+                        str,
+                        "106",
+                        "0",
+                        "待审批",
+                        ""
+                );
+        List<User> users = new ArrayList<>();
+        //部门主任
+        List<User> bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,office.getId(),"8",workReimbursement.getCreateBy());
+
+        //判定当前登陆人的部门是否是工程一部或者为工程一部的子部门,如果是,则审核人均为工程一部部门主任
+        if("7f776d072d7b4c839cef4e63ce6dbfa5".equals(office.getId()) || office.getParentIds().contains("7f776d072d7b4c839cef4e63ce6dbfa5")){
+            bmzrs = UserUtils.getByRoleActivityEnname("bmzr",2,"7f776d072d7b4c839cef4e63ce6dbfa5","8",workReimbursement.getCreateBy());
+        }
+
+        //财务主任(雷主任)
+        List<User> cws = UserUtils.getByRoleActivityEnname("cwzg",3,office.getId(),"8",workReimbursement.getCreateBy());
+        //财务员工
+        List<User> fpglys = UserUtils.getByRoleActivityEnname("dzfpbxshybxsd",3,office.getId(),"5",workReimbursement.getCreateBy());
+        //出纳
+        //List<User> cns = UserUtils.getByRoleActivityEnname("cn",3,office.getId(),"8",workReimbursement.getCreateBy());
+        //总经办负责人
+        //List<User> gsldList = UserUtils.getByRoleActivityEnname("zjbfzribvf",3,office.getId(),"8",workReimbursement.getCreateBy());
+        if (StringUtils.isNotBlank(workActivityMenu.getId())) {
+            workProjectNotify.setNotifyRole("");
+            workActivityMenu = workActivityMenuService.get(workActivityMenu.getId());
+            List<Activity> activities = workActivityMenu.getActivities();
+            for (Activity a : activities) {
+                String encount = a.getEncount();
+                String enlist = a.getEnlist();
+                if (a.getRole()!=null && StringUtils.isNotBlank(a.getRole().getEnname())){
+                    List enusers = UserUtils.getByRoleActivityEnnames(a.getRole().getEnname(),office.getId(),"8",workReimbursement.getCreateBy());
+                    if (enusers.size()==0){
+                        workReimbursement.setStatus("1");
+                        super.save(workReimbursement);
+                        return "流程审批人不能为空,角色"+a.getRole().getName()+"下无用户,请联系管理员!";
+                    }
+                    variables.put(enlist, enusers);
+                    variables.put(encount, enusers.size());
+                }
+                if (a.getDelFlag().equals("0") && a.getCount() == 1) {
+                    activity = a;
+                }
+            }
+            buffer.append(activity.getRole().getEnname());
+            if (activity != null && StringUtils.isNotBlank(activity.getId())) {
+                //角色审批
+                if (StringUtils.isNotBlank(activity.getRole().getEnname())) {
+                    users = UserUtils.getByRoleActivityEnnames(activity.getRole().getEnname(),office.getId(),"8",workReimbursement.getCreateBy());
+                }
+                //人员审批
+                if (StringUtils.isNotBlank(activity.getUser().getId())) {
+                    users.add(activity.getUser());
+                }
+            }
+            workProjectNotify.setId("");
+        } else {
+            if (bmzrs.size()==0 ){
+                workReimbursement.setStatus("1");
+                super.save(workReimbursement);
+            }
+            if (bmzrs.size()==0){
+                return "流程审批人不能为空,角色部门负责人下无用户,请联系管理员!";
+            }
+           /* if (fglds.size()==0){
+                return "流程审批人不能为空,角色分管领导下无用户,请联系管理员!";
+            }
+            if (cws.size()==0){
+                return "流程审批人不能为空,角色财务主管下无用户,请联系管理员!";
+            }
+            if (zjls.size()==0){
+                return "流程审批人不能为空,角色总经理下无用户,请联系管理员!";
+            }
+            if (cwzjs.size()==0){
+                return "流程审批人不能为空,角色财务分管领导下无用户,请联系管理员!";
+            }
+            if (cns.size()==0){
+                return "流程审批人不能为空,角色出纳下无用户,请联系管理员!";
+            }*/
+            variables.put("bmzrcount",bmzrs.size());
+            variables.put("bmzrList",bmzrs);
+            processType = "electronicInvoiceReimbursement";
+            users.addAll(bmzrs);
+        }
+        for (User u : users){
+            workProjectNotify.setUser(u);
+            workProjectNotify.setId("");
+            workProjectNotify.setNotifyRole("部门负责人审批");
+            workProjectNotifyService.save(workProjectNotify);
+            Map<String,Object> extras = new HashMap<>();
+            extras.put("type","7002");
+            extras.put("id",workProjectNotify.getId());
+            extras.put("procDefKey","106");
+            UserUtils.pushInfoToApp(title,str,extras,u.getId());
+            UserUtils.pushIm(u.getId(),str);
+        }
+        variables.put("type", processType);
+        variables.put("busId", businessKey);
+        variables.put("title", "审批单:" + workReimbursement.getNumber());//设置标题;
+
+        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processType, businessKey, variables);
+        workReimbursement.setProcessInstance(processInstance);
+        if (StringUtils.isNotBlank(processInstanceId)) {
+            workActivityProcessService.updateProcessInstanceId(processInstance.getId(),processInstanceId);
+            workActivityProcessService.deleteProcessInstanceId(processInstanceId);
+            workActivityProcessService.deleteProcessIdAuditUsers(processInstanceId);
+        }
+        // 更新流程实例ID
+        workReimbursement.setProcessInstanceId(processInstance.getId());
+        workReimbursementDao.updateProcessInstanceId(workReimbursement);
+        //通知添加流程实例ID
+        workProjectNotify.setProcessInstanceId(processInstance.getId());
+        workProjectNotifyService.save(workProjectNotify);
+        List<Activity> list = workActivityMenu.getActivities();
+        if (list != null && list.size() != 0) {
+            workActivityProcessService.saveList(list, processInstance.getId());
+        } else {
+            WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+            workActivityProcess.setProcessKey("electronicInvoiceReimbursement");
+            workActivityProcess.setCount(1);
+            workActivityProcess.setProcessInstanceId(processInstance.getId());
+            workActivityProcess.setIsApproval("0");
+            workActivityProcessService.save(workActivityProcess);
+            workActivityProcess.setCount(2);
+            workActivityProcess.setId("");
+            workActivityProcessService.save(workActivityProcess);
+            workActivityProcess.setCount(3);
+            workActivityProcess.setId("");
+            workActivityProcessService.save(workActivityProcess);
+            workActivityProcessService.insertAuditsByType(bmzrs,processInstance.getId(),1,1);
+            workActivityProcessService.insertAuditsByType(cws,processInstance.getId(),2,0);
+            workActivityProcessService.insertAuditsByType(fpglys,processInstance.getId(),3,0);
+        }
+        logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{
+                ActUtils.PD_REIMBURSEMENT[0], businessKey, processInstance.getId(), variables});
+        return "";
+    }
+
+
     @Transactional(readOnly = false)
     public void updateWorkReimbursementInfo(WorkReimbursement workReimbursement) {
-        try {
             for (WorkAccount workAccount : workReimbursement.getWorkAccountList()) {
                 if(null == workAccount.getId()){
                     continue;
@@ -460,7 +635,18 @@ public class WorkReimbursementNewService extends CrudService<WorkReimbursementDa
                     workAccountDao.delete(workAccount);
                 }
             }
+            if("0".equals(workReimbursement.getReimbursementType())){
+                for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementElectronicInvoiceVATTaxes()) {
+                    reimbursementVATTaxDao.delete(reimbursementVATTax);
+                }
+            }else if("1".equals(workReimbursement.getReimbursementType())){
+                for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementVATTaxes()) {
+                    reimbursementVATTaxDao.delete(reimbursementVATTax);
+                }
+            }
             for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementVATTaxes()) {
+                //普通报销 发票信息
+                reimbursementVATTax.setReimbursementType("0");
                 if (ReimbursementVATTax.DEL_FLAG_NORMAL.equals(reimbursementVATTax.getDelFlag())) {
                     reimbursementVATTax.setWorkReimbursement(workReimbursement);
                     if (StringUtils.isBlank(reimbursementVATTax.getId()) && StringUtils.isNotBlank(reimbursementVATTax.getInvoiceCode())) {
@@ -474,6 +660,23 @@ public class WorkReimbursementNewService extends CrudService<WorkReimbursementDa
                     reimbursementVATTaxDao.delete(reimbursementVATTax);
                 }
             }
+
+            for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementElectronicInvoiceVATTaxes()) {
+                //电子发票报销 发票信息
+                reimbursementVATTax.setReimbursementType("1");
+                if (ReimbursementVATTax.DEL_FLAG_NORMAL.equals(reimbursementVATTax.getDelFlag())) {
+                    reimbursementVATTax.setWorkReimbursement(workReimbursement);
+                    if (StringUtils.isBlank(reimbursementVATTax.getId()) && StringUtils.isNotBlank(reimbursementVATTax.getInvoiceNumber())) {
+                        reimbursementVATTax.preInsert();
+                        reimbursementVATTaxDao.insert(reimbursementVATTax);
+                    } else {
+                        reimbursementVATTax.preUpdate();
+                        reimbursementVATTaxDao.update(reimbursementVATTax);
+                    }
+                } else {
+                    reimbursementVATTaxDao.delete(reimbursementVATTax);
+                }
+            }
             //附件信息
             for (WorkClientAttachment workClientAttachment : workReimbursement.getWorkAttachments()) {
                 if (workClientAttachment.getId() == null) {
@@ -481,7 +684,7 @@ public class WorkReimbursementNewService extends CrudService<WorkReimbursementDa
                 }
                 if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())) {
                     workClientAttachment.setAttachmentId(workReimbursement.getId());
-                    workClientAttachment.setAttachmentFlag(VarStr.attachmentFlag[1]);
+                    workClientAttachment.setAttachmentFlag(workClientAttachment.getAttachmentFlag());
                     workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
                     if (StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())) {
                         workattachmentService.insertOnWorkClientAttachment(workClientAttachment);
@@ -532,10 +735,6 @@ public class WorkReimbursementNewService extends CrudService<WorkReimbursementDa
                 }
 
             }
-        }catch (Exception e){
-            logger.info("Exception e:"+ e);
-            return;
-        }
     }
     /**
      * 审核流程
@@ -1028,4 +1227,421 @@ public class WorkReimbursementNewService extends CrudService<WorkReimbursementDa
         workReimbursementDao.update(workReimbursement);
         return "保存审核意见成功!";
     }
+
+    /**
+     * 审核流程(电子发票报销)
+     * @param workReimbursement
+     */
+    @Transactional(readOnly = false)
+    public String electronicInvoiceReimbursementAuditSave(WorkReimbursement workReimbursement,List<User> auditUsers) {
+        String str = "";
+        String userName = UserUtils.get(workReimbursement.getCreateBy().getId()).getName();
+        Office office = officeService.get(workReimbursement.getOfficeId());
+        String title = "报销人:"+userName;
+        if (workReimbursement.getProject()!= null && StringUtils.isNotBlank(workReimbursement.getProject().getId())){
+            str =  "报销申请编号:"+workReimbursement.getNumber()+",报销项目:"+workReimbursement.getProject().getProjectName()+",报销费用合计:"+workReimbursement.getMoney()+",报销人:"+userName+",所属部门:"+office.getName();
+        }else {
+            str =  "报销申请编号:"+workReimbursement.getNumber()+",非项目报销,报销费用合计:"+workReimbursement.getMoney()+",报销人:"+userName+",所属部门:"+office.getName();
+        }
+        // 对不同环节的业务逻辑进行操作
+        String taskDefKey = workReimbursement.getAct().getTaskDefKey();
+        if (!"modifyApply".equals(taskDefKey) && !taskDefKey.contains("audit") && !taskDefKey.contains("cw") ) {
+            actTaskService.claim(workReimbursement.getAct().getTaskId(), UserUtils.getUser().getId());
+        }else if(taskDefKey.contains("cw")) {
+            //updateWorkReimbursementInfo(workReimbursement);
+        }else{
+            workReimbursement.getAct().setFlag("yes");
+            if("modifyApply".equals(taskDefKey)) {
+                updateWorkReimbursementInfo(workReimbursement);
+            }
+        }
+        String comment = "";
+        if (workReimbursement.getStatus().equals("4")){
+            comment = ("yes".equals(workReimbursement.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+        }else {
+            comment = ("yes".equals(workReimbursement.getAct().getFlag())?"[同意] ":"[驳回] ")+workReimbursement.getAct().getComment();
+        }
+        //yes 的时候状态为审核通过 否则为未通过
+        //1 审核中 2 未通过
+        workReimbursement.setStatus(("yes".equals(workReimbursement.getAct().getFlag()) ? "2" : "4"));
+        Map<String, Object> vars = Maps.newHashMap();
+        //业务逻辑对应的条件表达式
+        String exp = "";
+        String taskCount = "";
+        String notifyRole = "";
+        int key = 0;
+        String enname = "";
+        List<Activity> activitieList = activityService.getByProcessInstanceId(workReimbursement.getProcessInstanceId());
+        WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+        if (activitieList != null && activitieList.size() != 0) {
+            Iterator<Activity> iterator = activitieList.iterator();
+            while (iterator.hasNext()){
+                Activity activityInfo = iterator.next();
+                if (!"electronicInvoiceReimbursement".equals(activityInfo.getProcessKey())){
+                    iterator.remove();
+                }
+            }
+            workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+            workActivityMenu.setActivities(activitieList);
+        }
+
+        WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+        WorkActivityProcess selectProcess = new WorkActivityProcess();
+        selectProcess.setProcessInstanceId(workReimbursement.getProcessInstanceId());
+        List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+        List<Activity> activities = workActivityMenu.getActivities();
+        if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("electronicInvoiceReimbursement")) {
+            key = 1;
+            for (int i = 0; i < workActivityProcesses.size(); i++) {
+                WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+                if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+                    taskCount = activityProcess.getCount()+"";
+                    workActivityProcess = activityProcess;
+                    if (!workActivityProcess.getIsApproval().equals("0")) {
+                        workActivityProcess.setId("");
+                    }
+                    exp = "pass";
+                    if (!"yes".equals(workReimbursement.getAct().getFlag())) {
+                        workReimbursement.setStatus("4");
+                        workActivityProcess.setIsApproval("2");
+                        String returnBack = "-1";
+                        for (Activity activity : activities) {
+                            if (activity.getCount() == activityProcess.getCount()) {
+                                returnBack = activity.getReturnBack();
+                                notifyRole = activity.getName();
+                                break;
+                            }
+                        }
+                        if (returnBack.equals("0")) {
+                            workActivityProcess.setId("");
+                        }
+
+                    } else {
+                        workActivityProcess.setIsApproval("1");
+                    }
+                }else if(taskDefKey.equals("modifyApply")){
+                    notifyRole = "调整报销";
+                    taskCount = "0";
+                    exp = "pass";
+                    workActivityProcess.setId("");
+                    workActivityProcess.setCount(0);
+                    if (!"yes".equals(workReimbursement.getAct().getFlag())) {
+                        workReimbursement.setStatus("3");
+                        workActivityProcess.setIsApproval("2");
+                    } else {
+                        workActivityProcess.setIsApproval("1");
+                    }
+                    break;
+                }
+            }
+        } else {
+            workActivityMenu.setProcessType("electronicInvoiceReimbursement");
+            for (int i = 0; i < workActivityProcesses.size(); i++) {
+                WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+                String count = activityProcess.getCount() + "";
+                workActivityProcess = activityProcess;
+                if (!workActivityProcess.getIsApproval().equals("0")) {
+                    workActivityProcess.setId("");
+                }
+                // 审核环节
+                if ("bmzr".equals(taskDefKey) && count.contains("1")) {
+                    taskCount = "1";
+                    exp = "pass";
+                    if ("yes".equals(workReimbursement.getAct().getFlag())) {
+                        workActivityProcessService.insertAuditsByType(auditUsers,workReimbursement.getProcessInstanceId(),2,1);
+                        notifyRole = "财务主管审核";
+                        workActivityProcess.setIsApproval("1");
+                        enname = "cw";
+                        vars.put("cwList", auditUsers);
+                        vars.put("cwcount",auditUsers.size());
+                    } else {
+                        notifyRole = "调整报销";
+                        workActivityProcess.setIsApproval("2");
+                    }
+                    break;
+                } else if ("cw".equals(taskDefKey) && count.contains("2")) {
+                    taskCount = "2";
+                    exp = "pass";
+                    if ("yes".equals(workReimbursement.getAct().getFlag())) {
+                        workActivityProcessService.insertAuditsByType(auditUsers,workReimbursement.getProcessInstanceId(),3,1);
+                        notifyRole = "财务员工审核";
+                        workActivityProcess.setIsApproval("1");
+                        enname = "fpglys";
+                        vars.put("fpglysList", auditUsers);
+                        vars.put("fpglyscount",auditUsers.size());
+                    } else {
+                        notifyRole = "调整报销";
+                        workActivityProcess.setIsApproval("2");
+                    }
+                    break;
+                } else if (("fpglys".equals(taskDefKey) || "dzfpbxshybxsd".equals(taskDefKey)) && count.contains("3")) {
+                    taskCount = "3";
+                    exp = "pass";
+                    if ("yes".equals(workReimbursement.getAct().getFlag())) {
+                        notifyRole = "审批通过";
+                        workActivityProcess.setIsApproval("1");
+                    } else {
+                        notifyRole = "调整报销";
+                        workActivityProcess.setIsApproval("2");
+                    }
+                    break;
+                } else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+                    taskCount = "0";
+                    notifyRole = "部门负责人审批";
+                    exp = "pass";
+                    workActivityProcess.setCount(0);
+                    enname = "bmzr";
+                    if (!"yes".equals(workReimbursement.getAct().getFlag())) {
+                        workReimbursement.setStatus("3");
+                    }
+                    break;
+                } else if ("apply_end".equals(taskDefKey)) {
+                }
+
+            }
+        }
+        // 设置意见
+        workReimbursement.getAct().setComment(("yes".equals(workReimbursement.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workReimbursement.getAct().getComment());
+        workReimbursement.preUpdate();
+        // 提交流程任务
+        vars.put(exp, "yes".equals(workReimbursement.getAct().getFlag()) ? true : false);
+        vars.put("passs", true);
+        workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workReimbursement.getProcessInstanceId(),taskDefKey,"modifyApply",workReimbursement.getAct().getFlag(),comment, activities);
+        // 提交流程任务
+        actTaskService.complete(workReimbursement.getAct().getTaskId(), workReimbursement.getAct().getProcInsId(), workReimbursement.getAct().getComment(), vars);
+        workReimbursement.setLimitCond("1");
+        boolean state = actTaskService.isProcessEnd(workReimbursement.getAct().getProcInsId());
+        List<User> users = new ArrayList<>();
+        List<User> userList = new ArrayList<>();
+        if (!state) {
+            title =  "报销【" + workReimbursement.getNumber() + "】申请通过";
+            str = "报销【" + workReimbursement.getNumber() + "】申请通过,经办人:" + userName+",总金额:"+workReimbursement.getMoney();
+            users.add(workReimbursement.getCreateBy());
+            if ("yes".equals(workReimbursement.getAct().getFlag())) {
+
+                Set<String> set = new HashSet();
+                //添加经办人人员id
+                set.add(workReimbursement.getCreateBy().getId());
+                //判断是否含有有效的报销信息
+                if(null != workReimbursement.getWorkAccountList()) {
+                    //添加报销人人员id
+                    for (WorkAccount account : workReimbursement.getWorkAccountList()) {
+                        set.add(account.getReimbursementUserId());
+                    }
+                }
+                //获取通知需要的经办人和报销人人员信息
+                List<User> informUser = Lists.newArrayList();
+                for (String userId: set) {
+                    informUser.add(UserUtils.get(userId));
+                }
+
+                workReimbursement.setStatus("5");
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(workReimbursement.getId());
+                userList = workProjectNotifyService.readByNotifyId(notify);
+                //遍历需要通知的人员信息 进行通知(经办人和报销人员)
+                for (User user: informUser) {
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(workReimbursement.getId(),
+                                            user,
+                                            workReimbursement.getCompanyId(),
+                                            title,
+                                            str,
+                                            "106",
+                                            "0",
+                                            "待通知",
+                                            notifyRole));
+                }
+
+                //修改还款
+                if(workReimbursement.getReimbursementBackList()!=null&&workReimbursement.getReimbursementBackList().size()>0){
+                    for(WorkReimbursementBack workReimbursementBack:workReimbursement.getReimbursementBackList()){
+                        if(StringUtils.isNotBlank(workReimbursementBack.getMoney())||!"0".equals(workReimbursementBack.getMoney())){
+                            WorkLoan loan=new WorkLoan();
+                            double backMoney=Double.parseDouble(workReimbursementBack.getMoney());//本次还款
+                            WorkLoan workLoan =workLoanDao.get(workReimbursementBack.getWorkLoan().getId());
+                            loan.setId(workLoan.getId());
+                            loan.setUpdateBy(UserUtils.getUser());
+                            loan.setUpdateDate(new Date());
+                            if(workLoan.getRepay()==null){
+                                workLoan.setRepay("0");
+                            }
+                            double repay=Double.parseDouble(workLoan.getRepay());//还款金额
+                            double money=Double.parseDouble(workLoan.getMoney());//借款金额
+                            if(!"1".equals(workLoan.getRepayState())){//未还款
+                                if((backMoney+repay)>=money){
+                                    loan.setRepay(String.valueOf(money));
+                                    loan.setRepayState("1");
+
+                                }else{
+                                    loan.setRepay(String.valueOf(repay+backMoney));
+                                    loan.setRepayState("2");
+
+                                }
+                                workLoanDao.updateReay(loan);
+                                workRepayDao.updateReay(workReimbursementBack.getWorkLoan().getId(),workReimbursement.getId());
+                            }
+                        }
+                    }
+                }
+
+            } else {
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(workReimbursement.getId());
+                userList = workProjectNotifyService.readByNotifyId(notify);
+                if (StringUtils.isNotBlank(workReimbursement.getStatus()) && !workReimbursement.getStatus().equals("3")){
+                    workReimbursement.setStatus("4");
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(workReimbursement.getId(),
+                                            workReimbursement.getCreateBy(),
+                                            workReimbursement.getCompanyId(),
+                                            title,
+                                            str,
+                                            "106",
+                                            "0",
+                                            "待通知",
+                                            notifyRole));
+                }
+            }
+            workActivityProcessService.deleteProcessIdAuditUsers(workReimbursement.getProcessInstanceId());
+        } else {
+            if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("electronicInvoiceReimbursement")) {
+                WorkProjectNotify notify = new WorkProjectNotify();
+                notify.setNotifyId(workReimbursement.getId());
+                userList = workProjectNotifyService.readByNotifyId(notify);
+                //users.addAll(userList);
+                WorkProjectNotify workProjectNotify = UtilNotify
+                        .saveNotify(workReimbursement.getId(),
+                                new User(),
+                                workReimbursement.getCompanyId(),
+                                title,
+                                str,
+                                "106",
+                                "0",
+                                "待审批",
+                                notifyRole);
+                List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+                        activities,
+                        workProjectNotify,
+                        taskDefKey,
+                        workReimbursement.getAct().getFlag(),
+                        taskCount,
+                        workReimbursement.getCreateBy(),
+                        workReimbursement.getOfficeId(),
+                        "8");
+                for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+                    users.add(workProjectNotify1.getUser());
+                    workProjectNotify1.setId("");
+                    workProjectNotify1.setIsNewRecord(false);
+                    workProjectNotifyService
+                            .save(workProjectNotify1);
+                    if (!"modifyApply".equals(taskDefKey)){
+                        Map<String,Object> extras = new HashMap<>();
+                        if ("cw".equals(taskDefKey) || "cn".equals(taskDefKey) ){
+                            extras.put("type","7001");
+                        }else {
+                            extras.put("type","7002");
+                        }
+                        extras.put("id",workProjectNotify.getId());
+                        extras.put("procDefKey","106");
+                        UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+
+                    }
+                }
+
+            } else {
+                if (!"yes".equals(workReimbursement.getAct().getFlag())) {//驳回待办
+                    title =  "报销【" + workReimbursement.getNumber() + "】申请被驳回";
+                    str = "报销【" + workReimbursement.getNumber() + "】申请被驳回,请选择重新申请或作废";
+                    WorkProjectNotify notify = new WorkProjectNotify();
+                    notify.setNotifyId(workReimbursement.getId());
+                    userList = workProjectNotifyService.readByNotifyId(notify);
+                    //users.addAll(userList);
+                    workProjectNotifyService
+                            .save(UtilNotify
+                                    .saveNotify(workReimbursement.getId(),
+                                            workReimbursement.getCreateBy(),
+                                            workReimbursement.getCompanyId(),
+                                            title,
+                                            str,
+                                            "106",
+                                            "0",
+                                            "重新申请",
+                                            notifyRole));
+                    users.add( workReimbursement.getCreateBy());
+                } else {
+                    if (StringUtils.isNotBlank(enname)) {//驳回重新申请待办
+                        title =  "报销【" + workReimbursement.getNumber() + "】申请待审批";
+                        str = "报销【" + workReimbursement.getNumber() + "】申请待审批,经办人:" + userName+",总金额:"+workReimbursement.getMoney();
+                        WorkProjectNotify notify = new WorkProjectNotify();
+                        notify.setNotifyId(workReimbursement.getId());
+                        userList = workProjectNotifyService.readByNotifyId(notify);
+                        //users.addAll(userList1);
+                        WorkProjectNotify workProjectNotify = UtilNotify
+                                .saveNotify(workReimbursement.getId(),
+                                        new User(),
+                                        workReimbursement.getCompanyId(),
+                                        title,
+                                        str,
+                                        "106",
+                                        "0",
+                                        "待审批",
+                                        notifyRole);
+                        users.addAll(auditUsers);
+                        for (User user1:auditUsers){
+                            workProjectNotify.setId("");
+                            workProjectNotify.setUser(user1);
+                            workProjectNotify.setIsNewRecord(false);
+                            workProjectNotifyService
+                                    .save(workProjectNotify);
+                            if (!"modifyApply".equals(taskDefKey)){
+                                Map<String,Object> extras = new HashMap<>();
+                                if ("cw".equals(taskDefKey) || "cn".equals(taskDefKey) ){
+                                    extras.put("type","7001");
+                                }else {
+                                    extras.put("type","7002");
+                                }
+                                extras.put("id",workProjectNotify.getId());
+                                extras.put("procDefKey","106");
+                                UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+
+                            }
+                        }
+                    }else {
+                        WorkProjectNotify notify = new WorkProjectNotify();
+                        notify.setNotifyId(workReimbursement.getId());
+                        userList = workProjectNotifyService.readByNotifyId(notify);
+                        users.addAll(userList);
+                        users.add(workReimbursement.getCreateBy());
+                        workProjectNotifyService
+                                .save(UtilNotify
+                                        .saveNotify(workReimbursement.getId(),
+                                                workReimbursement.getCreateBy(),
+                                                workReimbursement.getCompanyId(),
+                                                title,
+                                                str,
+                                                "106",
+                                                "0",
+                                                "重新申请",
+                                                notifyRole));
+                    }
+                }
+            }
+        }
+        if (users!=null && users.size()!=0) {
+            for (User u : users) {
+                UserUtils.pushIm(u.getId(),str);
+            }
+        }
+        if (userList!=null && userList.size()!=0) {
+            for (User u : userList) {
+                UserUtils.pushMeIm(u.getId());
+            }
+        }
+
+        workReimbursementDao.update(workReimbursement);
+        return "保存审核意见成功!";
+    }
 }

+ 234 - 3
src/main/java/com/jeeplus/modules/workreimbursement/service/WorkReimbursementService.java

@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.FtlUtils;
 import com.jeeplus.common.utils.MenuStatusEnum;
 import com.jeeplus.common.utils.StringUtils;
 import com.jeeplus.modules.act.entity.Act;
@@ -17,14 +18,17 @@ import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportData;
 import com.jeeplus.modules.projectcontentinfo.service.ProjectReportDataService;
 import com.jeeplus.modules.projectrecord.dao.WorkProjectUserDao;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
+import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
 import com.jeeplus.modules.serialnum.service.SerialNumTplService;
 import com.jeeplus.modules.statement.entity.StatementCompanyComprehensiveInfo;
 import com.jeeplus.modules.statement.service.StatementCompanyComprehensiveService;
+import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.OfficeService;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
+import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
 import com.jeeplus.modules.workactivity.entity.Activity;
@@ -61,7 +65,23 @@ import org.activiti.engine.task.TaskQuery;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -140,6 +160,9 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
     public WorkReimbursement get(String id) {
         WorkReimbursement workReimbursement = super.get(id);
         if(null != workReimbursement){
+            //获取专业类型
+            List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("invoiceReimbursementType");
+
             List<WorkAccount> workAccounts = workAccountDao.findList(new WorkAccount(workReimbursement));
             for (WorkAccount workAccount:workAccounts){
                 List<WorkAccountAudit> workAccountAudits = workAccountDao.findByWorkAccount(workAccount);
@@ -157,7 +180,33 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
                 }
             }
             workReimbursement.setWorkAccountList(workAccounts);
-            workReimbursement.setReimbursementVATTaxes(reimbursementVATTaxDao.findList(new ReimbursementVATTax(workReimbursement)));
+            List<ReimbursementVATTax> vatTaxDaoList = reimbursementVATTaxDao.findList(new ReimbursementVATTax(workReimbursement));
+            List<ReimbursementVATTax> vatTaxList = Lists.newArrayList();
+            List<ReimbursementVATTax> electronicInvoiceVATTaxesList = Lists.newArrayList();
+            for (ReimbursementVATTax vatTax : vatTaxDaoList) {
+                switch (vatTax.getReimbursementType()){
+                    case "0":
+                        vatTaxList.add(vatTax);
+                        break;
+                    case "1":
+                        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+                        if(null != vatTax.getInvoiceDate()){
+                            String dateString = formatter.format(vatTax.getInvoiceDate());
+                            vatTax.setInvoiceDateStr(dateString);
+                        }
+                        for (MainDictDetail dictDetail : certificateMajor) {
+                            if(dictDetail.getValue().equals(vatTax.getInvoiceType())){
+                                vatTax.setInvoiceTypeStr(dictDetail.getLabel());
+                            }
+                        }
+
+                        electronicInvoiceVATTaxesList.add(vatTax);
+                        break;
+
+                }
+            }
+            workReimbursement.setReimbursementVATTaxes(vatTaxList);
+            workReimbursement.setReimbursementElectronicInvoiceVATTaxes(electronicInvoiceVATTaxesList);
             WorkClientAttachment workClientAttachment = new WorkClientAttachment();
             workClientAttachment.setAttachmentId(id);
             workClientAttachment.setAttachmentFlag(VarStr.attachmentFlag[1]);
@@ -168,6 +217,11 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
             if (workReimbursement!=null && StringUtils.isNotBlank(workReimbursement.getOfficeId())){
                 workReimbursement.setOfficeName(UserUtils.getOfficeById(workReimbursement.getOfficeId()).getName());
             }
+
+            WorkClientAttachment workClientInvoiceAttachment = new WorkClientAttachment();
+            workClientInvoiceAttachment.setAttachmentId(id);
+            workClientInvoiceAttachment.setAttachmentFlag("workInvoiceReimbursement");
+            workReimbursement.setWorkAttachmentInvoiceReimbursements(workattachmentService.getAttachmentList(workClientInvoiceAttachment));
             //暂存状态不操作流程
 		/*if(!"1".equals(workReimbursement.getStatus())){
             Map<String,Object> variables=null;
@@ -222,6 +276,7 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
         workReimbursement.setUploadMode(uploadMode);
         //数据处理(如果为阿里云文件服务器,则对查看的路径进行处理)
         workattachmentService.clientAttachmentManageOnUrl(workReimbursement.getWorkAttachments());
+        workattachmentService.clientAttachmentManageOnUrl(workReimbursement.getWorkAttachmentInvoiceReimbursements());
         return workReimbursement;
     }
 
@@ -647,8 +702,21 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
                     workAccountDao.delete(workAccount);
                 }
             }
+
+            if("0".equals(workReimbursement.getReimbursementType())){
+                for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementElectronicInvoiceVATTaxes()) {
+                    reimbursementVATTaxDao.delete(reimbursementVATTax);
+                }
+            }else if("1".equals(workReimbursement.getReimbursementType())){
+                for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementVATTaxes()) {
+                    reimbursementVATTaxDao.delete(reimbursementVATTax);
+                }
+            }
+
             for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementVATTaxes()) {
                 if (ReimbursementVATTax.DEL_FLAG_NORMAL.equals(reimbursementVATTax.getDelFlag())) {
+                    //普通报销 发票信息
+                    reimbursementVATTax.setReimbursementType("0");
                     reimbursementVATTax.setWorkReimbursement(workReimbursement);
                     if (StringUtils.isBlank(reimbursementVATTax.getId()) && StringUtils.isNotBlank(reimbursementVATTax.getInvoiceCode())) {
                         reimbursementVATTax.preInsert();
@@ -661,6 +729,24 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
                     reimbursementVATTaxDao.delete(reimbursementVATTax);
                 }
             }
+
+
+            for (ReimbursementVATTax reimbursementVATTax : workReimbursement.getReimbursementElectronicInvoiceVATTaxes()) {
+                //电子发票报销 发票信息
+                reimbursementVATTax.setReimbursementType("1");
+                if (ReimbursementVATTax.DEL_FLAG_NORMAL.equals(reimbursementVATTax.getDelFlag())) {
+                    reimbursementVATTax.setWorkReimbursement(workReimbursement);
+                    if (StringUtils.isBlank(reimbursementVATTax.getId()) && StringUtils.isNotBlank(reimbursementVATTax.getInvoiceNumber())) {
+                        reimbursementVATTax.preInsert();
+                        reimbursementVATTaxDao.insert(reimbursementVATTax);
+                    } else {
+                        reimbursementVATTax.preUpdate();
+                        reimbursementVATTaxDao.update(reimbursementVATTax);
+                    }
+                } else {
+                    reimbursementVATTaxDao.delete(reimbursementVATTax);
+                }
+            }
             //附件信息
             for (WorkClientAttachment workClientAttachment : workReimbursement.getWorkAttachments()) {
                 if (workClientAttachment.getId() == null) {
@@ -668,7 +754,7 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
                 }
                 if (WorkClientAttachment.DEL_FLAG_NORMAL.equals(workClientAttachment.getDelFlag())) {
                     workClientAttachment.setAttachmentId(workReimbursement.getId());
-                    workClientAttachment.setAttachmentFlag(VarStr.attachmentFlag[1]);
+                    workClientAttachment.setAttachmentFlag(workClientAttachment.getAttachmentFlag());
                     workClientAttachment.setAttachmentUser(UserUtils.getUser().getId());
                     if (StringUtils.isBlank(workClientAttachment.getId()) || "null".equals(workClientAttachment.getId())) {
                         workattachmentService.insertOnWorkClientAttachment(workClientAttachment);
@@ -1730,4 +1816,149 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
         }
         return page;
     }
+
+    /**
+     * 查询电子发票报销
+     * @return
+     */
+    public List<ReimbursementVATTax> getElectronicInvoiceList(List<String> idList) {
+        List<ReimbursementVATTax> electronicInvoiceList = workReimbursementDao.getElectronicInvoiceList(idList);
+        if(electronicInvoiceList.size()>0){
+            //获取专业类型
+            List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("invoiceReimbursementType");
+            for (int i = 0;i<electronicInvoiceList.size(); i++ ){
+                ReimbursementVATTax reimbursementVATTax = electronicInvoiceList.get(i);
+                reimbursementVATTax.setIndexNumber(String.valueOf(i+1));
+                for (MainDictDetail dictDetail : certificateMajor) {
+                    if(dictDetail.getValue().equals(reimbursementVATTax.getInvoiceType())){
+                        reimbursementVATTax.setInvoiceType(dictDetail.getLabel());
+                    }
+                }
+            }
+        }
+        return electronicInvoiceList;
+    }
+
+    /**
+     * 根据电子发票号码查询电子发票信息
+     * @param invoiceNumber
+     * @return
+     */
+    public ReimbursementVATTax getEffectiveDataByinvoiceNumber(String invoiceNumber, String id) {
+        return workReimbursementDao.getEffectiveDataByinvoiceNumber(invoiceNumber, id);
+    }
+
+
+    /**
+     * 报销电子发票数据处理
+     * @param file
+     * @return
+     */
+    public Map<String,Object> disposeXmlFile(File file, String id){
+        Map<String,Object> map = new HashMap();
+        //创建DOM4J解析器对象
+        try {
+            // 创建一个 DocumentBuilderFactory
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            // 使用工厂创建一个 DocumentBuilder
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            // 使用 DocumentBuilder 解析 XML 文件
+            Document document = builder.parse(file);
+            // 获取所有header节点的集合
+            NodeList headerList = document.getElementsByTagName("Header");
+            // 获取所有eInvoiceDataList节点的集合
+            NodeList eInvoiceDataList = document.getElementsByTagName("EInvoiceData");
+            // 获取所有taxSupervisionInfo节点的集合
+            NodeList taxSupervisionInfoList = document.getElementsByTagName("TaxSupervisionInfo");
+
+            Map<String,String> map1 = xmlNodeListDataDispose(headerList, document);
+            Map<String,String> map2 = xmlNodeListDataDispose(eInvoiceDataList, document);
+            Map<String,String> map3 = xmlNodeListDataDispose(taxSupervisionInfoList, document);
+            map.putAll(map1);
+            map.putAll(map2);
+            map.putAll(map3);
+
+            //对处理后的数据根据发票号进行数据库查询,查看是否存在已报销的电子发票数据
+            if(StringUtils.isNotBlank(map.get("InvoiceNumber").toString())){
+                ReimbursementVATTax invoiceNumber = workReimbursementDao.getEffectiveDataByinvoiceNumber(map.get("InvoiceNumber").toString(), id);
+                if(null != invoiceNumber){
+                    map.put("flag",true);
+                    map.put("message","发票号:" + map.get("InvoiceNumber").toString() + " 已发起或完成报销,请勿重复报销");
+                }else{
+                    map.put("flag",false);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return map;
+    }
+
+    /**
+     * 对节点集合进行遍历,并获取每个节点下的参数信息
+     * @param nodeList
+     * @param document
+     * @return
+     */
+    public Map<String,String> xmlNodeListDataDispose(NodeList nodeList,Document document){
+        Map<String,String> map = new HashMap<>();
+        if(null != nodeList && nodeList.getLength()>0){
+            //遍历每一个header节点
+            for (int i = 0; i < nodeList.getLength(); i++) {
+                //通过 item(i)方法 获取一个header节点,nodelist的索引值从0开始
+                Node header = nodeList.item(i);
+                //解析定义节点的子节点
+                NodeList childNodes = header.getChildNodes();
+                //节点数据处理
+                Map<String,String> map1 = xmlDataDispose(childNodes, document);
+                map.putAll(map1);
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 子节点遍历获取参数,若其下还有子节点,则循环调用 xmlNodeListDataDispose 方法
+     * @param childNodes
+     * @param document
+     * @return
+     */
+    public Map<String,String> xmlDataDispose(NodeList childNodes,Document document){
+        Map<String,String> map = new HashMap<>();
+        for (int k = 0; k < childNodes.getLength(); k++) {
+            // 区分出text类型的node以及element类型的node
+            if (childNodes.item(k).getNodeType() == Node.ELEMENT_NODE) {
+                Node firstChild = childNodes.item(k).getFirstChild();
+                if(null != firstChild){
+                    if(StringUtils.isBlank(childNodes.item(k).getFirstChild().getNodeValue())){
+                        // 获取所有header节点的集合
+                        NodeList childList = document.getElementsByTagName(childNodes.item(k).getNodeName());
+
+                        String parentName = childNodes.item(k).getNodeName();
+                        //循环调用,获取最低级节点数据信息
+                        Map<String,String> map1 = xmlNodeListDataDispose(childList, document);
+                        Map<String,String> map2 = new HashMap<>();
+                        if(map1.size()>0){
+                            //将获取到的数据进行遍历,添加父节点的参数信息,防止子节点key键相同,导致数据被覆盖
+                            for (String key : map1.keySet()) {
+                                if(key.contains("-")){
+                                    String newKey = key.replaceAll("-","");
+                                    map2.put(parentName + newKey,map1.get(key));
+                                }else{
+                                    map2.put(parentName + key,map1.get(key));
+                                }
+                            }
+                        }
+                        map.putAll(map2);
+                    }
+                    //判定key 和value 值均存在,则进行储存,否则不进行储存
+                    if(StringUtils.isNotBlank(childNodes.item(k).getNodeName()) && StringUtils.isNotBlank(childNodes.item(k).getFirstChild().getNodeValue())){
+                        map.put(childNodes.item(k).getNodeName(),childNodes.item(k).getFirstChild().getNodeValue());
+                    }
+                }
+            }
+        }
+        return map;
+    }
 }

+ 26 - 0
src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementAllController.java

@@ -39,6 +39,7 @@ import com.jeeplus.modules.workfullmanage.service.WorkFullManageService;
 import com.jeeplus.modules.workinvoice.entity.WorkInvoice;
 import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
 import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workreimbursement.entity.ReimbursementVATTax;
 import com.jeeplus.modules.workreimbursement.entity.WorkAccount;
 import com.jeeplus.modules.workreimbursement.entity.WorkReimbursement;
 import com.jeeplus.modules.workreimbursement.entity.WorkReimbursementTypeInfo;
@@ -125,6 +126,8 @@ public class WorkReimbursementAllController extends BaseController {
 	private WorkReimbursementTypeService workReimbursementTypeService;
 	@Autowired
 	protected WorkProjectNotifyService workProjectNotifyService;
+	@Autowired
+	protected WorkReimbursementService workRService;
 
 	@ModelAttribute
 	public WorkReimbursement get(@RequestParam(required=false) String id) {
@@ -457,6 +460,29 @@ public class WorkReimbursementAllController extends BaseController {
 		}
 		return "redirect:"+Global.getAdminPath()+"/workreimbursement/workReimbursementAll/?repage";
 	}
+	/**
+	 * 导出电子发票报销excel文件
+	 */
+	@RequiresPermissions("workreimbursement:workReimbursement:export")
+	@RequestMapping(value = "electronicInvoiceExport", method=RequestMethod.POST)
+	public String electronicInvoiceExportFile(WorkReimbursement workReimbursement, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+			String fileName = "报销电子发票明细表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+			Page<WorkReimbursement> page = workReimbursementService.findPage(new Page<WorkReimbursement>(request, response, -1), workReimbursement);
+			List<String> idList = Lists.newArrayList();
+			for (WorkReimbursement reimbursement : page.getList()) {
+				idList.add(reimbursement.getId());
+			}
+			List<ReimbursementVATTax> electronicInvoiceList = workRService.getElectronicInvoiceList(idList);
+			String agent = request.getHeader("USER-AGENT");
+			new ExportExcel("报销电子发票明细表", ReimbursementVATTax.class).setDataList(electronicInvoiceList).write(response, fileName,agent).dispose();
+			return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出报销电子发票明细表失败!失败信息:"+e.getMessage());
+			logger.error("Exception e:"+e);
+		}
+		return "redirect:"+Global.getAdminPath()+"/workreimbursement/workReimbursementAll/?repage";
+	}
 
 	/**
 	 * 导入Excel数据

+ 131 - 14
src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementController.java

@@ -10,9 +10,7 @@ import com.google.common.collect.Maps;
 import com.jeeplus.common.config.Global;
 import com.jeeplus.common.mapper.JsonMapper;
 import com.jeeplus.common.persistence.Page;
-import com.jeeplus.common.utils.DateUtils;
-import com.jeeplus.common.utils.MyBeanUtils;
-import com.jeeplus.common.utils.StringUtils;
+import com.jeeplus.common.utils.*;
 import com.jeeplus.common.utils.excel.ExportExcel;
 import com.jeeplus.common.utils.excel.ImportExcel;
 import com.jeeplus.common.web.BaseController;
@@ -22,10 +20,12 @@ import com.jeeplus.modules.act.utils.ActUtils;
 import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.projectrecord.enums.ProjectStatusEnum;
 import com.jeeplus.modules.projectrecord.service.ProjectRecordsService;
+import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
 import com.jeeplus.modules.sys.entity.Role;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.sysmtree.entity.SysMtree;
 import com.jeeplus.modules.sysmtree.service.SysMtreeService;
@@ -37,8 +37,10 @@ import com.jeeplus.modules.workclientinfo.service.WorkClientInfoService;
 import com.jeeplus.modules.projectrecord.dao.WorkProjectUserDao;
 import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
 import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
+import com.jeeplus.modules.workreimbursement.entity.ReimbursementVATTax;
 import com.jeeplus.modules.workreimbursement.entity.WorkReimbursement;
 import com.jeeplus.modules.workreimbursement.entity.WorkReimbursementTypeInfo;
+import com.jeeplus.modules.workreimbursement.service.WorkReimbursementNewService;
 import com.jeeplus.modules.workreimbursement.service.WorkReimbursementService;
 import com.jeeplus.modules.workreimbursement.service.WorkReimbursementTypeService;
 import com.jeeplus.modules.workreimbursement.utils.VarStr;
@@ -53,23 +55,28 @@ import org.activiti.engine.history.HistoricProcessInstance;
 import org.activiti.engine.runtime.ProcessInstance;
 import org.activiti.engine.task.Task;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.dom4j.io.SAXReader;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.ConstraintViolationException;
-import java.io.UnsupportedEncodingException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.*;
 import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 财务报销Controller
@@ -118,6 +125,8 @@ public class WorkReimbursementController extends BaseController {
 	protected WorkProjectNotifyService workProjectNotifyService;
 	@Autowired
 	protected HistoryService historyService;
+	@Autowired
+	protected WorkReimbursementNewService workReimbursementNewService;
 
 	@ModelAttribute
 	public WorkReimbursement get(@RequestParam(required=false) String id) {
@@ -170,19 +179,20 @@ public class WorkReimbursementController extends BaseController {
 		List<String> typeList= jersey.repackaged.com.google.common.collect.Lists.newArrayList();
 		typeList.add("13");
 		typeList.add("102");
+		typeList.add("106");
 		String types = org.apache.commons.lang3.StringUtils.join(typeList,',');
 		workProjectNotify.setTypes(types);
 		//添加发票对应编号
 		//workProjectNotify.setType("13");
 		//查询所有需要当前登录人进行处理的项目信息
-		//List<WorkProjectNotify> notifyList = workProjectNotifyService.findList(workProjectNotify);
+		List<WorkProjectNotify> notifyList = workProjectNotifyService.findList(workProjectNotify);
 
-		/*//添加发票对应编号
+		//添加发票对应编号
 		workProjectNotify.setType("102");
 		//查询所有需要当前登录人进行处理的项目信息
-		List<WorkProjectNotify> newNotifyList = workProjectNotifyService.findList(workProjectNotify);*/
+		List<WorkProjectNotify> newNotifyList = workProjectNotifyService.findList(workProjectNotify);
 
-		/*for (WorkReimbursement info: list) {
+		for (WorkReimbursement info: list) {
 			for (WorkProjectNotify notify: notifyList) {
 				if(notify.getNotifyId().equals(info.getId()) && "13".equals(notify.getType())){
 					info.setNotifyId(notify.getId());
@@ -205,8 +215,19 @@ public class WorkReimbursementController extends BaseController {
 					}
 					break;
 				}
+				//报告归档资料缺失说明修改权限处理
+				if(notify.getNotifyId().equals(info.getId()) && "106".equals(notify.getType())){
+					info.setNotifyId(notify.getId());
+					if("重新申请".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+						info.setNotifyFlag(4);
+					}
+					if("待审批".equals(notify.getRemarks()) && !"1".equals(notify.getStatus())){
+						info.setNotifyFlag(3);
+					}
+					break;
+				}
 			}
-		}*/
+		}
 		model.addAttribute("page", page);
 		return "modules/workreimbursement/workReimbursementList";
 	}
@@ -253,6 +274,27 @@ public class WorkReimbursementController extends BaseController {
 			}
 		}
 		if("1".equals(tabId)){
+			switch (workReimbursement.getReimbursementType()){
+				case "0" :
+					workReimbursement.setReimbursementTypeStr("普通报销");
+					break;
+				case "1" :
+					workReimbursement.setReimbursementTypeStr("电子发票报销");
+					break;
+
+			}
+
+			if(null != workReimbursement.getReimbursementElectronicInvoiceVATTaxes() && workReimbursement.getReimbursementElectronicInvoiceVATTaxes().size()>0){
+				//获取专业类型
+				List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("invoiceReimbursementType");
+				for (ReimbursementVATTax vatTax : workReimbursement.getReimbursementElectronicInvoiceVATTaxes()) {
+					for (MainDictDetail dictDetail : certificateMajor) {
+						if(dictDetail.getValue().equals(vatTax.getInvoiceType())){
+							vatTax.setInvoiceType(dictDetail.getLabel());
+						}
+					}
+				}
+			}
 			view = "workReimbursementFormDetail";
 		}else if("3".equals(tabId)){
 			ProcessInstance processInstance = actTaskService.getProcIns(workReimbursement.getProcessInstanceId());
@@ -382,7 +424,12 @@ public class WorkReimbursementController extends BaseController {
 			Map<String, Object> variables = Maps.newHashMap();
 			workReimbursement.setCompanyId(UserUtils.getSelectCompany().getId());
 			workReimbursement.setCreateOffice(UserUtils.getSelectOffice().getId());
-			String str = workReimbursementService.save(workReimbursement, variables,processInstanceId);
+			String str = "报销类型未选择";
+			if("0".equals(workReimbursement.getReimbursementType())){
+				str = workReimbursementService.save(workReimbursement, variables,processInstanceId);
+			}else if("1".equals(workReimbursement.getReimbursementType())){
+				str = workReimbursementNewService.electronicInvoiceReimbursementSave(workReimbursement, variables,processInstanceId);
+			}
 			if (StringUtils.isNotBlank(str)){
 				addMessage(redirectAttributes, "报销申请提交失败:"+str);
 			}else {
@@ -579,6 +626,30 @@ public class WorkReimbursementController extends BaseController {
 	}
 
 	/**
+	 * 导出电子发票报销excel文件
+	 */
+	@RequiresPermissions("workreimbursement:workReimbursement:export")
+	@RequestMapping(value = "electronicInvoiceExport", method=RequestMethod.POST)
+	public String electronicInvoiceExportFile(WorkReimbursement workReimbursement, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+		try {
+			String fileName = "报销电子发票明细表"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
+			Page<WorkReimbursement> page = workReimbursementService.findPage(new Page<WorkReimbursement>(request, response, -1), workReimbursement);
+			List<String> idList = Lists.newArrayList();
+			for (WorkReimbursement reimbursement : page.getList()) {
+				idList.add(reimbursement.getId());
+			}
+			List<ReimbursementVATTax> electronicInvoiceList = workReimbursementService.getElectronicInvoiceList(idList);
+			String agent = request.getHeader("USER-AGENT");
+			new ExportExcel("报销电子发票明细表", ReimbursementVATTax.class).setDataList(electronicInvoiceList).write(response, fileName,agent).dispose();
+			return null;
+		} catch (Exception e) {
+			addMessage(redirectAttributes, "导出报销电子发票明细表失败!失败信息:"+e.getMessage());
+			logger.error("Exception e:"+e);
+		}
+		return "redirect:"+Global.getAdminPath()+"/workreimbursement/workReimbursement/?repage";
+	}
+
+	/**
 	 * 导入Excel数据
 
 	 */
@@ -969,4 +1040,50 @@ public class WorkReimbursementController extends BaseController {
 		model.addAttribute("page",page);
 		return "modules/sys/gridReimburProjectList";
 	}
+
+
+	@RequestMapping(value = "disposeXmlFile", method=RequestMethod.POST)
+	@ResponseBody
+	public Map<String,Object> disposeXmlFile(HttpServletRequest request, MultipartFile multipartFile, String id){
+		Map<String,Object> map = new HashMap();
+		//创建DOM4J解析器对象
+		try {
+			//MultipartFile转File
+			File file = FtlUtils.transformMultipartFile(multipartFile);
+			// 创建一个 DocumentBuilderFactory
+			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+			// 使用工厂创建一个 DocumentBuilder
+			DocumentBuilder builder = factory.newDocumentBuilder();
+			// 使用 DocumentBuilder 解析 XML 文件
+			Document document = builder.parse(file);
+			// 获取所有header节点的集合
+			NodeList headerList = document.getElementsByTagName("Header");
+			// 获取所有eInvoiceDataList节点的集合
+			NodeList eInvoiceDataList = document.getElementsByTagName("EInvoiceData");
+			// 获取所有taxSupervisionInfo节点的集合
+			NodeList taxSupervisionInfoList = document.getElementsByTagName("TaxSupervisionInfo");
+
+			Map<String,String> map1 = workReimbursementService.xmlNodeListDataDispose(headerList, document);
+			Map<String,String> map2 = workReimbursementService.xmlNodeListDataDispose(eInvoiceDataList, document);
+			Map<String,String> map3 = workReimbursementService.xmlNodeListDataDispose(taxSupervisionInfoList, document);
+			map.putAll(map1);
+			map.putAll(map2);
+			map.putAll(map3);
+
+			//对处理后的数据根据发票号进行数据库查询,查看是否存在已报销的电子发票数据
+			if(StringUtils.isNotBlank(map.get("InvoiceNumber").toString())){
+				ReimbursementVATTax invoiceNumber = workReimbursementService.getEffectiveDataByinvoiceNumber(map.get("InvoiceNumber").toString(), id);
+				if(null != invoiceNumber){
+					map.put("flag",true);
+					map.put("message","发票号:" + map.get("InvoiceNumber").toString() + " 已发起或完成报销,请勿重复报销");
+				}else{
+					map.put("flag",false);
+				}
+			}
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return map;
+	}
 }

+ 69 - 3
src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementNewController.java

@@ -185,7 +185,12 @@ public class WorkReimbursementNewController extends BaseController {
 			Map<String, Object> variables = Maps.newHashMap();
 			workReimbursement.setCompanyId(UserUtils.getSelectCompany().getId());
 			workReimbursement.setCreateOffice(UserUtils.getSelectOffice().getId());
-			String str = workReimbursementNewService.save(workReimbursement, variables,processInstanceId);
+			String str = "报销类型未选择";
+			if("0".equals(workReimbursement.getReimbursementType())){
+				str = workReimbursementNewService.save(workReimbursement, variables,processInstanceId);
+			}else if("1".equals(workReimbursement.getReimbursementType())){
+				str = workReimbursementNewService.electronicInvoiceReimbursementSave(workReimbursement, variables,processInstanceId);
+			}
 			if (StringUtils.isNotBlank(str)){
 				addMessage(redirectAttributes, "报销申请提交失败:"+str);
 			}else {
@@ -221,12 +226,20 @@ public class WorkReimbursementNewController extends BaseController {
 				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),3);
 				if (users==null )
 					users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),1);
-				users = UserUtils.getByRoleActivityEnname("zjbfzribvf",3,workReimbursement.getOfficeId(),"8",workReimbursement.getCreateBy());
+				if("0".equals(workReimbursement.getReimbursementType())){
+					users = UserUtils.getByRoleActivityEnname("zjbfzribvf",3,workReimbursement.getOfficeId(),"8",workReimbursement.getCreateBy());
+				}else if ("1".equals(workReimbursement.getReimbursementType())){
+					users = UserUtils.getByRoleActivityEnname("dzfpbxshybxsd",3,workReimbursement.getOfficeId(),"8",workReimbursement.getCreateBy());
+				}
 			}else  if ("gsld".equals(taskDefKey)){
 				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),3);
 				if (users==null )
 					users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),1);
 				//users = UserUtils.getByRoleActivityEnname("zjl",3,workReimbursement.getOfficeId(),"8",workReimbursement.getCreateBy());
+			}else  if ("fpglys".equals(taskDefKey) || "dzfpbxshybxsd".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),1);
 			}/*else  if ("zjl".equals(taskDefKey)){
 				*//*users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),5);
 				if (users==null )
@@ -245,7 +258,60 @@ public class WorkReimbursementNewController extends BaseController {
             if ("yes".equals(flag) &&(users==null || users.size()==0)){
 				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
 			}else {
-				String str = workReimbursementNewService.auditSave(workReimbursement,users);
+				String str = "";
+				if("0".equals(workReimbursement.getReimbursementType())){
+					str = workReimbursementNewService.auditSave(workReimbursement,users);
+				}else if ("1".equals(workReimbursement.getReimbursementType())){
+					str = workReimbursementNewService.electronicInvoiceReimbursementAuditSave(workReimbursement,users);
+				}
+				addMessage(redirectAttributes, str);
+			}
+		}catch (Exception e){
+			logger.info("Exception e:"+e);
+			addMessage(redirectAttributes, "审批失败");
+		}
+		if (StringUtils.isNotBlank(workReimbursement.getHome()) && "home".equals(workReimbursement.getHome())) {
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else if (StringUtils.isNotBlank(workReimbursement.getHome()) && "notifyList".equals(workReimbursement.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
+		} else {
+			return "redirect:" + Global.getAdminPath() + "/workreimbursement/workReimbursement/?repage";
+		}
+	}
+
+	/**
+	 * 工单执行(完成任务)(电子发票报销审核方法)
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "electronicInvoiceReimbursementSaveAudit")
+	public String electronicInvoiceReimbursementSaveAudit(WorkReimbursement workReimbursement, Model model,
+							RedirectAttributes redirectAttributes) {
+		try {
+			// 对不同环节的业务逻辑进行操作
+			String taskDefKey = workReimbursement.getAct().getTaskDefKey();
+			List<User> users = null;
+			if ("bmzr".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),2);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwzg", 3, workReimbursement.getOfficeId(), "8", workReimbursement.getCreateBy());
+			}else  if ("cw".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),1);
+				users = UserUtils.getByRoleActivityEnname("cwygevod",3,workReimbursement.getOfficeId(),"8",workReimbursement.getCreateBy());
+			}else  if ("fpglys".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),1);
+			}else if ("modifyApply".equals(taskDefKey)){
+				users = UserUtils.getByProssType(workReimbursement.getProcessInstanceId(),1);
+			}
+            String flag = workReimbursement.getAct().getFlag();
+            if ("yes".equals(flag) &&(users==null || users.size()==0)){
+				addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+			}else {
+				String str = workReimbursementNewService.electronicInvoiceReimbursementAuditSave(workReimbursement,users);
 				addMessage(redirectAttributes, str);
 			}
 		}catch (Exception e){

Різницю між файлами не показано, бо вона завелика
+ 4021 - 0
src/main/resources/freemarker/projectHSSignature.ftl


Різницю між файлами не показано, бо вона завелика
+ 2480 - 0
src/main/resources/freemarker/projectInternalAuditSignature.ftl


+ 0 - 23
src/main/resources/freemarker/projectSignature.ftl

@@ -1781,30 +1781,7 @@
 					<w:t>法定代表人:杨荣华</w:t>
 				</w:r>
 			</w:p>
-			<w:p wsp:rsidR="00000000"
-				 wsp:rsidRDefault="00D858D2">
-				<w:pPr>
-					<w:spacing w:after="78"/>
-					<w:ind w:first-line="560"/>
-					<w:rPr>
-						<w:rFonts w:ascii="宋体"
-								  w:h-ansi="宋体"
-								  w:hint="fareast"/>
-						<wx:font wx:val="宋体"/>
-						<w:sz w:val="28"/>
-					</w:rPr>
-				</w:pPr>
-				<w:r>
-					<w:rPr>
-						<w:rFonts w:ascii="宋体"
-								  w:h-ansi="宋体"
-								  w:hint="fareast"/>
-						<wx:font wx:val="宋体"/>
-						<w:sz w:val="28"/>
-					</w:rPr>
 
-				</w:r>
-			</w:p>
 			<w:p wsp:rsidR="00000000"
 				 wsp:rsidRDefault="00D858D2">
 				<w:pPr>

+ 12 - 3
src/main/resources/jeeplus.properties

@@ -6,10 +6,11 @@
 jdbc.type=mysql
 jdbc.driver=com.mysql.jdbc.Driver
 db.name=ruihuaoa-activity-data
-#jdbc.url=jdbc:mysql://192.168.2.4:3306/simple_xg_total_process?useUnicode=true&characterEncoding=utf-8
+#jdbc.url=jdbc:mysql://8.136.152.135:3306/new_ccpm?useUnicode=true&characterEncoding=utf-8
 jdbc.url=jdbc:mysql://127.0.0.1:3306/new_ccpm?useUnicode=true&characterEncoding=utf-8
 jdbc.username=root
 jdbc.password=root
+#jdbc.password=Xgcomdata10376@
 #jdbc.password=root
 
 #pool settings
@@ -311,13 +312,17 @@ reportedUrl = https://comp.jszj.com.cn:8031/api/addProject
 #company_parties_seal_id = 2895597212998434929
 ##审定单用印流程id
 #approval_category_id = 2895535120981852163
+##(自定义(页面签))审定单用印流程id
+#custom_approval_category_id = 3103876801745744240
 ##报告用印流程id
 #report_category_id = 2896237012158222343
+##内审报告用印流程id
+#report_internal_audit_category_id = 3117352569284948928
 ##审定内用印流程id
 #judgement_category_id = 2912238663717396786
-#审定单用印流程id(盐城)
+##审定单用印流程id(盐城)
 #approval_YC_category_id = 2933219658963918882
-#报告用印流程id(盐城)
+##报告用印流程id(盐城)
 #report_YC_category_id = 2933233335469383748
 
 #192.168.2.6签章测试参数
@@ -339,8 +344,12 @@ company_round_seal_id_vertical = 2898043523878957918
 company_parties_seal_id = 2894163220106129636
 #审定单用印流程id
 approval_category_id = 2895582833566102435
+#(自定义(页面签))审定单用印流程id
+custom_approval_category_id = 3103151250849833169
 #报告用印流程id
 report_category_id = 2895618951099527314
+#内审报告用印流程id
+report_internal_audit_category_id = 3116948624000492165
 ##审定内用印流程id
 judgement_category_id = 2920938119742709765
 #审定单用印流程id(盐城)

+ 456 - 0
src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceAlterDao.xml

@@ -0,0 +1,456 @@
+<?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="com.jeeplus.modules.filialeWorkInvoice.dao.FilialeWorkInvoiceAlterDao">
+
+	<sql id="workInvoiceColumns">
+		a.id AS "id",
+		a.number AS "number",
+		a.process_instance_id AS "processInstanceId",
+		a.client_id AS "client.id",
+		a.project_id AS "project.id",
+		a.project_name AS "projectName",
+		a.money AS "money",
+		a.invoice_type AS "invoiceType",
+		a.charge_type AS "chargeType",
+		a.content AS "content",
+		a.drawer_id AS "drawer.id",
+		a.office_id AS "office.id",
+		a.invoice_number AS "invoiceNumber",
+		a.invoice_date AS "invoiceDate",
+		a.drawer_name AS "drawerName",
+		a.take_date AS "takeDate",
+		a.invoice_remarks AS "invoiceRemarks",
+		a.is_invoice AS "isInvoice",
+		a.is_charge AS "isCharge",
+		a.is_invalid AS "isInvalid",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.orUnicode AS "orUnicode",
+		a.address AS "address",
+		a.telephone AS "telephone",
+		a.bank AS "bank",
+		a.bank_number AS "bankNumber",
+		a.cancle_reason AS "cancaleReason",
+		u.name AS "drawer.name",
+		so.top_company AS "office.name",
+		w.name AS "client.name",
+		p.project_name AS "project.projectName",
+		a.invoice_state AS "invoiceState",
+		p.project_id AS "project.projectId",
+		ci.name AS "project.workContractInfo.name",
+		w.usc_code AS "client.uscCode",
+		w.fax AS "client.fax",
+		w.or_unicode AS "client.orUnicode",
+		w.telephone AS "client.telephone",
+		a.company_id AS "companyId",
+		a.cancle_reason AS "cancleReason",
+		w.address AS "client.address",
+		a.officee_id AS "officeId",
+		a.province AS "province",
+		invoice_id AS "workInvoice.id",
+		a.ext AS "ext"
+	</sql>
+
+	<sql id="workInvoiceJoins">
+		LEFT JOIN sys_user u ON u.id = a.drawer_id
+		LEFT JOIN work_client_info w ON  w.id = a.client_id
+	  	LEFT JOIN rural_project_records p ON  p.id = a.project_id
+	  	left JOIN work_contract_info ci on ci.id = p.contract_id
+	  	JOIN sys_office o ON o.id = a.office_id
+		JOIN sys_office s ON s.id = a.company_id
+		left jOIN sys_office so ON so.id = a.office_id
+	</sql>
+
+
+	<select id="get" resultType="FilialeWorkInvoiceAlter" >
+		SELECT
+		<include refid="workInvoiceColumns"/>
+		FROM filiale_work_invoicealter a
+		<include refid="workInvoiceJoins"/>
+		WHERE a.id = #{id}
+	</select>
+
+	<select id="findList" resultType="FilialeWorkInvoiceAlter" >
+		SELECT
+		<include refid="workInvoiceColumns"/>
+		FROM filiale_work_invoicealter a
+		<include refid="workInvoiceJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="number != null and number != ''">
+				AND a.number = #{number}
+			</if>
+			<if test="invoiceState != null and invoiceState != ''">
+				AND a.invoice_state = #{invoiceState}
+			</if>
+			<if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
+				AND a.update_date BETWEEN #{beginContractDate} AND #{endContractDate}
+			</if>
+			<if test="client != null and client.id != null and client.id != ''">
+				AND a.client_id = #{client.id}
+			</if>
+			<if test="project != null and project.id != null and project.id != ''">
+				AND a.project_id = #{project.id}
+			</if>
+			<if test="project != null and project.projectId != null and project.projectId != ''">
+				AND p.project_id LIKE
+				<if test="dbName == 'oracle'">'%'||#{project.projectId}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{project.projectId}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{project.projectId},'%')</if>
+			</if>
+			<if test="project != null and project.projectName != null and project.projectName != ''">
+				AND p.project_name LIKE
+				<if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{project.projectName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{project.projectName},'%')</if>
+			</if>
+			<if test="client != null and client.name != null and client.name != ''">
+				AND w.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{client.name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{client.name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{client.name},'%')</if>
+			</if>
+			<if test="office != null and office.name != null and office.name != ''">
+				AND so.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{office.name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{office.name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{office.name},'%')</if>
+			</if>
+			<if test="money != null and money != ''">
+				AND a.money = #{money}
+			</if>
+			<if test="invoiceType != null and invoiceType != ''">
+				AND a.invoice_type = #{invoiceType}
+			</if>
+			<if test="chargeType != null and chargeType != ''">
+				AND a.charge_type = #{chargeType}
+			</if>
+			<if test="content != null and content != ''">
+				AND a.content = #{content}
+			</if>
+			<if test="drawer != null and drawer.id != null and drawer.id != ''">
+				AND a.drawer_id = #{drawer.id}
+			</if>
+			<if test="companyId != null and companyId != ''">
+				AND a.company_id = #{companyId}
+			</if>
+			<if test="office != null and office.id != null and office.id != ''">
+				AND a.office_id = #{office.id}
+			</if>
+			<if test="invoiceNumber != null and invoiceNumber != ''">
+				AND a.invoice_number LIKE
+				<if test="dbName == 'oracle'">'%'||#{invoiceNumber}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{invoiceNumber}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{invoiceNumber},'%')</if>
+			</if>
+			<if test="invoiceDate != null and invoiceDate != ''">
+				AND a.invoice_date = #{invoiceDate}
+			</if>
+			<if test="isInvoice != null and isInvoice != ''">
+				AND a.is_invoice = #{isInvoice}
+			</if>
+			<if test="isCharge != null and isCharge != ''">
+				AND a.is_charge = #{isCharge}
+			</if>
+			<if test="isInvalid != null and isInvalid != ''">
+				AND a.is_invalid = #{isInvalid}
+			</if>
+			${sqlMap.dsf}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findAllList" resultType="FilialeWorkInvoiceAlter" >
+		SELECT
+		<include refid="workInvoiceColumns"/>
+		FROM filiale_work_invoicealter a
+		<include refid="workInvoiceJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<update id="updateProcessInstanceId">
+		UPDATE filiale_work_invoicealter SET
+			process_instance_id = #{processInstanceId}
+		WHERE id = #{id}
+	</update>
+
+	<insert id="insert">
+		INSERT INTO filiale_work_invoicealter(
+			id,
+			number,
+			client_id,
+			project_id,
+			project_name,
+			money,
+			invoice_type,
+			charge_type,
+			content,
+			drawer_id,
+			office_id,
+			invoice_number,
+			invoice_date,
+			drawer_name,
+			take_date,
+			invoice_remarks,
+			is_invoice,
+			is_charge,
+			is_invalid,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			invoice_state,
+			orUnicode,
+			address,
+			telephone,
+			bank,
+			company_id,
+			bank_number,
+			cancle_reason,
+			officee_id,
+			province,
+			invoice_id,
+			ext
+		) VALUES (
+			#{id},
+			#{number},
+			#{client.id},
+			#{project.id},
+			#{projectName},
+			#{money},
+			#{invoiceType},
+			#{chargeType},
+			#{content},
+			#{drawer.id},
+			#{office.id},
+			#{invoiceNumber},
+			#{invoiceDate},
+			#{drawerName},
+			#{takeDate},
+			#{invoiceRemarks},
+			#{isInvoice},
+			#{isCharge},
+			#{isInvalid},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{invoiceState},
+			#{orUnicode},
+			#{address},
+			#{telephone},
+			#{bank},
+			#{companyId},
+			#{bankNumber},
+			#{cancleReason},
+			#{officeId},
+			#{province},
+			#{workInvoice.id},
+			#{ext}
+		)
+	</insert>
+
+	<update id="update">
+		UPDATE filiale_work_invoicealter SET
+			number = #{number},
+			client_id = #{client.id},
+			invoice_id = #{workInvoice.id},
+			project_id = #{project.id},
+			project_name = #{projectName},
+			money = #{money},
+			invoice_type = #{invoiceType},
+			charge_type = #{chargeType},
+			content = #{content},
+			drawer_id = #{drawer.id},
+			office_id = #{office.id},
+			invoice_number = #{invoiceNumber},
+			invoice_date = #{invoiceDate},
+			drawer_name = #{drawerName},
+			take_date = #{takeDate},
+			invoice_remarks = #{invoiceRemarks},
+			is_invoice = #{isInvoice},
+			is_charge = #{isCharge},
+			is_invalid = #{isInvalid},
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			invoice_state=#{invoiceState},
+			orUnicode=#{orUnicode},
+			address=#{address},
+			telephone=#{telephone},
+			bank=#{bank},
+			company_id = #{companyId},
+			bank_number=#{bankNumber},
+			cancle_reason=#{cancleReason},
+			officee_id=#{officeId},
+			province = #{province},
+			ext = #{ext}
+		WHERE id = #{id}
+	</update>
+
+
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM filiale_work_invoicealter
+		WHERE id = #{id}
+	</update>
+
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE filiale_work_invoicealter SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+
+
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="FilialeWorkInvoiceAlter" statementType="STATEMENT">
+		select * FROM filiale_work_invoicealter  where ${propertyName} = '${value}'
+	</select>
+
+	<select id="findListByclient" resultType="WorkClientInfo">
+		SELECT
+		*
+		FROM work_client_info a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="companyId != null and companyId != ''">
+				AND a.company_id = #{companyId}
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+				<if test="dbName == 'mysql'">CONCAT('%', #{name}, '%')</if>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	<!--<select id="findListByproject" resultType="WorkBidProject">-->
+	<!--SELECT -->
+	<!--*-->
+	<!--FROM work_client_info a-->
+	<!--<where>-->
+	<!--a.del_flag = #{DEL_FLAG_NORMAL}-->
+	<!--<if test="name != null and name != ''">-->
+	<!--AND a.project.name LIKE -->
+	<!--<if test="dbName == 'oracle'">#{name}||'%'</if>-->
+	<!--<if test="dbName == 'mssql'">#{name}+'%'</if>-->
+	<!--<if test="dbName == 'mysql'">concat(#{name},'%')</if>-->
+	<!--</if>-->
+	<!--</where>-->
+	<!--<choose>-->
+	<!--<when test="page !=null and page.orderBy != null and page.orderBy != ''">-->
+	<!--ORDER BY ${page.orderBy}-->
+	<!--</when>-->
+	<!--<otherwise>-->
+	<!--ORDER BY a.update_date DESC-->
+	<!--</otherwise>-->
+	<!--</choose>-->
+	<!--</select>-->
+
+	<select id="getByProcInsId" resultType="FilialeWorkInvoiceAlter">
+		SELECT
+		<include refid="workInvoiceColumns"/>
+		FROM filiale_work_invoicealter a
+		<include refid="workInvoiceJoins"/>
+		WHERE a.process_instance_id = #{processInstanceId}
+	</select>
+
+	<select id="findListByproject" resultType="WorkBidProject">
+		select
+		a.id AS "id",
+		a.project_number AS "projectNumber",
+		a.project_name AS "projectName",
+		a.project_type AS "projectType",
+		a.type_explain AS "typeExplain",
+		a.project_source AS "projectSource",
+		a.source_explain AS "sourceExplain",
+		a.is_ext AS "isExt",
+		a.bid_company AS "bidCompany.id",
+		a.ext_company AS "extCompany",
+		a.contacts AS "contacts",
+		a.registration_date AS "registrationDate",
+		a.bid_date AS "bidDate",
+		a.trial_date AS "trialDate",
+		a.trial_type AS "trialType",
+		a.document_cost AS "documentCost",
+		a.purchase_date AS "purchaseDate",
+		a.bind_cost AS "bindCost",
+		a.other_cost AS "otherCost",
+		a.bid_bond AS "bidBond",
+		a.bond_style AS "bondStyle",
+		a.refund_date AS "refundDate",
+		a.offer AS "offer",
+		a.is_bid AS "isBid",
+		a.implementing_dept AS "implementingDept.id",
+		a.is_subcontract AS "isSubcontract",
+		a.subcontract_company AS "subcontractCompany",
+		a.project_situation AS "projectSituation",
+		a.status AS "status",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.work_project_id AS "workProject.id"
+		FROM work_client_info w
+		LEFT JOIN work_bid_project a on w.id = a.bid_company
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<!--<if-->
+			<if test="bidCompany != null  and bidCompany.id != null and bidCompany.id != ''">
+				AND a.bid_company =  #{bidCompany.id}
+			</if>
+			<if test="companyId != null and companyId != ''">
+				AND (a.company_id = #{companyId} or find_in_set(a.company_id ,#{parentIds}))
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE
+				<if test="dbName == 'oracle'">#{name}||'%'</if>
+				<if test="dbName == 'mssql'">#{name}+'%'</if>
+				<if test="dbName == 'mysql'">concat(#{name},'%')</if>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+</mapper>

Різницю між файлами не показано, бо вона завелика
+ 2623 - 0
src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceDao.xml


+ 617 - 0
src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceDetailDao.xml

@@ -0,0 +1,617 @@
+<?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="com.jeeplus.modules.filialeWorkInvoice.dao.FilialeWorkInvoiceDetailDao">
+
+	<sql id="workInvoiceDetailColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.code AS "code",
+		a.number AS "number",
+		a.total_money AS "totalMoney",
+		a.tax AS "tax",
+		a.tax_money AS "taxMoney",
+		a.tax_rate AS "taxRate",
+		a.income_money AS "incomeMoney",
+		a.date AS "date",
+		a.return_id AS "returnId",
+		w1.ext AS "invoiceExt",
+		w1.invoice_type AS "invoiceInvoiceType",
+		w2.name AS "invoiceClientName",
+		w1.orUnicode AS "invoiceOrUnicode",
+		w1.content AS "invoiceContent",
+		w1.remarks AS "invoiceRemarks",
+		a.state AS "state",
+		a.back_sign AS "backSign",
+		a.back_number AS "backNumber",
+		a.back_code AS "backCode",
+		w1.number AS "invocieNumber",
+		w1.drawer_name AS "invoiceDrawerName",
+		s2.top_company AS "invoiceOfficeName",
+		w3.contract_num AS "contractNum",
+		w3.name AS "contractName",
+		w4.name AS "contractClientName",
+		a.status AS "status",
+		a.return_number AS "returnNumber",
+		a.return_reason AS "returnReason",
+		a.return_cancle AS "returnCancle",
+		a.return_sign AS "returnSign",
+		a.return_date AS "returnDate",
+		a.return_user AS "returnUser",
+		a.process_instance_id AS "processInstanceId",
+		a.sign AS "sign",
+		a.company_id AS "comId",
+		a.office_id AS "officeId",
+		a.ainvoice_id AS "ainvoiceId",
+		a.invoice_id AS "invoiceId",
+		w2.name As "workInvoice.client.name",
+		s2.top_company AS "workInvoice.office.name",
+		wir.return_number AS "returnNumbers",
+		a.settle_flag AS "settleFlag"
+	</sql>
+
+	<sql id="workInvoiceDetailColumn">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.number AS "number",
+		a.total_money AS "totalMoney",
+		a.tax AS "tax",
+		a.return_id AS "returnId",
+		a.tax_money AS "taxMoney",
+		a.tax_rate AS "taxRate",
+		a.income_money AS "incomeMoney",
+		a.state AS "state",
+		a.back_sign AS "backSign",
+		a.back_number AS "backNumber",
+		a.back_code AS "backCode",
+		a.date AS "date",
+		a.code AS "code",
+		a.status AS "status",
+		a.return_number AS "returnNumber",
+		a.return_reason AS "returnReason",
+		a.return_cancle AS "returnCancle",
+		a.return_sign AS "returnSign",
+		a.return_date AS "returnDate",
+		a.return_user AS "returnUser",
+		a.process_instance_id AS "processInstanceId",
+		a.sign AS "sign",
+		a.ainvoice_id AS "ainvoiceId",
+		a.invoice_id AS "invoiceId",
+		a.settle_flag AS "settleFlag"
+	</sql>
+
+	<sql id="workInvoiceDetailJoins">
+		left join filiale_work_invoice w1 on w1.id = a.invoice_id
+		LEFT JOIN work_client_info w2 ON  w2.id = w1.client_id
+		left join sys_office s2 on s2.id = w1.office_id
+		left join project_records p on p.id = w1.project_id
+		left join work_contract_info w3 on w3.id = p.contract_id
+		left join work_client_info w4 on w4.id = w3.client_id
+		left join sys_office o ON o.id = a.office_id
+		left join sys_office s ON s.id = a.company_id
+		left join filiale_work_invoicereturn wir on wir.invoice_id =a.return_id
+	</sql>
+
+
+	<select id="get" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+			<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		WHERE a.id = #{id}
+	</select>
+
+	<select id="findList" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+			<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL} and a.back_sign !='冲销'
+			<if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
+				AND a.date BETWEEN #{beginContractDate} AND #{endContractDate}
+			</if>
+			<if test="number != null and number != ''">
+				AND a.number = #{number}
+			</if>
+			<if test="state != null and state != ''">
+				AND a.state = #{state}
+			</if>
+			<if test="invoiceId != null and invoiceId != ''">
+				AND a.invoice_id = #{invoiceId}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findListByContractInfo" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+		<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			AND w3.id = #{id}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findListReturn" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+		DISTINCT
+		<include refid="workInvoiceDetailColumn"/>
+		FROM
+		filiale_work_invoice_detail a
+		left join sys_office o ON o.id = a.office_id
+		left join sys_office s ON s.id = a.company_id
+		LEFT JOIN filiale_work_invoice w ON w.id = a.invoice_id
+		LEFT JOIN filiale_work_invoicereturn wir on a.id = wir.invoice_id
+		LEFT JOIN project_records p ON w.project_id = p.id
+		LEFT JOIN work_project_user wp ON p.id = wp.project_id
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL} and a.income_money = '0' and (wir.status is null or wir.status = '5') and w.invoice_type is not null
+			and w.invoice_state = '5'
+			<if test="state != null and state != ''">
+				AND a.state = #{state}
+			</if>
+			<if test="backSign != null and backSign != ''">
+				AND a.back_sign = #{backSign}
+			</if>
+			<if test="createBy != null and createBy.id != null and createBy.id != ''">
+				AND w.create_by = #{createBy.id}
+			</if>
+			<if test="createBy != null and createBy.id != null and createBy.id != ''">
+				AND wp.user_id = #{createBy.id}
+			</if>
+			/*${sqlMap.dsf}*/
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="afindList" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+			a.id AS "id",
+			a.create_by AS "createBy.id",
+			a.create_date AS "createDate",
+			a.update_by AS "updateBy.id",
+			a.update_date AS "updateDate",
+			a.remarks AS "remarks",
+			a.del_flag AS "delFlag",
+			a.number AS "number",
+			a.total_money AS "totalMoney",
+			a.tax AS "tax",
+			a.tax_money AS "taxMoney",
+			a.tax_rate AS "taxRate",
+			a.income_money AS "incomeMoney",
+			a.state AS "state",
+			a.back_sign AS "backSign",
+			a.back_number AS "backNumber",
+			a.back_code AS "backCode",
+			a.return_id AS "returnId",
+			a.date AS "date",
+			a.code AS "code",
+			a.status AS "status",
+			a.return_number AS "returnNumber",
+			a.return_reason AS "returnReason",
+			a.return_cancle AS "returnCancle",
+			a.return_sign AS "returnSign",
+			a.return_date AS "returnDate",
+			a.return_user AS "returnUser",
+			a.process_instance_id AS "processInstanceId",
+			a.sign AS "sign",
+			w2.name As "workInvoice.client.name",
+			s2.name AS "workInvoice.office.name",
+			a.company_id AS "comId",
+			a.office_id AS "officeId",
+			a.ainvoice_id AS "ainvoiceId",
+			a.invoice_id AS "invoiceId"
+		FROM filiale_work_invoice_detail a
+			left join filiale_work_invoicealter w1 on w1.id = a.ainvoice_id
+			LEFT JOIN work_client_info w2 ON  w2.id = w1.client_id
+			left join sys_office s2 on s2.id = w1.office_id
+			JOIN sys_office o ON o.id = a.office_id
+			JOIN sys_office s ON s.id = a.company_id
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="number != null and number != ''">
+				AND a.number = #{number}
+			</if>
+			<if test="state != null and state != ''">
+				AND a.state = #{state}
+			</if>
+			<if test="ainvoiceId != null and ainvoiceId != ''">
+				AND a.ainvoice_id = #{ainvoiceId}
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findLists" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+		<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL} and w1.del_flag = 0 and w2.del_flag = 0 and p.del_flag = 0 and w3.del_flag = 0 and w4.del_flag = 0
+			and w1.invoice_type is not null
+			<if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
+				AND a.date BETWEEN #{beginContractDate} AND #{endContractDate}
+			</if>
+			<if test="workInvoice !=null and workInvoice.client != null and workInvoice.client.name != null and workInvoice.client.name != ''">
+				AND w2.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{workInvoice.client.name}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{workInvoice.client.name}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{workInvoice.client.name},'%')</if>
+			</if>
+			<if test="invoiceDrawerName !=null and invoiceDrawerName != ''">
+				AND w1.drawer_name LIKE
+				<if test="dbName == 'oracle'">'%'||#{invoiceDrawerName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{invoiceDrawerName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{invoiceDrawerName},'%')</if>
+			</if>
+			<if test="invoiceOfficeName !=null and invoiceOfficeName != ''">
+				AND s2.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{invoiceOfficeName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{invoiceOfficeName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{invoiceOfficeName},'%')</if>
+			</if>
+			<if test="contractName !=null and contractName != ''">
+				AND w3.name LIKE
+				<if test="dbName == 'oracle'">'%'||#{contractName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{contractName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{contractName},'%')</if>
+			</if>
+			<if test="number != null and number != ''">
+				AND a.number = #{number}
+			</if>
+			<if test="state != null and state != ''">
+				AND a.state = #{state}
+			</if>
+			<if test="invoiceInvoiceType != null and invoiceInvoiceType != ''">
+				AND w1.invoice_type = #{invoiceInvoiceType}
+			</if>
+			<if test="status != null and status != ''">
+				AND a.status = #{status}
+			</if>
+			<if test="invoiceId != null and invoiceId != ''">
+				AND a.invoice_id = #{invoiceId}
+			</if>
+			${sqlMap.dsf}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findAllList" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+			<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="findByCode" resultType="FilialeWorkInvoiceDetail" >
+		SELECT
+		<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			and a.code = #{code} and a.number = #{number}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<insert id="insert">
+		INSERT INTO filiale_work_invoice_detail(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			number,
+			total_money,
+			tax,
+			tax_money,
+			tax_rate,
+			income_money,
+			state,
+			back_sign,
+			back_number,
+			back_code,
+			date,
+			code,
+			status,
+			return_number,
+			return_reason,
+			return_cancle,
+			return_sign,
+			return_date,
+			return_user,
+			process_instance_id,
+			sign,
+			company_id,
+			office_id,
+			ainvoice_id,
+			invoice_id,
+			return_id,
+			settle_flag
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{number},
+			#{totalMoney},
+			#{tax},
+			#{taxMoney},
+			#{taxRate},
+			#{incomeMoney},
+			#{state},
+			#{backSign},
+			#{backNumber},
+			#{backCode},
+			#{date},
+			#{code},
+			#{status},
+			#{returnNumber},
+			#{returnReason},
+			#{returnCancle},
+			#{returnSign},
+			#{returnDate},
+			#{returnUser},
+			#{processInstanceId},
+			#{sign},
+			#{comId},
+			#{officeId},
+			#{ainvoiceId},
+			#{invoiceId},
+			#{returnId},
+			#{settleFlag}
+		)
+	</insert>
+
+	<update id="update">
+		UPDATE filiale_work_invoice_detail SET
+			<if test="updateBy.id!=null and updateBy.id!=''">
+				update_by = #{updateBy.id},
+			</if>
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			number = #{number},
+			total_money = #{totalMoney},
+			tax = #{tax},
+			tax_money = #{taxMoney},
+			tax_rate = #{taxRate},
+			income_money = #{incomeMoney},
+			state = #{state},
+			back_sign = #{backSign},
+			back_number = #{backNumber},
+			back_code = #{backCode},
+			date = #{date},
+			code = #{code},
+			status = #{status},
+			return_number = #{returnNumber},
+			return_reason = #{returnReason},
+			return_cancle = #{returnCancle},
+			return_sign = #{returnSign},
+			return_date = #{returnDate},
+			return_user = #{returnUser},
+			process_instance_id = #{processInstanceId},
+			sign = #{sign},
+			company_id = #{comId},
+			office_id=#{officeId},
+			ainvoice_id = #{ainvoiceId},
+			invoice_id = #{invoiceId},
+			return_id = #{returnId},
+			settle_flag = #{settleFlag}
+		WHERE id = #{id}
+	</update>
+
+
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM filiale_work_invoice_detail
+		WHERE id = #{id}
+	</update>
+
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE filiale_work_invoice_detail SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+
+	<update id="updateProcessInstanceId">
+		UPDATE filiale_work_invoice_detail SET
+		process_instance_id = #{processInstanceId}
+		WHERE id = #{id}
+	</update>
+
+	<update id="updateByCode">
+		UPDATE filiale_work_invoice_detail SET
+		code = #{code},
+		number = #{number}
+		WHERE id = #{id}
+	</update>
+
+	<!-- 获取流程ID -->
+	<select id="getByProcessInstanceId" resultType="FilialeWorkInvoiceDetail">
+		SELECT
+		<include refid="workInvoiceDetailColumns"/>
+		FROM filiale_work_invoice_detail a
+		<include refid="workInvoiceDetailJoins"/>
+		WHERE a.process_instance_id = #{processInstanceId}
+	</select>
+
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="FilialeWorkInvoiceDetail" statementType="STATEMENT">
+		select * FROM filiale_work_invoice_detail  where ${propertyName} = '${value}'
+	</select>
+
+    <select id="findListWithDept" resultType="FilialeWorkInvoiceDetail" >
+        SELECT
+        <include refid="workInvoiceDetailColumn"/>
+        FROM filiale_work_invoice wi
+          LEFT JOIN  filiale_work_invoice_detail a ON wi.id=a.invoice_id
+        LEFT JOIN filiale_work_invoicereturn ir ON ir.invoice_id = a.id
+        <where>
+            <if test="comId!=null and comId!=''">
+                AND wi.company_id = #{comId}
+            </if>
+            <if test="officeId!=null and officeId!=''">
+                AND wi.office_id = #{officeId}
+            </if>
+            <if test="number != null and number != ''">
+                AND a.number = #{number}
+            </if>
+            <if test="state != null and state != ''">
+                AND a.state = #{state}
+            </if>
+            <!--<if test="backSign != null and backSign != ''">-->
+                <!--AND a.back_sign = #{backSign}-->
+            <!--</if>-->
+            <if test="exclusiveIds!=null">
+                AND a.id NOT IN
+                <foreach collection="exclusiveIds" item="exid" index="index"
+                         open="(" close=")" separator=",">
+                    #{exid}
+                </foreach>
+            </if>
+			AND wi.invoice_state = '5'
+--             AND a.total_money+0 > a.income_money+0
+            AND wi.del_flag = #{DEL_FLAG_NORMAL}
+            AND a.del_flag = #{DEL_FLAG_NORMAL}
+            AND ir.id IS NULL
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY a.update_date DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findPageByCompany" resultType="FilialeWorkInvoiceDetail" >
+        SELECT
+        <include refid="workInvoiceDetailColumn"/>
+        FROM filiale_work_invoice wi
+        LEFT JOIN  filiale_work_invoice_detail a ON wi.id=a.invoice_id
+        LEFT JOIN sys_office o ON o.id = wi.office_id
+        <where>
+            <if test="comId!=null and comId!=''">
+                AND wi.company_id = #{comId} AND wi.ext = '1'
+            </if>
+            <choose>
+                <when test="currentUser.branchOffice!=null and currentUser.branchOffice.id!=null and currentUser.branchOffice.id!=''">
+                    AND find_in_set(#{currentUser.branchOffice.id},o.parent_ids)
+                </when>
+                <otherwise>
+                    AND find_in_set(#{currentUser.company.id},o.parent_ids) AND (o.branch_office IS NULL || o.branch_office ='')
+                </otherwise>
+            </choose>
+            <if test="exclusiveIds!=null">
+                AND a.id NOT IN
+                <foreach collection="exclusiveIds" item="exid" index="index"
+                         open="(" close=")" separator=",">
+                    #{exid}
+                </foreach>
+            </if>
+            AND (a.settle_flag = '0' or a.settle_flag is NULL )
+            AND wi.del_flag = #{DEL_FLAG_NORMAL}
+            AND a.del_flag = #{DEL_FLAG_NORMAL}
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY a.update_date DESC
+            </otherwise>
+        </choose>
+    </select>
+
+    <update id="updateSettleFlag">
+        UPDATE filiale_work_invoice_detail SET
+		settle_flag = #{settleFlag}
+		WHERE id = #{id}
+    </update>
+
+	<select id="countByNumber" resultType="int">
+		SELECT count(1) from filiale_work_invoice_detail WHERE  number = #{number}
+	</select>
+
+	<select id="countByNumAndComp" resultType="int">
+		SELECT count(1) from filiale_work_invoice_detail a
+		left join filiale_work_invoice b on a.invoice_id = b.id
+		WHERE  a.number = #{invoiceNum} AND a.company_id = #{comId}
+		and b.invoice_state != 7
+	</select>
+</mapper>

+ 0 - 0
src/main/resources/mappings/modules/filialeWorkInvoice/FilialeWorkInvoiceReceiptDao.xml


Деякі файли не було показано, через те що забагато файлів було змінено