| | |
| | | @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); |
| | |
| | | // 当前时间 |
| | | Date nowDate = new Date(); |
| | | |
| | | Integer changeType = ComActIntegralUserTradeDO.changeType.add; |
| | | |
| | | Integer isVolunteer = integralUserDTO.getIsVolunteer(); |
| | | |
| | | if (!type.equals(8)) { |
| | |
| | | break; |
| | | case 6: |
| | | identityType = 2; |
| | | remark.append("参与党员活动"); |
| | | remark.append("成功参加党员活动奖励积分"); |
| | | ComActActivityDO actActivityDO3 = comActActivityService.getById(serviceId); |
| | | if(actActivityDO3 != null) { |
| | | amount = actActivityDO3.getRewardIntegral(); |
| | | } |
| | | break; |
| | | case 7: |
| | | // 查询调查问卷 |
| | |
| | | remark.append("】"); |
| | | break; |
| | | case 8: |
| | | if (integralUserDTO.getActivityType() == 1) { |
| | | changeType = ComActIntegralUserTradeDO.changeType.reduce; |
| | | ComActActivityDO actActivityDO2 = comActActivityService.getById(serviceId); |
| | | if (actActivityDO2 != null) { |
| | | amount = -actActivityDO2.getCancelDeduct(); |
| | | if (actActivityDO2.getVolunteerMax() != 0) { |
| | | if (actActivityDO2.getType()==1) { |
| | | identityType=3; |
| | | remark.append("取消志愿者活动扣除积分"); |
| | | } else { |
| | | } else if(actActivityDO2.getType()==3){ |
| | | identityType=2; |
| | | remark.append("取消党员活动扣除积分"); |
| | | } |
| | | else { |
| | | identityType=1; |
| | | remark.append("取消居民活动扣除积分"); |
| | | } |
| | | } |
| | | if (nonNull(isVolunteer) && isVolunteer.equals(1)) { |
| | | identityType = 3; |
| | | } else { |
| | | identityType = 1; |
| | | } |
| | | |
| | | } |
| | | // else { |
| | | // ComPbActivityDO comPbActivityDO = comBpActivityDAO.selectById(serviceId); |
| | |
| | | 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)); |
| | |
| | | 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(), |