|
|
@@ -1,10 +1,12 @@
|
|
|
package com.zhongzheng.framework.web.service;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.codec.Base64;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@@ -14,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.google.common.base.Splitter;
|
|
|
import com.zhongzheng.common.constant.Constants;
|
|
|
import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
|
@@ -22,6 +25,7 @@ import com.zhongzheng.common.exception.BaseException;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.type.EncryptHandler;
|
|
|
import com.zhongzheng.common.utils.*;
|
|
|
+import com.zhongzheng.common.utils.http.HttpUtils;
|
|
|
import com.zhongzheng.common.utils.ip.IpUtils;
|
|
|
import com.zhongzheng.modules.alisms.service.IAliSmsService;
|
|
|
import com.zhongzheng.modules.collect.domain.CollectBank;
|
|
|
@@ -30,19 +34,34 @@ import com.zhongzheng.modules.collect.domain.CollectNote;
|
|
|
import com.zhongzheng.modules.collect.mapper.CollectBankMapper;
|
|
|
import com.zhongzheng.modules.collect.mapper.CollectCourseMapper;
|
|
|
import com.zhongzheng.modules.collect.mapper.CollectNoteMapper;
|
|
|
+import com.zhongzheng.modules.course.domain.Course;
|
|
|
+import com.zhongzheng.modules.course.domain.CourseSection;
|
|
|
import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseSectionService;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseSubjectService;
|
|
|
+import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.vo.UserNewGoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
+import com.zhongzheng.modules.grade.service.impl.ClassGradeServiceImpl;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
|
|
|
+import com.zhongzheng.modules.system.domain.SysTenant;
|
|
|
import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
+import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
|
import com.zhongzheng.modules.user.bo.*;
|
|
|
-import com.zhongzheng.modules.user.domain.*;
|
|
|
+import com.zhongzheng.modules.user.domain.User;
|
|
|
+import com.zhongzheng.modules.user.domain.UserStudyLog;
|
|
|
+import com.zhongzheng.modules.user.domain.UserVisitLog;
|
|
|
import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
|
import com.zhongzheng.modules.user.mapper.UserMapper;
|
|
|
import com.zhongzheng.modules.user.service.*;
|
|
|
import com.zhongzheng.modules.user.vo.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@@ -65,6 +84,8 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
|
|
|
|
|
|
+ private static Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private CollectCourseMapper collectCourseMapper;
|
|
|
|
|
|
@@ -114,6 +135,19 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
private IUserLoginErrorService iUserLoginErrorService;
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
+ @Autowired
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
+ @Autowired
|
|
|
+ private ISysTenantService iSysTenantService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseService iCourseService;
|
|
|
+ @Autowired
|
|
|
+ private ICourseSectionService iCourseSectionService;
|
|
|
+ @Value("${liveGotoURL}")
|
|
|
+ private String liveGotoURL;
|
|
|
+ @Value("${oldSys.goods}")
|
|
|
+ private String OLD_GOODS;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -174,7 +208,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
@Override
|
|
|
public List<UserVo> selectList(UserQueryBo bo) {
|
|
|
bo.setGetOrderNum(1L);
|
|
|
- List<UserVo> list = entity2UserVo(userMapper.selectList(bo));
|
|
|
+ List<UserVo> list = entity2UserVo(userMapper.selectListNoTenant(bo));
|
|
|
for (UserVo userVo : list) {
|
|
|
userVo.setStudentCode(userVo.getUserAccount());
|
|
|
ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
@@ -182,13 +216,31 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
List<Integer> status = new ArrayList<>();
|
|
|
status.add(1);
|
|
|
classGradeUserQueryBo.setStatus(status);
|
|
|
- List<ClassGradeUserGoodsVo> classGradeUserGoodsVos = iClassGradeUserService.listUser(classGradeUserQueryBo);
|
|
|
+ List<ClassGradeUserGoodsVo> classGradeUserGoodsVos = iClassGradeUserService.listUserNoTenant(classGradeUserQueryBo);
|
|
|
userVo.setClassGradeUserGoodsVoList(classGradeUserGoodsVos);
|
|
|
userVo.setOrderNum(userVo.getGoodsCourseNum());
|
|
|
+
|
|
|
+ UserVisitLog userVisitLog = iUserVisitLogService.getOneNoTenant(userVo.getUserId());
|
|
|
+ if(Validator.isNotEmpty(userVisitLog)){
|
|
|
+ userVo.setLastVisitTime(userVisitLog.getCreateTime());
|
|
|
+ userVo.setVisitFromPlat(Integer.parseInt(userVisitLog.getFromPlat()));
|
|
|
+ }
|
|
|
+
|
|
|
+ UserStudyLog userStudyLog = iUserStudyLogService.getOneNoTenant( userVo.getUserId());
|
|
|
+ if(Validator.isNotEmpty(userStudyLog)){
|
|
|
+ userVo.setLastStudyTime(userStudyLog.getCreateTime());
|
|
|
+ userVo.setStudyFromPlat(Integer.parseInt(userStudyLog.getFromPlat()));
|
|
|
+ }
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<UserVo> dangAnList(UserQueryBo bo) {
|
|
|
+ List<User> list = baseMapper.dangAnList(bo);
|
|
|
+ return entity2UserVo(list);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<UserStatstVo> statsList(UserQueryBo bo) {
|
|
|
List<UserStatstVo> list = new ArrayList<>();
|
|
|
@@ -228,7 +280,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
@Override
|
|
|
public List<UserExportVo> selectListExport(UserQueryBo bo) {
|
|
|
bo.setGetOrderNum(1L);
|
|
|
- List<UserVo> list = entity2UserVo(userMapper.selectList(bo));
|
|
|
+ List<UserVo> list = entity2UserVo(userMapper.selectListByBo(bo));
|
|
|
List<UserExportVo> listExport = new ArrayList<>();
|
|
|
for (UserVo userVo : list) {
|
|
|
userVo.setStudentCode(userVo.getUserAccount());
|
|
|
@@ -654,6 +706,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
|
inertData.setUserAccount(String.valueOf(idWorker.nextId()));
|
|
|
inertData.setSex(1);
|
|
|
+ if (ObjectUtils.isNotNull(bo.getEduLevel())){
|
|
|
+ inertData.setEduLevel(bo.getEduLevel());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(bo.getSexNum())){
|
|
|
+ inertData.setSex(bo.getSexNum());
|
|
|
+ }
|
|
|
if (ObjectUtils.isNotNull(bo.getIdcard())){
|
|
|
inertData.setIdCard(bo.getIdcard());
|
|
|
}
|
|
|
@@ -677,7 +735,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(!save(inertData)){
|
|
|
throw new CustomException("注册失败");
|
|
|
}
|
|
|
- iSmsService.sendPwdSms(bo.getTel(),pwd);
|
|
|
+// iSmsService.sendPwdSms(bo.getTel(),pwd);
|
|
|
return inertData.getUserId();
|
|
|
}
|
|
|
|
|
|
@@ -692,7 +750,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(bo.getPwd()==null){
|
|
|
throw new CustomException("密码不能为空");
|
|
|
}
|
|
|
- if(!ToolsUtils.verifPwd(bo.getPwd())){
|
|
|
+ if(!ToolsUtils.verifEasyPwd(bo.getPwd())){
|
|
|
throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
|
|
|
}
|
|
|
String key = Constants.REGISTER_SMS + bo.getTel();
|
|
|
@@ -825,6 +883,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
|
inertData.setUserAccount(String.valueOf(idWorker.nextId()));
|
|
|
inertData.setSex(1);
|
|
|
+ if(Validator.isNotEmpty(itemImport.getSex())){
|
|
|
+ inertData.setSex(itemImport.getSex().equals("女")?2:1);
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(itemImport.getEduLevel())){
|
|
|
+ inertData.setEduLevel(itemImport.getEduLevel());
|
|
|
+ }
|
|
|
inertData.setIdCard(itemImport.getIdCard());
|
|
|
inertData.setRealname(itemImport.getRealname());
|
|
|
if (StringUtils.isNotBlank(itemImport.getCompanyName())) {
|
|
|
@@ -849,7 +913,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
errorList.add(itemImport);
|
|
|
continue;
|
|
|
}
|
|
|
- iSmsService.sendPwdSms(itemImport.getTelphone(),pwd);
|
|
|
+// iSmsService.sendPwdSms(itemImport.getTelphone(),pwd);
|
|
|
itemImport.setUserId(inertData.getUserId());
|
|
|
itemImport.setImportNo(importNo);
|
|
|
itemImport.setStudentCode(inertData.getUserAccount());
|
|
|
@@ -877,7 +941,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
{
|
|
|
throw new BaseException("新密码格式错误");
|
|
|
}
|
|
|
- if(!ToolsUtils.verifPwd(bo.getNewPwd())){
|
|
|
+ if(!ToolsUtils.verifEasyPwd(bo.getNewPwd())){
|
|
|
throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
|
|
|
}
|
|
|
user.setPassword(SecurityUtils.encryptPassword(bo.getNewPwd()));
|
|
|
@@ -887,6 +951,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean updatePwdByClient(UserAppUpdatePwdBo bo) {
|
|
|
+ User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
|
|
|
+ if(Validator.isEmpty(user)){
|
|
|
+ throw new BaseException("用户信息错误");
|
|
|
+ }
|
|
|
+ if (Validator.isEmpty(bo.getNewPwd()))
|
|
|
+ {
|
|
|
+ throw new BaseException("新密码格式错误");
|
|
|
+ }
|
|
|
+ if(!ToolsUtils.verifEasyPwd(bo.getNewPwd())){
|
|
|
+ throw new CustomException("密码应由6-18位组成");
|
|
|
+ }
|
|
|
+ user.setPassword(SecurityUtils.encryptPassword(bo.getNewPwd()));
|
|
|
+ user.setPwdTime(DateUtils.getNowTime());
|
|
|
+ user.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ updateById(user);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<UserIdCardBatchVo> batchUserId(List<UserIdCardAddBo> list) {
|
|
|
List<UserIdCardBatchVo> list1 = new ArrayList<>();
|
|
|
@@ -894,6 +978,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(Validator.isEmpty(bo.getTelphone())){
|
|
|
throw new CustomException("用户手机号码缺失");
|
|
|
}
|
|
|
+ log.info("批量获取用户ID" + JSON.toJSONString(bo));
|
|
|
// if(Validator.isEmpty(bo.getIdCard())){
|
|
|
// throw new CustomException("用户身份证号码缺失");
|
|
|
// }
|
|
|
@@ -910,8 +995,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
User user1 = getOne(new LambdaQueryWrapper<User>()
|
|
|
.eq(User::getTelphone,EncryptHandler.encrypt(bo.getTelphone())).last("limit 1"));
|
|
|
- //手机号码存在
|
|
|
- if(Validator.isNotEmpty(user1)){
|
|
|
+ //手机号码存在 身份证一致
|
|
|
+ if(Validator.isNotEmpty(user1) &&
|
|
|
+ Validator.isNotEmpty(bo.getIdCard())&&Validator.isNotEmpty(user1.getIdCard())
|
|
|
+ && EncryptHandler.decrypt(user1.getIdCard()).equals(bo.getIdCard())
|
|
|
+ ){
|
|
|
UserIdCardBatchVo user = BeanUtil.toBean(bo, UserIdCardBatchVo.class);
|
|
|
// if(Validator.isNotEmpty(bo.getIdCard())&&Validator.isNotEmpty(user1.getIdCard())&&!user1.getIdCard().equals(bo.getIdCard())){
|
|
|
// throw new CustomException(bo.getRealname()+"身份证号码不一致");
|
|
|
@@ -937,13 +1025,33 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
}*/
|
|
|
UserSystemRegisterBo registerBo = BeanUtil.toBean(bo, UserSystemRegisterBo.class);
|
|
|
- registerBo.setTel(bo.getTelphone());
|
|
|
+ String tel = "";
|
|
|
+ if (Validator.isNotEmpty(user1)){
|
|
|
+ //手机号码存在,身份证不一致 (随机生成)
|
|
|
+ tel = createTel();
|
|
|
+ registerBo.setTel(tel);
|
|
|
+ }else {
|
|
|
+ tel = bo.getTelphone();
|
|
|
+ registerBo.setTel(tel);
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(bo.getSex())){
|
|
|
+ if(bo.getSex().equals("男")){
|
|
|
+ registerBo.setSexNum(1);
|
|
|
+ }
|
|
|
+ else if(bo.getSex().equals("女")){
|
|
|
+ registerBo.setSexNum(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(bo.getEducation())){
|
|
|
+ registerBo.setEduLevel(bo.getEducation());
|
|
|
+ }
|
|
|
registerBo.setIdcard(bo.getIdCard());
|
|
|
registerBo.setRegisterPlat("4");
|
|
|
Long userId = systemRegisterUser(registerBo);
|
|
|
if(userId.longValue()>0){
|
|
|
UserIdCardBatchVo user = BeanUtil.toBean(bo, UserIdCardBatchVo.class);
|
|
|
user.setUserId(userId);
|
|
|
+ user.setTelphone(tel);
|
|
|
list1.add(user);
|
|
|
continue;
|
|
|
}
|
|
|
@@ -953,6 +1061,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return list1;
|
|
|
}
|
|
|
|
|
|
+ private String createTel() {
|
|
|
+ String mobile = TelPhoneUtils.createMobile();
|
|
|
+ int count = count(new LambdaQueryWrapper<User>()
|
|
|
+ .eq(User::getTelphone, EncryptHandler.encrypt(mobile)));
|
|
|
+ if (count > 0){
|
|
|
+ createTel();
|
|
|
+ }
|
|
|
+ return mobile;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public boolean editShareActivityCode(UserEditBo bo) {
|
|
|
if (ObjectUtils.isNotNull(bo.getShareActivityCode())){
|
|
|
@@ -1037,6 +1156,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private Long findSubjectId(String subject){
|
|
|
if(subject!=null){
|
|
|
String key = "SUB_"+subject;
|
|
|
@@ -1068,7 +1189,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(bo.getPwd()==null){
|
|
|
throw new CustomException("密码不能为空");
|
|
|
}
|
|
|
- if(!ToolsUtils.verifPwd(bo.getPwd())){
|
|
|
+ if(!ToolsUtils.verifEasyPwd(bo.getPwd())){
|
|
|
throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
|
|
|
}
|
|
|
String key = Constants.FORGET_SMS + bo.getTel();
|
|
|
@@ -1160,6 +1281,448 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return this.updateById(update);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public UserLiveAccountLoginVo liveUnifyLogin(UserLiveAccountLoginBo bo) {
|
|
|
+ if (bo.getType() != 1){
|
|
|
+ throw new CustomException("登录错误");
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(bo.getAccount())){
|
|
|
+ throw new CustomException("账号不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<User> userList = baseMapper.getUserByTel(bo.getAccount());
|
|
|
+ if (CollectionUtils.isEmpty(userList)){
|
|
|
+ throw new CustomException("账号不存在!请检查");
|
|
|
+ }
|
|
|
+ //参数解析
|
|
|
+ String param = new String(Base64.decode(bo.getParam()));
|
|
|
+ if (StringUtils.isBlank(param)){
|
|
|
+ throw new CustomException("参数为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
|
|
|
+ //商品ID
|
|
|
+ Long goodsId = Long.valueOf(split.get("gid"));
|
|
|
+ //观看权限
|
|
|
+ String per = split.get("watchPer");
|
|
|
+ //课程ID
|
|
|
+ String cid = split.get("cid");
|
|
|
+ //节ID
|
|
|
+ String sid = split.get("sid");
|
|
|
+
|
|
|
+ //获取对应商品
|
|
|
+ Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
|
|
|
+ User user = new User();
|
|
|
+ if (StringUtils.isNotBlank(per) && Integer.valueOf(per) == 2){
|
|
|
+ //所有人都可以看
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ Long tenantId = item.getTenantId();
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+ return ObjectUtils.isNotNull(courseId) && ObjectUtils.isNotNull(courseSection) && ObjectUtils.isNotNull(goodsTwo);
|
|
|
+ }).findFirst().orElse(null);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ //判断用户是否购买商品
|
|
|
+ Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
|
|
|
+ return count > 0;
|
|
|
+ }).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Validator.isEmpty(user)){
|
|
|
+ throw new CustomException("登录错误,请联系管理员!");
|
|
|
+ }
|
|
|
+ else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
+ {
|
|
|
+ throw new BaseException("对不起,您的账号:已停用");
|
|
|
+ }
|
|
|
+ String password = null;
|
|
|
+ if(bo.getPwd().length()>20){
|
|
|
+ String rsaPrivate = null;
|
|
|
+ try {
|
|
|
+ InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/pri.key");
|
|
|
+ rsaPrivate = AES.getStringByInputStream_1(certStream);
|
|
|
+ certStream.close();
|
|
|
+ password = AES.decrypt(bo.getPwd(),rsaPrivate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ password = bo.getPwd();
|
|
|
+ }
|
|
|
+ if (!SecurityUtils.matchesPassword(password,user.getPassword()))
|
|
|
+ {
|
|
|
+ iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
+ throw new BaseException("登录信息错误");
|
|
|
+ }
|
|
|
+ Long tenantId = user.getTenantId();
|
|
|
+ //组装跳转路径
|
|
|
+ SysTenant tenant = iSysTenantService.getById(tenantId);
|
|
|
+ String post = "";
|
|
|
+ String path = "";
|
|
|
+ switch (bo.getUrlType()){
|
|
|
+ case 1://H5
|
|
|
+ post = tenant.getHostH5();
|
|
|
+ path = "pages/webview/index";
|
|
|
+ break;
|
|
|
+ case 2://PC
|
|
|
+ post = tenant.getHostPc();
|
|
|
+ path = "living-room";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+
|
|
|
+ String url = "";
|
|
|
+ switch (bo.getUrlType()){
|
|
|
+ case 1://H5
|
|
|
+ String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
|
|
|
+ String s1 = Base64.encode(format1);
|
|
|
+ url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
|
|
|
+ break;
|
|
|
+ case 2://Pc
|
|
|
+ String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
|
|
|
+ String s = Base64.encode(format);
|
|
|
+ url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
|
|
|
+ vo.setTel(user.getTelphone());
|
|
|
+ vo.setUser_account(user.getUserAccount());
|
|
|
+ vo.setUrl(url);
|
|
|
+ vo.setTenantId(tenantId);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> automaticAccountLogin(UserAppTelphoneLoginBo bo) {
|
|
|
+ User user = baseMapper.getUserByAccount(bo.getUserAccount());
|
|
|
+
|
|
|
+ if(Validator.isEmpty(user)){
|
|
|
+ throw new CustomException("该账号不存在");
|
|
|
+ }
|
|
|
+ ClientLoginUser loginUser = new ClientLoginUser();
|
|
|
+ loginUser.setUser(user);
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put(Constants.TOKEN,wxTokenService.createToken(loginUser));
|
|
|
+ map.put("user_account",user.getUserAccount());
|
|
|
+ map.put("full_info",Validator.isEmpty(user.getIdCard())?false:true); //是否完善身份信息
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public UserLiveAccountLoginVo smsLiveUnifyLogin(UserLiveAccountLoginBo bo) {
|
|
|
+ if(bo.getTel()==null){
|
|
|
+ throw new CustomException("手机号不能为空");
|
|
|
+ }
|
|
|
+ String key = Constants.LOGIN_SMS + bo.getTel();
|
|
|
+ String code = redisCache.getCacheObjectNoTenant(key);
|
|
|
+ if(code==null){
|
|
|
+ throw new CustomException("验证码错误");
|
|
|
+ }
|
|
|
+ if(!code.equals(bo.getCode())){
|
|
|
+ throw new CustomException("验证码错误");
|
|
|
+ }
|
|
|
+ redisCache.deleteObject(key);
|
|
|
+
|
|
|
+ if (bo.getType() != 1){
|
|
|
+ throw new CustomException("登录错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<User> userList = baseMapper.getUserByTel(bo.getTel());
|
|
|
+ if (CollectionUtils.isEmpty(userList)){
|
|
|
+ throw new CustomException("请联系管理员!");
|
|
|
+ }
|
|
|
+ //参数解析
|
|
|
+ String param = new String(Base64.decode(bo.getParam()));
|
|
|
+ if (StringUtils.isBlank(param)){
|
|
|
+ throw new CustomException("参数为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
|
|
|
+ //商品ID
|
|
|
+ Long goodsId = Long.valueOf(split.get("gid"));
|
|
|
+ //观看权限
|
|
|
+ String per = split.get("watchPer");
|
|
|
+ //课程ID
|
|
|
+ String cid = split.get("cid");
|
|
|
+ //节ID
|
|
|
+ String sid = split.get("sid");
|
|
|
+ //获取对应商品
|
|
|
+ Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
|
|
|
+ User user = new User();
|
|
|
+ if (StringUtils.isNotBlank(per) && Integer.valueOf(per) == 2){
|
|
|
+ //所有人都可以看
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ Long tenantId = item.getTenantId();
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+ return ObjectUtils.isNotNull(courseId) && ObjectUtils.isNotNull(courseSection) && ObjectUtils.isNotNull(goodsTwo);
|
|
|
+ }).findFirst().orElse(null);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ user = userList.stream().filter(item -> {
|
|
|
+ //判断用户是否购买商品
|
|
|
+ Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
|
|
|
+ return count > 0;
|
|
|
+ }).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Validator.isEmpty(user)){
|
|
|
+ throw new CustomException("登录错误,请联系管理员!");
|
|
|
+ }
|
|
|
+ else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
+ {
|
|
|
+ throw new BaseException("对不起,您的账号:已停用");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long tenantId = user.getTenantId();
|
|
|
+ //组装跳转路径
|
|
|
+ SysTenant tenant = iSysTenantService.getById(tenantId);
|
|
|
+ String post = "";
|
|
|
+ String path = "";
|
|
|
+ switch (bo.getUrlType()){
|
|
|
+ case 1://H5
|
|
|
+ post = tenant.getHostH5();
|
|
|
+ path = "pages/webview/index";
|
|
|
+ break;
|
|
|
+ case 2://PC
|
|
|
+ post = tenant.getHostPc();
|
|
|
+ path = "living-room";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+
|
|
|
+ String url = "";
|
|
|
+ switch (bo.getUrlType()){
|
|
|
+ case 1://H5
|
|
|
+ String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
|
|
|
+ String s1 = Base64.encode(format1);
|
|
|
+ url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
|
|
|
+ break;
|
|
|
+ case 2://Pc
|
|
|
+ String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
|
|
|
+ String s = Base64.encode(format);
|
|
|
+ url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
|
|
|
+ vo.setTel(user.getTelphone());
|
|
|
+ vo.setUser_account(user.getUserAccount());
|
|
|
+ vo.setUrl(url);
|
|
|
+ vo.setTenantId(tenantId);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public UserLiveAccountLoginVo liveUnifyLoginRefresh(UserLiveAccountLoginBo bo) {
|
|
|
+ if(Validator.isEmpty(bo.getUser_account())){
|
|
|
+ throw new CustomException("账号不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ User user = baseMapper.getUserByAccount(bo.getUser_account());
|
|
|
+ if(Validator.isEmpty(user)){
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
+ }
|
|
|
+ else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
+ {
|
|
|
+ throw new BaseException("对不起,您的账号:已停用");
|
|
|
+ }
|
|
|
+ //参数解析
|
|
|
+ String param = new String(Base64.decode(bo.getParam()));
|
|
|
+ if (StringUtils.isBlank(param)){
|
|
|
+ throw new CustomException("参数为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
|
|
|
+ Long goodsId = Long.valueOf(split.get("gid"));
|
|
|
+ Long tenantId = user.getTenantId();
|
|
|
+
|
|
|
+ //获取对应商品
|
|
|
+ Goods goods = iGoodsService.queryGoodsByIdTenant(goodsId,tenantId);
|
|
|
+ if (ObjectUtils.isNull(goods)){
|
|
|
+ throw new CustomException("账号不匹配,请重新登录!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //组装跳转路径
|
|
|
+ SysTenant tenant = iSysTenantService.getById(tenantId);
|
|
|
+ String post = "";
|
|
|
+ String path = "";
|
|
|
+ switch (bo.getUrlType()){
|
|
|
+ case 1://H5
|
|
|
+ post = tenant.getHostH5();
|
|
|
+ path = "pages/webview/index";
|
|
|
+ break;
|
|
|
+ case 2://PC
|
|
|
+ post = tenant.getHostPc();
|
|
|
+ path = "living-room";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ String cid = split.get("cid");
|
|
|
+ String sid = split.get("sid");
|
|
|
+ Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
|
|
|
+ Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
|
|
|
+ CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
|
|
|
+ CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
|
|
|
+ Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
|
|
|
+
|
|
|
+ String url = "";
|
|
|
+ switch (bo.getUrlType()){
|
|
|
+ case 1://H5
|
|
|
+ String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
|
|
|
+ String s1 = Base64.encode(format1);
|
|
|
+ url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
|
|
|
+ break;
|
|
|
+ case 2://Pc
|
|
|
+ String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
|
|
|
+ String s = Base64.encode(format);
|
|
|
+ url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
|
|
|
+ vo.setTel(user.getTelphone());
|
|
|
+ vo.setUser_account(user.getUserAccount());
|
|
|
+ vo.setUrl(url);
|
|
|
+ vo.setTenantId(tenantId);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<User> listByIdsNotTenant(List<Long> userIds) {
|
|
|
+ return baseMapper.listByIdsNotTenant(userIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String createToken(LoginUser loginUser) {
|
|
|
+ return tokenService.createToken(loginUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public User getByIdNoTenant(Long userId) {
|
|
|
+ return baseMapper.getByIdNoTenant(userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public User getByCardNoTenant(String idCard) {
|
|
|
+ return baseMapper.getByCardNoTenant(idCard);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> importSevenUser(List<UserPeriodImportBo> userList) {
|
|
|
+ if (CollectionUtils.isEmpty(userList)) {
|
|
|
+ throw new IllegalArgumentException("请勿导入空表格");
|
|
|
+ }
|
|
|
+ List<UserPeriodImportBo> errorList = new ArrayList<>();
|
|
|
+ List<UserPeriodImportBo> successList = new ArrayList<>();
|
|
|
+ String importNo = ServletUtils.getEncoded("IMPORT");
|
|
|
+ for (UserPeriodImportBo itemImport : userList) {
|
|
|
+ if(Validator.isEmpty(itemImport.getUserPhone())||itemImport.getUserPhone().length()!=11){
|
|
|
+ itemImport.setCause("手机号不能为空或者格式不对");
|
|
|
+ errorList.add(itemImport);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(itemImport.getUserCard())){
|
|
|
+ itemImport.setCause("身份证不能为空");
|
|
|
+ errorList.add(itemImport);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(itemImport.getUserName())){
|
|
|
+ itemImport.setCause("真实姓名不能为空");
|
|
|
+ errorList.add(itemImport);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ User user = getOne(new LambdaQueryWrapper<User>()
|
|
|
+ .eq(User::getTelphone,EncryptHandler.encrypt(itemImport.getUserPhone())).last("limit 1"));
|
|
|
+ if(Validator.isNotNull(user)){
|
|
|
+ if(Validator.isNotEmpty(user.getIdCard())&&Validator.isNotEmpty(itemImport.getUserCard())&&!itemImport.getUserCard().equals(user.getIdCard())){
|
|
|
+ throw new CustomException(itemImport.getUserCard()+"身份证号码不一致");
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(user.getIdCard())){
|
|
|
+ //更新身份证和姓名
|
|
|
+ user.setIdCard(itemImport.getUserCard());
|
|
|
+ user.setRealname(itemImport.getUserName());
|
|
|
+ updateById(user);
|
|
|
+ }
|
|
|
+ //手机号已存在
|
|
|
+ itemImport.setUserId(user.getUserId());
|
|
|
+ itemImport.setStudentCode(user.getUserAccount());
|
|
|
+ itemImport.setUserName(user.getRealname());
|
|
|
+ itemImport.setUserCard(user.getIdCard());
|
|
|
+ successList.add(itemImport);
|
|
|
+ continue;
|
|
|
+ }else{
|
|
|
+ User user2 = getOne(new LambdaQueryWrapper<User>()
|
|
|
+ .eq(User::getIdCard,EncryptHandler.encrypt(itemImport.getUserCard())).last("limit 1"));
|
|
|
+ if(Validator.isNotEmpty(user2)){
|
|
|
+ throw new CustomException(itemImport.getUserName()+"身份证号码已存在,创建失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ User inertData = new User();
|
|
|
+ inertData.setTelphone(itemImport.getUserPhone());
|
|
|
+ //隐藏手机号作为初始昵称
|
|
|
+ inertData.setNickname(TelPhoneUtils.hideTelPhone(itemImport.getUserPhone()));
|
|
|
+ //雪花算法产生账号ID
|
|
|
+ SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
|
|
|
+ inertData.setUserAccount(String.valueOf(idWorker.nextId()));
|
|
|
+ inertData.setSex(1);
|
|
|
+ if(Validator.isNotEmpty(itemImport.getSex())){
|
|
|
+ inertData.setSex(itemImport.getSex().equals("女")?2:1);
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(itemImport.getEducation())){
|
|
|
+ inertData.setEduLevel(itemImport.getEducation());
|
|
|
+ }
|
|
|
+ inertData.setIdCard(itemImport.getUserCard());
|
|
|
+ inertData.setRealname(itemImport.getUserName());
|
|
|
+ inertData.setStatus(1);
|
|
|
+ inertData.setRegisterPlat("3");
|
|
|
+ inertData.setAvatar(Constants.DEFAULT_AVATAR);
|
|
|
+ inertData.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
|
|
+ inertData.setLastLoginTime(DateUtils.getNowTime());
|
|
|
+ inertData.setCreateTime(DateUtils.getNowTime());
|
|
|
+ inertData.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ //初始密码(身份证后6位)
|
|
|
+ String idCard = itemImport.getUserCard();
|
|
|
+ String pwd = idCard.substring(idCard.length() - 6); // 随机密码
|
|
|
+ inertData.setPassword(SecurityUtils.encryptPassword(pwd));
|
|
|
+ inertData.setImportNo(importNo); //设置导入编号 一个导入页面同时导入多次算一个编号
|
|
|
+ if(!save(inertData)){
|
|
|
+ itemImport.setCause("注册失败");
|
|
|
+ errorList.add(itemImport);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ itemImport.setUserId(inertData.getUserId());
|
|
|
+ itemImport.setImportNo(importNo);
|
|
|
+ itemImport.setStudentCode(inertData.getUserAccount());
|
|
|
+ successList.add(itemImport);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> accountLogin(UserAppAccountLoginBo bo) {
|
|
|
if(Validator.isEmpty(bo.getAccount())){
|
|
|
@@ -1184,13 +1747,29 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
.or()
|
|
|
.eq(User::getIdCard,EncryptHandler.encrypt(bo.getAccount())));
|
|
|
User user = getOne(queryWrapper);
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ Integer share = 0;
|
|
|
+ if (StringUtils.isNotBlank(tenantId) && "867735392558919680".equals(tenantId)){
|
|
|
+ share = 1;
|
|
|
+ }
|
|
|
+
|
|
|
if(Validator.isEmpty(user)){
|
|
|
iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
- throw new CustomException("登录信息错误");
|
|
|
+ //判断旧系统是否有账号
|
|
|
+ if (share > 0){
|
|
|
+ oldAccountLogin(bo,1);
|
|
|
+ }else {
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
+ }
|
|
|
}
|
|
|
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
{
|
|
|
- throw new BaseException("对不起,您的账号:已停用");
|
|
|
+ //判断旧系统是否有账号
|
|
|
+ if (share > 0){
|
|
|
+ oldAccountLogin(bo,1);
|
|
|
+ }else {
|
|
|
+ throw new CustomException("对不起,您的账号:已停用");
|
|
|
+ }
|
|
|
}
|
|
|
String password = null;
|
|
|
if(bo.getPwd().length()>20){
|
|
|
@@ -1209,7 +1788,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if (!SecurityUtils.matchesPassword(password,user.getPassword()))
|
|
|
{
|
|
|
iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
- throw new BaseException("登录信息错误");
|
|
|
+ //判断旧系统是否有账号
|
|
|
+ if (share > 0){
|
|
|
+ oldAccountLogin(bo,1);
|
|
|
+ }else {
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
+ }
|
|
|
}
|
|
|
//如果活动分销码变动
|
|
|
if (StringUtils.isNotBlank(bo.getShareActivityCode())){
|
|
|
@@ -1225,6 +1809,58 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ private void oldAccountLogin(UserAppAccountLoginBo bo,Integer type) {
|
|
|
+ String msg = type == 1?"登录信息错误":"对不起,您的账号:已停用";
|
|
|
+ Boolean codeFlag = true;
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(bo.getAccount()+bo.getAccount()+nowTime + "pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("idNum", bo.getAccount());
|
|
|
+ params.put("passwordSign", "1");
|
|
|
+ params.put("telphone",bo.getAccount());
|
|
|
+ String password = null;
|
|
|
+ if(bo.getPwd().length()>20){
|
|
|
+ String rsaPrivate = null;
|
|
|
+ try {
|
|
|
+ InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/pri.key");
|
|
|
+ rsaPrivate = AES.getStringByInputStream_1(certStream);
|
|
|
+ certStream.close();
|
|
|
+ password = AES.decrypt(bo.getPwd(),rsaPrivate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ password = bo.getPwd();
|
|
|
+ }
|
|
|
+ params.put("password", password);
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(OLD_GOODS, params);
|
|
|
+ if (!respone.contains("\"code\":200")) {
|
|
|
+ codeFlag = false;
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(respone);
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
+ if (ObjectUtils.isNotNull(data)){
|
|
|
+ UserNewGoodsVo vo = JSONObject.parseObject(JSONObject.toJSONString(data), UserNewGoodsVo.class);
|
|
|
+ throw new CustomException(vo.getPcUrl());
|
|
|
+ }else {
|
|
|
+ codeFlag = false;
|
|
|
+ throw new CustomException(msg);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ if (codeFlag){
|
|
|
+ throw new CustomException(e.getMessage(),699);
|
|
|
+ }else {
|
|
|
+ throw new CustomException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean bindIdCard(UserAppBindIdBo bo) {
|
|
|
if(Validator.isEmpty(bo.getIdCard())){
|