| | |
| | | import com.dsh.competition.feignclient.account.model.Student; |
| | | import com.dsh.competition.feignclient.course.CoursePackagePaymentClient; |
| | | import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour; |
| | | import com.dsh.competition.feignclient.model.BillingRequest; |
| | | 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; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | @Autowired |
| | | private PaymentCompetitionMapper paymentCompetitionMapper; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<CompetitionListVo> queryMyCompetitionList(Integer uid, Integer type, Integer pageSize, Integer pageNo) throws Exception { |
| | | pageSize = (pageSize - 1) * pageNo; |
| | | pageNo = (pageNo - 1) * pageSize; |
| | | if(0 == type){ |
| | | type = null; |
| | | } |
| | | return this.baseMapper.queryMyCompetitionList(uid, type, pageSize, pageNo); |
| | | } |
| | | |
| | |
| | | competitionInfo.setImgs(competition.getImgs()); |
| | | competitionInfo.setName(competition.getName()); |
| | | competitionInfo.setRegisterCondition(competition.getRegisterCondition()); |
| | | Store store = storeClient.queryStoreById(competition.getStoreId()); |
| | | Store store = storeClient.queryStoreById(Integer.valueOf(competition.getStoreId().split(",")[0])); |
| | | competitionInfo.setStoreName(store.getName()); |
| | | competitionInfo.setStoreAddress(store.getAddress()); |
| | | competitionInfo.setStoreLon(store.getLon()); |
| | |
| | | competitionInfo.setProvince(competition.getEntryProvince()); |
| | | competitionInfo.setCity(competition.getEntryCity()); |
| | | competitionInfo.setAddress(competition.getEntryAddress()); |
| | | competitionInfo.setPayType(competition.getPayType()); |
| | | competitionInfo.setPrice(competition.getPrice().doubleValue()); |
| | | competitionInfo.setCashPrice(competition.getCashPrice()); |
| | | competitionInfo.setPlayPaiCoin(competition.getPlayPaiCoin()); |
| | | competitionInfo.setClassPrice(competition.getClassPrice()); |
| | | competitionInfo.setIntroduction(competition.getIntroduction()); |
| | | competitionInfo.setRegistrationNotes(competition.getRegistrationNotes()); |
| | | competitionInfo.setApply(1); |
| | |
| | | if(paymentCompetition.getPayStatus() == 3){ |
| | | competitionInfo.setStatus(4); |
| | | } |
| | | competitionInfo.setPayMoney(paymentCompetition.getAmount()); |
| | | competitionInfo.setPayType(paymentCompetition.getPayType()); |
| | | return competitionInfo; |
| | | } |
| | | |
| | |
| | | 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()); |
| | |
| | | paymentCompetition.setRefundOrderNo(refund_id); |
| | | paymentCompetition.setRefundTime(new Date()); |
| | | paymentCompetition.setPayStatus(3); |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | |
| | | paymentCompetition.setRefundOrderNo(""); |
| | | paymentCompetition.setRefundTime(new Date()); |
| | | paymentCompetition.setPayStatus(3); |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | |
| | | Student student = studentClient.queryStudentByPhone(participant.getPhone()); |
| | | PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour(); |
| | | paymentDeductionClassHour.setId(student.getId()); |
| | | paymentDeductionClassHour.setClassHour(competition.getPrice().intValue()); |
| | | paymentDeductionClassHour.setClassHour(competition.getClassPrice()); |
| | | paymentDeductionClassHour.setCode(code); |
| | | coursePackagePaymentClient.rollbackPaymentDeductionClassHour(paymentDeductionClassHour); |
| | | } |
| | |
| | | paymentCompetition.setRefundOrderNo(""); |
| | | paymentCompetition.setRefundTime(new Date()); |
| | | paymentCompetition.setPayStatus(3); |
| | | paymentCompetition.setAppUserId(null); |
| | | this.updateById(paymentCompetition); |
| | | |
| | | competition.setApplicantsNumber(competition.getApplicantsNumber() - 1); |
| | |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public List<BillingRequest> queryDatas(Integer appUserId, String monthStart, String monthEnd) { |
| | | return this.baseMapper.queryDatas(appUserId,monthStart,monthEnd); |
| | | } |
| | | |
| | | @Override |
| | | 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); |
| | | } |
| | | } |