Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
1db3bbe1
提交
1db3bbe1
authored
11月 06, 2023
作者:
aiqingguo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
车辆层级配置
上级
81f3b9cd
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
655 行增加
和
0 行删除
+655
-0
PerformanceResultEnum.java
...java/com/clx/performance/enums/PerformanceResultEnum.java
+6
-0
IntegralTruckRuleSaveParam.java
...rmance/param/app/integral/IntegralTruckRuleSaveParam.java
+36
-0
IntegralTruckRuleStatusDeleteParam.java
...aram/app/integral/IntegralTruckRuleStatusDeleteParam.java
+23
-0
IntegralTruckRuleStatusUpdateParam.java
...aram/app/integral/IntegralTruckRuleStatusUpdateParam.java
+27
-0
IntegralTruckRuleUpdateParam.java
...ance/param/app/integral/IntegralTruckRuleUpdateParam.java
+38
-0
PageIntegralTruckRuleParam.java
...rmance/param/app/integral/PageIntegralTruckRuleParam.java
+15
-0
AppIntegralTruckRuleVO.java
...x/performance/vo/app/integral/AppIntegralTruckRuleVO.java
+46
-0
IntegralTruckRuleController.java
.../controller/app/integral/IntegralTruckRuleController.java
+89
-0
IntegralTruckRuleDaoImpl.java
...rformance/dao/impl/integral/IntegralTruckRuleDaoImpl.java
+55
-0
IntegralTruckRuleDao.java
...om/clx/performance/dao/integral/IntegralTruckRuleDao.java
+29
-0
IntegralTruckRuleMapper.java
.../performance/mapper/integral/IntegralTruckRuleMapper.java
+32
-0
IntegralTruckRule.java
...com/clx/performance/model/integral/IntegralTruckRule.java
+47
-0
IntegralTruckRuleServiceImpl.java
...e/service/impl/integral/IntegralTruckRuleServiceImpl.java
+154
-0
IntegralTruckRuleService.java
...erformance/service/integral/IntegralTruckRuleService.java
+17
-0
IntegralTruckRuleProvider.java
...mance/sqlProvider/integral/IntegralTruckRuleProvider.java
+27
-0
IntegralTruckRuleStruct.java
.../performance/struct/integral/IntegralTruckRuleStruct.java
+14
-0
没有找到文件。
performance-api/src/main/java/com/clx/performance/enums/PerformanceResultEnum.java
浏览文件 @
1db3bbe1
...
@@ -77,6 +77,12 @@ public enum PerformanceResultEnum implements ResultEnum {
...
@@ -77,6 +77,12 @@ public enum PerformanceResultEnum implements ResultEnum {
SETTLEMENT_NO_FOUND
(
1401
,
"结算单不存在"
),
SETTLEMENT_NO_FOUND
(
1401
,
"结算单不存在"
),
MONEY_NO_SAME
(
1501
,
"货主提现金额和平台支付金额不一致"
),
MONEY_NO_SAME
(
1501
,
"货主提现金额和平台支付金额不一致"
),
INTEGRAL_RULE_NO_FOUND
(
1600
,
"积分规则不存在"
),
INTEGRAL_RULE_RATIO_OVERLAP
(
1601
,
"层级划分范围重叠"
),
INTEGRAL_RULE_RATIO_ALL_EMPTY
(
1602
,
"层级划分范围不能全为空"
),
INTEGRAL_RULE_NAME_EXIST
(
1602
,
"层级名称已存在"
),
;
;
private
final
int
code
;
private
final
int
code
;
private
final
String
msg
;
private
final
String
msg
;
...
...
performance-api/src/main/java/com/clx/performance/param/app/integral/IntegralTruckRuleSaveParam.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
param
.
app
.
integral
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.math.BigDecimal
;
/**
* @Author: aiqingguo
* @Description: 新增积分
* @Date: 2023-10-11 17:30:57
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public
class
IntegralTruckRuleSaveParam
{
@ApiModelProperty
(
value
=
"层级名称"
,
example
=
""
)
private
String
name
;
@ApiModelProperty
(
value
=
"积分起始范围"
,
example
=
""
)
private
Integer
integralRatioBegin
;
@ApiModelProperty
(
value
=
"积分结束范围"
,
example
=
""
)
private
Integer
integralRatioEnd
;
@ApiModelProperty
(
value
=
"状态:1开启 2关闭"
,
example
=
""
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"预期收益开始范围(分)"
,
example
=
""
)
private
BigDecimal
incomeBegin
;
@ApiModelProperty
(
value
=
"预期收益结束范围(分)"
,
example
=
""
)
private
BigDecimal
incomeEnd
;
}
performance-api/src/main/java/com/clx/performance/param/app/integral/IntegralTruckRuleStatusDeleteParam.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
param
.
app
.
integral
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
* @Author: aiqingguo
* @Description: 新增积分
* @Date: 2023-10-11 17:30:57
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public
class
IntegralTruckRuleStatusDeleteParam
{
@ApiModelProperty
(
value
=
"id"
,
example
=
""
)
private
Integer
id
;
}
performance-api/src/main/java/com/clx/performance/param/app/integral/IntegralTruckRuleStatusUpdateParam.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
param
.
app
.
integral
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
* @Author: aiqingguo
* @Description: 新增积分
* @Date: 2023-10-11 17:30:57
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public
class
IntegralTruckRuleStatusUpdateParam
{
@ApiModelProperty
(
value
=
"id"
,
example
=
""
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"状态:1开启 2关闭"
,
example
=
""
)
private
Integer
status
;
}
performance-api/src/main/java/com/clx/performance/param/app/integral/IntegralTruckRuleUpdateParam.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
param
.
app
.
integral
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.math.BigDecimal
;
/**
* @Author: aiqingguo
* @Description: 新增积分
* @Date: 2023-10-11 17:30:57
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public
class
IntegralTruckRuleUpdateParam
{
@ApiModelProperty
(
value
=
"id"
,
example
=
""
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"层级名称"
,
example
=
""
)
private
String
name
;
@ApiModelProperty
(
value
=
"积分起始范围"
,
example
=
""
)
private
Integer
integralRatioBegin
;
@ApiModelProperty
(
value
=
"积分结束范围"
,
example
=
""
)
private
Integer
integralRatioEnd
;
@ApiModelProperty
(
value
=
"状态:1开启 2关闭"
,
example
=
""
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"预期收益开始范围(分)"
,
example
=
""
)
private
BigDecimal
incomeBegin
;
@ApiModelProperty
(
value
=
"预期收益结束范围(分)"
,
example
=
""
)
private
BigDecimal
incomeEnd
;
}
performance-api/src/main/java/com/clx/performance/param/app/integral/PageIntegralTruckRuleParam.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
param
.
app
.
integral
;
import
com.msl.common.base.PageParam
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
@Getter
@Setter
@NoArgsConstructor
@ToString
public
class
PageIntegralTruckRuleParam
extends
PageParam
{
}
performance-api/src/main/java/com/clx/performance/vo/app/integral/AppIntegralTruckRuleVO.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
vo
.
app
.
integral
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.math.BigDecimal
;
/**
* @Author: aiqinguo
* @Description: 车辆积分规则
* @Date: 2023/11/06 14:12:53
* @Version: 1.0
*/
@ApiModel
(
description
=
"车辆积分规则"
)
@Getter
@Setter
@ToString
@NoArgsConstructor
public
class
AppIntegralTruckRuleVO
{
@ApiModelProperty
(
value
=
"id"
,
example
=
""
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"层级名称"
,
example
=
""
)
private
String
name
;
@ApiModelProperty
(
value
=
"积分起始范围"
,
example
=
""
)
private
Integer
integralRatioBegin
;
@ApiModelProperty
(
value
=
"积分结束范围"
,
example
=
""
)
private
Integer
integralRatioEnd
;
@ApiModelProperty
(
value
=
"状态:1开启 2关闭"
,
example
=
""
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"预期收益开始范围(分)"
,
example
=
""
)
private
BigDecimal
incomeBegin
;
@ApiModelProperty
(
value
=
"预期收益结束范围(分)"
,
example
=
""
)
private
BigDecimal
incomeEnd
;
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
""
)
private
String
createTime
;
@ApiModelProperty
(
value
=
"修改时间"
,
example
=
""
)
private
String
modifiedTime
;
}
\ No newline at end of file
performance-web/src/main/java/com/clx/performance/controller/app/integral/IntegralTruckRuleController.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
controller
.
app
.
integral
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.param.app.collect.PageCollectLineReportParam
;
import
com.clx.performance.param.app.integral.*
;
import
com.clx.performance.service.integral.IntegralTruckRuleService
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
com.msl.common.base.PageData
;
import
com.msl.common.convertor.aspect.UnitCovert
;
import
com.msl.common.exception.ServiceSystemException
;
import
com.msl.common.result.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.constraints.NotBlank
;
@Slf4j
@RestController
@RequestMapping
(
value
=
"/app/driver/integral/rule"
)
@Validated
@Api
(
tags
=
"司机APP-积分记录"
)
@AllArgsConstructor
public
class
IntegralTruckRuleController
{
@Autowired
private
IntegralTruckRuleService
integralTruckRuleService
;
@ApiOperation
(
value
=
"新增车辆层级配置"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
value
=
"addRule"
)
@UnitCovert
public
Result
<
Void
>
addRule
(
@RequestBody
@Validated
IntegralTruckRuleSaveParam
param
)
{
if
(
param
.
getIntegralRatioBegin
()
==
null
&&
param
.
getIntegralRatioEnd
()==
null
){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_ALL_EMPTY
);
}
integralTruckRuleService
.
addRule
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"更新车辆层级配置"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/updateRule"
)
@UnitCovert
public
Result
<
Void
>
updateRule
(
@RequestBody
@Validated
IntegralTruckRuleUpdateParam
param
)
{
integralTruckRuleService
.
updateRule
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"更新车辆层级配置状态"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/updateRuleStatus"
)
public
Result
<
Void
>
updateRuleStatus
(
@RequestBody
@Validated
IntegralTruckRuleStatusUpdateParam
param
)
{
integralTruckRuleService
.
updateRuleStatus
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"删除车辆层级配置"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/deleteRule"
)
public
Result
<
Void
>
deleteRule
(
@RequestBody
@Validated
IntegralTruckRuleStatusDeleteParam
param
)
{
integralTruckRuleService
.
deleteRule
(
param
);
return
Result
.
ok
();
}
@ApiOperation
(
value
=
"查询车辆层级配置信息"
,
notes
=
"<br>By:艾庆国"
)
@GetMapping
(
value
=
"getRuleInfo"
)
@UnitCovert
(
param
=
false
)
public
Result
<
AppIntegralTruckRuleVO
>
getRuleInfo
(
@Validated
@NotBlank
(
message
=
"id不能为空"
)
Integer
id
)
{
return
Result
.
ok
(
integralTruckRuleService
.
getRuleInfo
(
id
));
}
@ApiOperation
(
value
=
"分页查询车辆层级配置列表"
,
notes
=
"<br>By:艾庆国"
)
@PostMapping
(
"/pageRule"
)
@UnitCovert
(
param
=
false
)
public
Result
<
PageData
<
AppIntegralTruckRuleVO
>>
pageRule
(
@RequestBody
@Validated
PageIntegralTruckRuleParam
param
)
{
IPage
<
AppIntegralTruckRuleVO
>
page
=
integralTruckRuleService
.
pageRule
(
param
);
return
Result
.
page
(
page
.
getRecords
(),
page
.
getTotal
(),
page
.
getPages
());
}
}
performance-web/src/main/java/com/clx/performance/dao/impl/integral/IntegralTruckRuleDaoImpl.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
dao
.
impl
.
integral
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.dao.integral.IntegralTruckRuleDao
;
import
com.clx.performance.mapper.integral.IntegralTruckRuleMapper
;
import
com.clx.performance.model.integral.IntegralTruckRule
;
import
com.clx.performance.param.app.integral.PageIntegralTruckRuleParam
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
com.msl.common.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @Author: aiqinguo
* @Description: 积分车辆规则
* @Date: 2023-10-9 12:00:54
* @Version: 1.0
*/
@Repository
public
class
IntegralTruckRuleDaoImpl
extends
BaseDaoImpl
<
IntegralTruckRuleMapper
,
IntegralTruckRule
,
Integer
>
implements
IntegralTruckRuleDao
{
@Override
public
boolean
update
(
IntegralTruckRule
item
)
{
return
update
(
lUdWrapper
()
.
eq
(
IntegralTruckRule:
:
getId
,
item
.
getId
())
.
set
(
IntegralTruckRule:
:
getStatus
,
item
.
getStatus
())
.
set
(
IntegralTruckRule:
:
getName
,
item
.
getName
())
.
set
(
IntegralTruckRule:
:
getIntegralRatioBegin
,
item
.
getIntegralRatioBegin
())
.
set
(
IntegralTruckRule:
:
getIntegralRatioEnd
,
item
.
getIntegralRatioEnd
())
.
set
(
IntegralTruckRule:
:
getIncomeBegin
,
item
.
getIncomeBegin
())
.
set
(
IntegralTruckRule:
:
getIncomeEnd
,
item
.
getIncomeEnd
())
);
}
@Override
public
boolean
updateStatus
(
IntegralTruckRule
item
)
{
return
update
(
lUdWrapper
()
.
eq
(
IntegralTruckRule:
:
getId
,
item
.
getId
())
.
set
(
IntegralTruckRule:
:
getStatus
,
item
.
getStatus
())
);
}
@Override
public
List
<
IntegralTruckRule
>
listAllRule
()
{
return
list
(
lQrWrapper
().
orderByAsc
(
IntegralTruckRule:
:
getIntegralRatioBegin
));
}
@Override
public
IPage
<
AppIntegralTruckRuleVO
>
pageRule
(
PageIntegralTruckRuleParam
param
)
{
Page
<
AppIntegralTruckRuleVO
>
page
=
Page
.
of
(
param
.
getPage
(),
param
.
getPageSize
());
return
baseMapper
.
pageRule
(
page
,
param
);
}
}
performance-web/src/main/java/com/clx/performance/dao/integral/IntegralTruckRuleDao.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
dao
.
integral
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.mapper.integral.IntegralTruckRuleMapper
;
import
com.clx.performance.model.integral.IntegralTruckRule
;
import
com.clx.performance.param.app.integral.PageIntegralTruckRuleParam
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
com.msl.common.dao.BaseDao
;
import
java.util.List
;
/**
* @Author: aiqinguo
* @Description: 积分车辆规则
* @Date: 2023-10-9 11:55:36
* @Version: 1.0
*/
public
interface
IntegralTruckRuleDao
extends
BaseDao
<
IntegralTruckRuleMapper
,
IntegralTruckRule
,
Integer
>
{
boolean
update
(
IntegralTruckRule
item
);
boolean
updateStatus
(
IntegralTruckRule
item
);
List
<
IntegralTruckRule
>
listAllRule
();
IPage
<
AppIntegralTruckRuleVO
>
pageRule
(
PageIntegralTruckRuleParam
param
);
}
performance-web/src/main/java/com/clx/performance/mapper/integral/IntegralTruckRuleMapper.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
mapper
.
integral
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.model.integral.IntegralTruckRule
;
import
com.clx.performance.param.app.integral.PageIntegralTruckRuleParam
;
import
com.clx.performance.sqlProvider.integral.IntegralTruckRuleProvider
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.SelectProvider
;
/**
* @Author: aiqinguo
* @Description: 积分车辆规则
* @Date: 2023-10-9 11:52:22
* @Version: 1.0
*/
@Mapper
public
interface
IntegralTruckRuleMapper
extends
BaseMapper
<
IntegralTruckRule
>
{
/**
* @see IntegralTruckRuleProvider#pageRule(com.baomidou.mybatisplus.extension.plugins.pagination.Page, com.clx.performance.param.app.integral.PageIntegralTruckRuleParam)
*/
@SelectProvider
(
type
=
IntegralTruckRuleProvider
.
class
,
method
=
"pageRule"
)
IPage
<
AppIntegralTruckRuleVO
>
pageRule
(
@Param
(
"page"
)
Page
<
AppIntegralTruckRuleVO
>
page
,
@Param
(
"param"
)
PageIntegralTruckRuleParam
param
);
}
\ No newline at end of file
performance-web/src/main/java/com/clx/performance/model/integral/IntegralTruckRule.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
model
.
integral
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.msl.common.config.KeyColumn
;
import
com.msl.common.model.HasKey
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
/**
* @Author: aiqinguo
* @Description: 车辆积分规则
* @Date: 2023/11/06 14:12:53
* @Version: 1.0
*/
@Getter
@Setter
@NoArgsConstructor
@TableName
(
autoResultMap
=
true
)
public
class
IntegralTruckRule
implements
HasKey
<
Integer
>
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
//id
private
String
name
;
//层级名称
private
Integer
echelon
;
//梯队
private
Integer
integralRatioBegin
;
//积分起始范围
private
Integer
integralRatioEnd
;
//积分结束范围
private
Integer
status
;
//状态:1开启 2关闭
private
BigDecimal
incomeBegin
;
//预期收益开始范围(分)
private
BigDecimal
incomeEnd
;
//预期收益结束范围(分)
private
LocalDateTime
createTime
;
//创建时间
private
LocalDateTime
modifiedTime
;
//修改时间
@KeyColumn
(
"id"
)
@Override
public
Integer
gainKey
()
{
return
id
;
}
}
\ No newline at end of file
performance-web/src/main/java/com/clx/performance/service/impl/integral/IntegralTruckRuleServiceImpl.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
service
.
impl
.
integral
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.dao.integral.IntegralTruckRuleDao
;
import
com.clx.performance.enums.PerformanceResultEnum
;
import
com.clx.performance.model.integral.IntegralTruckRule
;
import
com.clx.performance.param.app.integral.*
;
import
com.clx.performance.service.integral.IntegralTruckRuleService
;
import
com.clx.performance.struct.integral.IntegralTruckRuleStruct
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
com.msl.common.exception.ServiceSystemException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Slf4j
@Service
public
class
IntegralTruckRuleServiceImpl
implements
IntegralTruckRuleService
{
@Autowired
private
IntegralTruckRuleDao
integralTruckRuleDao
;
@Autowired
private
IntegralTruckRuleStruct
integralTruckRuleStruct
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addRule
(
IntegralTruckRuleSaveParam
param
)
{
IntegralTruckRule
rule
=
new
IntegralTruckRule
();
rule
.
setName
(
param
.
getName
());
rule
.
setStatus
(
param
.
getStatus
());
rule
.
setIntegralRatioBegin
(
param
.
getIntegralRatioBegin
());
rule
.
setIntegralRatioEnd
(
param
.
getIntegralRatioEnd
());
rule
.
setIncomeBegin
(
param
.
getIncomeBegin
());
rule
.
setIncomeEnd
(
param
.
getIncomeEnd
());
// 范围重叠验证
List
<
IntegralTruckRule
>
list
=
integralTruckRuleDao
.
listAllRule
();
if
(!
list
.
isEmpty
())
{
if
(
list
.
get
(
0
).
getIntegralRatioBegin
()
==
null
||
list
.
get
(
0
).
getIntegralRatioBegin
()
==
0
)
{
list
.
get
(
0
).
setIntegralRatioBegin
(-
1
);}
if
(
list
.
get
(
list
.
size
()-
1
).
getIntegralRatioEnd
()
==
null
||
list
.
get
(
list
.
size
()-
1
).
getIntegralRatioEnd
()
==
100
){
list
.
get
(
list
.
size
()-
1
).
setIntegralRatioEnd
(
101
);}
if
(
param
.
getIntegralRatioBegin
()
==
null
)
{
param
.
setIntegralRatioEnd
(
0
);}
if
(
param
.
getIntegralRatioEnd
()
==
null
){
param
.
setIntegralRatioEnd
(
100
);}
for
(
IntegralTruckRule
item
:
list
)
{
if
(
item
.
getName
().
equals
(
param
.
getName
()))
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_NAME_EXIST
);}
if
((
param
.
getIntegralRatioBegin
().
compareTo
(
item
.
getIntegralRatioBegin
())
>=
0
)
&&
(
param
.
getIntegralRatioBegin
().
compareTo
(
item
.
getIntegralRatioEnd
())
<
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
if
((
param
.
getIntegralRatioEnd
().
compareTo
(
item
.
getIntegralRatioBegin
())
>
0
)
&&
(
param
.
getIntegralRatioEnd
().
compareTo
(
item
.
getIntegralRatioEnd
())
<=
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
if
((
item
.
getIntegralRatioBegin
().
compareTo
(
param
.
getIntegralRatioBegin
())
>=
0
)
&&
(
item
.
getIntegralRatioBegin
().
compareTo
(
param
.
getIntegralRatioEnd
())
<
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
if
((
item
.
getIntegralRatioEnd
().
compareTo
(
param
.
getIntegralRatioBegin
())
>
0
)
&&
(
item
.
getIntegralRatioEnd
().
compareTo
(
param
.
getIntegralRatioEnd
())
<=
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
}
}
integralTruckRuleDao
.
saveEntity
(
rule
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateRule
(
IntegralTruckRuleUpdateParam
param
)
{
IntegralTruckRule
rule
=
integralTruckRuleDao
.
getEntityByKey
(
param
.
getId
()).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
rule
.
setName
(
param
.
getName
());
rule
.
setStatus
(
param
.
getStatus
());
rule
.
setIntegralRatioBegin
(
param
.
getIntegralRatioBegin
());
rule
.
setIntegralRatioEnd
(
param
.
getIntegralRatioEnd
());
rule
.
setIncomeBegin
(
param
.
getIncomeBegin
());
rule
.
setIncomeEnd
(
param
.
getIncomeEnd
());
// 范围重叠验证
List
<
IntegralTruckRule
>
list
=
integralTruckRuleDao
.
listAllRule
();
if
(!
list
.
isEmpty
())
{
if
(
list
.
get
(
0
).
getIntegralRatioBegin
()
==
null
||
list
.
get
(
0
).
getIntegralRatioBegin
()
==
0
)
{
list
.
get
(
0
).
setIntegralRatioBegin
(-
1
);}
if
(
list
.
get
(
list
.
size
()-
1
).
getIntegralRatioEnd
()
==
null
||
list
.
get
(
list
.
size
()-
1
).
getIntegralRatioEnd
()
==
100
){
list
.
get
(
list
.
size
()-
1
).
setIntegralRatioEnd
(
101
);}
if
(
param
.
getIntegralRatioBegin
()
==
null
)
{
param
.
setIntegralRatioEnd
(
0
);}
if
(
param
.
getIntegralRatioEnd
()
==
null
){
param
.
setIntegralRatioEnd
(
100
);}
for
(
IntegralTruckRule
item
:
list
)
{
if
(
item
.
getId
().
equals
(
rule
.
getId
()))
{
continue
;}
if
(
item
.
getName
().
equals
(
param
.
getName
()))
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_NAME_EXIST
);}
if
((
param
.
getIntegralRatioBegin
().
compareTo
(
item
.
getIntegralRatioBegin
())
>=
0
)
&&
(
param
.
getIntegralRatioBegin
().
compareTo
(
item
.
getIntegralRatioEnd
())
<
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
if
((
param
.
getIntegralRatioEnd
().
compareTo
(
item
.
getIntegralRatioBegin
())
>
0
)
&&
(
param
.
getIntegralRatioEnd
().
compareTo
(
item
.
getIntegralRatioEnd
())
<=
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
if
((
item
.
getIntegralRatioBegin
().
compareTo
(
param
.
getIntegralRatioBegin
())
>=
0
)
&&
(
item
.
getIntegralRatioBegin
().
compareTo
(
param
.
getIntegralRatioEnd
())
<
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
if
((
item
.
getIntegralRatioEnd
().
compareTo
(
param
.
getIntegralRatioBegin
())
>
0
)
&&
(
item
.
getIntegralRatioEnd
().
compareTo
(
param
.
getIntegralRatioEnd
())
<=
0
)){
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
INTEGRAL_RULE_RATIO_OVERLAP
);
}
}
}
integralTruckRuleDao
.
update
(
rule
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateRuleStatus
(
IntegralTruckRuleStatusUpdateParam
param
)
{
IntegralTruckRule
rule
=
integralTruckRuleDao
.
getEntityByKey
(
param
.
getId
()).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
rule
.
setStatus
(
param
.
getStatus
());
integralTruckRuleDao
.
updateStatus
(
rule
);
}
@Override
public
void
deleteRule
(
IntegralTruckRuleStatusDeleteParam
param
)
{
integralTruckRuleDao
.
deleteByKey
(
param
.
getId
());
}
@Override
public
AppIntegralTruckRuleVO
getRuleInfo
(
Integer
id
)
{
IntegralTruckRule
rule
=
integralTruckRuleDao
.
getEntityByKey
(
id
).
orElseThrow
(
PerformanceResultEnum
.
DATA_NOT_FIND
);
return
integralTruckRuleStruct
.
convert
(
rule
);
}
@Override
public
IPage
<
AppIntegralTruckRuleVO
>
pageRule
(
PageIntegralTruckRuleParam
param
)
{
return
integralTruckRuleDao
.
pageRule
(
param
);
}
}
performance-web/src/main/java/com/clx/performance/service/integral/IntegralTruckRuleService.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
service
.
integral
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.clx.performance.param.app.integral.*
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
public
interface
IntegralTruckRuleService
{
void
addRule
(
IntegralTruckRuleSaveParam
param
);
void
updateRule
(
IntegralTruckRuleUpdateParam
param
);
void
updateRuleStatus
(
IntegralTruckRuleStatusUpdateParam
param
);
void
deleteRule
(
IntegralTruckRuleStatusDeleteParam
param
);
AppIntegralTruckRuleVO
getRuleInfo
(
Integer
id
);
IPage
<
AppIntegralTruckRuleVO
>
pageRule
(
PageIntegralTruckRuleParam
param
);
}
performance-web/src/main/java/com/clx/performance/sqlProvider/integral/IntegralTruckRuleProvider.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
sqlProvider
.
integral
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.clx.performance.param.app.integral.PageIntegralTruckRuleParam
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.jdbc.SQL
;
public
class
IntegralTruckRuleProvider
{
public
String
pageRule
(
@Param
(
"page"
)
Page
<
AppIntegralTruckRuleVO
>
page
,
@Param
(
"param"
)
PageIntegralTruckRuleParam
param
)
{
return
new
SQL
(){{
SELECT
(
" id, name, "
+
" integral_ratio_begin as integralRatioBegin, integral_ratio_end as integralRatioEnd, "
+
" income_begin as incomeBegin, income_end as incomeEnd, "
+
" status, "
+
" date_format(create_time, '%Y-%m-%d %H:%i:%s') as createTime, "
+
" date_format(modified_time, '%Y-%m-%d %H:%i:%s') as modifiedTime "
);
FROM
(
"integral_truck_rule "
);
ORDER_BY
(
"create_time desc"
);
}}.
toString
();
}
}
performance-web/src/main/java/com/clx/performance/struct/integral/IntegralTruckRuleStruct.java
0 → 100644
浏览文件 @
1db3bbe1
package
com
.
clx
.
performance
.
struct
.
integral
;
import
com.clx.performance.model.integral.IntegralTruckRule
;
import
com.clx.performance.vo.app.integral.AppIntegralTruckRuleVO
;
import
com.msl.common.utils.DateStructUtil
;
import
com.msl.common.utils.DateUtils
;
import
org.mapstruct.Mapper
;
@Mapper
(
componentModel
=
"spring"
,
uses
=
DateStructUtil
.
class
,
imports
=
{
DateUtils
.
class
})
public
interface
IntegralTruckRuleStruct
{
AppIntegralTruckRuleVO
convert
(
IntegralTruckRule
item
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论