♻️Refactor: 优化目录层次结构
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.wonderland.stardewvalley;
|
||||
|
||||
import com.wonderland.stardewvalley.lark.EventListener;
|
||||
import com.wonderland.stardewvalley.util.lark.EventListener;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.constant;
|
||||
package com.wonderland.stardewvalley.common.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.constant;
|
||||
package com.wonderland.stardewvalley.common.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.constant;
|
||||
package com.wonderland.stardewvalley.common.constant;
|
||||
|
||||
public class GuideConstant {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.constant;
|
||||
package com.wonderland.stardewvalley.common.constant;
|
||||
|
||||
public class LarkConstant {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.exception;
|
||||
package com.wonderland.stardewvalley.common.exception;
|
||||
|
||||
/**
|
||||
* 运行时异常封装为业务异常
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.exception;
|
||||
package com.wonderland.stardewvalley.common.exception;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.exception;
|
||||
package com.wonderland.stardewvalley.common.exception;
|
||||
|
||||
/**
|
||||
* 根据条件抛出异常
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.wonderland.stardewvalley.controller;
|
||||
|
||||
import com.wonderland.stardewvalley.ai.ChatUtil;
|
||||
import com.wonderland.stardewvalley.service.ai.ChatUtil;
|
||||
import com.wonderland.stardewvalley.entity.AIChatRequest;
|
||||
import com.wonderland.stardewvalley.entity.BaseResponse;
|
||||
import com.wonderland.stardewvalley.util.ResultUtil;
|
||||
import com.wonderland.stardewvalley.util.response.ResultUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.wonderland.stardewvalley.controller;
|
||||
|
||||
import com.wonderland.stardewvalley.entity.BaseResponse;
|
||||
import com.wonderland.stardewvalley.util.ResultUtil;
|
||||
import com.wonderland.stardewvalley.util.response.ResultUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.wonderland.stardewvalley.controller;
|
||||
|
||||
import com.wonderland.stardewvalley.constant.GuideConstant;
|
||||
import com.wonderland.stardewvalley.common.constant.GuideConstant;
|
||||
import com.wonderland.stardewvalley.entity.BaseResponse;
|
||||
import com.wonderland.stardewvalley.lark.LarkUtil;
|
||||
import com.wonderland.stardewvalley.util.ResultUtil;
|
||||
import com.wonderland.stardewvalley.util.lark.LarkUtil;
|
||||
import com.wonderland.stardewvalley.util.response.ResultUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.wonderland.stardewvalley.entity;
|
||||
|
||||
|
||||
import com.wonderland.stardewvalley.exception.ErrorCode;
|
||||
import com.wonderland.stardewvalley.common.exception.ErrorCode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.ai;
|
||||
package com.wonderland.stardewvalley.service.ai;
|
||||
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.stereotype.Service;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.wonderland.stardewvalley.lark;
|
||||
package com.wonderland.stardewvalley.util.lark;
|
||||
|
||||
import com.lark.oapi.core.utils.Jsons;
|
||||
import com.lark.oapi.event.EventDispatcher;
|
||||
@@ -7,7 +7,7 @@ import com.lark.oapi.service.application.v6.model.P2BotMenuV6;
|
||||
import com.lark.oapi.service.im.ImService;
|
||||
import com.lark.oapi.service.im.v1.model.P2MessageReceiveV1;
|
||||
import com.lark.oapi.ws.Client;
|
||||
import com.wonderland.stardewvalley.constant.LarkConstant;
|
||||
import com.wonderland.stardewvalley.common.constant.LarkConstant;
|
||||
|
||||
public class EventListener {
|
||||
|
||||
+3
-7
@@ -1,8 +1,7 @@
|
||||
package com.wonderland.stardewvalley.lark;
|
||||
package com.wonderland.stardewvalley.util.lark;
|
||||
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.gson.JsonParser;
|
||||
@@ -11,8 +10,8 @@ import com.lark.oapi.core.utils.Jsons;
|
||||
import com.lark.oapi.service.im.v1.model.CreateMessageReq;
|
||||
import com.lark.oapi.service.im.v1.model.CreateMessageReqBody;
|
||||
import com.lark.oapi.service.im.v1.model.CreateMessageResp;
|
||||
import com.wonderland.stardewvalley.ai.ChatUtil;
|
||||
import com.wonderland.stardewvalley.constant.LarkConstant;
|
||||
import com.wonderland.stardewvalley.service.ai.ChatUtil;
|
||||
import com.wonderland.stardewvalley.common.constant.LarkConstant;
|
||||
import com.wonderland.stardewvalley.entity.game.Weather;
|
||||
import com.wonderland.stardewvalley.lark.card.CardTemplate;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -30,9 +29,6 @@ public class LarkUtil {
|
||||
// 复制该 Demo 后, 需要将 "YOUR_APP_ID", "YOUR_APP_SECRET" 替换为自己应用的 APP_ID, APP_SECRET.
|
||||
// 以下示例代码默认根据文档示例值填充,如果存在代码问题,请在 API 调试台填上相关必要参数后再复制代码使用
|
||||
|
||||
@Resource
|
||||
private ChatUtil chatUtil;
|
||||
|
||||
/**
|
||||
* 发送简单的文本消息
|
||||
* @param content 发送的内容
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.wonderland.stardewvalley.util;
|
||||
package com.wonderland.stardewvalley.util.response;
|
||||
|
||||
|
||||
import com.wonderland.stardewvalley.entity.BaseResponse;
|
||||
import com.wonderland.stardewvalley.exception.ErrorCode;
|
||||
import com.wonderland.stardewvalley.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 返回统一的格式
|
||||
+2
-8
@@ -1,19 +1,13 @@
|
||||
package com.wonderland.stardewvalley.util;
|
||||
package com.wonderland.stardewvalley.util.weather;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.wonderland.stardewvalley.ai.ChatUtil;
|
||||
import com.wonderland.stardewvalley.constant.BackGroundConstant;
|
||||
import com.wonderland.stardewvalley.constant.CityCode;
|
||||
import com.wonderland.stardewvalley.common.constant.CityCode;
|
||||
import com.wonderland.stardewvalley.entity.game.Weather;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WeatherUtil {
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.wonderland.stardewvalley.ai;
|
||||
|
||||
import com.wonderland.stardewvalley.constant.BackGroundConstant;
|
||||
import com.wonderland.stardewvalley.common.constant.BackGroundConstant;
|
||||
import com.wonderland.stardewvalley.service.ai.ChatUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
class ChatUtilTest {
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.wonderland.stardewvalley.lark;
|
||||
|
||||
import com.wonderland.stardewvalley.entity.game.Weather;
|
||||
import com.wonderland.stardewvalley.util.WeatherUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import com.wonderland.stardewvalley.util.weather.WeatherUtil;
|
||||
import com.wonderland.stardewvalley.util.lark.LarkUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class LarkUtilTest {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.wonderland.stardewvalley.util;
|
||||
|
||||
import com.wonderland.stardewvalley.entity.game.Weather;
|
||||
import com.wonderland.stardewvalley.util.weather.WeatherUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
class WeatherUtilTest {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user