新建编制信息初始化在编数

pull/196/head
dxfeng 2 years ago
parent 691b4764b4
commit f4c29de76b

@ -25,6 +25,7 @@ import com.weaver.general.BaseBean;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.*;
import java.util.stream.Collectors;
@ -157,11 +158,11 @@ public class ManagerDetachServiceImpl extends Service implements ManagerDetachSe
private String buildSqlWhere(Map<String, Object> params) {
DBType dbType = DBType.get(new RecordSet().getDBType());
String sqlWhere = " where delete_type = 0";
String lastName = (String) params.get("ecManager");
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
String ecManager = StringUtils.join(resourceIds,",");
String lastName = Util.null2String(params.get("ecManager"));
if (StringUtils.isNotBlank(lastName)) {
sqlWhere += " AND ec_manager in ("+ecManager+") ";
List<Long> resourceIds = MapperProxyFactory.getProxy(EmployeeMapper.class).getResourceIds(lastName);
String ecManager = StringUtils.join(resourceIds, ",");
sqlWhere += " AND ec_manager in (" + (StringUtils.isBlank(ecManager) ? "''" : ecManager) + ") ";
}
String ecRolelevel = (String) params.get("ecRolelevel");
if (StringUtils.isNotBlank(ecRolelevel)) {

@ -132,8 +132,8 @@ public class StaffServiceImpl extends Service implements StaffService {
checkRequired(staffPO);
int ignoreNull = getStaffMapper().insertIgnoreNull(staffPO);
// 同步组织架构图编制信息
//new StaffTriggerRunnable(staffPO).run();
// 初始化编制在编数
initStaffInfo(staffPO);
return ignoreNull;
}
@ -458,4 +458,35 @@ public class StaffServiceImpl extends Service implements StaffService {
}
}
/**
*
*
* @param staffPO
*/
public static void initStaffInfo(StaffPO staffPO) {
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();
}
if (null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment()) {
sql += " and departmentid = " + staffPO.getEcDepartment();
}
if (null != staffPO.getJobId() && 0 != staffPO.getJobId()) {
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(staffPO.getJobId());
if (null == jobById) {
return;
}
Integer ecJobTitle = jobById.getEcJobTitle();
sql += " and jobtitle = " + ecJobTitle;
}
rs.executeQuery(sql);
if (rs.next()) {
staffPO.setPermanentNum(-1 == rs.getInt("num") ? 0 : rs.getInt("num"));
StaffBO.buildStaffDesc(staffPO);
MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO);
}
}
}

@ -15,6 +15,7 @@ import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffPlanMapper;
import com.engine.organization.service.impl.StaffServiceImpl;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
@ -296,6 +297,8 @@ public class StaffInfoImportUtil {
staffPO.setControlPolicy(1);
}
MapperProxyFactory.getProxy(StaffMapper.class).insertIgnoreNull(staffPO);
// 初始化编制信息
StaffServiceImpl.initStaffInfo(staffPO);
historyDetailPO.setOperateDetail("添加成功");
historyDetailPO.setStatus("1");

Loading…
Cancel
Save