From eb80b83a3d4a0b59325e90405dc6c687c2904d3a Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期三, 05 一月 2022 14:45:16 +0800 Subject: [PATCH] 商家后台相关代码提交 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java index e35bdb4..5eab07b 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActIntegralUserTradeServiceImpl.java @@ -101,10 +101,6 @@ @Override public Long addIntegralTradeRecord(Long userId, Long integralId, Long communityId, Long serviceId, Integer serviceType, Integer amount, Integer changeType, String remark, Integer identityType, Long createBy) { - if (amount < 0) { - changeType = ComActIntegralUserTradeDO.changeType.reduce; - amount = Math.abs(amount); - } ComActIntegralUserTradeDO integralUserTradeDO = new ComActIntegralUserTradeDO(); integralUserTradeDO.setId(Snowflake.getId()); integralUserTradeDO.setUserId(userId); @@ -195,6 +191,8 @@ StringBuilder remark = new StringBuilder(); // 当前时间 Date nowDate = new Date(); + + Integer changeType = ComActIntegralUserTradeDO.changeType.add; Integer isVolunteer = integralUserDTO.getIsVolunteer(); @@ -316,6 +314,7 @@ remark.append("】"); break; case 8: + changeType = ComActIntegralUserTradeDO.changeType.reduce; if (integralUserDTO.getActivityType() == 1) { ComActActivityDO actActivityDO2 = comActActivityService.getById(serviceId); if (actActivityDO2 != null) { @@ -411,9 +410,10 @@ integralUserDO.setIntegralVolunteer(integralVolunteerNow); integralUserDO.setIntegralAvailableVolunteer(addIntegral(integralUserDO.getIntegralAvailableVolunteer() + amount)); } - if (reduceAmount > 0) { - integralUserDO.setIntegralSum(addIntegral(integralSum + reduceAmount)); - integralUserDO.setIntegralAvailableSum(addIntegral(integralAvailableSum + reduceAmount)); + if (changeType == ComActIntegralUserTradeDO.changeType.reduce) { + amount = reduceAmount; + integralUserDO.setIntegralSum(addIntegral(integralSum - reduceAmount)); + integralUserDO.setIntegralAvailableSum(addIntegral(integralAvailableSum - reduceAmount)); } else { integralUserDO.setIntegralSum(addIntegral(integralSum + amount)); integralUserDO.setIntegralAvailableSum(addIntegral(integralAvailableSum + amount)); @@ -424,7 +424,7 @@ comActIntegralUserService.updateById(integralUserDO); // 增加积分账户交易记录 Long tradeId = this.addIntegralTradeRecord(userId, integralId, communityId, serviceId, type, amount, - ComActIntegralUserTradeDO.changeType.add, remark.toString(), identityType, 2L); + changeType, remark.toString(), identityType, 2L); // 增加积分账户变更记录 comActIntegralUserChangeService.addIntegralUserChangeRecord(userId, integralId, communityId, integralSum, integralUserDO.getIntegralSum(), integralAvailableSum, integralUserDO.getIntegralAvailableSum(), -- Gitblit v1.7.1