java110-bean/src/main/java/com/java110/dto/community/CommunityDto.java
@@ -49,6 +49,10 @@ private String qrCode; private String storeId; private String storeName; private List<CommunityAttrDto> communityAttrDtos; @@ -298,4 +302,20 @@ public void setQrCode(String qrCode) { this.qrCode = qrCode; } public String getStoreId() { return storeId; } public void setStoreId(String storeId) { this.storeId = storeId; } public String getStoreName() { return storeName; } public void setStoreName(String storeName) { this.storeName = storeName; } } java110-db/src/main/resources/mapper/community/CommunityV1ServiceDaoImplMapper.xml
@@ -169,5 +169,58 @@ </select> <select id="queryCommunityAndPropertys" parameterType="Map" resultType="Map"> select t.fee_price,t.fee_price feePrice,t.address,t.city_code,t.city_code cityCode,t.status_cd,t.status_cd statusCd,t.map_y,t.map_y mapY,t.pay_fee_month,t.pay_fee_month payFeeMonth,t.map_x,t.map_x mapX,t.nearby_landmarks,t.nearby_landmarks nearbyLandmarks,t.name,t.tel,t.state,t.community_id,t.community_id communityId,t.community_area,t.community_area communityArea,t.qr_code qrCode,t.member_id storeId from s_community t left join s_community_member cm on t.community_id = cm.community_id and cm.member_type_cd = '390001200002' where 1 =1 <if test="feePrice !=null and feePrice != ''"> and t.fee_price= #{feePrice} </if> <if test="address !=null and address != ''"> and t.address= #{address} </if> <if test="cityCode !=null and cityCode != ''"> and t.city_code= #{cityCode} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="mapY !=null and mapY != ''"> and t.map_y= #{mapY} </if> <if test="payFeeMonth !=null and payFeeMonth != ''"> and t.pay_fee_month= #{payFeeMonth} </if> <if test="mapX !=null and mapX != ''"> and t.map_x= #{mapX} </if> <if test="nearbyLandmarks !=null and nearbyLandmarks != ''"> and t.nearby_landmarks= #{nearbyLandmarks} </if> <if test="name !=null and name != ''"> and t.name= #{name} </if> <if test="tel !=null and tel != ''"> and t.tel= #{tel} </if> <if test="state !=null and state != ''"> and t.state= #{state} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="communityArea !=null and communityArea != ''"> and t.community_area= #{communityArea} </if> order by t.create_time desc <if test="page != -1 and page != null "> limit #{page}, #{row} </if> </select> </mapper> java110-db/src/main/resources/mapper/report/BaseDataStatisticsServiceDaoImplMapper.xml
@@ -468,6 +468,81 @@ and t.store_id = #{storeId} group by DATE_FORMAT(t.create_time,'%Y-%m-%d') </select> <select id="getPropertyFeeSummaryDataCount" parameterType="Map" resultType="Map"> select count(1) count from building_room br left join building_unit bu on br.unit_id = br.unit_id and bu.status_cd = '0' left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0' left join building_owner_room_rel borr on br.room_id = borr.room_id and borr.status_cd = '0' left join building_owner bo on borr.owner_id = bo.owner_id and bo.status_cd = '0' and bo.owner_type_cd = '1001' where br.status_cd = '0' </select> <select id="getPropertyFeeSummaryData" parameterType="Map" resultType="Map"> select br.community_id communityId,bo.name ownerName,bo.sex,bo.link,concat(f.floor_num,'-',bu.unit_num,'-',br.room_num) roomName,br.room_id, borr.start_time bingTime,br.state,br.built_up_area builtUpArea,pfc.square_price squarePrice,pfc.config_id configId,pfc.fee_name feeName ( select max(pay_fee_time) from pay_fee_detail_month pfdm where pfdm.config_id = pfc.config_id and pfdm.obj_id = br.room_id and pfdm.status_cd = '0' and pfdm.detail_id != '-1' and pfdm.cur_month_time >=#{startTime} and pfdm.cur_month_time < #{endTIme} ) payFeeTime, ( select sum(pfdm.receivable_amount) from pay_fee_detail_month pfdm where pfdm.config_id = pfc.config_id and pfdm.obj_id = br.room_id and pfdm.status_cd = '0' and pfdm.cur_month_time >=#{startTime} and pfdm.cur_month_time < #{endTIme} ) receivableAmount, ( select sum(pfdm.received_amount) from pay_fee_detail_month pfdm where pfdm.config_id = pfc.config_id and pfdm.obj_id = br.room_id and pfdm.status_cd = '0' and pfdm.cur_month_time >=#{startTime} and pfdm.cur_month_time < #{endTIme} ) receivedAmount, ( select sum(pfdm.receivable_amount) from pay_fee_detail_month pfdm where pfdm.config_id = pfc.config_id and pfdm.obj_id = br.room_id and pfdm.status_cd = '0' and pfdm.detail_id = '-1' and pfdm.cur_month_time >=#{startTime} and pfdm.cur_month_time < #{endTIme} ) oweAmount from building_room br left join building_unit bu on br.unit_id = br.unit_id and bu.status_cd = '0' left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0' left join building_owner_room_rel borr on br.room_id = borr.room_id and borr.status_cd = '0' left join building_owner bo on borr.owner_id = bo.owner_id and bo.status_cd = '0' and bo.owner_type_cd = '1001' left join pay_fee pf on br.room_id = pf.payer_obj_id and pf.payer_obj_type = '3333' and pf.status_cd = '0' and pf.fee_type_cd = '888800010001' left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0' and pfc.fee_type_cd = '888800010001' where br.status_cd = '0' group by br.community_id, bo.name,bo.sex,bo.link,f.floor_num,bu.unit_num,br.room_num,br.room_id,borr.start_time,br.state,br.built_up_area,pfc.square_price,pfc.config_id,pfc.fee_name order by br.community_id,f.floor_num,bu.unit_num,br.room_num <if test="page != -1 and page != null"> limit #{page},#{row} </if> </select> <select id="computeEveryMonthFee" parameterType="Map" resultType="Map"> select a.obj_id roomId,a.cur_month_time curMonthTime,a.config_id configId,sum(receivableAmount) receivableAmount, sum(receivedAmount) receivedAmount,sum(oweAmount) oweAmount from ( select t.obj_id,t.cur_month_time,pfc.config_id, ( select sum(pfdm.receivable_amount) from pay_fee_detail_month pfdm where pfdm.month_id = t.month_id and pfdm.status_cd = '0' ) receivableAmount, ( select sum(pfdm.received_amount) from pay_fee_detail_month pfdm where pfdm.month_id = t.month_id and pfdm.status_cd = '0' ) receivedAmount, ( select sum(pfdm.receivable_amount) from pay_fee_detail_month pfdm where pfdm.month_id = t.month_id and pfdm.status_cd = '0' ) oweAmount from pay_fee_detail_month t left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' and pfc.fee_type_cd = '888800010001' where 1=1 and t.obj_id in <foreach collection="roomIds" item="item" open="(" close=")" separator=","> #{item} </foreach> and t.cur_month_time >=#{startTime} and t.cur_month_time < #{endTIme} ) a group by a.obj_id,a.cur_month_time </select> </mapper> java110-interface/src/main/java/com/java110/intf/community/ICommunityV1InnerServiceSMO.java
@@ -65,4 +65,7 @@ */ @RequestMapping(value = "/queryCommunitysCount", method = RequestMethod.POST) int queryCommunitysCount(@RequestBody CommunityDto communityDto); @RequestMapping(value = "/queryCommunityAndPropertys", method = RequestMethod.POST) List<CommunityDto> queryCommunityAndPropertys(@RequestBody CommunityDto communityDto); } java110-interface/src/main/java/com/java110/intf/report/IBaseDataStatisticsInnerServiceSMO.java
@@ -96,4 +96,14 @@ @RequestMapping(value = "/getCommunityContractAnalysis", method = RequestMethod.POST) List<Map> getCommunityContractAnalysis(@RequestBody Map info); @RequestMapping(value = "/getPropertyFeeSummaryData", method = RequestMethod.POST) List<Map> getPropertyFeeSummaryData(@RequestBody Map info); @RequestMapping(value = "/getPropertyFeeSummaryDataCount", method = RequestMethod.POST) int getPropertyFeeSummaryDataCount(@RequestBody Map info); @RequestMapping(value = "/computeEveryMonthFee", method = RequestMethod.POST) List<Map> computeEveryMonthFee(@RequestBody Map info); } service-community/src/main/java/com/java110/community/dao/ICommunityV1ServiceDao.java
@@ -70,4 +70,5 @@ */ int queryCommunitysCount(Map info); List<Map> queryCommunityAndPropertys(Map info); } service-community/src/main/java/com/java110/community/dao/impl/CommunityV1ServiceDaoImpl.java
@@ -108,5 +108,14 @@ return Integer.parseInt(businessCommunityInfos.get(0).get("count").toString()); } @Override public List<Map> queryCommunityAndPropertys(Map info) { logger.debug("查询 getCommunityInfo 入参 info : {}",info); List<Map> infos = sqlSessionTemplate.selectList("communityV1ServiceDaoImpl.queryCommunityAndPropertys",info); return infos; } } service-community/src/main/java/com/java110/community/smo/impl/CommunityV1InnerServiceSMOImpl.java
@@ -86,4 +86,11 @@ public int queryCommunitysCount(@RequestBody CommunityDto communityDto) { return communityV1ServiceDaoImpl.queryCommunitysCount(BeanConvertUtil.beanCovertMap(communityDto)); } @Override public List<CommunityDto> queryCommunityAndPropertys(@RequestBody CommunityDto communityDto) { List<CommunityDto> communitys = BeanConvertUtil.covertBeanList(communityV1ServiceDaoImpl.queryCommunityAndPropertys(BeanConvertUtil.beanCovertMap(communityDto)), CommunityDto.class); return communitys; } } service-report/src/main/java/com/java110/report/cmd/admin/GetPropertyFeeSummaryCmd.java
New file @@ -0,0 +1,154 @@ package com.java110.report.cmd.admin; import com.alibaba.fastjson.JSONObject; import com.java110.core.annotation.Java110Cmd; import com.java110.core.context.CmdContextUtils; 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.dto.store.StoreDto; import com.java110.intf.community.ICommunityV1InnerServiceSMO; import com.java110.intf.report.IBaseDataStatisticsInnerServiceSMO; import com.java110.intf.store.IStoreInnerServiceSMO; import com.java110.intf.store.IStoreV1InnerServiceSMO; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; import com.java110.utils.util.DateUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import java.text.ParseException; import java.util.*; /** * 查询物业费台账 */ @Java110Cmd(serviceCode = "admin.getPropertyFeeSummary") public class GetPropertyFeeSummaryCmd extends Cmd { @Autowired private IStoreInnerServiceSMO storeInnerServiceSMOImpl; @Autowired private IBaseDataStatisticsInnerServiceSMO baseDataStatisticsInnerServiceSMOImpl; @Autowired private ICommunityV1InnerServiceSMO communityV1InnerServiceSMOImpl; @Autowired private IStoreV1InnerServiceSMO storeV1InnerServiceSMOImpl; @Override public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { super.validatePageInfo(reqJson); String storeId = CmdContextUtils.getStoreId(context); StoreDto storeDto = new StoreDto(); storeDto.setStoreId(storeId); storeDto.setStoreTypeCd(StoreDto.STORE_TYPE_ADMIN); int count = storeInnerServiceSMOImpl.getStoreCount(storeDto); if (count < 1) { throw new CmdException("非法操作,请用系统管理员账户操作"); } } @Override public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { int row = reqJson.getIntValue("row"); Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); //todo 查询房屋物业费信息 reqJson.put("startTime", year + "-01-01"); reqJson.put("endTime", (year + 1) + "-01-01"); // todo 查询总数量 int total = baseDataStatisticsInnerServiceSMOImpl.getPropertyFeeSummaryDataCount(reqJson); List<Map> infos = null; if (total > 0) { infos = baseDataStatisticsInnerServiceSMOImpl.getPropertyFeeSummaryData(reqJson); } else { infos = new ArrayList<>(); } //todo 计算每月情况 computeEveryMonthFee(infos, reqJson); //todo 计算小区和物业公司信息 computeCommunityAndProperty(infos); ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, infos); context.setResponseEntity(responseEntity); } private void computeCommunityAndProperty(List<Map> infos) { CommunityDto communityDto = new CommunityDto(); List<CommunityDto> communityDtos = communityV1InnerServiceSMOImpl.queryCommunityAndPropertys(communityDto); if (communityDtos == null || communityDtos.isEmpty()) { return; } //todo 查询 物业名称 StoreDto storeDto = new StoreDto(); storeDto.setStoreTypeCd(StoreDto.STORE_TYPE_PROPERTY); List<StoreDto> storeDtos = storeV1InnerServiceSMOImpl.queryStores(storeDto); for(CommunityDto tmpCommunityDto : communityDtos){ for(StoreDto tmpStoreDto: storeDtos){ if(tmpStoreDto.getStoreId().equals(tmpCommunityDto.getStoreId())){ tmpCommunityDto.setStoreName(tmpStoreDto.getStoreName()); } } } for(Map info: infos){ for(CommunityDto tmpCommunityDto : communityDtos){ if(info.get("communityId").equals(tmpCommunityDto.getCommunityId())){ info.put("communityName",tmpCommunityDto.getName()); info.put("storeId",tmpCommunityDto.getStoreId()); info.put("storeName",tmpCommunityDto.getStoreName()); } } } } private void computeEveryMonthFee(List<Map> infos, JSONObject reqJson) { if (infos == null || infos.isEmpty()) { return; } List<String> roomIds = new ArrayList<>(); for (Map info : infos) { roomIds.add(info.get("roomId").toString()); } Map info = new HashMap(); info.put("roomIds", roomIds); info.put("startTime", reqJson.getString("startTime")); info.put("endTime", reqJson.getString("endTime")); List<Map> monthDatas = baseDataStatisticsInnerServiceSMOImpl.computeEveryMonthFee(reqJson); List<Map> months = null; for (Map roomInfo : infos) { months = new ArrayList<>(); for (Map monthInfo : infos) { if (roomInfo.get("roomId").equals(monthInfo.get("roomId")) && roomInfo.get("configId").equals(monthInfo.get("configId"))) { months.add(monthInfo); } } roomInfo.put("monthData", monthDatas); } } } service-report/src/main/java/com/java110/report/dao/IBaseDataStatisticsServiceDao.java
@@ -71,4 +71,10 @@ List<Map> getCommunityPersonInAnalysis(Map info); List<Map> getCommunityContractAnalysis(Map info); List<Map> getPropertyFeeSummaryData(Map info); int getPropertyFeeSummaryDataCount(Map info); List<Map> computeEveryMonthFee(Map info); } service-report/src/main/java/com/java110/report/dao/impl/BaseDataStatisticsServiceDaoImpl.java
@@ -40,12 +40,12 @@ */ @Override public int getReceivedRoomCount(Map info) { List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("baseDataStatisticsServiceDaoImpl.getReceivedRoomCount", info); if (businessReportFeeMonthStatisticsInfos.size() < 1) { List<Map> infos = sqlSessionTemplate.selectList("baseDataStatisticsServiceDaoImpl.getReceivedRoomCount", info); if (infos.size() < 1) { return 0; } return Integer.parseInt(businessReportFeeMonthStatisticsInfos.get(0).get("count").toString()); return Integer.parseInt(infos.get(0).get("count").toString()); } /** @@ -140,4 +140,26 @@ List<Map> infos = sqlSessionTemplate.selectList("baseDataStatisticsServiceDaoImpl.getCommunityContractAnalysis", info); return infos; } @Override public List<Map> getPropertyFeeSummaryData(Map info) { List<Map> infos = sqlSessionTemplate.selectList("baseDataStatisticsServiceDaoImpl.getPropertyFeeSummaryData", info); return infos; } @Override public int getPropertyFeeSummaryDataCount(Map info) { List<Map> infos = sqlSessionTemplate.selectList("baseDataStatisticsServiceDaoImpl.getPropertyFeeSummaryDataCount", info); if (infos.size() < 1) { return 0; } return Integer.parseInt(infos.get(0).get("count").toString()); } @Override public List<Map> computeEveryMonthFee(Map info) { List<Map> infos = sqlSessionTemplate.selectList("baseDataStatisticsServiceDaoImpl.computeEveryMonthFee", info); return infos; } } service-report/src/main/java/com/java110/report/smo/impl/BaseDataStatisticsInnerServiceSMOImpl.java
@@ -162,4 +162,28 @@ List<Map> infos = baseDataStatisticsServiceDaoImpl.getCommunityContractAnalysis(info); return infos; } @Override public List<Map> getPropertyFeeSummaryData(@RequestBody Map info) { int page = Integer.parseInt(info.get("page").toString()); int row = Integer.parseInt(info.get("row").toString()); if (page != PageDto.DEFAULT_PAGE) { info.put("page",(page - 1) * row); } List<Map> infos = baseDataStatisticsServiceDaoImpl.getPropertyFeeSummaryData(info); return infos; } @Override public int getPropertyFeeSummaryDataCount(@RequestBody Map info) { int count = baseDataStatisticsServiceDaoImpl.getPropertyFeeSummaryDataCount(info); return count; } @Override public List<Map> computeEveryMonthFee(@RequestBody Map info) { List<Map> infos = baseDataStatisticsServiceDaoImpl.computeEveryMonthFee(info); return infos; } } service-store/src/main/java/com/java110/store/cmd/purchase/PurchaseApplyCmd.java
@@ -305,6 +305,7 @@ resourceStoreTimesPo.setStoreId(resourceStoreDtos.get(0).getStoreId()); resourceStoreTimesPo.setTimesId(GenerateCodeFactory.getGeneratorId("10")); resourceStoreTimesPo.setShId(tmpPurchaseApplyDetailDto.getShId()); resourceStoreTimesPo.setCommunityId(resourceStoreDtos.get(0).getCommunityId()); resourceStoreTimesV1InnerServiceSMOImpl.saveOrUpdateResourceStoreTimes(resourceStoreTimesPo); } //获取订单号