Compare commits

...

2 Commits

Author SHA1 Message Date
YXY b4f25d47ac 开放所有回调接口
continuous-integration/drone/push Build is passing Details
1 year ago
YXY 092149f70c 短时间内创建和修改导致数据重复的问题
1 year ago

@ -85,7 +85,11 @@ public class EdiController extends BaseController {
// public void receiveCjtTicket(Long id) { // public void receiveCjtTicket(Long id) {
// ErpLarkTempRelation erpLarkTempRelation = erpLarkTempRelationMapper.selectErpLarkTempRelationById(id); // ErpLarkTempRelation erpLarkTempRelation = erpLarkTempRelationMapper.selectErpLarkTempRelationById(id);
// JSONObject jsonObject = JSONObject.parseObject(erpLarkTempRelation.getRemark()); // JSONObject jsonObject = JSONObject.parseObject(erpLarkTempRelation.getRemark());
// execeuteByType(jsonObject); // JSONObject req = new JSONObject();
// req.put("appKey",erpLarkTempRelation.getLarkKey());
// req.put("msgType",erpLarkTempRelation.getMethod());
// req.put("bizContent",jsonObject);
// execeuteByType(req);
// } // }
/** /**
@ -124,12 +128,6 @@ public class EdiController extends BaseController {
redisCache.setCacheObject(buildUniqueKey(RedisConstants.CJT_TICKET_CACHE_KEY, appKey), appTicket, 24, TimeUnit.HOURS); redisCache.setCacheObject(buildUniqueKey(RedisConstants.CJT_TICKET_CACHE_KEY, appKey), appTicket, 24, TimeUnit.HOURS);
} }
} }
// else if ("SaleDispatchVoucher_Delete".equals(msgType)){
// log.info("畅捷通删除接口回调");
// String voucherCode = bizContent.getString("voucherCode");
// CJTEdiCallbackRequestVo cjtEdiCallbackRequestVo = new CJTEdiCallbackRequestVo(msgType, voucherCode);
// ediOperateService.cjtCallback(cjtEdiCallbackRequestVo);
// }
else{ else{
cjtOperateCallBackFactory.handle(jsonObject); cjtOperateCallBackFactory.handle(jsonObject);
} }

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

@ -21,6 +21,12 @@ public class CJTOperateCallBackFactory {
private SaleDispatchSyncCallOperate saleDispatchSyncCallOperate; private SaleDispatchSyncCallOperate saleDispatchSyncCallOperate;
@Autowired @Autowired
private SaleOrderSyncCallBackOperate saleOrderSyncCallBackOperate; private SaleOrderSyncCallBackOperate saleOrderSyncCallBackOperate;
@Autowired
private PurchaseArrivalOrderCallBackOperate purchaseArrivalOrderCallBackOperate;
@Autowired
private PurchaseOrderSyncCallBackOperate purchaseOrderSyncCallBackOperate;
@Autowired
private SaleDeliverySyncCallBackOperate saleDeliverySyncCallBackOperate;
public void handle(JSONObject jsonObject){ public void handle(JSONObject jsonObject){
String appKey = jsonObject.getString("appKey"); String appKey = jsonObject.getString("appKey");
@ -44,36 +50,32 @@ public class CJTOperateCallBackFactory {
case SALE_DISPATCH_CREATE: case SALE_DISPATCH_CREATE:
case SALE_DISPATCH_UPDATE: case SALE_DISPATCH_UPDATE:
case SALE_DISPATCH_DELETE: case SALE_DISPATCH_DELETE:
switch (cjtAccountEnum){
case ONE:
saleDispatchSyncCallOperate.execute(cjtEdiCallbackRequestVo); saleDispatchSyncCallOperate.execute(cjtEdiCallbackRequestVo);
break; break;
default:
break;
}
break;
case SALE_ORDER_CREATE: case SALE_ORDER_CREATE:
case SALE_ORDER_UPDATE: case SALE_ORDER_UPDATE:
case SALE_ORDER_DELETE: case SALE_ORDER_DELETE:
switch (cjtAccountEnum){
case ONE:
saleOrderSyncCallBackOperate.execute(cjtEdiCallbackRequestVo); saleOrderSyncCallBackOperate.execute(cjtEdiCallbackRequestVo);
break; break;
default:
break;
}
break;
case MANUFACTURE_ORDER_CREATE: case MANUFACTURE_ORDER_CREATE:
case MANUFACTURE_ORDER_UPDATE: case MANUFACTURE_ORDER_UPDATE:
case MANUFACTURE_ORDER_DELETE: case MANUFACTURE_ORDER_DELETE:
switch (cjtAccountEnum){
case TWO:
manufactureOrderSyncCallOperate.execute(cjtEdiCallbackRequestVo); manufactureOrderSyncCallOperate.execute(cjtEdiCallbackRequestVo);
break; break;
default: case PURCHASE_ORDER_CREATE:
case PURCHASE_ORDER_UPDATE:
case PURCHASE_ORDER_DELETE:
purchaseOrderSyncCallBackOperate.execute(cjtEdiCallbackRequestVo);
break; break;
} case PURCHASE_ARRIVAL_ORDER_CREATE:
case PURCHASE_ARRIVAL_ORDER_UPDATE:
case PURCHASE_ARRIVAL_ORDER_DELETE:
purchaseArrivalOrderCallBackOperate.execute(cjtEdiCallbackRequestVo);
break;
case SALE_DELIVERY_CREATE:
case SALE_DELIVERY_UPDATE:
case SALE_DELIVERY_DELETE:
saleDeliverySyncCallBackOperate.execute(cjtEdiCallbackRequestVo);
break; break;
default: default:
saleDispatchSyncCallOperate.preHandle(cjtEdiCallbackRequestVo); saleDispatchSyncCallOperate.preHandle(cjtEdiCallbackRequestVo);

Loading…
Cancel
Save