| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.constant.RedisKeyConstant; |
| | | import com.xzx.gc.common.exception.RestException; |
| | | import com.xzx.gc.common.utils.IdUtils; |
| | | import com.xzx.gc.common.utils.LocationUtils; |
| | | import com.xzx.gc.common.utils.RedisUtil; |
| | | import com.xzx.gc.entity.*; |
| | | import com.xzx.gc.order.dto.AddJhyOrderDto; |
| | | import com.xzx.gc.order.dto.JhyOrderConfirmDto; |
| | |
| | | |
| | | @Autowired |
| | | private DistribService distribService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | public void addJhyOrder(AddJhyOrderDto orderDto) { |
| | | JhyInfo jhyInfo = jhyInfoMapper.selectJhyInfoByUserId(orderDto.getUserId()); |
| | |
| | | } |
| | | |
| | | public void confirmOrder(JhyOrderConfirmDto confirmDto) { |
| | | String key = RedisKeyConstant.ORDER_PAY + confirmDto.getOrderId(); |
| | | if (redisUtil.setnx(key, "0")) { |
| | | try { |
| | | JhyInfo jhyInfo = jhyInfoMapper.selectJhyInfoByUserId(confirmDto.getUserId()); |
| | | if (jhyInfo == null || !JhyInfo.CHECK_PASS.equals(jhyInfo.getStatus())) { |
| | | throw new RestException(-3, "不是集物员"); |
| | |
| | | userAccount.setCollectScore(userScore.add(totalScore).setScale( 0, BigDecimal.ROUND_DOWN ).toString()); |
| | | accountMapper.updateByPrimaryKey(userAccount); |
| | | |
| | | // 团长返利 |
| | | distribService.distribRecord(order.getId(), order.getUserId()); |
| | | // 推荐返利 |
| | | distribService.inviteAddOrderScore(order.getUserId(), order.getId().toString()); |
| | | } catch (Exception e) { |
| | | throw new RestException("支付失败"); |
| | | } finally { |
| | | redisUtil.del(key); |
| | | } |
| | | } else { |
| | | throw new RestException("支付中"); |
| | | } |
| | | |
| | | } |
| | | |
| | | public Map<Integer, Integer> orderStatusCount(Integer type, String userId) { |