feat:first commit

This commit is contained in:
Zhujx
2025-06-06 16:01:37 +08:00
commit ec437bb088
55 changed files with 2513 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
spring:
datasource:
url: jdbc:mysql:///xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver

View File

@@ -0,0 +1,6 @@
spring:
datasource:
url: jdbc:mysql://172.28.159.213:3306/xservice-script?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver

View File

@@ -0,0 +1,24 @@
mybatis:
mapper-locations:
- classpath*:mapper/*.xml
configuration:
map-underscore-to-camel-case: true
DingTalk:
# 钉钉消息用户,用逗号隔开
userList: "450841600726084717"
# 钉钉消息群ID需要调用/chat/create api创建群返回
chatId: "chatd16d8daeea33b36b73588c676d508096"
xiaobei:
unionId: o896o5y8bJZYMh2gdKhDdmUKc0Wk
codeArr: "010364, 022150, 013224, 008960, 013841, 015528, 012414, 020412, 014662, 016814, 014422, 015596, 007844,
023521, 016496, 016387, 021608, 008282, 012769, 021580, 017811, 007467, 017516, 018125, 016531, 021091,
021688, 021536, 019571, 168204, 020741, 013594"
server:
port: 8080
spring:
profiles:
active: local

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!-- 应用名称:和统一配置中的项目代码保持一致(小写) -->
<property name="APP_NAME" value="xservice-script"/>
<contextName>${APP_NAME}</contextName>
<!--日志文件保留天数 -->
<property name="LOG_MAX_HISTORY" value="30"/>
<!--应用日志文件保存路径 -->
<!--在没有定义${LOG_HOME}系统变量的时候,可以设置此本地变量。提交测试、上线时,要将其注释掉,使用系统变量。 -->
<property name="LOG_HOME" value="logs/${APP_NAME}"/>
<!--<property name="LOG_HOME" msg="/home/logs/${APP_NAME}" />-->
<!--控制台输出appender-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!--设置输出格式-->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%boldGreen(%contextName): %boldCyan(%d{yyyy-MM-dd HH:mm:ss:SSS}) %highlight([%c]) %boldMagenta([%t]) %boldCyan([%L]) %highlight([traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}]) %boldGreen([%p]) - %msg%n
</pattern>
<!--设置编码-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 按照每天生成日志文件:主项目日志 -->
<appender name="APP_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/debug-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%c类名%t表示线程名%L行 %p日志级别 %msg日志消息%n是换行符 -->
<pattern>%contextName: %d{yyyy-MM-dd HH:mm:ss.SSS} [%c][%t][%L][%p] [traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}] - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成日志文件:主项目日志 -->
<appender name="APP_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/info-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%c类名%t表示线程名%L行 %p日志级别 %msg日志消息%n是换行符 -->
<pattern>%contextName: %d{yyyy-MM-dd HH:mm:ss.SSS} [%c][%t][%L][%p] [traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}] - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 按照每天生成日志文件:主项目日志 -->
<appender name="APP_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/error-%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%c类名%t表示线程名%L行 %p日志级别 %msg日志消息%n是换行符 -->
<pattern>%contextName: %d{yyyy-MM-dd HH:mm:ss.SSS} [%c][%t][%L][%p] [traceId:%X{traceId:-},spanId:%X{spanId:-},localIp:%X{localIp:-}] - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 此日志文件只记录error级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--日志输出到文件-->
<root level="info">
<appender-ref ref="APP_DEBUG"/>
<appender-ref ref="APP_INFO"/>
<appender-ref ref="APP_ERROR"/>
<appender-ref ref="console"/>
</root>
<!-- mybatis 日志级别 -->
<logger name="com.xiang" level="debug"/>
</configuration>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xiang.repository.GladosMapper">
<resultMap id="BaseResultMap" type="com.xiang.entity.pojo.User" >
<result column="id" property="id"/>
<result column="user" property="user" />
<result column="email" property="email" />
<result column="cookie" property="cookie" />
<result column="status" property="status" />
</resultMap>
<sql id="Base_Column_List">
id, user,
email,
cookie,
status
</sql>
<insert id="insertScriptRunLog" keyProperty="id" useGeneratedKeys="true" parameterType="com.xiang.entity.pojo.GladosRunLog">
insert into scirpt_glados_run(time, status, response, user, user_id, code) values (#{time}, #{status}, #{response}, #{user}, #{userId}, #{code})
</insert>
<select id="listAllUser" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM script_glados_user
where status = 1
</select>
</mapper>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xiang.repository.XBFundMapper">
<resultMap id="BaseResultMap" type="com.xiang.entity.pojo.xb.FundInfo" >
<result column="id" property="id"/>
<result column="code" property="code" />
<result column="name" property="name" />
<result column="change" property="change" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="XbFundListMap" type="com.xiang.entity.pojo.xb.XbFundList">
<result column="id" property="id"/>
<result column="code" property="code" />
<result column="name" property="name" />
<result column="status" property="status" />
<result column="type" property="type" />
</resultMap>
<sql id="Base_Column_List">
id, code,
name,
`change`,
update_time
</sql>
<insert id="batchSave">
insert into xb_fund_info(code, name, `change`, update_time) values
<foreach collection="list" item="item" separator=",">
(#{item.code}, #{item.name}, #{item.change}, #{item.updateTime})
</foreach>
</insert>
<insert id="addCounts">
insert into xb_fund_count(l_id, code, name, `change`, update_time) values
<foreach collection="list" item="item" separator=",">
(#{item.lId}, #{item.code}, #{item.name}, #{item.change}, #{item.updateTime})
</foreach>
</insert>
<select id="queryListIn2Min" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from xb_fund_info
where update_time >= NOW() - INTERVAL 3 MINUTE
order by update_time desc
</select>
<select id="queryFundList" resultMap="XbFundListMap" parameterType="Integer">
select * from xb_fund_list
where status = 1
<if test="type != null">
and type = #{type}
</if>
</select>
<select id="queryFundInWeek" resultType="com.xiang.entity.pojo.xb.XbFundCount">
select * from xb_fund_count
where update_time between NOW() - INTERVAL 7 DAY and NOW()
</select>
</mapper>