Browse Source

居民管理,导出功能

master
zhangyuan 5 years ago
parent
commit
d5d9138f6e
  1. 24
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/controller/UserController.java
  2. 46
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateOne.java
  3. 51
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateThree.java
  4. 49
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateTwo.java
  5. 40
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateZero.java
  6. 11
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserService.java
  7. 23
      epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java

24
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<String, Object> params, HttpServletResponse response) throws Exception {
List<UserDTO> list = userService.list(params);
String auditState = (String) params.get("state");
// 状态(0-未审核,1-审核通过,2-审核未通过)
String fileName = null;
String fileName;
List<UserDTO> 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<String, Object> params, HttpServletResponse response) throws Exception {
List<UserDTO> 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<com.elink.esua.epdc.commons.tools.page.PageData < com.elink.esua.epdc.dto.UserDTO>>
* @author qushutong

46
epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateOne.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

51
epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateThree.java

@ -0,0 +1,51 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

49
epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateTwo.java

@ -0,0 +1,49 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

40
epdc-cloud-user/src/main/java/com/elink/esua/epdc/excel/UserExcelStateZero.java

@ -0,0 +1,40 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

11
epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/UserService.java

@ -399,7 +399,7 @@ public interface UserService extends BaseService<UserEntity> {
/***
* 已认证列表
* 待认证列表+已认证列表
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.UserDTO>
* @author qushutong
@ -407,4 +407,13 @@ public interface UserService extends BaseService<UserEntity> {
*/
PageData<UserDTO> authenticatedpage(Map<String, Object> params);
/***
* 待认证列表-导出
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.UserDTO>
* @author qushutong
* @date 2020/3/16 16:16
*/
List<UserDTO> authenticatedExport(Map<String, Object> params);
}

23
epdc-cloud-user/src/main/java/com/elink/esua/epdc/service/impl/UserServiceImpl.java

@ -160,10 +160,15 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Override
public List<UserDTO> list(Map<String, Object> params) {
String[] paramKeys = new String[]{"deptId", "realName", "identityNo", "startTime", "endTime", "nickname", "mobile"};
if (AppUserUtils.isDefaultQuery(params, paramKeys)) {
List<UserDTO> 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<UserDao, UserEntity> implem
}
}
@Override
public List<UserDTO> authenticatedExport(Map<String, Object> params) {
String[] paramKeys = new String[]{"deptId", "realName", "identityNo", "startTime", "endTime", "nickname", "mobile"};
if (AppUserUtils.isDefaultQuery(params, paramKeys)) {
List<UserDTO> 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);
}
}
/**
* 用户信息校验
*

Loading…
Cancel
Save