|
|
|
@ -38,6 +38,8 @@ import weaver.general.BaseBean;
|
|
|
|
|
import weaver.general.GCONST;
|
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.company.DepartmentComInfo;
|
|
|
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
@ -131,7 +133,7 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|
|
|
|
StaffPO staffPO = StaffBO.convertParamToPO(param, (long) user.getUID());
|
|
|
|
|
OrganizationAssert.isFalse(staffPO.getStaffNum() < 0, "编制数不可小于0,请更正");
|
|
|
|
|
List<StaffPO> verify = getStaffMapper().customSelect(param.getPlanId(), param.getEcCompany(), param.getEcDepartment(), param.getJobId());
|
|
|
|
|
if(!verify.isEmpty()){
|
|
|
|
|
if (!verify.isEmpty()) {
|
|
|
|
|
throw new OrganizationRunTimeException("同一编制方案下,同一维度的编制信息不可重复创建!");
|
|
|
|
|
}
|
|
|
|
|
checkRequired(staffPO);
|
|
|
|
@ -471,15 +473,27 @@ public class StaffServiceImpl extends Service implements StaffService {
|
|
|
|
|
* @param staffPO 编制信息实体列
|
|
|
|
|
*/
|
|
|
|
|
public static void initStaffInfo(StaffPO staffPO) {
|
|
|
|
|
boolean hasDepartment = null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment();
|
|
|
|
|
boolean hasJob = null != staffPO.getJobId() && 0 != staffPO.getJobId();
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = "select count(1) as num from hrmresource where STATUS < 4";
|
|
|
|
|
if (null != staffPO.getEcCompany() && 0 != staffPO.getEcCompany()) {
|
|
|
|
|
sql += " and subcompanyid1 = " + staffPO.getEcCompany();
|
|
|
|
|
ArrayList<String> subCompanyList = new ArrayList<>();
|
|
|
|
|
subCompanyList.add(staffPO.getEcCompany().toString());
|
|
|
|
|
if (!hasJob && !hasDepartment) {
|
|
|
|
|
new SubCompanyComInfo().getSubCompanyLists(staffPO.getEcCompany().toString(), subCompanyList);
|
|
|
|
|
}
|
|
|
|
|
sql += " and subcompanyid1 in (" + StringUtils.join(subCompanyList, ",") + ")";
|
|
|
|
|
}
|
|
|
|
|
if (null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment()) {
|
|
|
|
|
sql += " and departmentid = " + staffPO.getEcDepartment();
|
|
|
|
|
if (hasDepartment) {
|
|
|
|
|
ArrayList<String> departmentList = new ArrayList<>();
|
|
|
|
|
departmentList.add(staffPO.getEcDepartment().toString());
|
|
|
|
|
if (!hasJob) {
|
|
|
|
|
new DepartmentComInfo().getAllChildDeptByDepId(departmentList, staffPO.getEcDepartment().toString());
|
|
|
|
|
}
|
|
|
|
|
sql += " and departmentid in (" + StringUtils.join(departmentList, ",") + ")";
|
|
|
|
|
}
|
|
|
|
|
if (null != staffPO.getJobId() && 0 != staffPO.getJobId()) {
|
|
|
|
|
if (hasJob) {
|
|
|
|
|
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(Long.valueOf(staffPO.getJobId()));
|
|
|
|
|
if (null == jobById) {
|
|
|
|
|
return;
|
|
|
|
|