This commit is contained in:
韩鹏辉 2023-07-21 17:24:39 +08:00
parent 9dab18aafa
commit 1b874a4ac8
11 changed files with 112 additions and 22 deletions

View File

@ -108,6 +108,23 @@ public class UserController {
return userservice.getOutFlow(userId, userName, merchantCode, status, pageNum, pageSize);
}
/**
* 获取提现流水
* @param loginName
* @param token
* @param userId
* @param status
* @param pageNum
* @param pageSize
* @return
*/
@GetMapping("getUserOutFlow")
public RespBody getUserOutFlow(@RequestHeader("loginName") String loginName,@RequestHeader("token") String token,@RequestHeader("userId") String userId
,@RequestParam("status") String status,@RequestParam("pageNum") Integer pageNum
,@RequestParam("pageSize") Integer pageSize
){
return userservice.getUserOutFlow(userId,status,pageNum,pageSize);
}
/**
* 提现审核

View File

@ -153,6 +153,19 @@ public class AgencyService {
public RespBody queryCustormFlow(String userId,String userType,String agencyCode,String isExtend,Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
List<Map<String,Object>> list=userPromotionMapper.selectOrderByUserIdOrAgecyCode(userId,userType,agencyCode,isExtend);
if(ObjectUtil.isNotEmpty(list)&&list.size()>0){
list.stream().forEach(it->{
String id= it.get("id")+"";
Map<String,BigDecimal> map=userPromotionMapper.selectPromotionByUserId(id);
if(ObjectUtil.isNotEmpty(map)&&map.size()>0){
it.put("sumfansShareMoney",map.get("sumfansShareMoney"));
it.put("yestedayShareMoney",map.get("yestedayShareMoney"));
}else {
it.put("sumfansShareMoney",0);
it.put("yestedayShareMoney",0);
}
});
}
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
@ -292,7 +305,7 @@ public class AgencyService {
if(ObjectUtil.isNotEmpty(userPromotion)){
it.setLoginName(userPromotion.getLoginName());
it.setTypeCode(userPromotion.getTypeCode());
it.setCurrentFee(userPromotion.getCurrentFee().toString());
it.setCurrentFee(String.format("%.2f",userPromotion.getCurrentFee()));
}
});

View File

@ -182,6 +182,14 @@ public class Userservice {
}
public RespBody getUserOutFlow(String userId,String status,Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
List<TbPlussCash> list=tbPlussCashMapper.selectCashByUserId(userId,status);
PageInfo pageInfo=new PageInfo(list);
return new RespBody("000000",pageInfo);
}
public RespBody modifyOutFlow(Integer id,String userId,String status) throws Exception{
if(ObjectUtil.isEmpty(id)||ObjectUtil.isEmpty(userId)||ObjectUtil.isEmpty(status)){
@ -321,12 +329,17 @@ public class Userservice {
return new RespBody("000007");
}
TbPlussMerchantBaseInfo baseInfo= baseInfoMapper.selectByUserId(userId);
if(ObjectUtil.isEmpty(baseInfo)){
log.error("商户信息不存在");
return new RespBody("000031");
if(amount.compareTo(BigDecimal.TEN)<0){
log.error("小于最小提现金额");
return new RespBody("000032");
}
// TbPlussMerchantBaseInfo baseInfo= baseInfoMapper.selectByUserId(userId);
// if(ObjectUtil.isEmpty(baseInfo)){
// log.error("商户信息不存在");
// return new RespBody("000031");
// }
BigDecimal profit= tbPlussCashMapper.selectByUserId(userId);
@ -339,29 +352,35 @@ public class Userservice {
return new RespBody("000029");
}
TbPlussCashAccount account= tbPlussCashAccountMapper.selectByUserId(userId);
if(ObjectUtil.isEmpty(account)){
log.error("提现账户信息不完整");
return new RespBody("000030");
TbPlussUserPromotion promotion= userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isEmpty(promotion)){
log.error("用户不存在");
return new RespBody("000007");
}
// TbPlussCashAccount account= tbPlussCashAccountMapper.selectByUserId(userId);
// if(ObjectUtil.isEmpty(account)){
// log.error("提现账户信息不完整");
// return new RespBody("000030");
// }
TbPlussCash cash=new TbPlussCash();
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.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.setStatus(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);
cash.setCashstatus(JSONUtil.toJsonStr(getCashMap(promotion.getParentUserId(),new LinkedList<>())));
tbPlussCashMapper.insertSelective(cash);
return new RespBody("000000");
}
@ -369,7 +388,7 @@ public class Userservice {
public LinkedList<CashStatus> getCashMap(String userId, LinkedList<CashStatus> list){
TbPlussUserPromotion promotion=userPromotionMapper.selectUserProByUserId(userId);
TbPlussUserPromotion promotion=userPromotionMapper.selectByPrimaryKey(Integer.valueOf(userId));
if(ObjectUtil.isNotEmpty(promotion)&&"0".equals(promotion.getParentUserId())){
CashStatus cashStatus=new CashStatus();
cashStatus.setUserId(promotion.getUserId().toString());

View File

@ -8,7 +8,7 @@ server:
# 指定日志级别 把springboot的所有日志修改成为debug
logging:
level:
root: debug
root: info
mybatis:
configuration:
map-underscore-to-camel-case: true

View File

@ -46,14 +46,14 @@ public class ExceptionUtil {
map.put("000028","已被上级审核");
map.put("000029","可提余额不足");
map.put("000030","提现账户信息不完整");
map.put("000031","商户信息存在");
map.put("000031","商户信息不存在");
map.put("000032","小于最小提现金额");
map.put("000032","请求待接受");
map.put("000034","此用户已在黑名单中");
map.put("000035","此用户不在黑名单中");
map.put("000036","多购物车结算禁止使用优惠券");

View File

@ -1,10 +1,12 @@
package com.chaozhanggui.dao.system.dao;
import com.chaozhanggui.dao.system.entity.TbPlussCash;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
@Component
@Mapper
@ -26,4 +28,6 @@ public interface TbPlussCashMapper {
BigDecimal selectCashFrozenAmountByUserId(String userId);
BigDecimal selectCashAmt(String userId);
List<TbPlussCash> selectCashByUserId(@Param("userId") String userId, @Param("status") String status);
}

View File

@ -51,4 +51,6 @@ public interface TbPlussUserPromotionMapper {
TbPlussUserPromotion selectUserPromotionByUserId(@Param("userId") String userId,@Param("orderUserId") String orderUserId);
Map<String,BigDecimal> selectPromotionByUserId(String userId);
}

View File

@ -1,5 +1,7 @@
package com.chaozhanggui.dao.system.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -7,6 +9,9 @@ import java.util.Date;
public class TbPlussCash implements Serializable {
private Integer id;
@TableField(exist = false)
private String loginName;
private Integer userid;
private String username;
@ -246,4 +251,12 @@ public class TbPlussCash implements Serializable {
public void setCashstatusnow(String cashstatusnow) {
this.cashstatusnow = cashstatusnow == null ? null : cashstatusnow.trim();
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
}

View File

@ -315,14 +315,30 @@
</update>
<select id="selectByUserId" resultType="java.math.BigDecimal">
select sum(p.price) from tb_pluss_merchant_profit p where p.type=5 and p.userId=#{userId}
select IFNULL(sum(p.price),0) from tb_pluss_merchant_profit p where p.type=5 and p.userId=#{userId}
</select>
<select id="selectCashFrozenAmountByUserId" resultType="java.math.BigDecimal">
select sum(c.cashAmt) from tb_pluss_cash c where c.userId=#{userId} and c.`status`=0;
select IFNULL(sum(c.cashAmt),0) from tb_pluss_cash c where c.userId=#{userId} and c.`status`=0;
</select>
<select id="selectCashAmt" resultType="java.math.BigDecimal">
select sum(c.cashAmt) from tb_pluss_cash c where c.userId=#{userId} and c.`status`=1
select IFNULL(sum(c.cashAmt),0) from tb_pluss_cash c where c.userId=#{userId} and c.`status`=1
</select>
<select id="selectCashByUserId" resultMap="BaseResultMap">
SELECT
c.*,
o.loginName
FROM
tb_pluss_cash c
LEFT JOIN tb_pluss_user_info o ON c.userId = o.id
WHERE
c.userId = #{userId}
<if test="status !=null and status !=''">
and c.status=#{status}
</if>
ORDER BY
c.id DESC
</select>
</mapper>

View File

@ -548,6 +548,7 @@
<select id="selectProfit" resultType="com.chaozhanggui.dao.system.model.ProfitPO">
SELECT
p.orderNumber,
p.merchantCode,
p.merchantName,
p.price,

View File

@ -461,4 +461,9 @@
and o.merchantCode=#{merchantCode}
</if>
</select>
<select id="selectPromotionByUserId" resultType="java.util.Map">
select * from view_merchant_profit_sum where userId=#{userId}
</select>
</mapper>