| | |
| | | import com.ruoyi.system.pojo.dto.OrderPageDTO; |
| | | import com.ruoyi.system.pojo.model.DailyStatistics; |
| | | import com.ruoyi.system.pojo.vo.*; |
| | | import com.ruoyi.system.service.CompanyTypeService; |
| | | import com.ruoyi.system.service.OrderService; |
| | | import com.ruoyi.system.wx.RefundCallbackResult; |
| | | import com.ruoyi.system.wx.WechatPayService; |
| | |
| | | private RedisCache redisCache; |
| | | @Resource |
| | | private QichachaMapper qichachaMapper; |
| | | |
| | | @Resource |
| | | private CompanyTypeService companyTypeService; |
| | | |
| | | |
| | | @Resource |
| | | private AccountDetailMapper accountDetailMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | BusinessVO vo = new BusinessVO(); |
| | | BeanUtils.copyProperties(company, vo); |
| | | vo.setPlace(company.getCity()+company.getProvince()+company.getArea()); |
| | | |
| | | String name = companyTypeService.getById(company.getCompanyCategory()).getName(); |
| | | vo.setCompanyCategoryName(name); |
| | | |
| | | //todo 再查企业工商信息 覆盖掉之前的 |
| | | |
| | |
| | | order.setRefundTime(LocalDateTime.now()); |
| | | companyMapper.updateById(company); |
| | | }else{ |
| | | // 判断是否能退 |
| | | if(order.getShareUserId()!=null){ |
| | | User user = appUserMapper.selectById(order.getShareUserId()); |
| | | if(user.getBalance().doubleValue()<order.getCommissionPrice().doubleValue()){ |
| | | throw new ServiceException("退款失败,卖家上级余额不足"); |
| | | } |
| | | } |
| | | |
| | | |
| | | R r = refundPayMoney(order);//退款 |
| | | if (200 == r.getCode()) { |
| | | //退款申请成功 |
| | |
| | | order.setIsRefund(1); |
| | | order.setRefundTime(LocalDateTime.now()); |
| | | this.baseMapper.updateById(order); |
| | | |
| | | //将分佣次数加回 |
| | | User user = appUserMapper.selectById(order.getUserId()); |
| | | User inviter = appUserMapper.selectById(user.getInviteId()); |
| | | User inviter = appUserMapper.selectById(company.getUserId()); |
| | | if (inviter!=null && inviter.getIsDelete()==0){ |
| | | inviter.setInviteNum(inviter.getInviteNum()+1); |
| | | appUserMapper.updateById(inviter); |
| | | } |
| | | |
| | | // 分佣退回 |
| | | if(order.getShareUserId()!=null && order.getCommissionPrice().doubleValue()>0){ |
| | | User user = appUserMapper.selectById(order.getShareUserId()); |
| | | user.setBalance(user.getBalance().subtract(order.getCommissionPrice())); |
| | | appUserMapper.updateById(user); |
| | | AccountDetail accountDetail = new AccountDetail(); |
| | | accountDetail.setUserId(order.getShareUserId()); |
| | | accountDetail.setType(2); |
| | | accountDetail.setCategory(4); |
| | | accountDetail.setSourceId(order.getId()); |
| | | accountDetail.setMoney(order.getCommissionPrice()); |
| | | accountDetail.setRemark("订单取消分佣退回"); |
| | | accountDetailMapper.insert(accountDetail); |
| | | } |
| | | |
| | | //商品状态修改 |
| | | company.setStatus(1); |
| | | companyMapper.updateById(company); |