This commit is contained in:
parent
4012678d6a
commit
cc52270c04
|
|
@ -151,4 +151,13 @@ public class AccInfoController extends BaseController {
|
|||
public AjaxResult getOrderQRCode() {
|
||||
return success(accInfoService.getOrderQRCode());
|
||||
}
|
||||
|
||||
@ApiOperation(
|
||||
value = "查询账户(仅返回钱包余额)",
|
||||
notes = "移动端查询账户(仅返回钱包余额)"
|
||||
)
|
||||
@PostMapping({"/wallet/balance"})
|
||||
public AjaxResult queryWalletBalance(@RequestBody AccInfo accInfo) {
|
||||
return success(this.accInfoService.queryWalletBalance(accInfo));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
public class AccInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键自增 */
|
||||
private Long id;
|
||||
|
||||
/** 账户id */
|
||||
/** 账户id 主键自增 */
|
||||
@Excel(name = "账户id")
|
||||
@ApiModelProperty(value = "账户id")
|
||||
private Long accId;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.canteen.core.account.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AccInfoVo {
|
||||
/** 账户id 主键自增 */
|
||||
@Excel(name = "账户id")
|
||||
@ApiModelProperty(value = "账户id")
|
||||
private Long accId;
|
||||
|
||||
/** 账户名称 */
|
||||
@Excel(name = "账户名称")
|
||||
@ApiModelProperty(value = "账户名称")
|
||||
private String accName;
|
||||
|
||||
/** 人员id */
|
||||
@Excel(name = "人员id")
|
||||
@ApiModelProperty(value = "人员id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("账户状态 1正常 2冻结 3销户 4过期")
|
||||
private Integer accStatus;
|
||||
@ApiModelProperty("账户可用总余额(不包括冻结金额)")
|
||||
private BigDecimal accBalTotal;
|
||||
@ApiModelProperty("账户总余额(包含冻结金额)")
|
||||
private BigDecimal accAllBal;
|
||||
@ApiModelProperty("个人钱包(可用)余额/分")
|
||||
private BigDecimal walletBal;
|
||||
@ApiModelProperty("补贴钱包(可用)余额/分")
|
||||
private BigDecimal subsidyBal;
|
||||
@ApiModelProperty("红包余额")
|
||||
private BigDecimal redEnvelope;
|
||||
@ApiModelProperty("个人钱包冻结金额")
|
||||
private BigDecimal walletFreezeBal;
|
||||
@ApiModelProperty("补贴钱包冻结金额")
|
||||
private BigDecimal subFreezeBal;
|
||||
private BigDecimal accFreezeBalTotal;
|
||||
private List<AccWalletInfo> walletInfoList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.canteen.core.account.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class WalletBalanceVO {
|
||||
@ApiModelProperty("个人钱包余额/分")
|
||||
private BigDecimal walletBal;
|
||||
@ApiModelProperty("补贴钱包余额/分")
|
||||
private BigDecimal subsidyBal;
|
||||
@ApiModelProperty("红包余额")
|
||||
private BigDecimal redEnvelope;
|
||||
@ApiModelProperty("个人钱包冻结金额")
|
||||
private BigDecimal walletFreezeBal;
|
||||
@ApiModelProperty("补贴钱包冻结金额")
|
||||
private BigDecimal subFreezeBal;
|
||||
@ApiModelProperty("冻结金额")
|
||||
private BigDecimal accFreezeBalTotal;
|
||||
@ApiModelProperty("账户总余额(包含冻结金额)")
|
||||
private BigDecimal accAllBal;
|
||||
@ApiModelProperty("账户可用余额总余额(不包括冻结金额)")
|
||||
private BigDecimal accBalTotal;
|
||||
@ApiModelProperty("账户状态 1正常 2冻结 3销户 4过期")
|
||||
private Integer accStatus;
|
||||
|
||||
|
||||
public static WalletBalanceVO of(AccInfoVo accInfoVo) {
|
||||
WalletBalanceVO walletBalanceVO = new WalletBalanceVO();
|
||||
walletBalanceVO.setAccBalTotal(accInfoVo.getAccBalTotal());
|
||||
walletBalanceVO.setAccAllBal(accInfoVo.getAccAllBal());
|
||||
walletBalanceVO.setWalletBal(accInfoVo.getWalletBal());
|
||||
walletBalanceVO.setSubsidyBal(accInfoVo.getSubsidyBal());
|
||||
walletBalanceVO.setRedEnvelope(accInfoVo.getRedEnvelope());
|
||||
walletBalanceVO.setWalletFreezeBal(accInfoVo.getWalletFreezeBal());
|
||||
walletBalanceVO.setSubFreezeBal(accInfoVo.getSubFreezeBal());
|
||||
walletBalanceVO.setAccFreezeBalTotal(accInfoVo.getAccFreezeBalTotal());
|
||||
walletBalanceVO.setAccStatus(accInfoVo.getAccStatus());
|
||||
return walletBalanceVO;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.account.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.account.domain.AccInfo;
|
||||
import com.bonus.canteen.core.account.domain.AccInfoVo;
|
||||
|
||||
/**
|
||||
* 账户资料Mapper接口
|
||||
|
|
@ -26,6 +27,8 @@ public interface AccInfoMapper {
|
|||
*/
|
||||
public List<AccInfo> selectAccInfoList(AccInfo accInfo);
|
||||
|
||||
public List<AccInfoVo> selectAccInfoVoList(AccInfo accInfo);
|
||||
|
||||
/**
|
||||
* 新增账户资料
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.canteen.core.account.service;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.account.domain.AccInfo;
|
||||
import com.bonus.canteen.core.account.domain.AccInfoVo;
|
||||
import com.bonus.canteen.core.account.domain.WalletBalanceVO;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
||||
/**
|
||||
|
|
@ -27,6 +29,8 @@ public interface IAccInfoService {
|
|||
*/
|
||||
public List<AccInfo> selectAccInfoList(AccInfo accInfo);
|
||||
|
||||
public List<AccInfoVo> selectAccInfoVoList(AccInfo accInfo);
|
||||
|
||||
/**
|
||||
* 新增账户资料
|
||||
*
|
||||
|
|
@ -62,4 +66,6 @@ public interface IAccInfoService {
|
|||
public int syncAccInfo(SysUser sysUser);
|
||||
|
||||
public String getOrderQRCode();
|
||||
|
||||
public WalletBalanceVO queryWalletBalance(AccInfo accInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,35 @@
|
|||
package com.bonus.canteen.core.account.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.bonus.canteen.core.account.domain.AccInfoVo;
|
||||
import com.bonus.canteen.core.account.domain.AccWalletInfo;
|
||||
import com.bonus.canteen.core.account.domain.WalletBalanceVO;
|
||||
import com.bonus.canteen.core.account.enums.AccStatusEnum;
|
||||
import com.bonus.canteen.core.account.enums.AccWalletIdEnum;
|
||||
import com.bonus.canteen.core.account.service.IAccWalletInfoService;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.houqin.constant.LeCodeUseSceneEnum;
|
||||
import com.bonus.common.houqin.constant.SourceTypeEnum;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.account.mapper.AccInfoMapper;
|
||||
import com.bonus.canteen.core.account.domain.AccInfo;
|
||||
import com.bonus.canteen.core.account.service.IAccInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* 账户资料Service业务层处理
|
||||
|
|
@ -27,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
* @date 2025-04-05
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AccInfoServiceImpl implements IAccInfoService {
|
||||
@Autowired
|
||||
private AccInfoMapper accInfoMapper;
|
||||
|
|
@ -55,6 +67,11 @@ public class AccInfoServiceImpl implements IAccInfoService {
|
|||
return accInfoMapper.selectAccInfoList(accInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccInfoVo> selectAccInfoVoList(AccInfo accInfo) {
|
||||
return accInfoMapper.selectAccInfoVoList(accInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增账户资料
|
||||
*
|
||||
|
|
@ -147,4 +164,31 @@ public class AccInfoServiceImpl implements IAccInfoService {
|
|||
String userId = SecurityUtils.getUserId().toString();
|
||||
return "bns{\"s\":" + SourceTypeEnum.WECHAT_SMALL_PRO.getKey() + ",\"y\":" + LeCodeUseSceneEnum.PAY.key() + ",\"p\":\"" + userId + "\",\"t\":" + "\"" + stime + "\"}";
|
||||
}
|
||||
|
||||
public WalletBalanceVO queryWalletBalance(AccInfo accInfo) {
|
||||
log.info("[app]v4查询账户余额入参={}", JSONUtil.toJsonStr(accInfo));
|
||||
AccInfoVo accInfoVO = (AccInfoVo) accInfoMapper.selectAccInfoVoList(accInfo);
|
||||
if (ObjectUtil.isNull(accInfoVO)) {
|
||||
throw new ServiceException("账户不存在");
|
||||
} else {
|
||||
AccWalletInfo accWalletInfo = new AccWalletInfo();
|
||||
accWalletInfo.setAccId(accInfoVO.getAccId());
|
||||
List<AccWalletInfo> walletInfoList = this.accWalletInfoService.selectAccWalletInfoList(accWalletInfo);
|
||||
this.setAccInfoVODetailList(accInfoVO, walletInfoList);
|
||||
log.info("获取账户(钱包)信息,出参={}", JSONUtil.toJsonStr(accInfoVO));
|
||||
}
|
||||
WalletBalanceVO walletBalanceVO = WalletBalanceVO.of(accInfoVO);
|
||||
log.info("[app]v4查询账户余额入参={}", JSONUtil.toJsonStr(walletBalanceVO));
|
||||
return walletBalanceVO;
|
||||
}
|
||||
|
||||
protected void setAccInfoVODetailList(AccInfoVo accInfoVo, List<AccWalletInfo> walletInfoList) {
|
||||
if (ObjectUtil.isNotEmpty(walletInfoList)) {
|
||||
//accInfoVo.setAccBalTotal((BigDecimal)walletInfoList.stream().map(AccWalletInfo::getWalletBal).filter(ObjectUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
//BigDecimal frozenBalanceAll = (BigDecimal)walletInfoList.stream().map(AccWalletInfo::getFrozenBalance).filter(ObjectUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
//accInfoVo.setAccFreezeBalTotal(frozenBalanceAll);
|
||||
accInfoVo.setAccAllBal(NumberUtil.add(accInfoVo.getAccBalTotal(), accInfoVo.getAccFreezeBalTotal()));
|
||||
accInfoVo.setWalletInfoList(walletInfoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.canteen.core.account.mapper.AccInfoMapper">
|
||||
<resultMap type="com.bonus.canteen.core.account.domain.AccInfo" id="AccInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="accId" column="acc_id" />
|
||||
<result property="accName" column="acc_name" />
|
||||
<result property="userId" column="user_id" />
|
||||
|
|
@ -60,8 +59,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.bonus.canteen.core.account.domain.AccInfoVo" id="AccInfoVoResult">
|
||||
<result property="accId" column="acc_id" />
|
||||
<result property="accName" column="acc_name" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="walletBal" column="wallet_bal" />
|
||||
<result property="subsidyBal" column="subsidy_bal" />
|
||||
<result property="redEnvelope" column="red_envelope" />
|
||||
<result property="accStatus" column="acc_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAccInfoVo">
|
||||
select id, acc_id, acc_name, user_id, wallet_bal, subsidy_bal, red_envelope, subsidy_freeze_bal, acc_bal, balance2, water_wallet_bal, water_subsidy_bal, freeze_wallet_bal, freeze_subsidy_bal, freeze_red_envelope, wallet_over_bal, sub_over_bal, scope, end_date, red_validity_date, acc_status, pay_pwd, sub_date_flag, sub_month_flag, acc_pay_count, last_credit_time, interval_id, curr_credit_count, curr_brush_count, curr_use_reserve_count1, curr_use_reserve_count2, same_day_count, same_month_count, curr_cumu_amount, day_cumu_amount, month_sumu_amount, min_wallet_bal_limit, min_red_bal_limit, min_sub_bal_limit, month_full_reduce_amount, last_full_reduce_time, last_sub_time, sub_validity_date, last_sub_amount, last_wal_time, last_wal_amount, revision, reserved1, reserved2, reserved3, create_by, create_time, update_by, update_time from acc_info
|
||||
select acc_id, acc_name, user_id, wallet_bal, subsidy_bal, red_envelope, subsidy_freeze_bal,
|
||||
acc_bal, balance2, water_wallet_bal, water_subsidy_bal, freeze_wallet_bal, freeze_subsidy_bal,
|
||||
freeze_red_envelope, wallet_over_bal, sub_over_bal, scope, end_date, red_validity_date,
|
||||
acc_status, pay_pwd, sub_date_flag, sub_month_flag, acc_pay_count, last_credit_time,
|
||||
interval_id, curr_credit_count, curr_brush_count, curr_use_reserve_count1, curr_use_reserve_count2,
|
||||
same_day_count, same_month_count, curr_cumu_amount, day_cumu_amount, month_sumu_amount,
|
||||
min_wallet_bal_limit, min_red_bal_limit, min_sub_bal_limit, month_full_reduce_amount,
|
||||
last_full_reduce_time, last_sub_time, sub_validity_date, last_sub_amount, last_wal_time, last_wal_amount,
|
||||
revision, reserved1, reserved2, reserved3, create_by, create_time, update_by, update_time
|
||||
from acc_info
|
||||
</sql>
|
||||
|
||||
<select id="selectAccInfoList" parameterType="com.bonus.canteen.core.account.domain.AccInfo" resultMap="AccInfoResult">
|
||||
|
|
@ -118,10 +136,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="reserved3 != null and reserved3 != ''"> and reserved3 = #{reserved3}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAccInfoVoList" parameterType="com.bonus.canteen.core.account.domain.AccInfo" resultMap="AccInfoVoResult">
|
||||
<include refid="selectAccInfoVo"/>
|
||||
<where>
|
||||
<if test="accId != null "> and acc_id = #{accId}</if>
|
||||
<if test="accName != null and accName != ''"> and acc_name like concat('%', #{accName}, '%')</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="walletBal != null "> and wallet_bal = #{walletBal}</if>
|
||||
<if test="subsidyBal != null "> and subsidy_bal = #{subsidyBal}</if>
|
||||
<if test="redEnvelope != null "> and red_envelope = #{redEnvelope}</if>
|
||||
<if test="subsidyFreezeBal != null "> and subsidy_freeze_bal = #{subsidyFreezeBal}</if>
|
||||
<if test="accBal != null "> and acc_bal = #{accBal}</if>
|
||||
<if test="balance2 != null "> and balance2 = #{balance2}</if>
|
||||
<if test="waterWalletBal != null "> and water_wallet_bal = #{waterWalletBal}</if>
|
||||
<if test="waterSubsidyBal != null "> and water_subsidy_bal = #{waterSubsidyBal}</if>
|
||||
<if test="freezeWalletBal != null "> and freeze_wallet_bal = #{freezeWalletBal}</if>
|
||||
<if test="freezeSubsidyBal != null "> and freeze_subsidy_bal = #{freezeSubsidyBal}</if>
|
||||
<if test="freezeRedEnvelope != null "> and freeze_red_envelope = #{freezeRedEnvelope}</if>
|
||||
<if test="walletOverBal != null "> and wallet_over_bal = #{walletOverBal}</if>
|
||||
<if test="subOverBal != null "> and sub_over_bal = #{subOverBal}</if>
|
||||
<if test="scope != null "> and scope = #{scope}</if>
|
||||
<if test="endDate != null "> and end_date = #{endDate}</if>
|
||||
<if test="redValidityDate != null "> and red_validity_date = #{redValidityDate}</if>
|
||||
<if test="accStatus != null "> and acc_status = #{accStatus}</if>
|
||||
<if test="payPwd != null and payPwd != ''"> and pay_pwd = #{payPwd}</if>
|
||||
<if test="subDateFlag != null "> and sub_date_flag = #{subDateFlag}</if>
|
||||
<if test="subMonthFlag != null "> and sub_month_flag = #{subMonthFlag}</if>
|
||||
<if test="accPayCount != null "> and acc_pay_count = #{accPayCount}</if>
|
||||
<if test="lastCreditTime != null "> and last_credit_time = #{lastCreditTime}</if>
|
||||
<if test="intervalId != null "> and interval_id = #{intervalId}</if>
|
||||
<if test="currCreditCount != null "> and curr_credit_count = #{currCreditCount}</if>
|
||||
<if test="currBrushCount != null "> and curr_brush_count = #{currBrushCount}</if>
|
||||
<if test="currUseReserveCount1 != null "> and curr_use_reserve_count1 = #{currUseReserveCount1}</if>
|
||||
<if test="currUseReserveCount2 != null "> and curr_use_reserve_count2 = #{currUseReserveCount2}</if>
|
||||
<if test="sameDayCount != null "> and same_day_count = #{sameDayCount}</if>
|
||||
<if test="sameMonthCount != null "> and same_month_count = #{sameMonthCount}</if>
|
||||
<if test="currCumuAmount != null "> and curr_cumu_amount = #{currCumuAmount}</if>
|
||||
<if test="dayCumuAmount != null "> and day_cumu_amount = #{dayCumuAmount}</if>
|
||||
<if test="monthSumuAmount != null "> and month_sumu_amount = #{monthSumuAmount}</if>
|
||||
<if test="minWalletBalLimit != null "> and min_wallet_bal_limit = #{minWalletBalLimit}</if>
|
||||
<if test="minRedBalLimit != null "> and min_red_bal_limit = #{minRedBalLimit}</if>
|
||||
<if test="minSubBalLimit != null "> and min_sub_bal_limit = #{minSubBalLimit}</if>
|
||||
<if test="monthFullReduceAmount != null "> and month_full_reduce_amount = #{monthFullReduceAmount}</if>
|
||||
<if test="lastFullReduceTime != null "> and last_full_reduce_time = #{lastFullReduceTime}</if>
|
||||
<if test="lastSubTime != null "> and last_sub_time = #{lastSubTime}</if>
|
||||
<if test="subValidityDate != null "> and sub_validity_date = #{subValidityDate}</if>
|
||||
<if test="lastSubAmount != null "> and last_sub_amount = #{lastSubAmount}</if>
|
||||
<if test="lastWalTime != null "> and last_wal_time = #{lastWalTime}</if>
|
||||
<if test="lastWalAmount != null "> and last_wal_amount = #{lastWalAmount}</if>
|
||||
<if test="revision != null "> and revision = #{revision}</if>
|
||||
<if test="reserved1 != null and reserved1 != ''"> and reserved1 = #{reserved1}</if>
|
||||
<if test="reserved2 != null and reserved2 != ''"> and reserved2 = #{reserved2}</if>
|
||||
<if test="reserved3 != null and reserved3 != ''"> and reserved3 = #{reserved3}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAccInfoById" parameterType="Long" resultMap="AccInfoResult">
|
||||
<include refid="selectAccInfoVo"/>
|
||||
where id = #{id}
|
||||
where acc_id = #{accId}
|
||||
</select>
|
||||
|
||||
<insert id="insertAccInfo" parameterType="com.bonus.canteen.core.account.domain.AccInfo" useGeneratedKeys="true" keyProperty="accId">
|
||||
|
|
@ -293,7 +366,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where acc_id = #{accId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAccInfoByUserId" parameterType="Long">
|
||||
|
|
@ -301,9 +374,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<delete id="deleteAccInfoByIds" parameterType="String">
|
||||
delete from acc_info where id in
|
||||
delete from acc_info where acc_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
#{accId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue