diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java index 2ac8a066b0..87ffa6f26b 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java @@ -50,4 +50,12 @@ public class StaffSubmitFromDTO implements Serializable { */ @NotBlank(message = "角色不能为空") private List roles; + /** + * 来源app(政府端:gov、居民端:resi、运营端:oper) + */ + private String app; + /** + * 来源client(PC端:web、微信小程序:wxmp) + */ + private String client; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java index 34a6aa6fb3..c6cf9ea90e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java @@ -4,6 +4,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +import java.util.Date; import java.util.List; /** @@ -38,7 +39,7 @@ public class StaffDetailResultDTO implements Serializable { /** * 激活时间 */ - private String activeTime; + private Date activeTime; /** * 性别 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java index b8450650aa..6964cffec3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -2,6 +2,8 @@ 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.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -13,6 +15,7 @@ import com.epmet.dto.result.StaffsInAgencyResultDTO; import com.epmet.service.StaffService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -34,7 +37,7 @@ public class StaffController { * @return */ @PostMapping("staffsinagency") - public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + public Result getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) { return staffService.getStaffInfoForHome(fromDTO); } @@ -46,7 +49,7 @@ public class StaffController { * @author zhaoqifeng */ @PostMapping("stafflist") - public Result> getStaffList(StaffsInAgencyFromDTO fromDTO){ + public Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO){ return staffService.getStaffList(fromDTO); } @@ -58,7 +61,7 @@ public class StaffController { * @return Result */ @PostMapping("rolelist") - public Result addStaffInit(StaffInfoFromDTO fromDTO){ + public Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.addStaffInit(fromDTO); } @@ -69,7 +72,7 @@ public class StaffController { * @return Result */ @PostMapping("editstaffinit") - public Result editStaffInit(StaffInfoFromDTO fromDTO){ + public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.editStaffInit(fromDTO); } @@ -80,8 +83,8 @@ public class StaffController { * @return Result */ @PostMapping("addstaff") - public Result addStaff(StaffSubmitFromDTO fromDTO){ - return staffService.addStaff(fromDTO); + public Result addStaff(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitFromDTO fromDTO){ + return staffService.addStaff(tokenDto, fromDTO); } /** @@ -91,8 +94,8 @@ public class StaffController { * @return Result */ @PostMapping("editstaff") - public Result editStaff(StaffSubmitFromDTO fromDTO){ - return staffService.editStaff(fromDTO); + public Result editStaff(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitFromDTO fromDTO){ + return staffService.editStaff(tokenDto, fromDTO); } /** @@ -102,7 +105,7 @@ public class StaffController { * @return Result */ @PostMapping("staffdetail") - public Result getStaffDetail(StaffInfoFromDTO fromDTO){ + public Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.getStaffDetail(fromDTO); } @@ -113,7 +116,7 @@ public class StaffController { * @return Result */ @PostMapping("disabledstaff") - public Result disabledStaff(StaffInfoFromDTO fromDTO){ + public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.disabledStaff(fromDTO); } } 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 5ba8ee81f1..98d20c5939 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 @@ -7,9 +7,13 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.DepartmentInStaffFormDTO; +import com.epmet.dto.form.StaffInfoFromDTO; +import com.epmet.dto.form.StaffSubmitFromDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.DepartInStaffListResultDTO; +import com.epmet.dto.result.StaffDetailResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; @@ -34,7 +38,7 @@ public interface EpmetUserFeignClient { * @date 2020/4/22 10:05 **/ @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") - Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + Result getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO); @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); @@ -50,6 +54,67 @@ public interface EpmetUserFeignClient { @PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid") Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO); + /** + * 工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("/epmetuser/customerstaff/stafflist") + Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO); + /** + * 人员添加页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/rolelist") + Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO); + + /** + * 人员编辑页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/editstaffinit") + Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO); + + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/addstaff") + Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO); + + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/editstaff") + Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO); + + /** + * 人员详情 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/staffdetail") + Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO); + + /** + * 人员禁用 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/disabledstaff") + Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO); + /** * @param departmentInStaffFormDTO * @return 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 e36abef073..0177e9a6bc 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 @@ -7,10 +7,14 @@ import com.epmet.dto.*; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.StaffInfoFromDTO; +import com.epmet.dto.form.StaffSubmitFromDTO; import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffDetailResultDTO; import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -46,4 +50,39 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDepartmentStaffList", departmentInStaffFormDTO); } + + @Override + public Result> getStaffList(StaffsInAgencyFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "StaffsInAgencyFromDTO", fromDTO); + } + + @Override + public Result addStaffInit(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaffInit", fromDTO); + } + + @Override + public Result editStaffInit(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaffInit", fromDTO); + } + + @Override + public Result addStaff(StaffSubmitFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaff", fromDTO); + } + + @Override + public Result editStaff(StaffSubmitFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaff", fromDTO); + } + + @Override + public Result getStaffDetail(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffDetail", fromDTO); + } + + @Override + public Result disabledStaff(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "disabledStaff", fromDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java index ba5f227b95..e11e8edecb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -1,5 +1,6 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -58,7 +59,7 @@ public interface StaffService { * @param fromDTO 参数 * @return Result */ - Result addStaff(StaffSubmitFromDTO fromDTO); + Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO); /** * 人员编辑 @@ -66,7 +67,7 @@ public interface StaffService { * @param fromDTO 参数 * @return Result */ - Result editStaff(StaffSubmitFromDTO fromDTO); + Result editStaff(TokenDto tokenDto,StaffSubmitFromDTO fromDTO); /** * 人员详情 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java index 3ef22a3cf6..db4e263508 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.form.StaffInfoFromDTO; @@ -36,6 +37,7 @@ public class StaffServiceImpl implements StaffService { private CustomerAgencyService customerAgencyService; @Autowired private CustomerStaffAgencyService customerStaffAgencyService; + @Override public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO(); @@ -51,7 +53,7 @@ public class StaffServiceImpl implements StaffService { List staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); fromDTO.setStaffList(staffIds); //获取用户信息 - Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); + Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); resultDTO.setStaffList(staffInfoListResult.getData()); return new Result().ok(resultDTO); } @@ -69,37 +71,54 @@ public class StaffServiceImpl implements StaffService { List staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); fromDTO.setStaffList(staffIds); //获取用户列表 - Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); + Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); return null; } @Override public Result addStaffInit(StaffInfoFromDTO fromDTO) { - return null; + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + return epmetUserFeignClient.addStaffInit(fromDTO); } @Override public Result editStaffInit(StaffInfoFromDTO fromDTO) { - return null; + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + return epmetUserFeignClient.editStaffInit(fromDTO); } @Override - public Result addStaff(StaffSubmitFromDTO fromDTO) { - return null; + public Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { + fromDTO.setApp(tokenDto.getApp()); + fromDTO.setClient(tokenDto.getClient()); + Result result = epmetUserFeignClient.addStaff(fromDTO); + //机关总人数加一 + if (result.success()) { + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1); + customerAgencyService.updateById(customerAgencyEntity); + } + return new Result(); } @Override - public Result editStaff(StaffSubmitFromDTO fromDTO) { - return null; + public Result editStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { + fromDTO.setApp(tokenDto.getApp()); + fromDTO.setClient(tokenDto.getClient()); + return epmetUserFeignClient.editStaff(fromDTO); } @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { - return null; + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + return epmetUserFeignClient.getStaffDetail(fromDTO); } @Override public Result disabledStaff(StaffInfoFromDTO fromDTO) { - return null; + return epmetUserFeignClient.disabledStaff(fromDTO); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java new file mode 100644 index 0000000000..f823247843 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java @@ -0,0 +1,34 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/24 15:42 + */ +public interface CustomerStaffConstant { + + /** + * 专职 + */ + String FULL_TIME ="fulltime"; + /** + * 兼职 + */ + String PART_TIME ="parttime"; + /** + * 已激活 + */ + String INACTIVE ="inactive"; + /** + * 未激活 + */ + String ACTIVE ="active"; + /** + * 已禁用 + */ + String DISABLED ="disabled"; + /** + * 未禁用 + */ + String ENABLE ="enable"; +} 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 7daee8f457..f1ed7bd6ba 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 @@ -26,15 +26,11 @@ 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.*; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CustomerStaffFormDTO; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.DepartInStaffListResultDTO; +import com.epmet.dto.result.StaffDetailResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; import org.springframework.beans.factory.annotation.Autowired; @@ -145,17 +141,22 @@ public class CustomerStaffController { * @date 2020/4/22 10:05 **/ @PostMapping(value = "getstaffinfobyuserid") - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + public Result getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO) { return customerStaffService.getCustomerStaffInfoByUserId(formDTO); } + @PostMapping(value = "selectgridstaffcountbyuserid") + public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ + return customerStaffService.selectGridStaffCountByUserId(userIdDTO); + } + /** * 组织首页-工作人员列表 * @param fromDTO * @return */ @PostMapping("staffsinagency") - public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + public Result> getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffInfoForHome(fromDTO); } @@ -165,13 +166,74 @@ public class CustomerStaffController { * @return */ @PostMapping("stafflist") - public Result> getStaffList(StaffsInAgencyFromDTO fromDTO) { + public Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffList(fromDTO); } - @PostMapping(value = "selectgridstaffcountbyuserid") - public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ - return customerStaffService.selectGridStaffCountByUserId(userIdDTO); + /** + * 人员添加页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("rolelist") + public Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.addStaffInit(fromDTO); + } + + /** + * 人员编辑页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("editstaffinit") + public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.editStaffInit(fromDTO); + } + + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("addstaff") + public Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO){ + return customerStaffService.addStaff(fromDTO); + } + + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("editstaff") + public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){ + return customerStaffService.editStaff(fromDTO); + } + + /** + * 人员详情 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("staffdetail") + public Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.getStaffDetail(fromDTO); + } + + /** + * 人员禁用 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("disabledstaff") + public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.disabledStaff(fromDTO); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 309068b1c8..f1aaee18e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -39,5 +39,13 @@ public interface StaffRoleDao extends BaseDao { * @param orgId * @return */ + List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); + + /** + * 删除工作人员权限 + * @param dto + * @return + */ + boolean delStaffRoles(StaffRoleDTO dto); List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index f4f15edf0c..88742d7400 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -101,4 +101,10 @@ public interface StaffRoleService extends BaseService { * @return */ List listStaffsInRole(String roleKey, String orgId); + + /** + * 清空工作人员权限 + * @param dto + */ + void clearStaffRoles(StaffRoleDTO dto); } \ 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 baac7bcde8..7621320bb7 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 @@ -26,6 +26,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerStaffConstant; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; @@ -49,9 +50,13 @@ import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.dto.result.StaffRoleResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.GovStaffRoleEntity; +import com.epmet.entity.StaffRoleEntity; +import com.epmet.entity.UserEntity; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; import com.epmet.service.GovStaffRoleService; +import com.epmet.service.StaffRoleService; +import com.epmet.service.UserService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -79,7 +84,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -240,23 +248,94 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl { + StaffRoleEntity staffRoleEntity = new StaffRoleEntity(); + staffRoleEntity.setStaffId(userEntity.getId()); + staffRoleEntity.setRoleId(role); + staffRoleEntity.setOrgId(fromDTO.getAgencyId()); + staffRoleService.insert(staffRoleEntity); + }); + + return new Result(); } @Override + @Transactional(rollbackFor = Exception.class) public Result editStaff(StaffSubmitFromDTO fromDTO) { - return null; + CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); + //Customer_Staff表插入数据 + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setId(customerStaffEntity.getId()); + staffEntity.setRealName(fromDTO.getName()); + staffEntity.setMobile(fromDTO.getMobile()); + staffEntity.setGender(fromDTO.getGender()); + staffEntity.setWorkType(fromDTO.getWorkType()); + baseDao.updateById(staffEntity); + + //清空权限关联 + StaffRoleDTO staffRoleDTO = new StaffRoleDTO(); + staffRoleDTO.setStaffId(fromDTO.getStaffId()); + staffRoleDTO.setOrgId(fromDTO.getAgencyId()); + staffRoleService.clearStaffRoles(staffRoleDTO); + //重新添加角色关联 + fromDTO.getRoles().forEach(role -> { + StaffRoleEntity staffRoleEntity = new StaffRoleEntity(); + staffRoleEntity.setStaffId(fromDTO.getStaffId()); + staffRoleEntity.setRoleId(role); + staffRoleEntity.setOrgId(fromDTO.getAgencyId()); + staffRoleService.insert(staffRoleEntity); + }); + return new Result(); } @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { - return null; + StaffDetailResultDTO resultDTO = new StaffDetailResultDTO(); + //获取工作人员信息 + CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfo(fromDTO); + resultDTO.setStaffId(customerStaffDTO.getUserId()); + resultDTO.setName(customerStaffDTO.getRealName()); + resultDTO.setMobile(customerStaffDTO.getMobile()); + resultDTO.setHeadPhoto(customerStaffDTO.getHeadPhoto()); + resultDTO.setGender(customerStaffDTO.getGender()); + resultDTO.setActiveFlag(customerStaffDTO.getActiveFlag()); + resultDTO.setActiveTime(customerStaffDTO.getActiveTime()); + resultDTO.setEnableFlag(customerStaffDTO.getEnableFlag()); + + //获取工作人员角色 + List staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); + List roles = staffRoles.stream().map(GovStaffRoleEntity::getRoleName).collect(Collectors.toList()); + resultDTO.setRoles(roles); + return new Result().ok(resultDTO); } @Override public Result disabledStaff(StaffInfoFromDTO fromDTO) { - return null; + CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setId(customerStaffEntity.getId()); + staffEntity.setEnableFlag(CustomerStaffConstant.DISABLED); + baseDao.updateById(staffEntity); + return new Result(); } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index db7d154b22..0a9d7ce90d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -114,4 +114,10 @@ public class StaffRoleServiceImpl extends BaseServiceImpl + + update + staff_role + set DEL_FLAG = '1' + where STAFF_ID = #{staffId} + and ORG_ID = #{orgId} + and DEL_FLAG = '0' +