增加人员导出功能
This commit is contained in:
parent
a2d287dce9
commit
f479f053b3
|
@ -156,7 +156,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
<version>1.1.2-beta5</version>
|
<version>2.1.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,14 @@ package net.shapelight.modules.ten.controller;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcelFactory;
|
||||||
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||||
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import io.minio.PutObjectOptions;
|
import io.minio.PutObjectOptions;
|
||||||
|
@ -37,10 +42,12 @@ import net.shapelight.modules.sys.service.SysUserRoleService;
|
||||||
import net.shapelight.modules.sys.service.SysUserService;
|
import net.shapelight.modules.sys.service.SysUserService;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
import net.shapelight.modules.ten.service.*;
|
import net.shapelight.modules.ten.service.*;
|
||||||
|
import net.shapelight.modules.ten.vo.PersonExcelModel;
|
||||||
import net.shapelight.modules.vo.TenDeviceVo;
|
import net.shapelight.modules.vo.TenDeviceVo;
|
||||||
import net.shapelight.modules.vo.TenPersonOperationVo;
|
import net.shapelight.modules.vo.TenPersonOperationVo;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -48,6 +55,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +100,8 @@ public class TenPersonController extends AbstractController {
|
||||||
private TenCellDeptService tenCellDeptService;
|
private TenCellDeptService tenCellDeptService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenLabelService tenLabelService;
|
private TenLabelService tenLabelService;
|
||||||
|
@Autowired
|
||||||
|
private HttpServletResponse response;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,6 +148,81 @@ public class TenPersonController extends AbstractController {
|
||||||
return R.ok().put("data", page);
|
return R.ok().put("data", page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询住户列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/download")
|
||||||
|
@RequiresPermissions("ten:person")
|
||||||
|
@ApiOperation(value = "查询住户列表", response = TenPersonEntity.class)
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "limit", value = "每页条数", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "page", value = "页码", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "areaId", value = "区域ID", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "cellId", value = "小区ID", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "buildId", value = "楼栋ID", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "layer", value = "楼层", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "roomNumber", value = "房间名称", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "name", value = "姓名", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "gender", value = "性别", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "mobile", value = "手机号", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "idCard", value = "证件号", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "personType", value = "类型", paramType = "query", dataType = "String", required = true),
|
||||||
|
@ApiImplicitParam(name = "faceFailure", value = "人脸提取标志", paramType = "query", dataType = "String", required = true),
|
||||||
|
})
|
||||||
|
public void downloadPersonList(@RequestParam Map<String, Object> params){
|
||||||
|
String tenantId = getUser().getTenantId() + "";
|
||||||
|
params.put("tenantId", tenantId + "");
|
||||||
|
SysUserEntity user = getUser();
|
||||||
|
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
|
||||||
|
//小区管理员
|
||||||
|
if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) {
|
||||||
|
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId()));
|
||||||
|
params.put("cellId", scope.getCellId().toString());
|
||||||
|
}
|
||||||
|
List<Integer> personTypeList = new ArrayList<>();
|
||||||
|
List<TenLabelEntity> tenLabel = tenLabelService.list(new QueryWrapper<TenLabelEntity>()
|
||||||
|
.eq("tenant_id",getUser().getTenantId()));
|
||||||
|
personTypeList.add(Constant.PERSON_TYPE_OWNER);
|
||||||
|
personTypeList.add(Constant.PERSON_TYPE_MEMBER);
|
||||||
|
personTypeList.add(Constant.PERSON_TYPE_TENANT);
|
||||||
|
params.put("personTypeList",personTypeList);
|
||||||
|
String fileName = "person.xlsx";
|
||||||
|
|
||||||
|
List<PersonExcelModel> list = tenPersonService.queryPersonModel(params);
|
||||||
|
|
||||||
|
//表头样式策略
|
||||||
|
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||||
|
//设置头居中
|
||||||
|
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||||
|
//内容策略
|
||||||
|
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||||
|
//设置 水平居中
|
||||||
|
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
|
||||||
|
//初始化表格样式
|
||||||
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||||
|
|
||||||
|
// response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||||
|
try {
|
||||||
|
fileName = URLEncoder.encode("person.xlsx", "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
//响应首部 Access-Control-Expose-Headers 就是控制“暴露”的开关,它列出了哪些首部可以作为响应的一部分暴露给外部。
|
||||||
|
//此处设置了开放Content-Disposition,前端可获取该响应参数获取文件名称
|
||||||
|
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName);
|
||||||
|
|
||||||
|
try {
|
||||||
|
EasyExcelFactory.write(response.getOutputStream(),PersonExcelModel.class).sheet("人员信息").doWrite(list);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询访客列表
|
* 查询访客列表
|
||||||
|
|
|
@ -2,9 +2,11 @@ package net.shapelight.modules.ten.dao;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import net.shapelight.modules.excel.model.PersonModel;
|
||||||
import net.shapelight.modules.ten.entity.TenLabelEntity;
|
import net.shapelight.modules.ten.entity.TenLabelEntity;
|
||||||
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
import net.shapelight.modules.ten.entity.TenPersonEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import net.shapelight.modules.ten.vo.PersonExcelModel;
|
||||||
import net.shapelight.modules.vo.*;
|
import net.shapelight.modules.vo.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -35,6 +37,10 @@ public interface TenPersonDao {
|
||||||
|
|
||||||
IPage<TenPersonEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds,@Param("params") Map params);
|
IPage<TenPersonEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds,@Param("params") Map params);
|
||||||
|
|
||||||
|
List<PersonExcelModel> findAll(@Param("cellIds") List<Long> cellIds,@Param("params") Map params);
|
||||||
|
|
||||||
|
List<PersonExcelModel> findExtractAll(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
|
||||||
|
|
||||||
int findAllCount(@Param("cellIds") List<Long> cellIds,@Param("params") Map params);
|
int findAllCount(@Param("cellIds") List<Long> cellIds,@Param("params") Map params);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import net.shapelight.common.utils.PageUtils;
|
import net.shapelight.common.utils.PageUtils;
|
||||||
import net.shapelight.modules.excel.model.PersonModel;
|
import net.shapelight.modules.excel.model.PersonModel;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
|
import net.shapelight.modules.ten.vo.PersonExcelModel;
|
||||||
import net.shapelight.modules.vo.*;
|
import net.shapelight.modules.vo.*;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ import java.util.Map;
|
||||||
public interface TenPersonService {
|
public interface TenPersonService {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
List<PersonExcelModel> queryPersonModel(Map<String, Object> params);
|
||||||
PageUtils queryGlobalPage(Map<String, Object> params);
|
PageUtils queryGlobalPage(Map<String, Object> params);
|
||||||
|
|
||||||
PageUtils queryVerify(Map<String, Object> params);
|
PageUtils queryVerify(Map<String, Object> params);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.arcsoft.face.toolkit.ImageInfo;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import io.minio.PutObjectOptions;
|
import io.minio.PutObjectOptions;
|
||||||
|
import io.minio.errors.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.coobird.thumbnailator.Thumbnails;
|
import net.coobird.thumbnailator.Thumbnails;
|
||||||
import net.shapelight.common.config.GlobalValue;
|
import net.shapelight.common.config.GlobalValue;
|
||||||
|
@ -31,8 +32,12 @@ import net.shapelight.modules.face.util.UserInfo;
|
||||||
import net.shapelight.modules.face.util.UserRamCache;
|
import net.shapelight.modules.face.util.UserRamCache;
|
||||||
import net.shapelight.modules.face.util.UserRamGroup;
|
import net.shapelight.modules.face.util.UserRamGroup;
|
||||||
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
||||||
|
import net.shapelight.modules.sys.entity.SysUserEntity;
|
||||||
|
import net.shapelight.modules.sys.service.SysUserService;
|
||||||
|
import net.shapelight.modules.ten.controller.TenUserController;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
import net.shapelight.modules.ten.service.*;
|
import net.shapelight.modules.ten.service.*;
|
||||||
|
import net.shapelight.modules.ten.vo.PersonExcelModel;
|
||||||
import net.shapelight.modules.vo.*;
|
import net.shapelight.modules.vo.*;
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -41,6 +46,7 @@ import org.apache.commons.lang.RandomStringUtils;
|
||||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
@ -48,6 +54,10 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -102,7 +112,12 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
private FaceEngineService faceEngineService;
|
private FaceEngineService faceEngineService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenLabelService tenLabelService;
|
private TenLabelService tenLabelService;
|
||||||
|
@Autowired
|
||||||
|
private TenUserController tenUserController;
|
||||||
|
@Value("${global.minio.endpoint}")
|
||||||
|
private String baseImageUrl;
|
||||||
|
@Value("${global.minio.bucketName}")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
|
@ -173,6 +188,117 @@ public class TenPersonServiceImpl implements TenPersonService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<PersonExcelModel> queryPersonModel(Map<String, Object> params){
|
||||||
|
List<Long> cellIds = new ArrayList<>();
|
||||||
|
// cellIds.add(709832651506188289L);
|
||||||
|
|
||||||
|
String areaIdStr = (String) params.get("areaId");
|
||||||
|
String cellIdStr = (String) params.get("cellId");
|
||||||
|
|
||||||
|
String faceFailure = (String) params.get("faceFailure");
|
||||||
|
|
||||||
|
if (areaIdStr != null && !areaIdStr.isEmpty() && (cellIdStr == null || cellIdStr.isEmpty())) {
|
||||||
|
Long areaId = Long.parseLong(areaIdStr);
|
||||||
|
//子区域
|
||||||
|
List<Long> allArea = tenAreaService.getSubAreaIdList(areaId);
|
||||||
|
//本区域
|
||||||
|
allArea.add(areaId);
|
||||||
|
List<TenCellEntity> cellList = tenCellService.list(new QueryWrapper<TenCellEntity>()
|
||||||
|
.in("area_id", allArea));
|
||||||
|
for (TenCellEntity cell : cellList) {
|
||||||
|
cellIds.add(cell.getCellId());
|
||||||
|
}
|
||||||
|
} else if (cellIdStr != null && !cellIdStr.isEmpty()) {
|
||||||
|
Long cellLong = Long.parseLong(cellIdStr);
|
||||||
|
cellIds.add(cellLong);
|
||||||
|
} else {
|
||||||
|
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||||
|
for (TenCellEntity cell : cells) {
|
||||||
|
cellIds.add(cell.getCellId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cellIds.size() == 0) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<PersonExcelModel> list = null;
|
||||||
|
if(faceFailure!=null && faceFailure.equals("1")){
|
||||||
|
list = tenPersonDao.findExtractAll(cellIds, params);
|
||||||
|
}else{
|
||||||
|
list = tenPersonDao.findAll(cellIds, params);
|
||||||
|
}
|
||||||
|
for (PersonExcelModel personEntity : list) {
|
||||||
|
Map<String,String> sexMap = new HashMap<>();
|
||||||
|
sexMap.put("0","女");
|
||||||
|
sexMap.put("1","男");
|
||||||
|
personEntity.setGender(sexMap.get(personEntity.getGender()));
|
||||||
|
Map<String,String> statusMap = new HashMap<>();
|
||||||
|
statusMap.put("0","正常");
|
||||||
|
statusMap.put("1","禁用");
|
||||||
|
statusMap.put("2","待审核");
|
||||||
|
statusMap.put("3","审核不通过");
|
||||||
|
statusMap.put("4","照片质量不合格");
|
||||||
|
statusMap.put("5","未生效");
|
||||||
|
statusMap.put("6","已失效");
|
||||||
|
personEntity.setStatus(statusMap.get(personEntity.getStatus()));
|
||||||
|
List<TenPersonExtractEntity> extracts = tenPersonExtractService.list(
|
||||||
|
new QueryWrapper<TenPersonExtractEntity>()
|
||||||
|
.eq("person_id", personEntity.getPersonId())
|
||||||
|
);
|
||||||
|
R r = tenUserController.displayFaceFlag();
|
||||||
|
int displayInt = (int) r.get("data");
|
||||||
|
|
||||||
|
if(displayInt == 1) {
|
||||||
|
try {
|
||||||
|
boolean fileExists = isObjectExist(personEntity.getFaceImage());
|
||||||
|
if(fileExists) {
|
||||||
|
personEntity.setUrl(new URL(baseImageUrl+"/cell/"+personEntity.getFaceImage()));
|
||||||
|
}
|
||||||
|
} catch (
|
||||||
|
IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
boolean fileExists = isObjectExist(personEntity.getFaceModel());
|
||||||
|
if(fileExists) {
|
||||||
|
personEntity.setUrl(new URL(baseImageUrl+"/cell/"+personEntity.getFaceModel()));
|
||||||
|
}
|
||||||
|
} catch (
|
||||||
|
IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//personEntity.setUrl(new URL(baseImageUrl+"/cell/"+personEntity.getFaceImage()));
|
||||||
|
if(personEntity.getDeptId()!=null){
|
||||||
|
TenCellDeptEntity dept = tenCellDeptService.getById(personEntity.getDeptId());
|
||||||
|
|
||||||
|
if(dept!=null){
|
||||||
|
personEntity.setDeptName(dept.getName());
|
||||||
|
String deptAllName = tenCellDeptService.getAllParentName(dept.getParentId());
|
||||||
|
personEntity.setDeptAllName(deptAllName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isObjectExist(String name) {
|
||||||
|
if(StringUtils.isEmpty(name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
minioClient.statObject(bucketName,name);
|
||||||
|
return true;
|
||||||
|
} catch (ErrorResponseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryVerify(Map<String, Object> params) {
|
public PageUtils queryVerify(Map<String, Object> params) {
|
||||||
List<Long> cellIds = new ArrayList<>();
|
List<Long> cellIds = new ArrayList<>();
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package net.shapelight.modules.ten.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||||
|
import com.alibaba.excel.converters.string.StringImageConverter;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ContentRowHeight(100)
|
||||||
|
@ColumnWidth(100 / 8)
|
||||||
|
public class PersonExcelModel {
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long personId;
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private String faceImage;
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private String faceModel;
|
||||||
|
|
||||||
|
|
||||||
|
@ExcelProperty(value = "人像图",index = 0)
|
||||||
|
private URL url;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "姓名", index = 1)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "性别", index = 2)
|
||||||
|
private String gender;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "手机号", index = 3)
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "区域名称", index = 4)
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "学校名称", index = 5)
|
||||||
|
private String cellName;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "上级组织", index = 6)
|
||||||
|
private String deptAllName;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "组织", index = 7)
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "人员类型", index = 8)
|
||||||
|
private String labelName;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "状态", index = 9)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -89,6 +89,28 @@
|
||||||
</association>
|
</association>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="excelResultMap" type="net.shapelight.modules.ten.vo.PersonExcelModel">
|
||||||
|
<result column="person_id" jdbcType="BIGINT" property="personId"/>
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
|
<result column="gender" jdbcType="TINYINT" property="gender"/>
|
||||||
|
<result column="mobile" jdbcType="VARCHAR" property="mobile"/>
|
||||||
|
<result column="face_image" jdbcType="VARCHAR" property="faceImage"/>
|
||||||
|
<result column="face_model" jdbcType="VARCHAR" property="faceModel" />
|
||||||
|
|
||||||
|
<association property="cellName" javaType="String"
|
||||||
|
select="net.shapelight.modules.ten.dao.TenCellDao.getCellName"
|
||||||
|
column="cellId=cell_id">
|
||||||
|
</association>
|
||||||
|
<association property="areaName" javaType="String"
|
||||||
|
select="net.shapelight.modules.ten.dao.TenCellDao.getAreaNameByCellId"
|
||||||
|
column="cellId=cell_id">
|
||||||
|
</association>
|
||||||
|
<association property="labelName" javaType="String"
|
||||||
|
select="net.shapelight.modules.ten.dao.TenLabelDao.getLabelName"
|
||||||
|
column="labelId=label_id">
|
||||||
|
</association>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<resultMap id="updateMap" type="net.shapelight.modules.vo.TenPersonVo">
|
<resultMap id="updateMap" type="net.shapelight.modules.vo.TenPersonVo">
|
||||||
<result column="member_id" jdbcType="INTEGER" property="memberId"/>
|
<result column="member_id" jdbcType="INTEGER" property="memberId"/>
|
||||||
|
@ -765,6 +787,112 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
|
||||||
|
on p.room_id = r.room_id where p.delete_flag = 0
|
||||||
|
<if test="params.buildId != null and params.buildId!=''">
|
||||||
|
and r.build_id = #{params.buildId}
|
||||||
|
</if>
|
||||||
|
<if test="params.layer != null and params.layer!=''">
|
||||||
|
and r.layer = #{params.layer}
|
||||||
|
</if>
|
||||||
|
<if test="params.roomName != null and params.roomName!=''">
|
||||||
|
and r.room_name like CONCAT('%', '${params.roomName}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.roomId != null and params.roomId!=''">
|
||||||
|
and r.room_id = #{params.roomId}
|
||||||
|
</if>
|
||||||
|
<if test="params.name != null and params.name!=''">
|
||||||
|
and p.name like CONCAT('%', '${params.name}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.gender != null and params.gender!=''">
|
||||||
|
and p.gender = #{params.gender}
|
||||||
|
</if>
|
||||||
|
<if test="params.status != null and params.status!=''">
|
||||||
|
and p.status = #{params.status}
|
||||||
|
</if>
|
||||||
|
<if test="params.idCard != null and params.idCard!=''">
|
||||||
|
and p.id_card like CONCAT('%', '${params.idCard}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.mobile != null and params.mobile!=''">
|
||||||
|
and p.mobile like CONCAT('%', '${params.mobile}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.personType != null and params.personType!=''">
|
||||||
|
and p.person_type = #{params.personType}
|
||||||
|
</if>
|
||||||
|
<if test="params.faceFailure != null and params.faceFailure!=''">
|
||||||
|
and p.face_failure = #{params.faceFailure}
|
||||||
|
</if>
|
||||||
|
<if test="params.personTypeList != null">
|
||||||
|
and p.person_type in
|
||||||
|
<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">
|
||||||
|
#{personType}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="cellIds != null">
|
||||||
|
and p.cell_id in
|
||||||
|
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
|
||||||
|
#{cellId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="params.deptId != null and params.deptId!=''">
|
||||||
|
and p.dept_id = #{params.deptId}
|
||||||
|
</if>
|
||||||
|
<if test="params.labelId != null and params.labelId!=''">
|
||||||
|
and p.label_id = #{params.labelId}
|
||||||
|
</if>
|
||||||
|
order by p.create_time desc
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findAll" resultMap="excelResultMap">
|
||||||
|
<!--SELECT alias.* from (-->
|
||||||
|
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
|
||||||
|
<!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r-->
|
||||||
|
<!--on p.room_id = r.room_id where p.delete_flag = 0-->
|
||||||
|
<!--<if test="params.buildId != null and params.buildId!=''">-->
|
||||||
|
<!--and r.build_id = #{params.buildId}-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.layer != null and params.layer!=''">-->
|
||||||
|
<!--and r.layer = #{params.layer}-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.roomName != null and params.roomName!=''">-->
|
||||||
|
<!--and r.room_name like CONCAT('%', '${params.roomName}', '%')-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.name != null and params.name!=''">-->
|
||||||
|
<!--and p.name like CONCAT('%', '${params.name}', '%')-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.gender != null and params.gender!=''">-->
|
||||||
|
<!--and p.gender = #{params.gender}-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.status != null and params.status!=''">-->
|
||||||
|
<!--and p.status = #{params.status}-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.idCard != null and params.idCard!=''">-->
|
||||||
|
<!--and p.id_card like CONCAT('%', '${params.idCard}', '%')-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.mobile != null and params.mobile!=''">-->
|
||||||
|
<!--and p.mobile like CONCAT('%', '${params.mobile}', '%')-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.personType != null and params.personType!=''">-->
|
||||||
|
<!--and p.person_type = #{params.personType}-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.faceFailure != null and params.faceFailure!=''">-->
|
||||||
|
<!--and p.face_failure = #{params.faceFailure}-->
|
||||||
|
<!--</if>-->
|
||||||
|
<!--<if test="params.personTypeList != null">-->
|
||||||
|
<!--and p.person_type in-->
|
||||||
|
<!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">-->
|
||||||
|
<!--#{personType}-->
|
||||||
|
<!--</foreach>-->
|
||||||
|
<!--</if>-->
|
||||||
|
|
||||||
|
<!--</foreach>-->
|
||||||
|
<!--) alias where 1 = 1 order by alias.person_id desc-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
|
select p.*,r.layer,r.room_name from ten_person p left join ten_room r
|
||||||
on p.room_id = r.room_id where p.delete_flag = 0
|
on p.room_id = r.room_id where p.delete_flag = 0
|
||||||
<if test="params.buildId != null and params.buildId!=''">
|
<if test="params.buildId != null and params.buildId!=''">
|
||||||
|
@ -1345,6 +1473,51 @@
|
||||||
order by p.create_time desc
|
order by p.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findExtractAll" resultMap="excelResultMap">
|
||||||
|
select p.* from (select DISTINCT person_id from ten_person_extract where 1 = 1
|
||||||
|
<if test="cellIds != null">
|
||||||
|
and cell_id in
|
||||||
|
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
|
||||||
|
#{cellId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
) as e left join ten_person p
|
||||||
|
on e.person_id = p.person_id
|
||||||
|
where p.delete_flag = 0
|
||||||
|
<if test="params.name != null and params.name!=''">
|
||||||
|
and p.name like CONCAT('%', '${params.name}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.gender != null and params.gender!=''">
|
||||||
|
and p.gender = #{params.gender}
|
||||||
|
</if>
|
||||||
|
<if test="params.status != null and params.status!=''">
|
||||||
|
and p.status = #{params.status}
|
||||||
|
</if>
|
||||||
|
<if test="params.idCard != null and params.idCard!=''">
|
||||||
|
and p.id_card like CONCAT('%', '${params.idCard}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.mobile != null and params.mobile!=''">
|
||||||
|
and p.mobile like CONCAT('%', '${params.mobile}', '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.personType != null and params.personType!=''">
|
||||||
|
and p.person_type = #{params.personType}
|
||||||
|
</if>
|
||||||
|
<if test="params.personTypeList != null">
|
||||||
|
and p.person_type in
|
||||||
|
<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">
|
||||||
|
#{personType}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="params.deptId != null and params.deptId!=''">
|
||||||
|
and p.dept_id = #{params.deptId}
|
||||||
|
</if>
|
||||||
|
<if test="params.labelId != null and params.labelId!=''">
|
||||||
|
and p.label_id = #{params.labelId}
|
||||||
|
</if>
|
||||||
|
order by p.create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="findByIdCardAndDept" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
<select id="findByIdCardAndDept" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||||
select * from ten_person
|
select * from ten_person
|
||||||
|
@ -1353,12 +1526,10 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listPage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
<select id="listPage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||||
select * from ten_person where delete_flag = 0
|
select a.* from ten_person a INNER JOIN (SELECT member_id FROM ten_person WHERE delete_flag = 0 and `status` = 0
|
||||||
and status = 0
|
|
||||||
<if test="cellId != null and cellId!=''">
|
<if test="cellId != null and cellId!=''">
|
||||||
and cell_id = #{cellId}
|
and cell_id = #{cellId}
|
||||||
</if>
|
</if> ORDER BY member_id LIMIT #{start},#{count}) b on a.member_id = b.member_id
|
||||||
limit #{start},#{count}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findCount" resultType="int">
|
<select id="findCount" resultType="int">
|
||||||
|
|
Loading…
Reference in New Issue