Browse Source

Merge branch 'feature/statistical_zhy'

master
zhangyuan 3 years ago
parent
commit
e528c9b5ba
  1. 144
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactNeighborhoodUserHouseDailyDTO.java
  2. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java
  3. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java
  4. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactNeighborhoodUserHouseDailyDao.java
  5. 114
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactNeighborhoodUserHouseDailyEntity.java
  6. 78
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactNeighborhoodUserHouseDailyService.java
  7. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactNeighborhoodUserHouseDailyServiceImpl.java
  8. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml
  9. 35
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactNeighborhoodUserHouseDailyDao.xml
  10. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml

144
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactNeighborhoodUserHouseDailyDTO.java

@ -0,0 +1,144 @@
package com.epmet.dto.stats;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 网格的人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-01
*/
@Data
public class FactNeighborhoodUserHouseDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键customer_id+grid_id+date_id只有一条记录
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 数据更新至yyyyMMdd;
*/
private String dateId;
/**
* 网格id
*/
private String gridId;
/**
* 网格所属的组织id
*/
private String pid;
/**
* 网格所有上级id
*/
private String pids;
/**
* 小区ID
*/
private String neighbourhoodsId;
/**
* 小区名称
*/
private String neighborHoodName;
/**
* 房屋总数
*/
private Integer houseCount;
/**
* 自住房屋总数
*/
private Integer houseSelfCount;
/**
* 出租房屋总数
*/
private Integer houseLeaseCount;
/**
* 闲置房屋总数
*/
private Integer houseIdleCount;
/**
* 居民总数
*/
private Integer userCount;
/**
* 常住居民总数
*/
private Integer userResiCount;
/**
* 流动居民总数
*/
private Integer userFloatCount;
/**
* 当日新增房屋数
*/
private Integer houseIncr;
/**
* 当日修改房屋数
*/
private Integer houseModify;
/**
* 当日新增居民数
*/
private Integer userIncr;
/**
* 当日修改居民数
*/
private Integer userModify;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间第一次提交审核的时间注意和历史表的第一条记录时间一致
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java

@ -47,6 +47,16 @@ public class FactUserHouseResultDTO implements Serializable {
*/
private String agencyName;
/**
* 小区ID
*/
private String neighbourhoodsId;
/**
* 小区名称
*/
private String neighborHoodName;
/**
* agency_id所属的机关级别社区级community
街道:street,

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java

@ -72,6 +72,20 @@ public class FactUserHouseController {
return new Result();
}
/**
* 统计小区纬度
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhy
* @date 2022/5/31 9:48
*/
@PostMapping("userHouseStatNeighborhood")
public Result userHouseStatNeighborhood(@RequestBody FactUserHouseFormDTO formDTO) {
// factUserHouseService.statNeighborhood(formDTO);
return new Result();
}
/**
* 统计组织纬度
*

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactNeighborhoodUserHouseDailyDao.java

@ -0,0 +1,16 @@
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactNeighborhoodUserHouseDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 网格的人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-01
*/
@Mapper
public interface FactNeighborhoodUserHouseDailyDao extends BaseDao<FactNeighborhoodUserHouseDailyEntity> {
}

114
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactNeighborhoodUserHouseDailyEntity.java

@ -0,0 +1,114 @@
package com.epmet.entity.stats;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 网格的人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-01
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_neighborhood_user_house_daily")
public class FactNeighborhoodUserHouseDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 数据更新至yyyyMMdd;
*/
private String dateId;
/**
* 网格id
*/
private String gridId;
/**
* 网格所属的组织id
*/
private String pid;
/**
* 网格所有上级id
*/
private String pids;
/**
* 小区ID
*/
private String neighbourhoodsId;
/**
* 小区名称
*/
private String neighborHoodName;
/**
* 房屋总数
*/
private Integer houseCount;
/**
* 自住房屋总数
*/
private Integer houseSelfCount;
/**
* 出租房屋总数
*/
private Integer houseLeaseCount;
/**
* 闲置房屋总数
*/
private Integer houseIdleCount;
/**
* 居民总数
*/
private Integer userCount;
/**
* 常住居民总数
*/
private Integer userResiCount;
/**
* 流动居民总数
*/
private Integer userFloatCount;
/**
* 当日新增房屋数
*/
private Integer houseIncr;
/**
* 当日修改房屋数
*/
private Integer houseModify;
/**
* 当日新增居民数
*/
private Integer userIncr;
/**
* 当日修改居民数
*/
private Integer userModify;
}

78
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactNeighborhoodUserHouseDailyService.java

@ -0,0 +1,78 @@
package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.stats.FactNeighborhoodUserHouseDailyDTO;
import com.epmet.entity.stats.FactNeighborhoodUserHouseDailyEntity;
import java.util.List;
import java.util.Map;
/**
* 网格的人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-01
*/
public interface FactNeighborhoodUserHouseDailyService extends BaseService<FactNeighborhoodUserHouseDailyEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<FactNeighborhoodUserHouseDailyDTO>
* @author generator
* @date 2022-06-01
*/
PageData<FactNeighborhoodUserHouseDailyDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<FactNeighborhoodUserHouseDailyDTO>
* @author generator
* @date 2022-06-01
*/
List<FactNeighborhoodUserHouseDailyDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return FactNeighborhoodUserHouseDailyDTO
* @author generator
* @date 2022-06-01
*/
FactNeighborhoodUserHouseDailyDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-06-01
*/
void save(FactNeighborhoodUserHouseDailyDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2022-06-01
*/
void update(FactNeighborhoodUserHouseDailyDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2022-06-01
*/
void delete(String[] ids);
}

83
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactNeighborhoodUserHouseDailyServiceImpl.java

@ -0,0 +1,83 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.stats.FactNeighborhoodUserHouseDailyDao;
import com.epmet.dto.stats.FactNeighborhoodUserHouseDailyDTO;
import com.epmet.entity.stats.FactNeighborhoodUserHouseDailyEntity;
import com.epmet.service.stats.FactNeighborhoodUserHouseDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 网格的人房信息统计数按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-01
*/
@Service
public class FactNeighborhoodUserHouseDailyServiceImpl extends BaseServiceImpl<FactNeighborhoodUserHouseDailyDao, FactNeighborhoodUserHouseDailyEntity> implements FactNeighborhoodUserHouseDailyService {
@Override
public PageData<FactNeighborhoodUserHouseDailyDTO> page(Map<String, Object> params) {
IPage<FactNeighborhoodUserHouseDailyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, FactNeighborhoodUserHouseDailyDTO.class);
}
@Override
public List<FactNeighborhoodUserHouseDailyDTO> list(Map<String, Object> params) {
List<FactNeighborhoodUserHouseDailyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, FactNeighborhoodUserHouseDailyDTO.class);
}
private QueryWrapper<FactNeighborhoodUserHouseDailyEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<FactNeighborhoodUserHouseDailyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public FactNeighborhoodUserHouseDailyDTO get(String id) {
FactNeighborhoodUserHouseDailyEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, FactNeighborhoodUserHouseDailyDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(FactNeighborhoodUserHouseDailyDTO dto) {
FactNeighborhoodUserHouseDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactNeighborhoodUserHouseDailyEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(FactNeighborhoodUserHouseDailyDTO dto) {
FactNeighborhoodUserHouseDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactNeighborhoodUserHouseDailyEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml

@ -13,8 +13,8 @@
sum( CASE WHEN t.RENT_FLAG = '1' THEN 1 ELSE 0 END ) AS houseLeaseCount,
sum( CASE WHEN t.RENT_FLAG = '2' THEN 1 ELSE 0 END ) AS houseIdleCount,
sum( CASE WHEN t.id IS NOT NULL THEN 1 ELSE 0 END ) AS houseCount,
sum( CASE WHEN (t.id IS NOT NULL and DATE_FORMAT(t.CREATED_TIME,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS houseIncr,
sum( CASE WHEN (t.id IS NOT NULL and DATE_FORMAT(t.UPDATED_TIME,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS houseModify
sum( CASE WHEN (t.id IS NOT NULL and DATE_FORMAT(t.CREATED_TIME,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY ),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS houseIncr,
sum( CASE WHEN (t.id IS NOT NULL and DATE_FORMAT(t.UPDATED_TIME,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY ),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS houseModify
FROM
customer_grid g
LEFT JOIN (

35
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactNeighborhoodUserHouseDailyDao.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.stats.FactNeighborhoodUserHouseDailyDao">
<resultMap type="com.epmet.entity.stats.FactNeighborhoodUserHouseDailyEntity" id="factNeighborhoodUserHouseDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="neighbourhoodsId" column="NEIGHBOURHOODS_ID"/>
<result property="neighborHoodName" column="NEIGHBOR_HOOD_NAME"/>
<result property="houseCount" column="HOUSE_COUNT"/>
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/>
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/>
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/>
<result property="userCount" column="USER_COUNT"/>
<result property="userResiCount" column="USER_RESI_COUNT"/>
<result property="userFloatCount" column="USER_FLOAT_COUNT"/>
<result property="houseIncr" column="HOUSE_INCR"/>
<result property="houseModify" column="HOUSE_MODIFY"/>
<result property="userIncr" column="USER_INCR"/>
<result property="userModify" column="USER_MODIFY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml

@ -10,8 +10,8 @@
sum( CASE WHEN IS_FLOATING = '0' THEN 1 ELSE 0 END ) AS userResiCount,
sum( CASE WHEN IS_FLOATING = '1' THEN 1 ELSE 0 END ) AS userFloatCount,
sum( CASE WHEN id IS NOT NULL THEN 1 ELSE 0 END ) AS userCount,
sum( CASE WHEN (id IS NOT NULL and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS userIncr,
sum( CASE WHEN (id IS NOT NULL and DATE_FORMAT(UPDATED_TIME,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS userModify
sum( CASE WHEN (id IS NOT NULL and DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY ),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS userIncr,
sum( CASE WHEN (id IS NOT NULL and DATE_FORMAT(UPDATED_TIME,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 DAY ),'%Y-%m-%d')) THEN 1 ELSE 0 END ) AS userModify
FROM
ic_resi_user
WHERE

Loading…
Cancel
Save