Commit 9fb787b4 by giaogiao

1.商家端注册登陆;

2.优化商家列表查询
parent c6b23de1
...@@ -19,7 +19,7 @@ import java.io.IOException; ...@@ -19,7 +19,7 @@ import java.io.IOException;
@Slf4j @Slf4j
@Api(value = "Hello World2", tags = {"商户Hello World2"}) @Api(value = "Hello World2", tags = {"商户Hello World2"})
@RestController @RestController
@RequestMapping("/merchant/") @RequestMapping("/merchant/hello")
public class MerchantHelloWorldController { public class MerchantHelloWorldController {
@GetMapping(value = "/world") @GetMapping(value = "/world")
...@@ -41,7 +41,7 @@ public class MerchantHelloWorldController { ...@@ -41,7 +41,7 @@ public class MerchantHelloWorldController {
@GetMapping(value = "/needRoleAdmin") @GetMapping(value = "/needRoleAdmin")
@OperationLog(name = "needRoleAdmin") @OperationLog(name = "needRoleAdmin")
@ApiOperation(value = "needRoleAdmin", response = String.class) @ApiOperation(value = "needRoleAdmin", response = String.class)
@RequiresPermissions("mer:admin") @RequiresPermissions("merchant:admin")
public ApiResult<String> needRoleAdmin() throws IOException { public ApiResult<String> needRoleAdmin() throws IOException {
log.debug("Hello World...app"); log.debug("Hello World...app");
return ApiResult.ok("Hello World needRoleAdmin"); return ApiResult.ok("Hello World needRoleAdmin");
...@@ -50,7 +50,7 @@ public class MerchantHelloWorldController { ...@@ -50,7 +50,7 @@ public class MerchantHelloWorldController {
@GetMapping(value = "/needRoleAll") @GetMapping(value = "/needRoleAll")
@OperationLog(name = "needRoleAll") @OperationLog(name = "needRoleAll")
@ApiOperation(value = "needRoleAll", response = String.class) @ApiOperation(value = "needRoleAll", response = String.class)
@RequiresRoles("app:all") @RequiresRoles("merchant:all")
public ApiResult<String> needRoleAll() throws IOException { public ApiResult<String> needRoleAll() throws IOException {
log.debug("Hello World...app"); log.debug("Hello World...app");
return ApiResult.ok("Hello World needRoleAll"); return ApiResult.ok("Hello World needRoleAll");
......
...@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/merchantPermission") @RequestMapping("/merchant/permission")
@Module("${cfg.module}") @Module("${cfg.module}")
@Api(value = "商家权限API", tags = {"商家权限"}) @Api(value = "商家权限API", tags = {"商家权限"})
public class MerchantPermissionController extends BaseController { public class MerchantPermissionController extends BaseController {
......
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.api.merchant.controller;
import com.jumeirah.common.param.RegisterParam;
import com.jumeirah.common.service.SysRegisterService;
import com.jumeirah.common.vo.LoginSysUserTokenVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLogIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
/**
* 注册控制器
*
* @author geekidea
* @date 2019-09-28
* @since 1.3.0.RELEASE
**/
@Slf4j
@RestController
@Module("system")
@Api(value = "商户注册API", tags = {"商户注册"})
@RequestMapping("/merchant/")
public class MerchantRegisterController {
@Autowired
private SysRegisterService registerService;
@PostMapping("/register")
@OperationLogIgnore
@ApiOperation(value = "注册", notes = "商户注册", response = LoginSysUserTokenVo.class)
public ApiResult<LoginSysUserTokenVo> register(@Validated @RequestBody RegisterParam registerParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception {
return registerService.register(registerParam, response, language);
}
}
...@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/merchantRole") @RequestMapping("/merchant/role")
@Module("${cfg.module}") @Module("${cfg.module}")
@Api(value = "商家角色API", tags = {"商家角色"}) @Api(value = "商家角色API", tags = {"商家角色"})
public class MerchantRoleController extends BaseController { public class MerchantRoleController extends BaseController {
......
...@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/merchantRolePermission") @RequestMapping("/merchant/rolePermission")
@Module("${cfg.module}") @Module("${cfg.module}")
@Api(value = "商家角色权限关系API", tags = {"商家角色权限关系"}) @Api(value = "商家角色权限关系API", tags = {"商家角色权限关系"})
public class MerchantRolePermissionController extends BaseController { public class MerchantRolePermissionController extends BaseController {
......
package com.jumeirah.api.merchant.controller; package com.jumeirah.api.merchant.controller;
import com.jumeirah.api.merchant.service.MerchantSmsService; import com.jumeirah.common.service.impl.MerchantSmsService;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController; import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog; import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
...@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
//@Module("api-app") //@Module("api-app")
@Api(value = "短信验证码", tags = {"APP短信验证码相关"}) @Api(value = "短信验证码", tags = {"APP短信验证码相关"})
@RequestMapping("/app/sms/") @RequestMapping("/merchant/sms/")
public class MerchantSmsController extends BaseController { public class MerchantSmsController extends BaseController {
@Autowired @Autowired
......
...@@ -2,9 +2,11 @@ package com.jumeirah.api.merchant.controller; ...@@ -2,9 +2,11 @@ package com.jumeirah.api.merchant.controller;
import com.jumeirah.common.entity.MerchantUser; import com.jumeirah.common.entity.MerchantUser;
import com.jumeirah.common.param.LoginParam; import com.jumeirah.common.param.LoginParam;
import com.jumeirah.common.param.MerchantRegisterParam;
import com.jumeirah.common.param.MerchantUserPageParam; import com.jumeirah.common.param.MerchantUserPageParam;
import com.jumeirah.common.service.MerchantService;
import com.jumeirah.common.service.MerchantUserService; import com.jumeirah.common.service.MerchantUserService;
import com.jumeirah.common.vo.LoginSysUserTokenVo; import com.jumeirah.common.vo.LoginMerUserTokenVo;
import com.jumeirah.common.vo.MerchantUserQueryVo; import com.jumeirah.common.vo.MerchantUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController; import io.geekidea.springbootplus.framework.common.controller.BaseController;
...@@ -31,71 +33,73 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -31,71 +33,73 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
* 商家 控制器 * 商家用户 控制器
* *
* @author wei * @author wei
* @since 2020-09-27 * @since 2020-09-27
*/ */
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/merchantUser") @RequestMapping("/merchant/user")
@Module("${cfg.module}") @Module("${cfg.module}")
@Api(value = "商家API", tags = {"商家"}) @Api(value = "商家用户API", tags = {"商家用户表"})
public class MerchantUserController extends BaseController { public class MerchantUserController extends BaseController {
@Autowired @Autowired
private MerchantUserService merchantUserService; private MerchantUserService merchantUserService;
@Autowired
private MerchantService merchantService;
/** /**
* 添加商家 * 添加商家用户
*/ */
@PostMapping("/add") @PostMapping("/add")
@OperationLog(name = "添加商家", type = OperationLogType.ADD) @OperationLog(name = "添加商家用户", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家", response = ApiResult.class) @ApiOperation(value = "添加商家用户", response = ApiResult.class)
public ApiResult<Boolean> addMerchantUser(@Validated(Add.class) @RequestBody MerchantUser merchantUser) throws Exception { public ApiResult<Boolean> addMerchantUser(@Validated(Add.class) @RequestBody MerchantUser merchantUser) throws Exception {
boolean flag = merchantUserService.saveMerchantUser(merchantUser); boolean flag = merchantUserService.saveMerchantUser(merchantUser);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
/** /**
* 修改商家 * 修改商家用户
*/ */
@PostMapping("/update") @PostMapping("/update")
@OperationLog(name = "修改商家", type = OperationLogType.UPDATE) @OperationLog(name = "修改商家用户", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家", response = ApiResult.class) @ApiOperation(value = "修改商家用户", response = ApiResult.class)
public ApiResult<Boolean> updateMerchantUser(@Validated(Update.class) @RequestBody MerchantUser merchantUser) throws Exception { public ApiResult<Boolean> updateMerchantUser(@Validated(Update.class) @RequestBody MerchantUser merchantUser) throws Exception {
boolean flag = merchantUserService.updateMerchantUser(merchantUser); boolean flag = merchantUserService.updateMerchantUser(merchantUser);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
/** /**
* 删除商家 * 删除商家用户
*/ */
@PostMapping("/delete/{id}") @PostMapping("/delete/{id}")
@OperationLog(name = "删除商家", type = OperationLogType.DELETE) @OperationLog(name = "删除商家用户", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家", response = ApiResult.class) @ApiOperation(value = "删除商家用户", response = ApiResult.class)
public ApiResult<Boolean> deleteMerchantUser(@PathVariable("id") Long id) throws Exception { public ApiResult<Boolean> deleteMerchantUser(@PathVariable("id") Long id) throws Exception {
boolean flag = merchantUserService.deleteMerchantUser(id); boolean flag = merchantUserService.deleteMerchantUser(id);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
/** /**
* 获取商家详情 * 获取商家用户详情
*/ */
@GetMapping("/info/{id}") @GetMapping("/info/{id}")
@OperationLog(name = "商家详情", type = OperationLogType.INFO) @OperationLog(name = "商家用户详情", type = OperationLogType.INFO)
@ApiOperation(value = "商家详情", response = MerchantUserQueryVo.class) @ApiOperation(value = "商家用户详情", response = MerchantUserQueryVo.class)
public ApiResult<MerchantUserQueryVo> getMerchantUser(@PathVariable("id") Long id) throws Exception { public ApiResult<MerchantUserQueryVo> getMerchantUser(@PathVariable("id") Long id) throws Exception {
MerchantUserQueryVo merchantUserQueryVo = merchantUserService.getMerchantUserById(id); MerchantUserQueryVo merchantUserQueryVo = merchantUserService.getMerchantUserById(id);
return ApiResult.ok(merchantUserQueryVo); return ApiResult.ok(merchantUserQueryVo);
} }
/** /**
* 商家分页列表 * 商家用户分页列表
*/ */
@PostMapping("/getPageList") @PostMapping("/getPageList")
@OperationLog(name = "商家分页列表", type = OperationLogType.PAGE) @OperationLog(name = "商家用户分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家分页列表", response = MerchantUserQueryVo.class) @ApiOperation(value = "商家用户分页列表", response = MerchantUserQueryVo.class)
public ApiResult<Paging<MerchantUserQueryVo>> getMerchantUserPageList(@Validated @RequestBody MerchantUserPageParam merchantUserPageParam) throws Exception { public ApiResult<Paging<MerchantUserQueryVo>> getMerchantUserPageList(@Validated @RequestBody MerchantUserPageParam merchantUserPageParam) throws Exception {
Paging<MerchantUserQueryVo> paging = merchantUserService.getMerchantUserPageList(merchantUserPageParam); Paging<MerchantUserQueryVo> paging = merchantUserService.getMerchantUserPageList(merchantUserPageParam);
return ApiResult.ok(paging); return ApiResult.ok(paging);
...@@ -103,17 +107,16 @@ public class MerchantUserController extends BaseController { ...@@ -103,17 +107,16 @@ public class MerchantUserController extends BaseController {
@PostMapping("/login") @PostMapping("/login")
@OperationLogIgnore @OperationLogIgnore
@ApiOperation(value = "登录", notes = "商家登录", response = LoginSysUserTokenVo.class) @ApiOperation(value = "登录", notes = "商家用户登录")
public ApiResult<LoginSysUserTokenVo> login(@Validated @RequestBody LoginParam loginParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception { public ApiResult<LoginMerUserTokenVo> login(@Validated @RequestBody LoginParam loginParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception {
return merchantUserService.login(loginParam, response, language); return merchantUserService.login(loginParam, response, language);
} }
@PostMapping("/register") @PostMapping("/register")
@OperationLogIgnore @OperationLogIgnore
@ApiOperation(value = "注册", notes = "商家注册", response = LoginSysUserTokenVo.class) @ApiOperation(value = "注册", notes = "商家注册")
public ApiResult<LoginSysUserTokenVo> register(@Validated @RequestBody LoginParam loginParam, HttpServletResponse response, @RequestHeader(required = false) String language) throws Exception { public ApiResult<Boolean> register(@Validated @RequestBody MerchantRegisterParam merchantRegisterParam, HttpServletResponse response) throws Exception {
return merchantUserService.login(loginParam, response, language); return merchantUserService.register(merchantRegisterParam);
} }
} }
...@@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/sys/merchant") @RequestMapping("/sys/merchant")
@Api(value = "航空公司商家表API", tags = {"航空公司商家表"}) @Api(value = "航空公司商家表API", tags = {"航空公司商家表"})
public class MerchantController extends BaseController { public class MerchantForSysController extends BaseController {
@Autowired @Autowired
private MerchantService merchantService; private MerchantService merchantService;
......
...@@ -29,9 +29,9 @@ import org.mapstruct.factory.Mappers; ...@@ -29,9 +29,9 @@ import org.mapstruct.factory.Mappers;
* @date 2019-10-05 * @date 2019-10-05
**/ **/
@Mapper @Mapper
public interface SysUserConvert { public interface UserConvert {
SysUserConvert INSTANCE = Mappers.getMapper(SysUserConvert.class); UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
/** /**
* 系统用户实体对象转换成登录用户VO对象 * 系统用户实体对象转换成登录用户VO对象
......
...@@ -18,7 +18,7 @@ import java.util.Date; ...@@ -18,7 +18,7 @@ import java.util.Date;
* 航空公司商家表 * 航空公司商家表
* *
* @author giao * @author giao
* @since 2020-10-13 * @since 2020-10-16
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
...@@ -72,6 +72,14 @@ public class Merchant extends BaseEntity { ...@@ -72,6 +72,14 @@ public class Merchant extends BaseEntity {
@ApiModelProperty("在列表展示的图片url") @ApiModelProperty("在列表展示的图片url")
private String imageListUrl; private String imageListUrl;
@NotNull(message = "在列表展示的图片高度不能为空")
@ApiModelProperty("在列表展示的图片高度")
private Long imageListHeight;
@NotNull(message = "在列表展示的图片宽度不能为空")
@ApiModelProperty("在列表展示的图片宽度")
private Long imageListWidth;
@ApiModelProperty("公司介绍图片url") @ApiModelProperty("公司介绍图片url")
private String imageCompanyIntroductionUrl; private String imageCompanyIntroductionUrl;
...@@ -93,9 +101,16 @@ public class Merchant extends BaseEntity { ...@@ -93,9 +101,16 @@ public class Merchant extends BaseEntity {
@ApiModelProperty("航空公司名称") @ApiModelProperty("航空公司名称")
private String airlineName; private String airlineName;
@ApiModelProperty("列表图片高") @ApiModelProperty("公司所在地址")
private Long imageListHeight; private String location;
@ApiModelProperty("列表图片宽")
private Long imageListWidth; @ApiModelProperty("邮箱")
private String email;
@ApiModelProperty("营业执照图片url")
private String imageBusinessLicenseUrl;
@ApiModelProperty("审核注册状态 0未审核,1审核成功")
private Integer auditRegisterStatus;
} }
...@@ -15,7 +15,7 @@ import java.io.Serializable; ...@@ -15,7 +15,7 @@ import java.io.Serializable;
* 航空公司商家表 Mapper 接口 * 航空公司商家表 Mapper 接口
* *
* @author giao * @author giao
* @since 2020-10-13 * @since 2020-10-16
*/ */
@Repository @Repository
public interface MerchantMapper extends BaseMapper<Merchant> { public interface MerchantMapper extends BaseMapper<Merchant> {
......
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.common.param;
import io.geekidea.springbootplus.framework.shiro.service.LoginUsername;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 登录参数
*
* @author geekidea
* @date 2019-05-15
**/
@Data
@ApiModel("登录参数")
public class MerLoginParam implements LoginUsername {
private static final long serialVersionUID = 2854217576695117356L;
@NotBlank(message = "请输入账号")
@ApiModelProperty(value = "账号", example = "admin")
private String username;
@NotBlank(message = "请输入密码")
@ApiModelProperty(value = "密码", example = "123456")
private String password;
// @ApiModelProperty("验证码")
// private String code;
}
...@@ -12,12 +12,12 @@ import lombok.experimental.Accessors; ...@@ -12,12 +12,12 @@ import lombok.experimental.Accessors;
* </pre> * </pre>
* *
* @author giao * @author giao
* @date 2020-10-13 * @date 2020-10-16
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "商家表分页参数") @ApiModel(value = "航空公司商家表分页参数")
public class MerchantPageParam extends BasePageOrderParam { public class MerchantPageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.common.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 注册参数
*
* @author geekidea
* @date 2019-05-15
**/
@Data
@ApiModel("注册参数")
public class MerchantRegisterParam implements Serializable {
private static final long serialVersionUID = 2854217576695117357L;
@NotBlank(message = "请输入密码")
@ApiModelProperty(value = "密码", example = "123456")
private String password;
@NotBlank(message = "参数不能为空")
@ApiModelProperty("验证码")
private String smsCode;
@ApiModelProperty("商家名称")
@NotBlank(message = "参数不能为空")
private String name;
@ApiModelProperty("联系人手机号码")
@NotBlank(message = "请输入手机号")
private String phone;
@ApiModelProperty("联系人手机区号")
private String phoneArea;
@ApiModelProperty("公司所在地址")
private String location;
@ApiModelProperty("邮箱")
private String email;
@ApiModelProperty("营业执照图片url, 为多张可以传入数组")
private String imageBusinessLicenseUrl;
}
...@@ -10,7 +10,7 @@ import io.geekidea.springbootplus.framework.core.pagination.Paging; ...@@ -10,7 +10,7 @@ import io.geekidea.springbootplus.framework.core.pagination.Paging;
* 航空公司商家表 服务类 * 航空公司商家表 服务类
* *
* @author giao * @author giao
* @since 2020-10-13 * @since 2020-10-16
*/ */
public interface MerchantService extends BaseService<Merchant> { public interface MerchantService extends BaseService<Merchant> {
......
...@@ -2,8 +2,9 @@ package com.jumeirah.common.service; ...@@ -2,8 +2,9 @@ package com.jumeirah.common.service;
import com.jumeirah.common.entity.MerchantUser; import com.jumeirah.common.entity.MerchantUser;
import com.jumeirah.common.param.LoginParam; import com.jumeirah.common.param.LoginParam;
import com.jumeirah.common.param.MerchantRegisterParam;
import com.jumeirah.common.param.MerchantUserPageParam; import com.jumeirah.common.param.MerchantUserPageParam;
import com.jumeirah.common.vo.LoginSysUserTokenVo; import com.jumeirah.common.vo.LoginMerUserTokenVo;
import com.jumeirah.common.vo.MerchantUserQueryVo; import com.jumeirah.common.vo.MerchantUserQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.BaseService; import io.geekidea.springbootplus.framework.common.service.BaseService;
...@@ -36,7 +37,10 @@ public interface MerchantUserService extends BaseService<MerchantUser> { ...@@ -36,7 +37,10 @@ public interface MerchantUserService extends BaseService<MerchantUser> {
* @return * @return
* @throws Exception * @throws Exception
*/ */
ApiResult<LoginSysUserTokenVo> login(LoginParam loginParam, HttpServletResponse response, String language) throws Exception; ApiResult<LoginMerUserTokenVo> login(LoginParam loginParam, HttpServletResponse response, String language) throws Exception;
ApiResult<Boolean> register(MerchantRegisterParam merchantRegisterParam) throws Exception;
/** /**
......
...@@ -20,7 +20,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -20,7 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
* 航空公司商家表 服务实现类 * 航空公司商家表 服务实现类
* *
* @author giao * @author giao
* @since 2020-10-13 * @since 2020-10-16
*/ */
@Slf4j @Slf4j
@Service @Service
......
package com.jumeirah.api.merchant.service; package com.jumeirah.common.service.impl;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
......
package com.jumeirah.api.merchant.service; package com.jumeirah.common.service.impl;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import io.geekidea.springbootplus.framework.common.api.ApiResult; import io.geekidea.springbootplus.framework.common.api.ApiResult;
......
...@@ -4,17 +4,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,17 +4,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumeirah.common.convert.SysUserConvert; import com.jumeirah.common.convert.UserConvert;
import com.jumeirah.common.entity.Merchant;
import com.jumeirah.common.entity.MerchantRole; import com.jumeirah.common.entity.MerchantRole;
import com.jumeirah.common.entity.MerchantUser; import com.jumeirah.common.entity.MerchantUser;
import com.jumeirah.common.enums.StateEnum; import com.jumeirah.common.enums.StateEnum;
import com.jumeirah.common.mapper.MerchantUserMapper; import com.jumeirah.common.mapper.MerchantUserMapper;
import com.jumeirah.common.param.LoginParam; import com.jumeirah.common.param.LoginParam;
import com.jumeirah.common.param.MerchantRegisterParam;
import com.jumeirah.common.param.MerchantUserPageParam; import com.jumeirah.common.param.MerchantUserPageParam;
import com.jumeirah.common.service.MerchantRolePermissionService; import com.jumeirah.common.service.MerchantRolePermissionService;
import com.jumeirah.common.service.MerchantRoleService; import com.jumeirah.common.service.MerchantRoleService;
import com.jumeirah.common.service.MerchantService;
import com.jumeirah.common.service.MerchantUserService; import com.jumeirah.common.service.MerchantUserService;
import com.jumeirah.common.vo.LoginSysUserTokenVo; import com.jumeirah.common.vo.LoginMerUserTokenVo;
import com.jumeirah.common.vo.MerchantUserQueryVo; import com.jumeirah.common.vo.MerchantUserQueryVo;
import io.geekidea.springbootplus.config.properties.JwtProperties; import io.geekidea.springbootplus.config.properties.JwtProperties;
import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties; import io.geekidea.springbootplus.config.properties.SpringBootPlusProperties;
...@@ -35,6 +38,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -35,6 +38,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -77,6 +81,12 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper, ...@@ -77,6 +81,12 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
private MerchantRoleService merchantRoleService; private MerchantRoleService merchantRoleService;
@Autowired @Autowired
private MerchantService merchantService;
@Autowired
private MerchantSmsService merchantSmsService;
@Autowired
private MerchantRolePermissionService merchantRolePermissionService; private MerchantRolePermissionService merchantRolePermissionService;
public MerchantUser getSysUserByUsername(String username) throws Exception { public MerchantUser getSysUserByUsername(String username) throws Exception {
...@@ -87,7 +97,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper, ...@@ -87,7 +97,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public ApiResult<LoginSysUserTokenVo> login(LoginParam loginParam, HttpServletResponse response, String language) throws Exception { public ApiResult<LoginMerUserTokenVo> login(LoginParam loginParam, HttpServletResponse response, String language) throws Exception {
// // 校验验证码 // // 校验验证码
// checkVerifyCode(loginParam.getVerifyToken(), loginParam.getCode()); // checkVerifyCode(loginParam.getVerifyToken(), loginParam.getCode());
...@@ -115,7 +125,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper, ...@@ -115,7 +125,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
} }
// 将系统用户对象转换成登录用户对象 // 将系统用户对象转换成登录用户对象
LoginUserVo loginSysUserVo = SysUserConvert.INSTANCE.merchantUserToLoginSysUserVo(merchantUser); LoginUserVo loginSysUserVo = UserConvert.INSTANCE.merchantUserToLoginSysUserVo(merchantUser);
// // 获取部门 // // 获取部门
// SysDepartment sysDepartment = sysDepartmentService.getById(merchantUser.getDepartmentId()); // SysDepartment sysDepartment = sysDepartmentService.getById(merchantUser.getDepartmentId());
...@@ -178,7 +188,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper, ...@@ -178,7 +188,7 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
redisTemplate.opsForValue().set(tokenSha256, loginSysUserVo, 1, TimeUnit.DAYS);*/ redisTemplate.opsForValue().set(tokenSha256, loginSysUserVo, 1, TimeUnit.DAYS);*/
// 返回token和登录用户信息对象 // 返回token和登录用户信息对象
LoginSysUserTokenVo loginSysUserTokenVo = new LoginSysUserTokenVo(); LoginMerUserTokenVo loginSysUserTokenVo = new LoginMerUserTokenVo();
loginSysUserTokenVo.setToken(token); loginSysUserTokenVo.setToken(token);
loginSysUserTokenVo.setLoginSysUserVo(loginSysUserVo); loginSysUserTokenVo.setLoginSysUserVo(loginSysUserVo);
...@@ -188,6 +198,38 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper, ...@@ -188,6 +198,38 @@ public class MerchantUserServiceImpl extends BaseServiceImpl<MerchantUserMapper,
return ApiResult.ok(loginSysUserTokenVo); return ApiResult.ok(loginSysUserTokenVo);
} }
@Override
public ApiResult<Boolean> register(MerchantRegisterParam merchantRegisterPram) throws Exception {
// 校验验证码
boolean equalsRegisterCode = merchantSmsService.equalsRegisterCode(merchantRegisterPram.getPhoneArea(), merchantRegisterPram.getPhone(), merchantRegisterPram.getSmsCode());
if (!equalsRegisterCode) {
return ApiResult.fail(ApiCode.SMS_CODE_ERROR);
}
// 删除已使用的验证码
merchantSmsService.deleteRegisterCode(merchantRegisterPram.getPhoneArea(), merchantRegisterPram.getPhone());
// 判断是否已经注册
// if (appUserService.hasUserByPhoneNumer(loginParam.getPhoneArea(), loginParam.getPhone())) {
// // 如果已经注册直接走登陆的代码
// return appUserService.login(loginParam, language, true);
// }
// 没注册则先保存到数据库
Merchant merchant = new Merchant();
BeanUtils.copyProperties(merchantRegisterPram, merchant);
merchant.setAuditRegisterStatus(0);
merchant.setState(1);
boolean isDbOk = merchantService.saveMerchant(merchant);
if (!isDbOk) {
return ApiResult.fail(ApiCode.SPRING_BOOT_PLUS_EXCEPTION);
}
// 创建一个该公司默认的管理员账号
return ApiResult.ok();
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package com.jumeirah.common.service.impl; package com.jumeirah.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jumeirah.common.convert.SysUserConvert; import com.jumeirah.common.convert.UserConvert;
import com.jumeirah.common.entity.SysDepartment; import com.jumeirah.common.entity.SysDepartment;
import com.jumeirah.common.entity.SysRole; import com.jumeirah.common.entity.SysRole;
import com.jumeirah.common.entity.SysUser; import com.jumeirah.common.entity.SysUser;
...@@ -120,7 +120,7 @@ public class SysLoginServiceImpl implements SysLoginService { ...@@ -120,7 +120,7 @@ public class SysLoginServiceImpl implements SysLoginService {
} }
// 将系统用户对象转换成登录用户对象 // 将系统用户对象转换成登录用户对象
LoginUserVo loginSysUserVo = SysUserConvert.INSTANCE.sysUserToLoginSysUserVo(sysUser); LoginUserVo loginSysUserVo = UserConvert.INSTANCE.sysUserToLoginSysUserVo(sysUser);
// 获取部门 // 获取部门
SysDepartment sysDepartment = sysDepartmentService.getById(sysUser.getDepartmentId()); SysDepartment sysDepartment = sysDepartmentService.getById(sysUser.getDepartmentId());
......
/*
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jumeirah.common.vo;
import io.geekidea.springbootplus.framework.shiro.service.LoginToken;
import io.geekidea.springbootplus.framework.shiro.vo.LoginUserVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author geekidea
* @date 2019-10-26
**/
@Data
@Accessors(chain = true)
@ApiModel("登录用户信息TokenVO")
public class LoginMerUserTokenVo implements LoginToken {
private static final long serialVersionUID = -2138450422989081056L;
@ApiModelProperty("token")
private String token;
/**
* 登录用户对象
*/
private LoginUserVo loginSysUserVo;
}
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
from business_plain bp from business_plain bp
INNER JOIN merchant m ON bp.mc_id=m.id INNER JOIN merchant m ON bp.mc_id=m.id
where bp.business_type=#{param.type} where bp.business_type=#{param.type}
AND m.state=1 and m.audit_register_status=1
</select> </select>
</mapper> </mapper>
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
from charter_introduction ci from charter_introduction ci
INNER JOIN merchant m ON ci.mc_id=m.id INNER JOIN merchant m ON ci.mc_id=m.id
where ci.type = #{param.type} where ci.type = #{param.type}
AND m.state=1 and m.audit_register_status=1
</select> </select>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, name, phone, phone_area, head, remark, state, deleted, create_time, update_time, recharge_bank, recharge_name, recharge_bank_number, image_list_url, image_company_introduction_url, image_team_introduction_url, image_advantage_url, text_company_introduction, text_team_introduction, text_advantage, airline_name,image_list_height,image_list_width id, name, phone, phone_area, head, remark, state, deleted, create_time, update_time, recharge_bank, recharge_name, recharge_bank_number, image_list_url, image_list_height, image_list_width, image_company_introduction_url, image_team_introduction_url, image_advantage_url, text_company_introduction, text_team_introduction, text_advantage, airline_name, location, email, image_business_license_url, audit_register_status
</sql> </sql>
<select id="getMerchantById" resultType="com.jumeirah.common.vo.MerchantQueryVo"> <select id="getMerchantById" resultType="com.jumeirah.common.vo.MerchantQueryVo">
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from merchant from merchant
<where>
state=1 and audit_register_status=1
</where>
</select> </select>
</mapper> </mapper>
...@@ -2,7 +2,7 @@ spring-boot-plus: ...@@ -2,7 +2,7 @@ spring-boot-plus:
# 是否启用ansi控制台输出有颜色的字体,local环境建议开启,服务器环境设置为false # 是否启用ansi控制台输出有颜色的字体,local环境建议开启,服务器环境设置为false
enable-ansi: false enable-ansi: false
# 当前环境服务IP地址 # 当前环境服务IP地址
server-ip: 47.105.159.10 server-ip: 47.99.47.225
# 文件上传下载配置 # 文件上传下载配置
upload-path: /opt/upload/ upload-path: /opt/upload/
# AOP配置 # AOP配置
...@@ -15,15 +15,15 @@ spring-boot-plus: ...@@ -15,15 +15,15 @@ spring-boot-plus:
spring: spring:
datasource: datasource:
url: jdbc:mysql://mysql57:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://47.99.47.225:3306/Jumeirah?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: 123 password: temple123456
# Redis配置 # Redis配置
redis: redis:
database: 0 database: 0
host: redis6 host: 127.0.0.1
password: password: temple123456
port: 6379 port: 6379
# 打印SQL语句和结果集,本地开发环境可开启,线上注释掉 # 打印SQL语句和结果集,本地开发环境可开启,线上注释掉
......
...@@ -185,8 +185,8 @@ spring-boot-plus: ...@@ -185,8 +185,8 @@ spring-boot-plus:
# 排除登录 注册 登出 # 排除登录 注册 登出
- /app/user/registerOrLogin,/app/user/login - /app/user/registerOrLogin,/app/user/login
- /sys/login,/sys/logout,/sys/register - /sys/login,/sys/logout,/sys/register
- /merchantUser/login - /merchant/user/login,/merchant/user/register
- /app/sms/registerOrLoginCode - /app/sms/registerOrLoginCode,/merchant/sms/registerCode
# 排除静态资源 # 排除静态资源
- /static/**,/templates/** - /static/**,/templates/**
# 排除Swagger # 排除Swagger
...@@ -195,7 +195,7 @@ spring-boot-plus: ...@@ -195,7 +195,7 @@ spring-boot-plus:
# - /actuator/** # - /actuator/**
- # 排除首页 - # 排除首页
- /,/index.html - /,/index.html
- /app/noRole - /app/noRole,/merchant/hello/world
# 航空公司介绍分页列表 # 航空公司介绍分页列表
- /app/airline/getPageList - /app/airline/getPageList
# 公务机出售托管表分页列表 # 公务机出售托管表分页列表
...@@ -280,9 +280,9 @@ spring: ...@@ -280,9 +280,9 @@ spring:
elideSetAutoCommits: true elideSetAutoCommits: true
maintainTimeStats: false maintainTimeStats: false
hikari: hikari:
minimum-idle: 10 minimum-idle: 2
maximum-pool-size: 20 maximum-pool-size: 20
idle-timeout: 10000 idle-timeout: 1000
max-lifetime: 1800000 max-lifetime: 1800000
connection-timeout: 30000 connection-timeout: 30000
############################### HikariCP 数据源配置 end ################################ ############################### HikariCP 数据源配置 end ################################
......
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