Browse Source

网格小组

dev_shibei_match
zxc 5 years ago
parent
commit
e982425493
  1. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  2. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  3. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  4. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  5. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -50,4 +50,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @author zxc
*/
List<AgencyGridTotalCountResultDTO> selectAgencyGridTotalCount(@Param("formDto") List<AgencyDTO> formDto, @Param("dateId")String dateId);
/**
* @Description 获取客户下某个时间点以前的网格ID
* @param customerId
* @param dateId
* @author zxc
*/
List<String> getCustomerGridIdList(@Param("customerId") String customerId, @Param("dateId") String dateId);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

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

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java

@ -23,4 +23,12 @@ public interface CustomerGridService {
* @author zxc
*/
List<AgencyGridTotalCountResultDTO> selectAgencyGridTotalCount(List<AgencyDTO> community, String dateId);
/**
* @Description 获取客户下某个时间点以前的网格ID
* @param customerId
* @param dateId
* @author zxc
*/
List<String> getCustomerGridIdList(String customerId,String dateId);
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -34,4 +34,15 @@ public class CustomerGridServiceImpl implements CustomerGridService {
public List<AgencyGridTotalCountResultDTO> selectAgencyGridTotalCount(List<AgencyDTO> community, String dateId) {
return customerGridDao.selectAgencyGridTotalCount(community,dateId);
}
/**
* @Description 获取客户下某个时间点以前的网格ID
* @param customerId
* @param dateId
* @author zxc
*/
@Override
public List<String> getCustomerGridIdList(String customerId, String dateId) {
return customerGridDao.getCustomerGridIdList(customerId, dateId);
}
}

12
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -34,4 +34,16 @@
AND DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{dateId}
</foreach>
</select>
<!-- 获取客户下某个时间点以前的网格ID -->
<select id="getCustomerGridIdList" resultType="java.lang.String">
SELECT
id AS gridId
FROM
customer_grid
WHERE
del_flag = 0
AND customer_id = #{customerId}
AND DATE_FORMAT( created_time, '%Y%m%d' ) <![CDATA[ <= ]]> #{dateId}
</select>
</mapper>
Loading…
Cancel
Save