|
|
@@ -1,8 +1,11 @@
|
|
|
package com.cyksj.web.controller.manage.spotify;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
import com.cyksj.mapper.SpotifyUserUpgradeSubmitRecordMapper;
|
|
|
import com.cyksj.model.entity.SpotifyUserUpgradeSubmitRecord;
|
|
|
import com.cyksj.model.views.SpotifyUserUpgradeOrderView;
|
|
|
@@ -15,6 +18,7 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* 项目名: yhlxj
|
|
|
@@ -35,6 +39,8 @@ public class SpotifyUpgradeController {
|
|
|
|
|
|
private final OrderRefundService orderRefundService;
|
|
|
|
|
|
+ private final GroupsRelationMapper relationMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 提交账号列表
|
|
|
*/
|
|
|
@@ -57,6 +63,18 @@ public class SpotifyUpgradeController {
|
|
|
}
|
|
|
upgradeSubmitRecord.setStatus(status);
|
|
|
spotifyUserUpgradeSubmitRecordMapper.updateById(upgradeSubmitRecord);
|
|
|
+ //成功后 修改车票时间
|
|
|
+ if (status == SpotifyUserUpgradeSubmitRecord.Status.success) {
|
|
|
+ Optional.ofNullable(relationMapper.selectById(upgradeSubmitRecord.getRelationId())).ifPresent(relation -> {
|
|
|
+ if (relation.getStartTime() == null) {
|
|
|
+ relation.setStartTime(DateTime.now());
|
|
|
+ relation.setExpiryTime(DateUtil.offsetMonth(relation.getStartTime(), 12));
|
|
|
+ } else {
|
|
|
+ relation.setExpiryTime(DateUtil.offsetMonth(DateTime.now(), 12));
|
|
|
+ }
|
|
|
+ relationMapper.updateById(relation);
|
|
|
+ });
|
|
|
+ }
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|