Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
a773ec3b
Commit
a773ec3b
authored
Oct 17, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除还款同时删除待办
parent
9518bd36
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
21 deletions
+88
-21
RepaymentController.java
.../boot/module/hygf/biz/controller/RepaymentController.java
+6
-11
RepaymentServiceImpl.java
...ot/module/hygf/biz/service/impl/RepaymentServiceImpl.java
+34
-10
ToDoTasksServiceImpl.java
...ot/module/hygf/biz/service/impl/ToDoTasksServiceImpl.java
+48
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/RepaymentController.java
View file @
a773ec3b
...
@@ -135,15 +135,9 @@ public class RepaymentController extends BaseController {
...
@@ -135,15 +135,9 @@ public class RepaymentController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"batchDelete"
)
@PostMapping
(
value
=
"batchDelete"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据sequenceNbr批量删除"
,
notes
=
"根据sequenceNbr批量删除"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据sequenceNbr批量删除"
,
notes
=
"根据sequenceNbr批量删除"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
@RequestBody
RepaymentBatchDto
repaymentBatchDto
)
{
public
ResponseModel
<?>
deleteBySequenceNbr
(
@RequestBody
RepaymentBatchDto
repaymentBatchDto
)
{
List
<
String
>
sequenceNbrList
=
repaymentBatchDto
.
getSequenceNbrList
();
repaymentService
.
deleteBatch
(
repaymentBatchDto
);
List
<
Long
>
list
=
new
ArrayList
<>();
return
ResponseHelper
.
buildResponse
(
null
);
if
(
CollectionUtil
.
isNotEmpty
(
sequenceNbrList
))
{
for
(
String
s
:
sequenceNbrList
)
{
list
.
add
(
Long
.
valueOf
(
s
));
}
}
return
ResponseHelper
.
buildResponse
(
repaymentService
.
deleteBatchSeq
(
list
));
}
}
/**
/**
...
@@ -188,8 +182,9 @@ public class RepaymentController extends BaseController {
...
@@ -188,8 +182,9 @@ public class RepaymentController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/delete"
)
@DeleteMapping
(
value
=
"/delete"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除"
,
notes
=
"根据sequenceNbr删除"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除"
,
notes
=
"根据sequenceNbr删除"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
@RequestParam
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
ResponseModel
<?>
deleteBySequenceNbr
(
@RequestParam
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
repaymentService
.
removeById
(
sequenceNbr
));
repaymentService
.
deleteBySequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
null
);
}
}
/**
/**
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/RepaymentServiceImpl.java
View file @
a773ec3b
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
...
@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import
com.yeejoin.amos.boot.biz.common.utils.ExcelUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.ExcelUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.*
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.*
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DropDown
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.DropDown
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentBatchDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.RepaymentDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PrivilegeCompany
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PrivilegeCompany
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Repayment
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.Repayment
;
...
@@ -106,7 +107,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -106,7 +107,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
if
(
CollectionUtil
.
isNotEmpty
(
sequenceNbrList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
sequenceNbrList
))
{
LambdaUpdateWrapper
<
Repayment
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
LambdaUpdateWrapper
<
Repayment
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
set
(
Repayment:
:
getRepayState
,
RepaymentRepayStateEnum
.
REPAY
.
getCode
())
updateWrapper
.
set
(
Repayment:
:
getRepayState
,
RepaymentRepayStateEnum
.
REPAY
.
getCode
())
.
set
(
Repayment:
:
getRepayCommitTime
,
new
Date
())
.
set
(
Repayment:
:
getRepayCommitTime
,
new
Date
())
.
in
(
Repayment:
:
getSequenceNbr
,
sequenceNbrList
);
.
in
(
Repayment:
:
getSequenceNbr
,
sequenceNbrList
);
this
.
update
(
updateWrapper
);
this
.
update
(
updateWrapper
);
}
}
...
@@ -165,7 +166,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -165,7 +166,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
Boolean
dateSend
=
betweenDay
==
15
||
betweenDay
==
5
||
betweenDay
==
0
;
Boolean
dateSend
=
betweenDay
==
15
||
betweenDay
==
5
||
betweenDay
==
0
;
if
(
dateSend
&&
repayment
.
getCronSendState
()
==
RepaymentCronSendStateEnum
.
SEND
.
getCode
())
{
if
(
dateSend
&&
repayment
.
getCronSendState
()
==
RepaymentCronSendStateEnum
.
SEND
.
getCode
())
{
//生成待办
//生成待办
RouthPathVO
routhPathVO
=
new
RouthPathVO
();
RouthPathVO
routhPathVO
=
new
RouthPathVO
();
routhPathVO
.
setRouthPathId
(
String
.
valueOf
(
repayment
.
getSequenceNbr
()));
routhPathVO
.
setRouthPathId
(
String
.
valueOf
(
repayment
.
getSequenceNbr
()));
String
routhPath
=
commonService
.
getRouthPath
(
BusinessTypeEnum
.
HYGF_REPAY
.
getCode
(),
routhPathVO
);
String
routhPath
=
commonService
.
getRouthPath
(
BusinessTypeEnum
.
HYGF_REPAY
.
getCode
(),
routhPathVO
);
ToDoTasks
toDoTasks
=
new
ToDoTasks
(
TaskTypeStationEnum
.
还款
.
getCode
(),
repayment
.
getSequenceNbr
(),
createTaskName
(
repayment
),
repayment
.
getRegionalCompaniesCode
(),
routhPath
);
ToDoTasks
toDoTasks
=
new
ToDoTasks
(
TaskTypeStationEnum
.
还款
.
getCode
(),
repayment
.
getSequenceNbr
(),
createTaskName
(
repayment
),
repayment
.
getRegionalCompaniesCode
(),
routhPath
);
...
@@ -190,12 +191,12 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -190,12 +191,12 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
* @param number
* @param number
* @return
* @return
*/
*/
private
String
dealDoubleToString
(
Double
number
){
private
String
dealDoubleToString
(
Double
number
)
{
if
(!
Objects
.
isNull
(
number
))
{
if
(!
Objects
.
isNull
(
number
))
{
DecimalFormat
df
=
new
DecimalFormat
(
"#.##"
);
DecimalFormat
df
=
new
DecimalFormat
(
"#.##"
);
return
df
.
format
(
number
);
return
df
.
format
(
number
);
}
}
return
"0.00"
;
return
"0.00"
;
}
}
private
String
createTaskName
(
Repayment
repayment
)
{
private
String
createTaskName
(
Repayment
repayment
)
{
...
@@ -229,7 +230,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -229,7 +230,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
List
<
Repayment
>
repaymentList
=
new
ArrayList
<>();
List
<
Repayment
>
repaymentList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
read
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
read
.
size
();
i
++)
{
List
<
Object
>
objects
=
read
.
get
(
i
);
List
<
Object
>
objects
=
read
.
get
(
i
);
checkExcel
(
objects
,
i
);
checkExcel
(
objects
,
i
);
Repayment
repayment
=
new
Repayment
();
Repayment
repayment
=
new
Repayment
();
String
companyName
=
String
.
valueOf
(
objects
.
get
(
0
));
String
companyName
=
String
.
valueOf
(
objects
.
get
(
0
));
for
(
DropDown
dropDown
:
region
)
{
for
(
DropDown
dropDown
:
region
)
{
...
@@ -276,10 +277,10 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -276,10 +277,10 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
}
}
}
}
private
void
checkExcel
(
List
<
Object
>
objects
,
int
i
)
{
private
void
checkExcel
(
List
<
Object
>
objects
,
int
i
)
{
if
(
objects
.
size
()
!=
7
)
{
if
(
objects
.
size
()
!=
7
)
{
int
col
=
i
+
2
;
int
col
=
i
+
2
;
throw
new
BadRequest
(
"第"
+
col
+
"行数据不符合规范,每一列需要有值"
);
throw
new
BadRequest
(
"第"
+
col
+
"行数据不符合规范,每一列需要有值"
);
}
}
String
companyName
=
String
.
valueOf
(
objects
.
get
(
0
));
String
companyName
=
String
.
valueOf
(
objects
.
get
(
0
));
if
(
StrUtil
.
isEmpty
(
companyName
))
{
if
(
StrUtil
.
isEmpty
(
companyName
))
{
...
@@ -374,7 +375,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -374,7 +375,7 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addOrUpdate
(
RepaymentDto
model
)
{
public
void
addOrUpdate
(
RepaymentDto
model
)
{
if
(
Objects
.
isNull
(
model
.
getSequenceNbr
()))
{
if
(
Objects
.
isNull
(
model
.
getSequenceNbr
()))
{
model
.
setCronSendState
(
RepaymentCronSendStateEnum
.
SEND
.
getCode
());
model
.
setCronSendState
(
RepaymentCronSendStateEnum
.
SEND
.
getCode
());
model
.
setMessageState
(
RepaymentMessageStateEnum
.
UN_CONFIRM
.
getCode
());
model
.
setMessageState
(
RepaymentMessageStateEnum
.
UN_CONFIRM
.
getCode
());
model
.
setRepayState
(
RepaymentRepayStateEnum
.
UN_REPAY
.
getCode
());
model
.
setRepayState
(
RepaymentRepayStateEnum
.
UN_REPAY
.
getCode
());
...
@@ -392,4 +393,27 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
...
@@ -392,4 +393,27 @@ public class RepaymentServiceImpl extends BaseService<RepaymentDto, Repayment, R
throw
new
BadRequest
(
"有重复数据请检查,区域公司、期次、还款日期、放款批次唯一"
);
throw
new
BadRequest
(
"有重复数据请检查,区域公司、期次、还款日期、放款批次唯一"
);
}
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteBatch
(
RepaymentBatchDto
repaymentBatchDto
)
{
List
<
String
>
sequenceNbrList
=
repaymentBatchDto
.
getSequenceNbrList
();
List
<
Long
>
list
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
sequenceNbrList
))
{
for
(
String
s
:
sequenceNbrList
)
{
list
.
add
(
Long
.
valueOf
(
s
));
}
}
deleteBatchSeq
(
list
);
//删除待办
toDoTasksService
.
deleteByBusinessIds
(
sequenceNbrList
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteBySequenceNbr
(
Long
sequenceNbr
)
{
deleteBySeq
(
sequenceNbr
);
//删除待办
List
<
String
>
sequenceNbrList
=
new
ArrayList
<>();
sequenceNbrList
.
add
(
String
.
valueOf
(
sequenceNbr
));
toDoTasksService
.
deleteByBusinessIds
(
sequenceNbrList
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/ToDoTasksServiceImpl.java
View file @
a773ec3b
...
@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.TasksRole
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.TasksRole
;
...
@@ -28,6 +30,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
...
@@ -28,6 +30,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -110,6 +113,51 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
...
@@ -110,6 +113,51 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
}
}
}
}
/**
*
* 删除和业务关联的所有数据
* @param businessIds
*/
@Transactional
public
void
deleteByBusinessIds
(
List
<
String
>
businessIds
)
{
try
{
if
(
CollectionUtil
.
isNotEmpty
(
businessIds
)){
if
(
businessIds
.
size
()
<
1000
){
LambdaQueryWrapper
<
ToDoTasks
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
ToDoTasks:
:
getBusinessId
,
businessIds
);
remove
(
wrapper
);
}
else
{
List
<
List
<
String
>>
lists
=
splitList
(
businessIds
,
1000
);
for
(
List
<
String
>
list
:
lists
)
{
LambdaQueryWrapper
<
ToDoTasks
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
ToDoTasks:
:
getBusinessId
,
list
);
remove
(
wrapper
);
}
}
}
else
{
log
.
error
(
"业务Id为空,不进行删除"
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
BadRequest
(
"业务删除失败!"
);
}
}
private
<
T
>
List
<
List
<
T
>>
splitList
(
List
<
T
>
list
,
int
chunkSize
)
{
List
<
List
<
T
>>
splitLists
=
new
ArrayList
<>();
int
totalSize
=
list
.
size
();
for
(
int
i
=
0
;
i
<
totalSize
;
i
+=
chunkSize
)
{
// 计算结束索引,确保不超过列表的大小
int
end
=
Math
.
min
(
i
+
chunkSize
,
totalSize
);
// 使用 subList 方法获取子列表
List
<
T
>
sublist
=
list
.
subList
(
i
,
end
);
splitLists
.
add
(
new
ArrayList
<>(
sublist
));
// 创建新的 ArrayList 以避免 ConcurrentModificationException
}
return
splitLists
;
}
@Transactional
@Transactional
public
void
addToDoTasksByUserIds
(
List
<
String
>
userIds
,
ToDoTasks
toDoTasks
)
{
public
void
addToDoTasksByUserIds
(
List
<
String
>
userIds
,
ToDoTasks
toDoTasks
)
{
try
{
try
{
...
...
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