ANDRU-PC\Andru
2022-07-08 bf83faf881d659f0326b01e52ce37bc5eeecfc0d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
package com.hx.phip.service.userMoney.impl;
 
import javax.annotation.Resource;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hx.common.service.CommonService;
import com.hx.phiappt.common.OperationReasonConstants;
import com.hx.phiappt.common.OriginChannelConstants;
import com.hx.phiappt.constants.tool.money.UserMoneyTool;
import com.hx.phiappt.model.*;
import com.hx.phiappt.model.order.OrderItem;
import com.hx.phiappt.model.order.OrdersTotal;
import com.hx.phip.common.wx.corp.WeiXinMpUtil;
import com.hx.phip.config.CustomParameter;
import com.hx.phip.dao.mapper.*;
import com.hx.phip.model.ApplyParameter;
import com.hx.phip.model.SysParameter;
import com.hx.phip.service.UserIntegralRecordService;
import com.hx.phip.service.UserMoneyService;
import com.hx.phip.service.UserValueAddedFundRecordService;
import com.hx.phip.tool.ApplyParameterTool;
import com.hx.phip.tool.SendSMSTool;
import com.hx.util.AesUtil;
import com.hx.util.StringUtils;
import com.platform.constants.PlatformPattern;
import com.platform.exception.PlatTipsException;
import com.platform.resultTool.PlatformCode;
import com.platform.resultTool.SystemCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import com.hx.exception.TipsException;
import com.hx.phiappt.model.userMoney.UserMoneyUnclaimed;
import com.hx.phip.service.userMoney.UserMoneyUnclaimedService;
import com.hx.mybatisTool.SqlSentence;
 
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Transactional
@Service
public class UserMoneyUnclaimedServiceImpl implements UserMoneyUnclaimedService {
 
    private static final Logger logger = LoggerFactory.getLogger(UserMoneyUnclaimedServiceImpl.class);
 
    @Resource
    private CommonService commonService;
    @Resource
    private CustomParameter customParameter;
    @Resource
    private UserMoneyService userMoneyService;
    @Resource
    private UserMoneyUnclaimedMapper userMoneyUnclaimedMapper;
    @Resource
    private UserIntegralRecordService userIntegralRecordService;
    @Resource
    private UserValueAddedFundRecordService userValueAddedFundRecordService;
 
    /**
     * 查询列表
     */
    @Override
    public List<UserMoneyUnclaimed> selectList(SqlSentence sqlSentence) {
        return userMoneyUnclaimedMapper.selectList(sqlSentence);
    }
 
    /**
     * 查询列表
     */
    @Override
    public List<Map<String, Object>> selectListMap(SqlSentence sqlSentence) {
        return userMoneyUnclaimedMapper.selectListMap(sqlSentence);
    }
 
    /**
     * 查询单个
     */
    @Override
    public UserMoneyUnclaimed selectOne(SqlSentence sqlSentence) {
        return userMoneyUnclaimedMapper.selectOne(sqlSentence);
    }
 
    /**
     * 查询单个
     */
    @Override
    public Map<String, Object> selectOneMap(SqlSentence sqlSentence) {
        return userMoneyUnclaimedMapper.selectOneMap(sqlSentence);
    }
 
    /**
     * 查询单个,大数据不拿取
     */
    @Override
    public UserMoneyUnclaimed selectOneByKey(Object object) {
        return userMoneyUnclaimedMapper.selectOneByKey(object);
    }
 
    /**
     * 查询单个,大数据拿取
     */
    @Override
    public UserMoneyUnclaimed selectOneByKeyBlob(Object object) {
        return userMoneyUnclaimedMapper.selectOneByKeyBlob(object);
    }
 
    /**
     * 新增
     */
    @Override
    public void insert(UserMoneyUnclaimed userMoneyUnclaimed) {
        int count = userMoneyUnclaimedMapper.insert(userMoneyUnclaimed);
        if (count != 1) {
            throw new TipsException("新增失败!");
        } else {
            // 重新获取下数据
            UserMoneyUnclaimed checkUserMoneyUnclaimed = userMoneyUnclaimedMapper.selectOneByKey(userMoneyUnclaimed.getId());
            if(checkUserMoneyUnclaimed != null) {
                // 过滤待领取的数据
                this.handlerReceiveData(checkUserMoneyUnclaimed, BaseEntity.YES);
            }
        }
    }
 
    /**
     * 修改
     */
    @Override
    public void updateAll(UserMoneyUnclaimed userMoneyUnclaimed) {
        int count = userMoneyUnclaimedMapper.updateAll(userMoneyUnclaimed);
        if (count != 1) {
            throw new TipsException("保存失败!");
        }
    }
 
    /**
     * 修改
     */
    @Override
    public void updateWhere(SqlSentence sqlSentence) {
        int count = userMoneyUnclaimedMapper.updateWhere(sqlSentence);
        if (count != 1) {
            throw new TipsException("保存失败!");
        }
    }
 
    /**
     * 删除一个
     */
    @Override
    public void deleteOne(String delId) {
        int count = userMoneyUnclaimedMapper.deleteById(delId);
        if (count != 1) {
            throw new TipsException("删除失败!");
        }
    }
 
    /**
     * 查询条数
     */
    @Override
    public int selectCount(SqlSentence sqlSentence) {
        int count = userMoneyUnclaimedMapper.selectCount(sqlSentence);
        return count;
    }
 
    /**
     * 校验参数
     *
     * @param userMoneyUnclaimed 用户待领取列表
     */
    @Override
    public void checkParam(UserMoneyUnclaimed userMoneyUnclaimed) {
        // 用户校验
        if (StringUtils.isEmpty(userMoneyUnclaimed.getUserId())) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户id不能为空");
        }
 
        // 资金类型判断
        if (userMoneyUnclaimed.getFundType() == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "资金类型不能为空");
        } else {
            // 资金类型判断是否匹配
            switch (userMoneyUnclaimed.getFundType()) {
                case UserMoneyUnclaimed.FUND_TYPE_STORED_VALUE_FUND:
                case UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND:
                case UserMoneyUnclaimed.FUND_TYPE_INTEGRAL:
                case UserMoneyUnclaimed.FUND_TYPE_DEPOSIT:
                    break;
                default:
                    throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "资金类型错误,类型不存在");
            }
        }
 
        // 来源渠道
        if (StringUtils.isEmpty(userMoneyUnclaimed.getOriginChannel())) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "来源渠道不能为空");
        } else {
            if (checkConstantNotHaveValue(OriginChannelConstants.class, userMoneyUnclaimed.getOriginChannel())) {
                throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "来源渠道错误,渠道不存在");
            }
        }
 
        // 操作原因
        if(StringUtils.isEmpty(userMoneyUnclaimed.getOperationReason())){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作原因不能为空");
        } else {
            if (checkConstantNotHaveValue(OperationReasonConstants.class, userMoneyUnclaimed.getOperationReason())) {
                throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作原因错误,渠道不存在");
            }
        }
 
        // 操作类型
        if (userMoneyUnclaimed.getOpType() == null) {
            // 默认为系统处理
            userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_SYSTEM);
            // 增值金默认需要领取
            if (UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND == userMoneyUnclaimed.getFundType()) {
                // 增值金默认需要领取 负数不用用户领取和判断是否需要发送短信提醒领取
                if(BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) < 0) {
                    userMoneyUnclaimed.setOpType(UserMoneyUnclaimed.OP_TYPE_RECEIVE);
                }
            }
        } else {
            // 判断是否是支持的类型
            if (UserMoneyUnclaimed.OP_TYPE_SYSTEM != userMoneyUnclaimed.getOpType() && UserMoneyUnclaimed.OP_TYPE_RECEIVE != userMoneyUnclaimed.getOpType()) {
                throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作类型错误");
            }
        }
 
        // 是否发送短信
        if(UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType()){
            // 校验是否要发送短信
            checkIsNeedSentSMS(userMoneyUnclaimed);
        }
 
        // 判断操作数量或金额
        if (userMoneyUnclaimed.getOpNumber() == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作数量或金额不能为空");
        } else {
            // 判断操作数量或金额 是否为 0
            if (BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) == 0) {
                throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作数量或金额不能为0");
            } else if (BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) < 0) {
                // 资金操作类型-增加
                userMoneyUnclaimed.setFundOpType(UserMoneyUnclaimed.FUND_OP_TYPE_INCREASE);
            } else if (BigDecimal.ZERO.compareTo(userMoneyUnclaimed.getOpNumber()) > 0) {
                // 资金操作类型-减少
                userMoneyUnclaimed.setFundOpType(UserMoneyUnclaimed.FUND_OP_TYPE_REDUCE);
            }
 
            // 用户资金数据校验
            UserMoney userMoney = userMoneyService.selectUserIdDecrypt(userMoneyUnclaimed.getUserId());
            if (userMoney == null) {
                throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户的资产数据不存在");
            } else {
                // 判断数量减扣数量是否充足
                if (UserMoneyUnclaimed.FUND_OP_TYPE_REDUCE == userMoneyUnclaimed.getFundOpType()) {
                    // 资金类型判断是否匹配
                    switch (userMoneyUnclaimed.getFundType()) {
                        case UserMoneyUnclaimed.FUND_TYPE_STORED_VALUE_FUND:
                            // 金额操作
                            BigDecimal storedValueFund = new BigDecimal(userMoney.getStoredValueFund());
                            checkCanOperation(storedValueFund, userMoneyUnclaimed.getOpNumber());
                            break;
                        case UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND:
                            // 金额操作 不做校验可以减成负数
                            /*BigDecimal valueAddedFund = new BigDecimal(userMoney.getValueAddedFund());
                            checkCanOperation(valueAddedFund, userMoneyUnclaimed.getOpNumber());*/
                            break;
                        case UserMoneyUnclaimed.FUND_TYPE_INTEGRAL:
                            // 积分操作
                            BigDecimal integral = new BigDecimal(userMoney.getIntegral());
                            checkCanOperation(integral, userMoneyUnclaimed.getOpNumber());
                            break;
                        case UserMoneyUnclaimed.FUND_TYPE_DEPOSIT:
                            // 金额操作
                            BigDecimal deposit = new BigDecimal(userMoney.getDeposit());
                            checkCanOperation(deposit, userMoneyUnclaimed.getOpNumber());
                            break;
                    }
                }
            }
        }
 
        // 操作人信息判断
        if (userMoneyUnclaimed.getOperatorType() == null) {
            // 操作人类型默认为员工
            userMoneyUnclaimed.setOperatorType(UserMoneyUnclaimed.OPERATOR_TYPE_EMPLOYEE);
        } else {
            // 操作人类型判断是否匹配
            switch (userMoneyUnclaimed.getOperatorType()) {
                case UserMoneyUnclaimed.OPERATOR_TYPE_ADMIN:
                case UserMoneyUnclaimed.OPERATOR_TYPE_USER:
                case UserMoneyUnclaimed.OPERATOR_TYPE_EMPLOYEE:
                    break;
                default:
                    throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作人类型错误");
            }
        }
 
        // 判断是否传了操作人id
        if (StringUtils.isEmpty(userMoneyUnclaimed.getOperatorId())) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "操作人id不能为空");
        }
 
        // 操作人为员工
        if (UserMoneyUnclaimed.OPERATOR_TYPE_EMPLOYEE == userMoneyUnclaimed.getOperatorType()) {
            Employee employee = commonService.selectOneByKey(EmployeeMapper.class, userMoneyUnclaimed.getOperatorId());
            if (employee == null) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作人的信息不存在");
            } else {
                // 填充名称
                userMoneyUnclaimed.setOperatorName(employee.getCnName());
            }
        }
 
        // 操作人为后台用户
        if (UserMoneyUnclaimed.OPERATOR_TYPE_ADMIN == userMoneyUnclaimed.getOperatorType()) {
            SysAdmin sysAdmin = commonService.selectOneByKey(SysAdminMapper.class, userMoneyUnclaimed.getOperatorId());
            if (sysAdmin == null) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作人的信息不存在");
            } else {
                // 填充名称
                userMoneyUnclaimed.setOperatorName(sysAdmin.getName());
            }
        }
 
        // 操作人为用户
        if (UserMoneyUnclaimed.OPERATOR_TYPE_USER == userMoneyUnclaimed.getOperatorType()) {
            User user = commonService.selectOneByKey(UserMapper.class, userMoneyUnclaimed.getOperatorId());
            if (user == null) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作人的信息不存在");
            } else {
                // 填充名称
                userMoneyUnclaimed.setOperatorName(user.getName());
            }
        }
 
        /*// 判断订单 先不判断订单
        if(!StringUtils.isEmpty(userMoneyUnclaimed.getOrderId())){
            OrdersTotal ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class, userMoneyUnclaimed.getOrderId());
            if(ordersTotal == null){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "主订单的信息不存在");
            }
        }
 
        // 判断子订单
        if(!StringUtils.isEmpty(userMoneyUnclaimed.getOrderItemId())){
            if(StringUtils.isEmpty(userMoneyUnclaimed.getOrderId())){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "主订单id不能为空!");
            }
            OrderItem orderItem = commonService.selectOneByKey(OrderItemMapper.class, userMoneyUnclaimed.getOrderItemId());
            if(orderItem == null){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "子订单的信息不存在");
            } else {
                if(!orderItem.getOrderId().equals(userMoneyUnclaimed.getOrderId())){
                    throw new PlatTipsException(PlatformCode.ERROR_TIPS, "子订单的信息与主订单的信息不匹配");
                }
            }
        }*/
 
        // 获取有效期时间配置 待领取默认30天领取
        Date validityTime = UserMoneyTool.getUnclaimedValidityTime(commonService);
        // 设置有效期时间
        userMoneyUnclaimed.setLimitEndTime(validityTime);
    }
 
    /**
     * 校验常量值是否存在
     * @param classObj 类对象
     * @param value 校验值
     * @return 返回
     */
    private boolean checkConstantNotHaveValue(Class classObj, String value) {
        boolean flag = true;
        // 判断是否存在这个来源渠道
        Field[] fields = classObj.getDeclaredFields();
        for (Field field : fields) {
            field.setAccessible(true);
            // 获取常量名称
            String fieldName = field.getName();
            // 判断常量值是否存在
            if (field.getType().toString().endsWith("java.lang.String") && Modifier.isStatic(field.getModifiers())) {
                try {
                    // 获取常量值
                    String fieldValue = field.get(classObj).toString();
                    if (fieldValue.equals(value)) {
                        flag = false;
                        break;
                    }
                }catch (Exception ex){
                    throw new PlatTipsException(PlatformCode.ERROR_TIPS, "常量获取配置出现错误");
 
                }
            }
        }
        return flag;
    }
 
    /**
     * 判断数据是否支持减扣
     */
    private void checkCanOperation(BigDecimal value, BigDecimal opNumber) {
        // 负数取反计算
        if(BigDecimal.ZERO.compareTo(opNumber) > 0){
            opNumber = opNumber.negate();
        }
 
        // 计算账户余额是否支持减扣
        BigDecimal subtractValue = value.subtract(opNumber);
        if (subtractValue.compareTo(BigDecimal.ZERO) < 0) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "您的数量不足已减扣!");
        }
    }
 
    /**
     * 根据平台判断是否需要发送短信
     * @param userMoneyUnclaimed 用户待领取信息
     */
    private void checkIsNeedSentSMS(UserMoneyUnclaimed userMoneyUnclaimed) {
        // CRM不用发送短信领取其他平台需要发送短信领取
        // if(!OriginChannelConstants.ORIGIN_CHANNEL_CRM.equals(userMoneyUnclaimed.getOriginChannel())) {
        userMoneyUnclaimed.setIsSentSMS(BaseEntity.YES);
        String url = getSMSUrl();
        if (StringUtils.isEmpty(url)) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "获取发送短信链接地址出现异常!");
        }
        userMoneyUnclaimed.setSMSUrl(url);
        //}
    }
 
    /**
     * 生成需要发送短信的地址
     * @return 返回
     */
    private String getSMSUrl() {
        // 生成小程序链接
        String urlLink = null;
        // 正式区在拿取链接
        if (PlatformPattern.PROD.equals(customParameter.getPlatformPattern())) {
            //获取用户CRM小程序token
            ApplyParameter applyParameter = ApplyParameterTool.getMpParameter("wx71e6babac80abcee", commonService);
            if (applyParameter == null) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "mpId is error");
            }
 
            SysParameter sysParameter = WeiXinMpUtil.getAccessToken(commonService, applyParameter.getMpAppId(), AesUtil.aesDecryp(applyParameter.getMpSecretKey()));
            if (sysParameter == null) {
                throw new PlatTipsException(PlatformCode.ERROR_SYSTEM, "服务错误" + SystemCode.ERROR_GET_CORP_TOKEN);
            }
 
            String result = SendSMSTool.getAooLetUrl(sysParameter.getParamValue(), "/pages/recharge/incrementInfo", "", "release");
            if (!StringUtils.isEmpty(result)) {
                JSONObject jsonObject = JSON.parseObject(result);
                if (jsonObject.getInteger("errcode") != 0) {
                    throw new PlatTipsException(PlatformCode.ERROR_SYSTEM, "生成短信小程序路径错误:" + jsonObject.getString("msg") + SystemCode.ERROR_GET_CORP_TOKEN);
                }
                urlLink = jsonObject.getString("url_link");
            }
        } else {
            // 测试区跳转百度
            urlLink = "https://www.baidu.com";
        }
        return urlLink;
    }
 
    /**
     * 待领取资产处理
     * @param userMoneyUnclaimed 待领取数据
     * @param isReceive 是否过滤领取数据 0 否 1 是
     */
    @Override
    public void handlerReceiveData(UserMoneyUnclaimed userMoneyUnclaimed, Integer isReceive) {
        if (userMoneyUnclaimed != null) {
            // 多线程添加锁
            synchronized (this) {
                // 判断是不是要领取的数据
                if(BaseEntity.YES.equals(isReceive)) {
                    if (UserMoneyUnclaimed.OP_TYPE_RECEIVE == userMoneyUnclaimed.getOpType()) {
                        logger.info("待领取资产处理跳过,数据id:{},原因:需要领取数据", userMoneyUnclaimed.getId());
                        return;
                    }
                }
                // 判断是否处理了
                if(UserMoneyUnclaimed.STATUS_SUCCEED == userMoneyUnclaimed.getStatus()){
                    logger.info("待领取资产处理跳过,数据id:{},原因:数据已领取不需要再处理", userMoneyUnclaimed.getId());
                    return;
                }
                // 判断数据是否有效
                if(UserMoneyUnclaimed.NO.equals(userMoneyUnclaimed.getIsValid())){
                    logger.info("待领取资产处理跳过,数据id:{},原因:数据已失效无法领取", userMoneyUnclaimed.getId());
                    return;
                }
                // 操作资金处理
                switch (userMoneyUnclaimed.getFundType()) {
                    case UserMoneyUnclaimed.FUND_TYPE_STORED_VALUE_FUND:
                    case UserMoneyUnclaimed.FUND_TYPE_DEPOSIT:
                        // 储值金和预定金只处理总资金信息
                        userMoneyService.handleMoneyData(userMoneyUnclaimed);
                        break;
                    case UserMoneyUnclaimed.FUND_TYPE_VALUE_ADDED_FUND:
                        // 处理增值金
                        userValueAddedFundRecordService.handleData(userMoneyUnclaimed);
                        break;
                    case UserMoneyUnclaimed.FUND_TYPE_INTEGRAL:
                        // 处理积分
                        userIntegralRecordService.handleData(userMoneyUnclaimed);
                        break;
                }
 
                // 更新状态成已处理
                SqlSentence sqlSentence = new SqlSentence();
                Map<String, Object> sqlValue = new HashMap<>();
                String sql = " status=#{m.status},receiveTime=#{m.nowTime},limitEndTime=#{m.limitEndTime},editTime=#{m.nowTime} WHERE id=#{m.id}";
                sqlValue.put("id", userMoneyUnclaimed.getId());
                sqlValue.put("status", UserMoneyUnclaimed.STATUS_SUCCEED);
                // 已领取调整领取时间
                Date receivedValidityTime = UserMoneyTool.getReceivedValidityTime(commonService);
                sqlValue.put("limitEndTime", receivedValidityTime);
                sqlValue.put("nowTime",new Date());
                sqlSentence.sqlSentence(sql, sqlValue);
                commonService.updateWhere(UserMoneyUnclaimedMapper.class, sqlSentence);
            }
        }
    }
}