Commit be6e10a8 by liyanlin

增加判空校验

parent 38d65050
......@@ -155,9 +155,9 @@ public class CostPlanNewController {
if (file != null && file.getOriginalFilename().endsWith(".zip")) {
try {
InputStream is = file.getResource().getInputStream();
File rar = File.createTempFile(UidUtils.VM_ID + "fee-original", ".zip");
file.transferTo(rar);
Map<CostPlanService, List<CostPlanDomain>> costPlanServiceListMap = CostPlanServiceFactory.getCostPlanService(rar, userCode);
File zip = File.createTempFile(UidUtils.VM_ID + "fee-original", ".zip");
file.transferTo(zip);
Map<CostPlanService, List<CostPlanDomain>> costPlanServiceListMap = CostPlanServiceFactory.getCostPlanService(zip, userCode);
costPlanServiceListMap.forEach((x, y) -> {
y.forEach(costPlanDomain -> {
x.save(costPlanDomain);
......
......@@ -2,6 +2,7 @@ package com.blt.other.module.cost.service.impl.costplan;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.common.SpringContextUtil;
import com.bailuntec.common.exception.BizException;
import com.blt.other.common.exception.BizRuntimeException;
import com.blt.other.database.model.CostCompanyDomain;
import com.blt.other.module.cost.dao.CostDao;
......@@ -177,7 +178,14 @@ public class CostPlanServiceFactory {
JSONObject jsonObject = new JSONObject();
for (int j = 0; j < firstRow.getLastCellNum(); j++) {
String costPlanField = CostPlanEnumVo.getCostPlanField(sheetName, firstRow.getCell(j).toString());
if (!costPlanField.equals("") && row.getCell(j) != null) {
if (!costPlanField.equals("")) {
if(!costPlanField.equals("costRemark") && (row.getCell(j) == null || row.getCell(j).toString().trim().equals(""))){
throw new BizException("请填写必填项");
}
if(costPlanField.equals("costRemark") && sheetName.equals("付款") && (row.getCell(j) == null || row.getCell(j).toString().trim().equals("")))
{
throw new BizException("付款单备注为必填项");
}
jsonObject.put(costPlanField, row.getCell(j).toString());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment