| | |
| | | |
| | | private List repostList; |
| | | |
| | | private String length; |
| | | private int length; |
| | | |
| | | public String getLength() { |
| | | public int getLength() { |
| | | return length; |
| | | } |
| | | |
| | | public void setLength(String length) { |
| | | public void setLength(int length) { |
| | | this.length = length; |
| | | } |
| | | |
| New file |
| | |
| | | package com.java110.dto.report; |
| | | |
| | | /** |
| | | * 报表查询记录实体类(全String类型) |
| | | * 对应数据库表:report_query_record |
| | | */ |
| | | public class ReportQueryRecord { |
| | | /** |
| | | * 主键ID |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 刷新时间 |
| | | */ |
| | | private String refreshTime; |
| | | |
| | | /** |
| | | * 结束年份 |
| | | */ |
| | | private String endYear; |
| | | |
| | | /** |
| | | * 操作小区ID |
| | | */ |
| | | private String communityId; |
| | | |
| | | /** |
| | | * 操作小区名称 |
| | | */ |
| | | private String communityName; |
| | | |
| | | /** |
| | | * 报表内容串 |
| | | */ |
| | | private String reportContent; |
| | | |
| | | /** |
| | | * 操作人 |
| | | */ |
| | | private String operator; |
| | | |
| | | /** |
| | | * 操作人ID |
| | | */ |
| | | private String operatorId; |
| | | |
| | | /** |
| | | * 查询状态:1-成功,0-失败 |
| | | */ |
| | | private String queryStatus; |
| | | |
| | | /** |
| | | * 记录创建时间 |
| | | */ |
| | | private String createTime; |
| | | |
| | | /** |
| | | * 记录更新时间 |
| | | */ |
| | | private String updateTime; |
| | | |
| | | // 无参构造函数 |
| | | public ReportQueryRecord() { |
| | | } |
| | | |
| | | // 全参构造函数 |
| | | public ReportQueryRecord(String id, String refreshTime, String endYear, String communityId, |
| | | String communityName, String reportContent, String operator, String operatorId, |
| | | String queryStatus, String createTime, String updateTime) { |
| | | this.id = id; |
| | | this.refreshTime = refreshTime; |
| | | this.endYear = endYear; |
| | | this.communityId = communityId; |
| | | this.communityName = communityName; |
| | | this.reportContent = reportContent; |
| | | this.operator = operator; |
| | | this.operatorId = operatorId; |
| | | this.queryStatus = queryStatus; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | // getter和setter方法 |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getRefreshTime() { |
| | | return refreshTime; |
| | | } |
| | | |
| | | public void setRefreshTime(String refreshTime) { |
| | | this.refreshTime = refreshTime; |
| | | } |
| | | |
| | | public String getEndYear() { |
| | | return endYear; |
| | | } |
| | | |
| | | public void setEndYear(String endYear) { |
| | | this.endYear = endYear; |
| | | } |
| | | |
| | | public String getCommunityId() { |
| | | return communityId; |
| | | } |
| | | |
| | | public void setCommunityId(String communityId) { |
| | | this.communityId = communityId; |
| | | } |
| | | |
| | | public String getCommunityName() { |
| | | return communityName; |
| | | } |
| | | |
| | | public void setCommunityName(String communityName) { |
| | | this.communityName = communityName; |
| | | } |
| | | |
| | | public String getReportContent() { |
| | | return reportContent; |
| | | } |
| | | |
| | | public void setReportContent(String reportContent) { |
| | | this.reportContent = reportContent; |
| | | } |
| | | |
| | | public String getOperator() { |
| | | return operator; |
| | | } |
| | | |
| | | public void setOperator(String operator) { |
| | | this.operator = operator; |
| | | } |
| | | |
| | | public String getOperatorId() { |
| | | return operatorId; |
| | | } |
| | | |
| | | public void setOperatorId(String operatorId) { |
| | | this.operatorId = operatorId; |
| | | } |
| | | |
| | | public String getQueryStatus() { |
| | | return queryStatus; |
| | | } |
| | | |
| | | public void setQueryStatus(String queryStatus) { |
| | | this.queryStatus = queryStatus; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(String updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ReportQueryRecord{" + |
| | | "id='" + id + '\'' + |
| | | ", refreshTime='" + refreshTime + '\'' + |
| | | ", endYear='" + endYear + '\'' + |
| | | ", communityId='" + communityId + '\'' + |
| | | ", communityName='" + communityName + '\'' + |
| | | ", reportContent='" + reportContent + '\'' + |
| | | ", operator='" + operator + '\'' + |
| | | ", operatorId='" + operatorId + '\'' + |
| | | ", queryStatus='" + queryStatus + '\'' + |
| | | ", createTime='" + createTime + '\'' + |
| | | ", updateTime='" + updateTime + '\'' + |
| | | '}'; |
| | | } |
| | | } |
| | | |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="reportFeeServiceDaoImpl"> |
| | | <select id="repostInFee" resultType="java.util.Map"> |
| | | -- 步骤1:生成所有年份 |
| | | -- 步骤1:使用传入的yearList作为年份范围(避免递归CTE) |
| | | WITH all_years AS ( |
| | | SELECT 2020 AS year UNION ALL |
| | | SELECT 2021 UNION ALL |
| | | SELECT 2022 UNION ALL |
| | | SELECT 2023 UNION ALL |
| | | SELECT 2024 UNION ALL |
| | | SELECT 2025 |
| | | ), |
| | | -- 步骤2:生成所有费用类型 |
| | | all_fee_types AS ( |
| | | SELECT DISTINCT |
| | | <foreach collection="yearList" item="year" separator="UNION ALL"> |
| | | SELECT #{year} AS year |
| | | </foreach> |
| | | ), |
| | | -- 步骤2:生成所有费用类型 |
| | | all_fee_types AS ( |
| | | SELECT DISTINCT |
| | | f.fee_type_cd, |
| | | COALESCE(dict.`name`, '未知类型') AS fee_type_name |
| | | FROM pay_fee f |
| | | LEFT JOIN t_dict dict ON f.fee_type_cd = dict.status_cd |
| | | ), |
| | | -- 步骤3:生成"类型+年份"全量组合 |
| | | all_type_year AS ( |
| | | SELECT |
| | | FROM pay_fee f |
| | | LEFT JOIN t_dict dict ON f.fee_type_cd = dict.status_cd |
| | | ), |
| | | -- 步骤3:生成"类型+年份"全量组合 |
| | | all_type_year AS ( |
| | | SELECT |
| | | t.fee_type_cd, |
| | | t.fee_type_name, |
| | | y.year AS detail_year |
| | | FROM all_fee_types t |
| | | CROSS JOIN all_years y |
| | | ), |
| | | -- 步骤4:修正原始数据聚合逻辑(关键:确保月度数据不重复计算) |
| | | original_agg AS ( |
| | | SELECT |
| | | FROM all_fee_types t |
| | | CROSS JOIN all_years y |
| | | ), |
| | | -- 步骤4:原始数据聚合(按年份列表动态处理) |
| | | original_agg AS ( |
| | | SELECT |
| | | f.fee_type_cd, |
| | | COALESCE(dict.`name`, '未知类型') AS fee_type_name, |
| | | d.detail_year, |
| | | -- 年度总金额(基础数据,确保不重复) |
| | | SUM(DISTINCT d.receivable_amount) AS 该年应缴总额, -- 修正1:避免同年度金额重复计算 |
| | | -- 核心年度字段 |
| | | SUM(DISTINCT d.receivable_amount) AS 该年应缴总额, |
| | | ROUND(SUM(DISTINCT d.receivable_amount)/12, 4) AS 每月费用, |
| | | 12 AS 应收月份数, |
| | | -- 收缴率计算(使用DISTINCT确保分子分母匹配) |
| | | ROUND(CASE WHEN SUM(DISTINCT d.receivable_amount) = 0 THEN 0 |
| | | ELSE SUM(DISTINCT d.received_amount)/SUM(DISTINCT d.receivable_amount)*100 |
| | | END, 2) AS `当年收缴率(%)`, |
| | | ELSE SUM(DISTINCT d.received_amount)/SUM(DISTINCT d.receivable_amount)*100 |
| | | END, 2) AS 当年收缴率, |
| | | SUM(DISTINCT d.discount_amount) AS 折扣金额, |
| | | -- 各年实缴(按付款时间统计,避免跨年度重复) |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = 2020 THEN d.received_amount ELSE 0 END) AS 2020年实缴, |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = 2021 THEN d.received_amount ELSE 0 END) AS 2021年实缴, |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = 2022 THEN d.received_amount ELSE 0 END) AS 2022年实缴, |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = 2023 THEN d.received_amount ELSE 0 END) AS 2023年实缴, |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = 2024 THEN d.received_amount ELSE 0 END) AS 2024年实缴, |
| | | -- 各年实缴(遍历yearList生成字段) |
| | | <foreach collection="yearList" item="y" separator=","> |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = #{y} THEN d.received_amount ELSE 0 END) AS ${y}年实缴 |
| | | </foreach>, |
| | | -- 其他核心字段 |
| | | SUM(DISTINCT d.receivable_amount) AS 当年预算, |
| | | SUM(CASE WHEN YEAR(d.pay_fee_time) = 2025 THEN d.received_amount ELSE 0 END) AS 2025年实缴, |
| | | SUM(DISTINCT d.received_amount) AS 当年实缴, -- 当年实缴=当年实际收到的金额 |
| | | SUM(DISTINCT d.discount_amount) AS 当年折扣总额, |
| | | SUM(DISTINCT d.receivable_amount) - SUM(DISTINCT d.received_amount) AS 当年欠款, |
| | | -- 每月应收(修正2:按月份唯一值计算,避免重复) |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 1 THEN d.receivable_amount ELSE 0 END) AS 当年1月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 2 THEN d.receivable_amount ELSE 0 END) AS 当年2月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 3 THEN d.receivable_amount ELSE 0 END) AS 当年3月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 4 THEN d.receivable_amount ELSE 0 END) AS 当年4月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 5 THEN d.receivable_amount ELSE 0 END) AS 当年5月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 6 THEN d.receivable_amount ELSE 0 END) AS 当年6月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 7 THEN d.receivable_amount ELSE 0 END) AS 当年7月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 8 THEN d.receivable_amount ELSE 0 END) AS 当年8月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 9 THEN d.receivable_amount ELSE 0 END) AS 当年9月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 10 THEN d.receivable_amount ELSE 0 END) AS 当年10月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 11 THEN d.receivable_amount ELSE 0 END) AS 当年11月应收, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 12 THEN d.receivable_amount ELSE 0 END) AS 当年12月应收, |
| | | -- 每月实缴(同上,避免重复) |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 1 THEN d.received_amount ELSE 0 END) AS 当年1月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 2 THEN d.received_amount ELSE 0 END) AS 当年2月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 3 THEN d.received_amount ELSE 0 END) AS 当年3月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 4 THEN d.received_amount ELSE 0 END) AS 当年4月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 5 THEN d.received_amount ELSE 0 END) AS 当年5月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 6 THEN d.received_amount ELSE 0 END) AS 当年6月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 7 THEN d.received_amount ELSE 0 END) AS 当年7月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 8 THEN d.received_amount ELSE 0 END) AS 当年8月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 9 THEN d.received_amount ELSE 0 END) AS 当年9月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 10 THEN d.received_amount ELSE 0 END) AS 当年10月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 11 THEN d.received_amount ELSE 0 END) AS 当年11月实缴, |
| | | SUM(DISTINCT CASE WHEN d.detail_month = 12 THEN d.received_amount ELSE 0 END) AS 当年12月实缴 |
| | | FROM pay_fee_detail_month d |
| | | INNER JOIN pay_fee f ON d.fee_id = f.fee_id |
| | | LEFT JOIN t_dict dict ON f.fee_type_cd = dict.status_cd |
| | | WHERE d.community_id = '2025081537770016' AND d.status_cd = '0' |
| | | GROUP BY f.fee_type_cd, COALESCE(dict.`name`, '未知类型'), d.detail_year |
| | | ), |
| | | -- 步骤5:全量明细行 |
| | | detail_rows AS ( |
| | | SELECT |
| | | -- 每月应收(遍历monthList生成字段) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | SUM(DISTINCT CASE WHEN d.detail_month = #{m} THEN d.receivable_amount ELSE 0 END) AS 当年${m}月应收 |
| | | </foreach>, |
| | | -- 每月实缴(遍历monthList生成字段) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | SUM(DISTINCT CASE WHEN d.detail_month = #{m} THEN d.received_amount ELSE 0 END) AS 当年${m}月实缴 |
| | | </foreach> |
| | | FROM pay_fee_detail_month d |
| | | INNER JOIN pay_fee f ON d.fee_id = f.fee_id |
| | | LEFT JOIN t_dict dict ON f.fee_type_cd = dict.status_cd |
| | | WHERE d.community_id = #{communityId} |
| | | AND d.status_cd = '0' |
| | | AND d.detail_year BETWEEN #{startYear} AND #{endYear} |
| | | GROUP BY f.fee_type_cd, COALESCE(dict.`name`, '未知类型'), d.detail_year |
| | | ), |
| | | -- 步骤5:全量明细行(关联聚合结果) |
| | | detail_rows AS ( |
| | | SELECT |
| | | a.fee_type_cd, |
| | | a.fee_type_name, |
| | | a.detail_year AS 费用所属年份, |
| | | '明细' AS 行类型, |
| | | -- 核心年度字段 |
| | | COALESCE(o.该年应缴总额, 0) AS 该年应缴总额, |
| | | COALESCE(o.每月费用, 0) AS 每月费用, |
| | | COALESCE(o.应收月份数, 12) AS 应收月份数, |
| | | COALESCE(o.`当年收缴率(%)`, 0) AS `当年收缴率(%)`, |
| | | COALESCE(o.当年收缴率, 0) AS 当年收缴率, |
| | | COALESCE(o.折扣金额, 0) AS 折扣金额, |
| | | -- 各年实缴 |
| | | COALESCE(o.2020年实缴, 0) AS 2020年实缴, |
| | | COALESCE(o.2021年实缴, 0) AS 2021年实缴, |
| | | COALESCE(o.2022年实缴, 0) AS 2022年实缴, |
| | | COALESCE(o.2023年实缴, 0) AS 2023年实缴, |
| | | COALESCE(o.2024年实缴, 0) AS 2024年实缴, |
| | | -- 各年实缴(遍历yearList) |
| | | <foreach collection="yearList" item="y" separator=","> |
| | | COALESCE(o.${y}年实缴, 0) AS ${y}年实缴 |
| | | </foreach>, |
| | | -- 其他核心字段 |
| | | COALESCE(o.当年预算, 0) AS 当年预算, |
| | | COALESCE(o.2025年实缴, 0) AS 2025年实缴, |
| | | COALESCE(o.当年实缴, 0) AS 当年实缴, |
| | | COALESCE(o.当年折扣总额, 0) AS 当年折扣总额, |
| | | COALESCE(o.当年欠款, 0) AS 当年欠款, |
| | | -- 每月应收 |
| | | COALESCE(o.当年1月应收, 0) AS 当年1月应收, |
| | | COALESCE(o.当年2月应收, 0) AS 当年2月应收, |
| | | COALESCE(o.当年3月应收, 0) AS 当年3月应收, |
| | | COALESCE(o.当年4月应收, 0) AS 当年4月应收, |
| | | COALESCE(o.当年5月应收, 0) AS 当年5月应收, |
| | | COALESCE(o.当年6月应收, 0) AS 当年6月应收, |
| | | COALESCE(o.当年7月应收, 0) AS 当年7月应收, |
| | | COALESCE(o.当年8月应收, 0) AS 当年8月应收, |
| | | COALESCE(o.当年9月应收, 0) AS 当年9月应收, |
| | | COALESCE(o.当年10月应收, 0) AS 当年10月应收, |
| | | COALESCE(o.当年11月应收, 0) AS 当年11月应收, |
| | | COALESCE(o.当年12月应收, 0) AS 当年12月应收, |
| | | -- 每月实缴 |
| | | COALESCE(o.当年1月实缴, 0) AS 当年1月实缴, |
| | | COALESCE(o.当年2月实缴, 0) AS 当年2月实缴, |
| | | COALESCE(o.当年3月实缴, 0) AS 当年3月实缴, |
| | | COALESCE(o.当年4月实缴, 0) AS 当年4月实缴, |
| | | COALESCE(o.当年5月实缴, 0) AS 当年5月实缴, |
| | | COALESCE(o.当年6月实缴, 0) AS 当年6月实缴, |
| | | COALESCE(o.当年7月实缴, 0) AS 当年7月实缴, |
| | | COALESCE(o.当年8月实缴, 0) AS 当年8月实缴, |
| | | COALESCE(o.当年9月实缴, 0) AS 当年9月实缴, |
| | | COALESCE(o.当年10月实缴, 0) AS 当年10月实缴, |
| | | COALESCE(o.当年11月实缴, 0) AS 当年11月实缴, |
| | | COALESCE(o.当年12月实缴, 0) AS 当年12月实缴 |
| | | FROM all_type_year a |
| | | LEFT JOIN original_agg o |
| | | -- 每月应收(遍历monthList) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | COALESCE(o.当年${m}月应收, 0) AS 当年${m}月应收 |
| | | </foreach>, |
| | | -- 每月实缴(遍历monthList) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | COALESCE(o.当年${m}月实缴, 0) AS 当年${m}月实缴 |
| | | </foreach> |
| | | FROM all_type_year a |
| | | LEFT JOIN original_agg o |
| | | ON a.fee_type_cd = o.fee_type_cd |
| | | AND a.detail_year = o.detail_year |
| | | ), |
| | | -- 步骤6:类型总计行 |
| | | type_total_rows AS ( |
| | | SELECT |
| | | ), |
| | | -- 步骤6:类型总计行(聚合明细行) |
| | | type_total_rows AS ( |
| | | SELECT |
| | | fee_type_cd, |
| | | fee_type_name, |
| | | '类型总计' AS 费用所属年份, |
| | |
| | | ROUND(SUM(该年应缴总额) / (12 * COUNT(DISTINCT 费用所属年份)), 4) AS 每月费用, |
| | | 12 * COUNT(DISTINCT 费用所属年份) AS 应收月份数, |
| | | ROUND(CASE WHEN SUM(该年应缴总额) = 0 THEN 0 |
| | | ELSE SUM(2020年实缴 + 2021年实缴 + 2022年实缴 + 2023年实缴 + 2024年实缴 + 2025年实缴) |
| | | / SUM(该年应缴总额) * 100 |
| | | END, 2) AS `当年收缴率(%)`, |
| | | ELSE SUM(当年实缴) / SUM(该年应缴总额) * 100 |
| | | END, 2) AS 当年收缴率, |
| | | SUM(折扣金额) AS 折扣金额, |
| | | -- 各年实缴合计 |
| | | SUM(2020年实缴) AS 2020年实缴, |
| | | SUM(2021年实缴) AS 2021年实缴, |
| | | SUM(2022年实缴) AS 2022年实缴, |
| | | SUM(2023年实缴) AS 2023年实缴, |
| | | SUM(2024年实缴) AS 2024年实缴, |
| | | -- 各年实缴合计(遍历yearList) |
| | | <foreach collection="yearList" item="y" separator=","> |
| | | SUM(${y}年实缴) AS ${y}年实缴 |
| | | </foreach>, |
| | | -- 其他核心字段合计 |
| | | SUM(当年预算) AS 当年预算, |
| | | SUM(2025年实缴) AS 2025年实缴, |
| | | SUM(当年实缴) AS 当年实缴, |
| | | SUM(当年折扣总额) AS 当年折扣总额, |
| | | SUM(当年欠款) AS 当年欠款, |
| | | -- 每月应收合计 |
| | | SUM(当年1月应收) AS 当年1月应收, |
| | | SUM(当年2月应收) AS 当年2月应收, |
| | | SUM(当年3月应收) AS 当年3月应收, |
| | | SUM(当年4月应收) AS 当年4月应收, |
| | | SUM(当年5月应收) AS 当年5月应收, |
| | | SUM(当年6月应收) AS 当年6月应收, |
| | | SUM(当年7月应收) AS 当年7月应收, |
| | | SUM(当年8月应收) AS 当年8月应收, |
| | | SUM(当年9月应收) AS 当年9月应收, |
| | | SUM(当年10月应收) AS 当年10月应收, |
| | | SUM(当年11月应收) AS 当年11月应收, |
| | | SUM(当年12月应收) AS 当年12月应收, |
| | | -- 每月实缴合计 |
| | | SUM(当年1月实缴) AS 当年1月实缴, |
| | | SUM(当年2月实缴) AS 当年2月实缴, |
| | | SUM(当年3月实缴) AS 当年3月实缴, |
| | | SUM(当年4月实缴) AS 当年4月实缴, |
| | | SUM(当年5月实缴) AS 当年5月实缴, |
| | | SUM(当年6月实缴) AS 当年6月实缴, |
| | | SUM(当年7月实缴) AS 当年7月实缴, |
| | | SUM(当年8月实缴) AS 当年8月实缴, |
| | | SUM(当年9月实缴) AS 当年9月实缴, |
| | | SUM(当年10月实缴) AS 当年10月实缴, |
| | | SUM(当年11月实缴) AS 当年11月实缴, |
| | | SUM(当年12月实缴) AS 当年12月实缴 |
| | | FROM detail_rows |
| | | GROUP BY fee_type_cd, fee_type_name |
| | | ), |
| | | -- 步骤7:总合计行 |
| | | grand_total_row AS ( |
| | | SELECT |
| | | -- 每月应收合计(遍历monthList) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | SUM(当年${m}月应收) AS 当年${m}月应收 |
| | | </foreach>, |
| | | -- 每月实缴合计(遍历monthList) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | SUM(当年${m}月实缴) AS 当年${m}月实缴 |
| | | </foreach> |
| | | FROM detail_rows |
| | | GROUP BY fee_type_cd, fee_type_name |
| | | ), |
| | | -- 步骤7:总合计行(聚合所有数据) |
| | | grand_total_row AS ( |
| | | SELECT |
| | | 'ALL' AS fee_type_cd, |
| | | '所有类型总计' AS fee_type_name, |
| | | '总合计' AS 费用所属年份, |
| | |
| | | ROUND(SUM(该年应缴总额) / (12 * COUNT(DISTINCT 费用所属年份)), 4) AS 每月费用, |
| | | 12 * COUNT(DISTINCT 费用所属年份) AS 应收月份数, |
| | | ROUND(CASE WHEN SUM(该年应缴总额) = 0 THEN 0 |
| | | ELSE SUM(2020年实缴 + 2021年实缴 + 2022年实缴 + 2023年实缴 + 2024年实缴 + 2025年实缴) |
| | | / SUM(该年应缴总额) * 100 |
| | | END, 2) AS `当年收缴率`, |
| | | ELSE SUM(当年实缴) / SUM(该年应缴总额) * 100 |
| | | END, 2) AS 当年收缴率, |
| | | SUM(折扣金额) AS 折扣金额, |
| | | -- 各年实缴总合计 |
| | | SUM(2020年实缴) AS 2020年实缴, |
| | | SUM(2021年实缴) AS 2021年实缴, |
| | | SUM(2022年实缴) AS 2022年实缴, |
| | | SUM(2023年实缴) AS 2023年实缴, |
| | | SUM(2024年实缴) AS 2024年实缴, |
| | | -- 各年实缴总合计(遍历yearList) |
| | | <foreach collection="yearList" item="y" separator=","> |
| | | SUM(${y}年实缴) AS ${y}年实缴 |
| | | </foreach>, |
| | | -- 其他核心字段总合计 |
| | | SUM(当年预算) AS 当年预算, |
| | | SUM(2025年实缴) AS 2025年实缴, |
| | | SUM(当年实缴) AS 当年实缴, |
| | | SUM(当年折扣总额) AS 当年折扣总额, |
| | | SUM(当年欠款) AS 当年欠款, |
| | | -- 每月应收总合计 |
| | | SUM(当年1月应收) AS 当年1月应收, |
| | | SUM(当年2月应收) AS 当年2月应收, |
| | | SUM(当年3月应收) AS 当年3月应收, |
| | | SUM(当年4月应收) AS 当年4月应收, |
| | | SUM(当年5月应收) AS 当年5月应收, |
| | | SUM(当年6月应收) AS 当年6月应收, |
| | | SUM(当年7月应收) AS 当年7月应收, |
| | | SUM(当年8月应收) AS 当年8月应收, |
| | | SUM(当年9月应收) AS 当年9月应收, |
| | | SUM(当年10月应收) AS 当年10月应收, |
| | | SUM(当年11月应收) AS 当年11月应收, |
| | | SUM(当年12月应收) AS 当年12月应收, |
| | | -- 每月实缴总合计 |
| | | SUM(当年1月实缴) AS 当年1月实缴, |
| | | SUM(当年2月实缴) AS 当年2月实缴, |
| | | SUM(当年3月实缴) AS 当年3月实缴, |
| | | SUM(当年4月实缴) AS 当年4月实缴, |
| | | SUM(当年5月实缴) AS 当年5月实缴, |
| | | SUM(当年6月实缴) AS 当年6月实缴, |
| | | SUM(当年7月实缴) AS 当年7月实缴, |
| | | SUM(当年8月实缴) AS 当年8月实缴, |
| | | SUM(当年9月实缴) AS 当年9月实缴, |
| | | SUM(当年10月实缴) AS 当年10月实缴, |
| | | SUM(当年11月实缴) AS 当年11月实缴, |
| | | SUM(当年12月实缴) AS 当年12月实缴 |
| | | FROM detail_rows |
| | | ) |
| | | -- 每月应收总合计(遍历monthList) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | SUM(当年${m}月应收) AS 当年${m}月应收 |
| | | </foreach>, |
| | | -- 每月实缴总合计(遍历monthList) |
| | | <foreach collection="monthList" item="m" separator=","> |
| | | SUM(当年${m}月实缴) AS 当年${m}月实缴 |
| | | </foreach> |
| | | FROM detail_rows |
| | | ) |
| | | |
| | | -- 最终结果 |
| | | -- 最终结果:合并所有行并排序 |
| | | SELECT * FROM ( |
| | | SELECT * FROM type_total_rows |
| | | UNION ALL |
| | | SELECT * FROM detail_rows |
| | | UNION ALL |
| | | SELECT * FROM grand_total_row |
| | | ) AS all_rows |
| | | SELECT * FROM type_total_rows |
| | | UNION ALL |
| | | SELECT * FROM detail_rows |
| | | UNION ALL |
| | | SELECT * FROM grand_total_row |
| | | ) AS all_rows |
| | | ORDER BY |
| | | CASE |
| | | WHEN 行类型 = '总合计' THEN 2 |
| | | WHEN 行类型 = '类型总计' THEN 0 |
| | | ELSE 1 |
| | | END, |
| | | fee_type_cd, |
| | | CASE WHEN 费用所属年份 = '类型总计' THEN 0 ELSE CAST(费用所属年份 AS UNSIGNED) END; |
| | | |
| | | CASE |
| | | WHEN 行类型 = '总合计' THEN 2 |
| | | WHEN 行类型 = '类型总计' THEN 0 |
| | | ELSE 1 |
| | | END, |
| | | fee_type_cd, |
| | | CASE WHEN 费用所属年份 = '类型总计' THEN 0 ELSE CAST(费用所属年份 AS UNSIGNED) END |
| | | </select> |
| | | </mapper> |
| | | <insert id="saveReport" parameterType="Map"> |
| | | INSERT INTO report_query_record ( |
| | | id, |
| | | refresh_time, |
| | | end_year, |
| | | community_id, |
| | | community_name, |
| | | report_content, |
| | | operator, |
| | | operator_id, |
| | | query_status, |
| | | create_time, |
| | | update_time |
| | | ) VALUES ( |
| | | #{id}, |
| | | now(), |
| | | #{endYear}, |
| | | #{communityId}, |
| | | null, |
| | | #{reportContent}, |
| | | #{operator}, |
| | | null, |
| | | #{queryStatus}, |
| | | now(), |
| | | now() |
| | | ) |
| | | </insert> |
| | | <select id="queryReport" resultType="java.util.Map"> |
| | | SELECT |
| | | id, |
| | | refresh_time AS refreshTime, |
| | | end_year AS endYear, |
| | | community_id AS communityId, |
| | | community_name AS communityName, |
| | | report_content AS reportContent, |
| | | operator, |
| | | operator_id AS operatorId, |
| | | query_status AS queryStatus, |
| | | create_time AS createTime, |
| | | update_time AS updateTime |
| | | FROM report_query_record |
| | | WHERE 1 = 1 |
| | | <if test="communityId != null and communityId != ''"> |
| | | AND community_id = #{communityId} |
| | | </if> |
| | | <if test="endYear != null and endYear != ''"> |
| | | AND end_year = #{endYear} |
| | | </if> |
| | | <if test="queryStatus != null and queryStatus != ''"> |
| | | AND query_status = #{queryStatus} |
| | | </if> |
| | | <if test="operatorId != null and operatorId != ''"> |
| | | AND operator_id = #{operatorId} |
| | | </if> |
| | | <if test="startTime != null and startTime != ''"> |
| | | AND create_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null and endTime != ''"> |
| | | AND create_time <= #{endTime} |
| | | </if> |
| | | ORDER BY create_time DESC |
| | | <if test="pageNum != null and pageSize != null"> |
| | | LIMIT #{pageNum}, #{pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="openId !=null and openId != ''"> |
| | | , t.open_id= #{openId} |
| | | </if> |
| | | <if test="link !=null and link != ''"> |
| | | <if test="link !=null"> |
| | | , t.link= #{link} |
| | | </if> |
| | | <if test="remark !=null and remark != ''"> |
| | |
| | | <if test="sex !=null and sex != ''"> |
| | | ,t.sex= #{sex} |
| | | </if> |
| | | <if test="link !=null and link != ''"> |
| | | <if test="link !=null"> |
| | | ,t.link= #{link} |
| | | </if> |
| | | <if test="address !=null and address != ''"> |
| | |
| | | <if test="name !=null and name != ''"> |
| | | , t.name= #{name} |
| | | </if> |
| | | <if test="tel !=null and tel != ''"> |
| | | <if test="tel !=null"> |
| | | , t.tel= #{tel} |
| | | </if> |
| | | , t.email= #{email} |
| | |
| | | package com.java110.intf.fee; |
| | | |
| | | import com.java110.config.feign.FeignConfiguration; |
| | | import com.java110.dto.fee.TempCarFeeConfigDto; |
| | | import com.java110.dto.report.ReportQueryRecord; |
| | | import com.java110.vo.FeeQueryParams; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import java.util.List; |
| | |
| | | List<Map> repostPaidInFee(FeeQueryParams feeQueryParams); |
| | | |
| | | List<Map> repostPaidInFeeTwo(FeeQueryParams feeQueryParams); |
| | | |
| | | int saveReport(Map map); |
| | | |
| | | List<ReportQueryRecord> queryReport(Map map); |
| | | } |
| | |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.dto.dict.DictDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.report.ReportQueryRecord; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.dev.IDictV1InnerServiceSMO; |
| | | import com.java110.intf.fee.IReportFeeInnerServiceSMO; |
| | | import com.java110.po.fee.PayFeePo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.FeeQueryParams; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | int currentYear = java.time.Year.now().getValue(); |
| | | feeQueryParams.setEndYear(currentYear + 2); |
| | | int endYear = feeQueryParams.getEndYear(); |
| | | |
| | | List<Map> result = reportFeeInnerServiceSMOImpl.repostPaidInFee(feeQueryParams); |
| | | DictDto dictDto = new DictDto(); |
| | | dictDto.setTableName("pay_fee_config"); |
| | | dictDto.setTableColumns("fee_type_cd"); |
| | | List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDicts(dictDto); |
| | | int doYear = endYear - startYear; |
| | | |
| | | |
| | | ReportQueryRecord reportQueryRecord = new ReportQueryRecord(); |
| | | reportQueryRecord.setCommunityId(reqJson.getString("communityId")); |
| | | reportQueryRecord.setQueryStatus("0"); |
| | | reportQueryRecord.setEndYear(currentYear+""); |
| | | List<ReportQueryRecord> reportQueryRecords = reportFeeInnerServiceSMOImpl.queryReport(BeanConvertUtil.beanCovertMap(reportQueryRecord)); |
| | | |
| | | if(reportQueryRecords.size()>0){ |
| | | |
| | | } |
| | | |
| | | List<List<FeeDto>> reportFeeDtoLists = new LinkedList<>(); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | int ind = 1; |
| | | queryFee(reportFeeDtoLists ,reqJson); |
| | | |
| | | int[] arr = new int[endYear - startYear + 1]; |
| | | for (int i = startYear; i <= endYear; i++) { |
| | | arr[i-startYear] = i; |
| | | } |
| | | |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setRepostList(reportFeeDtoLists); |
| | | feeDto.setYearArr(arr); |
| | | feeDto.setLength(doYear - 1 + 20); |
| | | |
| | | reportQueryRecord.setCommunityId(reqJson.getString("communityId")); |
| | | reportQueryRecord.setQueryStatus("0"); |
| | | reportQueryRecord.setEndYear(currentYear+""); |
| | | reportQueryRecord.setReportContent(JSONObject.toJSONString(feeDto)); |
| | | |
| | | int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord)); |
| | | |
| | | ResultVo resultVo = new ResultVo(feeDto); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | public void queryFee(List<List<FeeDto>> reportFeeDtoLists, JSONObject reqJson) { |
| | | int startYear = 2020; |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto); |
| | | FeeQueryParams feeQueryParams = new FeeQueryParams(); |
| | | feeQueryParams.setCommunityId(reqJson.getString("communityId")); |
| | | feeQueryParams.setStartYear(startYear); |
| | | int currentYear = java.time.Year.now().getValue(); |
| | | feeQueryParams.setEndYear(currentYear + 2); |
| | | int endYear = feeQueryParams.getEndYear(); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | reportFeeDtoLists.add(new LinkedList<FeeDto>()); |
| | | int ind = 1; |
| | | int doYear = endYear - startYear; |
| | | |
| | | int[] arr = new int[endYear - startYear + 1]; |
| | | for (int i = startYear; i <= endYear; i++) { |
| | | arr[i-startYear] = i; |
| | | } |
| | | List<Map> result = reportFeeInnerServiceSMOImpl.repostPaidInFee(feeQueryParams); |
| | | DictDto dictDto = new DictDto(); |
| | | dictDto.setTableName("pay_fee_config"); |
| | | dictDto.setTableColumns("fee_type_cd"); |
| | | List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDicts(dictDto); |
| | | for (DictDto dictDto1 : dictDtos) {//类型 |
| | | List<FeeDto> reportFeeDtos = new LinkedList<>();//该类型的数组 |
| | | FeeDto feeDto = new FeeDto(); |
| | |
| | | doubles[0] = ((BigDecimal) map.get("该年应缴总额")).doubleValue(); |
| | | doubles[1] = ((BigDecimal) map.get("每月费用")).doubleValue(); |
| | | doubles[2] = ((Long) map.get("应收月份数")).doubleValue(); |
| | | doubles[3] = ((BigDecimal) map.get("当年收缴率(%)")).doubleValue(); |
| | | doubles[3] = ((BigDecimal) map.get("当年收缴率")).doubleValue(); |
| | | doubles[4] = ((BigDecimal) map.get("折扣金额")).doubleValue(); |
| | | int inde = 0; |
| | | for (int i : arr){ |
| | |
| | | doubles[inde + 8] =((BigDecimal) map.get("当年欠款")).doubleValue(); |
| | | |
| | | for (int i = 1 ; i <= 12 ; i++){ |
| | | doubles[inde + 8 + i] =((BigDecimal) map.get("当年"+i+"月实缴")).doubleValue(); |
| | | doubles[inde + 8 + i] =((BigDecimal) map.get("当年"+(i < 10 ? "0"+i : i) +"月实缴")).doubleValue(); |
| | | } |
| | | feeDto.setCurYear(dictDto1.getName()+"总计"); |
| | | feeDto.setReport(doubles); |
| | |
| | | doubles[0] = ((BigDecimal) map.get("该年应缴总额")).doubleValue(); |
| | | doubles[1] = ((BigDecimal) map.get("每月费用")).doubleValue(); |
| | | doubles[2] = ((Long) map.get("应收月份数")).doubleValue(); |
| | | doubles[3] = ((BigDecimal) map.get("当年收缴率(%)")).doubleValue(); |
| | | doubles[3] = ((BigDecimal) map.get("当年收缴率")).doubleValue(); |
| | | doubles[4] = ((BigDecimal) map.get("折扣金额")).doubleValue(); |
| | | int inde = 0; |
| | | for (int in : arr){ |
| | |
| | | doubles[inde + 8] =((BigDecimal) map.get("当年欠款")).doubleValue(); |
| | | |
| | | for (int in = 1 ; in <= 12 ; in++){ |
| | | doubles[inde + 8 + in] =((BigDecimal) map.get("当年"+in+"月实缴")).doubleValue(); |
| | | doubles[inde + 8 + in] =((BigDecimal) map.get("当年"+(in < 10 ? "0"+in : in) +"月实缴")).doubleValue(); |
| | | } |
| | | feeDto = new FeeDto(); |
| | | feeDto.setFeeTypeCdName(dictDto1.getName()); |
| | |
| | | } |
| | | ind ++; |
| | | } |
| | | FeeDto feeDto = new FeeDto(); |
| | | feeDto.setRepostList(reportFeeDtoLists); |
| | | feeDto.setYearArr(arr); |
| | | feeDto.setLength(String.valueOf(doYear+12+1+5+4)); |
| | | |
| | | ResultVo resultVo = new ResultVo(feeDto); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| | |
| | | package com.java110.fee.dao; |
| | | |
| | | import com.java110.dto.report.ReportQueryRecord; |
| | | import com.java110.vo.FeeQueryParams; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | |
| | | List<Map> repostPaidInFee(FeeQueryParams feeQueryParams); |
| | | |
| | | List<Map> repostPaidInFeeTwo(FeeQueryParams feeQueryParams); |
| | | |
| | | int saveReport(Map map); |
| | | |
| | | List<ReportQueryRecord> queryReport(Map map); |
| | | } |
| | |
| | | |
| | | import com.java110.core.base.dao.BaseServiceDao; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.dto.report.ReportQueryRecord; |
| | | import com.java110.fee.dao.IInitializePayFeeServiceDao; |
| | | import com.java110.fee.dao.IReportFeeServiceDao; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | |
| | | params.put("yearList", yearList); |
| | | return sqlSessionTemplate.selectList("reportFeeServiceDaoImpl.repostInFeeTwo", params); |
| | | } |
| | | |
| | | @Override |
| | | public int saveReport(Map map) { |
| | | return sqlSessionTemplate.insert("reportFeeServiceDaoImpl.saveReport", map); |
| | | } |
| | | |
| | | @Override |
| | | public List<ReportQueryRecord> queryReport(Map map) { |
| | | return BeanConvertUtil.covertBeanList(sqlSessionTemplate.selectList("reportFeeServiceDaoImpl.queryReport", map), ReportQueryRecord.class); |
| | | } |
| | | } |
| | |
| | | BigDecimal cycleDec = new BigDecimal(feeDiscountDto.getCycles()); |
| | | |
| | | double discountPrice = priceDec.multiply(cycleDec).multiply(new BigDecimal(1.0 - rate)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | |
| | | if (discountPrice < 0) { |
| | | return null; |
| | | } |
| | | ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto(); |
| | | computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId()); |
| | | computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_DV); |
| | |
| | | package com.java110.fee.smo.impl; |
| | | |
| | | import com.java110.core.base.smo.BaseServiceSMO; |
| | | import com.java110.dto.fee.TempCarFeeConfigDto; |
| | | import com.java110.fee.dao.IPrestoreFeeServiceDao; |
| | | import com.java110.dto.report.ReportQueryRecord; |
| | | import com.java110.fee.dao.IReportFeeServiceDao; |
| | | import com.java110.intf.fee.IPrestoreFeeInnerServiceSMO; |
| | | import com.java110.intf.fee.IReportFeeInnerServiceSMO; |
| | | import com.java110.vo.FeeQueryParams; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | |
| | | public List<Map> repostPaidInFeeTwo(FeeQueryParams feeQueryParams) { |
| | | return iReportFeeServiceDao.repostPaidInFeeTwo(feeQueryParams); |
| | | } |
| | | |
| | | @Override |
| | | public int saveReport(Map map) { |
| | | return iReportFeeServiceDao.saveReport(map); |
| | | } |
| | | |
| | | @Override |
| | | public List<ReportQueryRecord> queryReport(Map map) { |
| | | |
| | | return iReportFeeServiceDao.queryReport(map); |
| | | } |
| | | } |
| | |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区"); |
| | | Assert.hasKeyAndValue(reqJson, "roomName", "未包含房屋"); |
| | | Assert.hasKeyAndValue(reqJson, "roomId", "未包含房屋"); |
| | | // Assert.hasKeyAndValue(reqJson, "link", "未包含手机号"); |
| | | Assert.hasKeyAndValue(reqJson, "ownerName", "未包含人员名称"); |
| | | Assert.hasKeyAndValue(reqJson, "link", "未包含手机号"); |
| | | // Assert.hasKeyAndValue(reqJson, "ownerName", "未包含人员名称"); |
| | | Assert.hasKeyAndValue(reqJson, "ownerTypeCd", "未包含人员类型"); |
| | | |
| | | //todo 根据手机号查询 是否已经认证过,如果认证过则不能再次认证 |
| | |
| | | userDto.setUserId(userId); |
| | | List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto); |
| | | Assert.listOnlyOne(userDtos, "用户未登录"); |
| | | // if(!StringUtils.isEmpty(userDtos.get(0).getTel())){ |
| | | // if (!userDtos.get(0).getTel().equals(reqJson.getString("link"))) { |
| | | // throw new CmdException("手机号错误,不是注册时的手机号"); |
| | | // } |
| | | // } |
| | | if(!StringUtils.isEmpty(userDtos.get(0).getTel())){ |
| | | if (!userDtos.get(0).getTel().equals(reqJson.getString("link"))) { |
| | | throw new CmdException("手机号错误,不是注册时的手机号"); |
| | | } |
| | | } |
| | | OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto(); |
| | | //由于手机号是非必填,所有有可能查出来大量用户,所以不能使用手机号查询,要用userId查询 |
| | | // ownerAppUserDto.setLink(reqJson.getString("link")); |
| | |
| | | }else{ |
| | | for(OwnerAppUserDto ownerAppUser : ownerAppUserDtos){ |
| | | ownerAppUserPo.setAppUserId(ownerAppUser.getAppUserId()); |
| | | if(StringUtils.isEmpty(reqJson.getString("link"))){ |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDITING); |
| | | }else{ |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS); |
| | | } |
| | | ownerAppUserPo.setLink(reqJson.getString("link")); |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_AUDIT_SUCCESS); |
| | | ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo); |
| | | //更新building_owner表的link字段 |
| | | OwnerPo ownerPo = new OwnerPo(); |
| | |
| | | |
| | | List<OwnerDto> curOwners = ownerInnerServiceSMOImpl.queryOwners(curOwner); |
| | | Assert.listOnlyOne(curOwners, "未查询到业主信息或查询到多条"); |
| | | |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setLink(link); |
| | | ownerDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryAllOwners(ownerDto); |
| | | if (ownerDtos != null && ownerDtos.size() > 1) { |
| | | throw new IllegalArgumentException("手机号重复,请重新输入"); |
| | | } else if (ownerDtos != null && ownerDtos.size() == 1) { |
| | | for (OwnerDto owner : ownerDtos) { |
| | | if (!reqJson.getString("memberId").equals(owner.getMemberId())) { |
| | | throw new IllegalArgumentException("手机号重复,请重新输入"); |
| | | if(StringUtils.isNotEmpty(link)){ |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setLink(link); |
| | | ownerDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryAllOwners(ownerDto); |
| | | if (ownerDtos != null && ownerDtos.size() > 1) { |
| | | throw new IllegalArgumentException("手机号重复,请重新输入"); |
| | | } else if (ownerDtos != null && ownerDtos.size() == 1) { |
| | | for (OwnerDto owner : ownerDtos) { |
| | | if (!reqJson.getString("memberId").equals(owner.getMemberId())) { |
| | | throw new IllegalArgumentException("手机号重复,请重新输入"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | //todo 修改 业主信息 |
| | | OwnerPo ownerPo = BeanConvertUtil.covertBean(reqJson, OwnerPo.class); |
| | | if(StringUtils.isEmpty(reqJson.getString("link"))){ |
| | | ownerPo.setLink(""); |
| | | } |
| | | int flag = ownerV1InnerServiceSMOImpl.updateOwner(ownerPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("修改业主失败"); |
| | |
| | | for (OwnerAppUserDto ownerAppUser : ownerAppUserDtos) { |
| | | OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(ownerAppUser, OwnerAppUserPo.class); |
| | | ownerAppUserPo.setLink(reqJson.getString("link")); |
| | | if(StringUtils.isEmpty(reqJson.getString("link"))){ |
| | | ownerAppUserPo.setLink(""); |
| | | } |
| | | if(!ownerAppUser.getState().equals(OwnerAppUserDto.STATE_NOT_AUDIT) && StringUtils.isNotEmpty(ownerAppUser.getLink()) && |
| | | !ownerAppUser.getLink().equals(reqJson.getString("link"))){ |
| | | ownerAppUserPo.setState(OwnerAppUserDto.STATE_NOT_AUDIT); |
| | | } |
| | | ownerAppUserV1InnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo); |
| | | if (StringUtil.isEmpty(ownerAppUser.getUserId())) { |
| | | continue; |
| | |
| | | UserPo userPo = new UserPo(); |
| | | userPo.setUserId(ownerAppUserDtos.get(0).getUserId()); |
| | | userPo.setTel(reqJson.getString("link")); |
| | | if(StringUtils.isEmpty(reqJson.getString("link"))){ |
| | | userPo.setTel(""); |
| | | } |
| | | userV1InnerServiceSMOImpl.updateUser(userPo); |
| | | } |
| | | } |