1
zj
4 days ago 16f5baf41e3224ccb43fce45de968833f9f022d2
1
10 files modified
91 ■■■■ changed files
src/main/java/com/nq/service/impl/AgentUserServiceImpl.java 8 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java 75 ●●●● patch | view | raw | blame | history
src/main/resources/application.properties 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/UserRechargeMapper.xml 2 ●●● patch | view | raw | blame | history
target/classes/application.properties 2 ●●● patch | view | raw | blame | history
target/classes/com/nq/service/impl/AgentUserServiceImpl.class patch | view | raw | blame | history
target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class patch | view | raw | blame | history
target/classes/mapper/UserRechargeMapper.xml 2 ●●● patch | view | raw | blame | history
target/stock-0.0.1-SNAPSHOT.jar patch | view | raw | blame | history
target/stock-0.0.1-SNAPSHOT.jar.original patch | view | raw | blame | history
src/main/java/com/nq/service/impl/AgentUserServiceImpl.java
@@ -411,7 +411,13 @@
        String pcUrl = host + PropertiesUtil.getProperty("site.pc.reg.url") + agentUser.getAgentCode();
        agentInfoVO.setPcUrl(pcUrl);
        String mUrl = host + PropertiesUtil.getProperty("site.m.reg.url") + agentUser.getAgentCode();
        String mobileHost = PropertiesUtil.getProperty("frontend.domain.url", host);
        if (StringUtils.isNotBlank(mobileHost)) {
            mobileHost = mobileHost.replaceAll("/$", "");
        } else {
            mobileHost = host;
        }
        String mUrl = mobileHost + PropertiesUtil.getProperty("site.m.reg.url") + agentUser.getAgentCode();
        agentInfoVO.setMUrl(mUrl);
        return agentInfoVO;
    }
src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -171,22 +171,27 @@
            synchronized (UserWithdrawServiceImpl.class){
            //可取港币资金
            BigDecimal hkAmt=user.getEnaleWithdrawAmt();
            BigDecimal withdrawAmt = new BigDecimal(amt);
            BigDecimal enableWithdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
            BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
            int compareAmt = hkAmt.compareTo(new BigDecimal(amt));
            if (compareAmt == -1) {
            if (enableWithdrawAmt.compareTo(withdrawAmt) < 0) {
                return ServerResponse.createByErrorMsg("提现失败,用户可取港币资金不足");
            }
            BigDecimal reckon_hkAmt = hkAmt.subtract(new BigDecimal(amt));
            if (enableAmt.compareTo(withdrawAmt) < 0) {
            user.setEnaleWithdrawAmt(reckon_hkAmt);
                return ServerResponse.createByErrorMsg("提现失败,用户可用资金不足");
            log.info("提现前,港币金额={},提现后,港币金额={}",hkAmt,reckon_hkAmt);
            }
            BigDecimal reckonEnableWithdrawAmt = enableWithdrawAmt.subtract(withdrawAmt);
            user.setEnaleWithdrawAmt(reckonEnableWithdrawAmt);
            log.info("提现申请,用户 {} 冻结可取资金,原金额 = {} , 冻结后 = {}", user.getId(), enableWithdrawAmt, reckonEnableWithdrawAmt);
            int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
@@ -305,17 +310,14 @@
            User user = this.userMapper.selectByPrimaryKey(userWithdraw.getUserId());
            user.setUserAmt(user.getUserAmt().add(userWithdraw.getWithAmt()));
            user.setEnableAmt(user.getEnableAmt().add(userWithdraw.getWithAmt()));
            user.setEnaleWithdrawAmt(user.getEnaleWithdrawAmt().add(userWithdraw.getWithAmt()));
            BigDecimal enableWithdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
            user.setEnaleWithdrawAmt(enableWithdrawAmt.add(userWithdraw.getWithAmt()));
            int updateUserCount = this.userMapper.updateByPrimaryKeySelective(user);
            if (updateUserCount > 0) {
                log.info("反还用户资金,总 {} 可用 {}", user.getUserAmt(), user.getEnableAmt());
                log.info("用户取消提现,返还可取资金 {}", userWithdraw.getWithAmt());
                return ServerResponse.createBySuccessMsg("取消成功");
@@ -413,6 +415,7 @@
    }
    @Transactional
    public ServerResponse updateState(Integer withId, Integer state, String authMsg) throws Exception {
        UserWithdraw userWithdraw = this.userWithdrawMapper.selectByPrimaryKey(withId);
@@ -440,6 +443,42 @@
        }
        if (state.intValue() == 1) {
            User user = this.userMapper.selectByPrimaryKey(userWithdraw.getUserId());
            if (user == null) {
                return ServerResponse.createByErrorMsg("用户不存在");
            }
            BigDecimal withAmt = userWithdraw.getWithAmt();
            BigDecimal enableAmt = user.getEnableAmt() == null ? BigDecimal.ZERO : user.getEnableAmt();
            if (enableAmt.compareTo(withAmt) < 0) {
                return ServerResponse.createByErrorMsg("用户可用资金不足,无法完成提现");
            }
            BigDecimal afterEnableAmt = enableAmt.subtract(withAmt);
            user.setEnableAmt(afterEnableAmt);
            log.info("管理员确认提现成功,扣减用户 {} 可用资金,原金额 = {} , 扣减后 = {}", user.getId(), enableAmt, afterEnableAmt);
            int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
            if (updateCount <= 0) {
                throw new Exception("修改用户资金出错,抛出异常");
            }
        }
        if (state.intValue() == 2) {
@@ -451,12 +490,12 @@
            }
            //计算返还的总港币金额
            BigDecimal hkAmt = user.getHkAmt().add(userWithdraw.getWithAmt());
            BigDecimal enableWithdrawAmt = user.getEnaleWithdrawAmt() == null ? BigDecimal.ZERO : user.getEnaleWithdrawAmt();
            BigDecimal refundAmt = enableWithdrawAmt.add(userWithdraw.getWithAmt());
            log.info("管理员确认提现订单失败,返还用户 {} 总资金,原金额 = {} , 返还后 = {}", new Object[]{user.getId(), user.getHkAmt(), hkAmt});
            log.info("管理员确认提现订单失败,返还用户 {} 可取资金,原金额 = {} , 返还后 = {}", user.getId(), enableWithdrawAmt, refundAmt);
            user.setHkAmt(hkAmt);
            user.setEnaleWithdrawAmt(refundAmt);
            int updateCount = this.userMapper.updateByPrimaryKeySelective(user);
            if (updateCount > 0) {
src/main/resources/application.properties
@@ -75,7 +75,7 @@
#site setting
site.email.auth.url=/api/admin/authCharge.do
site.pc.reg.url=/homes/#/register?code=
site.m.reg.url=/wap/#/register?code=
site.m.reg.url=/#/register?code=
#??????
#pc.refresh.time=3000
src/main/resources/mapper/UserRechargeMapper.xml
@@ -221,7 +221,7 @@
  </select>
 <select id="listByAdmin" parameterType="map" resultType="com.nq.pojo.UserRecharge">
 <select id="listByAdmin" parameterType="map" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM user_recharge
target/classes/application.properties
@@ -75,7 +75,7 @@
#site setting
site.email.auth.url=/api/admin/authCharge.do
site.pc.reg.url=/homes/#/register?code=
site.m.reg.url=/wap/#/register?code=
site.m.reg.url=/#/register?code=
#??????
#pc.refresh.time=3000
target/classes/com/nq/service/impl/AgentUserServiceImpl.class
Binary files differ
target/classes/com/nq/service/impl/UserWithdrawServiceImpl.class
Binary files differ
target/classes/mapper/UserRechargeMapper.xml
@@ -221,7 +221,7 @@
  </select>
 <select id="listByAdmin" parameterType="map" resultType="com.nq.pojo.UserRecharge">
 <select id="listByAdmin" parameterType="map" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM user_recharge
target/stock-0.0.1-SNAPSHOT.jar
Binary files differ
target/stock-0.0.1-SNAPSHOT.jar.original
Binary files differ