change package

于相涌/mail
YXY 2 years ago committed by bob
parent 950a884d80
commit 40afd5533f

@ -218,7 +218,7 @@
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-flyingbook</artifactId>
<version>${ruoyi.version}</version>
<version>3.4.1-SNAPSHOT</version>
</dependency>
<dependency>

@ -20,8 +20,4 @@ public class RuoYiApplication
SpringApplication.run(RuoYiApplication.class, args);
}
@Bean
public ServletAdapter getServletAdapter() {
return new ServletAdapter();
}
}

@ -9,4 +9,5 @@ import lombok.Data;
@Data
public class LarkRequest {
private Long eventId;
private String message;
}

@ -7,6 +7,7 @@
<groupId>com.ruoyi</groupId>
<version>3.4.0</version>
</parent>
<version>3.4.1-SNAPSHOT</version>
<artifactId>ruoyi-flyingbook</artifactId>
<name>ruoyi-flyingbook</name>
<description>Demo project for Spring Boot</description>

@ -1,11 +1,7 @@
package com.flyingbook.LarkHelper;
package com.ruoyi.flyingbook.LarkHelper;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.lark.oapi.Client;
import com.lark.oapi.core.request.RequestOptions;
import com.lark.oapi.core.response.RawResponse;
import com.lark.oapi.core.token.AccessTokenType;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;

@ -1,4 +1,4 @@
package com.flyingbook;
package com.ruoyi.flyingbook;
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
import org.springframework.boot.SpringApplication;

@ -1,4 +1,4 @@
package com.flyingbook.config;
package com.ruoyi.flyingbook.config;
import com.lark.oapi.Client;

@ -1,4 +1,4 @@
package com.flyingbook.config;
package com.ruoyi.flyingbook.config;
import com.lark.oapi.Client;
import com.lark.oapi.core.enums.AppType;
import com.lark.oapi.core.response.RawResponse;

@ -1,24 +1,14 @@
package com.ruoyi.web.controller;
package com.ruoyi.flyingbook.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.base.LarkRequest;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.DecryptUtil;
import com.sun.org.apache.bcel.internal.generic.IfInstruction;
import com.ruoyi.flyingbook.strategy.ApprovalCallback;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.event.EventDispatcher;
import com.lark.oapi.service.contact.v3.ContactService;
import com.lark.oapi.service.contact.v3.model.P2UserCreatedV3;
import com.lark.oapi.service.im.v1.ImService;
import com.lark.oapi.service.im.v1.model.P1MessageReadV1;
import com.lark.oapi.service.im.v1.model.P2MessageReadV1;
import com.lark.oapi.service.im.v1.model.P2MessageReceiveV1;
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -27,7 +17,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
@Slf4j
@RestController
@RequestMapping("/event/test1")
public class EventController {
public class EventController extends BaseController {
@Autowired
private ApprovalCallback approvalCallback;
//3. 创建路由处理器
@PostMapping("/approval")
@ -45,6 +38,9 @@ public class EventController {
result = jsonObject.getString("challenge");
log.info("/event/test1/approval request:{} challenge:{}", jsonObject.toJSONString(), result);
}
LarkRequest larkRequest = new LarkRequest();
larkRequest.setMessage(result);
approvalCallback.execute(larkRequest);
return result;
}
}

@ -1,4 +1,4 @@
package com.ruoyi.web.controller;
package com.ruoyi.flyingbook.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.DecryptUtil;
import lombok.extern.slf4j.Slf4j;

@ -1,4 +1,4 @@
package com.flyingbook.domain;
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@ -1,4 +1,4 @@
package com.flyingbook.domain;
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@ -1,4 +1,4 @@
package com.flyingbook.domain;
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@ -1,4 +1,4 @@
package com.flyingbook.domain;
package com.ruoyi.flyingbook.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

@ -1,7 +1,7 @@
package com.flyingbook.mapper;
package com.ruoyi.flyingbook.mapper;
import com.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.domain.EventLog;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.mapper;
package com.ruoyi.flyingbook.mapper;
import com.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.Event;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.mapper;
package com.ruoyi.flyingbook.mapper;
import com.flyingbook.domain.LarkCompanyRelation;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.mapper;
package com.ruoyi.flyingbook.mapper;
import com.flyingbook.domain.LarkTableRelation;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.service;
package com.ruoyi.flyingbook.service;
import com.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.domain.EventLog;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.service;
package com.ruoyi.flyingbook.service;
import com.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.Event;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.service;
package com.ruoyi.flyingbook.service;
import com.flyingbook.domain.LarkCompanyRelation;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import java.util.List;

@ -1,7 +1,7 @@
package com.flyingbook.service;
package com.ruoyi.flyingbook.service;
import com.flyingbook.domain.LarkTableRelation;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import java.util.List;

@ -1,10 +1,10 @@
package com.flyingbook.service.impl;
package com.ruoyi.flyingbook.service.impl;
import java.util.List;
import com.flyingbook.domain.EventLog;
import com.flyingbook.mapper.EventLogMapper;
import com.flyingbook.service.IEventLogService;
import com.ruoyi.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.mapper.EventLogMapper;
import com.ruoyi.flyingbook.service.IEventLogService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@ -1,9 +1,9 @@
package com.flyingbook.service.impl;
package com.ruoyi.flyingbook.service.impl;
import com.flyingbook.domain.Event;
import com.flyingbook.mapper.EventMapper;
import com.flyingbook.service.IEventService;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.mapper.EventMapper;
import com.ruoyi.flyingbook.service.IEventService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@ -1,10 +1,10 @@
package com.flyingbook.service.impl;
package com.ruoyi.flyingbook.service.impl;
import java.util.List;
import com.flyingbook.domain.LarkCompanyRelation;
import com.flyingbook.mapper.LarkCompanyRelationMapper;
import com.flyingbook.service.ILarkCompanyRelationService;
import com.ruoyi.flyingbook.domain.LarkCompanyRelation;
import com.ruoyi.flyingbook.mapper.LarkCompanyRelationMapper;
import com.ruoyi.flyingbook.service.ILarkCompanyRelationService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@ -1,10 +1,10 @@
package com.flyingbook.service.impl;
package com.ruoyi.flyingbook.service.impl;
import java.util.List;
import com.flyingbook.domain.LarkTableRelation;
import com.flyingbook.mapper.LarkTableRelationMapper;
import com.flyingbook.service.ILarkTableRelationService;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import com.ruoyi.flyingbook.mapper.LarkTableRelationMapper;
import com.ruoyi.flyingbook.service.ILarkTableRelationService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@ -1,9 +1,9 @@
package com.flyingbook.strategy;
package com.ruoyi.flyingbook.strategy;
import com.flyingbook.domain.Event;
import com.flyingbook.domain.EventLog;
import com.flyingbook.service.IEventLogService;
import com.flyingbook.service.IEventService;
import com.ruoyi.flyingbook.domain.Event;
import com.ruoyi.flyingbook.domain.EventLog;
import com.ruoyi.flyingbook.service.IEventLogService;
import com.ruoyi.flyingbook.service.IEventService;
import com.ruoyi.common.base.LarkRequest;
import com.ruoyi.common.constant.RedisConstants;
import com.ruoyi.common.enums.EventOperateStatus;
@ -12,7 +12,7 @@ import com.ruoyi.common.enums.FlagStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.Date;
@ -21,7 +21,7 @@ import java.util.Date;
* @create 2023-03-12 15:58
*/
@Slf4j
@Component("approvalCallback")
@Service
public class ApprovalCallback extends CallbackAbstract {
@Autowired
@ -34,7 +34,7 @@ public class ApprovalCallback extends CallbackAbstract {
@Override
protected Boolean check(LarkRequest request) {
String message = "";
return Boolean.FALSE;
return Boolean.TRUE;
}
@Override
@ -44,7 +44,7 @@ public class ApprovalCallback extends CallbackAbstract {
@Override
protected void businessProcessing(LarkRequest request) {
String message = "aaa";
String message = request.getMessage();
Event event = this.buildDto(message);
int i = eventService.insertEvent(event);
request.setEventId(event.getId());
@ -53,13 +53,20 @@ public class ApprovalCallback extends CallbackAbstract {
@Override
protected void endHandle(LarkRequest request) {
if (request.getEventId() == null){
return;
}
redisTemplate.opsForList().rightPush(RedisConstants.MULTIDIMENSIONALTABULARFEEDBACK,request.getEventId());
EventLog eventLog = new EventLog();
eventLog.setCreateBy("Syetem");
eventLog.setCreateTime(new Date());
eventLog.setFlag(FlagStatus.OK.getCode());
eventLog.setOperateStatus(EventOperateStatus.PENDING.getCode());
eventLog.setOperateType(EventOperateType.CALL_BACK.getCode());
eventLog.setEventId(request.getEventId());
eventLogService.insertEventLog(eventLog);
Object o = redisTemplate.opsForList().leftPop(RedisConstants.MULTIDIMENSIONALTABULARFEEDBACK);
System.out.println(String.valueOf(o));
}
@Override

@ -1,4 +1,4 @@
package com.flyingbook.strategy;
package com.ruoyi.flyingbook.strategy;
import com.ruoyi.common.service.LarkOperateAbstract;
import lombok.extern.slf4j.Slf4j;

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flyingbook.mapper.EventLogMapper">
<mapper namespace="com.ruoyi.flyingbook.mapper.EventLogMapper">
<resultMap type="com.flyingbook.domain.EventLog" id="EventLogResult">
<resultMap type="EventLog" id="EventLogResult">
<result property="id" column="id"/>
<result property="tableId" column="table_id"/>
<result property="recordId" column="record_id"/>
@ -39,7 +39,7 @@
from event_log
</sql>
<select id="selectEventLogList" parameterType="com.flyingbook.domain.EventLog" resultMap="EventLogResult">
<select id="selectEventLogList" parameterType="EventLog" resultMap="EventLogResult">
<include refid="selectEventLogVo"/>
<where>
<if test="tableId != null and tableId != ''">and table_id = #{tableId}</if>
@ -58,7 +58,7 @@
where id = #{id}
</select>
<insert id="insertEventLog" parameterType="com.flyingbook.domain.EventLog" useGeneratedKeys="true" keyProperty="id">
<insert id="insertEventLog" parameterType="EventLog" useGeneratedKeys="true" keyProperty="id">
insert into event_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableId != null">table_id,</if>
@ -92,7 +92,7 @@
</trim>
</insert>
<update id="updateEventLog" parameterType="com.flyingbook.domain.EventLog">
<update id="updateEventLog" parameterType="EventLog">
update event_log
<trim prefix="SET" suffixOverrides=",">
<if test="tableId != null">table_id = #{tableId},</if>

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flyingbook.mapper.EventMapper">
<mapper namespace="com.ruoyi.flyingbook.mapper.EventMapper">
<resultMap type="com.flyingbook.domain.Event" id="EventResult">
<resultMap type="Event" id="EventResult">
<result property="id" column="id"/>
<result property="message" column="message"/>
<result property="createBy" column="create_by"/>
@ -27,7 +27,7 @@
from event
</sql>
<select id="selectEventList" parameterType="com.flyingbook.domain.Event" resultMap="EventResult">
<select id="selectEventList" parameterType="Event" resultMap="EventResult">
<include refid="selectEventVo"/>
<where>
<if test="message != null and message != ''">and message = #{message}</if>
@ -40,7 +40,7 @@
where id = #{id}
</select>
<insert id="insertEvent" parameterType="com.flyingbook.domain.Event" useGeneratedKeys="true" keyProperty="id">
<insert id="insertEvent" parameterType="Event" useGeneratedKeys="true" keyProperty="id">
insert into event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="message != null">message,</if>
@ -62,7 +62,7 @@
</trim>
</insert>
<update id="updateEvent" parameterType="com.flyingbook.domain.Event">
<update id="updateEvent" parameterType="Event">
update event
<trim prefix="SET" suffixOverrides=",">
<if test="message != null">message = #{message},</if>

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flyingbook.mapper.LarkCompanyRelationMapper">
<mapper namespace="com.ruoyi.flyingbook.mapper.LarkCompanyRelationMapper">
<resultMap type="com.flyingbook.domain.LarkCompanyRelation" id="LarkCompanyRelationResult">
<resultMap type="LarkCompanyRelation" id="LarkCompanyRelationResult">
<result property="id" column="id"/>
<result property="companyId" column="company_id"/>
<result property="companyName" column="company_name"/>
@ -33,7 +33,7 @@
from lark_company_relation
</sql>
<select id="selectLarkCompanyRelationList" parameterType="com.flyingbook.domain.LarkCompanyRelation"
<select id="selectLarkCompanyRelationList" parameterType="LarkCompanyRelation"
resultMap="LarkCompanyRelationResult">
<include refid="selectLarkCompanyRelationVo"/>
<where>
@ -52,7 +52,7 @@
where id = #{id}
</select>
<insert id="insertLarkCompanyRelation" parameterType="com.flyingbook.domain.LarkCompanyRelation" useGeneratedKeys="true" keyProperty="id">
<insert id="insertLarkCompanyRelation" parameterType="LarkCompanyRelation" useGeneratedKeys="true" keyProperty="id">
insert into lark_company_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyId != null">company_id,</if>
@ -80,7 +80,7 @@
</trim>
</insert>
<update id="updateLarkCompanyRelation" parameterType="com.flyingbook.domain.LarkCompanyRelation">
<update id="updateLarkCompanyRelation" parameterType="LarkCompanyRelation">
update lark_company_relation
<trim prefix="SET" suffixOverrides=",">
<if test="companyId != null">company_id = #{companyId},</if>

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flyingbook.mapper.LarkTableRelationMapper">
<mapper namespace="com.ruoyi.flyingbook.mapper.LarkTableRelationMapper">
<resultMap type="com.flyingbook.domain.LarkTableRelation" id="LarkTableRelationResult">
<resultMap type="LarkTableRelation" id="LarkTableRelationResult">
<result property="id" column="id"/>
<result property="larkCompanyRelationId" column="lark_company_relation_id"/>
<result property="fromTableId" column="from_table_id"/>
@ -33,7 +33,7 @@
from lark_table_relation
</sql>
<select id="selectLarkTableRelationList" parameterType="com.flyingbook.domain.LarkTableRelation" resultMap="LarkTableRelationResult">
<select id="selectLarkTableRelationList" parameterType="LarkTableRelation" resultMap="LarkTableRelationResult">
<include refid="selectLarkTableRelationVo"/>
<where>
<if test="larkCompanyRelationId != null ">and lark_company_relation_id = #{larkCompanyRelationId}</if>
@ -49,7 +49,7 @@
where id = #{id}
</select>
<insert id="insertLarkTableRelation" parameterType="com.flyingbook.domain.LarkTableRelation" useGeneratedKeys="true" keyProperty="id">
<insert id="insertLarkTableRelation" parameterType="LarkTableRelation" useGeneratedKeys="true" keyProperty="id">
insert into lark_table_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="larkCompanyRelationId != null">lark_company_relation_id,</if>
@ -77,7 +77,7 @@
</trim>
</insert>
<update id="updateLarkTableRelation" parameterType="com.flyingbook.domain.LarkTableRelation">
<update id="updateLarkTableRelation" parameterType="LarkTableRelation">
update lark_table_relation
<trim prefix="SET" suffixOverrides=",">
<if test="larkCompanyRelationId != null">lark_company_relation_id = #{larkCompanyRelationId},</if>

Loading…
Cancel
Save