| | |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.dto.GetImportOrderDTO; |
| | | import com.ruoyi.order.mapper.ChargeOrderMapper; |
| | | import com.ruoyi.order.mapper.OrderMapper; |
| | |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | if(!result.isEmpty()){ |
| | | return R.ok(result); |
| | | return R.fail(result); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | List<SysUser> data = sysUserClient.getSysUserAll().getData(); |
| | | SysUser sysUser = data.stream().filter(e -> e.getSiteId().equals(site.getId())).findFirst().orElse(null); |
| | | if (sysUser != null) { |
| | | if (sysUser.getIntegral()==null){ |
| | | sysUser.setIntegral(0); |
| | | } |
| | | if (sysUser.getIntegral()< point){ |
| | | return R.fail("站点积分不足"); |
| | | } |
| | | sysUser.setIntegral(sysUser.getIntegral()==null?0:sysUser.getIntegral()-point); |
| | | sysUserClient.updateSysUser(sysUser); |
| | | } |
| | | } |
| | | //保存到数据库 |
| | | chargeOrder.setPoint(point); |
| | | chargeOrderService.save(chargeOrder); |
| | | //添加用户积分流水 |
| | | //转入用户 |
| | | UserPoint userPoint = new UserPoint(); |
| | |
| | | if (r.isError(r)) { |
| | | return R.fail("导入订单-保存用户积分流水失败"); |
| | | } |
| | | //保存到数据库 |
| | | chargeOrder.setPoint(point); |
| | | chargeOrderService.save(chargeOrder); |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | // 计算积分并向下取整(Floor) |
| | | int cashInt = cash.intValue(); |
| | | return cashInt*=num1; |
| | | return cashInt * num1; |
| | | |
| | | } catch (NumberFormatException e) { |
| | | throw new RuntimeException("积分兑换比例配置值格式错误", e); |