魏超 5 vuotta sitten
vanhempi
commit
b552a47a99

+ 4
- 0
src/main/java/com/huiju/estateagents/common/NumberUtils.java Näytä tiedosto

11
     public static Integer yuanToFen(String amount){
11
     public static Integer yuanToFen(String amount){
12
         return new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
12
         return new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
13
     }
13
     }
14
+
15
+    public static String  fenToYuan(String price) {
16
+        return BigDecimal.valueOf(Long.valueOf(price)).divide(new BigDecimal(100)).toString();
17
+    }
14
 }
18
 }

+ 56
- 0
src/main/java/com/huiju/estateagents/redpack/controller/TaOrgAccountController.java Näytä tiedosto

1
 package com.huiju.estateagents.redpack.controller;
1
 package com.huiju.estateagents.redpack.controller;
2
 
2
 
3
+import java.io.IOException;
4
+import java.util.ArrayList;
5
+import java.util.List;
6
+
7
+import com.alibaba.excel.EasyExcel;
8
+import com.alibaba.excel.ExcelWriter;
9
+import com.alibaba.excel.write.metadata.WriteSheet;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
10
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
11
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
12
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
13
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
14
 import com.huiju.estateagents.base.ResponseBean;
15
+import com.huiju.estateagents.common.NumberUtils;
8
 import com.huiju.estateagents.common.StringUtils;
16
 import com.huiju.estateagents.common.StringUtils;
17
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
18
+import com.huiju.estateagents.redpack.entity.OrgAccountExport;
19
+import com.huiju.estateagents.redpack.entity.RechargeOrder;
9
 import com.huiju.estateagents.redpack.entity.TaOrgAccount;
20
 import com.huiju.estateagents.redpack.entity.TaOrgAccount;
10
 import com.huiju.estateagents.redpack.entity.TaOrgOrder;
21
 import com.huiju.estateagents.redpack.entity.TaOrgOrder;
11
 import com.huiju.estateagents.redpack.entity.TaOrgRefundApplication;
22
 import com.huiju.estateagents.redpack.entity.TaOrgRefundApplication;
20
 import org.springframework.web.bind.annotation.*;
31
 import org.springframework.web.bind.annotation.*;
21
 
32
 
22
 import javax.servlet.http.HttpServletRequest;
33
 import javax.servlet.http.HttpServletRequest;
34
+import javax.servlet.http.HttpServletResponse;
23
 
35
 
24
 /**
36
 /**
25
  * <p>
37
  * <p>
88
         return responseBean;
100
         return responseBean;
89
     }
101
     }
90
 
102
 
103
+    /**
104
+     * 账户信息导出
105
+     *
106
+     * @return
107
+     */
108
+    @RequestMapping(value = "/channel/taOrgAccount/taOrgAccountListExport")
109
+    public void taOrgAccountListExport(@RequestParam(value = "miniAppName", required = false) String miniAppName,
110
+                                    HttpServletRequest request, HttpServletResponse response) throws IOException {
111
+        response.setContentType("application/octet-stream");
112
+        response.setCharacterEncoding("utf-8");
113
+        response.setHeader("Content-disposition", "attachment;filename=账户统计.xlsx");
114
+
115
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), OrgAccountExport.class).registerWriteHandler(new CustomCellWriteHandler()).build();
116
+        WriteSheet writeSheet = EasyExcel.writerSheet("活动统计").build();
117
+
118
+        // 设置 sheet, 同一个sheet只需要设置一次
119
+        //使用分页插件
120
+        QueryWrapper<TaOrgAccount> queryWrapper = new QueryWrapper<>();
121
+        queryWrapper.like(!StringUtils.isEmpty(miniAppName), "miniapp_name", miniAppName);
122
+        queryWrapper.orderByDesc("create_date");
123
+
124
+        List<OrgAccountExport> data = new ArrayList<>();
125
+        List<TaOrgAccount> result = iTaOrgAccountService.list(queryWrapper);
126
+
127
+        result.forEach(e -> {
128
+            Integer totalRechargeAmount = taOrgOrderMapper.countTotalRechargeAmount(e.getOrgId());
129
+            //查询退款冻结额
130
+            Integer totalBlockAmount = taOrgAccountBlockedMapper.countTotalBlockAmount(e.getOrgId());
131
+            OrgAccountExport export = new OrgAccountExport();
132
+            export.setMiniAppName(e.getMiniappName());
133
+            export.setTotalRecharge(NumberUtils.fenToYuan(taOrgOrderMapper.countTotalRechargeAmount(e.getOrgId()).toString()));
134
+            export.setConsumeAmount(NumberUtils.fenToYuan(e.getPurchaseAmount().toString()));
135
+            export.setRefundAmount(NumberUtils.fenToYuan(e.getTotalRefund().toString()));
136
+            Integer balance = totalRechargeAmount - e.getPurchaseAmount() - e.getTotalRefund() - totalBlockAmount;
137
+            export.setBalance(NumberUtils.fenToYuan(totalRechargeAmount.toString()));
138
+
139
+            data.add(export);
140
+        });
141
+
142
+        excelWriter.write(data, writeSheet);
143
+        // finish 会帮忙关闭流
144
+        excelWriter.finish();
145
+    }
146
+
91
     /**
147
     /**
92
      * 保存对象
148
      * 保存对象
93
      *
149
      *

+ 3
- 2
src/main/java/com/huiju/estateagents/redpack/controller/TaOrgOrderController.java Näytä tiedosto

85
                                        @RequestParam(value = "miniAppName", required = false) String miniAppName,
85
                                        @RequestParam(value = "miniAppName", required = false) String miniAppName,
86
                                        @RequestParam(value = "itemType", required = false) String itemType,
86
                                        @RequestParam(value = "itemType", required = false) String itemType,
87
                                        @RequestParam(value = "startDate", required = false) String startDate,
87
                                        @RequestParam(value = "startDate", required = false) String startDate,
88
-                                       @RequestParam(value = "endDate", required = false) String endDate) {
88
+                                       @RequestParam(value = "endDate", required = false) String endDate,
89
+                                       @RequestParam(value = "auditStatus", required = false) String auditStatus) {
89
         ResponseBean responseBean = new ResponseBean();
90
         ResponseBean responseBean = new ResponseBean();
90
         try {
91
         try {
91
             //使用分页插件
92
             //使用分页插件
92
             IPage<TaOrgOrder> pg = new Page<>(pageNum, pageSize);
93
             IPage<TaOrgOrder> pg = new Page<>(pageNum, pageSize);
93
-            IPage<TaOrgOrder> result = iTaOrgOrderService.listByCondition(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, receivePhone, itemType, startDate, endDate, miniAppName);
94
+            IPage<TaOrgOrder> result = iTaOrgOrderService.listByCondition(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, receivePhone, itemType, startDate, endDate, miniAppName, auditStatus);
94
             responseBean.addSuccess(result);
95
             responseBean.addSuccess(result);
95
         } catch (Exception e) {
96
         } catch (Exception e) {
96
             e.printStackTrace();
97
             e.printStackTrace();

+ 45
- 0
src/main/java/com/huiju/estateagents/redpack/entity/OrgAccountExport.java Näytä tiedosto

1
+package com.huiju.estateagents.redpack.entity;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+
6
+import lombok.Data;
7
+
8
+@Data
9
+public class OrgAccountExport {
10
+    /**
11
+     * 账户
12
+     */
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "账户", index = 0)
15
+    private String miniAppName;
16
+
17
+    /**
18
+     * 总充值金额
19
+     */
20
+    @ColumnWidth(15)
21
+    @ExcelProperty(value = "总充值金额", index = 1)
22
+    private String totalRecharge;
23
+
24
+    /**
25
+     * 消费金额
26
+     */
27
+    @ColumnWidth(15)
28
+    @ExcelProperty(value = "消费金额", index = 2)
29
+    private String consumeAmount;
30
+
31
+    /**
32
+     * 已退款金额
33
+     */
34
+    @ColumnWidth(15)
35
+    @ExcelProperty(value = "已退款金额", index = 3)
36
+    private String refundAmount;
37
+
38
+    /**
39
+     * 余额
40
+     */
41
+    @ColumnWidth(15)
42
+    @ExcelProperty(value = "余额", index = 4)
43
+    private String balance;
44
+
45
+}

+ 2
- 1
src/main/java/com/huiju/estateagents/redpack/mapper/TaOrgOrderMapper.java Näytä tiedosto

43
                                                   @Param("tradingStatus") String tradingStatus,
43
                                                   @Param("tradingStatus") String tradingStatus,
44
                                                   @Param("startDate") String startDate,
44
                                                   @Param("startDate") String startDate,
45
                                                   @Param("endDate") String endDate,
45
                                                   @Param("endDate") String endDate,
46
-                                                  @Param("miniAppName") String miniAppName);
46
+                                                  @Param("miniAppName") String miniAppName,
47
+                                                  @Param("auditStatus") String auditStatus);
47
 
48
 
48
     /**
49
     /**
49
      * 消费订单
50
      * 消费订单

+ 1
- 1
src/main/java/com/huiju/estateagents/redpack/service/ITaOrgOrderService.java Näytä tiedosto

51
      * @param orderType
51
      * @param orderType
52
      * @return
52
      * @return
53
      */
53
      */
54
-    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);
54
+    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, String auditStatus);
55
 
55
 
56
     /**
56
     /**
57
      * 充值订单列表导出
57
      * 充值订单列表导出

+ 6
- 6
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgOrderServiceImpl.java Näytä tiedosto

112
     private TaWxPayConfigMapper taWxPayConfigMapper;
112
     private TaWxPayConfigMapper taWxPayConfigMapper;
113
 
113
 
114
     @Override
114
     @Override
115
-    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) {
115
+    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, String auditStatus) {
116
         IPage<TaOrgOrder> result = pg;
116
         IPage<TaOrgOrder> result = pg;
117
 
117
 
118
         if (CommConstant.ITEM_TYPE_RECHARGE.equals(orderType) || CommConstant.ITEM_TYPE_REFUND.equals(orderType)) {
118
         if (CommConstant.ITEM_TYPE_RECHARGE.equals(orderType) || CommConstant.ITEM_TYPE_REFUND.equals(orderType)) {
119
             List<String> urlList = new ArrayList<>();
119
             List<String> urlList = new ArrayList<>();
120
-            result = taOrgOrderMapper.orderListByRechargeOrRefund(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, startDate, endDate, miniAppName);
120
+            result = taOrgOrderMapper.orderListByRechargeOrRefund(pg, orderType, orgId, tradeNo, isOffline, tradingStatus, startDate, endDate, miniAppName, auditStatus);
121
             result.getRecords().forEach(e -> {
121
             result.getRecords().forEach(e -> {
122
                 e.setCertificateUrlList(getCertificateByOrderId(e.getOrderId()));
122
                 e.setCertificateUrlList(getCertificateByOrderId(e.getOrderId()));
123
             });
123
             });
517
 
517
 
518
         //插入凭证记录
518
         //插入凭证记录
519
         if (CollectionUtils.isNotEmpty(refundApplication.getCertificateList())) {
519
         if (CollectionUtils.isNotEmpty(refundApplication.getCertificateList())) {
520
-            List<TaOrgAccountCertificate> taOrgAccountCertificateList = assembleAccountCertificate(refundApplication.getOrgId(), taOrgAccount, taOrgAccountDetailedList.getSerialNo(), taOrgOrder.getOrderId(), userId, CommConstant.ITEM_TYPE_REFUND);
520
+            List<TaOrgAccountCertificate> taOrgAccountCertificateList = assembleAccountCertificate(refundApplication, taOrgAccount, taOrgAccountDetailedList.getSerialNo(), taOrgOrder.getOrderId(), userId, CommConstant.ITEM_TYPE_REFUND);
521
             taOrgAccountCertificateList.forEach(e -> {
521
             taOrgAccountCertificateList.forEach(e -> {
522
                 taOrgAccountCertificateMapper.insert(e);
522
                 taOrgAccountCertificateMapper.insert(e);
523
             });
523
             });
660
      * @param userId
660
      * @param userId
661
      * @return
661
      * @return
662
      */
662
      */
663
-    public List<TaOrgAccountCertificate> assembleAccountCertificate(Integer orgId, TaOrgAccount taOrgAccount, Integer accountSerialNo, String orderId, Integer userId, String consumeType) {
663
+    public List<TaOrgAccountCertificate> assembleAccountCertificate(TaOrgRefundApplication taOrgRefundApplication, TaOrgAccount taOrgAccount, Integer accountSerialNo, String orderId, Integer userId, String consumeType) {
664
         SysUser taUser = selectUserById(userId);
664
         SysUser taUser = selectUserById(userId);
665
         List<TaOrgAccountCertificate> taOrgAccountCertificateList = new ArrayList<>();
665
         List<TaOrgAccountCertificate> taOrgAccountCertificateList = new ArrayList<>();
666
 
666
 
667
-        taOrgAccount.getCertificateList().forEach(e -> {
667
+        taOrgRefundApplication.getCertificateList().forEach(e -> {
668
             TaOrgAccountCertificate taOrgAccountCertificate = new TaOrgAccountCertificate();
668
             TaOrgAccountCertificate taOrgAccountCertificate = new TaOrgAccountCertificate();
669
-            taOrgAccountCertificate.setOrgId(orgId);
669
+            taOrgAccountCertificate.setOrgId(taOrgRefundApplication.getOrgId());
670
             taOrgAccountCertificate.setAccountId(taOrgAccount.getAccountId());
670
             taOrgAccountCertificate.setAccountId(taOrgAccount.getAccountId());
671
             taOrgAccountCertificate.setAccountSerialNo(accountSerialNo);
671
             taOrgAccountCertificate.setAccountSerialNo(accountSerialNo);
672
             taOrgAccountCertificate.setOrderId(orderId);
672
             taOrgAccountCertificate.setOrderId(orderId);

+ 2
- 2
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java Näytä tiedosto

54
     @RequestMapping(value = "/channel/listContactByCondition", method = RequestMethod.GET)
54
     @RequestMapping(value = "/channel/listContactByCondition", method = RequestMethod.GET)
55
     public ResponseBean listContactByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
55
     public ResponseBean listContactByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
56
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
56
                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
57
-                                               String contactName, String telephone, String phone, String job, String appellation) {
57
+                                               String contactName, String telephone, String phone, String job, String appellation, String contentType) {
58
         ResponseBean responseBean = new ResponseBean();
58
         ResponseBean responseBean = new ResponseBean();
59
         try {
59
         try {
60
             //使用分页插件
60
             //使用分页插件
65
             queryWrapper.like(!StringUtils.isEmpty(phone), "phone", phone);
65
             queryWrapper.like(!StringUtils.isEmpty(phone), "phone", phone);
66
             queryWrapper.like(!StringUtils.isEmpty(job), "job", job);
66
             queryWrapper.like(!StringUtils.isEmpty(job), "job", job);
67
             queryWrapper.like(!StringUtils.isEmpty(appellation), "appellation", appellation);
67
             queryWrapper.like(!StringUtils.isEmpty(appellation), "appellation", appellation);
68
-            queryWrapper.eq("contact_type", CommConstant.FINANCE);
68
+            queryWrapper.like(!StringUtils.isEmpty(contentType), "contact_type", contentType);
69
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
69
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
70
             queryWrapper.orderByDesc("order_no", "create_date");
70
             queryWrapper.orderByDesc("order_no", "create_date");
71
 
71
 

+ 3
- 0
src/main/resources/mapper/redpack/TaOrgOrderMapper.xml Näytä tiedosto

41
         <if test="tradingStatus != null and tradingStatus != ''">
41
         <if test="tradingStatus != null and tradingStatus != ''">
42
             and t.trading_status = #{tradingStatus}
42
             and t.trading_status = #{tradingStatus}
43
         </if>
43
         </if>
44
+        <if test="auditStatus != null and auditStatus != ''">
45
+            and d.audit_status = #{auditStatus}
46
+        </if>
44
         <if test="startDate != null and startDate != ''">
47
         <if test="startDate != null and startDate != ''">
45
             and t.create_date > #{startDate}
48
             and t.create_date > #{startDate}
46
         </if>
49
         </if>