yuanzhi_kuang пре 3 месеци
родитељ
комит
da0111f86e
1 измењених фајлова са 62 додато и 3 уклоњено
  1. 62 3
      GDYSL/websrc/com/kingdee/shr/customer/gtiit/osf/SynADService.java

+ 62 - 3
GDYSL/websrc/com/kingdee/shr/customer/gtiit/osf/SynADService.java

@@ -68,6 +68,12 @@ public class SynADService implements IHRMsfService {
 			while (preRow.next())
 				personIdSet.add(preRow.getString("fid"));
 
+
+ 			// 查询合同变动的员工  20250829
+			preSql = " SELECT  fpersonid   from CT_MP_Pcontractinfo  where   flastupdatetime >='" + startDate + "' and flastupdatetime <='" + endDate + "'";
+			IRowSet pcoRow = DbUtil.executeQuery(ctx, preSql);
+			while (pcoRow.next())   personIdSet.add(pcoRow.getString("fpersonid"));
+
 			// 查询员工信息变动的员工
 			String lastDateSql = "SELECT fid FROM T_BD_Person where flastupdatetime>='" + startDate +
 					"' and flastupdatetime<='" + endDate + "'";
@@ -95,6 +101,8 @@ public class SynADService implements IHRMsfService {
 					sb.append("'").append(value).append("',");
 				sb.deleteCharAt(sb.length() - 1);
 			}
+			//202508  手机号用于去重
+			HashSet<String> telephoneNumberSet = new HashSet<>();
 
 			// 构建主查询SQL
 			// 查询非预入职员工信息
@@ -107,6 +115,12 @@ public class SynADService implements IHRMsfService {
 					.append("cmpt.cfexpireddate AS extensionAttribute10, ")
 					.append("sj.department department, ")
 					.append("sj.title title, ")
+					//兼职
+					.append("jz.department Division, ")
+					.append("jz.title extensionAttribute15, ")
+					.append("jz.manager AS extensionAttribute14 , ")
+					//
+					
 					.append("p.fnumber personnumber, ")
 					.append("p.femail mail, ")
 					.append("p.femail userPrincipalName, ")
@@ -166,6 +180,27 @@ public class SynADService implements IHRMsfService {
 					.append("    LEFT JOIN T_ORG_Admin org ON org.fid = c.fadminorgid ")
 					.append("    LEFT JOIN T_HR_HRBizDefine biz ON biz.fid = c.factionid")
 					.append(") sj ON sj.fpersonid = p.fid ")
+					//兼职 2025-08-29
+					.append("LEFT JOIN (")
+					.append("    SELECT c.fpersonid fpersonid, d.cfusername manager, ")
+					.append("           post.fname_l1 title, org.fname_l1 department, biz.fnumber bizNumber ")
+					.append("    FROM (")
+					.append("        SELECT a.fpersonid fpersonid, a.cflinemanagernamei cflinemanagernamei, ")
+					.append("               a.fpositionid fpositionid, a.fadminorgid fadminorgid, a.factionid factionid ")
+					.append("        FROM T_HR_EmpOrgRelation a ")
+					.append("        INNER JOIN (")
+					.append("            SELECT MAX(fleffdt) maxDate, fpersonid fpersonid ")
+					.append("            FROM T_HR_EmpOrgRelation ")
+					.append("            WHERE FIsLatestInAday = '1' AND FAssignType = '0' ")
+					.append("            GROUP BY fpersonid")
+					.append("        ) b ON a.fpersonid = b.fpersonid AND a.fleffdt = b.maxDate ")
+					.append("        WHERE a.FIsLatestInAday = '1' AND a.FAssignType = '0'")
+					.append("    ) c ")
+					.append("    LEFT JOIN T_BD_PERSON d ON c.cflinemanagernamei = d.fid ")
+					.append("    LEFT JOIN T_ORG_Position post ON post.fid = c.fpositionid ")
+					.append("    LEFT JOIN T_ORG_Admin org ON org.fid = c.fadminorgid ")
+					.append("    LEFT JOIN T_HR_HRBizDefine biz ON biz.fid = c.factionid")
+					.append(") jz ON jz.fpersonid = p.fid ")
 					.append("LEFT JOIN T_HR_BDEmployeeType zt ON zt.fid = p.femployeetypeid ")
 					.append("LEFT JOIN (")
 					.append("    SELECT a.fpersonid, b.fenterdate, b.FEFFDT, b.fleffdt ")
@@ -227,8 +262,9 @@ public class SynADService implements IHRMsfService {
 				// 邮箱地址
 				jsonObject.put("mail", iRowSet.getString("mail"));
 				// 办公电话
-				if (StringUtils.isNotBlank(iRowSet.getString("telephoneNumber")))
+				if (StringUtils.isNotBlank(iRowSet.getString("telephoneNumber"))){
 					jsonObject.put("telephoneNumber", iRowSet.getString("telephoneNumber"));
+				}
 				// 职位
 				jsonObject.put("title", iRowSet.getString("title"));
 				// 所属部门
@@ -265,11 +301,18 @@ public class SynADService implements IHRMsfService {
 				jsonObject.put("extensionAttribute10", stringDateFormat(iRowSet.getDate("extensionAttribute10")));
 				// 私人手机
 				jsonObject.put("extensionAttribute11", iRowSet.getString("extensionAttribute11"));
+				telephoneNumberSet.add(iRowSet.getString("extensionAttribute11"));
 				// 失效日期
 				jsonObject.put("AccountExpirationDate", AccountExpirationDate);
 				// 再就业标识
 				if (StringUtils.isNotBlank(iRowSet.getString("extensionAttribute12")))
 					jsonObject.put("extensionAttribute12", iRowSet.getString("extensionAttribute12"));
+				//202508  兼职
+				// 所属部门
+				jsonObject.put("Division", iRowSet.getString("Division"));
+				//  职位
+				jsonObject.put("extensionAttribute15", iRowSet.getString("extensionAttribute15"));
+				jsonObject.put("extensionAttribute14", iRowSet.getString("extensionAttribute14"));
 				jsonArray.add(jsonObject);
 			}
 
@@ -362,8 +405,16 @@ public class SynADService implements IHRMsfService {
 				// 邮箱地址
 				jsonObject.put("mail", iRowSet2.getString("mail"));
 				// 手机号码
-				if (StringUtils.isNotBlank(iRowSet2.getString("telephoneNumber")))
+				if (StringUtils.isNotBlank(iRowSet2.getString("telephoneNumber"))){
 					jsonObject.put("extensionAttribute11", iRowSet2.getString("telephoneNumber"));
+					jsonObject.put("telephoneNumber", iRowSet2.getString("telephoneNumber"));
+					// 手机号码去重,人去重
+					if(telephoneNumberSet.contains(iRowSet2.getString("telephoneNumber"))){
+						continue;
+					}
+					telephoneNumberSet.add(iRowSet2.getString("telephoneNumber"));
+				}
+
 				// 职位
 				jsonObject.put("title", iRowSet2.getString("title"));
 				// 所属部门
@@ -463,8 +514,16 @@ public class SynADService implements IHRMsfService {
 				// 邮箱地址
 				jsonObject.put("mail", iRowSet3.getString("mail"));
 				// 手机号码
-				if (StringUtils.isNotBlank(iRowSet3.getString("extensionAttribute11")))
+				if (StringUtils.isNotBlank(iRowSet3.getString("extensionAttribute11"))){
 					jsonObject.put("extensionAttribute11", iRowSet3.getString("extensionAttribute11"));
+					jsonObject.put("telephoneNumber", iRowSet3.getString("extensionAttribute11"));
+					//去重
+					if(telephoneNumberSet.contains(iRowSet3.getString("extensionAttribute11"))){
+						continue;
+					}
+					telephoneNumberSet.add(iRowSet3.getString("extensionAttribute11"));
+				}
+
 				// 职位
 				jsonObject.put("title", iRowSet3.getString("title"));
 				// 所属部门