添加接口:测试推送
This commit is contained in:
parent
6341aeecd5
commit
0c3216c6d3
@ -34,6 +34,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
// 所有OPTIONS请求都放行
|
||||
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
||||
.antMatchers("/global/configuration/**").permitAll()
|
||||
.antMatchers("/push/**").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectGlobalConfigDict").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectGlobalConfigValue").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll()
|
||||
|
@ -4,12 +4,11 @@ import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.dao.SysUserDao;
|
||||
import com.xkrs.model.entity.SysUserEntity;
|
||||
import com.xkrs.model.qo.SysUserPushAccountQo;
|
||||
import com.xkrs.sms.PushHelper;
|
||||
import com.xkrs.utils.ListUtils;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
@ -20,6 +19,7 @@ import java.util.Optional;
|
||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/push")
|
||||
public class PushController {
|
||||
|
||||
private final Locale locale = LocaleContextHolder.getLocale();
|
||||
@ -27,8 +27,11 @@ public class PushController {
|
||||
@Resource
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@PostMapping("/bindPushInfo")
|
||||
public String bindPushInfo(@RequestBody SysUserPushAccountQo sysUserPushAccountQo) {
|
||||
@Resource
|
||||
private PushHelper pushHelper;
|
||||
|
||||
@PostMapping("/bindUserPushInfo")
|
||||
public String bindUserPushInfo(@RequestBody SysUserPushAccountQo sysUserPushAccountQo) {
|
||||
Integer id = sysUserPushAccountQo.getId();
|
||||
String userAccount = sysUserPushAccountQo.getUserAccount();
|
||||
String regID = sysUserPushAccountQo.getRegID();
|
||||
@ -69,4 +72,17 @@ public class PushController {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "绑定成功", locale);
|
||||
}
|
||||
|
||||
@GetMapping("/testPush")
|
||||
public String testPush(@RequestParam(value = "userAccount") String userAccount) {
|
||||
//推送
|
||||
try {
|
||||
List<String> userAccountList = new ArrayList<>();
|
||||
userAccountList.add(userAccount);
|
||||
pushHelper.dispatchPushMessage(userAccountList, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "OKK", locale);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user