yangyj 1 year ago
parent
commit
22ce3f3c8c

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ConstructionSchedule.java

@@ -102,6 +102,10 @@ public class ConstructionSchedule implements  DataModel{
     /**合同概要*/
     @JSONField(name = "key_24",label="合同概要-ZJ",ordinal = 106)
     private String contractSummary;
+
+    @JSONField(name = "key_30",label="计划年",ordinal = 101)
+    private String planYear;
+
     @JSONField(name = "key_69",label="共N页" ,ordinal = 101)
     private String pageTotal;
     @JSONField(name = "key_68",label="第N页" ,ordinal = 101)

+ 11 - 7
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java

@@ -1276,11 +1276,11 @@ public class FormulaUtils {
         return null;
     }
 
-    public static String  chapterScheduleChartUrl( LinkedHashMap<Long,Double> actualMap, LinkedHashMap<Long,Double> plannedMap,int startYear,int endYear){
+    public static String  chapterScheduleChartUrl( LinkedHashMap<Integer,Double> actualMap, LinkedHashMap<Integer,Double> plannedMap,int startYear,int endYear){
           try {
               JFreeChart chart =chartTest(actualMap,plannedMap, startYear, endYear);
               String path= getSysLocalFileUrl() + "/pdf//"+SnowFlakeUtil.getId()+".png";
-            ChartUtils.saveChartAsPNG(new File(path), chart, 800, 600);
+            ChartUtils.saveChartAsPNG(new File(path), chart, 1200, 900);
             return path;
         } catch (Exception e) {
             e.printStackTrace();
@@ -1365,7 +1365,7 @@ public class FormulaUtils {
 
        return chart;
     }
-    public static JFreeChart chartTest(LinkedHashMap<Long,Double> actualMap, LinkedHashMap<Long,Double> plannedMap,int startYear,int endYear) {
+    public static JFreeChart chartTest(LinkedHashMap<Integer,Double> actualMap, LinkedHashMap<Integer,Double> plannedMap,int startYear,int endYear) {
         // 创建完整的数据集
         XYSeriesCollection dataset = new XYSeriesCollection();
 
@@ -1380,8 +1380,12 @@ public class FormulaUtils {
         XYSeries plannedSeries = new XYSeries("计划进度");
 
         // 填充数据系列
-        actualMap.forEach(actualSeries::add);
-        plannedMap.forEach(plannedSeries::add);
+        actualMap.forEach((yearMonth,ratio)->{
+            actualSeries.add(BaseUtils.getTimeMs(yearMonth/100,yearMonth%100),ratio);
+        });
+        plannedMap.forEach((yearMonth,ratio)->{
+            plannedSeries.add(BaseUtils.getTimeMs(yearMonth/100,yearMonth%100),ratio);
+        });
         dataset.addSeries(actualSeries);
         dataset.addSeries(plannedSeries);
 
@@ -1433,8 +1437,8 @@ public class FormulaUtils {
         return chart;
     }
     public static void main2(String[] args) throws IOException {
-        LinkedHashMap<Long,Double> actualProgress = new LinkedHashMap<>();
-        LinkedHashMap<Long,Double> plannedProgress = new LinkedHashMap<>();
+        LinkedHashMap<Integer,Double> actualProgress = new LinkedHashMap<>();
+        LinkedHashMap<Integer,Double> plannedProgress = new LinkedHashMap<>();
 
         JFreeChart chart = chartTest(actualProgress,plannedProgress,2023,2025);
 /*        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {

+ 60 - 63
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.annotation.JSONField;
 import com.mixsmart.utils.CustomFunction;
 import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.StringUtils;
+import io.swagger.models.auth.In;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.common.utils.BaseUtils;
@@ -945,6 +946,7 @@ public class ExecutorMeter extends FormulaExecutor {
                  chapters.stream().filter(e->e.getFormName().contains("暂")).findFirst().ifPresent(t->{
                      midPayItemList.stream().filter(e->e.getPayName().contains("暂")).findFirst().ifPresent(k->{
                          k.setPayNumber(t.getFormNumber());
+                         tec.meterInfo.getBaseInfo().setProvisionalSum(paymentCertificateMap.get(t.getFormNumber()).getContractAmount());
                      });
                  });
                  /*合计后回显*/
@@ -989,19 +991,21 @@ public class ExecutorMeter extends FormulaExecutor {
                      if(tec.meterInfo.getStartPayFormAll()!=null){
                         List<StartPayForm> startPayForm = tec.getMeterInfo().getStartPayFormAll();
                         if(startPayForm.size()>0){
-                            String[] startIds=tec.getPeriodInfo().getStartIds().split(",");
-                            if(Arrays.stream(startIds).anyMatch(BaseUtils::isNumber)) {
-                                List<StartPayForm> list = startPayForm.stream().sorted(Comparator.comparingInt(StartPayForm::getPeriodSort)).filter(e ->{
-                                    for(String s:startIds){
-                                        if(StringUtils.isEquals(s,e.getMeterPeriodId()))return  true;
+                            if(tec.getPeriodInfo().getStartIds()!=null) {
+                                String[] startIds = tec.getPeriodInfo().getStartIds().split(",");
+                                if (Arrays.stream(startIds).anyMatch(BaseUtils::isNumber)) {
+                                    List<StartPayForm> list = startPayForm.stream().sorted(Comparator.comparingInt(StartPayForm::getPeriodSort)).filter(e -> {
+                                        for (String s : startIds) {
+                                            if (StringUtils.isEquals(s, e.getMeterPeriodId())) return true;
+                                        }
+                                        return false;
+                                    }).collect(Collectors.toList());
+                                    if (Func.isNotEmpty(list)) {
+                                        StartPayForm relate = list.get(list.size() - 1);
+                                        BigDecimal pre = startPayForm.stream().filter(s -> s.getPeriodSort() <= relate.getPeriodSort()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
+                                        startPay.setPreviousPeriodEndPay(pre.toPlainString());
+                                        startPay.setCurrentPeriodEndPay(addFc.apply(startPay.getCurrentPeriodPay(), startPay.getPreviousPeriodEndPay()));
                                     }
-                                    return false;
-                                }).collect(Collectors.toList());
-                                if (Func.isNotEmpty(list)) {
-                                    StartPayForm relate = list.get(list.size() - 1);
-                                    BigDecimal pre = startPayForm.stream().filter(s -> s.getPeriodSort() <= relate.getPeriodSort()).map(s -> BaseUtils.str2BigDecimal(s.getMeterMoney())).reduce(BigDecimal.ZERO, BigDecimal::add);
-                                    startPay.setPreviousPeriodEndPay(pre.toPlainString());
-                                    startPay.setCurrentPeriodEndPay(addFc.apply(startPay.getCurrentPeriodPay(),startPay.getPreviousPeriodEndPay()));
                                 }
                             }
                         }
@@ -1617,8 +1621,8 @@ public class ExecutorMeter extends FormulaExecutor {
 
                 BigDecimal provisionalSum=tec.meterInfo.getInventoryForms().stream().filter(e->"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
                 BigDecimal BOQAmount=tec.meterInfo.getInventoryForms().stream().filter(e->!"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
-                baseInfo.setProvisionalSum(StringUtils.number2String(provisionalSum,2));
-                baseInfo.setBOQAmount(StringUtils.number2String(BOQAmount,2));
+                baseInfo.setProvisionalSum(provisionalSum.toPlainString());
+                baseInfo.setBOQAmount(BOQAmount.toPlainString());
                 BigDecimal changeTokenTotal=tec.meterInfo.getChangeTokenListMap().values().stream().flatMap(Collection::stream).map(ChangeToken::getTotalChangeMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
                 double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getContractAmount())+BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
                 String brief="开工日期:"+baseInfo.getStartDatePlan()+" 始算工期日:"+baseInfo.getStartDate()
@@ -1701,35 +1705,39 @@ public class ExecutorMeter extends FormulaExecutor {
             try {
                 String totalAmount=dataList.stream().map(ConstructionSchedule::getContractMoney).map(BaseUtils::str2BigDecimal).reduce(BigDecimal.ZERO,BigDecimal::add).toPlainString();
                 /*合同计划结束日期年末*/
+                LocalDate planStartDate=LocalDate.parse(baseInfo.getStartDatePlan(),BaseUtils.chineseDateFm);
                 LocalDate planEndDate=LocalDate.parse(baseInfo.getEndDatePlan(),BaseUtils.chineseDateFm);
-                LocalDate planStartDate=LocalDate.parse(baseInfo.getEndDatePlan(),BaseUtils.chineseDateFm);
+                /*年份*/
+                FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_30").ifPresent(t -> {
+                    List<Integer> value=IntStream.rangeClosed(planStartDate.getYear(),planEndDate.getYear()).boxed().collect(Collectors.toList());
+                    elementWriter.write(t, value);
+                });
                 int max = monthMoney.keySet().stream().max(Comparator.comparingInt(i->i)).orElse(BaseUtils.dateInt(planEndDate.getYear(),12));
                 int min= monthMoney.keySet().stream().min(Comparator.comparingInt(i->i)).orElse(BaseUtils.dateInt(planStartDate.getYear(),1));
                 List<Integer> tickUnit =BaseUtils.getTickUnit(min,max);
-                /*没月累计*/
-              /*  LocalDateTime head=BaseUtils.toLdt(min);
-                LocalDateTime tail=BaseUtils.toLdt(max);*/
-               /* List<String> monthlySum= IntStream.rangeClosed(1,max).boxed().map(month->{
-                    BigDecimal tmp=  monthMoney.entrySet().stream().filter(e->e.getKey()<=month).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
-                    return  ratioFc.apply(tmp.toPlainString(),totalAmount);
-                }).collect(Collectors.toList());*/
+                /*起始月相对于一月份的偏移量*/
+                int offset= min%100-1;
+                /*每月累计*/
+                LinkedHashMap<Integer,Double> actualMap  = new LinkedHashMap<>();
                 List<String> monthlySum=  tickUnit.stream().map(month->{
                     BigDecimal tmp=  monthMoney.entrySet().stream().filter(e->e.getKey()<=month).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
-                    return  ratioFc.apply(tmp.toPlainString(),totalAmount);
+                    String percent= ratioFc.apply(tmp.toPlainString(),totalAmount);
+                    actualMap.put(month,Double.parseDouble(percent));
+                    return percent;
                 }).collect(Collectors.toList());
-
-                FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_22").ifPresent(t->{
-                    elementWriter.write(t,monthlySum);
-                });
                 /*本月*/
-              /*List<String> monthlyCount= IntStream.rangeClosed(1,max).boxed().map(month->{
-                    BigDecimal tmp=  monthMoney.entrySet().stream().filter(e-> e.getKey().equals(month)).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
-                    return  ratioFc.apply(tmp.toPlainString(),totalAmount);
-                }).collect(Collectors.toList());*/
                 List<String> monthlyCount= tickUnit.stream().map(month->{
                     BigDecimal tmp=  monthMoney.entrySet().stream().filter(e-> e.getKey().equals(month)).map(Map.Entry::getValue).reduce(BigDecimal.ZERO,BigDecimal::add);
                     return  ratioFc.apply(tmp.toPlainString(),totalAmount);
                 }).collect(Collectors.toList());
+                if(offset>0){
+                    monthlySum.addAll(0,Collections.nCopies(offset,""));
+                    monthlyCount.addAll(0,Collections.nCopies(offset,""));
+                }
+                FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_22").ifPresent(t->{
+                    elementWriter.write(t,monthlySum);
+                });
+
 
                 FormulaUtils.elementFindByCode(fdm,ConstructionSchedule.TBN+":key_23").ifPresent(t->{
                     elementWriter.write(t,monthlyCount);
@@ -1737,6 +1745,7 @@ public class ExecutorMeter extends FormulaExecutor {
 
                 List<String> planMonthSum=new ArrayList<>();
                 LinkedHashMap<Integer,BigDecimal> planMonthMap=new LinkedHashMap<>();
+                LinkedHashMap<Integer,Double> plannedMap =new LinkedHashMap<>();
                 if(chapterSchedules!=null&&chapterSchedules.size()>0) {
                     /*月份装入数组*/
                     chapterSchedules.forEach(ChapterSchedule::updateArray);
@@ -1747,23 +1756,22 @@ public class ExecutorMeter extends FormulaExecutor {
                            planMonthMap.put(BaseUtils.dateInt(year,month),v.stream().map(e->e.getArr()[month-1]).reduce(BigDecimal.ZERO,BigDecimal::add));
                        }
                     });
-                   /* List<BigDecimal> planMonth = IntStream.range(0,12).boxed().map(i->chapterSchedules.stream().map(e->e.getArr()[i]).reduce(BigDecimal.ZERO,BigDecimal::add)).collect(Collectors.toList());*/
                     /*计划本月*/
                     FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_28").ifPresent(t -> {
                         List<String> value=planMonthMap.values().stream().map(BigDecimal::toPlainString).map(s-> ratioFc.apply(s, totalAmount)).collect(Collectors.toList());
                         elementWriter.write(t, value);
                     });
                     /*计划累计*/
-
+                    planMonthMap.entrySet().stream().filter(kv->kv.getKey()<=max).forEach(kv->{
+                        plannedMap.put(kv.getKey(), Double.parseDouble(ratioFc.apply(kv.getValue().toPlainString(),totalAmount)));
+                    });
                     planMonthSum = planMonthMap.keySet().stream().map(yearMonth->{
                         String tmp=  planMonthMap.entrySet().stream().filter(kv ->kv.getKey()<=yearMonth).map(Map.Entry::getValue).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
-                        return ratioFc.apply(tmp, totalAmount);
+                        String percent= ratioFc.apply(tmp, totalAmount);
+                        plannedMap.put(yearMonth,Double.parseDouble(percent));
+                        return percent;
                     }).collect(Collectors.toList());
 
-                     /*       planMonthSum = IntStream.range(0,12).boxed().map(i-> {
-                                String tmp=  planMonth.stream().filter(e -> planMonth.indexOf(e) <= i).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString();
-                                return ratioFc.apply(tmp, totalAmount);
-                            }      */
                     List<String> finalPlanMonthSum = planMonthSum;
                     FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_27").ifPresent(t -> {
                         elementWriter.write(t, finalPlanMonthSum);
@@ -1771,26 +1779,15 @@ public class ExecutorMeter extends FormulaExecutor {
 
                 }
                 /*上传图标*/
-                if(planMonthSum.size()>0&&monthlySum.size()>0){
-                    try {
-                        LinkedHashMap<Long,Double> actualMap  = new LinkedHashMap<>();
-                        monthMoney.forEach((yearMonth,sum)->{
-                            actualMap.put(BaseUtils.getTimeMs(yearMonth/100,yearMonth%100),Double.parseDouble(ratioFc.apply(sum.toPlainString(),totalAmount)));
-                        });
-
-                        LinkedHashMap<Long,Double> plannedMap =new LinkedHashMap<>();
-                        planMonthMap.entrySet().stream().filter(kv->kv.getKey()<=max).forEach(kv->{
-                            plannedMap.put(BaseUtils.getTimeMs(kv.getKey()/100,kv.getKey()%100),Double.parseDouble(ratioFc.apply(kv.getValue().toPlainString(),totalAmount)));
-                        });
-                        String path=FormulaUtils.chapterScheduleChartUrl(actualMap,plannedMap,planStartDate.getYear(),planEndDate.getYear());
-                        BladeFile chartFile= tec.getNewIOSSClient().uploadFile( ConstructionSchedule.TBN+ SnowFlakeUtil.getId() + ".png",path);
-                        /*施工进度图*/
-                        FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_29").ifPresent(t -> {
-                            elementWriter.write(t, chartFile.getLink());
-                        });
-                    }catch (Exception e){
-                        e.printStackTrace();
-                    }
+                try {
+                    String path=FormulaUtils.chapterScheduleChartUrl(actualMap,plannedMap,planStartDate.getYear(),planEndDate.getYear());
+                    BladeFile chartFile= tec.getNewIOSSClient().uploadFile( ConstructionSchedule.TBN+ SnowFlakeUtil.getId() + ".png",path);
+                    /*施工进度图*/
+                    FormulaUtils.elementFindByCode(fdm, ConstructionSchedule.TBN + ":key_29").ifPresent(t -> {
+                        elementWriter.write(t, chartFile.getLink());
+                    });
+                }catch (Exception e){
+                    e.printStackTrace();
                 }
             }catch (Exception e){
                 StaticLog.error(e.getMessage());
@@ -1807,12 +1804,12 @@ public class ExecutorMeter extends FormulaExecutor {
                 /*已过去*/
                 String passDay=CustomFunction.join(CustomFunction.daysPassed(baseInfo.getStartDate(), LocalDate.now()),"").toString();
 
-                BigDecimal provisionalSum=tec.meterInfo.getInventoryForms().stream().filter(e->"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
-                BigDecimal BOQAmount=tec.meterInfo.getInventoryForms().stream().filter(e->!"D".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
-                baseInfo.setProvisionalSum(StringUtils.number2String(provisionalSum,2));
-                baseInfo.setBOQAmount(StringUtils.number2String(BOQAmount,2));
+                BigDecimal provisionalSum=tec.meterInfo.getInventoryForms().stream().filter(e->"ZLJE".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
+                BigDecimal BOQAmount=tec.meterInfo.getInventoryForms().stream().filter(e->!"ZLJE".equals(e.getFormNumber())).map(e->BaseUtils.str2BigDecimal(e.getBidPrice())).reduce(BigDecimal.ZERO,BigDecimal::add);
+                baseInfo.setProvisionalSum(provisionalSum.toPlainString());
+                baseInfo.setBOQAmount(BOQAmount.toPlainString());
                 BigDecimal changeTokenTotal=tec.meterInfo.getChangeTokenListMap().values().stream().flatMap(Collection::stream).map(ChangeToken::getTotalChangeMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
-                double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getContractAmount())+BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
+                double totalMoney = BaseUtils.obj2DoubleZero(baseInfo.getProvisionalSum())+BaseUtils.obj2DoubleZero(baseInfo.getBOQAmount())+BaseUtils.obj2DoubleZero(changeTokenTotal);
                 String brief="开工日期:"+baseInfo.getStartDatePlan()+" 始算工期日:"+baseInfo.getStartDate()
                         +" 合同完成日期:"+baseInfo.getEndDatePlan()+" 合同期限"+contractDay+"天 时间延长"+extended+"天 修改后合同期限"+ totalDay
                         +"天(即至"+baseInfo.getEndDate()+")"

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

@@ -3637,7 +3637,8 @@ public class TaskController extends BladeController {
                                             if (value.startsWith("http") && RegexUtil.find("(?i)[.](jpeg|png|jpg)", value)) {
                                                 InputStream imageIn = CommonUtil.getOSSInputStream(value);
                                                 if (imageIn != null) {
-                                                    byte[] bytes = CommonUtil.compressImage(IOUtils.toByteArray(imageIn));
+                                                    byte[] bytes = IOUtils.toByteArray(imageIn);
+                                                   /* byte[] bytes = CommonUtil.compressImage(IOUtils.toByteArray(imageIn));*/
                                                     CreationHelper helper = workbook.getCreationHelper();
                                                     ClientAnchor anchor = helper.createClientAnchor();
                                                     Drawing<?> drawing = sheet.createDrawingPatriarch();

+ 115 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/utils/ReportUtils.java

@@ -0,0 +1,115 @@
+package org.springblade.meter.utils;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.springblade.common.utils.BaseUtils;
+import org.springblade.core.tool.utils.Func;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.stream.Collectors;
+
+/**
+ * @author yangyj
+ * @Date 2024/7/25 7:13
+ * @description 报表工具类
+ */
+public final class ReportUtils {
+    public static void deleteMergedRegions(Sheet sheet, List<CellRangeAddress> regionsToDelete) {
+        for (CellRangeAddress region : regionsToDelete) {
+            // 获取合并区域的数量
+            for (int i = sheet.getNumMergedRegions() - 1; i >= 0; i--) {
+                CellRangeAddress mergedRegion = sheet.getMergedRegion(i);
+                if (mergedRegion.formatAsString().equals(region.formatAsString())) {
+                    sheet.removeMergedRegion(i);
+                }
+            }
+        }
+    }
+
+    public static List<CellRangeAddress> getMergedRegions(Sheet sheet, String coords) {
+        List<CellRangeAddress> result = new ArrayList<>();
+        if (sheet.getMergedRegions() != null && StringUtils.isNotEmpty(coords)) {
+            for (CellRangeAddress ca : sheet.getMergedRegions()) {
+                int firstColumn = ca.getFirstColumn();
+                int lastColumn = ca.getLastColumn();
+                int firstRow = ca.getFirstRow();
+                int lastRow = ca.getLastRow();
+                Matcher mu = BaseUtils.matcher("(\\d{1,3}),(\\d{1,3}),(\\d{1,3}),(\\d{1,3})", coords);
+                /*合并单元格四个角坐标,只要任意一个在落在将要合并的区域里面意味着两者重合,就必须拆分前者*/
+                List<Integer[]> corners = Arrays.asList(new Integer[]{firstColumn, firstRow}, new Integer[]{lastColumn, firstRow}, new Integer[]{firstColumn, lastRow}, new Integer[]{lastColumn, lastRow});
+                if (mu.find()) {
+                    int firstColumn2 = BaseUtils.handleObj2Integer(mu.group(1));
+                    int lastColumn2 = BaseUtils.handleObj2Integer(mu.group(3));
+                    int firstRow2 = BaseUtils.handleObj2Integer(mu.group(2));
+                    int lastRow2 = BaseUtils.handleObj2Integer(mu.group(4));
+                    for (Integer[] corner : corners) {
+                        if (firstColumn2 <= corner[0] && corner[0] <= lastColumn2 && firstRow2 <= corner[1] && corner[1] <= lastRow2) {
+                            result.add(ca);
+                        }
+                    }
+                }
+            }
+        }
+        if (Func.isNotEmpty(result)) {
+            result = result.stream().distinct().collect(Collectors.toList());
+            return result;
+        }
+        return null;
+    }
+    public static String coords2Int(String coords) {
+        Matcher mx = BaseUtils.matcher("([A-Z]{1,3})(\\d{1,3})[~|\\-|,|#]([A-Z]{1,3})(\\d{1,3})", coords);
+        if (mx.find()) {
+            return coords4Ints(mx);
+        }
+        return null;
+    }
+
+    public static String coords4Ints(Matcher mx) {
+        List<Integer> l = new ArrayList<>();
+        for (int i = 1; i <= mx.groupCount(); i++) {
+            if (i % 2 == 0) {
+                l.add(BaseUtils.handleObj2Integer(mx.group(i)) - 1);
+            } else {
+                l.add(BaseUtils.parseColumn(mx.group(i)));
+            }
+        }
+        return l.get(0) + "," + l.get(1) + "," + l.get(2) + "," + l.get(3);
+    }
+
+    public static List<CellRangeAddress> mergeConfig(){
+        return new ArrayList<>();
+    }
+
+
+
+    public static void mainT(String[] args) throws IOException, InvalidFormatException {
+        Workbook workbook = WorkbookFactory.create(new FileInputStream("C:\\Users\\yangyj\\Desktop\\Swap_space\\24.xlsx"));
+        //获取工作表
+        Sheet sheet = workbook.getSheetAt(0);
+        String c1="O9-BZ9";
+        String c2="O10-BZ10";
+        String c3="O28-BZ28";
+        String c4="O29-BZ29";
+        String c5="O30-BZ30";
+        String c6="O31-BZ31";
+        List<CellRangeAddress> toDelete=getMergedRegions(sheet,coords2Int(c1));
+        if(toDelete!=null){
+            deleteMergedRegions(sheet,toDelete);
+        }
+        int type=5;
+
+         workbook.write(new FileOutputStream("C:\\Users\\yangyj\\Desktop\\Swap_space\\25.xlsx"));
+    }
+
+
+}