回调接口配置
continuous-integration/drone/push Build is passing Details

于相涌/mail
YXY 2 years ago
parent d5e1410857
commit f1290fa918

@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.DecryptUtil; import com.ruoyi.common.utils.DecryptUtil;
import com.ruoyi.flyingbook.factory.LarkCallBackFactory; import com.ruoyi.flyingbook.factory.LarkCallBackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -30,17 +31,25 @@ public class EventController extends BaseController {
} }
log.info("/event/test1/approval request:{}", jsonObject.toJSONString()); log.info("/event/test1/approval request:{}", jsonObject.toJSONString());
if (jsonObject.containsKey("encrypt")) { if (jsonObject.containsKey("encrypt")) {
String res = DecryptUtil.decrypt(jsonObject.getString("encrypt")); result = DecryptUtil.decrypt(jsonObject.getString("encrypt"));
jsonObject = JSONObject.parseObject(res);
log.info("/event/test1/approval encrypt:{}", JSONObject.toJSONString(result)); log.info("/event/test1/approval encrypt:{}", JSONObject.toJSONString(result));
} }
if (jsonObject.containsKey("challenge")) {
result = jsonObject.getString("challenge");
}
RequestVo larkRequest = new RequestVo(); RequestVo larkRequest = new RequestVo();
larkRequest.setMessage(result); larkRequest.setMessage(result);
larkFactory.execute(larkRequest); larkFactory.execute(larkRequest);
if (StringUtils.isNotBlank(result)){
jsonObject = JSONObject.parseObject(result);
if (jsonObject.containsKey("challenge")) {
return jsonObject.getString("challenge");
}
}
return result; return result;
} }
public static void main(String[] args) {
String str = "{\"encrypt\":\"cC+nYKAtEllTspofsBdr3NNsQEj6KUfBjnRfz5QEgakgWj/8aLh8sH2WpQqBAynDPEWfdSuhMO8AjDD0ZW+AKKIYU/4yKv+50Wdz0MnxIgs5zFk7QygvRQlnE+b75EULNLyQvgpCvlV6cTriTou/dIgaDatf9qmHu6bp0r+ms3neNUxavgYbOb5KryCzGjNY\"}";
EventController c = new EventController();
System.out.println(c.event(JSONObject.parseObject(str)));
}
} }

Loading…
Cancel
Save