15 changed files with 126 additions and 19 deletions
@ -1,16 +1,63 @@ |
|||
package com.epmet.service.screen.impl; |
|||
|
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.indexcoll.FactIndexPartyAblityCpcMonthlyDao; |
|||
import com.epmet.dto.screen.form.IndexCalculateForm; |
|||
import com.epmet.entity.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; |
|||
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|||
import com.epmet.service.screen.IndexCalculateService; |
|||
import com.epmet.util.DimIdGenerator; |
|||
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.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author liujianjun |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class IndexCalculateServiceImpl implements IndexCalculateService { |
|||
@Autowired |
|||
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; |
|||
@Autowired |
|||
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; |
|||
|
|||
@Override |
|||
public void cpcIndexCalculate(IndexCalculateForm formDTO) { |
|||
public Boolean indexCalculate(IndexCalculateForm formDTO) { |
|||
if (StringUtils.isBlank(formDTO.getMonthId())) { |
|||
//默认 当前月份-1
|
|||
formDTO.setMonthId(DimIdGenerator.getMonthDimId(DateUtils.addDateMonths(new Date(), -1))); |
|||
} |
|||
//按照客户分组
|
|||
if (CollectionUtils.isEmpty(formDTO.getCustomerIds())) { |
|||
Result<List<String>> externalCustomerIdsResult = epmetCommonServiceOpenFeignClient.getExternalCustomerIds(); |
|||
if (!externalCustomerIdsResult.success()) { |
|||
log.error("cpcIndexCalculate epmetCommonServiceOpenFeignClient.getExternalCustomerIds return fail"); |
|||
return false; |
|||
} |
|||
formDTO.setCustomerIds(externalCustomerIdsResult.getData()); |
|||
} |
|||
formDTO.getCustomerIds().forEach(customerId -> { |
|||
//计算党员
|
|||
try { |
|||
List<FactIndexPartyAblityCpcMonthlyEntity> list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(customerId, formDTO.getMonthId()); |
|||
} catch (Exception e) { |
|||
|
|||
} |
|||
|
|||
//计算网格
|
|||
//TODO
|
|||
|
|||
//计算社区
|
|||
//TODO
|
|||
|
|||
}); |
|||
return true; |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue