diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java index ac051e5..e99dadd 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java @@ -158,10 +158,14 @@ public class AppApiController { } if(tenPerson.getIdCard()!=null){ - TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), - tenPerson.getRoomId(),tenPerson.getCellId()); - if(tenPersonIdcard!=null){ - return R.error("身份证在此房间已存在"); +// TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), +// tenPerson.getRoomId(),tenPerson.getCellId()); +// if(tenPersonIdcard!=null){ +// return R.error("身份证在此房间已存在"); +// } + List 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){ - TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), - tenPerson.getRoomId(),tenPerson.getCellId()); - if(tenPersonIdcard!=null){ - return R.error("身份证在此房间已存在"); +// TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), +// tenPerson.getRoomId(),tenPerson.getCellId()); +// if(tenPersonIdcard!=null){ +// return R.error("身份证在此房间已存在"); +// } + List list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),tenPerson.getDeptId()); + if(list.size()>0){ + return R.error("身份证在此组织已存在"); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java b/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java index 8b7f38a..4bd4d80 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java @@ -3,16 +3,15 @@ package net.shapelight.modules.excel.listener; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.minio.PutObjectOptions; import lombok.Getter; import net.shapelight.common.utils.R; import net.shapelight.common.utils.UUIDUtil; import net.shapelight.commons.engine.sdk.PicSDK; import net.shapelight.modules.excel.model.PersonModel; -import net.shapelight.modules.ten.entity.TenBuildEntity; -import net.shapelight.modules.ten.entity.TenCellEntity; -import net.shapelight.modules.ten.entity.TenPersonEntity; -import net.shapelight.modules.ten.entity.TenRoomEntity; +import net.shapelight.modules.ten.entity.*; +import net.shapelight.modules.ten.service.TenCellDeptService; import net.shapelight.modules.ten.service.TenPersonService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,6 +31,7 @@ public class PersonExcelListener extends AnalysisEventListener { List list = new ArrayList<>(); // private List imagelist; private TenPersonService tenPersonService; + private TenCellDeptService tenCellDeptService; private String tenantId; private Map imageMap = new HashMap<>(); @@ -51,10 +51,11 @@ public class PersonExcelListener extends AnalysisEventListener { * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 */ public PersonExcelListener(List imagelist,TenPersonService tenPersonService, - String tenantId){ + TenCellDeptService tenCellDeptService,String tenantId){ // this.tenStudentDao = tenStudentDao; this.tenPersonService = tenPersonService; + this.tenCellDeptService = tenCellDeptService; this.tenantId = tenantId; //this.imagelist = imagelist; String osName = System.getProperty("os.name");//获取指定键(即os.name)的系统属性,如:Windows 7。 @@ -85,14 +86,22 @@ public class PersonExcelListener extends AnalysisEventListener { if(personModel.getName()==null || personModel.getGender() == null || personModel.getCellName() == null - || personModel.getBuildName() == null - || personModel.getBuildUnit() == null - || personModel.getRoomName() == null){ + || personModel.getDeptNameAll() == null){ +// || personModel.getBuildName() == null +// || personModel.getBuildUnit() == null +// || personModel.getRoomName() == null){ - personModel.setMessage("姓名,性别,小区,楼栋,单元,房间不能为空"); +// personModel.setMessage("姓名,性别,小区,楼栋,单元,房间不能为空"); + personModel.setMessage("姓名,性别,小区,组织不能为空"); list.add(personModel); return; } + /** + * + * 姓名 性别 手机号 身份证号 小区名称 组织名称 + * 张三 男 13200000001 352456199302121456 太白阁 一栋/二单元/3层/1002室 + * 李四 男 103215199601125620 太白阁 一栋/二单元/3层/1002室 + */ TenCellEntity cellEntity = tenPersonService.findCellByCellName(personModel.getCellName(),tenantId); @@ -102,46 +111,88 @@ public class PersonExcelListener extends AnalysisEventListener { return; } - - TenBuildEntity tenBuildEntity = tenPersonService.findBuildByNameAndUnit(personModel.getBuildName(), - personModel.getBuildUnit().replace("单元",""), - cellEntity.getCellId()); - 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("姓名在此房间已存在"); + String[] deptAll = personModel.getDeptNameAll().split("/"); + Long parentId = cellEntity.getCellId(); + if(deptAll.length>0 && deptAll.length<6){ + for(int i = 0;i deviceEntity = tenCellDeptService.list(new QueryWrapper() + .eq("parent_id",parentId) + .eq("name",deptName)); + if(deviceEntity.size()==0){ + //不存在,添加 + //父部门: + if(i == 0){ + parentId = cellEntity.getCellId(); + }else{ + TenCellDeptEntity parent = tenCellDeptService.getOne(new QueryWrapper() + .eq("cell_id",cellEntity.getCellId()) + .eq("parent_id",parentId) + .eq("name",deptName)); + } + TenCellDeptEntity tenCellDept = new TenCellDeptEntity(); + tenCellDept.setParentId(parentId); + tenCellDept.setName(deptName); + tenCellDept.setCellId(cellEntity.getCellId()); + tenCellDept.setTenantId(cellEntity.getTenantId()); + tenCellDeptService.save(tenCellDept); + parentId = tenCellDept.getDeptId(); + personModel.setDeptId(tenCellDept.getDeptId()); + }else{ + //存在 + TenCellDeptEntity deptEntity = deviceEntity.get(0); + parentId = deptEntity.getDeptId(); + personModel.setDeptId(deptEntity.getDeptId()); + } + } + }else{ + personModel.setMessage("组织结构最多5层"); list.add(personModel); return; } - TenPersonEntity tenPersonEntityIdCord = tenPersonService.findByIdCard(personModel.getIdCard(), - tenRoomEntity.getRoomId(),cellEntity.getCellId()); - if(tenPersonEntityIdCord!=null){ - personModel.setMessage("身份证在此房间已存在"); - list.add(personModel); - return; - } + + +// TenBuildEntity tenBuildEntity = tenPersonService.findBuildByNameAndUnit(personModel.getBuildName(), +// personModel.getBuildUnit().replace("单元",""), +// cellEntity.getCellId()); +// 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(); if(gender==null){ @@ -206,10 +257,10 @@ public class PersonExcelListener extends AnalysisEventListener { //--------------------------------------------------------------------- //门禁卡号 - String doorCard = personModel.getDoorCard(); - if(doorCard!=null&&doorCard.length()>0){ - personModel.setDoorCard(doorCard); - } +// String doorCard = personModel.getDoorCard(); +// if(doorCard!=null&&doorCard.length()>0){ +// personModel.setDoorCard(doorCard); +// } personModel.setStatus(1); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/excel/model/PersonModel.java b/shapelight-admin/src/main/java/net/shapelight/modules/excel/model/PersonModel.java index 8a7d3b1..4521c6d 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/excel/model/PersonModel.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/excel/model/PersonModel.java @@ -26,17 +26,26 @@ public class PersonModel extends BaseRowModel implements Serializable { @ExcelProperty(value = "小区名称", index = 4) private String cellName; - @ExcelProperty(value = "楼栋名称", index = 5) - private String buildName; + @ExcelProperty(value = "组织名称", index = 5) + private String deptNameAll; - @ExcelProperty(value = "单元名称", index = 6) - private String buildUnit; + private Long deptId; - @ExcelProperty(value = "房间名称", index = 7) - private String roomName; - @ExcelProperty(value = "门禁卡号", index = 8) - private String doorCard; +// @ExcelProperty(value = "父级名称", index = 5) +// 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; /** * 原始头像 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysLoginController.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysLoginController.java index 7d09505..7a59b58 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysLoginController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysLoginController.java @@ -3,6 +3,7 @@ package net.shapelight.modules.sys.controller; +import cn.hutool.core.codec.Base64; import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Producer; import io.swagger.annotations.*; @@ -134,6 +135,10 @@ public class SysLoginController extends AbstractController{ // 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()); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java index ed48ef8..1a92fab 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java @@ -139,7 +139,7 @@ public class SysUserController extends AbstractController { user.setUserId(Long.valueOf(id)); user.setCreateBy(getUser().getUsername()); user.setCreateTime(new Date()); - user.setUserType(Integer.valueOf(1)); + user.setUserType(Constant.SYSTEM_USER); List roleIdList = new ArrayList<>(); Long role = Long.valueOf(100L); roleIdList.add(role); @@ -161,7 +161,7 @@ public class SysUserController extends AbstractController { SysUserEntity sysUserEntity = sysUserService.getById(user.getUserId()); if(sysUserEntity.getUserType() == Constant.SYSTEM_ADMIN){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ - return R.error("系统管理员禁止修改"); + return R.error("平台超级管理员禁止修改"); } } sysUserService.update(user); @@ -177,7 +177,7 @@ public class SysUserController extends AbstractController { @ApiOperation("删除用户(根据userId数组)") public R delete(@RequestBody Long[] userIds){ if(ArrayUtils.contains(userIds, 1L)){ - return R.error("系统管理员不能删除"); + return R.error("平台超级管理员不能删除"); } if(ArrayUtils.contains(userIds, getUserId())){ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysDeviceLogServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysDeviceLogServiceImpl.java index dd737c5..b949836 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysDeviceLogServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysDeviceLogServiceImpl.java @@ -18,12 +18,15 @@ public class SysDeviceLogServiceImpl extends ServiceImpl params) { String sn = (String)params.get("sn"); + if (sn!=null) { + sn = sn.trim(); + } String recordTimeStart = (String)params.get("recordTimeStart"); String recordTimeEnd = (String)params.get("recordTimeEnd"); IPage page = this.page( new Query().getPage(params), new QueryWrapper() - .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) .le(!StringUtils.isNullOrEmpty(params.get("recordTimeEnd")),"create_time",recordTimeEnd) .orderByDesc("create_time") diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java index 33a9b60..84a2cab 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java @@ -109,7 +109,7 @@ public class SysUserServiceImpl extends ServiceImpl i * 查询平台用户 */ @Override - @DataFilter(subDept = true, user = false) +// @DataFilter(subDept = true, user = false) //@Cacheable(value="sys_user", key="'page'") public PageUtils queryPage(Map params) { String username = (String) params.get("username"); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java index 8197d86..95060f0 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCellDeptController.java @@ -93,6 +93,13 @@ public class TenCellDeptController extends AbstractController { @PostMapping("/save") @RequiresPermissions("ten:celldept") public R save(@RequestBody TenCellDeptEntity tenCellDept){ + int count = tenCellDeptService.count(new QueryWrapper() + .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()); if(deptAllName!=null){ String dArray[] = deptAllName.split("/"); @@ -113,6 +120,16 @@ public class TenCellDeptController extends AbstractController { @PostMapping("/update") @RequiresPermissions("ten:celldept") public R update(@RequestBody TenCellDeptEntity tenCellDept){ + TenCellDeptEntity old = tenCellDeptService.getById(tenCellDept.getDeptId()); + if(!old.getName().equals(tenCellDept.getName())){ + int count = tenCellDeptService.count(new QueryWrapper() + .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.setLastUpdateTime(new Date()); if(tenCellDept.getDeptId().longValue() == tenCellDept.getParentId().longValue()){ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java index 90dd826..ceeda97 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java @@ -83,7 +83,7 @@ public class TenPackController extends AbstractController { tenPackEntitys = tenPackService.list(new QueryWrapper() .eq("park_code_xa",tenPack.getParkCodeXa())); if(tenPackEntitys.size()>0){ - return R.error("停车场对接编码已注册"); + return R.error("停车场西安对接编码已注册"); } } this.tenPackService.save(tenPack); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java index 451b682..dbfe2aa 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java @@ -372,11 +372,16 @@ public class TenPersonController extends AbstractController { if(tenPerson.getIdCard()!=null){ - TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), - tenPerson.getRoomId(),tenPerson.getCellId()); - if(tenPersonIdcard!=null){ - return R.error("身份证在此房间已存在"); +// TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), +// tenPerson.getRoomId(),tenPerson.getCellId()); +// if(tenPersonIdcard!=null){ +// return R.error("身份证在此房间已存在"); +// } + List 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){ TenPersonEntity oldPerson = tenPersonService.getById(tenPerson.getPersonId(),tenPerson.getCellId()); if(!tenPerson.getIdCard().equals(oldPerson.getIdCard())){ - TenPersonEntity tenPersonEntityIdCard = tenPersonService.findByIdCard(tenPerson.getIdCard(), - oldPerson.getRoomId(),oldPerson.getCellId()); - if(tenPersonEntityIdCard!=null){ - return R.error("身份证在此房间已存在"); +// TenPersonEntity tenPersonEntityIdCard = tenPersonService.findByIdCard(tenPerson.getIdCard(), +// oldPerson.getRoomId(),oldPerson.getCellId()); +// if(tenPersonEntityIdCard!=null){ +// return R.error("身份证在此房间已存在"); +// } + List list = tenPersonService.findByIdCardAndDept(tenPerson.getIdCard(),oldPerson.getDeptId()); + if(list.size()>0){ + return R.error("身份证在此组织已存在"); } } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenUserController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenUserController.java index 1c42955..ed3a1c4 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenUserController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenUserController.java @@ -195,7 +195,7 @@ public class TenUserController extends AbstractController { user.setTenantId(getUser().getTenantId()); if(user.getUserType() == Constant.TENANT_ADMIN){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ - return R.error("系统管理员禁止修改"); + return R.error("超级管理员禁止修改"); } } SysUserEntity entity = sysUserService.getById(user.getUserId()); @@ -233,7 +233,7 @@ public class TenUserController extends AbstractController { user.setTenantId(getUser().getTenantId()); if(user.getUserType() == Constant.TENANT_ADMIN){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ - return R.error("系统管理员禁止修改"); + return R.error("超级管理员禁止修改"); } } if(user.getUserId().longValue() == getUserId().longValue()){ @@ -255,7 +255,7 @@ public class TenUserController extends AbstractController { user.setTenantId(getUser().getTenantId()); if(user.getUserType() == Constant.TENANT_ADMIN){ if(user.getUserId().longValue()!=(getUser().getUserId()).longValue()){ - return R.error("系统管理员禁止修改"); + return R.error("超级管理员禁止修改"); } } if (StringUtils.isBlank(user.getPassword())) { diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java index e431314..274fd2d 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java @@ -114,5 +114,9 @@ public interface TenPersonDao { TenPersonEntity getByIdWithDelete(@Param("personId")Long personId); + IPage findExtractPageAll(Page page, @Param("cellIds") List cellIds,@Param("params") Map params); + + List findByIdCardAndDept(@Param("idCard")String idCard, @Param("deptId")Long deptId); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java index 8571635..c4711ae 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java @@ -142,5 +142,10 @@ public interface TenPersonService { TenPersonEntity getByIdWithDelete(Long id); + PageUtils queryExtractPage(Map params); + + List findByIdCardAndDept(String idCard, + Long deptId); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java index c229e8d..b14d226 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java @@ -96,6 +96,8 @@ public class TenPersonServiceImpl implements TenPersonService { 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); //子区域 @@ -122,7 +124,13 @@ public class TenPersonServiceImpl implements TenPersonService { Page pageParam = new Page(); pageParam.setCurrent(Long.parseLong((String) params.get("page"))); pageParam.setSize(Long.parseLong((String) params.get("limit"))); - IPage page = tenPersonDao.findPageAll(pageParam, cellIds, params); + IPage 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()) { List extracts = tenPersonExtractService.list( new QueryWrapper() @@ -1816,7 +1824,7 @@ public class TenPersonServiceImpl implements TenPersonService { List list = new ArrayList<>(); for (String excelFileStr : excelFiles) { BufferedInputStream excelStream = null; - PersonExcelListener listener = new PersonExcelListener(imageFiles, this, tenantId); + PersonExcelListener listener = new PersonExcelListener(imageFiles, this, this.tenCellDeptService,tenantId); try { excelStream = new BufferedInputStream(new FileInputStream(excelFileStr)); 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()); - TenBuildEntity tenBuildEntity = findBuildByNameAndUnit(personModel.getBuildName(), - personModel.getBuildUnit().replace("单元", ""), - cellEntity.getCellId()); - TenRoomEntity tenRoomEntity = findRoomByRoomName(personModel.getRoomName(), - tenBuildEntity.getBuildId(), - cellEntity.getCellId()); +// TenBuildEntity tenBuildEntity = findBuildByNameAndUnit(personModel.getBuildName(), +// personModel.getBuildUnit().replace("单元", ""), +// cellEntity.getCellId()); +// TenRoomEntity tenRoomEntity = findRoomByRoomName(personModel.getRoomName(), +// tenBuildEntity.getBuildId(), +// cellEntity.getCellId()); tenPerson.setCellId(cellEntity.getCellId()); - tenPerson.setBuildId(tenBuildEntity.getBuildId()); - tenPerson.setRoomId(tenRoomEntity.getRoomId()); +// tenPerson.setBuildId(tenBuildEntity.getBuildId()); +// tenPerson.setRoomId(tenRoomEntity.getRoomId()); + tenPerson.setDeptId(personModel.getDeptId()); + cellId = cellEntity.getCellId(); @@ -2057,13 +2067,13 @@ public class TenPersonServiceImpl implements TenPersonService { tenPersonDao.insert(tenPerson); //门禁表 - if (personModel.getDoorCard() != null && personModel.getDoorCard().length() > 0) { - TenDoorCardEntity doorCardEntity = new TenDoorCardEntity(); - doorCardEntity.setDoorCard(personModel.getDoorCard()); - doorCardEntity.setCellId(tenPerson.getCellId()); - doorCardEntity.setPersonId(tenPerson.getPersonId()); - tenDoorCardService.save(doorCardEntity); - } +// if (personModel.getDoorCard() != null && personModel.getDoorCard().length() > 0) { +// TenDoorCardEntity doorCardEntity = new TenDoorCardEntity(); +// doorCardEntity.setDoorCard(personModel.getDoorCard()); +// doorCardEntity.setCellId(tenPerson.getCellId()); +// doorCardEntity.setPersonId(tenPerson.getPersonId()); +// tenDoorCardService.save(doorCardEntity); +// } //添加到同步表, @@ -2309,4 +2319,69 @@ public class TenPersonServiceImpl implements TenPersonService { public TenPersonEntity getByIdWithDelete(Long id) { return tenPersonDao.getByIdWithDelete(id); } + + @Override + public PageUtils queryExtractPage(Map params) { + List 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 allArea = tenAreaService.getSubAreaIdList(areaId); + //本区域 + allArea.add(areaId); + List cellList = tenCellService.list(new QueryWrapper() + .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 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 page = tenPersonDao.findPageAll(pageParam, cellIds, params); + for (TenPersonEntity personEntity : page.getRecords()) { + List extracts = tenPersonExtractService.list( + new QueryWrapper() + .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 findByIdCardAndDept(String idCard, Long deptId) { + return tenPersonDao.findByIdCardAndDept(idCard,deptId); + } } diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml index 868c581..a343471 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml @@ -1219,7 +1219,57 @@ + + + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml index 66e78ac..012d62e 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml @@ -630,9 +630,10 @@ and t.dept_id = #{params.deptId} - 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} and d.delete_flag = 0 + order by rec.record_time desc