添加管理后台提现

This commit is contained in:
韩鹏辉 2023-07-19 17:05:43 +08:00
parent df77eb28c9
commit 75aa53c0b4
10 changed files with 86 additions and 28 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
/**
* 登录相关接口
@ -141,4 +142,19 @@ public class UserController {
public RespBody getUserBalance(@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId){
return userservice.getUserBalance(userId);
}
/**
* 提现
* @param loginName
* @param token
* @param userId
* @param amount
* @return
*/
@RequestMapping("withdrawalProfit")
public RespBody withdrawalProfit(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId,
@RequestParam("amount") BigDecimal amount
){
return userservice.withdrawalProfit(userId, amount);
}
}

View File

@ -7,15 +7,11 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.admin.system.util.RedisCst;
import com.chaozhanggui.admin.system.util.RedisUtil;
import com.chaozhanggui.admin.system.util.StringUtil;
import com.chaozhanggui.admin.system.util.TokenUtil;
import com.chaozhanggui.common.system.config.RespBody;
import com.chaozhanggui.dao.system.dao.TbPlussCashAccountMapper;
import com.chaozhanggui.dao.system.dao.TbPlussCashMapper;
import com.chaozhanggui.dao.system.dao.TbPlussUserInfoMapper;
import com.chaozhanggui.dao.system.dao.TbPlussUserPromotionMapper;
import com.chaozhanggui.dao.system.entity.TbPlussCash;
import com.chaozhanggui.dao.system.entity.TbPlussUserInfo;
import com.chaozhanggui.dao.system.entity.TbPlussUserPromotion;
import com.chaozhanggui.dao.system.dao.*;
import com.chaozhanggui.dao.system.entity.*;
import com.chaozhanggui.dao.system.model.CashStatus;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -24,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -50,6 +43,10 @@ public class Userservice {
@Autowired
TbPlussCashAccountMapper tbPlussCashAccountMapper;
@Autowired
TbPlussMerchantBaseInfoMapper baseInfoMapper;
public RespBody doLogin(String loginName,String password,String userType,String ip) throws Exception {
Boolean flag=false;
@ -305,6 +302,21 @@ public class Userservice {
public RespBody withdrawalProfit(String userId,BigDecimal amount){
TbPlussUserInfo userInfo= userInfoMapper.selectByPrimaryKey(Long.valueOf(userId));
if(ObjectUtil.isEmpty(userInfo)){
log.error("用户不存在");
return new RespBody("000007");
}
TbPlussMerchantBaseInfo baseInfo= baseInfoMapper.selectByUserId(userId);
if(ObjectUtil.isEmpty(baseInfo)){
log.error("商户信息不存在");
return new RespBody("000031");
}
BigDecimal profit= tbPlussCashMapper.selectByUserId(userId);
BigDecimal fronzenAmt=tbPlussCashMapper.selectCashFrozenAmountByUserId(userId);
@ -316,11 +328,30 @@ public class Userservice {
return new RespBody("000029");
}
TbPlussCashAccount account= tbPlussCashAccountMapper.selectByUserId(userId);
if(ObjectUtil.isEmpty(account)){
log.error("提现账户信息不完整");
return new RespBody("000030");
}
TbPlussCash cash=new TbPlussCash();
return null;
cash.setUserid(Integer.valueOf(userId));
cash.setUsername(userInfo.getTruename());
cash.setMerchantcode(baseInfo.getMerchantcode());
cash.setMerchantname(baseInfo.getMerchantname());
cash.setAccountno(account.getAccountno());
cash.setAccountname(account.getAccountname());
cash.setCashamt(amount);
cash.setCreatedt(new Date());
cash.setCashnumber(StringUtil.getBillno());
cash.setType(1);
cash.setBaseservicecharge(BigDecimal.valueOf(3));
cash.setRatiocharge(cash.getCashamt().multiply(BigDecimal.valueOf(0.08)));
cash.setCashstatus(JSONUtil.toJsonStr(getCashMap(userId,new LinkedList<>())));
tbPlussCashMapper.insert(cash);
return new RespBody("000000");
}

View File

@ -53,7 +53,7 @@ public class PrinterUtils {
private static String getPrintData(OilTicketsDTO oilTicketsDTO) {
StringBuilder builder = new StringBuilder();
builder.append("<F><C>人口买卖</C></F><BR>");
builder.append("<F><C>贩卖刘一帆</C></F><BR>");
builder.append("<F><C>买卖凭票</C></F><BR>");
builder.append(" <BR>");
builder.append("<RS:18><CS:30>人口出售地点:");

View File

@ -25,6 +25,8 @@ public class StringUtil extends StringUtils {
return (intIn17 % 2) >= 1 ? "0" : "1";
}
public static final String letterChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static String random6() {

View File

@ -45,15 +45,14 @@ public class ExceptionUtil {
map.put("000027","提现已被拒绝");
map.put("000028","已被上级审核");
map.put("000029","可提余额不足");
map.put("000030","提现账户信息不完整");
map.put("000031","商户信息存在");
map.put("000030","账户状态异常");
map.put("000031","账户余额不足");
map.put("000032","请求待接受");
map.put("000034","此用户已在黑名单中");
map.put("000035","此用户不在黑名单中");

View File

@ -19,4 +19,6 @@ public interface TbPlussMerchantBaseInfoMapper {
int updateByPrimaryKeySelective(TbPlussMerchantBaseInfo record);
int updateByPrimaryKey(TbPlussMerchantBaseInfo record);
TbPlussMerchantBaseInfo selectByUserId(String userId);
}

View File

@ -106,6 +106,6 @@
<select id="selectByUserId" resultMap="BaseResultMap">
select * from tb_pluss_cash_account where userId=#{userId} group by id desc limit 1
</select>
</mapper>

View File

@ -319,10 +319,10 @@
</select>
<select id="selectCashFrozenAmountByUserId" resultType="java.math.BigDecimal">
select * from tb_pluss_cash c where c.userId=#{userId} and c.`status`=0;
select sum(c.cashAmt) from tb_pluss_cash c where c.userId=#{userId} and c.`status`=0;
</select>
<select id="selectCashAmt" resultType="java.math.BigDecimal">
select * from tb_pluss_cash c where c.userId=#{userId} and c.`status`=1
select sum(c.cashAmt) from tb_pluss_cash c where c.userId=#{userId} and c.`status`=1
</select>
</mapper>

View File

@ -586,4 +586,9 @@
validFlag = #{validflag,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByUserId" resultMap="BaseResultMap">
select * from tb_pluss_merchant_base_info where userId=#{userId}
</select>
</mapper>

View File

@ -549,18 +549,21 @@
p.merchantCode,
p.merchantName,
p.orderNumber,
i.loginName,
u.type_code as typeCode,
p.price,
u.loginName,
m.type_code AS typeCode,
p.createDt,
u.current_fee as currentFee
FROM tb_pluss_merchant_profit p
LEFT JOIN tb_pluss_user_promotion u ON p.userId = u.user_id
left join tb_pluss_user_info i on p.userId=i.id
m.current_fee AS currentFee,
p.consumeFee
FROM
tb_pluss_merchant_profit p
LEFT JOIN tb_pluss_merchant_base_info b ON p.userId = b.userId
LEFT JOIN tb_pluss_user_promotion m ON p.userId = m.user_id
LEFT JOIN tb_pluss_user_info u ON p.userId = u.id
WHERE
p.userId = #{userId}
p.merchantParentId = #{userId}
AND p.price != 0
<if test="orderNumber !=null and orderNumber != ''">
<if test="orderNumber !=null and orderNumber != ''">
and p.orderNumber=#{orderNumber}
</if>