publish 0.0.8
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>tiesheng</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-ademo</artifactId>
|
||||
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-web</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.tiesheng.demo.controller;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.message.config.aliyun.AliyunSmsConfig;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.util.config.GlobalConfig;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,6 +21,8 @@ public class TestController {
|
||||
|
||||
@Autowired
|
||||
GlobalConfig globalConfig;
|
||||
@Autowired
|
||||
AliyunSmsConfig aliyunSmsConfig;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@TokenIgnore
|
||||
@@ -31,4 +36,13 @@ public class TestController {
|
||||
globalConfig.redirect("mobile", "/test", response);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/send")
|
||||
@TokenIgnore
|
||||
public ApiResp<MessageReqResp> sendMessage() {
|
||||
MessageReqResp reqResp = aliyunSmsConfig.sendSms("13567116463", "SMS_126361543",
|
||||
JSONUtil.createObj().putOpt("code", "123456"));
|
||||
return ApiResp.respOK(reqResp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,3 +22,7 @@ tiesheng:
|
||||
global:
|
||||
version: 2
|
||||
host: http://localhost:8080
|
||||
aliyun:
|
||||
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
||||
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
||||
sign-name: 智慧校园
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-db-migration</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-encrypt</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-login</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-message</artifactId>
|
||||
@@ -25,6 +25,20 @@
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--阿里云短信登录-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>0.2.8</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>2.0.23</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.tiesheng.message;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@ComponentScan({
|
||||
"com.tiesheng.message.**.*",
|
||||
})
|
||||
public class MessageAutoConfigurer {
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.tiesheng.message.config.aliyun;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.aliyun.dysmsapi20170525.Client;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.aliyun.teaopenapi.models.Config;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "tiesheng.aliyun")
|
||||
public class AliyunSmsConfig {
|
||||
|
||||
@Autowired
|
||||
TieshengMessageConfigurer tieshengMessageConfigurer;
|
||||
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String signName;
|
||||
|
||||
/**
|
||||
* 获取一个短信发送客户端
|
||||
*/
|
||||
private Client getClient() throws Exception {
|
||||
|
||||
Config config = new Config()
|
||||
.setAccessKeyId(getAccessKeyId())
|
||||
.setAccessKeySecret(getAccessKeySecret());
|
||||
config.setEndpoint("dysmsapi.aliyuncs.com");
|
||||
return new Client(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @return 异常说明,为空是表示正常
|
||||
*/
|
||||
public MessageReqResp sendSms(String phones, String templateCode, JSONObject params) {
|
||||
|
||||
MessageReqResp reqResp = new MessageReqResp();
|
||||
reqResp.setTarget(phones);
|
||||
reqResp.setResult(0);
|
||||
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
request.setPhoneNumbers(phones);
|
||||
request.setSignName(getSignName());
|
||||
request.setTemplateCode(templateCode);
|
||||
if (params != null) {
|
||||
request.setTemplateParam(params.toString());
|
||||
}
|
||||
|
||||
reqResp.setContent(JSONUtil.toJsonStr(request));
|
||||
try {
|
||||
SendSmsResponse response = getClient().sendSms(request);
|
||||
reqResp.setRespBody(JSONUtil.toJsonStr(response.body));
|
||||
if (Objects.equals(response.getBody().getCode(), "OK")) {
|
||||
reqResp.setResult(1);
|
||||
} else {
|
||||
reqResp.setToast(response.getBody().getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
reqResp.setToast("未知异常,请稍后再试");
|
||||
}
|
||||
|
||||
tieshengMessageConfigurer.onMessageSend("阿里云短信", reqResp);
|
||||
|
||||
return reqResp;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getAccessKeyId() {
|
||||
return accessKeyId;
|
||||
}
|
||||
|
||||
public void setAccessKeyId(String accessKeyId) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
public String getAccessKeySecret() {
|
||||
return accessKeySecret;
|
||||
}
|
||||
|
||||
public void setAccessKeySecret(String accessKeySecret) {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
public String getSignName() {
|
||||
return signName;
|
||||
}
|
||||
|
||||
public void setSignName(String signName) {
|
||||
this.signName = signName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.tiesheng.message.pojos;
|
||||
|
||||
public class MessageReqResp {
|
||||
|
||||
/**
|
||||
* 发送对象
|
||||
*/
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* 发送内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 返回结果
|
||||
*/
|
||||
private String respBody;
|
||||
|
||||
/**
|
||||
* 结果,0-否,1-是
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
|
||||
/**
|
||||
* 提示的异常信息
|
||||
*/
|
||||
private String toast;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getRespBody() {
|
||||
return respBody;
|
||||
}
|
||||
|
||||
public void setRespBody(String respBody) {
|
||||
this.respBody = respBody;
|
||||
}
|
||||
|
||||
public Integer getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Integer result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getToast() {
|
||||
return toast;
|
||||
}
|
||||
|
||||
public void setToast(String toast) {
|
||||
this.toast = toast;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.tiesheng.message.service;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
public interface TieshengMessageConfigurer {
|
||||
|
||||
|
||||
/**
|
||||
* 消息发送后
|
||||
*
|
||||
* @param reqResp
|
||||
*/
|
||||
default void onMessageSend(String type, MessageReqResp reqResp) {
|
||||
LogFactory.get().info(JSONUtil.toJsonStr(reqResp));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.tiesheng.message.service.impl;
|
||||
|
||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(value = TieshengMessageConfigurer.class, ignored = DefaultMessageConfigurer.class)
|
||||
public class DefaultMessageConfigurer implements TieshengMessageConfigurer {
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-platform</artifactId>
|
||||
|
||||
@@ -233,7 +233,7 @@ public class PlatformDingConfig {
|
||||
|
||||
|
||||
/**
|
||||
* 发送工作通知-
|
||||
* 发送工作通知
|
||||
*
|
||||
* @param service
|
||||
* @param content
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-util</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-parent</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>0.0.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>tiesheng-web</artifactId>
|
||||
@@ -88,6 +88,12 @@
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>tiesheng-message</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.tiesheng.core;
|
||||
|
||||
import com.tiesheng.login.LoginAutoImportSelector;
|
||||
import com.tiesheng.message.MessageAutoConfigurer;
|
||||
import com.tiesheng.migration.MigrationAutoImportSelector;
|
||||
import com.tiesheng.util.UtilAutoConfigurer;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
@@ -16,6 +16,7 @@ import java.lang.annotation.*;
|
||||
@Documented
|
||||
@Import({
|
||||
UtilAutoConfigurer.class,
|
||||
MessageAutoConfigurer.class,
|
||||
CoreAutoImportSelector.class,
|
||||
LoginAutoImportSelector.class,
|
||||
MigrationAutoImportSelector.class
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.tiesheng.login.config.token.bean.TokenBean;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.exception.ApiRespEnum;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -16,7 +15,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*
|
||||
* @author hao
|
||||
*/
|
||||
@Configuration
|
||||
public interface TieshengWebConfigurer {
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.tiesheng.core.controller.log;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
||||
import com.tiesheng.core.service.CoreLogService;
|
||||
@@ -64,4 +66,26 @@ public class LogController {
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/message/page")
|
||||
public ApiResp<List<CoreLogMessage>> messagePage(String result, @Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogMessage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (!StrUtil.isEmpty(result)) {
|
||||
queryWrapper.eq("result", result);
|
||||
}
|
||||
dto.likeColumns(queryWrapper, "type", "target", "content", "resp_body");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogMessage> page = dto.pageObj();
|
||||
coreLogService.getLogMessageMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||
|
||||
public interface CoreLogMessageMapper extends BaseMapper<CoreLogMessage> {
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日志-消息
|
||||
*/
|
||||
@TableName(value = "core_log_message")
|
||||
public class CoreLogMessage extends DaoBase {
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 发送对象
|
||||
*/
|
||||
@TableField(value = "target")
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* 发送内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 返回结果
|
||||
*/
|
||||
@TableField(value = "resp_body")
|
||||
private String respBody;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
@TableField(value = "`result`")
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
*
|
||||
* @return type - 类型
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置类型
|
||||
*
|
||||
* @param type 类型
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发送对象
|
||||
*
|
||||
* @return target - 发送对象
|
||||
*/
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置发送对象
|
||||
*
|
||||
* @param target 发送对象
|
||||
*/
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发送内容
|
||||
*
|
||||
* @return content - 发送内容
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置发送内容
|
||||
*
|
||||
* @param content 发送内容
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取返回结果
|
||||
*
|
||||
* @return resp_body - 返回结果
|
||||
*/
|
||||
public String getRespBody() {
|
||||
return respBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置返回结果
|
||||
*
|
||||
* @param respBody 返回结果
|
||||
*/
|
||||
public void setRespBody(String respBody) {
|
||||
this.respBody = respBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结果
|
||||
*
|
||||
* @return result - 结果
|
||||
*/
|
||||
public Integer getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置结果
|
||||
*
|
||||
* @param result 结果
|
||||
*/
|
||||
public void setResult(Integer result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.core.config.web.TieshengWebConfigurer;
|
||||
import com.tiesheng.core.config.web.bean.CurrentWebUser;
|
||||
import com.tiesheng.core.mapper.CoreLogLoginMapper;
|
||||
import com.tiesheng.core.mapper.CoreLogMessageMapper;
|
||||
import com.tiesheng.core.mapper.CoreLogOperationMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
||||
import com.tiesheng.util.ServletKit;
|
||||
import com.tiesheng.util.ip2region.DataBlock;
|
||||
import com.tiesheng.util.ip2region.Ip2Region;
|
||||
@@ -21,17 +26,23 @@ import javax.servlet.http.HttpServletRequest;
|
||||
* @author hao
|
||||
*/
|
||||
@Service
|
||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> implements TieshengMessageConfigurer {
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
@Autowired
|
||||
CoreLogLoginMapper coreLogLoginMapper;
|
||||
@Autowired
|
||||
CoreLogMessageMapper coreLogMessageMapper;
|
||||
|
||||
public CoreLogLoginMapper getLogLoginMapper() {
|
||||
return coreLogLoginMapper;
|
||||
}
|
||||
|
||||
public CoreLogMessageMapper getLogMessageMapper() {
|
||||
return coreLogMessageMapper;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 操作日志
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -82,4 +93,21 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 消息日志
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 添加消息日志
|
||||
*
|
||||
* @param type
|
||||
* @param reqResp
|
||||
*/
|
||||
@Override
|
||||
public void onMessageSend(String type, MessageReqResp reqResp) {
|
||||
CoreLogMessage coreLogMessage = BeanUtil.copyProperties(reqResp, CoreLogMessage.class);
|
||||
coreLogMessage.setType(type);
|
||||
coreLogMessageMapper.insert(coreLogMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tiesheng.core.config.web.TieshengWebConfigurer;
|
||||
import com.tiesheng.core.mapper.CorePlatformUniqueMapper;
|
||||
@@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
@@ -68,4 +70,24 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
||||
return platformUnique;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过平台和用户id查询
|
||||
*
|
||||
* @param platform
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
private List<CorePlatformUnique> getByPlatformAndUser(String platform, List<String> userIds) {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
|
||||
QueryWrapper<CorePlatformUnique> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("user_id", userIds);
|
||||
queryWrapper.eq("platform", platform);
|
||||
queryWrapper.last("limit 1");
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for core_log_message
|
||||
-- ----------------------------
|
||||
CREATE TABLE `core_log_message`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '类型',
|
||||
`target` varchar(255) DEFAULT NULL COMMENT '发送对象',
|
||||
`content` text COMMENT '发送内容',
|
||||
`resp_body` text COMMENT '返回结果',
|
||||
`result` int(6) NOT NULL DEFAULT '0' COMMENT '结果',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
ROW_FORMAT = DYNAMIC COMMENT ='日志-消息';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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.tiesheng.core.mapper.CoreLogMessageMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreLogMessage">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_log_message-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="target" jdbcType="VARCHAR" property="target" />
|
||||
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
||||
<result column="resp_body" jdbcType="LONGVARCHAR" property="respBody" />
|
||||
<result column="result" jdbcType="INTEGER" property="result" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, `type`, target, content, resp_body, `result`
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user