魏超 5 anos atrás
pai
commit
d5d9be9558

+ 1
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java Ver arquivo

@@ -865,7 +865,7 @@ public class CommConstant {
865 865
     /**
866 866
      * 明细类型--红包
867 867
      */
868
-    public static final String ITEM_TYPE_REDPACKAGE = "redPackage";
868
+    public static final String ITEM_TYPE_REDPACKAGE = "redPacket";
869 869
 
870 870
     /**
871 871
      * 交易状态 成功

+ 21
- 2
src/main/java/com/huiju/estateagents/redpack/controller/TaOrgAccountController.java Ver arquivo

@@ -9,6 +9,8 @@ import com.huiju.estateagents.common.StringUtils;
9 9
 import com.huiju.estateagents.redpack.entity.TaOrgAccount;
10 10
 import com.huiju.estateagents.redpack.entity.TaOrgOrder;
11 11
 import com.huiju.estateagents.redpack.entity.TaOrgRefundApplication;
12
+import com.huiju.estateagents.redpack.mapper.TaOrgAccountBlockedMapper;
13
+import com.huiju.estateagents.redpack.mapper.TaOrgOrderMapper;
12 14
 import com.huiju.estateagents.redpack.service.ITaOrgAccountService;
13 15
 import com.huiju.estateagents.redpack.service.ITaOrgOrderService;
14 16
 import lombok.extern.slf4j.Slf4j;
@@ -40,6 +42,12 @@ public class TaOrgAccountController extends BaseController {
40 42
     @Autowired
41 43
     public ITaOrgOrderService iTaOrgOrderService;
42 44
 
45
+    @Autowired
46
+    public TaOrgOrderMapper taOrgOrderMapper;
47
+
48
+    @Autowired
49
+    public TaOrgAccountBlockedMapper taOrgAccountBlockedMapper;
50
+
43 51
     /**
44 52
      * 分页查询列表
45 53
      *
@@ -47,7 +55,7 @@ public class TaOrgAccountController extends BaseController {
47 55
      * @param pageSize
48 56
      * @return
49 57
      */
50
-    @RequestMapping(value = "/api/taOrgAccount", method = RequestMethod.GET)
58
+    @RequestMapping(value = "/channel/taOrgAccount", method = RequestMethod.GET)
51 59
     public ResponseBean taOrgAccountList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
52 60
                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
53 61
                                          @RequestParam(value = "miniAppName", required = false) String miniAppName) {
@@ -56,11 +64,22 @@ public class TaOrgAccountController extends BaseController {
56 64
             //使用分页插件
57 65
             IPage<TaOrgAccount> pg = new Page<>(pageNum, pageSize);
58 66
             QueryWrapper<TaOrgAccount> queryWrapper = new QueryWrapper<>();
59
-            queryWrapper.eq(!StringUtils.isEmpty(miniAppName), "miniapp_name", miniAppName);
67
+            queryWrapper.like(!StringUtils.isEmpty(miniAppName), "miniapp_name", miniAppName);
60 68
             queryWrapper.orderByDesc("create_date");
61 69
 
62 70
             IPage<TaOrgAccount> result = iTaOrgAccountService.page(pg, queryWrapper);
71
+            result.getRecords().forEach(e -> {
72
+                Integer totalRechargeAmount = taOrgOrderMapper.countTotalRechargeAmount(e.getOrgId());
73
+                e.setTotalRechargeAmount(totalRechargeAmount);
74
+                //查询退款冻结额
75
+                Integer totalBlockAmount = taOrgAccountBlockedMapper.countTotalBlockAmount(e.getOrgId());
76
+
77
+                //账户余额=总充值金额-已消费金额-已退款额-退款冻结额
78
+                Integer balance = totalRechargeAmount - e.getPurchaseAmount() - e.getTotalRefund() - totalBlockAmount;
79
+                e.setRealBalance(balance);
80
+            });
63 81
             responseBean.addSuccess(result);
82
+
64 83
         } catch (Exception e) {
65 84
             e.printStackTrace();
66 85
             logger.error("taOrgAccountList -=- {}", e.toString());

+ 52
- 3
src/main/java/com/huiju/estateagents/redpack/controller/TaOrgOrderController.java Ver arquivo

@@ -1,18 +1,24 @@
1 1
 package com.huiju.estateagents.redpack.controller;
2 2
 
3
+import java.io.IOException;
3 4
 import java.time.LocalDate;
4 5
 import java.time.LocalDateTime;
5 6
 import java.util.HashMap;
7
+import java.util.List;
6 8
 import java.util.Map;
7 9
 
8 10
 import javax.servlet.http.HttpServletRequest;
9 11
 import javax.servlet.http.HttpServletResponse;
10 12
 
13
+import com.alibaba.excel.EasyExcel;
14
+import com.alibaba.excel.ExcelWriter;
15
+import com.alibaba.excel.write.metadata.WriteSheet;
11 16
 import com.alibaba.fastjson.JSON;
12 17
 import org.slf4j.Logger;
13 18
 import org.slf4j.LoggerFactory;
14 19
 import org.springframework.beans.factory.annotation.Autowired;
15 20
 import org.springframework.format.annotation.DateTimeFormat;
21
+import org.springframework.web.bind.annotation.GetMapping;
16 22
 import org.springframework.web.bind.annotation.PathVariable;
17 23
 import org.springframework.web.bind.annotation.RequestBody;
18 24
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,7 +32,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
26 32
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
27 33
 import com.huiju.estateagents.base.BaseController;
28 34
 import com.huiju.estateagents.base.ResponseBean;
35
+import com.huiju.estateagents.common.CommConstant;
29 36
 import com.huiju.estateagents.entity.TaPerson;
37
+import com.huiju.estateagents.excel.ActivityStatistics.VisitPersonNum;
38
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
39
+import com.huiju.estateagents.redpack.entity.ConsumeOrder;
40
+import com.huiju.estateagents.redpack.entity.RechargeOrder;
41
+import com.huiju.estateagents.redpack.entity.RefundOrder;
30 42
 import com.huiju.estateagents.redpack.entity.TaOrgOrder;
31 43
 import com.huiju.estateagents.redpack.service.ITaOrgOrderService;
32 44
 import com.huiju.estateagents.service.ITaPersonService;
@@ -68,14 +80,15 @@ public class TaOrgOrderController extends BaseController {
68 80
                                        @RequestParam(value = "isOffline", required = false) Integer isOffline,
69 81
                                        @RequestParam(value = "tradingStatus", required = false) String tradingStatus,
70 82
                                        @RequestParam(value = "receivePhone", required = false) String receivePhone,
83
+                                       @RequestParam(value = "miniAppName", required = false) String miniAppName,
71 84
                                        @RequestParam(value = "itemType", required = false) String itemType,
72
-                                       @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
73
-                                       @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate) {
85
+                                       @RequestParam(value = "startDate", required = false) String startDate,
86
+                                       @RequestParam(value = "endDate", required = false) String endDate) {
74 87
         ResponseBean responseBean = new ResponseBean();
75 88
         try {
76 89
             //使用分页插件
77 90
             IPage<TaOrgOrder> pg = new Page<>(pageNum, pageSize);
78
-            IPage<TaOrgOrder> result = iTaOrgOrderService.listByCondition(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, receivePhone, itemType, startDate, endDate);
91
+            IPage<TaOrgOrder> result = iTaOrgOrderService.listByCondition(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, receivePhone, itemType, startDate, endDate, miniAppName);
79 92
             responseBean.addSuccess(result);
80 93
         } catch (Exception e) {
81 94
             e.printStackTrace();
@@ -85,6 +98,42 @@ public class TaOrgOrderController extends BaseController {
85 98
         return responseBean;
86 99
     }
87 100
 
101
+    /**
102
+     * 订单导出
103
+     * @return
104
+     */
105
+    @GetMapping(value = "/channel/taOrgOrder/orgOrderExport")
106
+    public void selectActivityVisitPersonNumExport(@RequestParam(value = "orderType", required = false) String orderType,
107
+                                                   @RequestParam(value = "orgId", required = false) Integer orgId,
108
+                                                   @RequestParam(value = "tradeNo", required = false) String tradeNo,
109
+                                                   @RequestParam(value = "isOffline", required = false) Integer isOffline,
110
+                                                   @RequestParam(value = "tradingStatus", required = false) String tradingStatus,
111
+                                                   @RequestParam(value = "receivePhone", required = false) String receivePhone,
112
+                                                   @RequestParam(value = "itemType", required = false) String itemType,
113
+                                                   @RequestParam(value = "miniAppName", required = false) String miniAppName,
114
+                                                   @RequestParam(value = "startDate", required = false) String startDate,
115
+                                                   @RequestParam(value = "endDate", required = false) String endDate,
116
+                                                   HttpServletRequest request, HttpServletResponse response) throws IOException {
117
+        response.setContentType("application/octet-stream");
118
+        response.setCharacterEncoding("utf-8");
119
+        response.setHeader("Content-disposition", "attachment;filename=订单统计.xlsx");
120
+        ExcelWriter excelWriter = null;
121
+        if (CommConstant.ITEM_TYPE_RECHARGE.equals(orderType)){
122
+            excelWriter = EasyExcel.write(response.getOutputStream(), RechargeOrder.class).registerWriteHandler(new CustomCellWriteHandler()).build();
123
+        }else if (CommConstant.ITEM_TYPE_REFUND.equals(orderType)){
124
+            excelWriter = EasyExcel.write(response.getOutputStream(), RefundOrder.class).registerWriteHandler(new CustomCellWriteHandler()).build();
125
+        } else{
126
+            excelWriter = EasyExcel.write(response.getOutputStream(), ConsumeOrder.class).registerWriteHandler(new CustomCellWriteHandler()).build();
127
+        }
128
+
129
+        // 设置 sheet, 同一个sheet只需要设置一次
130
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
131
+        List<TaOrgOrder> data = iTaOrgOrderService.listByConditionExport(orderType, orgId, tradeNo, isOffline, tradingStatus, receivePhone, itemType, startDate, endDate, miniAppName);
132
+        excelWriter.write(data, writeSheet);
133
+        // finish 会帮忙关闭流
134
+        excelWriter.finish();
135
+    }
136
+
88 137
     /**
89 138
      * 保存对象
90 139
      *

+ 61
- 0
src/main/java/com/huiju/estateagents/redpack/entity/ConsumeOrder.java Ver arquivo

@@ -0,0 +1,61 @@
1
+package com.huiju.estateagents.redpack.entity;
2
+
3
+import java.time.LocalDateTime;
4
+
5
+import com.alibaba.excel.annotation.ExcelProperty;
6
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
7
+
8
+import lombok.Data;
9
+
10
+@Data
11
+public class ConsumeOrder {
12
+    /**
13
+     * 订单编号
14
+     */
15
+    @ColumnWidth(15)
16
+    @ExcelProperty(value = "订单编号", index = 0)
17
+    private String tradeNo;
18
+
19
+    /**
20
+     * 消费组织
21
+     */
22
+    @ColumnWidth(15)
23
+    @ExcelProperty(value = "消费组织", index = 1)
24
+    private String miniAppName;
25
+
26
+    /**
27
+     * 消费金额
28
+     */
29
+    @ColumnWidth(15)
30
+    @ExcelProperty(value = "消费金额", index = 2)
31
+    private Integer amount;
32
+
33
+    /**
34
+     * 消费方式
35
+     */
36
+    @ColumnWidth(15)
37
+    @ExcelProperty(value = "消费方式", index = 3)
38
+    private String consumeType;
39
+
40
+    /**
41
+     * 消费下单时间
42
+     */
43
+    @ColumnWidth(15)
44
+    @ExcelProperty(value = "消费下单时间", index = 5)
45
+    private LocalDateTime createDate;
46
+
47
+    /**
48
+     * 接收人手机号
49
+     */
50
+    @ColumnWidth(15)
51
+    @ExcelProperty(value = "接收人手机号", index = 6)
52
+    private String phone;
53
+
54
+    /**
55
+     * 消费状态
56
+     */
57
+    @ColumnWidth(15)
58
+    @ExcelProperty(value = "消费状态", index = 7)
59
+    private String tradingStatus;
60
+
61
+}

+ 60
- 0
src/main/java/com/huiju/estateagents/redpack/entity/RechargeOrder.java Ver arquivo

@@ -0,0 +1,60 @@
1
+package com.huiju.estateagents.redpack.entity;
2
+
3
+import java.time.LocalDateTime;
4
+
5
+import com.alibaba.excel.annotation.ExcelProperty;
6
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
7
+
8
+import lombok.Data;
9
+
10
+@Data
11
+public class RechargeOrder {
12
+    /**
13
+     * 订单编号
14
+     */
15
+    @ColumnWidth(15)
16
+    @ExcelProperty(value = "订单编号", index = 0)
17
+    private String tradeNo;
18
+
19
+    /**
20
+     * 充值组织
21
+     */
22
+    @ColumnWidth(15)
23
+    @ExcelProperty(value = "充值组织", index = 1)
24
+    private String miniAppName;
25
+
26
+    /**
27
+     * 充值金额
28
+     */
29
+    @ColumnWidth(15)
30
+    @ExcelProperty(value = "充值金额", index = 2)
31
+    private Integer amount;
32
+
33
+    /**
34
+     * 充值方式
35
+     */
36
+    @ColumnWidth(15)
37
+    @ExcelProperty(value = "充值方式", index = 3)
38
+    private String isOffline;
39
+
40
+    /**
41
+     * 下单时间
42
+     */
43
+    @ColumnWidth(15)
44
+    @ExcelProperty(value = "下单时间", index = 4)
45
+    private LocalDateTime createDate;
46
+
47
+    /**
48
+     * 充值状态
49
+     */
50
+    @ColumnWidth(15)
51
+    @ExcelProperty(value = "充值状态", index = 5)
52
+    private String tradingStatus;
53
+
54
+    /**
55
+     * 支付时间
56
+     */
57
+    @ColumnWidth(15)
58
+    @ExcelProperty(value = "支付时间", index = 6)
59
+    private LocalDateTime payDate;
60
+}

+ 54
- 0
src/main/java/com/huiju/estateagents/redpack/entity/RefundOrder.java Ver arquivo

@@ -0,0 +1,54 @@
1
+package com.huiju.estateagents.redpack.entity;
2
+
3
+import java.time.LocalDateTime;
4
+
5
+import com.alibaba.excel.annotation.ExcelProperty;
6
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
7
+
8
+import lombok.Data;
9
+
10
+@Data
11
+public class RefundOrder {
12
+    /**
13
+     * 订单编号
14
+     */
15
+    @ColumnWidth(15)
16
+    @ExcelProperty(value = "订单编号", index = 0)
17
+    private String tradeNo;
18
+
19
+    /**
20
+     * 退款组织
21
+     */
22
+    @ColumnWidth(15)
23
+    @ExcelProperty(value = "退款组织", index = 1)
24
+    private String miniAppName;
25
+
26
+    /**
27
+     * 退款金额
28
+     */
29
+    @ColumnWidth(15)
30
+    @ExcelProperty(value = "退款金额", index = 2)
31
+    private Integer amount;
32
+
33
+    /**
34
+     * 退款创建时间
35
+     */
36
+    @ColumnWidth(15)
37
+    @ExcelProperty(value = "退款创建时间", index = 3)
38
+    private LocalDateTime createDate;
39
+
40
+    /**
41
+     * 退款状态
42
+     */
43
+    @ColumnWidth(15)
44
+    @ExcelProperty(value = "退款状态", index = 4)
45
+    private String auditStatus;
46
+
47
+    /**
48
+     * 驳回原因
49
+     */
50
+    @ColumnWidth(15)
51
+    @ExcelProperty(value = "驳回原因", index = 5)
52
+    private String auditResult;
53
+
54
+}

+ 12
- 0
src/main/java/com/huiju/estateagents/redpack/entity/TaOrgAccount.java Ver arquivo

@@ -106,6 +106,18 @@ public class TaOrgAccount implements Serializable {
106 106
     /**
107 107
      * 代理商名称
108 108
      */
109
+    @TableField(exist = false)
109 110
     private String channelProxyName;
110 111
 
112
+    /**
113
+     * 总充值金额
114
+     */
115
+    @TableField(exist = false)
116
+    private Integer totalRechargeAmount;
117
+
118
+    /**
119
+     * 公司/组织名称
120
+     */
121
+    @TableField(exist = false)
122
+    private String orgName;
111 123
 }

+ 10
- 0
src/main/java/com/huiju/estateagents/redpack/entity/TaOrgOrder.java Ver arquivo

@@ -131,5 +131,15 @@ public class TaOrgOrder implements Serializable {
131 131
     @TableField(exist = false)
132 132
     private String avatarurl;
133 133
 
134
+    /**
135
+     * 消费方式
136
+     */
137
+    @TableField(exist = false)
138
+    private String consumeType;
134 139
 
140
+    /**
141
+     * 活动名称
142
+     */
143
+    @TableField(exist = false)
144
+    private String activityName;
135 145
 }

+ 38
- 4
src/main/java/com/huiju/estateagents/redpack/mapper/TaOrgOrderMapper.java Ver arquivo

@@ -36,8 +36,9 @@ public interface TaOrgOrderMapper extends BaseMapper<TaOrgOrder> {
36 36
                                                   @Param("tradeNo") String tradeNo,
37 37
                                                   @Param("isOffline") Integer isOffline,
38 38
                                                   @Param("tradingStatus") String tradingStatus,
39
-                                                  @Param("startDate") LocalDate startDate,
40
-                                                  @Param("endDate") LocalDate endDate);
39
+                                                  @Param("startDate") String startDate,
40
+                                                  @Param("endDate") String endDate,
41
+                                                  @Param("miniAppName") String miniAppName);
41 42
 
42 43
     /**
43 44
      * 消费订单
@@ -54,8 +55,41 @@ public interface TaOrgOrderMapper extends BaseMapper<TaOrgOrder> {
54 55
                                          @Param("tradingStatus") String tradingStatus,
55 56
                                          @Param("receivePhone") String receivePhone,
56 57
                                          @Param("itemType") String itemType,
57
-                                         @Param("startDate") LocalDate startDate,
58
-                                         @Param("endDate") LocalDate endDate);
58
+                                         @Param("startDate") String startDate,
59
+                                         @Param("endDate") String endDate,
60
+                                         @Param("miniAppName") String miniAppName);
61
+
62
+    /**
63
+     * 充值退款订单导出
64
+     *
65
+     * @param orderType
66
+     * @return
67
+     */
68
+    List<TaOrgOrder> orderListByRechargeOrRefundExport(@Param("orderType") String orderType,
69
+                                                       @Param("orgId") Integer orgId,
70
+                                                       @Param("tradeNo") String tradeNo,
71
+                                                       @Param("isOffline") Integer isOffline,
72
+                                                       @Param("tradingStatus") String tradingStatus,
73
+                                                       @Param("startDate") String startDate,
74
+                                                       @Param("endDate") String endDate,
75
+                                                       @Param("miniAppName") String miniAppName);
76
+
77
+    /**
78
+     * 消费订单导出
79
+     *
80
+     * @param orderType
81
+     * @param orgId
82
+     * @return
83
+     */
84
+    List<TaOrgOrder> orderListByConsumeExport(@Param("orderType") String orderType,
85
+                                         @Param("orgId") Integer orgId,
86
+                                         @Param("tradeNo") String tradeNo,
87
+                                         @Param("tradingStatus") String tradingStatus,
88
+                                         @Param("receivePhone") String receivePhone,
89
+                                         @Param("itemType") String itemType,
90
+                                         @Param("startDate") String startDate,
91
+                                         @Param("endDate") String endDate,
92
+                                              @Param("miniAppName") String miniAppName);
59 93
 
60 94
     /**
61 95
      * 获取充值订单列表

+ 1
- 1
src/main/java/com/huiju/estateagents/redpack/service/ITaOrgAccountService.java Ver arquivo

@@ -37,7 +37,7 @@ public interface ITaOrgAccountService extends IService<TaOrgAccount> {
37 37
      * @param orgId
38 38
      * @return
39 39
      */
40
-    ResponseBean getOrgAccountById(Integer orgId);
40
+    TaOrgAccount getOrgAccountById(Integer orgId);
41 41
 
42 42
     /**
43 43
      * 根据orgId获取账户信息

+ 9
- 1
src/main/java/com/huiju/estateagents/redpack/service/ITaOrgOrderService.java Ver arquivo

@@ -48,7 +48,15 @@ public interface ITaOrgOrderService extends IService<TaOrgOrder> {
48 48
      * @param orderType
49 49
      * @return
50 50
      */
51
-    IPage<TaOrgOrder> listByCondition(IPage<TaOrgOrder> pg, String orderType, Integer orgId, String tradeNo, Integer isOffline, String tradingStatus, String receivePhone, String itemType, LocalDate startDate, LocalDate endDate);
51
+    IPage<TaOrgOrder> listByCondition(IPage<TaOrgOrder> pg, String orderType, Integer orgId, String tradeNo, Integer isOffline, String tradingStatus, String receivePhone, String itemType, String startDate, String endDate, String miniAppName);
52
+
53
+    /**
54
+     * 订单列表导出
55
+     *
56
+     * @param orderType
57
+     * @return
58
+     */
59
+    List<TaOrgOrder> listByConditionExport(String orderType, Integer orgId, String tradeNo, Integer isOffline, String tradingStatus, String receivePhone, String itemType, String startDate, String endDate, String miniAppName);
52 60
 
53 61
     /**
54 62
      * 微信支付

+ 2
- 3
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgAccountServiceImpl.java Ver arquivo

@@ -187,7 +187,7 @@ public class TaOrgAccountServiceImpl extends ServiceImpl<TaOrgAccountMapper, TaO
187 187
     }
188 188
 
189 189
     @Override
190
-    public ResponseBean getOrgAccountById(Integer orgId) {
190
+    public TaOrgAccount getOrgAccountById(Integer orgId) {
191 191
         ResponseBean responseBean = new ResponseBean<>();
192 192
         TaOrgAccount taOrgAccount = taOrgAccountMapper.getOrgAccountById(orgId);
193 193
 
@@ -201,8 +201,7 @@ public class TaOrgAccountServiceImpl extends ServiceImpl<TaOrgAccountMapper, TaO
201 201
         Integer balance = totalRechargeAmount - taOrgAccount.getPurchaseAmount() - taOrgAccount.getTotalRefund() - totalBlockAmount;
202 202
         taOrgAccount.setRealBalance(balance);
203 203
 
204
-        responseBean.addSuccess(taOrgAccount);
205
-        return responseBean;
204
+        return taOrgAccount;
206 205
     }
207 206
 
208 207
     @Override

+ 19
- 5
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgOrderServiceImpl.java Ver arquivo

@@ -83,17 +83,31 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
83 83
     private TaWxPayConfigMapper taWxPayConfigMapper;
84 84
 
85 85
     @Override
86
-    public IPage<TaOrgOrder> listByCondition(IPage<TaOrgOrder> pg, String orderType, Integer orgId, String tradeNo, Integer isOffline, String tradingStatus, String receivePhone, String itemType, LocalDate startDate, LocalDate endDate) {
87
-        IPage<TaOrgOrder> result = null;
86
+    public IPage<TaOrgOrder> listByCondition(IPage<TaOrgOrder> pg, String orderType, Integer orgId, String tradeNo, Integer isOffline, String tradingStatus, String receivePhone, String itemType, String startDate, String endDate, String miniAppName) {
87
+        IPage<TaOrgOrder> result = pg;
88 88
 
89 89
         if (CommConstant.ITEM_TYPE_RECHARGE.equals(orderType) || CommConstant.ITEM_TYPE_REFUND.equals(orderType)) {
90
-            result = taOrgOrderMapper.orderListByRechargeOrRefund(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, startDate, endDate);
90
+            result = taOrgOrderMapper.orderListByRechargeOrRefund(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, startDate, endDate, miniAppName);
91 91
             return result;
92 92
         } else if (CommConstant.ITEM_TYPE_REDPACKAGE.equals(orderType)) {
93
-            result = taOrgOrderMapper.orderListByConsume(pg, orderType, orgId, tradeNo, tradingStatus, receivePhone, itemType, startDate, endDate);
93
+            result = taOrgOrderMapper.orderListByConsume(pg, orderType, orgId, tradeNo, tradingStatus, receivePhone, itemType, startDate, endDate, miniAppName);
94 94
             return result;
95 95
         } else {
96
-            return null;
96
+            return result;
97
+        }
98
+    }
99
+
100
+    @Override
101
+    public List<TaOrgOrder> listByConditionExport(String orderType, Integer orgId, String tradeNo, Integer isOffline, String tradingStatus, String receivePhone, String itemType, String startDate, String endDate, String miniAppName) {
102
+        List<TaOrgOrder> result = new ArrayList<>();
103
+        if (CommConstant.ITEM_TYPE_RECHARGE.equals(orderType) || CommConstant.ITEM_TYPE_REFUND.equals(orderType)) {
104
+            result = taOrgOrderMapper.orderListByRechargeOrRefundExport(orderType, orgId, tradeNo, isOffline, tradingStatus, startDate, endDate, miniAppName);
105
+            return result;
106
+        } else if (CommConstant.ITEM_TYPE_REDPACKAGE.equals(orderType)) {
107
+            result = taOrgOrderMapper.orderListByConsumeExport(orderType, orgId, tradeNo, tradingStatus, receivePhone, itemType, startDate, endDate, miniAppName);
108
+            return result;
109
+        } else {
110
+            return result;
97 111
         }
98 112
     }
99 113
 

+ 2
- 1
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java Ver arquivo

@@ -52,7 +52,7 @@ public class TaContactController extends BaseController {
52 52
     @RequestMapping(value = "/channel/listContactByCondition", method = RequestMethod.GET)
53 53
     public ResponseBean listContactByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
54 54
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
55
-                                               String contactName, String telephone, String phone, String job) {
55
+                                               String contactName, String telephone, String phone, String job, String contactType) {
56 56
         ResponseBean responseBean = new ResponseBean();
57 57
         try {
58 58
             //使用分页插件
@@ -62,6 +62,7 @@ public class TaContactController extends BaseController {
62 62
             queryWrapper.like(!StringUtils.isEmpty(telephone), "telephone", telephone);
63 63
             queryWrapper.like(!StringUtils.isEmpty(phone), "phone", phone);
64 64
             queryWrapper.like(!StringUtils.isEmpty(job), "job", job);
65
+            queryWrapper.eq(!StringUtils.isEmpty(contactType), "contact_type", contactType);
65 66
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
66 67
             queryWrapper.orderByDesc("order_no", "create_date");
67 68
 

+ 1
- 1
src/main/resources/mapper/redpack/TaOrgAccountBlockedMapper.xml Ver arquivo

@@ -3,7 +3,7 @@
3 3
 <mapper namespace="com.huiju.estateagents.redpack.mapper.TaOrgAccountBlockedMapper">
4 4
 
5 5
     <select id="countTotalBlockAmount" resultType="java.lang.Integer">
6
-        select sum(t.blocked_balance) from ta_org_account_blocked t
6
+        select ifnull(sum(t.blocked_balance), 0) from ta_org_account_blocked t
7 7
         where t.org_id = #{orgId}
8 8
     </select>
9 9
 

+ 2
- 0
src/main/resources/mapper/redpack/TaOrgAccountMapper.xml Ver arquivo

@@ -5,12 +5,14 @@
5 5
     <select id="getOrgAccountById" resultType="com.huiju.estateagents.redpack.entity.TaOrgAccount">
6 6
         select
7 7
         t.miniapp_name,
8
+        d.name as orgName,
8 9
         c.channel_proxy_name,
9 10
         t.purchase_amount,
10 11
         total_refund
11 12
         From ta_org_account  t
12 13
         left join ta_channel_app_relation b on t.org_id = b.org_id
13 14
         left join ta_channel_proxy c on b.channel_id = c.channel_id
15
+        left join ta_org d on t.org_id = d.org_id
14 16
         where t.org_id = #{orgId}
15 17
     </select>
16 18
 

+ 104
- 5
src/main/resources/mapper/redpack/TaOrgOrderMapper.xml Ver arquivo

@@ -28,9 +28,9 @@
28 28
             and t.org_id = #{orgId}
29 29
         </if>
30 30
         <if test="tradeNo != null and tradeNo != ''">
31
-            and t.trade_no = #{tradeNo}
31
+            and t.trade_no like concat('%', #{tradeNo}, '%')
32 32
         </if>
33
-        <if test="isOffline != null and isOffline != ''">
33
+        <if test="isOffline != null">
34 34
             and t.is_offline = #{isOffline}
35 35
         </if>
36 36
         <if test="tradingStatus != null and tradingStatus != ''">
@@ -42,6 +42,9 @@
42 42
         <if test="endDate != null and endDate != ''">
43 43
             and t.create_date &lt; #{endDate}
44 44
         </if>
45
+        <if test="miniAppName != null and miniAppName != ''">
46
+            and b.name like concat('%', #{miniAppName}, '%')
47
+        </if>
45 48
         GROUP BY t.order_id
46 49
     </select>
47 50
 
@@ -52,11 +55,13 @@
52 55
         t.amount,
53 56
         t.create_date,
54 57
         c.phone,
55
-        t.trading_status
58
+        t.trading_status,
59
+        d.`name` as activityName
56 60
         From ta_org_order t
57 61
         left join ta_org_order_detail a on t.order_id = a.order_id
58 62
         left join ta_miniapp b on t.org_id = b.org_id
59 63
         left join ta_person c on a.receiver_id = c.person_id
64
+        left join ta_drainage d on a.target_id = d.drainage_id
60 65
         where
61 66
         a.item_type = #{orderType}
62 67
         <if test="orgId != null and orgId != ''">
@@ -66,7 +71,98 @@
66 71
             and t.org_id = #{orgId}
67 72
         </if>
68 73
         <if test="tradeNo != null and tradeNo != ''">
69
-            and t.trade_no = #{tradeNo}
74
+            and t.trade_no like concat('%', #{tradeNo}, '%')
75
+        </if>
76
+        <if test="tradingStatus != null and tradingStatus != ''">
77
+            and t.trading_status = #{tradingStatus}
78
+        </if>
79
+        <if test="startDate != null and startDate != ''">
80
+            and t.create_date > #{startDate}
81
+        </if>
82
+        <if test="endDate != null and endDate != ''">
83
+            and t.create_date &lt; #{endDate}
84
+        </if>
85
+        <if test="receivePhone != null and receivePhone != ''">
86
+            and c.phone like concat('%', #{receivePhone}, '%')
87
+        </if>
88
+        <if test="itemType != null and itemType != ''">
89
+            and a.item_type = #{itemType}
90
+        </if>
91
+        <if test="miniAppName != null and miniAppName != ''">
92
+            and b.name like concat('%', #{miniAppName}, '%')
93
+        </if>
94
+        GROUP BY t.order_id
95
+    </select>
96
+
97
+    <select id="orderListByRechargeOrRefundExport" resultType="com.huiju.estateagents.redpack.entity.TaOrgOrder">
98
+        select
99
+        t.trade_no,
100
+        t.amount,
101
+        b.name as miniAppName,
102
+        t.is_offline,
103
+        t.create_date,
104
+        t.trading_status,
105
+        t.pay_date
106
+        <if test="orderType == 'recharge' || orderType == 'refund'">
107
+            d.audit_status,
108
+            d.audit_result,
109
+        </if>
110
+        GROUP_CONCAT(c.url) as certificateList
111
+        From ta_org_order t
112
+        left join ta_org_order_detail a on t.order_id = a.order_id
113
+        left join ta_miniapp b on t.org_id = b.org_id
114
+        left join ta_org_account_certificate c on t.order_id = c.order_id
115
+        <if test="orderType == 'recharge' || orderType == 'refund'">
116
+            left join ta_org_refund_application d on d.org_id = t.org_id
117
+        </if>
118
+        where
119
+        a.item_type = #{orderType}
120
+        <if test="orgId != null and orgId != ''">
121
+            and t.org_id = #{orgId}
122
+        </if>
123
+        <if test="tradeNo != null and tradeNo != ''">
124
+            and t.trade_no like concat('%', #{tradeNo}, '%')
125
+        </if>
126
+        <if test="isOffline != null and isOffline != ''">
127
+            and t.is_offline = #{isOffline}
128
+        </if>
129
+        <if test="tradingStatus != null ">
130
+            and t.trading_status = #{tradingStatus}
131
+        </if>
132
+        <if test="startDate != null and startDate != ''">
133
+            and t.create_date > #{startDate}
134
+        </if>
135
+        <if test="endDate != null and endDate != ''">
136
+            and t.create_date &lt; #{endDate}
137
+        </if>
138
+        <if test="miniAppName != null and miniAppName != ''">
139
+            and b.name like concat('%', #{miniAppName}, '%')
140
+        </if>
141
+        GROUP BY t.order_id
142
+    </select>
143
+
144
+    <select id="orderListByConsumeExport" resultType="com.huiju.estateagents.redpack.entity.TaOrgOrder">
145
+        select
146
+        t.trade_no,
147
+        b.name as miniAppName,
148
+        t.amount,
149
+        t.create_date,
150
+        c.phone,
151
+        t.trading_status,
152
+        "红包" as consumeType,
153
+        d.`name` as activityName
154
+        From ta_org_order t
155
+        left join ta_org_order_detail a on t.order_id = a.order_id
156
+        left join ta_miniapp b on t.org_id = b.org_id
157
+        left join ta_person c on a.receiver_id = c.person_id
158
+        left join ta_drainage d on a.target_id = d.drainage_id
159
+        where
160
+        a.item_type = #{orderType}
161
+        <if test="orgId != null and orgId != ''">
162
+            and t.org_id = #{orgId}
163
+        </if>
164
+        <if test="tradeNo != null and tradeNo != ''">
165
+            and t.trade_no like concat('%', #{tradeNo}, '%')
70 166
         </if>
71 167
         <if test="tradingStatus != null and tradingStatus != ''">
72 168
             and t.trading_status = #{tradingStatus}
@@ -83,6 +179,9 @@
83 179
         <if test="itemType != null and itemType != ''">
84 180
             and a.item_type = #{itemType}
85 181
         </if>
182
+        <if test="miniAppName != null and miniAppName != ''">
183
+            and b.name like concat('%', #{miniAppName}, '%')
184
+        </if>
86 185
         GROUP BY t.order_id
87 186
     </select>
88 187
 
@@ -219,7 +318,7 @@
219 318
     </select>
220 319
 
221 320
     <select id="countTotalRechargeAmount" resultType="java.lang.Integer">
222
-        select sum(t.amount) as amount from ta_org_order t
321
+        select ifnull(sum(t.amount),0) as amount from ta_org_order t
223 322
         left join ta_org_order_detail a on t.order_id = a.order_id where t.org_id = #{orgId}
224 323
         and a.item_type = 'recharge'
225 324
     </select>