|
|
|
@ -0,0 +1,86 @@
|
|
|
|
|
package com.weaver.seconddev.jcl.organization.esb;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
|
|
import com.weaver.common.base.entity.result.WeaResult;
|
|
|
|
|
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
|
|
|
|
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @use:更新关联组织员工id
|
|
|
|
|
* @date 2025年3月31日
|
|
|
|
|
* @author xuxy
|
|
|
|
|
*/
|
|
|
|
|
@Service("UpdateGlzzygidAction_jcl")
|
|
|
|
|
public class UpdateGlzzygidAction implements EsbServerlessRpcRemoteInterface {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private DatabaseUtils databaseUtils;
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(UpdateGlzzygidAction.class);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
|
|
|
|
Map<String, Object> rs =new HashMap<>();
|
|
|
|
|
//查询组织员工表人员id
|
|
|
|
|
String sfzhm = String.valueOf(params.get("sfzhm").toString());
|
|
|
|
|
String sjh = String.valueOf(params.get("sjh").toString());
|
|
|
|
|
String yx = String.valueOf(params.get("yx").toString());
|
|
|
|
|
Map<String, Object> result = queryEmployeeInfoBySfz(sfzhm,sjh,yx);
|
|
|
|
|
log.error("UpdateGlzzygidAction.flowV3:"+result);
|
|
|
|
|
rs.put("flowV3",result);
|
|
|
|
|
return WeaResult.success(rs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> queryEmployeeInfoBySfz(String sfzhm,String sjh,String yx) {
|
|
|
|
|
Map<String, Object> rs = new HashMap<>();
|
|
|
|
|
String userId = "";
|
|
|
|
|
String sql = "";
|
|
|
|
|
String str = "";
|
|
|
|
|
int flag = 0;
|
|
|
|
|
if(StringUtils.isNotBlank(sfzhm)){
|
|
|
|
|
sql=" SELECT user from hr_userinfo where delete_type=0 and TENANT_KEY='t7n9jpeaoa' and ID_NO = '" + sfzhm + "'" ;
|
|
|
|
|
}else if(StringUtils.isNotBlank(sjh)){
|
|
|
|
|
sql=" select id from eteams.employee where delete_type=0 and TENANT_KEY='t7n9jpeaoa' and mobile = '" + sjh + "'" ;
|
|
|
|
|
flag = 1;
|
|
|
|
|
}else if(StringUtils.isNotBlank(yx)){
|
|
|
|
|
sql=" select id from eteams.employee where delete_type=0 and TENANT_KEY='t7n9jpeaoa' and email = '" + yx + "'" ;
|
|
|
|
|
flag = 2;
|
|
|
|
|
}else{
|
|
|
|
|
return rs;
|
|
|
|
|
}
|
|
|
|
|
log.error("queryEmployeeInfoBySfz.sql:{}",sql);
|
|
|
|
|
rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("queryEmployeeInfoBySfz.recordList:{}",recordList);
|
|
|
|
|
if(flag==0){
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
userId = (String) recordList.get(0).get("user");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
userId = (String) recordList.get(0).get("id");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新员工信息表
|
|
|
|
|
if(flag==0){
|
|
|
|
|
str = "update uf_jcl_employee_information set glzzyg = '" + userId + "'" +
|
|
|
|
|
" where id_no = '" + sfzhm + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 ";
|
|
|
|
|
}else if(flag==1) {
|
|
|
|
|
str = "update uf_jcl_employee_information set glzzyg = '" + userId + "'" +
|
|
|
|
|
" where mobile = '" + sjh + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 ";
|
|
|
|
|
}else {
|
|
|
|
|
str = "update uf_jcl_employee_information set glzzyg = '" + userId + "'" +
|
|
|
|
|
" where email = '" + yx + "' and TENANT_KEY = 't7n9jpeaoa' and delete_type=0 ";
|
|
|
|
|
}
|
|
|
|
|
log.error("queryEmployeeInfoBySfz.sql:{}",str);
|
|
|
|
|
rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", str);
|
|
|
|
|
log.error("UpdateYgxxInfoAction.rs:{}", rs);
|
|
|
|
|
return rs;
|
|
|
|
|
}
|
|
|
|
|
}
|