Commit a170c801 authored by m1991's avatar m1991

Merge remote-tracking branch 'origin/master'

parents a4c5661e 05d51a6e
...@@ -5,8 +5,6 @@ import cn.wisenergy.model.app.AccountInfo; ...@@ -5,8 +5,6 @@ import cn.wisenergy.model.app.AccountInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Map;
/** /**
* @author 86187 * @author 86187
*/ */
......
...@@ -40,5 +40,5 @@ public interface MonthAwardMapper extends BaseMapper<MonthAward> { ...@@ -40,5 +40,5 @@ public interface MonthAwardMapper extends BaseMapper<MonthAward> {
* @param yearMonth 年月 * @param yearMonth 年月
* @return 月度奖金 * @return 月度奖金
*/ */
MonthAward getByTime(@Param("yearMonth")Date yearMonth); MonthAward getByTime(@Param("yearMonth") String yearMonth);
} }
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<result column="farmer_award" property="farmerAward"/> <result column="farmer_award" property="farmerAward"/>
<result column="forest_start_award" property="forestStartAward"/> <result column="forest_start_award" property="forestStartAward"/>
<result column="partner_award" property="partnerAward"/> <result column="partner_award" property="partnerAward"/>
<result column="year_month" property="yearMonth"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
</resultMap> </resultMap>
...@@ -26,12 +27,12 @@ ...@@ -26,12 +27,12 @@
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
growth_award,award_total,month_award_total,month_increased,gold_award,farmer_award, forest_start_award, growth_award,award_total,month_award_total,month_increased,gold_award,farmer_award, forest_start_award,
partner_award,create_time,update_time partner_award,year_month,create_time,update_time
</sql> </sql>
<sql id="vals"> <sql id="vals">
#{growthAward},#{awardTotal},#{monthAwardTotal},#{monthIncreased},#{goldAward},#{farmerAward}, #{growthAward},#{awardTotal},#{monthAwardTotal},#{monthIncreased},#{goldAward},#{farmerAward},
#{forestStartAward}, #{partnerAward},now(),now() #{forestStartAward}, #{partnerAward},#{yearMonth},now(),now()
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
<if test="farmerAward != null">farmer_award =#{farmerAward},</if> <if test="farmerAward != null">farmer_award =#{farmerAward},</if>
<if test="forestStartAward != null">forest_start_award =#{forestStartAward},</if> <if test="forestStartAward != null">forest_start_award =#{forestStartAward},</if>
<if test="partnerAward != null">partner_award =#{partnerAward},</if> <if test="partnerAward != null">partner_award =#{partnerAward},</if>
<if test="yearMonth != null">year_month =#{yearMonth},</if>
update_time =now() update_time =now()
</sql> </sql>
...@@ -56,6 +58,7 @@ ...@@ -56,6 +58,7 @@
<if test="farmerAward != null">and farmer_award =#{farmerAward}</if> <if test="farmerAward != null">and farmer_award =#{farmerAward}</if>
<if test="forestStartAward != null">and forest_start_award =#{forestStartAward}</if> <if test="forestStartAward != null">and forest_start_award =#{forestStartAward}</if>
<if test="partnerAward != null">and partner_award =#{partnerAward}</if> <if test="partnerAward != null">and partner_award =#{partnerAward}</if>
<if test="yearMonth != null">and year_month =#{yearMonth}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if> <if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if> <if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql> </sql>
...@@ -93,12 +96,11 @@ ...@@ -93,12 +96,11 @@
<include refid="table"/> <include refid="table"/>
<where> <where>
<if test="yearMonth != null"> <if test="yearMonth != null">
YEAR(create_time) = YEAR(#{yearMonth}) year_month=#{yearMonth}
AND MONTH(create_time) = MONTH(#{yearMonth})
</if> </if>
order by create_time desc
limit 1
</where> </where>
order by create_time desc
limit 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -73,6 +73,11 @@ public class MonthAward implements Serializable { ...@@ -73,6 +73,11 @@ public class MonthAward implements Serializable {
@ApiModelProperty(value = "森田合伙人月奖励总额",name="partnerAward") @ApiModelProperty(value = "森田合伙人月奖励总额",name="partnerAward")
private Double partnerAward; private Double partnerAward;
/**
* 时间 :yyyy-MM
*/
@ApiModelProperty(value = "时间 :yyyy-MM",name="yearMonth")
private String yearMonth;
private Date createTime; private Date createTime;
......
package cn.wisenergy.service.app; package cn.wisenergy.service.app;
import org.springframework.stereotype.Service;
/**
* @author 86187
*/
public interface AerialDeliveryUserService { public interface AerialDeliveryUserService {
/** /**
* 空投池用户随机分配推荐人邀请码 * 空投池用户随机分配推荐人邀请码
......
...@@ -16,7 +16,7 @@ public interface TradeRecordService { ...@@ -16,7 +16,7 @@ public interface TradeRecordService {
* *
* @return true or false * @return true or false
*/ */
Boolean monthAwardCount(); R<Boolean> monthAwardCount();
/** /**
* 交易流水列表查询 * 交易流水列表查询
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.MonthAwardMapper; import cn.wisenergy.mapper.MonthAwardMapper;
import cn.wisenergy.mapper.TradeRecordMapper; import cn.wisenergy.mapper.TradeRecordMapper;
...@@ -33,8 +34,9 @@ public class MonthAwardServiceImpl extends ServiceImpl<MonthAwardMapper, MonthAw ...@@ -33,8 +34,9 @@ public class MonthAwardServiceImpl extends ServiceImpl<MonthAwardMapper, MonthAw
} }
//获取本月最新的一条数据 //获取本月最新的一条数据
String yearMonth = DateUtil.convertDateToStr(new Date(), "yyyy-MM");
MonthAwardVo monthAwardVo = new MonthAwardVo(); MonthAwardVo monthAwardVo = new MonthAwardVo();
MonthAward monthAward = baseMapper.getByTime(new Date()); MonthAward monthAward = baseMapper.getByTime(yearMonth);
if (null == monthAward) { if (null == monthAward) {
return R.ok(monthAwardVo); return R.ok(monthAwardVo);
} }
......
...@@ -39,7 +39,7 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade ...@@ -39,7 +39,7 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade
private TradeRecordMapper tradeRecordMapper; private TradeRecordMapper tradeRecordMapper;
@Override @Override
public Boolean monthAwardCount() { public R<Boolean> monthAwardCount() {
MonthAward result = new MonthAward(); MonthAward result = new MonthAward();
//1、获取本月新增奖金 //1、获取本月新增奖金
Double monthGrow = baseMapper.queryMonthGrow(new Date()); Double monthGrow = baseMapper.queryMonthGrow(new Date());
...@@ -63,9 +63,15 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade ...@@ -63,9 +63,15 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade
result.setMonthAwardTotal(monthAwardTotal); result.setMonthAwardTotal(monthAwardTotal);
//4、较上月增长奖金 本月累计奖金-上月累计奖金 //4、较上月增长奖金 本月累计奖金-上月累计奖金
//获取上月 累计奖金 //本月
String currentMonth=DateUtil.convertDateToStr(new Date(),"yyyy-MM");
Date lastDate=DateUtil.getLastMonth(new Date());
String lastMonth=DateUtil.convertDateToStr(lastDate,"yyyy-MM");
Double growthAward; Double growthAward;
MonthAward monthAward = monthAwardMapper.getByTime(date);
//获取上月 累计奖金
MonthAward monthAward = monthAwardMapper.getByTime(lastMonth);
if (null == monthAward) { if (null == monthAward) {
growthAward = monthAwardTotal; growthAward = monthAwardTotal;
} else { } else {
...@@ -75,29 +81,51 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade ...@@ -75,29 +81,51 @@ public class TradeRecordServiceImpl extends ServiceImpl<TradeRecordMapper, Trade
//5、获取黄金树本月奖金 //5、获取黄金树本月奖金
Double goldAward = baseMapper.queryByUserLevel(UserLevelEnum.GOLD_TREE.getCode(), new Date()); Double goldAward = baseMapper.queryByUserLevel(UserLevelEnum.GOLD_TREE.getCode(), new Date());
result.setGoldAward(goldAward); if (null == goldAward) {
result.setGoldAward(0.00);
} else {
result.setGoldAward(goldAward);
}
//6、获取农场主本月奖金 //6、获取农场主本月奖金
Double farmerAward = baseMapper.queryByUserLevel(UserLevelEnum.FARMER.getCode(), new Date()); Double farmerAward = baseMapper.queryByUserLevel(UserLevelEnum.FARMER.getCode(), new Date());
result.setFarmerAward(farmerAward); if (null == farmerAward) {
result.setFarmerAward(0.00);
} else {
result.setFarmerAward(farmerAward);
}
//7、森林之星月奖金 //7、森林之星月奖金
Double startAward = baseMapper.queryByUserLevel(UserLevelEnum.FOREST_START.getCode(), new Date()); Double startAward = baseMapper.queryByUserLevel(UserLevelEnum.FOREST_START.getCode(), new Date());
result.setForestStartAward(startAward); if (null == startAward) {
result.setForestStartAward(0.00);
} else {
result.setForestStartAward(startAward);
}
//8、森田合伙人月奖金 //8、森田合伙人月奖金
Double partnerAward = baseMapper.queryByUserLevel(UserLevelEnum.PARTNER.getCode(), new Date()); Double partnerAward = baseMapper.queryByUserLevel(UserLevelEnum.PARTNER.getCode(), new Date());
result.setPartnerAward(partnerAward); if (null == partnerAward) {
result.setPartnerAward(0.00);
} else {
result.setPartnerAward(partnerAward);
}
//9、 判断是否有本月奖金这条数据,没有,新增,有更新值 //9、 判断是否有本月奖金这条数据,没有,新增,有更新值
MonthAward currentMonth = monthAwardMapper.getByTime(new Date()); MonthAward currentMonthAward = monthAwardMapper.getByTime(currentMonth);
if (null == currentMonth) { if (null == currentMonthAward) {
int count = monthAwardMapper.add(result); int count = monthAwardMapper.add(result);
return count != 0; if (count == 0) {
return R.ok(1, false);
}
} else { } else {
int count = monthAwardMapper.edit(result); int count = monthAwardMapper.edit(result);
return count != 0; if (count == 0) {
return R.ok(1, false);
}
} }
return R.ok(0, true);
} }
@Override @Override
......
...@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
......
...@@ -7,6 +7,7 @@ import cn.wisenergy.model.app.UsersDto; ...@@ -7,6 +7,7 @@ import cn.wisenergy.model.app.UsersDto;
import cn.wisenergy.model.vo.AerialDeliveryVo; import cn.wisenergy.model.vo.AerialDeliveryVo;
import cn.wisenergy.model.vo.UserPoolVo; import cn.wisenergy.model.vo.UserPoolVo;
import cn.wisenergy.service.Manager.RegistUserMoudleInitManager; import cn.wisenergy.service.Manager.RegistUserMoudleInitManager;
import cn.wisenergy.service.app.AerialDeliveryUserService;
import cn.wisenergy.service.app.UserLevelService; import cn.wisenergy.service.app.UserLevelService;
import cn.wisenergy.service.app.UserService; import cn.wisenergy.service.app.UserService;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -47,6 +48,9 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -47,6 +48,9 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Autowired @Autowired
private RegistUserMoudleInitManager registUserMoudleInit; private RegistUserMoudleInitManager registUserMoudleInit;
@Autowired
private AerialDeliveryUserService aerialDeliveryUserService;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
...@@ -124,18 +128,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -124,18 +128,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
String inviteCode = "0"; String inviteCode = "0";
beInvitedCode = "1"; beInvitedCode = "1";
int userLevel = 0; int userLevel = 0;
int frozen=0; int frozen = 0;
String headImage = Constants.Common.HEAD_POTRAIT; String headImage = Constants.Common.HEAD_POTRAIT;
usersMapper.insertbyint(userId, inviteCode, beInvitedCode, userLevel, headImage,frozen); usersMapper.insertbyint(userId, inviteCode, beInvitedCode, userLevel, headImage, frozen);
//初始化六张表 //初始化六张表
registUserMoudleInit.registUserMoudleInit(userId); registUserMoudleInit.registUserMoudleInit(userId);
} else { } else {
//插入用户手机号与推荐人邀请码 //插入用户手机号与推荐人邀请码
String inviteCode = "0"; String inviteCode = "0";
int userLevel = 0; int userLevel = 0;
int frozen=0; int frozen = 0;
String headImage = Constants.Common.HEAD_POTRAIT; String headImage = Constants.Common.HEAD_POTRAIT;
usersMapper.insertbyint(userId, inviteCode, beInvitedCode, userLevel, headImage,frozen); usersMapper.insertbyint(userId, inviteCode, beInvitedCode, userLevel, headImage, frozen);
//初始化六张表 //初始化六张表
registUserMoudleInit.registUserMoudleInit(userId); registUserMoudleInit.registUserMoudleInit(userId);
//用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改 //用户的被邀请码,查询到推荐人用户,根据推荐人用户的邀请码查询/修改
...@@ -159,8 +163,8 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -159,8 +163,8 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
int idbc = Integer.valueOf(idb); int idbc = Integer.valueOf(idb);
//获取注册用户的id //获取注册用户的id
User use= usersMapper.getByUserId(userId); User use = usersMapper.getByUserId(userId);
int ida =use.getId(); int ida = use.getId();
//判断被邀请用户的创建时间是否比推荐人的用户时间晚 //判断被邀请用户的创建时间是否比推荐人的用户时间晚
if (idbc > ida) { if (idbc > ida) {
...@@ -178,14 +182,14 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -178,14 +182,14 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
//根据插入的用户手机号,查询用户唯一ID //根据插入的用户手机号,查询用户唯一ID
if(null== usersMapper.getuserIdById(userId)|| "".equals(usersMapper.getuserIdById(userId))){ if (null == usersMapper.getuserIdById(userId) || "".equals(usersMapper.getuserIdById(userId))) {
Map map =new HashMap(); Map map = new HashMap();
map.put("code",1); map.put("code", 1);
map.put("msg","该用户不存在!"); map.put("msg", "该用户不存在!");
return map; return map;
} }
long yqm=usersMapper.getuserIdById(userId); long yqm = usersMapper.getuserIdById(userId);
//用户唯一ID调用生成6位邀请码 //用户唯一ID调用生成6位邀请码
String inviteCode = ShareCodeUtil.idToCode(yqm); String inviteCode = ShareCodeUtil.idToCode(yqm);
Integer userLevel = 0; Integer userLevel = 0;
...@@ -213,15 +217,17 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -213,15 +217,17 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
if (null == userIdByIntive) { if (null == userIdByIntive) {
R.error(1, "用户推荐人邀请码不存在,请填写正确的邀请码"); R.error(1, "用户推荐人邀请码不存在,请填写正确的邀请码");
} else { } else {
//上级用户的直推信息 普通用户数量+1 // //上级用户的直推信息 普通用户数量+1
RecommendUser recommendUserMapperByUserId = recommendUserMapper.getByUserId(userIdByIntive); // RecommendUser recommendUserMapperByUserId = recommendUserMapper.getByUserId(userIdByIntive);
Integer normalUserNum = recommendUserMapperByUserId.getNormalUserNum(); // Integer normalUserNum = recommendUserMapperByUserId.getNormalUserNum();
recommendUserMapperByUserId.setNormalUserNum(normalUserNum + 1); // recommendUserMapperByUserId.setNormalUserNum(normalUserNum + 1);
recommendUserMapper.updateById(recommendUserMapperByUserId); // recommendUserMapper.updateById(recommendUserMapperByUserId);
//通过用户的userid和推荐人邀请码 设置当前用户的上级直推数据和当前用户所在团队的团队数据
aerialDeliveryUserService.userSetBeinviteCode(userId,beInvitedCode);
} }
//递归向上修改团队用户信息表 //递归向上修改团队用户信息表
teamUserInfo(beInvitedCode); // teamUserInfo(beInvitedCode);
Map map = new HashMap(); Map map = new HashMap();
R.ok("注册成功!", 0); R.ok("注册成功!", 0);
map.put("code", 0); map.put("code", 0);
...@@ -317,7 +323,10 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -317,7 +323,10 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return R.error("推荐人不能是自己!"); return R.error("推荐人不能是自己!");
} }
//4、设置用户被邀请码 //更新推荐用户的等级或者直推人数
aerialDeliveryUserService.userSetBeinviteCode(userId, userCode.getUserId());
//5、设置用户被邀请码
user.setBeInvitedCode(inviteCode); user.setBeInvitedCode(inviteCode);
int count = usersMapper.edit(user); int count = usersMapper.edit(user);
if (count == 0) { if (count == 0) {
......
...@@ -12,7 +12,6 @@ import cn.wisenergy.model.vo.UserLoginVo; ...@@ -12,7 +12,6 @@ import cn.wisenergy.model.vo.UserLoginVo;
import cn.wisenergy.model.vo.UserRegisterVo; import cn.wisenergy.model.vo.UserRegisterVo;
import cn.wisenergy.service.app.LoginService; import cn.wisenergy.service.app.LoginService;
import cn.wisenergy.service.app.UserService; import cn.wisenergy.service.app.UserService;
import cn.wisenergy.web.config.JwtConfig;
import cn.wisenergy.web.shiro.JwtUtil; import cn.wisenergy.web.shiro.JwtUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
...@@ -3,7 +3,6 @@ package cn.wisenergy.web.admin.controller.app; ...@@ -3,7 +3,6 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.TradeRecord; import cn.wisenergy.model.app.TradeRecord;
import cn.wisenergy.model.dto.TradeRecordQuery; import cn.wisenergy.model.dto.TradeRecordQuery;
import cn.wisenergy.model.vo.TaxRateVo;
import cn.wisenergy.service.app.TradeRecordService; import cn.wisenergy.service.app.TradeRecordService;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -12,6 +11,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -12,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -33,4 +33,12 @@ public class TradeRecordController { ...@@ -33,4 +33,12 @@ public class TradeRecordController {
log.info("shop-mall[]TradeRecordController[]queryList[]input.param.query:" + query); log.info("shop-mall[]TradeRecordController[]queryList[]input.param.query:" + query);
return tradeRecordService.queryList(query); return tradeRecordService.queryList(query);
} }
@ApiOperation(value = "统计月度奖金", notes = "统计月度奖金", httpMethod = "POST")
@PostMapping("/monthAwardCount")
public R<Boolean> monthAwardCount() {
log.info("shop-mall[]TradeRecordController[]monthAwardCount[]input.method");
return tradeRecordService.monthAwardCount();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment