forked from chanjarster/weixin-java-tools
-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
CP_部门管理
MR-C edited this page Feb 23, 2020
·
3 revisions
WxCpDepart depart = new WxCpDepart();
depart.setName("子部门" + System.currentTimeMillis());
depart.setParentId(1L);
depart.setOrder(1L);
Integer departId = wxCpService.getDepartmentService().create(depart);
Long id = null;
List<WxCpDepart> departList = wxCpService.getDepartmentService().list(id);
以上代码段中的参数id可以为null,当它为null时将获取所有部门,当它有值时将获取该id对应的部门及其子部门
WxCpDepart depart = new WxCpDepart();
// 部门Id必须有值,不能为空
Long departId = getDepartId();
depart.setId(departId);
// 为要修改的字段赋值
depart.setName("子部门改名" + System.currentTimeMillis());
this.wxCpService.getDepartmentService().update(depart);
wxCpService.departDelete(depart.getId());
// 部门Id必须有值,不能为空
Long departId = getDepartId();
this.wxCpService.getDepartmentService().delete(departId);
String encType = request.getParameter("encrypt_type");
String nonce = request.getParameter("nonce");
String timestamp = request.getParameter("timestamp");
String msgSignature = request.getParameter("msg_signature");
String signature = request.getParameter("signature");
String openid = request.getParameter("openid");
log.info("接收微信请求:[openid=[{}], [openid=[{}],[signature=[{}], encType=[{}], msgSignature=[{}],"
+ " timestamp=[{}], nonce=[{}], requestBody=[{}] ",
appid, openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
// 请求里面没有对应信息。 // if (!this.wxMpService.switchover(appid)) { //appid // throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); // }
if (!wxMpService.checkSignature(timestamp, nonce, signature)) {
throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
}
return ResponseEntity.ok("");