Commit cb39a12d98a713b5529fefadf875c9f5761bf9e1
1 parent
794ac27e
更新api接口头信息
Showing
18 changed files
with
106 additions
and
31 deletions
src/com/fh/controller/api/ApiServer.java
@@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.ResponseBody; | @@ -10,10 +10,9 @@ import org.springframework.web.bind.annotation.ResponseBody; | ||
10 | 10 | ||
11 | import com.fh.controller.base.BaseController; | 11 | import com.fh.controller.base.BaseController; |
12 | import com.fh.service.sunvote.basestation.BasestationManager; | 12 | import com.fh.service.sunvote.basestation.BasestationManager; |
13 | +import com.fh.service.sunvote.keypad.KeypadManager; | ||
13 | import com.fh.service.sunvote.school.SchoolManager; | 14 | import com.fh.service.sunvote.school.SchoolManager; |
14 | -import com.fh.util.Jurisdiction; | ||
15 | import com.fh.util.PageData; | 15 | import com.fh.util.PageData; |
16 | -import com.google.gson.Gson; | ||
17 | 16 | ||
18 | @Controller | 17 | @Controller |
19 | @RequestMapping(value="/api") | 18 | @RequestMapping(value="/api") |
@@ -25,26 +24,80 @@ public class ApiServer extends BaseController { | @@ -25,26 +24,80 @@ public class ApiServer extends BaseController { | ||
25 | @Resource(name="basestationService") | 24 | @Resource(name="basestationService") |
26 | private BasestationManager basestationService; | 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 | @ResponseBody | 32 | @ResponseBody |
31 | - public Object school() throws Exception{ | 33 | + public Object schoolList() throws Exception{ |
32 | PageData pd = this.getPageData(); | 34 | PageData pd = this.getPageData(); |
33 | String id = pd.getString("id"); | 35 | String id = pd.getString("id"); |
34 | if(id != null && !"".equals(id)){ | 36 | if(id != null && !"".equals(id)){ |
35 | pd.put("SCHOOL_ID", pd.getString("id")); | 37 | pd.put("SCHOOL_ID", pd.getString("id")); |
36 | PageData ret = schoolService.findById(pd); | 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 | }else{ | 42 | }else{ |
40 | List<PageData> ret = schoolService.listAll(pd); | 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 | @ResponseBody | 101 | @ResponseBody |
49 | public Object basestation() throws Exception{ | 102 | public Object basestation() throws Exception{ |
50 | PageData pd = this.getPageData(); | 103 | PageData pd = this.getPageData(); |
@@ -52,12 +105,34 @@ public class ApiServer extends BaseController { | @@ -52,12 +105,34 @@ public class ApiServer extends BaseController { | ||
52 | if(id != null && !"".equals(id)){ | 105 | if(id != null && !"".equals(id)){ |
53 | pd.put("BASESTATION_ID", pd.getString("id")); | 106 | pd.put("BASESTATION_ID", pd.getString("id")); |
54 | PageData ret = basestationService.findById(pd); | 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 | }else{ | 111 | }else{ |
58 | List<PageData> ret = basestationService.listAll(pd); | 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
src/com/fh/controller/app/redis/RedisDemoController.java
@@ -19,7 +19,7 @@ import com.fh.util.AppUtil; | @@ -19,7 +19,7 @@ import com.fh.util.AppUtil; | ||
19 | import com.fh.util.PageData; | 19 | import com.fh.util.PageData; |
20 | 20 | ||
21 | /** RedisDemo | 21 | /** RedisDemo |
22 | - * @author FH Q313596790 | 22 | + * @author Elvis |
23 | * 2016.5.8 | 23 | * 2016.5.8 |
24 | */ | 24 | */ |
25 | @Controller | 25 | @Controller |
src/com/fh/controller/app/sysuser/SysUserController.java
src/com/fh/controller/base/BaseController.java
@@ -17,7 +17,7 @@ import com.fh.util.PageData; | @@ -17,7 +17,7 @@ import com.fh.util.PageData; | ||
17 | import com.fh.util.UuidUtil; | 17 | import com.fh.util.UuidUtil; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | - * @author FH Q313596790 | 20 | + * @author Elvis |
21 | * 修改时间:2015、12、11 | 21 | * 修改时间:2015、12、11 |
22 | */ | 22 | */ |
23 | public class BaseController { | 23 | public class BaseController { |
src/com/fh/controller/dst/datasource2/DataSource2Controller.java
@@ -26,7 +26,7 @@ import com.fh.service.dst.datasource2.DataSource2Manager; | @@ -26,7 +26,7 @@ import com.fh.service.dst.datasource2.DataSource2Manager; | ||
26 | 26 | ||
27 | /** | 27 | /** |
28 | * 说明:第2数据源例子 | 28 | * 说明:第2数据源例子 |
29 | - * 创建人:FH Q313596790 | 29 | + * 创建人:Elvis |
30 | * 创建时间:2016-04-29 | 30 | * 创建时间:2016-04-29 |
31 | */ | 31 | */ |
32 | @Controller | 32 | @Controller |
src/com/fh/controller/fhdb/brdb/BRdbController.java
@@ -32,7 +32,7 @@ import com.fh.service.fhdb.brdb.BRdbManager; | @@ -32,7 +32,7 @@ import com.fh.service.fhdb.brdb.BRdbManager; | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * 说明:数据库管理(备份和还原) | 34 | * 说明:数据库管理(备份和还原) |
35 | - * 创建人:FH Q313596790 | 35 | + * 创建人:Elvis |
36 | * 创建时间:2016-03-30 | 36 | * 创建时间:2016-03-30 |
37 | */ | 37 | */ |
38 | @Controller | 38 | @Controller |
src/com/fh/controller/fhdb/sqledit/SQLeditController.java
src/com/fh/controller/fhdb/timingbackup/TimingBackUpController.java
@@ -32,7 +32,7 @@ import com.fh.service.fhdb.timingbackup.TimingBackUpManager; | @@ -32,7 +32,7 @@ import com.fh.service.fhdb.timingbackup.TimingBackUpManager; | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * 说明:定时备份 | 34 | * 说明:定时备份 |
35 | - * 创建人:FH Q313596790 | 35 | + * 创建人:Elvis |
36 | * 创建时间:2016-04-09 | 36 | * 创建时间:2016-04-09 |
37 | */ | 37 | */ |
38 | @Controller | 38 | @Controller |
src/com/fh/controller/fhoa/datajur/DatajurController.java
@@ -25,7 +25,7 @@ import com.fh.service.fhoa.department.DepartmentManager; | @@ -25,7 +25,7 @@ import com.fh.service.fhoa.department.DepartmentManager; | ||
25 | 25 | ||
26 | /** | 26 | /** |
27 | * 说明:组织数据权限表 | 27 | * 说明:组织数据权限表 |
28 | - * 创建人:FH Q313596790 | 28 | + * 创建人:Elvis |
29 | * 创建时间:2016-04-26 | 29 | * 创建时间:2016-04-26 |
30 | */ | 30 | */ |
31 | @Controller | 31 | @Controller |
src/com/fh/controller/fhoa/department/DepartmentController.java
@@ -30,7 +30,7 @@ import com.fh.service.fhoa.department.DepartmentManager; | @@ -30,7 +30,7 @@ import com.fh.service.fhoa.department.DepartmentManager; | ||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * 说明:组织机构 | 32 | * 说明:组织机构 |
33 | - * 创建人:FH Q313596790 | 33 | + * 创建人:Elvis |
34 | * 创建时间:2015-12-16 | 34 | * 创建时间:2015-12-16 |
35 | */ | 35 | */ |
36 | @Controller | 36 | @Controller |
src/com/fh/controller/fhoa/fhfile/FhfileController.java
@@ -35,7 +35,7 @@ import com.fh.service.fhoa.fhfile.FhfileManager; | @@ -35,7 +35,7 @@ import com.fh.service.fhoa.fhfile.FhfileManager; | ||
35 | 35 | ||
36 | /** | 36 | /** |
37 | * 说明:文件管理 | 37 | * 说明:文件管理 |
38 | - * 创建人:FH Q313596790 | 38 | + * 创建人:Elvis |
39 | * 创建时间:2016-05-27 | 39 | * 创建时间:2016-05-27 |
40 | */ | 40 | */ |
41 | @Controller | 41 | @Controller |
src/com/fh/controller/fhoa/staff/StaffController.java
@@ -34,7 +34,7 @@ import com.fh.service.fhoa.staff.StaffManager; | @@ -34,7 +34,7 @@ import com.fh.service.fhoa.staff.StaffManager; | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * 说明:员工管理 | 36 | * 说明:员工管理 |
37 | - * 创建人:FH Q313596790 | 37 | + * 创建人:Elvis |
38 | * 创建时间:2016-04-23 | 38 | * 创建时间:2016-04-23 |
39 | */ | 39 | */ |
40 | @Controller | 40 | @Controller |
src/com/fh/controller/sunvote/teachingmaterial/TeachingMaterialController.java
@@ -27,7 +27,7 @@ import com.fh.service.sunvote.teachingmaterial.TeachingMaterialManager; | @@ -27,7 +27,7 @@ import com.fh.service.sunvote.teachingmaterial.TeachingMaterialManager; | ||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * 说明:教材 | 29 | * 说明:教材 |
30 | - * 创建人:FH Q313596790 | 30 | + * 创建人:Elvis |
31 | * 创建时间:2018-04-18 | 31 | * 创建时间:2018-04-18 |
32 | */ | 32 | */ |
33 | @Controller | 33 | @Controller |
src/com/fh/dao/AbstractBaseRedisDao.java
@@ -7,7 +7,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; | @@ -7,7 +7,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; | ||
7 | 7 | ||
8 | /** | 8 | /** |
9 | * redis Dao | 9 | * redis Dao |
10 | - * @author FH Q313596790 | 10 | + * @author Elvis |
11 | * 修改时间:2016、5、2 | 11 | * 修改时间:2016、5、2 |
12 | */ | 12 | */ |
13 | public abstract class AbstractBaseRedisDao<K, V> { | 13 | public abstract class AbstractBaseRedisDao<K, V> { |
src/com/fh/dao/DAO.java
src/com/fh/dao/DaoSupport.java
@@ -10,7 +10,7 @@ import org.apache.ibatis.session.SqlSessionFactory; | @@ -10,7 +10,7 @@ import org.apache.ibatis.session.SqlSessionFactory; | ||
10 | import org.mybatis.spring.SqlSessionTemplate; | 10 | import org.mybatis.spring.SqlSessionTemplate; |
11 | import org.springframework.stereotype.Repository; | 11 | import org.springframework.stereotype.Repository; |
12 | /** | 12 | /** |
13 | - * @author FH Q313596790 | 13 | + * @author Elvis |
14 | * 修改时间:2015、12、11 | 14 | * 修改时间:2015、12、11 |
15 | */ | 15 | */ |
16 | @Repository("daoSupport") | 16 | @Repository("daoSupport") |