Browse Source

项目分类

dev_shibei_match
zxc 4 years ago
parent
commit
c72cf84966
  1. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java
  2. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java
  3. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java
  4. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java
  5. 74
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  6. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java

@ -43,4 +43,12 @@ public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
CustomerSubInfoDTO selectCustomerSubInfo(@Param("customerId")String customerId);
List<CustomerRelationEntity> selectListByPids(String customerId);
/**
* @Description 查询子级客户
* @Param customerId
* @author zxc
* @date 2021/3/23 上午10:21
*/
List<CustomerRelationEntity> selectSubCustomer(@Param("customerId") String customerId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java

@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.indexcal.CustomerSubInfoDTO;
import com.epmet.entity.crm.CustomerRelationEntity;
import java.util.List;
/**
* 客户关系表(01.14 add)
*
@ -40,4 +42,12 @@ public interface CustomerRelationService extends BaseService<CustomerRelationEnt
CustomerSubInfoDTO getCustomerSubInfo(String customerId);
boolean haveSubCustomer(String customerId);
/**
* @Description 查询子级客户
* @Param customerId
* @author zxc
* @date 2021/3/23 上午10:21
*/
List<CustomerRelationEntity> selectSubCustomer(String customerId);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java

@ -27,9 +27,11 @@ import com.epmet.entity.crm.CustomerRelationEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.stats.DimCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -70,4 +72,18 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
}
return true;
}
/**
* @Description 查询子级客户
* @Param customerId
* @author zxc
* @date 2021/3/23 上午10:21
*/
@Override
public List<CustomerRelationEntity> selectSubCustomer(String customerId) {
if (StringUtils.isEmpty(customerId)){
return new ArrayList<>();
}
return baseDao.selectSubCustomer(customerId);
}
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java

@ -102,4 +102,13 @@ public interface ScreenProjectCategoryOrgDailyService extends BaseService<Screen
* @return void
*/
void collect(ScreenCollFormDTO<ScreenProjectCategoryOrgDailyDTO> param);
/**
* @Description 按组织计算分类统计项目数量
* @Param customerId
* @Param dateId
* @author zxc
* @date 2021/3/23 上午10:07
*/
void extractProjectCategoryOrgData(String customerId, String dateId);
}

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

@ -29,14 +29,19 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.crm.CustomerRelationEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -51,6 +56,8 @@ import java.util.Map;
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<ScreenProjectCategoryOrgDailyDao, ScreenProjectCategoryOrgDailyEntity> implements ScreenProjectCategoryOrgDailyService {
@Autowired
private CustomerRelationService relationService;
@Override
public PageData<ScreenProjectCategoryOrgDailyDTO> page(Map<String, Object> params) {
@ -131,4 +138,71 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
}
}
/**
* @Description 按组织计算分类统计项目数量
* @Param customerId
* @Param dateId
* @author zxc
* @date 2021/3/23 上午10:07
*/
@Override
public void extractProjectCategoryOrgData(String customerId, String dateId) {
List<ScreenProjectCategoryOrgDailyEntity> needInsert = new ArrayList<>();
// 先查询有无子客户
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
if (CollectionUtils.isEmpty(relationInfo)){
needInsert = disposeOneCustomer(customerId, dateId);
}else {
needInsert = disposeMoreCustomer(customerId,dateId,relationInfo);
}
deleteAndInsert(customerId,dateId,needInsert);
}
/**
* @Description 单客户处理
* @Param customerId
* @Param dateId
* @author zxc
* @date 2021/3/23 上午10:40
*/
private List<ScreenProjectCategoryOrgDailyEntity> disposeOneCustomer(String customerId, String dateId){
return new ArrayList<>();
}
/**
* @Description 多客户处理
* @Param customerId
* @Param dateId
* @Param relationInfo 子级客户信息
* @author zxc
* @date 2021/3/23 上午10:40
*/
private List<ScreenProjectCategoryOrgDailyEntity> disposeMoreCustomer(String customerId, String dateId,List<CustomerRelationEntity> relationInfo){
return new ArrayList<>();
}
/**
* @Description 删除和新增
* @Param customerId
* @Param dateId
* @author zxc
* @date 2021/3/23 上午10:52
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(String customerId, String dateId, List<ScreenProjectCategoryOrgDailyEntity> needInsert){
if (CollectionUtils.isEmpty(needInsert)){
return;
}
Integer row = NumConstant.ZERO;
do {
row = baseDao.deleteByDateIdAndCustomerId(customerId, dateId);
}while (row > NumConstant.ZERO && row == NumConstant.ONE_THOUSAND);
List<List<ScreenProjectCategoryOrgDailyEntity>> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
insertBatch(p);
});
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml

@ -34,4 +34,9 @@
#{customerId},
'%')
</select>
<!-- 查询子级客户 -->
<select id="selectSubCustomer" resultType="com.epmet.entity.crm.CustomerRelationEntity">
SELECT * FROM customer_relation WHERE DEL_FLAG = 0 AND PARENT_CUSTOMER_ID = #{customerId}
</select>
</mapper>
Loading…
Cancel
Save