张延森 4 년 전
부모
커밋
15ea69a00d

+ 1
- 1
pom.xml 파일 보기

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>xiangsong</artifactId>
13
-	<version>1.0.48</version>
13
+	<version>1.0.50</version>
14 14
 	<name>xiangsong</name>
15 15
 	<description>香颂</description>
16 16
 

+ 9
- 0
src/main/java/com/huiju/estateagents/common/DateUtils.java 파일 보기

@@ -60,6 +60,15 @@ public class DateUtils {
60 60
         return false;
61 61
     }
62 62
 
63
+    public static String format(LocalDateTime dt, String formatStr) {
64
+        if (null == dt) {
65
+            return null;
66
+        }
67
+
68
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formatStr);
69
+        return dt.format(formatter);
70
+    }
71
+
63 72
     /**
64 73
      * 当前时间是否早于指定时间
65 74
      *

+ 75
- 1
src/main/java/com/huiju/estateagents/controller/TaPointsExchangeController.java 파일 보기

@@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8 8
 import com.huiju.estateagents.common.CommConstant;
9
+import com.huiju.estateagents.common.DateUtils;
10
+import com.huiju.estateagents.common.ExcelUtils;
9 11
 import com.huiju.estateagents.entity.TaGoods;
10 12
 import com.huiju.estateagents.entity.TaPointsExchange;
13
+import com.huiju.estateagents.excel.TaPointsExchangeExport;
11 14
 import com.huiju.estateagents.service.ITaGoodsService;
12 15
 import com.huiju.estateagents.service.ITaPointsExchangeService;
13 16
 import io.swagger.annotations.Api;
@@ -26,7 +29,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
26 29
 import org.springframework.web.bind.annotation.RestController;
27 30
 
28 31
 import javax.servlet.http.HttpServletRequest;
32
+import javax.servlet.http.HttpServletResponse;
29 33
 import java.time.LocalDateTime;
34
+import java.util.ArrayList;
30 35
 import java.util.List;
31 36
 
32 37
 /**
@@ -94,6 +99,69 @@ public class TaPointsExchangeController extends BaseController {
94 99
         }
95 100
         return responseBean;
96 101
     }
102
+
103
+
104
+    /**
105
+     * 分页查询列表
106
+     * @param pageNum
107
+     * @param pageSize
108
+     * @return
109
+     */
110
+    @RequestMapping(value="/admin/taPointsExchange/export",method= RequestMethod.GET)
111
+    public ResponseBean taPointsExchangeExport(@RequestParam(value ="personName",required = false) String personName,
112
+                                               @RequestParam(value ="phone",required = false) String phone,
113
+                                               @RequestParam(value ="personType",required = false) String personType,
114
+                                               @RequestParam(value ="targetName",required = false) String targetName,
115
+                                               @RequestParam(value ="startCreateDate",required = false) String startCreateDate,
116
+                                               @RequestParam(value ="endCreateDate",required = false) String endCreateDate,
117
+                                               @RequestParam(value ="startVerifyDate",required = false) String startVerifyDate,
118
+                                               @RequestParam(value ="endVerifyDate",required = false) String endVerifyDate,
119
+                                               @RequestParam(value ="status",required = false) Integer status,
120
+                                               @RequestParam(value ="tel",required = false) String tel,
121
+                                               HttpServletRequest request,
122
+                                               HttpServletResponse response){
123
+        ResponseBean responseBean = new ResponseBean();
124
+        try {
125
+            //使用分页插件
126
+            TaPointsExchange taPointsExchange = new TaPointsExchange();
127
+            taPointsExchange.setPersonName(personName);
128
+            taPointsExchange.setPhone(phone);
129
+            taPointsExchange.setPersonType(personType);
130
+            taPointsExchange.setTargetName(targetName);
131
+            taPointsExchange.setStartCreateDate(startCreateDate);
132
+            taPointsExchange.setEndCreateDate(endCreateDate);
133
+            taPointsExchange.setStartVerifyDate(startVerifyDate);
134
+            taPointsExchange.setEndVerifyDate(endVerifyDate);
135
+            taPointsExchange.setStatus(status);
136
+            taPointsExchange.setTel(tel);
137
+            taPointsExchange.setOrgId(getOrgId(request));
138
+
139
+            responseBean = iTaPointsExchangeService.selectList(1, 9999,taPointsExchange,getTaPersonBuildingListByUserId(request));
140
+            List<TaPointsExchange> records = ((Page<TaPointsExchange>) responseBean.getData()).getRecords();
141
+
142
+            List<TaPointsExchangeExport> list = new ArrayList<>();
143
+            if (null != records) {
144
+                for (TaPointsExchange item: records) {
145
+                    TaPointsExchangeExport row = new TaPointsExchangeExport();
146
+                    row.setPersonName(item.getPersonName());
147
+                    row.setPhone(item.getPhone());
148
+                    row.setPersonType("prop".equals(item.getPersonType()) ? "物业相关" : ("life-consultant".equals(item.getPersonType()) ? "生活管家" : null));
149
+                    row.setTargetName(item.getTargetName());
150
+                    row.setStatus(1 == item.getStatus() ? "已领取" : "未领取");
151
+                    row.setCreateDate(DateUtils.format(item.getCreateDate(), "yyyy-MM-dd HH:mm"));
152
+                    row.setVerifyDate(DateUtils.format(item.getVerifyDate(), "yyyy-MM-dd HH:mm"));
153
+                    list.add(row);
154
+                }
155
+            }
156
+
157
+            ExcelUtils.flush(response, TaPointsExchangeExport.class, list, "积分兑换记录" + DateUtils.today());
158
+        }catch (Exception e){
159
+            e.printStackTrace();
160
+            logger.error("taPointsExchangeList -=- {}",e.toString());
161
+            responseBean.addError(e.getMessage());
162
+        }
163
+        return responseBean;
164
+    }
97 165
     
98 166
     /**
99 167
      * 修改对象
@@ -231,7 +299,13 @@ public class TaPointsExchangeController extends BaseController {
231 299
     public ResponseBean wxPointsExchangeList(@RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
232 300
                                              @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
233 301
                                              @RequestParam(value = "buildingId", required = false) String buildingId,
234
-                                             @RequestParam(value = "personId", required = false) String personId){
302
+                                             @RequestParam(value = "personId", required = false) String personId,
303
+                                             HttpServletRequest request){
304
+
305
+        if (null == personId) {
306
+            personId = getPersonId(request);
307
+        }
308
+
235 309
         ResponseBean responseBean = new ResponseBean();
236 310
         try {
237 311
             //使用分页插件

+ 1
- 1
src/main/java/com/huiju/estateagents/entity/TaPointsExchange.java 파일 보기

@@ -108,7 +108,7 @@ public class TaPointsExchange implements Serializable {
108 108
     
109 109
     @TableField(exist = false)
110 110
     private String personType;
111
-    
111
+
112 112
     @TableField(exist = false)
113 113
     private String startCreateDate;
114 114
     

+ 57
- 0
src/main/java/com/huiju/estateagents/excel/TaPointsExchangeExport.java 파일 보기

@@ -0,0 +1,57 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+@Data
8
+public class TaPointsExchangeExport {
9
+
10
+    /**
11
+     * 兑换人姓名
12
+     */
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "用户姓名", index = 0)
15
+    private String personName;
16
+
17
+    /**
18
+     * 兑换人手机
19
+     */
20
+    @ColumnWidth(20)
21
+    @ExcelProperty(value = "手机号", index = 2)
22
+    private String phone;
23
+
24
+    /**
25
+     * 物品名称
26
+     */
27
+    @ColumnWidth(30)
28
+    @ExcelProperty(value = "商品名称", index = 3)
29
+    private String targetName;
30
+
31
+
32
+    /**
33
+     * 状态
34
+     */
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "状态", index = 6)
37
+    private String status;
38
+
39
+    /**
40
+     * 创建时间
41
+     */
42
+    @ColumnWidth(30)
43
+    @ExcelProperty(value = "兑换时间", index = 4)
44
+    private String createDate;
45
+
46
+    /**
47
+     * 领取时间
48
+     */
49
+    @ColumnWidth(30)
50
+    @ExcelProperty(value = "领取时间", index = 5)
51
+    private String verifyDate;
52
+
53
+    @ColumnWidth(15)
54
+    @ExcelProperty(value = "用户类型", index = 1)
55
+    private String personType;
56
+
57
+}