|
|
@ -1,19 +1,25 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.constant.BaseReportConstant; |
|
|
|
import com.epmet.dao.stats.BaseReportDao; |
|
|
|
import com.epmet.dto.basereport.form.*; |
|
|
|
import com.epmet.service.BaseReportService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.ListUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 部分基础数据上报 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class BaseReportServiceImpl implements BaseReportService { |
|
|
|
|
|
|
|
@Autowired |
|
|
@ -217,9 +223,21 @@ public class BaseReportServiceImpl implements BaseReportService { |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void agencyProject(AgencyProjectFormDTO formDTO) { |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(formDTO.getDataList())){ |
|
|
|
log.warn(String.format(BaseReportConstant.DATA_IS_NULL),"组织项目"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (formDTO.getIsFirst()) { |
|
|
|
int deleteNum; |
|
|
|
do { |
|
|
|
deleteNum = baseReportDao.delAgencyProject(formDTO.getDataList().get(NumConstant.ZERO).getCustomerId(), formDTO.getDataList().get(NumConstant.ZERO).getDateId()); |
|
|
|
} while (deleteNum > NumConstant.ZERO); |
|
|
|
} |
|
|
|
List<List<AgencyProjectFormDTO.DataList>> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); |
|
|
|
partition.forEach(p -> { |
|
|
|
baseReportDao.insertAgencyProject(p); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|