Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
72ee726ccb
|
|
@ -1,5 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
|
@ -11,7 +13,10 @@ import com.chaozhanggui.system.cashierservice.mybatis.TbVersionMapper;
|
|||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.chaozhanggui.system.cashierservice.util.MD5Util;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -62,7 +67,6 @@ public class LoginService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
if (ObjectUtil.isEmpty(loginReq.getSerialNumber())) {
|
||||
return Result.fail(CodeEnum.SERIALNUMBER);
|
||||
}
|
||||
|
|
@ -120,7 +124,14 @@ public class LoginService {
|
|||
tbTokenMapper.insert(tbToken);
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(account.getShopId()));
|
||||
|
||||
if (shopInfo.getExpireAt() != null) {
|
||||
Long expireAt = shopInfo.getExpireAt();
|
||||
Date time = DateUtil.calendar(expireAt).getTime();
|
||||
long expireDays = DateUtil.between(DateUtil.beginOfDay(new Date()), DateUtil.beginOfDay(time), DateUnit.DAY, false);
|
||||
if (expireDays < 0) {
|
||||
return Result.fail("店铺已到期,请联系区域经理续费");
|
||||
}
|
||||
}
|
||||
redisUtil.saveMessage(key, token, 365 * 24 * 60 * 60);
|
||||
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
|
@ -136,8 +147,14 @@ public class LoginService {
|
|||
accountMap.put("userCode", tbPlussShopStaff.getCode());
|
||||
accountMap.put("token", token);
|
||||
accountMap.put("loginTime", System.currentTimeMillis());
|
||||
accountMap.put("expireDate", "");
|
||||
if (Objects.nonNull(shopInfo)) {
|
||||
accountMap.put("shopName", shopInfo.getShopName());
|
||||
if(shopInfo.getExpireAt() != null) {
|
||||
Long expireAt = shopInfo.getExpireAt();
|
||||
Date time = DateUtil.calendar(expireAt).getTime();
|
||||
accountMap.put("expireDate", DateUtil.formatDate(time));
|
||||
}
|
||||
}
|
||||
accountMap.put("uuid", uuid);
|
||||
accountMap.put("isStaff", "staff".equals(tbPlussShopStaff.getType()));
|
||||
|
|
@ -227,4 +244,5 @@ public class LoginService {
|
|||
return Result.success(SUCCESS, BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue