diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerCommunityManageUserListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerCommunityManageUserListFormDTO.java new file mode 100755 index 0000000000..9970b1e5de --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerCommunityManageUserListFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 社区治理人员 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-27 + */ +@Data +public class CustomerCommunityManageUserListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNo; + + private Integer pageSize; + + private String agencyId; + + private String level; + + private String staffId; + + private String communityId; + + private Integer type; + + private String name; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridManageUserListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridManageUserListFormDTO.java index 4fac1d9b49..a7c958e69b 100755 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridManageUserListFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridManageUserListFormDTO.java @@ -27,4 +27,11 @@ public class CustomerGridManageUserListFormDTO implements Serializable { private String staffId; + private String gridId; + + private Integer type; + + private String name; + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerCommunityManageUserController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerCommunityManageUserController.java index 5e1e20ca43..707ed01ef0 100755 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerCommunityManageUserController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerCommunityManageUserController.java @@ -1,7 +1,9 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -10,6 +12,8 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.CustomerCommunityManageUserDTO; +import com.epmet.dto.form.CustomerCommunityManageUserListFormDTO; +import com.epmet.dto.form.CustomerGridManageUserListFormDTO; import com.epmet.excel.CustomerCommunityManageUserExcel; import com.epmet.service.CustomerCommunityManageUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -34,8 +38,9 @@ public class CustomerCommunityManageUserController { private CustomerCommunityManageUserService customerCommunityManageUserService; @RequestMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = customerCommunityManageUserService.page(params); + public Result> page(@LoginUser TokenDto tokenDto, @RequestBody CustomerCommunityManageUserListFormDTO dto){ + dto.setStaffId(tokenDto.getUserId()); + PageData page = customerCommunityManageUserService.page(dto); return new Result>().ok(page); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerCommunityManageUserService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerCommunityManageUserService.java index ceba800ea2..54640e2457 100755 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerCommunityManageUserService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerCommunityManageUserService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.CustomerCommunityManageUserDTO; +import com.epmet.dto.form.CustomerCommunityManageUserListFormDTO; import com.epmet.entity.CustomerCommunityManageUserEntity; import java.util.List; @@ -19,12 +20,12 @@ public interface CustomerCommunityManageUserService extends BaseService * @author generator * @date 2023-11-27 */ - PageData page(Map params); + PageData page(CustomerCommunityManageUserListFormDTO dto); /** * 默认查询 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerCommunityManageUserServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerCommunityManageUserServiceImpl.java index 5b4fb524e8..5c0137ca93 100755 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerCommunityManageUserServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerCommunityManageUserServiceImpl.java @@ -4,14 +4,24 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerCommunityManageUserDao; +import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dto.CustomerCommunityManageUserDTO; +import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.CustomerCommunityManageUserListFormDTO; +import com.epmet.dto.result.CustomerGridManageUserListDTO; +import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerCommunityManageUserEntity; +import com.epmet.entity.CustomerGridManageUserEntity; import com.epmet.redis.CustomerCommunityManageUserRedis; import com.epmet.service.CustomerCommunityManageUserService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 社区治理人员 @@ -32,14 +43,51 @@ public class CustomerCommunityManageUserServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, CustomerCommunityManageUserDTO.class); + public PageData page(CustomerCommunityManageUserListFormDTO dto) { + + CustomerStaffAgencyDTO customerStaffAgencyDTO = customerStaffAgencyDao.selectLatestCustomerByStaff(dto.getStaffId()); + if (customerStaffAgencyDTO == null ){ + throw new EpmetException("未查询到工作人员信息"+dto.getStaffId()); + } + + CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(customerStaffAgencyDTO.getAgencyId()); + + LambdaQueryWrapper resultLQ = new LambdaQueryWrapper<>(); + + if (customerAgencyEntity.getLevel().equals("community")){ + + resultLQ.eq(CustomerCommunityManageUserEntity::getCommunityId,customerAgencyEntity.getId()); + + }else{ + LambdaQueryWrapper agencyLq = new LambdaQueryWrapper() + .like(CustomerAgencyEntity::getPids,customerAgencyEntity.getId()).eq(CustomerAgencyEntity::getLevel,"community"); + List agencyListIds = customerAgencyDao.selectList(agencyLq).stream().map(CustomerAgencyEntity::getId).collect(Collectors.toList()); + resultLQ.in(CustomerCommunityManageUserEntity::getCommunityId,agencyListIds); + } + + if (dto.getCommunityId()!=null){ + resultLQ.eq(CustomerCommunityManageUserEntity::getCommunityId,dto.getCommunityId()); + } + if (dto.getName()!=null){ + resultLQ.like(CustomerCommunityManageUserEntity::getName,dto.getName()); + } + if (dto.getType()!=null){ + resultLQ.eq(CustomerCommunityManageUserEntity::getType,dto.getType()); + } + + PageHelper.startPage(dto.getPageNo(),dto.getPageSize()); + + List list = baseDao.selectList(resultLQ); + PageInfo resultPage = new PageInfo<>(list); + List result = ConvertUtils.sourceToTarget(list,CustomerCommunityManageUserDTO.class); + + return new PageData<>(result,resultPage.getTotal()); } @Override diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridManageUserServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridManageUserServiceImpl.java index 5c29778b37..a881a1c40c 100755 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridManageUserServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridManageUserServiceImpl.java @@ -63,6 +63,17 @@ public class CustomerGridManageUserServiceImpl extends BaseServiceImpl 0) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() .in(CustomerGridManageUserEntity::getGridId, gridIds); + + if (dto.getGridId()!=null){ + lambdaQueryWrapper.eq(CustomerGridManageUserEntity::getGridId,dto.getGridId()); + } + if (dto.getName()!=null){ + lambdaQueryWrapper.like(CustomerGridManageUserEntity::getName,dto.getName()); + } + if (dto.getType()!=null){ + lambdaQueryWrapper.eq(CustomerGridManageUserEntity::getType,dto.getType()); + } + PageHelper.startPage(dto.getPageNo(),dto.getPageSize()); List list = baseDao.selectList(lambdaQueryWrapper); PageInfo customerGridManageUserEntityPageInfo = new PageInfo<>(list);