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
Show 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;
...
@@ -2,12 +2,7 @@ package cn.com.glsx.notify.modules.api;
import
cn.com.glsx.notify.api.NotifyCenterFeignClient
;
import
cn.com.glsx.notify.api.NotifyCenterFeignClient
;
import
cn.com.glsx.notify.dto.MailTemplateMessageDTO
;
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.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
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -24,25 +19,25 @@ import java.util.Map;
...
@@ -24,25 +19,25 @@ import java.util.Map;
@RequestMapping
(
value
=
"/api/notify"
)
@RequestMapping
(
value
=
"/api/notify"
)
public
class
NotifyApiController
implements
NotifyCenterFeignClient
{
public
class
NotifyApiController
implements
NotifyCenterFeignClient
{
@Autowired
/*
@Autowired
private
SmsService
smsService
;
private SmsService smsService;
*/
@Autowired
@Autowired
private
MailService
mailService
;
private
MailService
mailService
;
@Autowired
/*
@Autowired
private
PCService
pcService
;
private PCService pcService;
*/
// @Autowired
// @Autowired
// private WeixinService weixinService;
// private WeixinService weixinService;
@Override
/*
@Override
@PostMapping(value = "/sendSms")
@PostMapping(value = "/sendSms")
@ResponseBody
@ResponseBody
public R sendSms(@RequestBody SmsTemplateMessageDTO messageDTO) {
public R sendSms(@RequestBody SmsTemplateMessageDTO messageDTO) {
smsService.sendSms(messageDTO.getPhone(), messageDTO.getTemplate(), messageDTO.getArgs().values());
smsService.sendSms(messageDTO.getPhone(), messageDTO.getTemplate(), messageDTO.getArgs().values());
return R.ok();
return R.ok();
}
}
*/
@Override
@Override
@PostMapping
(
value
=
"/sendMail"
)
@PostMapping
(
value
=
"/sendMail"
)
...
@@ -56,7 +51,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
...
@@ -56,7 +51,7 @@ public class NotifyApiController implements NotifyCenterFeignClient {
return
R
.
ok
();
return
R
.
ok
();
}
}
@Override
/*
@Override
@PostMapping(value = "/sendPC")
@PostMapping(value = "/sendPC")
@ResponseBody
@ResponseBody
public R sendPC(@RequestBody PCTemplateMessageDTO messageDTO) {
public R sendPC(@RequestBody PCTemplateMessageDTO messageDTO) {
...
@@ -65,15 +60,15 @@ public class NotifyApiController implements NotifyCenterFeignClient {
...
@@ -65,15 +60,15 @@ public class NotifyApiController implements NotifyCenterFeignClient {
// 2020/9/21 kafka消息队列
// 2020/9/21 kafka消息队列
pcService.sendMessage(messageDTO);
pcService.sendMessage(messageDTO);
return R.ok();
return R.ok();
}
}
*/
@Override
/*
@Override
@PostMapping(value = "/sendWechat")
@PostMapping(value = "/sendWechat")
@ResponseBody
@ResponseBody
public R sendWechat(@RequestBody WechatTemplateMessageDTO messageDTO) {
public R sendWechat(@RequestBody WechatTemplateMessageDTO messageDTO) {
//weixinService.push(messageDTO.getAppid(), messageDTO);
//weixinService.push(messageDTO.getAppid(), messageDTO);
return R.ok();
return R.ok();
}
}
*/
/**
/**
* 邮件内容自己拼接而成发送邮件
* 邮件内容自己拼接而成发送邮件
...
...
src/main/java/cn/com/glsx/notify/modules/service/PCService.java
View file @
852fe73
/*
package cn.com.glsx.notify.modules.service;
package cn.com.glsx.notify.modules.service;
import cn.com.glsx.notify.dto.PCTemplateMessageDTO;
import cn.com.glsx.notify.dto.PCTemplateMessageDTO;
...
@@ -11,9 +12,11 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
...
@@ -11,9 +12,11 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
import javax.annotation.Resource;
import javax.annotation.Resource;
*/
/**
/**
* @author payu
* @author payu
*/
*//*
@Slf4j
@Slf4j
@Service
@Service
public class PCService {
public class PCService {
...
@@ -42,3 +45,4 @@ 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;
package cn.com.glsx.notify.modules.service;
import cn.com.glsx.notify.modules.entity.MessageLog;
import cn.com.glsx.notify.modules.entity.MessageLog;
...
@@ -10,9 +11,11 @@ import org.springframework.stereotype.Service;
...
@@ -10,9 +11,11 @@ import org.springframework.stereotype.Service;
import java.text.MessageFormat;
import java.text.MessageFormat;
*/
/**
/**
* @author payu
* @author payu
*/
*//*
@Service
@Service
public class SmsService {
public class SmsService {
...
@@ -43,3 +46,4 @@ 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;
package cn.com.glsx.notify.modules.utils;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
...
@@ -10,9 +11,11 @@ import org.springframework.stereotype.Component;
...
@@ -10,9 +11,11 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.annotation.Resource;
import java.util.TreeMap;
import java.util.TreeMap;
*/
/**
/**
* @author payu
* @author payu
*/
*//*
@Slf4j
@Slf4j
@Component("smsUtils")
@Component("smsUtils")
public class SmsUtils {
public class SmsUtils {
...
@@ -20,24 +23,28 @@ public class SmsUtils {
...
@@ -20,24 +23,28 @@ public class SmsUtils {
@Resource
@Resource
private SMSProperties properties;
private SMSProperties properties;
/**
*/
/**
* 短信
* 短信
*
*
* @param phone
* @param phone
* @param content
* @param content
*/
*//*
// @Async
// @Async
public void send(String phone, String content) {
public void send(String phone, String content) {
send(phone, content, properties.getSource());
send(phone, content, properties.getSource());
}
}
/**
*/
/**
* 短信派单
* 短信派单
*
*
* @param phone
* @param phone
* @param content
* @param content
* @param source
* @param source
*/
*//*
// @Async
// @Async
public void send(String phone, String content, String source) {
public void send(String phone, String content, String source) {
...
@@ -98,3 +105,4 @@ public class SmsUtils {
...
@@ -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;
package cn.com.glsx.notify.netty.utils;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantLock;
...
@@ -7,9 +8,11 @@ public class NettyByteAndStringUtils {
...
@@ -7,9 +8,11 @@ public class NettyByteAndStringUtils {
private final static ReentrantLock Lock = new ReentrantLock();
private final static ReentrantLock Lock = new ReentrantLock();
/**
* byte数组转hex
*/
*/
/**
* byte数组转hex
*//*
public static String byteToHex(byte[] bytes) {
public static String byteToHex(byte[] bytes) {
final ReentrantLock putLock = Lock;
final ReentrantLock putLock = Lock;
putLock.lock();
putLock.lock();
...
@@ -27,9 +30,11 @@ public class NettyByteAndStringUtils {
...
@@ -27,9 +30,11 @@ public class NettyByteAndStringUtils {
}
}
}
}
/**
* hex转byte数组
*/
*/
/**
* hex转byte数组
*//*
public static byte[] hexToByte(String hex) {
public static byte[] hexToByte(String hex) {
final ReentrantLock putLock = Lock;
final ReentrantLock putLock = Lock;
putLock.lock();
putLock.lock();
...
@@ -50,9 +55,11 @@ public class NettyByteAndStringUtils {
...
@@ -50,9 +55,11 @@ public class NettyByteAndStringUtils {
}
}
}
}
/**
* 字节数组的大小
*/
*/
/**
* 字节数组的大小
*//*
public static int getByteSize(byte[] bytes) {
public static int getByteSize(byte[] bytes) {
final ReentrantLock putLock = Lock;
final ReentrantLock putLock = Lock;
putLock.lock();
putLock.lock();
...
@@ -73,3 +80,4 @@ public class NettyByteAndStringUtils {
...
@@ -73,3 +80,4 @@ public class NettyByteAndStringUtils {
}
}
}
}
}
}
*/
src/test/java/cn/com/glsx/test/NotifyApplicationTests.java
View file @
852fe73
package
cn
.
com
.
glsx
.
test
;
package
cn
.
com
.
glsx
.
test
;
import
cn.com.glsx.Application
;
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.dto.WechatTemplateMessageDTO
;
import
cn.com.glsx.notify.modules.service.MailService
;
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.glsx.plat.common.utils.DateUtils
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
org.assertj.core.util.Lists
;
import
org.assertj.core.util.Lists
;
...
@@ -25,24 +21,24 @@ import java.util.Map;
...
@@ -25,24 +21,24 @@ import java.util.Map;
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
(
classes
=
Application
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
public
class
NotifyApplicationTests
{
public
class
NotifyApplicationTests
{
@Autowired
/*
@Autowired
private
SmsService
smsService
;
private SmsService smsService;
*/
@Autowired
@Autowired
private
MailService
mailService
;
private
MailService
mailService
;
@Autowired
/*
@Autowired
private
PCService
pcService
;
private PCService pcService;
*/
// @Autowired
// @Autowired
// private WeixinService weixinService;
// private WeixinService weixinService;
@Test
/*
@Test
public void testSms() {
public void testSms() {
Map<String, Object> args = new HashMap<>();
Map<String, Object> args = new HashMap<>();
args.put("code", 1234);
args.put("code", 1234);
smsService.sendSms("18682185876", "SMS_TEMPLATE_VERIFY_CODE", args.values());
smsService.sendSms("18682185876", "SMS_TEMPLATE_VERIFY_CODE", args.values());
}
}
*/
@Test
@Test
public
void
testMail
()
throws
Exception
{
public
void
testMail
()
throws
Exception
{
...
@@ -63,7 +59,7 @@ public class NotifyApplicationTests {
...
@@ -63,7 +59,7 @@ public class NotifyApplicationTests {
Thread
.
sleep
(
30000
);
Thread
.
sleep
(
30000
);
}
}
@Test
/*
@Test
public void testPC() {
public void testPC() {
PCTemplateMessageDTO templateMessageDTO = PCTemplateMessageDTO.builder()
PCTemplateMessageDTO templateMessageDTO = PCTemplateMessageDTO.builder()
.application(Constants.SERVER_NAME + "_TOPIC")
.application(Constants.SERVER_NAME + "_TOPIC")
...
@@ -74,7 +70,7 @@ public class NotifyApplicationTests {
...
@@ -74,7 +70,7 @@ public class NotifyApplicationTests {
.type(1)
.type(1)
.build();
.build();
pcService.sendMessage(templateMessageDTO);
pcService.sendMessage(templateMessageDTO);
}
}
*/
@Test
@Test
public
void
testWeixinSend
()
{
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