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

禅道id--

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