Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
620e6514
Commit
620e6514
authored
Jun 17, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增用户数据汇总表和接口
parent
261dac6d
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
477 additions
and
221 deletions
+477
-221
UserDataMapper.java
...per/src/main/java/cn/wisenergy/mapper/UserDataMapper.java
+17
-0
UsersMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
+11
-4
UserDataMapper.xml
...nergy-mapper/src/main/resources/mapper/UserDataMapper.xml
+104
-0
UsersMapper.xml
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+14
-6
UserData.java
...-model/src/main/java/cn/wisenergy/model/app/UserData.java
+57
-0
UserDto.java
...y-model/src/main/java/cn/wisenergy/model/dto/UserDto.java
+29
-0
UserDataManger.java
...ain/java/cn/wisenergy/service/Manager/UserDataManger.java
+32
-0
UserDataService.java
...c/main/java/cn/wisenergy/service/app/UserDataService.java
+16
-0
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+3
-1
UserDataServiceImpl.java
...va/cn/wisenergy/service/app/impl/UserDataServiceImpl.java
+111
-0
UserServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
+22
-53
UserController.java
...cn/wisenergy/web/admin/controller/app/UserController.java
+0
-14
UserDataController.java
...isenergy/web/admin/controller/app/UserDataController.java
+31
-0
XxlJobConfig.java
...n/src/main/java/cn/wisenergy/web/config/XxlJobConfig.java
+0
-65
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+14
-38
application-prod.yml
wisenergy-web-admin/src/main/resources/application-prod.yml
+16
-40
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UserDataMapper.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.UserData
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author 86187
*/
public
interface
UserDataMapper
extends
BaseMapper
<
UserData
>
{
int
add
(
UserData
userData
);
int
edit
(
UserData
userData
);
UserData
getByUserId
(
@Param
(
"userId"
)
Long
userId
);
}
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
View file @
620e6514
...
...
@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import
cn.wisenergy.model.app.Users
;
import
cn.wisenergy.model.dto.UserDto
;
import
cn.wisenergy.model.dto.UserSimpleInfoDto
;
import
cn.wisenergy.model.dto.UsersInfoDto
;
import
cn.wisenergy.model.vo.UserVo
;
...
...
@@ -48,37 +49,43 @@ public interface UsersMapper extends BaseMapper<Users> {
/**
* 获取所有用户的下一级信息
*
* @param parentId 父id
* @return
*/
List
<
UserVo
>
getLastUser
(
@Param
(
"parentId"
)
Integer
parentId
);
/**
* 向下最深层级层级数
* @param id 用户id
* 获取向下最深层级层级数、伞下人员总和
*
* @param userId 用户id
* @return 层级数
*/
Double
getDownLevel
(
@Param
(
"id"
)
Long
id
,
@Param
(
"userId"
)
Long
userId
);
UsersInfoDto
getLevelAndTotal
(
@Param
(
"userId"
)
Long
userId
);
/**
* 伞下人员总和
*
* @param id 用户id
* @return 伞下人员总和
*/
Integer
getTotal
(
@Param
(
"id"
)
Long
id
);
List
<
UserDto
>
getAllUserData
();
/*************** chenqi****************/
/**
* 获取伞下有那些用户
*
* @param userId 用户id
*
*
/
*/
List
<
UserSimpleInfoDto
>
getDownUsersById
(
Long
userId
);
/**
* 获取用户向下最深层级层级数,伞下人员总和
*
* @param userId 用户
* @return
*/
...
...
wisenergy-mapper/src/main/resources/mapper/UserDataMapper.xml
0 → 100644
View file @
620e6514
<?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.UserDataMapper"
>
<resultMap
id=
"userMap"
type=
"cn.wisenergy.model.app.UserData"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_id"
property=
"userId"
/>
<result
column=
"real_name"
property=
"realName"
/>
<result
column=
"id_number"
property=
"idNumber"
/>
<result
column=
"phone"
property=
"phone"
/>
<result
column=
"total_recharge"
property=
"totalRecharge"
/>
<result
column=
"total_withdrawal"
property=
"totalWithdrawal"
/>
<result
column=
"rank"
property=
"rank"
/>
<result
column=
"bottom"
property=
"bottom"
/>
<result
column=
"total_people"
property=
"totalPeople"
/>
<result
column=
"buy_total"
property=
"buyTotal"
/>
<result
column=
"sale_total"
property=
"saleTotal"
/>
<result
column=
"created_at"
property=
"createdAt"
/>
<result
column=
"updated_at"
property=
"updatedAt"
/>
</resultMap>
<sql
id=
"table"
>
user_date
</sql>
<sql
id=
"cols_all"
>
id,
<include
refid=
"cols_exclude_id"
/>
</sql>
<sql
id=
"cols_exclude_id"
>
user_id,real_name,id_number,phone,total_recharge,total_withdrawal,rank, bottom,total_people,buy_total,
sale_total,created_at,updated_at
</sql>
<sql
id=
"vals"
>
#{userId},#{realName},#{idNumber},#{phone},#{totalRecharge},#{totalWithdrawal},#{rank},#{bottom},
#{totalPeople},#{buyTotal},#{saleTotal},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"userId != null"
>
user_id = #{userId},
</if>
<if
test=
"realName != null"
>
real_name =#{realName},
</if>
<if
test=
"idNumber != null"
>
id_number =#{idNumber},
</if>
<if
test=
"phone != null"
>
phone =#{phone},
</if>
<if
test=
"totalRecharge != null"
>
total_recharge = #{totalRecharge},
</if>
<if
test=
"totalWithdrawal != null"
>
total_withdrawal =#{totalWithdrawal},
</if>
<if
test=
"rank != null"
>
rank =#{rank},
</if>
<if
test=
"bottom != null"
>
bottom =#{bottom},
</if>
<if
test=
"totalPeople != null"
>
total_people = #{totalPeople},
</if>
<if
test=
"buyTotal != null"
>
buy_total = #{buyTotal},
</if>
<if
test=
"saleTotal != null"
>
sale_total =#{saleTotal},
</if>
updated_at =now()
</sql>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"userId != null"
>
and user_id = #{userId},
</if>
<if
test=
"realName != null"
>
and real_name =#{realName},
</if>
<if
test=
"idNumber != null"
>
and id_number =#{idNumber},
</if>
<if
test=
"phone != null"
>
and phone =#{phone},
</if>
<if
test=
"totalRecharge != null"
>
and total_recharge = #{totalRecharge},
</if>
<if
test=
"totalWithdrawal != null"
>
and total_withdrawal =#{totalWithdrawal},
</if>
<if
test=
"rank != null"
>
and rank =#{rank},
</if>
<if
test=
"bottom != null"
>
and bottom =#{bottom},
</if>
<if
test=
"totalPeople != null"
>
and total_people = #{totalPeople},
</if>
<if
test=
"buyTotal != null"
>
and buy_total = #{buyTotal},
</if>
<if
test=
"saleTotal != null"
>
and sale_total =#{saleTotal},
</if>
<if
test=
"createdAt != null"
>
and created_at
>
= #{createdAt}
</if>
<if
test=
"updatedAt != null"
>
and #{updatedAt}
>
= updated_at
</if>
</sql>
<insert
id=
"add"
parameterType=
"cn.wisenergy.model.app.UserData"
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.UserData"
>
UPDATE
<include
refid=
"table"
/>
<set>
<include
refid=
"updateCondition"
/>
</set>
<where>
id = #{id}
</where>
</update>
<select
id=
"getByUserId"
resultType=
"cn.wisenergy.model.app.UserData"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
user_id=#{userId}
</where>
</select>
</mapper>
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
View file @
620e6514
...
...
@@ -171,11 +171,13 @@
</select>
<select
id=
"getDownLevel"
resultType=
"java.lang.Double"
>
select
((LENGTH(a.sub_path) - LENGTH(REPLACE(a.sub_path,",", ""))) / LENGTH(",")-2) as down_level from
(select id,SUBSTR(path,POSITION(",${id}," IN path)) as sub_path
from users where path LIKE CONCAT('%',#{id},'%')) a ORDER BY down_level desc limit 1
<select
id=
"getLevelAndTotal"
resultType=
"cn.wisenergy.model.dto.UsersInfoDto"
>
SELECT
MAX(rank) 'bottom',
count(*)-1 'totalPeople'
FROM users
WHERE
FIND_IN_SET(#{userId},path)
</select>
<select
id=
"getTotal"
resultType=
"java.lang.Integer"
>
...
...
@@ -183,7 +185,7 @@
from
<include
refid=
"table"
/>
<where>
path LIKE CONCAT('%',#{id},'%'
)
FIND_IN_SET(#{id},path
)
</where>
</select>
...
...
@@ -232,4 +234,10 @@ GROUP BY user_id
ORDER BY u.id
</select>
<select
id=
"getAllUserData"
resultType=
"cn.wisenergy.model.dto.UserDto"
>
select id as userId,rank,phone
from
<include
refid=
"table"
/>
</select>
</mapper>
wisenergy-model/src/main/java/cn/wisenergy/model/app/UserData.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
model
.
app
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author 86187
*/
@Data
@ApiModel
(
value
=
"UserInfo"
)
public
class
UserData
{
/**
* 主键id
*/
private
Integer
id
;
@ApiModelProperty
(
name
=
"userId"
,
value
=
"会员ID"
)
private
Long
userId
;
@ApiModelProperty
(
name
=
"realName"
,
value
=
"姓名"
)
private
String
realName
;
@ApiModelProperty
(
name
=
"idNumber"
,
value
=
"身份证号"
)
private
String
idNumber
;
@ApiModelProperty
(
name
=
"phone"
,
value
=
"用户手机号"
)
private
String
phone
;
@ApiModelProperty
(
name
=
"totalRecharge"
,
value
=
"充值总额"
)
private
Double
totalRecharge
;
@ApiModelProperty
(
name
=
"totalWithdrawal"
,
value
=
"提现总额"
)
private
Double
totalWithdrawal
;
@ApiModelProperty
(
name
=
"rank"
,
value
=
"层级"
)
private
Integer
rank
;
@ApiModelProperty
(
name
=
"bottom"
,
value
=
"向下最深层级层级数"
)
private
Integer
bottom
;
@ApiModelProperty
(
name
=
"totalPeople"
,
value
=
"伞下人员总和"
)
private
Integer
totalPeople
;
@ApiModelProperty
(
name
=
"buyTotal"
,
value
=
"otc卖入总额"
)
private
Double
buyTotal
;
@ApiModelProperty
(
name
=
"saleTotal"
,
value
=
"otc卖出总额"
)
private
Double
saleTotal
;
private
Date
createdAt
;
private
Date
updatedAt
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/UserDto.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author 86187
*/
@Data
@ApiModel
(
value
=
"UserDto"
)
public
class
UserDto
{
/**
* 用户id
*/
@ApiModelProperty
(
name
=
"userId"
,
value
=
"用户id"
)
private
Long
userId
;
/**
* 层级
*/
@ApiModelProperty
(
name
=
"rank"
,
value
=
"层级"
)
private
Integer
rank
;
/**
* 用户手机号
*/
@ApiModelProperty
(
name
=
"phone"
,
value
=
"用户手机号"
)
private
String
phone
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/UserDataManger.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
service
.
Manager
;
import
cn.wisenergy.mapper.UserDataMapper
;
import
cn.wisenergy.model.app.UserData
;
import
org.apache.shiro.util.CollectionUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author 86187
*/
@Component
public
class
UserDataManger
{
@Resource
private
UserDataMapper
userDataMapper
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveBatchUserData
(
List
<
UserData
>
list
)
{
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
for
(
UserData
userData
:
list
)
{
int
count
=
userDataMapper
.
add
(
userData
);
if
(
count
==
0
)
{
return
false
;
}
}
}
return
true
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserDataService.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
/**
* @author 86187
*/
public
interface
UserDataService
{
/**
* 批量添加用户统计数据
*
* @return true or false
*/
R
<
Boolean
>
addBatch
();
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
620e6514
...
...
@@ -29,6 +29,7 @@ public interface UserService {
/**
* 获取用户下一级
*
* @param userId 用户id
* @return 树结构
*/
R
<
List
<
UserVo
>>
getLastUser
(
Long
userId
);
...
...
@@ -36,8 +37,9 @@ public interface UserService {
/**
* 获取用户详细信息
* @param userId 用户id
* @return
* @return
用户详细信息
*/
R
<
UsersInfoDto
>
getByUserInfoById
(
Long
userId
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserDataServiceImpl.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.Actives
;
import
cn.wisenergy.model.app.UserData
;
import
cn.wisenergy.model.dto.UserDto
;
import
cn.wisenergy.model.dto.UsersInfoDto
;
import
cn.wisenergy.service.Manager.UserDataManger
;
import
cn.wisenergy.service.app.UserDataService
;
import
org.apache.shiro.util.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author 86187
*/
@Service
public
class
UserDataServiceImpl
implements
UserDataService
{
@Resource
private
UsersMapper
usersMapper
;
@Resource
private
ActivesMapper
activesMapper
;
@Resource
private
UserRechargeMapper
userRechargeMapper
;
@Resource
private
UserWithdrawsMapper
withdrawsMapper
;
@Resource
private
UsdtOrderDetailsMapper
orderDetailsMapper
;
@Resource
private
UserDataManger
userDataManger
;
@Override
public
R
<
Boolean
>
addBatch
()
{
//获取所有用户数据
List
<
UserDto
>
userDtos
=
usersMapper
.
getAllUserData
();
if
(
CollectionUtils
.
isEmpty
(
userDtos
))
{
return
R
.
ok
(
1
,
false
);
}
UserData
userData
=
new
UserData
();
List
<
UserData
>
list
=
new
ArrayList
<>();
for
(
UserDto
userDto
:
userDtos
)
{
Long
userId
=
userDto
.
getUserId
();
//1、用户基本信息
userData
.
setUserId
(
userDto
.
getUserId
());
userData
.
setPhone
(
userDto
.
getPhone
());
userData
.
setRank
(
userDto
.
getRank
());
//2、用户身份、电话信息
Actives
actives
=
activesMapper
.
getByUserId
(
userId
);
if
(
null
!=
actives
)
{
userData
.
setIdNumber
(
actives
.
getIdNumber
());
userData
.
setRealName
(
actives
.
getRealName
());
}
//3、向下最深层级层级数、伞下人员总和
UsersInfoDto
userInfoDto
=
usersMapper
.
getLevelAndTotal
(
userId
);
if
(
null
!=
userInfoDto
)
{
if
(
null
!=
userInfoDto
.
getBottom
())
{
userData
.
setBottom
(
userInfoDto
.
getBottom
()
-
userDto
.
getRank
());
}
userData
.
setTotalPeople
(
userInfoDto
.
getTotalPeople
());
}
//4、充值总额
Double
totalRecharge
=
userRechargeMapper
.
getTotalRecharge
(
userId
);
if
(
null
!=
totalRecharge
)
{
userData
.
setTotalRecharge
(
String
.
valueOf
(
totalRecharge
));
}
//5、提现总额
Double
totalWithdrawal
=
withdrawsMapper
.
getTotalWithdrawal
(
userId
);
if
(
null
!=
totalWithdrawal
)
{
userData
.
setTotalWithdrawal
(
String
.
valueOf
(
totalWithdrawal
));
}
//6、otc卖出总额
Double
buyTotal
=
orderDetailsMapper
.
getBuyTotal
(
userId
);
if
(
null
!=
buyTotal
)
{
userData
.
setBuyTotal
(
String
.
valueOf
(
buyTotal
));
}
//7、otc买入总额
Double
saleTotal
=
orderDetailsMapper
.
getSaleTotal
(
userId
);
if
(
null
!=
saleTotal
)
{
userData
.
setSaleTotal
(
String
.
valueOf
(
saleTotal
));
}
list
.
add
(
userData
);
}
//写入数据库
boolean
bool
=
userDataManger
.
saveBatchUserData
(
list
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
return
R
.
ok
(
0
,
true
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
View file @
620e6514
...
...
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -24,29 +25,31 @@ import java.util.List;
@Slf4j
public
class
UserServiceImpl
extends
ServiceImpl
<
UsersMapper
,
Users
>
implements
UserService
{
@
Autowired
@
Resource
private
UsersMapper
usersMapper
;
@
Autowired
@
Resource
private
ActivesMapper
activesMapper
;
@
Autowired
@
Resource
private
UserRechargeMapper
userRechargeMapper
;
@
Autowired
@
Resource
private
UserWithdrawsMapper
withdrawsMapper
;
@
Autowired
@
Resource
private
UsdtOrderDetailsMapper
orderDetailsMapper
;
@Resource
private
UserDataMapper
userDataMapper
;
@Override
public
Users
getById
(
Long
userId
)
{
return
null
;
return
usersMapper
.
getById
(
userId
)
;
}
@Override
public
R
<
List
<
UserVo
>>
getLastUser
(
Long
userId
)
{
//用户id为空时,查询最顶级
if
(
null
==
userId
)
{
userId
=
1L
;
...
...
@@ -76,52 +79,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, Users> implements
UsersInfoDto
userDto
=
new
UsersInfoDto
();
//1、获取用户信息
Users
users
=
usersMapper
.
getById
(
userId
);
if
(
null
!=
users
)
{
userDto
.
setUserId
(
users
.
getId
());
userDto
.
setPhone
(
users
.
getPhone
());
userDto
.
setRank
(
users
.
getRank
());
}
//2、获取用户身份信息
Actives
actives
=
activesMapper
.
getByUserId
(
userId
);
if
(
null
!=
actives
)
{
userDto
.
setIdNumber
(
actives
.
getIdNumber
());
userDto
.
setRealName
(
actives
.
getRealName
());
}
//3、向下最深层级层级数
double
downLevel
=
usersMapper
.
getDownLevel
(
userId
,
userId
);
userDto
.
setBottom
((
int
)
downLevel
);
//4、伞下人员总和
Integer
total
=
usersMapper
.
getTotal
(
userId
);
if
(
null
!=
total
)
{
userDto
.
setTotalPeople
(
total
);
}
//5、充值总额
Double
totalRecharge
=
userRechargeMapper
.
getTotalRecharge
(
userId
);
if
(
null
!=
totalRecharge
)
{
userDto
.
setTotalRecharge
(
String
.
valueOf
(
totalRecharge
));
}
//6、提现总额
Double
totalWithdrawal
=
withdrawsMapper
.
getTotalWithdrawal
(
userId
);
if
(
null
!=
totalWithdrawal
)
{
userDto
.
setTotalWithdrawal
(
String
.
valueOf
(
totalWithdrawal
));
}
//7、otc卖出总额
Double
buyTotal
=
orderDetailsMapper
.
getBuyTotal
(
userId
);
if
(
null
!=
buyTotal
)
{
userDto
.
setBuyTotal
(
String
.
valueOf
(
buyTotal
));
}
//8、otc买入总额
Double
saleTotal
=
orderDetailsMapper
.
getSaleTotal
(
userId
);
if
(
null
!=
saleTotal
)
{
userDto
.
setSaleTotal
(
String
.
valueOf
(
saleTotal
));
UserData
user
=
userDataMapper
.
getByUserId
(
userId
);
if
(
null
!=
user
)
{
userDto
.
setUserId
(
user
.
getUserId
());
userDto
.
setPhone
(
user
.
getPhone
());
userDto
.
setRank
(
user
.
getRank
());
userDto
.
setIdNumber
(
user
.
getIdNumber
());
userDto
.
setRealName
(
user
.
getRealName
());
userDto
.
setBottom
(
user
.
getRank
());
userDto
.
setTotalPeople
(
user
.
getTotalPeople
());
userDto
.
setTotalWithdrawal
(
String
.
valueOf
(
user
.
getTotalWithdrawal
()));
userDto
.
setBuyTotal
(
String
.
valueOf
(
user
.
getBuyTotal
()));
userDto
.
setSaleTotal
(
String
.
valueOf
(
user
.
getSaleTotal
()));
}
return
R
.
ok
(
userDto
);
}
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserController.java
View file @
620e6514
...
...
@@ -2,13 +2,11 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.constant.RedisConsts
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.common.utils.RedisUtils
;
import
cn.wisenergy.model.app.Users
;
import
cn.wisenergy.model.dto.UsersInfoDto
;
import
cn.wisenergy.model.vo.UserVo
;
import
cn.wisenergy.service.app.UserService
;
import
cn.wisenergy.web.common.BaseController
;
import
cn.wisenergy.web.config.JwtConfig
;
import
cn.wisenergy.web.shiro.JwtUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -37,21 +35,9 @@ public class UserController extends BaseController {
@Autowired
private
JwtUtil
jwtUtil
;
@Autowired
private
JwtConfig
jwtConfig
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Autowired
private
RedisUtils
redisUtils
;
@ApiOperation
(
value
=
"获取用户信息"
,
notes
=
"获取用户信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"int"
)
@GetMapping
(
"/user/getByUserId"
)
public
Users
getByUserId
(
Long
userId
)
{
return
userService
.
getById
(
userId
);
}
/**
* shiro登录
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserDataController.java
0 → 100644
View file @
620e6514
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.service.app.UserDataService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
jdk.nashorn.internal.ir.annotations.Reference
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
/**
* @author 86187
*/
@Api
(
tags
=
"用户数据统计管理"
)
@RestController
@Slf4j
public
class
UserDataController
{
@Resource
private
UserDataService
userDataService
;
@ApiOperation
(
value
=
"获取token接口"
,
notes
=
"获取token接口"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/user/saveBatchUserData"
)
public
R
<
Boolean
>
saveBatchUserData
()
{
return
userDataService
.
addBatch
();
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/XxlJobConfig.java
deleted
100644 → 0
View file @
261dac6d
package
cn
.
wisenergy
.
web
.
config
;
import
cn.wisenergy.common.utils.IpUtil
;
import
com.xxl.job.core.executor.impl.XxlJobSpringExecutor
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.net.UnknownHostException
;
@Configuration
public
class
XxlJobConfig
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
XxlJobConfig
.
class
);
@Value
(
"${xxl.job.admin.addresses}"
)
private
String
adminAddresses
;
@Value
(
"${xxl.job.accessToken}"
)
private
String
accessToken
;
@Value
(
"${xxl.job.executor.appname}"
)
private
String
appname
;
@Value
(
"${xxl.job.executor.address}"
)
private
String
address
;
@Value
(
"${xxl.job.executor.ip}"
)
private
String
ip
;
@Value
(
"${xxl.job.executor.port}"
)
private
int
port
;
@Value
(
"${xxl.job.executor.logpath}"
)
private
String
logPath
;
@Value
(
"${xxl.job.executor.logretentiondays}"
)
private
int
logRetentionDays
;
@Bean
public
XxlJobSpringExecutor
xxlJobExecutor
()
{
LOGGER
.
info
(
">>>>>>>>>>> xxl-job config init."
);
XxlJobSpringExecutor
xxlJobSpringExecutor
=
new
XxlJobSpringExecutor
();
xxlJobSpringExecutor
.
setAdminAddresses
(
adminAddresses
);
xxlJobSpringExecutor
.
setAppname
(
appname
);
xxlJobSpringExecutor
.
setAddress
(
address
);
String
ip
=
null
;
try
{
ip
=
IpUtil
.
getLocalHostLANAddress
().
getHostAddress
();
}
catch
(
UnknownHostException
e
)
{
LOGGER
.
error
(
"UnknownHostException "
,
e
);
}
LOGGER
.
info
(
"XxlJobSpringExecutor ip:"
+
ip
);
xxlJobSpringExecutor
.
setIp
(
ip
);
xxlJobSpringExecutor
.
setIp
(
ip
);
xxlJobSpringExecutor
.
setPort
(
port
);
xxlJobSpringExecutor
.
setAccessToken
(
accessToken
);
xxlJobSpringExecutor
.
setLogPath
(
logPath
);
xxlJobSpringExecutor
.
setLogRetentionDays
(
logRetentionDays
);
return
xxlJobSpringExecutor
;
}
}
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
620e6514
...
...
@@ -48,19 +48,19 @@ spring:
config
:
multi-statement-allow
:
true
redis
:
open
:
false
# 是否开启redis缓存 true开启 false关闭
database
:
0
host
:
8.131.244.76
port
:
6379
password
:
1qaz@WSX
timeout
:
6000ms
jedis
:
pool
:
max-active
:
1000
# 连接池最大连接数(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
#
redis:
#
open: false # 是否开启redis缓存 true开启 false关闭
#
database: 0
#
host: 8.131.244.76
#
port: 6379
#
password: 1qaz@WSX
#
timeout: 6000ms
#
jedis:
#
pool:
#
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
#
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
#
max-idle: 10 # 连接池中的最大空闲连接
#
min-idle: 5 # 连接池中的最小空闲连接
# 192.168.110.165 adm4HYservice$
# redis:
# database: 0
...
...
@@ -78,34 +78,10 @@ spring:
uploadFile
:
resourceHandler
:
/upload_flowChart/**
#请求 url 中的资源映射也是保存到数据库中的父级路径
location
:
/opt/images/upload_flowChart/
#自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/
file
:
upload
:
path
:
/opt/upload/
jwt
:
# 加密秘钥
secret
:
f4e2e52034348f86b67cde581c0f9eb5
# token有效时长,单位秒
expire
:
14400
logging
:
config
:
classpath:logback-spring.xml
sms
:
accessKeyId
:
LTAI4G6xmYPhjrS18Bxz5Kqu
secret
:
l3ZuSn2XjsFZXaB3yb8O5ASRJh3DDe
regionId
:
cn-hangzhou
domain
:
dysmsapi.aliyuncs.com
version
:
2017-05-25
action
:
SendSms
signName
:
西田森生物科技
xxl
:
job
:
accessToken
:
admin
:
addresses
:
http://127.0.0.1:8090/job-admin
executor
:
address
:
appname
:
shop-mall
ip
:
logpath
:
/var/logs/xxl-job/jobhandler
logretentiondays
:
30
port
:
9999
\ No newline at end of file
config
:
classpath:logback-spring.xml
\ No newline at end of file
wisenergy-web-admin/src/main/resources/application-prod.yml
View file @
620e6514
...
...
@@ -3,9 +3,9 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://
8.140.108.250:3306/shop-mall
?useUnicode=true&serverTimezone=GMT%2B8
username
:
xitiansen
password
:
adm4HYservice
url
:
jdbc:mysql://
localhost:3306/yashi
?useUnicode=true&serverTimezone=GMT%2B8
username
:
root
password
:
Wise!@#123
initial-size
:
10
max-active
:
100
min-idle
:
10
...
...
@@ -33,26 +33,23 @@ spring:
config
:
multi-statement-allow
:
true
#/www/server/redis/src/redis-server
redis
:
open
:
false
# 是否开启redis缓存 true开启 false关闭
database
:
0
host
:
8.140.108.250
port
:
6379
password
:
1qaz@WSX
timeout
:
6000ms
jedis
:
pool
:
max-active
:
1000
# 连接池最大连接数(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle
:
10
# 连接池中的最大空闲连接
min-idle
:
5
# 连接池中的最小空闲连接
#
redis:
#
open: false # 是否开启redis缓存 true开启 false关闭
#
database: 0
#
host: 8.140.108.250
#
port: 6379
#
password: 1qaz@WSX
#
timeout: 6000ms
#
jedis:
#
pool:
#
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
#
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
#
max-idle: 10 # 连接池中的最大空闲连接
#
min-idle: 5 # 连接池中的最小空闲连接
###上传文件配置 :该配置可根据部署的系统或开发人员自定义路径,每次部署之前需要修改location
uploadFile
:
resourceHandler
:
/upload_flowChart/**
#请求 url 中的资源映射也是保存到数据库中的父级路径
location
:
/opt/images/upload_flowChart/
#自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/
file
:
upload
:
path
:
/opt/images/
jwt
:
# 加密秘钥
secret
:
f4e2e52034348f86b67cde581c0f9eb5
...
...
@@ -60,24 +57,3 @@ jwt:
expire
:
14400
logging
:
config
:
classpath:logback-spring.xml
sms
:
accessKeyId
:
LTAI4G6xmYPhjrS18Bxz5Kqu
secret
:
l3ZuSn2XjsFZXaB3yb8O5ASRJh3DDe
regionId
:
cn-hangzhou
domain
:
dysmsapi.aliyuncs.com
version
:
2017-05-25
action
:
SendSms
signName
:
西田森生物科技
xxl
:
job
:
accessToken
:
admin
:
addresses
:
http://172.24.252.166:8090/job-admin
executor
:
address
:
appname
:
shop-mall
ip
:
logpath
:
/var/logs/xxl-job/jobhandler
logretentiondays
:
30
port
:
9999
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