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