Browse Source

Merge remote-tracking branch 'origin/dev_staff_info' into dev_staff_info

dev_shibei_match
yinzuomei 4 years ago
parent
commit
0011bb1b7e
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  2. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  3. 96
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java
  4. 85
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffOrgRelationController.java
  5. 33
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffOrgRelationDao.java
  6. 66
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java
  7. 95
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffOrgRelationService.java
  8. 100
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.java
  9. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  10. 8
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffOrgRelationDao.xml
  11. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java
  12. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  13. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java

@ -54,6 +54,7 @@ public enum RequirePermissionEnum {
ORG_STAFF_CREATE("org_staff_create", "组织:工作人员:新增", "组织:工作人员:新增"),
ORG_STAFF_UPDATE("org_staff_update", "组织:工作人员:编辑", "组织:工作人员:编辑"),
ORG_STAFF_FORBIDDEN("org_staff_forbidden", "组织:工作人员:禁用", "组织:工作人员:禁用"),
ORG_STAFF_ENABLE("org_staff_enable", "组织:工作人员:解禁", "组织:工作人员:解禁"),
ORG_STAFF_TRANSFER("org_staff_transfer", "组织:工作人员:调动", "组织:工作人员:调动"),
/**

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -211,9 +211,10 @@ public class EpmetUserController {
* @Description 通讯录姓名检索工作人员
* @author sun
*/
@PostMapping("stafflist")
public Result<List<ListStaffResultDTO>> staffList(@RequestBody ListStaffFormDTO formDTO) {
@PostMapping("stafflistbyrealname")
public Result<List<ListStaffResultDTO>> staffListByRealName(@LoginUser TokenDto tokenDto, @RequestBody ListStaffFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ListStaffFormDTO.Staff.class);
formDTO.setCustomerId(formDTO.getCustomerId());
return new Result<List<ListStaffResultDTO>>().ok(epmetUserService.listStaff(formDTO));
}

96
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 工作人员注册组织关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-19
*/
@Data
public class StaffOrgRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 所有上级组织机构ID(以英文:隔开)部门/网格得拼上所属组织Id
*/
private String pids;
/**
* 工作人员Id
*/
private String staffId;
/**
* 工作人员添加入口Id(agencyId;deptId;gridId)
*/
private String orgId;
/**
* 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
*/
private String orgType;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

85
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffOrgRelationController.java

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
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.StaffOrgRelationDTO;
import com.epmet.service.StaffOrgRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 工作人员注册组织关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-19
*/
@RestController
@RequestMapping("stafforgrelation")
public class StaffOrgRelationController {
@Autowired
private StaffOrgRelationService staffOrgRelationService;
@GetMapping("page")
public Result<PageData<StaffOrgRelationDTO>> page(@RequestParam Map<String, Object> params){
PageData<StaffOrgRelationDTO> page = staffOrgRelationService.page(params);
return new Result<PageData<StaffOrgRelationDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<StaffOrgRelationDTO> get(@PathVariable("id") String id){
StaffOrgRelationDTO data = staffOrgRelationService.get(id);
return new Result<StaffOrgRelationDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody StaffOrgRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
staffOrgRelationService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody StaffOrgRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
staffOrgRelationService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
staffOrgRelationService.delete(ids);
return new Result();
}
}

33
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffOrgRelationDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.StaffOrgRelationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 工作人员注册组织关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-19
*/
@Mapper
public interface StaffOrgRelationDao extends BaseDao<StaffOrgRelationEntity> {
}

66
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 工作人员注册组织关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("staff_org_relation")
public class StaffOrgRelationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 所有上级组织机构ID(以英文:隔开)部门/网格得拼上所属组织Id
*/
private String pids;
/**
* 工作人员Id
*/
private String staffId;
/**
* 工作人员添加入口Id(agencyId;deptId;gridId)
*/
private String orgId;
/**
* 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
*/
private String orgType;
}

95
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffOrgRelationService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.StaffOrgRelationDTO;
import com.epmet.entity.StaffOrgRelationEntity;
import java.util.List;
import java.util.Map;
/**
* 工作人员注册组织关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-19
*/
public interface StaffOrgRelationService extends BaseService<StaffOrgRelationEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<StaffOrgRelationDTO>
* @author generator
* @date 2021-08-19
*/
PageData<StaffOrgRelationDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<StaffOrgRelationDTO>
* @author generator
* @date 2021-08-19
*/
List<StaffOrgRelationDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return StaffOrgRelationDTO
* @author generator
* @date 2021-08-19
*/
StaffOrgRelationDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-08-19
*/
void save(StaffOrgRelationDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-08-19
*/
void update(StaffOrgRelationDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-08-19
*/
void delete(String[] ids);
}

100
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.java

@ -0,0 +1,100 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
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.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.StaffOrgRelationDao;
import com.epmet.dto.StaffOrgRelationDTO;
import com.epmet.entity.StaffOrgRelationEntity;
import com.epmet.service.StaffOrgRelationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 工作人员注册组织关系表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-19
*/
@Service
public class StaffOrgRelationServiceImpl extends BaseServiceImpl<StaffOrgRelationDao, StaffOrgRelationEntity> implements StaffOrgRelationService {
@Override
public PageData<StaffOrgRelationDTO> page(Map<String, Object> params) {
IPage<StaffOrgRelationEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, StaffOrgRelationDTO.class);
}
@Override
public List<StaffOrgRelationDTO> list(Map<String, Object> params) {
List<StaffOrgRelationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, StaffOrgRelationDTO.class);
}
private QueryWrapper<StaffOrgRelationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<StaffOrgRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public StaffOrgRelationDTO get(String id) {
StaffOrgRelationEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, StaffOrgRelationDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(StaffOrgRelationDTO dto) {
StaffOrgRelationEntity entity = ConvertUtils.sourceToTarget(dto, StaffOrgRelationEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StaffOrgRelationDTO dto) {
StaffOrgRelationEntity entity = ConvertUtils.sourceToTarget(dto, StaffOrgRelationEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

@ -66,6 +66,8 @@ public class StaffServiceImpl implements StaffService {
private CustomerStaffDepartmentService customerStaffDepartmentService;
@Autowired
private CustomerStaffGridService customerStaffGridService;
@Autowired
private StaffOrgRelationService staffOrgRelationService;
@Override
public Result<StaffsInAgencyResultDTO> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
@ -374,6 +376,19 @@ public class StaffServiceImpl implements StaffService {
customerGridService.updateById(gridEntity);
}
//5.工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId());
if("agency".equals(fromDTO.getOrgType())){
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":"));
}else {
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId());
}
staffOrgRelationEntity.setStaffId(result.getData().getUserId());
staffOrgRelationEntity.setOrgId(fromDTO.getOrgId());
staffOrgRelationEntity.setOrgType(fromDTO.getOrgType());
staffOrgRelationService.insert(staffOrgRelationEntity);
return new Result();
}

8
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffOrgRelationDao.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.StaffOrgRelationDao">
</mapper>

8
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java

@ -10,7 +10,7 @@ import java.util.List;
/**
* @author sun
* @dscription 接口入参--通讯录工作人员解禁
* @dscription 通讯录工作人员解禁-接口入参
*/
@NoArgsConstructor
@Data
@ -18,8 +18,8 @@ public class EnableStaffFormDTO implements Serializable {
private static final long serialVersionUID = -5220529162950147825L;
/**
* 徽章名称
* 被解禁用户Id
*/
@NotBlank(message = "徽章名称不能为空")
private String badgeName;
private String staffId;
}

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

@ -18,6 +18,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
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.security.user.LoginUserUtil;
@ -433,7 +437,11 @@ public class CustomerStaffController {
* @author sun
*/
@PostMapping("enablestaff")
public Result enableStaff(@RequestBody EnableStaffFormDTO fromDTO){
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_ENABLE)
public Result enableStaff(@LoginUser TokenDto tokenDto, @RequestBody EnableStaffFormDTO fromDTO){
if (tokenDto.getUserId().equals(fromDTO.getStaffId())) {
throw new RenException("工作人员自己不能解禁自己");
}
customerStaffService.enableStaff(fromDTO);
return new Result();
}

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

@ -744,7 +744,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
*/
@Override
public void enableStaff(EnableStaffFormDTO fromDTO) {
//超级管理员解禁 需要加新权限
CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId());
if (null == customerStaffEntity) {
logger.error(String.format("工作人员解禁,未查询到被解禁人信息,被解禁人Id->%s", fromDTO.getStaffId()));
throw new RenException("未查询到被解禁人信息,请核对后操作");
}
CustomerStaffEntity staffEntity = new CustomerStaffEntity();
staffEntity.setId(customerStaffEntity.getId());
staffEntity.setEnableFlag(CustomerStaffConstant.ENABLE);
baseDao.updateById(staffEntity);
}
}

Loading…
Cancel
Save