Преглед изворни кода

周报表上报后端代码的编写

mengy пре 3 година
родитељ
комит
71bc21e75a

+ 1 - 1
src/main/java/com/chinaitop/depot/business/controller/ReportMonthlyController.java

@@ -161,7 +161,7 @@ public class ReportMonthlyController {
161 161
 	 * @return
162 162
 	 */
163 163
 	@RequestMapping(value="/updateMonthlyStatus", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
164
-	@ApiOperation(value="修改计划上报状态", notes = "修改计划上报状态")
164
+	@ApiOperation(value="修改上报状态", notes = "修改上报状态")
165 165
 	@ApiImplicitParams({
166 166
 			@ApiImplicitParam(name = "id", value = "id", paramType = "query"),
167 167
 			@ApiImplicitParam(name = "status", value = "状态", paramType = "query")

+ 82 - 1
src/main/java/com/chinaitop/depot/business/controller/ReportWeeklyController.java

@@ -3,6 +3,7 @@ package com.chinaitop.depot.business.controller;
3 3
 import com.chinaitop.depot.business.model.ReportWeekly;
4 4
 import com.chinaitop.depot.business.model.ReportWeeklyExample;
5 5
 import com.chinaitop.depot.business.service.ReportWeeklyService;
6
+import com.chinaitop.depot.utils.HTTPUtils;
6 7
 import com.chinaitop.depot.utils.ParameterUtil;
7 8
 import com.fasterxml.jackson.databind.ObjectMapper;
8 9
 import com.github.pagehelper.PageHelper;
@@ -10,6 +11,7 @@ import com.github.pagehelper.PageInfo;
10 11
 import io.swagger.annotations.ApiImplicitParam;
11 12
 import io.swagger.annotations.ApiImplicitParams;
12 13
 import io.swagger.annotations.ApiOperation;
14
+import org.springframework.beans.factory.annotation.Value;
13 15
 import org.springframework.http.MediaType;
14 16
 import org.springframework.web.bind.annotation.RequestMapping;
15 17
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
17 19
 
18 20
 import javax.annotation.Resource;
19 21
 import java.io.IOException;
22
+import java.net.URLEncoder;
20 23
 import java.util.HashMap;
21 24
 import java.util.List;
22 25
 import java.util.Map;
@@ -27,7 +30,10 @@ public class ReportWeeklyController {
27 30
 	
28 31
 	@Resource
29 32
 	private ReportWeeklyService reportWeeklyService;
30
-	
33
+
34
+	// 获取ip地址
35
+	@Value("${reportUrlmw}")
36
+	private String reportPath;
31 37
 	
32 38
 	/**
33 39
 	 * 查找信息
@@ -109,4 +115,79 @@ public class ReportWeeklyController {
109 115
 		return map;
110 116
 	}
111 117
 
118
+
119
+	/**
120
+	 *
121
+	 * 上报周报表
122
+	 * @return
123
+	 * @throws Exception
124
+	 */
125
+	@RequestMapping(value="/reportWeeklySave", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
126
+	@ApiOperation(value="周报表列表", notes = "查询数据列表,支持分页")
127
+	@ApiImplicitParams({
128
+			@ApiImplicitParam(name = "reportWeekly", value = "月报表", paramType = "from")
129
+	})
130
+	public Map<String, Object> reportWeeklySave(String reportWeekly) throws Exception {
131
+		// Integer userId = userInfo.getUserId();
132
+		Map<String, Object> modelMap = new HashMap<String, Object>();
133
+		StringBuffer req = new StringBuffer();
134
+		try {
135
+			String mon = URLEncoder.encode(reportWeekly, "UTF-8");
136
+
137
+			String url = reportPath+"/rotation/report/monthly/save";//省平台月报表接口地址
138
+			String count= HTTPUtils.doGet(url+"?reportWeekly="+mon);
139
+			System.out.println("返回值:"+count+"---"+"请求地址:"+url);
140
+			System.out.println("请求地址以及参数:--"+url+"?reportWeekly="+mon);
141
+			if(count.contains("Success") || count.contains("200")){
142
+				modelMap.put("status", "success");
143
+				modelMap.put("msg", "成功!");
144
+			}
145
+		} catch (Exception e){
146
+			// req.append("?data=");
147
+			e.printStackTrace();
148
+			modelMap.put("status", "error");
149
+			modelMap.put("msg", "保存失败!");
150
+		}
151
+
152
+		return modelMap;
153
+	}
154
+
155
+	/**
156
+	 * 上报 修改状态
157
+	 * @param id
158
+	 * @param
159
+	 * @return
160
+	 */
161
+	@RequestMapping(value="/updateWeeklyStatus", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
162
+	@ApiOperation(value="修改上报状态", notes = "修改上报状态")
163
+	@ApiImplicitParams({
164
+			@ApiImplicitParam(name = "id", value = "id", paramType = "query"),
165
+			@ApiImplicitParam(name = "status", value = "状态", paramType = "query")
166
+	})
167
+	public Map<String, Object> updateWeeklyStatus(Integer id,Integer status,String totalQuantity,String enterpriseRemark,String provinceRemark,String sendTime) {
168
+		Map<String, Object> modelMap = new HashMap<String, Object>();
169
+		ReportWeekly week = new ReportWeekly();
170
+		try {
171
+			if(id!=null && status!=null){
172
+				week.setId(id);
173
+				week.setStatus(String.valueOf(status));
174
+				reportWeeklyService.updateWeeklyStatus(week);
175
+				modelMap.put("week", week);
176
+				modelMap.put("status", "success");
177
+			}else{
178
+				throw new RuntimeException("id或status无值");
179
+			}
180
+		} catch (Exception e) {
181
+			// TODO Auto-generated catch block
182
+			e.printStackTrace();
183
+			modelMap.put("status", "error");
184
+			modelMap.put("msg", "保存失败!");
185
+		}
186
+
187
+		return modelMap;
188
+
189
+	}
190
+
191
+
192
+
112 193
 }

+ 1 - 0
src/main/java/com/chinaitop/depot/business/service/ReportWeeklyService.java

@@ -39,4 +39,5 @@ public interface ReportWeeklyService {
39 39
 	 */
40 40
 	void remove(Integer Id);
41 41
 
42
+    void updateWeeklyStatus(ReportWeekly week);
42 43
 }

+ 6 - 0
src/main/java/com/chinaitop/depot/business/service/impl/ReportWeeklyServiceImpl.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.business.service.impl;
2 2
 
3 3
 import com.chinaitop.depot.business.mapper.ReportWeeklyMapper;
4
+import com.chinaitop.depot.business.model.ReportMonthly;
4 5
 import com.chinaitop.depot.business.model.ReportWeekly;
5 6
 import com.chinaitop.depot.business.model.ReportWeeklyExample;
6 7
 import com.chinaitop.depot.business.service.ReportWeeklyService;
@@ -45,4 +46,9 @@ public class ReportWeeklyServiceImpl implements ReportWeeklyService {
45 46
 		reportWeeklyMapper.deleteByPrimaryKey(Id);
46 47
 	}
47 48
 
49
+	@Override
50
+	public void updateWeeklyStatus(ReportWeekly week) {
51
+		// TODO Auto-generated method stub
52
+		reportWeeklyMapper.updateByPrimaryKeySelective(week);
53
+	}
48 54
 }