|
|
@ -6,6 +6,7 @@ import com.lark.oapi.service.bitable.v1.model.CreateAppTableRecordRespBody;
|
|
|
|
import com.ruoyi.common.constant.RedisConstants;
|
|
|
|
import com.ruoyi.common.constant.RedisConstants;
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
|
import com.ruoyi.common.enums.CjtAccountEnum;
|
|
|
|
import com.ruoyi.common.enums.CjtAccountEnum;
|
|
|
|
|
|
|
|
import com.ruoyi.common.enums.CjtCallBackOperateEnum;
|
|
|
|
import com.ruoyi.common.enums.FlagStatus;
|
|
|
|
import com.ruoyi.common.enums.FlagStatus;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkRobotHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkRobotHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
|
|
|
@ -62,7 +63,8 @@ public abstract class CJTOperateCallBackAbstract {
|
|
|
|
protected static final String REQUEST_ROOT_PATH = "https://openapi.chanjet.com";
|
|
|
|
protected static final String REQUEST_ROOT_PATH = "https://openapi.chanjet.com";
|
|
|
|
|
|
|
|
|
|
|
|
public void execute(CJTEdiCallbackRequestVo req) {
|
|
|
|
public void execute(CJTEdiCallbackRequestVo req) {
|
|
|
|
String operateCallBackFlag = buildCacheUniqueKey(RedisConstants.CJT_CALLBACK_OPERATE, req.getAppId() + req.getMsgType() + req.getVoucherId());
|
|
|
|
CjtCallBackOperateEnum msgTypeEnum = req.getMsgTypeEnum();
|
|
|
|
|
|
|
|
String operateCallBackFlag = buildCacheUniqueKey(RedisConstants.CJT_CALLBACK_OPERATE, req.getAppId() + msgTypeEnum.getLarkCompanyCode() + req.getVoucherId());
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Boolean operateFlag = redisCache.setCacheObjectIfAbsent(operateCallBackFlag, operateCallBackFlag, 10L, TimeUnit.MINUTES);
|
|
|
|
Boolean operateFlag = redisCache.setCacheObjectIfAbsent(operateCallBackFlag, operateCallBackFlag, 10L, TimeUnit.MINUTES);
|
|
|
|
if (!operateFlag) {
|
|
|
|
if (!operateFlag) {
|
|
|
@ -228,15 +230,13 @@ public abstract class CJTOperateCallBackAbstract {
|
|
|
|
Map<String, Object> larkBody = buildLarkBody(header, detail, cjtAccountEnum);
|
|
|
|
Map<String, Object> larkBody = buildLarkBody(header, detail, cjtAccountEnum);
|
|
|
|
request.setBody(larkBody);
|
|
|
|
request.setBody(larkBody);
|
|
|
|
CreateAppTableRecordRespBody respBody = larkTableHelper.addTableRecord(request);
|
|
|
|
CreateAppTableRecordRespBody respBody = larkTableHelper.addTableRecord(request);
|
|
|
|
|
|
|
|
req.setRetry(Boolean.FALSE);
|
|
|
|
String larkKey = respBody.getRecord().getRecordId();
|
|
|
|
String larkKey = respBody.getRecord().getRecordId();
|
|
|
|
relationList.add(buildErpLarkRelation(uniqueKey, larkKey, cjtAccountEnum.getCode(), toTableId, req.getVoucherId()));
|
|
|
|
relationList.add(buildErpLarkRelation(uniqueKey, larkKey, cjtAccountEnum.getCode(), toTableId, req.getVoucherId()));
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
errorList.add(e.getMessage());
|
|
|
|
errorList.add(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CollectionUtils.isEmpty(errorList)) {
|
|
|
|
|
|
|
|
req.setRetry(Boolean.FALSE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(relationList)) {
|
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(relationList)) {
|
|
|
|
erpLarkRelationMapper.batchInsert(relationList);
|
|
|
|
erpLarkRelationMapper.batchInsert(relationList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|