Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-csf
Commits
4f3200b4
Commit
4f3200b4
authored
Sep 24, 2025
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fna接口47
parent
0fcfed7b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
186 additions
and
63 deletions
+186
-63
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFnaController.java
+17
-28
yd-csf-service/src/main/java/com/yd/csf/service/dao/FnaMapper.java
+1
-0
yd-csf-service/src/main/java/com/yd/csf/service/dto/FnaCopyRequest.java
+13
-0
yd-csf-service/src/main/java/com/yd/csf/service/enums/FnaStatusEnum.java
+29
-0
yd-csf-service/src/main/java/com/yd/csf/service/model/Fna.java
+5
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/FnaFormService.java
+2
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/FnaService.java
+3
-4
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaFormServiceImpl.java
+8
-0
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaServiceImpl.java
+102
-30
yd-csf-service/src/main/resources/mappers/FnaMapper.xml
+6
-1
No files found.
yd-csf-api/src/main/java/com/yd/csf/api/controller/ApiFnaController.java
View file @
4f3200b4
package
com
.
yd
.
csf
.
api
.
controller
;
package
com
.
yd
.
csf
.
api
.
controller
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.common.result.Result
;
import
com.yd.csf.api.service.ApiAppointmentService
;
import
com.yd.csf.api.service.ApiAppointmentService
;
import
com.yd.csf.feign.dto.appointment.ApiAppointmentInfoDto
;
import
com.yd.csf.feign.dto.appointment.ApiAppointmentInfoDto
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.dto.DeleteFnaRequest
;
import
com.yd.csf.service.dto.FnaAddRequest
;
import
com.yd.csf.service.dto.FnaQueryRequest
;
import
com.yd.csf.service.dto.FnaUpdateRequest
;
import
com.yd.csf.service.model.Customer
;
import
com.yd.csf.service.model.Customer
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.service.CustomerService
;
import
com.yd.csf.service.service.CustomerService
;
...
@@ -54,7 +51,7 @@ public class ApiFnaController {
...
@@ -54,7 +51,7 @@ public class ApiFnaController {
@Operation
(
summary
=
"新建流程"
)
@Operation
(
summary
=
"新建流程"
)
public
Result
<
Map
<
String
,
Object
>>
addFna
(
@RequestBody
FnaAddRequest
fnaAddRequest
,
HttpServletRequest
request
)
{
public
Result
<
Map
<
String
,
Object
>>
addFna
(
@RequestBody
FnaAddRequest
fnaAddRequest
,
HttpServletRequest
request
)
{
if
(
fnaAddRequest
==
null
)
{
if
(
fnaAddRequest
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
Error
Code
.
PARAMS_ERROR
.
getMessage
());
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
Result
Code
.
PARAMS_ERROR
.
getMessage
());
}
}
return
Result
.
success
(
fnaService
.
addFna
(
fnaAddRequest
));
return
Result
.
success
(
fnaService
.
addFna
(
fnaAddRequest
));
}
}
...
@@ -70,7 +67,7 @@ public class ApiFnaController {
...
@@ -70,7 +67,7 @@ public class ApiFnaController {
@Operation
(
summary
=
"删除流程"
)
@Operation
(
summary
=
"删除流程"
)
public
Result
<
Boolean
>
deleteFna
(
@RequestBody
DeleteFnaRequest
deleteRequest
,
HttpServletRequest
request
)
{
public
Result
<
Boolean
>
deleteFna
(
@RequestBody
DeleteFnaRequest
deleteRequest
,
HttpServletRequest
request
)
{
if
(
deleteRequest
==
null
||
StringUtils
.
isBlank
(
deleteRequest
.
getFnaBizId
()))
{
if
(
deleteRequest
==
null
||
StringUtils
.
isBlank
(
deleteRequest
.
getFnaBizId
()))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
Error
Code
.
PARAMS_ERROR
.
getMessage
());
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
Result
Code
.
PARAMS_ERROR
.
getMessage
());
}
}
return
Result
.
success
(
fnaService
.
deleteFna
(
deleteRequest
));
return
Result
.
success
(
fnaService
.
deleteFna
(
deleteRequest
));
}
}
...
@@ -85,7 +82,7 @@ public class ApiFnaController {
...
@@ -85,7 +82,7 @@ public class ApiFnaController {
@Operation
(
summary
=
"更新流程"
)
@Operation
(
summary
=
"更新流程"
)
public
Result
<
Boolean
>
updateFna
(
@RequestBody
FnaUpdateRequest
fnaUpdateRequest
)
{
public
Result
<
Boolean
>
updateFna
(
@RequestBody
FnaUpdateRequest
fnaUpdateRequest
)
{
if
(
fnaUpdateRequest
==
null
||
StringUtils
.
isBlank
(
fnaUpdateRequest
.
getFnaBizId
()))
{
if
(
fnaUpdateRequest
==
null
||
StringUtils
.
isBlank
(
fnaUpdateRequest
.
getFnaBizId
()))
{
throw
new
BusinessException
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
Error
Code
.
PARAMS_ERROR
.
getMessage
());
throw
new
BusinessException
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
Result
Code
.
PARAMS_ERROR
.
getMessage
());
}
}
String
appointmentNo
=
null
;
String
appointmentNo
=
null
;
if
(
StringUtils
.
isNotBlank
(
fnaUpdateRequest
.
getAppointmentBizId
()))
{
if
(
StringUtils
.
isNotBlank
(
fnaUpdateRequest
.
getAppointmentBizId
()))
{
...
@@ -109,12 +106,12 @@ public class ApiFnaController {
...
@@ -109,12 +106,12 @@ public class ApiFnaController {
@Operation
(
summary
=
"流程详情"
)
@Operation
(
summary
=
"流程详情"
)
public
Result
<
FnaVO
>
getFnaVOByBizId
(
String
fnaBizId
,
HttpServletRequest
request
)
{
public
Result
<
FnaVO
>
getFnaVOByBizId
(
String
fnaBizId
,
HttpServletRequest
request
)
{
if
(
StringUtils
.
isBlank
(
fnaBizId
))
{
if
(
StringUtils
.
isBlank
(
fnaBizId
))
{
return
Result
.
fail
(
ErrorCode
.
PARAMS_ERROR
.
getCode
(),
Error
Code
.
PARAMS_ERROR
.
getMessage
());
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
Result
Code
.
PARAMS_ERROR
.
getMessage
());
}
}
// 查询数据库
// 查询数据库
Fna
fna
=
fnaService
.
getByBizId
(
fnaBizId
);
Fna
fna
=
fnaService
.
getByBizId
(
fnaBizId
);
if
(
fna
==
null
)
{
if
(
fna
==
null
)
{
return
Result
.
fail
(
ErrorCode
.
NOT_FOUND_ERROR
.
getCode
(),
ErrorCode
.
NOT_FOUND
_ERROR
.
getMessage
());
return
Result
.
fail
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL
_ERROR
.
getMessage
());
}
}
// 获取封装类
// 获取封装类
...
@@ -139,26 +136,18 @@ public class ApiFnaController {
...
@@ -139,26 +136,18 @@ public class ApiFnaController {
}
}
/**
/**
*
分页获取fna列表(封装类)
*
生成副本
*
*
* @param fna
Quer
yRequest
* @param fna
Cop
yRequest
* @param request
* @param request
* @return
* @return
*/
*/
// @PostMapping("/list/page/vo")
@PostMapping
(
"/copy"
)
// public Result<Page<Fna>> listFnaVOByPage(@RequestBody FnaQueryRequest fnaQueryRequest,
@Operation
(
summary
=
"生成副本"
)
// HttpServletRequest request) {
public
Result
<
Map
<
String
,
Object
>>
copyFna
(
@RequestBody
FnaCopyRequest
fnaCopyRequest
,
HttpServletRequest
request
)
{
// long current = fnaQueryRequest.getPageNo();
if
(
fnaCopyRequest
==
null
||
StringUtils
.
isBlank
(
fnaCopyRequest
.
getFnaBizId
()))
{
// long size = fnaQueryRequest.getPageSize();
return
Result
.
fail
(
ResultCode
.
PARAMS_ERROR
.
getCode
(),
ResultCode
.
PARAMS_ERROR
.
getMessage
());
//
}
// // 查询数据库
return
Result
.
success
(
fnaService
.
copyFna
(
fnaCopyRequest
));
// Page<Fna> fnaPage = fnaService.page(new Page<>(current, size),
}
// fnaService.getQueryWrapper(fnaQueryRequest));
// // 获取封装类
//// return Result.success(fnaService.getFnaVOPage(fnaPage, request));
//
// return Result.success(fnaPage);
// }
}
}
yd-csf-service/src/main/java/com/yd/csf/service/dao/FnaMapper.java
View file @
4f3200b4
...
@@ -11,6 +11,7 @@ import com.yd.csf.service.model.Fna;
...
@@ -11,6 +11,7 @@ import com.yd.csf.service.model.Fna;
*/
*/
public
interface
FnaMapper
extends
BaseMapper
<
Fna
>
{
public
interface
FnaMapper
extends
BaseMapper
<
Fna
>
{
boolean
updateFnaNoById
(
String
fnaNo
,
Long
id
);
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/dto/FnaCopyRequest.java
0 → 100644
View file @
4f3200b4
package
com
.
yd
.
csf
.
service
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
@Data
public
class
FnaCopyRequest
{
/**
* 原流程业务ID
*/
@Schema
(
description
=
"原流程业务ID"
)
private
String
fnaBizId
;
}
yd-csf-service/src/main/java/com/yd/csf/service/enums/FnaStatusEnum.java
0 → 100644
View file @
4f3200b4
package
com
.
yd
.
csf
.
service
.
enums
;
/**
* fna状态枚举 'DRAFT'-草稿, 'UNCOMPLETED'-未完成, 'COMPLETED'-已完成
*/
public
enum
FnaStatusEnum
{
DRAFT
(
"草稿"
,
"DRAFT"
),
UNCOMPLETED
(
"未完成"
,
"UNCOMPLETED"
),
COMPLETED
(
"已完成"
,
"COMPLETED"
),
;
//字典项标签(名称)
private
String
itemLabel
;
//字典项值
private
String
itemValue
;
//构造函数
FnaStatusEnum
(
String
itemLabel
,
String
itemValue
)
{
this
.
itemLabel
=
itemLabel
;
this
.
itemValue
=
itemValue
;
}
public
String
getItemLabel
()
{
return
itemLabel
;
}
public
String
getItemValue
()
{
return
itemValue
;
}
}
yd-csf-service/src/main/java/com/yd/csf/service/model/Fna.java
View file @
4f3200b4
...
@@ -32,6 +32,11 @@ public class Fna implements Serializable {
...
@@ -32,6 +32,11 @@ public class Fna implements Serializable {
private
String
fnaNo
;
private
String
fnaNo
;
/**
/**
* 租户编码
*/
private
String
tenantCode
;
/**
* 系统用户唯一业务ID
* 系统用户唯一业务ID
*/
*/
private
String
userBizId
;
private
String
userBizId
;
...
...
yd-csf-service/src/main/java/com/yd/csf/service/service/FnaFormService.java
View file @
4f3200b4
...
@@ -56,4 +56,6 @@ public interface FnaFormService extends IService<FnaForm> {
...
@@ -56,4 +56,6 @@ public interface FnaFormService extends IService<FnaForm> {
FnaForm
getFnaForm
(
FnaFormUpdateRequest
fnaFormUpdateRequest
);
FnaForm
getFnaForm
(
FnaFormUpdateRequest
fnaFormUpdateRequest
);
FnaForm
getByFnaFormBizId
(
String
fnaFormBizId
);
FnaForm
getByFnaFormBizId
(
String
fnaFormBizId
);
PersonalData
getPersonalDataObj
(
Object
personalData
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/FnaService.java
View file @
4f3200b4
...
@@ -2,11 +2,8 @@ package com.yd.csf.service.service;
...
@@ -2,11 +2,8 @@ package com.yd.csf.service.service;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yd.csf.service.dto.DeleteFnaRequest
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.dto.FnaAddRequest
;
import
com.yd.csf.service.dto.FnaQueryRequest
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yd.csf.service.dto.FnaUpdateRequest
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.vo.FnaVO
;
import
com.yd.csf.service.vo.FnaVO
;
...
@@ -54,4 +51,6 @@ public interface FnaService extends IService<Fna> {
...
@@ -54,4 +51,6 @@ public interface FnaService extends IService<Fna> {
Fna
queryOne
(
String
fnaBizId
);
Fna
queryOne
(
String
fnaBizId
);
Boolean
updateFna
(
FnaUpdateRequest
fnaUpdateRequest
,
String
appointmentNo
);
Boolean
updateFna
(
FnaUpdateRequest
fnaUpdateRequest
,
String
appointmentNo
);
Map
<
String
,
Object
>
copyFna
(
FnaCopyRequest
fnaCopyRequest
);
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaFormServiceImpl.java
View file @
4f3200b4
...
@@ -247,4 +247,12 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
...
@@ -247,4 +247,12 @@ public class FnaFormServiceImpl extends ServiceImpl<FnaFormMapper, FnaForm> impl
return
baseMapper
.
selectOne
(
queryWrapper
);
return
baseMapper
.
selectOne
(
queryWrapper
);
}
}
@Override
public
PersonalData
getPersonalDataObj
(
Object
personalData
)
{
if
(
personalData
==
null
)
{
return
new
PersonalData
();
}
return
GSON
.
fromJson
(
personalData
.
toString
(),
PersonalData
.
class
);
}
}
}
yd-csf-service/src/main/java/com/yd/csf/service/service/impl/FnaServiceImpl.java
View file @
4f3200b4
...
@@ -7,20 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
...
@@ -7,20 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.gson.Gson
;
import
com.yd.auth.core.dto.AuthUserDto
;
import
com.yd.auth.core.dto.AuthUserDto
;
import
com.yd.auth.core.utils.SecurityUtil
;
import
com.yd.auth.core.utils.SecurityUtil
;
import
com.yd.common.constant.CommonConstant
;
import
com.yd.common.constant.CommonConstant
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.enums.CommonEnum
;
import
com.yd.common.enums.ResultCode
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.exception.BusinessException
;
import
com.yd.common.result.Result
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.common.utils.RandomStringGenerator
;
import
com.yd.csf.feign.dto.appointment.ApiAppointmentInfoDto
;
import
com.yd.csf.service.common.ErrorCode
;
import
com.yd.csf.service.dao.FnaMapper
;
import
com.yd.csf.service.dao.FnaMapper
;
import
com.yd.csf.service.dto.DeleteFnaRequest
;
import
com.yd.csf.service.dto.*
;
import
com.yd.csf.service.dto.FnaAddRequest
;
import
com.yd.csf.service.enums.FnaStatusEnum
;
import
com.yd.csf.service.dto.FnaQueryRequest
;
import
com.yd.csf.service.dto.FnaUpdateRequest
;
import
com.yd.csf.service.model.Customer
;
import
com.yd.csf.service.model.Customer
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.Fna
;
import
com.yd.csf.service.model.FnaForm
;
import
com.yd.csf.service.model.FnaForm
;
...
@@ -39,10 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -39,10 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -53,17 +48,13 @@ import java.util.stream.Collectors;
...
@@ -53,17 +48,13 @@ import java.util.stream.Collectors;
@Slf4j
@Slf4j
public
class
FnaServiceImpl
extends
ServiceImpl
<
FnaMapper
,
Fna
>
implements
FnaService
{
public
class
FnaServiceImpl
extends
ServiceImpl
<
FnaMapper
,
Fna
>
implements
FnaService
{
// @Resource
// private UserService userService;
@Autowired
@Autowired
private
FnaFormService
fnaFormService
;
private
FnaFormService
fnaFormService
;
@Resource
@Resource
private
CustomerService
customerService
;
private
CustomerService
customerService
;
@Resource
private
AppointmentServiceImpl
appointmentService
;
private
final
static
Gson
GSON
=
new
Gson
();
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -76,11 +67,7 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
...
@@ -76,11 +67,7 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
String
userBizId
=
authUserDto
.
getUserBizId
();
String
userBizId
=
authUserDto
.
getUserBizId
();
fna
.
setUserBizId
(
userBizId
);
fna
.
setUserBizId
(
userBizId
);
fna
.
setFnaBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FNA
.
getCode
()));
String
fnaBizId
=
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FNA
.
getCode
());
fna
.
setFnaBizId
(
fnaBizId
);
fna
.
setFnaNo
(
generateFnaNo
(
fnaAddRequest
.
getTenantCode
(),
fnaBizId
));
fna
.
setCreatorId
(
userBizId
);
fna
.
setCreatorId
(
userBizId
);
fna
.
setUpdaterId
(
userBizId
);
fna
.
setUpdaterId
(
userBizId
);
fna
.
setStatus
(
"DRAFT"
);
fna
.
setStatus
(
"DRAFT"
);
...
@@ -91,28 +78,38 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
...
@@ -91,28 +78,38 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
// 写入数据库
// 写入数据库
boolean
result
=
this
.
save
(
fna
);
boolean
result
=
this
.
save
(
fna
);
if
(!
result
)
{
if
(!
result
)
{
throw
new
BusinessException
(
ErrorCode
.
OPERATION_ERROR
.
getCode
(),
ErrorCode
.
OPERATION_ERROR
.
getMessage
());
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
ResultCode
.
FAIL
.
getMessage
());
}
}
// 生成fna编号
String
fnaNo
=
generateFnaNo
(
fnaAddRequest
.
getTenantCode
(),
fna
.
getId
());
// 更新fna
baseMapper
.
updateFnaNoById
(
fnaNo
,
fna
.
getId
());
// 组装返回
// 组装返回
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"fnaBizId"
,
fna
BizId
);
map
.
put
(
"fnaBizId"
,
fna
.
getFnaBizId
()
);
return
map
;
return
map
;
}
}
/**
/**
* 生成f流程编号
* 生成f流程编号
* 流程编号格式:租户编号-流程类型-创建时间(YY-MM-DD)-
bizl
d
* 流程编号格式:租户编号-流程类型-创建时间(YY-MM-DD)-
i
d
*
*
* @param tenantCode
* @param tenantCode
* @param fna
Biz
Id
* @param fnaId
* @return
* @return
*/
*/
private
String
generateFnaNo
(
String
tenantCode
,
String
fnaBiz
Id
)
{
private
String
generateFnaNo
(
String
tenantCode
,
Long
fna
Id
)
{
String
defaultTenantCode
=
"CSF"
;
String
defaultTenantCode
=
"CSF"
;
if
(
StringUtils
.
isBlank
(
tenantCode
))
{
if
(
StringUtils
.
isBlank
(
tenantCode
))
{
tenantCode
=
defaultTenantCode
;
tenantCode
=
defaultTenantCode
;
}
}
return
tenantCode
+
"-B-"
+
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
))
+
"-"
+
fnaBizId
;
// 如果 fnaId 不足 4位,则补足 4位,超过则不变
String
fnaIdstr
=
String
.
valueOf
(
fnaId
);
if
(
fnaId
<
1000L
)
{
fnaIdstr
=
String
.
format
(
"%04d"
,
fnaId
);
}
return
tenantCode
+
"-B-"
+
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
))
+
"-"
+
fnaIdstr
;
}
}
/**
/**
...
@@ -256,12 +253,12 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
...
@@ -256,12 +253,12 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
// 判断是否存在
// 判断是否存在
Fna
oldFna
=
this
.
getByBizId
(
fnaBizId
);
Fna
oldFna
=
this
.
getByBizId
(
fnaBizId
);
if
(
oldFna
==
null
)
{
if
(
oldFna
==
null
)
{
throw
new
BusinessException
(
ErrorCode
.
NOT_FOUND_ERROR
.
getCode
(),
ErrorCode
.
NOT_FOUND
_ERROR
.
getMessage
());
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL
_ERROR
.
getMessage
());
}
}
// 操作数据库
// 操作数据库
boolean
result
=
this
.
removeById
(
oldFna
.
getId
());
boolean
result
=
this
.
removeById
(
oldFna
.
getId
());
if
(!
result
)
{
if
(!
result
)
{
throw
new
BusinessException
(
ErrorCode
.
OPERATION_ERROR
.
getCode
(),
ErrorCode
.
OPERATION_ERROR
.
getMessage
());
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
ResultCode
.
FAIL
.
getMessage
());
}
}
return
result
;
return
result
;
}
}
...
@@ -282,7 +279,7 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
...
@@ -282,7 +279,7 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
String
fnaBizId
=
fnaUpdateRequest
.
getFnaBizId
();
String
fnaBizId
=
fnaUpdateRequest
.
getFnaBizId
();
Fna
fna
=
this
.
getByBizId
(
fnaBizId
);
Fna
fna
=
this
.
getByBizId
(
fnaBizId
);
if
(
fna
==
null
)
{
if
(
fna
==
null
)
{
throw
new
BusinessException
(
ErrorCode
.
NOT_FOUND_ERROR
.
getCode
(),
ErrorCode
.
NOT_FOUND
_ERROR
.
getMessage
());
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL
_ERROR
.
getMessage
());
}
}
BeanUtils
.
copyProperties
(
fnaUpdateRequest
,
fna
,
"fnaBizId"
);
BeanUtils
.
copyProperties
(
fnaUpdateRequest
,
fna
,
"fnaBizId"
);
...
@@ -308,4 +305,79 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
...
@@ -308,4 +305,79 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
return
this
.
updateById
(
fna
);
return
this
.
updateById
(
fna
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Map
<
String
,
Object
>
copyFna
(
FnaCopyRequest
fnaCopyRequest
)
{
String
fnaBizId
=
fnaCopyRequest
.
getFnaBizId
();
Fna
oldFna
=
this
.
getByBizId
(
fnaBizId
);
if
(
oldFna
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL_ERROR
.
getMessage
());
}
// 获取Security上下文当前用户的登录信息
AuthUserDto
authUserDto
=
SecurityUtil
.
getCurrentLoginUser
();
String
userBizId
=
authUserDto
.
getUserBizId
();
// 新建流程
Fna
newFna
=
new
Fna
();
// 租户编码
newFna
.
setTenantCode
(
oldFna
.
getTenantCode
());
// 复制 客户信息
newFna
.
setCustomerName
(
oldFna
.
getCustomerName
());
newFna
.
setFnaFormBizId
(
oldFna
.
getFnaFormBizId
());
newFna
.
setUserBizId
(
userBizId
);
newFna
.
setFnaBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FNA
.
getCode
()));
newFna
.
setCreatorId
(
userBizId
);
newFna
.
setUpdaterId
(
userBizId
);
newFna
.
setStatus
(
FnaStatusEnum
.
UNCOMPLETED
.
getItemValue
());
Date
date
=
new
Date
();
newFna
.
setCreateTime
(
date
);
newFna
.
setUpdateTime
(
date
);
// 保存 fna
boolean
result
=
this
.
save
(
newFna
);
if
(!
result
)
{
throw
new
BusinessException
(
ResultCode
.
FAIL
.
getCode
(),
ResultCode
.
FAIL
.
getMessage
());
}
// 生成fna编号
String
fnaNo
=
generateFnaNo
(
oldFna
.
getTenantCode
(),
newFna
.
getId
());
// 复制 FnaForm
String
newFnaFormBizId
=
copyFnaForm
(
oldFna
.
getFnaFormBizId
(),
userBizId
);
// 更新 fna
Fna
updateFna
=
new
Fna
();
updateFna
.
setId
(
newFna
.
getId
());
updateFna
.
setFnaNo
(
fnaNo
);
updateFna
.
setFnaFormBizId
(
newFnaFormBizId
);
this
.
updateById
(
updateFna
);
return
Collections
.
singletonMap
(
"fnaBizId"
,
newFna
.
getFnaBizId
());
}
private
String
copyFnaForm
(
String
oldFnaFormBizId
,
String
userBizId
)
{
FnaForm
fnaForm
=
fnaFormService
.
getByFnaFormBizId
(
oldFnaFormBizId
);
if
(
fnaForm
==
null
)
{
throw
new
BusinessException
(
ResultCode
.
NULL_ERROR
.
getCode
(),
ResultCode
.
NULL_ERROR
.
getMessage
());
}
// 处理个人资料
PersonalData
personalData
=
fnaFormService
.
getPersonalDataObj
(
fnaForm
.
getPersonalData
());
personalData
.
setAccountName
(
null
);
personalData
.
setRegistrationNumber
(
null
);
personalData
.
setNumber
(
null
);
FnaForm
newFnaForm
=
new
FnaForm
();
BeanUtils
.
copyProperties
(
fnaForm
,
newFnaForm
,
"id"
,
"fnaFormBizId"
,
"userBizId"
,
"personalData"
);
newFnaForm
.
setFnaFormBizId
(
RandomStringGenerator
.
generateBizId16
(
CommonEnum
.
UID_TYPE_FNA_FORM
.
getCode
()));
newFnaForm
.
setUserBizId
(
userBizId
);
newFnaForm
.
setCreatorId
(
userBizId
);
newFnaForm
.
setUpdaterId
(
userBizId
);
newFnaForm
.
setPersonalData
(
GSON
.
toJson
(
personalData
));
Date
date
=
new
Date
();
newFnaForm
.
setCreateTime
(
date
);
newFnaForm
.
setUpdateTime
(
date
);
fnaFormService
.
save
(
newFnaForm
);
return
newFnaForm
.
getFnaFormBizId
();
}
}
}
yd-csf-service/src/main/resources/mappers/FnaMapper.xml
View file @
4f3200b4
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<id
property=
"id"
column=
"id"
/>
<id
property=
"id"
column=
"id"
/>
<result
property=
"fnaBizId"
column=
"fna_biz_id"
/>
<result
property=
"fnaBizId"
column=
"fna_biz_id"
/>
<result
property=
"fnaNo"
column=
"fna_no"
/>
<result
property=
"fnaNo"
column=
"fna_no"
/>
<result
property=
"tenantCode"
column=
"tenant_code"
/>
<result
property=
"userBizId"
column=
"user_biz_id"
/>
<result
property=
"userBizId"
column=
"user_biz_id"
/>
<result
property=
"customerBizId"
column=
"customer_biz_id"
/>
<result
property=
"customerBizId"
column=
"customer_biz_id"
/>
<result
property=
"appointmentNo"
column=
"appointment_no"
/>
<result
property=
"appointmentNo"
column=
"appointment_no"
/>
...
@@ -30,10 +31,14 @@
...
@@ -30,10 +31,14 @@
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id,fna_biz_id,fna_no,user_biz_id,customer_biz_id,appointment_no,
id,fna_biz_id,fna_no,
tenant_code,
user_biz_id,customer_biz_id,appointment_no,
appointment_biz_id,booking_status_tip,underwriting_no,policy_biz_id,policy_no,
appointment_biz_id,booking_status_tip,underwriting_no,policy_biz_id,policy_no,
status,product_code,product_name,url,edit,
status,product_code,product_name,url,edit,
remark,is_deleted,creator_id,updater_id,create_time,
remark,is_deleted,creator_id,updater_id,create_time,
update_time
update_time
</sql>
</sql>
<update
id=
"updateFnaNoById"
>
update fna set fna_no = #{fnaNo} where id = #{id}
</update>
</mapper>
</mapper>
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