・緑黄色野菜 修正 JAR_2020-12-28_0625_BUILD
authorsatomichan <git.20200328@...>
Sun, 27 Dec 2020 21:59:20 +0000 (06:59 +0900)
committersatomichan <git.20200328@...>
Sun, 27 Dec 2020 21:59:20 +0000 (06:59 +0900)
・「脂肪酸成分表」対応

src/main/java/jp/satomichan/nucalgen/MextStdFoodCompTable.java
src/main/java/jp/satomichan/nucalgen/Nucalgen.java
src/main/java/jp/satomichan/nucalgen/NutritionColumn.java
src/main/java/jp/satomichan/nucalgen/NutritionColumnHolder.java

index d85124898ebffdea68e075f3a59930f0d6e9c44e..ec6718833c3765974ded7283ff01fe8db574502c 100644 (file)
@@ -87,16 +87,17 @@ public class MextStdFoodCompTable {
 
                                } //CELL
 
+
+
                                //食品群(1~18)書き込み
                                compRow.createCell(62).setCellValue(group);
 
-
                                //緑黄色野菜か?
-                               if(brightColoredVegetablesXmlFileName.length() > 0) {
-                                       boolean isBrightColored = false;
+                               boolean isBrightColored = false;
+                               if(group == 6 && brightColoredVegetablesXmlFileName.length() > 0) {
                                        String foodName = thisRow.getCell(3).getStringCellValue();
                                        for(String aBright : this.brightColoredVegetableList) {
-                                               if(foodName.matches(aBright + ".*")) {
+                                               if(foodName.matches(".*" + aBright + ".*")) {
                                                        isBrightColored = true;
                                                        break;
                                                }
index 9f900568c84cd660be73021ff7b7b5f6406c4c32..313d755ca025cc1df3a594943c572326cfba19f9 100644 (file)
@@ -55,8 +55,8 @@ public class Nucalgen {
 
                        if(cmd.hasOption("use-processed-table") == false) {
                                //成分表 変換
-                               MextStdFoodCompTable moe = new MextStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list"));
-                               moe.processInto(outputWorkbook);
+                               MextStdFoodCompTable stdCompTable = new MextStdFoodCompTable(cmd.getOptionValue("bright-colored-vegetables-list"));
+                               stdCompTable.processInto(outputWorkbook);
                        }
 
 
@@ -108,7 +108,7 @@ public class Nucalgen {
 
                                        String div100 = aColumn.isUseRawValue() ? "" :  "/ 100 * $D" + (rowIndex + 1);
 
-                                       thisCell.setCellFormula("IFERROR(VLOOKUP($B" + (rowIndex + 1) + ",成分表!$B$12:$BL$2500,MATCH(\"" + aColumn.getName() + "\",成分表!$B$11:$BL$11,0),FALSE) " + div100 + ",\"\")");
+                                       thisCell.setCellFormula("IFERROR(VLOOKUP($B" + (rowIndex + 1) + "," + aColumn.getTable() + "!$B$12:$BL$2500,MATCH(\"" + aColumn.getName() + "\"," + aColumn.getTable() + "!$B$11:$BL$11,0),FALSE) " + div100 + ",\"\")");
                                        colIndex++;
                                }
 
index 34d7ee32a709036449bbe0154dca40042a945bc8..d548f2562a09a321c926895d3805a5e9237e571e 100644 (file)
@@ -2,6 +2,7 @@ package jp.satomichan.nucalgen;
 
 public class NutritionColumn {
        private String name;
+       private String table;
        private String dispName;
        private String format;
        private String unit;
@@ -18,6 +19,14 @@ public class NutritionColumn {
                this.name = name;
        }
 
+       public String getTable() {
+               return table;
+       }
+
+       public void setTable(String table) {
+               this.table = table;
+       }
+
        public void setName(Object name) {
                this.name = (String) name;
        }
index e20d7994094b4e5e54e7412824aa2531ff996b1c..78c4fd9f14e88b3e33ff03365efa823c99120369 100644 (file)
@@ -21,6 +21,7 @@ public class NutritionColumnHolder {
                this.nutritionColumnList = new ArrayList<NutritionColumn>();
 
                List<Object> names = aConfig.getList("cols.column.name");
+               List<Object> tables = aConfig.getList("cols.column.table");
                List<Object> dispNames = aConfig.getList("cols.column.disp_name");
                List<Object> aliases = aConfig.getList("cols.column.alias");
                List<Object> formats = aConfig.getList("cols.column.format");
@@ -31,6 +32,7 @@ public class NutritionColumnHolder {
                for (Object aName : names) {
                        NutritionColumn nc = new NutritionColumn();
                        nc.setName((String) aName);
+                       nc.setTable((String) tables.get(names.indexOf(aName)));
                        nc.setDispName((String) dispNames.get(names.indexOf(aName)));
                        nc.setAlias((String) aliases.get(names.indexOf(aName)));
                        nc.setFormat((String) formats.get(names.indexOf(aName)));