会员架构

This commit is contained in:
Administrator 2020-09-20 23:07:36 +08:00
parent cfc6c69613
commit 8444bc9a02
20 changed files with 414 additions and 16 deletions

View File

@ -1,7 +1,10 @@
package com.ruoyi.business.controller;
import com.ruoyi.business.domain.BizAccountDetail;
import com.ruoyi.business.domain.BizMember;
import com.ruoyi.business.service.IBizAccountService;
import com.ruoyi.business.service.IBizMemberService;
import com.ruoyi.business.service.IBizProductService;
import com.ruoyi.business.utils.Encrypt;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -16,6 +19,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -35,6 +40,12 @@ public class BizMemberController extends BaseController
@Autowired
private IBizMemberService bizMemberService;
@Autowired
private IBizAccountService bizAccountService;
@Autowired
private IBizProductService bizProductService;
@RequiresPermissions("business:member:view")
@GetMapping()
public String member()
@ -55,6 +66,87 @@ public class BizMemberController extends BaseController
return getDataTable(list);
}
/**
* 会员账户明细
*/
@RequiresPermissions("business:member:view")
@GetMapping("/accountDetail")
public String accountDetail(Long memberID, int accountType, ModelMap mmap)
{
BizMember bizMember = bizMemberService.selectBizMemberSimple(memberID);
mmap.put("memberID", memberID);
mmap.put("mobile", bizMember.getMobile());
mmap.put("memberName", bizMember.getMemberName());
mmap.put("accountType", accountType);
return prefix + "/accountDetail";
}
/**
* 查询会员账户明细
*/
@RequiresPermissions("business:member:view")
@PostMapping("/listAccountDetail")
@ResponseBody
public TableDataInfo listAccountDetail(BizAccountDetail bizAccountDetail)
{
startPage();
List<BizAccountDetail> list = bizAccountService.selectBizAccountDetailList(bizAccountDetail);
return getDataTable(list);
}
/**
* 会员架构
*/
@RequiresPermissions("business:member:view")
@GetMapping("/accountTeam")
public String accountTeam(Long memberID, ModelMap mmap)
{
BizMember bizMember = bizMemberService.selectBizMemberSimple(memberID);
mmap.put("memberID", memberID);
mmap.put("memberName", bizMember.getMemberName());
mmap.put("productList", bizProductService.selectTeamProductList());
return prefix + "/accountTeam";
}
/**
* 查询会员架构
*/
@RequiresPermissions("business:member:view")
@PostMapping("/accountTeamDetail")
@ResponseBody
public AjaxResult accountTeamDetail(Long memberID, Long productID)
{
Map paramMap = new HashMap();
paramMap.put("memberID", memberID);
paramMap.put("productID", productID);
List<Map> teamList = bizMemberService.selectTeamData(paramMap);
Map temp = new HashMap();
long teamNum = 0;
//取出架构人员数据
for (Map item : teamList) {
Long rID = (Long) item.get("recommend_id");
List<Map> chList = (List<Map>) temp.get(rID);
if (chList == null) {
chList = new ArrayList();
temp.put(rID, chList);
}
chList.add(item);
teamNum += ((BigDecimal) item.get("num")).longValue();
}
//重组数据
for (Map item : teamList) {
Long id = (Long) item.get("id");
List<Map> chList = (List<Map>) temp.get(id);
if (chList != null) {
item.put("children", chList);
}
}
Map resultMap = new HashMap();
resultMap.put("teamNum", teamNum);
resultMap.put("memberList", temp.get(memberID));
return AjaxResult.success(resultMap);
}
/**
* 导出会员列表
*/

View File

@ -16,7 +16,7 @@ public class BizAccount extends BaseEntity
{
private static final long serialVersionUID = 1L;
//用户豆账户(0-福豆余额1-个人福豆2-团队福豆, 3-福豆田)
//用户豆账户(0-福豆余额1-个人福豆2-团队福豆,3-专项福豆, 4-福豆田)
public static final int DOU_BALANCE = 0;
public static final int DOU_PERSON = 1;
public static final int DOU_TEAM = 2;

View File

@ -60,6 +60,10 @@ public class BizAccountDetail extends BaseEntity
@Excel(name = "变动详情.1充值2:提现3:转账4:冲正5:支付")
private Integer typeDetail;
/** 账户变更金额 */
@Excel(name = "账户变更金额")
private Long amount;
/** 账户变更前金额 */
@Excel(name = "账户变更前金额")
private Long beforeAmount;
@ -140,6 +144,14 @@ public class BizAccountDetail extends BaseEntity
this.beforeAmount = beforeAmount;
}
public Long getAmount() {
return amount;
}
public void setAmount(Long amount) {
this.amount = amount;
}
public Long getBeforeAmount()
{
return beforeAmount;

View File

@ -93,4 +93,11 @@ public interface BizMemberMapper
*/
public int getValidChildCount(Long memberID);
/**
* 取出会员等级明细及商品购买数
*
* @param paramMap
* @return 结果
*/
public List<Map> selectTeamData(Map paramMap);
}

View File

@ -36,6 +36,14 @@ public interface BizProductMapper
*/
public List<BizProduct> selectBizProductList(BizProduct bizProduct);
/**
* 查询团队产品列表
*
* @param
* @return 产品集合
*/
public List<BizProduct> selectTeamProductList();
/**
* 新增产品
*

View File

@ -1,6 +1,7 @@
package com.ruoyi.business.service;
import com.ruoyi.business.domain.BizAccount;
import com.ruoyi.business.domain.BizAccountDetail;
import java.util.List;
@ -60,6 +61,14 @@ public interface IBizAccountService
*/
public int deleteBizAccountById(Long id);
/**
* 查询会员账户明细列表
*
* @param bizAccountDetail 会员账户明细
* @return 会员账户明细集合
*/
public List<BizAccountDetail> selectBizAccountDetailList(BizAccountDetail bizAccountDetail);
/**
* 会员福豆变动明细
*

View File

@ -92,4 +92,11 @@ public interface IBizMemberService
*/
public int deleteBizMemberById(Long id);
/**
* 取出会员等级明细及商品购买数
*
* @param paramMap
* @return 结果
*/
public List<Map> selectTeamData(Map paramMap);
}

View File

@ -28,6 +28,14 @@ public interface IBizProductService
*/
public List<BizProduct> selectBizProductList(BizProduct bizProduct);
/**
* 查询团队产品列表
*
* @param
* @return 产品集合
*/
public List<BizProduct> selectTeamProductList();
/**
* 新增产品
*

View File

@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;
import javax.annotation.Resource;
/**
* 会员账户Service业务层处理
*
@ -22,7 +24,7 @@ import com.ruoyi.common.core.text.Convert;
@Service
public class BizAccountServiceImpl implements IBizAccountService
{
@Autowired
@Resource
private BizAccountMapper bizAccountMapper;
/**
@ -99,6 +101,18 @@ public class BizAccountServiceImpl implements IBizAccountService
return bizAccountMapper.deleteBizAccountById(id);
}
/**
* 查询会员账户明细列表
*
* @param bizAccountDetail 会员账户明细
* @return 会员账户明细集合
*/
public List<BizAccountDetail> selectBizAccountDetailList(BizAccountDetail bizAccountDetail)
{
return bizAccountMapper.selectBizAccountDetailList(bizAccountDetail);
}
/**
* 会员福豆变动明细
*
@ -136,10 +150,11 @@ public class BizAccountServiceImpl implements IBizAccountService
detail.setBusinessNo(businessInfo);
detail.setChangeType(changeType);
detail.setTypeDetail(detailType);
detail.setAmount(money);
detail.setBeforeAmount(beforeMoney);
detail.setAfterAmount(afterMoney);
detail.setChangeDesc(desc);
detail.setUpdateTime(new Date());
detail.setCreateTime(new Date());
bizAccountMapper.insertBizAccountDetail(detail);
return true;
}

View File

@ -8,6 +8,7 @@ import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 会员收货地址Service业务层处理
@ -18,7 +19,7 @@ import java.util.List;
@Service
public class BizMemberAddressServiceImpl implements IBizMemberAddressService
{
@Autowired
@Resource
private BizMemberAddressMapper bizMemberAddressMapper;
/**

View File

@ -189,4 +189,15 @@ public class BizMemberServiceImpl implements IBizMemberService
return bizMemberMapper.deleteBizMemberById(id);
}
/**
* 取出会员等级明细及商品购买数
*
* @param paramMap
* @return 结果
*/
@Override
public List<Map> selectTeamData(Map paramMap)
{
return bizMemberMapper.selectTeamData(paramMap);
}
}

View File

@ -15,6 +15,8 @@ import com.ruoyi.business.domain.BizProduct;
import com.ruoyi.business.service.IBizProductService;
import com.ruoyi.common.core.text.Convert;
import javax.annotation.Resource;
/**
* 产品Service业务层处理
*
@ -24,7 +26,7 @@ import com.ruoyi.common.core.text.Convert;
@Service
public class BizProductServiceImpl implements IBizProductService
{
@Autowired
@Resource
private BizProductMapper bizProductMapper;
/**
@ -72,6 +74,18 @@ public class BizProductServiceImpl implements IBizProductService
return bizProductMapper.selectBizProductList(bizProduct);
}
/**
* 查询团队产品列表
*
* @param
* @return 产品集合
*/
@Override
public List<BizProduct> selectTeamProductList()
{
return bizProductMapper.selectTeamProductList();
}
/**
* 新增产品
*

View File

@ -9,6 +9,8 @@ import com.ruoyi.business.domain.BizProductType;
import com.ruoyi.business.service.IBizProductTypeService;
import com.ruoyi.common.core.text.Convert;
import javax.annotation.Resource;
/**
* 产品分类Service业务层处理
*
@ -18,7 +20,7 @@ import com.ruoyi.common.core.text.Convert;
@Service
public class BizProductTypeServiceImpl implements IBizProductTypeService
{
@Autowired
@Resource
private BizProductTypeMapper bizProductTypeMapper;
/**

View File

@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="businessNo" column="business_no" />
<result property="changeType" column="change_type" />
<result property="typeDetail" column="type_detail" />
<result property="amount" column="amount" />
<result property="beforeAmount" column="before_amount" />
<result property="afterAmount" column="after_amount" />
<result property="changeDesc" column="change_desc" />
@ -48,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBizAccountVo"/>
where id = #{id}
</select>
<insert id="insertBizAccount" parameterType="BizAccount" useGeneratedKeys="true" keyProperty="id">
insert into biz_account
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -97,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectBizAccountDetailList" parameterType="BizAccountDetail" resultMap="BizAccountDetailResult">
select id, member_id, account_id, account_type, business_no, change_type, type_detail, before_amount, after_amount, change_desc, create_by, create_time, update_by, update_time from biz_account_detail
select id, member_id, account_id, account_type, business_no, change_type, type_detail, amount, before_amount, after_amount, change_desc, create_by, create_time, update_by, update_time from biz_account_detail
<where>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="accountId != null "> and account_id = #{accountId}</if>
@ -116,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessNo != null and businessNo != ''">business_no,</if>
<if test="changeType != null">change_type,</if>
<if test="typeDetail != null">type_detail,</if>
<if test="amount != null">amount,</if>
<if test="beforeAmount != null">before_amount,</if>
<if test="afterAmount != null">after_amount,</if>
<if test="changeDesc != null">change_desc,</if>
@ -131,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessNo != null and businessNo != ''">#{businessNo},</if>
<if test="changeType != null">#{changeType},</if>
<if test="typeDetail != null">#{typeDetail},</if>
<if test="amount != null">#{amount},</if>
<if test="beforeAmount != null">#{beforeAmount},</if>
<if test="afterAmount != null">#{afterAmount},</if>
<if test="changeDesc != null">#{changeDesc},</if>

View File

@ -132,4 +132,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and exists(select id from biz_order b where b.member_id = a.id and is_team = 1)
</select>
<select id="selectTeamData" parameterType="Map" resultType="Map">
select a.id,a.member_name,a.recommend_id, sum(IF(c.product_count IS NULL,0,c.product_count)) as num from biz_member a
left join biz_order b on a.id = b.member_id and b.order_status > 0 and b.is_team = 1
left join biz_order_detail c on c.order_id = b.id
<if test="productId != null">and c.product_id = #{productId}</if>
where recommend_all_id like concat('%,', #{memberID}, ',%')
group by a.id,a.member_name,a.recommend_id
</select>
</mapper>

View File

@ -43,6 +43,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by sort desc, id desc
</select>
<select id="selectTeamProductList" resultMap="BizProductResult">
select id, product_name from biz_product where cashback_amount > 0 and online_status = 1 order by sort desc, id desc
</select>
<select id="selectBizProductById" parameterType="Long" resultMap="BizProductResult">
<include refid="selectBizProductVo"/>

View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('会员账户明细列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label style="font-size:20px;width:500px;text-align: left">
<a class="btn btn-success " onclick="history.back()">
<i class="fa fa-reply"></i> 返回
</a>
&nbsp;&nbsp;<span th:text="*{memberName}"></span><span th:text="*{mobile}"></span>
&nbsp;&nbsp;
<select style="font-size: 16px;display: inline" class="form-control" id="accountType" name="accountType" th:value="*{accountType}" onchange="$.table.search()">
<option value="0" th:selected="*{accountType==0}">福豆余额</option>
<option value="1" th:selected="*{accountType==1}">个人福豆</option>
<option value="2" th:selected="*{accountType==2}">团队福豆</option>
<option value="3" th:selected="*{accountType==3}">专项福豆</option>
<option value="4" th:selected="*{accountType==4}">福豆田</option>
</select>
</label>
<input id="memberId" name="memberId" th:value="*{memberID}" type="hidden">
</li>
</ul>
</div>
</form>
</div>
<!--
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="business:detail:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="business:detail:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="business:detail:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="business:detail:export">
<i class="fa fa-download"></i> 导出
</a>
</div>-->
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<style>
.fixed-table-toolbar{height: 0;overflow: hidden}
</style>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('business:detail:edit')}]];
var removeFlag = [[${@permission.hasPermi('business:detail:remove')}]];
var prefix = ctx + "business/member";
$(function() {
var options = {
url: prefix + "/listAccountDetail",
modalName: "会员账户明细",
columns: [
{
field: 'id',
title: '会员账户明细ID',
visible: false
},
{
field: 'typeDetail',
title: '变动类型',
formatter: function(value, row, index) {
switch (value){
case 1:return "账户充值";
case 2:return "账户提现";
case 3:return "转账";
case 4:return "冲正";
case 5:return "支付";
}
}
},
{
field: 'amount',
title: '变更金额',
formatter: function(value, row, index) {
let type = value >= 0;
return "<span style='color:" + (type ? "#00AA00" : "#FF0000") + "'>" + (value > 0 ? "+" : "") + value + "</span>"
}
},
{
field: 'beforeAmount',
title: '变更前金额'
},
{
field: 'afterAmount',
title: '变更后金额'
},
{
field: 'changeDesc',
title: '交易备注'
},
{
field: 'businessNo',
title: '业务相关'
},
{
field: 'createTime',
title: '交易时间'
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('会员架构')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<input id="memberID" th:value="*{memberID}" type="hidden">
<div class="form-group">
<div class="col-sm-8">
<select id="productID" class="form-control" onchange="showTeam(this.value)">
<option th:each="product:${productList}" th:value="*{product.id}" th:text="*{product.productName}"></option>
</select>
</div>
<div class="col-sm-1" style="width: 30%;line-height: 31px;font-size:16px">
团队总盒数:<span id="numSpan">0</span>
</div>
</div>
<div class="form-group">
<div class="col-sm-8">
<div id="teamDiv"></div>
<!--<input name="memberName" th:field="*{memberName}" class="form-control" type="text" required maxlength="10">-->
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "business/member";
$(function() {
showTeam($("#productID").val());
});
//读取团队架构
function showTeam(productID){
$.post(prefix + "/accountTeamDetail", "memberID=" + $("#memberID").val() + "&productID=" + productID, function(resp){
if(resp.code != 0) return;
});
}
//列出子级
function showChildren(){
}
</script>
</body>
</html>

View File

@ -86,27 +86,42 @@
{
field: 'douBalance',
align: 'center',
title: '福豆余额'
title: '福豆余额',
formatter: function(value, row, index) {
return "<a href='javascript:void(0)' onclick='showDetail(" + row.id + ", 0)'>" + value + "</a>";
}
},
{
field: 'douPerson',
align: 'center',
title: '个人福豆'
title: '个人福豆',
formatter: function(value, row, index) {
return "<a href='javascript:void(0)' onclick='showDetail(" + row.id + ", 1)'>" + value + "</a>";
}
},
{
field: 'douTeam',
align: 'center',
title: '团队福豆'
title: '团队福豆',
formatter: function(value, row, index) {
return "<a href='javascript:void(0)' onclick='showDetail(" + row.id + ", 2)'>" + value + "</a>";
}
},
{
field: 'douField',
align: 'center',
title: '福豆田'
title: '福豆田',
formatter: function(value, row, index) {
return "<a href='javascript:void(0)' onclick='showDetail(" + row.id + ", 4)'>" + value + "</a>";
}
},
{
field: 'douSpecial',
align: 'center',
title: '专项福豆'
title: '专项福豆',
formatter: function(value, row, index) {
return "<a href='javascript:void(0)' onclick='showDetail(" + row.id + ", 3)'>" + value + "</a>";
}
},
{
field: 'memberType',
@ -131,7 +146,8 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="updatePwd(\'' + row.id + '\')"><i class="fa fa-cog"></i>修改密码</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="showTeam(\'' + row.id + '\', \'' + row.memberName + row.mobile + '\')"><i class="fa fa-share-alt"></i>会员架构</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="updatePwd(\'' + row.id + '\', \'' + row.memberName + '\')"><i class="fa fa-cog"></i>修改密码</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
@ -141,8 +157,18 @@
$.table.init(options);
});
//查看明细
function showDetail(memberID, accountType){
location.href = prefix + "/accountDetail?memberID=" + memberID + "&accountType=" + accountType;
}
//会员架构
function showTeam(memberID, title){
$.modal.open(title + " 会员架构", prefix + "/accountTeam?memberID=" + memberID);
}
//修改密码
function updatePwd(memberID){
function updatePwd(memberID, memberName){
$.post(prefix + "/showPassword", {
memberID:memberID
}, function(response){
@ -152,7 +178,7 @@
});
let showPwd = function(oldPwd){
$.modal.confirm("<div id='anch'>请输入新的密码<br/><input class='form-control' id='newPwd' value='" + oldPwd + "' maxlength='30'></div>", function() {
$.modal.confirm("<div id='anch'>请输入新的密码&nbsp;&nbsp;" + memberName + "<br/><input class='form-control' id='newPwd' value='" + oldPwd + "' maxlength='30'></div>", function() {
let pwd = $("#newPwd").val();
if(pwd.length == 0){
$.modal.msgError("请输入新密码");

View File

@ -57,6 +57,7 @@ CREATE TABLE `biz_account_detail` (
`business_no` varchar(64) NOT NULL DEFAULT '' COMMENT '业务订单编号: 三方支付/兑现申请/团队明细',
`change_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '变更类型1:收入(加)-1:支出(减)',
`type_detail` tinyint(4) NOT NULL COMMENT '变动详情.1充值2:提现3:转账4:冲正5:支付',
`amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '变更金额',
`before_amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '账户变更前金额',
`after_amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '账户变更后金额',
`change_desc` varchar(64) DEFAULT '' COMMENT '交易备注:充值【一级推荐奖励】,充值【二级推荐奖励】,充值【团队奖励】,充值【专项划拨】,转账【专项划拨】',
@ -152,6 +153,7 @@ CREATE TABLE `biz_order` (
`member_name` varchar(32) NOT NULL DEFAULT '' COMMENT '用户姓名',
`order_amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '订单金额',
`order_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '订单状态0-待支付1-已支付2-已取消, 3-待收货, 4-已完成',
`is_team` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否影响团队福豆',
`address_detail` varchar(64) NOT NULL DEFAULT '' COMMENT '收货地址',
`remark` varchar(100) NOT NULL DEFAULT '' COMMENT '备注',
`address_id` bigint(20) NOT NULL COMMENT '收货人地址ID',