| | |
| | | public static double computePriceScale(double price,String scale,int decimalPlace){ |
| | | |
| | | //todo 解决 群里反馈 进度丢失问题 |
| | | //todo 发现了个BUG MoneyUtil.computePriceScale 计算金额四舍五入时,精度丢失问题, new BigDecimal(String ) 就OK了, double 会出问题。 例如444.195 四舍五入变成了 44.19 |
| | | //todo 发现了个BUG |
| | | // MoneyUtil.computePriceScale |
| | | // 计算金额四舍五入时,精度丢失问题, |
| | | // new BigDecimal(String ) |
| | | // 就OK了, double 会出问题。 |
| | | // 例如444.195 四舍五入变成了 44.19 |
| | | BigDecimal feeTotalPrice = new BigDecimal(price+""); |
| | | |
| | | if(DOWN.equals(scale)) { |
| | |
| | | return feeTotalPrice.doubleValue(); |
| | | } |
| | | |
| | | /** |
| | | * 四舍五入 |
| | | * @param price |
| | | * @return |
| | | */ |
| | | public static double computePriceScale(double price){ |
| | | return computePriceScale(price,HALF_UP,2); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | Assert.listOnlyOne(userDtos, "用户未登录"); |
| | | |
| | | reqJson.put("propertyUserId", userDtos.get(0).getUserId()); |
| | | reqJson.put("propertyUserTel", userDtos.get(0).getTel()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | Assert.listOnlyOne(userDtos, "用户未登录"); |
| | | |
| | | reqJson.put("propertyUserTel", userDtos.get(0).getTel()); |
| | | reqJson.put("propertyUserId", userDtos.get(0).getUserId()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.java110.report.statistics.IOrderStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | |
| | | double receivedFee = feeStatisticsImpl.getReceivedFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","实收金额"); |
| | | data.put("value", receivedFee); |
| | | data.put("value", MoneyUtil.computePriceScale(receivedFee)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 欠费金额 |
| | | double oweFee = feeStatisticsImpl.getOweFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","欠费金额"); |
| | | data.put("value", oweFee); |
| | | data.put("value", MoneyUtil.computePriceScale(oweFee)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 优惠金额 |
| | | double discountFee = feeStatisticsImpl.getDiscountFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","优惠金额"); |
| | | data.put("value", discountFee); |
| | | data.put("value", MoneyUtil.computePriceScale(discountFee)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 滞纳金 |
| | | double lateFee = feeStatisticsImpl.getLateFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","滞纳金"); |
| | | data.put("value", lateFee); |
| | | data.put("value", MoneyUtil.computePriceScale(lateFee)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 账户预存 |
| | | double prestoreAccount = feeStatisticsImpl.getPrestoreAccount(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","账户预存"); |
| | | data.put("value", prestoreAccount); |
| | | data.put("value", MoneyUtil.computePriceScale(prestoreAccount)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 账户扣款 |
| | | double withholdAccount = feeStatisticsImpl.getWithholdAccount(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","账户扣款"); |
| | | data.put("value", withholdAccount); |
| | | data.put("value", MoneyUtil.computePriceScale(withholdAccount)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 临时车收入 |
| | | double tempCarFee = feeStatisticsImpl.getTempCarFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","临时车收入"); |
| | | data.put("value", tempCarFee); |
| | | data.put("value", MoneyUtil.computePriceScale(tempCarFee)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 押金退款 |
| | | double refundDeposit = feeStatisticsImpl.geRefundDeposit(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","押金退款"); |
| | | data.put("value", refundDeposit); |
| | | data.put("value", MoneyUtil.computePriceScale(refundDeposit)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 退款订单数 |
| | | double refundOrderCount = feeStatisticsImpl.geRefundOrderCount(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","退款订单数"); |
| | | data.put("value", refundOrderCount); |
| | | data.put("value", MoneyUtil.computePriceScale(refundOrderCount)); |
| | | datas.add(data); |
| | | // todo 查询 退款金额 |
| | | double refundFee = feeStatisticsImpl.geRefundFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","退款金额"); |
| | | data.put("value", refundFee); |
| | | data.put("value", MoneyUtil.computePriceScale(refundFee)); |
| | | datas.add(data); |
| | | |
| | | |
| | |
| | | double chargeFee = feeStatisticsImpl.getChargeFee(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","充电金额"); |
| | | data.put("value", chargeFee); |
| | | data.put("value", MoneyUtil.computePriceScale(chargeFee)); |
| | | datas.add(data); |
| | | |
| | | // todo 查询 月卡金额 |
| | | double chargeMonthOrderMoney = orderStatisticsImpl.getChargeMonthOrderCount(queryStatisticsDto); |
| | | data = new JSONObject(); |
| | | data.put("name","月卡实收"); |
| | | data.put("value", chargeMonthOrderMoney); |
| | | data.put("value", MoneyUtil.computePriceScale(chargeMonthOrderMoney)); |
| | | datas.add(data); |
| | | |
| | | |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | continue; |
| | | } |
| | | for (DictDto tDict : dictDtos) { |
| | | //feeTypeCd = info.get("feeTypeCd").toString(); |
| | | feeTypeCd = tDict.getStatusCd(); |
| | | if (!info.containsKey(feeTypeCd)) { |
| | | continue; |
| | |
| | | data.put("receivedFee" + feeTypeCd, info.get(feeTypeCd)); |
| | | } |
| | | } |
| | | data.put("receivedFee", receivedFee.doubleValue()); |
| | | data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); |
| | | } |
| | | |
| | | return datas; |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | private List<Map> computeFloorReceivedFee(List<Map> datas) { |
| | | if (datas == null || datas.size() < 1) { |
| | | if (ListUtil.isNull(datas)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (tmpDatas == null || tmpDatas.size() < 1) { |
| | | if (ListUtil.isNull(tmpDatas)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | BigDecimal receivedFee = null; |
| | | double receivedFeeD = 0; |
| | | for (Map tmpData : tmpDatas) { |
| | | receivedFee = new BigDecimal(0.00); |
| | | for (Map data : datas) { |
| | | if (!data.get("floorId").toString().equals(tmpData.get("floorId"))) { |
| | | continue; |
| | | } |
| | | |
| | | receivedFee = receivedFee.add(new BigDecimal(data.get("receivedFee").toString())); |
| | | tmpData.put("receivedFee" + data.get("feeTypeCd").toString(), data.get("receivedFee")); |
| | | receivedFeeD = Double.parseDouble(data.get("receivedFee").toString()); |
| | | receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); |
| | | tmpData.put("receivedFee" + data.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); |
| | | } |
| | | tmpData.put("receivedFee", receivedFee.doubleValue()); |
| | | tmpData.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); |
| | | } |
| | | |
| | | return tmpDatas; |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | |
| | | BigDecimal oweFee = null; |
| | | BigDecimal receivedFee = null; |
| | | double oweFeeD = 0; |
| | | double receivedFeeD = 0; |
| | | for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { |
| | | oweFee = new BigDecimal(0.00); |
| | | receivedFee = new BigDecimal(0.00); |
| | |
| | | continue; |
| | | } |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); |
| | | receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), info.get("oweFee")); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), info.get("receivedFee")); |
| | | oweFeeD = Double.parseDouble(info.get("oweFee").toString()); |
| | | receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); |
| | | receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); |
| | | } |
| | | data.put("oweFee", oweFee.doubleValue()); |
| | | data.put("receivedFee", receivedFee.doubleValue()); |
| | | data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); |
| | | data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); |
| | | } |
| | | |
| | | return datas; |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | |
| | | BigDecimal oweFee = null; |
| | | BigDecimal receivedFee = null; |
| | | double oweFeeD = 0; |
| | | double receivedFeeD = 0; |
| | | for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { |
| | | data = datas.getJSONObject(dataIndex); |
| | | oweFee = new BigDecimal(0.00); |
| | |
| | | continue; |
| | | } |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); |
| | | receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), info.get("oweFee")); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), info.get("receivedFee")); |
| | | oweFeeD = Double.parseDouble(info.get("oweFee").toString()); |
| | | receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); |
| | | receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); |
| | | } |
| | | data.put("oweFee", oweFee.doubleValue()); |
| | | data.put("receivedFee", receivedFee.doubleValue()); |
| | | data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); |
| | | data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); |
| | | } |
| | | |
| | | return datas; |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | BigDecimal oweFee = null; |
| | | BigDecimal receivedFee = null; |
| | | double oweFeeD = 0; |
| | | double receivedFeeD = 0; |
| | | for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { |
| | | data = datas.getJSONObject(dataIndex); |
| | | oweFee = new BigDecimal(0.00); |
| | |
| | | continue; |
| | | } |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); |
| | | receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), info.get("oweFee")); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), info.get("receivedFee")); |
| | | oweFeeD = Double.parseDouble(info.get("oweFee").toString()); |
| | | receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); |
| | | receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); |
| | | data.put("objName", info.get("objName")); |
| | | |
| | | } |
| | | data.put("oweFee", oweFee.doubleValue()); |
| | | data.put("receivedFee", receivedFee.doubleValue()); |
| | | data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); |
| | | data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); |
| | | // todo 处理 收费对象重复问题 |
| | | delRepeatObjName(data); |
| | | } |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | } |
| | | |
| | | // todo 计算 房屋欠费实收数据 |
| | | JSONArray datas = computeRoomOweReceivedFee(rooms,queryStatisticsDto); |
| | | JSONArray datas = computeRoomOweReceivedFee(rooms, queryStatisticsDto); |
| | | |
| | | ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) queryStatisticsDto.getRow()), count, datas); |
| | | |
| | |
| | | * @param rooms |
| | | * @return |
| | | */ |
| | | private JSONArray computeRoomOweReceivedFee(List<RoomDto> rooms,QueryStatisticsDto queryStatisticsDto) { |
| | | if (rooms == null || rooms.size() < 1) { |
| | | private JSONArray computeRoomOweReceivedFee(List<RoomDto> rooms, QueryStatisticsDto queryStatisticsDto) { |
| | | if (ListUtil.isNull(rooms)) { |
| | | return new JSONArray(); |
| | | } |
| | | |
| | |
| | | for (RoomDto roomDto : rooms) { |
| | | objIds.add(roomDto.getRoomId()); |
| | | data = new JSONObject(); |
| | | data.put("roomId",roomDto.getRoomId()); |
| | | data.put("roomName",roomDto.getFloorNum()+"-"+roomDto.getUnitNum()+"-"+roomDto.getRoomNum()); |
| | | data.put("ownerName",roomDto.getOwnerName()); |
| | | data.put("ownerId",roomDto.getOwnerId()); |
| | | data.put("link",roomDto.getLink()); |
| | | data.put("roomId", roomDto.getRoomId()); |
| | | data.put("roomName", roomDto.getFloorNum() + "-" + roomDto.getUnitNum() + "-" + roomDto.getRoomNum()); |
| | | data.put("ownerName", roomDto.getOwnerName()); |
| | | data.put("ownerId", roomDto.getOwnerId()); |
| | | data.put("link", roomDto.getLink()); |
| | | datas.add(data); |
| | | } |
| | | |
| | | queryStatisticsDto.setObjIds(objIds.toArray(new String[objIds.size()])); |
| | | List<Map> infos = feeStatisticsImpl.getObjFeeSummary(queryStatisticsDto); |
| | | |
| | | if(infos == null || infos.size() < 1){ |
| | | if (infos == null || infos.size() < 1) { |
| | | return datas; |
| | | } |
| | | |
| | | BigDecimal oweFee = null; |
| | | BigDecimal receivedFee = null; |
| | | for(int dataIndex = 0; dataIndex < datas.size();dataIndex ++){ |
| | | double oweFeeD = 0; |
| | | double receivedFeeD = 0; |
| | | for (int dataIndex = 0; dataIndex < datas.size(); dataIndex++) { |
| | | oweFee = new BigDecimal(0.00); |
| | | receivedFee = new BigDecimal(0.00); |
| | | data = datas.getJSONObject(dataIndex); |
| | | for(Map info : infos){ |
| | | if(!data.get("roomId").toString().equals(info.get("objId"))){ |
| | | for (Map info : infos) { |
| | | if (!data.get("roomId").toString().equals(info.get("objId"))) { |
| | | continue; |
| | | } |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(info.get("oweFee").toString())); |
| | | receivedFee = receivedFee.add(new BigDecimal(info.get("receivedFee").toString())); |
| | | data.put("oweFee"+info.get("feeTypeCd").toString(),info.get("oweFee")); |
| | | data.put("receivedFee"+info.get("feeTypeCd").toString(),info.get("receivedFee")); |
| | | oweFeeD = Double.parseDouble(info.get("oweFee").toString()); |
| | | receivedFeeD = Double.parseDouble(info.get("receivedFee").toString()); |
| | | |
| | | oweFee = oweFee.add(new BigDecimal(oweFeeD + "")); |
| | | receivedFee = receivedFee.add(new BigDecimal(receivedFeeD + "")); |
| | | data.put("oweFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(oweFeeD)); |
| | | data.put("receivedFee" + info.get("feeTypeCd").toString(), MoneyUtil.computePriceScale(receivedFeeD)); |
| | | } |
| | | data.put("oweFee",oweFee.doubleValue()); |
| | | data.put("receivedFee",receivedFee.doubleValue()); |
| | | data.put("oweFee", MoneyUtil.computePriceScale(oweFee.doubleValue())); |
| | | data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee.doubleValue())); |
| | | } |
| | | |
| | | return datas; |
| | |
| | | import com.java110.report.statistics.IFeeStatistics; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.MoneyUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | |
| | | int oweRoomCount = feeStatisticsImpl.getOweRoomCount(queryStatisticsDto); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("hisOweFee", hisOweFee); |
| | | data.put("curOweFee", curOweFee); |
| | | data.put("hisReceivedFee", hisReceivedFee); |
| | | data.put("preReceivedFee", preReceivedFee); |
| | | data.put("receivedFee", receivedFee); |
| | | data.put("hisOweFee", MoneyUtil.computePriceScale(hisOweFee)); |
| | | data.put("curOweFee", MoneyUtil.computePriceScale(curOweFee)); |
| | | data.put("hisReceivedFee", MoneyUtil.computePriceScale(hisReceivedFee)); |
| | | data.put("preReceivedFee", MoneyUtil.computePriceScale(preReceivedFee)); |
| | | data.put("receivedFee", MoneyUtil.computePriceScale(receivedFee)); |
| | | data.put("roomCount", roomCount); |
| | | data.put("feeRoomCount", feeRoomCount); |
| | | data.put("oweRoomCount", oweRoomCount); |
| | | data.put("curReceivableFee", curReceivableFee); |
| | | data.put("curReceivableFee", MoneyUtil.computePriceScale(curReceivableFee)); |
| | | |
| | | JSONArray datas = new JSONArray(); |
| | | datas.add(data); |