Commit cb39a12d98a713b5529fefadf875c9f5761bf9e1

Authored by 孙向锦
1 parent 794ac27e

更新api接口头信息

src/com/fh/controller/api/ApiServer.java
... ... @@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
10 10  
11 11 import com.fh.controller.base.BaseController;
12 12 import com.fh.service.sunvote.basestation.BasestationManager;
  13 +import com.fh.service.sunvote.keypad.KeypadManager;
13 14 import com.fh.service.sunvote.school.SchoolManager;
14   -import com.fh.util.Jurisdiction;
15 15 import com.fh.util.PageData;
16   -import com.google.gson.Gson;
17 16  
18 17 @Controller
19 18 @RequestMapping(value="/api")
... ... @@ -25,26 +24,80 @@ public class ApiServer extends BaseController {
25 24 @Resource(name="basestationService")
26 25 private BasestationManager basestationService;
27 26  
  27 + @Resource(name="keypadService")
  28 + private KeypadManager keypadService;
28 29  
29   - @RequestMapping(value="/school" ,produces="application/json;charset=UTF-8")
  30 +
  31 + @RequestMapping(value="/school/list" ,produces="application/json;charset=UTF-8")
30 32 @ResponseBody
31   - public Object school() throws Exception{
  33 + public Object schoolList() throws Exception{
32 34 PageData pd = this.getPageData();
33 35 String id = pd.getString("id");
34 36 if(id != null && !"".equals(id)){
35 37 pd.put("SCHOOL_ID", pd.getString("id"));
36 38 PageData ret = schoolService.findById(pd);
37   - Gson gson = new Gson();
38   - return gson.toJson(ret);
  39 + ResponseGson<PageData> res = new ResponseGson();
  40 + res.setData(ret);
  41 + return res.toJson();
39 42 }else{
40 43 List<PageData> ret = schoolService.listAll(pd);
41   - Gson gson = new Gson();
42   - return gson.toJson(ret);
  44 + ResponseGson<List<PageData>> res = new ResponseGson();
  45 + res.setData(ret);
  46 + return res.toJson();
43 47 }
44   -
  48 + }
  49 + @RequestMapping(value="/school/add" ,produces="application/json;charset=UTF-8")
  50 + @ResponseBody
  51 + public Object schoolAdd() throws Exception{
  52 + PageData pd = this.getPageData();
  53 + ResponseGson<PageData> res = new ResponseGson();
  54 + try {
  55 + if (pd.get("name") != null) {
  56 + schoolService.save(pd);
  57 + res.setData(pd);
  58 + } else {
  59 + res.setDataError();
  60 + }
  61 + }catch(Exception e){
  62 + res.setDataError();
  63 + }
  64 + return res.toJson();
  65 + }
  66 +
  67 + @RequestMapping(value="/school/delete" ,produces="application/json;charset=UTF-8")
  68 + @ResponseBody
  69 + public Object schoolDelete() throws Exception{
  70 + ResponseGson<PageData> res = new ResponseGson();
  71 + PageData pd = this.getPageData();
  72 + String id = pd.getString("id");
  73 + if(id != null && !"".equals(id)){
  74 + pd.put("SCHOOL_ID", pd.getString("id"));
  75 + schoolService.delete(pd);
  76 + res.setData(pd);
  77 + }else{
  78 + res.setDataError();
  79 + }
  80 + return res.toJson();
  81 + }
  82 +
  83 + @RequestMapping(value="/school/update" ,produces="application/json;charset=UTF-8")
  84 + @ResponseBody
  85 + public Object schoolUpdate() throws Exception{
  86 + ResponseGson<PageData> res = new ResponseGson();
  87 + PageData pd = this.getPageData();
  88 + String id = pd.getString("id");
  89 + if(id != null && !"".equals(id)){
  90 + pd.put("SCHOOL_ID", pd.getString("id"));
  91 + schoolService.edit(pd);
  92 + res.setData(pd);
  93 + }else{
  94 + res.setDataError();
  95 + }
  96 + return res.toJson();
45 97 }
46 98  
47   - @RequestMapping(value="/basestation" ,produces="application/json;charset=UTF-8")
  99 +
  100 + @RequestMapping(value="/basestation/list" ,produces="application/json;charset=UTF-8")
48 101 @ResponseBody
49 102 public Object basestation() throws Exception{
50 103 PageData pd = this.getPageData();
... ... @@ -52,12 +105,34 @@ public class ApiServer extends BaseController {
52 105 if(id != null && !"".equals(id)){
53 106 pd.put("BASESTATION_ID", pd.getString("id"));
54 107 PageData ret = basestationService.findById(pd);
55   - Gson gson = new Gson();
56   - return gson.toJson(ret);
  108 + ResponseGson<PageData> res = new ResponseGson();
  109 + res.setData(ret);
  110 + return res.toJson();
57 111 }else{
58 112 List<PageData> ret = basestationService.listAll(pd);
59   - Gson gson = new Gson();
60   - return gson.toJson(ret);
  113 + ResponseGson<List<PageData>> res = new ResponseGson();
  114 + res.setData(ret);
  115 + return res.toJson();
  116 + }
  117 +
  118 + }
  119 +
  120 + @RequestMapping(value="/keypad/list" ,produces="application/json;charset=UTF-8")
  121 + @ResponseBody
  122 + public Object keypad() throws Exception{
  123 + PageData pd = this.getPageData();
  124 + String id = pd.getString("id");
  125 + if(id != null && !"".equals(id)){
  126 + pd.put("KEYPAD_ID", pd.getString("id"));
  127 + PageData ret = keypadService.findById(pd);
  128 + ResponseGson<PageData> res = new ResponseGson();
  129 + res.setData(ret);
  130 + return res.toJson();
  131 + }else{
  132 + List<PageData> ret = keypadService.listAll(pd);
  133 + ResponseGson<List<PageData>> res = new ResponseGson();
  134 + res.setData(ret);
  135 + return res.toJson();
61 136 }
62 137  
63 138 }
... ...
src/com/fh/controller/app/appuser/IntAppuserController.java
... ... @@ -16,7 +16,7 @@ import com.fh.util.PageData;
16 16 import com.fh.util.Tools;
17 17  
18 18  
19   -/**@author FH Q313596790
  19 +/**@author Elvis
20 20 * 会员-接口类
21 21 * 相关参数协议:
22 22 * 00 请求失败
... ...
src/com/fh/controller/app/redis/RedisDemoController.java
... ... @@ -19,7 +19,7 @@ import com.fh.util.AppUtil;
19 19 import com.fh.util.PageData;
20 20  
21 21 /** RedisDemo
22   - * @author FH Q313596790
  22 + * @author Elvis
23 23 * 2016.5.8
24 24 */
25 25 @Controller
... ...
src/com/fh/controller/app/sysuser/SysUserController.java
... ... @@ -21,7 +21,7 @@ import com.fh.util.PageData;
21 21 import com.fh.util.Tools;
22 22  
23 23  
24   -/**@author FH Q313596790
  24 +/**@author Elvis
25 25 * 系统用户-接口类
26 26 * 相关参数协议:
27 27 * 00 请求失败
... ...
src/com/fh/controller/base/BaseController.java
... ... @@ -17,7 +17,7 @@ import com.fh.util.PageData;
17 17 import com.fh.util.UuidUtil;
18 18  
19 19 /**
20   - * @author FH Q313596790
  20 + * @author Elvis
21 21 * 修改时间:2015、12、11
22 22 */
23 23 public class BaseController {
... ...
src/com/fh/controller/dst/datasource2/DataSource2Controller.java
... ... @@ -26,7 +26,7 @@ import com.fh.service.dst.datasource2.DataSource2Manager;
26 26  
27 27 /**
28 28 * 说明:第2数据源例子
29   - * 创建人:FH Q313596790
  29 + * 创建人:Elvis
30 30 * 创建时间:2016-04-29
31 31 */
32 32 @Controller
... ...
src/com/fh/controller/fhdb/brdb/BRdbController.java
... ... @@ -32,7 +32,7 @@ import com.fh.service.fhdb.brdb.BRdbManager;
32 32  
33 33 /**
34 34 * 说明:数据库管理(备份和还原)
35   - * 创建人:FH Q313596790
  35 + * 创建人:Elvis
36 36 * 创建时间:2016-03-30
37 37 */
38 38 @Controller
... ...
src/com/fh/controller/fhdb/sqledit/SQLeditController.java
... ... @@ -26,7 +26,7 @@ import com.fh.util.PageData;
26 26  
27 27 /**
28 28 * 说明:SQL编辑器
29   - * 创建人:FH Q313596790
  29 + * 创建人:Elvis
30 30 * 创建时间:2016-03-30
31 31 */
32 32 @Controller
... ...
src/com/fh/controller/fhdb/timingbackup/TimingBackUpController.java
... ... @@ -32,7 +32,7 @@ import com.fh.service.fhdb.timingbackup.TimingBackUpManager;
32 32  
33 33 /**
34 34 * 说明:定时备份
35   - * 创建人:FH Q313596790
  35 + * 创建人:Elvis
36 36 * 创建时间:2016-04-09
37 37 */
38 38 @Controller
... ...
src/com/fh/controller/fhoa/datajur/DatajurController.java
... ... @@ -25,7 +25,7 @@ import com.fh.service.fhoa.department.DepartmentManager;
25 25  
26 26 /**
27 27 * 说明:组织数据权限表
28   - * 创建人:FH Q313596790
  28 + * 创建人:Elvis
29 29 * 创建时间:2016-04-26
30 30 */
31 31 @Controller
... ...
src/com/fh/controller/fhoa/department/DepartmentController.java
... ... @@ -30,7 +30,7 @@ import com.fh.service.fhoa.department.DepartmentManager;
30 30  
31 31 /**
32 32 * 说明:组织机构
33   - * 创建人:FH Q313596790
  33 + * 创建人:Elvis
34 34 * 创建时间:2015-12-16
35 35 */
36 36 @Controller
... ...
src/com/fh/controller/fhoa/fhfile/FhfileController.java
... ... @@ -35,7 +35,7 @@ import com.fh.service.fhoa.fhfile.FhfileManager;
35 35  
36 36 /**
37 37 * 说明:文件管理
38   - * 创建人:FH Q313596790
  38 + * 创建人:Elvis
39 39 * 创建时间:2016-05-27
40 40 */
41 41 @Controller
... ...
src/com/fh/controller/fhoa/staff/StaffController.java
... ... @@ -34,7 +34,7 @@ import com.fh.service.fhoa.staff.StaffManager;
34 34  
35 35 /**
36 36 * 说明:员工管理
37   - * 创建人:FH Q313596790
  37 + * 创建人:Elvis
38 38 * 创建时间:2016-04-23
39 39 */
40 40 @Controller
... ...
src/com/fh/controller/sunvote/teachingmaterial/TeachingMaterialController.java
... ... @@ -27,7 +27,7 @@ import com.fh.service.sunvote.teachingmaterial.TeachingMaterialManager;
27 27  
28 28 /**
29 29 * 说明:教材
30   - * 创建人:FH Q313596790
  30 + * 创建人:Elvis
31 31 * 创建时间:2018-04-18
32 32 */
33 33 @Controller
... ...
src/com/fh/dao/AbstractBaseRedisDao.java
... ... @@ -7,7 +7,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
7 7  
8 8 /**
9 9 * redis Dao
10   - * @author FH Q313596790
  10 + * @author Elvis
11 11 * 修改时间:2016、5、2
12 12 */
13 13 public abstract class AbstractBaseRedisDao<K, V> {
... ...
src/com/fh/dao/DAO.java
1 1 package com.fh.dao;
2 2 /**
3   - * @author FH Q313596790
  3 + * @author Elvis
4 4 * 修改时间:2015、12、11
5 5 */
6 6 public interface DAO {
... ...
src/com/fh/dao/DaoSupport.java
... ... @@ -10,7 +10,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
10 10 import org.mybatis.spring.SqlSessionTemplate;
11 11 import org.springframework.stereotype.Repository;
12 12 /**
13   - * @author FH Q313596790
  13 + * @author Elvis
14 14 * 修改时间:2015、12、11
15 15 */
16 16 @Repository("daoSupport")
... ...
src/com/fh/dao/redis/RedisDao.java
... ... @@ -7,7 +7,7 @@ import java.util.Set;
7 7  
8 8 /**
9 9 * 说明: redis
10   - * 创建人:FH Q313596790
  10 + * 创建人:Elvis
11 11 * 创建时间:2016-05-2
12 12 * @version
13 13 */
... ...