Browse Source

Merge remote-tracking branch 'origin/dev'

dev_shibei_match
yinzuomei 4 years ago
parent
commit
99ed7c84f6
  1. 29
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/CustomerProjectCategoryDTO.java
  2. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  3. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  4. 39
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  5. 43
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  6. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

29
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/CustomerProjectCategoryDTO.java

@ -0,0 +1,29 @@
package com.epmet.project;
import lombok.Data;
import java.io.Serializable;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/5/12 11:19
*/
@Data
public class CustomerProjectCategoryDTO implements Serializable {
/**
* 客户自己的分类编码
*/
private String categoryCode;
/**
* 客户自己的分类名称
*/
private String categoryName;
/**
* 分类等级12....产品只有2级分类
*/
private Integer level;
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -18,6 +18,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.project.CustomerProjectCategoryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -39,4 +40,6 @@ public interface ScreenProjectCategoryOrgDailyDao {
* @return java.util.List<com.epmet.dto.result.screen.CategoryAnalysisResultDTO>
*/
List<CategoryAnalysisResultDTO> selectCategoryAnalysis(@Param("agencyId") String agencyId,@Param("customerId")String customerId);
CustomerProjectCategoryDTO selectProjectCategory(@Param("categoryCode")String categoryCode, @Param("customerId")String customerId, @Param("subCustomerIds")List<String> subCustomerIds);
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -17,8 +17,7 @@ public interface ScreenProjectDataDao {
List<String> selectIdsByAreaCode(@Param("areaCode") String areaCode);
List<ScreenProjectDetailResultDTO> projectDistributionDetail(@Param("projectId") String projectId,
@Param("customerId") String customerId);
List<ScreenProjectDetailResultDTO> projectDistributionDetail(@Param("projectId") String projectId);
List<String> selectProjectImgs(@Param("projectId") String projectId,
@Param("customerId") String customerId);

39
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -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;
}
}

43
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -5,15 +5,11 @@
<select id="selectCategoryAnalysis" resultType="com.epmet.dto.result.screen.CategoryAnalysisResultDTO">
SELECT D.CATEGORY_NAME AS categoryName,
SELECT '' AS categoryName,
M.PROJECT_TOTAL AS projectTotal,
m.DATE_ID as dateId,
m.CATEGORY_CODE as categoryCode
FROM screen_project_category_org_daily m
left join customer_project_category_dict d
on(m.CATEGORY_CODE=D.CATEGORY_CODE
AND D.DEL_FLAG='0'
and d.CUSTOMER_ID=#{customerId})
WHERE M.DEL_FLAG = '0'
and m.level='1'
AND M.ORG_ID = #{agencyId}
@ -34,4 +30,41 @@
)
ORDER BY M.PROJECT_TOTAL desc,D.CATEGORY_NAME asc
</select>
<!-- 平阴的分类编码: 平阴自己的+ 子客户未对照的 -->
<select id="selectProjectCategory" parameterType="map" resultType="com.epmet.project.CustomerProjectCategoryDTO">
SELECT
*
FROM
(
SELECT DISTINCT
m.CATEGORY_CODE,
m.CATEGORY_NAME,
m.`LEVEL`
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.customer_id = #{customerId}
<if test="subCustomerIds != null and subCustomerIds.size() > 0">
UNION ALL
SELECT DISTINCT
m.CATEGORY_CODE,
m.CATEGORY_NAME,
m.`LEVEL`
FROM
customer_project_category_dict m
WHERE
m.DEL_FLAG = '0'
AND m.EPMET_CATEGORY_CODE IS NULL
AND m.customer_id IN
<foreach item="subCustomerId" collection="subCustomerIds" open="(" separator="," close=")">
#{subCustomerId}
</foreach>
</if>
) temp
WHERE
temp.CATEGORY_CODE = #{categoryCode}
LIMIT 1
</select>
</mapper>

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -72,7 +72,6 @@
WHERE
del_flag = '0'
AND project_id = #{projectId}
and CUSTOMER_ID= #{customerId}
</select>
<select id="selectProjectImgs" resultType="java.lang.String">
select PROJECT_IMG_URL from screen_project_img_data

Loading…
Cancel
Save