From bc37531718815ea529428a07d56be7ad2102a8a4 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Wed, 25 May 2022 13:35:05 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BA=BA=E6=88=BF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/org/IcHouseDao.java | 26 + .../com/epmet/dao/user/IcResiUserDao.java | 39 ++ .../com/epmet/entity/org/IcHouseEntity.java | 110 ++++ .../epmet/entity/user/IcResiUserEntity.java | 513 ++++++++++++++++++ .../com/epmet/service/org/HouseService.java | 37 ++ .../service/org/impl/HouseServiceImpl.java | 80 +++ .../epmet/service/user/IcResiUserService.java | 39 ++ .../user/impl/IcResiUserServiceImpl.java | 90 +++ .../main/resources/mapper/org/IcHouseDao.xml | 39 ++ .../resources/mapper/user/IcResiUserDao.xml | 28 + 10 files changed, 1001 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/IcHouseEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/IcResiUserEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java new file mode 100644 index 0000000000..040f5ec9a4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java @@ -0,0 +1,26 @@ +package com.epmet.dao.org; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.HouseChartResultDTO; +import com.epmet.entity.org.IcHouseEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +@Mapper +public interface IcHouseDao extends BaseDao { + + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + List houseChart(@Param("orgId") String orgId, @Param("orgType") String orgType); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java new file mode 100644 index 0000000000..5625f9a3c5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.user; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.UserChartResultDTO; +import com.epmet.entity.user.IcResiUserEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户基础信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-26 + */ +@Mapper +public interface IcResiUserDao extends BaseDao { + + List userChart(@Param("orgId") String orgId, @Param("orgType") String orgType); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/IcHouseEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/IcHouseEntity.java new file mode 100644 index 0000000000..889f5b3d86 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/IcHouseEntity.java @@ -0,0 +1,110 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.org; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_house") +public class IcHouseEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 片区id,neighbor_hood_part.id,可为空。 + */ + private String partId; + + /** + * 所属楼栋id + */ + private String buildingId; + + /** + * 所属单元id + */ + private String buildingUnitId; + + /** + * 房屋名字后台插入时生成 + */ + private String houseName; + + /** + * 门牌号 + */ + private String doorName; + + /** + * 房屋类型,这里存储字典value就可以 + */ + private String houseType; + + /** + * 存储字典value + */ + private String purpose; + + /** + * 1出租;0未出租 + */ + private Integer rentFlag; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证号 + */ + private String ownerIdCard; + + /** + * 排序 + */ + private BigDecimal sort; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/IcResiUserEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/IcResiUserEntity.java new file mode 100644 index 0000000000..4a2260b045 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/user/IcResiUserEntity.java @@ -0,0 +1,513 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.user; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户基础信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_resi_user") +public class IcResiUserEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * + */ + private String agencyId; + + /** + * + */ + private String pids; + + /** + * 网格ID + */ + private String gridId; + + /** + * 所属小区ID + */ + private String villageId; + + /** + * 所属楼宇Id + */ + private String buildId; + + /** + * 单元id + */ + private String unitId; + + /** + * 所属家庭Id + */ + private String homeId; + + /** + * 是否本地户籍 + */ + private String isBdhj; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String mobile; + + /** + * 性别 + */ + private String gender; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 出生日期 + */ + private String birthday; + + /** + * 备注 + */ + private String remarks; + + /** + * 联系人 + */ + private String contacts; + + /** + * 联系人电话 + */ + private String contactsMobile; + + /** + * 九小场所url + */ + private String ninePlace; + + /** + * 是否党员 + */ + private String isParty; + + /** + * 是否低保户 + */ + private String isDbh; + + /** + * 是否保障房 + */ + private String isEnsureHouse; + + /** + * 是否失业 + */ + private String isUnemployed; + + /** + * 是否育龄妇女 + */ + private String isYlfn; + + /** + * 是否退役军人 + */ + private String isVeterans; + + /** + * 是否统战人员 + */ + private String isUnitedFront; + + /** + * 是否信访人员 + */ + private String isXfry; + + /** + * 是否志愿者 + */ + private String isVolunteer; + + /** + * 是否老年人 + */ + private String isOldPeople; + + /** + * 是否空巢 + */ + private String isKc; + + /** + * 是否失独 + */ + private String isSd; + + /** + * 是否失能 + */ + private String isSn; + + /** + * 是否失智 + */ + private String isSz; + + /** + * 是否残疾 + */ + private String isCj; + + /** + * 是否大病 + */ + private String isDb; + + /** + * 是否慢病 + */ + private String isMb; + + /** + * 是否特殊人群 + */ + private String isSpecial; + + /** + * 是否租户【是:1 否:0】 + */ + private String isTenant; + + /** + * 是否流动人口【是:1 否:0】 + */ + private String isFloating; + + /** + * 文化程度【字典表】 + */ + private String culture; + + /** + * 文化程度备注 + */ + private String cultureRemakes; + + /** + * 特长【字典表】 + */ + private String specialSkill; + + /** + * 兴趣爱好 + */ + private String hobby; + + /** + * 兴趣爱好备注 + */ + private String hobbyRemakes; + + /** + * 宗教信仰 + */ + private String faith; + + /** + * 宗教信仰备注 + */ + private String faithRemakes; + + /** + * 残疾类别【字典表】 + */ + private String cjlb; + + /** + * 残疾登记(状况)【字典表】 + */ + private String cjzk; + + /** + * 残疾证号 + */ + private String cjzh; + + /** + * 残疾说明 + */ + private String cjsm; + + /** + * 有无监护人【yes no】 + */ + private String ynJdr; + + /** + * 有无技能特长【yes no】 + */ + private String ynJntc; + + /** + * 有无劳动能力 + */ + private String ynLdnl; + + /** + * 有无非义务教育阶段助学【yes no】 + */ + private String ynFywjyjdzx; + + /** + * 所患大病 + */ + private String shdb; + + /** + * 患大病时间 + */ + private String dbsj; + + /** + * 所患慢性病 + */ + private String shmxb; + + /** + * 患慢性病时间 + */ + private String mxbsj; + + /** + * 是否参保 + */ + private String isCb; + + /** + * 自付金额 + */ + private String zfje; + + /** + * 救助金额 + */ + private String jzje; + + /** + * 救助时间[yyyy-MM-dd] + */ + private String jzsj; + + /** + * 享受救助明细序号 + */ + private String jzmxxh; + + /** + * 健康信息备注 + */ + private String healthRemakes; + + /** + * 工作单位 + */ + private String gzdw; + + /** + * 职业 + */ + private String zy; + + /** + * 离退休时间 + */ + private String ltxsj; + + /** + * 工作信息备注 + */ + private String workRemake; + + /** + * 退休金额 + */ + private String txje; + + /** + * 月收入 + */ + private String ysr; + + /** + * 籍贯 + */ + private String jg; + + /** + * 户籍所在地 + */ + private String hjszd; + + /** + * 现居住地 + */ + private String xjzd; + + /** + * 人户情况 + */ + private String rhzk; + + /** + * 居住信息备注 + */ + private String jzxxRemakes; + + /** + * 民族【字典表】 + */ + private String mz; + + /** + * 与户主关系【字典表】 + */ + private String yhzgx; + + /** + * 居住情况【字典表】 + */ + private String jzqk; + + /** + * 婚姻状况【字典表】 + */ + private String hyzk; + + /** + * 配偶情况【字典表】 + */ + private String poqk; + + /** + * 有无赡养人 + */ + private String ynSyr; + + /** + * 与赡养人关系【字典表】 + */ + private String ysyrgx; + + /** + * 赡养人电话 + */ + private String syrMobile; + + /** + * 家庭信息备注 + */ + private String jtxxRemakes; + + /** + * 用户状态【0:正常;1:迁出;2:注销】 + */ + private String status; + + /** + * 用户详细状态:01:新增、02:导入、03:迁入、04:新生、11:迁出、21死亡 + */ + private String subStatus; + + /** + * 预留字段1 + */ + private String field1; + + /** + * 预留字段2 + */ + private String field2; + + /** + * 预留字段3 + */ + private String field3; + + /** + * 预留字段4 + */ + private String field4; + + /** + * 预留字段5 + */ + private String field5; + + /** + * 预留字段6 + */ + private String field6; + + /** + * 预留字段7 + */ + private String field7; + + /** + * 预留字段8 + */ + private String field8; + + /** + * 预留字段9 + */ + private String field9; + + /** + * 预留字段10 + */ + private String field10; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java new file mode 100644 index 0000000000..1989a04cf8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.org; + +import com.epmet.dto.form.HouseChartFormDTO; +import com.epmet.dto.result.HouseChartResultDTO; + +/** + * 小区表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-25 + */ +public interface HouseService { + + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + HouseChartResultDTO houseChart(HouseChartFormDTO formDTO); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java new file mode 100644 index 0000000000..030792e44a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java @@ -0,0 +1,80 @@ +package com.epmet.service.org.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.dao.org.IcHouseDao; +import com.epmet.dto.form.HouseChartFormDTO; +import com.epmet.dto.result.HouseChartResultDTO; +import com.epmet.dto.result.HouseIcResiUserResultDTO; +import com.epmet.service.org.HouseService; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.NumberFormat; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +@Slf4j +@Service +public class HouseServiceImpl implements HouseService, ResultDataResolver { + + /** + * 导出房屋内家庭成员时本地缓存 + */ + private static final Cache> memberCacheMap = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).expireAfterWrite(30,TimeUnit.MINUTES).build(); + + @Resource + private IcHouseDao icHouseDao; + + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + @Override + public HouseChartResultDTO houseChart(HouseChartFormDTO formDTO) { + HouseChartResultDTO resultDTO = new HouseChartResultDTO(); + //计算百分比使用,保留小数点后两位 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.TWO); + //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //2.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + //2.根据入参值查询对应的房屋统计数据 + List list = icHouseDao.houseChart(formDTO.getOrgId(), formDTO.getOrgType()); + //3.汇总数据 + AtomicInteger houseTotal = new AtomicInteger(); + list.forEach(l -> { + houseTotal.addAndGet(l.getNum()); + if (l.getRentFlag() == 0) { + resultDTO.setZzHouseTotal(l.getNum()); + } else if (l.getRentFlag() == 1) { + resultDTO.setCzHouseTotal(l.getNum()); + } else { + resultDTO.setXzHouseTotal(l.getNum()); + } + }); + resultDTO.setHouseTotal(houseTotal.get()); + resultDTO.setZzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getZzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getZzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setCzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getCzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setXzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getXzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getXzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setOrgId(formDTO.getOrgId()); + resultDTO.setOrgType(formDTO.getOrgType()); + return resultDTO; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java new file mode 100644 index 0000000000..ea6a7e6261 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.user; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.UserChartFormDTO; +import com.epmet.dto.result.UserChartResultDTO; +import com.epmet.entity.user.IcResiUserEntity; + +/** + * 用户基础信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-26 + */ +public interface IcResiUserService extends BaseService { + + /** + * @Author sun + * @Description 【人房】居民总数饼图 + **/ + UserChartResultDTO userChart(UserChartFormDTO formDTO); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java new file mode 100644 index 0000000000..ea583e56a0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java @@ -0,0 +1,90 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.user.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.feign.ResultDataResolver; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.dao.user.IcResiUserDao; +import com.epmet.dto.form.UserChartFormDTO; +import com.epmet.dto.result.UserChartResultDTO; +import com.epmet.entity.user.IcResiUserEntity; +import com.epmet.service.user.IcResiUserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.text.NumberFormat; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 用户基础信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-26 + */ +@Slf4j +@Service +public class IcResiUserServiceImpl extends BaseServiceImpl implements IcResiUserService, ResultDataResolver { + + /** + * @Author sun + * @Description 【人房】居民总数饼图 + **/ + @Override + public UserChartResultDTO userChart(UserChartFormDTO formDTO) { + UserChartResultDTO resultDTO = new UserChartResultDTO(); + //计算百分比使用,保留小数点后两位 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.TWO); + //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //2.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + //2.根据入参值查询对应的房屋统计数据 + List list = baseDao.userChart(formDTO.getOrgId(), formDTO.getOrgType()); + //3.汇总数据 + AtomicInteger userTotal = new AtomicInteger(); + list.forEach(l -> { + userTotal.addAndGet(l.getNum()); + if ("0".equals(l.getIsFloating())) { + resultDTO.setCzUserTotal(l.getNum()); + } else { + resultDTO.setLdUserTotal(l.getNum()); + } + }); + resultDTO.setUserTotal(userTotal.get()); + resultDTO.setCzUserRatio(Double.valueOf((resultDTO.getUserTotal() == 0 || resultDTO.getCzUserTotal() > resultDTO.getUserTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzUserTotal() / (float) resultDTO.getUserTotal()) * 100))); + resultDTO.setLdUserRatio(Double.valueOf((resultDTO.getUserTotal() == 0 || resultDTO.getLdUserTotal() > resultDTO.getUserTotal()) ? "0" : numberFormat.format(((float) resultDTO.getLdUserTotal() / (float) resultDTO.getUserTotal()) * 100))); + resultDTO.setOrgId(formDTO.getOrgId()); + resultDTO.setOrgType(formDTO.getOrgType()); + + return resultDTO; + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml new file mode 100644 index 0000000000..2be94d9f5d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml @@ -0,0 +1,39 @@ + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml new file mode 100644 index 0000000000..e32ef99c58 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml @@ -0,0 +1,28 @@ + + + + + + + + From 2995dcc4435014154675c650bcaab9dc4d3b0c0c Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Fri, 27 May 2022 10:35:23 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E4=BA=BA=E6=88=BF=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stats/FactAgencyUserHouseDailyDTO.java | 148 ++++++++++++++++++ .../dto/stats/FactGridUserHouseDailyDTO.java | 139 ++++++++++++++++ .../controller/FactUserHouseController.java | 45 ++++++ .../stats/FactAgencyUserHouseDailyDao.java | 16 ++ .../dao/stats/FactGridUserHouseDailyDao.java | 16 ++ .../stats/FactAgencyUserHouseDailyEntity.java | 118 ++++++++++++++ .../stats/FactGridUserHouseDailyEntity.java | 109 +++++++++++++ .../com/epmet/excel/FactUserHouseExcel.java | 90 +++++++++++ .../FactAgencyUserHouseDailyService.java | 78 +++++++++ .../stats/FactGridUserHouseDailyService.java | 78 +++++++++ .../FactAgencyUserHouseDailyServiceImpl.java | 83 ++++++++++ .../FactGridUserHouseDailyServiceImpl.java | 83 ++++++++++ .../stats/FactAgencyUserHouseDailyDao.xml | 35 +++++ .../stats/FactGridUserHouseDailyDao.xml | 34 ++++ 14 files changed, 1072 insertions(+) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyUserHouseDailyDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridUserHouseDailyDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyUserHouseDailyEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridUserHouseDailyEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/FactUserHouseExcel.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyUserHouseDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyUserHouseDailyDTO.java new file mode 100644 index 0000000000..862f85649f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyUserHouseDailyDTO.java @@ -0,0 +1,148 @@ +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-05-27 + */ +@Data +public class FactAgencyUserHouseDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键,customer_id+AGENCY_ID+date_id只有一条记录 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 组织id + */ + private String agencyId; + + /** + * agency_id所属的机关级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) + */ + private String level; + + /** + * 组织i所属的组织id + */ + private String pid; + + /** + * 组织i所有上级id + */ + private String pids; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + 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; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridUserHouseDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridUserHouseDailyDTO.java new file mode 100644 index 0000000000..1da0d57339 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactGridUserHouseDailyDTO.java @@ -0,0 +1,139 @@ +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-05-27 + */ +@Data +public class FactGridUserHouseDailyDTO 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; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + 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; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java new file mode 100644 index 0000000000..fa9c678cef --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java @@ -0,0 +1,45 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.excel.FactUserHouseExcel; +import com.epmet.service.stats.FactAgencyUserHouseDailyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@RestController +@RequestMapping("factAgencyUserHouseDaily") +public class FactUserHouseController { + + @Autowired + private FactAgencyUserHouseDailyService factAgencyUserHouseDailyService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = factAgencyUserHouseDailyService.page(params); + return new Result>().ok(page); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = factAgencyUserHouseDailyService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, FactUserHouseExcel.class); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java new file mode 100644 index 0000000000..89cb5a5502 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Mapper +public interface FactAgencyUserHouseDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java new file mode 100644 index 0000000000..13f093e29c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactGridUserHouseDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格的人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Mapper +public interface FactGridUserHouseDailyDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyUserHouseDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyUserHouseDailyEntity.java new file mode 100644 index 0000000000..2426a984d5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyUserHouseDailyEntity.java @@ -0,0 +1,118 @@ +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-05-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_agency_user_house_daily") +public class FactAgencyUserHouseDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 组织id + */ + private String agencyId; + + /** + * agency_id所属的机关级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) + */ + private String level; + + /** + * 组织i所属的组织id + */ + private String pid; + + /** + * 组织i所有上级id + */ + private String pids; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + 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; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridUserHouseDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridUserHouseDailyEntity.java new file mode 100644 index 0000000000..58075e335e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactGridUserHouseDailyEntity.java @@ -0,0 +1,109 @@ +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-05-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_grid_user_house_daily") +public class FactGridUserHouseDailyEntity 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; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + 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; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/FactUserHouseExcel.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/FactUserHouseExcel.java new file mode 100644 index 0000000000..c5de0d2dd9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/FactUserHouseExcel.java @@ -0,0 +1,90 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Data +public class FactUserHouseExcel { + + @Excel(name = "主键,customer_id+AGENCY_ID+date_id只有一条记录") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "数据更新至:yyyyMMdd; ") + private String dateId; + + @Excel(name = "组织id") + private String agencyId; + + @Excel(name = "组织i所属的组织id") + private String pid; + + @Excel(name = "组织i所有上级id") + private String pids; + + @Excel(name = "小区总数") + private Integer neighbourhoodsCount; + + @Excel(name = "房屋总数") + private Integer houseCount; + + @Excel(name = "自住房屋总数") + private Integer houseSelfCount; + + @Excel(name = "出租房屋总数") + private Integer houseLeaseCount; + + @Excel(name = "闲置房屋总数") + private Integer houseIdleCount; + + @Excel(name = "居民总数") + private Integer userCount; + + @Excel(name = "常住居民总数") + private Integer userResiCount; + + @Excel(name = "流动居民总数") + private Integer userFloatCount; + + @Excel(name = "当日新增房屋数") + private Integer houseIncr; + + @Excel(name = "当日修改房屋数") + private Integer houseModify; + + @Excel(name = "当日新增居民数") + private Integer userIncr; + + @Excel(name = "当日修改居民数") + private Integer userModify; + + @Excel(name = "删除标识 0未删除、1已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间:第一次提交审核的时间,注意和历史表的第一条记录时间一致") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java new file mode 100644 index 0000000000..01943d026f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.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.FactAgencyUserHouseDailyDTO; +import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +public interface FactAgencyUserHouseDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactAgencyUserHouseDailyDTO + * @author generator + * @date 2022-05-27 + */ + FactAgencyUserHouseDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-27 + */ + void save(FactAgencyUserHouseDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-27 + */ + void update(FactAgencyUserHouseDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-27 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java new file mode 100644 index 0000000000..0cf17e5e08 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.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.FactGridUserHouseDailyDTO; +import com.epmet.entity.stats.FactGridUserHouseDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 网格的人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +public interface FactGridUserHouseDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactGridUserHouseDailyDTO + * @author generator + * @date 2022-05-27 + */ + FactGridUserHouseDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-27 + */ + void save(FactGridUserHouseDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-27 + */ + void update(FactGridUserHouseDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-27 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java new file mode 100644 index 0000000000..057d528542 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.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.FactAgencyUserHouseDailyDao; +import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; +import com.epmet.service.stats.FactAgencyUserHouseDailyService; +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-05-27 + */ +@Service +public class FactAgencyUserHouseDailyServiceImpl extends BaseServiceImpl implements FactAgencyUserHouseDailyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactAgencyUserHouseDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactAgencyUserHouseDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactAgencyUserHouseDailyDTO get(String id) { + FactAgencyUserHouseDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactAgencyUserHouseDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactAgencyUserHouseDailyDTO dto) { + FactAgencyUserHouseDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactAgencyUserHouseDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactAgencyUserHouseDailyDTO dto) { + FactAgencyUserHouseDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactAgencyUserHouseDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java new file mode 100644 index 0000000000..41c178863c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.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.FactGridUserHouseDailyDao; +import com.epmet.dto.stats.FactGridUserHouseDailyDTO; +import com.epmet.entity.stats.FactGridUserHouseDailyEntity; +import com.epmet.service.stats.FactGridUserHouseDailyService; +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-05-27 + */ +@Service +public class FactGridUserHouseDailyServiceImpl extends BaseServiceImpl implements FactGridUserHouseDailyService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactGridUserHouseDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactGridUserHouseDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactGridUserHouseDailyDTO get(String id) { + FactGridUserHouseDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactGridUserHouseDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactGridUserHouseDailyDTO dto) { + FactGridUserHouseDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGridUserHouseDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactGridUserHouseDailyDTO dto) { + FactGridUserHouseDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactGridUserHouseDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml new file mode 100644 index 0000000000..7c178cbc70 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml new file mode 100644 index 0000000000..534d2376d8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From aea3236ee31b3cbd73060750e26704b261314792 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Fri, 27 May 2022 13:56:31 +0800 Subject: [PATCH 03/30] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E5=92=8C=E7=BB=84=E7=BB=87=E6=9F=A5=E8=AF=A2=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stats/result/FactUserHouseResultDTO.java | 154 ++++++++++++++++++ .../controller/FactUserHouseController.java | 12 +- .../stats/FactAgencyUserHouseDailyDao.java | 8 +- .../dao/stats/FactGridUserHouseDailyDao.java | 8 +- .../FactAgencyUserHouseDailyService.java | 3 +- .../stats/FactGridUserHouseDailyService.java | 3 +- .../service/stats/FactUserHouseService.java | 37 +++++ .../FactAgencyUserHouseDailyServiceImpl.java | 17 +- .../FactGridUserHouseDailyServiceImpl.java | 16 +- .../stats/impl/FactUserHouseServiceImpl.java | 58 +++++++ .../stats/FactAgencyUserHouseDailyDao.xml | 24 ++- .../stats/FactGridUserHouseDailyDao.xml | 25 ++- 12 files changed, 342 insertions(+), 23 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java new file mode 100644 index 0000000000..a8fc8cb467 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java @@ -0,0 +1,154 @@ +package com.epmet.dto.stats.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Data +public class FactUserHouseResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键,customer_id+AGENCY_ID+date_id只有一条记录 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织id + */ + private String agencyName; + + /** + * agency_id所属的机关级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) + */ + private String level; + + /** + * 组织i所属的组织id + */ + private String pid; + + /** + * 组织i所有上级id + */ + private String pids; + + /** + * 小区总数 + */ + private Integer neighbourhoodsCount; + + /** + * 房屋总数 + */ + 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; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java index fa9c678cef..423a372d5a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java @@ -4,8 +4,10 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.excel.FactUserHouseExcel; import com.epmet.service.stats.FactAgencyUserHouseDailyService; +import com.epmet.service.stats.FactUserHouseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -28,17 +30,17 @@ import java.util.Map; public class FactUserHouseController { @Autowired - private FactAgencyUserHouseDailyService factAgencyUserHouseDailyService; + private FactUserHouseService factUserHouseService; @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = factAgencyUserHouseDailyService.page(params); - return new Result>().ok(page); + public Result> page(@RequestParam Map params){ + PageData page = factUserHouseService.page(params); + return new Result>().ok(page); } @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = factAgencyUserHouseDailyService.list(params); + List list = factUserHouseService.list(params); ExcelUtils.exportExcelToTarget(response, null, list, FactUserHouseExcel.class); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java index 89cb5a5502..9fc1e9dc60 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java @@ -1,9 +1,13 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; +import java.util.Map; + /** * 人房信息统计数,按天统计 * @@ -12,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactAgencyUserHouseDailyDao extends BaseDao { - + + List listPage(Map params); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java index 13f093e29c..312dd37fbb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java @@ -1,9 +1,13 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; +import java.util.Map; + /** * 网格的人房信息统计数,按天统计 * @@ -12,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactGridUserHouseDailyDao extends BaseDao { - + + List listPage(Map params); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java index 01943d026f..d0dfe6bfd3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java @@ -3,6 +3,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; import java.util.List; @@ -24,7 +25,7 @@ public interface FactAgencyUserHouseDailyService extends BaseService page(Map params); + PageData page(Map params); /** * 默认查询 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java index 0cf17e5e08..72f1bb7e85 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java @@ -3,6 +3,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.FactGridUserHouseDailyDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; import java.util.List; @@ -24,7 +25,7 @@ public interface FactGridUserHouseDailyService extends BaseService page(Map params); + PageData page(Map params); /** * 默认查询 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java new file mode 100644 index 0000000000..e792d7be1f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java @@ -0,0 +1,37 @@ +package com.epmet.service.stats; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; + +import java.util.List; +import java.util.Map; + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +public interface FactUserHouseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-27 + */ + List list(Map params); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java index 057d528542..9b2a73208a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyUserHouseDailyServiceImpl.java @@ -4,10 +4,13 @@ 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.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.FactAgencyUserHouseDailyDao; +import com.epmet.dto.ChangeDeathDTO; import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; import com.epmet.service.stats.FactAgencyUserHouseDailyService; import org.apache.commons.lang3.StringUtils; @@ -28,13 +31,15 @@ import java.util.Map; @Service public class FactAgencyUserHouseDailyServiceImpl extends BaseServiceImpl implements FactAgencyUserHouseDailyService { + @Autowired + private LoginUserUtil loginUserUtil; + @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, FactAgencyUserHouseDailyDTO.class); + public PageData page(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); + IPage page = getPage(params); + List list = baseDao.listPage(params); + return new PageData<>(list, page.getTotal()); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java index 41c178863c..9ba325485b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java @@ -4,10 +4,12 @@ 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.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.FactGridUserHouseDailyDao; import com.epmet.dto.stats.FactGridUserHouseDailyDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; import com.epmet.service.stats.FactGridUserHouseDailyService; import org.apache.commons.lang3.StringUtils; @@ -28,13 +30,15 @@ import java.util.Map; @Service public class FactGridUserHouseDailyServiceImpl extends BaseServiceImpl implements FactGridUserHouseDailyService { + @Autowired + private LoginUserUtil loginUserUtil; + @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, FactGridUserHouseDailyDTO.class); + public PageData page(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); + IPage page = getPage(params); + List list = baseDao.listPage(params); + return new PageData<>(list, page.getTotal()); } @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java new file mode 100644 index 0000000000..282d5f3695 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -0,0 +1,58 @@ +package com.epmet.service.stats.impl; + +import com.epmet.commons.tools.enums.OrgLevelEnum; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; +import com.epmet.service.stats.FactAgencyUserHouseDailyService; +import com.epmet.service.stats.FactGridUserHouseDailyService; +import com.epmet.service.stats.FactUserHouseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Service +public class FactUserHouseServiceImpl implements FactUserHouseService { + + @Autowired + private FactAgencyUserHouseDailyService factAgencyUserHouseDailyService; + + @Autowired + private FactGridUserHouseDailyService factGridUserHouseDailyService; + + @Override + public PageData page(Map params) { + PageData page = null; + if (params.containsKey("level")) { + if (OrgLevelEnum.GRID.getCode().equals(params.get("level").toString()) || OrgLevelEnum.COMMUNITY.getCode().equals(params.get("level").toString())) { + page = factGridUserHouseDailyService.page(params); + } else { + page = factAgencyUserHouseDailyService.page(params); + } + } + return page; + } + + @Override + public List list(Map params) { + List list = new ArrayList<>(); + if (params.containsKey("level")) { + if (OrgLevelEnum.GRID.getCode().equals(params.get("level").toString()) || OrgLevelEnum.COMMUNITY.getCode().equals(params.get("level").toString())) { + list = ConvertUtils.sourceToTarget(factGridUserHouseDailyService.list(params), FactUserHouseResultDTO.class); + } else { + list = ConvertUtils.sourceToTarget(factAgencyUserHouseDailyService.list(params), FactUserHouseResultDTO.class); + } + } + return list; + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml index 7c178cbc70..a348c0d295 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml @@ -31,5 +31,27 @@ - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 534d2376d8..965cb87d1f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -30,5 +30,28 @@ - + \ No newline at end of file From 1d18a2482c8fc1e904edd1840498ee95fdc0255f Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Fri, 27 May 2022 17:59:40 +0800 Subject: [PATCH 04/30] =?UTF-8?q?grid=E5=92=8Cagency=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/stats/form/FactUserHouseFormDTO.java | 30 +++++++ .../stats/result/FactUserHouseResultDTO.java | 5 ++ .../controller/FactUserHouseController.java | 15 ++-- .../java/com/epmet/dao/org/IcHouseDao.java | 12 ++- .../com/epmet/dao/user/IcResiUserDao.java | 5 +- .../com/epmet/service/org/HouseService.java | 14 ++-- .../service/org/impl/HouseServiceImpl.java | 76 ++++-------------- .../service/stats/FactUserHouseService.java | 3 + .../stats/impl/DimGridServiceImpl.java | 2 + .../stats/impl/FactUserHouseServiceImpl.java | 66 ++++++++++++++++ .../epmet/service/user/IcResiUserService.java | 12 ++- .../user/impl/IcResiUserServiceImpl.java | 54 ++----------- .../main/resources/mapper/org/IcHouseDao.xml | 79 ++++++++++++------- .../resources/mapper/user/IcResiUserDao.xml | 25 +++--- 14 files changed, 217 insertions(+), 181 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java new file mode 100644 index 0000000000..9206fcccd1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.stats.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 人房信息统计数,按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Data +public class FactUserHouseFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java index a8fc8cb467..67c5da0a6b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/FactUserHouseResultDTO.java @@ -32,6 +32,11 @@ public class FactUserHouseResultDTO implements Serializable { */ private String dateId; + /** + * 网格id + */ + private String gridId; + /** * 组织id */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java index 423a372d5a..b1f2ee1f01 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java @@ -3,16 +3,15 @@ package com.epmet.controller; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.excel.FactUserHouseExcel; import com.epmet.service.stats.FactAgencyUserHouseDailyService; import com.epmet.service.stats.FactUserHouseService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -33,7 +32,7 @@ public class FactUserHouseController { private FactUserHouseService factUserHouseService; @RequestMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = factUserHouseService.page(params); return new Result>().ok(page); } @@ -44,4 +43,10 @@ public class FactUserHouseController { ExcelUtils.exportExcelToTarget(response, null, list, FactUserHouseExcel.class); } + @PostMapping("stat") + public Result stat(@RequestBody FactUserHouseFormDTO formDTO) { + factUserHouseService.stat(formDTO); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java index 040f5ec9a4..b6af5aa3b2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/IcHouseDao.java @@ -1,10 +1,10 @@ package com.epmet.dao.org; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.HouseChartResultDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.org.IcHouseEntity; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -17,10 +17,8 @@ import java.util.List; @Mapper public interface IcHouseDao extends BaseDao { - /** - * @Author sun - * @Description 【人房】房屋总数饼图 - **/ - List houseChart(@Param("orgId") String orgId, @Param("orgType") String orgType); + List houseStat(FactUserHouseFormDTO formDTO); + + List neighborhoodStatStat(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java index 5625f9a3c5..56b1cb5fd1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/IcResiUserDao.java @@ -18,7 +18,8 @@ package com.epmet.dao.user; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.UserChartResultDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.user.IcResiUserEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -34,6 +35,6 @@ import java.util.List; @Mapper public interface IcResiUserDao extends BaseDao { - List userChart(@Param("orgId") String orgId, @Param("orgType") String orgType); + List userStat(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java index 1989a04cf8..fa7081cf7c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java @@ -17,8 +17,10 @@ package com.epmet.service.org; -import com.epmet.dto.form.HouseChartFormDTO; -import com.epmet.dto.result.HouseChartResultDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; + +import java.util.List; /** * 小区表 @@ -28,10 +30,8 @@ import com.epmet.dto.result.HouseChartResultDTO; */ public interface HouseService { - /** - * @Author sun - * @Description 【人房】房屋总数饼图 - **/ - HouseChartResultDTO houseChart(HouseChartFormDTO formDTO); + List houseStat(FactUserHouseFormDTO formDTO); + + List neighborhoodStat(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java index 030792e44a..efcb8612ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/HouseServiceImpl.java @@ -1,80 +1,32 @@ package com.epmet.service.org.impl; -import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.feign.ResultDataResolver; -import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.org.IcHouseDao; -import com.epmet.dto.form.HouseChartFormDTO; -import com.epmet.dto.result.HouseChartResultDTO; -import com.epmet.dto.result.HouseIcResiUserResultDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; +import com.epmet.entity.org.IcHouseEntity; import com.epmet.service.org.HouseService; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import java.text.NumberFormat; import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; @Slf4j +@DataSource(DataSourceConstant.GOV_ORG) @Service -public class HouseServiceImpl implements HouseService, ResultDataResolver { +public class HouseServiceImpl extends BaseServiceImpl implements HouseService, ResultDataResolver { - /** - * 导出房屋内家庭成员时本地缓存 - */ - private static final Cache> memberCacheMap = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.MINUTES).expireAfterWrite(30,TimeUnit.MINUTES).build(); - - @Resource - private IcHouseDao icHouseDao; + @Override + public List houseStat(FactUserHouseFormDTO formDTO) { + return baseDao.houseStat(formDTO); + } - /** - * @Author sun - * @Description 【人房】房屋总数饼图 - **/ @Override - public HouseChartResultDTO houseChart(HouseChartFormDTO formDTO) { - HouseChartResultDTO resultDTO = new HouseChartResultDTO(); - //计算百分比使用,保留小数点后两位 - NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.TWO); - //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 - if (StringUtils.isEmpty(formDTO.getOrgId())) { - //2.获取工作人员缓存信息 - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); - if (null == staffInfo) { - throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); - } - formDTO.setOrgId(staffInfo.getAgencyId()); - formDTO.setOrgType("agency"); - } - //2.根据入参值查询对应的房屋统计数据 - List list = icHouseDao.houseChart(formDTO.getOrgId(), formDTO.getOrgType()); - //3.汇总数据 - AtomicInteger houseTotal = new AtomicInteger(); - list.forEach(l -> { - houseTotal.addAndGet(l.getNum()); - if (l.getRentFlag() == 0) { - resultDTO.setZzHouseTotal(l.getNum()); - } else if (l.getRentFlag() == 1) { - resultDTO.setCzHouseTotal(l.getNum()); - } else { - resultDTO.setXzHouseTotal(l.getNum()); - } - }); - resultDTO.setHouseTotal(houseTotal.get()); - resultDTO.setZzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getZzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getZzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); - resultDTO.setCzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getCzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); - resultDTO.setXzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getXzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getXzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); - resultDTO.setOrgId(formDTO.getOrgId()); - resultDTO.setOrgType(formDTO.getOrgType()); - return resultDTO; + public List neighborhoodStat(FactUserHouseFormDTO formDTO) { + return baseDao.neighborhoodStatStat(formDTO); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java index e792d7be1f..6d88596a7c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java @@ -2,6 +2,7 @@ package com.epmet.service.stats; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import java.util.List; @@ -34,4 +35,6 @@ public interface FactUserHouseService { * @date 2022-05-27 */ List list(Map params); + + void stat(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java index 9ff2671fbb..044f6e63d1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java @@ -81,9 +81,11 @@ public class DimGridServiceImpl extends BaseServiceImpl getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); + String customerId = (String)params.get("customerId"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(StringUtils.isNotBlank(customerId), "CUSTOMER_ID", customerId); return wrapper; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java index 282d5f3695..122b6c8d91 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -1,18 +1,26 @@ package com.epmet.service.stats.impl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.OrgLevelEnum; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; +import com.epmet.entity.stats.FactGridUserHouseDailyEntity; +import com.epmet.service.org.HouseService; +import com.epmet.service.stats.DimGridService; import com.epmet.service.stats.FactAgencyUserHouseDailyService; import com.epmet.service.stats.FactGridUserHouseDailyService; import com.epmet.service.stats.FactUserHouseService; +import com.epmet.service.user.IcResiUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; /** * 人房信息统计数,按天统计 @@ -29,6 +37,15 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { @Autowired private FactGridUserHouseDailyService factGridUserHouseDailyService; + @Autowired + private HouseService houseService; + + @Autowired + private IcResiUserService icResiUserService; + + @Autowired + private DimGridService dimGridService; + @Override public PageData page(Map params) { PageData page = null; @@ -55,4 +72,53 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { return list; } + @Override + public void stat(FactUserHouseFormDTO formDTO) { + String dateId = DateUtils.getBeforeNDay(NumConstant.ONE); + String customerId = formDTO.getCustomerId(); + + List neiList = houseService.neighborhoodStat(formDTO); + List houseList = houseService.houseStat(formDTO); + List userList = icResiUserService.userStat(formDTO); + + List addList = new ArrayList<>(); + + neiList.forEach(item -> { + String agencyId = item.getAgencyId(); + FactUserHouseResultDTO dto = new FactUserHouseResultDTO(); + dto.setCustomerId(formDTO.getCustomerId()); + dto.setDateId(dateId); + dto.setPid(item.getPid()); + dto.setPids(item.getPids()); + dto.setNeighbourhoodsCount(item.getNeighbourhoodsCount()); + + Optional houseOptional = houseList.stream().filter(house -> agencyId.equals(house.getAgencyId()) && customerId.equals(house.getCustomerId())).findFirst(); + if (houseOptional.isPresent()) { + dto.setHouseCount(houseOptional.get().getHouseCount()); + dto.setHouseSelfCount(houseOptional.get().getHouseSelfCount()); + dto.setHouseLeaseCount(houseOptional.get().getHouseLeaseCount()); + dto.setHouseIdleCount(houseOptional.get().getHouseIdleCount()); + } else { + dto.setHouseCount(NumConstant.ZERO); + dto.setHouseSelfCount(NumConstant.ZERO); + dto.setHouseLeaseCount(NumConstant.ZERO); + dto.setHouseIdleCount(NumConstant.ZERO); + } + + Optional userOptional = userList.stream().filter(user -> agencyId.equals(user.getAgencyId()) && customerId.equals(user.getCustomerId())).findFirst(); + if (userOptional.isPresent()) { + dto.setUserCount(userOptional.get().getUserCount()); + dto.setUserResiCount(userOptional.get().getUserResiCount()); + dto.setUserFloatCount(userOptional.get().getUserFloatCount()); + } else { + dto.setUserCount(NumConstant.ZERO); + dto.setUserResiCount(NumConstant.ZERO); + dto.setUserFloatCount(NumConstant.ZERO); + } + addList.add(dto); + }); + + List entityList = ConvertUtils.sourceToTarget(addList, FactGridUserHouseDailyEntity.class); + factGridUserHouseDailyService.insertBatch(entityList); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java index ea6a7e6261..12bc106b65 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java @@ -18,10 +18,12 @@ package com.epmet.service.user; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.dto.form.UserChartFormDTO; -import com.epmet.dto.result.UserChartResultDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.user.IcResiUserEntity; +import java.util.List; + /** * 用户基础信息 * @@ -30,10 +32,6 @@ import com.epmet.entity.user.IcResiUserEntity; */ public interface IcResiUserService extends BaseService { - /** - * @Author sun - * @Description 【人房】居民总数饼图 - **/ - UserChartResultDTO userChart(UserChartFormDTO formDTO); + List userStat(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java index ea583e56a0..b48086d053 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/IcResiUserServiceImpl.java @@ -17,24 +17,19 @@ package com.epmet.service.user.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.feign.ResultDataResolver; -import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.user.IcResiUserDao; -import com.epmet.dto.form.UserChartFormDTO; -import com.epmet.dto.result.UserChartResultDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.user.IcResiUserEntity; import com.epmet.service.user.IcResiUserService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; -import java.text.NumberFormat; import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; /** * 用户基础信息 @@ -43,48 +38,13 @@ import java.util.concurrent.atomic.AtomicInteger; * @since v1.0.0 2021-10-26 */ @Slf4j +@DataSource(DataSourceConstant.EPMET_USER) @Service public class IcResiUserServiceImpl extends BaseServiceImpl implements IcResiUserService, ResultDataResolver { - /** - * @Author sun - * @Description 【人房】居民总数饼图 - **/ @Override - public UserChartResultDTO userChart(UserChartFormDTO formDTO) { - UserChartResultDTO resultDTO = new UserChartResultDTO(); - //计算百分比使用,保留小数点后两位 - NumberFormat numberFormat = NumberFormat.getInstance(); - numberFormat.setMaximumFractionDigits(NumConstant.TWO); - //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 - if (StringUtils.isEmpty(formDTO.getOrgId())) { - //2.获取工作人员缓存信息 - CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); - if (null == staffInfo) { - throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); - } - formDTO.setOrgId(staffInfo.getAgencyId()); - formDTO.setOrgType("agency"); - } - //2.根据入参值查询对应的房屋统计数据 - List list = baseDao.userChart(formDTO.getOrgId(), formDTO.getOrgType()); - //3.汇总数据 - AtomicInteger userTotal = new AtomicInteger(); - list.forEach(l -> { - userTotal.addAndGet(l.getNum()); - if ("0".equals(l.getIsFloating())) { - resultDTO.setCzUserTotal(l.getNum()); - } else { - resultDTO.setLdUserTotal(l.getNum()); - } - }); - resultDTO.setUserTotal(userTotal.get()); - resultDTO.setCzUserRatio(Double.valueOf((resultDTO.getUserTotal() == 0 || resultDTO.getCzUserTotal() > resultDTO.getUserTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzUserTotal() / (float) resultDTO.getUserTotal()) * 100))); - resultDTO.setLdUserRatio(Double.valueOf((resultDTO.getUserTotal() == 0 || resultDTO.getLdUserTotal() > resultDTO.getUserTotal()) ? "0" : numberFormat.format(((float) resultDTO.getLdUserTotal() / (float) resultDTO.getUserTotal()) * 100))); - resultDTO.setOrgId(formDTO.getOrgId()); - resultDTO.setOrgType(formDTO.getOrgType()); - - return resultDTO; + public List userStat(FactUserHouseFormDTO formDTO) { + return baseDao.userStat(formDTO); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml index 2be94d9f5d..41f39be8ec 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/IcHouseDao.xml @@ -3,37 +3,58 @@ - SELECT - COUNT(id) num, - rent_flag rentFlag + g.CUSTOMER_ID, + g.id AS GRID_ID, + g.PID, + g.PIDS, + sum( CASE WHEN t.RENT_FLAG = '0' THEN 1 ELSE 0 END ) AS houseSelfCount, + 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 FROM - ic_house - WHERE del_flag = '0' - - - AND neighbor_hood_id IN ( - select id from ic_neighbor_hood - where del_flag = '0' - and (agency_id = #{orgId} OR agency_pids LIKE CONCAT('%', #{orgId}, '%')) - ) - - - AND neighbor_hood_id IN ( - select id from ic_neighbor_hood - where del_flag = '0' - and grid_id = #{orgId} - ) - - - AND neighbor_hood_id IN ( - select id from ic_neighbor_hood - where del_flag = '0' - and id = #{orgId} - ) - - - GROUP BY rent_flag + customer_grid g + LEFT JOIN ( + SELECT + h.id, + h.RENT_FLAG, + n.GRID_ID + FROM + ic_house h + LEFT JOIN ic_neighbor_hood n ON h.NEIGHBOR_HOOD_ID = n.id + WHERE + h.CREATED_TIME < DATE_SUB( CURDATE(), INTERVAL 1 DAY ) + ) t ON t.GRID_ID = g.ID + + + AND g.CUSTOMER_ID = #{customerId} + + + GROUP BY + g.CUSTOMER_ID, + g.id + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml index e32ef99c58..54d5f37b7e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/IcResiUserDao.xml @@ -3,26 +3,21 @@ - SELECT - COUNT(id) num, - is_floating isFloating + CUSTOMER_ID, + GRID_ID, + 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 FROM ic_resi_user WHERE del_flag = '0' - - - AND (agency_id = #{orgId} OR pids LIKE CONCAT('%', #{orgId}, '%')) - - - AND grid_id = #{orgId} - - - AND village_id = #{orgId} - - - GROUP BY is_floating + AND CREATED_TIME < DATE_SUB( CURDATE(), INTERVAL 1 DAY ) + GROUP BY + CUSTOMER_ID, + AGENCY_ID From 0347a88abcf886e240713aa14d5e1851a2d6b29e Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 10:37:05 +0800 Subject: [PATCH 05/30] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/stats/form/FactUserHouseFormDTO.java | 5 + .../feign/DataStatisticalOpenFeignClient.java | 7 ++ ...ataStatisticalOpenFeignClientFallBack.java | 11 +++ .../controller/FactUserHouseController.java | 15 +-- .../dao/stats/FactGridUserHouseDailyDao.java | 2 + .../stats/FactGridUserHouseDailyService.java | 3 + .../service/stats/FactUserHouseService.java | 4 +- .../FactGridUserHouseDailyServiceImpl.java | 10 ++ .../stats/impl/FactUserHouseServiceImpl.java | 53 ++++++++-- .../stats/FactGridUserHouseDailyDao.xml | 99 ++++++++++++++++++- .../epmet/service/StatsUserHouseService.java | 18 ++++ .../impl/StatsUserHouseServiceImpl.java | 26 +++++ .../com/epmet/task/StatsUserHouseTask.java | 43 ++++++++ 13 files changed, 282 insertions(+), 14 deletions(-) create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java index 9206fcccd1..ed7492dbee 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/form/FactUserHouseFormDTO.java @@ -27,4 +27,9 @@ public class FactUserHouseFormDTO implements Serializable { */ private String dateId; + /** + * level + */ + private String level; + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index 595977d64c..0aedb1d83e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -13,6 +13,7 @@ import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.user.form.StaffBaseInfoFormDTO; import com.epmet.dto.user.param.MidPatrolFormDTO; import com.epmet.dto.user.result.GridUserInfoDTO; @@ -368,4 +369,10 @@ public interface DataStatisticalOpenFeignClient { @PostMapping("/data/stats/screenextract/data_check") Result dataCheck(@RequestBody ExtractOriginFormDTO formDTO); + + @PostMapping("/data/stats/factAgencyUserHouseDaily/userHouseStatGrid") + Result userHouseStatGrid(@RequestBody FactUserHouseFormDTO formDTO); + + @PostMapping("/data/stats/factAgencyUserHouseDaily/userHouseStatAgency") + Result userHouseStatAgency(@RequestBody FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index 43e2a3445c..6ebe9d5004 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -14,6 +14,7 @@ import com.epmet.dto.org.result.CustomerAgencyDTO; import com.epmet.dto.org.result.CustomerGridDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.user.form.StaffBaseInfoFormDTO; import com.epmet.dto.user.param.MidPatrolFormDTO; import com.epmet.dto.user.result.GridUserInfoDTO; @@ -351,4 +352,14 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result dataCheck(ExtractOriginFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "dataCheck", formDTO); } + + @Override + public Result userHouseStatGrid(FactUserHouseFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userHouseStatGrid", formDTO); + } + + @Override + public Result userHouseStatAgency(FactUserHouseFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userHouseStatAgency", formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java index b1f2ee1f01..d36cf9a5e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactUserHouseController.java @@ -3,12 +3,9 @@ package com.epmet.controller; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.extract.form.ExtractOriginFormDTO; -import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.excel.FactUserHouseExcel; -import com.epmet.service.stats.FactAgencyUserHouseDailyService; import com.epmet.service.stats.FactUserHouseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -43,9 +40,15 @@ public class FactUserHouseController { ExcelUtils.exportExcelToTarget(response, null, list, FactUserHouseExcel.class); } - @PostMapping("stat") - public Result stat(@RequestBody FactUserHouseFormDTO formDTO) { - factUserHouseService.stat(formDTO); + @PostMapping("userHouseStatGrid") + public Result userHouseStatGrid(@RequestBody FactUserHouseFormDTO formDTO) { + factUserHouseService.statGrid(formDTO); + return new Result(); + } + + @PostMapping("userHouseStatAgency") + public Result userHouseStatAgency(@RequestBody FactUserHouseFormDTO formDTO) { + factUserHouseService.statAgency(formDTO); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java index 312dd37fbb..346ea6bf40 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java @@ -1,6 +1,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -19,4 +20,5 @@ public interface FactGridUserHouseDailyDao extends BaseDao listPage(Map params); + List statAgency(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java index 72f1bb7e85..bd171008cb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java @@ -3,6 +3,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.FactGridUserHouseDailyDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; @@ -76,4 +77,6 @@ public interface FactGridUserHouseDailyService extends BaseService statAgency(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java index 6d88596a7c..6b77221a07 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java @@ -36,5 +36,7 @@ public interface FactUserHouseService { */ List list(Map params); - void stat(FactUserHouseFormDTO formDTO); + void statGrid(FactUserHouseFormDTO formDTO); + + void statAgency(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java index 9ba325485b..54878a314e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java @@ -9,6 +9,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.stats.FactGridUserHouseDailyDao; import com.epmet.dto.stats.FactGridUserHouseDailyDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; import com.epmet.service.stats.FactGridUserHouseDailyService; @@ -50,9 +51,13 @@ public class FactGridUserHouseDailyServiceImpl extends BaseServiceImpl getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); + String dateId = (String)params.get("dateId"); + String customerId = (String)params.get("customerId"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(StringUtils.isNotBlank(dateId), "DATE_ID", dateId); + wrapper.eq(StringUtils.isNotBlank(customerId), "CUSTOMER_ID", customerId); return wrapper; } @@ -84,4 +89,9 @@ public class FactGridUserHouseDailyServiceImpl extends BaseServiceImpl statAgency(FactUserHouseFormDTO formDTO){ + return baseDao.statAgency(formDTO); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java index 122b6c8d91..c9f3baac89 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -5,8 +5,10 @@ import com.epmet.commons.tools.enums.OrgLevelEnum; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dto.stats.FactGridUserHouseDailyDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; +import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; import com.epmet.entity.stats.FactGridUserHouseDailyEntity; import com.epmet.service.org.HouseService; import com.epmet.service.stats.DimGridService; @@ -14,13 +16,11 @@ import com.epmet.service.stats.FactAgencyUserHouseDailyService; import com.epmet.service.stats.FactGridUserHouseDailyService; import com.epmet.service.stats.FactUserHouseService; import com.epmet.service.user.IcResiUserService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; /** * 人房信息统计数,按天统计 @@ -73,8 +73,11 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { } @Override - public void stat(FactUserHouseFormDTO formDTO) { - String dateId = DateUtils.getBeforeNDay(NumConstant.ONE); + public void statGrid(FactUserHouseFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getDateId())) { + formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE)); + } + String dateId = formDTO.getDateId(); String customerId = formDTO.getCustomerId(); List neiList = houseService.neighborhoodStat(formDTO); @@ -121,4 +124,42 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { List entityList = ConvertUtils.sourceToTarget(addList, FactGridUserHouseDailyEntity.class); factGridUserHouseDailyService.insertBatch(entityList); } + + @Override + public void statAgency(FactUserHouseFormDTO formDTO) { + Map params = new HashMap<>(); + params.put("dateId", formDTO.getDateId()); + params.put("customerId", formDTO.getCustomerId()); + List list = factGridUserHouseDailyService.list(params); + if (list.isEmpty()) { + return; + } + + formDTO.setLevel("community"); + List commList = factGridUserHouseDailyService.statAgency(formDTO); + if (!commList.isEmpty()) { + factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(commList, FactAgencyUserHouseDailyEntity.class)); + } + formDTO.setLevel("street"); + List streetList = factGridUserHouseDailyService.statAgency(formDTO); + if (!streetList.isEmpty()) { + factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(streetList, FactAgencyUserHouseDailyEntity.class)); + } + formDTO.setLevel("district"); + List districtList = factGridUserHouseDailyService.statAgency(formDTO); + if (!districtList.isEmpty()) { + factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(districtList, FactAgencyUserHouseDailyEntity.class)); + } + formDTO.setLevel("city"); + List cityList = factGridUserHouseDailyService.statAgency(formDTO); + if (!cityList.isEmpty()) { + factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(cityList, FactAgencyUserHouseDailyEntity.class)); + } + formDTO.setLevel("province"); + List provinceList = factGridUserHouseDailyService.statAgency(formDTO); + if (!provinceList.isEmpty()) { + factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(provinceList, FactAgencyUserHouseDailyEntity.class)); + } + + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 965cb87d1f..6108a2f5cc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -40,7 +40,7 @@ LEFT JOIN dim_grid d ON d.id = g.GRID_ID AND g.CUSTOMER_ID = #{customerId} - AND g.CUSTOMER_ID = #{customerId} + AND d.CUSTOMER_ID = #{customerId} AND g.GRID_ID = #{agencyId} @@ -54,4 +54,101 @@ ORDER BY g.CREATED_TIME DESC + + + \ No newline at end of file diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java new file mode 100644 index 0000000000..789d99c3ea --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java @@ -0,0 +1,18 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; + +public interface StatsUserHouseService { + + /** + * 人房信息统计 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhy + * @date 2022/5/30 10:25 + */ + Result execUserHouseStatistical(FactUserHouseFormDTO formDTO); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java new file mode 100644 index 0000000000..04d5b287fb --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java @@ -0,0 +1,26 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import com.epmet.service.StatsUserHouseService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +@Service +public class StatsUserHouseServiceImpl implements StatsUserHouseService { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; + + @Override + public Result execUserHouseStatistical(FactUserHouseFormDTO formDTO) { + return dataStatisticalOpenFeignClient.userHouseStatGrid(formDTO); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java new file mode 100644 index 0000000000..0b4cae80f2 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java @@ -0,0 +1,43 @@ +package com.epmet.task; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; +import com.epmet.service.StatsUserHouseService; +import com.epmet.service.StatsUserService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 人房 + * + * @author zhy + * @date 2022/5/30 10:23 + */ +@Component("statsUserHouseTask") +public class StatsUserHouseTask implements ITask { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private StatsUserHouseService statsUserHouseService; + + @Override + public void run(String params) { + logger.info("StatsUserHouseTask定时任务正在执行,参数为:{}", params); + FactUserHouseFormDTO formDTO = new FactUserHouseFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, FactUserHouseFormDTO.class); + } + Result result = statsUserHouseService.execUserHouseStatistical(formDTO); + if (result.success()) { + logger.info("StatsUserHouseTask定时任务执行成功"); + } else { + logger.error("StatsUserHouseTask定时任务执行失败:" + result.getMsg()); + } + } +} From 751d1099be67ebb193d588ef1ba2792642802326 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 10:59:33 +0800 Subject: [PATCH 06/30] =?UTF-8?q?=E6=A3=80=E6=B5=8BgridId=E8=80=8C?= =?UTF-8?q?=E9=9D=9Eagency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/stats/impl/FactUserHouseServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java index c9f3baac89..2681ca34cb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -87,7 +87,7 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { List addList = new ArrayList<>(); neiList.forEach(item -> { - String agencyId = item.getAgencyId(); + String gridId = item.getGridId(); FactUserHouseResultDTO dto = new FactUserHouseResultDTO(); dto.setCustomerId(formDTO.getCustomerId()); dto.setDateId(dateId); @@ -95,7 +95,7 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { dto.setPids(item.getPids()); dto.setNeighbourhoodsCount(item.getNeighbourhoodsCount()); - Optional houseOptional = houseList.stream().filter(house -> agencyId.equals(house.getAgencyId()) && customerId.equals(house.getCustomerId())).findFirst(); + Optional houseOptional = houseList.stream().filter(house -> gridId.equals(house.getGridId()) && customerId.equals(house.getCustomerId())).findFirst(); if (houseOptional.isPresent()) { dto.setHouseCount(houseOptional.get().getHouseCount()); dto.setHouseSelfCount(houseOptional.get().getHouseSelfCount()); @@ -108,7 +108,7 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { dto.setHouseIdleCount(NumConstant.ZERO); } - Optional userOptional = userList.stream().filter(user -> agencyId.equals(user.getAgencyId()) && customerId.equals(user.getCustomerId())).findFirst(); + Optional userOptional = userList.stream().filter(user -> gridId.equals(user.getGridId()) && customerId.equals(user.getCustomerId())).findFirst(); if (userOptional.isPresent()) { dto.setUserCount(userOptional.get().getUserCount()); dto.setUserResiCount(userOptional.get().getUserResiCount()); From 8aa442d8395d22c6883239d4ae2120267b2eb471 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 11:09:08 +0800 Subject: [PATCH 07/30] =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/stats/impl/FactUserHouseServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java index 2681ca34cb..47a30955bd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -91,6 +91,7 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { FactUserHouseResultDTO dto = new FactUserHouseResultDTO(); dto.setCustomerId(formDTO.getCustomerId()); dto.setDateId(dateId); + dto.setGridId(gridId); dto.setPid(item.getPid()); dto.setPids(item.getPids()); dto.setNeighbourhoodsCount(item.getNeighbourhoodsCount()); From 1eb63292955584eb037a5e6ce87b7bfcadd924f2 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 13:34:35 +0800 Subject: [PATCH 08/30] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/stats/FactGridUserHouseDailyDao.java | 2 ++ .../com/epmet/service/org/HouseService.java | 16 ++++++++++++++++ .../stats/FactGridUserHouseDailyService.java | 18 ++++++++++++++++++ .../service/stats/FactUserHouseService.java | 16 ++++++++++++++++ .../FactGridUserHouseDailyServiceImpl.java | 5 +++++ .../stats/impl/FactUserHouseServiceImpl.java | 2 ++ .../epmet/service/user/IcResiUserService.java | 8 ++++++++ .../mapper/stats/FactGridUserHouseDailyDao.xml | 8 ++++++++ 8 files changed, 75 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java index 346ea6bf40..d6ee4903be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactGridUserHouseDailyDao.java @@ -21,4 +21,6 @@ public interface FactGridUserHouseDailyDao extends BaseDao listPage(Map params); List statAgency(FactUserHouseFormDTO formDTO); + + void deleteByDateId(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java index fa7081cf7c..a174b06c26 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/HouseService.java @@ -30,8 +30,24 @@ import java.util.List; */ public interface HouseService { + /** + * 房屋统计 + * + * @param formDTO + * @return java.util.List + * @author zhy + * @date 2022/5/30 13:33 + */ List houseStat(FactUserHouseFormDTO formDTO); + /** + * 小区统计 + * + * @param formDTO + * @return java.util.List + * @author zhy + * @date 2022/5/30 13:33 + */ List neighborhoodStat(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java index bd171008cb..3e63b8c477 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactGridUserHouseDailyService.java @@ -78,5 +78,23 @@ public interface FactGridUserHouseDailyService extends BaseService + * @author zhy + * @date 2022/5/30 13:32 + */ List statAgency(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java index 6b77221a07..8f3776908b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactUserHouseService.java @@ -36,7 +36,23 @@ public interface FactUserHouseService { */ List list(Map params); + /** + * 人房网格数据 + * + * @param formDTO + * @return void + * @author zhy + * @date 2022/5/30 13:31 + */ void statGrid(FactUserHouseFormDTO formDTO); + /** + * 人房组织数据 + * + * @param formDTO + * @return void + * @author zhy + * @date 2022/5/30 13:31 + */ void statAgency(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java index 54878a314e..c2232e4f56 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactGridUserHouseDailyServiceImpl.java @@ -89,6 +89,11 @@ public class FactGridUserHouseDailyServiceImpl extends BaseServiceImpl statAgency(FactUserHouseFormDTO formDTO){ return baseDao.statAgency(formDTO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java index 47a30955bd..48b82e2065 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -80,6 +80,8 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { String dateId = formDTO.getDateId(); String customerId = formDTO.getCustomerId(); + factGridUserHouseDailyService.deleteByDateId(formDTO); + List neiList = houseService.neighborhoodStat(formDTO); List houseList = houseService.houseStat(formDTO); List userList = icResiUserService.userStat(formDTO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java index 12bc106b65..3f2289edef 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/IcResiUserService.java @@ -32,6 +32,14 @@ import java.util.List; */ public interface IcResiUserService extends BaseService { + /** + * 居民统计 + * + * @param formDTO + * @return java.util.List + * @author zhy + * @date 2022/5/30 13:33 + */ List userStat(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 6108a2f5cc..77b9f35449 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -151,4 +151,12 @@ + + DELETE + FROM + fact_agency_user_house_daily + WHERE + DATE_ID = #{dateId} + AND CUSTOMER_ID = #{customerId} + \ No newline at end of file From 106bf78ee659bedc0e885295cc9daa35d853365b Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 14:00:30 +0800 Subject: [PATCH 09/30] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=97=B6=E5=88=A0=E9=99=A4=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/stats/FactAgencyUserHouseDailyDao.java | 2 ++ .../stats/FactAgencyUserHouseDailyService.java | 11 +++++++++++ .../impl/FactAgencyUserHouseDailyServiceImpl.java | 6 ++++++ .../stats/impl/FactUserHouseServiceImpl.java | 6 ++++++ .../mapper/stats/FactAgencyUserHouseDailyDao.xml | 10 ++++++++++ .../mapper/stats/FactGridUserHouseDailyDao.xml | 2 +- .../com/epmet/service/StatsUserHouseService.java | 13 +++++++++++-- .../service/impl/StatsUserHouseServiceImpl.java | 8 ++++++-- .../java/com/epmet/task/StatsUserHouseTask.java | 15 ++++++++++----- 9 files changed, 63 insertions(+), 10 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java index 9fc1e9dc60..a3a65195ae 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyUserHouseDailyDao.java @@ -1,6 +1,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -19,4 +20,5 @@ public interface FactAgencyUserHouseDailyDao extends BaseDao listPage(Map params); + void deleteByDateId(FactUserHouseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java index d0dfe6bfd3..4e42898302 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyUserHouseDailyService.java @@ -3,6 +3,7 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.stats.FactAgencyUserHouseDailyDTO; +import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.dto.stats.result.FactUserHouseResultDTO; import com.epmet.entity.stats.FactAgencyUserHouseDailyEntity; @@ -76,4 +77,14 @@ public interface FactAgencyUserHouseDailyService extends BaseService params = new HashMap<>(); params.put("dateId", formDTO.getDateId()); params.put("customerId", formDTO.getCustomerId()); @@ -138,6 +142,8 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { return; } + factAgencyUserHouseDailyService.deleteByDateId(formDTO); + formDTO.setLevel("community"); List commList = factGridUserHouseDailyService.statAgency(formDTO); if (!commList.isEmpty()) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml index a348c0d295..2be091d038 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyUserHouseDailyDao.xml @@ -54,4 +54,14 @@ ORDER BY a.CREATED_TIME DESC + + + DELETE + FROM + fact_agency_user_house_daily + WHERE + DATE_ID = #{dateId} + AND CUSTOMER_ID = #{customerId} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 77b9f35449..deed30076f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -154,7 +154,7 @@ DELETE FROM - fact_agency_user_house_daily + fact_grid_user_house_daily WHERE DATE_ID = #{dateId} AND CUSTOMER_ID = #{customerId} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java index 789d99c3ea..58c930e1a1 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsUserHouseService.java @@ -1,7 +1,6 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.StatsFormDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; public interface StatsUserHouseService { @@ -14,5 +13,15 @@ public interface StatsUserHouseService { * @author zhy * @date 2022/5/30 10:25 */ - Result execUserHouseStatistical(FactUserHouseFormDTO formDTO); + Result execUserHouseGridStatistical(FactUserHouseFormDTO formDTO); + + /** + * 人房信息统计 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhy + * @date 2022/5/30 10:25 + */ + Result execUserHouseAgencyStatistical(FactUserHouseFormDTO formDTO); } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java index 04d5b287fb..30875e947b 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsUserHouseServiceImpl.java @@ -1,7 +1,6 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.StatsFormDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.service.StatsUserHouseService; @@ -20,7 +19,12 @@ public class StatsUserHouseServiceImpl implements StatsUserHouseService { private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; @Override - public Result execUserHouseStatistical(FactUserHouseFormDTO formDTO) { + public Result execUserHouseGridStatistical(FactUserHouseFormDTO formDTO) { return dataStatisticalOpenFeignClient.userHouseStatGrid(formDTO); } + + @Override + public Result execUserHouseAgencyStatistical(FactUserHouseFormDTO formDTO) { + return dataStatisticalOpenFeignClient.userHouseStatAgency(formDTO); + } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java index 0b4cae80f2..1a32b7c1c7 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserHouseTask.java @@ -2,10 +2,8 @@ package com.epmet.task; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.StatsFormDTO; import com.epmet.dto.stats.form.FactUserHouseFormDTO; import com.epmet.service.StatsUserHouseService; -import com.epmet.service.StatsUserService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,11 +31,18 @@ public class StatsUserHouseTask implements ITask { if (StringUtils.isNotBlank(params)) { formDTO = JSON.parseObject(params, FactUserHouseFormDTO.class); } - Result result = statsUserHouseService.execUserHouseStatistical(formDTO); + Result result = statsUserHouseService.execUserHouseGridStatistical(formDTO); if (result.success()) { - logger.info("StatsUserHouseTask定时任务执行成功"); + logger.info("StatsUserHouseTask-grid定时任务执行成功"); } else { - logger.error("StatsUserHouseTask定时任务执行失败:" + result.getMsg()); + logger.error("StatsUserHouseTask-grid定时任务执行失败:" + result.getMsg()); + } + + result = statsUserHouseService.execUserHouseAgencyStatistical(formDTO); + if (result.success()) { + logger.info("StatsUserHouseTask-agency定时任务执行成功"); + } else { + logger.error("StatsUserHouseTask-agency定时任务执行失败:" + result.getMsg()); } } } From 335f2298cfbf8e4e7be078eac33ce7366bbe8727 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 14:25:21 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E6=8C=87=E5=AE=9Acustomer=E8=A1=A8?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/stats/FactGridUserHouseDailyDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index deed30076f..8dabf42170 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -98,8 +98,8 @@ INNER JOIN dim_grid g ON g.id = d.GRID_ID INNER JOIN dim_agency c ON c.id = g.AGENCY_ID WHERE - DATE_ID = #{dateId} - AND CUSTOMER_ID = #{customerId} + d.DATE_ID = #{dateId} + AND d.CUSTOMER_ID = #{customerId} GROUP BY c.id From 25b3240fd9a65591e6d0c639b47133e423ff3c55 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 14:34:41 +0800 Subject: [PATCH 11/30] dateId --- .../epmet/service/stats/impl/FactUserHouseServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java index 64b8246255..a7d94b76a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactUserHouseServiceImpl.java @@ -147,26 +147,31 @@ public class FactUserHouseServiceImpl implements FactUserHouseService { formDTO.setLevel("community"); List commList = factGridUserHouseDailyService.statAgency(formDTO); if (!commList.isEmpty()) { + commList.forEach(item -> item.setDateId(formDTO.getDateId())); factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(commList, FactAgencyUserHouseDailyEntity.class)); } formDTO.setLevel("street"); List streetList = factGridUserHouseDailyService.statAgency(formDTO); if (!streetList.isEmpty()) { + streetList.forEach(item -> item.setDateId(formDTO.getDateId())); factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(streetList, FactAgencyUserHouseDailyEntity.class)); } formDTO.setLevel("district"); List districtList = factGridUserHouseDailyService.statAgency(formDTO); if (!districtList.isEmpty()) { + districtList.forEach(item -> item.setDateId(formDTO.getDateId())); factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(districtList, FactAgencyUserHouseDailyEntity.class)); } formDTO.setLevel("city"); List cityList = factGridUserHouseDailyService.statAgency(formDTO); if (!cityList.isEmpty()) { + cityList.forEach(item -> item.setDateId(formDTO.getDateId())); factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(cityList, FactAgencyUserHouseDailyEntity.class)); } formDTO.setLevel("province"); List provinceList = factGridUserHouseDailyService.statAgency(formDTO); if (!provinceList.isEmpty()) { + provinceList.forEach(item -> item.setDateId(formDTO.getDateId())); factAgencyUserHouseDailyService.insertBatch(ConvertUtils.sourceToTarget(provinceList, FactAgencyUserHouseDailyEntity.class)); } From 81b678fa03acaaf22b7f668888e7883e2c443b3a Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Mon, 30 May 2022 14:44:26 +0800 Subject: [PATCH 12/30] =?UTF-8?q?=E7=BB=84=E7=BB=87ID=E5=8F=96=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/stats/FactGridUserHouseDailyDao.xml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 8dabf42170..ca3a8ebb99 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -58,6 +58,7 @@ SELECT - a.*, - d.AGENCY_NAME + d.AGENCY_NAME AS AGENCY_NAME, + max( NEIGHBOURHOODS_COUNT ) AS NEIGHBOURHOODS_COUNT, + max( HOUSE_COUNT ) AS HOUSE_COUNT, + max( HOUSE_SELF_COUNT ) AS HOUSE_SELF_COUNT, + max( HOUSE_LEASE_COUNT ) AS HOUSE_LEASE_COUNT, + max( HOUSE_IDLE_COUNT ) AS HOUSE_IDLE_COUNT, + max( USER_COUNT ) AS USER_COUNT, + max( USER_RESI_COUNT ) AS USER_RESI_COUNT, + max( USER_FLOAT_COUNT ) AS USER_FLOAT_COUNT, + max( HOUSE_INCR ) AS HOUSE_INCR, + max( HOUSE_MODIFY ) AS HOUSE_MODIFY, + max( USER_INCR ) AS USER_INCR, + max( USER_MODIFY ) AS USER_MODIFY FROM fact_agency_user_house_daily a LEFT JOIN dim_agency d ON d.id = a.AGENCY_ID @@ -45,14 +56,29 @@ AND a.AGENCY_ID = #{agencyId} + + AND a.DATE_ID = #{dateId} + + + AND a.LEVEL = 'community' + + + AND a.LEVEL = 'street' + + + AND a.LEVEL = 'district' + + + AND a.LEVEL = 'city' + - AND a.DATE_ID >= #{startTime} + AND DATE_FORMAT( a.DATE_ID, '%Y-%m-%d' ) >= DATE_FORMAT( #{startTime}, '%Y-%m-%d' ) - AND a.DATE_ID <= #{endTime} + AND DATE_FORMAT( a.DATE_ID, '%Y-%m-%d' ) <= DATE_FORMAT( #{endTime}, '%Y-%m-%d' ) - ORDER BY - a.CREATED_TIME DESC + GROUP BY + a.AGENCY_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index bd511e14db..5807a0b07f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -32,27 +32,40 @@ + + DELETE FROM diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 5807a0b07f..301d4e8dfa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -52,9 +52,12 @@ AND g.CUSTOMER_ID = #{customerId} AND d.CUSTOMER_ID = #{customerId} - + AND d.GRID_ID = #{agencyId} + + AND d.PID = #{agencyId} + AND d.DATE_ID = #{dateId} @@ -68,6 +71,43 @@ GRID_ID + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index d7765a73ef..57d72c45ac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -104,12 +104,6 @@ AND d.DATE_ID = #{dateId} - - AND DATE_FORMAT( d.DATE_ID, '%Y-%m-%d' ) >= DATE_FORMAT( #{startTime}, '%Y-%m-%d' ) - - - AND DATE_FORMAT( d.DATE_ID, '%Y-%m-%d' ) <= DATE_FORMAT( #{endTime}, '%Y-%m-%d' ) - diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml index 57d72c45ac..b46b9467eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGridUserHouseDailyDao.xml @@ -104,6 +104,16 @@ AND d.DATE_ID = #{dateId} + + AND DATE_FORMAT( d.DATE_ID, '%Y-%m-%d' ) >= DATE_FORMAT( #{startTime}, '%Y-%m-%d' ) + + + AND DATE_FORMAT( d.DATE_ID, '%Y-%m-%d' ) <= DATE_FORMAT( #{endTime}, '%Y-%m-%d' ) + + GROUP BY + d.DATE_ID + ORDER BY + d.DATE_ID ASC