|
@@ -6,6 +6,8 @@ import com.diagbot.client.AuthServiceClient;
|
|
|
import com.diagbot.dto.GetConsoleUserInfoDTO;
|
|
|
import com.diagbot.dto.LoginDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.dto.UserInfoDTO;
|
|
|
+import com.diagbot.dto.UserInfoExportDTO;
|
|
|
import com.diagbot.dto.UserOrgDTO;
|
|
|
import com.diagbot.entity.JWT;
|
|
|
import com.diagbot.entity.Organization;
|
|
@@ -19,12 +21,16 @@ import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.exception.ServiceErrorCode;
|
|
|
import com.diagbot.service.impl.UserServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
+import com.diagbot.util.ExportBeanExcelUtil;
|
|
|
+import com.diagbot.util.GsonUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RegexValidateUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.ImgVerVerVO;
|
|
|
+import com.diagbot.vo.UserExportVO;
|
|
|
import com.diagbot.vo.UserSaveVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
@@ -399,4 +405,80 @@ public class UserFacade extends UserServiceImpl {
|
|
|
}
|
|
|
return userIdList;
|
|
|
}
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param userExportVO
|
|
|
+ * @return 导出Excel文件
|
|
|
+ */
|
|
|
+ public RespDTO export(UserExportVO userExportVO){
|
|
|
+ Map<String, Object> userMap = new HashMap<String, Object>();
|
|
|
+ userMap.put("startTime", userExportVO.getStartTime());
|
|
|
+ userMap.put("endTime", userExportVO.getEndTime());
|
|
|
+ List<UserInfoDTO> datas = dependentuserInfoByTime(userMap);
|
|
|
+ GsonUtil.toJson(datas);
|
|
|
+ List<String> listName = new ArrayList<>();
|
|
|
+
|
|
|
+ listName.add("用户id");
|
|
|
+ listName.add("记录创建时间");
|
|
|
+ listName.add("用户名");
|
|
|
+ listName.add("联系人");
|
|
|
+ listName.add("邮箱");
|
|
|
+ listName.add("机构ID");
|
|
|
+ listName.add("机构名称");
|
|
|
+ listName.add("机构属性");
|
|
|
+ listName.add("负责人");
|
|
|
+ listName.add("机构地址");
|
|
|
+ listName.add("上级机构id");
|
|
|
+ listName.add("下属机构数量");
|
|
|
+ listName.add("岗位信息");
|
|
|
+ listName.add("是否通过认证 ");
|
|
|
+ listName.add("认证状态");
|
|
|
+
|
|
|
+ List<String> listId = new ArrayList<>();
|
|
|
+ listId.add("userId");//用户ID
|
|
|
+ listId.add("userGmtCreate");//记录创建时间
|
|
|
+ listId.add("userName");// 用户名
|
|
|
+ listId.add("linKman");//联系人
|
|
|
+ listId.add("email");// 邮箱
|
|
|
+ listId.add("orgId");//机构ID
|
|
|
+ //listId.add("orgGmtCreate");//记录创建时间
|
|
|
+ listId.add("orgName");//机构名称
|
|
|
+ listId.add("orgType");//机构属性
|
|
|
+ listId.add("orgPrincipal");//负责人
|
|
|
+ listId.add("orgAddress");//机构地址
|
|
|
+ listId.add("orgParentId");//上级机构id
|
|
|
+ listId.add("orgSubNum");//下属机构数量
|
|
|
+ listId.add("autPosition");//岗位信息
|
|
|
+ listId.add("autIsReject");//是否通过认证 N:未通过,Y:已通过
|
|
|
+ listId.add("autStatus");//认证状态
|
|
|
+
|
|
|
+ List<UserInfoExportDTO> list = new ArrayList<>();
|
|
|
+ for (int i = 0; i < datas.size(); i++) {
|
|
|
+ UserInfoDTO userInfo = datas.get(i);
|
|
|
+ list.add(new UserInfoExportDTO(String.valueOf(userInfo.getUserId()),
|
|
|
+ DateUtil.formatDate(userInfo.getUserGmtCreate()),
|
|
|
+ userInfo.getUserName(),
|
|
|
+ userInfo.getLinKman(),
|
|
|
+ userInfo.getEmail(),
|
|
|
+ String.valueOf(userInfo.getOrgId()),
|
|
|
+ userInfo.getOrgName(),
|
|
|
+ String.valueOf(userInfo.getOrgType()),
|
|
|
+ userInfo.getOrgPrincipal(),
|
|
|
+ userInfo.getOrgAddress(),
|
|
|
+ String.valueOf(userInfo.getOrgParentId()),
|
|
|
+ String.valueOf(userInfo.getOrgSubNum()),
|
|
|
+ userInfo.getAutPosition(),
|
|
|
+ String.valueOf(userInfo.getAutIsReject()),
|
|
|
+ String.valueOf(userInfo.getAutStatus())));
|
|
|
+ }
|
|
|
+ //response.setContentType("text/html;charset=UTF-8");
|
|
|
+ String filePath =userExportVO.getFilePath();//文件路径
|
|
|
+ String fileName = userExportVO.getFileName();//文件名
|
|
|
+ ExportBeanExcelUtil ex = new ExportBeanExcelUtil();
|
|
|
+ RespDTO resul = ex.exportExcel("测试POI导出EXCEL文档", listName, listId, list,filePath,fileName);
|
|
|
+
|
|
|
+ return resul;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|