Multiple tabs in the table body verify that a certain field is equal (Method 3: Combination of List and StringBuilder)

Multiple tabs in the table body verify that a certain field is equal (Method 3: Combination of List and StringBuilder)

/**
 * @desc: save validation
 * @author: hh
 * @date: 2023-4-3
 */

public class SaveCheckRule implements IRule<AggBgmxysVO>{<!-- -->
@Override
public void process(AggBgmxysVO[] aggvos) {<!-- -->

for (int i = 0; i < aggvos. length; i ++ ) {<!-- -->
try {<!-- -->
checknum(aggvos[i]);
} catch (BusinessException e) {<!-- -->
ExceptionUtils.wrappBusinessException(e.getMessage());
}
}
}
/**
* @desc: The "quantity and" of the table body are equal
* @author: hh
* @date: 2023-3-31
*/
private void checknum(AggBgmxysVO aggvo) throws BusinessException{<!-- -->
// TODO auto-generated method stub
BgmxysCVO[] cvos = (BgmxysCVO[]) aggvo.getChildren(BgmxysCVO.class);
BgmxysDVO[] dvos = (BgmxysDVO[]) aggvo.getChildren(BgmxysDVO.class);
BgmxysEVO[] evos = (BgmxysEVO[]) aggvo.getChildren(BgmxysEVO.class);
BgmxysFVO[] fvos = (BgmxysFVO[]) aggvo.getChildren(BgmxysFVO.class);
BgmxysGVO[] gvos = (BgmxysGVO[]) aggvo.getChildren(BgmxysGVO.class);
if(cvos == null || cvos. length < 1){<!-- -->
if(dvos == null || dvos. length < 1){<!-- -->
if(evos == null || evos. length < 1){<!-- -->
if(fvos == null || fvos.length < 1){<!-- -->
if(gvos == null || gvos. length < 1){<!-- -->
ExceptionUtils.wrappBusinessException("There is no data in the table body, please check!");
}
}
}
}
}
List<String> cvoRownoList = new ArrayList<String>();
List<String> dvoRownoList = new ArrayList<String>();
List<String> evoRownoList = new ArrayList<String>();
List<String> fvoRownoList = new ArrayList<String>();
List<String> gvoRownoList = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
Boolean flag1 = true;
for(int i = 0; i < cvos. length; i ++ ){<!-- -->
UFDouble nyjmny = NullValueUtils.getNullUFdoubleValue(cvos[i].getNyjmny());
UFDouble nmnyone = NullValueUtils.getNullUFdoubleValue(cvos[i].getNmnyone());
UFDouble nmnytwo = NullValueUtils.getNullUFdoubleValue(cvos[i].getNmnytwo());
UFDouble nmnythree = NullValueUtils.getNullUFdoubleValue(cvos[i].getNmnythree());
UFDouble nmnyfour = NullValueUtils.getNullUFdoubleValue(cvos[i].getNmnyfour());
UFDouble nmnyfive = NullValueUtils.getNullUFdoubleValue(cvos[i].getNmnyfive());
if(!nyjmny.equals(nmnyone.add(nmnytwo).add(nmnythree).add(nmnyfour).add(nmnyfive))){<!-- -->
flag1 = false;
String rowno = NullValueUtils.getNullStringValue((i + 1)*10);
cvoRownoList.add(rowno);
}
}
if(!flag1){<!-- -->
sb.append("Office Expenses" + StringUtils.join(cvoRownoList.toArray(new String[0]), ",") + "The row amount fields are not equal," );
}
\t\t
Boolean flag2 = true;
for(int i = 0; i < dvos. length; i ++ ){<!-- -->
UFDouble nyjmny = NullValueUtils.getNullUFdoubleValue(dvos[i].getNyjmny());
UFDouble nmnyone = NullValueUtils.getNullUFdoubleValue(dvos[i].getNmnyone());
UFDouble nmnytwo = NullValueUtils.getNullUFdoubleValue(dvos[i].getNmnytwo());
UFDouble nmnythree = NullValueUtils.getNullUFdoubleValue(dvos[i].getNmnythree());
UFDouble nmnyfour = NullValueUtils.getNullUFdoubleValue(dvos[i].getNmnyfour());
UFDouble nmnyfive = NullValueUtils.getNullUFdoubleValue(dvos[i].getNmnyfive());
if(!nyjmny.equals(nmnyone.add(nmnytwo).add(nmnythree).add(nmnyfour).add(nmnyfive))){<!-- -->
flag2 = false;
String rowno = NullValueUtils.getNullStringValue((i + 1)*10);
dvoRownoList.add(rowno);
}
}
if(!flag2){<!-- -->
sb.append("data fee" + StringUtils.join(dvoRownoList.toArray(new String[0]), ",") + "row amount fields are not equal," );
}
\t\t
Boolean flag3 = true;
for(int i = 0; i < evos. length; i ++ ){<!-- -->
UFDouble nyjmny = NullValueUtils.getNullUFdoubleValue(evos[i].getNyjmny());
UFDouble nmnyone = NullValueUtils.getNullUFdoubleValue(evos[i].getNmnyone());
UFDouble nmnytwo = NullValueUtils.getNullUFdoubleValue(evos[i].getNmnytwo());
UFDouble nmnythree = NullValueUtils.getNullUFdoubleValue(evos[i].getNmnythree());
UFDouble nmnyfour = NullValueUtils.getNullUFdoubleValue(evos[i].getNmnyfour());
UFDouble nmnyfive = NullValueUtils.getNullUFdoubleValue(evos[i].getNmnyfive());
if(!nyjmny.equals(nmnyone.add(nmnytwo).add(nmnythree).add(nmnyfour).add(nmnyfive))){<!-- -->
flag3 = false;
String rowno = NullValueUtils.getNullStringValue((i + 1)*10);
evoRownoList.add(rowno);
}
}
if(!flag3){<!-- -->
sb.append("Text fee" + StringUtils.join(evoRownoList.toArray(new String[0]), ",") + "The row amount fields are not equal," );
}
\t\t
Boolean flag4 = true;
for(int i = 0; i < fvos. length; i ++ ){<!-- -->
UFDouble nyjmny = NullValueUtils.getNullUFdoubleValue(fvos[i].getNyjmny());
UFDouble nmnyone = NullValueUtils.getNullUFdoubleValue(fvos[i].getNmnyone());
UFDouble nmnytwo = NullValueUtils.getNullUFdoubleValue(fvos[i].getNmnytwo());
UFDouble nmnythree = NullValueUtils.getNullUFdoubleValue(fvos[i].getNmnythree());
UFDouble nmnyfour = NullValueUtils.getNullUFdoubleValue(fvos[i].getNmnyfour());
UFDouble nmnyfive = NullValueUtils.getNullUFdoubleValue(fvos[i].getNmnyfive());
if(!nyjmny.equals(nmnyone.add(nmnytwo).add(nmnythree).add(nmnyfour).add(nmnyfive))){<!-- -->
flag4 = false;
String rowno = NullValueUtils.getNullStringValue((i + 1)*10);
fvoRownoList.add(rowno);
}
}
if(!flag4){<!-- -->
sb.append("production fee" + StringUtils.join(fvoRownoList.toArray(new String[0]), ",") + "row amount fields are not equal," );
}
\t\t
Boolean flag5 = true;
for(int i = 0; i < gvos. length; i ++ ){<!-- -->
UFDouble nyjmny = NullValueUtils.getNullUFdoubleValue(gvos[i].getNyjmny());
UFDouble nmnyone = NullValueUtils.getNullUFdoubleValue(gvos[i].getNmnyone());
UFDouble nmnytwo = NullValueUtils.getNullUFdoubleValue(gvos[i].getNmnytwo());
UFDouble nmnythree = NullValueUtils.getNullUFdoubleValue(gvos[i].getNmnythree());
UFDouble nmnyfour = NullValueUtils.getNullUFdoubleValue(gvos[i].getNmnyfour());
UFDouble nmnyfive = NullValueUtils.getNullUFdoubleValue(gvos[i].getNmnyfive());
if(!nyjmny.equals(nmnyone.add(nmnytwo).add(nmnythree).add(nmnyfour).add(nmnyfive))){<!-- -->
flag5 = false;
String rowno = NullValueUtils.getNullStringValue((i + 1)*10);
gvoRownoList.add(rowno);
}
}
if(!flag5){<!-- -->
sb.append("Network communication fee number" + StringUtils.join(gvoRownoList.toArray(new String[0]), ",") + "row amount fields are not equal," );
}
throw new BusinessException("Failed to save: " + sb.toString() + "Please check!");
}