成员同步

This commit is contained in:
钱涛 2024-07-29 09:46:01 +08:00
parent 76543c6021
commit a976dbc9c5
3 changed files with 67 additions and 8 deletions

View File

@ -18,4 +18,16 @@ left join hrmresource e on e.id= result.employee_id
left join hrsa_tax_agent t on a.tax_agent_id=t.id left join hrsa_tax_agent t on a.tax_agent_id=t.id
where a.delete_type=0 and i.delete_type=0 and t.delete_type=0 and c.delete_type=0 where a.delete_type=0 and i.delete_type=0 and t.delete_type=0 and c.delete_type=0
and a.employee_id=人员id and t.name=扣缴义务人名称 and a.employee_id=人员id and t.name=扣缴义务人名称
c.name='基本工资' order by effective_time desc c.name='基本工资' order by effective_time desc
# 删除系统项目
UPDATE set hrsa_sys_salary_item where delete_type =3 where delete_type =0;
update hrsa_salary_sob_default_item set delete_type =3 where delete_type =0;
update hrsa_salary_sob_item set delete_type= 3 where delete_type =0 and salary_item_id in (select id from hrsa_salary_item where delete_type=0 and system_type=1 and use_in_employee_salary =0 and code not in('ressueTotal','issuedTotal')
);
UPDATE hrsa_salary_item set delete_type = 3 where delete_type=0 and system_type=1 and use_in_employee_salary =0 and code not in('ressueTotal','issuedTotal');

View File

@ -1,9 +1,13 @@
package com.engine.salary.enums.auth; package com.engine.salary.enums.auth;
import com.engine.common.service.HrmCommonService;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.salary.enums.BaseEnum; import com.engine.salary.enums.BaseEnum;
import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
import weaver.conn.RecordSet;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@ -20,24 +24,62 @@ import java.util.stream.Collectors;
public enum TargetTypeEnum implements BaseEnum<Integer> { public enum TargetTypeEnum implements BaseEnum<Integer> {
emp(1, "人员", 87627) { EMP(1, "人员", 87627) {
@Override @Override
public List<Long> getEmpIds(Set<String> targets) { public List<Long> getEmpIds(Set<String> targets) {
return targets.stream().map(Long::valueOf).collect(Collectors.toList()); return targets.stream().map(Long::valueOf).collect(Collectors.toList());
} }
}, },
department(2, "部门", 87626) { DEPARTMENT(2, "部门", 87626) {
@Override @Override
public List<Long> getEmpIds(Set<String> targets) { public List<Long> getEmpIds(Set<String> targets) {
List<Long> deptIds = targets.stream().map(Long::valueOf).collect(Collectors.toList()); List<Long> deptIds = targets.stream().map(Long::valueOf).collect(Collectors.toList());
SalaryEmployeeServiceImpl salaryEmployeeService = new SalaryEmployeeServiceImpl(); SalaryEmployeeServiceImpl salaryEmployeeService = new SalaryEmployeeServiceImpl();
return salaryEmployeeService.listByDepartment(deptIds); return salaryEmployeeService.listByDepartment(deptIds);
} }
},
JOB(3, "岗位", 87626) {
@Override
public List<Long> getEmpIds(Set<String> targets) {
List<Long> ids = targets.stream().map(Long::valueOf).collect(Collectors.toList());
SalaryEmployeeServiceImpl salaryEmployeeService = new SalaryEmployeeServiceImpl();
return salaryEmployeeService.listByJob(ids);
}
},
SUBCOMPANY(4, "分部", 87626) {
@Override
public List<Long> getEmpIds(Set<String> targets) {
List<Long> ids = targets.stream().map(Long::valueOf).collect(Collectors.toList());
SalaryEmployeeServiceImpl salaryEmployeeService = new SalaryEmployeeServiceImpl();
return salaryEmployeeService.listBySubCompany(ids);
}
},
ROLE(5, "角色", 87626) {
@Override
public List<Long> getEmpIds(Set<String> targets) {
HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
List<Object> memberList = new ArrayList<>();
targets.forEach(roleId -> {
memberList.addAll(hrmCommonService.getRoleMembers(roleId, "2"));
});
return memberList.stream().map(id -> Long.parseLong(id.toString()) ).collect(Collectors.toList());
}
},
SQL(6, "sql", 87626) {
@Override
public List<Long> getEmpIds(Set<String> targets) {
List<Long> memberList = new ArrayList<>();
targets.forEach(sql -> {
RecordSet rs = new RecordSet();
if (rs.execute(sql)) {
while (rs.next()) {
memberList.add(Long.parseLong(rs.getString("id")));
}
}
});
return memberList;
}
}; };
// post(3, "岗位", 87626),
// branch(4, "分部", 87626),
// role(5, "角色", 87626),
// sql(6, "sql", 87626);
private Integer value; private Integer value;

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.auth; package com.engine.salary.service.auth;
import cn.hutool.core.collection.CollUtil;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.hrmelog.entity.dto.LoggerContext;
@ -22,6 +23,7 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.*; import java.util.*;
@ -140,6 +142,9 @@ public class AuthMemberServiceImpl extends Service implements AuthMemberService
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build()) .build())
.collect(Collectors.toList()); .collect(Collectors.toList());
getAuthRoleEmpMapper().batchInsert(roleEmpPOS); if (CollUtil.isNotEmpty(roleEmpPOS)) {
List<List<AuthRoleEmpPO>> partition = Lists.partition(roleEmpPOS, 100);
partition.forEach(list -> getAuthRoleEmpMapper().batchInsert(list));
}
} }
} }