guomengjiao 2 mesi fa
parent
commit
d76b8a76a4

+ 2 - 2
common/src/main/java/com/jeesite/common/constant/Constants.java

@@ -60,7 +60,7 @@ public interface Constants {
         String TYPE_DESC = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">图 firstIndex: di_type产品市场规模分析</span></p>";
         // 替换应用
         String APPLICATION_TEXT = "di_application";
-        String APPLICATION_DESC = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">图 7: di_application行业应用展示</span></p>";
+        String APPLICATION_DESC = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">图 firstIndex: di_application行业应用展示</span></p>";
         // 应用序号
         String FIGURE_TEXT = "di_figure";
     }
@@ -75,7 +75,7 @@ public interface Constants {
         String FOUR_TEXT = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">Table fourIndex: di_company @@@@ Product Revenue by Geographic Area</span></p>";
         String FIVE_TEXT = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">Table fiveIndex: di_company Key Performance Indicators (KPIs) Assessment (Company Size, R&D Investment, International Revenue Contribution, @@@@ Market Position)</span></p>";
         String TYPE_DESC = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">Figure firstIndex: di_type Product Analysis</span></p>";
-        String APPLICATION_DESC = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">Figure 7: di_application Overview</span></p>";
+        String APPLICATION_DESC = "<p style=\"line-height: 1.15;\"><span style=\"font-family: 微软雅黑;\">Figure firstIndex: di_application Overview</span></p>";
     }
 
     // 正文目录

+ 40 - 13
modules/report/src/main/java/com/jeesite/modules/report/util/TransContentUtils.java

@@ -76,7 +76,7 @@ public class TransContentUtils {
             int firstIndex = Integer.valueOf(directoryHtml.substring(corpIndex-2,corpIndex-1));
 
             // 第二三行,替换@@@@符号
-            String desc,desc01,desc02,desc03;
+            String desc,desc01,desc02,desc03,desc04,desc05;
             if(Constants.lang.ZH_CH.equals(lang)){
                 desc = Constants.directory.COMPANY_TEXT;
                 desc01 = Constants.directory.COMPANY_DESC_FST;
@@ -87,6 +87,8 @@ public class TransContentUtils {
                 }else{
                     desc03 = Constants.directory.COMPANY_DESC_THD_SERVICE.replace(word,researchReport.getContext());
                 }
+                desc04 = Constants.directory.COMPANY_DESC_FOUR.replace(word,researchReport.getContext());
+                desc05 = "";
             }else{
                 desc = Constants.directory_en.COMPANY_TEXT;
                 desc01 = Constants.directory_en.COMPANY_DESC_FST;
@@ -97,16 +99,22 @@ public class TransContentUtils {
                 }else{
                     desc03 = Constants.directory_en.COMPANY_DESC_THD_SERVICE.replace(word,researchReport.getContext());
                 }
+                desc04 = Constants.directory_en.COMPANY_DESC_FOUR.replace(word,researchReport.getContext());
+                desc05 = Constants.directory_en.COMPANY_DESC_FIVE.replace(word,researchReport.getContext());
             }
 
             desc = desc.replace("firstTitleIndex",firstTitleIndex);
             desc01 = desc01.replace("firstTitleIndex",firstTitleIndex);
             desc02 = desc02.replace("firstTitleIndex",firstTitleIndex);
             desc03 = desc03.replace("firstTitleIndex",firstTitleIndex);
+            desc04 = desc04.replace("firstTitleIndex",firstTitleIndex);
+            desc05 = desc05.replace("firstTitleIndex",firstTitleIndex);
             String newStr = "";
             String oldStr = desc.replace("secondIndex",String.valueOf(firstIndex)).replace("firstTitleIndex",firstTitleIndex)+
                     desc01.replace("secondIndex",String.valueOf(firstIndex))+
-                    desc02.replace("secondIndex",String.valueOf(firstIndex))+ desc03.replace("secondIndex",String.valueOf(firstIndex));
+                    desc02.replace("secondIndex",String.valueOf(firstIndex))+ desc03.replace("secondIndex",String.valueOf(firstIndex))
+                    + desc04.replace("secondIndex",String.valueOf(firstIndex)) + desc05.replace("secondIndex",String.valueOf(firstIndex))
+                    ;
 
             String[] corpArr = companies.split(Constants.separator.ASTERISK);
             for(int t = 0; t < corpArr.length; t++){
@@ -118,6 +126,10 @@ public class TransContentUtils {
                         .replace(Constants.charts.COMPANY_TEXT,corpArr[t]);
                 newStr += desc03.replace("secondIndex",String.valueOf(firstIndex + t))
                         .replace(Constants.charts.COMPANY_TEXT,corpArr[t]);
+                newStr += desc04.replace("secondIndex",String.valueOf(firstIndex + t))
+                        .replace(Constants.charts.COMPANY_TEXT,corpArr[t]);
+                newStr += desc05.replace("secondIndex",String.valueOf(firstIndex + t))
+                        .replace(Constants.charts.COMPANY_TEXT,corpArr[t]);
             }
             directoryHtml = directoryHtml.replace(oldStr,newStr);
         }
@@ -187,7 +199,8 @@ public class TransContentUtils {
         String companies = researchReport.getCompanies(), types = researchReport.getTypes(),
                 applications = researchReport.getApplications(),lang = researchReport.getLang();
         // 替换公司和序号
-        String secondText, thirdText,fistText,typeDesc,appDesc;
+        String secondText, thirdText,fistText,typeDesc,appDesc,fourText,fiveText;
+        int comLen = 3;
         if(Constants.lang.ZH_CH.equals(lang)){
             fistText = Constants.charts.FIRST_TEXT;
             secondText = Constants.charts.SECOND_TEXT.replaceAll(info04.getWord(),researchReport.getContext());
@@ -219,6 +232,9 @@ public class TransContentUtils {
                     thirdText = Constants.charts.THIRD_TEXT_SERVICE_GLOBAL.replaceAll(info04.getWord(), researchReport.getContext());
                 }*/
             }
+            fourText = Constants.charts.FOUR_TEXT.replaceAll(info04.getWord(),researchReport.getContext());
+            fiveText = "";
+            comLen++;
         }else{
             fistText = Constants.charts_en.FIRST_TEXT;
             secondText = Constants.charts_en.SECOND_TEXT.replaceAll(info04.getWord(),researchReport.getContext());
@@ -250,6 +266,9 @@ public class TransContentUtils {
                     thirdText = Constants.charts.THIRD_TEXT_SERVICE_GLOBAL.replaceAll(info04.getWord(), researchReport.getContext());
                 }*/
             }
+            fourText = Constants.charts_en.FOUR_TEXT.replaceAll(info04.getWord(),researchReport.getContext());
+            fiveText = Constants.charts_en.FIVE_TEXT.replaceAll(info04.getWord(),researchReport.getContext());
+            comLen+=2;
         }
 
 
@@ -265,19 +284,25 @@ public class TransContentUtils {
                 firstIndex = Integer.valueOf(chartsHtml.substring(index-4,index-2));
             }
             String newStr = "", oldStr = fistText.replace("firstIndex",String.valueOf(firstIndex))+
-                    secondText.replace("secondIndex",String.valueOf(firstIndex + 1))+ thirdText.replace("thirdIndex",String.valueOf(firstIndex +2));
+                    secondText.replace("secondIndex",String.valueOf(firstIndex + 1))
+                    + thirdText.replace("thirdIndex",String.valueOf(firstIndex +2))
+                    + fourText.replace("fourIndex",String.valueOf(firstIndex + 3))
+                    + fiveText.replace("fiveIndex",String.valueOf(firstIndex + 4))
+                    ;
             String[] companyArr = companies.split(Constants.separator.ASTERISK);
 
             for(int i01 = 0; i01 < companyArr.length; i01++){
-                newStr += fistText.replace("firstIndex",String.valueOf(firstIndex + i01 *3)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
-                newStr += secondText.replace("secondIndex",String.valueOf(firstIndex + 1 + i01 *3)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
-                newStr += thirdText.replace("thirdIndex",String.valueOf(firstIndex + 2 + i01 *3)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
+                newStr += fistText.replace("firstIndex",String.valueOf(firstIndex + i01 *comLen)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
+                newStr += secondText.replace("secondIndex",String.valueOf(firstIndex + 1 + i01 *comLen)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
+                newStr += thirdText.replace("thirdIndex",String.valueOf(firstIndex + 2 + i01 *comLen)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
+                newStr += fourText.replace("fourIndex",String.valueOf(firstIndex + 3 + i01 *comLen)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
+                newStr += fiveText.replace("fiveIndex",String.valueOf(firstIndex + 4 + i01 *comLen)).replace(Constants.charts.COMPANY_TEXT,companyArr[i01]);
             }
             // 替换公司
             chartsHtml = chartsHtml.replace(oldStr,newStr);
 
             // 最后值
-            int lastIndex = firstIndex + companyArr.length * 3;
+            int lastIndex = firstIndex + companyArr.length * comLen;
             int num = StringUtils.countMatches(chartsHtml,Constants.charts.NUMBER_TEXT);
             if(num > 0){
                 for(int i02 = 0; i02 < num; i02++){
@@ -310,14 +335,16 @@ public class TransContentUtils {
         if(StringUtils.isNotBlank(applications) && appIndex > -1){
             String[] appArr = applications.split(Constants.separator.ASTERISK);
             // 起始值
-            //int firstIndex = Integer.valueOf(chartsHtml.substring(index-4,index-2));
-            String newStr = "";
-            //oldStr = Constants.charts.APPLICATION_DESC.replace("firstIndex",String.valueOf(lastIndex));
+            String typeFirst = chartsHtml.substring(appIndex - 3, appIndex - 2);
+            if (!StringUtils.isNumeric(typeFirst)) {
+                typeFirst = chartsHtml.substring(appIndex - 2, appIndex - 1);
+            }
+            String newStr = "", oldStr = appDesc.replace("firstIndex", typeFirst);
             for(int i04 = 0; i04 < appArr.length; i04++){
-                newStr += appDesc.replace("3",String.valueOf(lastIndex + i04))
+                newStr += appDesc.replace("firstIndex",String.valueOf(lastIndex + i04))
                         .replace(Constants.charts.APPLICATION_TEXT,appArr[i04]);
             }
-            chartsHtml = chartsHtml.replace(appDesc,newStr);
+            chartsHtml = chartsHtml.replace(oldStr,newStr);
 
             lastIndex = lastIndex + appArr.length;
         }