Helius
2021-08-04 04b04d8e0746f6bf6f83450caec52bc7f9ce8db9
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
@@ -7,9 +7,11 @@
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;
@@ -59,6 +61,9 @@
    @Autowired
    private DistribService distribService;
    @Autowired
    private RedisUtil redisUtil;
    public void addJhyOrder(AddJhyOrderDto orderDto) {
        JhyInfo jhyInfo = jhyInfoMapper.selectJhyInfoByUserId(orderDto.getUserId());
@@ -200,6 +205,9 @@
    }
    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, "不是集物员");
@@ -267,7 +275,19 @@
        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) {