Browse Source

Merge branch 'dev' of http://gogs.gzzzyd.com/pangqijun/vending-machine-api into dev

LuoDLeo 3 months ago
parent
commit
43189549a6

+ 1 - 1
src/main/java/org/springblade/modules/api/controller/ApiMerchantUserController.java

@@ -40,7 +40,7 @@ public class ApiMerchantUserController {
         Assert.notNull(user, "未查询到用户信息");
         UserMerchantVO vo = iUserMerchantService.getByUserId(user.getId());
         vo.setAvatar(user.getAvatar());
-        vo.setMerchantName(user.getName());
+        vo.setName(user.getName());
         vo.setRealName(vo.getRealName());
         vo.setPhone(user.getPhone());
         return R.data(vo);

+ 15 - 5
src/main/java/org/springblade/modules/api/controller/LoginController.java

@@ -28,6 +28,7 @@ import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
 import org.springblade.common.cache.ParamCache;
 import org.springblade.common.constant.CommonConstant;
+import org.springblade.common.enums.AuditStatusEnum;
 import org.springblade.common.enums.ResultCode;
 import org.springblade.common.utils.CommonUtil;
 import org.springblade.core.boot.ctrl.BladeController;
@@ -63,6 +64,7 @@ import org.springblade.modules.system.entity.UserMerchant;
 import org.springblade.modules.system.service.IUserMerchantService;
 import org.springblade.modules.system.service.IUserService;
 import org.springblade.modules.system.service.IUserWeChatService;
+import org.springblade.modules.system.vo.UserMerchantVO;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -221,6 +223,12 @@ public class LoginController extends BladeController {
 			userWeChatService.saveUserInfo(userInfo, code);
 		}
 		User user = userService.getById(userInfo.getUser().getId());
+		if (UserEnum.MERCHANT.getName().equals(userType)) {
+			UserMerchantVO vo = iUserMerchantService.getByUserId(user.getId());
+			if (AuditStatusEnum.WAIT.getValue().equals(vo.getAuditStatus())) {
+				return R.fail("账号审核中");
+			}
+		}
 		if(ObjectUtil.isNotNull(user.getLogOut()) && user.getLogOut() == 1){
 			return R.fail("用户已注销无法正常使用,如需使用请联系管理员");
 		}
@@ -348,10 +356,10 @@ public class LoginController extends BladeController {
 		if (query1 != null){
 			return R.fail("手机号已注册!");
 		}
-		boolean flg = captchaCode(request.getPhone(), request.getCaptchaId(), request.getCaptchaCode());
-		if (!flg){
-			return R.fail(VALIDATE_FAIL);
-		}
+//		boolean flg = captchaCode(request.getPhone(), request.getCaptchaId(), request.getCaptchaCode());
+//		if (!flg){
+//			return R.fail(VALIDATE_FAIL);
+//		}
 		String tenantId = WebUtil.getRequest().getHeader(TokenUtil.TENANT_HEADER_KEY);
 		User user = new User();
 		user.setAccount(request.getPhone());
@@ -359,16 +367,18 @@ public class LoginController extends BladeController {
 		user.setTenantId(tenantId);
 		user.setUserType(UserEnum.MERCHANT.getCategory());
 		user.setPassword(DigestUtil.encrypt(request.getPassword()));
-		user.setName(request.getMerchantName());
+		user.setName(DesensitizedUtil.mobilePhone(request.getPhone()));
 		user.setRealName(request.getName());
 		userService.save(user);
 
 		UserMerchant userMerchant = new UserMerchant();
+		userMerchant.setMerchantName(request.getMerchantName());
 		userMerchant.setUserId(user.getId());
 		userMerchant.setAddress(request.getAddress());
 		userMerchant.setIdCard(request.getIdCard());
 		userMerchant.setBusinessLicence(request.getBusinessLicence());
 		userMerchant.setParentId(0L);
+		userMerchant.setAuditStatus(AuditStatusEnum.WAIT.getValue());
 		iUserMerchantService.save(userMerchant);
 
 		return R.success("注册成功");

+ 7 - 1
src/main/java/org/springblade/modules/system/controller/UserMerchantController.java

@@ -27,6 +27,8 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.system.entity.User;
+import org.springblade.modules.system.service.IUserService;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -49,6 +51,7 @@ import org.springblade.core.boot.ctrl.BladeController;
 public class UserMerchantController extends BladeController {
 
 	private final IUserMerchantService userMerchantService;
+	private final IUserService iUserService;
 
 	/**
 	 * 详情
@@ -58,7 +61,10 @@ public class UserMerchantController extends BladeController {
 	@ApiOperation(value = "详情", notes = "传入userMerchant")
 	public R<UserMerchantVO> detail(UserMerchant userMerchant) {
 		UserMerchant detail = userMerchantService.getOne(Condition.getQueryWrapper(userMerchant));
-		return R.data(UserMerchantWrapper.build().entityVO(detail));
+		UserMerchantVO userMerchantVO = UserMerchantWrapper.build().entityVO(detail);
+		User user = iUserService.getById(detail.getUserId());
+		userMerchantVO.setPhone(user.getPhone());
+		return R.data(userMerchantVO);
 	}
 
 	/**

+ 20 - 2
src/main/java/org/springblade/modules/system/entity/UserMerchant.java

@@ -35,6 +35,11 @@ public class UserMerchant implements Serializable {
 	*/
 	@ApiModelProperty(value = "用户id")
 	private Long userId;
+	/**
+	 * 商户名称
+	 */
+	@ApiModelProperty(value = "商户名称")
+	private String merchantName;
 	/**
 	* 身份证号
 	*/
@@ -45,6 +50,16 @@ public class UserMerchant implements Serializable {
 	*/
 	@ApiModelProperty(value = "营业执照")
 	private String businessLicence;
+	/**
+	 * 银行卡号
+	 */
+	@ApiModelProperty(name = "银行卡号")
+	private String bankCardNumber;
+	/**
+	 * 开户行
+	 */
+	@ApiModelProperty(name = "开户行")
+	private String openingBank;
 	/**
 	* 地址
 	*/
@@ -60,6 +75,9 @@ public class UserMerchant implements Serializable {
 	*/
 	@ApiModelProperty(value = "授权菜单")
 	private String authMenu;
-
-
+	/**
+	 * 审核状态 1-已审核 0-待审核
+	 */
+	@ApiModelProperty(value = "审核状态 1-审核通过 0-待审核 2-审核拒绝")
+	private Integer auditStatus;
 }

+ 2 - 1
src/main/java/org/springblade/modules/system/mapper/UserMerchantMapper.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.system.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.modules.system.entity.UserMerchant;
 import org.springblade.modules.system.vo.UserMerchantVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -37,6 +38,6 @@ public interface UserMerchantMapper extends BaseMapper<UserMerchant> {
 	 * @param userMerchant
 	 * @return
 	 */
-	List<UserMerchantVO> selectUserMerchantPage(IPage page, UserMerchantVO userMerchant);
+	List<UserMerchantVO> selectUserMerchantPage(IPage page, @Param("p") UserMerchantVO userMerchant);
 
 }

+ 21 - 4
src/main/java/org/springblade/modules/system/mapper/UserMerchantMapper.xml

@@ -5,17 +5,34 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="userMerchantResultMap" type="org.springblade.modules.system.entity.UserMerchant">
         <result column="id" property="id"/>
+        <result column="merchant_name" property="merchantName"/>
         <result column="user_id" property="userId"/>
         <result column="id_card" property="idCard"/>
         <result column="business_licence" property="businessLicence"/>
         <result column="address" property="address"/>
         <result column="parent_id" property="parentId"/>
         <result column="auth_menu" property="authMenu"/>
+        <result column="audit_status" property="auditStatus"/>
     </resultMap>
-
-
-    <select id="selectUserMerchantPage" resultMap="userMerchantResultMap">
-        select * from blade_user_merchant where is_delete = 0
+    <select id="selectUserMerchantPage" resultType="org.springblade.modules.system.vo.UserMerchantVO">
+        SELECT
+            m.*,
+            u.avatar,
+            u.phone,
+            u.real_name,
+            u.`name`,
+            u.account
+        FROM
+            blade_user_merchant m
+                JOIN blade_user u ON m.user_id = u.id
+        WHERE u.is_deleted = 0
+        <if test="@cn.hutool.core.util.StrUtil@isNotBlank(p.merchantName)">
+            AND INSTR( m.merchant_name, #{p.merchantName} ) > 0
+        </if>
+        <if test="p.auditStatus != null">
+            AND m.audit_status = #{p.auditStatus}
+        </if>
     </select>
 
+
 </mapper>

+ 2 - 2
src/main/java/org/springblade/modules/system/vo/UserMerchantVO.java

@@ -34,9 +34,9 @@ public class UserMerchantVO extends UserMerchant {
 	private static final long serialVersionUID = 1L;
 
 	/**
-	 * 商户名
+	 * 
 	 */
-	private String merchantName;
+	private String name;
 	/**
 	 * 姓名
 	 */

+ 5 - 5
src/main/java/sql/usermerchant.menu.mysql

@@ -1,10 +1,10 @@
 INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
-VALUES ('1813060589279272967', 1123598815738675201, 'usermerchant', '商家用户表', 'menu', '/system/usermerchant', NULL, 1, 1, 0, 1, NULL, 0);
+VALUES ('1813206682197561351', 1123598815738675201, 'usermerchant', '商家用户表', 'menu', '/system/usermerchant', NULL, 1, 1, 0, 1, NULL, 0);
 INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
-VALUES ('1813060589279272968', '1813060589279272967', 'usermerchant_add', '新增', 'add', '/system/usermerchant/add', 'plus', 1, 2, 1, 1, NULL, 0);
+VALUES ('1813206682197561352', '1813206682197561351', 'usermerchant_add', '新增', 'add', '/system/usermerchant/add', 'plus', 1, 2, 1, 1, NULL, 0);
 INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
-VALUES ('1813060589279272969', '1813060589279272967', 'usermerchant_edit', '修改', 'edit', '/system/usermerchant/edit', 'form', 2, 2, 2, 1, NULL, 0);
+VALUES ('1813206682197561353', '1813206682197561351', 'usermerchant_edit', '修改', 'edit', '/system/usermerchant/edit', 'form', 2, 2, 2, 1, NULL, 0);
 INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
-VALUES ('1813060589279272970', '1813060589279272967', 'usermerchant_delete', '删除', 'delete', '/api/system/usermerchant/remove', 'delete', 3, 2, 3, 1, NULL, 0);
+VALUES ('1813206682197561354', '1813206682197561351', 'usermerchant_delete', '删除', 'delete', '/api/system/usermerchant/remove', 'delete', 3, 2, 3, 1, NULL, 0);
 INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
-VALUES ('1813060589279272971', '1813060589279272967', 'usermerchant_view', '查看', 'view', '/system/usermerchant/view', 'file-text', 4, 2, 2, 1, NULL, 0);
+VALUES ('1813206682197561355', '1813206682197561351', 'usermerchant_view', '查看', 'view', '/system/usermerchant/view', 'file-text', 4, 2, 2, 1, NULL, 0);

+ 3 - 10
src/main/resources/application-test.yml

@@ -1,20 +1,13 @@
 #数据源配置
 spring:
   redis:
-    ##redis 单机环境配置
-    ##将docker脚本部署的redis服务映射为宿主机ip
-    ##生产环境推荐使用阿里云高可用redis服务并设置密码
     host: 192.168.1.74
     port: 6379
-    password: 123456789
-    database: 8
+    database: 10
     ssl: false
-    ##redis 集群环境配置
-    #cluster:
-    #  nodes: 127.0.0.1:7001,127.0.0.1:7002,127.0.0.1:7003
-    #  commandTimeout: 5000
+    password: 123456789
   datasource:
-    url: jdbc:mysql://192.168.1.74:3306/groupon?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+    url: jdbc:mysql://192.168.1.74:3306/vend?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
     username: root
     password: root_123