Commit b83c66fd by 翁国栋 Committed by 284718418@qq.com

禅道id--

982、注册流程调整注册流程调整
parent 4159f3a9
......@@ -149,8 +149,8 @@ public class LoginController {
private String summary;
@Value("${config-8timer.authentication-code}")
public String authentication_code;
public String authentication_code;
@Autowired
private HttpSession session;
......@@ -174,7 +174,7 @@ public class LoginController {
/**
* 发送验证码
*
*
* @param entRegisterDto
* @return
*/
......@@ -197,7 +197,7 @@ public class LoginController {
// QyzxRemainingQuantity quantity = QyzxRemainingQuantity.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
// .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
// .gt(QyzxRemainingQuantity::getRemainder, 0));
// .gt(QyzxRemainingQuantity::getRemainder, 0));
// }
// Date date = null;
// Integer remainder = null;
......@@ -268,7 +268,7 @@ public class LoginController {
/**
* 手机号码认证
*
*
* @param entRegisterDto
* @return
*/
......@@ -281,17 +281,17 @@ public class LoginController {
String code = entRegisterDto.getCode().toString();
String codeRedis = session.getAttribute(phone) != null ? session.getAttribute(phone).toString() : "";
if(authentication_code !=null && !("").equals(authentication_code)) {
if (authentication_code.equals(code)) {
return ResultUtil.success("验证码正确");
}
}
if (code == null || !code.equals(codeRedis)) {
return ResultUtil.error("验证码不符");
}
return ResultUtil.success("验证码正确");
}
......@@ -307,7 +307,7 @@ public class LoginController {
Integer type = entRegisterDto.getPwUpdateType();// 验证方式
QyzxEmpLogin qyzxEmpLogin = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();// 员工登录表
if(qyzxEmpLogin != null) {
String dbPwd = qyzxEmpLogin.getPw();// 数据库原密码
if (type == 1) {
......@@ -318,14 +318,14 @@ public class LoginController {
return ResultUtil.error("新密码与原密码相同,请修改后重试!");
}
} else {
if(authentication_code ==null || ("").equals(authentication_code) || !authentication_code.equals(code)) {
String codeRedis = session.getAttribute(phone) != null ? session.getAttribute(phone).toString() : "";
if (!code.equals(codeRedis)) {
return ResultUtil.error("短信验证码错误");
}
}
if (Md5.md5(pw).equals(dbPwd)) {
return ResultUtil.error("新密码与原密码相同,请修改后重试!");
}
......@@ -336,13 +336,13 @@ public class LoginController {
}else {
return ResultUtil.error("账号不存在");
}
}
/**
* 修改密码
*
*
* @param entRegisterDto
* @return
*/
......@@ -359,15 +359,15 @@ public class LoginController {
if (code == null) {
return ResultUtil.error("请填写验证码");
}
if(authentication_code ==null || ("").equals(authentication_code) || !authentication_code.equals(code)) {
if (!code.toString().equals(codeRedis)) {
return ResultUtil.error("验证码不符");
}
}
QyzxEmpLogin qyzxEmpLogin = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
if (qyzxEmpLogin != null) {
......@@ -405,7 +405,7 @@ public class LoginController {
/**
* 修改手机号/用户名
*
*
* @param entRegisterDto
* @return
*/
......@@ -422,7 +422,7 @@ public class LoginController {
String code = entRegisterDto.getCode();
// String codeRedis = redisTemplate.get(phone).toString();
String codeRedis = session.getAttribute(phone) != null ? session.getAttribute(phone).toString() : "";
if(authentication_code !=null && !("").equals(authentication_code)) {
if (authentication_code.equals(code)) {
QyzxEmpLogin qyzxEmpLogin1 = qyzxEmpLoginMapper.selectById(empNum);
......@@ -440,12 +440,12 @@ public class LoginController {
}
}
}
if (code == null || !code.toString().equals(codeRedis)) {
return ResultUtil.error("验证码不符/失效");
}
QyzxEmpLogin qyzxEmpLogin1 = qyzxEmpLoginMapper.selectById(empNum);
if (qyzxEmpLogin1 != null) {
......@@ -465,7 +465,7 @@ public class LoginController {
/**
* 是否有账号
*
*
* @return
*/
@GetMapping(value = "/user")
......@@ -493,26 +493,26 @@ public class LoginController {
private KqglAssoLeaveRulesMapper kqglassoleaverulesmapper;
@Autowired
private KqglAssoOvertimeRulesMMapper kqglassoovertimerulesmmapper;
@GetMapping(value="/doublecheck/{checkobject}")
@ApiOperation(value = "检查注册公司名是否重复", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> doublecheck(@PathVariable("checkobject") String checkobject) {
QyzxEntInfoM gsif = QyzxEntInfoM.builder().build().selectOne(new QueryWrapper<QyzxEntInfoM>().lambda().eq(QyzxEntInfoM::getName, checkobject));
if(gsif != null) {
return ResultUtil.success("呀,该公司名已被注册了!!!") ;
}else {
return ResultUtil.data(0,"操作成功!");
}
}
/**
* 注册企业
*
*
* @param entRegisterDto
* @return
*/
......@@ -540,7 +540,8 @@ public class LoginController {
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, login.getId())
.eq(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN.getType()).count();
//将密码改为注册企业输入的密码 2021//11/11 wgd
login.setPw(Md5.md5(pw));
if (count > max) {
return ResultUtil.error("已注册过企业");
}
......@@ -604,7 +605,7 @@ public class LoginController {
.last("LIMIT 1"));
if (rule == null) {
List<KqglAssoLeaveRules> rullist = new ArrayList<KqglAssoLeaveRules>();
for (KqglAssoLeaveRulesT rul : ruless) {
KqglAssoLeaveRules vice = KqglAssoLeaveRules.builder().name(rul.getName()).company(rul.getCompany())
.leaveType(rul.getLeaveType()).apply(rul.getApply()).createTime(new Date().getTime())
......@@ -619,14 +620,14 @@ public class LoginController {
} else {
Logoutput("重复初始化数据!");
}
//建立初始化的加班规则
KqglAssoOvertimeRulesM jbgzdef = KqglAssoOvertimeRulesM.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRulesM>().lambda().eq(KqglAssoOvertimeRulesM::getOvertimeruledefault, 1));
KqglAssoOvertimeRules Rules = KqglAssoOvertimeRules.builder().build();
Rules.setOrgCode(qyzxEntInfoM.getId());
BeanUtil.copyProperties(jbgzdef, Rules , "orgCode");
Rules.insert();
//假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, qyId));
......@@ -637,10 +638,10 @@ public class LoginController {
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(login.getId()).balanceDays(0.0).modifyUserid(login.getId()).modifyTimer(current_time).orgCode(qyId).build().insert();
}
}
//加班基础设置
KqglAssoOvertimeBasics.builder().minimumUnit(3).modifyUserid(999).modifyTime(new Date().getTime()).orgCode(qyzxEntInfoM.getId()).build().insert();
//报税周期设置
XcglAssoBszqsz.builder().taxReturnCycle(2).qyid(qyzxEntInfoM.getId()).build().insert();
......@@ -681,7 +682,7 @@ public class LoginController {
/**
* 验证码登录
*
*
* @param entRegisterDto
* @return
*/
......@@ -697,7 +698,7 @@ public class LoginController {
}
String phone = entRegisterDto.getPhone();
String codeRedis = session.getAttribute(phone) != null ? session.getAttribute(phone).toString() : "";
if(authentication_code !=null && !("").equals(authentication_code)) {
if (authentication_code.equals(code)) {
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
......@@ -706,7 +707,7 @@ public class LoginController {
return loginhan(qyzxEmpLogin1, request);
}
}
if (codeRedis == null || !code.equals(codeRedis))
return ResultUtil.error("验证码不符");
......@@ -806,11 +807,11 @@ public class LoginController {
List<String> menus = new ArrayList<>();
zas.stream().forEach(o -> menus.add(o.getMenuId()));
qyzxEmpLogin1.setMenus(menus);
}
}
List<MenuStructureDto> mestrs = new ArrayList<MenuStructureDto>();
List<QyzxAdminMenu> qyme = QyzxAdminMenu.builder().build().selectList(new QueryWrapper<QyzxAdminMenu>().lambda().eq(QyzxAdminMenu::getOrgCode, qyzxEmpLogin1.getOrgId()).orderByAsc(QyzxAdminMenu::getSortNumber));
String[] zdy = new String[qyme.size()];
......@@ -824,11 +825,11 @@ public class LoginController {
mestrs.add(metr);
zdy[i] = me.getMenuCode();
i++;
}
}
//
List<AdminMenuTemplate> adtes = AdminMenuTemplate.builder().build().selectList(new QueryWrapper<AdminMenuTemplate>().lambda().eq(AdminMenuTemplate::getEnable, 1).orderByAsc(AdminMenuTemplate::getSortNumber));
for(AdminMenuTemplate adm : adtes) {
if(!ClockInTool.useArrayUtils(ClockInTool.deleteArrayNull(zdy), adm.getMenuCode())) {
if(adm.getDistribution() == 0 && qyzxEmpLogin1.getOrgId() == 3) {
MenuStructureDto metr = MenuStructureDto.builder().build();
......@@ -848,17 +849,17 @@ public class LoginController {
}
}
qyzxEmpLogin1.setMenstr(mestrs);
QyzxAdminColour cdys = QyzxAdminColour.builder().build().selectOne(new QueryWrapper<QyzxAdminColour>().lambda().eq(QyzxAdminColour::getOrgCode, qyzxEmpLogin1.getOrgId()));
qyzxEmpLogin1.setZdyys(cdys);
// 可操作企业
// 需要更新最后一次登陆信息
// 用户信息缓存
session.setAttribute("ui", qyzxEmpLogin1);
System.err.println(session.getId());
Object ui = session.getAttribute("ui");
return ResultUtil.data(qyzxEmpLogin1);
......@@ -866,7 +867,7 @@ public class LoginController {
/**
* 密码登录
*
*
* @param entRegisterDto
* @return
*/
......@@ -901,7 +902,7 @@ public class LoginController {
/**
* 绑定邮箱
*
*
* @param empNum
* @return
*/
......@@ -920,14 +921,14 @@ public class LoginController {
return ResultUtil.error("绑定失败");
}
@Value("${config-8timer.expiration_time}")
public Integer expiration_time;
static SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//////PC
@PostMapping(value = "/extracting_code")
@ApiOperation(value = "获取二维码", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Extracting_QR_code(HttpServletResponse response) throws Exception {
......@@ -935,48 +936,48 @@ public class LoginController {
String timercode = String.valueOf(new Date().getTime());
String randomnum = String.valueOf((int)(1+Math.random()*(10-1+1)));//随机数
String key=Md5.md5(timercode+randomnum);//加密
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("type", "longin");
hashMap.put("scancode", key);
hashMap.put("code", "200");
hashMap.put("message", "");
hashMap.put("result", "true");
String result = new cn.hutool.json.JSONObject(hashMap).toString();//转化为json格式
String result = new cn.hutool.json.JSONObject(hashMap).toString();//转化为json格式
Logoutput("全部信息="+result);//打印json串
ZzglCodeLogin.builder().keyCode(key).vlaue(timercode).datatime(new Date().getTime()).build().insert();
ZzglCodeLogin.builder().keyCode(key+"_code").vlaue("1").datatime(new Date().getTime()).build().insert();
ServletOutputStream pw = response.getOutputStream();
pw.print(result);
pw.flush();
pw.close();
return null;
// return ResultUtil.data(key,"成功");
}
@PostMapping(value = "/scan_code_login")
@ApiOperation(value = "扫码登录", httpMethod = "POST", notes = "接口发布说明")
public Result<QyzxEmpLogin> Scan_code_login(@RequestBody ScancodeloginparametersDto scancodelogin,HttpServletRequest request) throws ParseException {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
ZzglCodeLogin colo = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
String timercode = colo.getVlaue();
ZzglCodeLogin colo_ = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_code"));
String timer_code = colo_.getVlaue();
timercode = ClockInTool.stampToDate(timercode);
long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(timercode, "+"+expiration_time)));
//key
//计算
//1:没人扫码 2:扫码成功 3:登录成功 4:过期
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(changed_time)));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd1.after(sd2)) {
......@@ -991,19 +992,19 @@ public class LoginController {
int EmpNum = Integer.valueOf(num.getVlaue());
ZzglCodeLogin orco = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_orgcode"));
int OrgCode = Integer.valueOf(orco.getVlaue());
YgglMainEmp ygam = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, EmpNum).eq(YgglMainEmp::getOrgCode, OrgCode));
if(ygam != null) {
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(QyzxEmpLogin::getPhone, ygam.getPhone()).one();
if (qyzxEmpLogin1 != null) {
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_code"));
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_empnum"));
ZzglCodeLogin.builder().build().delete(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()+"_orgcode"));
return loginhan(qyzxEmpLogin1, request);
}else {
return ResultUtil.error("登录失败");
......@@ -1018,13 +1019,13 @@ public class LoginController {
// return ResultUtil.error("二维码已过期");
return ResultUtil.success("4");
}
}
//////APP
@PostMapping(value = "/scanLogin")
@ApiOperation(value = "手机端扫码登录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> scanLogin(@RequestBody ScancodeloginparametersDto scancodelogin) throws ParseException {
......@@ -1033,10 +1034,10 @@ public class LoginController {
ZzglCodeLogin colo = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
if(colo != null) {
String timercode = colo.getVlaue();
timercode = ClockInTool.stampToDate(timercode);
long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(timercode, "+"+expiration_time)));
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(changed_time)));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd1.after(sd2)) {
......@@ -1052,21 +1053,21 @@ public class LoginController {
return ResultUtil.error("验证失败");
}
}
@PostMapping(value = "/scanLoginOk")
@ApiOperation(value = "手机端扫码登录确认", httpMethod = "POST", notes = "接口发布说明")
public Result<QyzxEmpLogin> scanLoginOk(@CurrentUser UserBean userBean,@RequestBody ScancodeloginparametersDto scancodelogin, HttpServletRequest request) throws ParseException {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
if(scancodelogin.getKey() != null) {
ZzglCodeLogin.builder().keyCode(scancodelogin.getKey()+"_empnum").vlaue(String.valueOf(userBean.getEmpNum())).datatime(new Date().getTime()).build().insert();
ZzglCodeLogin.builder().keyCode(scancodelogin.getKey()+"_orgcode").vlaue(String.valueOf(userBean.getOrgCode())).datatime(new Date().getTime()).build().insert();
ZzglCodeLogin colo = ZzglCodeLogin.builder().build().selectOne(new QueryWrapper<ZzglCodeLogin>().lambda().eq(ZzglCodeLogin::getKeyCode, scancodelogin.getKey()));
String timercode = colo.getVlaue();
timercode = ClockInTool.stampToDate(timercode);
long changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(timercode, "+"+expiration_time)));
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(changed_time)));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd1.after(sd2)) {
......@@ -1079,8 +1080,8 @@ public class LoginController {
return ResultUtil.error("验证失败");
}
}
@GetMapping(value = "/switching_enterprises/{orgcodeid}")
@ApiOperation(value = "切换企业", httpMethod = "GET", notes = "是否有账号")
public Result<QyzxEmpLogin> Switching_Enterprises(@CurrentUser UserBean userBean,@PathVariable("orgcodeid") Integer orgcodeid,HttpServletRequest request) {
......@@ -1090,14 +1091,14 @@ public class LoginController {
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(QyzxEmpLogin::getPhone, userBean.getQyzxEmpLogin().getPhone()).one();
if (qyzxEmpLogin1 != null) {
return loginhan(qyzxEmpLogin1, request);
}else {
return ResultUtil.error("切换失败!!");
}
}
@GetMapping(value = "/record_breaking")
@ApiOperation(value = "刷新纪录", httpMethod = "GET", notes = "是否有账号")
public Result<QyzxEmpLogin> RecordBreaking(@CurrentUser UserBean userBean,HttpServletRequest request) {
......@@ -1105,25 +1106,25 @@ public class LoginController {
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(QyzxEmpLogin::getPhone, userBean.getQyzxEmpLogin().getPhone()).eq(QyzxEmpLogin::getOrgId, userBean.getOrgCode()).one();
if (qyzxEmpLogin1 != null) {
return loginhan(qyzxEmpLogin1, request);
}else {
return ResultUtil.error("刷新失败!!");
}
}
@Value("${config-8timer.environmental-science}")
public String environmental_science;
public void Logoutput(String science) {
if(!("pro").equals(environmental_science)) {
System.out.println(science);
}else {
System.out.println("");
}
}
}
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