Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
7e670f9b
提交
7e670f9b
authored
10月 16, 2023
作者:
aiqingguo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
时间处理
上级
294009e7
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
64 行增加
和
35 行删除
+64
-35
IntegralStatisticsDao.java
...n/java/com/clx/performance/dao/IntegralStatisticsDao.java
+2
-1
IntegralStatisticsDaoImpl.java
...m/clx/performance/dao/impl/IntegralStatisticsDaoImpl.java
+2
-1
IntegralOrder.java
...rc/main/java/com/clx/performance/model/IntegralOrder.java
+4
-2
IntegralRecord.java
...c/main/java/com/clx/performance/model/IntegralRecord.java
+5
-3
IntegralStatistics.java
...in/java/com/clx/performance/model/IntegralStatistics.java
+5
-3
IntegralTruck.java
...rc/main/java/com/clx/performance/model/IntegralTruck.java
+4
-2
IntegralMqHandlerService.java
...com/clx/performance/service/IntegralMqHandlerService.java
+3
-1
IntegralRecordService.java
...va/com/clx/performance/service/IntegralRecordService.java
+3
-1
IntegralStatisticsService.java
...om/clx/performance/service/IntegralStatisticsService.java
+4
-2
IntegralMqHandlerServiceImpl.java
...erformance/service/impl/IntegralMqHandlerServiceImpl.java
+10
-10
IntegralRecordServiceImpl.java
...x/performance/service/impl/IntegralRecordServiceImpl.java
+3
-1
IntegralStatisticsServiceImpl.java
...rformance/service/impl/IntegralStatisticsServiceImpl.java
+7
-6
IntegralTruckServiceImpl.java
...lx/performance/service/impl/IntegralTruckServiceImpl.java
+3
-2
LocalDateTimeUtils.java
...in/java/com/clx/performance/utils/LocalDateTimeUtils.java
+9
-0
没有找到文件。
performance-web/src/main/java/com/clx/performance/dao/IntegralStatisticsDao.java
浏览文件 @
7e670f9b
...
@@ -9,6 +9,7 @@ import com.msl.common.base.Optional;
...
@@ -9,6 +9,7 @@ import com.msl.common.base.Optional;
import
com.msl.common.dao.BaseDao
;
import
com.msl.common.dao.BaseDao
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -29,7 +30,7 @@ public interface IntegralStatisticsDao extends BaseDao<IntegralStatisticsMapper,
...
@@ -29,7 +30,7 @@ public interface IntegralStatisticsDao extends BaseDao<IntegralStatisticsMapper,
Optional
<
IntegralStatistics
>
selectById
(
Integer
id
);
Optional
<
IntegralStatistics
>
selectById
(
Integer
id
);
List
<
IntegralStatistics
>
selectByStatisticsDate
(
@Param
(
"statisticsDate"
)
String
statisticsDate
);
List
<
IntegralStatistics
>
selectByStatisticsDate
(
@Param
(
"statisticsDate"
)
LocalDateTime
statisticsDate
);
List
<
IntegralStatistics
>
selectListByStatisticsDateAndTruckNoList
(
@Param
(
"statisticsDate"
)
String
statisticsDate
,
@Param
(
"list"
)
List
<
String
>
truckNoList
);
List
<
IntegralStatistics
>
selectListByStatisticsDateAndTruckNoList
(
@Param
(
"statisticsDate"
)
String
statisticsDate
,
@Param
(
"list"
)
List
<
String
>
truckNoList
);
...
...
performance-web/src/main/java/com/clx/performance/dao/impl/IntegralStatisticsDaoImpl.java
浏览文件 @
7e670f9b
...
@@ -11,6 +11,7 @@ import com.msl.common.base.Optional;
...
@@ -11,6 +11,7 @@ import com.msl.common.base.Optional;
import
com.msl.common.dao.impl.BaseDaoImpl
;
import
com.msl.common.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -62,7 +63,7 @@ public class IntegralStatisticsDaoImpl extends BaseDaoImpl<IntegralStatisticsMap
...
@@ -62,7 +63,7 @@ public class IntegralStatisticsDaoImpl extends BaseDaoImpl<IntegralStatisticsMap
}
}
@Override
@Override
public
List
<
IntegralStatistics
>
selectByStatisticsDate
(
String
statisticsDate
)
{
public
List
<
IntegralStatistics
>
selectByStatisticsDate
(
LocalDateTime
statisticsDate
)
{
return
list
(
lQrWrapper
()
return
list
(
lQrWrapper
()
.
eq
(
IntegralStatistics:
:
getStatisticsDate
,
statisticsDate
)
.
eq
(
IntegralStatistics:
:
getStatisticsDate
,
statisticsDate
)
.
orderByDesc
(
IntegralStatistics:
:
getIntegral
));
.
orderByDesc
(
IntegralStatistics:
:
getIntegral
));
...
...
performance-web/src/main/java/com/clx/performance/model/IntegralOrder.java
浏览文件 @
7e670f9b
...
@@ -7,6 +7,8 @@ import com.msl.common.config.KeyColumn;
...
@@ -7,6 +7,8 @@ import com.msl.common.config.KeyColumn;
import
com.msl.common.model.HasKey
;
import
com.msl.common.model.HasKey
;
import
lombok.*
;
import
lombok.*
;
import
java.time.LocalDateTime
;
/**
/**
* @Author: aiqinguo
* @Author: aiqinguo
* @Description: 积分货单
* @Description: 积分货单
...
@@ -29,8 +31,8 @@ public class IntegralOrder implements HasKey<Integer> {
...
@@ -29,8 +31,8 @@ public class IntegralOrder implements HasKey<Integer> {
private
String
receiveAddress
;
//收货地址
private
String
receiveAddress
;
//收货地址
private
Integer
orderType
;
//货单类型:1优质单 2普通单 3流水单 4支援单
private
Integer
orderType
;
//货单类型:1优质单 2普通单 3流水单 4支援单
private
Integer
truckEchelon
;
//车辆梯队
private
Integer
truckEchelon
;
//车辆梯队
private
String
createTime
;
//创建时间
private
LocalDateTime
createTime
;
//创建时间
private
String
modifiedTime
;
//修改时间
private
LocalDateTime
modifiedTime
;
//修改时间
@Getter
@Getter
@AllArgsConstructor
@AllArgsConstructor
...
...
performance-web/src/main/java/com/clx/performance/model/IntegralRecord.java
浏览文件 @
7e670f9b
...
@@ -7,6 +7,8 @@ import com.msl.common.config.KeyColumn;
...
@@ -7,6 +7,8 @@ import com.msl.common.config.KeyColumn;
import
com.msl.common.model.HasKey
;
import
com.msl.common.model.HasKey
;
import
lombok.*
;
import
lombok.*
;
import
java.time.LocalDateTime
;
/**
/**
* @Author: aiqinguo
* @Author: aiqinguo
* @Description: 积分记录
* @Description: 积分记录
...
@@ -23,13 +25,13 @@ public class IntegralRecord implements HasKey<Integer> {
...
@@ -23,13 +25,13 @@ public class IntegralRecord implements HasKey<Integer> {
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
//id
private
Integer
id
;
//id
private
Integer
statisticsId
;
//统计id
private
Integer
statisticsId
;
//统计id
private
String
statisticsDate
;
//统计时间
private
LocalDateTime
statisticsDate
;
//统计时间
private
String
truckNo
;
//车牌号
private
String
truckNo
;
//车牌号
private
Integer
integral
;
//获得积分
private
Integer
integral
;
//获得积分
private
Integer
type
;
//类型
private
Integer
type
;
//类型
private
String
remark
;
//原因
private
String
remark
;
//原因
private
String
createTime
;
//创建时间
private
LocalDateTime
createTime
;
//创建时间
private
String
modifiedTime
;
//修改时间
private
LocalDateTime
modifiedTime
;
//修改时间
@Getter
@Getter
...
...
performance-web/src/main/java/com/clx/performance/model/IntegralStatistics.java
浏览文件 @
7e670f9b
...
@@ -9,6 +9,8 @@ import lombok.Getter;
...
@@ -9,6 +9,8 @@ import lombok.Getter;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
import
java.time.LocalDateTime
;
/**
/**
* @Author: aiqinguo
* @Author: aiqinguo
* @Description: 积分排名统计
* @Description: 积分排名统计
...
@@ -25,12 +27,12 @@ public class IntegralStatistics implements HasKey<Integer> {
...
@@ -25,12 +27,12 @@ public class IntegralStatistics implements HasKey<Integer> {
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
//id
private
Integer
id
;
//id
private
String
truckNo
;
//车牌号
private
String
truckNo
;
//车牌号
private
String
statisticsDate
;
//统计时间(周一)
private
LocalDateTime
statisticsDate
;
//统计时间(周一)
private
Integer
integralBase
;
//基础积分
private
Integer
integralBase
;
//基础积分
private
Integer
integral
;
//积分
private
Integer
integral
;
//积分
private
Integer
rank
;
//排名
private
Integer
rank
;
//排名
private
String
createTime
;
//创建时间
private
LocalDateTime
createTime
;
//创建时间
private
String
modifiedTime
;
//修改时间
private
LocalDateTime
modifiedTime
;
//修改时间
@KeyColumn
(
"id"
)
@KeyColumn
(
"id"
)
@Override
@Override
...
...
performance-web/src/main/java/com/clx/performance/model/IntegralTruck.java
浏览文件 @
7e670f9b
...
@@ -9,6 +9,8 @@ import lombok.Getter;
...
@@ -9,6 +9,8 @@ import lombok.Getter;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.Setter
;
import
java.time.LocalDateTime
;
/**
/**
* @Author: aiqinguo
* @Author: aiqinguo
* @Description: 积分车辆
* @Description: 积分车辆
...
@@ -30,8 +32,8 @@ public class IntegralTruck implements HasKey<Integer> {
...
@@ -30,8 +32,8 @@ public class IntegralTruck implements HasKey<Integer> {
private
Integer
echelon
;
//梯队
private
Integer
echelon
;
//梯队
private
Integer
integral
;
//积分
private
Integer
integral
;
//积分
private
Integer
rank
;
//排名
private
Integer
rank
;
//排名
private
String
createTime
;
//创建时间
private
LocalDateTime
createTime
;
//创建时间
private
String
modifiedTime
;
//修改时间
private
LocalDateTime
modifiedTime
;
//修改时间
@KeyColumn
(
"id"
)
@KeyColumn
(
"id"
)
@Override
@Override
...
...
performance-web/src/main/java/com/clx/performance/service/IntegralMqHandlerService.java
浏览文件 @
7e670f9b
...
@@ -2,6 +2,8 @@ package com.clx.performance.service;
...
@@ -2,6 +2,8 @@ package com.clx.performance.service;
import
com.clx.performance.param.mq.*
;
import
com.clx.performance.param.mq.*
;
import
java.time.LocalDateTime
;
public
interface
IntegralMqHandlerService
{
public
interface
IntegralMqHandlerService
{
void
truckAdd
(
IntegralTuckAddMqParam
mq
);
void
truckAdd
(
IntegralTuckAddMqParam
mq
);
...
@@ -21,5 +23,5 @@ public interface IntegralMqHandlerService {
...
@@ -21,5 +23,5 @@ public interface IntegralMqHandlerService {
void
integralRealTimeStatistics
(
Integer
statisticsId
);
void
integralRealTimeStatistics
(
Integer
statisticsId
);
void
integralRealTimeRankStatistics
(
String
statisticsDate
);
void
integralRealTimeRankStatistics
(
LocalDateTime
statisticsDate
);
}
}
performance-web/src/main/java/com/clx/performance/service/IntegralRecordService.java
浏览文件 @
7e670f9b
...
@@ -3,10 +3,12 @@ package com.clx.performance.service;
...
@@ -3,10 +3,12 @@ package com.clx.performance.service;
import
com.clx.performance.model.IntegralRecord
;
import
com.clx.performance.model.IntegralRecord
;
import
com.clx.performance.param.pc.IntegralRecordAddParam
;
import
com.clx.performance.param.pc.IntegralRecordAddParam
;
import
java.time.LocalDateTime
;
public
interface
IntegralRecordService
{
public
interface
IntegralRecordService
{
void
addRecord
(
IntegralRecordAddParam
param
);
void
addRecord
(
IntegralRecordAddParam
param
);
IntegralRecord
save
(
Integer
statisticsId
,
String
statisticsDate
,
String
truckNo
,
Integer
type
,
Integer
integral
,
String
remark
);
IntegralRecord
save
(
Integer
statisticsId
,
LocalDateTime
statisticsDate
,
String
truckNo
,
Integer
type
,
Integer
integral
,
String
remark
);
}
}
performance-web/src/main/java/com/clx/performance/service/IntegralStatisticsService.java
浏览文件 @
7e670f9b
...
@@ -6,12 +6,14 @@ import com.clx.performance.param.pc.pageIntegralStatisticsDetailParam;
...
@@ -6,12 +6,14 @@ import com.clx.performance.param.pc.pageIntegralStatisticsDetailParam;
import
com.clx.performance.vo.pc.IntegralRecordVO
;
import
com.clx.performance.vo.pc.IntegralRecordVO
;
import
com.clx.performance.vo.pc.IntegralStatisticsVO
;
import
com.clx.performance.vo.pc.IntegralStatisticsVO
;
import
java.time.LocalDateTime
;
public
interface
IntegralStatisticsService
{
public
interface
IntegralStatisticsService
{
IPage
<
IntegralStatisticsVO
>
pageStatisticsList
(
PageIntegralStatisticsParam
param
);
IPage
<
IntegralStatisticsVO
>
pageStatisticsList
(
PageIntegralStatisticsParam
param
);
IPage
<
IntegralRecordVO
>
pageStatisticsDetailList
(
pageIntegralStatisticsDetailParam
param
);
IPage
<
IntegralRecordVO
>
pageStatisticsDetailList
(
pageIntegralStatisticsDetailParam
param
);
int
protectionIntegralCalc
(
String
statisticsDate
);
int
protectionIntegralCalc
(
LocalDateTime
statisticsDate
);
int
protectionIntegralCalc
(
String
createTime
,
String
statisticsDate
);
int
protectionIntegralCalc
(
LocalDateTime
createTime
,
LocalDateTime
statisticsDate
);
}
}
performance-web/src/main/java/com/clx/performance/service/impl/IntegralMqHandlerServiceImpl.java
浏览文件 @
7e670f9b
...
@@ -57,7 +57,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -57,7 +57,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
truck
.
setDriverMobile
(
mq
.
getDriverMobile
());
truck
.
setDriverMobile
(
mq
.
getDriverMobile
());
truck
.
setEchelon
(
1
);
truck
.
setEchelon
(
1
);
String
statisticsDate
=
LocalDateTimeUtils
.
getWeekStart
();
LocalDateTime
statisticsDate
=
LocalDateTimeUtils
.
getStartWeek
();
int
protectionIntegral
=
integralStatisticsService
.
protectionIntegralCalc
(
statisticsDate
);
int
protectionIntegral
=
integralStatisticsService
.
protectionIntegralCalc
(
statisticsDate
);
int
baseIntegral
=
100
;
int
baseIntegral
=
100
;
...
@@ -72,7 +72,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -72,7 +72,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
IntegralStatistics
statisticsNext
=
new
IntegralStatistics
();
IntegralStatistics
statisticsNext
=
new
IntegralStatistics
();
statisticsNext
.
setTruckNo
(
truckNo
);
statisticsNext
.
setTruckNo
(
truckNo
);
statisticsNext
.
setStatisticsDate
(
LocalDateTimeUtils
.
formatTime
(
LocalDateTimeUtils
.
parseTime
(
statistics
.
getStatisticsDate
()).
plusDays
(
7
)
));
statisticsNext
.
setStatisticsDate
(
statistics
.
getStatisticsDate
().
plusDays
(
7
));
statisticsNext
.
setIntegralBase
(
0
);
statisticsNext
.
setIntegralBase
(
0
);
statisticsNext
.
setIntegral
(
0
);
statisticsNext
.
setIntegral
(
0
);
statisticsNext
.
setRank
(
1
);
statisticsNext
.
setRank
(
1
);
...
@@ -126,9 +126,9 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -126,9 +126,9 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
nextWeekTruckInit
(
IntegralNextWeekTruckInitMqParam
mq
){
public
void
nextWeekTruckInit
(
IntegralNextWeekTruckInitMqParam
mq
){
String
statisticsDateCurrent
=
mq
.
getStatisticsDate
(
);
LocalDateTime
statisticsDateCurrent
=
LocalDateTimeUtils
.
parseTime
(
mq
.
getStatisticsDate
()
);
String
statisticsDateNext
=
LocalDateTimeUtils
.
formatTime
(
LocalDateTimeUtils
.
parseTime
(
statisticsDateCurrent
).
plusDays
(
7
)
);
LocalDateTime
statisticsDateNext
=
statisticsDateCurrent
.
plusDays
(
7
);
// 查找本周车辆
// 查找本周车辆
List
<
IntegralStatistics
>
list
=
integralStatisticsDao
.
selectByStatisticsDate
(
statisticsDateCurrent
);
List
<
IntegralStatistics
>
list
=
integralStatisticsDao
.
selectByStatisticsDate
(
statisticsDateCurrent
);
...
@@ -173,7 +173,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -173,7 +173,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
}
}
// 更新本周实时排名
// 更新本周实时排名
integralRealTimeRankStatistics
(
mq
.
getStatisticsDate
(
));
integralRealTimeRankStatistics
(
LocalDateTimeUtils
.
parseTime
(
mq
.
getStatisticsDate
()
));
}
}
/**
/**
...
@@ -203,10 +203,10 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -203,10 +203,10 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
* 新车保护分
* 新车保护分
*/
*/
private
void
newTruckProtection
(
IntegralTruck
truck
,
IntegralStatistics
statistics
){
private
void
newTruckProtection
(
IntegralTruck
truck
,
IntegralStatistics
statistics
){
String
statisticsDate
=
statistics
.
getStatisticsDate
();
LocalDateTime
statisticsDate
=
statistics
.
getStatisticsDate
();
// 超过保护期
// 超过保护期
if
(
LocalDateTimeUtils
.
parseTime
(
truck
.
getCreateTime
()).
isBefore
(
LocalDateTimeUtils
.
parseTime
(
statisticsDate
)
.
minusDays
(
7
)))
{
return
;}
if
(
truck
.
getCreateTime
().
isBefore
(
statisticsDate
.
minusDays
(
7
)))
{
return
;}
// 已保护不处理
// 已保护不处理
IntegralRecord
record
=
integralRecordDao
.
selectByStatisticsIdAndType
(
statistics
.
getId
(),
IntegralRecord
.
type
.
PROTECTION
.
getValue
());
IntegralRecord
record
=
integralRecordDao
.
selectByStatisticsIdAndType
(
statistics
.
getId
(),
IntegralRecord
.
type
.
PROTECTION
.
getValue
());
...
@@ -233,7 +233,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -233,7 +233,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
IntegralRecord
record
=
integralRecordDao
.
selectByStatisticsIdAndType
(
statistics
.
getId
(),
IntegralRecord
.
type
.
SETTLEMENT
.
getValue
());
IntegralRecord
record
=
integralRecordDao
.
selectByStatisticsIdAndType
(
statistics
.
getId
(),
IntegralRecord
.
type
.
SETTLEMENT
.
getValue
());
if
(
null
!=
record
)
{
return
;}
if
(
null
!=
record
)
{
return
;}
String
statisticsDatePre
=
LocalDateTimeUtils
.
formatTime
(
LocalDateTimeUtils
.
parseTime
(
statistics
.
getStatisticsDate
()
).
minusDays
(
7
));
String
statisticsDatePre
=
LocalDateTimeUtils
.
formatTime
(
statistics
.
getStatisticsDate
(
).
minusDays
(
7
));
// 查找上周统计数据
// 查找上周统计数据
IntegralStatistics
statisticsPre
=
integralStatisticsDao
.
selectByTruckNoAndStatisticsDate
(
truck
.
getTruckNo
(),
statisticsDatePre
).
orNull
();
IntegralStatistics
statisticsPre
=
integralStatisticsDao
.
selectByTruckNoAndStatisticsDate
(
truck
.
getTruckNo
(),
statisticsDatePre
).
orNull
();
...
@@ -290,7 +290,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -290,7 +290,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
integralTruckDao
.
updateIntegral
(
truck
);
integralTruckDao
.
updateIntegral
(
truck
);
// 更新本周实时排名
// 更新本周实时排名
integralRealTimeRankStatistics
(
mq
.
getStatisticsDate
(
));
integralRealTimeRankStatistics
(
LocalDateTimeUtils
.
parseTime
(
mq
.
getStatisticsDate
()
));
}
}
...
@@ -578,7 +578,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
...
@@ -578,7 +578,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
integralRealTimeRankStatistics
(
String
statisticsDate
){
public
void
integralRealTimeRankStatistics
(
LocalDateTime
statisticsDate
){
List
<
IntegralStatistics
>
list
=
integralStatisticsDao
.
selectByStatisticsDate
(
statisticsDate
);
List
<
IntegralStatistics
>
list
=
integralStatisticsDao
.
selectByStatisticsDate
(
statisticsDate
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/IntegralRecordServiceImpl.java
浏览文件 @
7e670f9b
...
@@ -15,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -15,6 +15,8 @@ import lombok.extern.slf4j.Slf4j;
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
java.time.LocalDateTime
;
@Slf4j
@Slf4j
@Service
@Service
public
class
IntegralRecordServiceImpl
implements
IntegralRecordService
{
public
class
IntegralRecordServiceImpl
implements
IntegralRecordService
{
...
@@ -56,7 +58,7 @@ public class IntegralRecordServiceImpl implements IntegralRecordService {
...
@@ -56,7 +58,7 @@ public class IntegralRecordServiceImpl implements IntegralRecordService {
}
}
@Override
@Override
public
IntegralRecord
save
(
Integer
statisticsId
,
String
statisticsDate
,
String
truckNo
,
Integer
type
,
Integer
integral
,
String
remark
){
public
IntegralRecord
save
(
Integer
statisticsId
,
LocalDateTime
statisticsDate
,
String
truckNo
,
Integer
type
,
Integer
integral
,
String
remark
){
IntegralRecord
record
=
new
IntegralRecord
();
IntegralRecord
record
=
new
IntegralRecord
();
record
.
setStatisticsId
(
statisticsId
);
record
.
setStatisticsId
(
statisticsId
);
record
.
setStatisticsDate
(
statisticsDate
);
record
.
setStatisticsDate
(
statisticsDate
);
...
...
performance-web/src/main/java/com/clx/performance/service/impl/IntegralStatisticsServiceImpl.java
浏览文件 @
7e670f9b
...
@@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -58,23 +59,23 @@ public class IntegralStatisticsServiceImpl implements IntegralStatisticsService
...
@@ -58,23 +59,23 @@ public class IntegralStatisticsServiceImpl implements IntegralStatisticsService
* 新手积分计算
* 新手积分计算
*/
*/
@Override
@Override
public
int
protectionIntegralCalc
(
String
statisticsDate
)
{
public
int
protectionIntegralCalc
(
LocalDateTime
statisticsDate
)
{
int
day
=
diffDay
(
statisticsDate
,
LocalDateTimeUtils
.
get
String
DayStart
());
int
day
=
diffDay
(
statisticsDate
,
LocalDateTimeUtils
.
getDayStart
());
if
(
day
>=
7
)
{
return
0
;}
if
(
day
>=
7
)
{
return
0
;}
return
(
7
-
day
)*
30
;
return
(
7
-
day
)*
30
;
}
}
@Override
@Override
public
int
protectionIntegralCalc
(
String
createTime
,
String
statisticsDate
){
public
int
protectionIntegralCalc
(
LocalDateTime
createTime
,
LocalDateTime
statisticsDate
){
int
day
=
diffDay
(
LocalDateTimeUtils
.
get
String
DayStart
(
createTime
),
statisticsDate
);
int
day
=
diffDay
(
LocalDateTimeUtils
.
getDayStart
(
createTime
),
statisticsDate
);
if
(
day
>=
7
)
{
return
0
;}
if
(
day
>=
7
)
{
return
0
;}
return
(
7
-
day
)*
30
;
return
(
7
-
day
)*
30
;
}
}
private
int
diffDay
(
String
beginDate
,
String
endDate
){
private
int
diffDay
(
LocalDateTime
beginDate
,
LocalDateTime
endDate
){
long
day
=
Duration
.
between
(
LocalDateTimeUtils
.
parseTime
(
beginDate
),
LocalDateTimeUtils
.
parseTime
(
endDate
)
).
toDays
();
long
day
=
Duration
.
between
(
beginDate
,
endDate
).
toDays
();
return
Long
.
valueOf
(
day
).
intValue
();
return
Long
.
valueOf
(
day
).
intValue
();
}
}
...
...
performance-web/src/main/java/com/clx/performance/service/impl/IntegralTruckServiceImpl.java
浏览文件 @
7e670f9b
...
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -19,6 +19,7 @@ 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.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -60,7 +61,7 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
...
@@ -60,7 +61,7 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
truck
.
setDriverMobile
(
param
.
getDriverMobile
());
truck
.
setDriverMobile
(
param
.
getDriverMobile
());
truck
.
setEchelon
(
1
);
truck
.
setEchelon
(
1
);
String
statisticsDate
=
LocalDateTimeUtils
.
getWeekStart
();
LocalDateTime
statisticsDate
=
LocalDateTimeUtils
.
getStartWeek
();
int
protectionIntegral
=
integralStatisticsService
.
protectionIntegralCalc
(
statisticsDate
);
int
protectionIntegral
=
integralStatisticsService
.
protectionIntegralCalc
(
statisticsDate
);
int
baseIntegral
=
100
;
int
baseIntegral
=
100
;
...
@@ -75,7 +76,7 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
...
@@ -75,7 +76,7 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
IntegralStatistics
statisticsNext
=
new
IntegralStatistics
();
IntegralStatistics
statisticsNext
=
new
IntegralStatistics
();
statisticsNext
.
setTruckNo
(
truckNo
);
statisticsNext
.
setTruckNo
(
truckNo
);
statisticsNext
.
setStatisticsDate
(
LocalDateTimeUtils
.
formatTime
(
LocalDateTimeUtils
.
parseTime
(
statistics
.
getStatisticsDate
()).
plusDays
(
7
)
));
statisticsNext
.
setStatisticsDate
(
statistics
.
getStatisticsDate
().
plusDays
(
7
));
statisticsNext
.
setIntegralBase
(
0
);
statisticsNext
.
setIntegralBase
(
0
);
statisticsNext
.
setIntegral
(
0
);
statisticsNext
.
setIntegral
(
0
);
statisticsNext
.
setRank
(
1
);
statisticsNext
.
setRank
(
1
);
...
...
performance-web/src/main/java/com/clx/performance/utils/LocalDateTimeUtils.java
浏览文件 @
7e670f9b
...
@@ -391,4 +391,13 @@ public class LocalDateTimeUtils {
...
@@ -391,4 +391,13 @@ public class LocalDateTimeUtils {
public
static
String
getWeekStart
(
String
dateTime
)
{
public
static
String
getWeekStart
(
String
dateTime
)
{
return
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
LocalDateTime
.
of
(
parseLocalDate
(
dateTime
),
LocalTime
.
MIN
).
with
(
TemporalAdjusters
.
previousOrSame
(
DayOfWeek
.
MONDAY
)));
return
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
LocalDateTime
.
of
(
parseLocalDate
(
dateTime
),
LocalTime
.
MIN
).
with
(
TemporalAdjusters
.
previousOrSame
(
DayOfWeek
.
MONDAY
)));
}
}
public
static
LocalDateTime
getStartWeek
()
{
return
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
).
with
(
TemporalAdjusters
.
previousOrSame
(
DayOfWeek
.
MONDAY
));
}
public
static
LocalDateTime
getStartWeek
(
String
dateTime
)
{
return
LocalDateTime
.
of
(
parseLocalDate
(
dateTime
),
LocalTime
.
MIN
).
with
(
TemporalAdjusters
.
previousOrSame
(
DayOfWeek
.
MONDAY
));
}
public
static
LocalDateTime
getStartWeek
(
LocalDateTime
dateTime
)
{
return
LocalDateTime
.
of
(
dateTime
.
toLocalDate
(),
LocalTime
.
MIN
).
with
(
TemporalAdjusters
.
previousOrSame
(
DayOfWeek
.
MONDAY
));
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论