Browse Source

校验多个pid为0的数据

master
zxc 5 years ago
parent
commit
989b7c95be
  1. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java

@ -17,8 +17,11 @@
package com.epmet.service.evaluationindex.screen.impl; package com.epmet.service.evaluationindex.screen.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.CompareConstant; import com.epmet.constant.CompareConstant;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
@ -36,7 +39,9 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 大屏数据采集 * 大屏数据采集
@ -299,6 +304,11 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} while (deleteNum != NumConstant.ZERO); } while (deleteNum != NumConstant.ZERO);
} }
if (!CollectionUtils.isEmpty(formDTO.getDataList())) { if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
List<CustomerAgencyFormDTO> pidIsZeroList = formDTO.getDataList().stream().filter(d -> d.getPid().equals(NumConstant.ZERO_STR) || "".equals(d.getPid())).collect(Collectors.toList());
if (pidIsZeroList.size()>=NumConstant.ONE){
Object o = JSONObject.toJSON(pidIsZeroList);
throw new RenException("多个pid为【0】的数据:"+o.toString());
}
screenCustomerAgencyDao.batchInsertCustomerAgency(formDTO.getDataList(), customerId); screenCustomerAgencyDao.batchInsertCustomerAgency(formDTO.getDataList(), customerId);
} }
} }

Loading…
Cancel
Save