| | |
| | | import com.java110.dto.floor.FloorDto; |
| | | import com.java110.dto.room.RoomDto; |
| | | import com.java110.dto.unit.UnitDto; |
| | | import com.java110.dto.fee.FeeAttrDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.dto.owner.OwnerRoomRelDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.intf.community.IFloorInnerServiceSMO; |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.community.IRoomInnerServiceSMO; |
| | | import com.java110.intf.community.IUnitInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeAttrInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerCarInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerRoomRelV1InnerServiceSMO; |
| | | import com.java110.po.fee.FeeAttrPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.*; |
| | |
| | | import org.springframework.http.ResponseEntity; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private static Logger logger = LoggerFactory.getLogger(ListFeeCmd.class); |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeAttrInnerServiceSMO feeAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IComputeFeeSMO computeFeeSMOImpl; |
| | |
| | | |
| | | @Autowired |
| | | private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerGetDataCheck ownerGetDataCheckImpl; |
| | |
| | | |
| | | @Override |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | if (reqJson.containsKey("roomNum") && !StringUtil.isEmpty(reqJson.getString("roomNum"))) { |
| | | String[] roomNums = reqJson.getString("roomNum").split("-"); |
| | | if (roomNums.length != 3) { |
| | | throw new IllegalArgumentException("房屋编号格式不对!"); |
| | | } |
| | | RoomDto roomDto = new RoomDto(); |
| | | roomDto.setCommunityId(reqJson.getString("communityId")); |
| | | roomDto.setFloorNum(roomNums[0]); |
| | | roomDto.setUnitNum(roomNums[1]); |
| | | roomDto.setRoomNum(roomNums[2]); |
| | | List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); |
| | | Assert.listOnlyOne(roomDtos, "找不到房屋信息!"); |
| | | } |
| | | // todo 房屋名称 刷入 房屋ID |
| | | freshPayerObjIdByRoomNum(reqJson); |
| | | |
| | |
| | | ownerRoomRelDto.setRoomId(reqJson.getString("payerObjId")); |
| | | ownerRoomRelDto.setOwnerId(reqJson.getString("ownerId")); |
| | | List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelV1InnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); |
| | | if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) { |
| | | if (ListUtil.isNull(ownerRoomRelDtos)) { |
| | | ApiFeeVo apiFeeVo = new ApiFeeVo(); |
| | | apiFeeVo.setTotal(0); |
| | | apiFeeVo.setRecords((int) Math.ceil((double) 0 / (double) reqJson.getInteger("row"))); |
| | |
| | | cmdDataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| | | if(reqJson.containsKey("isContractFee")){ |
| | | feeDto.setContractFee(reqJson.getString("payerObjId")); |
| | | feeDto.setPayerObjId(null); |
| | | } |
| | | if(reqJson.containsKey("contractId")){ |
| | | feeDto.setContractFee(reqJson.getString("contractId")); |
| | | } |
| | | int count = feeInnerServiceSMOImpl.queryFeesCount(feeDto); |
| | | if (count > 0) { |
| | | List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);//查询费用项目 |
| | | computeFeePrice(feeDtos);//计算费用 |
| | | //todo 计算费用 |
| | | computeFeePrice(feeDtos); |
| | | List<ApiFeeDataVo> apiFeeDataVos = BeanConvertUtil.covertBeanList(feeDtos, ApiFeeDataVo.class); |
| | | for (ApiFeeDataVo apiFeeDataVo : apiFeeDataVos) { |
| | | apiFeeDataVo.setStartTime(apiFeeDataVo.getStartTime() == null ? null : apiFeeDataVo.getStartTime().split(" ")[0]); |
| | | apiFeeDataVo.setEndTime(apiFeeDataVo.getEndTime() == null ? null : apiFeeDataVo.getEndTime().split(" ")[0]); |
| | | apiFeeDataVo.setMaxEndTime(apiFeeDataVo.getMaxEndTime() == null ? null : apiFeeDataVo.getMaxEndTime().split(" ")[0]); |
| | | apiFeeDataVo.setDeadlineTime(apiFeeDataVo.getDeadlineTime() == null ? null : apiFeeDataVo.getDeadlineTime().split(" ")[0]); |
| | | //计算monthCount |
| | | //计算MaxEndTime和endTime之间的月数 |
| | | int monthCount = DateUtil.calculateMonths(apiFeeDataVo.getEndTime(), apiFeeDataVo.getMaxEndTime()); |
| | | apiFeeDataVo.setMonthCount(monthCount); |
| | | //获取付费对象类型 |
| | | String payerObjType = apiFeeDataVo.getPayerObjType(); |
| | | if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(payerObjType)) { |
| | |
| | | if (!reqJson.containsKey("payerObjIds") || StringUtil.isEmpty(reqJson.getString("payerObjIds"))) { |
| | | return; |
| | | } |
| | | |
| | | String payerObjIds = reqJson.getString("payerObjIds"); |
| | | feeDto.setPayerObjIds(payerObjIds.split(",")); |
| | | } |
| | |
| | | if (!reqJson.containsKey("roomNum") || StringUtil.isEmpty(reqJson.getString("roomNum"))) { |
| | | return; |
| | | } |
| | | |
| | | String[] roomNums = reqJson.getString("roomNum").split("-", 3); |
| | | if (roomNums == null || roomNums.length != 3) { |
| | | throw new IllegalArgumentException("房屋编号格式错误!"); |
| | | } |
| | | |
| | | String floorNum = roomNums[0]; |
| | | String unitNum = roomNums[1]; |
| | | String roomNum = roomNums[2]; |
| | |
| | | floorDto.setFloorNum(floorNum); |
| | | floorDto.setCommunityId(reqJson.getString("communityId")); |
| | | List<FloorDto> floorDtos = floorInnerServiceSMOImpl.queryFloors(floorDto); |
| | | if (floorDtos == null || floorDtos.size() < 1) { |
| | | if (ListUtil.isNull(floorDtos)) { |
| | | return; |
| | | } |
| | | for (FloorDto floor : floorDtos) { |
| | |
| | | unitDto.setFloorId(floor.getFloorId()); |
| | | unitDto.setUnitNum(unitNum); |
| | | List<UnitDto> unitDtos = unitInnerServiceSMOImpl.queryUnits(unitDto); |
| | | if (unitDtos == null || unitDtos.size() < 1) { |
| | | if (ListUtil.isNull(unitDtos)) { |
| | | continue; |
| | | } |
| | | for (UnitDto unit : unitDtos) { |
| | |
| | | } |
| | | |
| | | private void computeFeePrice(List<FeeDto> feeDtos) { |
| | | if (feeDtos == null || feeDtos.isEmpty()) { |
| | | if (ListUtil.isNull(feeDtos)) { |
| | | return; |
| | | } |
| | | String val = CommunitySettingFactory.getValue(feeDtos.get(0).getCommunityId(), TOTAL_FEE_PRICE); |
| | |
| | | Integer.parseInt(feeDto.getDecimalPlace()))); |
| | | BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice()); |
| | | curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth)); |
| | | if (curFeePrice.doubleValue() == -1) { |
| | | curFeePrice = BigDecimal.valueOf(0); |
| | | } |
| | | feeDto.setAmountOwed(MoneyUtil.computePriceScale(curFeePrice.doubleValue(), feeDto.getScale(), Integer.parseInt(feeDto.getDecimalPlace())) + ""); |
| | | //动态费用 |
| | | if ("4004".equals(computingFormula) |
| | |
| | | } |
| | | //考虑租金递增 |
| | | computeFeeSMOImpl.dealRentRate(feeDto); |
| | | |
| | | } |
| | | |
| | | |
| | | } |