|
|
@@ -19,6 +19,7 @@ import com.cyksj.common.snowflake.Sequence;
|
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
import com.cyksj.common.util.GoogleGenerator;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
|
+import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.*;
|
|
|
@@ -1072,10 +1073,23 @@ public class GroupRelationController {
|
|
|
/**
|
|
|
* 申请更换车票
|
|
|
*/
|
|
|
- @PostMapping("/change/ticket/{relationId}")
|
|
|
- public Result<String> changeTicket(@PathVariable Long relationId) {
|
|
|
+ @PostMapping("/change/ticket")
|
|
|
+ public Result<String> changeTicket(@RequestBody ChangeTicketReq changeTicketReq) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- groupRelationFrontService.changeTicket(userId, relationId);
|
|
|
+ List<Long> relationIds = changeTicketReq.getRelationIds();
|
|
|
+ if (CollUtil.isEmpty(relationIds)) {
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+ relationIds.forEach(relationId -> {
|
|
|
+ try {
|
|
|
+ groupRelationFrontService.changeTicket(userId, relationId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更换车票失败:{}", StringUtil.getErrorText(e));
|
|
|
+ if (relationIds.size() == 1) {
|
|
|
+ throw BusinessRuntimeException.getInstance(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
}
|