Commit c417db5e by tangzhaoqian Committed by chenzg

登录bug

parent e3ccb5ac
package cn.timer.api.controller; package cn.timer.api.controller;
import java.io.IOException; import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.alibaba.druid.sql.visitor.functions.Now;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
...@@ -43,7 +40,6 @@ import cn.timer.api.bean.zzgl.ZzglAuth; ...@@ -43,7 +40,6 @@ import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum; import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper; import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper; import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
...@@ -472,14 +468,10 @@ public class LoginController { ...@@ -472,14 +468,10 @@ public class LoginController {
return ResultUtil.error("已注册过企业"); return ResultUtil.error("已注册过企业");
} }
} }
//增加一个月试用期
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.MONTH, 1);
cal.getTime();
// 企业信息 // 企业信息
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().name(name).registerTime(DateUtil.date()) QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().name(name).registerTime(DateUtil.date())
.endTime(DateUtil.offsetDay(new Date(), offset)).level(CommonEnum.LEVEL_PROBATION.getType()).endTime(cal.getTime()) .endTime(DateUtil.offsetDay(new Date(), offset)).level(CommonEnum.LEVEL_PROBATION.getType())
.build(); .build();
boolean b1 = qyzxEntInfoM.insert(); boolean b1 = qyzxEntInfoM.insert();
if (!b1) { if (!b1) {
...@@ -574,12 +566,24 @@ public class LoginController { ...@@ -574,12 +566,24 @@ public class LoginController {
qyzxEmpLogin1.setQys(qys); qyzxEmpLogin1.setQys(qys);
QysDto ctrl = qys.get(0); QysDto ctrl = qys.get(0);
if (qyzxEmpLogin1.getOrgId() != null) { if (qyzxEmpLogin1.getOrgId() != null) {
Stream<QysDto> s = qys.stream()
.filter(item -> "1".equals(item.getStatus().toString()) && qyzxEmpLogin1.getOrgId().equals(item.getId())); // for (QysDto qysDto : qys) {
if (s != null) { // if (qyzxEmpLogin1.getOrgId().equals(qysDto.getId()) && qysDto.getStatus() == 1) {
ctrl = s.findFirst().get(); // ctrl = qysDto;
// }
// System.out.println(qyzxEmpLogin1.getOrgId());
// System.out.println(qysDto);
// }
Optional<QysDto> s = qys.parallelStream()
.filter(item -> item.getStatus() == 1 && qyzxEmpLogin1.getOrgId().equals(item.getId())).findFirst();
System.out.println(s.isPresent());
if (s != null && s.isPresent()) {
ctrl = s.get();
} }
} }
if (ctrl.getStatus() == null || ctrl.getStatus().equals(0)) { if (ctrl.getStatus() == null || ctrl.getStatus().equals(0)) {
return ResultUtil.error("帐号被禁用"); return ResultUtil.error("帐号被禁用");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment