|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+package com.chinaitop.depot.business.controller;
|
|
|
2
|
+
|
|
|
3
|
+import com.chinaitop.depot.business.model.ReportMonthly;
|
|
|
4
|
+import com.chinaitop.depot.business.model.ReportMonthlyExample;
|
|
|
5
|
+import com.chinaitop.depot.business.service.ReportMonthlyService;
|
|
|
6
|
+import com.chinaitop.depot.utils.ParameterUtil;
|
|
|
7
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
8
|
+import com.github.pagehelper.PageHelper;
|
|
|
9
|
+import com.github.pagehelper.PageInfo;
|
|
|
10
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
11
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
12
|
+import io.swagger.annotations.ApiOperation;
|
|
|
13
|
+import org.springframework.http.MediaType;
|
|
|
14
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
15
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
16
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
17
|
+
|
|
|
18
|
+import javax.annotation.Resource;
|
|
|
19
|
+import java.io.IOException;
|
|
|
20
|
+import java.util.HashMap;
|
|
|
21
|
+import java.util.List;
|
|
|
22
|
+import java.util.Map;
|
|
|
23
|
+
|
|
|
24
|
+@RestController
|
|
|
25
|
+@RequestMapping(value="/reportMonthly")
|
|
|
26
|
+public class ReportMonthlyController {
|
|
|
27
|
+
|
|
|
28
|
+ @Resource
|
|
|
29
|
+ private ReportMonthlyService reportMonthlyService;
|
|
|
30
|
+
|
|
|
31
|
+
|
|
|
32
|
+ /**
|
|
|
33
|
+ * 查找信息
|
|
|
34
|
+ * @return
|
|
|
35
|
+ */
|
|
|
36
|
+ @RequestMapping(value = "/getReportMonthlyList", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
|
|
|
37
|
+ @ApiOperation(value="查询月报表列表", notes = "查询月报表列表,支持分页")
|
|
|
38
|
+ @ApiImplicitParams({
|
|
|
39
|
+ @ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
|
|
|
40
|
+ @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query")
|
|
|
41
|
+
|
|
|
42
|
+ })
|
|
|
43
|
+ public PageInfo<ReportMonthly> getReportMonthlyList(Integer pageNum, Integer pageSize, Integer houseId, Integer type, String searchStartDate, String searchEndDate){
|
|
|
44
|
+ ReportMonthlyExample example = new ReportMonthlyExample();
|
|
|
45
|
+ //ReportMonthlyExample.Criteria criteria = example.createCriteria();
|
|
|
46
|
+ if (pageNum!=null && pageSize!=null) {
|
|
|
47
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
48
|
+ }
|
|
|
49
|
+
|
|
|
50
|
+ List<ReportMonthly> list = reportMonthlyService.queryByExample(example);
|
|
|
51
|
+ PageInfo<ReportMonthly> pageInfo = new PageInfo<ReportMonthly>(list);
|
|
|
52
|
+ return pageInfo;
|
|
|
53
|
+ }
|
|
|
54
|
+
|
|
|
55
|
+ /**
|
|
|
56
|
+ * 获取ById
|
|
|
57
|
+ * @return
|
|
|
58
|
+ */
|
|
|
59
|
+ @RequestMapping(value = "/getReportMonthlyById" ,produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
|
|
|
60
|
+ @ApiOperation(value="获取ById", notes = "获取ById")
|
|
|
61
|
+ @ApiImplicitParams({
|
|
|
62
|
+ @ApiImplicitParam(name = "id", value = "id", paramType = "query"),
|
|
|
63
|
+ })
|
|
|
64
|
+ public ReportMonthly getReportMonthlyById(Integer id){
|
|
|
65
|
+ return reportMonthlyService.findById(id);
|
|
|
66
|
+ }
|
|
|
67
|
+
|
|
|
68
|
+ /**
|
|
|
69
|
+ * 新增
|
|
|
70
|
+ * @param reportMonthlyJson
|
|
|
71
|
+ * @return
|
|
|
72
|
+ */
|
|
|
73
|
+ @RequestMapping(value = "edit" ,produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
|
|
|
74
|
+ @ApiOperation(value="新增数据", notes = "新增数据")
|
|
|
75
|
+ @ApiImplicitParams({
|
|
|
76
|
+ @ApiImplicitParam(name = "paymentJson", value = "JSON数据对象", paramType = "form"),
|
|
|
77
|
+ @ApiImplicitParam(name = "orgId", value = "登陆人id", paramType = "orgId"),
|
|
|
78
|
+ })
|
|
|
79
|
+ public Map<String,String> edit(String reportMonthlyJson,Integer orgId){
|
|
|
80
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
81
|
+ try {
|
|
|
82
|
+ ReportMonthly reportMonthly = (ReportMonthly) mapper.readValue(reportMonthlyJson, ReportMonthly.class);
|
|
|
83
|
+ reportMonthly.setOrgId(orgId);
|
|
|
84
|
+ if(ParameterUtil.isnotnull(reportMonthly.getId())){
|
|
|
85
|
+ reportMonthlyService.update(reportMonthly);
|
|
|
86
|
+ }else{
|
|
|
87
|
+ reportMonthlyService.add(reportMonthly);
|
|
|
88
|
+ }
|
|
|
89
|
+ } catch (IOException e) {
|
|
|
90
|
+ e.printStackTrace();
|
|
|
91
|
+ }
|
|
|
92
|
+ return null;
|
|
|
93
|
+ }
|
|
|
94
|
+
|
|
|
95
|
+ /**
|
|
|
96
|
+ * 移除
|
|
|
97
|
+ * @param id
|
|
|
98
|
+ * @return
|
|
|
99
|
+ */
|
|
|
100
|
+ @RequestMapping(value = "remove", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
|
|
|
101
|
+ @ApiOperation(value="按ID删除信息", notes = "按ID删除信息")
|
|
|
102
|
+ @ApiImplicitParams({
|
|
|
103
|
+ @ApiImplicitParam(name = "id", value = "数据ID", paramType = "form")
|
|
|
104
|
+ })
|
|
|
105
|
+ public Map<String,String> remove(Integer id){
|
|
|
106
|
+ Map<String,String> map = new HashMap<String, String>();
|
|
|
107
|
+ reportMonthlyService.remove(id);
|
|
|
108
|
+ map.put("status","success");
|
|
|
109
|
+ return map;
|
|
|
110
|
+ }
|
|
|
111
|
+
|
|
|
112
|
+}
|