|
@@ -1,5 +1,7 @@
|
|
|
package com.tour.api.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.tour.common.annotation.AccessToken;
|
|
|
import com.tour.common.core.controller.BaseController;
|
|
|
import com.tour.common.core.domain.BaseResult;
|
|
@@ -7,6 +9,7 @@ import com.tour.module.domain.Contacts;
|
|
|
import com.tour.module.domain.Order;
|
|
|
import com.tour.module.domain.dto.OmsOrderDto;
|
|
|
import com.tour.module.domain.dto.SystemOrderDto;
|
|
|
+import com.tour.module.expection.CustomAppException;
|
|
|
import com.tour.module.service.IContactsService;
|
|
|
import com.tour.module.service.IOrderService;
|
|
|
import io.swagger.annotations.*;
|
|
@@ -71,6 +74,13 @@ public class MemberCenterApi extends BaseController {
|
|
|
@AccessToken
|
|
|
public BaseResult addContact(@RequestBody Contacts contact) {
|
|
|
contact.setMemberId(getLoginId());
|
|
|
+ List<Contacts> contactsList = contactsService.list(new QueryWrapper<Contacts>()
|
|
|
+ .eq("deleted", 0)
|
|
|
+ .eq("id_card", contact.getIdCard())
|
|
|
+ .eq("member_id", contact.getMemberId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(contactsList)) {
|
|
|
+ throw new CustomAppException("联系人已存在!");
|
|
|
+ }
|
|
|
return BaseResult.success(contactsService.save(contact));
|
|
|
}
|
|
|
|