|
|
@ -9,6 +9,7 @@ import com.epmet.entity.stats.DimAgencyEntity; |
|
|
|
import com.epmet.entity.stats.DimGridEntity; |
|
|
|
import com.epmet.service.StatsGroupService; |
|
|
|
import com.epmet.service.group.GroupDataService; |
|
|
|
import com.epmet.service.org.CustomerGridService; |
|
|
|
import com.epmet.service.stats.*; |
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
import com.epmet.util.ModuleConstant; |
|
|
@ -21,6 +22,7 @@ import java.time.LocalDate; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.ZonedDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -44,6 +46,8 @@ public class StatsGroupServiceImpl implements StatsGroupService { |
|
|
|
private FactGroupAgencyMonthlyService factGroupAgencyMonthlyService; |
|
|
|
@Autowired |
|
|
|
private DimCustomerService dimCustomerService; |
|
|
|
@Autowired |
|
|
|
private CustomerGridService customerGridService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 统计【网格-日】 |
|
|
@ -132,7 +136,20 @@ public class StatsGroupServiceImpl implements StatsGroupService { |
|
|
|
String pidByAgencyId = dimAgencyService.getPidByAgencyId(agencyId); |
|
|
|
agencyResult.setPid(StringUtils.isBlank(pidByAgencyId)?"0":pidByAgencyId); |
|
|
|
// TODO 1. 机关下有多少网格
|
|
|
|
agencyResult.setGridTotal(allGrid.size()); |
|
|
|
List<String> customerGridIdList = customerGridService.getCustomerGridIdList(customerId, dateId); |
|
|
|
AtomicReference<Integer> gridSize = new AtomicReference<>(0); |
|
|
|
if (customerGridIdList.size() != NumConstant.ZERO){ |
|
|
|
customerGridIdList.forEach(gridId -> { |
|
|
|
allGrid.forEach(allAgencyGrid -> { |
|
|
|
if (gridId.equals(allAgencyGrid)){ |
|
|
|
gridSize.updateAndGet(v -> v + NumConstant.ONE); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
agencyResult.setGridTotal(gridSize.get()); |
|
|
|
}else { |
|
|
|
agencyResult.setGridTotal(NumConstant.ZERO); |
|
|
|
} |
|
|
|
|
|
|
|
// TODO 2. 机关下有多少小组,只算 state = ‘approved’
|
|
|
|
List<AgencyGroupTotalCountResultDTO> agencyGroupTotalCount = groupDataService.getAgencyGroupTotalCount(allGrid,dateId); |
|
|
|