Commit df6b5e42 authored by codezwjava's avatar codezwjava

用户注册时 数据维护

parent c63aee5f
...@@ -14,4 +14,5 @@ public interface CultivatingPrizeInfoMapper extends BaseMapper<CultivatingPrizeI ...@@ -14,4 +14,5 @@ public interface CultivatingPrizeInfoMapper extends BaseMapper<CultivatingPrizeI
CultivatingPrizeInfo getOneByUserId(String userId); CultivatingPrizeInfo getOneByUserId(String userId);
void add(CultivatingPrizeInfo cultivatingPrizeInfo);
} }
...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper; ...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.RecommendUser; import cn.wisenergy.model.app.RecommendUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/** /**
* @author zw * @author zw
...@@ -25,4 +26,11 @@ public interface RecommendUserMapper extends BaseMapper<RecommendUser> { ...@@ -25,4 +26,11 @@ public interface RecommendUserMapper extends BaseMapper<RecommendUser> {
* @return 直推用户总人数 * @return 直推用户总人数
*/ */
Integer getRecommendUserCountByUserId(String userId); Integer getRecommendUserCountByUserId(String userId);
/**
* 新增用户直推信息
* @param recommendUser
* @return
*/
int add(RecommendUser recommendUser);
} }
...@@ -26,4 +26,6 @@ public interface TeamUserInfoMapper extends BaseMapper<TeamUserInfo> { ...@@ -26,4 +26,6 @@ public interface TeamUserInfoMapper extends BaseMapper<TeamUserInfo> {
* @return 团队总人数 * @return 团队总人数
*/ */
Integer getTeamUserCount(String userId); Integer getTeamUserCount(String userId);
void add(TeamUserInfo teamUserInfo);
} }
...@@ -68,4 +68,12 @@ ...@@ -68,4 +68,12 @@
</where> </where>
</select> </select>
<insert id="add" parameterType="cn.wisenergy.model.app.CultivatingPrizeInfo">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value
(<include refid="vals"/>)
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<sql id="vals"> <sql id="vals">
#{userId},#{normalUserNum},#{seedlingNum},#{bronzeTreeNum},#{silverTreeNum}, #{userId},#{normalUserNum},#{seedlingNum},#{bronzeTreeNum},#{silverTreeNum},
#{goldTreeNum},#{farmerNum},#{forestStartNum},#{partnerNum},now(),now(),#{monthy_count},#{history_count} #{goldTreeNum},#{farmerNum},#{forestStartNum},#{partnerNum},now(),now(),#{monthyCount},#{historyCount}
</sql> </sql>
<sql id="updateCondition"> <sql id="updateCondition">
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</where> </where>
</select> </select>
<!--根据用户邀请码更新直推表--> <!--根据用户邀请码更新直推表-->
<select id="zcByUserId" > <select id="zcByUserId" resultType="integer">
select select
id id
from from
...@@ -100,4 +100,11 @@ ...@@ -100,4 +100,11 @@
</where> </where>
</select> </select>
<insert id="add" parameterType="cn.wisenergy.model.app.RecommendUser" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value
(<include refid="vals"/>)
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -93,4 +93,12 @@ ...@@ -93,4 +93,12 @@
user_id=#{userId} user_id=#{userId}
</where> </where>
</select> </select>
<insert id="add" parameterType="cn.wisenergy.model.app.TeamUserInfo" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value
(<include refid="vals"/>)
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -31,7 +31,7 @@ public class RecommendUser implements Serializable { ...@@ -31,7 +31,7 @@ public class RecommendUser implements Serializable {
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty(name = "userId", value = "用户id") @ApiModelProperty(name = "user_id", value = "用户id")
private String userId; private String userId;
/** /**
...@@ -86,19 +86,19 @@ public class RecommendUser implements Serializable { ...@@ -86,19 +86,19 @@ public class RecommendUser implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(name = "createTime", value = "创建时间") @ApiModelProperty(name = "create_time", value = "创建时间")
private Date createTime; private Date createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty(name = "updateTime", value = "更新时间") @ApiModelProperty(name = "update_time", value = "更新时间")
private Date updateTime; private Date updateTime;
/** /**
* 用户当月消费金额 * 用户当月消费金额
*/ */
@ApiModelProperty(name = "monthyCount", value = "用户当月消费金额") @ApiModelProperty(name = "monthy_count", value = "用户当月消费金额")
private BigDecimal monthyCount; private BigDecimal monthyCount;
/** /**
......
...@@ -91,4 +91,6 @@ public interface UserService { ...@@ -91,4 +91,6 @@ public interface UserService {
* @return true or false * @return true or false
*/ */
R<Boolean> fillInInviteCode(String userId, String inviteCode); R<Boolean> fillInInviteCode(String userId, String inviteCode);
Boolean registUserMoudleInit(String userId);
} }
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.*; import cn.wisenergy.common.utils.*;
import cn.wisenergy.mapper.RecommendUserMapper; import cn.wisenergy.mapper.*;
import cn.wisenergy.mapper.TeamUserInfoMapper; import cn.wisenergy.model.app.*;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.RecommendUser;
import cn.wisenergy.model.app.TeamUserInfo;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.app.UsersDto; 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;
...@@ -17,8 +13,11 @@ import lombok.extern.slf4j.Slf4j; ...@@ -17,8 +13,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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 org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -40,6 +39,15 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -40,6 +39,15 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
@Autowired @Autowired
private TeamUserInfoMapper teamUserInfoMapper; private TeamUserInfoMapper teamUserInfoMapper;
@Autowired
private CultivatingPrizeInfoMapper cultivatingPrizeInfoMapper;
@Autowired
private AccountMapper accountMapper;
@Autowired
private TeamPerformanceMapper teamPerformanceMapper;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
...@@ -318,4 +326,80 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -318,4 +326,80 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
} }
return succ; return succ;
} }
/**
* 注册时用户初始化
* @param userId
* @return
*/
@Override
@Transactional
public Boolean registUserMoudleInit(String userId){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
String data = sdf.format(new Date());
try {
//直推用户表维护
RecommendUser recommendUser = new RecommendUser();
recommendUser.setUserId(userId);
recommendUser.setNormalUserNum(0);
recommendUser.setSeedlingNum(0);
recommendUser.setBronzeTreeNum(0);
recommendUser.setSilverTreeNum(0);
recommendUser.setGoldTreeNum(0);
recommendUser.setFarmerNum(0);
recommendUser.setForestStartNum(0);
recommendUser.setPartnerNum(0);
recommendUser.setMonthyCount(new BigDecimal(0));
recommendUser.setHistoryCount(new BigDecimal(0));
recommendUserMapper.add(recommendUser);
//团队用户表数据维护
TeamUserInfo teamUserInfo = new TeamUserInfo();
teamUserInfo.setUserId(userId);
teamUserInfo.setNormalUserNum(0);
teamUserInfo.setSeedlingNum(0);
teamUserInfo.setBronzeTreeNum(0);
teamUserInfo.setSilverTreeNum(0);
teamUserInfo.setGoldTreeNum(0);
teamUserInfo.setFarmerNum(0);
teamUserInfo.setForestStartNum(0);
teamUserInfo.setPartnerNum(0);
teamUserInfoMapper.add(teamUserInfo);
//培育奖记录数据维护
CultivatingPrizeInfo cultivatingPrizeInfo = new CultivatingPrizeInfo();
cultivatingPrizeInfo.setUserId(userId);
cultivatingPrizeInfo.setSeedling(0);
cultivatingPrizeInfo.setBronzeTree(0);
cultivatingPrizeInfo.setSilverTree(0);
cultivatingPrizeInfo.setGoldTree(0);
cultivatingPrizeInfo.setFarmer(0);
cultivatingPrizeInfo.setForestStart(0);
cultivatingPrizeInfo.setPartner(0);
cultivatingPrizeInfoMapper.add(cultivatingPrizeInfo);
//账户表记录数据维护
AccountInfo accountInfo = new AccountInfo();
accountInfo.setUserId(userId);
accountInfo.setUserLevel(0);
accountInfo.setYearMonth(data);
accountInfo.setExtractMoney(new BigDecimal(0));
accountInfo.setEarningsMonth(new BigDecimal(0));
accountInfo.setFrozenMoney(new BigDecimal(0));
accountInfo.setEarningsTotal(new BigDecimal(0));
accountMapper.add(accountInfo);
//团队业绩表数据维护
TeamPerformance teamPerformance = new TeamPerformance();
teamPerformance.setUserId(userId);
teamPerformance.setUserLevel(0);
teamPerformance.setYearMonth(data);
teamPerformance.setMonthTeamPerformance(new BigDecimal(0));
teamPerformanceMapper.add(teamPerformance);
return true;
}catch (Exception e){
return false;
}
}
} }
...@@ -170,4 +170,9 @@ public class UserController extends BaseController { ...@@ -170,4 +170,9 @@ public class UserController extends BaseController {
return userService.fillInInviteCode(userId, inviteCode); return userService.fillInInviteCode(userId, inviteCode);
} }
// @GetMapping("/registUser")
// public void registUserInit(String userId){
// userService.registUserMoudleInit(userId);
// }
} }
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