hmp 4 年之前
父節點
當前提交
16efe6c116

+ 15 - 0
src/main/java/org/springblade/common/enums/AppConstant.java

@@ -8,6 +8,9 @@ import lombok.Getter;
  */
 public interface AppConstant {
 
+	/**
+	 * socket sid前缀
+	 */
 	@Getter
 	@AllArgsConstructor
 	enum SOCKET_PRE{
@@ -17,6 +20,9 @@ public interface AppConstant {
 		String name;
 	}
 
+	/**
+	 * 平台
+	 */
 	@Getter
 	@AllArgsConstructor
 	enum PLATFORM{
@@ -25,4 +31,13 @@ public interface AppConstant {
 		;
 		String name;
 	}
+
+	/**
+	 * 用户类型
+	 */
+	@Getter
+	enum USER_TYPE{
+		普通用户,渠道代理,城市代理
+	}
+
 }

+ 2 - 1
src/main/java/org/springblade/gateway/client_gateway/controller/ClientUserController.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
+import org.springblade.common.enums.AppConstant;
 import org.springblade.common.enums.ResCode;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.api.R;
@@ -40,7 +41,7 @@ public class ClientUserController {
 		LoginUser user = loginUserService.getOne(new QueryWrapper<LoginUser>().lambda().eq(LoginUser::getOpenid, loginDto.getOpenid()));
 		if(user==null){
 			user = new LoginUser();
-			user.setAgent(0);
+			user.setUserType(AppConstant.USER_TYPE.普通用户.name());
 			user.setAvatar(loginDto.getAvatar());
 			user.setBalance(BigDecimal.ZERO);
 			user.setChannelPoint(BigDecimal.ZERO);

+ 44 - 0
src/main/java/org/springblade/gateway/common_gateway/controller/AppUserBankController.java

@@ -0,0 +1,44 @@
+package org.springblade.gateway.common_gateway.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.gateway.common_gateway.wrapper.AppUserBankWrapper;
+import org.springblade.ldt.user.entity.UserBank;
+import org.springblade.ldt.user.service.IUserBankService;
+import org.springblade.ldt.user.wrapper.UserBankWrapper;
+import org.springblade.modules.system.service.IUserService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * @author cy-computer
+ */
+@RestController
+@RequestMapping("/common/userbank")
+@Api(tags = "用户银行模块")
+public class AppUserBankController {
+
+	@Resource
+	private IUserBankService userBankService;
+	/**
+	 * 小程序银行卡脱敏
+	 * @param userBank
+	 * @param query
+	 * @return
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入userBank")
+	public R appList(UserBank userBank, Query query) {
+		IPage<UserBank> pages = userBankService.page(Condition.getPage(query), Condition.getQueryWrapper(userBank));
+		return R.data(AppUserBankWrapper.build().pageVO(pages));
+	}
+}

+ 49 - 0
src/main/java/org/springblade/gateway/common_gateway/wrapper/AppUserBankWrapper.java

@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.gateway.common_gateway.wrapper;
+
+import cn.hutool.core.util.DesensitizedUtil;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.ldt.user.entity.UserBank;
+import org.springblade.ldt.user.vo.UserBankVO;
+
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2021-08-30
+ */
+public class AppUserBankWrapper extends BaseEntityWrapper<UserBank, UserBankVO>  {
+
+	public static AppUserBankWrapper build() {
+		return new AppUserBankWrapper();
+ 	}
+
+	@Override
+	public UserBankVO entityVO(UserBank userBank) {
+		UserBankVO userBankVO = Objects.requireNonNull(BeanUtil.copy(userBank, UserBankVO.class));
+		if (userBankVO != null) {
+			String bankCard = DesensitizedUtil.bankCard(userBankVO.getCardNo());
+			userBankVO.setCardNo(bankCard);
+		}
+		return userBankVO;
+	}
+
+}

+ 1 - 1
src/main/java/org/springblade/ldt/user/entity/LoginUser.java

@@ -92,7 +92,7 @@ public class LoginUser implements Serializable {
 	* 是否是代理
 	*/
 		@ApiModelProperty(value = "是否是代理")
-		private Integer agent;
+		private String userType;
 
 
 }

+ 1 - 1
src/main/java/org/springblade/ldt/user/mapper/LoginUserMapper.xml

@@ -14,7 +14,7 @@
         <result column="sex" property="sex"/>
         <result column="birth" property="birth"/>
         <result column="total_value" property="totalValue"/>
-        <result column="agent" property="agent"/>
+        <result column="user_type" property="userType"/>
     </resultMap>
 
 

+ 2 - 1
src/main/java/org/springblade/payment/callback/AgentChargeCallback.java

@@ -2,6 +2,7 @@ package org.springblade.payment.callback;
 
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.springblade.common.enums.AppConstant;
 import org.springblade.common.enums.SystemConstant;
 import org.springblade.ldt.agent.entity.AgentRecord;
 import org.springblade.ldt.agent.service.IAgentRecordService;
@@ -68,7 +69,7 @@ public class AgentChargeCallback {
 			agentRecordService.updateById(agentRecord);
 			//更新用户代标识
 			LoginUser user = loginUserService.getById(userId);
-			user.setAgent(1);
+			user.setUserType(AppConstant.USER_TYPE.渠道代理.name());
 			loginUserService.updateById(user);
 		}
 	}

+ 1 - 1
src/main/java/org/springblade/payment/callback/UserPayCallback.java

@@ -63,7 +63,7 @@ public class UserPayCallback {
 
 	@EventListener
 	@Async
-	@Transactional(rollbackFor = Exception.class)
+	@Transactional
 	public void PaySuccess(UserPayEvent userPayEvent) {
 		SuccessParams successParams = userPayEvent.getSuccessParams();
 		PaymentVO paymentVO = PaymentVO.builder().isSuccess(Boolean.FALSE).msg("订单付款异常!").build();