|
我在保存方法里面加上了一些重复判断的条件,抛出了throws Exception的异常
前端有错误提示,关闭错误提示后,重新修改后,再次提交,
Iterator<Row> rows = table.iterator(com.justep.system.data.ModifyState.EDIT );
Iterator<Row> rowsNew = table.iterator(com.justep.system.data.ModifyState.NEW );
这2个集合里面取不到刚重新提交的数据,这个应该怎么处理?
public static int saveCO_XM(List insertRange,List deleteRange,List updateRange,String concept,String dataModel,String fnModel,String readOnly,String notNull,Table table) throws Exception{
logger.info("保存项目");
//获得所有更改的行
Iterator<Row> rows = table.iterator(com.justep.system.data.ModifyState.EDIT );
String currentGH = ContextHelper.getOperator().getCode(); //获取当前登录人
Timestamp currentDate = com.justep.system.util.CommonUtils.getCurrentDateTime(); //获取当前时间
int countNum = 0;
while (rows.hasNext()){
Row row = rows.next();
try{
row.setValue("fUpdatePerson",currentGH); //给列赋值
row.setDateTime("fUpdateTime", currentDate);
}catch(Exception e){
logger.info("无更新人更新时间的列");
}
String fID = row.getString("CO_XM");
String fFYDM = row.getString("fFYDM");
countNum = workinghoursService.judgefFYDM( fFYDM, fID);
}
if(countNum>0){
throw new Exception("费用代码重复,请重新输入!");
}
//获得所有新增的行
Iterator<Row> rowsNew = table.iterator(com.justep.system.data.ModifyState.NEW );
while (rowsNew.hasNext()){
Row rowNew = rowsNew.next();
try{
rowNew.setValue("fCreatePerson",currentGH); //给列赋值
rowNew.setDateTime("fCreationTime", currentDate);
rowNew.setValue("fUpdatePerson",currentGH); //给列赋值
rowNew.setDateTime("fUpdateTime", currentDate);
}catch(Exception e){
logger.info("无创建人创建时间更新人更新时间的列");
}
String fID = rowNew.getString("CO_XM");
String fFYDM = rowNew.getString("fFYDM");
countNum = workinghoursService.judgefFYDM( fFYDM, fID);
}
if(countNum>0){
throw new Exception("费用代码重复,请重新输入!");
}
return BizData.save(table, concept, insertRange, deleteRange, updateRange, readOnly, notNull, dataModel, fnModel);
}
|
|