微信实现
This commit is contained in:
parent
78eddfc9d1
commit
b99a19fc44
|
|
@ -82,6 +82,19 @@ public class AjaxResult extends HashMap<String, Object>
|
||||||
json.put("data", object);
|
json.put("data", object);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 返回成功消息
|
||||||
|
*
|
||||||
|
* @return 成功消息
|
||||||
|
*/
|
||||||
|
public static AjaxResult success(Object object,String msg)
|
||||||
|
{
|
||||||
|
AjaxResult json = new AjaxResult();
|
||||||
|
json.put("msg", msg);
|
||||||
|
json.put("code", Constants.SUCCESS);
|
||||||
|
json.put("data", object);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 返回成功消息
|
* 返回成功消息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,12 @@
|
||||||
<artifactId>weixin-java-cp</artifactId>
|
<artifactId>weixin-java-cp</artifactId>
|
||||||
<version>${weixin-java-cp.version}</version>
|
<version>${weixin-java-cp.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 通用工具-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-framework</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
package com.ruoyi.wx.cp;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Binary Wang(https://github.com/binarywang)
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
public class WxCpDemoApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(WxCpDemoApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.ruoyi.wx.cp.controller;
|
package com.ruoyi.wx.cp.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.wx.cp.config.WxCpConfiguration;
|
import com.ruoyi.wx.cp.config.WxCpConfiguration;
|
||||||
import com.ruoyi.wx.cp.config.WxCpProperties;
|
import com.ruoyi.wx.cp.config.WxCpProperties;
|
||||||
import com.ruoyi.wx.cp.utils.JsonUtils;
|
import com.ruoyi.wx.cp.utils.JsonUtils;
|
||||||
|
|
@ -32,41 +35,42 @@ public class WxUserGroupController {
|
||||||
|
|
||||||
private WxCpProperties properties;
|
private WxCpProperties properties;
|
||||||
|
|
||||||
|
@Log(title = "上传文件", businessType = BusinessType.INSERT)
|
||||||
@GetMapping("/departAllList")
|
@GetMapping("/departAllList")
|
||||||
public List<WxCpDepart> departAllList() {
|
public AjaxResult departAllList() {
|
||||||
this.logger.info("\n获取组织机构");
|
this.logger.info("\n获取组织机构");
|
||||||
try {
|
try {
|
||||||
final WxCpService wxCpService = WxCpConfiguration.getCpService(999999);
|
final WxCpService wxCpService = WxCpConfiguration.getCpService(999999);
|
||||||
WxCpDepartmentService departmentService = wxCpService.getDepartmentService();
|
WxCpDepartmentService departmentService = wxCpService.getDepartmentService();
|
||||||
List<WxCpDepart> list = departmentService.list(null);
|
List<WxCpDepart> list = departmentService.list(null);
|
||||||
return list;
|
return AjaxResult.success(list,"获取组织机构成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.logger.info("\n获取组织机构出错" + e.getMessage());
|
this.logger.info("\n获取组织机构出错" + e.getMessage());
|
||||||
|
return AjaxResult.error("获取组织机构出错");
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/insert")
|
@GetMapping("/insert")
|
||||||
public Object insert(WxCpDepart wxCpDepart) {
|
public AjaxResult insert(WxCpDepart wxCpDepart) {
|
||||||
this.logger.info("\n获取组织机构");
|
this.logger.info("新增组织机构");
|
||||||
try {
|
try {
|
||||||
WxCpDepartmentService departmentService = WxCpConfiguration.getCpService(999999).getDepartmentService();
|
WxCpDepartmentService departmentService = WxCpConfiguration.getCpService(999999).getDepartmentService();
|
||||||
Integer integer = departmentService.create(wxCpDepart);
|
Integer id = departmentService.create(wxCpDepart);
|
||||||
return integer;
|
return AjaxResult.success(id,"新增组织机构成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.logger.info("\n获取组织机构出错" + e.getMessage());
|
this.logger.info("\n新增组织机构" + e.getMessage());
|
||||||
|
return AjaxResult.error("新增组织机构出错");
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/update")
|
@GetMapping("/update")
|
||||||
public List<WxCpDepart> update() {
|
public AjaxResult update(WxCpDepart wxCpDepart) {
|
||||||
this.logger.info("\n获取组织机构");
|
this.logger.info("\n获取组织机构");
|
||||||
try {
|
try {
|
||||||
final WxCpService wxCpService = WxCpConfiguration.getCpService(999999);
|
WxCpDepartmentService departmentService = WxCpConfiguration.getCpService(999999).getDepartmentService();
|
||||||
WxCpDepartmentService departmentService = wxCpService.getDepartmentService();
|
|
||||||
List<WxCpDepart> list = departmentService.list(null);
|
departmentService.update(wxCpDepart);
|
||||||
return list;
|
return AjaxResult.success("更新组织机构成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.logger.info("\n获取组织机构出错" + e.getMessage());
|
this.logger.info("\n获取组织机构出错" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -74,15 +78,14 @@ public class WxUserGroupController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/delete")
|
@GetMapping("/delete")
|
||||||
public List<WxCpDepart> delete() {
|
public AjaxResult delete(Long id) {
|
||||||
this.logger.info("\n获取组织机构");
|
this.logger.info("\n获取组织机构");
|
||||||
try {
|
try {
|
||||||
final WxCpService wxCpService = WxCpConfiguration.getCpService(999999);
|
WxCpDepartmentService departmentService = WxCpConfiguration.getCpService(999999).getDepartmentService();
|
||||||
WxCpDepartmentService departmentService = wxCpService.getDepartmentService();
|
departmentService.delete(id);
|
||||||
List<WxCpDepart> list = departmentService.list(null);
|
return AjaxResult.success("删除组织机构成功");
|
||||||
return list;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.logger.info("\n获取组织机构出错" + e.getMessage());
|
this.logger.info("\n删除组织机构出错" + e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue