Commit 92797cf8 authored by hezhen's avatar hezhen

123

parent 27388812
package com.github.wxiaoqi.security.admin.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/17 20:22
*/
@Data
public class WalletCathSumDto {
//总金额
private BigDecimal sumAmount;
//总次数
private Integer number;
//用户余额
private BigDecimal balance;
//费率
private BigDecimal proceduReates;
//钱包id
private Integer walletId;
}
...@@ -33,7 +33,7 @@ public class MyWalletCath implements Serializable { ...@@ -33,7 +33,7 @@ public class MyWalletCath implements Serializable {
*/ */
@Column(name = "user_id") @Column(name = "user_id")
@ApiModelProperty(value = "用户iD") @ApiModelProperty(value = "用户iD")
private String userId; private Integer userId;
/** /**
* 提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡) * 提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)
...@@ -45,9 +45,9 @@ public class MyWalletCath implements Serializable { ...@@ -45,9 +45,9 @@ public class MyWalletCath implements Serializable {
/** /**
* 商户订单号 * 商户订单号
*/ */
@Column(name = "orderno") @Column(name = "account_number")
@ApiModelProperty(value = "商户订单号") @ApiModelProperty(value = "用户账号")
private String orderno; private String accountNumber;
/** /**
* 第三方订单号:如微信,支付宝,银行卡等 * 第三方订单号:如微信,支付宝,银行卡等
...@@ -55,13 +55,37 @@ public class MyWalletCath implements Serializable { ...@@ -55,13 +55,37 @@ public class MyWalletCath implements Serializable {
@Column(name = "cono") @Column(name = "cono")
@ApiModelProperty(value = "第三方订单号:如微信,支付宝,银行卡等") @ApiModelProperty(value = "第三方订单号:如微信,支付宝,银行卡等")
private String cono; private String cono;
/**
* 提现金额
*/
@Column(name = "balance")
@ApiModelProperty(value = "当前钱包余额")
private BigDecimal balance;
/** /**
* 提现金额 * 提现金额
*/ */
@Column(name = "amount") @Column(name = "amount")
@ApiModelProperty(value = "提现金额") @ApiModelProperty(value = "提现金额")
private BigDecimal amount; private BigDecimal amount;
/**
* 到账金额
*/
@Column(name = "real_amount")
@ApiModelProperty(value = "到账金额")
private BigDecimal realAmount;
/**
* 手续费
*/
@Column(name = "commission")
@ApiModelProperty(value = "手续费")
private BigDecimal commission;
/** /**
* 订单状态:0-未提现,待审核,1-已审核 * 订单状态:0-未提现,待审核,1-已审核
...@@ -87,9 +111,9 @@ public class MyWalletCath implements Serializable { ...@@ -87,9 +111,9 @@ public class MyWalletCath implements Serializable {
/** /**
* 操作者ID * 操作者ID
*/ */
@Column(name = "oper_user") @Column(name = "upd_user")
@ApiModelProperty(value = "操作者ID") @ApiModelProperty(value = "操作者ID")
private String operUser; private String updUser;
} }
package com.github.wxiaoqi.security.admin.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/12 9:20
*/
@Data
public class ApplyCathVo {
/**
* 用户ID
*/
@ApiModelProperty("用户ID")
private Integer userId;
/**
* 提现金额
*/
@ApiModelProperty(value = "提现金额")
private BigDecimal amount;
/**
* 支付密码
*/
@ApiModelProperty(value = "支付密码")
private String password;
/**
* 支付账号
*/
@ApiModelProperty(value = "支付账号")
private String accountNumber;
/**
* 支付类型
*/
@ApiModelProperty(value = "支付类型")
private Integer cathType;
}
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
<artifactId>xx-im-api</artifactId> <artifactId>xx-im-api</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-app-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
<artifactId>xx-activity-api</artifactId> <artifactId>xx-activity-api</artifactId>
......
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.entity.AppUserAlipay;
import com.github.wxiaoqi.security.admin.entity.AppUserRelationTemp;
import com.github.wxiaoqi.security.admin.mapper.AppUserAlipayMapper;
import com.github.wxiaoqi.security.admin.mapper.AppUserRelationTempMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* 支付宝账号表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-07-03 16:36:44
*/
@Service
public class AppUserAlipayBiz extends BaseBiz<AppUserAlipayMapper, AppUserAlipay> {
//添加支付宝账号
public void addAlipay(Integer userId,String txAlipay){
AppUserAlipay appUserAlipay=new AppUserAlipay();
appUserAlipay.setTxAlipay(txAlipay);
appUserAlipay.setUserId(userId);
appUserAlipay.setIsDel(0);
AppUserAlipay appUserAlipay1=selectOne(appUserAlipay);
if (appUserAlipay1==null){
appUserAlipay.setIsDefault(1);
insertSelective(appUserAlipay);
}else {
appUserAlipay1.setIsDefault(1);
updateSelectiveById(appUserAlipay1);
}
}
//获取支付宝列表
public List<AppUserAlipay> getListByUserId(Integer userId){
Example example=new Example(AppUserAlipay.class);
example.createCriteria().andEqualTo("userId",userId).andEqualTo("isDel",0);
example.setOrderByClause("is_default desc");
return selectByExample(example);
}
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.biz; ...@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO; import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO; import com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO; import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathSumDto;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath; import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
import com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper; import com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper;
import com.github.wxiaoqi.security.admin.vo.WalletCathAdminVo; import com.github.wxiaoqi.security.admin.vo.WalletCathAdminVo;
...@@ -120,4 +121,8 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> { ...@@ -120,4 +121,8 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
Map<Integer, BigDecimal> userIdAndPersonalConsumptionMap = personalConsumptions.stream().collect(Collectors.toMap(PersonalConsumptionDTO::getUserId, PersonalConsumptionDTO::getTotalConsumption)); Map<Integer, BigDecimal> userIdAndPersonalConsumptionMap = personalConsumptions.stream().collect(Collectors.toMap(PersonalConsumptionDTO::getUserId, PersonalConsumptionDTO::getTotalConsumption));
return userIdAndPersonalConsumptionMap; return userIdAndPersonalConsumptionMap;
} }
public WalletCathSumDto sumCathAmount(Integer type){
return mapper.sumCathAmount(type);
}
} }
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.AppUserAlipay;
import tk.mybatis.mapper.common.Mapper;
/**
* 钱包提现表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
public interface AppUserAlipayMapper extends Mapper<AppUserAlipay> {
}
...@@ -2,10 +2,10 @@ package com.github.wxiaoqi.security.admin.mapper; ...@@ -2,10 +2,10 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO; import com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO; import com.github.wxiaoqi.security.admin.dto.WalletCathListDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathSumDto;
import com.github.wxiaoqi.security.admin.entity.MyWalletCath; import com.github.wxiaoqi.security.admin.entity.MyWalletCath;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
/** /**
...@@ -22,4 +22,12 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> { ...@@ -22,4 +22,12 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> {
@Param("state") Integer state); @Param("state") Integer state);
List<PersonalConsumptionDTO> findUserWithDrawingByUserIds(@Param("userIds") List<Integer> userIds); List<PersonalConsumptionDTO> findUserWithDrawingByUserIds(@Param("userIds") List<Integer> userIds);
/**
* 计算提现的金额
* @param type 1-日;2-月
* @return
*/
WalletCathSumDto sumCathAmount(@Param("type") int type);
} }
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.AppUserAlipayBiz;
import com.github.wxiaoqi.security.admin.biz.MyWalletBiz; import com.github.wxiaoqi.security.admin.biz.MyWalletBiz;
import com.github.wxiaoqi.security.admin.vo.AppletWalletVo; import com.github.wxiaoqi.security.admin.vo.AppletWalletVo;
import com.github.wxiaoqi.security.admin.vo.ApplyCathVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig; import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil; import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo; import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
/** /**
* @author libin * @author libin
...@@ -34,6 +35,10 @@ public class MyWalletController { ...@@ -34,6 +35,10 @@ public class MyWalletController {
@Autowired @Autowired
private MyWalletBiz myWalletBiz; private MyWalletBiz myWalletBiz;
@Autowired
private AppUserAlipayBiz alipayBiz;
@GetMapping @GetMapping
public ObjectRestResponse<AppletWalletVo> findMyWallet(HttpServletRequest request){ public ObjectRestResponse<AppletWalletVo> findMyWallet(HttpServletRequest request){
try { try {
...@@ -46,4 +51,96 @@ public class MyWalletController { ...@@ -46,4 +51,96 @@ public class MyWalletController {
} }
@GetMapping
@ApiOperation("检查验证码")
public ObjectRestResponse checkCode(
@RequestParam(value = "phone",defaultValue = "")String phone,
@RequestParam(value = "mobilecode",defaultValue = "")String mobilecod
){
return myWalletBiz.checkCode(phone,mobilecod);
}
@PostMapping("/setPwd")
@ApiOperation("设置密码")
public ObjectRestResponse setPwd(
@RequestParam(value = "phone",defaultValue = "")String phone,
@RequestParam(value = "mobilecode",defaultValue = "")String mobilecod,
@RequestParam(value = "password",defaultValue = "")String password,
@RequestParam(value = "type",defaultValue = "1")Integer type,
HttpServletRequest request){
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.setPwd(userId,phone,mobilecod,password,type);
}catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/checkSetPwd")
@ApiOperation("检查用户是否设置过支付密码")
public ObjectRestResponse checkSetPwd(HttpServletRequest request){
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkSetPwd(userId);
}catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/checkAmount")
@ApiOperation("检查提成下一步操作")
public ObjectRestResponse checkAmount(
@RequestParam(value = "amount",defaultValue = "0.00") BigDecimal amount,
HttpServletRequest request){
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.checkAmount(userId,amount,null);
}catch (Exception e) {
throw new BaseException(e);
}
}
@PostMapping("/applyCath")
@ApiOperation("提现申请")
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo, HttpServletRequest request){
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return myWalletBiz.applyCath(applyCathVo);
}catch (Exception e) {
throw new BaseException(e);
}
}
@PostMapping("/verifyCath")
@ApiOperation("提现审核")
public ObjectRestResponse verifyCath(
@RequestParam(value = "cathId",defaultValue = "0") Integer cathId,
@RequestParam(value = "cono",defaultValue = "") String cono){
try {
return myWalletBiz.verifyCath(cathId,cono);
}catch (Exception e) {
throw new BaseException(e);
}
}
@GetMapping("/txAlipayList")
@ApiOperation("获取支付账号列表")
public ObjectRestResponse txAlipayList(HttpServletRequest request){
try {
Integer userId=Integer.parseInt(userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId());
return ObjectRestResponse.succ(alipayBiz.getListByUserId(userId)) ;
}catch (Exception e) {
throw new BaseException(e);
}
}
} }
...@@ -205,6 +205,23 @@ public class AppPermissionService { ...@@ -205,6 +205,23 @@ public class AppPermissionService {
return JsonResultUtil.createSuccessResultWithObj(result); return JsonResultUtil.createSuccessResultWithObj(result);
} }
//检查验证码是否正确
public String checkCodeByUsername(String username,String mobilecode){
// 判断参数和验证码
if (StringUtils.isBlank(username) || StringUtils.isBlank(mobilecode)) {
log.info("---参数为空------");
return null;
}
String redisLockKey = RedisKey.CONSTANT_CODE_PREFIX + username + mobilecode;
String mobilecodeRedis = userRedisTemplate.opsForValue().get(redisLockKey) == null ? "" : userRedisTemplate.opsForValue().get(redisLockKey).toString();
log.error("checkCodeByUsername接口,获取redis中的验证码:" + mobilecodeRedis);
if (StringUtils.isBlank(mobilecodeRedis)) {
log.info("---验证码错误------username==="+username);
return null;
}
return redisLockKey;
}
/** /**
* 注册用户 * 注册用户
* *
......
...@@ -34,4 +34,21 @@ ...@@ -34,4 +34,21 @@
</foreach> </foreach>
GROUP BY `user_id` GROUP BY `user_id`
</select> </select>
<select id="sumCathAmount" resultType="com.github.wxiaoqi.security.admin.dto.WalletCathSumDto">
select IFNULL(SUM(amount),0) as sumAmount,COUNT(*) as `number` from my_wallet_cath
<where>
<choose>
<when test="type ==1 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</when >
<when test="type==2 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m') = date_format(now(),'%Y-%m')
</when >
<otherwise>
</otherwise>
</choose>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
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