generated from dxfeng/secondev-chapanda-feishu
代码合并-Lee
This commit is contained in:
parent
7188ba5a7f
commit
b47a30c621
|
|
@ -71,8 +71,11 @@ public class BeiSenOffer {
|
|||
private String pOIdEmpAdmin;
|
||||
private String pOIdEmpReserve2;
|
||||
private String employType;
|
||||
@FieldConversion(relatedTable = "uf_ryly")
|
||||
private String employmentSource;
|
||||
@FieldConversion(relatedTable = "uf_ygxs_bs")
|
||||
private String employmentForm;
|
||||
@FieldConversion(relatedTable = "uf_rylb")
|
||||
private String employmentType;
|
||||
private LocalDateTime entryDate;
|
||||
private String oIdJobPosition;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,12 @@ package com.weaver.seconddev.beisen.esb;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.cache.tablecache.impl.ComInfoCache;
|
||||
import com.weaver.common.hrm.cache.HrmEmployeeComInfo;
|
||||
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
|
||||
import com.weaver.ebuilder.form.client.service.emobile.IEtFormDatasetService;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
|
|
@ -20,7 +23,6 @@ import com.weaver.seconddev.portal.entity.param.BaseParam;
|
|||
import com.weaver.seconddev.portal.mapper.portal.EbuilderBaseMapper;
|
||||
import com.weaver.seconddev.portal.util.DateUtil;
|
||||
import com.weaver.seconddev.portal.util.PapiUtil;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
|
@ -44,23 +46,25 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
@Autowired
|
||||
Token2BeiSenUtil http2BenSenUtil;
|
||||
|
||||
|
||||
@Autowired
|
||||
OfferMapper offerMapper;
|
||||
@Autowired
|
||||
private ComInfoCache comInfoCache;
|
||||
|
||||
@Autowired
|
||||
IEtFormDatasetService etFormDatasetService;
|
||||
|
||||
@Autowired
|
||||
OfferMapper offerMapper;
|
||||
|
||||
@Autowired
|
||||
HrmCommonEmployeeDao hrmCommonEmployeeDao;
|
||||
|
||||
@Autowired
|
||||
DepartMentService departMentService;
|
||||
|
||||
@Autowired
|
||||
EbuilderBaseMapper ebuilderBaseMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
//etFormDatasetService.deleteData( params)
|
||||
|
||||
String startDate = String.valueOf(params.get("startDate"));
|
||||
|
|
@ -82,6 +86,7 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
|
||||
BaseParam baseParam = new BaseParam();
|
||||
JSONArray datas = new JSONArray();
|
||||
log.error("beiSenOfferData:{}", JSONObject.toJSONString(beiSenOfferData));
|
||||
// 遍历offer数据,插入到EB表
|
||||
for (BeiSenOffer offer : beiSenOfferData) {
|
||||
String objectId = offer.getObjectId();
|
||||
|
|
@ -108,12 +113,16 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
|
||||
|
||||
// 注解转换方式
|
||||
mainDataObj.put("location", convertOffer.getPlace());
|
||||
// mainDataObj.put("location", convertOffer.getPlace());
|
||||
mainDataObj.put("htgzdd", convertOffer.getPlace());
|
||||
mainDataObj.put("marital_status", convertOffer.getMarryCategory());
|
||||
mainDataObj.put("nation", convertOffer.getNation());
|
||||
mainDataObj.put("householdtype", convertOffer.getDomicileType());
|
||||
mainDataObj.put("education", convertOffer.getEducationLevel());
|
||||
mainDataObj.put("htlx", convertOffer.getContractType());
|
||||
mainDataObj.put("rylb", convertOffer.getEmploymentType());
|
||||
mainDataObj.put("yglx", convertOffer.getEmploymentForm());
|
||||
mainDataObj.put("ryly", convertOffer.getEmploymentSource());
|
||||
|
||||
|
||||
// 直接写入北森数据
|
||||
|
|
@ -124,10 +133,11 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
mainDataObj.put("jjlxrdh", convertOffer.getEmergencyContactPhone());
|
||||
mainDataObj.put("username", convertOffer.getName());
|
||||
// TODO 待确认
|
||||
mainDataObj.put("sex", convertOffer.getGender());
|
||||
String gender = convertOffer.getGender();
|
||||
mainDataObj.put("sex", "0".equals(gender) ? "male" : "1".equals(gender) ? "female" : null);
|
||||
mainDataObj.put("mobile", convertOffer.getMobilePhone());
|
||||
mainDataObj.put("id_no", convertOffer.getIDNumber());
|
||||
mainDataObj.put("birthday", convertOffer.getBirthday());
|
||||
mainDataObj.put("birthday", DateUtil.formatDate(convertOffer.getBirthday()));
|
||||
mainDataObj.put("age", convertOffer.getAge());
|
||||
mainDataObj.put("graduate_school", convertOffer.getLastSchool());
|
||||
mainDataObj.put("sl", convertOffer.getWorkYearCompanyTotal());
|
||||
|
|
@ -189,7 +199,7 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
String sqrEmpId = getEmployeeIdByOId(baseParam, convertOffer.getCreatedBy());
|
||||
mainDataObj.put("sqr", sqrEmpId);
|
||||
// 根据人员获取HR系统部门ID写入
|
||||
String deptIdByEmpId = getDeptIdByEmpId(baseParam, sqrEmpId);
|
||||
String deptIdByEmpId = getDeptIdByEmpId(sqrEmpId);
|
||||
mainDataObj.put("sqbm", deptIdByEmpId);
|
||||
|
||||
//mainDataObj.put("gj", "");
|
||||
|
|
@ -211,8 +221,6 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
|
||||
mainDataObj.put("first_work_date", DateUtil.formatDate(convertOffer.getWorkDate()));
|
||||
|
||||
// TODO mainDataObj.put("rylb", convertOffer.getEmploymentType());
|
||||
|
||||
String pOIdEmpReserve2 = getEmployeeIdByOId(baseParam, convertOffer.getPOIdEmpReserve2());
|
||||
mainDataObj.put("other_superior", pOIdEmpReserve2);
|
||||
|
||||
|
|
@ -221,26 +229,20 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
mainDataObj.put("frgs", legalEntityCompany.getId());
|
||||
}
|
||||
mainDataObj.put("htzzrq", DateUtil.formatDate(convertOffer.getTerminateDate()));
|
||||
// TODO
|
||||
|
||||
List<Long> deptListByLevel = new ArrayList<>();
|
||||
deptListByLevel.add(null);
|
||||
deptListByLevel.add(null);
|
||||
deptListByLevel.add(null);
|
||||
deptListByLevel.add(null);
|
||||
deptListByLevel.add(null);
|
||||
deptListByLevel.add(null);
|
||||
if (StringUtils.isNotBlank(deptIdByOId)) {
|
||||
deptListByLevel.add(Long.parseLong(deptIdByOId));
|
||||
List<Long> deptListByLevel1 = getDeptListByLevel(Long.parseLong(deptIdByOId));
|
||||
deptListByLevel.addAll(0, deptListByLevel1);
|
||||
}
|
||||
|
||||
mainDataObj.put("yjbm", deptListByLevel.get(0));
|
||||
mainDataObj.put("ejbm", deptListByLevel.get(1));
|
||||
mainDataObj.put("sanbm", deptListByLevel.get(2));
|
||||
mainDataObj.put("sijbm", deptListByLevel.get(3));
|
||||
mainDataObj.put("wjbm", deptListByLevel.get(4));
|
||||
mainDataObj.put("ljbm", deptListByLevel.get(5));
|
||||
mainDataObj.put("yjbm", deptListByLevel.size() >= 1 ? deptListByLevel.get(deptListByLevel.size() - 1) : null);
|
||||
mainDataObj.put("ejbm", deptListByLevel.size() >= 2 ? deptListByLevel.get(deptListByLevel.size() - 2) : null);
|
||||
mainDataObj.put("sanbm", deptListByLevel.size() >= 3 ? deptListByLevel.get(deptListByLevel.size() - 3) : null);
|
||||
mainDataObj.put("sijbm", deptListByLevel.size() >= 4 ? deptListByLevel.get(deptListByLevel.size() - 4) : null);
|
||||
mainDataObj.put("wjbm", deptListByLevel.size() >= 5 ? deptListByLevel.get(deptListByLevel.size() - 5) : null);
|
||||
mainDataObj.put("ljbm", deptListByLevel.size() >= 6 ? deptListByLevel.get(deptListByLevel.size() - 6) : null);
|
||||
|
||||
|
||||
// TODO mainDataObj.put("employType", convertOffer.getEmployType());
|
||||
|
|
@ -291,16 +293,11 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
String papiToken = PapiUtil.getPapiToken(ApplicationConfigConstant.APP_URL, ApplicationConfigConstant.ORGANIZATION_APP_KEY, ApplicationConfigConstant.ORGANIZATION_APP_SECRET, papiCode);
|
||||
jsonObject.put("access_token", papiToken);
|
||||
|
||||
log.error("jsonObject===" + jsonObject);
|
||||
log.error("jsonObject:{}", jsonObject.toJSONString());
|
||||
|
||||
return HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/ebuilder/form/dataset/v2/saveFormData")
|
||||
.header("Content-Type", "application/json")
|
||||
.body(jsonObject.toJSONString())
|
||||
.execute()
|
||||
.body();
|
||||
return HttpRequest.post(ApplicationConfigConstant.APP_URL + "/papi/openapi/api/ebuilder/form/dataset/v2/saveFormData").header("Content-Type", "application/json").body(jsonObject.toJSONString()).execute().body();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取北森系统offer数据
|
||||
*
|
||||
|
|
@ -328,11 +325,7 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
try {
|
||||
String url = Constants.beishenHost + Constants.offerUrl;
|
||||
|
||||
String resultStr = HttpRequest.post(url)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("Authorization", "Bearer " + token)
|
||||
.body(bodyJson.toJSONString())
|
||||
.execute()
|
||||
String resultStr = HttpRequest.post(url).header("Content-Type", "application/json").header("Authorization", "Bearer " + token).body(bodyJson.toJSONString()).execute()
|
||||
//.charset("UTF-8") // 显式指定编码
|
||||
.body();
|
||||
// Bearer X4eTEiMr-1SzSRQHqY2MuRMnVgJbxp7kYKg3ZqTvwvYlD6CXfkfq-lGI_Rl3swX3E097-rkhE
|
||||
|
|
@ -342,10 +335,7 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
JSONObject returnJson = JSONObject.parseObject(resultStr);
|
||||
if ("200".equals(returnJson.getString("code"))) {
|
||||
JSONArray dataArray = returnJson.getJSONArray("data");
|
||||
List<BeiSenOffer> offerList = JSONArray.parseArray(
|
||||
dataArray.toJSONString(),
|
||||
BeiSenOffer.class
|
||||
);
|
||||
List<BeiSenOffer> offerList = JSONArray.parseArray(dataArray.toJSONString(), BeiSenOffer.class);
|
||||
offerArray.addAll(offerList);
|
||||
scrollId = returnJson.getString("scrollId");
|
||||
hasMore = StringUtils.isNotBlank(scrollId) && dataArray.size() > 0;
|
||||
|
|
@ -429,7 +419,6 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
return null;
|
||||
}
|
||||
log.error("tableName: " + tableName);
|
||||
log.error("offerMapper is null: " + (offerMapper == null));
|
||||
return offerMapper.convertBeiSenField(baseParam, tableName, fieldValue);
|
||||
}
|
||||
|
||||
|
|
@ -499,15 +488,16 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
/**
|
||||
* 根据员工id获取部门id
|
||||
*
|
||||
* @param baseParam
|
||||
* @param empId
|
||||
* @return
|
||||
*/
|
||||
public String getDeptIdByEmpId(BaseParam baseParam, String empId) {
|
||||
public String getDeptIdByEmpId(String empId) {
|
||||
if (StringUtils.isNotBlank(empId)) {
|
||||
SimpleEmployee byId = hrmCommonEmployeeDao.getById(Long.parseLong(empId));
|
||||
if (null != byId) {
|
||||
return byId.getDepartmentId().toString();
|
||||
HrmEmployeeComInfo hrmEmployeeInfo = comInfoCache.getCacheById(HrmEmployeeComInfo.class, Long.parseLong(empId));
|
||||
// SimpleEmployee byId = hrmCommonEmployeeDao.getById(Long.parseLong(empId));
|
||||
log.error("getDeptIdByEmpId:{}", JSON.toJSONString(hrmEmployeeInfo));
|
||||
if (null != hrmEmployeeInfo) {
|
||||
return String.valueOf(hrmEmployeeInfo.getDepartment());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
@ -521,13 +511,25 @@ public class SyncBeiSenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
* @return
|
||||
*/
|
||||
public String getDeptIdByOId(BaseParam baseParam, Long oId) {
|
||||
Long deptId = offerMapper.getDepartmentIdByOId(baseParam, oId);
|
||||
return deptId == null ? null : deptId.toString();
|
||||
try {
|
||||
Long deptId = offerMapper.getDepartmentIdByOId(baseParam, String.valueOf(oId));
|
||||
|
||||
String result = deptId == null ? null : deptId.toString();
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("getDeptIdByOId:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Long> getDeptListByLevel(Long deptId) {
|
||||
return departMentService.getAllSuperDepIds(deptId);
|
||||
List<Long> allSuperDepIds = new ArrayList<>();
|
||||
try {
|
||||
allSuperDepIds = departMentService.getAllSuperDepIds(deptId);
|
||||
return allSuperDepIds;
|
||||
} catch (Exception e) {
|
||||
log.error("getDeptListByLevel:{}", e.getMessage());
|
||||
return allSuperDepIds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public interface OfferMapper {
|
|||
|
||||
Long getEmployeeIdByOId(@Param("param") BaseParam param,@Param("oId") Long oId);
|
||||
|
||||
Long getDepartmentIdByOId(@Param("param") BaseParam param,@Param("oId") Long oId);
|
||||
Long getDepartmentIdByOId(@Param("param") BaseParam param,@Param("oId") String oId);
|
||||
|
||||
Long getOfferIdByObjectId(@Param("param") BaseParam param,@Param("objectId") String objectId);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
<if test=" offer.name !='' and offer.name !=null">
|
||||
and t1.username = #{offer.name}
|
||||
</if>
|
||||
<if test=" offer.iDNumber !='' and offer.iDNumber !=null">
|
||||
and t1.id_no = #{offer.iDNumber} and t1.id_type = #{offer.iDType}
|
||||
</if>
|
||||
<!-- <if test=" offer.iDNumber !='' and offer.iDNumber !=null">-->
|
||||
<!-- and t1.id_no = #{offer.iDNumber} and t1.zjlx = #{offer.iDType}-->
|
||||
<!-- </if>-->
|
||||
<if test="offer.iDNumber == null or offer.iDNumber == ''">
|
||||
and t1.id_no is null
|
||||
</if>
|
||||
|
|
@ -34,7 +34,8 @@
|
|||
</select>
|
||||
|
||||
<select id="getDepartmentIdByOId" resultType="java.lang.Long">
|
||||
select t1.id from ${param.eteams}.${param.table_dept_cus} t1
|
||||
select t2.id from ${param.eteams}.${param.table_dept_cus} t1
|
||||
left join ${param.eteams}.department t2 on t2.formdata=t1.id
|
||||
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
|
||||
and t1.oid = #{oId}
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue