|
@@ -0,0 +1,84 @@
|
|
|
+package com.abcsz.litigationcase.service.impl;
|
|
|
+
|
|
|
+import com.abcsz.litigationcase.dao.entity.UserEntity;
|
|
|
+import com.abcsz.litigationcase.dao.entity.UserLoginEntity;
|
|
|
+import com.abcsz.litigationcase.dao.mapper.UserLoginMapper;
|
|
|
+import com.abcsz.litigationcase.dao.mapper.UserMapper;
|
|
|
+import com.abcsz.litigationcase.domain.ro.UserLoginRo;
|
|
|
+import com.abcsz.litigationcase.domain.vo.PublicVo;
|
|
|
+import com.abcsz.litigationcase.service.UserLoginService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 用户登陆记录表 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author shengqianlei
|
|
|
+ * @since 2022-04-28
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class UserLoginServiceIml extends ServiceImpl<UserLoginMapper, UserLoginEntity> implements UserLoginService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserMapper userMapper;
|
|
|
+ @Autowired
|
|
|
+ private UserLoginMapper userLoginMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PublicVo userLogin(UserLoginRo ro) {
|
|
|
+ log.info("用户登录登记...");
|
|
|
+ PublicVo publicVo = new PublicVo();
|
|
|
+
|
|
|
+ try {
|
|
|
+ /* 查询用户信息 */
|
|
|
+ QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("user_account",ro.getUserAccount());
|
|
|
+ queryWrapper.eq("del_flag",0);
|
|
|
+ UserEntity userEntity = userMapper.selectOne(queryWrapper);
|
|
|
+ if(userEntity == null){
|
|
|
+ publicVo.setRetCode("Y001");
|
|
|
+ publicVo.setRetMsg("用户账号不存在");
|
|
|
+ log.info(publicVo.getRetCode() + "****" + publicVo.getRetMsg());
|
|
|
+ return publicVo;
|
|
|
+ }
|
|
|
+ if(!(userEntity.getUserPassword().equals(ro.getUserPassword()))){
|
|
|
+ publicVo.setRetCode("Y002");
|
|
|
+ publicVo.setRetMsg("密码输入错误");
|
|
|
+ log.info(publicVo.getRetCode() + "****" + publicVo.getRetMsg());
|
|
|
+ return publicVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ UserLoginEntity userLoginEntity = new UserLoginEntity();
|
|
|
+ userLoginEntity.setUserId(userEntity.getUserId());
|
|
|
+ userLoginEntity.setLoginTime(new Date());
|
|
|
+ userLoginEntity.setDelFlag(0);
|
|
|
+ int count = userLoginMapper.insert(userLoginEntity);
|
|
|
+ if(count !=1){
|
|
|
+ publicVo.setRetCode("S001");
|
|
|
+ publicVo.setRetMsg("登陆信息登记异常,请重新登陆");
|
|
|
+ log.info(publicVo.getRetCode() + "****" + publicVo.getRetMsg());
|
|
|
+ return publicVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage() + "****" + e.getStackTrace());
|
|
|
+ publicVo.setRetCode("X001");
|
|
|
+ publicVo.setRetMsg("系统异常");
|
|
|
+ log.error(publicVo.getRetCode() + "****" + publicVo.getRetMsg());
|
|
|
+ return publicVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ publicVo.setRetCode("0000");
|
|
|
+ publicVo.setRetMsg("操作成功");
|
|
|
+ log.info(publicVo.getRetCode() + "****" + publicVo.getRetMsg());
|
|
|
+ return publicVo;
|
|
|
+ }
|
|
|
+}
|