Browse Source

cpc_base_data插入分批,多个pid修改条件

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

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

@ -31,6 +31,7 @@ import com.epmet.dto.screencoll.form.*;
import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenEventImgDataEntity;
import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity;
import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService; import com.epmet.service.evaluationindex.screen.ShiBeiScreenCollService;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -229,7 +230,10 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} while (deleteNum != NumConstant.ZERO); } while (deleteNum != NumConstant.ZERO);
} }
if (!CollectionUtils.isEmpty(formDTO.getDataList())) { if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
screenCpcBaseDataDao.batchInsertCpcBaseData(formDTO.getDataList(), customerId); List<List<CpcBaseDataFormDTO>> pageByOneHundred = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED);
pageByOneHundred.forEach(one -> {
screenCpcBaseDataDao.batchInsertCpcBaseData(one, customerId);
});
} }
} }
@ -305,7 +309,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} }
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()); 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){ if (pidIsZeroList.size()>NumConstant.ONE){
Object o = JSONObject.toJSON(pidIsZeroList); Object o = JSONObject.toJSON(pidIsZeroList);
throw new RenException("多个pid为【0】的数据:"+o.toString()); throw new RenException("多个pid为【0】的数据:"+o.toString());
} }

Loading…
Cancel
Save