Parcourir la source

修改审计咨询意见单不要小数

qianxb il y a 1 an
Parent
commit
76ecee0347

+ 6 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMeterPeriodController.java

@@ -126,6 +126,12 @@ public class ContractMeterPeriodController extends BladeController {
 						throw new ServiceException("上一期结束日期和下一期的开始日期必须连续");
 					}
 				}
+				/*需求修改-开始日期在上一次结束日期之后就行 */
+//				if (lastDate != null) {
+//					if (lastDate.compareTo(period.getStartDate()) >= 0) {
+//						throw new ServiceException("下一期的开始日期必须在上一期结束日期之后");
+//					}
+//				}
 				//判断判断开始日期是否大于结束日期
 				if (period.getEndDate().compareTo(period.getStartDate()) == -1){
 					throw new ServiceException("结束日期必须大于开始日期");

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/InterimPayCertificateController.java

@@ -69,7 +69,7 @@ public class InterimPayCertificateController extends BladeController {
 			interimPayCertificate.setPeriodNumber(contractMeterPeriod.getPeriodNumber());
 		}
 		interimPayCertificateService.add(interimPayCertificate);
-		//taskController.calculate(interimPayCertificate.getId().toString(),0);
+		taskController.calculate(interimPayCertificate.getId().toString(),0);
 		return R.success("新增成功");
 	}
 

+ 52 - 14
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -8,6 +8,7 @@ import com.aspose.cells.PageSetup;
 import com.aspose.cells.SaveFormat;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -86,6 +87,7 @@ import java.io.*;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -1378,6 +1380,7 @@ public class TaskController extends BladeController {
                 if (reportAllMoney == null || reportAllMoney.compareTo(BigDecimal.ZERO) == 0){
                     throw new ServiceException("上报金额不能为0");
                 }
+                reportAllMoney =reportAllMoney.setScale(0,RoundingMode.HALF_UP);
                 vo.setReportAllMoney(reportAllMoney);
                 if (task.getIsBuildAudit() == 1) {
                     PeriodVO periodVO = null;
@@ -1408,8 +1411,13 @@ public class TaskController extends BladeController {
                                 }
                                 WbsTreePrivate aPrivate = r.getData();
                                 //获取所有的key
-                                Map<String, String> map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
-//                            Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
+                                Map<String, String> map = new HashMap<>();
+                                String os = System.getProperty("os.name").toLowerCase();
+                                if (os.contains("win")) {
+                                    map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1808346073870106624.html");
+                                } else {
+                                    map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
+                                }
                                 if (map.size() == 0) {
                                     throw new ServiceException("未获取到html中的keyName");
                                 }
@@ -1433,6 +1441,7 @@ public class TaskController extends BladeController {
                                     }
 
                                     if (beforeMoney != null) {
+                                        beforeMoney = beforeMoney.setScale(0,RoundingMode.HALF_UP);
                                         tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"), beforeMoney);
                                     }
                                     tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
@@ -2580,6 +2589,9 @@ public class TaskController extends BladeController {
                         reportId = inData2.getId() + "";
                     } else {
                         reportId = inData.getId() + "";
+                        interimPayCertificateService.update(new LambdaUpdateWrapper<InterimPayCertificate>()
+                                .eq(InterimPayCertificate::getId,reportId)
+                                .set(InterimPayCertificate::getPayMoney,currentMeterMoney));
                     }
                 }
                 /**计量公式执行 0中间,1材料,2开工*/
@@ -2639,8 +2651,13 @@ public class TaskController extends BladeController {
                     }
                     WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
                     //获取所有的key
-                    Map<String, String> map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
-//                    Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
+                    Map<String, String> map = new HashMap<>();
+                    String os = System.getProperty("os.name").toLowerCase();
+                    if (os.contains("win")) {
+                        map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1808346073870106624.html");
+                    } else {
+                        map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
+                    }
                     if (map.size() == 0){
                         throw new ServiceException("未获取到html中的keyName");
                     }
@@ -2673,15 +2690,21 @@ public class TaskController extends BladeController {
                     Task updateTask = new Task();
                     updateTask.setId(task.getId());
                     Map<String, Object> tableData = dto.getTableData();
+                    Object ob = tableData.get(map.get("要求付款额度"));
+                    if (ob != null){
+                        BigDecimal decimal = new BigDecimal(ob.toString()).setScale(0,RoundingMode.HALF_UP);
+                        tableData.put(map.get("要求付款额度"), decimal);
+                    }
                     Object object = tableData.get(map.get("造价机构现场咨询意见_本期审核进度款(元)"));
                     if (object != null) {
                         try {
-                            BigDecimal decimal = new BigDecimal(object.toString());
+                            BigDecimal decimal = new BigDecimal(object.toString()).setScale(0,RoundingMode.HALF_UP);
+                            tableData.put(map.get("造价机构现场咨询意见_本期审核进度款(元)"), decimal);
                             updateTask.setTaskCommonMoney(decimal);
                             Object object2 = tableData.get(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"));
                             if (object2 != null) {
-                                BigDecimal decimal2 = new BigDecimal(object2.toString());
-                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal.add(decimal2));
+                                BigDecimal decimal2 = new BigDecimal(object2.toString()).setScale(0,RoundingMode.HALF_UP);
+                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal.add(decimal2).setScale(0,RoundingMode.HALF_UP));
                             } else {
                                 tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal);
                             }
@@ -2762,7 +2785,7 @@ public class TaskController extends BladeController {
         Object object2 = tableData.get(key);
         if (object2 != null) {
             try {
-                BigDecimal decimal = new BigDecimal(object2.toString());
+                BigDecimal decimal = new BigDecimal(object2.toString()).setScale(0, RoundingMode.HALF_UP);
                 tableData.put(key,decimal.toString()+"元");
             }catch (Exception e){
                 throw new ServiceException("金额格式不对");
@@ -3172,6 +3195,13 @@ public class TaskController extends BladeController {
     @ApiOperationSupport(order = 22)
     @ApiOperation(value = "计量生成Pdf", notes = "计量生成Pdf")
     public R meterPdfInfo(@RequestParam String reportId, @RequestParam Integer type) {
+        /*加锁*/
+        String redisValue = bladeRedis.get("blade:meter::meterPdfInfo:reportId-" +  reportId);
+        if (StringUtils.isNotBlank(redisValue) && redisValue.equals("1")) {
+            throw new ServiceException("重新计算中,请等待");
+        }
+        bladeRedis.set("blade:meter::meterPdfInfo:reportId-" + reportId, "1");
+        bladeRedis.expire("blade:meter::meterPdfInfo:reportId-" +  reportId, 5);
         return calculate(reportId, type);
     }
 
@@ -3739,7 +3769,7 @@ public class TaskController extends BladeController {
         String fileUrl = null;
         String os = System.getProperty("os.name").toLowerCase();
         if (os.contains("win")) {
-            fileUrl = "C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html";
+            fileUrl = "C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1808346073870106624.html";
         } else {
             fileUrl = aPrivate.getHtmlUrl();
         }
@@ -3796,8 +3826,13 @@ public class TaskController extends BladeController {
 
         //数据不为空,构造数据
         String fileUrl = aPrivate.getHtmlUrl();
-        File file1 = ResourceUtil.getFile(fileUrl);
-//        File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
+        File file1 = null;
+        String os = System.getProperty("os.name").toLowerCase();
+        if (os.contains("win")) {
+            file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1808346073870106624.html");
+        } else {
+            file1 = ResourceUtil.getFile(fileUrl);
+        }
         InputStream fileInputStream;
         if (file1.exists()) {
             fileInputStream = new FileInputStream(file1);
@@ -3813,7 +3848,7 @@ public class TaskController extends BladeController {
         org.jsoup.nodes.Document doc = Jsoup.parse(htmlString);
         Element table = doc.select("table").first();
         Elements trs = table.select("tr");
-
+        System.out.println("----------------------组装电签---------------------------");
         //实际电签人
         Set<User> sigUser = new HashSet<>();
         List<TextdictInfo> infoList = jdbcTemplate.query("select * from m_textdict_info where type in (2,6) and tab_id = " + aPrivate.getPKeyId(), new BeanPropertyRowMapper<>(TextdictInfo.class));
@@ -3867,7 +3902,8 @@ public class TaskController extends BladeController {
                 htmlDeptIdMap.put(textdictInfo.getId(),textdictInfo.getSigRoleName()+"123");
             }
         }
-
+        //过滤去除为null的key
+        DataInfo.remove(null);
         if (ObjectUtil.isNotEmpty(DataInfo)) {
             for (String val : Objects.requireNonNull(DataInfo).keySet()) {
                 if (val.contains("__")) {
@@ -4004,6 +4040,8 @@ public class TaskController extends BladeController {
                                 newStyle.setFont(redFont);
                                 cell.setCellStyle(newStyle);
                                 String sig = htmlDeptIdMap.get(e.getId());
+//                                String other = StringUtils.isBlank(cell.getStringCellValue())?"":cell.getStringCellValue();
+//                                cell.setCellValue(sig+","+other);
                                 cell.setCellValue(sig);
                             } else {
                                 ObjectUtils.isNotEmpty(cell);
@@ -4021,7 +4059,7 @@ public class TaskController extends BladeController {
 
         FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
-
+        System.out.println("----------------------处理证书---------------------------");
         if (bladeFile != null) {
             //获取所有专家个人证书
             List<SignPfxFile> list = jdbcTemplate.query(" select * from m_sign_pfx_file where is_deleted = 0  and certificate_user_id in ("+sigUser.stream().map(User::getId).distinct().map(Objects::toString).collect(Collectors.joining(",")) +")", new BeanPropertyRowMapper<>(SignPfxFile.class));