44323
2023-11-14 ddbb38c54db9c3670e5ff53f4bf713525de1099d
cloud-server-competition/src/main/java/com/dsh/competition/service/impl/PaymentCompetitionServiceImpl.java
@@ -16,9 +16,7 @@
import com.dsh.competition.feignclient.other.StoreClient;
import com.dsh.competition.feignclient.other.model.Store;
import com.dsh.competition.mapper.PaymentCompetitionMapper;
import com.dsh.competition.model.CompetitionInfo;
import com.dsh.competition.model.CompetitionListVo;
import com.dsh.competition.model.ParticipantVo;
import com.dsh.competition.model.*;
import com.dsh.competition.service.CompetitionService;
import com.dsh.competition.service.IParticipantService;
import com.dsh.competition.service.IPaymentCompetitionService;
@@ -26,6 +24,7 @@
import com.dsh.competition.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -67,6 +66,8 @@
    @Resource
    private StudentClient studentClient;
    @Autowired
    private PaymentCompetitionMapper paymentCompetitionMapper;
@@ -128,6 +129,9 @@
        List<ParticipantVo> participant = new ArrayList<>();
        List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId()));
        List<Integer> collect = list.stream().map(UserCompetition::getParticipantId).collect(Collectors.toList());
        if(collect.size()==0){
            collect.add(-1);
        }
        List<Participant> participants = participantService.listByIds(collect);
        SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy");
        for (Participant participant1 : participants) {
@@ -179,6 +183,10 @@
            String refund_id = map.get("refund_id");
            paymentCompetition.setRefundOrderNo(refund_id);
            this.updateById(paymentCompetition);
            storeClient.addBackRecord(paymentCompetition.getAmount()+"_"+paymentCompetition.getAppUserId());
        }
        if(paymentCompetition.getPayType() == 2){//支付宝支付
            Map<String, String> map = payMoneyUtil.aliRefund(payOrderNo, amount.toString());
@@ -243,4 +251,21 @@
    public List<BillingRequest> queryCancelDatas(Integer appUserId, String monthStart, String monthEnd) {
        return this.baseMapper.queryCancelDatas(appUserId,monthStart,monthEnd);
    }
    @Override
    public List<PaymentCompetition> listAll(CompetitionQuery query) {
        String STime = null;
        String ETime = null;
        if (StringUtils.hasLength(query.getTime())) {
            STime = query.getTime().split(" - ")[0] + " 00:00:00";
            ETime = query.getTime().split(" - ")[1] + " 23:59:59";
        }
        return paymentCompetitionMapper.listAll(query,STime,ETime,query.getAmount());
    }
    @Override
    public Integer queryByCode(String code) {
        return this.baseMapper.queryBycode(code);
    }
}