Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-notifycenter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 852fe73c
authored
Feb 23, 2022
by
yangll
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
注释掉暂时没有使用的类
1 parent
fe9e7b71
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
40 deletions
src/main/java/cn/com/glsx/notify/modules/api/NotifyApiController.java
src/main/java/cn/com/glsx/notify/modules/service/PCService.java
src/main/java/cn/com/glsx/notify/modules/service/SmsService.java
src/main/java/cn/com/glsx/notify/modules/utils/SmsUtils.java
src/main/java/cn/com/glsx/notify/netty/utils/NettyByteAndStringUtils.java
src/test/java/cn/com/glsx/test/NotifyApplicationTests.java
src/main/java/cn/com/glsx/notify/modules/api/NotifyApiController.java
View file @
852fe73
...
...
@@ -2,12 +2,7 @@ package cn.com.glsx.notify.modules.api;
import
cn.com.glsx.notify.api.NotifyCenterFeignClient
;
import
cn.com.glsx.notify.dto.MailTemplateMessageDTO
;
import
cn.com.glsx.notify.dto.PCTemplateMessageDTO
;
import
cn.com.glsx.notify.dto.SmsTemplateMessageDTO
;
import
cn.com.glsx.notify.dto.WechatTemplateMessageDTO
;
import
cn.com.glsx.notify.modules.service.MailService
;
import
cn.com.glsx.notify.modules.service.PCService
;
import
cn.com.glsx.notify.modules.service.SmsService
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -24,25 +19,25 @@ import java.util.Map;
@RequestMapping
(
value
=
"/api/notify"
)
public
class
NotifyApiController
implements
NotifyCenterFeignClient
{
@Autowired
private
SmsService
smsService
;
/*
@Autowired
private SmsService smsService;
*/
@Autowired
private
MailService
mailService
;
@Autowired
private
PCService
pcService
;
/*
@Autowired
private PCService pcService;
*/
// @Autowired
// private WeixinService weixinService;
@Override
/*
@Override
@PostMapping(value = "/sendSms")
@ResponseBody
public R sendSms(@RequestBody SmsTemplateMessageDTO messageDTO) {
smsService.sendSms(messageDTO.getPhone(), messageDTO.getTemplate(), messageDTO.getArgs().values());
return R.ok();
}
}
*/
@Override
@PostMapping
(
value
=
"/sendMail"
)
...
...
@@ -56,7 +51,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
return
R
.
ok
();
}
@Override
/*
@Override
@PostMapping(value = "/sendPC")
@ResponseBody
public R sendPC(@RequestBody PCTemplateMessageDTO messageDTO) {
...
...
@@ -65,15 +60,15 @@ public class NotifyApiController implements NotifyCenterFeignClient {
// 2020/9/21 kafka消息队列
pcService.sendMessage(messageDTO);
return R.ok();
}
}
*/
@Override
/*
@Override
@PostMapping(value = "/sendWechat")
@ResponseBody
public R sendWechat(@RequestBody WechatTemplateMessageDTO messageDTO) {
//weixinService.push(messageDTO.getAppid(), messageDTO);
return R.ok();
}
}
*/
/**
* 邮件内容自己拼接而成发送邮件
...
...
src/main/java/cn/com/glsx/notify/modules/service/PCService.java
View file @
852fe73
/*
package cn.com.glsx.notify.modules.service;
import cn.com.glsx.notify.dto.PCTemplateMessageDTO;
...
...
@@ -11,9 +12,11 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
import javax.annotation.Resource;
*/
/**
* @author payu
*/
*//*
@Slf4j
@Service
public class PCService {
...
...
@@ -42,3 +45,4 @@ public class PCService {
}
}
*/
src/main/java/cn/com/glsx/notify/modules/service/SmsService.java
View file @
852fe73
/*
package cn.com.glsx.notify.modules.service;
import cn.com.glsx.notify.modules.entity.MessageLog;
...
...
@@ -10,9 +11,11 @@ import org.springframework.stereotype.Service;
import java.text.MessageFormat;
*/
/**
* @author payu
*/
*//*
@Service
public class SmsService {
...
...
@@ -43,3 +46,4 @@ public class SmsService {
}
}
*/
src/main/java/cn/com/glsx/notify/modules/utils/SmsUtils.java
View file @
852fe73
/*
package cn.com.glsx.notify.modules.utils;
import com.alibaba.fastjson.JSONObject;
...
...
@@ -10,9 +11,11 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.TreeMap;
*/
/**
* @author payu
*/
*//*
@Slf4j
@Component("smsUtils")
public class SmsUtils {
...
...
@@ -20,24 +23,28 @@ public class SmsUtils {
@Resource
private SMSProperties properties;
/**
*/
/**
* 短信
*
* @param phone
* @param content
*/
*//*
// @Async
public void send(String phone, String content) {
send(phone, content, properties.getSource());
}
/**
*/
/**
* 短信派单
*
* @param phone
* @param content
* @param source
*/
*//*
// @Async
public void send(String phone, String content, String source) {
...
...
@@ -98,3 +105,4 @@ public class SmsUtils {
// }
}
*/
src/main/java/cn/com/glsx/notify/netty/utils/NettyByteAndStringUtils.java
View file @
852fe73
/*
package cn.com.glsx.notify.netty.utils;
import java.util.concurrent.locks.ReentrantLock;
...
...
@@ -7,9 +8,11 @@ public class NettyByteAndStringUtils {
private final static ReentrantLock Lock = new ReentrantLock();
/**
*/
/**
* byte数组转hex
*/
*//*
public static String byteToHex(byte[] bytes) {
final ReentrantLock putLock = Lock;
putLock.lock();
...
...
@@ -27,9 +30,11 @@ public class NettyByteAndStringUtils {
}
}
/**
*/
/**
* hex转byte数组
*/
*//*
public static byte[] hexToByte(String hex) {
final ReentrantLock putLock = Lock;
putLock.lock();
...
...
@@ -50,9 +55,11 @@ public class NettyByteAndStringUtils {
}
}
/**
*/
/**
* 字节数组的大小
*/
*//*
public static int getByteSize(byte[] bytes) {
final ReentrantLock putLock = Lock;
putLock.lock();
...
...
@@ -73,3 +80,4 @@ public class NettyByteAndStringUtils {
}
}
}
*/
src/test/java/cn/com/glsx/test/NotifyApplicationTests.java
View file @
852fe73
package
cn
.
com
.
glsx
.
test
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.admin.common.constant.Constants
;
import
cn.com.glsx.notify.dto.PCTemplateMessageDTO
;
import
cn.com.glsx.notify.dto.WechatTemplateMessageDTO
;
import
cn.com.glsx.notify.modules.service.MailService
;
import
cn.com.glsx.notify.modules.service.PCService
;
import
cn.com.glsx.notify.modules.service.SmsService
;
import
com.glsx.plat.common.utils.DateUtils
;
import
com.google.common.collect.Maps
;
import
org.assertj.core.util.Lists
;
...
...
@@ -25,24 +21,24 @@ import java.util.Map;
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
NotifyApplicationTests
{
@Autowired
private
SmsService
smsService
;
/*
@Autowired
private SmsService smsService;
*/
@Autowired
private
MailService
mailService
;
@Autowired
private
PCService
pcService
;
/*
@Autowired
private PCService pcService;
*/
// @Autowired
// private WeixinService weixinService;
@Test
/*
@Test
public void testSms() {
Map<String, Object> args = new HashMap<>();
args.put("code", 1234);
smsService.sendSms("18682185876", "SMS_TEMPLATE_VERIFY_CODE", args.values());
}
}
*/
@Test
public
void
testMail
()
throws
Exception
{
...
...
@@ -63,7 +59,7 @@ public class NotifyApplicationTests {
Thread
.
sleep
(
30000
);
}
@Test
/*
@Test
public void testPC() {
PCTemplateMessageDTO templateMessageDTO = PCTemplateMessageDTO.builder()
.application(Constants.SERVER_NAME + "_TOPIC")
...
...
@@ -74,7 +70,7 @@ public class NotifyApplicationTests {
.type(1)
.build();
pcService.sendMessage(templateMessageDTO);
}
}
*/
@Test
public
void
testWeixinSend
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment