#chabaodao-4# e签宝发起流程

This commit is contained in:
shilei 2025-08-05 09:47:22 +08:00
parent 9d16fd42d7
commit bbab8c7666
33 changed files with 1373 additions and 111 deletions

View File

@ -225,4 +225,35 @@ public class HrmAssessmentDao {
} }
return dataMap; 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;
}
} }

View File

@ -62,7 +62,6 @@ public class Esb2BeisenJobRequirementAction implements EsbServerlessRpcRemoteInt
String requestname = (String) params.get("requestname"); String requestname = (String) params.get("requestname");
String createDate = (String) params.get("createDate"); String createDate = (String) params.get("createDate");
int requirementCount = converInteger(params,"requirementCount") ; int requirementCount = converInteger(params,"requirementCount") ;
String arivalTime = (String) params.get("arivalTime"); String arivalTime = (String) params.get("arivalTime");

View File

@ -11,8 +11,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -21,7 +19,7 @@ public class Esb2BeisenOfferCronJob implements EsbServerlessRpcRemoteInterface {
private final static Logger log = LoggerFactory.getLogger(Esb2BeisenOfferCronJob.class); private final static Logger log = LoggerFactory.getLogger(Esb2BeisenOfferCronJob.class);
@Autowired @Autowired
Token2BeiSenUtil http2BenSenUtil ; Token2BeiSenUtil token2BeiSenUtil ;
@Autowired @Autowired
Offer2BeiSenUtil offer2BeiSenUtil; Offer2BeiSenUtil offer2BeiSenUtil;
@ -48,7 +46,7 @@ public class Esb2BeisenOfferCronJob implements EsbServerlessRpcRemoteInterface {
String endDate = String.valueOf(params.get("endDate")); String endDate = String.valueOf(params.get("endDate"));
String endTime = String.valueOf(params.get("endTime")); String endTime = String.valueOf(params.get("endTime"));
String token = http2BenSenUtil.getToken(); String token = token2BeiSenUtil.getToken();
log.error("token:{}",token); log.error("token:{}",token);
if(StringUtils.isNotBlank(token)){ if(StringUtils.isNotBlank(token)){

View File

@ -21,10 +21,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("Esb2BeisenPerformanceCronJobNew") @Service("Esb2BeisenPerformanceCronJobNew")
public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteInterface { 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)); log.error("ebList:{}", JSON.toJSONString(ebList));
@ -366,6 +373,16 @@ public class Esb2BeisenPerformanceCronJobNew implements EsbServerlessRpcRemoteIn
String employeeid = String.valueOf(employeeMap.get(value)); String employeeid = String.valueOf(employeeMap.get(value));
log.error("employeeid:{}",employeeid); log.error("employeeid:{}",employeeid);
dataJson.put("bkhr",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)){ if("TotalScoreRuleIdLookup".equals(name)){
dataJson.put("ppdj",text); dataJson.put("ppdj",text);
} }
} }
dataArray.add(dataJson); dataArray.add(dataJson);
log.error("dataJson:{}",dataJson.toJSONString()); log.error("dataJson:{}",dataJson.toJSONString());

View File

@ -44,4 +44,23 @@ public class Constants {
public static String templateTable = "uf_dzqmbgl"; public static String templateTable = "uf_dzqmbgl";
public static String templateTableZdb = "uf_dzqmbgl_zdb"; 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";
} }

View File

@ -14,7 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@RestController @RestController
@ -51,6 +53,22 @@ public class SealTemplateController {
return WeaResult.success(dataMap); 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 * @param request

View File

@ -41,7 +41,9 @@ public class SealTemplateDao {
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList); Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result); List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
if(recordList.size() > 0){ 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){ }catch (Exception e){
log.error("getDepartmentCodeById:e:" + e); log.error("getDepartmentCodeById:e:" + e);
@ -101,4 +103,33 @@ public class SealTemplateDao {
return dataid; 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;
}
} }

View File

@ -0,0 +1,64 @@
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 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.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"));
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");
}
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",fileKeys);
return WeaResult.success(actionMap);
}
}

View File

@ -0,0 +1,55 @@
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 usermobile = "";
String uniqueId = "";
if(StringUtils.isNotBlank(mobile) && StringUtils.isNotBlank(name)){
Map<String,Object> dataMap = esb2EsignCreateUserUtil.createUser(name,mobile);
esignAccountId = String.valueOf(dataMap.get("esignAccountId"));
usermobile = String.valueOf(dataMap.get("mobile"));
uniqueId = String.valueOf(dataMap.get("mobile"));
}
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",usermobile);
actionMap.put("uniqueId",uniqueId);
return WeaResult.success(actionMap);
}
}

View File

@ -2,11 +2,13 @@ package com.weaver.seconddev.chapanda.esign.service;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map; import java.util.Map;
@Component @Component
public interface SealTemplateService { public interface SealTemplateService {
Map<String,Object> queryPreviewUrl(String templateId,Map<String, Object> paraMap); Map<String,Object> queryPreviewUrl(String templateId,Map<String, Object> paraMap);
List<Map<String,Object>> queryTemplateField(String templateId, Map<String, Object> paraMap);
} }

View File

@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*** /***
@ -72,7 +74,6 @@ public class SealTemplateServiceImpl implements SealTemplateService {
} }
bodyJson.put("templateFormValues",formArray); bodyJson.put("templateFormValues",formArray);
bodyJson.put("templateId",templateId); bodyJson.put("templateId",templateId);
log.error("bodyJson:{}",bodyJson.toJSONString()); log.error("bodyJson:{}",bodyJson.toJSONString());
@ -96,6 +97,7 @@ public class SealTemplateServiceImpl implements SealTemplateService {
return dataMap; return dataMap;
} }
/*** /***
* 转换规则 * 转换规则
* @param paraMap * @param paraMap
@ -172,4 +174,85 @@ public class SealTemplateServiceImpl implements SealTemplateService {
bodyJson.put("formValue",value); bodyJson.put("formValue",value);
return bodyJson; 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)); // 提取{?}之间的内容
}
}
} }

View File

@ -0,0 +1,185 @@
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){
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.previewUrl)
.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 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;
}
}

View File

@ -0,0 +1,154 @@
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;
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);
bodyJson.put("uniqueId",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.previewUrl)
.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");
if("0".equals(errCode)){
JSONObject dataJson = bodyJson.getJSONObject("data");
if(dataJson.containsKey("signFlowId")){
String accountId = dataJson.getString("accountId");
String esignAccountId = dataJson.getString("esignAccountId");
String uniqueId = dataJson.getString("uniqueId");
dataMap.put("accountId",accountId);
dataMap.put("esignAccountId",esignAccountId);
dataMap.put("uniqueId",uniqueId);
}
}
}
return dataMap;
}
}

View File

@ -54,7 +54,7 @@ public class Esb2EsignPreviewUrlUtil {
try { try {
Request request = new Request.Builder() Request request = new Request.Builder()
.url(Constants.eSignHost+Constants.querySealsUrl+"?fileKey="+fileKey) .url(Constants.eSignHost+Constants.previewUrl+"?fileKey="+fileKey)
.method("GET", null) .method("GET", null)
.addHeader("x-timevale-project-id", Constants.xTimevaleProjectId) .addHeader("x-timevale-project-id", Constants.xTimevaleProjectId)
.addHeader("x-timevale-signature", xTimevaleSignature) .addHeader("x-timevale-signature", xTimevaleSignature)

View File

@ -0,0 +1,224 @@
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();
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("pageNo",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();
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("pageNo",pageNo);
signPo.put("signDateInfos",signDateInfos);
signPo.put("signIdentity","PERSON");
signPo.put("sealType","0");
signPo.put("pageNo",pageNo);
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;
}
}

View File

@ -50,7 +50,7 @@ public class Constants {
public static String HrmHost = "https://hrtest.chabaidao.com"; 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"; public static String createTimeoffUrl = "/open-apis/calendar/v4/timeoff_events?user_id_type=open_id";

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -2,6 +2,7 @@ package com.weaver.seconddev.chapanda.feishu.esb;
import com.weaver.common.base.entity.result.WeaResult; import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface; import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.chapanda.feishu.dao.HrmUserAvatarDao;
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuProfilePictureUtil; import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuProfilePictureUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Service("Esb2FeishuHrmAvatarDateCron") @Service("Esb2FeishuHrmAvatarDateCron")
@ -18,11 +20,14 @@ public class Esb2FeishuHrmAvatarDateCron implements EsbServerlessRpcRemoteInterf
@Autowired @Autowired
Esb2FeishuProfilePictureUtil esb2FeishuProfilePictureUtil; Esb2FeishuProfilePictureUtil esb2FeishuProfilePictureUtil;
@Autowired
HrmUserAvatarDao hrmUserAvatarDao;
@Override @Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) { public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
int days = 2;
Map<String, Object> dataMap = esb2FeishuProfilePictureUtil.syncHrmAvatarByDate(); List<Map<String,Object>> avatarList = hrmUserAvatarDao.queryHrmAvatarByDate(days);
Map<String, Object> dataMap = esb2FeishuProfilePictureUtil.syncHrmAvatarByAvatarList(avatarList);
Map<String, Object> actionMap = new HashMap<String, Object>(); Map<String, Object> actionMap = new HashMap<String, Object>();
actionMap.put("code",200); actionMap.put("code",200);

View File

@ -2,6 +2,7 @@ package com.weaver.seconddev.chapanda.feishu.esb;
import com.weaver.common.base.entity.result.WeaResult; import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface; import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.chapanda.feishu.dao.HrmUserAvatarDao;
import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuProfilePictureUtil; import com.weaver.seconddev.chapanda.feishu.util.Esb2FeishuProfilePictureUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Service("Esb2FeishuHrmAvatarFullCron") @Service("Esb2FeishuHrmAvatarFullCron")
@ -18,10 +20,13 @@ public class Esb2FeishuHrmAvatarFullCron implements EsbServerlessRpcRemoteInterf
@Autowired @Autowired
Esb2FeishuProfilePictureUtil esb2FeishuProfilePictureUtil; Esb2FeishuProfilePictureUtil esb2FeishuProfilePictureUtil;
@Autowired
HrmUserAvatarDao hrmUserAvatarDao;
@Override @Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) { 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>(); Map<String, Object> actionMap = new HashMap<String, Object>();
actionMap.put("code",200); actionMap.put("code",200);

View File

@ -73,7 +73,7 @@ public class Esb2FeishuSendFinishAction implements EsbServerlessRpcRemoteInterfa
log.error("msgType:{}",msgType); log.error("msgType:{}",msgType);
String cid = String.valueOf(params.get("cid")); 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 = ""; String code = "";
if("5".equals(msgType)){ if("5".equals(msgType)){
@ -108,7 +108,7 @@ public class Esb2FeishuSendFinishAction implements EsbServerlessRpcRemoteInterfa
log.error("operator_open_id:{}",operator_open_id); log.error("operator_open_id:{}",operator_open_id);
if(StringUtils.isNotBlank(create_open_id)){ if(StringUtils.isNotBlank(create_open_id)){
if(StringUtils.isNotBlank(operator_open_id)){ if(StringUtils.isNotBlank(operator_open_id)){
String status = "TERMINATED"; String status = "APPROVED";
code = esb2FeishuSendFinishUtil.senTodoMessage( code = esb2FeishuSendFinishUtil.senTodoMessage(
requestid,requestName,requestmark, requestid,requestName,requestmark,
creatorname,createTime, creatorname,createTime,

View File

@ -50,7 +50,7 @@ public class Esb2FeishuSendMessageCardAction implements EsbServerlessRpcRemoteIn
} }
if(StringUtils.isBlank(receiveId)){ if(StringUtils.isBlank(receiveId)){
return WeaResult.fail(500,"receiveId is null"); return WeaResult.fail(500,"1. is null");
} }
String openId = hrmQueryOpenIdDao.queryHrmOpenId(receiveId); String openId = hrmQueryOpenIdDao.queryHrmOpenId(receiveId);
@ -58,7 +58,7 @@ public class Esb2FeishuSendMessageCardAction implements EsbServerlessRpcRemoteIn
return WeaResult.fail(500,"openId is null"); 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 chat_id = (String) dataMap.get("chat_id");
String message_id = (String) dataMap.get("message_id"); String message_id = (String) dataMap.get("message_id");

View File

@ -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;
}
}

View File

@ -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()); log.error("avatarList:{}",avatarList.size());
Map<String, Object> messageMap = new HashMap<String, Object>(); Map<String, Object> messageMap = new HashMap<String, Object>();
int successTotal = 0; 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;
}
} }

View File

@ -202,7 +202,10 @@ public class Esb2FeishuSendDeleteUtil {
log.error("task_open_id:"+task_open_id); log.error("task_open_id:"+task_open_id);
JSONObject taskListJson = new JSONObject(); 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("open_id",task_open_id);
taskListJson.put("title","@i18n@title"); taskListJson.put("title","@i18n@title");
taskListJson.put("links",linksJson); taskListJson.put("links",linksJson);

View File

@ -204,6 +204,9 @@ public class Esb2FeishuSendDoneUtil {
JSONArray taskListArray = new JSONArray(); JSONArray taskListArray = new JSONArray();
log.error("task_open_id:"+task_open_id); log.error("task_open_id:"+task_open_id);
JSONObject taskListJson = new JSONObject(); JSONObject taskListJson = new JSONObject();
// "weaver_"+requestid+"_"+task_open_id+"_"+cid
taskListJson.put("task_id","weaver_"+requestid+"_"+cid); taskListJson.put("task_id","weaver_"+requestid+"_"+cid);
taskListJson.put("open_id",task_open_id); taskListJson.put("open_id",task_open_id);
taskListJson.put("title","@i18n@title"); taskListJson.put("title","@i18n@title");

View File

@ -203,7 +203,8 @@ public class Esb2FeishuSendFinishUtil {
JSONArray taskListArray = new JSONArray(); JSONArray taskListArray = new JSONArray();
log.error("task_open_id:"+task_open_id); log.error("task_open_id:"+task_open_id);
JSONObject taskListJson = new JSONObject(); 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("open_id",task_open_id);
taskListJson.put("title","@i18n@title"); taskListJson.put("title","@i18n@title");
taskListJson.put("links",linksJson); taskListJson.put("links",linksJson);

View File

@ -20,9 +20,10 @@ public class Esb2FeishuSendMessageUtil{
@Autowired @Autowired
private Esb2FeishuTokenUtil esb2FeishuTokenUtil; 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>(); Map<String, Object> messageMap = new HashMap<String, Object>();
List<String> defaultList = new ArrayList<String>(); List<String> defaultList = new ArrayList<String>();
defaultList.add("templateId"); defaultList.add("templateId");
defaultList.add("templateVersionName"); defaultList.add("templateVersionName");
@ -50,13 +51,9 @@ public class Esb2FeishuSendMessageUtil{
// templateVariable.put("current_date,",sdf.format(new Date())); // templateVariable.put("current_date,",sdf.format(new Date()));
JSONObject data_Json = new JSONObject(); JSONObject data_Json = new JSONObject();
for(String key : defaultList){ data_Json.put("template_id",template_id);
String value = paraMap.get(key).toString(); data_Json.put("template_version_name",template_version_name);
data_Json.put(key,value); data_Json.put("template_variable",templateVariable);
}
// data_Json.put("template_id",template_id);
// data_Json.put("template_version_name",template_version_name);
// data_Json.put("template_variable",templateVariable.toJSONString());
JSONObject contentJson = new JSONObject(); JSONObject contentJson = new JSONObject();
contentJson.put("type","template"); contentJson.put("type","template");

View File

@ -28,10 +28,13 @@ public class Esb2FeishuUploadImageUtil {
@Autowired @Autowired
private FileDownloadService fileDownloadService; private FileDownloadService fileDownloadService;
@Autowired
Esb2FeishuTokenUtil esb2FeishuTokenUtil;
public String uploadImage(Long pvalue) { public String uploadImage(Long pvalue) {
log.error("esb2feishuuploadimageutil start"); log.error("esb2feishuuploadimageutil start");
String imageKey = ""; String imageKey = "";
String token = getToken2(); String token = esb2FeishuTokenUtil.getToken();
log.error("token:"+token); log.error("token:"+token);
if(StringUtils.isNotBlank(token)){ if(StringUtils.isNotBlank(token)){
InputStream fileInputStream = null; InputStream fileInputStream = null;
@ -74,73 +77,73 @@ public class Esb2FeishuUploadImageUtil {
} }
public String getToken2() { // public String getToken2() {
String token = ""; // String token = "";
JSONObject returnData = getAccessToken(); // JSONObject returnData = getAccessToken();
if(returnData.containsKey("tenantAccessToken")){ // if(returnData.containsKey("tenantAccessToken")){
token = returnData.getString("tenantAccessToken"); // token = returnData.getString("tenantAccessToken");
} // }
System.out.println("token:"+token); // System.out.println("token:"+token);
return token; // return token;
} // }
/** /**
* *
* @return * @return
*/ */
public JSONObject getAccessToken() { // public JSONObject getAccessToken() {
//
JSONObject returnData = new JSONObject(); // JSONObject returnData = new JSONObject();
JSONObject dataJson = new JSONObject(); // JSONObject dataJson = new JSONObject();
dataJson.put("app_id", Constants.app_id); // dataJson.put("app_id", Constants.app_id);
dataJson.put("app_secret", Constants.app_secret); // dataJson.put("app_secret", Constants.app_secret);
//
log.error("dataJson:{}",dataJson.toJSONString()); // log.error("dataJson:{}",dataJson.toJSONString());
// dataJson.put("app_id", "cli_a8d0ee6b667dd00e"); //// dataJson.put("app_id", "cli_a8d0ee6b667dd00e");
// dataJson.put("app_secret", "UjShC4eY7vCgHsQvFWZZleVdCqSEWGD0"); //// dataJson.put("app_secret", "UjShC4eY7vCgHsQvFWZZleVdCqSEWGD0");
//
try { // try {
OkHttpClient client = new OkHttpClient().newBuilder() // OkHttpClient client = new OkHttpClient().newBuilder()
.build(); // .build();
MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); // MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString()); // RequestBody body = RequestBody.create(mediaType, dataJson.toJSONString());
Request request = new Request.Builder() // Request request = new Request.Builder()
.url(Constants.feishuHost+Constants.tokenUrl) // .url(Constants.feishuHost+Constants.tokenUrl)
.method("POST", body) // .method("POST", body)
.addHeader("Content-Type", "application/json; charset=utf-8") // .addHeader("Content-Type", "application/json; charset=utf-8")
.build(); // .build();
Response response = client.newCall(request).execute(); // Response response = client.newCall(request).execute();
int code = response.code(); // int code = response.code();
String msg = response.body().string(); // String msg = response.body().string();
//
log.error("code:{}",code); // log.error("code:{}",code);
log.error("msg:{}",msg); // log.error("msg:{}",msg);
//
if(code == 200){ // if(code == 200){
if(StringUtils.isNotBlank(msg)){ // if(StringUtils.isNotBlank(msg)){
JSONObject returnJson = JSONObject.parseObject(msg); // JSONObject returnJson = JSONObject.parseObject(msg);
if(returnJson.containsKey("code")){ // if(returnJson.containsKey("code")){
String dataCode = returnJson.getString("code"); // String dataCode = returnJson.getString("code");
if("0".equals(dataCode)){ // if("0".equals(dataCode)){
String tenantAccessToken = returnJson.getString("tenant_access_token"); // String tenantAccessToken = returnJson.getString("tenant_access_token");
int expire = returnJson.getInteger("expire"); // int expire = returnJson.getInteger("expire");
//
log.error("tenantAccessToken:{}",tenantAccessToken); // log.error("tenantAccessToken:{}",tenantAccessToken);
log.error("expire:{}",expire); // log.error("expire:{}",expire);
//
returnData.put("tenantAccessToken",tenantAccessToken); // returnData.put("tenantAccessToken",tenantAccessToken);
} // }
} // }
} // }
}else{ // }else{
log.error("msg:{}",msg); // log.error("msg:{}",msg);
} // }
} catch (Exception e) { // } catch (Exception e) {
log.error("msg:{}",e.getMessage()); // log.error("msg:{}",e.getMessage());
e.printStackTrace(); // e.printStackTrace();
} // }
return returnData; // return returnData;
} // }
/** /**

View File

@ -12,6 +12,11 @@ import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 经济补偿
*/
@Service("Esb2QunjieEconomicCompensationAction") @Service("Esb2QunjieEconomicCompensationAction")
public class Esb2QunjieEconomicCompensationAction implements EsbServerlessRpcRemoteInterface { public class Esb2QunjieEconomicCompensationAction implements EsbServerlessRpcRemoteInterface {
private final static Logger log = LoggerFactory.getLogger(Esb2QunjieEconomicCompensationAction.class); private final static Logger log = LoggerFactory.getLogger(Esb2QunjieEconomicCompensationAction.class);

View File

@ -23,19 +23,19 @@ public class Esb2QunjieFinshSealApplyAction implements EsbServerlessRpcRemoteInt
log.error("Esb2QunjieFinshSealApplyAction start"); log.error("Esb2QunjieFinshSealApplyAction start");
String applyId = (String) params.get("applyId"); String applyId = (String) params.get("applyId");
String sealId = (String) params.get("sealId"); // String sealId = (String) params.get("sealId");
log.error("applyId:{}",applyId); log.error("applyId:{}",applyId);
log.error("sealId:{}",sealId); // log.error("sealId:{}",sealId);
if(StringUtils.isBlank(applyId)){ if(StringUtils.isBlank(applyId)){
return WeaResult.fail(500,"用印申请流程获取失败"); return WeaResult.fail(500,"用印申请流程获取失败");
} }
if(StringUtils.isBlank(sealId)){ // if(StringUtils.isBlank(sealId)){
return WeaResult.fail(500,"印章信息获取失败"); // return WeaResult.fail(500,"印章信息获取失败");
} // }
String message = esb2QunjieFinshSealApplyUtil.finshApplyRquest(applyId,sealId); String message = esb2QunjieFinshSealApplyUtil.finshApplyRquest(applyId);
if(StringUtils.isBlank(message)){ if(StringUtils.isBlank(message)){
return WeaResult.fail(500,"关闭授权失败"); return WeaResult.fail(500,"关闭授权失败");
} }

View File

@ -8,14 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException; 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 @Component
@ -25,7 +18,7 @@ public class Esb2QunjieFinshSealApplyUtil {
@Autowired @Autowired
private Esb2QunjieTokenUtil esb2QunjieTokenUtil; private Esb2QunjieTokenUtil esb2QunjieTokenUtil;
public String finshApplyRquest(String applyId,String sealId) { public String finshApplyRquest(String applyId) {
log.error("senCardMessage start"); log.error("senCardMessage start");
String timestamp = ""; String timestamp = "";
String token = esb2QunjieTokenUtil.getAccessToken(); String token = esb2QunjieTokenUtil.getAccessToken();
@ -34,8 +27,8 @@ public class Esb2QunjieFinshSealApplyUtil {
JSONObject bodyJson = new JSONObject(); JSONObject bodyJson = new JSONObject();
bodyJson.put("applyId",applyId); bodyJson.put("applyId",applyId);
String[] sealIdList = new String[]{sealId}; // String[] sealIdList = new String[]{sealId};
bodyJson.put("sealIdList",sealIdList); // bodyJson.put("sealIdList",sealIdList);
System.out.println("bodyJson:"+bodyJson.toJSONString()); System.out.println("bodyJson:"+bodyJson.toJSONString());