Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
shop-Mall
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
shop-Mall
Commits
8da9308c
Commit
8da9308c
authored
4 years ago
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化2
parent
e47f419e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
225 additions
and
159 deletions
+225
-159
ProgressPrizeMapper.java
...rc/main/java/cn/wisenergy/mapper/ProgressPrizeMapper.java
+11
-0
TeamPerformanceMapper.java
.../main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
+6
-6
ProgressPrizeMapper.xml
...-mapper/src/main/resources/mapper/ProgressPrizeMapper.xml
+15
-1
AccountInfo.java
...del/src/main/java/cn/wisenergy/model/app/AccountInfo.java
+1
-1
MonthAward.java
...odel/src/main/java/cn/wisenergy/model/app/MonthAward.java
+1
-1
ProgressPrize.java
...l/src/main/java/cn/wisenergy/model/app/ProgressPrize.java
+13
-13
TeamPerformance.java
...src/main/java/cn/wisenergy/model/app/TeamPerformance.java
+1
-1
TradeRecordEnum.java
...c/main/java/cn/wisenergy/model/enums/TradeRecordEnum.java
+3
-1
TeamPerformanceSortVo.java
...ain/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java
+14
-0
AccountManager.java
...ain/java/cn/wisenergy/service/Manager/AccountManager.java
+37
-4
AccountServiceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountServiceImpl.java
+122
-89
UploadController.java
.../wisenergy/web/admin/controller/app/UploadController.java
+0
-15
ShiroConfig.java
...min/src/main/java/cn/wisenergy/web/shiro/ShiroConfig.java
+1
-0
application.yml
wisenergy-web-admin/src/main/resources/application.yml
+0
-27
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/ProgressPrizeMapper.java
View file @
8da9308c
...
...
@@ -4,6 +4,9 @@ import cn.wisenergy.model.app.ProgressPrize;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author 86187
*/
...
...
@@ -14,4 +17,12 @@ public interface ProgressPrizeMapper extends BaseMapper<ProgressPrize> {
int
edit
(
ProgressPrize
progressPrize
);
int
delById
(
@Param
(
"id"
)
Integer
id
);
/**
* 根据 年月 获取月的最大进步奖用户列表
*
* @param yearMonth 年月
* @return 最大进步奖用户列表
*/
List
<
ProgressPrize
>
getByYearMonth
(
@Param
(
"yearMonth"
)
String
yearMonth
);
}
This diff is collapsed.
Click to expand it.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TeamPerformanceMapper.java
View file @
8da9308c
...
...
@@ -25,7 +25,7 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
* @param yearMonth 时间
* @return 用户月业绩
*/
TeamPerformance
getByUserIdAndTime
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"yearMonth"
)
Date
yearMonth
);
TeamPerformance
getByUserIdAndTime
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"yearMonth"
)
String
yearMonth
);
/**
* 统计 等级月业绩和
...
...
@@ -34,7 +34,7 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
* @param yearMonth 年月
* @return 等级总金额
*/
Double
countTeamMoney
(
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"yearMonth"
)
Date
yearMonth
);
Double
countTeamMoney
(
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"yearMonth"
)
String
yearMonth
);
/**
* 获取时间前的 月业绩列表
...
...
@@ -42,7 +42,7 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
* @param yearMonth 时间
* @return 月业绩列表
*/
List
<
TeamPerformance
>
getByBeforeTime
(
@Param
(
"yearMonth"
)
Date
yearMonth
);
List
<
TeamPerformance
>
getByBeforeTime
(
@Param
(
"yearMonth"
)
String
yearMonth
);
/**
* 根据时间统计 所有用户业绩和
...
...
@@ -50,14 +50,14 @@ public interface TeamPerformanceMapper extends BaseMapper<TeamPerformance> {
* @param yearMonth 时间
* @return 所有用户业绩和
*/
Double
countByTime
(
@Param
(
"yearMonth"
)
Date
yearMonth
);
Double
countByTime
(
@Param
(
"yearMonth"
)
String
yearMonth
);
/**
* 月业绩排名前20人 业绩和
* @param yearMonth 时间
* @return 业绩和
*/
Double
countTwenty
(
@Param
(
"yearMonth"
)
Date
yearMonth
);
Double
countTwenty
(
@Param
(
"yearMonth"
)
String
yearMonth
);
List
<
TeamPerformance
>
userTwenty
(
@Param
(
"yearMonth"
)
Date
yearMonth
);
List
<
TeamPerformance
>
userTwenty
(
@Param
(
"yearMonth"
)
String
yearMonth
);
}
This diff is collapsed.
Click to expand it.
wisenergy-mapper/src/main/resources/mapper/ProgressPrizeMapper.xml
View file @
8da9308c
...
...
@@ -12,7 +12,7 @@
</resultMap>
<sql
id=
"table"
>
month_award
progress_prize
</sql>
<sql
id=
"cols_all"
>
...
...
@@ -72,4 +72,18 @@
where id = #{id}
</delete>
<select
id=
"getByYearMonth"
resultType=
"cn.wisenergy.model.app.ProgressPrize"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
<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
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/app/AccountInfo.java
View file @
8da9308c
...
...
@@ -40,7 +40,7 @@ public class AccountInfo implements Serializable {
* 年月
*/
@ApiModelProperty
(
name
=
"yearMonth"
,
value
=
"年月"
)
private
Date
yearMonth
;
private
String
yearMonth
;
/**
...
...
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/app/MonthAward.java
View file @
8da9308c
...
...
@@ -29,7 +29,7 @@ public class MonthAward implements Serializable {
* 年月
*/
@ApiModelProperty
(
name
=
"yearMonth"
,
value
=
"年月"
)
private
Date
yearMonth
;
private
String
yearMonth
;
/**
* 本月月度肥料总额
...
...
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/app/ProgressPrize.java
View file @
8da9308c
...
...
@@ -8,10 +8,10 @@ import java.math.BigDecimal;
import
java.util.Date
;
/**
*@ Description: 每月进步奖实体类
*@ Author : 86187
*@ Date : 2021/3/1 9:31
* @author 86187
* @ Description: 每月进步奖实体类
* @ Author : 86187
* @ Date : 2021/3/1 9:31
*/
@Data
public
class
ProgressPrize
implements
Serializable
{
...
...
@@ -20,43 +20,43 @@ public class ProgressPrize implements Serializable {
/**
* 主键id
*/
@ApiModelProperty
(
value
=
"主键id"
,
name
=
"id"
)
@ApiModelProperty
(
value
=
"主键id"
,
name
=
"id"
)
private
Integer
id
;
/**
* 用户id
*/
@ApiModelProperty
(
value
=
"用户id"
,
name
=
"userId"
)
@ApiModelProperty
(
value
=
"用户id"
,
name
=
"userId"
)
private
String
userId
;
/**
* 年月
*/
@ApiModelProperty
(
value
=
"年月"
,
name
=
"yearMonth"
)
private
Date
yearMonth
;
@ApiModelProperty
(
value
=
"年月"
,
name
=
"yearMonth"
)
private
String
yearMonth
;
/**
* 本月增长率
*/
@ApiModelProperty
(
value
=
"本月增长率"
,
name
=
"growthRate"
)
private
BigDecimal
growthRate
;
@ApiModelProperty
(
value
=
"本月增长率"
,
name
=
"growthRate"
)
private
Double
growthRate
;
/**
* 进步奖奖金
*/
@ApiModelProperty
(
value
=
"进步奖奖金"
,
name
=
"awardMoney"
)
private
BigDecimal
awardMoney
;
@ApiModelProperty
(
value
=
"进步奖奖金"
,
name
=
"awardMoney"
)
private
Double
awardMoney
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
Date
createTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
,
name
=
"updateTime"
)
@ApiModelProperty
(
value
=
"更新时间"
,
name
=
"updateTime"
)
private
Date
updateTime
;
}
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/app/TeamPerformance.java
View file @
8da9308c
...
...
@@ -41,7 +41,7 @@ public class TeamPerformance implements Serializable {
* 年-月
*/
@ApiModelProperty
(
value
=
"年-月"
,
name
=
"yearMonth"
)
private
Date
yearMonth
;
private
String
yearMonth
;
/**
* 本月团队业绩
...
...
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/enums/TradeRecordEnum.java
View file @
8da9308c
...
...
@@ -20,7 +20,9 @@ public enum TradeRecordEnum {
CULTIVATING_PRIZE
(
5
,
"培育奖"
),
SALARY_REWARD
(
6
,
"工资奖励"
);
SALARY_REWARD
(
6
,
"工资奖励"
),
PROGRESS_PRIZE
(
7
,
"最大进步奖"
);
private
Integer
code
;
private
String
desc
;
...
...
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/vo/TeamPerformanceSortVo.java
View file @
8da9308c
...
...
@@ -8,9 +8,23 @@ import lombok.Data;
*/
@Data
public
class
TeamPerformanceSortVo
{
/**
* 增长率
*/
private
Double
growthRate
;
/**
* 用户id
*/
private
String
userId
;
/**
* 月团队业绩
*/
private
Double
monthPerformance
;
/**
* 月团队业绩 类
*/
private
TeamPerformance
teamPerformance
;
}
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/AccountManager.java
View file @
8da9308c
package
cn
.
wisenergy
.
service
.
Manager
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.OrderMapper
;
import
cn.wisenergy.mapper.TeamPerformanceMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.enums.RebateStatusEnum
;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
import
cn.wisenergy.model.vo.TeamPerformanceSortVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -37,6 +39,15 @@ public class AccountManager {
@Autowired
private
TeamPerformanceMapper
teamPerformanceMapper
;
@Autowired
private
ProgressPrizeMapper
progressPrizeMapper
;
@Autowired
private
TradeRecordMapper
tradeRecordMapper
;
private
static
final
String
PATTERN
=
"yyyy-MM"
;
/**
* 保存用户佣金
*
...
...
@@ -78,4 +89,26 @@ public class AccountManager {
teamPerformanceMapper
.
updateById
(
teamPerformance
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateOrSavePrize
(
List
<
TeamPerformanceSortVo
>
listVo
,
List
<
AccountInfo
>
accountInfos
,
List
<
ProgressPrize
>
prizes
)
{
Date
date
=
new
Date
();
String
yearMonth
=
DateUtil
.
convertDateToStr
(
date
,
PATTERN
);
//判断 prizes 是否为空集合,是新增
//新增
if
(
CollectionUtils
.
isEmpty
(
prizes
))
{
for
(
TeamPerformanceSortVo
sortVo
:
listVo
)
{
String
userId
=
sortVo
.
getTeamPerformance
().
getUserId
();
ProgressPrize
progressPrize
=
new
ProgressPrize
();
progressPrize
.
setUserId
(
userId
);
progressPrize
.
setGrowthRate
(
sortVo
.
getGrowthRate
());
progressPrize
.
setAwardMoney
(
sortVo
.
getMonthPerformance
());
progressPrize
.
setYearMonth
(
yearMonth
);
progressPrizeMapper
.
add
(
progressPrize
);
}
}
else
{
}
}
}
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountServiceImpl.java
View file @
8da9308c
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UploadController.java
View file @
8da9308c
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.FileUtils
;
import
cn.wisenergy.model.app.shopZx
;
import
cn.wisenergy.service.app.UploadService
;
import
com.alibaba.fastjson.JSON
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.Resource
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.support.ServletUriComponentsBuilder
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
io.swagger.annotations.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/ShiroConfig.java
View file @
8da9308c
...
...
@@ -18,6 +18,7 @@ import java.util.Map;
/**
* shiro配置类
* @author 86187
*/
@Configuration
public
class
ShiroConfig
{
...
...
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/resources/application.yml
View file @
8da9308c
...
...
@@ -47,30 +47,3 @@ mybatis-plus:
cache-enabled
:
false
call-setters-on-nulls
:
true
jdbc-type-for-null
:
'
null'
camera
:
ysy
:
#萤石云
api
:
appKey
:
53ff83088a8b445ea1b30c0ba85f7653
appSecret
:
0274e379003912b7ec1f3ef18a169624
isc
:
#海康威视
api
:
host
:
172.18.1.51:4443
#host: 111.203.232.172:4443
appKey
:
23756916
appSecret
:
TDrCbqQXe9XSt7SimYDO
path
:
/artemis
absoluteImgPath
:
d://Pictures/img/
sonImgPath
:
d://img/
sms
:
accessKeyId
:
LTAI4G6xmYPhjrS18Bxz5Kqu
secret
:
l3ZuSn2XjsFZXaB3yb8O5ASRJh3DDe
regionId
:
cn-hangzhou
domain
:
dysmsapi.aliyuncs.com
version
:
2017-05-25
action
:
SendSms
signName
:
西田森生物科技
This diff is collapsed.
Click to expand it.
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