/** * 创建 ResourceUse 实例 * * @description : 会议室申请 * @param dto * @return */ private ResourceUse createApplyMeeting(IBaseDTO dto) { ResourceUse resourceUse = new ResourceUse(); resourceUse.setId(keyService.getNext("resource_use")); resourceUse.setResourceInfo(getResourceInfo(dto.get("meetingName").toString())); resourceUse.setDateArea(TimeUtil.getTimeByStr(dto.get("useDate").toString(), "yyyy-MM-dd")); resourceUse.setTimeArea( dto.get("startHour").toString() + " ---- " + dto.get("endHour").toString()); resourceUse.setUserName(dto.get("applyUser") == null ? "" : dto.get("applyUser").toString()); resourceUse.setResourceState("1"); // 0-未审批;1-等待审批;2-已批准 resourceUse.setRemark(dto.get("applyReason") == null ? "" : dto.get("applyReason").toString()); resourceUse.setApplyState("40"); return resourceUse; }
/** * PO to DTO * * <p> * * @description:ResourceUse to DynaBeanDTO * @return */ private DynaBeanDTO ResourceUsetoDTO(ResourceUse resourceUse) { DynaBeanDTO dto = new DynaBeanDTO(); dto.set("name", resourceUse.getResourceInfo().getResourceName()); dto.set("useDate", TimeUtil.getTheTimeStr(resourceUse.getDateArea(), "yyyy-MM-dd")); dto.set("timeArea", resourceUse.getTimeArea()); dto.set("applyUser", resourceUse.getUserName()); if ("0".equals(resourceUse.getResourceState())) { dto.set("state", "未审批"); } else if ("1".equals(resourceUse.getResourceState())) { dto.set("state", "待审批"); } else { dto.set("state", "已批准"); } dto.set("principalName", resourceUse.getPrincipalName()); return dto; }