|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.fasterxml.jackson.annotation.JsonInclude; | 
|---|
|  |  |  | import com.moral.api.entity.Organization; | 
|---|
|  |  |  | import com.moral.api.entity.User; | 
|---|
|  |  |  | import com.moral.api.pojo.dto.organization.OrganizationDTO; | 
|---|
|  |  |  | import com.moral.api.pojo.dto.organization.OrganizationQueryDTO; | 
|---|
|  |  |  | import com.moral.api.pojo.vo.user.UserVO; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.util.DateUtils; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (dto.getCode() != ResponseCodeEnum.SUCCESS.getCode()) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | OrganizationQueryVO vo = new OrganizationQueryVO(); | 
|---|
|  |  |  | long page = dto.getPage(); | 
|---|
|  |  |  | long pages = dto.getPages(); | 
|---|
|  |  |  | long total = dto.getTotal(); | 
|---|
|  |  |  | long current = dto.getCurrent(); | 
|---|
|  |  |  | long size = dto.getSize(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | vo.setCurrent(current); | 
|---|
|  |  |  | vo.setOrganizations(organizationVOS); | 
|---|
|  |  |  | vo.setPages(page); | 
|---|
|  |  |  | vo.setPages(pages); | 
|---|
|  |  |  | vo.setSize(size); | 
|---|
|  |  |  | vo.setTotal(total); | 
|---|
|  |  |  | return vo; | 
|---|
|  |  |  | 
|---|
|  |  |  | OrganizationVO vo = new OrganizationVO(); | 
|---|
|  |  |  | Organization organization = dto.getOrganization(); | 
|---|
|  |  |  | Organization parentOrganization = dto.getParentOrganization(); | 
|---|
|  |  |  | User adminUser = dto.getAdminUser(); | 
|---|
|  |  |  | Date createTime = organization.getCreateTime(); | 
|---|
|  |  |  | Date expireTime = organization.getExpireTime(); | 
|---|
|  |  |  | String createTimeStr = DateUtils.dateToDateString(createTime, "yyyy-MM-dd"); | 
|---|
|  |  |  | String exipreTimeStr = DateUtils.dateToDateString(expireTime, "yyyy-MM-dd"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //封装组织信息 | 
|---|
|  |  |  | vo.setId(organization.getId()); | 
|---|
|  |  |  | vo.setName(organization.getName()); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(parentOrganization)) | 
|---|
|  |  |  | vo.setParentName(parentOrganization.getName()); | 
|---|
|  |  |  | 
|---|
|  |  |  | vo.setAddress(organization.getAddress()); | 
|---|
|  |  |  | vo.setCreateTime(createTimeStr); | 
|---|
|  |  |  | vo.setExpireTime(exipreTimeStr); | 
|---|
|  |  |  | vo.setAdminUserId(organization.getAdminUserId()); | 
|---|
|  |  |  | vo.setProvinceCode(organization.getProvinceCode()); | 
|---|
|  |  |  | vo.setCityCode(organization.getCityCode()); | 
|---|
|  |  |  | vo.setAreaCode(organization.getAreaCode()); | 
|---|
|  |  |  | vo.setProvinceCityAreaName(organization.getProvinceName() + "/" + organization.getCityName() + "/" + organization.getAreaName()); | 
|---|
|  |  |  | vo.setLocationLevelCode(organization.getLocationLevelCode()); | 
|---|
|  |  |  | vo.setLocationLevelName(organization.getLocationLevelName()); | 
|---|
|  |  |  | //封装组织admin账号信息 | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(adminUser)) { | 
|---|
|  |  |  | UserVO adminUserVO = new UserVO(); | 
|---|
|  |  |  | String adminUserCreateTimeStr = DateUtils.dateToDateString(adminUser.getCreateTime(), "yyyy-MM-dd"); | 
|---|
|  |  |  | String adminUserExpireTimeStr = DateUtils.dateToDateString(adminUser.getExpireTime(), "yyyy-MM-dd"); | 
|---|
|  |  |  | adminUserVO.setId(adminUser.getId()); | 
|---|
|  |  |  | adminUserVO.setMobile(adminUser.getMobile()); | 
|---|
|  |  |  | adminUserVO.setEmail(adminUser.getEmail()); | 
|---|
|  |  |  | adminUserVO.setWechat(adminUser.getWechat()); | 
|---|
|  |  |  | adminUserVO.setAccount(adminUser.getAccount()); | 
|---|
|  |  |  | adminUserVO.setExpireTime(adminUserExpireTimeStr); | 
|---|
|  |  |  | adminUserVO.setCreateTime(adminUserCreateTimeStr); | 
|---|
|  |  |  | adminUserVO.setUserName(adminUser.getUserName()); | 
|---|
|  |  |  | adminUserVO.setOrganizationName(organization.getName()); | 
|---|
|  |  |  | vo.setAdminUserAccount(adminUser.getAccount()); | 
|---|
|  |  |  | vo.setAdminUser(adminUserVO); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | vo.setAdminUser(new UserVO()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return vo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|