|
|
@ -2,6 +2,7 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
|
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventDataDao; |
|
|
@ -17,10 +18,15 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDT |
|
|
|
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO; |
|
|
|
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO; |
|
|
|
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO; |
|
|
|
import com.epmet.feign.OperCrmOpenFeignClient; |
|
|
|
import com.epmet.project.CustomerProjectCategoryDTO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -29,6 +35,8 @@ import java.util.List; |
|
|
|
* @author yinzuomei@elink-cn.com |
|
|
|
* @date 2020/8/18 10:23 |
|
|
|
*/ |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|
|
|
public class ScreenProjectServiceImpl implements ScreenProjectService { |
|
|
@ -42,6 +50,8 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ScreenProjectCategoryOrgDailyDao screenProjectCategoryOrgDailyDao; |
|
|
|
@Autowired |
|
|
|
private OperCrmOpenFeignClient operCrmOpenFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 3、项目详情 |
|
|
@ -88,17 +98,17 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result projectDistributionDetail(ScreenProjectDetailFormDTO formDTO) { |
|
|
|
List<ScreenProjectDetailResultDTO> resultDTOS = screenProjectDataDao.projectDistributionDetail(formDTO.getProjectId(),formDTO.getCustomerId()); |
|
|
|
List<ScreenProjectDetailResultDTO> resultDTOS = screenProjectDataDao.projectDistributionDetail(formDTO.getProjectId()); |
|
|
|
resultDTOS.forEach(item -> { |
|
|
|
//项目图片
|
|
|
|
List<String> imgList = screenProjectDataDao.selectProjectImgs(formDTO.getProjectId(),formDTO.getCustomerId()); |
|
|
|
List<String> imgList = screenProjectDataDao.selectProjectImgs(formDTO.getProjectId(),item.getCustomerId()); |
|
|
|
item.setImgList(imgList); |
|
|
|
//项目处理流程
|
|
|
|
List<ScreenProjectDetailResultDTO.processDTO> processDTOS = screenProjectDataDao.selectProjectProcess(formDTO.getProjectId(),formDTO.getCustomerId()); |
|
|
|
List<ScreenProjectDetailResultDTO.processDTO> processDTOS = screenProjectDataDao.selectProjectProcess(formDTO.getProjectId(),item.getCustomerId()); |
|
|
|
//流程附件
|
|
|
|
processDTOS.forEach(processDTO -> { |
|
|
|
List<ScreenProjectDetailResultDTO.processDTO.AttachmentDTO> attachmentDTOS = |
|
|
|
screenProjectDataDao.selectProjectProcessAttachments(processDTO.getProcessId(),formDTO.getProjectId(),formDTO.getCustomerId()); |
|
|
|
screenProjectDataDao.selectProjectProcessAttachments(processDTO.getProcessId(),formDTO.getProjectId(),item.getCustomerId()); |
|
|
|
processDTO.setAttachments(attachmentDTOS); |
|
|
|
}); |
|
|
|
item.setProcessList(processDTOS); |
|
|
@ -118,6 +128,25 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { |
|
|
|
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) |
|
|
|
@Override |
|
|
|
public List<CategoryAnalysisResultDTO> categoryAnalysis(String customerId, CategoryAnalysisFormDTO formDTO) { |
|
|
|
return screenProjectCategoryOrgDailyDao.selectCategoryAnalysis(formDTO.getAgencyId(),customerId); |
|
|
|
List<CategoryAnalysisResultDTO> resultDTOList = screenProjectCategoryOrgDailyDao.selectCategoryAnalysis(formDTO.getAgencyId(), customerId); |
|
|
|
List<CategoryAnalysisResultDTO> resultList = new ArrayList<>(); |
|
|
|
if (!CollectionUtils.isEmpty(resultDTOList)) { |
|
|
|
Result<List<String>> crmRes = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); |
|
|
|
List<String> subCustomerIds = new ArrayList<>(); |
|
|
|
if (crmRes.success() && !CollectionUtils.isEmpty(crmRes.getData())) { |
|
|
|
subCustomerIds = crmRes.getData(); |
|
|
|
} |
|
|
|
for (CategoryAnalysisResultDTO dto : resultDTOList) { |
|
|
|
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(dto.getCategoryCode(), customerId, subCustomerIds); |
|
|
|
if (null == projectCategoryDTO || StringUtils.isBlank(projectCategoryDTO.getCategoryName())) { |
|
|
|
log.warn(String.format("查询分类名称失败,当前客户:%s, categoryCode:%s", dto.getCategoryCode(), customerId)); |
|
|
|
continue; |
|
|
|
} |
|
|
|
CategoryAnalysisResultDTO resultDto = ConvertUtils.sourceToTarget(dto, CategoryAnalysisResultDTO.class); |
|
|
|
resultDto.setCategoryName(projectCategoryDTO.getCategoryName()); |
|
|
|
resultList.add(resultDto); |
|
|
|
} |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
} |
|
|
|