dobe_comic8/main/java/shkd/repc/recon/opplugin/IntroduceContractPlugin.java

38 lines
1.5 KiB
Java
Raw Normal View History

package shkd.repc.recon.opplugin;
import com.alibaba.fastjson.JSONObject;
import kd.bos.entity.api.ApiResult;
import kd.bos.entity.plugin.ImportLogger;
import kd.bos.form.plugin.impt.BatchImportPlugin;
import kd.bos.form.plugin.impt.ImportBillData;
import java.util.Iterator;
import java.util.List;
public class IntroduceContractPlugin extends BatchImportPlugin {
@Override
protected ApiResult save(List<ImportBillData> rowdatas, ImportLogger logger) {
Iterator<ImportBillData> iterator = rowdatas.iterator();
while (iterator.hasNext()){
ImportBillData importBillData = iterator.next();
JSONObject data = importBillData.getData();
String qeug_bcdecimalqty = (String) data.get("qeug_bcdecimalqty");//本次完工量
String qeug_decimalqty = (String) data.get("qeug_decimalqty");//工程量
double bcdecimalqty = 0;
double decimalqty =0;
try {
bcdecimalqty = Double.parseDouble(qeug_bcdecimalqty);
decimalqty = Double.parseDouble(qeug_decimalqty);
} catch (NumberFormatException e) {
logger.log(importBillData.getStartIndex(),"工程量数据格式有误").fail();
iterator.remove();
}
if (bcdecimalqty>decimalqty){
logger.log(importBillData.getStartIndex(),"本次完工量不能大于工程量").fail();
iterator.remove();
}
}
return super.save(rowdatas, logger);
}
}