|
|
@ -1,14 +1,70 @@ |
|
|
package com.qniao.dam.application.service.mica; |
|
|
package com.qniao.dam.application.service.mica; |
|
|
|
|
|
|
|
|
|
|
|
import com.qniao.dam.api.command.mica.user.response.UnlockMarriageInformationContactApplyVo; |
|
|
import com.qniao.dam.domain.aggregate.mica.MarriageInformationContactApplyAggregate; |
|
|
import com.qniao.dam.domain.aggregate.mica.MarriageInformationContactApplyAggregate; |
|
|
|
|
|
import com.qniao.dam.domain.aggregate.mica.entity.MarriageInformationContactApply; |
|
|
|
|
|
import com.qniao.dam.domain.aggregate.right.entity.Right; |
|
|
|
|
|
import com.qniao.dam.domian.aggregate.mica.constant.MarriageInformationContactApplyStatusEnum; |
|
|
|
|
|
import com.qniao.dam.domian.aggregate.pcur.constant.CardUsageTyepEnum; |
|
|
|
|
|
import com.qniao.dam.domian.aggregate.right.constant.RightTypeEnum; |
|
|
|
|
|
import com.qniao.dam.infrastructure.persistent.dao.mica.MarriageInformationContactApplyDao; |
|
|
|
|
|
import com.qniao.dam.query.mcur.MatchCardUsageRecordQueryService; |
|
|
|
|
|
import com.qniao.dam.query.right.RightQueryService; |
|
|
|
|
|
import com.qniao.framework.exception.BizException; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class MarriageInformationContactApplyApplicationService { |
|
|
public class MarriageInformationContactApplyApplicationService { |
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private MarriageInformationContactApplyAggregate marriageInformationContactApplyAggregate; |
|
|
private MarriageInformationContactApplyAggregate marriageInformationContactApplyAggregate; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private MarriageInformationContactApplyDao marriageInformationContactApplyDao; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private RightQueryService rightQueryService; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private MatchCardUsageRecordQueryService matchCardUsageRecordQueryService; |
|
|
|
|
|
|
|
|
|
|
|
public void confirm(MarriageInformationContactApply apply) { |
|
|
|
|
|
MarriageInformationContactApply existApply = marriageInformationContactApplyDao.selectById(apply.getId()); |
|
|
|
|
|
if (MarriageInformationContactApplyStatusEnum.PENDING.equals(existApply.getStatus())) { |
|
|
|
|
|
marriageInformationContactApplyAggregate.edit(apply); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public UnlockMarriageInformationContactApplyVo unlock(MarriageInformationContactApply apply, Long applicantUserId) { |
|
|
|
|
|
MarriageInformationContactApply existApply = marriageInformationContactApplyDao.selectById(apply.getId()); |
|
|
|
|
|
if (!MarriageInformationContactApplyStatusEnum.APPROVED.equals(existApply.getStatus())) { |
|
|
|
|
|
throw new BizException("对方未同意您的申请"); |
|
|
|
|
|
} |
|
|
|
|
|
UnlockMarriageInformationContactApplyVo vo = new UnlockMarriageInformationContactApplyVo(); |
|
|
|
|
|
if (existApply.getUnlocked()) { |
|
|
|
|
|
vo.setSuccess(true); |
|
|
|
|
|
} else { |
|
|
|
|
|
//未解锁 |
|
|
|
|
|
if (!applicantUserId.equals(existApply.getApplicantUserId())) { |
|
|
|
|
|
throw new BizException("您不是申请人"); |
|
|
|
|
|
} else { |
|
|
|
|
|
//判断是否会员 |
|
|
|
|
|
Right right = rightQueryService.getUserVipInfo(existApply.getApplicantUserId(), existApply.getApplicantMiId()); |
|
|
|
|
|
if (Objects.nonNull(right)) { |
|
|
|
|
|
//是会员 |
|
|
|
|
|
if (RightTypeEnum.VIP.equals(right.getType())) { |
|
|
|
|
|
// int lastDay = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()) |
|
|
|
|
|
//正式会员 |
|
|
|
|
|
//int usageFreeCount = matchCardUsageRecordQueryService.countUsageRecord(usageRecord.getUserId(), CardUsageTyepEnum.FREE,); |
|
|
|
|
|
} else { |
|
|
|
|
|
//体验会员(周会员) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
|
|
|
} |
|
|
} |
|
|
} |