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

月报表周报表新增查询条件

mengy пре 3 година
родитељ
комит
66ee8e0491

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

@@ -12,6 +12,7 @@ import com.github.pagehelper.PageInfo;
12 12
 import io.swagger.annotations.ApiImplicitParam;
13 13
 import io.swagger.annotations.ApiImplicitParams;
14 14
 import io.swagger.annotations.ApiOperation;
15
+import org.apache.commons.lang3.StringUtils;
15 16
 import org.springframework.beans.factory.annotation.Value;
16 17
 import org.springframework.http.MediaType;
17 18
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -19,8 +20,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
19 20
 import org.springframework.web.bind.annotation.RestController;
20 21
 
21 22
 import javax.annotation.Resource;
23
+import javax.servlet.http.HttpServletRequest;
22 24
 import java.io.IOException;
23 25
 import java.net.URLEncoder;
26
+import java.util.Date;
24 27
 import java.util.HashMap;
25 28
 import java.util.List;
26 29
 import java.util.Map;
@@ -44,17 +47,31 @@ public class ReportMonthlyController {
44 47
 	@ApiOperation(value="查询月报表列表", notes = "查询月报表列表,支持分页")
45 48
 	@ApiImplicitParams({
46 49
 			@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
47
-			@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query")
50
+			@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
51
+			@ApiImplicitParam(name = "reportPeriod", value = "月", paramType = "query"),
52
+			@ApiImplicitParam(name = "status", value = "状态", paramType = "query"),
53
+			@ApiImplicitParam(name = "filledTime", value = "填报日期", paramType = "query")
48 54
 
49 55
 	})
50
-	public PageInfo<ReportMonthly> getReportMonthlyList(Integer pageNum, Integer pageSize, Integer houseId, Integer type, String searchStartDate, String searchEndDate){
51
-		ReportMonthlyExample example = new ReportMonthlyExample();
52
-		//ReportMonthlyExample.Criteria criteria = example.createCriteria();
56
+	public PageInfo<ReportMonthly> getReportMonthlyList(HttpServletRequest request, Integer pageNum, Integer pageSize, String reportPeriod, String status, String filledTime){
57
+		ReportMonthly record = new ReportMonthly();
58
+
59
+		if (StringUtils.isNotBlank(status)){
60
+			record.setStatus(status);
61
+		}
62
+		if(ParameterUtil.isnotnull(filledTime) ){
63
+			//Date starDate = ParameterUtil.string2datetime(filledTime + " 00:00:00");
64
+			record.setFilledTimeCopy(filledTime);
65
+
66
+		}
53 67
 		if (pageNum!=null && pageSize!=null) {
54 68
 			PageHelper.startPage(pageNum, pageSize);
55 69
 		}
56 70
 
57
-		List<ReportMonthly> list = reportMonthlyService.queryByExample(example);
71
+		if (StringUtils.isNotBlank(reportPeriod)){
72
+			record.setReportPeriod(reportPeriod);
73
+		}
74
+		List<ReportMonthly> list = reportMonthlyService.getReportMonthlyList(record);
58 75
 		PageInfo<ReportMonthly> pageInfo = new PageInfo<ReportMonthly>(list);
59 76
 		return pageInfo;
60 77
 	}
@@ -88,9 +105,15 @@ public class ReportMonthlyController {
88 105
 		try {
89 106
 			ReportMonthly reportMonthly = (ReportMonthly) mapper.readValue(reportMonthlyJson, ReportMonthly.class);
90 107
 			reportMonthly.setOrgId(orgId);
108
+			if(ParameterUtil.isnotnull(reportMonthly.getFilledName()) ){
109
+				Date starDate = ParameterUtil.string2datetime(reportMonthly.getFilledName() + " 00:00:00");
110
+				reportMonthly.setFilledTime(starDate);
111
+
112
+			}
91 113
 			if(ParameterUtil.isnotnull(reportMonthly.getId())){
92 114
 				reportMonthlyService.update(reportMonthly);
93 115
 			}else{
116
+				reportMonthly.setStatus("0");
94 117
 				reportMonthlyService.add(reportMonthly);
95 118
 			}
96 119
 		} catch (IOException e) {

+ 26 - 4
src/main/java/com/chinaitop/depot/business/controller/ReportWeeklyController.java

@@ -12,6 +12,7 @@ import com.github.pagehelper.PageInfo;
12 12
 import io.swagger.annotations.ApiImplicitParam;
13 13
 import io.swagger.annotations.ApiImplicitParams;
14 14
 import io.swagger.annotations.ApiOperation;
15
+import org.apache.commons.lang3.StringUtils;
15 16
 import org.springframework.beans.factory.annotation.Value;
16 17
 import org.springframework.http.MediaType;
17 18
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
21 22
 import javax.annotation.Resource;
22 23
 import java.io.IOException;
23 24
 import java.net.URLEncoder;
25
+import java.util.Date;
24 26
 import java.util.HashMap;
25 27
 import java.util.List;
26 28
 import java.util.Map;
@@ -44,17 +46,31 @@ public class ReportWeeklyController {
44 46
 	@ApiOperation(value="查询周报表列表", notes = "查询周报表列表,支持分页")
45 47
 	@ApiImplicitParams({
46 48
 			@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
47
-			@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query")
49
+			@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
50
+			@ApiImplicitParam(name = "reportPeriod", value = "周", paramType = "query"),
51
+			@ApiImplicitParam(name = "status", value = "状态", paramType = "query"),
52
+			@ApiImplicitParam(name = "filledTime", value = "填报日期", paramType = "query")
48 53
 
49 54
 	})
50
-	public PageInfo<ReportWeekly> getReportWeeklyList(Integer pageNum, Integer pageSize, Integer houseId, Integer type, String searchStartDate, String searchEndDate){
51
-		ReportWeeklyExample example = new ReportWeeklyExample();
55
+	public PageInfo<ReportWeekly> getReportWeeklyList(Integer pageNum, Integer pageSize, String reportPeriod, String status, String filledTime){
56
+		ReportWeekly example = new ReportWeekly();
52 57
 		//ReportWeeklyExample.Criteria criteria = example.createCriteria();
58
+		if (StringUtils.isNotBlank(reportPeriod)){
59
+			example.setReportPeriod(reportPeriod);
60
+		}
61
+		if (StringUtils.isNotBlank(status)){
62
+			example.setStatus(status);
63
+		}
64
+		if(ParameterUtil.isnotnull(filledTime) ){
65
+			//Date starDate = ParameterUtil.string2datetime(filledTime + " 00:00:00");
66
+			example.setFilledTimeCopy(filledTime);
67
+
68
+		}
53 69
 		if (pageNum!=null && pageSize!=null) {
54 70
 			PageHelper.startPage(pageNum, pageSize);
55 71
 		}
56 72
 
57
-		List<ReportWeekly> list = reportWeeklyService.queryByExample(example);
73
+		List<ReportWeekly> list = reportWeeklyService.getReportWeeklyList(example);
58 74
 		PageInfo<ReportWeekly> pageInfo = new PageInfo<ReportWeekly>(list);
59 75
 		return pageInfo;
60 76
 	}
@@ -88,9 +104,15 @@ public class ReportWeeklyController {
88 104
 		try {
89 105
 			ReportWeekly reportWeekly = (ReportWeekly) mapper.readValue(reportWeeklyJson, ReportWeekly.class);
90 106
 			reportWeekly.setOrgId(orgId);
107
+			if(ParameterUtil.isnotnull(reportWeekly.getFilledName()) ){
108
+				Date starDate = ParameterUtil.string2datetime(reportWeekly.getFilledName() + " 00:00:00");
109
+				reportWeekly.setFilledTime(starDate);
110
+
111
+			}
91 112
 			if(ParameterUtil.isnotnull(reportWeekly.getId())){
92 113
 				reportWeeklyService.update(reportWeekly);
93 114
 			}else{
115
+				reportWeekly.setStatus("0");
94 116
 				reportWeeklyService.add(reportWeekly);
95 117
 			}
96 118
 		} catch (IOException e) {

+ 3 - 0
src/main/java/com/chinaitop/depot/business/mapper/ReportMonthlyMapper.java

@@ -28,4 +28,7 @@ public interface ReportMonthlyMapper {
28 28
     int updateByPrimaryKeySelective(ReportMonthly record);
29 29
 
30 30
     int updateByPrimaryKey(ReportMonthly record);
31
+
32
+    List<ReportMonthly> getReportMonthlyList(ReportMonthly record);
33
+    List<ReportMonthly> getReportMonthlyListTwo(ReportMonthly record);
31 34
 }

+ 46 - 3
src/main/java/com/chinaitop/depot/business/mapper/ReportMonthlyMapper.xml

@@ -175,13 +175,56 @@
175 175
     </if>
176 176
     <include refid="Base_Column_List" />
177 177
     from report_monthly
178
-    <if test="_parameter != null" >
179
-      <include refid="Example_Where_Clause" />
180
-    </if>
178
+    <where>
179
+      <if test="status != null">
180
+        and status = #{status,jdbcType=VARCHAR}
181
+      </if>
182
+      <if test="filledTimeCopy != null">
183
+        and filled_time LIKE CONCAT('%', #{filledTimeCopy,jdbcType=VARCHAR}, '%')
184
+      </if>
185
+    </where>
181 186
     <if test="orderByClause != null" >
182 187
       order by ${orderByClause}
183 188
     </if>
184 189
   </select>
190
+
191
+  <select id="getReportMonthlyList" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.ReportMonthly" >
192
+    select
193
+    <include refid="Base_Column_List" />
194
+    from report_monthly
195
+    <where>
196
+      <if test="status != null">
197
+        and status = #{status,jdbcType=VARCHAR}
198
+      </if>
199
+      <if test="filledTimeCopy != null">
200
+        and filled_time LIKE CONCAT('%', #{filledTimeCopy,jdbcType=VARCHAR}, '%')
201
+      </if>
202
+      <if test="reportPeriod != null">
203
+        and SUBSTRING(report_period,6,1)=#{reportPeriod,jdbcType=VARCHAR}
204
+      </if>
205
+    </where>
206
+      order by filled_time
207
+
208
+  </select>
209
+  <select id="getReportMonthlyListTwo" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.ReportMonthly" >
210
+    select
211
+    <include refid="Base_Column_List" />
212
+    from report_monthly
213
+    <where>
214
+      <if test="status != null">
215
+        and status = #{status,jdbcType=VARCHAR}
216
+      </if>
217
+      <if test="filledTimeCopy != null">
218
+        and filled_time LIKE CONCAT('%', #{filledTimeCopy,jdbcType=VARCHAR}, '%')
219
+      </if>
220
+      <if test="reportPeriod != null">
221
+        and SUBSTRING(report_period,6,2)=#{reportPeriod,jdbcType=VARCHAR}
222
+      </if>
223
+    </where>
224
+    order by filled_time
225
+
226
+  </select>
227
+
185 228
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
186 229
     select
187 230
     <include refid="Base_Column_List" />

+ 3 - 0
src/main/java/com/chinaitop/depot/business/mapper/ReportWeeklyMapper.java

@@ -28,4 +28,7 @@ public interface ReportWeeklyMapper {
28 28
     int updateByPrimaryKeySelective(ReportWeekly record);
29 29
 
30 30
     int updateByPrimaryKey(ReportWeekly record);
31
+
32
+    List<ReportWeekly> getReportWeeklyList(ReportWeekly example);
33
+    List<ReportWeekly> getReportWeeklyListTwo(ReportWeekly example);
31 34
 }

+ 46 - 3
src/main/java/com/chinaitop/depot/business/mapper/ReportWeeklyMapper.xml

@@ -203,13 +203,56 @@
203 203
     </if>
204 204
     <include refid="Base_Column_List" />
205 205
     from report_weekly
206
-    <if test="_parameter != null" >
207
-      <include refid="Example_Where_Clause" />
208
-    </if>
206
+    <where>
207
+      <if test="status != null">
208
+        and status = #{status,jdbcType=VARCHAR}
209
+      </if>
210
+      <if test="filledTimeCopy != null">
211
+        and filled_time LIKE CONCAT('%', #{filledTimeCopy,jdbcType=VARCHAR}, '%')
212
+      </if>
213
+    </where>
209 214
     <if test="orderByClause != null" >
210 215
       order by ${orderByClause}
211 216
     </if>
212 217
   </select>
218
+
219
+  <select id="getReportWeeklyList" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.ReportWeekly" >
220
+    select
221
+    <include refid="Base_Column_List" />
222
+    from report_weekly
223
+    <where>
224
+      <if test="status != null">
225
+        and status = #{status,jdbcType=VARCHAR}
226
+      </if>
227
+      <if test="filledTimeCopy != null">
228
+        and filled_time LIKE CONCAT('%', #{filledTimeCopy,jdbcType=VARCHAR}, '%')
229
+      </if>
230
+      <if test="reportPeriod != null">
231
+        and SUBSTRING(report_period,7,1)=#{reportPeriod,jdbcType=VARCHAR}
232
+      </if>
233
+
234
+    </where>
235
+    order by filled_time
236
+  </select>
237
+  <select id="getReportWeeklyListTwo" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.ReportWeekly" >
238
+    select
239
+    <include refid="Base_Column_List" />
240
+    from report_weekly
241
+    <where>
242
+      <if test="status != null">
243
+        and status = #{status,jdbcType=VARCHAR}
244
+      </if>
245
+      <if test="filledTimeCopy != null">
246
+        and filled_time LIKE CONCAT('%', #{filledTimeCopy,jdbcType=VARCHAR}, '%')
247
+      </if>
248
+      <if test="reportPeriod != null">
249
+        and SUBSTRING(report_period,7,2)=#{reportPeriod,jdbcType=VARCHAR}
250
+      </if>
251
+
252
+    </where>
253
+    order by filled_time
254
+  </select>
255
+
213 256
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
214 257
     select
215 258
     <include refid="Base_Column_List" />

+ 13 - 1
src/main/java/com/chinaitop/depot/business/model/ReportMonthly.java

@@ -2,11 +2,13 @@ package com.chinaitop.depot.business.model;
2 2
 
3 3
 import java.util.Date;
4 4
 
5
-public class ReportMonthly {
5
+public class ReportMonthly extends ReportMonthlyExample {
6 6
     private Integer id;
7 7
 
8 8
     private String status;
9 9
 
10
+    private String filledTimeCopy;
11
+
10 12
     private String companyOrgCode;
11 13
 
12 14
     private String reportPeriod;
@@ -1550,4 +1552,14 @@ public class ReportMonthly {
1550 1552
     public void setCountyPlanNumber(String countyPlanNumber) {
1551 1553
         this.countyPlanNumber = countyPlanNumber == null ? null : countyPlanNumber.trim();
1552 1554
     }
1555
+
1556
+
1557
+    public void setFilledTimeCopy(String filledTimeCopy) {
1558
+        this.filledTimeCopy = filledTimeCopy == null ? null : filledTimeCopy.trim();
1559
+    }
1560
+
1561
+    public String getFilledTimeCopy() {
1562
+        return filledTimeCopy;
1563
+    }
1564
+
1553 1565
 }

+ 11 - 1
src/main/java/com/chinaitop/depot/business/model/ReportWeekly.java

@@ -2,11 +2,13 @@ package com.chinaitop.depot.business.model;
2 2
 
3 3
 import java.util.Date;
4 4
 
5
-public class ReportWeekly {
5
+public class ReportWeekly extends ReportWeeklyExample {
6 6
     private Integer id;
7 7
 
8 8
     private String status;
9 9
 
10
+    private String filledTimeCopy;
11
+
10 12
     private String companyOrgCode;
11 13
 
12 14
     private String reportPeriod;
@@ -1928,4 +1930,12 @@ public class ReportWeekly {
1928 1930
     public void setProvinceRemarksOil(String provinceRemarksOil) {
1929 1931
         this.provinceRemarksOil = provinceRemarksOil == null ? null : provinceRemarksOil.trim();
1930 1932
     }
1933
+
1934
+    public String getFilledTimeCopy() {
1935
+        return filledTimeCopy;
1936
+    }
1937
+
1938
+    public void setFilledTimeCopy(String filledTimeCopy) {
1939
+        this.filledTimeCopy = filledTimeCopy;
1940
+    }
1931 1941
 }

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

@@ -40,4 +40,5 @@ public interface ReportMonthlyService {
40 40
 	 */
41 41
 	void remove(Integer Id);
42 42
 
43
+    List<ReportMonthly> getReportMonthlyList(ReportMonthly record);
43 44
 }

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

@@ -40,4 +40,6 @@ public interface ReportWeeklyService {
40 40
 	void remove(Integer Id);
41 41
 
42 42
     void updateWeeklyStatus(ReportWeekly week);
43
+
44
+    List<ReportWeekly> getReportWeeklyList(ReportWeekly example);
43 45
 }

+ 17 - 0
src/main/java/com/chinaitop/depot/business/service/impl/ReportMonthlyServiceImpl.java

@@ -21,6 +21,23 @@ public class ReportMonthlyServiceImpl implements ReportMonthlyService {
21 21
 		// TODO Auto-generated method stub
22 22
 		return reportMonthlyMapper.selectByExample(example);
23 23
 	}
24
+
25
+	@Override
26
+	public List<ReportMonthly> getReportMonthlyList(ReportMonthly record) {
27
+		if(record.getReportPeriod()!=null){
28
+			if (Integer.parseInt(record.getReportPeriod())<10) {
29
+				return reportMonthlyMapper.getReportMonthlyList(record);
30
+			}else {
31
+				return reportMonthlyMapper.getReportMonthlyListTwo(record);
32
+			}
33
+		}else {
34
+			return reportMonthlyMapper.selectByExample(record);
35
+		}
36
+
37
+		// TODO Auto-generated method stub
38
+
39
+	}
40
+
24 41
 	//根据id修改计划状态
25 42
 	@Override
26 43
 	public void updateMonthlyStatus(ReportMonthly mon) {

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

@@ -22,6 +22,22 @@ public class ReportWeeklyServiceImpl implements ReportWeeklyService {
22 22
 		return reportWeeklyMapper.selectByExample(example);
23 23
 	}
24 24
 
25
+
26
+	@Override
27
+	public List<ReportWeekly> getReportWeeklyList(ReportWeekly example) {
28
+		// TODO Auto-generated method stub
29
+		if (example.getReportPeriod()!=null) {
30
+			if (Integer.parseInt(example.getReportPeriod())<10) {
31
+				return reportWeeklyMapper.getReportWeeklyList(example);
32
+			}else {
33
+				return reportWeeklyMapper.getReportWeeklyListTwo(example);
34
+			}
35
+		}else {
36
+			return reportWeeklyMapper.selectByExample(example);
37
+		}
38
+
39
+	}
40
+
25 41
 	@Override
26 42
 	public ReportWeekly findById(Integer Id) {
27 43
 		// TODO Auto-generated method stub