提交 28f5b119 作者: xiaowang

提现流水明细

上级 b928b6d8
package com.mmc.iuav.user.model.vo.wallet;
package com.mmc.iuav.user.model.dto.wallet;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -12,27 +12,23 @@ import java.util.Date;
/**
* @Author LW
* @date 2023/8/24 14:37
* @date 2023/8/26 15:42
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UserBillingDetailVO implements Serializable {
private static final long serialVersionUID = -113701726830167312L;
public class WithdrawalInfoVO implements Serializable {
public final static String AMT = "amt";
public final static String APPLY = "APPLY";
private static final long serialVersionUID = 2535626170303302278L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "用户id")
private Integer userAccountId;
@ApiModelProperty(value = "流水编号")
private String payNo;
@ApiModelProperty(value = "操作方式 100(订单发布) 200(无人接单取消订单)300(有人接单取消订单)400(飞手抢单)500(客服判定飞手无责取消订单)" +
"600(飞手有责取消订单)700(正常结算)800(修改订单金额状态)900(飞手未确认修改金额状态)1000(飞手确认修改金额状态)1100(充值) 1200(提现)")
@ApiModelProperty(value = "操作方式")
private Integer payMethod;
@ApiModelProperty(value = "云享金变动金额(正数充值,负数扣除)")
private BigDecimal cashAmtPaid;
@ApiModelProperty(value = "佣金变动金额(正数入账,负数扣除)")
private BigDecimal salaryAmtPaid;
@ApiModelProperty(value = "操作时间")
......
package com.mmc.iuav.user.model.qo.wallet;
import com.mmc.iuav.group.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author 作者 lw
* @version 创建时间:2023.8.26 上午11:40:21
* @explain 类说明
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WalletFlowQO implements Serializable {
private static final long serialVersionUID = -2568266056802132237L;
@ApiModelProperty(value = "用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "查询年-月")
private String yearMonth;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间", hidden = true)
private String endTime;
@ApiModelProperty(value = "状态类型")
private Integer payMethod;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
......@@ -21,6 +21,10 @@ public class ApplyWithdrawalVO implements Serializable {
private static final long serialVersionUID = 8677383830415176214L;
@ApiModelProperty(value = "用户id")
private Integer userAccountId;
@ApiModelProperty(value = "户名")
private String empName;
@ApiModelProperty(value = "手机号")
private String empPhone;
@ApiModelProperty(value = "交易类型(bankcard:银行卡,alipay:支付宝,wechatpay:微信)", required = true)
private String settleType;
@ApiModelProperty(value = "收款账号,交易类型为支付宝时,为支付宝账号;交易类型为微信时,填收款用户的openid", required = true)
......
......@@ -2,9 +2,10 @@ package com.mmc.iuav.user.controller.wallet;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.controller.BaseController;
import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO;
import com.mmc.iuav.user.model.dto.wallet.PayWalletDTO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.wallet.TopUpOrderVO;
import com.mmc.iuav.user.model.vo.wallet.UserBillingDetailVO;
import com.mmc.iuav.user.model.vo.wallet.WalletFlowVO;
import com.mmc.iuav.user.service.wallet.PayWalletService;
import io.swagger.annotations.*;
......@@ -69,15 +70,16 @@ public class PayWalletController extends BaseController {
@ApiOperation(value = "用户账单明细")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserBillingDetailVO.class)})
@GetMapping("customerBillingDetail")
public ResultBody<UserBillingDetailVO> customerBillingDetail(HttpServletRequest request, Integer pageNo, Integer pageSize) {
return payWalletService.customerBillingDetail(this.getUserLoginInfoFromRedis(request).getUserAccountId(), pageNo, pageSize);
@PostMapping("customerBillingDetail")
public ResultBody<UserBillingDetailVO> customerBillingDetail(HttpServletRequest request, @RequestBody WalletFlowQO walletFlowQO) {
return payWalletService.customerBillingDetail(this.getUserLoginInfoFromRedis(request).getUserAccountId(), walletFlowQO);
}
@ApiOperation(value = "账单详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserBillingDetailVO.class)})
@GetMapping("billingDetails")
public ResultBody<UserBillingDetailVO> billingDetails(Integer id) {
return payWalletService.billingDetails(id);
public ResultBody<UserBillingDetailVO> billingDetails(@ApiParam(value = "ID", required = true) @RequestParam Integer id,
@ApiParam(value = "详情类型", required = true) @RequestParam String detailType) {
return payWalletService.billingDetails(id, detailType);
}
}
......@@ -2,6 +2,7 @@ package com.mmc.iuav.user.controller.wallet;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.controller.BaseController;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
import com.mmc.iuav.user.service.xzsz.WithdrawalService;
import io.swagger.annotations.Api;
......@@ -39,7 +40,12 @@ public class WithdrawalController extends BaseController {
// 提现查询
// 个人提现列表
@ApiOperation(value = "个人提现明细列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("withdrawalList")
public ResultBody withdrawalList(HttpServletRequest request, @RequestBody WalletFlowQO walletFlowQO) {
return withdrawalService.withdrawalList(this.getUserLoginInfoFromRedis(request).getUserAccountId(), walletFlowQO);
}
// 全部用户提现列表
......
package com.mmc.iuav.user.dao.wallet;
import com.mmc.iuav.user.entity.XzWithdrawalApplyDO;
import com.mmc.iuav.user.entity.wallet.PayLogDO;
import com.mmc.iuav.user.entity.wallet.PayWalletDO;
import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -22,11 +24,19 @@ public interface PayWalletDao {
int updatePayWallet(PayWalletDO updatePayWallet);
List<PayLogDO> getPayLog(Integer userAccountId, Integer pageNo, Integer pageSize);
List<PayLogDO> getPayLog(WalletFlowQO param);
int countPayLog(Integer userAccountId);
int countPayLog(WalletFlowQO param);
PayLogDO getPayLogById(Integer id);
void insertWithdrawalLog(WithdrawalLogDO withdrawalLogDO);
List<WithdrawalLogDO> getWithdrawalListByUserAccountId(WalletFlowQO param);
XzWithdrawalApplyDO withdrawalApplyById(Integer id);
List<WithdrawalLogDO> listPayWithdrawalLog(Integer id);
int countPayWithdrawalLog(WalletFlowQO param);
}
package com.mmc.iuav.user.entity;
import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO;
import com.mmc.iuav.user.enums.SettleTypeEnum;
import com.mmc.iuav.user.model.vo.XzWithdrawalVO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
import com.mmc.iuav.user.util.PrivacyUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -22,6 +24,7 @@ public class XzWithdrawalApplyDO implements Serializable {
private static final long serialVersionUID = 7891653696372539753L;
private Integer id;
private Integer userAccountId;
private Integer applyStatus;
private String bankName;
private String bankRemo;
private String empNum;
......@@ -46,6 +49,7 @@ public class XzWithdrawalApplyDO implements Serializable {
private String tradeResult;
private String submitStatus;
private String errorCode;
private Date payTime;
private String errorMessage;
private BigDecimal chargeAmount;
private Date createTime;
......@@ -79,4 +83,19 @@ public class XzWithdrawalApplyDO implements Serializable {
this.positionName = applyWithdrawalVO.getPositionName();
this.payAmount = applyWithdrawalVO.getPayAmount().doubleValue();
}
public UserBillingDetailVO buildUserBillingDetailVO() {
payAccount = PrivacyUtil.encryptBankAcct(payAccount);
String name = "提现";
if (this.applyStatus == 0) {
name = "银行处理中";
} else if (this.applyStatus == 1) {
name = "提现成功";
} else if (this.applyStatus == 2) {
name = "提现失败";
}
return UserBillingDetailVO.builder().userAccountId(userAccountId)
.payNo(outerTradeNo).payTime(payTime).account(payAccount)
.name(name).id(id).build();
}
}
package com.mmc.iuav.user.entity.wallet;
import com.mmc.iuav.user.model.vo.wallet.UserBillingDetailVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......
package com.mmc.iuav.user.entity.wallet;
import com.mmc.iuav.user.enums.RebateMethod;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Author LW
* @date 2023/8/24 14:37
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UserBillingDetailVO implements Serializable {
private static final long serialVersionUID = -113701726830167312L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "用户id")
private Integer userAccountId;
@ApiModelProperty(value = "流水编号")
private String payNo;
@ApiModelProperty(value = "操作方式")
private Integer payMethod;
@ApiModelProperty(value = "云享金变动金额(正数充值,负数扣除)")
private BigDecimal cashAmtPaid;
@ApiModelProperty(value = "佣金变动金额(正数入账,负数扣除)")
private BigDecimal salaryAmtPaid;
@ApiModelProperty(value = "操作时间")
private Date payTime;
@ApiModelProperty(value = "操作名称")
private String name;
@ApiModelProperty(value = "到账账户")
private String account;
@ApiModelProperty(value = "处理进度")
private List<Schedule> schedules;
public void buildSchedules(List<WithdrawalLogDO> list) {
this.schedules = new ArrayList<Schedule>();
for (WithdrawalLogDO d : list) {
if (RebateMethod.PENDING.getCode().equals(d.getPayMethod().toString())) {
Schedule sd = new Schedule();
sd.setTitle(RebateMethod.PENDING.getStatus());
sd.setAcTime(d.getPayTime());
sd.setActive(1);
this.schedules.add(sd);
} else if (RebateMethod.SUCCESS.getCode().equals(d.getPayMethod().toString())) {
Schedule sd = new Schedule();
sd.setTitle(RebateMethod.SUCCESS.getStatus());
sd.setAcTime(d.getPayTime());
sd.setActive(1);
this.schedules.add(sd);
} else if (RebateMethod.FAIL.getCode().equals(d.getPayMethod().toString())) {
Schedule sd = new Schedule();
sd.setTitle(RebateMethod.FAIL.getStatus());
sd.setAcTime(d.getPayTime());
sd.setActive(1);
this.schedules.add(sd);
}
}
if (this.schedules.size() == 1) {
Schedule sd = new Schedule();
sd.setTitle(RebateMethod.SUCCESS.getStatus());
sd.setActive(0);
this.schedules.add(sd);
}
}
public static class Schedule {
private String title;
private Date acTime;
private Integer active;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Date getAcTime() {
return acTime;
}
public void setAcTime(Date acTime) {
this.acTime = acTime;
}
public Integer getActive() {
return active;
}
public void setActive(Integer active) {
this.active = active;
}
}
}
package com.mmc.iuav.user.entity.wallet;
import com.mmc.iuav.user.enums.WithdrawalMethod;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -42,6 +43,8 @@ public class WithdrawalLogDO implements Serializable {
*/
private Integer xzWithdrawalApplyId;
private String typeName;
/**
* 提现冻结
*/
......@@ -50,5 +53,19 @@ public class WithdrawalLogDO implements Serializable {
private Date createTime;
private Date updateTime;
public UserBillingDetailVO buildUserBillingDetailVO() {
if (payMethod.equals(WithdrawalMethod.TXDJ.getCode())) {
this.typeName = WithdrawalMethod.TXDJ.getName();
}
if (payMethod.equals(WithdrawalMethod.TXCG.getCode())) {
this.typeName = WithdrawalMethod.TXCG.getName();
}
if (payMethod.equals(WithdrawalMethod.TXSB.getCode())) {
this.typeName = WithdrawalMethod.TXSB.getName();
}
return UserBillingDetailVO.builder().id(id).userAccountId(userAccountId)
.payMethod(payMethod).payTime(payTime).payNo(payNo).name(typeName).build();
}
}
package com.mmc.iuav.user.enums;
/**
* @author 作者 lw
* @version 创建时间:2023.8.26 下午5:29:24
* @explain 类说明
*/
public enum RebateMethod {
PENDING("150", "提现申请"), SUCCESS("200", "提现到账"), FAIL("250", "提现失败");
RebateMethod(String code, String status) {
this.code = code;
this.status = status;
}
private String code;
private String status;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
package com.mmc.iuav.user.service.wallet;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.wallet.TopUpOrderVO;
import com.mmc.iuav.user.model.vo.wallet.WalletFlowVO;
......@@ -18,7 +19,7 @@ public interface PayWalletService {
ResultBody feignTopUpCash(TopUpOrderVO topUpOrderVO);
ResultBody customerBillingDetail(Integer userAccountId, Integer pageNo, Integer pageSize);
ResultBody customerBillingDetail(Integer userAccountId, WalletFlowQO walletFlowQO);
ResultBody billingDetails(Integer id);
ResultBody billingDetails(Integer id, String detailType);
}
......@@ -6,10 +6,15 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.dao.UserServiceDao;
import com.mmc.iuav.user.dao.wallet.PayWalletDao;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.XzWithdrawalApplyDO;
import com.mmc.iuav.user.entity.wallet.PayLogDO;
import com.mmc.iuav.user.entity.wallet.PayWalletDO;
import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO;
import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO;
import com.mmc.iuav.user.enums.PayMethodEnums;
import com.mmc.iuav.user.model.dto.wallet.PayWalletDTO;
import com.mmc.iuav.user.model.dto.wallet.WithdrawalInfoVO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.wallet.FlyerWalletFlowVO;
import com.mmc.iuav.user.model.vo.wallet.PublisherWalletFlowVO;
import com.mmc.iuav.user.model.vo.wallet.TopUpOrderVO;
......@@ -17,6 +22,7 @@ import com.mmc.iuav.user.model.vo.wallet.WalletFlowVO;
import com.mmc.iuav.user.service.wallet.PayWalletService;
import com.mmc.iuav.user.util.TDateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -473,18 +479,34 @@ public class PayWalletServiceImpl implements PayWalletService {
}
@Override
public ResultBody customerBillingDetail(Integer userAccountId, Integer pageNo, Integer pageSize) {
int count = payWalletDao.countPayLog(userAccountId);
public ResultBody customerBillingDetail(Integer userAccountId, WalletFlowQO param) {
param.setUserAccountId(userAccountId);
int count = payWalletDao.countPayLog(param);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
List<PayLogDO> payLogList = payWalletDao.getPayLog(userAccountId, (pageNo - 1) * pageSize, pageSize);
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, payLogList.stream().map(PayLogDO::buildUserBillingDetailVO).collect(Collectors.toList())));
if (!StringUtils.isBlank(param.getYearMonth())) {
param.setEndTime(TDateUtil.getDateStr(
TDateUtil.getMonthLatestDay(TDateUtil.getDate(param.getYearMonth() + "-01", "yyyy-MM-dd")),
"yyyy-MM-dd") + " 23:59:59");
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<PayLogDO> payLogList = payWalletDao.getPayLog(param);
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, payLogList.stream().map(PayLogDO::buildUserBillingDetailVO).collect(Collectors.toList())));
}
@Override
public ResultBody billingDetails(Integer id) {
PayLogDO payLogDO = payWalletDao.getPayLogById(id);
return ResultBody.success(payLogDO.buildUserBillingDetailVO());
public ResultBody billingDetails(Integer id, String detailType) {
if (WithdrawalInfoVO.AMT.equals(detailType)) {
PayLogDO payLogDO = payWalletDao.getPayLogById(id);
return ResultBody.success(payLogDO.buildUserBillingDetailVO());
} else {
XzWithdrawalApplyDO apply = payWalletDao.withdrawalApplyById(id);
UserBillingDetailVO detail = apply.buildUserBillingDetailVO();
List<WithdrawalLogDO> rebates = payWalletDao.listPayWithdrawalLog(apply.getId());
detail.buildSchedules(rebates);
return ResultBody.success(detail);
}
}
}
package com.mmc.iuav.user.service.xzsz;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
/**
......@@ -9,4 +10,6 @@ import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
*/
public interface WithdrawalService {
ResultBody apply(ApplyWithdrawalVO applyWithdrawalVO, Integer userAccountId);
ResultBody withdrawalList(Integer userAccountId, WalletFlowQO walletFlowQO);
}
package com.mmc.iuav.user.service.xzsz.impl;
import com.mmc.iuav.general.CodeUtil;
import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.dao.RealNameAuthDao;
......@@ -13,10 +14,12 @@ import com.mmc.iuav.user.entity.XzWithdrawalApplyDO;
import com.mmc.iuav.user.entity.wallet.PayWalletDO;
import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO;
import com.mmc.iuav.user.enums.WithdrawalMethod;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
import com.mmc.iuav.user.service.xzsz.WithdrawalService;
import com.mmc.iuav.user.util.TDateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -25,6 +28,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author: zj
......@@ -76,8 +81,8 @@ public class WithdrawalServiceImpl implements WithdrawalService {
// 记录提现申请记录
XzWithdrawalApplyDO xzWithdrawalApplyDO = new XzWithdrawalApplyDO(applyWithdrawalVO);
xzWithdrawalApplyDO.setOuterTradeNo(outerTradeNo);
xzWithdrawalApplyDO.setEmpName(realNameAuth.getUserName());
xzWithdrawalApplyDO.setEmpPhone(realNameAuth.getPhoneNum());
xzWithdrawalApplyDO.setEmpName(applyWithdrawalVO.getEmpName());
xzWithdrawalApplyDO.setEmpPhone(applyWithdrawalVO.getEmpPhone());
xzWithdrawalApplyDO.setLicenseId(realNameAuth.getIdNumber());
xzWithdrawalApplyDO.setLicenseType("ID_CARD");
xzWithdrawalApplyDO.setMonth(TDateUtil.getCurrentDateByType("yyyy-MM"));
......@@ -107,4 +112,24 @@ public class WithdrawalServiceImpl implements WithdrawalService {
}
return ResultBody.success();
}
@Override
public ResultBody withdrawalList(Integer userAccountId, WalletFlowQO param) {
if (!StringUtils.isBlank(param.getYearMonth())) {
param.setEndTime(TDateUtil.getDateStr(
TDateUtil.getMonthLatestDay(TDateUtil.getDate(param.getYearMonth() + "-01", "yyyy-MM-dd")),
"yyyy-MM-dd") + " 23:59:59");
}
param.setUserAccountId(userAccountId);
int count = payWalletDao.countPayWithdrawalLog(param);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<WithdrawalLogDO> withdrawalLogList = payWalletDao.getWithdrawalListByUserAccountId(param);
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, withdrawalLogList.stream()
.map(WithdrawalLogDO::buildUserBillingDetailVO).collect(Collectors.toList())));
}
}
package com.mmc.iuav.user.util;
/**
* 正则表达式匹配
*
* @author tyg
* @date 2018年9月21日下午4:32:27
*/
public class PatternUtil {
/**
* 手机号码匹配
*/
public static final String PHONE_REG = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";
/**
* 座机号码匹配
*/
public static final String MOBILE_REG = "^\\d{3}-\\d{8}|\\d{4}-\\d{7}$";
/**
* 汉字匹配
*/
public static final String CHIINESE_REG = "^[\\u4e00-\\u9fa5]{0,}$";
/**
* 英文和数字匹配(不区分大小写)
*/
public static final String LETTER_NUMBER_REG = "^[A-Za-z0-9]+$";
/**
* 非零开头的最多带两位小数的数字
*/
public static final String DECIMAL_REG = "^([1-9][0-9]*)+(.[0-9]{1,2})?$";
/**
* 纯数字
*/
public static final String ONLY_NUMBER_REG = "^[0-9]{1,}$";
/**
* 纯字母
*/
public static final String ONLY_LETTER_REG = "^[a-zA-Z]{1,}$";
/**
* 邮箱email
*/
public static final String EMAIL_REG = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
/**
* 日期规则
*/
public static final String DATE_YMD = "^(\\d{4}-\\d{2}-\\d{2})$";
/**
* 时间规则
*/
public static final String DATE_YMDHDS = "^(\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2})$";
/**
* 银行卡卡号位数
*/
public final static String BANK_CARD_NUMBER = "^\\d{16}|\\d{19}$";
/**
* 身份证号码位数限制
*/
public final static String ID_CARD = "^\\d{15}|(\\d{17}[0-9,x,X])$";
/**
* 是否为手机号码
*
* @param phone
* @return
* @return boolean
* @author tyg
* @date 2018年9月25日上午9:44:38
*/
public static boolean isPhone(String phone) {
return phone.matches(PHONE_REG);
}
/**
* 是否为座机号码
*
* @param mobile
* @return
* @return boolean
* @author tyg
* @date 2018年9月25日上午9:44:38
*/
public static boolean isMobile(String mobile) {
return mobile.matches(MOBILE_REG);
}
public static void main(String[] args) {
System.out.println(isPhone("13228116626"));
System.out.println(isMobile("028-63358547"));
}
}
package com.mmc.iuav.user.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
/**
* 日志辅助类,用来处理敏感信息,进行脱敏
*
* @author tyg
* @date 2018年5月5日下午4:01:22
*/
public class PrivacyUtil {
//银行账户:显示前六后四,范例:622848******4568
public static String encryptBankAcct(String bankAcct) {
if (bankAcct == null) {
return "";
}
return replaceBetween(bankAcct, 6, bankAcct.length() - 4, null);
}
//身份证号码:显示前六后四,范例:110601********2015
public static String encryptIdCard(String idCard) {
if (idCard == null) {
return "";
}
return replaceBetween(idCard, 6, idCard.length() - 4, null);
}
//客户email:显示前二后四,范例:abxx@xxx.com
public static String encryptEmail(String email) {
//判断是否为邮箱地址
if (email == null || !Pattern.matches(PatternUtil.EMAIL_REG, email)) {
return "";
}
StringBuilder sb = new StringBuilder(email);
//邮箱账号名只显示前两位
int at_position = sb.indexOf("@");
if (at_position > 2) {
sb.replace(2, at_position, StringUtils.repeat("x", at_position - 2));
}
//邮箱域名隐藏
int period_position = sb.lastIndexOf(".");
sb.replace(at_position + 1, period_position, StringUtils.repeat("x", period_position - at_position - 1));
return sb.toString();
}
//手机:显示前三后四,范例:189****3684
public static String encryptPhoneNo(String phoneNo) {
if (phoneNo == null) {
return "";
}
return replaceBetween(phoneNo, 3, phoneNo.length() - 4, null);
}
/**
* @param object 待处理对象
* @param fieldNames 需要处理的属性
* @return 将对象转换为字符串,并对敏感信息进行处理
*/
public static String encryptSensitiveInfo(Object object, String[] fieldNames) {
return encryptSensitiveInfo(object, fieldNames, null);
}
/**
* @param object 待处理对象
* @param fieldNames 需要处理的属性
* @param excludes 不需要显示的属性
* @return 将对象转换为字符串,并对敏感信息进行处理
*/
public static String encryptSensitiveInfo(Object object, String[] fieldNames, String[] excludes) {
if (fieldNames == null) {
fieldNames = new String[0];
}
//合并数组
Set<String> set = new HashSet<String>(Arrays.asList(fieldNames));
if (excludes != null) {
for (int i = 0; i < excludes.length; i++) {
set.add(excludes[i]);
}
}
//将对象转换为字符串
String str = ReflectionToStringBuilder.toStringExclude(object, set.toArray(new String[0]));
//处理敏感信息
StringBuilder sb = new StringBuilder(str);
sb.deleteCharAt(sb.length() - 1);
for (int i = 0; i < fieldNames.length; i++) {
String fieldName = fieldNames[i];
try {
Field f = object.getClass().getDeclaredField(fieldName);
f.setAccessible(true);
String value = encryptSensitiveInfo(String.valueOf(f.get(object)));
if (i != 0 || sb.charAt(sb.length() - 1) != '[') {
sb.append(",");
}
sb.append(fieldName).append("=").append(value);
} catch (Exception e) {
}
}
sb.append("]");
str = sb.toString();
return str;
}
/**
* 对敏感信息进行处理。使用正则表达式判断使用哪种规则
*
* @param sourceStr 需要处理的敏感信息
* @return
* @return String
* @author tyg
* @date 2018年5月5日下午3:59:28
*/
public static String encryptSensitiveInfo(String sourceStr) {
if (sourceStr == null) {
return "";
}
if (Pattern.matches(PatternUtil.PHONE_REG, sourceStr)) {
return encryptPhoneNo(sourceStr);
} else if (Pattern.matches(PatternUtil.EMAIL_REG, sourceStr)) {
return encryptEmail(sourceStr);
} else if (Pattern.matches(PatternUtil.BANK_CARD_NUMBER, sourceStr)) {
return encryptBankAcct(sourceStr);
} else if (Pattern.matches(PatternUtil.ID_CARD, sourceStr)) {
return encryptIdCard(sourceStr);
} else {
return sourceStr;
}
}
/**
* 将字符串开始位置到结束位置之间的字符用指定字符替换
*
* @param sourceStr 待处理字符串
* @param begin 开始位置
* @param end 结束位置
* @param replacement 替换字符
* @return
*/
private static String replaceBetween(String sourceStr, int begin, int end, String replacement) {
if (sourceStr == null) {
return "";
}
if (replacement == null) {
replacement = "*";
}
int replaceLength = end - begin;
if (StringUtils.isNotBlank(sourceStr) && replaceLength > 0) {
StringBuilder sb = new StringBuilder(sourceStr);
sb.replace(begin, end, StringUtils.repeat(replacement, replaceLength));
return sb.toString();
} else {
return sourceStr;
}
}
}
\ No newline at end of file
......@@ -73,27 +73,47 @@
</select>
<select id="getPayLog" resultType="com.mmc.iuav.user.entity.wallet.PayLogDO">
SELECT pl.id,
pl.user_account_id,
pl.pay_no,
pl.pay_method,
pl.cash_amt_paid,
pl.salary_amt_paid,
pl.pay_time,
pl.remark,
pl.operate_user,
pl.create_time,
wd.`name`
pl.user_account_id,
pl.pay_no,
pl.pay_method,
pl.cash_amt_paid,
pl.salary_amt_paid,
pl.pay_time,
pl.remark,
pl.operate_user,
pl.create_time,
wd.`name`
FROM pay_log pl
INNER JOIN wallet_dictionary wd ON pl.pay_method = wd.`code`
WHERE pl.user_account_id = #{userAccountId}
ORDER BY pl.pay_time DESC
limit #{pageNo}
, #{pageSize}
INNER JOIN wallet_dictionary wd ON pl.pay_method = wd.`code`
<where>
pl.user_account_id = #{userAccountId}
<if test="startTime != null and startTime != '' ">
and pl.pay_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d
%H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and pl.pay_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d
%H:%i:%s')
</if>
</where>
ORDER BY pl.create_time DESC
limit #{pageNo}
, #{pageSize}
</select>
<select id="countPayLog" resultType="java.lang.Integer">
select count(*)
from pay_log
where user_account_id = #{userAccountId}
<where>
pl.user_account_id = #{userAccountId}
<if test="startTime != null and startTime != '' ">
and pl.pay_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d
%H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and pl.pay_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d
%H:%i:%s')
</if>
</where>
</select>
<select id="getPayLogById" resultType="com.mmc.iuav.user.entity.wallet.PayLogDO">
SELECT pl.id,
......@@ -111,4 +131,88 @@
INNER JOIN wallet_dictionary wd ON pl.pay_method = wd.`code`
WHERE pl.id = #{id}
</select>
<select id="getWithdrawalListByUserAccountId"
resultType="com.mmc.iuav.user.entity.wallet.WithdrawalLogDO">
select id,
user_account_id,
xz_withdrawal_apply_id,
pay_no,
pay_method,
pay_time,
salary_freeze,
create_time
from withdrawal_log
<where>
user_account_id = #{userAccountId}
<if test="startTime != null and startTime != '' ">
and pc.pay_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and pc.pay_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
</where>
order by create_time DESC
limit #{pageNo},#{pageSize}
</select>
<select id="withdrawalApplyById" resultType="com.mmc.iuav.user.entity.XzWithdrawalApplyDO">
select id,
user_account_id,
bank_name,
bank_remo,
emp_num,
emp_name,
emp_phone,
license_id,
license_type,
`month`,
notify_url,
outer_trade_no,
pay_account,
pay_amount,
position_name,
remarks,
settle_type,
tax_fund_id,
wechat_app_id,
trade_status,
trade_time,
front_log_no,
trade_fail_code,
trade_result,
submit_status,
error_code,
error_message,
charge_amount,
create_time
from xz_withdrawal_apply
where id = #{id}
</select>
<select id="listPayWithdrawalLog" resultType="com.mmc.iuav.user.entity.wallet.WithdrawalLogDO">
select id,
user_account_id,
xz_withdrawal_apply_id,
pay_no,
pay_method,
pay_time,
salary_freeze,
create_time
from withdrawal_log
where xz_withdrawal_apply_id = #{id}
order by pb.pay_time asc
</select>
<select id="countPayWithdrawalLog" resultType="java.lang.Integer">
select count(*)
from withdrawal_log
<where>
pl.user_account_id = #{userAccountId}
<if test="startTime != null and startTime != '' ">
and pl.pay_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d
%H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and pl.pay_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d
%H:%i:%s')
</if>
</where>
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论