|
|
@@ -5,19 +5,28 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.Assert;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
+import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
import com.goafanti.common.enums.OrderState;
|
|
|
+import com.goafanti.common.enums.UserLevel;
|
|
|
import com.goafanti.common.model.MemberOrder;
|
|
|
+import com.goafanti.common.model.User;
|
|
|
+import com.goafanti.common.model.UserIdentity;
|
|
|
import com.goafanti.core.mybatis.JDBCIdGenerator;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+import com.goafanti.memberGrade.bo.BusinessType;
|
|
|
import com.goafanti.memberGrade.service.MemberGradeService;
|
|
|
+import com.goafanti.user.service.UserIdentityService;
|
|
|
+import com.goafanti.user.service.UserService;
|
|
|
|
|
|
/**
|
|
|
* 会员 前台
|
|
|
@@ -31,6 +40,10 @@ public class MemberGradeFrontController extends BaseApiController {
|
|
|
@Autowired
|
|
|
private MemberGradeService memberGradeService;
|
|
|
@Autowired
|
|
|
+ private UserService userService;
|
|
|
+ @Autowired
|
|
|
+ private UserIdentityService userIdentityService;
|
|
|
+ @Autowired
|
|
|
private JDBCIdGenerator jDBCIdGenerator;
|
|
|
|
|
|
/**
|
|
|
@@ -66,6 +79,9 @@ public class MemberGradeFrontController extends BaseApiController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/addBasicsMemberOrder", method = RequestMethod.POST)
|
|
|
public Result addBasicsMemberOrder(Integer menberType, String price, Integer validMonth) {
|
|
|
+ Assert.notNull(TokenManager.getUserToken(), "必须用户登录");
|
|
|
+ User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
+ Assert.isTrue(u.getLvl() == 1, "必须为实名认证用户,已经是会员的无需重复申请");
|
|
|
MemberOrder mo = new MemberOrder();
|
|
|
mo.setId(jDBCIdGenerator.generateId());
|
|
|
mo.setMenberType(menberType);
|
|
|
@@ -73,8 +89,7 @@ public class MemberGradeFrontController extends BaseApiController {
|
|
|
mo.setValidMonth(validMonth);
|
|
|
mo.setOrderState(OrderState.UNPAYED.getCode());
|
|
|
mo.setOrderTime(new Date());
|
|
|
- Assert.notNull(TokenManager.getUserToken(), "必须用户登录");
|
|
|
- mo.setUserId(TokenManager.getUserId());
|
|
|
+ mo.setUserId(u.getId());
|
|
|
return res().data(memberGradeService.addBasicsMemberOrder(mo));
|
|
|
}
|
|
|
|
|
|
@@ -88,4 +103,22 @@ public class MemberGradeFrontController extends BaseApiController {
|
|
|
return res().data(memberGradeService.delMemberOrder(id));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取专家联系手机
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/contact", method = RequestMethod.GET)
|
|
|
+ public Result contact(String uid) {
|
|
|
+ User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
+ Assert.isTrue(u != null && u.getLvl() > UserLevel.CERTIFIED.getCode(), "必须是登录实名用户");
|
|
|
+ Assert.hasText(uid, "找不到专家");
|
|
|
+ JSONObject business = memberGradeService.selectMemberBusiness(u.getLvl());
|
|
|
+ Assert.isTrue(AFTConstants.YES.equals(business.get(BusinessType.CHA_KAN_LIAN_XI.getKey())), "该会员不能查看专家联系方式");
|
|
|
+ UserIdentity ui = userIdentityService.selectUserIdentityByUserId(uid);
|
|
|
+ if (ui != null && StringUtils.isNotBlank(ui.getContactMobile())) {
|
|
|
+ return res().data(ui.getContactMobile());
|
|
|
+ }
|
|
|
+ User expert = userService.selectByPrimaryKey(uid);
|
|
|
+ Assert.notNull(expert, "找不到专家");
|
|
|
+ return res().data(expert.getMobile());
|
|
|
+ }
|
|
|
}
|