增加组织架构,人员表,对应关系表,就业表里面增减组织架构公司id。每次同步只支持1l即霖梓公司数据,不删除非霖梓的公司id

This commit is contained in:
wulin 2021-05-18 10:01:08 +08:00
parent f0e7b633b5
commit 57d5a519af
23 changed files with 61 additions and 35 deletions

View File

@ -68,9 +68,11 @@ public class StaffRoleController extends AbstractController {
@Autowired
private DepartmentsStaffRelateService departmentsStaffRelateService;
@Autowired
@Autowired
private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService;
private static Long COMPANY_ID = 1l;
/**
* 列表
*/
@ -122,7 +124,7 @@ public class StaffRoleController extends AbstractController {
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id) {
StaffRole lzStaffRole = staffRoleService.selectStaffRoleById(id);
List<StaffEntity> staffEntityList = staffService.selectAll();
List<StaffEntity> staffEntityList = staffService.selectAll(COMPANY_ID);
List<StaffEntity> newList = new ArrayList<>();
staffEntityList.forEach(p -> {
StaffEntity staffEntity = new StaffEntity();

View File

@ -144,7 +144,7 @@ public class TestController {
@RequestMapping("/test/relate")
public void relate() {
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.selectAll();
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.selectAll(1l);
for (DepartmentsStaffRelateEntity l : list) {
DepartmentsEntity departmentsEntity = departmentsService.selectByDepartmentId(l.getDepartmentId());
l.setLevel(departmentsEntity.getLevel());
@ -242,7 +242,7 @@ public class TestController {
// http://localhost:8080/lz_management/test/restore
@RequestMapping("/test/restore")
public void restore() throws Exception {
List<StaffEntity> staffEntities = staffService.selectAll();
List<StaffEntity> staffEntities = staffService.selectAll(1l);
for (StaffEntity staffEntity : staffEntities) {
//doRestore(staffEntity.getId());
}

View File

@ -33,7 +33,7 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
List<DepartmentsDto> getDepartmentsByparentId(@Param("parentId") String parentId);
List<DepartmentsEntity> selectAll();
List<DepartmentsEntity> selectAll(@Param("companyId") Long companyId);
List<DepartmentsEntity> selectEntityByParentDepartmentId(@Param("parentId") String parentId);

View File

@ -51,7 +51,7 @@ public interface DepartmentsStaffRelateDao extends BaseMapper<DepartmentsStaffRe
List<DepartmentsStaffRelateEntity> selectByStaffIds(@Param("staffIds") List<Long> staffIds);
List<DepartmentsStaffRelateEntity> selectAll();
List<DepartmentsStaffRelateEntity> selectAll(@Param("companyId") Long companyId);
DepartmentsStaffRelateEntity selectLastDepartmentByStaffId(@Param("staffId") Long staffId);

View File

@ -79,7 +79,7 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
List<StaffEntity> selectBySearchName(@Param("page") IPage page, @Param("model") FindByNameModel nameModel);
List<StaffEntity> selectAll();
List<StaffEntity> selectAll(@Param("companyId") Long companyId);
List<ReportProgressListDto> getPositionByStaffIds(@Param("req") ReportListReq req, @Param("staffIds") List<String> staffIds, @Param("page") IPage page);

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -35,6 +37,8 @@ public class DepartmentsStaffRelateEntity implements Serializable {
private Long staffId;
//第几级部门
private Integer level;
//公司id
private Long companyId;
/***
* 是否为部门领导
*/

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -125,5 +127,8 @@ public class StaffEntity implements Serializable {
//
private String salt;
//公司id
private Long companyId;
}

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -105,6 +107,9 @@ public class StaffOccupationEntity implements Serializable {
*/
private String resumeUrl;
//公司id
private Long companyId;
public String getKey(){
return staffId + "_" + position;
}

View File

@ -58,7 +58,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
//查找父级部门
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
List<DepartmentsEntity> selectAll();
List<DepartmentsEntity> selectAll(Long companyId);
int delDepartments(List<DepartmentsEntity> departmentsEntities);

View File

@ -29,7 +29,7 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
void deleteAllRelates();
List<DepartmentsStaffRelateEntity> selectAll();
List<DepartmentsStaffRelateEntity> selectAll(Long companyId);
List<DepartmentsStaffRelateEntity> selectByStaffIds(List<Long> staffIds);

View File

@ -84,7 +84,7 @@ public interface StaffService extends IService<StaffEntity> {
//统计部门下的人
List<String> staffsByAllDeparmentIds(List<String> deparmentIds);
List<StaffEntity> selectAll();
List<StaffEntity> selectAll(Long companyId);
List<StaffSimpleDto> selectStaffSimpleInfoByIds(List<Long> ids);

View File

@ -298,8 +298,8 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
}
@Override
public List<DepartmentsEntity> selectAll(){
return departmentsDao.selectAll();
public List<DepartmentsEntity> selectAll(Long companyId){
return departmentsDao.selectAll(companyId);
}
@Override

View File

@ -64,8 +64,8 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
}
@Override
public List<DepartmentsStaffRelateEntity> selectAll() {
return departmentsStaffRelateDao.selectAll();
public List<DepartmentsStaffRelateEntity> selectAll(Long companyId) {
return departmentsStaffRelateDao.selectAll(companyId);
}
@Override

View File

@ -426,8 +426,8 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
}
@Override
public List<StaffEntity> selectAll() {
return staffDao.selectAll();
public List<StaffEntity> selectAll(Long companyId) {
return staffDao.selectAll(companyId);
}
/**

View File

@ -53,6 +53,8 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
@Autowired
private RecordRoleService recordRoleService;
private static Long COMPANY_ID = 1l;
@Override
@ -107,12 +109,12 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
@Override
public List<FlowDto> getFowList() {
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll();
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll(COMPANY_ID);
List<DepartmentsEntity> parentDepartments = tDepartments.stream()
//根据两个属性进行过滤
.filter(s -> s.getDepartmentParentId().equals("1"))
.collect(Collectors.toList());
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll();
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll(COMPANY_ID);
Map<String, FlowInfo> departmentsStaffRelateEntityMap = new HashMap<>();
Map<String, DepartmentsStaffRelateEntity> singleRelateMap = new HashMap<>();
@ -132,7 +134,7 @@ public class FlowManagerServiceImpl extends ServiceImpl<FlowManagerMapper, FlowM
}
}
List<StaffEntity> staffEntities = staffDao.selectAll();
List<StaffEntity> staffEntities = staffDao.selectAll(COMPANY_ID);
Map<Long ,StaffEntity> staffMap = new HashMap<>();
for(StaffEntity staffEntity : staffEntities){
staffMap.put(staffEntity.getId(),staffEntity);

View File

@ -122,6 +122,8 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Autowired
private StaffOccupationService staffOccupationService;
private static Long COMPANY_ID = 1l;
@Override
public StaffRole selectStaffRoleById(Long id) {
return staffRoleMapper.selectStaffRoleById(id);
@ -222,7 +224,7 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
List<Long> menuIdList1 = new ArrayList<>();
if (staffRole != null) {
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectAll();
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectAll(COMPANY_ID);
Map<String, List<DepartmentsEntity>> map = resultRecordService.getStringListMap(departmentsEntities);
role.setRoleId(staffRole.getId());
role.setRoleName(staffRole.getDepartmentLevel());
@ -246,12 +248,12 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Override
public List<SysMenuEntity> selectMenuList() {
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll();
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll(COMPANY_ID);
List<DepartmentsEntity> parentDepartments = tDepartments.stream()
//根据两个属性进行过滤
.filter(s -> s.getDepartmentParentId().equals("1"))
.collect(Collectors.toList());
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll();
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll(COMPANY_ID);
Map<String, DepartmentsStaffRelateEntity> departmentsStaffRelateEntityMap = new HashMap<>();
Map<String, DepartmentsStaffRelateEntity> singleDepartmentsStaffRelate = new HashMap<>();
for (DepartmentsStaffRelateEntity d : departmentsStaffRelateEntities) {
@ -260,7 +262,7 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
departmentsStaffRelateEntityMap.put(d.getDepartmentId(), d);
}
}
List<StaffEntity> staffEntities = staffDao.selectAll();
List<StaffEntity> staffEntities = staffDao.selectAll(COMPANY_ID);
Map<Long, StaffEntity> staffMap = new HashMap<>();
for (StaffEntity staffEntity : staffEntities) {
staffMap.put(staffEntity.getId(), staffEntity);

View File

@ -121,6 +121,8 @@ public class DingtalkBusiness {
@Value("${dingtalk.appid}")
private String appid;
private static Long COMPANY_ID = 1l;
/**
* 获取组织架构信息并录入到数据库
*/
@ -204,7 +206,7 @@ public class DingtalkBusiness {
List<String> newPositions = new ArrayList<>();//新的职位或者新的人员对应信息
//获取所有的部门详情
List<DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetailsV2(token, "1");
List<DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetailsV2(token, COMPANY_ID.toString());
if(departmentInfosBos.size() > 0){
List<String> probationUserIDS = getProbationStaff(token);//获取试用期人员信息
@ -216,7 +218,7 @@ public class DingtalkBusiness {
//获取原有部门信息
Map<String, DepartmentInfosBo> mapDepartmentInfosBos
= departmentInfosBos.stream().collect(Collectors.toMap(DepartmentInfosBo::getId, Function.identity(), (e, r) -> e));
List<DepartmentsEntity> departmentsEntities = departmentsService.selectAll();
List<DepartmentsEntity> departmentsEntities = departmentsService.selectAll(COMPANY_ID);
Map<String, DepartmentsEntity> mapDeparts = null;
if(departmentsEntities.size() > 0){
mapDeparts =
@ -224,7 +226,7 @@ public class DingtalkBusiness {
}
//获取原有的部门人员对应关系
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll();
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll(COMPANY_ID);
Map<String, DepartmentsStaffRelateEntity> mapDepStaffs = null;
if(departmentsStaffRelateEntities.size() > 0){
@ -235,7 +237,7 @@ public class DingtalkBusiness {
}
//获取所有人员信息
List<StaffEntity> staffEntities = staffService.selectAll();
List<StaffEntity> staffEntities = staffService.selectAll(COMPANY_ID);
Map<String, StaffEntity> mapStaffs = null;
if(staffEntities.size() > 0){
mapStaffs = staffEntities.stream().

View File

@ -154,6 +154,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Autowired
private ResultTaskService resultTaskService;
private static Long COMPANY_ID = 1l;
@Override
public ResultRecord selectResultRecordById(Long id) {
@ -191,7 +193,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
@Override
public R queryPage(ResultRecordReq params, SysUserEntity user) {
List<String> departmentIds = new ArrayList<>();
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll();
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll(COMPANY_ID);
if (StringUtil.isNotBlank(params.getDepartment1()) || StringUtil.isNotBlank(params.getDepartment2())
|| StringUtil.isNotBlank(params.getDepartment3())) {
Map<String, List<DepartmentsEntity>> departmentMap = null;

View File

@ -73,7 +73,7 @@
<select id="selectAll" resultType="com.lz.modules.app.entity.DepartmentsEntity">
select * from lz_departments where is_delete=0
select * from lz_departments where is_delete=0 and company_id= #{companyId}
</select>
<select id="selectEntityByParentDepartmentId" resultType="com.lz.modules.app.entity.DepartmentsEntity">

View File

@ -13,6 +13,7 @@
<result property="staffId" column="staff_id"/>
<result column="level" property="level"/>
<result column="is_leader" property="isLeader"/>
<result column="company_id" property="companyId"/>
</resultMap>
@ -58,7 +59,7 @@
group by staff_id
</select>
<select id="selectAll" resultType="com.lz.modules.app.entity.DepartmentsStaffRelateEntity">
select * from lz_departments_staff_relate where is_delete = 0
select * from lz_departments_staff_relate where is_delete = 0 and company_id = #{companyId}
</select>
<select id="selectLastDepartmentByStaffId"

View File

@ -29,13 +29,14 @@
<result column="job_number" property="jobNumber"/>
<result column="password" property="password"/>
<result column="salt" property="salt"/>
<result column="company_id" property="companyId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, create_time AS createTime, update_time AS updateTime, name AS name, gender AS gender, birthday AS birthday, marital_status AS maritalStatus, national AS national, political_landscape AS politicalLandscape, mobile AS mobile, province AS province, emergency_contact AS emergencyContact, emergency_contact_relation AS emergencyContactRelation, emergency_contact_phone AS emergencyContactPhone, email AS email, current_address AS currentAddress, open_id AS openId, employee_id AS employeeId, union_id AS unionId, parent_id AS parentId, is_master AS isMaster
id AS id, is_delete AS isDelete, create_time AS createTime, update_time AS updateTime, name AS name, gender AS gender, birthday AS birthday, marital_status AS maritalStatus, national AS national, political_landscape AS politicalLandscape, mobile AS mobile, province AS province, emergency_contact AS emergencyContact, emergency_contact_relation AS emergencyContactRelation, emergency_contact_phone AS emergencyContactPhone, email AS email, current_address AS currentAddress, open_id AS openId, employee_id AS employeeId, union_id AS unionId, parent_id AS parentId, is_master AS isMaster, company_id AS companyId
</sql>
@ -446,7 +447,7 @@
</select>
<select id="selectAll" resultType="com.lz.modules.app.entity.StaffEntity">
select * from lz_staff where is_delete = 0
select * from lz_staff where is_delete = 0 and company_id = #{companyId}
</select>
<select id="getPositionByStaffIds" resultType="com.lz.modules.app.dto.ReportProgressListDto">

View File

@ -26,6 +26,7 @@
<result property="jobSeniority" column="job_seniority"/>
<result property="workExperience" column="work_experience"/>
<result property="resumeUrl" column="resume_url"/>
<result column="company_id" property="companyId"/>
</resultMap>
<select id="getStaffOccupationByStaffId" resultType="com.lz.modules.app.entity.StaffOccupationEntity">

View File

@ -85,9 +85,8 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_indicator_library"));
list.add(new TablesBean("lz_indicator_type"));
list.add(new TablesBean("lz_task_resp"));
list.add(new TablesBean("lz_departments_staff_relate"));
list.add(new TablesBean("lz_staff"));
List<TablesBean> list2 = new ArrayList<TablesBean>();