v9:修复所有bug

This commit is contained in:
gaoben 2023-11-16 13:30:57 +08:00
parent 1830be2b65
commit 20eb02695d
16 changed files with 336 additions and 99 deletions

View File

@ -158,10 +158,14 @@ public class AppApiController {
} }
if(tenPerson.getIdCard()!=null){ if(tenPerson.getIdCard()!=null){
TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), // TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(),
tenPerson.getRoomId(),tenPerson.getCellId()); // tenPerson.getRoomId(),tenPerson.getCellId());
if(tenPersonIdcard!=null){ // if(tenPersonIdcard!=null){
return R.error("身份证在此房间已存在"); // return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
} }
} }
@ -579,10 +583,14 @@ public class AppApiController {
} }
if(tenPerson.getIdCard()!=null){ if(tenPerson.getIdCard()!=null){
TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), // TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(),
tenPerson.getRoomId(),tenPerson.getCellId()); // tenPerson.getRoomId(),tenPerson.getCellId());
if(tenPersonIdcard!=null){ // if(tenPersonIdcard!=null){
return R.error("身份证在此房间已存在"); // return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
} }
} }

View File

@ -3,16 +3,15 @@ package net.shapelight.modules.excel.listener;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.PutObjectOptions; import io.minio.PutObjectOptions;
import lombok.Getter; import lombok.Getter;
import net.shapelight.common.utils.R; import net.shapelight.common.utils.R;
import net.shapelight.common.utils.UUIDUtil; import net.shapelight.common.utils.UUIDUtil;
import net.shapelight.commons.engine.sdk.PicSDK; import net.shapelight.commons.engine.sdk.PicSDK;
import net.shapelight.modules.excel.model.PersonModel; import net.shapelight.modules.excel.model.PersonModel;
import net.shapelight.modules.ten.entity.TenBuildEntity; import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.entity.TenCellEntity; import net.shapelight.modules.ten.service.TenCellDeptService;
import net.shapelight.modules.ten.entity.TenPersonEntity;
import net.shapelight.modules.ten.entity.TenRoomEntity;
import net.shapelight.modules.ten.service.TenPersonService; import net.shapelight.modules.ten.service.TenPersonService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -32,6 +31,7 @@ public class PersonExcelListener extends AnalysisEventListener<PersonModel> {
List<PersonModel> list = new ArrayList<>(); List<PersonModel> list = new ArrayList<>();
// private List<String> imagelist; // private List<String> imagelist;
private TenPersonService tenPersonService; private TenPersonService tenPersonService;
private TenCellDeptService tenCellDeptService;
private String tenantId; private String tenantId;
private Map<String,String> imageMap = new HashMap<>(); private Map<String,String> imageMap = new HashMap<>();
@ -51,10 +51,11 @@ public class PersonExcelListener extends AnalysisEventListener<PersonModel> {
* 如果使用了spring,请使用这个构造方法每次创建Listener的时候需要把spring管理的类传进来 * 如果使用了spring,请使用这个构造方法每次创建Listener的时候需要把spring管理的类传进来
*/ */
public PersonExcelListener(List<String> imagelist,TenPersonService tenPersonService, public PersonExcelListener(List<String> imagelist,TenPersonService tenPersonService,
String tenantId){ TenCellDeptService tenCellDeptService,String tenantId){
// this.tenStudentDao = tenStudentDao; // this.tenStudentDao = tenStudentDao;
this.tenPersonService = tenPersonService; this.tenPersonService = tenPersonService;
this.tenCellDeptService = tenCellDeptService;
this.tenantId = tenantId; this.tenantId = tenantId;
//this.imagelist = imagelist; //this.imagelist = imagelist;
String osName = System.getProperty("os.name");//获取指定键即os.name的系统属性,Windows 7 String osName = System.getProperty("os.name");//获取指定键即os.name的系统属性,Windows 7
@ -85,14 +86,22 @@ public class PersonExcelListener extends AnalysisEventListener<PersonModel> {
if(personModel.getName()==null if(personModel.getName()==null
|| personModel.getGender() == null || personModel.getGender() == null
|| personModel.getCellName() == null || personModel.getCellName() == null
|| personModel.getBuildName() == null || personModel.getDeptNameAll() == null){
|| personModel.getBuildUnit() == null // || personModel.getBuildName() == null
|| personModel.getRoomName() == null){ // || personModel.getBuildUnit() == null
// || personModel.getRoomName() == null){
personModel.setMessage("姓名,性别,小区,楼栋,单元,房间不能为空"); // personModel.setMessage("姓名,性别,小区,楼栋,单元,房间不能为空");
personModel.setMessage("姓名,性别,小区,组织不能为空");
list.add(personModel); list.add(personModel);
return; return;
} }
/**
*
* 姓名 性别 手机号 身份证号 小区名称 组织名称
* 张三 13200000001 352456199302121456 太白阁 一栋/二单元/3层/1002室
* 李四 103215199601125620 太白阁 一栋/二单元/3层/1002室
*/
TenCellEntity cellEntity = tenPersonService.findCellByCellName(personModel.getCellName(),tenantId); TenCellEntity cellEntity = tenPersonService.findCellByCellName(personModel.getCellName(),tenantId);
@ -102,46 +111,88 @@ public class PersonExcelListener extends AnalysisEventListener<PersonModel> {
return; return;
} }
String[] deptAll = personModel.getDeptNameAll().split("/");
TenBuildEntity tenBuildEntity = tenPersonService.findBuildByNameAndUnit(personModel.getBuildName(), Long parentId = cellEntity.getCellId();
personModel.getBuildUnit().replace("单元",""), if(deptAll.length>0 && deptAll.length<6){
cellEntity.getCellId()); for(int i = 0;i<deptAll.length;i++){
if (tenBuildEntity==null) { String deptName = deptAll[i];
personModel.setMessage("楼栋单元不存在"); List<TenCellDeptEntity> deviceEntity = tenCellDeptService.list(new QueryWrapper<TenCellDeptEntity>()
list.add(personModel); .eq("parent_id",parentId)
return; .eq("name",deptName));
if(deviceEntity.size()==0){
//不存在添加
//父部门
if(i == 0){
parentId = cellEntity.getCellId();
}else{
TenCellDeptEntity parent = tenCellDeptService.getOne(new QueryWrapper<TenCellDeptEntity>()
.eq("cell_id",cellEntity.getCellId())
.eq("parent_id",parentId)
.eq("name",deptName));
} }
TenRoomEntity tenRoomEntity = tenPersonService.findRoomByRoomName(personModel.getRoomName(), TenCellDeptEntity tenCellDept = new TenCellDeptEntity();
tenBuildEntity.getBuildId(), tenCellDept.setParentId(parentId);
cellEntity.getCellId()); tenCellDept.setName(deptName);
if(tenRoomEntity == null){ tenCellDept.setCellId(cellEntity.getCellId());
personModel.setMessage("房间不存在"); tenCellDept.setTenantId(cellEntity.getTenantId());
list.add(personModel); tenCellDeptService.save(tenCellDept);
return; parentId = tenCellDept.getDeptId();
personModel.setDeptId(tenCellDept.getDeptId());
}else{
//存在
TenCellDeptEntity deptEntity = deviceEntity.get(0);
parentId = deptEntity.getDeptId();
personModel.setDeptId(deptEntity.getDeptId());
} }
if(personModel.getName().trim().length()==0){
personModel.setMessage("姓名不能为空");
list.add(personModel);
return;
} }
}else{
TenPersonEntity tenPersonEntity = tenPersonService.findByName(personModel.getName(), personModel.setMessage("组织结构最多5层");
tenRoomEntity.getRoomId(),cellEntity.getCellId());
if(tenPersonEntity!=null){
personModel.setMessage("姓名在此房间已存在");
list.add(personModel); list.add(personModel);
return; return;
} }
TenPersonEntity tenPersonEntityIdCord = tenPersonService.findByIdCard(personModel.getIdCard(),
tenRoomEntity.getRoomId(),cellEntity.getCellId());
if(tenPersonEntityIdCord!=null){ // TenBuildEntity tenBuildEntity = tenPersonService.findBuildByNameAndUnit(personModel.getBuildName(),
personModel.setMessage("身份证在此房间已存在"); // personModel.getBuildUnit().replace("单元",""),
list.add(personModel); // cellEntity.getCellId());
return; // if (tenBuildEntity==null) {
} // personModel.setMessage("楼栋单元不存在");
// list.add(personModel);
// return;
// }
// TenRoomEntity tenRoomEntity = tenPersonService.findRoomByRoomName(personModel.getRoomName(),
// tenBuildEntity.getBuildId(),
// cellEntity.getCellId());
// if(tenRoomEntity == null){
// personModel.setMessage("房间不存在");
// list.add(personModel);
// return;
// }
// if(personModel.getName().trim().length()==0){
// personModel.setMessage("姓名不能为空");
// list.add(personModel);
// return;
// }
// TenPersonEntity tenPersonEntity = tenPersonService.findByName(personModel.getName(),
// tenRoomEntity.getRoomId(),cellEntity.getCellId());
// if(tenPersonEntity!=null){
// personModel.setMessage("姓名在此房间已存在");
// list.add(personModel);
// return;
// }
//
//
// TenPersonEntity tenPersonEntityIdCord = tenPersonService.findByIdCard(personModel.getIdCard(),
// tenRoomEntity.getRoomId(),cellEntity.getCellId());
// if(tenPersonEntityIdCord!=null){
// personModel.setMessage("身份证在此房间已存在");
// list.add(personModel);
// return;
// }
String gender = personModel.getGender(); String gender = personModel.getGender();
if(gender==null){ if(gender==null){
@ -206,10 +257,10 @@ public class PersonExcelListener extends AnalysisEventListener<PersonModel> {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
//门禁卡号 //门禁卡号
String doorCard = personModel.getDoorCard(); // String doorCard = personModel.getDoorCard();
if(doorCard!=null&&doorCard.length()>0){ // if(doorCard!=null&&doorCard.length()>0){
personModel.setDoorCard(doorCard); // personModel.setDoorCard(doorCard);
} // }
personModel.setStatus(1); personModel.setStatus(1);

View File

@ -26,17 +26,26 @@ public class PersonModel extends BaseRowModel implements Serializable {
@ExcelProperty(value = "小区名称", index = 4) @ExcelProperty(value = "小区名称", index = 4)
private String cellName; private String cellName;
@ExcelProperty(value = "楼栋名称", index = 5) @ExcelProperty(value = "组织名称", index = 5)
private String buildName; private String deptNameAll;
@ExcelProperty(value = "单元名称", index = 6) private Long deptId;
private String buildUnit;
@ExcelProperty(value = "房间名称", index = 7)
private String roomName;
@ExcelProperty(value = "门禁卡号", index = 8) // @ExcelProperty(value = "父级名称", index = 5)
private String doorCard; // private String parentDeptName;
// @ExcelProperty(value = "楼栋名称", index = 5)
// private String buildName;
//
// @ExcelProperty(value = "单元名称", index = 6)
// private String buildUnit;
//
// @ExcelProperty(value = "房间名称", index = 7)
// private String roomName;
//
// @ExcelProperty(value = "门禁卡号", index = 8)
// private String doorCard;
/** /**
* 原始头像 * 原始头像

View File

@ -3,6 +3,7 @@
package net.shapelight.modules.sys.controller; package net.shapelight.modules.sys.controller;
import cn.hutool.core.codec.Base64;
import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer; import com.google.code.kaptcha.Producer;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -134,6 +135,10 @@ public class SysLoginController extends AbstractController{
// return R.error("验证码不正确"); // return R.error("验证码不正确");
// } // }
//this.loginForm.password = base.encode('f4fab52d797e197c'+this.loginForm.password)
String p = Base64.decodeStr(form.getPassword());
p = p.substring(16);
form.setPassword(p);
//用户信息 //用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername()); SysUserEntity user = sysUserService.queryByUserName(form.getUsername());

View File

@ -139,7 +139,7 @@ public class SysUserController extends AbstractController {
user.setUserId(Long.valueOf(id)); user.setUserId(Long.valueOf(id));
user.setCreateBy(getUser().getUsername()); user.setCreateBy(getUser().getUsername());
user.setCreateTime(new Date()); user.setCreateTime(new Date());
user.setUserType(Integer.valueOf(1)); user.setUserType(Constant.SYSTEM_USER);
List<Long> roleIdList = new ArrayList<>(); List<Long> roleIdList = new ArrayList<>();
Long role = Long.valueOf(100L); Long role = Long.valueOf(100L);
roleIdList.add(role); roleIdList.add(role);
@ -161,7 +161,7 @@ public class SysUserController extends AbstractController {
SysUserEntity sysUserEntity = sysUserService.getById(user.getUserId()); SysUserEntity sysUserEntity = sysUserService.getById(user.getUserId());
if(sysUserEntity.getUserType() == Constant.SYSTEM_ADMIN){ if(sysUserEntity.getUserType() == Constant.SYSTEM_ADMIN){
if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){
return R.error("系统管理员禁止修改"); return R.error("平台超级管理员禁止修改");
} }
} }
sysUserService.update(user); sysUserService.update(user);
@ -177,7 +177,7 @@ public class SysUserController extends AbstractController {
@ApiOperation("删除用户根据userId数组") @ApiOperation("删除用户根据userId数组")
public R delete(@RequestBody Long[] userIds){ public R delete(@RequestBody Long[] userIds){
if(ArrayUtils.contains(userIds, 1L)){ if(ArrayUtils.contains(userIds, 1L)){
return R.error("系统管理员不能删除"); return R.error("平台超级管理员不能删除");
} }
if(ArrayUtils.contains(userIds, getUserId())){ if(ArrayUtils.contains(userIds, getUserId())){

View File

@ -18,12 +18,15 @@ public class SysDeviceLogServiceImpl extends ServiceImpl<SysDeviceLogDao, SysDev
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
String sn = (String)params.get("sn"); String sn = (String)params.get("sn");
if (sn!=null) {
sn = sn.trim();
}
String recordTimeStart = (String)params.get("recordTimeStart"); String recordTimeStart = (String)params.get("recordTimeStart");
String recordTimeEnd = (String)params.get("recordTimeEnd"); String recordTimeEnd = (String)params.get("recordTimeEnd");
IPage<SysDeviceLogEntity> page = this.page( IPage<SysDeviceLogEntity> page = this.page(
new Query<SysDeviceLogEntity>().getPage(params), new Query<SysDeviceLogEntity>().getPage(params),
new QueryWrapper<SysDeviceLogEntity>() new QueryWrapper<SysDeviceLogEntity>()
.like(!StringUtils.isNullOrEmpty(params.get("sn")),"sn",params.get("sn")) .like(!StringUtils.isNullOrEmpty(sn),"sn",sn)
.ge(!StringUtils.isNullOrEmpty(params.get("recordTimeStart")),"create_time",recordTimeStart) .ge(!StringUtils.isNullOrEmpty(params.get("recordTimeStart")),"create_time",recordTimeStart)
.le(!StringUtils.isNullOrEmpty(params.get("recordTimeEnd")),"create_time",recordTimeEnd) .le(!StringUtils.isNullOrEmpty(params.get("recordTimeEnd")),"create_time",recordTimeEnd)
.orderByDesc("create_time") .orderByDesc("create_time")

View File

@ -109,7 +109,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
* 查询平台用户 * 查询平台用户
*/ */
@Override @Override
@DataFilter(subDept = true, user = false) // @DataFilter(subDept = true, user = false)
//@Cacheable(value="sys_user", key="'page'") //@Cacheable(value="sys_user", key="'page'")
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
String username = (String) params.get("username"); String username = (String) params.get("username");

View File

@ -93,6 +93,13 @@ public class TenCellDeptController extends AbstractController {
@PostMapping("/save") @PostMapping("/save")
@RequiresPermissions("ten:celldept") @RequiresPermissions("ten:celldept")
public R save(@RequestBody TenCellDeptEntity tenCellDept){ public R save(@RequestBody TenCellDeptEntity tenCellDept){
int count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
.eq("cell_id",tenCellDept.getCellId())
.eq("parent_id",tenCellDept.getParentId())
.eq("name",tenCellDept.getName()));
if(count>0){
return R.error("组织名称已存在");
}
String deptAllName = tenCellDeptService.getAllParentName(tenCellDept.getParentId()); String deptAllName = tenCellDeptService.getAllParentName(tenCellDept.getParentId());
if(deptAllName!=null){ if(deptAllName!=null){
String dArray[] = deptAllName.split("/"); String dArray[] = deptAllName.split("/");
@ -113,6 +120,16 @@ public class TenCellDeptController extends AbstractController {
@PostMapping("/update") @PostMapping("/update")
@RequiresPermissions("ten:celldept") @RequiresPermissions("ten:celldept")
public R update(@RequestBody TenCellDeptEntity tenCellDept){ public R update(@RequestBody TenCellDeptEntity tenCellDept){
TenCellDeptEntity old = tenCellDeptService.getById(tenCellDept.getDeptId());
if(!old.getName().equals(tenCellDept.getName())){
int count = tenCellDeptService.count(new QueryWrapper<TenCellDeptEntity>()
.eq("cell_id",tenCellDept.getCellId())
.eq("parent_id",tenCellDept.getParentId())
.eq("name",tenCellDept.getName()));
if(count>0){
return R.error("组织名称已存在");
}
}
tenCellDept.setLastUpdateBy(getUser().getUsername()); tenCellDept.setLastUpdateBy(getUser().getUsername());
tenCellDept.setLastUpdateTime(new Date()); tenCellDept.setLastUpdateTime(new Date());
if(tenCellDept.getDeptId().longValue() == tenCellDept.getParentId().longValue()){ if(tenCellDept.getDeptId().longValue() == tenCellDept.getParentId().longValue()){

View File

@ -83,7 +83,7 @@ public class TenPackController extends AbstractController {
tenPackEntitys = tenPackService.list(new QueryWrapper<TenPackEntity>() tenPackEntitys = tenPackService.list(new QueryWrapper<TenPackEntity>()
.eq("park_code_xa",tenPack.getParkCodeXa())); .eq("park_code_xa",tenPack.getParkCodeXa()));
if(tenPackEntitys.size()>0){ if(tenPackEntitys.size()>0){
return R.error("停车场对接编码已注册"); return R.error("停车场西安对接编码已注册");
} }
} }
this.tenPackService.save(tenPack); this.tenPackService.save(tenPack);

View File

@ -372,11 +372,16 @@ public class TenPersonController extends AbstractController {
if(tenPerson.getIdCard()!=null){ if(tenPerson.getIdCard()!=null){
TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), // TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(),
tenPerson.getRoomId(),tenPerson.getCellId()); // tenPerson.getRoomId(),tenPerson.getCellId());
if(tenPersonIdcard!=null){ // if(tenPersonIdcard!=null){
return R.error("身份证在此房间已存在"); // return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
} }
} }
@ -428,10 +433,14 @@ public class TenPersonController extends AbstractController {
if(tenPerson.getIdCard()!=null){ if(tenPerson.getIdCard()!=null){
TenPersonEntity oldPerson = tenPersonService.getById(tenPerson.getPersonId(),tenPerson.getCellId()); TenPersonEntity oldPerson = tenPersonService.getById(tenPerson.getPersonId(),tenPerson.getCellId());
if(!tenPerson.getIdCard().equals(oldPerson.getIdCard())){ if(!tenPerson.getIdCard().equals(oldPerson.getIdCard())){
TenPersonEntity tenPersonEntityIdCard = tenPersonService.findByIdCard(tenPerson.getIdCard(), // TenPersonEntity tenPersonEntityIdCard = tenPersonService.findByIdCard(tenPerson.getIdCard(),
oldPerson.getRoomId(),oldPerson.getCellId()); // oldPerson.getRoomId(),oldPerson.getCellId());
if(tenPersonEntityIdCard!=null){ // if(tenPersonEntityIdCard!=null){
return R.error("身份证在此房间已存在"); // return R.error("身份证在此房间已存在");
// }
List<TenPersonEntity> list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId());
if(list.size()>0){
return R.error("身份证在此组织已存在");
} }
} }
} }

View File

@ -195,7 +195,7 @@ public class TenUserController extends AbstractController {
user.setTenantId(getUser().getTenantId()); user.setTenantId(getUser().getTenantId());
if(user.getUserType() == Constant.TENANT_ADMIN){ if(user.getUserType() == Constant.TENANT_ADMIN){
if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){
return R.error("系统管理员禁止修改"); return R.error("超级管理员禁止修改");
} }
} }
SysUserEntity entity = sysUserService.getById(user.getUserId()); SysUserEntity entity = sysUserService.getById(user.getUserId());
@ -233,7 +233,7 @@ public class TenUserController extends AbstractController {
user.setTenantId(getUser().getTenantId()); user.setTenantId(getUser().getTenantId());
if(user.getUserType() == Constant.TENANT_ADMIN){ if(user.getUserType() == Constant.TENANT_ADMIN){
if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){
return R.error("系统管理员禁止修改"); return R.error("超级管理员禁止修改");
} }
} }
if(user.getUserId().longValue() == getUserId().longValue()){ if(user.getUserId().longValue() == getUserId().longValue()){
@ -255,7 +255,7 @@ public class TenUserController extends AbstractController {
user.setTenantId(getUser().getTenantId()); user.setTenantId(getUser().getTenantId());
if(user.getUserType() == Constant.TENANT_ADMIN){ if(user.getUserType() == Constant.TENANT_ADMIN){
if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){
return R.error("系统管理员禁止修改"); return R.error("超级管理员禁止修改");
} }
} }
if (StringUtils.isBlank(user.getPassword())) { if (StringUtils.isBlank(user.getPassword())) {

View File

@ -114,5 +114,9 @@ public interface TenPersonDao {
TenPersonEntity getByIdWithDelete(@Param("personId")Long personId); TenPersonEntity getByIdWithDelete(@Param("personId")Long personId);
IPage<TenPersonEntity> findExtractPageAll(Page page, @Param("cellIds") List<Long> cellIds,@Param("params") Map params);
List<TenPersonEntity> findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId);
} }

View File

@ -142,5 +142,10 @@ public interface TenPersonService {
TenPersonEntity getByIdWithDelete(Long id); TenPersonEntity getByIdWithDelete(Long id);
PageUtils queryExtractPage(Map<String, Object> params);
List<TenPersonEntity> findByIdCardAndDept(String idCard,
Long deptId);
} }

View File

@ -96,6 +96,8 @@ public class TenPersonServiceImpl implements TenPersonService {
String areaIdStr = (String) params.get("areaId"); String areaIdStr = (String) params.get("areaId");
String cellIdStr = (String) params.get("cellId"); String cellIdStr = (String) params.get("cellId");
String faceFailure = (String) params.get("faceFailure");
if (areaIdStr != null && !areaIdStr.isEmpty() && (cellIdStr == null || cellIdStr.isEmpty())) { if (areaIdStr != null && !areaIdStr.isEmpty() && (cellIdStr == null || cellIdStr.isEmpty())) {
Long areaId = Long.parseLong(areaIdStr); Long areaId = Long.parseLong(areaIdStr);
//子区域 //子区域
@ -122,7 +124,13 @@ public class TenPersonServiceImpl implements TenPersonService {
Page pageParam = new Page(); Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page"))); pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit"))); pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<TenPersonEntity> page = tenPersonDao.findPageAll(pageParam, cellIds, params); IPage<TenPersonEntity> page = null;
if(faceFailure!=null && faceFailure.equals("1")){
page = tenPersonDao.findExtractPageAll(pageParam, cellIds, params);
}else{
page = tenPersonDao.findPageAll(pageParam, cellIds, params);
}
for (TenPersonEntity personEntity : page.getRecords()) { for (TenPersonEntity personEntity : page.getRecords()) {
List<TenPersonExtractEntity> extracts = tenPersonExtractService.list( List<TenPersonExtractEntity> extracts = tenPersonExtractService.list(
new QueryWrapper<TenPersonExtractEntity>() new QueryWrapper<TenPersonExtractEntity>()
@ -1816,7 +1824,7 @@ public class TenPersonServiceImpl implements TenPersonService {
List<PersonModel> list = new ArrayList<>(); List<PersonModel> list = new ArrayList<>();
for (String excelFileStr : excelFiles) { for (String excelFileStr : excelFiles) {
BufferedInputStream excelStream = null; BufferedInputStream excelStream = null;
PersonExcelListener listener = new PersonExcelListener(imageFiles, this, tenantId); PersonExcelListener listener = new PersonExcelListener(imageFiles, this, this.tenCellDeptService,tenantId);
try { try {
excelStream = new BufferedInputStream(new FileInputStream(excelFileStr)); excelStream = new BufferedInputStream(new FileInputStream(excelFileStr));
EasyExcelFactory.readBySax(excelStream, new Sheet(1, 1, PersonModel.class), listener); EasyExcelFactory.readBySax(excelStream, new Sheet(1, 1, PersonModel.class), listener);
@ -1872,16 +1880,18 @@ public class TenPersonServiceImpl implements TenPersonService {
TenCellEntity cellEntity = findCellByCellName(personModel.getCellName(), personModel.getTenantId()); TenCellEntity cellEntity = findCellByCellName(personModel.getCellName(), personModel.getTenantId());
TenBuildEntity tenBuildEntity = findBuildByNameAndUnit(personModel.getBuildName(), // TenBuildEntity tenBuildEntity = findBuildByNameAndUnit(personModel.getBuildName(),
personModel.getBuildUnit().replace("单元", ""), // personModel.getBuildUnit().replace("单元", ""),
cellEntity.getCellId()); // cellEntity.getCellId());
TenRoomEntity tenRoomEntity = findRoomByRoomName(personModel.getRoomName(), // TenRoomEntity tenRoomEntity = findRoomByRoomName(personModel.getRoomName(),
tenBuildEntity.getBuildId(), // tenBuildEntity.getBuildId(),
cellEntity.getCellId()); // cellEntity.getCellId());
tenPerson.setCellId(cellEntity.getCellId()); tenPerson.setCellId(cellEntity.getCellId());
tenPerson.setBuildId(tenBuildEntity.getBuildId()); // tenPerson.setBuildId(tenBuildEntity.getBuildId());
tenPerson.setRoomId(tenRoomEntity.getRoomId()); // tenPerson.setRoomId(tenRoomEntity.getRoomId());
tenPerson.setDeptId(personModel.getDeptId());
cellId = cellEntity.getCellId(); cellId = cellEntity.getCellId();
@ -2057,13 +2067,13 @@ public class TenPersonServiceImpl implements TenPersonService {
tenPersonDao.insert(tenPerson); tenPersonDao.insert(tenPerson);
//门禁表 //门禁表
if (personModel.getDoorCard() != null && personModel.getDoorCard().length() > 0) { // if (personModel.getDoorCard() != null && personModel.getDoorCard().length() > 0) {
TenDoorCardEntity doorCardEntity = new TenDoorCardEntity(); // TenDoorCardEntity doorCardEntity = new TenDoorCardEntity();
doorCardEntity.setDoorCard(personModel.getDoorCard()); // doorCardEntity.setDoorCard(personModel.getDoorCard());
doorCardEntity.setCellId(tenPerson.getCellId()); // doorCardEntity.setCellId(tenPerson.getCellId());
doorCardEntity.setPersonId(tenPerson.getPersonId()); // doorCardEntity.setPersonId(tenPerson.getPersonId());
tenDoorCardService.save(doorCardEntity); // tenDoorCardService.save(doorCardEntity);
} // }
//添加到同步表 //添加到同步表
@ -2309,4 +2319,69 @@ public class TenPersonServiceImpl implements TenPersonService {
public TenPersonEntity getByIdWithDelete(Long id) { public TenPersonEntity getByIdWithDelete(Long id) {
return tenPersonDao.getByIdWithDelete(id); return tenPersonDao.getByIdWithDelete(id);
} }
@Override
public PageUtils queryExtractPage(Map<String, Object> params) {
List<Long> cellIds = new ArrayList<>();
// cellIds.add(709832651506188289L);
String areaIdStr = (String) params.get("areaId");
String cellIdStr = (String) params.get("cellId");
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 PageUtils(new ArrayList<>(), 0, 0, 0);
}
Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<TenPersonEntity> page = tenPersonDao.findPageAll(pageParam, cellIds, params);
for (TenPersonEntity personEntity : page.getRecords()) {
List<TenPersonExtractEntity> extracts = tenPersonExtractService.list(
new QueryWrapper<TenPersonExtractEntity>()
.eq("person_id", personEntity.getPersonId())
);
if (extracts != null) {
personEntity.setExtractCount(extracts.size());
personEntity.setExtractList(extracts);
} else {
personEntity.setExtractCount(0);
personEntity.setExtractList(new ArrayList<>());
}
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 new PageUtils(page);
}
@Override
public List<TenPersonEntity> findByIdCardAndDept(String idCard, Long deptId) {
return tenPersonDao.findByIdCardAndDept(idCard,deptId);
}
} }

View File

@ -1219,7 +1219,57 @@
</select> </select>
<select id="findExtractPageAll" resultMap="BaseResultMap">
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 * from ten_person
where dept_id = #{deptId} and delete_flag = 0
and id_card = #{idCard}
</select>
</mapper> </mapper>

View File

@ -630,9 +630,10 @@
<if test="params.deptId != null and params.deptId!=''"> <if test="params.deptId != null and params.deptId!=''">
and t.dept_id = #{params.deptId} and t.dept_id = #{params.deptId}
</if> </if>
order by record_time desc) as rec left join ten_device d on rec.device_sn = d.sn ) as rec left join ten_device d on rec.device_sn = d.sn
where d.tenant_id = #{params.tenantId} where d.tenant_id = #{params.tenantId}
and d.delete_flag = 0 and d.delete_flag = 0
order by rec.record_time desc
</select> </select>