|
|
|
@ -16,10 +16,12 @@ import com.engine.organization.util.OrganizationDateUtil;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import weaver.common.DateUtil;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import java.sql.Date;
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
@ -52,6 +54,8 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
saveDeptToMap(params);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
saveHrmToMap(params);
|
|
|
|
|
saveHrmToVersion(params, user);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@ -104,8 +108,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
void saveDeptToMap(Map<String, Object> params) {
|
|
|
|
|
String id = (String) params.get("id");
|
|
|
|
|
int st = 100000000;
|
|
|
|
|
int sj = 200000000;
|
|
|
|
|
int sk = 300000000;
|
|
|
|
|
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
|
|
|
|
|
|
|
|
|
JclOrgMap jclOrgMap = new JclOrgMap();
|
|
|
|
@ -123,7 +126,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
jclOrgMap.setFLeaderJobId(Math.toIntExact(hrmResourcePO.getJobTitle()));
|
|
|
|
|
}
|
|
|
|
|
jclOrgMap.setFName((String) params.get("departmentName"));
|
|
|
|
|
jclOrgMap.setFParentId(Integer.parseInt((String) params.get("subCompanyId1")));
|
|
|
|
|
jclOrgMap.setFParentId(st+Integer.parseInt((String) params.get("subCompanyId1")));
|
|
|
|
|
jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|
jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2022-12-31").getTime()));
|
|
|
|
|
jclOrgMap.setFIsVitual(0);
|
|
|
|
@ -148,12 +151,63 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
getJclOrgMapMapper().insertMap(jclOrgMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 人员保存至map
|
|
|
|
|
*/
|
|
|
|
|
void saveHrmToMap(Map<String, Object> params){
|
|
|
|
|
String id = (String) params.get("id");
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
|
|
|
|
int sk = 300000000;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
|
|
JclOrgMap jclOrgMap = new JclOrgMap();
|
|
|
|
|
jclOrgMap.setId(sk + Integer.parseInt(id));
|
|
|
|
|
jclOrgMap.setFType(4);
|
|
|
|
|
jclOrgMap.setFObjId(Integer.parseInt(id));
|
|
|
|
|
jclOrgMap.setFClass(0);
|
|
|
|
|
jclOrgMap.setFClassName("行政维度");
|
|
|
|
|
jclOrgMap.setFName((String) params.get("lastname"));
|
|
|
|
|
if (StringUtils.isNotBlank(id)) {
|
|
|
|
|
rs.executeQuery("select messagerurl, lastname, jobtitle from hrmresource where id="+id+";");
|
|
|
|
|
if (rs.next()){
|
|
|
|
|
jclOrgMap.setFLeaderImg(Util.null2String(rs.getString("messagerurl")));
|
|
|
|
|
jclOrgMap.setFLeaderName(Util.null2String(rs.getString("lastname")));
|
|
|
|
|
jclOrgMap.setFLeaderJobId(Integer.valueOf(rs.getString("jobtitle")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
jclOrgMap.setFParentId(sk+Integer.parseInt((String) params.get("jobtitle")));
|
|
|
|
|
JclOrgMap jclOrgMapByFParentId = getJclOrgMapMapper().getSumPlanAndJobByFParentId(jclOrgMap.getFDateBegin(), String.valueOf(jclOrgMap.getFParentId()));
|
|
|
|
|
if (null != jclOrgMapByFParentId) {
|
|
|
|
|
jclOrgMap.setFPlan(jclOrgMapByFParentId.getFPlan());
|
|
|
|
|
jclOrgMap.setFOnJob(jclOrgMapByFParentId.getFOnJob());
|
|
|
|
|
} else {
|
|
|
|
|
jclOrgMap.setFPlan(0);
|
|
|
|
|
jclOrgMap.setFOnJob(0);
|
|
|
|
|
}
|
|
|
|
|
jclOrgMap.setFIsVitual(0);
|
|
|
|
|
jclOrgMap.setFDateBegin(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|
jclOrgMap.setFDateEnd(new Date(OrganizationDateUtil.stringToDate("2022-12-31").getTime()));
|
|
|
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
|
cal.setTime(jclOrgMap.getFDateBegin());
|
|
|
|
|
Calendar calendar = DateUtil.addDay(cal, -1);
|
|
|
|
|
Date time = new Date(calendar.getTime().getTime());
|
|
|
|
|
|
|
|
|
|
getJclOrgMapMapper().deleteMap("4", id, jclOrgMap.getFDateBegin());
|
|
|
|
|
getJclOrgMapMapper().updateMap("4", id, jclOrgMap.getFDateBegin(), time);
|
|
|
|
|
|
|
|
|
|
getJclOrgMapMapper().insertMap(jclOrgMap);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分部保存至版本表
|
|
|
|
|
*/
|
|
|
|
|
void saveSubComToVersion(Map<String, Object> params,User user) {
|
|
|
|
|
String id = (String) params.get("id");
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDateTime(new java.util.Date());
|
|
|
|
|
|
|
|
|
|
HrmSubCompanyVersion hrmSubCompanyVersion = new HrmSubCompanyVersion();
|
|
|
|
|
hrmSubCompanyVersion.setSubComId(Integer.parseInt(id));
|
|
|
|
@ -168,7 +222,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
hrmSubCompanyVersion.setDescription((String) params.get("description"));
|
|
|
|
|
hrmSubCompanyVersion.setOperator(user.getUsername());
|
|
|
|
|
hrmSubCompanyVersion.setVersion(genVersionId(1,id));
|
|
|
|
|
hrmSubCompanyVersion.setOperateTime(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|
hrmSubCompanyVersion.setOperateTime(new Timestamp(OrganizationDateUtil.stringToDateTime(currentDate).getTime()));
|
|
|
|
|
|
|
|
|
|
getCompanyVersionMapper().insertHrmSubComVersion(hrmSubCompanyVersion);
|
|
|
|
|
}
|
|
|
|
@ -178,7 +232,7 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
*/
|
|
|
|
|
void saveComToVersion(Map<String, Object> params,User user) {
|
|
|
|
|
String id = (String) params.get("id");
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date());
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDateTime(new java.util.Date());
|
|
|
|
|
|
|
|
|
|
HrmDepartmentVersion hrmDepartmentVersion = new HrmDepartmentVersion();
|
|
|
|
|
hrmDepartmentVersion.setDepartmentId(Integer.parseInt(id));
|
|
|
|
@ -197,11 +251,40 @@ public class VersionManageServiceImpl extends Service implements VersionManageSe
|
|
|
|
|
hrmDepartmentVersion.setDescription((String) params.get("description"));
|
|
|
|
|
hrmDepartmentVersion.setOperator(user.getLastname());
|
|
|
|
|
hrmDepartmentVersion.setVersion(genVersionId(2,id));
|
|
|
|
|
hrmDepartmentVersion.setOperateTime(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|
hrmDepartmentVersion.setOperateTime(new Timestamp(OrganizationDateUtil.stringToDateTime(currentDate).getTime()));
|
|
|
|
|
|
|
|
|
|
getCompanyVersionMapper().insertHrmDeptVersion(hrmDepartmentVersion);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 人员保存至版本
|
|
|
|
|
*/
|
|
|
|
|
void saveHrmToVersion(Map<String, Object> params,User user){
|
|
|
|
|
String id = (String) params.get("id");
|
|
|
|
|
String currentDate = OrganizationDateUtil.getFormatLocalDateTime(new java.util.Date());
|
|
|
|
|
|
|
|
|
|
HrmResourceVersion hrmResourceVersion = new HrmResourceVersion();
|
|
|
|
|
hrmResourceVersion.setResourceid(Integer.parseInt(id));
|
|
|
|
|
/* hrmResourceVersion.setCompanystartdate(new Date(OrganizationDateUtil.stringToDate((String) params.get("companystartdate")).getTime()));
|
|
|
|
|
hrmResourceVersion.setCompanyworkyear(Integer.parseInt((String) params.get("companyworkyear")));
|
|
|
|
|
hrmResourceVersion.setWorkstartdate(new Date(OrganizationDateUtil.stringToDate((String) params.get("workstartdate")).getTime()));*/
|
|
|
|
|
|
|
|
|
|
hrmResourceVersion.setDepartmentid(Integer.parseInt((String) params.get("departmentid")));
|
|
|
|
|
hrmResourceVersion.setDsporder(Double.valueOf((String) params.get("dsporder")).intValue());
|
|
|
|
|
hrmResourceVersion.setSubcompanyid1(Integer.parseInt((String) params.get("subcompanyid1")));
|
|
|
|
|
hrmResourceVersion.setJobtitle(Integer.parseInt((String) params.get("jobtitle")));
|
|
|
|
|
hrmResourceVersion.setMobile((String) params.get("mobile"));
|
|
|
|
|
hrmResourceVersion.setTelephone((String) params.get("telephone"));
|
|
|
|
|
hrmResourceVersion.setManagerid(Integer.parseInt((String) params.get("managerid")));
|
|
|
|
|
hrmResourceVersion.setLastname((String) params.get("lastname"));
|
|
|
|
|
hrmResourceVersion.setOperator(user.getLastname());
|
|
|
|
|
hrmResourceVersion.setVersion(genVersionId(4,id));
|
|
|
|
|
hrmResourceVersion.setOperateTime(new Timestamp(OrganizationDateUtil.stringToDateTime(currentDate).getTime()));
|
|
|
|
|
|
|
|
|
|
getCompanyVersionMapper().insertHrmResourceVersion(hrmResourceVersion);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 版本号生成
|
|
|
|
|
*/
|
|
|
|
|