java110-bean/src/main/java/com/java110/dto/reportFee/ReportFeeMonthStatisticsDto.java
@@ -156,6 +156,8 @@ private String feeFlag; private String preOweAmount; public String getReceivableAmount() { return receivableAmount; @@ -804,4 +806,12 @@ public void setFeeFlag(String feeFlag) { this.feeFlag = feeFlag; } public String getPreOweAmount() { return preOweAmount; } public void setPreOweAmount(String preOweAmount) { this.preOweAmount = preOweAmount; } } java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
@@ -2761,117 +2761,70 @@ <select id="queryHuaningOweFeeCount" parameterType="Map" resultType="Map"> select count(1) count from ( select a.floorNum,a.oweAmount,b.curOweAmount from (select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount from f_floor t left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0' where t.status_cd = '0' <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="roomNum !=null and roomNum != ''"> and br.room_num= #{roomNum} </if> <if test="objName !=null and objName != ''"> and rfms.obj_name= #{objName} </if> <if test="feeYear !=null and feeYear != ''"> and rfms.fee_year= #{feeYear} </if> <if test="feeMonth !=null and feeMonth != ''"> and rfms.fee_month= #{feeMonth} </if> GROUP BY t.floor_num ) a, (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount from f_floor t left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and curT.status_cd = '0' and curT.community_id = t.community_id where t.status_cd = '0' <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="roomNum !=null and roomNum != ''"> and br.room_num= #{roomNum} </if> <if test="feeYear !=null and feeYear != ''"> and curT.fee_year= #{feeYear} </if> <if test="feeMonth !=null and feeMonth != ''"> and curT.fee_month= #{feeMonth} </if> GROUP BY t.floor_num ) b where a.floorNum = b.floorNum <if test="floorId !=null and floorId != ''"> and a.floor_id = #{floorId} </if> ) t from f_floor f where 1=1 and f.community_id = #{communityId} and f.status_cd = '0' </select> <!-- 查询费用月统计信息 add by wuxw 2018-07-03 --> <select id="queryHuaningOweFee" parameterType="Map" resultType="Map"> select a.floorNum,a.oweAmount,b.curOweAmount from (select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount from f_floor t left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0' where t.status_cd = '0' <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} select f.floor_num floorNum, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and bu.floor_id = f.floor_id and t.community_id = f.community_id <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> <if test="roomNum !=null and roomNum != ''"> and br.room_num= #{roomNum} and t.detail_id = '-1' and t.cur_month_time <= #{endTime} ) oweAmount, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and bu.floor_id = f.floor_id and t.community_id = f.community_id <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> <if test="objName !=null and objName != ''"> and rfms.obj_name= #{objName} and t.detail_id = '-1' and t.cur_month_time <= #{endTime} and t.cur_month_time >= #{startTime} ) curOweAmount, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and bu.floor_id = f.floor_id and t.community_id = f.community_id <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> <if test="feeYear !=null and feeYear != ''"> and rfms.fee_year= #{feeYear} </if> <if test="feeMonth !=null and feeMonth != ''"> and rfms.fee_month= #{feeMonth} </if> GROUP BY t.floor_num ) a, (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount from f_floor t left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and curT.status_cd = '0' and curT.community_id = t.community_id where t.status_cd = '0' <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="roomNum !=null and roomNum != ''"> and br.room_num= #{roomNum} </if> <if test="feeYear !=null and feeYear != ''"> and curT.fee_year= #{feeYear} </if> <if test="feeMonth !=null and feeMonth != ''"> and curT.fee_month= #{feeMonth} </if> GROUP BY t.floor_num ) b where a.floorNum = b.floorNum <if test="floorId !=null and floorId != ''"> and a.floor_id = #{floorId} </if> <if test="page != -1 and page != null "> limit #{page}, #{row} </if> and t.detail_id = '-1' and t.cur_month_time < #{startTime} ) preOweAmount from f_floor f where 1=1 and f.community_id = #{communityId} and f.status_cd = '0' </select> @@ -2888,95 +2841,118 @@ <!-- 查询费用月统计信息 add by wuxw 2018-07-03 --> <select id="queryHuaningPayFee" parameterType="Map" resultType="Map"> select a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4 from (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount from f_floor t inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0' inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0' where 1=1 and t.status_cd = '0' and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth} and t.community_id= #{communityId} GROUP BY floor_num ) a, (select t.floor_num floorNum,sum(pfdm1.received_amount ) receivedAmount1 from f_floor t inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0' inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0' LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month < #{month} where 1=1 and t.status_cd = '0' and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth} and t.community_id= #{communityId} GROUP BY floor_num ) b, (select t.floor_num floorNum,sum(pfdm2.received_amount ) receivedAmount2 from f_floor t inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0' inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0' LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month} where 1=1 and t.status_cd = '0' and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth} and t.community_id= #{communityId} GROUP BY floor_num ) c, (select t.floor_num floorNum,sum(pfdm3.received_amount ) receivedAmount3 from f_floor t inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0' inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0' LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth} where 1=1 and t.status_cd = '0' and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth} and t.community_id= #{communityId} GROUP BY floor_num ) d, (select t.floor_num floorNum,sum(pfdm4.received_amount ) receivedAmount4 from f_floor t inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0' inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0' LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and pfdm4.status_cd = '0' and pfdm4.detail_year < #{year} where 1=1 and t.status_cd = '0' and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth} and t.community_id= #{communityId} GROUP BY floor_num ) e, (select t.floor_num floorNum,SUM(rfms.receivable_amount) receivableAmount from f_floor t inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0' inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0' inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0' where t.community_id = #{communityId} and rfms.fee_year = #{year} and rfms.fee_month = #{month} group by t.floor_num ) f where a.floorNum = b.floorNum and b.floorNum = c.floorNum and c.floorNum = d.floorNum and d.floorNum = e.floorNum and e.floorNum = f.floorNum <if test="page != -1 and page != null "> limit #{page}, #{row} f.floor_num floorNum, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> and bu.floor_id = f.floor_id and t.community_id = f.community_id and t.cur_month_time = #{endTime} ) receivableAmount, ( select ifnull(SUM(t.received_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> and bu.floor_id = f.floor_id and t.community_id = f.community_id and t.pay_fee_time >= #{endTime} and t.pay_fee_time < #{nextMonthTime} and t.detail_id != '-1' ) receivedAmount, ( select ifnull(SUM(t.received_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> and bu.floor_id = f.floor_id and t.community_id = f.community_id and t.pay_fee_time >= #{endTime} and t.pay_fee_time < #{nextMonthTime} and t.cur_month_time < #{endTime} and t.cur_month_time >= #{startTime} and t.detail_id != '-1' ) receivedAmount1, ( select ifnull(SUM(t.received_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> and bu.floor_id = f.floor_id and t.community_id = f.community_id and t.pay_fee_time >= #{endTime} and t.pay_fee_time < #{nextMonthTime} and t.cur_month_time = #{endTime} and t.detail_id != '-1' ) receivedAmount2, ( select ifnull(SUM(t.received_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> and bu.floor_id = f.floor_id and t.community_id = f.community_id and t.pay_fee_time >= #{endTime} and t.pay_fee_time < #{nextMonthTime} and t.cur_month_time >= #{nextMonthTime} and t.detail_id != '-1' ) receivedAmount3, ( select ifnull(SUM(t.received_amount),0) from pay_fee_detail_month t inner join building_room br on t.obj_id = br.room_id and br.status_cd = '0' inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> and bu.floor_id = f.floor_id and t.community_id = f.community_id and t.pay_fee_time >= #{endTime} and t.pay_fee_time < #{nextMonthTime} and t.cur_month_time < #{startTime} and t.detail_id != '-1' ) receivedAmount4 from f_floor f where 1=1 and f.community_id = #{communityId} and f.status_cd = '0' </select> <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map"> select count(1) count @@ -3101,32 +3077,79 @@ </if> </select> <select id="queryHuaningOweFeeDetailCount" parameterType="Map" resultType="Map"> select count(1) count from ( select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount from report_owe_fee t left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' where t.amount_owed > 0 and pfc.fee_type_cd = '888800010001' <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} select count(1) count from building_room br inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0' inner join report_owe_fee rof on br.room_id = rof.payer_obj_id inner join pay_fee pf on rof.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and br.community_id = #{communityId} and br.status_cd = '0' and rof.amount_owed > 0 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> ) tt <if test="floorId != null and floorId != ''"> and f.floor_id = #{floorId} </if> </select> <!-- 查询费用月统计信息 add by wuxw 2018-07-03 --> <select id="queryHuaningOweFeeDetail" parameterType="Map" resultType="Map"> select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount from report_owe_fee t left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0' left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' where t.amount_owed > 0 and pfc.fee_type_cd = '888800010001' <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} select concat(f.floor_num,'-',bu.unit_num,'-',br.room_num) roomName, br.built_up_area builtUpArea, rof.fee_name feeName, rof.end_time endTime, rof.deadline_time deadlineTime, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t where 1=1 and t.fee_id = rof.fee_id and t.community_id = f.community_id and t.detail_id = '-1' and t.cur_month_time <= #{startTime} ) oweAmount, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t where 1=1 and t.fee_id = rof.fee_id and t.community_id = f.community_id and t.detail_id = '-1' and t.cur_month_time <= #{startTime} and t.cur_month_time >= #{endTime} ) curOweAmount, ( select ifnull(SUM(t.receivable_amount),0) from pay_fee_detail_month t where 1=1 and t.fee_id = rof.fee_id and t.community_id = f.community_id and t.detail_id = '-1' and t.cur_month_time <= #{startTime} ) preOweAmount from building_room br inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0' inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0' inner join report_owe_fee rof on br.room_id = rof.payer_obj_id inner join pay_fee pf on rof.fee_id = pf.fee_id and pf.status_cd = '0' where 1=1 and br.community_id = #{communityId} and br.status_cd = '0' and rof.amount_owed > 0 <if test="feeTypeCd != null and feeTypeCd != ''"> and pf.fee_type_cd = #{feeTypeCd} </if> <if test="floorId != null and floorId != ''"> and f.floor_id = #{floorId} </if> <if test="page != -1 and page != null "> limit #{page}, #{row} service-job/src/main/java/com/java110/job/export/adapt/DataFeeManualCollectionAdapt.java
New file @@ -0,0 +1,383 @@ package com.java110.job.export.adapt; import com.alibaba.fastjson.JSONObject; import com.java110.core.smo.IComputeFeeSMO; import com.java110.dto.data.ExportDataDto; import com.java110.dto.fee.FeeDto; import com.java110.dto.fee.FeePrintSpecDto; import com.java110.dto.room.RoomDto; import com.java110.intf.community.IRoomInnerServiceSMO; import com.java110.intf.fee.IFeeInnerServiceSMO; import com.java110.intf.fee.IFeePrintSpecInnerServiceSMO; import com.java110.job.export.IExportDataAdapt; import com.java110.utils.util.*; import com.java110.utils.util.DateUtil; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFClientAnchor; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 催缴单 导出处理类 */ @Service("dataFeeManualCollection") public class DataFeeManualCollectionAdapt implements IExportDataAdapt { @Autowired private IRoomInnerServiceSMO roomInnerServiceSMOImpl; @Autowired private IFeeInnerServiceSMO feeInnerServiceSMOImpl; @Autowired private IComputeFeeSMO computeFeeSMOImpl; @Autowired private IFeePrintSpecInnerServiceSMO feePrintSpecInnerServiceSMOImpl; private static final int MAX_ROW = 100; @Override public SXSSFWorkbook exportData(ExportDataDto exportDataDto) { JSONObject reqJson = exportDataDto.getReqJson(); Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区"); SXSSFWorkbook workbook = null; //工作簿 workbook = new SXSSFWorkbook(); workbook.setCompressTempFiles(false); Sheet sheet = workbook.createSheet("催缴单"); Drawing patriarch = sheet.createDrawingPatriarch(); RoomDto roomDto = new RoomDto(); roomDto.setCommunityId(reqJson.getString("communityId")); roomDto.setRoomId(reqJson.getString("roomId")); roomDto.setFloorId(reqJson.getString("floorId")); int count = roomInnerServiceSMOImpl.queryRoomsCount(roomDto); if (count < 1) { return workbook; } FeePrintSpecDto feePrintSpecDto = new FeePrintSpecDto(); feePrintSpecDto.setCommunityId(reqJson.getString("communityId")); feePrintSpecDto.setSpecCd("1010"); feePrintSpecDto.setPage(1); feePrintSpecDto.setRow(1); List<FeePrintSpecDto> feePrintSpecDtos = feePrintSpecInnerServiceSMOImpl.queryFeePrintSpecs(feePrintSpecDto); if (feePrintSpecDtos == null || feePrintSpecDtos.size() < 1) { feePrintSpecDto = null; } else { feePrintSpecDto = feePrintSpecDtos.get(0); } int maxPage = (int) Math.ceil((double) count / (double) MAX_ROW); List<RoomDto> roomDtos = null; int line = 0; double totalPageHeight = 0; for (int page = 1; page <= maxPage; page++) { roomDto.setPage(page); roomDto.setRow(MAX_ROW); roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); for (RoomDto roomDto1 : roomDtos) { getTmpRoomDtos(roomDto1); } for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) { //todo 有可能房屋下没有欠费 if (roomDtos.get(roomIndex).getFees() == null) { continue; } Map<String, Object> info = generatorRoomOweFee(sheet, workbook, roomDtos.get(roomIndex), line, totalPageHeight, patriarch, feePrintSpecDto); line = Integer.parseInt(info.get("line").toString()) + 1; totalPageHeight = Double.parseDouble(info.get("totalPageHeight").toString()); } } return workbook; } private Map<String, Object> generatorRoomOweFee(Sheet sheet, SXSSFWorkbook workbook, RoomDto roomDto, int line, double totalPageHeight, Drawing patriarch, FeePrintSpecDto feePrintSpecDto) { List<FeeDto> fees = roomDto.getFees(); String[] feePrintRemarks = null; if (feePrintSpecDto != null) { feePrintRemarks = feePrintSpecDto.getContent().toLowerCase().replace("</br>", "").split("\n"); } else { feePrintRemarks = new String[]{""}; } int defaultRowHeight = 280; //计算当前单子的高度 int titleHeight = defaultRowHeight * 3; int subTitleHeight = defaultRowHeight * 5; int totalHeight = titleHeight + subTitleHeight + defaultRowHeight * 3 + fees.size() * defaultRowHeight; //备注,加上打印配置内容 if (feePrintRemarks != null && feePrintRemarks.length > 0) { totalHeight += (feePrintRemarks.length * defaultRowHeight); } double A4_lengthways_pageSize = defaultRowHeight * 57;//15960 //当前页 已经占用的高度 double curPageHeight = totalPageHeight % A4_lengthways_pageSize; //当前页空闲高度 double freePageHeight = A4_lengthways_pageSize - curPageHeight; if (freePageHeight < totalHeight && curPageHeight != 0) { line += Math.ceil(freePageHeight / defaultRowHeight); totalPageHeight += freePageHeight; } totalPageHeight += totalHeight; sheet.setColumnWidth(0, 8 * 256 * 2); sheet.setColumnWidth(1, 8 * 256 * 1); sheet.setColumnWidth(2, 8 * 256 * 1); sheet.setColumnWidth(3, 8 * 256 * 3); sheet.setColumnWidth(4, 8 * 256 * 1); sheet.setColumnWidth(5, 8 * 256 * 1); sheet.setColumnWidth(6, 8 * 256 * 1); //通用样式 CellStyle cellStyle = workbook.createCellStyle(); //设置样式对象,这里仅设置了边框属性 cellStyle.setBorderBottom(BorderStyle.THIN); //下边框 cellStyle.setBorderLeft(BorderStyle.THIN);//左边框 cellStyle.setBorderTop(BorderStyle.THIN);//上边框 cellStyle.setBorderRight(BorderStyle.THIN);//右边框 cellStyle.setAlignment(HorizontalAlignment.CENTER); // 标题 Row row = sheet.createRow(0 + line); Cell cell0 = row.createCell(0); //cell0.setCellValue("缴费通知单totalHeight:" + totalHeight + "-totalPageHeight:" + totalPageHeight + "-curPageHeight:" + curPageHeight + "-freePageHeight:" + freePageHeight + "-line:" + line); if (feePrintSpecDto != null) { cell0.setCellValue(feePrintSpecDto.getPrintName() + "缴费通知单"); } else { cell0.setCellValue("缴费通知单"); } //标题设置字体 Font font = workbook.createFont(); font.setFontName("黑体"); font.setFontHeightInPoints((short) 26); CellStyle titleCellStyle = workbook.createCellStyle(); titleCellStyle.setFont(font); titleCellStyle.setAlignment(HorizontalAlignment.CENTER); cell0.setCellStyle(titleCellStyle); row.setHeight((short) (titleHeight)); //合并标题 CellRangeAddress region = new CellRangeAddress(0 + line, 0 + line, 0, 6); sheet.addMergedRegion(region); //子标题 if (feePrintSpecDto != null) { XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) 0, 1 + line, (short) 1, 1 + line + 1); anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);//设置图片随单元移动调整大小 try { String qrImg = feePrintSpecDto.getQrImg().replace("data:image/webp;base64,", "") .replace("data:image/png;base64,", "") .replace("data:image/jpeg;base64,", ""); patriarch.createPicture(anchor, workbook.addPicture(Base64Convert.base64ToByte(qrImg), XSSFWorkbook.PICTURE_TYPE_JPEG)); } catch (IOException e) { e.printStackTrace(); } } CellStyle subTitleCellStyle = workbook.createCellStyle(); subTitleCellStyle.setAlignment(HorizontalAlignment.CENTER); subTitleCellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM); row = sheet.createRow(1 + line); Cell cell1 = row.createCell(1); if (fees != null && fees.size() > 0) { cell1.setCellValue("业主:" + fees.get(0).getOwnerName()); } else { cell1.setCellValue("业主:无"); } cell1.setCellStyle(subTitleCellStyle); Cell cell2 = row.createCell(2); cell2.setCellValue("房号:" + roomDto.getFloorNum() + "-" + roomDto.getUnitNum() + "-" + roomDto.getRoomNum()); cell2.setCellStyle(subTitleCellStyle); row.createCell(3).setCellValue(""); row.createCell(4).setCellValue(""); Cell cell5 = row.createCell(5); cell5.setCellValue(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)); cell5.setCellStyle(subTitleCellStyle); CellStyle rowCellStyle = workbook.createCellStyle(); rowCellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM); row.setRowStyle(rowCellStyle); //设置表头之上 region = new CellRangeAddress(1 + line, 1 + line, 2, 3); sheet.addMergedRegion(region); region = new CellRangeAddress(1 + line, 1 + line, 5, 6); sheet.addMergedRegion(region); //子标题高度 row.setHeight((short) (subTitleHeight)); row = sheet.createRow(2 + line); cell0 = row.createCell(0); cell0.setCellValue("收费名称"); cell0.setCellStyle(cellStyle); cell1 = row.createCell(1); cell1.setCellValue("收费标准"); cell1.setCellStyle(cellStyle); cell2 = row.createCell(2); cell2.setCellValue("数量/面积"); cell2.setCellStyle(cellStyle); Cell cell3 = row.createCell(3); cell3.setCellValue("欠费时间"); cell3.setCellStyle(cellStyle); Cell cell4 = row.createCell(4); cell4.setCellValue("应缴金额(元)"); cell4.setCellStyle(cellStyle); cell5 = row.createCell(5); cell5.setCellValue("违约金(元)"); cell5.setCellStyle(cellStyle); Cell cell6 = row.createCell(6); cell6.setCellValue("备注"); cell6.setCellStyle(cellStyle); row.setHeight((short) (defaultRowHeight)); BigDecimal totalPrice = new BigDecimal(0); String startTime = ""; String endTime = ""; String squarePrice = ""; for (int feeIndex = 0; feeIndex < fees.size(); feeIndex++) { JSONObject feeObj = BeanConvertUtil.beanCovertJson(fees.get(feeIndex)); row = sheet.createRow(line + feeIndex + 3); startTime = DateUtil.getFormatTimeStringB(feeObj.getDate("endTime")); endTime = DateUtil.getFormatTimeStringB(feeObj.getDate("deadlineTime")); //todo 如果费用是周期性费用 则 结束时间减一天 if (feeObj.containsKey("feeFlag") && (FeeDto.FEE_FLAG_CYCLE.equals(feeObj.getString("feeFlag")) || FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeObj.getString("feeFlag")))) { endTime = DateUtil.getFormatTimeStringB(DateUtil.stepDay(DateUtil.getDateFromStringB(endTime), -1)); } squarePrice = feeObj.getString("squarePrice"); //动态费用单价就去动态单价 if (feeObj.containsKey("computingFormula") && "9009".equals(feeObj.getString("computingFormula"))) { squarePrice = feeObj.getString("mwPrice"); } cell0 = row.createCell(0); cell0.setCellValue(feeObj.getString("feeName")); cell0.setCellStyle(cellStyle); cell1 = row.createCell(1); cell1.setCellValue(squarePrice); cell1.setCellStyle(cellStyle); cell2 = row.createCell(2); cell2.setCellValue(roomDto.getBuiltUpArea()); cell2.setCellStyle(cellStyle); cell3 = row.createCell(3); if (feeObj.containsKey("curDegrees")) { cell3.setCellValue(startTime + "至" + endTime + " " + feeObj.getString("preDegrees") + "至" + feeObj.getString("curDegrees")); } else { cell3.setCellValue(startTime + "至" + endTime); } cell3.setCellStyle(cellStyle); cell4 = row.createCell(4); cell4.setCellValue(feeObj.getString("feeTotalPrice")); cell4.setCellStyle(cellStyle); cell5 = row.createCell(5); cell5.setCellValue("0"); cell5.setCellStyle(cellStyle); cell6 = row.createCell(6); cell6.setCellValue(""); cell6.setCellStyle(cellStyle); row.setHeight((short) (defaultRowHeight)); totalPrice = totalPrice.add(new BigDecimal(feeObj.getString("feeTotalPrice"))); } row = sheet.createRow(line + fees.size() + 3); cell0 = row.createCell(0); cell0.setCellValue("合计(大写)"); cell0.setCellStyle(cellStyle); cell1 = row.createCell(1); cell1.setCellValue(Money2ChineseUtil.toChineseChar(totalPrice.doubleValue())); cell1.setCellStyle(cellStyle); cell2 = row.createCell(2); cell2.setCellValue(""); cell2.setCellStyle(cellStyle); cell3 = row.createCell(3); cell3.setCellValue(""); cell3.setCellStyle(cellStyle); cell4 = row.createCell(4); cell4.setCellValue(totalPrice.doubleValue()); cell4.setCellStyle(cellStyle); cell5 = row.createCell(5); cell5.setCellValue(""); cell5.setCellStyle(cellStyle); cell6 = row.createCell(6); cell6.setCellValue(""); cell6.setCellStyle(cellStyle); row.setHeight((short) (defaultRowHeight)); //合计 合并 region = new CellRangeAddress(line + fees.size() + 3, line + fees.size() + 3, 1, 3); sheet.addMergedRegion(region); if (feePrintRemarks != null && feePrintRemarks.length > 0) { for (int remarkIndex = 0; remarkIndex < feePrintRemarks.length; remarkIndex++) { row = sheet.createRow(line + fees.size() + 4 + remarkIndex); row.createCell(0).setCellValue(feePrintRemarks[remarkIndex]); row.setHeight((short) (defaultRowHeight)); } } row = sheet.createRow(line + fees.size() + 4 + feePrintRemarks.length); row.createCell(0).setCellValue(""); row.setHeight((short) (defaultRowHeight)); Map info = new HashMap(); info.put("line", line + fees.size() + 4 + feePrintRemarks.length); info.put("totalPageHeight", totalPageHeight); return info; } private RoomDto getTmpRoomDtos(RoomDto tmpRoomDto) { FeeDto tmpFeeDto = null; tmpFeeDto = new FeeDto(); tmpFeeDto.setArrearsEndTime(DateUtil.getCurrentDate()); tmpFeeDto.setState(FeeDto.STATE_DOING); tmpFeeDto.setPayerObjId(tmpRoomDto.getRoomId()); tmpFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM); List<FeeDto> feeDtos = feeInnerServiceSMOImpl.querySimpleFees(tmpFeeDto); if (feeDtos == null || feeDtos.size() < 1) { return null; } List<FeeDto> tmpFeeDtos = new ArrayList<>(); for (FeeDto tempFeeDto : feeDtos) { computeFeeSMOImpl.computeEveryOweFee(tempFeeDto, tmpRoomDto);//计算欠费金额 //如果金额为0 就排除 //if (tempFeeDto.getFeePrice() > 0 && tempFeeDto.getEndTime().getTime() <= DateUtil.getCurrentDate().getTime()) { if (tempFeeDto.getFeePrice() > 0) { tmpFeeDtos.add(tempFeeDto); } } if (tmpFeeDtos.size() < 1) { return null; } tmpRoomDto.setFees(tmpFeeDtos); return tmpRoomDto; } } service-report/src/main/java/com/java110/report/api/ReportFeeMonthStatisticsApi.java
@@ -114,7 +114,6 @@ } /** * 查询费用汇总表 * @@ -324,8 +323,8 @@ reportFeeMonthStatisticsDto.setFeeStartTime(feeStartTime); reportFeeMonthStatisticsDto.setFeeEndTime(feeEndTime); reportFeeMonthStatisticsDto.setObjId(objId); if(!StringUtil.isEmpty(roomName)){ String[] roomNameArray = roomName.split("-",3); if (!StringUtil.isEmpty(roomName)) { String[] roomNameArray = roomName.split("-", 3); reportFeeMonthStatisticsDto.setFloorNum(roomNameArray[0]); reportFeeMonthStatisticsDto.setUnitNum(roomNameArray[1]); reportFeeMonthStatisticsDto.setRoomNum(roomNameArray[2]); @@ -565,7 +564,8 @@ reportFeeMonthStatisticsDto.setFloorNum(floorNum); reportFeeMonthStatisticsDto.setPage(page); reportFeeMonthStatisticsDto.setRow(row); reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + ""); reportFeeMonthStatisticsDto.setStartTime(DateUtil.getYear() + "-01-01"); reportFeeMonthStatisticsDto.setEndTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)); return getReportFeeMonthStatisticsBMOImpl.queryHuaningOweFee(reportFeeMonthStatisticsDto); } @@ -597,6 +597,9 @@ paramInfo.put("month", month); paramInfo.put("page", page); paramInfo.put("row", row); paramInfo.put("startTime", DateUtil.getYear() + "-01-01"); paramInfo.put("endTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_Q)+"-01"); paramInfo.put("nextMonthTime",DateUtil.getFormatTimeStringB(DateUtil.getNextMonthFirstDate())); return getReportFeeMonthStatisticsBMOImpl.queryHuaningPayFee(paramInfo); } @@ -639,6 +642,7 @@ public ResponseEntity<String> queryHuaningOweFeeDetail(@RequestParam(value = "communityId") String communityId, @RequestParam(value = "year") int year, @RequestParam(value = "month") int month, @RequestParam(value = "feeTypeCd", required = false) String feeTypeCd, @RequestParam(value = "page") int page, @RequestParam(value = "row") int row) { Map paramInfo = new HashMap(); @@ -647,6 +651,9 @@ paramInfo.put("month", month); paramInfo.put("page", page); paramInfo.put("row", row); paramInfo.put("feeTypeCd", feeTypeCd); paramInfo.put("startTime", DateUtil.getYear() + "-01-01"); paramInfo.put("endTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)); return getReportFeeMonthStatisticsBMOImpl.queryHuaningOweFeeDetail(paramInfo); } service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
@@ -832,43 +832,23 @@ @Override public ResponseEntity<String> queryHuaningOweFee(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) { int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeCount(reportFeeMonthStatisticsDto); List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null; if (count > 0) { reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFee(reportFeeMonthStatisticsDto); } else { reportFeeMonthStatisticsDtos = new ArrayList<>(); } reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFee(reportFeeMonthStatisticsDto); ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos); ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(reportFeeMonthStatisticsDtos); return responseEntity; } @Override public ResponseEntity<String> queryHuaningPayFee(Map paramInfo) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, (int) paramInfo.get("year")); calendar.set(Calendar.MONTH, (int) paramInfo.get("month") - 1); paramInfo.put("yearMonth", DateUtil.getFormatTimeString(calendar.getTime(), "YYYY-MM")); calendar.add(Calendar.MONTH, 1); paramInfo.put("nextYear", calendar.get(Calendar.YEAR)); paramInfo.put("nextMonth", calendar.get(Calendar.MONTH) + 1); int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFeeCount(paramInfo); List<Map> reportFeeMonthStatisticsDtos = null; if (count > 0) { reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFee(paramInfo); } else { reportFeeMonthStatisticsDtos = new ArrayList<>(); } ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (int) paramInfo.get("row")), count, reportFeeMonthStatisticsDtos); reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningPayFee(paramInfo); ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK); ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(reportFeeMonthStatisticsDtos); return responseEntity; } @@ -900,12 +880,12 @@ @Override public ResponseEntity<String> queryHuaningOweFeeDetail(Map paramInfo) { Calendar calendar = Calendar.getInstance(); //Calendar calendar = Calendar.getInstance(); int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetailCount(paramInfo); List<Map> reportFeeMonthStatisticsDtos = null; if (count > 0) { reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryHuaningOweFeeDetail(paramInfo); refreshOweFee(reportFeeMonthStatisticsDtos, paramInfo); // refreshOweFee(reportFeeMonthStatisticsDtos, paramInfo); } else { reportFeeMonthStatisticsDtos = new ArrayList<>(); }