From d5b49c215836dc9b2e38d855934d1d1f464db231 Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Fri, 24 Apr 2020 14:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=88=A0=E9=99=A4=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=81=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../java/com/epmet/dto/GridStaffCountDTO.java | 21 ++++++ .../main/java/com/epmet/dto/UserIdDTO.java | 21 ++++++ .../com/epmet/dto/form/AddGridFormDTO.java | 31 ++++++++ .../com/epmet/dto/form/DeleteGridFormDTO.java | 30 ++++++++ .../com/epmet/dto/form/EditGridFormDTO.java | 31 ++++++++ .../epmet/dto/result/AddGridResultDTO.java | 21 ++++++ .../com/epmet/controller/GridController.java | 37 +++++++++- .../java/com/epmet/dao/CustomerGridDao.java | 38 ++++++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 5 ++ .../EpmetUserFeignClientFallBack.java | 6 ++ .../epmet/service/CustomerGridService.java | 27 ++++++- .../service/impl/CustomerGridServiceImpl.java | 74 ++++++++++++++++--- .../main/resources/mapper/CustomerGridDao.xml | 56 ++++++++++++++ .../controller/CustomerStaffController.java | 9 ++- .../java/com/epmet/dao/CustomerStaffDao.java | 12 ++- .../epmet/service/CustomerStaffService.java | 9 +++ .../impl/CustomerStaffServiceImpl.java | 15 ++++ .../resources/mapper/CustomerStaffDao.xml | 12 +++ 19 files changed, 436 insertions(+), 20 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 6fc0a1cbf5..01d63ec781 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/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, "该机关存在下级机关,不允许删除"), diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java new file mode 100644 index 0000000000..fcdbe3ed04 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java new file mode 100644 index 0000000000..65ed41cab6 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java new file mode 100644 index 0000000000..95df5fca15 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java new file mode 100644 index 0000000000..ed266210ba --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java new file mode 100644 index 0000000000..2c5556f7a3 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java new file mode 100644 index 0000000000..eedf5c895a --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java index 2f2b919b20..f3b19c5027 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java +++ b/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 griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){ + public Result gridDetail(@LoginUser TokenDto tokenDto,@RequestBody CustomerGridFormDTO customerGridFormDTO){ Result griddetail = customerGridService.griddetail(customerGridFormDTO); return griddetail; } - /*@PostMapping("addgrid") + /** + * 新建当前机关下的所属网格 + */ + @PostMapping("addgrid") + public Result 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); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index d387278ec5..d15a7c7032 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/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 { */ List 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); + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 217d37c0bb..42465e7055 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/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> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + @PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid") + Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index a4cf20b805..aa0149a726 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/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> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO); } + + @Override + public Result selectGridStaffCountByUserId(UserIdDTO userIdDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectGridStaffCountByUserId", userIdDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 5d427e434a..41390fe5e5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/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 { * @return */ Result griddetail(CustomerGridFormDTO customerGridFormDTO); + + /** + * 新建当前机关下的所属网格 + */ + Result 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); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index da136fb56a..a53a6bac1c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/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>().ok(baseDao.getMyGrids(userId)); } + /** + * 查询网格详情 + * @param customerGridFormDTO + * @return + */ @Override public Result griddetail(CustomerGridFormDTO customerGridFormDTO) { GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO); @@ -178,4 +182,56 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(griddetail); } + @Override + @Transactional(rollbackFor = Exception.class) + public Result 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().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 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(); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 574084079e..c7a54db7b9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -138,4 +138,60 @@ AND grid_id = #{gridId} + + + + + + + + + + + + update + customer_grid + set + grid_name = #{gridName}, + manage_district = #{manageDistrict}, + updated_by = #{updatedBy} + where + id = #{id} + + + + + update + customer_grid + set + updated_by = #{userId}, + del_flag = 1 + where + id = #{gridId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 42c39a6022..b3aa12f74a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/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> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffInfoForHome(fromDTO); } + + @PostMapping(value = "selectgridstaffcountbyuserid") + public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ + return customerStaffService.selectGridStaffCountByUserId(userIdDTO); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index b552832c2d..3026894e00 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/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 { CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + /** + * 根据userId查询网格下未被禁用的人员数量 + * @param userIdDTO + * @return + */ + GridStaffCountDTO selectGridStaffCountByUserId(UserIdDTO userIdDTO); /** * 根据userId查询查询网格下的用户信息 * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 4a7ceb335f..1fe7ce3442 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/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 { * @return */ Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + + /** + * 根据userId查询网格下未被禁用的人员数量 + * @param userIdDTO + * @return + */ + Result selectGridStaffCountByUserId(UserIdDTO userIdDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 560fe0008c..5756cb4fce 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/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>().ok(list); } + /** + * 根据userId查询网格下未被禁用的人员数量 + * @param userIdDTO + * @return + */ + @Override + public Result selectGridStaffCountByUserId(UserIdDTO userIdDTO) { + Result gridStaffCountDTOResult = new Result(); + GridStaffCountDTO gridStaffCountDTO = baseDao.selectGridStaffCountByUserId(userIdDTO); + gridStaffCountDTOResult.setData(gridStaffCountDTO); + return gridStaffCountDTOResult; + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index ab8ad974a5..a98e30cf86 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -41,6 +41,18 @@ AND cs.del_flag = 0 + + +