|
@@ -46,6 +46,7 @@ import platform.modules.home.request.FindRequest;
|
|
|
import platform.modules.home.response.FindResponse;
|
|
import platform.modules.home.response.FindResponse;
|
|
|
import platform.modules.home.response.FindResponseProject;
|
|
import platform.modules.home.response.FindResponseProject;
|
|
|
import platform.modules.home.response.ListResponse;
|
|
import platform.modules.home.response.ListResponse;
|
|
|
|
|
+import platform.modules.home.service.WxMicroappService;
|
|
|
import platform.modules.sys.entity.ActivityDetail;
|
|
import platform.modules.sys.entity.ActivityDetail;
|
|
|
import platform.modules.sys.entity.ActivityFavourite;
|
|
import platform.modules.sys.entity.ActivityFavourite;
|
|
|
import platform.modules.sys.entity.ActivityRegistration;
|
|
import platform.modules.sys.entity.ActivityRegistration;
|
|
@@ -181,6 +182,9 @@ public class HomeController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private BuildingService buildingService;
|
|
private BuildingService buildingService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private WxMicroappService wxMicroappService;
|
|
|
|
|
+
|
|
|
// @GetMapping(value = "")
|
|
// @GetMapping(value = "")
|
|
|
// public String homePage(ModelMap modelMap) throws Exception {
|
|
// public String homePage(ModelMap modelMap) throws Exception {
|
|
|
// //获取幻灯片
|
|
// //获取幻灯片
|
|
@@ -870,7 +874,7 @@ public class HomeController extends BaseController {
|
|
|
modelMap.put("isLogin", ShiroUtils.isLogin());
|
|
modelMap.put("isLogin", ShiroUtils.isLogin());
|
|
|
modelMap.put("userType", ShiroUtils.getUserType());
|
|
modelMap.put("userType", ShiroUtils.getUserType());
|
|
|
modelMap.put("userName", ShiroUtils.getNickName());
|
|
modelMap.put("userName", ShiroUtils.getNickName());
|
|
|
- modelMap.put("userId",ShiroUtils.getUserId());
|
|
|
|
|
|
|
+ modelMap.put("userId", ShiroUtils.getUserId());
|
|
|
User user = ShiroUtils.getUserEntity();
|
|
User user = ShiroUtils.getUserEntity();
|
|
|
if (user != null) {
|
|
if (user != null) {
|
|
|
modelMap.put("firstLogin", user.getFist_login());
|
|
modelMap.put("firstLogin", user.getFist_login());
|
|
@@ -1011,7 +1015,7 @@ public class HomeController extends BaseController {
|
|
|
*/
|
|
*/
|
|
|
@RequestMapping("/personalRegister")
|
|
@RequestMapping("/personalRegister")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public ResponseMessage personalRegister(User userInfo){
|
|
|
|
|
|
|
+ public ResponseMessage personalRegister(User userInfo) {
|
|
|
try {
|
|
try {
|
|
|
if (!Constant.Environment.PROD_TEST.equals(profiles) && !Constant.Environment.TEST.equals(profiles)) {
|
|
if (!Constant.Environment.PROD_TEST.equals(profiles) && !Constant.Environment.TEST.equals(profiles)) {
|
|
|
if (!verificationCodeUtil.validateVerificationCode(userInfo.getPhone(), userInfo.getValidateNum())) {
|
|
if (!verificationCodeUtil.validateVerificationCode(userInfo.getPhone(), userInfo.getValidateNum())) {
|
|
@@ -1039,6 +1043,66 @@ public class HomeController extends BaseController {
|
|
|
return ResponseMessage.success("注册成功");
|
|
return ResponseMessage.success("注册成功");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @GetMapping("/validate")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResponseMessage wechatRegist(@RequestParam("phone") String phone, @RequestParam("code") String code) {
|
|
|
|
|
+ return ResponseMessage.success("请求成功", verificationCodeUtil.validateVerificationCode(phone, code));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 微信注册
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param userInfo
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/wechatRegist")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResponseMessage wechatRegist(@RequestBody User userInfo) {
|
|
|
|
|
+
|
|
|
|
|
+ User user_o = userService.findByMobile(userInfo.getPhone());
|
|
|
|
|
+ if (user_o != null) {
|
|
|
|
|
+ return ResponseMessage.success("注册成功", user_o.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ User user = new User();
|
|
|
|
|
+ user.setUser_name(userInfo.getPhone());
|
|
|
|
|
+ user.setNick_name(userInfo.getPhone());
|
|
|
|
|
+ user.setPassword(SecureUtil.md5().digestHex("123456".trim()));
|
|
|
|
|
+ user.setPhone(userInfo.getPhone());
|
|
|
|
|
+ user.setUser_type(Constant.UserType.WECHAT);
|
|
|
|
|
+ user.setIs_register(1);
|
|
|
|
|
+ user.setFist_login(1);
|
|
|
|
|
+ user.setIs_start(true);
|
|
|
|
|
+ user.setIs_admin(false);
|
|
|
|
|
+ user.setCreate_name("wechat_" + userInfo.getPhone());
|
|
|
|
|
+ user.setCreate_time(DateUtil.getTimeString(new Date()));
|
|
|
|
|
+ Integer id = userService.insertAndGetId(user);
|
|
|
|
|
+ return ResponseMessage.success("注册成功", id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 微信小程序登录
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("wxapp/login")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResponseMessage wxAppLogin(
|
|
|
|
|
+ @RequestParam String code
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return ResponseMessage.success("登录成功", wxMicroappService.wxAppLogin(code));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 微信小程序获取用户信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("wxapp/phone")
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ public ResponseMessage wxAppUserinfo(
|
|
|
|
|
+ @RequestParam String code,
|
|
|
|
|
+ @RequestParam String encryptedData,
|
|
|
|
|
+ @RequestParam String iv
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return ResponseMessage.success("获取用户信息成功", wxMicroappService.getPhoneNumber(code, encryptedData, iv));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 企业注册
|
|
* 企业注册
|
|
|
*
|
|
*
|
|
@@ -1052,7 +1116,7 @@ public class HomeController extends BaseController {
|
|
|
public ResponseMessage register(Company information, User userInfo) throws Exception {
|
|
public ResponseMessage register(Company information, User userInfo) throws Exception {
|
|
|
try {
|
|
try {
|
|
|
Approval approval = new Approval();
|
|
Approval approval = new Approval();
|
|
|
- if (!Constant.Environment.PROD_TEST.equals(profiles) && !Constant.Environment.TEST.equals(profiles)){
|
|
|
|
|
|
|
+ if (!Constant.Environment.PROD_TEST.equals(profiles) && !Constant.Environment.TEST.equals(profiles)) {
|
|
|
if (!verificationCodeUtil.validateVerificationCode(information.getPhone(), information.getValidateNum())) {
|
|
if (!verificationCodeUtil.validateVerificationCode(information.getPhone(), information.getValidateNum())) {
|
|
|
return ResponseMessage.error("验证码错误!");
|
|
return ResponseMessage.error("验证码错误!");
|
|
|
}
|
|
}
|
|
@@ -1073,12 +1137,11 @@ public class HomeController extends BaseController {
|
|
|
//查看是否已经存在企业
|
|
//查看是否已经存在企业
|
|
|
// Company company = companyService.findByParkIdAndCompanyName(information.getCompany_name(), information.getBuild_id());
|
|
// Company company = companyService.findByParkIdAndCompanyName(information.getCompany_name(), information.getBuild_id());
|
|
|
Company company = companyService.findByCompanyName(information.getCompany_name());
|
|
Company company = companyService.findByCompanyName(information.getCompany_name());
|
|
|
- if (company != null){
|
|
|
|
|
|
|
+ if (company != null) {
|
|
|
information.setId(company.getId());
|
|
information.setId(company.getId());
|
|
|
information.setIs_register(0);
|
|
information.setIs_register(0);
|
|
|
companyService.update(information);
|
|
companyService.update(information);
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
companyService.insertAndGetId(information);
|
|
companyService.insertAndGetId(information);
|
|
|
}
|
|
}
|
|
|
approval.setApply_id(information.getId());
|
|
approval.setApply_id(information.getId());
|