|
|
|
@ -3,6 +3,7 @@ package com.glxp.sale.admin.controller.auth;
|
|
|
|
|
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.sale.admin.constant.Constant;
|
|
|
|
|
import com.glxp.sale.admin.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.sale.admin.entity.auth.AuthLicense;
|
|
|
|
|
import com.glxp.sale.admin.entity.info.CompanyEntity;
|
|
|
|
|
import com.glxp.sale.admin.exception.JsonException;
|
|
|
|
|
import com.glxp.sale.admin.req.auth.LoginRequest;
|
|
|
|
@ -17,6 +18,8 @@ import com.glxp.sale.admin.util.PasswordUtils;
|
|
|
|
|
import com.glxp.sale.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.sale.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.sale.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.sale.admin.util.AppUtils;
|
|
|
|
|
import com.glxp.sale.admin.dao.auth.AuthLicenseDao;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -24,6 +27,8 @@ import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -167,4 +172,39 @@ public class LoginController {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_CHANGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 平台验证
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@PostMapping(value = "/verify")
|
|
|
|
|
public BaseResponse verify(@RequestBody Map<String, Object> params,
|
|
|
|
|
HttpServletRequest request) {
|
|
|
|
|
AuthAdmin authAdmin;
|
|
|
|
|
authAdmin = authAdminService.findByUserName(params.get("username").toString());
|
|
|
|
|
if (authAdmin == null) {
|
|
|
|
|
return ResultVOUtils.error("用户名或密码错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!PasswordUtils.authAdminPwd(params.get("password").toString()).equals(authAdmin.getPassWord())) {
|
|
|
|
|
return ResultVOUtils.error("用户名或密码错误");
|
|
|
|
|
}
|
|
|
|
|
AuthLicense authLicense = new AuthLicense();
|
|
|
|
|
if(params.get("appid")!=null) {
|
|
|
|
|
authLicense = authLicenseDao.get(params.get("appid").toString());
|
|
|
|
|
} else {
|
|
|
|
|
String appid = AppUtils.getAppid();
|
|
|
|
|
authLicense.setId(appid);
|
|
|
|
|
authLicense.setAppid(appid);
|
|
|
|
|
authLicense.setApkKey(appid);
|
|
|
|
|
if(params.get("name")!=null)
|
|
|
|
|
authLicense.setName(params.get("name").toString());
|
|
|
|
|
authLicense.setSecretKey(AppUtils.getSecretKey(appid));
|
|
|
|
|
authLicense.setCreateDate(new Date());
|
|
|
|
|
authLicenseDao.save(authLicense);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(authLicense);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|