|
@@ -2,6 +2,7 @@ package com.caimei365.user.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.caimei365.user.components.RedisService;
|
|
|
import com.caimei365.user.feign.CommodityFeign;
|
|
|
import com.caimei365.user.mapper.*;
|
|
|
import com.caimei365.user.model.ResponseJson;
|
|
@@ -12,10 +13,7 @@ import com.caimei365.user.model.dto.ShopUpdateDto;
|
|
|
import com.caimei365.user.model.po.*;
|
|
|
import com.caimei365.user.model.vo.*;
|
|
|
import com.caimei365.user.service.ShopService;
|
|
|
-import com.caimei365.user.utils.DateUtil;
|
|
|
-import com.caimei365.user.utils.GenerateUtils;
|
|
|
-import com.caimei365.user.utils.ImageUtils;
|
|
|
-import com.caimei365.user.utils.OssUtil;
|
|
|
+import com.caimei365.user.utils.*;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -42,12 +40,16 @@ public class ShopServiceImpl implements ShopService {
|
|
|
@Value("${caimei.wwwDomain}")
|
|
|
private String wwwDomain;
|
|
|
@Resource
|
|
|
+ private RedisService redisService;
|
|
|
+ @Resource
|
|
|
private CommodityFeign commodityFeign;
|
|
|
@Resource
|
|
|
private BaseMapper baseMapper;
|
|
|
@Resource
|
|
|
private ShopMapper shopMapper;
|
|
|
@Resource
|
|
|
+ private LoginMapper loginMapper;
|
|
|
+ @Resource
|
|
|
private ArticleMapper articleMapper;
|
|
|
@Resource
|
|
|
private BaikeProductMapper baikeProductMapper;
|
|
@@ -57,6 +59,60 @@ public class ShopServiceImpl implements ShopService {
|
|
|
private String active;
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 供应商快捷登录
|
|
|
+ *
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<UserLoginVo> shortcutLogin(Integer userId) {
|
|
|
+ UserLoginVo userLoginVo = shopMapper.getShopByUserId(userId);
|
|
|
+ // 生成token给用户
|
|
|
+ String token = JwtUtil.createToken(userId);
|
|
|
+ // 为了过期续签,将token存入redis,并设置超时时间
|
|
|
+ redisService.set(token, token, JwtUtil.getExpireTime());
|
|
|
+ userLoginVo.setToken(token);
|
|
|
+ if (null != userLoginVo) {
|
|
|
+ if (null != userLoginVo.getShopId()) {
|
|
|
+ if (null != userLoginVo.getShopStatus() && null != userLoginVo.getUserIdentity() && 3 == userLoginVo.getUserIdentity()) {
|
|
|
+
|
|
|
+ if (3 == userLoginVo.getShopStatus()) {
|
|
|
+ return ResponseJson.error(-1, "您的企业账号正在加速审核中,审核通过后即可登录", userLoginVo);
|
|
|
+ }
|
|
|
+ if (91 == userLoginVo.getShopStatus()) {
|
|
|
+ return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", userLoginVo);
|
|
|
+ }
|
|
|
+ if (92 == userLoginVo.getShopStatus()) {
|
|
|
+ return ResponseJson.error(-3, "您的企业账号审核未通过", userLoginVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 是否可为机构下单
|
|
|
+ boolean flag = false;
|
|
|
+ // 供应商商品上架平台信息
|
|
|
+ List<String> shopProductList = loginMapper.getShopProductGroudMall(userLoginVo.getShopId());
|
|
|
+ if (null != shopProductList) {
|
|
|
+ for(String product : shopProductList ) {
|
|
|
+ if (StringUtils.isNotBlank(product)) {
|
|
|
+ // 商品上架平台是否在联合丽格上架
|
|
|
+ if (product.contains("4")) {
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ userLoginVo.setShopIsOrder(flag);
|
|
|
+ } else {
|
|
|
+ return ResponseJson.error(-1, "该账号未成为供应商", null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return ResponseJson.error(-1, "用户数据异常", null);
|
|
|
+ }
|
|
|
+ return ResponseJson.success("登录成功", userLoginVo);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据用户Id查询供应商资料
|
|
|
*
|