Browse Source

网格小组统计修改

master
zxc 5 years ago
parent
commit
c31210c538
  1. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/AgencyMonthlyFormDTO.java
  2. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/AgencyGroupDailyResultDTO.java
  3. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupGridDailyResultDTO.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyDailyDao.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupGridDailyDao.java
  6. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java
  7. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  8. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java
  9. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java
  10. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java
  11. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java
  12. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml
  13. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyMonthlyDao.xml
  14. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/AgencyMonthlyFormDTO.java

@ -19,6 +19,11 @@ public class AgencyMonthlyFormDTO implements Serializable {
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 机关ID
*/

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/AgencyGroupDailyResultDTO.java

@ -18,6 +18,11 @@ public class AgencyGroupDailyResultDTO implements Serializable {
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 机构ID
*/

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/GroupGridDailyResultDTO.java

@ -18,6 +18,11 @@ public class GroupGridDailyResultDTO implements Serializable {
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 机构ID 关联机关dim表
*/

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupAgencyDailyDao.java

@ -62,6 +62,6 @@ public interface FactGroupAgencyDailyDao extends BaseDao<FactGroupAgencyDailyEnt
* @param dateId
* @author zxc
*/
void deleteInsertAgencyDailyByDateId(@Param("dateId")String dateId);
void deleteInsertAgencyDailyByDateId(@Param("dateId")String dateId,@Param("customerId")String customerId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGroupGridDailyDao.java

@ -46,6 +46,6 @@ public interface FactGroupGridDailyDao extends BaseDao<FactGroupGridDailyEntity>
* @param dateId
* @author zxc
*/
void deleteInsertDateId(@Param("dateId")String dateId);
void deleteInsertDateId(@Param("dateId")String dateId,@Param("customerId")String customerId);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java

@ -47,6 +47,7 @@ public class GroupDataServiceImpl implements GroupDataService {
BeanUtils.copyProperties(dimTime,dailyResult);
dailyResult.setAgencyId(grid.getAgencyId());
dailyResult.setGridId(grid.getId());
dailyResult.setCustomerId(customerId);
result.add(dailyResult);
});

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

@ -62,7 +62,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date);
List<DimGridEntity> gridsInfo = dimGridService.getGridListByCustomerId(customerId);
List<GroupGridDailyResultDTO> resultDTOS = groupDataService.groupGridDaily(customerId,dimIdBean,gridsInfo);
factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS);
factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS,customerId);
});
}
@ -84,7 +84,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
List<DimAgencyDTO> customerAgencyInfos = dimAgencyService.getAgencyInfoByCustomerId(customerId);
List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily,customerId);
});
}
@ -125,6 +125,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
AgencyGroupDailyResultDTO agencyResult = new AgencyGroupDailyResultDTO();
String agencyId = agency.getId();
agencyResult.setAgencyId(agencyId);
agencyResult.setCustomerId(customerId);
BeanUtils.copyProperties(timeDim,agencyResult);
//机关下的所有网格(包括直属网格)
List<String> allGrid = this.getAllGrid(agencyId);
@ -157,9 +158,9 @@ public class StatsGroupServiceImpl implements StatsGroupService {
agencyResult.setGroupMemberMinCount(sorted.get(NumConstant.ZERO).getGroupCount());
agencyResult.setMinMemberGroupId(sorted.get(NumConstant.ZERO).getGroupId());
}else if (sorted.size() >= NumConstant.TWO){
groupPeopleMedian = sorted.size() % 2 == 0 ?
(sorted.get(sorted.size() / 2 - 1).getGroupCount() + sorted.get(sorted.size() / 2).getGroupCount()) / 2 :
sorted.get(sorted.size() / 2).getGroupCount();
groupPeopleMedian = sorted.size() % NumConstant.TWO == NumConstant.ZERO ?
(sorted.get(sorted.size() / NumConstant.TWO - NumConstant.ONE).getGroupCount() + sorted.get(sorted.size() / 2).getGroupCount()) / 2 :
sorted.get(sorted.size() / NumConstant.TWO).getGroupCount();
agencyResult.setGroupMedian(groupPeopleMedian);
agencyResult.setGroupMemberMaxCount(sorted.get(NumConstant.ZERO).getGroupCount());

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupAgencyDailyService.java

@ -24,7 +24,6 @@ import com.epmet.dto.group.result.AgencyGroupDailyResultDTO;
import com.epmet.dto.group.result.AgencyGroupMonthlyResultDTO;
import com.epmet.dto.stats.FactGroupAgencyDailyDTO;
import com.epmet.entity.stats.FactGroupAgencyDailyEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -102,7 +101,7 @@ public interface FactGroupAgencyDailyService extends BaseService<FactGroupAgency
* @param agencyList
* @author zxc
*/
void insertGroupAgencyDaily(@Param("agencyList") List<AgencyGroupDailyResultDTO> agencyList);
void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId);
/**
* @Description 获取 网格小组机关-日统计的最后一天数据

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGroupGridDailyService.java

@ -99,5 +99,5 @@ public interface FactGroupGridDailyService extends BaseService<FactGroupGridDail
* @param formDto
* @author zxc
*/
void statisticsGroupGridDaily(List<GroupGridDailyResultDTO> formDto);
void statisticsGroupGridDaily(List<GroupGridDailyResultDTO> formDto,String customerId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupAgencyDailyServiceImpl.java

@ -109,9 +109,9 @@ public class FactGroupAgencyDailyServiceImpl extends BaseServiceImpl<FactGroupAg
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList) {
public void insertGroupAgencyDaily(List<AgencyGroupDailyResultDTO> agencyList,String customerId) {
if (agencyList.size() != NumConstant.ZERO){
baseDao.deleteInsertAgencyDailyByDateId(agencyList.get(NumConstant.ZERO).getDateId());
baseDao.deleteInsertAgencyDailyByDateId(agencyList.get(NumConstant.ZERO).getDateId(),customerId);
baseDao.insertGroupAgencyDaily(agencyList);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGroupGridDailyServiceImpl.java

@ -111,12 +111,12 @@ public class FactGroupGridDailyServiceImpl extends BaseServiceImpl<FactGroupGrid
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void statisticsGroupGridDaily(List<GroupGridDailyResultDTO> formDto) {
public void statisticsGroupGridDaily(List<GroupGridDailyResultDTO> formDto,String customerId) {
if (formDto.size() == NumConstant.ZERO){
return;
}
String dateId = formDto.get(NumConstant.ZERO).getDateId();
baseDao.deleteInsertDateId(dateId);
baseDao.deleteInsertDateId(dateId,customerId);
baseDao.insertGroupGridDaily(formDto);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyDailyDao.xml

@ -32,13 +32,14 @@
<insert id="insertGroupAgencyDaily">
INSERT INTO fact_group_agency_daily (
ID, AGENCY_ID, PID, DATE_ID, WEEK_ID, MONTH_ID, QUARTER_ID, YEAR_ID, GRID_TOTAL, GROUP_TOTAL_COUNT, GROUP_MEMBER_TOTAL_COUNT,
ID, CUSTOMER_ID, AGENCY_ID, PID, DATE_ID, WEEK_ID, MONTH_ID, QUARTER_ID, YEAR_ID, GRID_TOTAL, GROUP_TOTAL_COUNT, GROUP_MEMBER_TOTAL_COUNT,
GROUP_MEMBER_AVG_COUNT, GROUP_MEDIAN, GROUP_INCR, GROUP_MEMBER_MAX_COUNT, MAX_MEMBER_GROUP_ID, GROUP_MEMBER_MIN_COUNT,
MIN_MEMBER_GROUP_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="agencyList" item="agency" separator=",">
(
REPLACE(UUID(),'-',''),
#{agency.customerId},
#{agency.agencyId},
#{agency.pid},
#{agency.dateId},
@ -70,6 +71,7 @@
<select id="getLastDayAgency" resultType="com.epmet.dto.group.form.AgencyMonthlyFormDTO" parameterType="java.lang.String">
SELECT
ID AS id,
customer_id AS customerId,
AGENCY_ID AS agencyId,
PID AS pid,
MONTH_ID AS monthId,
@ -111,12 +113,13 @@
</select>
<!-- 删除当天已存在数据 -->
<delete id="deleteInsertAgencyDailyByDateId" parameterType="java.lang.String">
<delete id="deleteInsertAgencyDailyByDateId">
DELETE
FROM
fact_group_agency_daily
WHERE
date_id = #{dateId}
AND customer_id = #{customerId}
</delete>
</mapper>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupAgencyMonthlyDao.xml

@ -30,7 +30,7 @@
<insert id="insertAgencyGroupMonthly">
INSERT INTO fact_group_agency_monthly
(ID, AGENCY_ID, PID, MONTH_ID, QUARTER_ID, YEAR_ID, GRID_TOTAL, GROUP_TOTAL, GROUP_MEMBER_TOTAL,
(ID, CUSTOMER_ID, AGENCY_ID, PID, MONTH_ID, QUARTER_ID, YEAR_ID, GRID_TOTAL, GROUP_TOTAL, GROUP_MEMBER_TOTAL,
GROUP_MEMBER_AVG_COUNT, GROUP_MEDIAN, GROUP_INCR, GROUP_MEMBER_MAX_COUNT, MAX_MEMBER_GROUP_ID,
GROUP_MEMBER_MIN_COUNT, MIN_MEMBER_GROUP_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME,
UPDATED_BY, UPDATED_TIME)
@ -38,6 +38,7 @@
<foreach collection="agencyMonth" item="agency" separator=",">
(
REPLACE(UUID(),'-',''),
#{agency.customerId},
#{agency.agencyId},
#{agency.pid},
#{agency.monthId},

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml

@ -31,13 +31,14 @@
</resultMap>
<insert id="insertGroupGridDaily">
INSERT INTO fact_group_grid_daily (ID, AGENCY_ID, GRID_ID, DATE_ID, WEEK_ID, MONTH_ID, YEAR_ID, QUARTER_ID, GRID_TOTAL,
INSERT INTO fact_group_grid_daily (ID, CUSTOMER_ID, AGENCY_ID, GRID_ID, DATE_ID, WEEK_ID, MONTH_ID, YEAR_ID, QUARTER_ID, GRID_TOTAL,
GROUP_TOTAL, GROUP_MEMBER_TOTAL, GROUP_MEMBER_AVG_COUNT, GROUP_MEDIAN, GROUP_INCR, GROUP_MEMBER_MAX_COUNT, MAX_MEMBER_GROUP_ID,
GROUP_MEMBER_MIN_COUNT, MIN_MEMBER_GROUP_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
VALUES
<foreach collection="formDto" item="grid" separator=",">
(
REPLACE(UUID(),'-',''),
#{grid.customerId},
#{grid.agencyId},
#{grid.gridId},
#{grid.dateId},
@ -66,12 +67,13 @@
</insert>
<!-- 删除已存在的数据【当天】防止当天数据多条 -->
<delete id="deleteInsertDateId" parameterType="java.lang.String">
<delete id="deleteInsertDateId">
DELETE
FROM
fact_group_grid_daily
WHERE
date_id = #{dateId}
AND customer_id = #{customerId}
</delete>
</mapper>
Loading…
Cancel
Save