Compare commits
2 Commits
9d16fd42d7
...
9816dbe468
| Author | SHA1 | Date |
|---|---|---|
|
|
9816dbe468 | |
|
|
bbab8c7666 |
|
|
@ -31,5 +31,48 @@ public class Constants {
|
|||
|
||||
public static String assessmentFilterUrl = "/PerformanceCloudOpen/api/v5/Assessment/GetAssessmentsByFilters";
|
||||
|
||||
public static String beishenAssessHost = "http://api.beisenapp.com";
|
||||
|
||||
public static String tenantId = "431582";
|
||||
public static String queryAssessUrl = "/Assess/"+Constants.tenantId+"/activity/testee/result/email";
|
||||
|
||||
public static String beisenAccount = "jiekou@test-chabaidao.com";
|
||||
|
||||
public static String consumerKey = "594581d3d5444778a168bb511deb70f7"; // AppKey
|
||||
|
||||
public static String consumerSecret = "6bdef18164794475ac38233c2af4ba01"; // AppSecret
|
||||
|
||||
public static String accessToken = "ae32056b4f6d45199ab036e817dfd98f"; // Token
|
||||
|
||||
public static String tokenSecret = "2e99b9da11cf4ce591a063457a23d5ed"; // Secret
|
||||
|
||||
public static String oauthSignatureMethod = "HMAC-SHA1";
|
||||
|
||||
public static String oauthVersion = "1.0";
|
||||
|
||||
public static String format = "json";
|
||||
|
||||
public static String nyyqzdm = "extnianlingyaoqiu_431582_2032843164";
|
||||
|
||||
//职位(新)
|
||||
public static String zwzd = "extzhiweixin_431582_698711961";
|
||||
public static String unRelateRequirementUrl = "/RecruitV6/api/v1/Requirement/OperateRequirementBeforeCheck";
|
||||
|
||||
public static String positionUrl = "/TenantBaseExternal/api/v5/Position/GetByTimeWindow";
|
||||
|
||||
public static String beisenPostionTable = "uf_bs_gw";
|
||||
|
||||
public static String hrmPostionTable = "eteams.ft_1155455711525494797";
|
||||
|
||||
public static String queryUserIdByEmailUrl = "/TenantBaseExternal/api/v5/Employee/GetUserIDByEmail";
|
||||
|
||||
public static String queryUserIdByCodeUrl = "/TenantBaseExternal/api/v5/Employee/GetUserIDsByJobNumbers";
|
||||
|
||||
public static String queryDeptIdByCodeUrl = "/TenantBaseExternal/api/v5/Organization/GetOrganizationInfoByCodes";
|
||||
|
||||
|
||||
public static String query360AssessmentUrl = "/I360API/api/opencustom/getpersonelscoredataapi";
|
||||
|
||||
public static String assessment360Table = "uf_cpjg";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,64 +132,4 @@ public class FormFieldDao {
|
|||
return fieldMap;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> queryDepartmentList(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select code,id from eteams.department and tenant_key=? and delete_type=0" ;
|
||||
log.error("queryDepartmentList--dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryDepartmentList:"+recordList.size());
|
||||
for(Map<String,Object> recordMap : recordList ) {
|
||||
String code = String.valueOf(recordMap.get("code"));
|
||||
String id = String.valueOf(recordMap.get("id"));
|
||||
dataMap.put(code,id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryDepartmentList:{} ", e);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
public String getGmvIdByCode(String code,String formTable,String dataKey){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
String dataId = "";
|
||||
try{
|
||||
|
||||
String dataSql =" select id from "+formTable+" and tenant_key=? and delete_type=0 and "+dataKey+"=?" ;
|
||||
log.error("dataSql:{}", dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(code);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("queryDepartmentList:"+recordList.size());
|
||||
if(recordList.size()>0){
|
||||
dataId = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("queryDepartmentList:{} ", e);
|
||||
}
|
||||
return dataId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class HrmAssessment360Dao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmAssessment360Dao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAssessment360Data(String gh,String hdid,String wjid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from " +Constants.assessment360Table +
|
||||
" where gh = ? " +
|
||||
" and hdid = ? " +
|
||||
" and wjid = ? " +
|
||||
" and tenant_key=? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(gh);
|
||||
paramList.add(hdid);
|
||||
paramList.add(wjid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public String queryEmployeeJobNumData(String jobNum){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String employeeId = "";
|
||||
try{
|
||||
String dataSql =" select id from eteams.employee where job_num = ? and tenant_key=? and delete_type = 0" ;
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(jobNum);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
employeeId = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return employeeId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -225,4 +225,61 @@ public class HrmAssessmentDao {
|
|||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> queryEmployeeAssessmentOtherInfo(String employeeid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> employeeMap = new HashMap<String, Object>();
|
||||
try{
|
||||
|
||||
String dataSql =" select hiredate as rzrq,zhgzr as lzrq,zzrq,personnel_status as ryzt,subcompany as gs,yjbm as bm1,ejbm as bm2,sanjbm as bm3,sijbm as bm4,rylb,location as gzdd" +
|
||||
" from uf_jcl_employee_information \n" +
|
||||
" where id = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type = 0 " ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
employeeMap = recordList.get(0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}", e);
|
||||
}
|
||||
return employeeMap;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> queryEmployeeEmail(){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
|
||||
String dataSql =" select id,email from eteams.employee \n" +
|
||||
" where tenant_key=? \n" +
|
||||
" and delete_type=0 " ;
|
||||
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" ,e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,114 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class HrmBeisenPositionDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmBeisenPositionDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPositionIdByGwId(String gwid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from " +Constants.beisenPostionTable +
|
||||
" where bs_gwid = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(gwid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> updateHrmPositionByBensen(String code,String objectId,String oIdOrganization){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try{
|
||||
String dataSql =" update " +Constants.hrmPostionTable + " set oid=?,odeptid=? "+
|
||||
" where code = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(objectId);
|
||||
paramList.add(oIdOrganization);
|
||||
paramList.add(code);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
result = databaseUtils.executeForUpdate(sourceType, groupId, dataSql, sqlParamList);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String getBeisenPositionIdByHrmPositionId(String gwid){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
String id = "";
|
||||
try{
|
||||
String dataSql =" select id from " +Constants.beisenPostionTable +
|
||||
" where bs_gwid = ? " +
|
||||
" and tenant_key = ? \n" +
|
||||
" and delete_type=0" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(gwid);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size()>0){
|
||||
id = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("e:{}" , e);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeisenAssessUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenAssessCronJob")
|
||||
public class Esb2BeisenAssessCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeisenAssessUtil esb2BeisenAssessUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String emails = String.valueOf(params.get("emails"));
|
||||
log.error("emails:{}",emails);
|
||||
esb2BeisenAssessUtil.queryAssessData(emails);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmAssessment360Dao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenAssessment360Util;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenAssessment360Action")
|
||||
public class Esb2BeisenAssessment360Action implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessment360Action.class);
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenAssessment360Util esb2BeiSenAssessment360Util;
|
||||
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
HrmAssessment360Dao hrmAssessment360Dao;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("ryid");
|
||||
fieldList.add("gsyx");
|
||||
fieldList.add("gh");
|
||||
fieldList.add("hdid");
|
||||
fieldList.add("hdmc");
|
||||
fieldList.add("wjid");
|
||||
fieldList.add("wjmc");
|
||||
fieldList.add("zzjg");
|
||||
fieldList.add("cjsj");
|
||||
fieldList.add("wcsj");
|
||||
|
||||
log.error("Esb2BeisenAssessment360Action");
|
||||
|
||||
String employeeid = String.valueOf(params.get("employeeid"));
|
||||
log.error("employeeid:{}",employeeid);
|
||||
if(StringUtils.isNotBlank(employeeid)){
|
||||
Long employeeId = Long.valueOf(employeeid);
|
||||
log.error("employeeId:{}",employeeId);
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(employeeId);
|
||||
String email = createByEmployee.getEmail();
|
||||
log.error("email:{}",email);
|
||||
JSONArray assessmentArray = esb2BeiSenAssessment360Util.convertAssessmentData(email);
|
||||
log.error("assessmentArray:{}",assessmentArray.size());
|
||||
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.assessment360Table,fieldList);
|
||||
log.error("fieldMap:{}",fieldMap.size());
|
||||
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<assessmentArray.size();i++){
|
||||
JSONObject dataJson = assessmentArray.getJSONObject(i);
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
|
||||
if(dataJson.containsKey("gh") && dataJson.containsKey("hdid") && dataJson.containsKey("wjid")){
|
||||
String gh = dataJson.getString("gh");
|
||||
String hdid = dataJson.getString("hdid");
|
||||
String wjid = dataJson.getString("wjid");
|
||||
|
||||
log.error("gh:{}",gh);
|
||||
log.error("hdid:{}",hdid);
|
||||
log.error("wjid:{}",wjid);
|
||||
|
||||
String ryid = "";
|
||||
if(StringUtils.isNotBlank(gh)){
|
||||
ryid = hrmAssessment360Dao.queryEmployeeJobNumData(gh);
|
||||
}
|
||||
log.error("ryid:{}",ryid);
|
||||
|
||||
dataJson.put("ryid",ryid);
|
||||
|
||||
String ufId = hrmAssessment360Dao.getAssessment360Data(gh,hdid,wjid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isBlank(ufId)){
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
log.error("fieldid:{}",fieldList.get(n));
|
||||
log.error("fieldid2:{}",dataJson.containsKey(fieldList.get(n)));
|
||||
log.error("fieldid3:{}",fieldMap.containsKey(fieldList.get(n)));
|
||||
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = formFieldDao.queryTableFormId(Constants.assessment360Table);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
actionMap.put("ebList",ebList.size());
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmBeisenPositionDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenAssessment360Util;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenAssessment360FullCronJob")
|
||||
public class Esb2BeisenAssessment360FullCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessment360FullCronJob.class);
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
|
||||
@Autowired
|
||||
HrmBeisenPositionDao hrmBeisenPositionDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenAssessment360Util esb2BeiSenAssessment360Util;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
JSONArray assessmentArray = new JSONArray();
|
||||
|
||||
esb2BeiSenAssessment360Util.queryAssessment360Data();
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,10 +3,7 @@ package com.weaver.seconddev.chapanda.beisen.esb;
|
|||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenStaffDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.BeisenStaffInfoByStaffCodeUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.BlackList2BeiSenUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Token2BeiSenUtil;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -29,8 +26,12 @@ public class Esb2BeisenCreateBlackListAction implements EsbServerlessRpcRemoteIn
|
|||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
// @Autowired
|
||||
// BeisenStaffInfoByStaffCodeUtil beisenStaffInfoByStaffCodeUtil;
|
||||
|
||||
|
||||
@Autowired
|
||||
BeisenStaffInfoByStaffCodeUtil beisenStaffInfoByStaffCodeUtil;
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
|
@ -41,7 +42,7 @@ public class Esb2BeisenCreateBlackListAction implements EsbServerlessRpcRemoteIn
|
|||
String userIdStr = String.valueOf(params.get("userid"));
|
||||
log.error("userIdStr:{}",userIdStr);
|
||||
if(StringUtils.isNotBlank(userIdStr)){
|
||||
userId = Long.parseLong(userIdStr);
|
||||
userId = Long.valueOf(userIdStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,15 +60,19 @@ public class Esb2BeisenCreateBlackListAction implements EsbServerlessRpcRemoteIn
|
|||
log.error("staffemail:{}",staffemail);
|
||||
int beisenUserId = -1;
|
||||
String jobNum = "";
|
||||
if(userId >0){
|
||||
if(userId.longValue() >0){
|
||||
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(userId);
|
||||
jobNum = simpleEmployee.getJobNum();
|
||||
}
|
||||
|
||||
log.error("jobNum:{}",jobNum);
|
||||
if(StringUtils.isNotBlank(jobNum)){
|
||||
BeisenStaffDto beisenStaffDto = beisenStaffInfoByStaffCodeUtil.getBeisenStaffInfoByStaffCode(jobNum);
|
||||
beisenUserId = beisenStaffDto.getUserId();
|
||||
|
||||
String beisenUser = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobNum);
|
||||
if(StringUtils.isNotBlank(beisenUser)){
|
||||
beisenUserId = Integer.valueOf(beisenUser);
|
||||
}
|
||||
// BeisenStaffDto beisenStaffDto = beisenStaffInfoByStaffCodeUtil.getBeisenStaffInfoByStaffCode(jobNum);
|
||||
}
|
||||
log.error("beisenUserId:{}",beisenUserId);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,14 +43,17 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
@Autowired
|
||||
BeisenStaffInfoByStaffCodeUtil beisenStaffInfoByStaffCodeUtil ;
|
||||
|
||||
@Autowired
|
||||
BeisenDeptInfoByOriginalIdUtil beisenDeptInfoByOriginalIdUtil;
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmDepartmentDao hrmDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryDeptIdUtil beisenQueryDeptIdUtil;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2BeisenJobRequirementAction start");
|
||||
|
|
@ -62,7 +65,6 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
String requestname = (String) params.get("requestname");
|
||||
String createDate = (String) params.get("createDate");
|
||||
|
||||
|
||||
int requirementCount = converInteger(params,"requirementCount") ;
|
||||
String arivalTime = (String) params.get("arivalTime");
|
||||
|
||||
|
|
@ -79,6 +81,8 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
|
||||
String originalId = String.valueOf(params.get("originalId"));
|
||||
|
||||
String nlyq = String.valueOf(params.get("nlyq"));
|
||||
|
||||
log.error("requirementStatus:" + requirementStatus);
|
||||
log.error("originalId:" + originalId);
|
||||
log.error("requirementType:" + requirementType);
|
||||
|
|
@ -93,6 +97,7 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
log.error("kind:" + kind);
|
||||
log.error("isSecrecy:" + isSecrecy);
|
||||
log.error("form_data_id:" + form_data_id);
|
||||
log.error("nlyq:" + nlyq);
|
||||
|
||||
String createBy = String.valueOf(params.get("createBy"));
|
||||
String dutyUserId = String.valueOf(params.get("dutyUserId"));
|
||||
|
|
@ -100,23 +105,9 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
log.error("dutyUserId:" + dutyUserId);
|
||||
|
||||
|
||||
int beisenUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
BeisenStaffDto beisenStaffDto = beisenStaffInfoByStaffCodeUtil.getBeisenStaffInfoByStaffCode(jobnum);
|
||||
if(beisenStaffDto !=null){
|
||||
beisenUserId = beisenStaffDto.getUserId();
|
||||
}
|
||||
log.error("beisenUserId:" + beisenUserId);
|
||||
}
|
||||
}
|
||||
|
||||
String zpgw = String.valueOf(params.get("zpgw"));
|
||||
String zwmc = String.valueOf(params.get("zwmc"));
|
||||
String createByEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
log.error("createByEmail:" + createByEmail);
|
||||
String dutyUserEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
|
|
@ -128,18 +119,58 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
}
|
||||
log.error("originalCode:" + originalCode);
|
||||
|
||||
int orgId = -1;
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
orgId = beisenDepartmentDto.getOrgId();
|
||||
int beisenCreateUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenCreateUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenCreateUserId:" + beisenCreateUserId);
|
||||
}
|
||||
}
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:" + token);
|
||||
int beisenDutyUserId = -1;
|
||||
if(StringUtils.isNotBlank(dutyUserId)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(dutyUserId));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenDutyUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenDutyUserId:" + beisenDutyUserId);
|
||||
}
|
||||
}
|
||||
|
||||
int orgId = -1;
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
// BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
// log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
String deptid = beisenQueryDeptIdUtil.queryBeisenDeptIdByCode(originalCode);
|
||||
if(StringUtils.isNotBlank(deptid)){
|
||||
orgId = Integer.valueOf(deptid);
|
||||
}
|
||||
// orgId = beisenDepartmentDto.getOrgId();
|
||||
}
|
||||
|
||||
String xqmc = (String) params.get("xqmc");
|
||||
String gzzz = String.valueOf(params.get("gzzz"));
|
||||
String rzzg = String.valueOf(params.get("rzzg "));
|
||||
|
||||
log.error("orgId:" + orgId);
|
||||
String dataId = jobRequirement2BeisenUtil.sendJobRequirement(token,requirementStatus,requirementType,
|
||||
requestname,beisenUserId,
|
||||
String dataId = jobRequirement2BeisenUtil.sendJobRequirement(requirementStatus,requirementType,
|
||||
requestname,beisenCreateUserId,
|
||||
createDate,requirementCount,
|
||||
arivalTime,
|
||||
createByEmail,
|
||||
|
|
@ -151,7 +182,7 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
|
|||
workExperience,
|
||||
kind,
|
||||
isSecrecy,
|
||||
originalCode);
|
||||
originalCode,nlyq,zpgw,zwmc,beisenDutyUserId,xqmc,gzzz,rzzg);
|
||||
|
||||
log.error("dataId:" + dataId);
|
||||
// if(StringUtils.isNotBlank(dataId)){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,226 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hrm.util.HrmCommonUtil;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmDepartmentDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenDepartmentDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.entity.BeisenStaffDto;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/***
|
||||
* @author: shil
|
||||
* @date: 2025/8/7
|
||||
* @description: 招聘需求创建
|
||||
*/
|
||||
@Service("Esb2BeisenJobRequirementCreateAction")
|
||||
public class Esb2BeisenJobRequirementCreateAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenJobRequirementCreateAction.class);
|
||||
|
||||
@Autowired
|
||||
JobRequirement2BeisenUtil jobRequirement2BeisenUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmCommonUtil hrmCommonUtil;
|
||||
|
||||
@Autowired
|
||||
private HrmDepartmentDao hrmDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryUseridUtil beisenQueryUseridUtil;
|
||||
|
||||
@Autowired
|
||||
BeisenQueryDeptIdUtil beisenQueryDeptIdUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
log.error("Esb2BeisenJobRequirementAction start");
|
||||
|
||||
int requirementStatus = converInteger(params,"requirementStatus");
|
||||
String form_data_id = (String) params.get("form_data_id");
|
||||
int requirementType = converInteger(params,"requirementType");
|
||||
|
||||
String requestname = (String) params.get("requestname");
|
||||
String createDate = (String) params.get("createDate");
|
||||
String xqmc = (String) params.get("xqmc");
|
||||
|
||||
int requirementCount = converInteger(params,"requirementCount") ;
|
||||
String arivalTime = (String) params.get("arivalTime");
|
||||
|
||||
int salaryType = converInteger(params,"salaryType");
|
||||
int category = converInteger(params,"category");
|
||||
String educationInfo = (String) params.get("educationInfo");
|
||||
String workExperience = (String) params.get("workExperience");
|
||||
int kind = converInteger(params,"kind");
|
||||
boolean isSecrecy = false;
|
||||
String isSecrecyStr = (String) params.get("isSecrecy");
|
||||
if("1".equals(isSecrecyStr)){
|
||||
isSecrecy = true;
|
||||
}
|
||||
|
||||
String originalId = String.valueOf(params.get("originalId"));
|
||||
|
||||
String nlyq = String.valueOf(params.get("nlyq"));
|
||||
|
||||
String zpgw = String.valueOf(params.get("zpgw"));
|
||||
String zwmc = String.valueOf(params.get("zwmc"));
|
||||
|
||||
log.error("requirementStatus:" + requirementStatus);
|
||||
log.error("originalId:" + originalId);
|
||||
log.error("requirementType:" + requirementType);
|
||||
log.error("requestname:" + requestname);
|
||||
log.error("createDate:" + createDate);
|
||||
log.error("requirementCount:" + requirementCount);
|
||||
log.error("arivalTime:" + arivalTime);
|
||||
log.error("salaryType:" + salaryType);
|
||||
log.error("category:" + category);
|
||||
log.error("educationInfo:" + educationInfo);
|
||||
log.error("workExperience:" + workExperience);
|
||||
log.error("kind:" + kind);
|
||||
log.error("isSecrecy:" + isSecrecy);
|
||||
log.error("form_data_id:{}" , form_data_id);
|
||||
log.error("nlyq:{}" , nlyq);
|
||||
log.error("zpgw:{}" , zpgw);
|
||||
|
||||
String createBy = String.valueOf(params.get("createBy"));
|
||||
String dutyUserId = String.valueOf(params.get("dutyUserId"));
|
||||
log.error("createBy:" + createBy);
|
||||
log.error("dutyUserId:" + dutyUserId);
|
||||
|
||||
int beisenCreateUserId = -1;
|
||||
if(StringUtils.isNotBlank(createBy)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(createBy));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenCreateUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenCreateUserId:" + beisenCreateUserId);
|
||||
}
|
||||
}
|
||||
|
||||
int beisenDutyUserId = -1;
|
||||
if(StringUtils.isNotBlank(dutyUserId)){
|
||||
String jobnum = "";
|
||||
SimpleEmployee createByEmployee = hrmCommonUtil.getSimpleEmployee(Long.valueOf(dutyUserId));
|
||||
if(createByEmployee !=null && createByEmployee.getId() > 0){
|
||||
jobnum = createByEmployee.getJobNum();
|
||||
}
|
||||
log.error("jobnum:" + jobnum);
|
||||
if(StringUtils.isNotBlank(jobnum)){
|
||||
String userid = beisenQueryUseridUtil.queryBeisenUserIdByJobNum(jobnum);
|
||||
if(StringUtils.isNotBlank(userid)){
|
||||
beisenDutyUserId = Integer.valueOf(userid);
|
||||
}
|
||||
log.error("beisenDutyUserId:" + beisenDutyUserId);
|
||||
}
|
||||
}
|
||||
|
||||
String createByEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
log.error("createByEmail:" + createByEmail);
|
||||
String dutyUserEmail = hrmDepartmentDao.queryEmailByEmployeeId(dutyUserId);
|
||||
log.error("dutyUserEmail:" + dutyUserEmail);
|
||||
|
||||
String originalCode = "";
|
||||
if(StringUtils.isNotBlank(originalId)){
|
||||
originalCode = hrmDepartmentDao.getDepartmentCodeById(originalId);
|
||||
}
|
||||
log.error("originalCode:" + originalCode);
|
||||
|
||||
int orgId = -1;
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
// BeisenDepartmentDto beisenDepartmentDto = beisenDeptInfoByOriginalIdUtil.getBeisenDeptDataByOriginalId(originalId);
|
||||
// log.error("beisenDepartmentDto:{}",beisenDepartmentDto.toString());
|
||||
String deptid = beisenQueryDeptIdUtil.queryBeisenDeptIdByCode(originalCode);
|
||||
if(StringUtils.isNotBlank(deptid)){
|
||||
orgId = Integer.valueOf(deptid);
|
||||
}
|
||||
// orgId = beisenDepartmentDto.getOrgId();
|
||||
}
|
||||
|
||||
String gzzz = String.valueOf(params.get("gzzz"));
|
||||
String rzzg = String.valueOf(params.get("rzzg "));
|
||||
|
||||
log.error("orgId:" + orgId);
|
||||
String dataId = jobRequirement2BeisenUtil.sendJobRequirement(requirementStatus,requirementType,
|
||||
requestname,beisenCreateUserId,
|
||||
createDate,requirementCount,
|
||||
arivalTime,
|
||||
createByEmail,
|
||||
dutyUserEmail,
|
||||
orgId,
|
||||
salaryType,
|
||||
category,
|
||||
educationInfo,
|
||||
workExperience,
|
||||
kind,
|
||||
isSecrecy,
|
||||
originalCode,
|
||||
nlyq,
|
||||
zpgw,
|
||||
zwmc,
|
||||
beisenDutyUserId,
|
||||
xqmc,
|
||||
gzzz,
|
||||
rzzg);
|
||||
|
||||
|
||||
log.error("dataId:" + dataId);
|
||||
// if(StringUtils.isNotBlank(dataId)){
|
||||
// String sourceType = "";
|
||||
// String groupId = "";
|
||||
//
|
||||
// String dataSql =" update uf_zpxqgl set bszxid = ? " +
|
||||
// " where form_data_id = ?\n" +
|
||||
// " and tenant_key=? \n" +
|
||||
// " and delete_type=0 \n" ;
|
||||
//
|
||||
// log.error("dataSql:" + dataSql);
|
||||
// List<String> paramList = new ArrayList<>(100);
|
||||
//
|
||||
// paramList.add(form_data_id);
|
||||
// paramList.add(Constants.TENANT_KEY);
|
||||
// List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
// result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
// }
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","创建招聘需求成功");
|
||||
actionMap.put("dataId",dataId);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 转换为int
|
||||
* @param params
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public int converInteger(Map<String,Object> params,String key){
|
||||
int value = -1;
|
||||
try{
|
||||
String requirementStatusStr = (String) params.get(key);
|
||||
value = Integer.valueOf(requirementStatusStr);
|
||||
}catch (Exception e){
|
||||
log.error("key:{},e:{}",key,e.getMessage());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.*;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenJobRequirementUnRelateAction")
|
||||
public class Esb2BeisenJobRequirementUnRelateAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenJobRequirementUnRelateAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeisenUnRelateRequestUtil esb2BeisenUnRelateRequestUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String form_data_id = String.valueOf(params.get("form_data_id"));
|
||||
String requirementId = String.valueOf(params.get("requirementId"));
|
||||
|
||||
if(StringUtils.isBlank(requirementId)){
|
||||
return WeaResult.fail(500,"招聘需求信息获取为空");
|
||||
}
|
||||
|
||||
log.error("requirementId:" + requirementId);
|
||||
String code = esb2BeisenUnRelateRequestUtil.unRelateJobRequirement(requirementId);
|
||||
log.error("code:" + code);
|
||||
if(StringUtils.isBlank(code)){
|
||||
return WeaResult.fail(500,"取消招聘需求失败");
|
||||
}
|
||||
|
||||
if(!"200".equals(code)){
|
||||
return WeaResult.fail(500,"取消招聘需求失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","取消招聘需求成功");
|
||||
actionMap.put("datacode",code);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,8 +11,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -21,7 +19,7 @@ public class Esb2BeisenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenOfferCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil http2BenSenUtil ;
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
@Autowired
|
||||
Offer2BeiSenUtil offer2BeiSenUtil;
|
||||
|
|
@ -48,7 +46,7 @@ public class Esb2BeisenOfferCronJob implements EsbServerlessRpcRemoteInterface {
|
|||
String endDate = String.valueOf(params.get("endDate"));
|
||||
String endTime = String.valueOf(params.get("endTime"));
|
||||
|
||||
String token = http2BenSenUtil.getToken();
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service("Esb2BeisenPerformanceCronJobNew")
|
||||
public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteInterface {
|
||||
|
|
@ -216,6 +213,16 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
}
|
||||
}
|
||||
|
||||
for(String ebId:ebList){
|
||||
|
||||
String rylb = "";
|
||||
String bm1 = "";
|
||||
if("2".equals(rylb)){
|
||||
|
||||
}else if("".equals(bm1)){
|
||||
|
||||
}
|
||||
}
|
||||
log.error("ebList:{}", JSON.toJSONString(ebList));
|
||||
|
||||
|
||||
|
|
@ -366,6 +373,16 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
String employeeid = String.valueOf(employeeMap.get(value));
|
||||
log.error("employeeid:{}",employeeid);
|
||||
dataJson.put("bkhr",employeeid);
|
||||
if(StringUtils.isNotBlank(employeeid)){
|
||||
Map<String,Object> otherMap = hrmAssessmentDao.queryEmployeeAssessmentOtherInfo(employeeid);
|
||||
Iterator<Map.Entry<String, Object>> iterator = otherMap.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
String emKey = entry.getKey();
|
||||
String emValue = entry.getValue().toString();
|
||||
dataJson.put(emKey,emValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -387,6 +404,7 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
|
|||
if("TotalScoreRuleIdLookup".equals(name)){
|
||||
dataJson.put("ppdj",text);
|
||||
}
|
||||
|
||||
}
|
||||
dataArray.add(dataJson);
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,284 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmBeisenPositionDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenPositionUtil;
|
||||
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.*;
|
||||
|
||||
@Service("Esb2BeisenPositionFullCronJob")
|
||||
public class Esb2BeisenPositionFullCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenPositionFullCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenPositionUtil esb2BeiSenPositionUtil;
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
|
||||
@Autowired
|
||||
HrmBeisenPositionDao hrmBeisenPositionDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
log.error("Esb2BeisenPositionFullCronJob");
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
JSONArray positionArray = new JSONArray();
|
||||
|
||||
String startDate = String.valueOf(params.get("startDate"));
|
||||
String endDate = String.valueOf(params.get("endDate"));
|
||||
int capacity = 100;
|
||||
int total = 0;
|
||||
String scrollId = "";
|
||||
JSONArray firstArray = new JSONArray();
|
||||
String msg = esb2BeiSenPositionUtil.queryPositionByDate(startDate, endDate,capacity);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("total")){
|
||||
total = msgJson.getInteger("total");
|
||||
}
|
||||
if(msgJson.containsKey("data")){
|
||||
firstArray = msgJson.getJSONArray("data");
|
||||
}
|
||||
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}
|
||||
}
|
||||
|
||||
log.error("total:{}",total);
|
||||
log.error("firstArray:{}",firstArray.size());
|
||||
log.error("scrollId:{}",scrollId);
|
||||
|
||||
if(total <= capacity){
|
||||
positionArray = firstArray;
|
||||
}else{
|
||||
if(firstArray.size() > 0){
|
||||
positionArray.addAll(firstArray);
|
||||
}
|
||||
int pageCount = (int)Math.floor(total / capacity*1.0);
|
||||
log.error("pageCount:{}",pageCount);
|
||||
int count = 0;
|
||||
while(StringUtils.isNotBlank(scrollId) && !"null".equals(scrollId)){
|
||||
String positionData = esb2BeiSenPositionUtil.queryPositionByscrollId(startDate, endDate,scrollId,capacity);
|
||||
if(StringUtils.isNotBlank(positionData)){
|
||||
JSONObject msgJson = JSONObject.parseObject(positionData);
|
||||
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONArray itemArray = msgJson.getJSONArray("data");
|
||||
log.error("itemArray:{}",itemArray.size());
|
||||
if(itemArray.size() > 0){
|
||||
positionArray.addAll(itemArray);
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
}
|
||||
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
|
||||
log.error("scrollId:{}",scrollId);
|
||||
log.error("count:{}",count);
|
||||
|
||||
count++;
|
||||
if(count > (pageCount+5)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("positionArray:{}",positionArray.size());
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("bs_gwid");
|
||||
fieldList.add("bs_gwmc");
|
||||
fieldList.add("bs_gwbm");
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
updateHrmPosition(positionArray);
|
||||
doSavePositionData(positionArray);
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
public JSONArray convertPositionList(JSONArray positionArray){
|
||||
JSONArray dataArray = new JSONArray();
|
||||
|
||||
for(int i=0;i<positionArray.size();i++) {
|
||||
JSONObject positionJson = positionArray.getJSONObject(i);
|
||||
String name = positionJson.getString("name");
|
||||
String code = positionJson.getString("code");
|
||||
String objectId = positionJson.getString("objectId");
|
||||
|
||||
log.error("name:{}",name);
|
||||
log.error("objectId:{}",objectId);
|
||||
|
||||
if(StringUtils.isNotBlank(code) && StringUtils.isNotBlank(objectId)){
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("bs_gwid",objectId);
|
||||
dataJson.put("bs_gwmc",name);
|
||||
dataJson.put("bs_gwbm",code);
|
||||
dataArray.add(dataJson);
|
||||
}
|
||||
}
|
||||
return dataArray;
|
||||
}
|
||||
|
||||
public List<String> doSavePositionData(JSONArray positionArray){
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("bs_gwid");
|
||||
fieldList.add("bs_gwmc");
|
||||
fieldList.add("bs_gwbm");
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
JSONArray dataArray = convertPositionList(positionArray);
|
||||
log.error("dataArray:"+dataArray.size());
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.beisenPostionTable,fieldList);
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("bs_gwid") && StringUtils.isNotBlank(dataJson.getString("bs_gwid"))){
|
||||
String bs_gwid = dataJson.getString("bs_gwid");
|
||||
String bs_gwmc = dataJson.getString("bs_gwmc");
|
||||
String bs_gwbm = dataJson.getString("bs_gwbm");
|
||||
String ufId = hrmBeisenPositionDao.getPositionIdByGwId(bs_gwid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)){
|
||||
log.error("修改");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
}else{
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = formFieldDao.queryTableFormId(Constants.beisenPostionTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ebList;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> updateHrmPosition(JSONArray positionArray){
|
||||
Map<String,String> resultMap = new HashMap<String,String>();
|
||||
int failCount = 0;
|
||||
int successCount = 0;
|
||||
int total = positionArray.size() ;
|
||||
if(positionArray.size() > 0){
|
||||
for(int i=0;i<positionArray.size();i++){
|
||||
JSONObject dataJson = positionArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("objectId") && StringUtils.isNotBlank(dataJson.getString("objectId"))){
|
||||
String objectId = dataJson.getString("objectId");
|
||||
String code = dataJson.getString("code");
|
||||
String oIdOrganization = dataJson.getString("oIdOrganization");
|
||||
Map<String, Object> result = hrmBeisenPositionDao.updateHrmPositionByBensen(code,objectId,oIdOrganization);
|
||||
if (result.containsKey("code")) {
|
||||
code = String.valueOf(result.get("code"));
|
||||
log.error("code:" + code);
|
||||
if ("200".equals(code)) {
|
||||
successCount++;
|
||||
}else{
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("failCount",String.valueOf(failCount));
|
||||
resultMap.put("successCount",String.valueOf(successCount));
|
||||
resultMap.put("total",String.valueOf(total));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataChangeResult;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDetailDto;
|
||||
import com.weaver.ebuilder.form.client.entity.data.EBDataReqDto;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.FormFieldDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmBeisenPositionDao;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.EbuilderOperateUtils;
|
||||
import com.weaver.seconddev.chapanda.beisen.util.Esb2BeiSenPositionUtil;
|
||||
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.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2BeisenPositionTimeCronJob")
|
||||
public class Esb2BeisenPositionTimeCronJob implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenPositionTimeCronJob.class);
|
||||
|
||||
@Autowired
|
||||
Esb2BeiSenPositionUtil esb2BeiSenPositionUtil;
|
||||
|
||||
@Autowired
|
||||
FormFieldDao formFieldDao;
|
||||
|
||||
@Autowired
|
||||
HrmBeisenPositionDao hrmBeisenPositionDao;
|
||||
|
||||
@Autowired
|
||||
EbuilderOperateUtils ebuilderOperateUtils;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
JSONArray positionArray = new JSONArray();
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 获取当前日期的前一周
|
||||
LocalDate lastWeek = today.minusWeeks(1);
|
||||
|
||||
String startDate = lastWeek.toString();
|
||||
String endDate = today.toString();
|
||||
|
||||
log.error("startDate:{}",startDate);
|
||||
log.error("endDate:{}",endDate);
|
||||
|
||||
int capacity = 100;
|
||||
int total = 0;
|
||||
String scrollId = "";
|
||||
JSONArray firstArray = new JSONArray();
|
||||
String msg = esb2BeiSenPositionUtil.queryPositionByDate(startDate, endDate,capacity);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("total")){
|
||||
total = msgJson.getInteger("total");
|
||||
}
|
||||
if(msgJson.containsKey("data")){
|
||||
firstArray = msgJson.getJSONArray("data");
|
||||
}
|
||||
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}
|
||||
}
|
||||
|
||||
if(total <= capacity){
|
||||
positionArray = firstArray;
|
||||
}else{
|
||||
if(firstArray.size() > 0){
|
||||
positionArray.addAll(firstArray);
|
||||
}
|
||||
int pageCount = (int)Math.floor(total / capacity*1.0);
|
||||
int count = 0;
|
||||
while(StringUtils.isNotBlank(scrollId) && !"null".equals(scrollId)){
|
||||
String positionData = esb2BeiSenPositionUtil.queryPositionByscrollId(startDate, endDate,scrollId,capacity);
|
||||
if(StringUtils.isNotBlank(positionData)){
|
||||
JSONObject msgJson = JSONObject.parseObject(positionData);
|
||||
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONArray itemArray = msgJson.getJSONArray("data");
|
||||
if(itemArray.size() > 0){
|
||||
positionArray.add(itemArray);
|
||||
}
|
||||
}
|
||||
if(msgJson.containsKey("scrollId")){
|
||||
scrollId = msgJson.getString("scrollId");
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
}else{
|
||||
scrollId = "";
|
||||
}
|
||||
count++;
|
||||
if(count > (pageCount+5)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("positionArray:{}",positionArray.size());
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
updateHrmPosition(positionArray);
|
||||
doSavePositionData(positionArray);
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","同步成功");
|
||||
actionMap.put("total",ebList.size());
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
|
||||
public JSONArray convertPositionList(JSONArray positionArray){
|
||||
JSONArray dataArray = new JSONArray();
|
||||
for(int i=0;i<positionArray.size();i++) {
|
||||
JSONObject positionJson = positionArray.getJSONObject(i);
|
||||
String name = positionJson.getString("name");
|
||||
String code = positionJson.getString("code");
|
||||
String objectId = positionJson.getString("objectId");
|
||||
|
||||
if(StringUtils.isNotBlank(code) && StringUtils.isNotBlank(objectId)){
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("bs_gwid",objectId);
|
||||
dataJson.put("bs_gwmc",name);
|
||||
dataJson.put("bs_gwbm",code);
|
||||
dataArray.add(dataJson);
|
||||
}
|
||||
}
|
||||
return dataArray;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 保存职位数据
|
||||
* @param positionArray
|
||||
* @return
|
||||
*/
|
||||
public List<String> doSavePositionData(JSONArray positionArray){
|
||||
List<String> ebList = new ArrayList<String>();
|
||||
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
fieldList.add("bs_gwid");
|
||||
fieldList.add("bs_gwmc");
|
||||
fieldList.add("bs_gwbm");
|
||||
|
||||
if(positionArray.size() > 0){
|
||||
JSONArray dataArray = convertPositionList(positionArray);
|
||||
log.error("dataArray:"+dataArray.size());
|
||||
Map<String, Object> fieldMap = formFieldDao.queryFromTableField(Constants.beisenPostionTable,fieldList);
|
||||
List<EBDataReqDto> addDatas = new ArrayList<EBDataReqDto>();
|
||||
List<EBDataReqDto> updateDatas = new ArrayList<EBDataReqDto>();
|
||||
for(int i=0;i<dataArray.size();i++){
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("bs_gwid") && StringUtils.isNotBlank(dataJson.getString("bs_gwid"))){
|
||||
String bs_gwid = dataJson.getString("bs_gwid");
|
||||
String bs_gwmc = dataJson.getString("bs_gwmc");
|
||||
String bs_gwbm = dataJson.getString("bs_gwbm");
|
||||
String ufId = hrmBeisenPositionDao.getPositionIdByGwId(bs_gwid);
|
||||
log.error("ufId:{}",ufId);
|
||||
|
||||
if(StringUtils.isNotBlank(ufId)){
|
||||
log.error("修改");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
mainData.add(new EBDataReqDetailDto("id", ufId));
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
updateDatas.add(ebDataReqDto);
|
||||
}else{
|
||||
log.error("新增");
|
||||
EBDataReqDto ebDataReqDto = new EBDataReqDto();
|
||||
List<EBDataReqDetailDto> mainData = new ArrayList<EBDataReqDetailDto>();
|
||||
for(int n=0;n<fieldList.size();n++){
|
||||
if(dataJson.containsKey(fieldList.get(n)) && fieldMap.containsKey(fieldList.get(n))){
|
||||
String value = dataJson.getString(fieldList.get(n));
|
||||
String fieldId = fieldMap.get(fieldList.get(n)).toString();
|
||||
|
||||
log.error("fieldId:{}",fieldId);
|
||||
log.error("value:{}",value);
|
||||
mainData.add(new EBDataReqDetailDto(fieldId, value));
|
||||
}
|
||||
}
|
||||
ebDataReqDto.setMainDatas(mainData);
|
||||
addDatas.add(ebDataReqDto);
|
||||
}
|
||||
}else{
|
||||
}
|
||||
}
|
||||
log.error("addDatas:{}",addDatas.size());
|
||||
log.error("updateDatas:{}",updateDatas.size());
|
||||
|
||||
Map<String,Object> recordMap = formFieldDao.queryTableFormId(Constants.beisenPostionTable);
|
||||
String formId = recordMap.get("id").toString();
|
||||
String appId = recordMap.get("app_id").toString();
|
||||
log.error("formId:{}",formId);
|
||||
log.error("appId:{}",appId);
|
||||
if(StringUtils.isNotBlank(formId) && StringUtils.isNotBlank(appId)){
|
||||
if(addDatas.size() > 0){
|
||||
EBDataChangeResult addEbDataChangeResult = ebuilderOperateUtils.bacthInsertDbForm(addDatas,formId,appId);
|
||||
boolean isTrue = addEbDataChangeResult.getStatus();
|
||||
log.error("message:{}",addEbDataChangeResult.getMessage());
|
||||
log.error("isTrue1:{}",isTrue);
|
||||
if(isTrue){
|
||||
ebList.addAll(addEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
|
||||
if(updateDatas.size() > 0){
|
||||
|
||||
EBDataChangeResult updateEbDataChangeResult = ebuilderOperateUtils.bacthEditEbForm(updateDatas,formId,appId);
|
||||
boolean isTrue = updateEbDataChangeResult.getStatus();
|
||||
log.error("isTrue2:{}",isTrue);
|
||||
log.error("message2:{}",updateEbDataChangeResult.getMessage());
|
||||
if(isTrue){
|
||||
ebList.addAll(updateEbDataChangeResult.getDataIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ebList;
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> updateHrmPosition(JSONArray positionArray){
|
||||
Map<String,String> resultMap = new HashMap<String,String>();
|
||||
int failCount = 0;
|
||||
int successCount = 0;
|
||||
int total = positionArray.size() ;
|
||||
if(positionArray.size() > 0){
|
||||
for(int i=0;i<positionArray.size();i++){
|
||||
JSONObject dataJson = positionArray.getJSONObject(i);
|
||||
log.error("dataJson2:{}",dataJson.toJSONString());
|
||||
if(dataJson.containsKey("objectId") && StringUtils.isNotBlank(dataJson.getString("objectId"))){
|
||||
String objectId = dataJson.getString("objectId");
|
||||
String code = dataJson.getString("code");
|
||||
String oIdOrganization = dataJson.getString("oIdOrganization");
|
||||
Map<String, Object> result = hrmBeisenPositionDao.updateHrmPositionByBensen(code,objectId,oIdOrganization);
|
||||
if (result.containsKey("code")) {
|
||||
code = String.valueOf(result.get("code"));
|
||||
log.error("code:" + code);
|
||||
if ("200".equals(code)) {
|
||||
successCount++;
|
||||
}else{
|
||||
failCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("failCount",String.valueOf(failCount));
|
||||
resultMap.put("successCount",String.valueOf(successCount));
|
||||
resultMap.put("total",String.valueOf(total));
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Component
|
||||
public class BeisenQueryDeptIdUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(BeisenQueryDeptIdUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
public String queryBeisenDeptIdByCode(String code){
|
||||
String deptid = "";
|
||||
if(StringUtils.isNotEmpty(code)) {
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
deptid = queryDeptIdByCode(token, code);
|
||||
}
|
||||
}
|
||||
return deptid;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param token
|
||||
* @param deptcode
|
||||
* @return
|
||||
*/
|
||||
private String queryDeptIdByCode(String token,String deptcode){
|
||||
String deptid = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, "{\"codes\":[\""+deptcode+"\"]}");
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.queryDeptIdByCodeUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
if(code == 200) {
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("data")){
|
||||
JSONArray dataArray = bodyJson.getJSONArray("data");
|
||||
if(dataArray.size() > 0){
|
||||
JSONObject itemJson = dataArray.getJSONObject(0);
|
||||
if(itemJson.containsKey("oId")){
|
||||
deptid = itemJson.getString("oId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
log.error("deptid:{}",deptid);
|
||||
return deptid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Component
|
||||
public class BeisenQueryUseridUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(BeisenQueryUseridUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
public String queryBeisenUserIdByEmail(String email){
|
||||
String userid = "";
|
||||
if(StringUtils.isNotEmpty(email)) {
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
userid = queryUserIdByEmail(token, email);
|
||||
}
|
||||
}
|
||||
return userid;
|
||||
}
|
||||
|
||||
|
||||
public String queryBeisenUserIdByJobNum(String jobNum){
|
||||
String userid = "";
|
||||
if(StringUtils.isNotEmpty(jobNum)) {
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
userid = queryUserIdByJobNum(token, jobNum);
|
||||
}
|
||||
}
|
||||
return userid;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param token
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
private String queryUserIdByEmail(String token,String email){
|
||||
String userid = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("email",email);
|
||||
RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.queryUserIdByEmailUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
if(code == 200) {
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("data")){
|
||||
userid = bodyJson.getString("data");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
log.error("userid:{}",userid);
|
||||
return userid;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param token
|
||||
* @param jobNum
|
||||
* @return
|
||||
*/
|
||||
private String queryUserIdByJobNum(String token,String jobNum){
|
||||
String userid = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, "{\n \"jobNumbers\":[\""+jobNum+"\"]\n}");
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.queryUserIdByCodeUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
log.error("code:{}",code);
|
||||
String msg = response.body().string();
|
||||
if(code == 200) {
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("data")){
|
||||
JSONArray dataArray = bodyJson.getJSONArray("data");
|
||||
if(dataArray.size() > 0){
|
||||
JSONObject itemJson = dataArray.getJSONObject(0);
|
||||
if(itemJson.containsKey("userId")){
|
||||
userid = itemJson.getString("userId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
log.error("userid:{}",userid);
|
||||
return userid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.beisen.dao.HrmAssessmentDao;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.quorum.SyncedLearnerTracker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
public class Esb2BeiSenAssessment360Util {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeiSenAssessment360Util.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
@Autowired
|
||||
HrmAssessmentDao hrmAssessmentDao;
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public JSONArray queryAssessment360Data(){
|
||||
JSONArray assessmentArray = new JSONArray();
|
||||
|
||||
List<Map<String, Object>> emailList = hrmAssessmentDao.queryEmployeeEmail();
|
||||
for(int i=0;i<emailList.size();i++){
|
||||
Map<String, Object> emailMap = emailList.get(i);
|
||||
String email = emailMap.get("email").toString();
|
||||
if(StringUtils.isNotBlank(email)){
|
||||
JSONArray dataArray = convertAssessmentData(email);
|
||||
assessmentArray.addAll(dataArray);
|
||||
}
|
||||
}
|
||||
return assessmentArray;
|
||||
}
|
||||
|
||||
|
||||
public JSONArray convertAssessmentData(String email){
|
||||
JSONArray assessmentArray = new JSONArray();
|
||||
if(StringUtils.isNotBlank(email)){
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("email",email);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
String msg = doHttpPost(token,bodyJson.toJSONString());
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONObject dataJson = msgJson.getJSONObject("data");
|
||||
|
||||
String personnelStaffCode = "";
|
||||
String personnelMail = "";
|
||||
String personnelName = "";
|
||||
if(dataJson.containsKey("personInfo")){
|
||||
JSONObject personInfoJson = dataJson.getJSONObject("personInfo");
|
||||
if(personInfoJson.containsKey("personnelName")){
|
||||
personnelName = personInfoJson.getString("personnelName");
|
||||
}
|
||||
if(personInfoJson.containsKey("personnelMail")){
|
||||
personnelMail = personInfoJson.getString("personnelMail");
|
||||
}
|
||||
if(personInfoJson.containsKey("personnelStaffCode")){
|
||||
personnelStaffCode = personInfoJson.getString("personnelStaffCode");
|
||||
}
|
||||
}
|
||||
|
||||
log.error("personnelStaffCode:{}",personnelStaffCode);
|
||||
log.error("personnelMail:{}",personnelMail);
|
||||
|
||||
if(dataJson.containsKey("activityList")){
|
||||
JSONArray activityListArray = dataJson.getJSONArray("activityList");
|
||||
for (int i = 0; i < activityListArray.size(); i++) {
|
||||
JSONObject activityJson = activityListArray.getJSONObject(i);
|
||||
String activityID = "";
|
||||
if(activityJson.containsKey("activityID")){
|
||||
activityID = activityJson.getString("activityID");
|
||||
}
|
||||
String activityName = "";
|
||||
if(activityJson.containsKey("activityName")){
|
||||
activityName = activityJson.getString("activityName");
|
||||
}
|
||||
String createTime = "";
|
||||
if(activityJson.containsKey("createTime")){
|
||||
createTime = activityJson.getString("createTime");
|
||||
}
|
||||
JSONArray questionnaireInfoList = new JSONArray();
|
||||
if(activityJson.containsKey("questionnaireInfoList")){
|
||||
questionnaireInfoList = activityJson.getJSONArray("questionnaireInfoList");
|
||||
}
|
||||
|
||||
log.error("activityID:{}",personnelMail);
|
||||
log.error("createTime:{}",createTime);
|
||||
log.error("questionnaireInfoList:{}",questionnaireInfoList.size());
|
||||
|
||||
for(int n=0;n<questionnaireInfoList.size();n++){
|
||||
JSONObject questionnaireInfoJson = questionnaireInfoList.getJSONObject(n);
|
||||
String questionnaireID = questionnaireInfoJson.getString("questionnaireID");
|
||||
String questionnaireName = questionnaireInfoJson.getString("questionnaireName");
|
||||
String otherAvg = questionnaireInfoJson.getString("otherAvg");
|
||||
String lastUpdateTime = questionnaireInfoJson.getString("lastUpdateTime");
|
||||
log.error("questionnaireID:{}",questionnaireID);
|
||||
log.error("otherAvg:{}",otherAvg);
|
||||
log.error("lastUpdateTime:{}",lastUpdateTime);
|
||||
|
||||
JSONObject assessJson = new JSONObject();
|
||||
assessJson.put("gsyx",personnelMail);
|
||||
assessJson.put("gh",personnelStaffCode);
|
||||
assessJson.put("hdid",activityID);
|
||||
assessJson.put("hdmc",activityName);
|
||||
assessJson.put("wjid",questionnaireID);
|
||||
assessJson.put("wjmc",questionnaireName);
|
||||
assessJson.put("zzjg",otherAvg);
|
||||
assessJson.put("cjsj",createTime.replace("T"," "));
|
||||
assessJson.put("wcsj",lastUpdateTime.replace("T"," "));
|
||||
assessmentArray.add(assessJson);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return assessmentArray;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
*/
|
||||
public String doHttpPost(String token,String bodyJson){
|
||||
String bodyData = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson);
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost + Constants.query360AssessmentUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
if(code == 200){
|
||||
bodyData = msg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@Component
|
||||
public class Esb2BeiSenPositionUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeiSenPositionUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
/***
|
||||
*
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public String queryPositionByDate(String startDate, String endDate,int capacity){
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
String bodyData = "";
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("startTime",startDate);
|
||||
bodyJson.put("stopTime",endDate);
|
||||
bodyJson.put("timeWindowQueryType","1");
|
||||
bodyJson.put("capacity",capacity);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+ Constants.positionUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
if(code == 200){
|
||||
bodyData = msg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
*/
|
||||
public String queryPositionByscrollId(String startDate, String endDate,String scrollId,int capacity){
|
||||
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
log.error("token:{}",token);
|
||||
String bodyData = "";
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("startTime",startDate);
|
||||
bodyJson.put("stopTime",endDate);
|
||||
bodyJson.put("timeWindowQueryType","1");
|
||||
bodyJson.put("scrollId",scrollId);
|
||||
bodyJson.put("capacity",capacity);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost + Constants.positionUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
if(code == 200){
|
||||
bodyData = msg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return bodyData;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Base64;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/***
|
||||
* 获取考核数据
|
||||
*/
|
||||
@Component
|
||||
public class Esb2BeisenAssessUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenAssessUtil.class);
|
||||
|
||||
/***
|
||||
*
|
||||
* @param emails
|
||||
* @param beisen_account
|
||||
* @param format
|
||||
* @param consumer_key
|
||||
* @param oauth_token
|
||||
* @param oauth_signature_method
|
||||
* @param oauth_timestamp
|
||||
* @param oauth_nonce
|
||||
* @param oauth_version
|
||||
* @param oauth_signature
|
||||
*/
|
||||
public String doHttpGet(String emails,String beisen_account,String format,String consumer_key,String oauth_token,String oauth_signature_method,String oauth_timestamp,String oauth_nonce,String oauth_version,String oauth_signature){
|
||||
String msg = "";
|
||||
String applyUrl = Constants.beishenAssessHost+Constants.queryAssessUrl+"?beisen_account="+beisen_account+"&emails="+emails+"&format="+format+"&oauth_consumer_key="+consumer_key+"&oauth_token="+oauth_token+"&oauth_signature_method="+oauth_signature_method+"&oauth_timestamp="+oauth_timestamp+"&oauth_nonce="+oauth_nonce+"&oauth_version="+oauth_version+"&oauth_signature="+oauth_signature;
|
||||
log.error("applyUrl:{}",applyUrl);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("text/plain");
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(applyUrl)
|
||||
.method("GET", null)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
msg = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/***
|
||||
* 查询考核数据
|
||||
* @param emails
|
||||
*/
|
||||
public void queryAssessData(String emails){
|
||||
String applyUrl = Constants.beishenAssessHost+Constants.queryAssessUrl;
|
||||
String beisen_account = Constants.beisenAccount;
|
||||
String oauth_consumer_key = Constants.consumerKey;
|
||||
String oauth_token = Constants.accessToken;
|
||||
String oauth_version = Constants.oauthVersion;
|
||||
String oauth_nonce = randomString(11);
|
||||
String oauth_signature_method = Constants.oauthSignatureMethod;
|
||||
String format = Constants.format;
|
||||
String oauth_consumer_secret = Constants.consumerSecret;
|
||||
String oauth_token_secret = Constants.tokenSecret;
|
||||
|
||||
String oauth_signature = "";
|
||||
|
||||
long oauth_timestamp = System.currentTimeMillis()/1000;
|
||||
log.error("oauth_consumer_key:{}",oauth_consumer_key);
|
||||
log.error("oauth_nonce:{}",oauth_nonce);
|
||||
log.error("oauth_timestamp:{}",oauth_timestamp);
|
||||
log.error("oauth_token:{}",oauth_token);
|
||||
log.error("oauth_version:{}",oauth_version);
|
||||
|
||||
String key = oauth_consumer_secret+"&"+oauth_token_secret ;
|
||||
log.error("key:{}",key);
|
||||
try {
|
||||
String paramData = "beisen_account="+URLEncoder.encode(beisen_account, "UTF-8")+"&emails="+URLEncoder.encode(emails, "UTF-8")+"&format="+URLEncoder.encode(format, "UTF-8")+"&oauth_consumer_key="+URLEncoder.encode(oauth_consumer_key, "UTF-8")+"&oauth_nonce="+URLEncoder.encode(oauth_nonce, "UTF-8")+"&oauth_signature_method="+URLEncoder.encode(oauth_signature_method, "UTF-8")+"&oauth_timestamp="+URLEncoder.encode(oauth_timestamp+"", "UTF-8")+"&oauth_token="+URLEncoder.encode(oauth_token, "UTF-8")+"&oauth_version="+URLEncoder.encode(oauth_version, "UTF-8");
|
||||
log.error("paramData:{}",paramData);
|
||||
String encodeParamData = URLEncoder.encode(paramData, "UTF-8");
|
||||
log.error("encodeParamData:{}",encodeParamData);
|
||||
String concatData = "POST&"+URLEncoder.encode(applyUrl, "UTF-8")+"&"+encodeParamData;
|
||||
oauth_signature = calculateHmacSha1(key, concatData);
|
||||
log.error("oauth_signature:{}",oauth_signature);
|
||||
oauth_signature = URLEncoder.encode(oauth_signature, "UTF-8");
|
||||
log.error("oauth_signature2:{}",oauth_signature);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(oauth_signature)){
|
||||
String msg = doHttpGet(emails,beisen_account,format,oauth_consumer_key,oauth_token,oauth_signature_method,oauth_timestamp+"",oauth_nonce,oauth_version,oauth_signature);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 计算HmacSHA1
|
||||
* @param key
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
public String calculateHmacSha1(String key, String message) {
|
||||
String data = "";
|
||||
try {
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "HmacSHA1");
|
||||
mac.init(secretKeySpec);
|
||||
byte[] digest = mac.doFinal(message.getBytes());
|
||||
data = Base64.getEncoder().encodeToString(digest);
|
||||
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
log.error("e:{}",e.getMessage());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String randomString(int length){
|
||||
String data = UUID.randomUUID().toString();
|
||||
// 定义可能的字符
|
||||
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
StringBuilder sb = new StringBuilder(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = ThreadLocalRandom.current().nextInt(characters.length());
|
||||
sb.append(characters.charAt(index));
|
||||
}
|
||||
data = sb.toString();
|
||||
return data;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.weaver.seconddev.chapanda.beisen.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class Esb2BeisenUnRelateRequestUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenUnRelateRequestUtil.class);
|
||||
|
||||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
public String unRelateJobRequirement(String requirementId){
|
||||
|
||||
String dataCode = "";
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
int operationType = 1;
|
||||
bodyJson.put("operationType",operationType);
|
||||
bodyJson.put("id",requirementId);
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.unRelateRequirementUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
int code = response.code();
|
||||
String bodyData = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("bodyData:{}",bodyData);
|
||||
if(code == 200){
|
||||
if(StringUtils.isNotBlank(bodyData)){
|
||||
JSONObject dataJson = JSONObject.parseObject(bodyData);
|
||||
if(dataJson.containsKey("code")){
|
||||
dataCode = dataJson.getString("code");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.error("bodyData:"+bodyData);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return dataCode;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,163 +18,195 @@ public class JobRequirement2BeisenUtil {
|
|||
@Autowired
|
||||
Token2BeiSenUtil token2BeiSenUtil ;
|
||||
|
||||
public String sendJobRequirement(String token,
|
||||
int requirementStatus,
|
||||
int requirementType,
|
||||
String requestname,
|
||||
int beisenCreateBy,
|
||||
String createDate,
|
||||
int requirementCount,
|
||||
String arivalTime,
|
||||
String createByEmail,
|
||||
String dutyUserEmail,
|
||||
int beisenDepartmentId,
|
||||
int salaryType,
|
||||
int category,
|
||||
String educationInfo,
|
||||
String workExperience,
|
||||
int kind,
|
||||
boolean isSecrecy,
|
||||
String originalCode
|
||||
public String sendJobRequirement(int requirementStatus,
|
||||
int requirementType,
|
||||
String requestname,
|
||||
int beisenCreateBy,
|
||||
String createDate,
|
||||
int requirementCount,
|
||||
String arivalTime,
|
||||
String createByEmail,
|
||||
String dutyUserEmail,
|
||||
int beisenDepartmentId,
|
||||
int salaryType,
|
||||
int category,
|
||||
String educationInfo,
|
||||
String workExperience,
|
||||
int kind,
|
||||
boolean isSecrecy,
|
||||
String originalCode,
|
||||
String nlyq,
|
||||
String zpgw,
|
||||
String zwmc,
|
||||
int beisenDutyUserId,
|
||||
String xqmc,
|
||||
String gzzz,
|
||||
String rzzg
|
||||
){
|
||||
String data = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
/***
|
||||
* 需求状态
|
||||
* 10 草稿
|
||||
* 20 审批中
|
||||
* 30 审批未通过
|
||||
* 40 进行中
|
||||
* 50 已关闭
|
||||
* 60 已完成
|
||||
* 70 已暂停
|
||||
* 80 审批已终止
|
||||
*
|
||||
*/
|
||||
if(requirementStatus > -1){
|
||||
bodyJson.put("requirementStatus",requirementStatus);
|
||||
}
|
||||
String token = token2BeiSenUtil.getToken();
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
|
||||
/***
|
||||
* 需求类型
|
||||
* 1 新增
|
||||
* 2 顶替
|
||||
* 3 储备
|
||||
*/
|
||||
if(requirementType > -1){
|
||||
bodyJson.put("requirementType",requirementType);
|
||||
}
|
||||
|
||||
|
||||
bodyJson.put("name",requestname);
|
||||
|
||||
if(beisenCreateBy > -1){
|
||||
bodyJson.put("createBy",beisenCreateBy);
|
||||
}
|
||||
|
||||
if(!createDate.contains("T")){
|
||||
createDate = createDate+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("createDate",createDate);
|
||||
|
||||
if(!arivalTime.contains("T")){
|
||||
arivalTime = arivalTime+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("arivalTime",arivalTime);
|
||||
|
||||
bodyJson.put("dutyUserEmail",dutyUserEmail);
|
||||
bodyJson.put("createByEmail",createByEmail);
|
||||
|
||||
if(beisenDepartmentId > -1){
|
||||
bodyJson.put("departmentId",beisenDepartmentId);
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
bodyJson.put("orgCode",originalCode);
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
/***
|
||||
* 需求状态
|
||||
* 10 草稿
|
||||
* 20 审批中
|
||||
* 30 审批未通过
|
||||
* 40 进行中
|
||||
* 50 已关闭
|
||||
* 60 已完成
|
||||
* 70 已暂停
|
||||
* 80 审批已终止
|
||||
*
|
||||
*/
|
||||
if(requirementStatus > -1){
|
||||
bodyJson.put("requirementStatus",requirementStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 需求人数
|
||||
*/
|
||||
if(requirementCount > -1){
|
||||
bodyJson.put("requirementCount",requirementCount);
|
||||
}
|
||||
/***
|
||||
* 需求类型
|
||||
* 1 新增
|
||||
* 2 顶替
|
||||
* 3 储备
|
||||
*/
|
||||
if(requirementType > -1){
|
||||
bodyJson.put("requirementType",requirementType);
|
||||
}
|
||||
|
||||
|
||||
bodyJson.put("name",xqmc);
|
||||
log.error("beisenCreateBy:{}",beisenCreateBy);
|
||||
if(beisenCreateBy > -1){
|
||||
bodyJson.put("createBy",beisenCreateBy);
|
||||
}
|
||||
|
||||
if(!createDate.contains("T")){
|
||||
createDate = createDate+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("createDate",createDate);
|
||||
|
||||
if(!arivalTime.contains("T")){
|
||||
arivalTime = arivalTime+"T00:00:00";
|
||||
}
|
||||
bodyJson.put("arivalTime",arivalTime);
|
||||
|
||||
bodyJson.put("dutyUserEmail",dutyUserEmail);
|
||||
bodyJson.put("createByEmail",createByEmail);
|
||||
|
||||
if(beisenDepartmentId > -1){
|
||||
bodyJson.put("departmentId",beisenDepartmentId);
|
||||
}else{
|
||||
if(StringUtils.isNotBlank(originalCode)){
|
||||
bodyJson.put("orgCode",originalCode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 需求人数
|
||||
*/
|
||||
if(requirementCount > -1){
|
||||
bodyJson.put("requirementCount",requirementCount);
|
||||
}
|
||||
|
||||
// if(salaryType >-1){
|
||||
// bodyJson.put("salaryType",salaryType);
|
||||
// }
|
||||
|
||||
// bodyJson.put("PositionIdCoreHR","d948d6ce-70cc-4265-975c-fea732759676");
|
||||
|
||||
/***
|
||||
* 招聘类别
|
||||
* 1 社会招聘
|
||||
* 2 校园招聘
|
||||
* 3 实习生招聘
|
||||
*/
|
||||
/***
|
||||
* 招聘类别
|
||||
* 1 社会招聘
|
||||
* 2 校园招聘
|
||||
* 3 实习生招聘
|
||||
*/
|
||||
|
||||
if(category > -1){
|
||||
bodyJson.put("category",category);
|
||||
if(category > -1){
|
||||
bodyJson.put("category",category);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 学历要求
|
||||
* 9 小学
|
||||
* 8 初中
|
||||
* 3 高中
|
||||
* 4 中技(中专/技校/职高)
|
||||
* 5 大专
|
||||
* 1 本科
|
||||
* 2 硕士研究生
|
||||
* 6 MBA
|
||||
* 7 博士研究生
|
||||
* 10 大专及以上
|
||||
* 11 本科及以上
|
||||
* 12 不限
|
||||
*/
|
||||
bodyJson.put("educationInfo",educationInfo);
|
||||
/***
|
||||
* 工作经验
|
||||
* 在读学生
|
||||
* 应届毕业生
|
||||
* 99 在读学生
|
||||
* 98 应届毕业生
|
||||
* 1 1年
|
||||
* 2 2年
|
||||
* 3 3年
|
||||
* 4 4年
|
||||
* 5 5年
|
||||
* 6 6年
|
||||
* 7 7年
|
||||
* 8 8年
|
||||
* 9 9年
|
||||
* 10 10年及以上
|
||||
*/
|
||||
bodyJson.put("workExperience",workExperience);
|
||||
|
||||
/***
|
||||
* 工作性质
|
||||
* 1 全职
|
||||
* 2 兼职
|
||||
* 3 实习
|
||||
* 4 其他
|
||||
*/
|
||||
|
||||
if(kind > -1){
|
||||
bodyJson.put("kind",kind);
|
||||
}
|
||||
if(StringUtils.isNotBlank(nlyq)){
|
||||
JSONObject customProperties = new JSONObject();
|
||||
customProperties.put(Constants.nyyqzdm,nlyq);
|
||||
customProperties.put(Constants.zwzd,zwmc);
|
||||
bodyJson.put("customProperties",customProperties);
|
||||
}
|
||||
log.error("beisenDutyUserId:{}",beisenDutyUserId);
|
||||
if(beisenDutyUserId>-1){
|
||||
bodyJson.put("dutyUser",beisenDutyUserId);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(gzzz)){
|
||||
bodyJson.put("jobDescription",gzzz);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(rzzg)){
|
||||
bodyJson.put("qualification",rzzg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bodyJson.put("isSecrecy",isSecrecy);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
data = doHttpPost(token,bodyJson.toJSONString());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 学历要求
|
||||
* 9 小学
|
||||
* 8 初中
|
||||
* 3 高中
|
||||
* 4 中技(中专/技校/职高)
|
||||
* 5 大专
|
||||
* 1 本科
|
||||
* 2 硕士研究生
|
||||
* 6 MBA
|
||||
* 7 博士研究生
|
||||
* 10 大专及以上
|
||||
* 11 本科及以上
|
||||
* 12 不限
|
||||
*/
|
||||
bodyJson.put("educationInfo",educationInfo);
|
||||
/***
|
||||
* 工作经验
|
||||
* 在读学生
|
||||
* 应届毕业生
|
||||
* 99 在读学生
|
||||
* 98 应届毕业生
|
||||
* 1 1年
|
||||
* 2 2年
|
||||
* 3 3年
|
||||
* 4 4年
|
||||
* 5 5年
|
||||
* 6 6年
|
||||
* 7 7年
|
||||
* 8 8年
|
||||
* 9 9年
|
||||
* 10 10年及以上
|
||||
*/
|
||||
bodyJson.put("workExperience",workExperience);
|
||||
|
||||
/***
|
||||
* 工作性质
|
||||
* 1 全职
|
||||
* 2 兼职
|
||||
* 3 实习
|
||||
* 4 其他
|
||||
*/
|
||||
|
||||
if(kind > -1){
|
||||
bodyJson.put("kind",kind);
|
||||
}
|
||||
|
||||
bodyJson.put("isSecrecy",isSecrecy);
|
||||
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson.toJSONString());
|
||||
|
||||
// RequestBody body = RequestBody.create(mediaType, "{\n \"requirementStatus\":50,\n \"requirementType\":3,\n \"name\":\"测试招聘需求接口\",\n \"departmentId\":2335561,\n \"createBy\":402189433,\n \"createDate\":\"2025-07-01T10:05:45\",\n \"arivalTime\":\"2025-08-01T10:00:00\",\n \"dutyUserEmail\":\"yemintest@chabaidao.com\",\n \"createByEmail\":\"yemintest@chabaidao.com\"\n}");
|
||||
|
||||
public String doHttpPost(String token,String bodyJson){
|
||||
String data = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyJson);
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.beishenHost+Constants.jobRequirementUrl)
|
||||
|
|
@ -198,11 +230,9 @@ public class JobRequirement2BeisenUtil {
|
|||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.error("bodyData:"+bodyData);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
log.error("e:{}",e);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class Request2CostControlController {
|
|||
if(StringUtils.isNotBlank(staffcode)){
|
||||
String workflowId = String.valueOf(params.get("workflowId"));
|
||||
if(StringUtils.isNotBlank(workflowId)){
|
||||
Long workflowid = Long.parseLong(workflowId);
|
||||
Long workflowid = Long.valueOf(workflowId);
|
||||
Long employeeId = convertStaffCodeService.convEmployeeIdByCode(staffcode);
|
||||
if(employeeId > 0){
|
||||
dataMap = request2CostControlService.queryRequestByWorkflowType(params,workflowid,page_no,pageSize,employeeId);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class RequestInfoController {
|
|||
if(StringUtils.isNotBlank(staffcode)){
|
||||
String workflowId = String.valueOf(params.get("workflowId"));
|
||||
if(StringUtils.isNotBlank(workflowId)){
|
||||
Long workflowid = Long.parseLong(workflowId);
|
||||
Long workflowid = Long.valueOf(workflowId);
|
||||
Long employeeId = convertStaffCodeService.convEmployeeIdByCode(staffcode);
|
||||
if(employeeId > 0){
|
||||
dataMap = request2CostControlService.queryRequestByWorkflowType(params,workflowid,page_no,pageSize,employeeId);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class ConvertStaffCodeDao {
|
|||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(!recordList.isEmpty()){
|
||||
employeeId = Long.parseLong(String.valueOf(recordList.get(0).get("id")));
|
||||
employeeId = Long.valueOf(String.valueOf(recordList.get(0).get("id")));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
|
|
@ -44,4 +44,28 @@ public class Constants {
|
|||
public static String templateTable = "uf_dzqmbgl";
|
||||
|
||||
public static String templateTableZdb = "uf_dzqmbgl_zdb";
|
||||
|
||||
public static String qrDocSwitcher = "false";
|
||||
|
||||
public static String signFileFormat = "PDF";
|
||||
|
||||
public static String partyBaccountType = "2";
|
||||
|
||||
public static String autoSign = "false";
|
||||
|
||||
public static int edgePosition = 1;
|
||||
|
||||
public static int edgeScope = 0;
|
||||
|
||||
public static int sealType = 0;
|
||||
|
||||
public static String partyAaccountType = "1";
|
||||
|
||||
public static String externalpersonUrl = "/V1/accounts/outerAccounts/simpleCreate";
|
||||
|
||||
|
||||
public static String signFlowsUrl = "/V1/signFlows/create";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
|
|
@ -51,6 +53,22 @@ public class SealTemplateController {
|
|||
return WeaResult.success(dataMap);
|
||||
}
|
||||
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@GetMapping("/queryTemplateField")
|
||||
public WeaResult<Object> queryTemplateField(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
|
||||
String templateId = request.getParameter("templateId");
|
||||
Map<String,Object> paraMap = CommonUtils.requestToMap(request);
|
||||
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
dataList = sealTemplateService.queryTemplateField(templateId,paraMap);
|
||||
}else{
|
||||
return WeaResult.fail(500,"模板ID为空");
|
||||
}
|
||||
return WeaResult.success(dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试接口
|
||||
* @param request
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ public class SealTemplateDao {
|
|||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
if(recordList.size() > 0){
|
||||
dataid = String.valueOf(recordList.get(0).get("id"));
|
||||
if(recordList.get(0).containsKey("id")){
|
||||
dataid = String.valueOf(recordList.get(0).get("id"));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
|
|
@ -101,4 +103,33 @@ public class SealTemplateDao {
|
|||
return dataid;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> queryTemplateFieldByType(String templateId,String type){
|
||||
String groupId = "weaver-ebuilder-form-service";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select k.zdm ,k.zdlx ,k.zdlx_obj ,k.zdz ,k.zdmc,k.zdz as rc \n" +
|
||||
" from uf_dzqmbgl t\n" +
|
||||
" inner join uf_dzqmbgl_zdb k on k.form_data_id = t.form_data_id \n" +
|
||||
" where t.mbid=? and t.tenant_key=? and k.zdlx in("+type+") " +
|
||||
" and t.delete_type=0 and k.tenant_key=? and k.delete_type=0 " ;
|
||||
|
||||
log.error("dataSql:{}" , dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(templateId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}", recordList.size());
|
||||
}catch (Exception e){
|
||||
log.error("getDepartmentCodeById:e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignApplyRequest4OrgainzeUtil;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignPreviewUrlUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateRequest4OrganizeAction")
|
||||
public class Esb2EsignCreateRequest4OrganizeAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateRequest4OrganizeAction.class);
|
||||
@Autowired
|
||||
Esb2EsignApplyRequest4OrgainzeUtil esb2EsignApplyRequest4OrgainzeUtil;
|
||||
|
||||
@Autowired
|
||||
private Esb2EsignPreviewUrlUtil esb2EsignPreviewUrlUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestname = String.valueOf(params.get("requestname"));
|
||||
String sealId = String.valueOf(params.get("sealId"));
|
||||
String docFilekey = String.valueOf(params.get("docFilekey"));
|
||||
String docName = String.valueOf(params.get("docName"));
|
||||
String creditCode = String.valueOf(params.get("creditCode"));
|
||||
String qsrJobNum = String.valueOf(params.get("qsrJobNum"));
|
||||
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestname:{}",requestname);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
log.error("docName:{}",docName);
|
||||
log.error("creditCode:{}",creditCode);
|
||||
log.error("qsrJobNum:{}",qsrJobNum);
|
||||
|
||||
String signFlowId = "";
|
||||
String signUrls = "";
|
||||
String accountIds = "";
|
||||
String uniqueIds = "";
|
||||
String fileKeys = "";
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
JSONObject dataJson = esb2EsignApplyRequest4OrgainzeUtil.applyRequest(requestid,requestname,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
signFlowId = dataJson.getString("signFlowId");
|
||||
signUrls = dataJson.getString("signUrls");
|
||||
accountIds = dataJson.getString("accountIds");
|
||||
uniqueIds = dataJson.getString("uniqueIds");
|
||||
fileKeys = dataJson.getString("fileKeys");
|
||||
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
log.error("signUrls:{}",signUrls);
|
||||
log.error("accountIds:{}",accountIds);
|
||||
log.error("uniqueIds:{}",uniqueIds);
|
||||
log.error("fileKeys:{}",fileKeys);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileKeys)){
|
||||
return WeaResult.fail(500,"用印申请失败");
|
||||
}
|
||||
|
||||
String preViewUrl = "";
|
||||
if(StringUtils.isNotBlank(fileKeys)){
|
||||
preViewUrl = esb2EsignPreviewUrlUtil.queryPreviewUrl(fileKeys);
|
||||
}
|
||||
log.error("preViewUrl:{}",preViewUrl);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("signFlowId",signFlowId);
|
||||
actionMap.put("accountIds",accountIds);
|
||||
actionMap.put("signUrls",signUrls);
|
||||
actionMap.put("uniqueIds",uniqueIds);
|
||||
actionMap.put("fileKeys",fileKeys);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignApplyRequestUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateRequest4PartiesAction")
|
||||
public class Esb2EsignCreateRequest4PartiesAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateRequest4PartiesAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignApplyRequestUtil esb2EsignApplyRequestUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestname = String.valueOf(params.get("requestname"));
|
||||
String sealId = String.valueOf(params.get("sealId"));
|
||||
String docFilekey = String.valueOf(params.get("docFilekey"));
|
||||
String docName = String.valueOf(params.get("docName"));
|
||||
String creditCode = String.valueOf(params.get("creditCode"));
|
||||
|
||||
String employeeMobile = String.valueOf(params.get("employeeMobile"));
|
||||
String qsrJobNum = String.valueOf(params.get("qsrJobNum"));
|
||||
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestname:{}",requestname);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
log.error("docName:{}",docName);
|
||||
log.error("creditCode:{}",creditCode);
|
||||
log.error("employeeMobile:{}",employeeMobile);
|
||||
log.error("qsrJobNum:{}",qsrJobNum);
|
||||
|
||||
String signFlowId = "";
|
||||
String signUrls = "";
|
||||
String accountIds = "";
|
||||
String uniqueIds = "";
|
||||
String fileKeys = "";
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
JSONObject dataJson = esb2EsignApplyRequestUtil.applyRequest(requestid,requestname,employeeMobile,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
signFlowId = dataJson.getString("signFlowId");
|
||||
signUrls = dataJson.getString("signUrls");
|
||||
accountIds = dataJson.getString("accountIds");
|
||||
uniqueIds = dataJson.getString("uniqueIds");
|
||||
fileKeys = dataJson.getString("fileKeys");
|
||||
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
log.error("signUrls:{}",signUrls);
|
||||
log.error("accountIds:{}",accountIds);
|
||||
log.error("uniqueIds:{}",uniqueIds);
|
||||
log.error("fileKeys:{}",fileKeys);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileKeys)){
|
||||
return WeaResult.fail(500,"用印申请失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("signFlowId",signFlowId);
|
||||
actionMap.put("accountIds",accountIds);
|
||||
actionMap.put("signUrls",signUrls);
|
||||
actionMap.put("uniqueIds",uniqueIds);
|
||||
actionMap.put(" ",fileKeys);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignApplyRequestUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateRequestAction")
|
||||
public class Esb2EsignCreateRequestAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateRequestAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignApplyRequestUtil esb2EsignApplyRequestUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String requestid = String.valueOf(params.get("requestid"));
|
||||
String requestname = String.valueOf(params.get("requestname"));
|
||||
String sealId = String.valueOf(params.get("sealId"));
|
||||
String docFilekey = String.valueOf(params.get("docFilekey"));
|
||||
String docName = String.valueOf(params.get("docName"));
|
||||
String creditCode = String.valueOf(params.get("creditCode"));
|
||||
|
||||
String employeeMobile = String.valueOf(params.get("employeeMobile"));
|
||||
String qsrJobNum = String.valueOf(params.get("qsrJobNum"));
|
||||
|
||||
log.error("requestid:{}",requestid);
|
||||
log.error("requestname:{}",requestname);
|
||||
log.error("sealId:{}",sealId);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
log.error("docName:{}",docName);
|
||||
log.error("creditCode:{}",creditCode);
|
||||
log.error("employeeMobile:{}",employeeMobile);
|
||||
log.error("qsrJobNum:{}",qsrJobNum);
|
||||
|
||||
String signFlowId = "";
|
||||
String signUrls = "";
|
||||
String accountIds = "";
|
||||
String uniqueIds = "";
|
||||
String fileKeys = "";
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
JSONObject dataJson = esb2EsignApplyRequestUtil.applyRequest(requestid,requestname,employeeMobile,templateId,sealId,docFilekey,docName,creditCode,qsrJobNum);
|
||||
signFlowId = dataJson.getString("signFlowId");
|
||||
signUrls = dataJson.getString("signUrls");
|
||||
accountIds = dataJson.getString("accountIds");
|
||||
uniqueIds = dataJson.getString("uniqueIds");
|
||||
fileKeys = dataJson.getString("fileKeys");
|
||||
|
||||
log.error("signFlowId:{}",signFlowId);
|
||||
log.error("signUrls:{}",signUrls);
|
||||
log.error("accountIds:{}",accountIds);
|
||||
log.error("uniqueIds:{}",uniqueIds);
|
||||
log.error("fileKeys:{}",fileKeys);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(fileKeys)){
|
||||
return WeaResult.fail(500,"用印申请失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("signFlowId",signFlowId);
|
||||
actionMap.put("accountIds",accountIds);
|
||||
actionMap.put("signUrls",signUrls);
|
||||
actionMap.put("uniqueIds",uniqueIds);
|
||||
actionMap.put(" ",fileKeys);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignCreateUserUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2EsignCreateUserAction")
|
||||
public class Esb2EsignCreateUserAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateUserAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignCreateUserUtil esb2EsignCreateUserUtil;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String mobile = String.valueOf(params.get("mobile"));
|
||||
String name = String.valueOf(params.get("name"));
|
||||
|
||||
if(StringUtils.isBlank(mobile)){
|
||||
return WeaResult.fail(500,"手机号为空");
|
||||
}
|
||||
if(StringUtils.isBlank(name)){
|
||||
return WeaResult.fail(500,"姓名为空");
|
||||
}
|
||||
|
||||
String esignAccountId = "";
|
||||
String uniqueId = "";
|
||||
if(StringUtils.isNotBlank(mobile) && StringUtils.isNotBlank(name)){
|
||||
Map<String,Object> dataMap = esb2EsignCreateUserUtil.createUser(name,mobile);
|
||||
esignAccountId = String.valueOf(dataMap.get("esignAccountId"));
|
||||
uniqueId = String.valueOf(dataMap.get("uniqueId"));
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(esignAccountId)){
|
||||
return WeaResult.fail(500,"创建e签宝用户失败");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("esignAccountId",esignAccountId);
|
||||
actionMap.put("mobile",mobile);
|
||||
actionMap.put("uniqueId",uniqueId);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,13 @@
|
|||
package com.weaver.seconddev.chapanda.esign.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.esign.service.SealTemplateService;
|
||||
import com.weaver.seconddev.chapanda.esign.util.Esb2EsignUtil;
|
||||
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.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
|
@ -19,8 +16,6 @@ import java.util.Map;
|
|||
public class Esb2EsignQueryPreviewUrlAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignQueryPreviewUrlAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2EsignUtil esb2EsignUtil;
|
||||
|
||||
@Autowired
|
||||
SealTemplateService sealTemplateService;
|
||||
|
|
@ -37,12 +32,18 @@ public class Esb2EsignQueryPreviewUrlAction implements EsbServerlessRpcRemoteInt
|
|||
Map<String, Object> dataMap = new HashMap<String,Object>();
|
||||
|
||||
String templateId = String.valueOf(params.get("templateId"));
|
||||
String form_data_id = String.valueOf(params.get("form_data_id"));
|
||||
if(StringUtils.isNotBlank(templateId)){
|
||||
dataMap = sealTemplateService.queryPreviewUrl(templateId,params);
|
||||
}
|
||||
String fileKey = String.valueOf(dataMap.get("filekey"));
|
||||
String preViewUrl = String.valueOf(dataMap.get("previewurl"));
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("data",dataMap);
|
||||
actionMap.put("filekey",fileKey);
|
||||
actionMap.put("previewurl",preViewUrl);
|
||||
actionMap.put("form_data_id",form_data_id);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 同步电子印章模板数据
|
||||
* 同步电子印章模板数据, 含有明细表字段
|
||||
*/
|
||||
@Service("Esb2EsignSyncTemplateCron")
|
||||
public class Esb2EsignSyncTemplateCron implements EsbServerlessRpcRemoteInterface {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ package com.weaver.seconddev.chapanda.esign.service;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public interface SealTemplateService {
|
||||
|
||||
Map<String,Object> queryPreviewUrl(String templateId,Map<String, Object> paraMap);
|
||||
List<Map<String,Object>> queryTemplateField(String templateId, Map<String, Object> paraMap);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/***
|
||||
|
|
@ -49,8 +51,12 @@ public class SealTemplateServiceImpl implements SealTemplateService {
|
|||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
List<Map<String,Object>> templateFieldList = sealTemplateDao.queryTemplateFieldByTemplateId(templateId);
|
||||
log.error("templateFieldList:{}",templateFieldList.size());
|
||||
|
||||
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(1151285259738521602L);
|
||||
String employee_id = String.valueOf(paraMap.get("employee_id"));
|
||||
Long employeeId = 0L;
|
||||
if(StringUtils.isNotBlank(employee_id)){
|
||||
employeeId = Long.valueOf(employee_id);
|
||||
}
|
||||
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(employeeId);
|
||||
log.error("simpleEmployee:{}",simpleEmployee.getUsername());
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
String fileKey = "";
|
||||
|
|
@ -68,11 +74,13 @@ public class SealTemplateServiceImpl implements SealTemplateService {
|
|||
log.error("zdz:{}",zdz);
|
||||
|
||||
JSONObject formJson = converFieldValue(paraMap,simpleEmployee,zdlx,zdz,zdm);
|
||||
|
||||
formArray.add(formJson);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bodyJson.put("templateFormValues",formArray);
|
||||
bodyJson.put("templateId",templateId);
|
||||
log.error("bodyJson:{}",bodyJson.toJSONString());
|
||||
|
|
@ -90,12 +98,13 @@ public class SealTemplateServiceImpl implements SealTemplateService {
|
|||
}
|
||||
|
||||
dataMap.put("bodyData",bodyJson.toJSONString());
|
||||
dataMap.put("fileKey",fileKey);
|
||||
dataMap.put("filekey",fileKey);
|
||||
dataMap.put("previewurl",preViewUrl);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 转换规则
|
||||
* @param paraMap
|
||||
|
|
@ -172,4 +181,85 @@ public class SealTemplateServiceImpl implements SealTemplateService {
|
|||
bodyJson.put("formValue",value);
|
||||
return bodyJson;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param templateId
|
||||
* @param paraMap
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> queryTemplateField(String templateId, Map<String, Object> paraMap) {
|
||||
String types = String.valueOf(paraMap.get("type"));
|
||||
List<Map<String, Object>> fieldList = new ArrayList<Map<String, Object>>();
|
||||
String[] typeArr = types.split(",");
|
||||
for(int i=0;i<typeArr.length;i++){
|
||||
List<Map<String,Object>> dataList = sealTemplateDao.queryTemplateFieldByType(templateId,typeArr[i]);
|
||||
if("3".equals(typeArr[i])){
|
||||
fieldList.addAll(convertSql2Param(dataList));
|
||||
}else{
|
||||
fieldList.addAll(convertParam2Param(dataList));
|
||||
}
|
||||
}
|
||||
return fieldList;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> convertSql2Param(List<Map<String,Object>> dataList){
|
||||
List<Map<String,Object>> paramList = new ArrayList<Map<String,Object>>();
|
||||
List<String> parameters = new ArrayList<>();
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
String zdz = String.valueOf(dataList.get(i).get("zdz"));
|
||||
if(zdz.contains("select")){
|
||||
Pattern pattern = Pattern.compile("\\{\\?([^}]+)\\}");
|
||||
Matcher matcher = pattern.matcher(zdz);
|
||||
while (matcher.find()) {
|
||||
if(!parameters.contains(matcher.group(1))){
|
||||
parameters.add(matcher.group(1)); // 提取{?和}之间的内容
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(String key : parameters){
|
||||
Map<String,Object> paramMap = new HashMap<String,Object>();
|
||||
paramMap.put("field",key);
|
||||
paramList.add(paramMap);
|
||||
}
|
||||
|
||||
return paramList;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String,Object>> convertParam2Param(List<Map<String,Object>> dataList){
|
||||
List<Map<String,Object>> paramList = new ArrayList<Map<String,Object>>();
|
||||
List<String> parameters = new ArrayList<>();
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
String zdz = String.valueOf(dataList.get(i).get("zdz"));
|
||||
if(!parameters.contains(zdz)){
|
||||
parameters.add(zdz);
|
||||
}
|
||||
}
|
||||
for(String key : parameters){
|
||||
Map<String,Object> paramMap = new HashMap<String,Object>();
|
||||
paramMap.put("field",key);
|
||||
paramList.add(paramMap);
|
||||
}
|
||||
return paramList;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String data = "select mc from uf_legal_entity where id = '{?frgs}' and name = '{?test}' ";
|
||||
|
||||
// 使用正则表达式按{?截取,}为结束
|
||||
Pattern pattern = Pattern.compile("\\{\\?([^}]+)\\}");
|
||||
Matcher matcher = pattern.matcher(data);
|
||||
|
||||
List<String> parameters = new ArrayList<>();
|
||||
while (matcher.find()) {
|
||||
parameters.add(matcher.group(1)); // 提取{?和}之间的内容
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,190 @@
|
|||
package com.weaver.seconddev.chapanda.esign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
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.Component;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@Component
|
||||
public class Esb2EsignApplyRequest4OrgainzeUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignApplyRequest4OrgainzeUtil.class);
|
||||
@Autowired
|
||||
Esb2EsignTemplateSealPostionUtil esb2EsignTemplateSealPostionUtil;
|
||||
public JSONObject applyRequest(String requestid,String requestname,String templateId,String sealId,String docFilekey,String docName,String creditCode,String qsrJobNum){
|
||||
|
||||
JSONArray signDocs = new JSONArray();
|
||||
JSONObject signDoc = new JSONObject();
|
||||
signDoc.put("docFilekey",docFilekey);
|
||||
signDoc.put("docName",docName);
|
||||
signDoc.put("docOrder",1);
|
||||
signDocs.add(signDoc);
|
||||
|
||||
JSONArray signers = appendSignersParty(templateId,sealId,docFilekey,creditCode,qsrJobNum);
|
||||
log.error("signers:{}",signers.toJSONString());
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("bizNo",requestid);
|
||||
bodyJson.put("initiatorUniqueId","admin");
|
||||
bodyJson.put("qrDocSwitcher",Constants.qrDocSwitcher);
|
||||
bodyJson.put("signDocs",signDocs);
|
||||
bodyJson.put("signFileFormat",Constants.signFileFormat);
|
||||
bodyJson.put("signers",signers);
|
||||
bodyJson.put("subject",requestname);
|
||||
|
||||
String xTimevaleSignature = encryptionHmacSHA256(bodyJson.toJSONString());
|
||||
log.error("xTimevaleSignature:"+xTimevaleSignature);
|
||||
|
||||
JSONObject returnJson = new JSONObject();
|
||||
String msg = doHttpPost(xTimevaleSignature,bodyJson.toJSONString());
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
returnJson = convertData(msg);
|
||||
}
|
||||
return returnJson;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xTimevaleSignature
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String doHttpPost(String xTimevaleSignature,String bodyData){
|
||||
log.error("bodyData:{}",bodyData);
|
||||
String msg = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyData);
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.eSignHost+Constants.signFlowsUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("x-timevale-project-id", Constants.xTimevaleProjectId)
|
||||
.addHeader("x-timevale-signature", xTimevaleSignature)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
log.error("code:"+code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String encryptionHmacSHA256(String bodyData){
|
||||
String encryptionData = "";
|
||||
// String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
// 要签名的数据
|
||||
// JSONObject dataObject = new JSONObject();
|
||||
// dataObject.put("templateId","JMHT-ZXSJ");
|
||||
// String data = "{\"templateId\":\"JMHT-ZXSJ\"}" ;
|
||||
try {
|
||||
// 初始化Mac对象
|
||||
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(Constants.secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||
sha256Hmac.init(secretKeySpec);
|
||||
byte[] result = sha256Hmac.doFinal(bodyData.getBytes(StandardCharsets.UTF_8));
|
||||
encryptionData = Hex.encodeHexString(result);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}catch (InvalidKeyException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encryptionData;
|
||||
}
|
||||
|
||||
|
||||
public JSONArray appendSignersParty(String templateId,String sealId,String docFilekey,String creditCode,String qsrJobNum){
|
||||
JSONArray signers = new JSONArray();
|
||||
JSONObject detailJson = esb2EsignTemplateSealPostionUtil.getTemplateFormData4Orgainze(templateId,sealId,docFilekey);
|
||||
log.error("detailJson:{}",detailJson.toJSONString());
|
||||
|
||||
JSONObject partyAJson = new JSONObject();
|
||||
partyAJson.put("authorizationOrganizeNo",creditCode);
|
||||
partyAJson.put("uniqueId",qsrJobNum);
|
||||
partyAJson.put("accountType",Constants.partyAaccountType);
|
||||
partyAJson.put("autoSign","true");
|
||||
partyAJson.put("signOrder","1");
|
||||
|
||||
if(detailJson.containsKey("partyA")){
|
||||
JSONArray partyA = detailJson.getJSONArray("partyA");
|
||||
partyAJson.put("signDocDetails",partyA);
|
||||
}
|
||||
|
||||
log.error("partyAJson:{}",partyAJson.toJSONString());
|
||||
signers.add(partyAJson);
|
||||
return signers;
|
||||
}
|
||||
|
||||
|
||||
public JSONObject convertData(String msg){
|
||||
JSONObject dataObject = new JSONObject();
|
||||
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("errCode")){
|
||||
String errCode = bodyJson.getString("errCode");
|
||||
if("0".equals(errCode)){
|
||||
JSONObject dataJson = bodyJson.getJSONObject("data");
|
||||
if(dataJson.containsKey("signFlowId")){
|
||||
String signFlowId = dataJson.getString("signFlowId");
|
||||
dataObject.put("signFlowId",signFlowId);
|
||||
|
||||
String signUrls = "";
|
||||
String uniqueIds = "";
|
||||
String accountIds = "";
|
||||
|
||||
if(dataJson.containsKey("signUrls")){
|
||||
String signUrlsStr = dataJson.getString("signUrls");
|
||||
if(!"[]".equals(signUrlsStr)){
|
||||
JSONArray signUrlsArray = dataJson.getJSONArray("signUrls");
|
||||
for(int i=0;i<signUrlsArray.size();i++){
|
||||
JSONObject signUrlJson = signUrlsArray.getJSONObject(i);
|
||||
String signUrl = signUrlJson.getString("signUrl");
|
||||
String uniqueId = signUrlJson.getString("uniqueId");
|
||||
String accountId = signUrlJson.getString("accountId");
|
||||
signUrls += StringUtils.isBlank(signUrls) ? signUrl : ","+signUrl ;
|
||||
uniqueIds += StringUtils.isBlank(uniqueIds) ? uniqueId : ","+uniqueId ;
|
||||
accountIds += StringUtils.isBlank(accountIds) ? accountId : ","+accountId ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String fileKeys = "";
|
||||
JSONArray signDocs = dataJson.getJSONArray("signDocs");
|
||||
for(int i=0;i<signDocs.size();i++){
|
||||
JSONObject signDoc = signDocs.getJSONObject(i);
|
||||
String fileKey = signDoc.getString("fileKey");
|
||||
fileKeys += StringUtils.isBlank(fileKeys) ? fileKey : ","+fileKey ;
|
||||
}
|
||||
dataObject.put("signUrls",signUrls);
|
||||
dataObject.put("accountIds",accountIds);
|
||||
dataObject.put("uniqueIds",uniqueIds);
|
||||
dataObject.put("fileKeys",fileKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataObject;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package com.weaver.seconddev.chapanda.esign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
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.Component;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@Component
|
||||
public class Esb2EsignApplyRequestUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignApplyRequestUtil.class);
|
||||
@Autowired
|
||||
Esb2EsignTemplateSealPostionUtil esb2EsignTemplateSealPostionUtil;
|
||||
public JSONObject applyRequest(String requestid,String requestname,String employeeMobile,String templateId,String sealId,String docFilekey,String docName,String creditCode,String qsrJobNum){
|
||||
|
||||
JSONArray signDocs = new JSONArray();
|
||||
JSONObject signDoc = new JSONObject();
|
||||
signDoc.put("docFilekey",docFilekey);
|
||||
signDoc.put("docName",docName);
|
||||
signDoc.put("docOrder",1);
|
||||
signDocs.add(signDoc);
|
||||
|
||||
JSONArray signers = appendSignersParty(employeeMobile,templateId,sealId,docFilekey,creditCode,qsrJobNum);
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("bizNo",requestid);
|
||||
bodyJson.put("initiatorUniqueId","admin");
|
||||
bodyJson.put("qrDocSwitcher",Constants.qrDocSwitcher);
|
||||
bodyJson.put("signDocs",signDocs);
|
||||
bodyJson.put("signFileFormat",Constants.signFileFormat);
|
||||
bodyJson.put("signers",signers);
|
||||
bodyJson.put("subject",requestname);
|
||||
|
||||
String xTimevaleSignature = encryptionHmacSHA256(bodyJson.toJSONString());
|
||||
log.error("xTimevaleSignature:"+xTimevaleSignature);
|
||||
|
||||
JSONObject returnJson = new JSONObject();
|
||||
String msg = doHttpPost(xTimevaleSignature,bodyJson.toJSONString());
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
returnJson = convertData(msg);
|
||||
}
|
||||
return returnJson;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xTimevaleSignature
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String doHttpPost(String xTimevaleSignature,String bodyData){
|
||||
log.error("bodyData:{}",bodyData);
|
||||
String msg = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyData);
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.eSignHost+Constants.signFlowsUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("x-timevale-project-id", Constants.xTimevaleProjectId)
|
||||
.addHeader("x-timevale-signature", xTimevaleSignature)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
log.error("code:"+code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String encryptionHmacSHA256(String bodyData){
|
||||
String encryptionData = "";
|
||||
// String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
// 要签名的数据
|
||||
// JSONObject dataObject = new JSONObject();
|
||||
// dataObject.put("templateId","JMHT-ZXSJ");
|
||||
// String data = "{\"templateId\":\"JMHT-ZXSJ\"}" ;
|
||||
try {
|
||||
// 初始化Mac对象
|
||||
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(Constants.secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||
sha256Hmac.init(secretKeySpec);
|
||||
byte[] result = sha256Hmac.doFinal(bodyData.getBytes(StandardCharsets.UTF_8));
|
||||
encryptionData = Hex.encodeHexString(result);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}catch (InvalidKeyException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encryptionData;
|
||||
}
|
||||
|
||||
|
||||
public JSONArray appendSignersParty(String employeeMobile,String templateId,String sealId,String docFilekey,String creditCode,String qsrJobNum){
|
||||
JSONArray signers = new JSONArray();
|
||||
JSONObject detailJson = esb2EsignTemplateSealPostionUtil.getTemplateFormData(templateId,sealId,docFilekey);
|
||||
|
||||
|
||||
|
||||
JSONObject partyBJson = new JSONObject();
|
||||
partyBJson.put("authorizationOrganizeNo","");
|
||||
partyBJson.put("uniqueId",employeeMobile);
|
||||
partyBJson.put("accountType",Constants.partyBaccountType);
|
||||
partyBJson.put("autoSign",Constants.autoSign);
|
||||
if(detailJson.containsKey("partyB")){
|
||||
JSONArray partyB = detailJson.getJSONArray("partyB");
|
||||
partyBJson.put("signDocDetails",partyB);
|
||||
}
|
||||
|
||||
partyBJson.put("signOrder","1");
|
||||
|
||||
JSONObject partyAJson = new JSONObject();
|
||||
partyAJson.put("authorizationOrganizeNo",creditCode);
|
||||
partyAJson.put("uniqueId",qsrJobNum);
|
||||
partyAJson.put("accountType",Constants.partyAaccountType);
|
||||
partyAJson.put("autoSign",Constants.autoSign);
|
||||
if(detailJson.containsKey("partyA")){
|
||||
JSONArray partyA = detailJson.getJSONArray("partyA");
|
||||
partyAJson.put("signDocDetails",partyA);
|
||||
}
|
||||
|
||||
partyAJson.put("signOrder","2");
|
||||
|
||||
signers.add(partyBJson);
|
||||
signers.add(partyAJson);
|
||||
return signers;
|
||||
}
|
||||
|
||||
|
||||
public JSONObject convertData(String msg){
|
||||
JSONObject dataObject = new JSONObject();
|
||||
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("errCode")){
|
||||
String errCode = bodyJson.getString("errCode");
|
||||
if("0".equals(errCode)){
|
||||
JSONObject dataJson = bodyJson.getJSONObject("data");
|
||||
if(dataJson.containsKey("signFlowId")){
|
||||
String signFlowId = dataJson.getString("signFlowId");
|
||||
dataObject.put("signFlowId",signFlowId);
|
||||
JSONArray signUrlsArray = dataJson.getJSONArray("signUrls");
|
||||
String signUrls = "";
|
||||
String uniqueIds = "";
|
||||
String accountIds = "";
|
||||
for(int i=0;i<signUrlsArray.size();i++){
|
||||
JSONObject signUrlJson = signUrlsArray.getJSONObject(i);
|
||||
String signUrl = signUrlJson.getString("signUrl");
|
||||
String uniqueId = signUrlJson.getString("uniqueId");
|
||||
String accountId = signUrlJson.getString("accountId");
|
||||
signUrls += StringUtils.isBlank(signUrls) ? signUrl : ","+signUrl ;
|
||||
uniqueIds += StringUtils.isBlank(uniqueIds) ? uniqueId : ","+uniqueId ;
|
||||
accountIds += StringUtils.isBlank(accountIds) ? accountId : ","+accountId ;
|
||||
}
|
||||
|
||||
String fileKeys = "";
|
||||
JSONArray signDocs = dataJson.getJSONArray("signDocs");
|
||||
for(int i=0;i<signDocs.size();i++){
|
||||
JSONObject signDoc = signDocs.getJSONObject(i);
|
||||
String fileKey = signDoc.getString("fileKey");
|
||||
fileKeys += StringUtils.isBlank(fileKeys) ? fileKey : ","+fileKey ;
|
||||
}
|
||||
dataObject.put("signUrls",signUrls);
|
||||
dataObject.put("accountIds",accountIds);
|
||||
dataObject.put("uniqueIds",uniqueIds);
|
||||
dataObject.put("fileKeys",fileKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataObject;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
package com.weaver.seconddev.chapanda.esign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
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.Component;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class Esb2EsignCreateUserUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignCreateUserUtil.class);
|
||||
// @Autowired
|
||||
// Esb2EsignTemplateSealPostionUtil esb2EsignTemplateSealPostionUtil;
|
||||
public Map<String,Object> createUser(String name,String mobile){
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("contactsMobile",mobile);
|
||||
bodyJson.put("name",name);
|
||||
bodyJson.put("loginMobile",mobile);
|
||||
|
||||
String xTimevaleSignature = encryptionHmacSHA256(bodyJson.toJSONString());
|
||||
log.error("xTimevaleSignature:"+xTimevaleSignature);
|
||||
|
||||
String msg = doHttpPost(xTimevaleSignature,bodyJson.toJSONString());
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
dataMap = convertData(msg);
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param xTimevaleSignature
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String doHttpPost(String xTimevaleSignature,String bodyData){
|
||||
String msg = "";
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyData);
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.eSignHost+Constants.externalpersonUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("x-timevale-project-id", Constants.xTimevaleProjectId)
|
||||
.addHeader("x-timevale-signature", xTimevaleSignature)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
log.error("code:"+code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String encryptionHmacSHA256(String bodyData){
|
||||
String encryptionData = "";
|
||||
// String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
// 要签名的数据
|
||||
// JSONObject dataObject = new JSONObject();
|
||||
// dataObject.put("templateId","JMHT-ZXSJ");
|
||||
// String data = "{\"templateId\":\"JMHT-ZXSJ\"}" ;
|
||||
try {
|
||||
// 初始化Mac对象
|
||||
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(Constants.secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||
sha256Hmac.init(secretKeySpec);
|
||||
byte[] result = sha256Hmac.doFinal(bodyData.getBytes(StandardCharsets.UTF_8));
|
||||
encryptionData = Hex.encodeHexString(result);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}catch (InvalidKeyException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encryptionData;
|
||||
}
|
||||
|
||||
|
||||
// public JSONArray appendSignersParty(String employeeMobile,String templateId,String sealId,String docFilekey,String creditCode,String qsrJobNum){
|
||||
// JSONArray signers = new JSONArray();
|
||||
// JSONObject detailJson = esb2EsignTemplateSealPostionUtil.getTemplateFormData(templateId,sealId,docFilekey);
|
||||
// JSONObject partyA = detailJson.getJSONObject("partyA");
|
||||
// JSONObject partyB = detailJson.getJSONObject("partyB");
|
||||
// JSONObject partyBJson = new JSONObject();
|
||||
// partyBJson.put("authorizationOrganizeNo","");
|
||||
// partyBJson.put("uniqueId",employeeMobile);
|
||||
// partyBJson.put("accountType",Constants.partyBaccountType);
|
||||
// partyBJson.put("autoSign",Constants.autoSign);
|
||||
// partyBJson.put("signDocDetails",partyB);
|
||||
// partyBJson.put("signOrder","1");
|
||||
//
|
||||
// JSONObject partyAJson = new JSONObject();
|
||||
// partyAJson.put("authorizationOrganizeNo",creditCode);
|
||||
// partyAJson.put("uniqueId",qsrJobNum);
|
||||
// partyAJson.put("accountType",Constants.partyAaccountType);
|
||||
// partyAJson.put("autoSign",Constants.autoSign);
|
||||
// partyAJson.put("signDocDetails",partyA);
|
||||
// partyAJson.put("signOrder","2");
|
||||
//
|
||||
// signers.add(partyBJson);
|
||||
// signers.add(partyAJson);
|
||||
// return signers;
|
||||
// }
|
||||
|
||||
|
||||
public Map<String,Object> convertData(String msg){
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
|
||||
JSONObject bodyJson = JSONObject.parseObject(msg);
|
||||
if(bodyJson.containsKey("errCode")){
|
||||
String errCode = bodyJson.getString("errCode");
|
||||
log.error("errCode:{}",errCode);
|
||||
if("0".equals(errCode)){
|
||||
JSONObject dataJson = bodyJson.getJSONObject("data");
|
||||
String accountId = dataJson.getString("accountId");
|
||||
String esignAccountId = dataJson.getString("esignAccountId");
|
||||
String uniqueId = dataJson.getString("uniqueId");
|
||||
|
||||
log.error("accountId:{}",accountId);
|
||||
log.error("esignAccountId:{}",esignAccountId);
|
||||
log.error("uniqueId:{}",errCode);
|
||||
|
||||
dataMap.put("accountId",accountId);
|
||||
dataMap.put("esignAccountId",esignAccountId);
|
||||
dataMap.put("uniqueId",uniqueId);
|
||||
}
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ public class Esb2EsignPreviewUrlUtil {
|
|||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.eSignHost+Constants.querySealsUrl+"?fileKey="+fileKey)
|
||||
.url(Constants.eSignHost+Constants.previewUrl+"?fileKey="+fileKey)
|
||||
.method("GET", null)
|
||||
.addHeader("x-timevale-project-id", Constants.xTimevaleProjectId)
|
||||
.addHeader("x-timevale-signature", xTimevaleSignature)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,343 @@
|
|||
package com.weaver.seconddev.chapanda.esign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.esign.constant.Constants;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@Component
|
||||
public class Esb2EsignTemplateSealPostionUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2EsignTemplateSealPostionUtil.class);
|
||||
|
||||
public JSONObject getTemplateFormData(String templateId,String sealId,String docFilekey){
|
||||
|
||||
JSONObject detailJson = new JSONObject();
|
||||
|
||||
|
||||
JSONObject partyA = new JSONObject();
|
||||
JSONObject partyB = new JSONObject();
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("templateId", templateId);
|
||||
|
||||
String xTimevaleSignature = encryptionHmacSHA256(bodyJson.toJSONString());
|
||||
log.error("xTimevaleSignature:"+xTimevaleSignature);
|
||||
String msg = doPostHttp(xTimevaleSignature,bodyJson.toJSONString());
|
||||
log.error("msg:"+msg);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("errCode")){
|
||||
String errCode = msgJson.getString("errCode");
|
||||
if("0".equals(errCode)){
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONObject dataJson = msgJson.getJSONObject("data");
|
||||
if(dataJson.containsKey("template")){
|
||||
JSONObject templateJson = dataJson.getJSONObject("template");
|
||||
if(templateJson.containsKey("templateFlows")){
|
||||
JSONArray templateFlows = templateJson.getJSONArray("templateFlows");
|
||||
|
||||
for(int i=0;i<templateFlows.size();i++){
|
||||
JSONObject templateFlowJson = templateFlows.getJSONObject(i);
|
||||
if(templateFlowJson.containsKey("flowName")){
|
||||
String flowName = templateFlowJson.getString("flowName");
|
||||
if("甲方".equals(flowName)){
|
||||
|
||||
JSONObject predefineJson = templateFlowJson.getJSONObject("predefine");
|
||||
boolean addSignTime = predefineJson.getBoolean("addSignTime");
|
||||
JSONArray positionsArray = predefineJson.getJSONArray("positions");
|
||||
System.out.println("positionsArray:"+positionsArray);
|
||||
|
||||
JSONArray signPos = new JSONArray();
|
||||
|
||||
for(int k=0;k<positionsArray.size();k++){
|
||||
JSONObject positionsJson = positionsArray.getJSONObject(k);
|
||||
String posX = positionsJson.getString("posX");
|
||||
String posY = positionsJson.getString("posY");
|
||||
String pageNo = positionsJson.getString("pageNo");
|
||||
|
||||
JSONArray signDateInfos = new JSONArray();
|
||||
|
||||
|
||||
if(positionsJson.containsKey("templateSignTimeInfos")){
|
||||
if(!"[]".equals(positionsJson.getString("templateSignTimeInfos").trim())){
|
||||
JSONArray templateSignTimeInfosArray = positionsJson.getJSONArray("templateSignTimeInfos");
|
||||
for(int n=0;n<templateSignTimeInfosArray.size();n++){
|
||||
JSONObject templateSignTimeInfosJson = templateSignTimeInfosArray.getJSONObject(n);
|
||||
JSONObject signDateInfo = new JSONObject();
|
||||
signDateInfo.put("dateFormat",templateSignTimeInfosJson.getString("dateFormat"));
|
||||
signDateInfo.put("fontSize",templateSignTimeInfosJson.getString("fontSize"));
|
||||
signDateInfo.put("posPage",templateSignTimeInfosJson.getString("posPage"));
|
||||
signDateInfo.put("posX",templateSignTimeInfosJson.getString("posX"));
|
||||
signDateInfo.put("posY",templateSignTimeInfosJson.getString("posY"));
|
||||
signDateInfos.add(signDateInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONObject signPo = new JSONObject();
|
||||
signPo.put("addSignTime",addSignTime);
|
||||
signPo.put("edgePosition",1);
|
||||
signPo.put("edgeScope",0);
|
||||
signPo.put("posX",posX);
|
||||
signPo.put("posY",posY);
|
||||
signPo.put("posPage",pageNo);
|
||||
signPo.put("signDateInfos",signDateInfos);
|
||||
|
||||
signPo.put("sealId",sealId);
|
||||
signPo.put("signIdentity","ORGANIZE");
|
||||
signPo.put("signType",2);
|
||||
signPos.add(signPo);
|
||||
}
|
||||
|
||||
|
||||
partyA.put("signPos",signPos);
|
||||
partyA.put("docFilekey",docFilekey);
|
||||
}else if("乙方".equals(flowName)){
|
||||
JSONObject predefineJson = templateFlowJson.getJSONObject("predefine");
|
||||
boolean addSignTime = predefineJson.getBoolean("addSignTime");
|
||||
JSONArray positionsArray = predefineJson.getJSONArray("positions");
|
||||
System.out.println("positionsArray:"+positionsArray);
|
||||
|
||||
JSONArray signPos = new JSONArray();
|
||||
|
||||
for(int k=0;k<positionsArray.size();k++){
|
||||
JSONObject positionsJson = positionsArray.getJSONObject(k);
|
||||
String posX = positionsJson.getString("posX");
|
||||
String posY = positionsJson.getString("posY");
|
||||
String pageNo = positionsJson.getString("pageNo");
|
||||
|
||||
JSONArray signDateInfos = new JSONArray();
|
||||
if(positionsJson.containsKey("templateSignTimeInfos")){
|
||||
if(!"[]".equals(positionsJson.getString("templateSignTimeInfos").trim())){
|
||||
JSONArray templateSignTimeInfosArray = positionsJson.getJSONArray("templateSignTimeInfos");
|
||||
for(int n=0;n<templateSignTimeInfosArray.size();n++){
|
||||
JSONObject templateSignTimeInfosJson = templateSignTimeInfosArray.getJSONObject(n);
|
||||
JSONObject signDateInfo = new JSONObject();
|
||||
signDateInfo.put("dateFormat",templateSignTimeInfosJson.getString("dateFormat"));
|
||||
signDateInfo.put("fontSize",templateSignTimeInfosJson.getString("fontSize"));
|
||||
signDateInfo.put("posPage",templateSignTimeInfosJson.getString("posPage"));
|
||||
signDateInfo.put("posX",templateSignTimeInfosJson.getString("posX"));
|
||||
signDateInfo.put("posY",templateSignTimeInfosJson.getString("posY"));
|
||||
signDateInfos.add(signDateInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSONObject signPo = new JSONObject();
|
||||
signPo.put("addSignTime",addSignTime);
|
||||
signPo.put("edgePosition",1);
|
||||
signPo.put("edgeScope",0);
|
||||
signPo.put("posX",posX);
|
||||
signPo.put("posY",posY);
|
||||
signPo.put("posPage",pageNo);
|
||||
if(signDateInfos.size() > 0){
|
||||
signPo.put("signDateInfos",signDateInfos);
|
||||
}
|
||||
signPo.put("signIdentity","PERSON");
|
||||
signPo.put("sealType","0");
|
||||
signPo.put("signType",2);
|
||||
|
||||
signPos.add(signPo);
|
||||
}
|
||||
partyB.put("signPos",signPos);
|
||||
partyB.put("docFilekey",docFilekey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray signDocPartyA = new JSONArray();
|
||||
signDocPartyA.add(partyA);
|
||||
JSONArray signDocPartyB = new JSONArray();
|
||||
signDocPartyB.add(partyB);
|
||||
|
||||
detailJson.put("partyA",signDocPartyA);
|
||||
detailJson.put("partyB",signDocPartyB);
|
||||
return detailJson;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param xTimevaleSignature
|
||||
* @return
|
||||
*/
|
||||
public String doPostHttp(String xTimevaleSignature,String bodyData){
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
|
||||
RequestBody body = RequestBody.create(mediaType,bodyData);
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.eSignHost+Constants.getTemplateInfoUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("x-timevale-project-id", Constants.xTimevaleProjectId)
|
||||
.addHeader("x-timevale-signature", xTimevaleSignature)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
bodyData = response.body().string();
|
||||
log.error("code:{}",code);
|
||||
log.error("bodyData:{}",bodyData);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param bodyData
|
||||
* @return
|
||||
*/
|
||||
public String encryptionHmacSHA256(String bodyData){
|
||||
String encryptionData = "";
|
||||
// String secretKey = "7f067a08f5c675137e6e72aa298e2c07";
|
||||
// 要签名的数据
|
||||
// JSONObject dataObject = new JSONObject();
|
||||
// dataObject.put("templateId","JMHT-ZXSJ");
|
||||
// String data = "{\"templateId\":\"JMHT-ZXSJ\"}" ;
|
||||
try {
|
||||
// 初始化Mac对象
|
||||
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(Constants.secretKey.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
|
||||
sha256Hmac.init(secretKeySpec);
|
||||
byte[] result = sha256Hmac.doFinal(bodyData.getBytes(StandardCharsets.UTF_8));
|
||||
encryptionData = Hex.encodeHexString(result);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}catch (InvalidKeyException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encryptionData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public JSONObject getTemplateFormData4Orgainze(String templateId,String sealId,String docFilekey){
|
||||
|
||||
JSONObject detailJson = new JSONObject();
|
||||
|
||||
JSONObject partyA = new JSONObject();
|
||||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("templateId", templateId);
|
||||
|
||||
String xTimevaleSignature = encryptionHmacSHA256(bodyJson.toJSONString());
|
||||
log.error("xTimevaleSignature:"+xTimevaleSignature);
|
||||
String msg = doPostHttp(xTimevaleSignature,bodyJson.toJSONString());
|
||||
log.error("msg:"+msg);
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||
if(msgJson.containsKey("errCode")){
|
||||
String errCode = msgJson.getString("errCode");
|
||||
if("0".equals(errCode)){
|
||||
if(msgJson.containsKey("data")){
|
||||
JSONObject dataJson = msgJson.getJSONObject("data");
|
||||
if(dataJson.containsKey("template")){
|
||||
JSONObject templateJson = dataJson.getJSONObject("template");
|
||||
if(templateJson.containsKey("templateFlows")){
|
||||
JSONArray templateFlows = templateJson.getJSONArray("templateFlows");
|
||||
log.error("templateFlows:{}",templateFlows);
|
||||
for(int i=0;i<templateFlows.size();i++){
|
||||
JSONObject templateFlowJson = templateFlows.getJSONObject(i);
|
||||
if(templateFlowJson.containsKey("flowName")){
|
||||
String flowName = templateFlowJson.getString("flowName");
|
||||
log.error("flowName:{}",flowName);
|
||||
if("公司盖章处".equals(flowName)){
|
||||
|
||||
JSONObject predefineJson = templateFlowJson.getJSONObject("predefine");
|
||||
boolean addSignTime = predefineJson.getBoolean("addSignTime");
|
||||
JSONArray positionsArray = predefineJson.getJSONArray("positions");
|
||||
log.error("positionsArray:{}",positionsArray.size());
|
||||
JSONArray signPos = new JSONArray();
|
||||
|
||||
for(int k=0;k<positionsArray.size();k++){
|
||||
JSONObject positionsJson = positionsArray.getJSONObject(k);
|
||||
String posX = positionsJson.getString("posX");
|
||||
String posY = positionsJson.getString("posY");
|
||||
String pageNo = positionsJson.getString("pageNo");
|
||||
log.error("posX:{}",posX);
|
||||
log.error("posY:{}",posY);
|
||||
log.error("pageNo:{}",pageNo);
|
||||
|
||||
JSONArray signDateInfos = new JSONArray();
|
||||
if(positionsJson.containsKey("templateSignTimeInfos")){
|
||||
if(!"[]".equals(positionsJson.getString("templateSignTimeInfos").trim())){
|
||||
JSONArray templateSignTimeInfosArray = positionsJson.getJSONArray("templateSignTimeInfos");
|
||||
for(int n=0;n<templateSignTimeInfosArray.size();n++){
|
||||
JSONObject templateSignTimeInfosJson = templateSignTimeInfosArray.getJSONObject(n);
|
||||
JSONObject signDateInfo = new JSONObject();
|
||||
signDateInfo.put("dateFormat",templateSignTimeInfosJson.getString("dateFormat"));
|
||||
signDateInfo.put("fontSize",templateSignTimeInfosJson.getString("fontSize"));
|
||||
signDateInfo.put("posPage",templateSignTimeInfosJson.getString("posPage"));
|
||||
signDateInfo.put("posX",templateSignTimeInfosJson.getString("posX"));
|
||||
signDateInfo.put("posY",templateSignTimeInfosJson.getString("posY"));
|
||||
signDateInfos.add(signDateInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.error("signDateInfos:{}",signDateInfos.size());
|
||||
JSONObject signPo = new JSONObject();
|
||||
signPo.put("addSignTime",addSignTime);
|
||||
signPo.put("edgePosition",1);
|
||||
signPo.put("edgeScope",0);
|
||||
signPo.put("posX",posX);
|
||||
signPo.put("posY",posY);
|
||||
signPo.put("posPage",pageNo);
|
||||
if(signDateInfos.size()>0){
|
||||
signPo.put("signDateInfos",signDateInfos);
|
||||
}
|
||||
|
||||
signPo.put("sealId",sealId);
|
||||
signPo.put("signIdentity","ORGANIZE");
|
||||
signPo.put("signType",1);
|
||||
signPos.add(signPo);
|
||||
}
|
||||
|
||||
partyA.put("signPos",signPos);
|
||||
log.error("docFilekey:{}",docFilekey);
|
||||
partyA.put("docFilekey",docFilekey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray signDocPartyA = new JSONArray();
|
||||
signDocPartyA.add(partyA);
|
||||
detailJson.put("partyA",signDocPartyA);
|
||||
return detailJson;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ public class Constants {
|
|||
|
||||
public static String HrmHost = "https://hrtest.chabaidao.com";
|
||||
|
||||
public static String updateMode = "REPLACE";
|
||||
public static String updateMode = "UPDATE";
|
||||
|
||||
public static String createTimeoffUrl = "/open-apis/calendar/v4/timeoff_events?user_id_type=open_id";
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.cost.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.cost.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class HrmQueryOpenIdDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmQueryOpenIdDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String queryHrmOpenId(String employeeId){
|
||||
String groupId = "weaver-workflow-report-serviceworkflowreport";
|
||||
String sourceType = "LOGIC";
|
||||
String openId = "";
|
||||
try{
|
||||
String dataSql =" select u.open_id\n" +
|
||||
" from eb_hrm_user u\n" +
|
||||
" inner join eteams.employee e on e.mobile = u.mobile \n" +
|
||||
" where e.delete_type = 0\n" +
|
||||
" and u.delete_type = 0\n" +
|
||||
" and e.id =? and u.tenant_key = ? and e.tenant_key = ? " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(employeeId);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
if(recordList.size() > 0){
|
||||
openId = String.valueOf(recordList.get(0).get("open_id"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return openId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.dao;
|
||||
|
||||
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||
import com.weaver.seconddev.chapanda.cost.constant.Constants;
|
||||
import com.weaver.seconddev.chapanda.cost.util.DatabaseUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class HrmUserAvatarDao {
|
||||
|
||||
private final static Logger log = LoggerFactory.getLogger(HrmUserAvatarDao.class);
|
||||
|
||||
@Autowired
|
||||
private DatabaseUtils databaseUtils;
|
||||
|
||||
/***
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> queryHrmAvatarList(){
|
||||
String groupId = "weaver-workflow-report-serviceworkflowreport";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select u.open_id,u.user_id,e.id,a.p1,a.p2,a.p3 " +
|
||||
" from eb_hrm_user u\n" +
|
||||
" left join eteams.employee e on e.mobile = u.mobile \n" +
|
||||
" inner join eteams.avatar a on a.id = e.avatar \n" +
|
||||
" where e.delete_type = 0\n" +
|
||||
" and u.delete_type = 0 and u.tenant_key = ? and e.tenant_key = ? and a.tenant_key = ? \n" +
|
||||
" and a.p1 is not null " ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> queryHrmAvatarByDate(int days){
|
||||
String groupId = "weaver-workflow-report-serviceworkflowreport";
|
||||
String sourceType = "LOGIC";
|
||||
List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
|
||||
try{
|
||||
String dataSql =" select a.id,e.username,u.open_id ,u.user_id,e.id,a.P1,a.P2 ,a.p3,e.MOBILE \n" +
|
||||
" from eb_hrm_user u\n" +
|
||||
" inner join eteams.employee e on e.MOBILE = u.mobile \n" +
|
||||
" inner join eteams.avatar a on a.id = e.avatar \n" +
|
||||
" inner join fileobj f on f.id = a.P1 \n" +
|
||||
" where e.delete_type = 0\n" +
|
||||
" and u.delete_type = 0\n" +
|
||||
" and a.p1 is not null and u.tenant_key = ? and e.tenant_key = ? and a.tenant_key = ? \n" +
|
||||
" and (\n" +
|
||||
" left(f.create_time,10) in(DATE_FORMAT(CURDATE(), '%Y-%m-%d'),DATE_FORMAT(CURDATE()-1, '%Y-%m-%d'))\n" +
|
||||
" or left(f.UPLOAD_TIME ,10) in(DATE_FORMAT(CURDATE(), '%Y-%m-%d'),DATE_FORMAT(CURDATE()-1, '%Y-%m-%d'))\n" +
|
||||
" )" ;
|
||||
|
||||
log.error("dataSql:" + dataSql);
|
||||
List<String> paramList = new ArrayList<>(100);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
paramList.add(Constants.TENANT_KEY);
|
||||
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||
recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:{}",recordList.size());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("e:" + e);
|
||||
}
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ public class WorkflowDegreeLevelDao {
|
|||
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||
log.error("recordList:"+recordList.size());
|
||||
if(!recordList.isEmpty()){
|
||||
employeeId = Long.parseLong(String.valueOf(recordList.get(0).get("id")));
|
||||
employeeId = Long.valueOf(String.valueOf(recordList.get(0).get("id")));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ public class Esb2FeishuBotCreateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
if("0".equals(msgType)){
|
||||
String senderMobile ="";
|
||||
if(StringUtils.isNotBlank(senderid)){
|
||||
Long sender_id = Long.parseLong(senderid);
|
||||
Long sender_id = Long.valueOf(senderid);
|
||||
SimpleEmployee senderEmployee = hrmCommonUtil.getSimpleEmployee(sender_id);
|
||||
senderMobile = senderEmployee.getMobile();
|
||||
}
|
||||
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
Long creator_id = Long.valueOf(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ public class Esb2FeishuBotCreateTodoAction implements EsbServerlessRpcRemoteInte
|
|||
|
||||
String operator_open_id = "";
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
Long userid = Long.valueOf(operatorid);
|
||||
log.error("userid:{}",userid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class Esb2FeishuCalendarsEventsAction implements EsbServerlessRpcRemoteIn
|
|||
|
||||
String mobile = "";
|
||||
if(StringUtils.isNotBlank(employee_id)){
|
||||
Long employeeId = Long.parseLong(employee_id);
|
||||
Long employeeId = Long.valueOf(employee_id);
|
||||
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(employeeId);
|
||||
mobile = simpleEmployee.getMobile();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class Esb2FeishuCreateCalendarsTimeoffAction implements EsbServerlessRpcR
|
|||
|
||||
String mobile = "";
|
||||
if(StringUtils.isNotBlank(employee_id)){
|
||||
Long employeeId = Long.parseLong(employee_id);
|
||||
Long employeeId = Long.valueOf(employee_id);
|
||||
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(employeeId);
|
||||
mobile = simpleEmployee.getMobile();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.esb;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.feishu.dao.HrmQueryOpenIdDao;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuHrmAvatarUtil;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuHrmAvatarAction")
|
||||
public class Esb2FeishuHrmAvatarAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2FeishuHrmAvatarAction.class);
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuHrmAvatarUtil esb2FeishuHrmAvatarUtil;
|
||||
|
||||
@Autowired
|
||||
HrmQueryOpenIdDao hrmQueryOpenIdDao;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
String employeeid = String.valueOf(params.get("employeeid"));
|
||||
Long avatar = Long.valueOf(String.valueOf(params.get("avatar")));
|
||||
if(StringUtils.isBlank(employeeid)){
|
||||
return WeaResult.fail(500,"获取人员信息失败");
|
||||
}
|
||||
if(StringUtils.isBlank(String.valueOf(avatar))){
|
||||
return WeaResult.fail(500,"获取人员头像信息失败");
|
||||
}
|
||||
String openId = hrmQueryOpenIdDao.queryHrmOpenId(employeeid);
|
||||
if(StringUtils.isBlank(openId)){
|
||||
return WeaResult.fail(500,"获取人员飞书信息失败");
|
||||
}
|
||||
|
||||
Map<String,Object> avatarMap = esb2FeishuHrmAvatarUtil.syncHrmAvatarByEmployee(openId,avatar);
|
||||
String avatarOrigin = String.valueOf(avatarMap.get("avatarOrigin"));
|
||||
String avatarKey = String.valueOf(avatarMap.get("avatarKey"));
|
||||
if(StringUtils.isBlank(avatarOrigin)){
|
||||
return WeaResult.fail(500,"更新飞书头像异常");
|
||||
}
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
actionMap.put("msg","成功");
|
||||
actionMap.put("avatarOrigin",avatarOrigin);
|
||||
actionMap.put("avatarKey",avatarKey);
|
||||
return WeaResult.success(actionMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.weaver.seconddev.chapanda.feishu.esb;
|
|||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.feishu.dao.HrmUserAvatarDao;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuProfilePictureUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuHrmAvatarDateCron")
|
||||
|
|
@ -18,11 +20,14 @@ public class Esb2FeishuHrmAvatarDateCron implements EsbServerlessRpcRemoteInterf
|
|||
@Autowired
|
||||
Esb2FeishuProfilePictureUtil esb2FeishuProfilePictureUtil;
|
||||
|
||||
@Autowired
|
||||
HrmUserAvatarDao hrmUserAvatarDao;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
Map<String, Object> dataMap = esb2FeishuProfilePictureUtil.syncHrmAvatarByDate();
|
||||
int days = 2;
|
||||
List<Map<String,Object>> avatarList = hrmUserAvatarDao.queryHrmAvatarByDate(days);
|
||||
Map<String, Object> dataMap = esb2FeishuProfilePictureUtil.syncHrmAvatarByAvatarList(avatarList);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.weaver.seconddev.chapanda.feishu.esb;
|
|||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.chapanda.feishu.dao.HrmUserAvatarDao;
|
||||
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuProfilePictureUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("Esb2FeishuHrmAvatarFullCron")
|
||||
|
|
@ -18,10 +20,13 @@ public class Esb2FeishuHrmAvatarFullCron implements EsbServerlessRpcRemoteInterf
|
|||
@Autowired
|
||||
Esb2FeishuProfilePictureUtil esb2FeishuProfilePictureUtil;
|
||||
|
||||
@Autowired
|
||||
HrmUserAvatarDao hrmUserAvatarDao;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
|
||||
Map<String, Object> dataMap = esb2FeishuProfilePictureUtil.syncHrmAvatarByFull();
|
||||
List<Map<String,Object>> avatarList = hrmUserAvatarDao.queryHrmAvatarList();
|
||||
Map<String, Object> dataMap = esb2FeishuProfilePictureUtil.syncHrmAvatarByAvatarList(avatarList);
|
||||
|
||||
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||
actionMap.put("code",200);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class Esb2FeishuSendDeleteAction implements EsbServerlessRpcRemoteInterfa
|
|||
String creatorname = "";
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
Long creator_id = Long.valueOf(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
|
|
@ -100,7 +100,7 @@ public class Esb2FeishuSendDeleteAction implements EsbServerlessRpcRemoteInterfa
|
|||
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
Long userid = Long.valueOf(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
|
||||
String userMobile = userEmployee.getMobile();
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class Esb2FeishuSendDoneAction implements EsbServerlessRpcRemoteInterface
|
|||
String status = "APPROVED";
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
Long creator_id = Long.valueOf(creatorid);
|
||||
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ public class Esb2FeishuSendDoneAction implements EsbServerlessRpcRemoteInterface
|
|||
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
Long userid = Long.valueOf(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("操作者:{}",userEmployee.getUsername());
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ public class Esb2FeishuSendFinishAction implements EsbServerlessRpcRemoteInterfa
|
|||
log.error("msgType:{}",msgType);
|
||||
|
||||
String cid = String.valueOf(params.get("cid"));
|
||||
log.error("bot:requestid:{},nodeid:{},operatorid:{},cid{},msgType:{},todo",requestid,nodeId,operatorid,cid,msgType);
|
||||
log.error("bot:requestid:{},nodeid:{},operatorid:{},cid{},msgType:{},fininsh",requestid,nodeId,operatorid,cid,msgType);
|
||||
|
||||
String code = "";
|
||||
if("5".equals(msgType)){
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
Long creator_id = Long.valueOf(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
|
|
@ -95,7 +95,7 @@ public class Esb2FeishuSendFinishAction implements EsbServerlessRpcRemoteInterfa
|
|||
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
Long userid = Long.valueOf(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("userMobile:{}",userMobile);
|
||||
|
|
@ -108,7 +108,7 @@ public class Esb2FeishuSendFinishAction implements EsbServerlessRpcRemoteInterfa
|
|||
log.error("operator_open_id:{}",operator_open_id);
|
||||
if(StringUtils.isNotBlank(create_open_id)){
|
||||
if(StringUtils.isNotBlank(operator_open_id)){
|
||||
String status = "TERMINATED";
|
||||
String status = "APPROVED";
|
||||
code = esb2FeishuSendFinishUtil.senTodoMessage(
|
||||
requestid,requestName,requestmark,
|
||||
creatorname,createTime,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class Esb2FeishuSendMessageCardAction implements EsbServerlessRpcRemoteIn
|
|||
}
|
||||
|
||||
if(StringUtils.isBlank(receiveId)){
|
||||
return WeaResult.fail(500,"receiveId is null");
|
||||
return WeaResult.fail(500,"1. is null");
|
||||
}
|
||||
|
||||
String openId = hrmQueryOpenIdDao.queryHrmOpenId(receiveId);
|
||||
|
|
@ -58,7 +58,7 @@ public class Esb2FeishuSendMessageCardAction implements EsbServerlessRpcRemoteIn
|
|||
return WeaResult.fail(500,"openId is null");
|
||||
}
|
||||
|
||||
Map<String, Object> dataMap = esb2FeishuSendMessageUtil.senCardMessage(openId,params);
|
||||
Map<String, Object> dataMap = esb2FeishuSendMessageUtil.senCardMessage(templateId,templateVersionName,openId,params);
|
||||
String chat_id = (String) dataMap.get("chat_id");
|
||||
String message_id = (String) dataMap.get("message_id");
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class Esb2FeishuSendTodoAction implements EsbServerlessRpcRemoteInterface
|
|||
|
||||
String creatorMobile = "";
|
||||
if(StringUtils.isNotBlank(creatorid)){
|
||||
Long creator_id = Long.parseLong(creatorid);
|
||||
Long creator_id = Long.valueOf(creatorid);
|
||||
SimpleEmployee creatorEmployee = hrmCommonUtil.getSimpleEmployee(creator_id);
|
||||
creatorMobile = creatorEmployee.getMobile();
|
||||
creatorname = creatorEmployee.getUsername();
|
||||
|
|
@ -103,7 +103,7 @@ public class Esb2FeishuSendTodoAction implements EsbServerlessRpcRemoteInterface
|
|||
|
||||
String operator_open_id = "" ;
|
||||
if(StringUtils.isNotBlank(operatorid)){
|
||||
Long userid = Long.parseLong(operatorid);
|
||||
Long userid = Long.valueOf(operatorid);
|
||||
SimpleEmployee userEmployee = hrmCommonUtil.getSimpleEmployee(userid);
|
||||
String userMobile = userEmployee.getMobile();
|
||||
log.error("操作人:{}",userEmployee.getUsername());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,101 @@
|
|||
package com.weaver.seconddev.chapanda.feishu.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.seconddev.chapanda.feishu.constant.Constants;
|
||||
import okhttp3.*;
|
||||
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.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
public class Esb2FeishuHrmAvatarUtil {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2FeishuHrmAvatarUtil.class);
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuUploadImageUtil esb2FeishuUploadImageUtil;
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuTokenUtil esb2FeishuTokenUtil;
|
||||
|
||||
public Map<String, Object> syncHrmAvatarByEmployee(String open_id,Long avatar ) {
|
||||
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
String avatarKey = esb2FeishuUploadImageUtil.uploadImage(avatar);
|
||||
|
||||
log.error("avatarKeyr:{}",avatarKey);
|
||||
|
||||
String avatar_origin = "";
|
||||
if(StringUtils.isNotBlank(avatarKey)){
|
||||
String token = esb2FeishuTokenUtil.getToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
String message = doHttpPostByToken(avatarKey,open_id,token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("user")){
|
||||
JSONObject userJson = dataJson.getJSONObject("user");
|
||||
log.error("userJson:{}",userJson.toJSONString());
|
||||
if(userJson.containsKey("avatar")){
|
||||
JSONObject avatarJson = userJson.getJSONObject("avatar");
|
||||
if(avatarJson.containsKey("avatar_origin")){
|
||||
avatar_origin = avatarJson.getString("avatar_origin");
|
||||
log.error("avatar_origin:{}",avatar_origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dataMap.put("avatarOrigin",avatar_origin);
|
||||
dataMap.put("avatarKey",avatarKey);
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public String doHttpPostByToken(String avatar_key,String open_id,String token){
|
||||
String msg = "";
|
||||
log.error("avatar_key:{}",avatar_key);
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
JSONObject bodyData = new JSONObject();
|
||||
bodyData.put("avatar_key",avatar_key);
|
||||
RequestBody body = RequestBody.create(mediaType, bodyData.toJSONString());
|
||||
log.error("update-avatar:{}",bodyData.toJSONString());
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.feishuHost+Constants.profileUrl+"/"+open_id+"?user_id_type=open_id")
|
||||
.method("PATCH", body)
|
||||
.addHeader("Authorization", "Bearer "+token)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
log.error("code:{}",code);
|
||||
msg = response.body().string();
|
||||
log.error("msg:"+msg);
|
||||
} catch (IOException e) {
|
||||
log.error("e:"+e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -124,9 +124,9 @@ public class Esb2FeishuProfilePictureUtil {
|
|||
}
|
||||
|
||||
|
||||
public Map<String, Object> syncHrmAvatarByDate() {
|
||||
public Map<String, Object> syncHrmAvatarByDate(int days) {
|
||||
|
||||
List<Map<String,Object>> avatarList = hrmUserAvatarDao.queryHrmAvatarByDate();
|
||||
List<Map<String,Object>> avatarList = hrmUserAvatarDao.queryHrmAvatarByDate(days);
|
||||
log.error("avatarList:{}",avatarList.size());
|
||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||
int successTotal = 0;
|
||||
|
|
@ -182,4 +182,61 @@ public class Esb2FeishuProfilePictureUtil {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public Map<String, Object> syncHrmAvatarByAvatarList(List<Map<String,Object>> avatarList) {
|
||||
|
||||
log.error("avatarList:{}",avatarList.size());
|
||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||
int successTotal = 0;
|
||||
for(int i=0;i<avatarList.size();i++){
|
||||
|
||||
Map<String,Object> avatarMap = avatarList.get(i);
|
||||
String open_id = String.valueOf(avatarMap.get("open_id"));
|
||||
String user_id = String.valueOf(avatarMap.get("user_id"));
|
||||
Long p1 = Long.valueOf(String.valueOf(avatarMap.get("p1")));
|
||||
Long p2 = Long.valueOf(String.valueOf(avatarMap.get("p2")));
|
||||
Long p3 = Long.valueOf(String.valueOf(avatarMap.get("p3")));
|
||||
log.error("p1:{}",p1);
|
||||
log.error("p2:{}",p2);
|
||||
log.error("open_id:{}",open_id);
|
||||
|
||||
String avatarKey = "";
|
||||
if(p1 > 0){
|
||||
avatarKey = esb2FeishuUploadImageUtil.uploadImage(p1);
|
||||
}else if(p2 > 0){
|
||||
avatarKey = esb2FeishuUploadImageUtil.uploadImage(p2);
|
||||
}else if(p3 > 0){
|
||||
avatarKey = esb2FeishuUploadImageUtil.uploadImage(p3);
|
||||
}
|
||||
|
||||
log.error("avatarKeyr:{}",avatarKey);
|
||||
|
||||
if(StringUtils.isNotBlank(avatarKey)){
|
||||
String token = esb2FeishuTokenUtil.getToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
String message = doHttpPostByToken(avatarKey,open_id,token);
|
||||
if(StringUtils.isNotBlank(message)){
|
||||
JSONObject returnData = JSONObject.parseObject(message);
|
||||
if(returnData.containsKey("code")){
|
||||
String code = returnData.getString("code");
|
||||
if("0".equals(code)){
|
||||
successTotal++;
|
||||
JSONObject dataJson = returnData.getJSONObject("data");
|
||||
if(dataJson.containsKey("user")){
|
||||
JSONObject userJson = dataJson.getJSONObject("user");
|
||||
log.error("userJson:{}",userJson.toJSONString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageMap.put("total",avatarList.size());
|
||||
messageMap.put("success",successTotal);
|
||||
return messageMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,10 @@ public class Esb2FeishuSendDeleteUtil {
|
|||
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id+"_"+cid);
|
||||
|
||||
// "weaver_"+requestid+"_"+task_open_id+"_"+cid
|
||||
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ public class Esb2FeishuSendDoneUtil {
|
|||
JSONArray taskListArray = new JSONArray();
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
|
||||
// "weaver_"+requestid+"_"+task_open_id+"_"+cid
|
||||
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
|
|
|
|||
|
|
@ -203,7 +203,8 @@ public class Esb2FeishuSendFinishUtil {
|
|||
JSONArray taskListArray = new JSONArray();
|
||||
log.error("task_open_id:"+task_open_id);
|
||||
JSONObject taskListJson = new JSONObject();
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+task_open_id+"_"+cid);
|
||||
// "weaver_"+requestid+"_"+task_open_id+"_"+cid
|
||||
taskListJson.put("task_id","weaver_"+requestid+"_"+cid);
|
||||
taskListJson.put("open_id",task_open_id);
|
||||
taskListJson.put("title","@i18n@title");
|
||||
taskListJson.put("links",linksJson);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@ public class Esb2FeishuSendMessageUtil{
|
|||
@Autowired
|
||||
private Esb2FeishuTokenUtil esb2FeishuTokenUtil;
|
||||
|
||||
public Map<String, Object> senCardMessage(String openId, Map<String,Object> paraMap) {
|
||||
public Map<String, Object> senCardMessage(String template_id,String template_version_name,String openId, Map<String,Object> paraMap) {
|
||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||
|
||||
|
||||
List<String> defaultList = new ArrayList<String>();
|
||||
defaultList.add("templateId");
|
||||
defaultList.add("templateVersionName");
|
||||
|
|
@ -50,13 +51,9 @@ public class Esb2FeishuSendMessageUtil{
|
|||
// templateVariable.put("current_date,",sdf.format(new Date()));
|
||||
|
||||
JSONObject data_Json = new JSONObject();
|
||||
for(String key : defaultList){
|
||||
String value = paraMap.get(key).toString();
|
||||
data_Json.put(key,value);
|
||||
}
|
||||
// data_Json.put("template_id",template_id);
|
||||
// data_Json.put("template_version_name",template_version_name);
|
||||
// data_Json.put("template_variable",templateVariable.toJSONString());
|
||||
data_Json.put("template_id",template_id);
|
||||
data_Json.put("template_version_name",template_version_name);
|
||||
data_Json.put("template_variable",templateVariable);
|
||||
|
||||
JSONObject contentJson = new JSONObject();
|
||||
contentJson.put("type","template");
|
||||
|
|
|
|||
|
|
@ -28,10 +28,13 @@ public class Esb2FeishuUploadImageUtil {
|
|||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
|
||||
@Autowired
|
||||
Esb2FeishuTokenUtil esb2FeishuTokenUtil;
|
||||
|
||||
public String uploadImage(Long pvalue) {
|
||||
log.error("esb2feishuuploadimageutil start");
|
||||
String imageKey = "";
|
||||
String token = getToken2();
|
||||
String token = esb2FeishuTokenUtil.getToken();
|
||||
log.error("token:"+token);
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
InputStream fileInputStream = null;
|
||||
|
|
@ -74,73 +77,73 @@ public class Esb2FeishuUploadImageUtil {
|
|||
}
|
||||
|
||||
|
||||
public String getToken2() {
|
||||
String token = "";
|
||||
JSONObject returnData = getAccessToken();
|
||||
if(returnData.containsKey("tenantAccessToken")){
|
||||
token = returnData.getString("tenantAccessToken");
|
||||
}
|
||||
System.out.println("token:"+token);
|
||||
return token;
|
||||
}
|
||||
// public String getToken2() {
|
||||
// String token = "";
|
||||
// JSONObject returnData = getAccessToken();
|
||||
// if(returnData.containsKey("tenantAccessToken")){
|
||||
// token = returnData.getString("tenantAccessToken");
|
||||
// }
|
||||
// System.out.println("token:"+token);
|
||||
// return token;
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getAccessToken() {
|
||||
|
||||
JSONObject returnData = new JSONObject();
|
||||
JSONObject dataJson = new JSONObject();
|
||||
dataJson.put("app_id", Constants.app_id);
|
||||
dataJson.put("app_secret", Constants.app_secret);
|
||||
|
||||
log.error("dataJson:{}",dataJson.toJSONString());
|
||||
// dataJson.put("app_id", "cli_a8d0ee6b667dd00e");
|
||||
// dataJson.put("app_secret", "UjShC4eY7vCgHsQvFWZZleVdCqSEWGD0");
|
||||
|
||||
try {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
|
||||
RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString());
|
||||
Request request = new Request.Builder()
|
||||
.url(Constants.feishuHost+Constants.tokenUrl)
|
||||
.method("POST", body)
|
||||
.addHeader("Content-Type", "application/json; charset=utf-8")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
int code = response.code();
|
||||
String msg = response.body().string();
|
||||
|
||||
log.error("code:{}",code);
|
||||
log.error("msg:{}",msg);
|
||||
|
||||
if(code == 200){
|
||||
if(StringUtils.isNotBlank(msg)){
|
||||
JSONObject returnJson = JSONObject.parseObject(msg);
|
||||
if(returnJson.containsKey("code")){
|
||||
String dataCode = returnJson.getString("code");
|
||||
if("0".equals(dataCode)){
|
||||
String tenantAccessToken = returnJson.getString("tenant_access_token");
|
||||
int expire = returnJson.getInteger("expire");
|
||||
|
||||
log.error("tenantAccessToken:{}",tenantAccessToken);
|
||||
log.error("expire:{}",expire);
|
||||
|
||||
returnData.put("tenantAccessToken",tenantAccessToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.error("msg:{}",msg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("msg:{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
// public JSONObject getAccessToken() {
|
||||
//
|
||||
// JSONObject returnData = new JSONObject();
|
||||
// JSONObject dataJson = new JSONObject();
|
||||
// dataJson.put("app_id", Constants.app_id);
|
||||
// dataJson.put("app_secret", Constants.app_secret);
|
||||
//
|
||||
// log.error("dataJson:{}",dataJson.toJSONString());
|
||||
//// dataJson.put("app_id", "cli_a8d0ee6b667dd00e");
|
||||
//// dataJson.put("app_secret", "UjShC4eY7vCgHsQvFWZZleVdCqSEWGD0");
|
||||
//
|
||||
// try {
|
||||
// OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
// .build();
|
||||
// MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
|
||||
// RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString());
|
||||
// Request request = new Request.Builder()
|
||||
// .url(Constants.feishuHost+Constants.tokenUrl)
|
||||
// .method("POST", body)
|
||||
// .addHeader("Content-Type", "application/json; charset=utf-8")
|
||||
// .build();
|
||||
// Response response = client.newCall(request).execute();
|
||||
// int code = response.code();
|
||||
// String msg = response.body().string();
|
||||
//
|
||||
// log.error("code:{}",code);
|
||||
// log.error("msg:{}",msg);
|
||||
//
|
||||
// if(code == 200){
|
||||
// if(StringUtils.isNotBlank(msg)){
|
||||
// JSONObject returnJson = JSONObject.parseObject(msg);
|
||||
// if(returnJson.containsKey("code")){
|
||||
// String dataCode = returnJson.getString("code");
|
||||
// if("0".equals(dataCode)){
|
||||
// String tenantAccessToken = returnJson.getString("tenant_access_token");
|
||||
// int expire = returnJson.getInteger("expire");
|
||||
//
|
||||
// log.error("tenantAccessToken:{}",tenantAccessToken);
|
||||
// log.error("expire:{}",expire);
|
||||
//
|
||||
// returnData.put("tenantAccessToken",tenantAccessToken);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// log.error("msg:{}",msg);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("msg:{}",e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return returnData;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ public class Esb2QunjieCreateSealApplyAction implements EsbServerlessRpcRemoteIn
|
|||
|
||||
int applyCountInt = 0;
|
||||
if(StringUtils.isNotBlank(applyCount)){
|
||||
applyCountInt = Integer.parseInt(applyCount);
|
||||
applyCountInt = Integer.valueOf(applyCount);
|
||||
}
|
||||
int applyCrossPageSealCountInt = 0;
|
||||
if(StringUtils.isNotBlank(applyCrossPageSealCount)){
|
||||
applyCrossPageSealCountInt = Integer.parseInt(applyCrossPageSealCount);
|
||||
applyCrossPageSealCountInt = Integer.valueOf(applyCrossPageSealCount);
|
||||
}
|
||||
if(applyCountInt <=0 && applyCrossPageSealCountInt <=0){
|
||||
return WeaResult.fail(500,"用印次数和骑缝章次数不能同时小等于0");
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 经济补偿
|
||||
*/
|
||||
|
||||
@Service("Esb2QunjieEconomicCompensationAction")
|
||||
public class Esb2QunjieEconomicCompensationAction implements EsbServerlessRpcRemoteInterface {
|
||||
private final static Logger log = LoggerFactory.getLogger(Esb2QunjieEconomicCompensationAction.class);
|
||||
|
|
@ -73,15 +78,19 @@ public class Esb2QunjieEconomicCompensationAction implements EsbServerlessRpcRem
|
|||
|
||||
Map<String, Object> dataMap = esb2QunjieEconomicCompensationUtil.applySealRequest(requestid,requestName,fileids);
|
||||
|
||||
String status = String.valueOf(dataMap.get("status"));
|
||||
if(!"0".equals(status)){
|
||||
String data = String.valueOf(dataMap.get("data"));
|
||||
return WeaResult.fail(500,data);
|
||||
}
|
||||
String applyId = String.valueOf(dataMap.get("applyId"));
|
||||
String workflowBaseId = String.valueOf(dataMap.get("workflowBaseId"));
|
||||
String formId = String.valueOf(dataMap.get("formId"));
|
||||
String applyNo = String.valueOf(dataMap.get("applyNo"));
|
||||
String safeCode = String.valueOf(dataMap.get("safeCode"));
|
||||
String vrCode = String.valueOf(dataMap.get("vrCode"));
|
||||
String status = String.valueOf(dataMap.get("status"));
|
||||
|
||||
if(StringUtils.isBlank(safeCode)){
|
||||
if(StringUtils.isBlank(applyId)){
|
||||
return WeaResult.fail(500,"用印申请流程创建失败");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,19 +23,19 @@ public class Esb2QunjieFinshSealApplyAction implements EsbServerlessRpcRemoteInt
|
|||
log.error("Esb2QunjieFinshSealApplyAction start");
|
||||
|
||||
String applyId = (String) params.get("applyId");
|
||||
String sealId = (String) params.get("sealId");
|
||||
// String sealId = (String) params.get("sealId");
|
||||
log.error("applyId:{}",applyId);
|
||||
log.error("sealId:{}",sealId);
|
||||
// log.error("sealId:{}",sealId);
|
||||
|
||||
if(StringUtils.isBlank(applyId)){
|
||||
return WeaResult.fail(500,"用印申请流程获取失败");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(sealId)){
|
||||
return WeaResult.fail(500,"印章信息获取失败");
|
||||
}
|
||||
// if(StringUtils.isBlank(sealId)){
|
||||
// return WeaResult.fail(500,"印章信息获取失败");
|
||||
// }
|
||||
|
||||
String message = esb2QunjieFinshSealApplyUtil.finshApplyRquest(applyId,sealId);
|
||||
String message = esb2QunjieFinshSealApplyUtil.finshApplyRquest(applyId);
|
||||
if(StringUtils.isBlank(message)){
|
||||
return WeaResult.fail(500,"关闭授权失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ public class Esb2QunjieEconomicCompensationUtil {
|
|||
try {
|
||||
String[] fileidArray = fileids.split(",");
|
||||
for(int i=0;i<fileidArray.length;i++){
|
||||
Long fileid = Long.parseLong(fileidArray[i]);
|
||||
Long fileid = Long.valueOf(fileidArray[i]);
|
||||
FileData fileData = fileDownloadService.downloadFile(fileid);
|
||||
FileObj fileObj = fileData.getFileObj();
|
||||
String fileName = fileObj.getName();
|
||||
log.error("fileName:{}",fileName);
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
// String encodedFileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
inputStream = fileData.getInputStream();
|
||||
if (inputStream.available() > 0) {
|
||||
byte[] fileByte = convertInputStreamToBytes(inputStream);
|
||||
|
|
@ -242,7 +242,14 @@ public class Esb2QunjieEconomicCompensationUtil {
|
|||
messageMap.put("applyNo",applyNo);
|
||||
messageMap.put("safeCode",safeCode);
|
||||
messageMap.put("vrCode",vrCode);
|
||||
messageMap.put("status",applyStatus);
|
||||
messageMap.put("status",status);
|
||||
messageMap.put("applyStatus",applyStatus);
|
||||
}else{
|
||||
messageMap.put("status",status);
|
||||
String data =returnData.getString("data") ;
|
||||
log.error("data:{}",data);
|
||||
messageMap.put("data",data);
|
||||
messageMap.put("message",returnData.getString("message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,14 +8,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Component
|
||||
|
|
@ -25,7 +18,7 @@ public class Esb2QunjieFinshSealApplyUtil {
|
|||
@Autowired
|
||||
private Esb2QunjieTokenUtil esb2QunjieTokenUtil;
|
||||
|
||||
public String finshApplyRquest(String applyId,String sealId) {
|
||||
public String finshApplyRquest(String applyId) {
|
||||
log.error("senCardMessage start");
|
||||
String timestamp = "";
|
||||
String token = esb2QunjieTokenUtil.getAccessToken();
|
||||
|
|
@ -34,8 +27,8 @@ public class Esb2QunjieFinshSealApplyUtil {
|
|||
|
||||
JSONObject bodyJson = new JSONObject();
|
||||
bodyJson.put("applyId",applyId);
|
||||
String[] sealIdList = new String[]{sealId};
|
||||
bodyJson.put("sealIdList",sealIdList);
|
||||
// String[] sealIdList = new String[]{sealId};
|
||||
// bodyJson.put("sealIdList",sealIdList);
|
||||
|
||||
System.out.println("bodyJson:"+bodyJson.toJSONString());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue