|
@@ -44,37 +44,38 @@ public class ScheduleTaskServiceImpl implements IScheduleTaskServer {
|
|
|
@Autowired
|
|
|
private DDClient dClient;
|
|
|
|
|
|
-//请假类型
|
|
|
+ //请假类型
|
|
|
@Override
|
|
|
public void syncHolidayType() {
|
|
|
// 获取请假类型数据
|
|
|
- List<Map<String, String>> holidayTypes = scheduleTaskMapper.getholidayType();
|
|
|
- for (Map<String, String> holidayType : holidayTypes) {
|
|
|
+ List<Map<String, String>> holidayTypes = scheduleTaskMapper.getholidayType();
|
|
|
+ for (Map<String, String> holidayType : holidayTypes) {
|
|
|
|
|
|
// key一定要是, (逗号+空格)方便匹配的时候数据切割
|
|
|
- String sc = "textField_ltxp9j1b, textField_lvxlsg7g, textField_lw1fdclw, textField_lwaiw7ig, textField_lvylr7ij";
|
|
|
- String fd = "textField_ltxp9j17, textField_ltxp9j1b, numberField_ltxp9j18, numberField_ltxp9j19, textField_lvylr7ij, textField_lw1fdclw, textField_lvxlsg7g, textField_ltxp9j1a, textField_lwaiw7ig";
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid("FORM-60CEBDC490C74A36904B3776211C5CCA3Y8N")
|
|
|
- .searchCondition(JSONObject.toJSONString(UtilMap.map(sc, holidayType.get("HOLIDAYCODE"), holidayType.get("VALIDYEAR"), holidayType.get("PEOPLECODE"), holidayType.get("TELPHONE"), holidayType.get("PEOPLE"))))
|
|
|
- .formDataJson(JSONObject.toJSONString(UtilMap.map(fd, holidayType.get("HOLIDAYNAME"), holidayType.get("HOLIDAYCODE"), holidayType.get("REALLIMIT"), holidayType.get("FREEZELIMIT"), holidayType.get("PEOPLE"),holidayType.get("PEOPLECODE"), holidayType.get("VALIDYEAR"), holidayType.get("UNIT"), holidayType.get("TELPHONE"))))
|
|
|
- .build(),YDConf.FORM_OPERATION.upsert);
|
|
|
-
|
|
|
- }
|
|
|
+ String sc = "textField_ltxp9j1b, textField_lvxlsg7g, textField_lw1fdclw, textField_lwaiw7ig, textField_lvylr7ij";
|
|
|
+ String fd = "textField_ltxp9j17, textField_ltxp9j1b, numberField_ltxp9j18, numberField_ltxp9j19, textField_lvylr7ij, textField_lw1fdclw, textField_lvxlsg7g, textField_ltxp9j1a, textField_lwaiw7ig";
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-60CEBDC490C74A36904B3776211C5CCA3Y8N")
|
|
|
+ .searchCondition(JSONObject.toJSONString(UtilMap.map(sc, holidayType.get("HOLIDAYCODE"), holidayType.get("VALIDYEAR"), holidayType.get("PEOPLECODE"), holidayType.get("TELPHONE"), holidayType.get("PEOPLE"))))
|
|
|
+ .formDataJson(JSONObject.toJSONString(UtilMap.map(fd, holidayType.get("HOLIDAYNAME"), holidayType.get("HOLIDAYCODE"), holidayType.get("REALLIMIT"), holidayType.get("FREEZELIMIT"), holidayType.get("PEOPLE"), holidayType.get("PEOPLECODE"), holidayType.get("VALIDYEAR"), holidayType.get("UNIT"), holidayType.get("TELPHONE"))))
|
|
|
+ .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
-//招聘来源
|
|
|
+
|
|
|
+ //招聘来源
|
|
|
@Override
|
|
|
public void syncRecruitSource() {
|
|
|
List<Map<String, String>> recruitSource = scheduleTaskMapper.getRecruitSource();
|
|
|
for (Map<String, String> source : recruitSource) {
|
|
|
|
|
|
- if(source.get("RECRUITCODE")!=null){
|
|
|
+ if (source.get("RECRUITCODE") != null) {
|
|
|
String RS = "textField_lui2bzdj, textField_lui2bzdk";
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.formUuid("FORM-7244B897AA4F47FBBED33C0D8DB50E4E835C")
|
|
|
.searchCondition(JSONObject.toJSONString(UtilMap.map("textField_lui2bzdk", source.get("RECRUITCODE"))))
|
|
|
.formDataJson(JSONObject.toJSONString(UtilMap.map(RS, source.get("RECRUITNAME"), source.get("RECRUITCODE"))))
|
|
|
- .build(),YDConf.FORM_OPERATION.upsert);
|
|
|
+ .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -82,71 +83,145 @@ public class ScheduleTaskServiceImpl implements IScheduleTaskServer {
|
|
|
|
|
|
}
|
|
|
|
|
|
-// 岗位信息
|
|
|
+ // 岗位信息
|
|
|
@Override
|
|
|
public void syncPositionSource() {
|
|
|
List<Map<String, String>> positions = scheduleTaskMapper.getPosition();
|
|
|
for (Map<String, String> position : positions)
|
|
|
- if(position.get("JOBCODE")!=null)
|
|
|
- {
|
|
|
+ if (position.get("JOBCODE") != null) {
|
|
|
String PS = "textField_lupd5hjh, textField_lupd5hji, textField_lupd5hjj, textField_lupd5hjk, textField_lvyv8631";
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.formUuid("FORM-543561E5EF2848CE98311B5DF9AD4AB90DQJ")
|
|
|
.searchCondition(JSONObject.toJSONString(UtilMap.map("textField_lvyv8631", position.get("JOBCODE"))))
|
|
|
.formDataJson(JSONObject.toJSONString(UtilMap.map(PS, position.get("POSITIONNAME"), position.get("SIMPLENAME"), position.get("POSITIONCODE"), position.get("JOBNAME"), position.get("JOBCODE"))))
|
|
|
- .build(),YDConf.FORM_OPERATION.upsert);
|
|
|
+ .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
-//人员信息
|
|
|
+
|
|
|
+ //人员信息
|
|
|
@Override
|
|
|
public void syncPerson() throws ParseException {
|
|
|
|
|
|
List<Map<String, String>> people = scheduleTaskMapper.getPerson();
|
|
|
for (Map<String, String> person : people) {
|
|
|
|
|
|
- try{
|
|
|
+ try {
|
|
|
String mobile = person.get("PHONE");
|
|
|
- if(mobile!=null){
|
|
|
+ if (mobile != null) {
|
|
|
Map map = ddClient_contacts.getUserInfoByMobile(dClient.getAccessToken(), mobile);
|
|
|
- log.info("map:{}",map.get("userid"));
|
|
|
+ log.info("map:{}", map.get("userid"));
|
|
|
+ List<Object> list1=new ArrayList<>();
|
|
|
+ List<Object> list2=new ArrayList<>();
|
|
|
+ List<Object> list3=new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
// 时间戳格式化
|
|
|
// String hiredate = JSONObject.toJSONStringWithDateFormat(person.get("HIREDATE"), "yyyy-MM-dd ");
|
|
|
// String empDate = JSONObject.toJSONStringWithDateFormat(person.get("EMPDATE"), "yyyy-MM-dd ");
|
|
|
if (true) {
|
|
|
- String SC ="textField_ltz8oj7i, textField_lu143isi, textField_lwahamao";
|
|
|
- String PR = "employeeField_ltz8oj7g, textField_ltz8oj7i, textField_lu143isi, textField_lvyzmtte, textField_lu9kqmgo, textField_lu9kqmgt, textField_lveut51i, textField_lveut51j, textField_luv30uq1, numberField_lwokzscl, textField_ltz8oj7m, textField_lveut51k, textField_lwahamao, dateField_lxb6up8p, dateField_lxb6up8q";
|
|
|
+ ///一批量的HR数据(所属公司字段,所在分部字段)
|
|
|
+ //根据公司得出depid; 文本,depid
|
|
|
+ //根据公司depid+所在分部字段 ===dept_id
|
|
|
+ //
|
|
|
+
|
|
|
+ String ssgsid = "";
|
|
|
+ String ssfbID = "";
|
|
|
+ String ssfbOID = "";
|
|
|
+ List<Map> map_bew = ddClient_contacts.listSubDepartmentDetail(dClient.getAccessToken(), 1);
|
|
|
+ for (Map m : map_bew) {
|
|
|
+//["ssgsid" ]
|
|
|
+// if(person.get("COMPANYNAME").toString().equals("瑞思教育")){
|
|
|
+// ssgsid = "594629905";
|
|
|
+// }
|
|
|
+
|
|
|
+ if (m.get("name").equals(person.get("COMPANYNAME").toString())) {
|
|
|
+ ssgsid = String.valueOf(m.get("dept_id"));
|
|
|
+ if (ssgsid != null) {
|
|
|
+ list1.add(ssgsid);
|
|
|
+ System.out.println("该用户的公司list1:"+list1);
|
|
|
+ List<Map> map_Dew = ddClient_contacts.listSubDepartmentDetail(dClient.getAccessToken(), Long.parseLong(ssgsid));
|
|
|
+ for (Map ms : map_Dew) {
|
|
|
+ System.out.println(ms.get("name"));
|
|
|
+ System.out.println("从数据库获得的分部:"+person.get("PARENTORGNAME"));
|
|
|
+
|
|
|
+ if (ms.get("name").equals(person.get("PARENTORGNAME").toString())) {
|
|
|
+ ssfbID = ms.get("dept_id").toString();
|
|
|
+ list2.add(ssfbID);
|
|
|
+ System.out.println("该用户的分部list2:"+list2);
|
|
|
+
|
|
|
+ if (ssfbID != null) {
|
|
|
+ List<Map> map_Oew = ddClient_contacts.listSubDepartmentDetail(dClient.getAccessToken(), Long.parseLong(ssfbID));
|
|
|
+ for (Map mo : map_Oew) {
|
|
|
+
|
|
|
+ System.out.println(mo.get("name"));
|
|
|
+ System.out.println("从数据库获得的部门:"+person.get("ORGNAME"));
|
|
|
+ if (mo.get("name").equals(person.get("ORGNAME").toString())) {
|
|
|
+ ssfbOID = mo.get("dept_id").toString();
|
|
|
+ list3.add(ssfbOID);
|
|
|
+ System.out.println("该用户的部门list3:"+list3);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (ssgsid != null) {
|
|
|
+// List<Map> map_Dew = ddClient_contacts.listSubDepartmentDetail(dClient.getAccessToken(), Long.parseLong(ssgsid));
|
|
|
+// for (Map ms : map_Dew) {
|
|
|
+// System.out.println(ms.get("name"));
|
|
|
+// if (ms.get("name").equals(person.get("PARENTORGNAME").toString())) {
|
|
|
+// ssfbID = ms.get("dept_id").toString();
|
|
|
+// System.out.println("该用户的分部:"+ssfbID);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ System.out.println(ssgsid + ";" + ssfbID+ ";" + ssfbOID);
|
|
|
+
|
|
|
+ String SC = "textField_ltz8oj7i, textField_lu143isi, textField_lwahamao";
|
|
|
+ String PR = "employeeField_ltz8oj7g, textField_ltz8oj7i, textField_lu143isi, textField_lvyzmtte, textField_lu9kqmgo, textField_lu9kqmgt, textField_lveut51i, textField_lveut51j, textField_luv30uq1, numberField_lwokzscl, textField_ltz8oj7m, textField_lveut51k, textField_lwahamao, dateField_lxb6up8p, dateField_lxb6up8q, departmentSelectField_lyqy1pou, departmentSelectField_lyqxfhfp, departmentSelectField_lz6dh5n7";
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.formUuid("FORM-2C10C625AF2D456F93852DFEAEBF9C349IQA")
|
|
|
- .searchCondition(JSONObject.toJSONString(UtilMap.map(SC, person.get("EHR"),person.get("NAME"),person.get("PHONE"))))
|
|
|
- .formDataJson(JSONObject.toJSONString(UtilMap.map(PR, map.get("userid").toString(), person.get("EHR"),person.get("NAME"),person.get("ENAME"),person.get("POSITIONNAME"),person.get("POSITIONCODE"),person.get("ORGNAME"),person.get("ORGNUMBER"),person.get("ZHIJINAME"),person.get("ZHIJICODE"),person.get("COMPANYNAME"),person.get("COMPANYCODE"),person.get("PHONE"),person.get("HIREDATE"),person.get("EMPDATE"))))
|
|
|
+ .searchCondition(JSONObject.toJSONString(UtilMap.map(SC, person.get("EHR"), person.get("NAME"), person.get("PHONE"))))
|
|
|
+ .formDataJson(JSONObject.toJSONString(UtilMap.map(PR, map.get("userid").toString(), person.get("EHR"), person.get("NAME"), person.get("ENAME"), person.get("POSITIONNAME"), person.get("POSITIONCODE"), person.get("ORGNAME"), person.get("ORGNUMBER"), person.get("ZHIJINAME"), person.get("ZHIJICODE"), person.get("COMPANYNAME"), person.get("COMPANYCODE"), person.get("PHONE"), person.get("HIREDATE"), person.get("EMPDATE"),list1 ,list2, list3)))
|
|
|
.build(), YDConf.FORM_OPERATION.upsert);
|
|
|
}
|
|
|
}
|
|
|
- }catch (McException e){
|
|
|
- log.info("人员信息同步失败:"+e.getMessage());
|
|
|
+ } catch (McException e) {
|
|
|
+ log.info("人员信息同步失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-// @Override
|
|
|
-// public void syncDelete() {
|
|
|
-//
|
|
|
-// DDR_New ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
-// .formUuid("FORM-2C10C625AF2D456F93852DFEAEBF9C349IQA")
|
|
|
-// .build(),YDConf.FORM_QUERY.retrieve_search_form_id);
|
|
|
-//
|
|
|
-// System.out.println(ddrNew.getTotalCount());
|
|
|
-//
|
|
|
-// ydClient.operateData(YDParam.builder()
|
|
|
-// .formUuid("FORM-2C10C625AF2D456F93852DFEAEBF9C349IQA")
|
|
|
-// .asynchronousExecution(true)
|
|
|
-// .formInstanceIdList((List<String>) ddrNew.getData())
|
|
|
-// .build(),YDConf.FORM_OPERATION.delete_batch);
|
|
|
-//
|
|
|
-// }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void syncDelete() {
|
|
|
+
|
|
|
+ DDR_New ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
+ .formUuid("FORM-2C10C625AF2D456F93852DFEAEBF9C349IQA")
|
|
|
+ .build(),YDConf.FORM_QUERY.retrieve_search_form_id);
|
|
|
+
|
|
|
+ System.out.println(ddrNew.getTotalCount());
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-2C10C625AF2D456F93852DFEAEBF9C349IQA")
|
|
|
+ .asynchronousExecution(true)
|
|
|
+ .formInstanceIdList((List<String>) ddrNew.getData())
|
|
|
+ .build(),YDConf.FORM_OPERATION.delete_batch);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|