Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
data-server
Commits
72fc0552
Commit
72fc0552
authored
Feb 27, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
月度肥料接口实现
parent
dcaeace6
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
426 additions
and
134 deletions
+426
-134
MemberPercentMapper.java
...rc/main/java/cn/wisenergy/mapper/MemberPercentMapper.java
+9
-7
ShopZxMapper.java
...apper/src/main/java/cn/wisenergy/mapper/ShopZxMapper.java
+1
-3
TeamPerformanceMapper.java
.../main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
+29
-0
UsersMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
+6
-0
MemberPercentMapper.xml
...-mapper/src/main/resources/mapper/MemberPercentMapper.xml
+22
-8
ShopZxMapper.xml
wisenergy-mapper/src/main/resources/mapper/ShopZxMapper.xml
+1
-1
TeamPerformanceMapper.xml
...apper/src/main/resources/mapper/TeamPerformanceMapper.xml
+109
-0
UsersMapper.xml
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+10
-0
MemberPercent.java
...l/src/main/java/cn/wisenergy/model/app/MemberPercent.java
+9
-3
TeamPerformance.java
...src/main/java/cn/wisenergy/model/app/TeamPerformance.java
+64
-0
shopZx.java
...gy-model/src/main/java/cn/wisenergy/model/app/shopZx.java
+2
-78
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+23
-8
PublicManager.java
...main/java/cn/wisenergy/service/Manager/PublicManager.java
+32
-0
AccountService.java
...rc/main/java/cn/wisenergy/service/app/AccountService.java
+1
-1
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+1
-2
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+107
-19
UserServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
+0
-4
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/
Rebate
Mapper.java
→
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/
MemberPercent
Mapper.java
View file @
72fc0552
package
cn
.
wisenergy
.
mapper
;
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.
Rebate
;
import
cn.wisenergy.model.app.
MemberPercent
;
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
;
/**
/**
* @author 86187
* @author 86187
*/
*/
public
interface
RebateMapper
extends
BaseMapper
<
Rebate
>
{
public
interface
MemberPercentMapper
extends
BaseMapper
<
MemberPercent
>
{
/**
/**
*
*
* @param
rebate
入参
* @param
memberpercent
入参
* @return 1
* @return 1
*/
*/
int
add
(
Rebate
rebate
);
int
add
(
MemberPercent
memberpercent
);
/**
/**
* 编辑
* 编辑
* @param
rebate
入参
* @param
memberpercent
入参
* @return 1
* @return 1
*/
*/
int
edit
(
Rebate
rebate
);
int
edit
(
MemberPercent
memberpercent
);
/**
/**
* 删除
* 删除
...
@@ -34,6 +34,8 @@ public interface RebateMapper extends BaseMapper<Rebate> {
...
@@ -34,6 +34,8 @@ public interface RebateMapper extends BaseMapper<Rebate> {
* @param userLevel 会员等级
* @param userLevel 会员等级
* @return 返佣比例
* @return 返佣比例
*/
*/
Rebate
getByLevel
(
@Param
(
"userLevel"
)
Integer
userLevel
);
MemberPercent
getByLevel
(
@Param
(
"userLevel"
)
Integer
userLevel
);
MemberPercent
getByLevelAndType
(
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"type"
)
Integer
type
);
}
}
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/ShopZxMapper.java
View file @
72fc0552
package
cn
.
wisenergy
.
mapper
;
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.app.shopZx
;
import
cn.wisenergy.model.app.shopZx
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.mapstruct.TargetType
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* Created by m1991 on 2021/2/24 14:50
* Created by m1991 on 2021/2/24 14:50
...
...
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
0 → 100644
View file @
72fc0552
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.TeamPerformance
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
/**
* @author 86187
*/
public
interface
TeamPerformanceMapper
extends
BaseMapper
<
TeamPerformance
>
{
int
add
(
TeamPerformance
teamPerformance
);
int
edit
(
TeamPerformance
teamPerformance
);
int
delById
(
@Param
(
"id"
)
Integer
id
);
TeamPerformance
getByUserIdAndTime
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"yearMonth"
)
Date
yearMonth
);
/**
* 统计
* @param userLevel 等级
* @param yearMonth 年月
* @return 等级总金额
*/
Double
countTeamMoney
(
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"yearMonth"
)
Date
yearMonth
);
}
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
View file @
72fc0552
...
@@ -62,4 +62,10 @@ public interface UsersMapper extends BaseMapper<User> {
...
@@ -62,4 +62,10 @@ public interface UsersMapper extends BaseMapper<User> {
*/
*/
User
getByBeInvitedCode
(
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
User
getByBeInvitedCode
(
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
/**
* 获取黄金树以上会员用户
* @return
*/
List
<
User
>
getAllGoldUser
();
}
}
wisenergy-mapper/src/main/resources/mapper/
Rebate
Mapper.xml
→
wisenergy-mapper/src/main/resources/mapper/
MemberPercent
Mapper.xml
View file @
72fc0552
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.wisenergy.mapper.
Rebate
Mapper"
>
<mapper
namespace=
"cn.wisenergy.mapper.
MemberPercent
Mapper"
>
<resultMap
id=
"userMap"
type=
"cn.wisenergy.model.app.
Rebate
"
>
<resultMap
id=
"userMap"
type=
"cn.wisenergy.model.app.
MemberPercent
"
>
<id
column=
"id"
property=
"id"
/>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_level"
property=
"userLevel"
/>
<result
column=
"user_level"
property=
"userLevel"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"percent"
property=
"percent"
/>
<result
column=
"percent"
property=
"percent"
/>
<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>
<sql
id=
"table"
>
<sql
id=
"table"
>
rebate
member_percent
</sql>
</sql>
<sql
id=
"cols_all"
>
<sql
id=
"cols_all"
>
...
@@ -20,15 +21,16 @@
...
@@ -20,15 +21,16 @@
</sql>
</sql>
<sql
id=
"cols_exclude_id"
>
<sql
id=
"cols_exclude_id"
>
user_level,percent,create_time,update_time
user_level,
type,
percent,create_time,update_time
</sql>
</sql>
<sql
id=
"vals"
>
<sql
id=
"vals"
>
#{userLevel},#{percent},now(),now()
#{userLevel},#{
type},#{
percent},now(),now()
</sql>
</sql>
<sql
id=
"updateCondition"
>
<sql
id=
"updateCondition"
>
<if
test=
"userLevel != null"
>
user_level = #{userLevel},
</if>
<if
test=
"userLevel != null"
>
user_level = #{userLevel},
</if>
<if
test=
"type != null"
>
type = #{type},
</if>
<if
test=
"percent != null"
>
percent =#{percent},
</if>
<if
test=
"percent != null"
>
percent =#{percent},
</if>
update_time =now()
update_time =now()
</sql>
</sql>
...
@@ -36,12 +38,13 @@
...
@@ -36,12 +38,13 @@
<sql
id=
"criteria"
>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"userLevel != null"
>
and user_level = #{userLevel}
</if>
<if
test=
"userLevel != null"
>
and user_level = #{userLevel}
</if>
<if
test=
"type != null"
>
and type = #{type}
</if>
<if
test=
"percent != null"
>
and percent =#{percent}
</if>
<if
test=
"percent != null"
>
and percent =#{percent}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
</sql>
<insert
id=
"add"
parameterType=
"cn.wisenergy.model.app.
Rebate
"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"add"
parameterType=
"cn.wisenergy.model.app.
MemberPercent
"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into
insert into
<include
refid=
"table"
/>
<include
refid=
"table"
/>
(
<include
refid=
"cols_exclude_id"
/>
)
(
<include
refid=
"cols_exclude_id"
/>
)
...
@@ -50,7 +53,7 @@
...
@@ -50,7 +53,7 @@
)
)
</insert>
</insert>
<update
id=
"edit"
parameterType=
"cn.wisenergy.model.app.
Rebate
"
>
<update
id=
"edit"
parameterType=
"cn.wisenergy.model.app.
MemberPercent
"
>
UPDATE
UPDATE
<include
refid=
"table"
/>
<include
refid=
"table"
/>
<set>
<set>
...
@@ -67,7 +70,7 @@
...
@@ -67,7 +70,7 @@
where id = #{id}
where id = #{id}
</delete>
</delete>
<select
id=
"getByLevel"
resultType=
"cn.wisenergy.model.app.
Rebate
"
>
<select
id=
"getByLevel"
resultType=
"cn.wisenergy.model.app.
MemberPercent
"
>
select
select
<include
refid=
"cols_all"
/>
<include
refid=
"cols_all"
/>
from
from
...
@@ -77,4 +80,15 @@
...
@@ -77,4 +80,15 @@
</where>
</where>
</select>
</select>
<select
id=
"getByLevelAndType"
resultType=
"cn.wisenergy.model.app.MemberPercent"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
user_level=#{userLevel}
and type=#{type}
</where>
</select>
</mapper>
</mapper>
wisenergy-mapper/src/main/resources/mapper/ShopZxMapper.xml
View file @
72fc0552
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<!--</insert>-->
<!--</insert>-->
<!--资讯内容倒叙查询-->
<!--资讯内容倒叙查询-->
<select
id=
"selectAll"
parameterType=
"cn.wisenergy.model.app.shopZx"
>
<select
id=
"selectAll"
parameterType=
"cn.wisenergy.model.app.shopZx"
resultType=
"cn.wisenergy.model.app.shopZx"
>
select zxid as zxid,zxUrl as zxUrl,
select zxid as zxid,zxUrl as zxUrl,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxLikes as zxLikes,userid as userid,zxName as zxName,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
zxShenHe as zxShenHe,zxField as zxField,zxDate as zxDate,
...
...
wisenergy-mapper/src/main/resources/mapper/TeamPerformanceMapper.xml
0 → 100644
View file @
72fc0552
<?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=
"cn.wisenergy.mapper.TeamPerformanceMapper"
>
<resultMap
id=
"monthMap"
type=
"cn.wisenergy.model.app.TeamPerformance"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"user_level"
property=
"userLevel"
/>
<result
column=
"year_month"
property=
"yearMonth"
/>
<result
column=
"month_team_performance"
property=
"monthTeamPerformance"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"table"
>
team_performance
</sql>
<sql
id=
"cols_all"
>
id,
<include
refid=
"cols_exclude_id"
/>
</sql>
<sql
id=
"cols_exclude_id"
>
user_id,user_level,year_month,month_team_performance,create_time,update_time
</sql>
<sql
id=
"vals"
>
#{userId},#{userLevel},#{yearMonth},#{monthTeamPerformance},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"userId != null"
>
month_manure_total = #{userId},
</if>
<if
test=
"userLevel != null"
>
user_level = #{userLevel},
</if>
<if
test=
"yearMonth != null"
>
year_month =#{yearMonth},
</if>
<if
test=
"monthTeamPerformance != null"
>
month_team_performance =#{monthTeamPerformance},
</if>
update_time =now()
</sql>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"userId != null"
>
and month_manure_total = #{userId}
</if>
<if
test=
"userLevel != null"
>
and user_level = #{userLevel}
</if>
<if
test=
"yearMonth != null"
>
and year_month =#{yearMonth}
</if>
<if
test=
"monthTeamPerformance != null"
>
and month_team_performance =#{monthTeamPerformance}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
<insert
id=
"add"
parameterType=
"cn.wisenergy.model.app.TeamPerformance"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into
<include
refid=
"table"
/>
(
<include
refid=
"cols_exclude_id"
/>
)
value(
<include
refid=
"vals"
/>
)
</insert>
<update
id=
"edit"
parameterType=
"cn.wisenergy.model.app.TeamPerformance"
>
UPDATE
<include
refid=
"table"
/>
<set>
<include
refid=
"updateCondition"
/>
</set>
<where>
id = #{id}
</where>
</update>
<delete
id=
"delById"
parameterType=
"java.lang.Integer"
>
delete from
<include
refid=
"table"
/>
where id = #{id}
</delete>
<select
id=
"getByUserIdAndTime"
resultType=
"cn.wisenergy.model.app.TeamPerformance"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"userId != null"
>
user_id = #{userId}
</if>
<if
test=
"yearMonth != null"
>
AND(
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if>
</where>
</select>
<select
id=
"countTeamMoney"
resultType=
"java.lang.Double"
>
select
sum(month_team_performance)
from
<include
refid=
"table"
/>
<where>
<if
test=
"userLevel != null"
>
user_level = #{userLevel}
</if>
<if
test=
"yearMonth != null"
>
AND(
YEAR(year_month) = YEAR(#{yearMonth})
AND MONTH(year_month) = MONTH(#{yearMonth}))
</if>
</where>
</select>
</mapper>
\ No newline at end of file
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
View file @
72fc0552
...
@@ -166,6 +166,16 @@
...
@@ -166,6 +166,16 @@
</where>
</where>
</select>
</select>
<select
id=
"getAllGoldUser"
resultType=
"cn.wisenergy.model.app.User"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
user_level >3
</where>
</select>
<!--用户添加-->
<!--用户添加-->
<insert
id=
"save"
>
<insert
id=
"save"
>
insert into user(user_id,password) value (#{userId},#{password})
insert into user(user_id,password) value (#{userId},#{password})
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/
Rebate
.java
→
wisenergy-model/src/main/java/cn/wisenergy/model/app/
MemberPercent
.java
View file @
72fc0552
...
@@ -10,13 +10,14 @@ import java.util.Date;
...
@@ -10,13 +10,14 @@ import java.util.Date;
/**
/**
* @author 86187
* @author 86187
* @ Description:
返佣表实体类
* @ Description:
会员等级优惠百分比
* @ Author : 86187
* @ Author : 86187
* @ Date : 2021/2/22 11:05
* @ Date : 2021/2/22 11:05
*/
*/
@Data
@Data
@ApiModel
(
"Rebate"
)
@ApiModel
(
"MemberPercent"
)
public
class
Rebate
implements
Serializable
{
public
class
MemberPercent
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3829843983637924282L
;
/**
/**
* 返佣id
* 返佣id
*/
*/
...
@@ -28,6 +29,11 @@ public class Rebate implements Serializable {
...
@@ -28,6 +29,11 @@ public class Rebate implements Serializable {
*/
*/
@ApiModelProperty
(
name
=
"userLevel"
,
value
=
"用户会员等级"
)
@ApiModelProperty
(
name
=
"userLevel"
,
value
=
"用户会员等级"
)
private
Integer
userLevel
;
private
Integer
userLevel
;
/**
* 会员等级百分比类型:1:返佣 2:月度肥料 3:月度最大进步奖 4:运营中心补贴
*/
@ApiModelProperty
(
name
=
"type"
,
value
=
"会员等级百分比类型:1:返佣 2:月度肥料 3:月度最大进步奖 4:运营中心补贴"
)
private
Integer
type
;
/**
/**
* 等级对应的返佣比例
* 等级对应的返佣比例
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/TeamPerformance.java
0 → 100644
View file @
72fc0552
package
cn
.
wisenergy
.
model
.
app
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @author 86187
* @ Description: 团队业绩实体类
* @ Author : 86187
* @ Date : 2021/2/26 16:31
*/
@Data
@ApiModel
(
"TeamPerformance"
)
public
class
TeamPerformance
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3124781800304763059L
;
/**
* 主键id
*/
@ApiModelProperty
(
value
=
"主键id"
,
name
=
"id"
)
private
Integer
id
;
/**
* 用户id
*/
@ApiModelProperty
(
value
=
"用户id"
,
name
=
"userId"
)
private
String
userId
;
/**
* 用户等级
*/
@ApiModelProperty
(
value
=
"用户等级"
,
name
=
"userLevel"
)
private
Integer
userLevel
;
/**
* 年-月
*/
@ApiModelProperty
(
value
=
"年-月"
,
name
=
"yearMonth"
)
private
Date
yearMonth
;
/**
* 本月团队业绩
*/
@ApiModelProperty
(
value
=
"本月团队业绩"
,
name
=
"monthTeamPerformance"
)
private
BigDecimal
monthTeamPerformance
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
Date
createTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
,
name
=
"updateTime"
)
private
Date
updateTime
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/app/shopZx.java
View file @
72fc0552
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
...
@@ -67,7 +68,7 @@ public class shopZx extends Model<shopZx> implements Serializable{
...
@@ -67,7 +68,7 @@ public class shopZx extends Model<shopZx> implements Serializable{
* 资讯数据创建时间
* 资讯数据创建时间
*/
*/
@ApiModelProperty
(
name
=
"zxDate"
,
value
=
"资讯数据创建时间"
)
@ApiModelProperty
(
name
=
"zxDate"
,
value
=
"资讯数据创建时间"
)
private
Dat
a
zxDate
;
private
Dat
e
zxDate
;
/**
/**
* 图片存放地址
* 图片存放地址
...
@@ -80,81 +81,4 @@ public class shopZx extends Model<shopZx> implements Serializable{
...
@@ -80,81 +81,4 @@ public class shopZx extends Model<shopZx> implements Serializable{
*/
*/
@ApiModelProperty
(
name
=
"zxAddress"
,
value
=
"用户发布地址"
)
@ApiModelProperty
(
name
=
"zxAddress"
,
value
=
"用户发布地址"
)
private
String
zxAddress
;
private
String
zxAddress
;
public
Data
getZxDate
()
{
return
zxDate
;
}
public
void
setZxDate
(
Data
zxDate
)
{
this
.
zxDate
=
zxDate
;
}
public
Integer
getZxid
()
{
return
zxid
;
}
public
void
setZxid
(
Integer
zxid
)
{
this
.
zxid
=
zxid
;
}
public
String
getZxUrl
()
{
return
zxUrl
;
}
public
void
setZxUrl
(
String
zxUrl
)
{
this
.
zxUrl
=
zxUrl
;
}
public
String
getUserid
()
{
return
userid
;
}
public
void
setUserid
(
String
userid
)
{
this
.
userid
=
userid
;
}
public
Integer
getZxLikes
()
{
return
zxLikes
;
}
public
void
setZxLikes
(
Integer
zxLikes
)
{
this
.
zxLikes
=
zxLikes
;
}
public
String
getZxName
()
{
return
zxName
;
}
public
void
setZxName
(
String
zxName
)
{
this
.
zxName
=
zxName
;
}
public
Integer
getZxShenHe
()
{
return
zxShenHe
;
}
public
void
setZxShenHe
(
Integer
zxShenHe
)
{
this
.
zxShenHe
=
zxShenHe
;
}
public
String
getZxField
()
{
return
zxField
;
}
public
void
setZxField
(
String
zxField
)
{
this
.
zxField
=
zxField
;
}
@Override
public
String
toString
()
{
return
"shopzx{"
+
"zxid="
+
zxid
+
", zxUrl="
+
zxUrl
+
", userid="
+
userid
+
", zxLikes="
+
zxLikes
+
", zxName="
+
zxName
+
", zxShenHe="
+
zxShenHe
+
", zxField="
+
zxField
+
"}"
;
}
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/
common
/AccountManager.java
→
wisenergy-service/src/main/java/cn/wisenergy/service/
Manager
/AccountManager.java
View file @
72fc0552
package
cn
.
wisenergy
.
service
.
common
;
package
cn
.
wisenergy
.
service
.
Manager
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.OrderMapper
;
import
cn.wisenergy.mapper.OrderMapper
;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.app.OrderInfo
;
import
cn.wisenergy.model.app.Rebate
;
import
cn.wisenergy.model.app.TradeRecord
;
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.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
/**
* @author 86187
* @author 86187
...
@@ -33,15 +32,21 @@ public class AccountManager {
...
@@ -33,15 +32,21 @@ public class AccountManager {
@Autowired
@Autowired
private
TradeRecordMapper
recordMapper
;
private
TradeRecordMapper
recordMapper
;
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateOrderAddMoney
(
OrderInfo
orderInfo
,
AccountInfo
accountInfo
,
Rebate
rebate
)
{
public
Boolean
updateOrderAddMoney
(
OrderInfo
orderInfo
,
AccountInfo
accountInfo
,
MemberPercent
memberpercent
)
{
//1、计算返佣金额
//1、计算返佣金额
BigDecimal
bigDecimal
=
orderInfo
.
getPayment
().
multiply
(
rebate
.
getPercent
());
BigDecimal
bigDecimal
=
orderInfo
.
getPayment
().
multiply
(
memberpercent
.
getPercent
());
BigDecimal
extractMoney
=
accountInfo
.
getExtractMoney
().
add
(
bigDecimal
);
BigDecimal
extractMoney
=
accountInfo
.
getExtractMoney
().
add
(
bigDecimal
);
accountInfo
.
setExtractMoney
(
extractMoney
);
accountInfo
.
setExtractMoney
(
extractMoney
);
BigDecimal
performanceMonth
=
accountInfo
.
getPerformanceMonth
().
add
(
extractMoney
);
BigDecimal
performanceMonth
=
accountInfo
.
getPerformanceMonth
().
add
(
bigDecimal
);
accountInfo
.
setPerformanceMonth
(
performanceMonth
);
accountInfo
.
setPerformanceMonth
(
performanceMonth
);
BigDecimal
performanceTotal
=
accountInfo
.
getPerformanceTotal
().
add
(
bigDecimal
);
accountInfo
.
setPerformanceMonth
(
performanceTotal
);
//2、修改订单返佣状态:已返佣 1
//2、修改订单返佣状态:已返佣 1
orderInfo
.
setRebateStatus
(
1
);
orderInfo
.
setRebateStatus
(
1
);
...
@@ -52,6 +57,9 @@ public class AccountManager {
...
@@ -52,6 +57,9 @@ public class AccountManager {
//3、增加账户可用金额
//3、增加账户可用金额
int
sum
=
accountMapper
.
updateById
(
accountInfo
);
int
sum
=
accountMapper
.
updateById
(
accountInfo
);
if
(
sum
==
0
){
return
false
;
}
//4、添加交易流水记录
//4、添加交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
TradeRecord
tradeRecord
=
new
TradeRecord
();
...
@@ -65,4 +73,11 @@ public class AccountManager {
...
@@ -65,4 +73,11 @@ public class AccountManager {
return
true
;
return
true
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateAccountPerformanceMonth
(
List
<
TeamPerformance
>
list
)
{
for
(
TeamPerformance
teamPerformance
:
list
)
{
teamPerformanceMapper
.
updateById
(
teamPerformance
);
}
}
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/PublicManager.java
0 → 100644
View file @
72fc0552
package
cn
.
wisenergy
.
service
.
Manager
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* @author 86187
* @ Description: 账户管理公共类
* @ Author : 86187
* @ Date : 2021/2/23 10:43
*/
@Component
@Slf4j
public
class
PublicManager
{
public
boolean
isThisMonth
(
Date
time
,
String
pattern
)
{
Date
date
=
new
Date
(
time
.
getTime
());
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
//参数时间
String
param
=
sdf
.
format
(
date
);
//当前时间
String
now
=
sdf
.
format
(
new
Date
());
if
(
param
.
equals
(
now
))
{
return
true
;
}
return
false
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountService.java
View file @
72fc0552
...
@@ -30,7 +30,7 @@ public interface AccountService {
...
@@ -30,7 +30,7 @@ public interface AccountService {
R
<
AccountInfo
>
getByUserId
(
String
userId
);
R
<
AccountInfo
>
getByUserId
(
String
userId
);
/**
/**
* 业绩统计
*
收益和
业绩统计
*
*
* @param list 订单信息
* @param list 订单信息
* @return true or false
* @return true or false
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
72fc0552
...
@@ -9,6 +9,7 @@ import java.util.List;
...
@@ -9,6 +9,7 @@ import java.util.List;
* @ Description: 用户接口
* @ Description: 用户接口
* @ Author : 86187
* @ Author : 86187
* @ Date : 2021/1/6 16:08
* @ Date : 2021/1/6 16:08
* @author 86187
*/
*/
public
interface
UserService
{
public
interface
UserService
{
...
@@ -27,6 +28,4 @@ public interface UserService {
...
@@ -27,6 +28,4 @@ public interface UserService {
*/
*/
User
getByUserId
(
String
userId
);
User
getByUserId
(
String
userId
);
R
<
List
<
User
>>
test
();
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
72fc0552
...
@@ -2,14 +2,13 @@ package cn.wisenergy.service.app.impl;
...
@@ -2,14 +2,13 @@ package cn.wisenergy.service.app.impl;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.RebateMapper
;
import
cn.wisenergy.mapper.MemberPercentMapper
;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.app.OrderInfo
;
import
cn.wisenergy.service.Manager.PublicManager
;
import
cn.wisenergy.model.app.Rebate
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.service.
common
.AccountManager
;
import
cn.wisenergy.service.
Manager
.AccountManager
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -18,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -36,11 +37,19 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -36,11 +37,19 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
private
AccountMapper
accountMapper
;
private
AccountMapper
accountMapper
;
@Autowired
@Autowired
private
RebateMapper
rebate
Mapper
;
private
MemberPercentMapper
memberPercent
Mapper
;
@Autowired
@Autowired
private
AccountManager
accountManager
;
private
AccountManager
accountManager
;
@Autowired
private
PublicManager
publicManager
;
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
private
static
final
String
PATTERN
=
"yyyy-mm"
;
@Override
@Override
public
R
<
Boolean
>
orderRebate
(
List
<
OrderInfo
>
list
)
{
public
R
<
Boolean
>
orderRebate
(
List
<
OrderInfo
>
list
)
{
log
.
info
(
"shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}"
,
list
.
size
());
log
.
info
(
"shop-mall[]AccountServiceImpl[]orderRebate[]input.param.list:{}"
,
list
.
size
());
...
@@ -67,13 +76,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -67,13 +76,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
}
//获取返佣比例
//获取返佣比例
Rebate
rebate
=
rebate
Mapper
.
getByLevel
(
user
.
getUserLevel
());
MemberPercent
memberpercent
=
memberPercent
Mapper
.
getByLevel
(
user
.
getUserLevel
());
if
(
null
==
rebate
)
{
if
(
null
==
memberpercent
)
{
continue
;
continue
;
}
}
//修改订单状态为已返佣,账户可用金额增加
//修改订单状态为已返佣,账户可用金额增加
accountManager
.
updateOrderAddMoney
(
orderInfo
,
accountInfo
,
rebate
);
accountManager
.
updateOrderAddMoney
(
orderInfo
,
accountInfo
,
memberpercent
);
}
}
}
}
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
...
@@ -92,9 +101,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -92,9 +101,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
}
}
//计算当月所有订单成交额
BigDecimal
totalMoney
=
new
BigDecimal
(
0
);
for
(
OrderInfo
orderInfo
:
list
)
{
boolean
bool
=
publicManager
.
isThisMonth
(
orderInfo
.
getCreateTime
(),
PATTERN
);
if
(
bool
&&
orderInfo
.
getMonthlyTaskStatus
()
==
0
)
{
totalMoney
=
totalMoney
.
add
(
orderInfo
.
getPayment
());
}
}
//遍历订单
//遍历订单
for
(
OrderInfo
orderInfo
:
list
)
{
for
(
OrderInfo
orderInfo
:
list
)
{
//订单状态创建时间,小于当前时间
//订单状态创建时间,小于当前时间
订单当月处理状态 :未处理
long
createTime
=
orderInfo
.
getCreated
().
getTime
();
long
createTime
=
orderInfo
.
getCreated
().
getTime
();
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
if
(
orderInfo
.
getMonthlyTaskStatus
()
==
0
&&
createTime
<=
time
)
{
if
(
orderInfo
.
getMonthlyTaskStatus
()
==
0
&&
createTime
<=
time
)
{
...
@@ -104,24 +122,52 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -104,24 +122,52 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
continue
;
continue
;
}
}
//获取当前用户的上级用户列表
List
<
TeamPerformance
>
teamPerformances
=
new
ArrayList
<>();
List
<
User
>
userList
=
getByList
(
user
.
getUserId
());
if
(
CollectionUtils
.
isEmpty
(
userList
)){
//获取团队业绩信息
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
new
Date
());
if
(
null
==
teamPerformance
)
{
continue
;
continue
;
}
}
//1、统计当前用户月度业绩
BigDecimal
userCount
=
teamPerformance
.
getMonthTeamPerformance
().
add
(
orderInfo
.
getPayment
());
teamPerformance
.
setMonthTeamPerformance
(
userCount
);
teamPerformances
.
add
(
teamPerformance
);
//2、获取当前用户的上级用户列表
List
<
User
>
userList
=
getByList
(
user
.
getUserId
());
if
(
CollectionUtils
.
isEmpty
(
userList
))
{
continue
;
}
//获取账户信息
for
(
User
userInfo
:
userList
)
{
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
//3、统计当前用户上级月度绩效
if
(
null
==
accountInfo
)
{
TeamPerformance
team
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
new
Date
());
if
(
null
==
team
)
{
continue
;
continue
;
}
}
//1、统计当前用户月度绩效
BigDecimal
monthCount
=
team
.
getMonthTeamPerformance
().
add
(
orderInfo
.
getPayment
());
team
.
setMonthTeamPerformance
(
monthCount
);
teamPerformances
.
add
(
team
);
}
//修改订单状态为已返佣,账户可用金额增加
//4、更新账户月度绩效
accountManager
.
updateAccountPerformanceMonth
(
teamPerformances
);
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List
<
User
>
userList
=
usersMapper
.
getAllGoldUser
();
for
(
User
user
:
userList
)
{
boolean
bool
=
monthlyIncome
(
totalMoney
,
user
);
if
(!
bool
)
{
continue
;
}
}
}
}
}
return
R
.
ok
(
0
,
true
);
return
R
.
ok
(
0
,
true
);
}
}
/**
/**
...
@@ -147,4 +193,46 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
...
@@ -147,4 +193,46 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
getUser
(
list
,
userInfo
.
getUserId
());
getUser
(
list
,
userInfo
.
getUserId
());
}
}
}
}
private
boolean
monthlyIncome
(
BigDecimal
totalMoney
,
User
user
)
{
double
total
=
totalMoney
.
doubleValue
();
BigDecimal
money
;
//当月所有人订单成交总金额/3980/12 向下整
double
moneyMonth
=
Math
.
floor
(
total
/
3980
/
12
);
if
(
moneyMonth
!=
0
)
{
//获取等级优惠百分比
MemberPercent
memberPercent
=
memberPercentMapper
.
getByLevelAndType
(
user
.
getUserLevel
(),
2
);
if
(
null
!=
memberPercent
)
{
//获取本月团队总金额
TeamPerformance
teamPerformance
=
teamPerformanceMapper
.
getByUserIdAndTime
(
user
.
getUserId
(),
new
Date
());
//获取该等级团队总金额
Double
teamTotal
=
teamPerformanceMapper
.
countTeamMoney
(
user
.
getUserLevel
(),
new
Date
());
if
(
null
!=
teamPerformance
&&
null
!=
teamTotal
)
{
double
month
=
teamPerformance
.
getMonthTeamPerformance
().
doubleValue
();
double
percent
=
memberPercent
.
getPercent
().
doubleValue
();
//计算收益
double
income
=
moneyMonth
*
3980
*
percent
*
month
/
teamTotal
;
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
user
.
getUserId
());
BigDecimal
bigDecimal
=
new
BigDecimal
(
income
);
BigDecimal
performanceMonth
=
accountInfo
.
getPerformanceMonth
().
add
(
bigDecimal
);
accountInfo
.
setPerformanceMonth
(
performanceMonth
);
BigDecimal
performanceTotal
=
accountInfo
.
getPerformanceTotal
().
add
(
bigDecimal
);
accountInfo
.
setPerformanceMonth
(
performanceTotal
);
//更新月收益
int
count
=
accountMapper
.
updateById
(
accountInfo
);
if
(
count
!=
0
)
{
return
true
;
}
}
}
}
return
false
;
}
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
View file @
72fc0552
...
@@ -35,8 +35,4 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
...
@@ -35,8 +35,4 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return
usersMapper
.
getByUserId
(
userId
);
return
usersMapper
.
getByUserId
(
userId
);
}
}
@Override
public
R
<
List
<
User
>>
test
()
{
return
null
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment