|
@@ -4,6 +4,7 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -78,51 +79,40 @@ public class SysMessageController extends BaseController {
|
|
if (sysUser == null) {
|
|
if (sysUser == null) {
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
}
|
|
}
|
|
- return succeed(sysMessageService.queryCountOfUnread(MessageSendMode.PUSH, sysUser.getId()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /*@ApiOperation(value = "发送短信验证码")
|
|
|
|
- @PostMapping("/sendSmsCode")
|
|
|
|
- public Object sendSmsCode(String sendCodeType, String mobileNo) {
|
|
|
|
-
|
|
|
|
- SysUser sysUser;
|
|
|
|
|
|
+ Map<String, Integer> map = sysMessageService.queryCountOfUnread(MessageSendMode.PUSH, sysUser.getId());
|
|
|
|
|
|
- if (StringUtils.isBlank(mobileNo)) {
|
|
|
|
- sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- } else {
|
|
|
|
- sysUser = sysUserFeignService.queryUserByMobile(mobileNo);
|
|
|
|
- }
|
|
|
|
- if (sysUser == null) {
|
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
|
|
|
+ if (map == null || map.size() == 0) {
|
|
|
|
+ return succeed();
|
|
}
|
|
}
|
|
- Integer userId = sysUser.getId();
|
|
|
|
-
|
|
|
|
- mobileNo = sysUser.getPhone();
|
|
|
|
|
|
+ return succeed(map);
|
|
|
|
+ }
|
|
|
|
|
|
- MessageType messageType = MessageType.getMessageType(sendCodeType);
|
|
|
|
- if (messageType == null) {
|
|
|
|
- throw new BizException("消息类型参数错误");
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isBlank(mobileNo) || !CommonValidator.isMobileNo(mobileNo)) {
|
|
|
|
- throw new BizException("请输入正确的手机号");
|
|
|
|
- }
|
|
|
|
- sysMessageService.sendSecurityCode(MessageSender.YIMEI, userId, MessageSendMode.SMS, messageType, mobileNo);
|
|
|
|
- return succeed();
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- /*@ApiOperation(value = "发送短信验证码")
|
|
|
|
- @PostMapping("/noAuth/sendSmsCode")
|
|
|
|
- public Object noAuthSendSmsCode(String sendCodeType, String mobileNo) {
|
|
|
|
- MessageType messageType = MessageType.getMessageType(sendCodeType);
|
|
|
|
- if (messageType == null) {
|
|
|
|
- throw new BizException("消息类型参数错误");
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isBlank(mobileNo) || !CommonValidator.isMobileNo(mobileNo)) {
|
|
|
|
- throw new BizException("请输入正确的手机号");
|
|
|
|
- }
|
|
|
|
-// sysMessageService.sendSecurityCode(MessageSender.YIMEI, userId, MessageSendMode.SMS, messageType, mobileNo);
|
|
|
|
- return succeed();
|
|
|
|
- }*/
|
|
|
|
|
|
+ /*
|
|
|
|
+ * @ApiOperation(value = "发送短信验证码")
|
|
|
|
+ *
|
|
|
|
+ * @PostMapping("/sendSmsCode") public Object sendSmsCode(String sendCodeType, String mobileNo) {
|
|
|
|
+ *
|
|
|
|
+ * SysUser sysUser;
|
|
|
|
+ *
|
|
|
|
+ * if (StringUtils.isBlank(mobileNo)) { sysUser = sysUserFeignService.queryUserInfo(); } else { sysUser =
|
|
|
|
+ * sysUserFeignService.queryUserByMobile(mobileNo); } if (sysUser == null) { return failed(HttpStatus.FORBIDDEN, "请登录"); } Integer userId =
|
|
|
|
+ * sysUser.getId();
|
|
|
|
+ *
|
|
|
|
+ * mobileNo = sysUser.getPhone();
|
|
|
|
+ *
|
|
|
|
+ * MessageType messageType = MessageType.getMessageType(sendCodeType); if (messageType == null) { throw new BizException("消息类型参数错误"); } if
|
|
|
|
+ * (StringUtils.isBlank(mobileNo) || !CommonValidator.isMobileNo(mobileNo)) { throw new BizException("请输入正确的手机号"); }
|
|
|
|
+ * sysMessageService.sendSecurityCode(MessageSender.YIMEI, userId, MessageSendMode.SMS, messageType, mobileNo); return succeed(); }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * @ApiOperation(value = "发送短信验证码")
|
|
|
|
+ *
|
|
|
|
+ * @PostMapping("/noAuth/sendSmsCode") public Object noAuthSendSmsCode(String sendCodeType, String mobileNo) { MessageType messageType =
|
|
|
|
+ * MessageType.getMessageType(sendCodeType); if (messageType == null) { throw new BizException("消息类型参数错误"); } if (StringUtils.isBlank(mobileNo) ||
|
|
|
|
+ * !CommonValidator.isMobileNo(mobileNo)) { throw new BizException("请输入正确的手机号"); } // sysMessageService.sendSecurityCode(MessageSender.YIMEI,
|
|
|
|
+ * userId, MessageSendMode.SMS, messageType, mobileNo); return succeed(); }
|
|
|
|
+ */
|
|
|
|
|
|
@ApiOperation(value = "发送消息")
|
|
@ApiOperation(value = "发送消息")
|
|
@PostMapping("/sendMessage")
|
|
@PostMapping("/sendMessage")
|