团队福豆结算
This commit is contained in:
parent
fd35edd27d
commit
9f62e9f0bb
|
|
@ -182,7 +182,7 @@ public class BizMemberController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
//取得当前团队盒数对应分成
|
//取得当前团队盒数对应分成
|
||||||
private long getTeamDou(long totalNum, List<SysDictData> levels, int numLimit)
|
public static long getTeamDou(long totalNum, List<SysDictData> levels, int numLimit)
|
||||||
{
|
{
|
||||||
if (totalNum <= numLimit) return 0L;
|
if (totalNum <= numLimit) return 0L;
|
||||||
for (SysDictData data : levels) {
|
for (SysDictData data : levels) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
package com.ruoyi.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.business.domain.BizTeamReward;
|
||||||
|
import com.ruoyi.business.service.IBizTeamRewardService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队奖励明细Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2020-09-22
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/business/reward")
|
||||||
|
public class BizTeamRewardController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "business/reward";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBizTeamRewardService bizTeamRewardService;
|
||||||
|
|
||||||
|
@RequiresPermissions("business:reward:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String reward()
|
||||||
|
{
|
||||||
|
return prefix + "/reward";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:reward:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BizTeamReward> list = bizTeamRewardService.selectBizTeamRewardList(bizTeamReward);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出团队奖励明细列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:reward:export")
|
||||||
|
@Log(title = "团队奖励明细", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
List<BizTeamReward> list = bizTeamRewardService.selectBizTeamRewardList(bizTeamReward);
|
||||||
|
ExcelUtil<BizTeamReward> util = new ExcelUtil<BizTeamReward>(BizTeamReward.class);
|
||||||
|
return util.exportExcel(list, "reward");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增团队奖励明细
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存团队奖励明细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:reward:add")
|
||||||
|
@Log(title = "团队奖励明细", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
return toAjax(bizTeamRewardService.insertBizTeamReward(bizTeamReward));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团队奖励明细
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
BizTeamReward bizTeamReward = bizTeamRewardService.selectBizTeamRewardById(id);
|
||||||
|
mmap.put("bizTeamReward", bizTeamReward);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存团队奖励明细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:reward:edit")
|
||||||
|
@Log(title = "团队奖励明细", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
return toAjax(bizTeamRewardService.updateBizTeamReward(bizTeamReward));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除团队奖励明细
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:reward:remove")
|
||||||
|
@Log(title = "团队奖励明细", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(bizTeamRewardService.deleteBizTeamRewardByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.ruoyi.business.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队奖励明细对象 biz_team_reward
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2020-09-22
|
||||||
|
*/
|
||||||
|
public class BizTeamReward extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
//团队奖励明细类型
|
||||||
|
public static final int TEAM_REWARD_TYPE_RECOMM = 0;
|
||||||
|
public static final int TEAM_REWARD_TYPE_SECOND = 1;
|
||||||
|
public static final int TEAM_REWARD_TYPE_TEAM = 2;
|
||||||
|
|
||||||
|
/** 团队奖励ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 会员ID */
|
||||||
|
@Excel(name = "会员ID")
|
||||||
|
private Long memberId;
|
||||||
|
|
||||||
|
/** 团队用户ID */
|
||||||
|
@Excel(name = "团队用户ID")
|
||||||
|
private Long rewardMemberId;
|
||||||
|
|
||||||
|
/** 用户购买产品数量 */
|
||||||
|
@Excel(name = "用户购买产品数量")
|
||||||
|
private Long rewardProductCount;
|
||||||
|
|
||||||
|
/** 奖励的福豆数量 */
|
||||||
|
@Excel(name = "奖励的福豆数量")
|
||||||
|
private Long rewardAmount;
|
||||||
|
|
||||||
|
/** 产品ID */
|
||||||
|
@Excel(name = "产品ID")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/** 奖励类型:0:一级直推;1:二级推荐;2:平级; */
|
||||||
|
@Excel(name = "奖励类型:0:一级直推;1:二级推荐;2:团队;")
|
||||||
|
private Integer rewardType;
|
||||||
|
|
||||||
|
/** 奖励日期(xxxx-xx-xx) */
|
||||||
|
@Excel(name = "奖励日期(xxxx-xx-xx)")
|
||||||
|
private String rewardDate;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setMemberId(Long memberId)
|
||||||
|
{
|
||||||
|
this.memberId = memberId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMemberId()
|
||||||
|
{
|
||||||
|
return memberId;
|
||||||
|
}
|
||||||
|
public void setRewardMemberId(Long rewardMemberId)
|
||||||
|
{
|
||||||
|
this.rewardMemberId = rewardMemberId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRewardMemberId()
|
||||||
|
{
|
||||||
|
return rewardMemberId;
|
||||||
|
}
|
||||||
|
public void setRewardProductCount(Long rewardProductCount)
|
||||||
|
{
|
||||||
|
this.rewardProductCount = rewardProductCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRewardProductCount()
|
||||||
|
{
|
||||||
|
return rewardProductCount;
|
||||||
|
}
|
||||||
|
public void setRewardAmount(Long rewardAmount)
|
||||||
|
{
|
||||||
|
this.rewardAmount = rewardAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRewardAmount()
|
||||||
|
{
|
||||||
|
return rewardAmount;
|
||||||
|
}
|
||||||
|
public void setProductId(Long productId)
|
||||||
|
{
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getProductId()
|
||||||
|
{
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
public void setRewardType(Integer rewardType)
|
||||||
|
{
|
||||||
|
this.rewardType = rewardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRewardType()
|
||||||
|
{
|
||||||
|
return rewardType;
|
||||||
|
}
|
||||||
|
public void setRewardDate(String rewardDate)
|
||||||
|
{
|
||||||
|
this.rewardDate = rewardDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRewardDate()
|
||||||
|
{
|
||||||
|
return rewardDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("memberId", getMemberId())
|
||||||
|
.append("rewardMemberId", getRewardMemberId())
|
||||||
|
.append("rewardProductCount", getRewardProductCount())
|
||||||
|
.append("rewardAmount", getRewardAmount())
|
||||||
|
.append("productId", getProductId())
|
||||||
|
.append("rewardType", getRewardType())
|
||||||
|
.append("rewardDate", getRewardDate())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -124,4 +124,21 @@ public interface BizMemberMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateMemberLevel(BizMember bizMember);
|
public int updateMemberLevel(BizMember bizMember);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询需结算团队分成会员列表
|
||||||
|
*
|
||||||
|
* @param minValue 团队分成最少盒数
|
||||||
|
* @return 会员集合
|
||||||
|
*/
|
||||||
|
public List<Map> selectTeamBenefitMember(int minValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询直接下级会员列表
|
||||||
|
*
|
||||||
|
* @param memberID 会员ID
|
||||||
|
* @return 会员ID集合
|
||||||
|
*/
|
||||||
|
public List<Long> selectSubMember(Long memberID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.business.mapper;
|
package com.ruoyi.business.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ruoyi.business.domain.BizOrder;
|
import com.ruoyi.business.domain.BizOrder;
|
||||||
import com.ruoyi.business.domain.BizOrderDetail;
|
import com.ruoyi.business.domain.BizOrderDetail;
|
||||||
|
|
||||||
|
|
@ -67,4 +69,12 @@ public interface BizOrderMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertBizOrderDetail(BizOrderDetail bizOrderDetail);
|
public int insertBizOrderDetail(BizOrderDetail bizOrderDetail);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队订单
|
||||||
|
*
|
||||||
|
* @param memberID 会员ID
|
||||||
|
* @return 订单集合
|
||||||
|
*/
|
||||||
|
public List<Map> selectTeamBizOrder(Long memberID);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.ruoyi.business.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.business.domain.BizTeamReward;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队奖励明细Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2020-09-22
|
||||||
|
*/
|
||||||
|
public interface BizTeamRewardMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细
|
||||||
|
*
|
||||||
|
* @param id 团队奖励明细ID
|
||||||
|
* @return 团队奖励明细
|
||||||
|
*/
|
||||||
|
public BizTeamReward selectBizTeamRewardById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细列表
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 团队奖励明细集合
|
||||||
|
*/
|
||||||
|
public List<BizTeamReward> selectBizTeamRewardList(BizTeamReward bizTeamReward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增团队奖励明细
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBizTeamReward(BizTeamReward bizTeamReward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团队奖励明细
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBizTeamReward(BizTeamReward bizTeamReward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除团队奖励明细
|
||||||
|
*
|
||||||
|
* @param id 团队奖励明细ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBizTeamRewardById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除团队奖励明细
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBizTeamRewardByIds(String[] ids);
|
||||||
|
}
|
||||||
|
|
@ -107,4 +107,12 @@ public interface IBizMemberService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int doSpecialTask();
|
public int doSpecialTask();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行团队福豆分成每日任务
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int doTeamTask();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.ruoyi.business.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.business.domain.BizTeamReward;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队奖励明细Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2020-09-22
|
||||||
|
*/
|
||||||
|
public interface IBizTeamRewardService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细
|
||||||
|
*
|
||||||
|
* @param id 团队奖励明细ID
|
||||||
|
* @return 团队奖励明细
|
||||||
|
*/
|
||||||
|
public BizTeamReward selectBizTeamRewardById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细列表
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 团队奖励明细集合
|
||||||
|
*/
|
||||||
|
public List<BizTeamReward> selectBizTeamRewardList(BizTeamReward bizTeamReward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增团队奖励明细
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBizTeamReward(BizTeamReward bizTeamReward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入团队明细
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void addTeamReward(Long memberID, Long rewardMemberId, Long rewardProductCount, Long rewardAmount, Long productId, int rewardType, String rewardDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团队奖励明细
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBizTeamReward(BizTeamReward bizTeamReward);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除团队奖励明细
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBizTeamRewardByIds(String ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除团队奖励明细信息
|
||||||
|
*
|
||||||
|
* @param id 团队奖励明细ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBizTeamRewardById(Long id);
|
||||||
|
}
|
||||||
|
|
@ -1,26 +1,30 @@
|
||||||
package com.ruoyi.business.service.impl;
|
package com.ruoyi.business.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import com.ruoyi.business.controller.BizMemberController;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ruoyi.business.domain.BizAccount;
|
import com.ruoyi.business.domain.BizAccount;
|
||||||
import com.ruoyi.business.domain.BizAccountDetail;
|
import com.ruoyi.business.domain.BizAccountDetail;
|
||||||
|
import com.ruoyi.business.domain.BizMember;
|
||||||
|
import com.ruoyi.business.domain.BizTeamReward;
|
||||||
import com.ruoyi.business.mapper.BizAccountMapper;
|
import com.ruoyi.business.mapper.BizAccountMapper;
|
||||||
|
import com.ruoyi.business.mapper.BizMemberMapper;
|
||||||
|
import com.ruoyi.business.mapper.BizOrderMapper;
|
||||||
import com.ruoyi.business.service.IBizAccountService;
|
import com.ruoyi.business.service.IBizAccountService;
|
||||||
|
import com.ruoyi.business.service.IBizMemberService;
|
||||||
|
import com.ruoyi.business.service.IBizTeamRewardService;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.system.domain.SysDictData;
|
||||||
import com.ruoyi.system.utils.DictUtils;
|
import com.ruoyi.system.utils.DictUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.business.mapper.BizMemberMapper;
|
|
||||||
import com.ruoyi.business.domain.BizMember;
|
|
||||||
import com.ruoyi.business.service.IBizMemberService;
|
|
||||||
import com.ruoyi.common.core.text.Convert;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员Service业务层处理
|
* 会员Service业务层处理
|
||||||
|
|
@ -34,9 +38,15 @@ public class BizMemberServiceImpl implements IBizMemberService
|
||||||
@Resource
|
@Resource
|
||||||
private BizMemberMapper bizMemberMapper;
|
private BizMemberMapper bizMemberMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
|
private BizOrderMapper bizOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
private IBizAccountService bizAccountService;
|
private IBizAccountService bizAccountService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBizTeamRewardService bizTeamRewardService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BizAccountMapper bizAccountMapper;
|
private BizAccountMapper bizAccountMapper;
|
||||||
|
|
||||||
|
|
@ -253,4 +263,108 @@ public class BizMemberServiceImpl implements IBizMemberService
|
||||||
}
|
}
|
||||||
return accessCount;
|
return accessCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行团队福豆分成每日任务
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int doTeamTask()
|
||||||
|
{
|
||||||
|
//分成标准
|
||||||
|
List<SysDictData> levels = DictUtils.getDictCache("busi_teamaward_level");
|
||||||
|
//分成盒数限制
|
||||||
|
int numLimit = Integer.parseInt(DictUtils.getDictLabel("busi_award_set", "1"));
|
||||||
|
//日期记录上一天的
|
||||||
|
String dateStr = DateUtils.getDate(-1);
|
||||||
|
|
||||||
|
List<Map> memberList = bizMemberMapper.selectTeamBenefitMember(numLimit);
|
||||||
|
int accessCount = 0;
|
||||||
|
for (Map member : memberList) {
|
||||||
|
Long memberID = (Long) member.get("id");
|
||||||
|
Long totalNum = ((BigDecimal) member.get("totalNum")).longValue();
|
||||||
|
long selfDou = BizMemberController.getTeamDou(totalNum, levels, numLimit);
|
||||||
|
|
||||||
|
Map<Long, Map> temp = new HashMap();
|
||||||
|
Map<Long, Integer> numMap = new HashMap();
|
||||||
|
//直接下级列表
|
||||||
|
List<Long> subList = bizMemberMapper.selectSubMember(memberID);
|
||||||
|
for (Long subID : subList) {
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("num", 0);
|
||||||
|
map.put("teamMembers", new ArrayList());
|
||||||
|
temp.put(subID, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map> orderList = bizOrderMapper.selectTeamBizOrder(memberID);
|
||||||
|
int counter = 0; //剔除前numLimit盒
|
||||||
|
for (Map order : orderList) {
|
||||||
|
Long buyerID = (Long) order.get("id");
|
||||||
|
String allID = (String) order.get("all_id");
|
||||||
|
int count = (Integer) order.get("product_count");
|
||||||
|
for (Long subID : subList) {
|
||||||
|
if (buyerID.equals(subID) || testContains(allID, subID)) { //是自己或子级
|
||||||
|
Map subMap = temp.get(subID);
|
||||||
|
int num = (Integer) subMap.get("num");
|
||||||
|
subMap.put("num", num + count);
|
||||||
|
List chList = (List) subMap.get("teamMembers");
|
||||||
|
if (!chList.contains(buyerID)) {
|
||||||
|
chList.add(buyerID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//没到限制盒数的订单剔除掉
|
||||||
|
int oldCount = counter;
|
||||||
|
counter += count;
|
||||||
|
if (counter <= numLimit) continue;
|
||||||
|
if (oldCount <= numLimit) {
|
||||||
|
//有可能一个订单同时包含有效盒和无效盒
|
||||||
|
count = counter - numLimit;
|
||||||
|
}
|
||||||
|
//存入每个团队成员的明细
|
||||||
|
Integer chTotal = (Integer) numMap.get(buyerID);
|
||||||
|
if (chTotal == null) chTotal = 0;
|
||||||
|
chTotal += count;
|
||||||
|
numMap.put(buyerID, chTotal);
|
||||||
|
}
|
||||||
|
//根据直接下级计算数据
|
||||||
|
long totalBenifit = 0L;
|
||||||
|
for (Long subID : subList) {
|
||||||
|
Map subMap = temp.get(subID);
|
||||||
|
int subTeamNum = (Integer) subMap.get("num");
|
||||||
|
//比较subDou和selfDou得出分成数值
|
||||||
|
long subDou = BizMemberController.getTeamDou(subTeamNum, levels, numLimit);
|
||||||
|
long getDou = selfDou - subDou;
|
||||||
|
if (getDou <= 0) continue;
|
||||||
|
List<Long> chList = (List<Long>) subMap.get("teamMembers");
|
||||||
|
//子级用户对数据
|
||||||
|
for (Long chID : chList) {
|
||||||
|
//子级盒数
|
||||||
|
Integer chTotal = numMap.get(chID);
|
||||||
|
if (chTotal == null || chTotal <= 0) continue;
|
||||||
|
long benifit = getDou * chTotal; //该子用户分成
|
||||||
|
//插入数据
|
||||||
|
bizTeamRewardService.addTeamReward(memberID, chID, (long) chTotal, benifit, null, BizTeamReward.TEAM_REWARD_TYPE_TEAM, dateStr);
|
||||||
|
totalBenifit += benifit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//团队福豆及福豆田
|
||||||
|
if (totalBenifit > 0) {
|
||||||
|
accessCount ++;
|
||||||
|
bizAccountService.accountChange(memberID, BizAccount.DOU_TEAM, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, totalBenifit,"", BizAccountDetail.DOU_DESC_TEAM);
|
||||||
|
bizAccountService.accountChange(memberID, BizAccount.DOU_FIELD, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, totalBenifit,"", BizAccountDetail.DOU_DESC_TEAM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return accessCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//测试all包含字符串
|
||||||
|
private boolean testContains(String allID, Long id)
|
||||||
|
{
|
||||||
|
return ("," + allID + ",").indexOf("," + id + ",") >= 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ public class BizOrderServiceImpl implements IBizOrderService
|
||||||
@Resource
|
@Resource
|
||||||
private BizAccountServiceImpl bizAccountService;
|
private BizAccountServiceImpl bizAccountService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BizTeamRewardServiceImpl bizTeamRewardService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询订单
|
* 查询订单
|
||||||
*
|
*
|
||||||
|
|
@ -231,21 +234,26 @@ public class BizOrderServiceImpl implements IBizOrderService
|
||||||
Long recMemberID = member.getRecommendId();
|
Long recMemberID = member.getRecommendId();
|
||||||
if (recMemberID != null && recMemberID != 0) {
|
if (recMemberID != null && recMemberID != 0) {
|
||||||
//取出直推奖励金额
|
//取出直推奖励金额
|
||||||
String award1 = DictUtils.getDictLabel("busi_recommend_award", "1");
|
long award1 = productNum * Long.parseLong(DictUtils.getDictLabel("busi_recommend_award", "1"));
|
||||||
result = bizAccountService.accountChange(memberID, BizAccount.DOU_TEAM, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, Long.parseLong(award1), businessCode, BizAccountDetail.DOU_DESC_RECOMM);
|
result = bizAccountService.accountChange(recMemberID, BizAccount.DOU_TEAM, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, award1, businessCode, BizAccountDetail.DOU_DESC_RECOMM);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return AjaxResult.error("扣款失败,请联系管理员");
|
return AjaxResult.error("扣款失败,请联系管理员");
|
||||||
}
|
}
|
||||||
|
//增加团队积分数据(直推)
|
||||||
|
String dateStr = DateUtils.getDate(-1); //日期记录上一天的
|
||||||
|
bizTeamRewardService.addTeamReward(recMemberID, memberID, (long) productNum, award1, productID, BizTeamReward.TEAM_REWARD_TYPE_RECOMM, dateStr);
|
||||||
//判断二级直推(需要3个下级)
|
//判断二级直推(需要3个下级)
|
||||||
BizMember recommendMember = bizMemberMapper.selectBizMemberSimple(recMemberID);
|
BizMember recommendMember = bizMemberMapper.selectBizMemberSimple(recMemberID);
|
||||||
Long topMemberID = recommendMember.getRecommendId();
|
Long topMemberID = recommendMember.getRecommendId();
|
||||||
//判断有效下级数不少于三个
|
//判断有效下级数不少于三个
|
||||||
if (bizMemberMapper.getValidChildCount(topMemberID) >= BizAccount.SECOND_AWARD_CHILD_LIMIT) {
|
if (recMemberID != null && bizMemberMapper.getValidChildCount(topMemberID) >= BizAccount.SECOND_AWARD_CHILD_LIMIT) {
|
||||||
String award2 = DictUtils.getDictLabel("busi_recommend_award", "2");
|
long award2 = productNum * Long.parseLong(DictUtils.getDictLabel("busi_recommend_award", "2"));
|
||||||
result = bizAccountService.accountChange(memberID, BizAccount.DOU_TEAM, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, Long.parseLong(award2), businessCode, BizAccountDetail.DOU_DESC_SECOND);
|
result = bizAccountService.accountChange(topMemberID, BizAccount.DOU_TEAM, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, award2, businessCode, BizAccountDetail.DOU_DESC_SECOND);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return AjaxResult.error("扣款失败,请联系管理员");
|
return AjaxResult.error("扣款失败,请联系管理员");
|
||||||
}
|
}
|
||||||
|
//增加团队积分数据(二推)
|
||||||
|
bizTeamRewardService.addTeamReward(topMemberID, memberID, (long) productNum, award2, productID, BizTeamReward.TEAM_REWARD_TYPE_SECOND, dateStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.ruoyi.business.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.business.mapper.BizTeamRewardMapper;
|
||||||
|
import com.ruoyi.business.domain.BizTeamReward;
|
||||||
|
import com.ruoyi.business.service.IBizTeamRewardService;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团队奖励明细Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2020-09-22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BizTeamRewardServiceImpl implements IBizTeamRewardService
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private BizTeamRewardMapper bizTeamRewardMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细
|
||||||
|
*
|
||||||
|
* @param id 团队奖励明细ID
|
||||||
|
* @return 团队奖励明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BizTeamReward selectBizTeamRewardById(Long id)
|
||||||
|
{
|
||||||
|
return bizTeamRewardMapper.selectBizTeamRewardById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队奖励明细列表
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 团队奖励明细
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BizTeamReward> selectBizTeamRewardList(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
return bizTeamRewardMapper.selectBizTeamRewardList(bizTeamReward);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增团队奖励明细
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBizTeamReward(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
bizTeamReward.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return bizTeamRewardMapper.insertBizTeamReward(bizTeamReward);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入团队明细
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addTeamReward(Long memberID, Long rewardMemberId, Long rewardProductCount, Long rewardAmount, Long productId, int rewardType, String rewardDate)
|
||||||
|
{
|
||||||
|
BizTeamReward bizTeamReward = new BizTeamReward();
|
||||||
|
bizTeamReward.setMemberId(memberID);
|
||||||
|
bizTeamReward.setRewardMemberId(rewardMemberId);
|
||||||
|
bizTeamReward.setRewardProductCount(rewardProductCount);
|
||||||
|
bizTeamReward.setRewardAmount(rewardAmount);
|
||||||
|
bizTeamReward.setProductId(productId);
|
||||||
|
bizTeamReward.setRewardType(rewardType);
|
||||||
|
bizTeamReward.setRewardDate(rewardDate);
|
||||||
|
bizTeamReward.setCreateTime(new Date());
|
||||||
|
insertBizTeamReward(bizTeamReward);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改团队奖励明细
|
||||||
|
*
|
||||||
|
* @param bizTeamReward 团队奖励明细
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBizTeamReward(BizTeamReward bizTeamReward)
|
||||||
|
{
|
||||||
|
bizTeamReward.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return bizTeamRewardMapper.updateBizTeamReward(bizTeamReward);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除团队奖励明细对象
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBizTeamRewardByIds(String ids)
|
||||||
|
{
|
||||||
|
return bizTeamRewardMapper.deleteBizTeamRewardByIds(Convert.toStrArray(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除团队奖励明细信息
|
||||||
|
*
|
||||||
|
* @param id 团队奖励明细ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBizTeamRewardById(Long id)
|
||||||
|
{
|
||||||
|
return bizTeamRewardMapper.deleteBizTeamRewardById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ public class BusinessTask {
|
||||||
LogUtils.getAccessLog().info("======今日非休息日,开始执行福豆相关任务======");
|
LogUtils.getAccessLog().info("======今日非休息日,开始执行福豆相关任务======");
|
||||||
|
|
||||||
//专项划拨任务
|
//专项划拨任务
|
||||||
doSpecialTask();
|
//doSpecialTask();
|
||||||
|
|
||||||
//团队福豆分成任务
|
//团队福豆分成任务
|
||||||
doTeamTask();
|
doTeamTask();
|
||||||
|
|
@ -69,7 +69,7 @@ public class BusinessTask {
|
||||||
try {
|
try {
|
||||||
int accessCount = bizMemberService.doSpecialTask();
|
int accessCount = bizMemberService.doSpecialTask();
|
||||||
|
|
||||||
LogUtils.getAccessLog().info("======执行专项划拨任务完成,处理会员" + accessCount + "条======");
|
LogUtils.getAccessLog().info("======执行专项划拨任务完成,处理会员数据" + accessCount + "条======");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
LogUtils.getAccessLog().error("======执行专项划拨任务出错======" + ex.getMessage());
|
LogUtils.getAccessLog().error("======执行专项划拨任务出错======" + ex.getMessage());
|
||||||
|
|
@ -80,10 +80,9 @@ public class BusinessTask {
|
||||||
private void doTeamTask()
|
private void doTeamTask()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
int numLimit = Integer.parseInt(DictUtils.getDictLabel("busi_award_set", "1"));
|
int accessCount = bizMemberService.doTeamTask();
|
||||||
|
|
||||||
|
LogUtils.getAccessLog().info("======执行团队福豆分成任务完成,处理会员数据" + accessCount + "条======");
|
||||||
LogUtils.getAccessLog().info("======执行团队福豆分成任务完成======");
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
LogUtils.getAccessLog().error("======执行团队福豆分成任务出错======" + ex.getMessage());
|
LogUtils.getAccessLog().error("======执行团队福豆分成任务出错======" + ex.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -163,4 +163,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
set special_level = #{specialLevel}
|
set special_level = #{specialLevel}
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectTeamBenefitMember" parameterType="Integer" resultType="Map">
|
||||||
|
select id, totalNum from (
|
||||||
|
select t1.id, IF(sum(num) IS NULL,0,sum(num)) totalNum from (
|
||||||
|
select distinct(m1.id) from biz_member m1
|
||||||
|
inner join biz_order o1 on m1.id = o1.member_id and o1.order_status > 0 and o1.is_team = 1
|
||||||
|
where m1.is_delete = 0 and (select count(id) from biz_member m2 where m2.recommend_id=m1.id) >= 3
|
||||||
|
) t1
|
||||||
|
inner join
|
||||||
|
(
|
||||||
|
select a.id, a.recommend_all_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
|
||||||
|
where a.is_delete = 0
|
||||||
|
group by a.id
|
||||||
|
) t2 on concat(',', t2.recommend_all_id, ',') like concat('%', t1.id, '%') and t2.num > 0
|
||||||
|
group by t1.id
|
||||||
|
) t3
|
||||||
|
where totalNum > #{minValue}
|
||||||
|
order by id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSubMember" parameterType="Long" resultType="Long">
|
||||||
|
select id from biz_member where recommend_id = #{memberID}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -156,4 +156,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectTeamBizOrder" parameterType="Long" resultType="Map">
|
||||||
|
select b.id, b.recommend_all_id all_id, c.product_count from biz_order a
|
||||||
|
left join biz_member b on a.member_id = b.id
|
||||||
|
left join (select max(id), order_id, product_id, product_count from biz_order_detail group by order_id) c on a.id = c.order_id
|
||||||
|
where a.order_status > 0 and a.is_team = 1 and concat(',', b.recommend_all_id, ',') like concat('%', #{memberID}, '%')
|
||||||
|
order by a.id asc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.business.mapper.BizTeamRewardMapper">
|
||||||
|
|
||||||
|
<resultMap type="BizTeamReward" id="BizTeamRewardResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="memberId" column="member_id" />
|
||||||
|
<result property="rewardMemberId" column="reward_member_id" />
|
||||||
|
<result property="rewardProductCount" column="reward_product_count" />
|
||||||
|
<result property="rewardAmount" column="reward_amount" />
|
||||||
|
<result property="productId" column="product_id" />
|
||||||
|
<result property="rewardType" column="reward_type" />
|
||||||
|
<result property="rewardDate" column="reward_date" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBizTeamRewardVo">
|
||||||
|
select id, member_id, reward_member_id, reward_product_count, reward_amount, product_id, reward_type, reward_date, create_by, create_time, update_by, update_time from biz_team_reward
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBizTeamRewardList" parameterType="BizTeamReward" resultMap="BizTeamRewardResult">
|
||||||
|
<include refid="selectBizTeamRewardVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="memberId != null "> and member_id = #{memberId}</if>
|
||||||
|
<if test="rewardMemberId != null "> and reward_member_id = #{rewardMemberId}</if>
|
||||||
|
<if test="rewardProductCount != null "> and reward_product_count = #{rewardProductCount}</if>
|
||||||
|
<if test="rewardAmount != null "> and reward_amount = #{rewardAmount}</if>
|
||||||
|
<if test="productId != null "> and product_id = #{productId}</if>
|
||||||
|
<if test="rewardType != null "> and reward_type = #{rewardType}</if>
|
||||||
|
<if test="rewardDate != null and rewardDate != ''"> and reward_date = #{rewardDate}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBizTeamRewardById" parameterType="Long" resultMap="BizTeamRewardResult">
|
||||||
|
<include refid="selectBizTeamRewardVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBizTeamReward" parameterType="BizTeamReward" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into biz_team_reward
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="memberId != null">member_id,</if>
|
||||||
|
<if test="rewardMemberId != null">reward_member_id,</if>
|
||||||
|
<if test="rewardProductCount != null">reward_product_count,</if>
|
||||||
|
<if test="rewardAmount != null">reward_amount,</if>
|
||||||
|
<if test="productId != null">product_id,</if>
|
||||||
|
<if test="rewardType != null">reward_type,</if>
|
||||||
|
<if test="rewardDate != null and rewardDate != ''">reward_date,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="memberId != null">#{memberId},</if>
|
||||||
|
<if test="rewardMemberId != null">#{rewardMemberId},</if>
|
||||||
|
<if test="rewardProductCount != null">#{rewardProductCount},</if>
|
||||||
|
<if test="rewardAmount != null">#{rewardAmount},</if>
|
||||||
|
<if test="productId != null">#{productId},</if>
|
||||||
|
<if test="rewardType != null">#{rewardType},</if>
|
||||||
|
<if test="rewardDate != null and rewardDate != ''">#{rewardDate},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBizTeamReward" parameterType="BizTeamReward">
|
||||||
|
update biz_team_reward
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="memberId != null">member_id = #{memberId},</if>
|
||||||
|
<if test="rewardMemberId != null">reward_member_id = #{rewardMemberId},</if>
|
||||||
|
<if test="rewardProductCount != null">reward_product_count = #{rewardProductCount},</if>
|
||||||
|
<if test="rewardAmount != null">reward_amount = #{rewardAmount},</if>
|
||||||
|
<if test="productId != null">product_id = #{productId},</if>
|
||||||
|
<if test="rewardType != null">reward_type = #{rewardType},</if>
|
||||||
|
<if test="rewardDate != null and rewardDate != ''">reward_date = #{rewardDate},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBizTeamRewardById" parameterType="Long">
|
||||||
|
delete from biz_team_reward where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBizTeamRewardByIds" parameterType="String">
|
||||||
|
delete from biz_team_reward where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
.childDiv{padding:7px 0 0 0}
|
.childDiv{padding:7px 0 0 0}
|
||||||
.childDiv .cont{padding-left: 20px}
|
.childDiv .cont{padding-left: 20px}
|
||||||
.childDiv span{display:block;font-size: 14px;line-height: 24px;padding:0 0 4px 4px;cursor:pointer;border-radius: 5px;border:1px solid #AAAAAA}
|
.childDiv span{display:block;font-size: 14px;line-height: 24px;padding:0 0 4px 4px;cursor:pointer;border-radius: 5px;border:1px solid #AAAAAA}
|
||||||
.childDiv span.noneChild{padding-left: 29px;padding-top: 2px;padding-bottom: 2px}
|
.childDiv span.noneChild{padding-left: 19px;padding-top: 2px;padding-bottom: 2px}
|
||||||
.childDiv span ss{font-family: 宋体}
|
.childDiv span ss{font-family: 宋体}
|
||||||
</style>
|
</style>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.common.utils;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
|
|
@ -50,6 +51,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
return dateTimeNow(YYYY_MM_DD);
|
return dateTimeNow(YYYY_MM_DD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前日期偏差日期, 默认格式为yyyy-MM-dd
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String getDate(int diff)
|
||||||
|
{
|
||||||
|
Calendar now = Calendar.getInstance();
|
||||||
|
now.add(Calendar.DAY_OF_MONTH, diff);
|
||||||
|
return dateTime(now.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
public static final String getTime()
|
public static final String getTime()
|
||||||
{
|
{
|
||||||
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ CREATE TABLE `biz_team_reward` (
|
||||||
`reward_member_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '团队用户ID',
|
`reward_member_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '团队用户ID',
|
||||||
`reward_product_count` int(11) NOT NULL DEFAULT 0 COMMENT '用户购买产品数量',
|
`reward_product_count` int(11) NOT NULL DEFAULT 0 COMMENT '用户购买产品数量',
|
||||||
`reward_amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '奖励的福豆数量',
|
`reward_amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '奖励的福豆数量',
|
||||||
`product_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '产品ID',
|
`product_id` bigint(20) DEFAULT 0 COMMENT '产品ID',
|
||||||
`reward_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '奖励类型:0:一级直推;1:二级推荐;2:平级;',
|
`reward_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '奖励类型:0:一级直推;1:二级推荐;2:平级;',
|
||||||
`reward_date` datetime DEFAULT NULL COMMENT '奖励时间',
|
`reward_date` varchar(10) DEFAULT NULL COMMENT '奖励日期',
|
||||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue