From d5d9138f6e9b35834b3726e5cd7625f24b30ecb3 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Thu, 6 Aug 2020 13:40:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../esua/epdc/controller/UserController.java | 24 ++++++--- .../esua/epdc/excel/UserExcelStateOne.java | 46 +++++++++++++++++ .../esua/epdc/excel/UserExcelStateThree.java | 51 +++++++++++++++++++ .../esua/epdc/excel/UserExcelStateTwo.java | 49 ++++++++++++++++++ .../esua/epdc/excel/UserExcelStateZero.java | 40 +++++++++++++++ .../elink/esua/epdc/service/UserService.java | 11 +++- .../epdc/service/impl/UserServiceImpl.java | 23 ++++++++- 7 files changed, 234 insertions(+), 10 deletions(-) create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateOne.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateThree.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateTwo.java create mode 100644 epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateZero.java diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java index c0bbdbd..4717cc6 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java @@ -30,7 +30,7 @@ import com.elink.esua.epdc.dto.PartyMemberModifyFormDTO; import com.elink.esua.epdc.dto.UserDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcUserPointsFormDTO; import com.elink.esua.epdc.enums.AppUserStatesEnum; -import com.elink.esua.epdc.excel.UserExcel; +import com.elink.esua.epdc.excel.*; import com.elink.esua.epdc.service.UserService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -192,22 +192,30 @@ public class UserController { } @GetMapping("export") - @DataFilter(tableAlias = "u", isPendingCreator = false, deptId = "DEPT_ID", prefix = "AND") +// @DataFilter(tableAlias = "u", isPendingCreator = false, deptId = "DEPT_ID", prefix = "AND") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = userService.list(params); + String auditState = (String) params.get("state"); // 状态(0-未审核,1-审核通过,2-审核未通过) - String fileName = null; + String fileName; + List list; if (AppUserStatesEnum.STATE_COMPLETED_INFORMATION_PENDING_REVIEW.value().equals(auditState)) { + list = userService.authenticatedExport(params); fileName = "待认证居民"; + ExcelUtils.exportExcelToTarget(response, fileName, list, UserExcelStateOne.class); } else if (AppUserStatesEnum.STATE_INFORMATION_PASSED.value().equals(auditState)) { + list = userService.authenticatedExport(params); fileName = "已认证居民"; + ExcelUtils.exportExcelToTarget(response, fileName, list, UserExcelStateThree.class); } else if (AppUserStatesEnum.STATE_INFORMATION_NOT_PASSED.value().equals(auditState)) { + list = userService.authenticatedExport(params); fileName = "居民认证失败"; + ExcelUtils.exportExcelToTarget(response, fileName, list, UserExcelStateTwo.class); } else if (AppUserStatesEnum.STATE_REGISTERED.value().equals(auditState)) { + list = userService.authenticatedExport(params); fileName = "未认证居民"; + ExcelUtils.exportExcelToTarget(response, fileName, list, UserExcelStateZero.class); } - ExcelUtils.exportExcelToTarget(response, fileName, list, UserExcel.class); } /** @@ -235,10 +243,10 @@ public class UserController { * @date 2020/3/18 15:59 */ @GetMapping("unauthorizedexport") - @DataFilter(tableAlias = "ug", isPendingCreator = false, deptId = "GRID_ID", prefix = "AND") +// @DataFilter(tableAlias = "ug", isPendingCreator = false, deptId = "GRID_ID", prefix = "AND") public void unauthorizedExport(@RequestParam Map params, HttpServletResponse response) throws Exception { List list = userService.list(params); - ExcelUtils.exportExcelToTarget(response, "未认证居民", list, UserExcel.class); + ExcelUtils.exportExcelToTarget(response, "未认证居民", list, UserExcelStateZero.class); } /*** @@ -280,7 +288,7 @@ public class UserController { /*** - * 已认证居民 + * 待认证居民+已认证居民 * @param params * @return com.elink.esua.epdc.commons.tools.utils.Result> * @author qushutong diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateOne.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateOne.java new file mode 100644 index 0000000..4ff06e4 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateOne.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户信息表 + * + * @author qu qu@gmail.com + * @since v1.0.0 2019-09-02 + */ +@Data +public class UserExcelStateOne { + + @Excel(name = "真实姓名") + private String realName; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "注册时间", format = "yyyy-MM-dd HH:mm:ss") + private Date registerTime; + + @Excel(name = "居民住址") + private String address; + +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateThree.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateThree.java new file mode 100644 index 0000000..6fbbbf4 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateThree.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户信息表 + * + * @author qu qu@gmail.com + * @since v1.0.0 2019-09-02 + */ +@Data +public class UserExcelStateThree { + + @Excel(name = "真实姓名") + private String realName; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "认证时间", format = "yyyy-MM-dd HH:mm:ss") + private Date registerTime; + + @Excel(name = "注册时间", format = "yyyy-MM-dd HH:mm:ss") + private Date createdTime; + + @Excel(name = "身份证号") + private String identityNo; + + @Excel(name = "居民住址") + private String address; +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateTwo.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateTwo.java new file mode 100644 index 0000000..26b9712 --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateTwo.java @@ -0,0 +1,49 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户信息表 + * + * @author qu qu@gmail.com + * @since v1.0.0 2019-09-02 + */ +@Data +public class UserExcelStateTwo { + + @Excel(name = "真实姓名") + private String realName; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "昵称") + private String nickname; + + @Excel(name = "注册时间", format = "yyyy-MM-dd HH:mm:ss") + private Date registerTime; + + @Excel(name = "居民住址") + private String address; + +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateZero.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateZero.java new file mode 100644 index 0000000..a67421d --- /dev/null +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateZero.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户信息表 + * + * @author qu qu@gmail.com + * @since v1.0.0 2019-09-02 + */ +@Data +public class UserExcelStateZero { + + @Excel(name = "昵称") + private String nickname; + + @Excel(name = "加入网格时间", format = "yyyy-MM-dd HH:mm:ss") + private Date registerTime; + +} \ No newline at end of file diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserService.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserService.java index 3dacb69..489766e 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserService.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserService.java @@ -399,7 +399,7 @@ public interface UserService extends BaseService { /*** - * 已认证列表 + * 待认证列表+已认证列表 * @param params * @return com.elink.esua.epdc.commons.tools.page.PageData * @author qushutong @@ -407,4 +407,13 @@ public interface UserService extends BaseService { */ PageData authenticatedpage(Map params); + /*** + * 待认证列表-导出 + * @param params + * @return com.elink.esua.epdc.commons.tools.page.PageData + * @author qushutong + * @date 2020/3/16 16:16 + */ + List authenticatedExport(Map params); + } diff --git a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java index 7e9f781..95c800c 100644 --- a/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java +++ b/epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java @@ -160,10 +160,15 @@ public class UserServiceImpl extends BaseServiceImpl implem @Override public List list(Map params) { + String[] paramKeys = new String[]{"deptId", "realName", "identityNo", "startTime", "endTime", "nickname", "mobile"}; + if (AppUserUtils.isDefaultQuery(params, paramKeys)) { + List userDtoList = Lists.newArrayList(); + return userDtoList; + } this.verifyParams(params); String auditState = (String) params.get("state"); if (AppUserStatesEnum.STATE_REGISTERED.value().equals(auditState)) { - return this.baseDao.selectListUserDto(params); + return this.baseDao.selectListUserDtos(params); } else { return this.baseDao.selectAuthenticatedListUserDto(params); } @@ -1561,6 +1566,22 @@ public class UserServiceImpl extends BaseServiceImpl implem } } + @Override + public List authenticatedExport(Map params) { + String[] paramKeys = new String[]{"deptId", "realName", "identityNo", "startTime", "endTime", "nickname", "mobile"}; + if (AppUserUtils.isDefaultQuery(params, paramKeys)) { + List userDtoList = Lists.newArrayList(); + return userDtoList; + } + this.verifyParams(params); + // 查询当前用户所具有的的数据权限 + if (AppUserStatesEnum.STATE_COMPLETED_INFORMATION_PENDING_REVIEW.value().equals(params.get("state").toString())) { + return this.baseDao.selectWaitAuthenticatedListUserDto(params); + } else { + return this.baseDao.selectAuthenticatedListUserDto(params); + } + } + /** * 用户信息校验 *