Browse Source

网格删除、修改、添加

master
zxc 5 years ago
parent
commit
d5b49c2158
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java
  3. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java
  4. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java
  5. 30
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java
  6. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java
  7. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java
  8. 37
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  9. 38
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  10. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  11. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  12. 27
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  13. 74
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  14. 56
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  15. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  16. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  17. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  18. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  19. 12
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -25,6 +25,7 @@ public enum EpmetErrorCode {
AUTO_CONFIRM_FAILED(8103, "党员注册失败"),
MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"),
MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"),
NOT_DEL_GRID(8106,"该网格存在工作人员,不允许删除"),
CANNOT_AUDIT_WARM(8201, "请完善居民信息"),
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-24 9:13
*/
@Data
public class GridStaffCountDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格下未被禁用的工作人员数量
*/
private Integer enableCount;
}

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-24 9:06
*/
@Data
public class UserIdDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* userId
*/
private String userId;
}

31
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-23 16:42
*/
@Data
public class AddGridFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机构id
*/
private String agencyId;
/**
* 新建网格名称
*/
private String gridName;
/**
* 管辖区域
*/
private String manageDistrict;
}

30
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-23 19:18
*/
@Data
public class DeleteGridFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格id
*/
private String gridId;
/**
* 工作人员id
*/
private String staffId;
/**
* userId
*/
private String userId;
}

31
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-23 19:12
*/
@Data
public class EditGridFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* gridId 网格id
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
/**
* 管理区域
*/
private String manageDistrict;
}

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther zxc
* @Create 2020-04-23 16:45
*/
@Data
public class AddGridResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* gridId 网格id
*/
private String gridId;
}

37
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -1,7 +1,13 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.AddGridFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.DeleteGridFormDTO;
import com.epmet.dto.form.EditGridFormDTO;
import com.epmet.dto.result.AddGridResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,16 +27,41 @@ public class GridController {
@Autowired
private CustomerGridService customerGridService;
/**
* 获取网格详情
* @param customerGridFormDTO
* @return
*/
@PostMapping("griddetail")
public Result<GridDetailResultDTO> griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){
public Result<GridDetailResultDTO> gridDetail(@LoginUser TokenDto tokenDto,@RequestBody CustomerGridFormDTO customerGridFormDTO){
Result<GridDetailResultDTO> griddetail = customerGridService.griddetail(customerGridFormDTO);
return griddetail;
}
/*@PostMapping("addgrid")
/**
* 新建当前机关下的所属网格
*/
@PostMapping("addgrid")
public Result<AddGridResultDTO> addGrid(@LoginUser TokenDto tokenDto, @RequestBody AddGridFormDTO addGridFormDTO){
return customerGridService.addGrid(tokenDto,addGridFormDTO);
}
/**
* 管理员修改网格信息
*/
@PostMapping("editgrid")
public Result editGrid(@LoginUser TokenDto tokenDto, @RequestBody EditGridFormDTO editGridFormDTO){
return customerGridService.editGrid(tokenDto,editGridFormDTO);
@PostMapping("deletegrid")*/
}
/**
* 删除网格
*/
@PostMapping("deletegrid")
public Result deleteGrid(@LoginUser TokenDto tokenDto, @RequestBody DeleteGridFormDTO deleteGridFormDTO){
return customerGridService.deleteGrid(tokenDto,deleteGridFormDTO);
}
}

38
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -18,15 +18,19 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.DeleteGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.AddGridResultDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -86,4 +90,38 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
*/
List<CustomerStaffGridDTO> selectUserIdByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
* 根据userId查询customerId
* @param userId
* @return
*/
String selectCustomerIdByUserId(@Param("userId") String userId);
/**
* 根据pid查询pids
* @param pid
* @return
*/
String selectPidsByPid(@Param("pid")String pid);
/**
* 根据gridName查询gridId
* @param gridName
* @return
*/
String selectGridIdByGridName(@Param("gridName")String gridName);
/**
* 编辑网格信息
* @param customerGridDTO
*/
void editGrid(CustomerGridDTO customerGridDTO);
/**
* 删除网格
* @param deleteGridFormDTO
*/
void deleteGrid(DeleteGridFormDTO deleteGridFormDTO);
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -2,6 +2,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
@ -9,6 +10,7 @@ import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -43,4 +45,7 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/staffsinagency")
Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
@PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid")
Result<GridStaffCountDTO> selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO);
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -3,6 +3,7 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
@ -32,4 +33,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO);
}
@Override
public Result<GridStaffCountDTO> selectGridStaffCountByUserId(UserIdDTO userIdDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectGridStaffCountByUserId", userIdDTO);
}
}

27
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -18,15 +18,18 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddGridResultDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
@ -130,4 +133,24 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @return
*/
Result<GridDetailResultDTO> griddetail(CustomerGridFormDTO customerGridFormDTO);
/**
* 新建当前机关下的所属网格
*/
Result<AddGridResultDTO> addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO);
/**
* 修改网格信息
* @param tokenDto
* @param editGridFormDTO
*/
Result editGrid(TokenDto tokenDto,EditGridFormDTO editGridFormDTO);
/**
* 删除网格
* @param tokenDto
* @param deleteGridFormDTO
* @return
*/
Result deleteGrid(TokenDto tokenDto,DeleteGridFormDTO deleteGridFormDTO);
}

74
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -21,15 +21,17 @@ 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.constant.FieldConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddGridResultDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridDetailResultDTO;
@ -43,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 客户网格表
@ -169,6 +168,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return new Result<List<CustomerGridByUserIdResultDTO>>().ok(baseDao.getMyGrids(userId));
}
/**
* 查询网格详情
* @param customerGridFormDTO
* @return
*/
@Override
public Result<GridDetailResultDTO> griddetail(CustomerGridFormDTO customerGridFormDTO) {
GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO);
@ -178,4 +182,56 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return new Result<GridDetailResultDTO>().ok(griddetail);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<AddGridResultDTO> addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) {
CustomerGridEntity customerGridEntity = new CustomerGridEntity();
customerGridEntity.setCustomerId(baseDao.selectCustomerIdByUserId(tokenDto.getUserId()));
customerGridEntity.setGridName(addGridFormDTO.getGridName());
customerGridEntity.setDelFlag("0");
customerGridEntity.setCreatedBy(tokenDto.getUserId());
customerGridEntity.setUpdatedBy(tokenDto.getUserId());
customerGridEntity.setTotalUser(0);
customerGridEntity.setManageDistrict(addGridFormDTO.getManageDistrict());
customerGridEntity.setPid(addGridFormDTO.getAgencyId());
customerGridEntity.setPids(baseDao.selectPidsByPid(addGridFormDTO.getAgencyId()));
baseDao.insert(customerGridEntity);
String gridId = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName());
AddGridResultDTO addGridResultDTO = new AddGridResultDTO();
addGridResultDTO.setGridId(gridId);
return new Result<AddGridResultDTO>().ok(addGridResultDTO);
}
/**
* 修改网格信息
* @param tokenDto
* @param editGridFormDTO
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result editGrid(TokenDto tokenDto, EditGridFormDTO editGridFormDTO) {
CustomerGridDTO customerGridDTO = new CustomerGridDTO();
customerGridDTO.setManageDistrict(editGridFormDTO.getManageDistrict());
customerGridDTO.setGridName(editGridFormDTO.getGridName());
customerGridDTO.setUpdatedBy(tokenDto.getUserId());
customerGridDTO.setId(editGridFormDTO.getGridId());
baseDao.editGrid(customerGridDTO);
return new Result();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result deleteGrid(TokenDto tokenDto,DeleteGridFormDTO deleteGridFormDTO) {
UserIdDTO userIdDTO = new UserIdDTO();
userIdDTO.setUserId(tokenDto.getUserId());
deleteGridFormDTO.setUserId(tokenDto.getUserId());
Result<GridStaffCountDTO> gridStaffCountDTOResult = epmetUserFeignClient.selectGridStaffCountByUserId(userIdDTO);
if (gridStaffCountDTOResult.getData().getEnableCount()==0){
baseDao.deleteGrid(deleteGridFormDTO);
}else {
return new Result().error(EpmetErrorCode.NOT_DEL_GRID.getCode());
}
return new Result();
}
}

56
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -138,4 +138,60 @@
AND grid_id = #{gridId}
</select>
<!-- 根据userId查询customerId -->
<select id="selectCustomerIdByUserId" resultType="string">
SELECT
customer_id
FROM
customer_staff_grid
WHERE
user_id = #{userId}
LIMIT 1
</select>
<!-- 根据pid查询pids -->
<select id="selectPidsByPid" resultType="string">
SELECT
pids
FROM
customer_agency
WHERE
pid = #{pid}
limit 1
</select>
<!-- 根据gridName查询gridId -->
<select id="selectGridIdByGridName" resultType="string">
SELECT
id AS gridId
FROM
customer_grid
WHERE
grid_name = #{gridName}
AND del_flag = 0
</select>
<!-- 修改网格信息 -->
<update id="editGrid">
update
customer_grid
set
grid_name = #{gridName},
manage_district = #{manageDistrict},
updated_by = #{updatedBy}
where
id = #{id}
</update>
<!-- 删除网格 -->
<update id="deleteGrid">
update
customer_grid
set
updated_by = #{userId},
del_flag = 1
where
id = #{gridId}
</update>
</mapper>

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -25,9 +25,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
@ -155,4 +153,9 @@ public class CustomerStaffController {
public Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
return customerStaffService.getStaffInfoForHome(fromDTO);
}
@PostMapping(value = "selectgridstaffcountbyuserid")
public Result<GridStaffCountDTO> selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){
return customerStaffService.selectGridStaffCountByUserId(userIdDTO);
}
}

12
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -18,14 +18,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
import com.epmet.dto.form.CustomerStaffFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.result.StaffInfoResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -58,6 +58,12 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO);
/**
* 根据userId查询网格下未被禁用的人员数量
* @param userIdDTO
* @return
*/
GridStaffCountDTO selectGridStaffCountByUserId(UserIdDTO userIdDTO);
/**
* 根据userId查询查询网格下的用户信息
*

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -20,6 +20,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
@ -140,4 +142,11 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @return
*/
Result<List<StaffInfoResultDTO>> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO);
/**
* 根据userId查询网格下未被禁用的人员数量
* @param userIdDTO
* @return
*/
Result<GridStaffCountDTO> selectGridStaffCountByUserId(UserIdDTO userIdDTO);
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -27,6 +27,8 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.CustomerStaffDao;
import com.epmet.dto.*;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
@ -156,4 +158,17 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return new Result<List<StaffInfoResultDTO>>().ok(list);
}
/**
* 根据userId查询网格下未被禁用的人员数量
* @param userIdDTO
* @return
*/
@Override
public Result<GridStaffCountDTO> selectGridStaffCountByUserId(UserIdDTO userIdDTO) {
Result<GridStaffCountDTO> gridStaffCountDTOResult = new Result<GridStaffCountDTO>();
GridStaffCountDTO gridStaffCountDTO = baseDao.selectGridStaffCountByUserId(userIdDTO);
gridStaffCountDTOResult.setData(gridStaffCountDTO);
return gridStaffCountDTOResult;
}
}

12
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -41,6 +41,18 @@
</foreach>
AND cs.del_flag = 0
</select>
<!-- 根据userId查询网格下未被禁用的人员数量 -->
<select id="selectGridStaffCountByUserId" parameterType="com.epmet.dto.UserIdDTO" resultType="com.epmet.dto.GridStaffCountDTO">
SELECT
count(*) AS enableCount
FROM
customer_staff
WHERE
user_id = #{userId}
AND del_flag = 0
AND enable_flag = 'enable'
</select>
<select id="selectCustomerStaffList" resultType="com.epmet.dto.result.StaffInfoResultDTO" parameterType="com.epmet.dto.form.StaffsInAgencyFromDTO">
SELECT
cs.USER_ID AS "staffId",

Loading…
Cancel
Save