|
|
@@ -29,6 +29,7 @@ import com.fs.his.service.IFsCityService;
|
|
|
import com.fs.his.service.OpenImAsyncService;
|
|
|
import com.fs.im.dto.OpenImMsgCallBackResponse;
|
|
|
import com.fs.im.util.JsonUtil;
|
|
|
+import com.fs.im.vo.OpenImBeforeCreateGroupVO;
|
|
|
import com.fs.im.vo.OpenImMsgCallBackVO;
|
|
|
import com.fs.jpush.service.JpushService;
|
|
|
|
|
|
@@ -242,6 +243,33 @@ public class CommonController extends AppBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("openIm创建群组之前的回调")
|
|
|
+ @PostMapping(value = "/callbackBeforeCreateGroupCommand")
|
|
|
+ public OpenImMsgCallBackResponse callbackBeforeCreateGroupCommand(@RequestBody String body) {
|
|
|
+ if (StringUtils.isBlank(body)) {
|
|
|
+ log.warn("OpenIM 回调 body 为空");
|
|
|
+ return OpenImMsgCallBackResponse.fail("body为空");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ OpenImBeforeCreateGroupVO messageInfo = JsonUtil.fromJson(body, OpenImBeforeCreateGroupVO.class);
|
|
|
+ if (messageInfo == null || StringUtils.isBlank(messageInfo.getCreatorUserID())) {
|
|
|
+ log.warn("OpenIM 回调参数无效: {}", body);
|
|
|
+ return OpenImMsgCallBackResponse.fail("参数无效");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!messageInfo.getCreatorUserID().startsWith("C")){
|
|
|
+ log.info("非销售不允许创群");
|
|
|
+ return OpenImMsgCallBackResponse.fail("非销售不允许创群");
|
|
|
+ }
|
|
|
+
|
|
|
+ return OpenImMsgCallBackResponse.success();
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 解析失败仍返回成功,避免 OpenIM 反复重试;异常已记录便于排查
|
|
|
+ log.error("OpenIM 回调解析失败, body={}", body, e);
|
|
|
+ return OpenImMsgCallBackResponse.fail("参数异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 手动转码
|
|
|
*
|