| | |
| | | private String isContractFee; |
| | | private String contractFee; |
| | | |
| | | private int[][] reportAmounts; |
| | | |
| | | public String getFeeId() { |
| | | return feeId; |
| | | } |
| | |
| | | public void setContractFee(String contractFee) { |
| | | this.contractFee = contractFee; |
| | | } |
| | | |
| | | public int[][] getReportAmounts() { |
| | | return reportAmounts; |
| | | } |
| | | |
| | | public void setReportAmounts(int[][] reportAmounts) { |
| | | this.reportAmounts = reportAmounts; |
| | | } |
| | | } |
| | |
| | | package com.java110.vo; |
| | | |
| | | import com.java110.po.fee.PayFeePo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | public class FeeQueryParams { |
| | | private String communityId; |
| | | private Integer startYear; |
| | | private Integer endYear; |
| | | |
| | | private List<PayFeePo> payFeePos; |
| | | private BigDecimal[][] reports; |
| | | // getters and setters |
| | | |
| | | public String getCommunityId() { |
| | |
| | | public void setEndYear(Integer endYear) { |
| | | this.endYear = endYear; |
| | | } |
| | | |
| | | public List<PayFeePo> getPayFeePos() { |
| | | return payFeePos; |
| | | } |
| | | |
| | | public void setPayFeePos(List<PayFeePo> payFeePos) { |
| | | this.payFeePos = payFeePos; |
| | | } |
| | | |
| | | public BigDecimal[][] getReports() { |
| | | return reports; |
| | | } |
| | | |
| | | public void setReports(BigDecimal[][] reports) { |
| | | this.reports = reports; |
| | | } |
| | | } |
| | |
| | | <mapper namespace="reportFeeServiceDaoImpl"> |
| | | <select id="repostInFee" resultType="java.util.Map"> |
| | | SELECT |
| | | pfd.community_id as communityId, |
| | | td.name AS feeTypeName, |
| | | pf.fee_type_cd AS feeTypeCode, |
| | | <foreach collection="yearList" item="year" separator=","> |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < #{year}+1 AND pfd.end_time >= #{year} |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, #{year}-12-31), |
| | | GREATEST(pfd.start_time, #{year}-01-01) |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS 'amount${year}' |
| | | </foreach> |
| | | SUM(pfd.received_amount) AS totalAmount |
| | | pfd.community_id, |
| | | td.name AS '费用类型名称', |
| | | YEAR(pfd.create_time), |
| | | pf.fee_type_cd AS '费用类型编码', |
| | | -- 计算各年份的收费金额(按天数比例分配) |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < '2021-01-01' AND pfd.end_time >= '2020-01-01' |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, '2020-12-31'), |
| | | GREATEST(pfd.start_time, '2020-01-01') |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS '2020年收费金额(元)', |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < '2022-01-01' AND pfd.end_time >= '2021-01-01' |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, '2021-12-31'), |
| | | GREATEST(pfd.start_time, '2021-01-01') |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS '2021年收费金额(元)', |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < '2023-01-01' AND pfd.end_time >= '2022-01-01' |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, '2022-12-31'), |
| | | GREATEST(pfd.start_time, '2022-01-01') |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS '2022年收费金额(元)', |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < '2024-01-01' AND pfd.end_time >= '2023-01-01' |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, '2023-12-31'), |
| | | GREATEST(pfd.start_time, '2023-01-01') |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS '2023年收费金额(元)', |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < '2025-01-01' AND pfd.end_time >= '2024-01-01' |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, '2024-12-31'), |
| | | GREATEST(pfd.start_time, '2024-01-01') |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS '2024年收费金额(元)', |
| | | SUM( |
| | | CASE |
| | | WHEN pfd.start_time < '2026-01-01' AND pfd.end_time >= '2025-01-01' |
| | | THEN pfd.received_amount * |
| | | DATEDIFF( |
| | | LEAST(pfd.end_time, '2025-12-31'), |
| | | GREATEST(pfd.start_time, '2025-01-01') |
| | | ) / DATEDIFF(pfd.end_time, pfd.start_time) |
| | | ELSE 0 |
| | | END |
| | | ) AS '2025年收费金额(元)', |
| | | SUM(pfd.received_amount) AS '总收费金额(元)' |
| | | FROM |
| | | pay_fee_detail pfd |
| | | LEFT JOIN pay_fee pf ON pf.fee_id = pfd.fee_id |
| | |
| | | AND td.status_cd = pf.fee_type_cd |
| | | WHERE |
| | | pfd.status_cd = '0' AND |
| | | pfd.community_id = #{params.communityId} |
| | | AND ( |
| | | <foreach collection="yearList" item="year" separator="OR"> |
| | | (pfd.start_time < #{year}+1 AND pfd.end_time >= #{year}) |
| | | </foreach> |
| | | ) |
| | | pfd.community_id = '2025081537770016' |
| | | GROUP BY |
| | | td.name, pf.fee_type_cd, pfd.community_id |
| | | td.name, pf.fee_type_cd, pfd.community_id,YEAR(pfd.create_time) |
| | | ORDER BY |
| | | td.name |
| | | td.name; |
| | | </select> |
| | | </mapper> |
| | |
| | | <!-- 保存业主信息信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveOwnerInfo" parameterType="Map"> |
| | | insert into building_owner(id_card, sex, link, owner_type_cd, remark, owner_id, user_id, name, state, |
| | | community_id, age, member_id, address,person_type,person_role,concact_person,concact_link,face_url) |
| | | community_id, age, member_id, address,person_type,person_role,concact_person,concact_link,face_url,other_address) |
| | | values (#{idCard}, #{sex}, #{link}, #{ownerTypeCd}, #{remark}, #{ownerId}, #{userId}, #{name}, #{state}, |
| | | #{communityId}, #{age}, #{memberId}, #{address},#{personType},#{personRole},#{concactPerson},#{concactLink},#{faceUrl}) |
| | | #{communityId}, #{age}, #{memberId}, #{address},#{personType},#{personRole},#{concactPerson},#{concactLink},#{faceUrl},#{otherAddress}) |
| | | </insert> |
| | | |
| | | <!-- 查询业主信息信息 add by wuxw 2018-07-03 --> |
| | |
| | | select t.id_card,t.id_card idCard,t.sex,t.link,t.owner_type_cd,t.owner_type_cd |
| | | ownerTypeCd,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,t.owner_id ownerId,t.user_id,t.user_id |
| | | userId,t.name,t.state,t.community_id,t.community_id communityId,t.age,t.member_id,t.member_id memberId, |
| | | t.address ,t.person_type personType,t.person_role personRole,t.concact_person concactPerson,td.name ownerTypeName, |
| | | t.address,t.other_address otherAddress ,t.person_type personType,t.person_role personRole,t.concact_person concactPerson,td.name ownerTypeName, |
| | | t.concact_link concactLink,t.face_url faceUrl,tdType.name personTypeName,tdRole.name personRoleName |
| | | from building_owner t |
| | | left join t_dict td on td.table_name = 'building_owner' and td.`table_columns` = 'owner_type_cd' and td.status_cd = t.owner_type_cd |
| | |
| | | <if test="address !=null and address != ''"> |
| | | ,t.address= #{address} |
| | | </if> |
| | | <if test="otherAddress !=null and otherAddress != ''"> |
| | | ,t.other_address= #{otherAddress} |
| | | </if> |
| | | <if test="ownerTypeCd !=null and ownerTypeCd != ''"> |
| | | ,t.owner_type_cd= #{ownerTypeCd} |
| | | </if> |
| New file |
| | |
| | | package com.java110.fee.cmd.fee; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | import com.java110.intf.fee.IReportFeeInnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.vo.FeeQueryParams; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Java110Cmd(serviceCode = "fee.queryReportFeeCmd") |
| | | public class QueryReportFeeCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IReportFeeInnerServiceSMO reportFeeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { |
| | | Assert.hasKey(reqJson, "communityId", "请求报文中未包含小区编号"); |
| | | } |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { |
| | | 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(communityDtos.get(0).getCreateTime().getYear()+1900); |
| | | if(reqJson.containsKey("startYear")){ |
| | | feeQueryParams.setStartYear(Integer.parseInt(reqJson.getString("startYear"))); |
| | | } |
| | | int currentYear = java.time.Year.now().getValue(); |
| | | feeQueryParams.setEndYear(currentYear + 2); |
| | | List<Map> result = reportFeeInnerServiceSMOImpl.repostPaidInFee(feeQueryParams); |
| | | context.setResponseEntity(new ResponseEntity<>(result, HttpStatus.OK)); |
| | | } |
| | | } |
| | |
| | | import com.java110.dto.community.CommunityDto; |
| | | import com.java110.intf.community.ICommunityInnerServiceSMO; |
| | | 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.vo.FeeQueryParams; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { |
| | | 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(communityDtos.get(0).getCreateTime().getYear()); |
| | | feeQueryParams.setStartYear(startYear); |
| | | int currentYear = java.time.Year.now().getValue(); |
| | | feeQueryParams.setEndYear(currentYear + 2); |
| | | List<Map> result = reportFeeInnerServiceSMOImpl.repostPaidInFee(feeQueryParams); |
| | | context.setResponseEntity(new ResponseEntity<>(result, HttpStatus.OK)); |
| | | |
| | | int endYear = feeQueryParams.getEndYear(); |
| | | double[][] reports = new double[22 * (endYear - startYear)][endYear - startYear + 1]; |
| | | for(int j = 0 ; j < result.size() ; j++){ |
| | | for (int i = startYear; i <= endYear; i++) { |
| | | reports[j][i-startYear] = (double) result.get(j).get(i+"年收费金额(元)"); |
| | | } |
| | | } |
| | | ResultVo resultVo = new ResultVo(reports); |
| | | |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | | @Service("iReportFeeServiceDaoImpl") |
| | | public class IReportFeeServiceDaoImpl extends BaseServiceDao implements IReportFeeServiceDao { |
| | |
| | | for (int year = feeQueryParams.getStartYear(); year <= feeQueryParams.getEndYear(); year++) { |
| | | yearList.add(year); |
| | | } |
| | | List<String> monthList = IntStream.rangeClosed(1, 12) |
| | | .mapToObj(month -> String.format("%02d", month)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("communityId", feeQueryParams.getCommunityId()); |
| | | params.put("startYear", feeQueryParams.getStartYear()); |
| | | params.put("monthList", monthList); |
| | | params.put("endYear", feeQueryParams.getEndYear()); |
| | | params.put("yearList", yearList); |
| | | return sqlSessionTemplate.selectList("reportFeeServiceDaoImpl.repostInFee", params); |
| | |
| | | Environment.setSystemStartWay(Environment.SPRING_BOOT); |
| | | |
| | | //刷新缓存 |
| | | flushMainCache(args); |
| | | // flushMainCache(args); |
| | | |
| | | //服务启动完成 |
| | | ServiceStartInit.printStartSuccessInfo(); |