|
@@ -1,31 +1,8 @@
|
1
|
1
|
package com.huiju.estateagents.redpack.service.impl;
|
2
|
2
|
|
3
|
|
-import java.io.ByteArrayOutputStream;
|
4
|
|
-import java.io.InputStream;
|
5
|
|
-import java.net.HttpURLConnection;
|
6
|
|
-import java.net.URL;
|
7
|
|
-import java.net.URLEncoder;
|
8
|
|
-import java.time.LocalDate;
|
9
|
|
-import java.time.LocalDateTime;
|
10
|
|
-import java.util.ArrayList;
|
11
|
|
-import java.util.Arrays;
|
12
|
|
-import java.util.HashMap;
|
13
|
|
-import java.util.List;
|
14
|
|
-import java.util.Map;
|
15
|
|
-import java.util.stream.Collectors;
|
16
|
|
-
|
17
|
|
-import javax.servlet.http.HttpServletResponse;
|
18
|
|
-
|
19
|
|
-import org.apache.commons.collections.CollectionUtils;
|
20
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
21
|
|
-import org.springframework.beans.factory.annotation.Value;
|
22
|
|
-import org.springframework.stereotype.Service;
|
23
|
|
-import org.springframework.transaction.annotation.Transactional;
|
24
|
|
-
|
25
|
3
|
import com.alibaba.excel.EasyExcel;
|
26
|
4
|
import com.alibaba.fastjson.JSONObject;
|
27
|
5
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
28
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
29
|
6
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
30
|
7
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
31
|
8
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -36,7 +13,6 @@ import com.huiju.estateagents.center.taUser.entity.TaUser;
|
36
|
13
|
import com.huiju.estateagents.center.taUser.mapper.TaUserMapper;
|
37
|
14
|
import com.huiju.estateagents.common.CommConstant;
|
38
|
15
|
import com.huiju.estateagents.common.CommonUtils;
|
39
|
|
-import com.huiju.estateagents.common.StringUtils;
|
40
|
16
|
import com.huiju.estateagents.common.wxpay.WXPay;
|
41
|
17
|
import com.huiju.estateagents.common.wxpay.WXPayConstants;
|
42
|
18
|
import com.huiju.estateagents.common.wxpay.WxConfig;
|
|
@@ -45,26 +21,34 @@ import com.huiju.estateagents.excel.redPacket.AccountConsumeRecordExport;
|
45
|
21
|
import com.huiju.estateagents.excel.redPacket.AccountPayRecordExport;
|
46
|
22
|
import com.huiju.estateagents.excel.redPacket.AccountRefundRecordExport;
|
47
|
23
|
import com.huiju.estateagents.mapper.TaWxPayConfigMapper;
|
48
|
|
-import com.huiju.estateagents.redpack.entity.ConsumeOrder;
|
49
|
|
-import com.huiju.estateagents.redpack.entity.RechargeOrder;
|
50
|
|
-import com.huiju.estateagents.redpack.entity.RefundOrder;
|
51
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgAccount;
|
52
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgAccountBlocked;
|
53
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgAccountCertificate;
|
54
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgAccountDetailedList;
|
55
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgOrder;
|
56
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgOrderDetail;
|
57
|
|
-import com.huiju.estateagents.redpack.entity.TaOrgRefundApplication;
|
58
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgAccountBlockedMapper;
|
59
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgAccountCertificateMapper;
|
60
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgAccountDetailedListMapper;
|
61
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgAccountMapper;
|
62
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgOrderDetailMapper;
|
63
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgOrderMapper;
|
64
|
|
-import com.huiju.estateagents.redpack.mapper.TaOrgRefundApplicationMapper;
|
|
24
|
+import com.huiju.estateagents.redpack.entity.*;
|
|
25
|
+import com.huiju.estateagents.redpack.mapper.*;
|
|
26
|
+import com.huiju.estateagents.redpack.service.ITaOrgAccountService;
|
65
|
27
|
import com.huiju.estateagents.redpack.service.ITaOrgOrderService;
|
66
|
|
-
|
|
28
|
+import com.huiju.estateagents.sample.entity.TaContact;
|
|
29
|
+import com.huiju.estateagents.sample.mapper.TaContactMapper;
|
67
|
30
|
import lombok.extern.slf4j.Slf4j;
|
|
31
|
+import org.apache.commons.collections.CollectionUtils;
|
|
32
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
33
|
+import org.springframework.beans.factory.annotation.Value;
|
|
34
|
+import org.springframework.stereotype.Service;
|
|
35
|
+import org.springframework.transaction.annotation.Transactional;
|
|
36
|
+
|
|
37
|
+import javax.servlet.http.HttpServletResponse;
|
|
38
|
+import java.io.ByteArrayOutputStream;
|
|
39
|
+import java.io.InputStream;
|
|
40
|
+import java.net.HttpURLConnection;
|
|
41
|
+import java.net.URL;
|
|
42
|
+import java.net.URLEncoder;
|
|
43
|
+import java.time.LocalDate;
|
|
44
|
+import java.time.LocalDateTime;
|
|
45
|
+import java.util.ArrayList;
|
|
46
|
+import java.util.HashMap;
|
|
47
|
+import java.util.List;
|
|
48
|
+import java.util.Map;
|
|
49
|
+import java.util.concurrent.ExecutorService;
|
|
50
|
+import java.util.concurrent.Executors;
|
|
51
|
+import java.util.stream.Collectors;
|
68
|
52
|
|
69
|
53
|
/**
|
70
|
54
|
* <p>
|
|
@@ -111,6 +95,12 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
111
|
95
|
@Autowired
|
112
|
96
|
private TaWxPayConfigMapper taWxPayConfigMapper;
|
113
|
97
|
|
|
98
|
+ @Autowired
|
|
99
|
+ private TaContactMapper taContactMapper;
|
|
100
|
+
|
|
101
|
+ @Autowired
|
|
102
|
+ private ITaOrgAccountService taOrgAccountService;
|
|
103
|
+
|
114
|
104
|
@Override
|
115
|
105
|
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
|
106
|
IPage<TaOrgOrder> result = pg;
|
|
@@ -148,7 +138,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
148
|
138
|
return result;
|
149
|
139
|
}
|
150
|
140
|
|
151
|
|
- public List<String> getCertificateByOrderId(String orderId){
|
|
141
|
+ public List<String> getCertificateByOrderId(String orderId) {
|
152
|
142
|
List<String> urlList = new ArrayList<>();
|
153
|
143
|
QueryWrapper<TaOrgAccountCertificate> taOrgAccountCertificateQueryWrapper = new QueryWrapper<>();
|
154
|
144
|
taOrgAccountCertificateQueryWrapper.eq("order_id", orderId);
|
|
@@ -156,6 +146,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
156
|
146
|
urlList = taOrgAccountCertificates.stream().map(TaOrgAccountCertificate::getUrl).collect(Collectors.toList());
|
157
|
147
|
return urlList;
|
158
|
148
|
}
|
|
149
|
+
|
159
|
150
|
/**
|
160
|
151
|
* 微信支付
|
161
|
152
|
*
|
|
@@ -257,6 +248,18 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
257
|
248
|
return payResult;
|
258
|
249
|
}
|
259
|
250
|
|
|
251
|
+ // 4.发送短信
|
|
252
|
+ ExecutorService threadPool = Executors.newCachedThreadPool();
|
|
253
|
+ threadPool.execute(() -> {
|
|
254
|
+ List<TaContact> taContacts = taOrgAccountService.selectSmsContactUser();
|
|
255
|
+ if (CollectionUtils.isNotEmpty(taContacts)) {
|
|
256
|
+ TaContact taContact = taContacts.get(0);
|
|
257
|
+ String[] smsParams = {"业务平台充值提醒", taOrgOrder.getTradeNo()};
|
|
258
|
+ // 短信发送
|
|
259
|
+ taOrgAccountService.sendSmsMessage(taContact.getPhone(), CommConstant.ITEM_TYPE_RECHARGE, smsParams);
|
|
260
|
+ }
|
|
261
|
+ });
|
|
262
|
+
|
260
|
263
|
JSONObject obj = new JSONObject();
|
261
|
264
|
obj.put("amount", amount);
|
262
|
265
|
obj.put("realAmount", realAmount);
|
|
@@ -348,8 +351,30 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
|
348
|
351
|
return responseBean;
|
349
|
352
|
}
|
350
|
353
|
|
351
|
|
- // 5.更新账户新金额
|
|
354
|
+ // 5.创建冻结表数据
|
|
355
|
+ TaOrgAccountBlocked taOrgAccountBlocked = new TaOrgAccountBlocked();
|
|
356
|
+ taOrgAccountBlocked.setAccountId(taOrgAccount.getAccountId());
|
|
357
|
+ taOrgAccountBlocked.setBlockedBalance(amount);
|
|
358
|
+ taOrgAccountBlocked.setBlockedReason("线上退款申请");
|
|
359
|
+ taOrgAccountBlocked.setCreateDate(LocalDateTime.now());
|
|
360
|
+ taOrgAccountBlocked.setStatus(CommConstant.STATUS_NORMAL);
|
|
361
|
+ taOrgAccountBlocked.setOrgId(orgId);
|
|
362
|
+ taOrgAccountBlockedMapper.insert(taOrgAccountBlocked);
|
|
363
|
+
|
|
364
|
+ // 6.更新账户新金额
|
352
|
365
|
taOrgAccountMapper.updateAvailableBalanceById(taOrgAccount.getAccountId(), amount);
|
|
366
|
+
|
|
367
|
+ // 7.发送短信
|
|
368
|
+ ExecutorService threadPool = Executors.newCachedThreadPool();
|
|
369
|
+ threadPool.execute(() -> {
|
|
370
|
+ List<TaContact> taContacts = taOrgAccountService.selectSmsContactUser();
|
|
371
|
+ if (CollectionUtils.isNotEmpty(taContacts)) {
|
|
372
|
+ TaContact taContact = taContacts.get(0);
|
|
373
|
+ String[] smsParams = {"业务平台退款申请", taOrgOrder.getTradeNo()};
|
|
374
|
+ // 短信发送
|
|
375
|
+ taOrgAccountService.sendSmsMessage(taContact.getPhone(), CommConstant.ITEM_TYPE_RECHARGE, smsParams);
|
|
376
|
+ }
|
|
377
|
+ });
|
353
|
378
|
responseBean.addSuccess(taOrgOrder);
|
354
|
379
|
return responseBean;
|
355
|
380
|
}
|