|
|
@@ -529,7 +529,32 @@ public class UasEmployeeService extends AbstractService {
|
|
|
* 当前方法仅适用于企业微信端已提前建立好人员资料
|
|
|
* */
|
|
|
public void syncAll_UpGrade(){
|
|
|
- List<Employee> employeeList = queryForBeanList("select * from employee where em_statuscode='AUDITED' and em_mobile is not null", Employee.class);
|
|
|
+ syncEmployee(null);
|
|
|
+ }
|
|
|
+ public Object convert_openUserId(){
|
|
|
+ List<Employee> employeeList = queryForBeanList("select * from employee where em_statuscode='AUDITED' and em_plainqywx is not null and em_qywx is null", Employee.class);
|
|
|
+ //通过手机号查找userID信息
|
|
|
+ if(!employeeList.isEmpty()) {
|
|
|
+ GetUserOpenIDListResp getUserOpenIDListResp = addrBookSdk.convert_openUserId(employeeList.stream().map(Employee::getEm_plainqywx).collect(Collectors.toList()));
|
|
|
+ List<GetUserOpenIDListResp.OpenUser> userList = getUserOpenIDListResp.getOpen_userid_list();
|
|
|
+ for (GetUserOpenIDListResp.OpenUser openUser : userList) {
|
|
|
+ Employee employee = employeeList.stream().filter(emp->StringUtils.hasText(emp.getEm_plainqywx())&&emp.getEm_plainqywx().equals(openUser.getUserid())).findFirst().orElse(null);
|
|
|
+ if(employee!= null){
|
|
|
+ employee.setEm_qywx(openUser.getOpen_userid());
|
|
|
+ setQywxWithPlain(employee);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getUserOpenIDListResp;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ public void syncEmployee(String mobile){
|
|
|
+ List<Employee> employeeList = null;
|
|
|
+ if(StringUtils.hasText(mobile)){
|
|
|
+ employeeList = queryForBeanList("select * from employee where em_statuscode='AUDITED' and em_mobile=?", Employee.class,mobile);
|
|
|
+ }else {
|
|
|
+ employeeList = queryForBeanList("select * from employee", Employee.class);
|
|
|
+ }
|
|
|
//通过手机号查找userID信息
|
|
|
for (Employee employee : employeeList) {
|
|
|
try {
|
|
|
@@ -544,24 +569,7 @@ public class UasEmployeeService extends AbstractService {
|
|
|
}
|
|
|
}
|
|
|
if(!employeeList.isEmpty()) {
|
|
|
- List<GetUserOpenIDListResp.OpenUser> userList = addrBookSdk.convert_openUserId(employeeList.stream().filter(emp->StringUtils.hasText(emp.getEm_plainqywx())).map(Employee::getEm_plainqywx).collect(Collectors.toList())).getOpen_userid_list();
|
|
|
- for (GetUserOpenIDListResp.OpenUser openUser : userList) {
|
|
|
- Employee employee = employeeList.stream().filter(emp->StringUtils.hasText(emp.getEm_plainqywx())&&emp.getEm_plainqywx().equals(openUser.getUserid())).findFirst().orElse(null);
|
|
|
- if(employee!= null){
|
|
|
- employee.setEm_qywx(openUser.getOpen_userid());
|
|
|
- setQywxWithPlain(employee);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- public Object convert_openUserId(){
|
|
|
- List<Employee> employeeList = queryForBeanList("select * from employee where em_statuscode='AUDITED' and em_plainqywx is not null and em_qywx is null", Employee.class);
|
|
|
- //通过手机号查找userID信息
|
|
|
- if(!employeeList.isEmpty()) {
|
|
|
- GetUserOpenIDListResp getUserOpenIDListResp = addrBookSdk.convert_openUserId(employeeList.stream().map(Employee::getEm_plainqywx).collect(Collectors.toList()));
|
|
|
- List<GetUserOpenIDListResp.OpenUser> userList = getUserOpenIDListResp.getOpen_userid_list();
|
|
|
+ List<GetUserOpenIDListResp.OpenUser> userList = addrBookSdk.convert_openUserId(employeeList.stream().filter(emp->StringUtils.hasText(emp.getEm_plainqywx())).map(Employee::getEm_plainqywx).collect(Collectors.toList())).getOpen_userid_list();
|
|
|
for (GetUserOpenIDListResp.OpenUser openUser : userList) {
|
|
|
Employee employee = employeeList.stream().filter(emp->StringUtils.hasText(emp.getEm_plainqywx())&&emp.getEm_plainqywx().equals(openUser.getUserid())).findFirst().orElse(null);
|
|
|
if(employee!= null){
|
|
|
@@ -569,8 +577,6 @@ public class UasEmployeeService extends AbstractService {
|
|
|
setQywxWithPlain(employee);
|
|
|
}
|
|
|
}
|
|
|
- return getUserOpenIDListResp;
|
|
|
}
|
|
|
- return null;
|
|
|
}
|
|
|
}
|