Browse Source

事件分析抽取逻辑bug修改,效率分析查询接口修改

master
yinzuomei 5 years ago
parent
commit
be99eb8077
  1. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java
  7. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java
  8. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java
  9. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  11. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  12. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml
  13. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  14. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml

@ -43,7 +43,7 @@
INNER JOIN screen_customer_agency a ON ( m.ORG_ID = a.AGENCY_ID AND a.DEL_FLAG = '0' )
WHERE
m.DEL_FLAG = '0'
AND a.AREA_CODE LIKE concat( #{areaCode}, '%')
AND a.PARENT_AREA_CODE=#{areaCode}
AND M.DATE_ID=(
select t1.DATE_ID from screen_project_org_daily t1
where t1.DEL_FLAG='0'

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -790,8 +790,8 @@ public class DemoController {
@RequestParam("dateId") String dateId,
@RequestParam("monthId") String monthId) {
screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId);
screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId);
screenProjectQuantityGridMonthlyService.extractionProjectGridMonthly(customerId, monthId);
screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId);
screenProjectQuantityOrgMonthlyService.extractionProjectOrgMonthly(customerId, monthId);
return new Result();
}

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

@ -23,6 +23,8 @@ import com.epmet.entity.crm.CustomerRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户关系表(01.14 add)
*
@ -39,4 +41,6 @@ public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
* @Date 2021/1/21 11:27
**/
CustomerSubInfoDTO selectCustomerSubInfo(@Param("customerId")String customerId);
List<CustomerRelationEntity> selectListByPids(String customerId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -192,4 +192,6 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @date 2021/2/1 下午2:03
*/
List<ScreenProjectOrgDailyDTO> selectAgencyByCustomer(@Param("customerId")String customerId);
List<ScreenProjectOrgDailyDTO> selectAgencyByAreaCode(String areaCode);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -31,4 +31,6 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @date 2021/1/14 上午11:07
*/
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(@Param("customerIds") List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
}

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

@ -41,4 +41,6 @@ public interface CustomerRelationService extends BaseService<CustomerRelationEnt
* @Date 2021/1/14 16:22
**/
Map<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds);
boolean haveSubCustomer(String customerId);
}

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

@ -73,4 +73,13 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
}
return list.stream().collect(Collectors.toMap(CustomerSubInfoDTO::getCustomerId, customer -> customer));
}
@Override
public boolean haveSubCustomer(String customerId) {
List<CustomerRelationEntity> list=baseDao.selectListByPids(customerId);
if(null==list||list.isEmpty()){
return false;
}
return true;
}
}

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

@ -23,7 +23,6 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
@ -34,7 +33,10 @@ import com.epmet.dto.pingyin.result.ProjectOrgDailyResultDTO;
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectOrgDailyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService;
import com.epmet.service.org.CustomerAgencyService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
@ -45,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -62,6 +65,10 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
@Autowired
private ScreenCustomerAgencyDao agencyDao;
@Autowired
private CustomerRelationService customerRelationService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Override
public PageData<ScreenProjectOrgDailyDTO> page(Map<String, Object> params) {
@ -148,9 +155,18 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
*/
@Override
public void extractionProjectOrgDaily(String customerId, String dateId) {
List<ScreenProjectOrgDailyDTO> agencyInfos = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> agencyInfos = new ArrayList<>();
//如果有子客户要按照跟组织的area_code查询组织列表
if(customerRelationService.haveSubCustomer(customerId)){
//
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId);
agencyInfos=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode());
}else{
agencyInfos=agencyDao.selectAgencyByCustomer(customerId);
}
if (CollectionUtils.isEmpty(agencyInfos)){
throw new RenException(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
}
List<ProjectOrgDailyResultDTO> projectOrgDaily = baseDao.selectOrgProject(agencyInfos, dateId);
if (CollectionUtils.isEmpty(projectOrgDaily)){

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

@ -23,7 +23,6 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
@ -35,7 +34,10 @@ import com.epmet.dto.screen.ScreenProjectOrgDailyDTO;
import com.epmet.dto.screen.ScreenProjectQuantityOrgMonthlyDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService;
import com.epmet.service.org.CustomerAgencyService;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
@ -45,6 +47,7 @@ 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;
@ -62,7 +65,10 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
@Autowired
private ScreenCustomerAgencyDao agencyDao;
@Autowired
private CustomerRelationService customerRelationService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Override
public PageData<ScreenProjectQuantityOrgMonthlyDTO> page(Map<String, Object> params) {
IPage<ScreenProjectQuantityOrgMonthlyEntity> page = baseDao.selectPage(
@ -147,10 +153,20 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
*/
@Override
public void extractionProjectOrgMonthly(String customerId, String monthId) {
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS = agencyDao.selectAgencyByCustomer(customerId);
List<ScreenProjectOrgDailyDTO> screenProjectOrgDailyDTOS = new ArrayList<>();
//如果有子客户要按照跟组织的area_code查询组织列表
if(customerRelationService.haveSubCustomer(customerId)){
//
CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId);
screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode());
}else{
screenProjectOrgDailyDTOS=agencyDao.selectAgencyByCustomer(customerId);
}
if (CollectionUtils.isEmpty(screenProjectOrgDailyDTOS)){
throw new RenException(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
log.warn(String.format(PingYinConstants.AGENCY_INFO_IS_ZERO,customerId));
return;
}
List<ScreenProjectQuantityOrgMonthlyDTO> agencyInfos = ConvertUtils.sourceToTarget(screenProjectOrgDailyDTOS, ScreenProjectQuantityOrgMonthlyDTO.class);
List<ProjectOrgMonthlyResultDTO> projectOrg = baseDao.selectQuantityOrgMonthly(agencyInfos, monthId);
if (!CollectionUtils.isEmpty(projectOrg)){
@ -174,6 +190,7 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
if (a.getAreaCode().equals(p.getAreaCode())){
a.setClosedIncr(p.getClosedIncr());
a.setProjectIncr(p.getProjectIncr());
a.setProjectIncr(p.getProjectIncr());
}
});
}
@ -183,6 +200,7 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl<
a.setClosedTotal(p.getClosedTotal());
a.setProjectTotal(p.getProjectTotal());
a.setUnClosedTotal(p.getUnClosedTotal());
a.setProjectIncr(p.getProjectIncr());
}
});
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -18,4 +18,6 @@ public interface CustomerAgencyService {
* @date 2021/1/14 上午11:07
*/
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -45,4 +45,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
}
return new ArrayList<>();
}
@Override
public CustomerAgencyEntity getRootAgencyInfo(String customerId) {
return customerAgencyDao.getRootAgencyInfo(customerId);
}
}

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

@ -22,4 +22,16 @@
AND cr.`STATUS` = 'open'
AND cr.PARENT_CUSTOMER_ID =#{customerId}
</select>
<select id="selectListByPids" parameterType="java.lang.String" resultType="com.epmet.entity.crm.CustomerRelationEntity">
SELECT
*
FROM
customer_relation cr
WHERE
cr.DEL_FLAG = '0'
AND cr.PIDS LIKE CONCAT(
#{customerId},
'%')
</select>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -377,4 +377,17 @@
WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
</select>
<select id="selectAgencyByAreaCode" resultType="com.epmet.dto.screen.ScreenProjectOrgDailyDTO">
SELECT
sca.CUSTOMER_ID,
sca.AGENCY_ID AS orgId,
sca.PID,
sca.PIDS,
sca.`LEVEL` AS orgType,
sca.AREA_CODE
FROM screen_customer_agency sca
WHERE DEL_FLAG = 0
and sca.AREA_CODE like CONCAT(#{areaCode},'%')
</select>
</mapper>

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -118,4 +118,11 @@
)
</select>
<select id="getRootAgencyInfo" resultType="com.epmet.entity.org.CustomerAgencyEntity">
select *
from customer_agency ca
where ca.del_flag='0'
and ca.pid='0'
and ca.CUSTOMER_ID=#{customerId}
</select>
</mapper>
Loading…
Cancel
Save