Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
32746a5e
Commit
32746a5e
authored
Jul 15, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
bf1affd1
4196924b
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
456 additions
and
95 deletions
+456
-95
FddPersonAccount.java
.../cloud/plus/v1/yifu/archives/entity/FddPersonAccount.java
+12
-0
FddReqLog.java
...om/yifu/cloud/plus/v1/yifu/archives/entity/FddReqLog.java
+0
-31
FddSealInfo.java
.../yifu/cloud/plus/v1/yifu/archives/entity/FddSealInfo.java
+0
-31
EmpBadRecordSearchVo.java
.../cloud/plus/v1/yifu/archives/vo/EmpBadRecordSearchVo.java
+3
-0
FddSealInfoServiceImpl.java
...v1/yifu/archives/service/impl/FddSealInfoServiceImpl.java
+11
-0
TEmpBadRecordServiceImpl.java
.../yifu/archives/service/impl/TEmpBadRecordServiceImpl.java
+0
-1
TEmployeeProjectServiceImpl.java
...fu/archives/service/impl/TEmployeeProjectServiceImpl.java
+14
-13
Common.java
.../com/yifu.cloud.plus.v1/yifu/common/core/util/Common.java
+20
-1
SysHouseHoldInfoController.java
...v1/yifu/social/controller/SysHouseHoldInfoController.java
+1
-1
ColumnEntity.java
.../yifu.cloud.plus.v1/yifu/codegen/entity/ColumnEntity.java
+5
-0
CodeGenKits.java
.../yifu.cloud.plus.v1/yifu/codegen/support/CodeGenKits.java
+18
-0
Controller.java.vm
...fu-codegen/src/main/resources/template/Controller.java.vm
+28
-2
Entity.java.vm
...l/yifu-codegen/src/main/resources/template/Entity.java.vm
+25
-13
EntitySearchVo.java.vm
...odegen/src/main/resources/template/EntitySearchVo.java.vm
+56
-0
EntityVo.java.vm
...yifu-codegen/src/main/resources/template/EntityVo.java.vm
+70
-0
Service.java.vm
.../yifu-codegen/src/main/resources/template/Service.java.vm
+7
-1
ServiceImpl.java.vm
...u-codegen/src/main/resources/template/ServiceImpl.java.vm
+186
-1
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/FddPersonAccount.java
View file @
32746a5e
...
...
@@ -17,6 +17,7 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
...
...
@@ -99,4 +100,15 @@ public class FddPersonAccount extends BaseEntity {
@Schema
(
description
=
"实名短信发送:0未发送 1已发送"
)
private
String
realMessageFlag
;
@Schema
(
description
=
"组织名称"
)
@TableField
(
exist
=
false
)
private
String
companyName
;
@Schema
(
description
=
"法大大印章ID"
)
@TableField
(
exist
=
false
)
private
String
sealId
;
@Schema
(
description
=
"印章名称"
)
@TableField
(
exist
=
false
)
private
String
sealName
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/FddReqLog.java
View file @
32746a5e
...
...
@@ -69,35 +69,4 @@ public class FddReqLog extends BaseEntity {
@Schema
(
description
=
"调用类名"
)
private
String
className
;
/**
* 创建者
*/
@Schema
(
description
=
"创建者"
)
private
String
createBy
;
/**
* 更新人
*/
@Schema
(
description
=
"更新人"
)
private
String
updateBy
;
/**
* 创建时间
*/
@Schema
(
description
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@Schema
(
description
=
"更新时间"
)
private
LocalDateTime
updateTime
;
/**
* 创建人姓名
*/
@Schema
(
description
=
"创建人姓名"
)
private
String
createName
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/FddSealInfo.java
View file @
32746a5e
...
...
@@ -81,35 +81,4 @@ public class FddSealInfo extends BaseEntity {
@Schema
(
description
=
"印章对应的公司id"
)
private
String
sealCompanyId
;
/**
* 创建者
*/
@Schema
(
description
=
"创建者"
)
private
String
createBy
;
/**
* 更新人
*/
@Schema
(
description
=
"更新人"
)
private
String
updateBy
;
/**
* 创建时间
*/
@Schema
(
description
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新时间
*/
@Schema
(
description
=
"更新时间"
)
private
LocalDateTime
updateTime
;
/**
* 创建人姓名
*/
@Schema
(
description
=
"创建人姓名"
)
private
String
createName
;
}
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmpBadRecordSearchVo.java
View file @
32746a5e
...
...
@@ -14,6 +14,9 @@ import java.time.LocalDateTime;
*/
@Data
public
class
EmpBadRecordSearchVo
extends
TEmpBadRecord
{
/**
* 多选导出或删除等操作
*/
private
String
ids
;
/**
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/FddSealInfoServiceImpl.java
View file @
32746a5e
...
...
@@ -123,6 +123,17 @@ public class FddSealInfoServiceImpl extends ServiceImpl<FddSealInfoMapper, FddSe
@Override
public
R
<
String
>
sealAuth
(
List
<
String
>
id
,
String
fddPersonAccountId
)
throws
ApiException
{
// //查询机构印章信息
// CompanySealListReq companySealListReq = new CompanySealListReq();
// companySealListReq.setToken(fddUtil.getToken());
// companySealListReq.setSealInfo(1);
// OwnerInfo owner1 = new OwnerInfo();
// owner1.setUnionId("6ecf01effd8647528255a72c9014ce08");
// companySealListReq.setOwner(owner1);
// SealClient sealClient1 = new SealClient(fddUtil.getFadadaApiClient());
// BaseRsp<CompanySealListRsp> rsp1 = sealClient1.companySealList(companySealListReq);
// CompanySealListRsp data1 = rsp1.getData();
for
(
String
sId
:
id
)
{
FddSealInfo
entity
=
this
.
getById
(
sId
);
if
(
entity
==
null
)
{
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmpBadRecordServiceImpl.java
View file @
32746a5e
...
...
@@ -53,7 +53,6 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
View file @
32746a5e
...
...
@@ -1196,21 +1196,22 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
list
=
gettEmpProInfoExportVos
(
idstr
,
projectDTO
);
ServletOutputStream
out
=
null
;
if
(
list
!=
null
&&
!
list
.
isEmpty
())
{
list
=
new
ArrayList
<>();
}
try
{
if
(
list
.
size
()
>
0
)
{
out
=
response
.
getOutputStream
();
ExcelUtil
<
EmployeeProjectExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeProjectExportVO
.
class
);
for
(
EmployeeProjectExportVO
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
response
.
setContentType
(
"multipart/form-data"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeProjectExportVO
.
class
).
includeColumnFiledNames
(
includeColumnFiledNames
).
sheet
(
"项目档案"
)
.
doWrite
(
list
);
out
.
flush
();
out
=
response
.
getOutputStream
();
ExcelUtil
<
EmployeeProjectExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeProjectExportVO
.
class
);
for
(
EmployeeProjectExportVO
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
response
.
setContentType
(
"multipart/form-data"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeProjectExportVO
.
class
).
includeColumnFiledNames
(
includeColumnFiledNames
).
sheet
(
"项目档案"
)
.
doWrite
(
list
);
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
finally
{
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/Common.java
View file @
32746a5e
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.core.util;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
...
...
@@ -31,7 +32,25 @@ public class Common {
public
static
boolean
isEmpty
(
String
str
)
{
return
null
==
str
||
""
.
equals
(
str
.
trim
())
||
"null"
.
equals
(
str
.
trim
())
||
"undefinded"
.
equals
(
str
.
trim
());
}
/**
* 截取startStr和endStr中间的字符串(开区间)
*
* @param startStr 开始的标志
* @param endStr 结束标志
* @param src 源串
* @return 返回符合要求的字符串或者返回null
* @author: fxj
*/
public
static
String
subByStr
(
String
startStr
,
String
endStr
,
String
src
)
{
if
(
StringUtils
.
isNotBlank
(
src
)
&&
StringUtils
.
isNotBlank
(
startStr
)
&&
StringUtils
.
isNotBlank
(
endStr
))
{
int
start
=
src
.
indexOf
(
startStr
);
int
end
=
src
.
indexOf
(
endStr
);
if
(
end
>
start
&&
start
>
-
1
)
{
return
src
.
substring
(
start
+
1
,
end
);
}
}
return
null
;
}
/**
* 对象null
*
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/SysHouseHoldInfoController.java
View file @
32746a5e
...
...
@@ -94,7 +94,7 @@ public class SysHouseHoldInfoController {
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('demo_syshouseholdinfo_add')"
)
public
R
save
(
@RequestBody
SysHouseHoldInfo
sysHouseHoldInfo
)
{
return
R
.
ok
(
sysHouseHoldInfoService
.
saveInfo
(
sysHouseHoldInfo
)
);
return
sysHouseHoldInfoService
.
saveInfo
(
sysHouseHoldInfo
);
}
/**
...
...
yifu-visual/yifu-codegen/src/main/java/com/yifu.cloud.plus.v1/yifu/codegen/entity/ColumnEntity.java
View file @
32746a5e
...
...
@@ -75,4 +75,9 @@ public class ColumnEntity {
*/
private
Boolean
hidden
;
/**
* 是否隐藏
*/
private
String
maxLength
;
}
yifu-visual/yifu-codegen/src/main/java/com/yifu.cloud.plus.v1/yifu/codegen/support/CodeGenKits.java
View file @
32746a5e
...
...
@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.codegen.entity.GenFormConf;
import
com.yifu.cloud.plus.v1.yifu.codegen.entity.TableEntity
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
lombok.SneakyThrows
;
import
lombok.experimental.UtilityClass
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -64,6 +65,10 @@ public class CodeGenKits {
private
final
String
ENTITY_JAVA_VM
=
"Entity.java.vm"
;
private
final
String
ENTITY_VO_JAVA_VM
=
"EntityVo.java.vm"
;
private
final
String
ENTITY_SEARCH_VO_JAVA_VM
=
"EntitySearchVo.java.vm"
;
private
final
String
MAPPER_JAVA_VM
=
"Mapper.java.vm"
;
private
final
String
SERVICE_JAVA_VM
=
"Service.java.vm"
;
...
...
@@ -93,6 +98,8 @@ public class CodeGenKits {
*/
private
List
<
String
>
getTemplates
(
GenConfig
config
)
{
List
<
String
>
templates
=
new
ArrayList
<>();
templates
.
add
(
"template/EntityVo.java.vm"
);
templates
.
add
(
"template/EntitySearchVo.java.vm"
);
templates
.
add
(
"template/Entity.java.vm"
);
templates
.
add
(
"template/Mapper.java.vm"
);
templates
.
add
(
"template/Mapper.xml.vm"
);
...
...
@@ -183,6 +190,9 @@ public class CodeGenKits {
String
dataType
=
StrUtil
.
subBefore
(
columnEntity
.
getDataType
(),
"("
,
false
);
String
attrType
=
config
.
getString
(
dataType
,
"unknowType"
);
columnEntity
.
setAttrType
(
attrType
);
if
(
"String"
.
equals
(
attrType
))
{
columnEntity
.
setMaxLength
(
Common
.
subByStr
(
"("
,
")"
,
column
.
get
(
"columnType"
)));
}
if
(!
hasBigDecimal
&&
"BigDecimal"
.
equals
(
attrType
))
{
hasBigDecimal
=
true
;
}
...
...
@@ -354,6 +364,14 @@ public class CodeGenKits {
return
packagePath
+
"entity"
+
File
.
separator
+
className
+
".java"
;
}
if
(
template
.
contains
(
ENTITY_VO_JAVA_VM
))
{
return
packagePath
+
"entity"
+
File
.
separator
+
className
+
"Vo.java"
;
}
if
(
template
.
contains
(
ENTITY_SEARCH_VO_JAVA_VM
))
{
return
packagePath
+
"entity"
+
File
.
separator
+
className
+
"SearchVo.java"
;
}
if
(
template
.
contains
(
MAPPER_JAVA_VM
))
{
return
packagePath
+
"mapper"
+
File
.
separator
+
className
+
"Mapper.java"
;
}
...
...
yifu-visual/yifu-codegen/src/main/resources/template/Controller.java.vm
View file @
32746a5e
...
...
@@ -68,7 +68,7 @@ public class ${className}Controller {
*/
@
ApiOperation
(
value
=
"简单分页查询"
)
@
GetMapping
(
"/page"
)
public
R
<
IPage
<${
className
}>>
get
${
className
}
Page
(
Page
<${
className
}>
page
,
${
className
}
${
classname
})
{
public
R
<
IPage
<${
className
}>>
get
${
className
}
Page
(
Page
<${
className
}>
page
,
${
className
}
SearchVo
${
classname
})
{
return
new
R
<>(${
classname
}
Service
.
get
${
className
}
Page
(
page
,${
classname
}));
}
/**
...
...
@@ -79,7 +79,7 @@ public class ${className}Controller {
@
Operation
(
summary
=
"不分页查询"
,
description
=
"不分页查询"
)
@
PostMapping
(
"/noPage"
)
//@
PreAuthorize
(
"@pms.hasPermission('${moduleName}_${pathName}_get')"
)
public
R
<
List
<${
className
}>>
get
${
className
}
NoPage
(@
RequestBody
${
className
}
${
classname
})
{
public
R
<
List
<${
className
}>>
get
${
className
}
NoPage
(@
RequestBody
${
className
}
SearchVo
${
classname
})
{
return
R
.
ok
(${
classname
}
Service
.
list
(
Wrappers
.
query
(${
classname
})));
}
...
...
@@ -134,4 +134,30 @@ public class ${className}Controller {
return
R
.
ok
(${
classname
}
Service
.
removeById
(${
pk
.
lowerAttrName
}));
}
/**
*
${
comments
}
批量导入
*
*
@
author
${
author
}
*
@
date
${
datetime
}
**/
@
SneakyThrows
@
Operation
(
description
=
"批量新增${comments} hasPermission('${moduleName}_${pathName}-batch-import')"
)
@
SysLog
(
"批量新增${comments}"
)
@
PostMapping
(
"/importListAdd"
)
@
PreAuthorize
(
"@pms.hasPermission('${moduleName}_${pathName}-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(@
RequestBody
MultipartFile
file
){
return
${
classname
}
Service
.
importDiy
(
file
.
getInputStream
());
}
/**
*
${
comments
}
批量导出
*
@
author
${
author
}
*
@
date
${
datetime
}
**/
@
Operation
(
description
=
"导出${comments} hasPermission('${moduleName}_${pathName}-export')"
)
@
PostMapping
(
"/export"
)
@
PreAuthorize
(
"@pms.hasPermission('${moduleName}_${pathName}-export')"
)
public
void
export
(
HttpServletResponse
response
,
@
RequestBody
${
className
}
SearchVo
searchVo
)
{
${
classname
}
Service
.
listExport
(
response
,
searchVo
);
}
}
yifu-visual/yifu-codegen/src/main/resources/template/Entity.java.vm
View file @
32746a5e
...
...
@@ -14,7 +14,7 @@
*
this
software
without
specific
prior
written
permission
.
*
Author
:
lengleng
(
wangiegie
@
gmail
.
com
)
*/
#
set
($
excludeColumns
=
[
"create_time"
,
"update_time"
,
"create_by"
,
"update_by"
])
#
*#
set
($
excludeColumns
=
[
"create_time"
,
"update_time"
,
"create_by"
,
"update_by"
])*#
package
${
package
}.${
moduleName
}.
entity
;
import
com
.
alibaba
.
excel
.
annotation
.
ExcelProperty
;
...
...
@@ -25,6 +25,9 @@ import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import
io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
Schema
;
import
lombok
.
Data
;
import
lombok
.
EqualsAndHashCode
;
import
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
constant
.
ExcelAttribute
;
import
org
.
hibernate
.
validator
.
constraints
.
Length
;
import
javax
.
validation
.
constraints
.
NotBlank
;
#
if
(${
hasBigDecimal
})
import
java
.
math
.
BigDecimal
;
#
end
...
...
@@ -42,20 +45,29 @@ import java.math.BigDecimal;
public
class
${
className
}
extends
BaseEntity
{
#
foreach
($
column
in
$
columns
)
##
排除部分字段
#
if
(
!$excludeColumns.contains($column.columnName))
/**
*
$
column
.
comments
*/
#
if
($
column
.
columnName
==
$
pk
.
columnName
)
@
TableId
(
type
=
IdType
.
ASSIGN_ID
)
#
end
@
ExcelAttribute
(
name
=
"$column.comments"
#
if
($
column
.
isNullable
==
'NO'
&&
$
column
.
attrType
!='LocalDate' && $column.attrType !='LocalDateTime'), isNotEmpty = true,errorInfo = "$column.comments不能为空"#end #if($column.maxLength), maxLength = $column.maxLength #end)
@
Schema
(
description
=
"$column.comments"
#
if
($
column
.
hidden
),
hidden
=$
column
.
hidden
#
end
)
##
排除部分字段
#
if
(
!$excludeColumns.contains($column.columnName))
/**
*
$
column
.
comments
*/
#
if
($
column
.
columnName
==
$
pk
.
columnName
)
@
TableId
(
type
=
IdType
.
ASSIGN_ID
)
#
else
@
ExcelAttribute
(
name
=
"$column.comments"
#
if
($
column
.
nullable
),
isNotEmpty
=
true
,
errorInfo
=
"$column.comments不能为空"
#
end
#
if
($
column
.
attrType
==
'LocalDate'
||
$
column
.
attrType
==
'LocalDateTime'
)
,
isDate
=
true
#
end
#
if
($
column
.
maxLength
),
maxLength
=
$
column
.
maxLength
#
end
)
#
if
($
column
.
nullable
)
@
NotBlank
(
message
=
"$column.comments不能为空"
)
#
end
#
if
($
column
.
maxLength
&&
$
column
.
attrType
==
'String'
)
@
Length
(
max
=$
column
.
maxLength
,
message
=
"$column.comments不能超过$column.maxLength个字符"
)
#
end
#
end
#
end
@
ExcelProperty
(
"$column.comments"
)
#
if
($
column
.
attrType
==
'LocalDate'
||
$
column
.
attrType
==
'LocalDateTime'
||
$
column
.
attrType
==
'Date'
)
private
Date
$
column
.
lowerAttrName
;
#
else
private
$
column
.
attrType
$
column
.
lowerAttrName
;
#
end
#
end
#
end
}
yifu-visual/yifu-codegen/src/main/resources/template/EntitySearchVo.java.vm
0 → 100644
View file @
32746a5e
/*
*
Copyright
(
c
)
2018
-
2025
,
lengleng
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
*
*
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
*
this
list
of
conditions
and
the
following
disclaimer
.
*
Redistributions
in
binary
form
must
reproduce
the
above
copyright
*
notice
,
this
list
of
conditions
and
the
following
disclaimer
in
the
*
documentation
and
/
or
other
materials
provided
with
the
distribution
.
*
Neither
the
name
of
the
yifu4cloud
.
com
developer
nor
the
names
of
its
*
contributors
may
be
used
to
endorse
or
promote
products
derived
from
*
this
software
without
specific
prior
written
permission
.
*
Author
:
lengleng
(
wangiegie
@
gmail
.
com
)
*/
package
${
package
}.${
moduleName
}.
vo
;
import
io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
Schema
;
import
${
package
}.${
moduleName
}.
entity
.${
className
}
import
lombok
.
Data
;
/**
*
${
comments
}
*
*
@
author
${
author
}
*
@
date
${
datetime
}
*/
@
Data
public
class
${
className
}
SearchVo
extends
${
className
}{
/**
*
多选导出或删除等操作
*/
@
Schema
(
description
=
"选中ID,多个逗号分割"
)
private
String
ids
;
/**
*
创建时间区间
[
开始时间,结束时间
]
*/
@
Schema
(
description
=
"创建时间区间"
)
private
LocalDateTime
[]
createTimes
;
/**
*
@
Author
fxj
*
查询数据起
**/
@
Schema
(
description
=
"查询limit 开始"
)
private
int
limitStart
;
/**
*
@
Author
fxj
*
查询数据止
**/
@
Schema
(
description
=
"查询limit 数据条数"
)
private
int
limitEnd
;
}
yifu-visual/yifu-codegen/src/main/resources/template/EntityVo.java.vm
0 → 100644
View file @
32746a5e
/*
*
Copyright
(
c
)
2018
-
2025
,
lengleng
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
*
*
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
*
this
list
of
conditions
and
the
following
disclaimer
.
*
Redistributions
in
binary
form
must
reproduce
the
above
copyright
*
notice
,
this
list
of
conditions
and
the
following
disclaimer
in
the
*
documentation
and
/
or
other
materials
provided
with
the
distribution
.
*
Neither
the
name
of
the
yifu4cloud
.
com
developer
nor
the
names
of
its
*
contributors
may
be
used
to
endorse
or
promote
products
derived
from
*
this
software
without
specific
prior
written
permission
.
*
Author
:
lengleng
(
wangiegie
@
gmail
.
com
)
*/
#
set
($
excludeColumns
=
[
"create_time"
,
"update_time"
,
"create_by"
,
"update_by"
])
package
${
package
}.${
moduleName
}.
vo
;
import
com
.
alibaba
.
excel
.
annotation
.
ExcelProperty
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
IdType
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableId
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableName
;
import
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
mybatis
.
base
.
BaseEntity
;
import
io
.
swagger
.
v3
.
oas
.
annotations
.
media
.
Schema
;
import
lombok
.
Data
;
import
lombok
.
EqualsAndHashCode
;
import
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
constant
.
ExcelAttribute
;
import
org
.
hibernate
.
validator
.
constraints
.
Length
;
import
javax
.
validation
.
constraints
.
NotBlank
;
#
if
(${
hasBigDecimal
})
import
java
.
math
.
BigDecimal
;
#
end
/**
*
${
comments
}
*
*
@
author
${
author
}
*
@
date
${
datetime
}
*/
@
Data
public
class
${
className
}
Vo
extends
RowIndex
implements
Serializable
{
#
foreach
($
column
in
$
columns
)
##
排除部分字段
#
if
(
!$excludeColumns.contains($column.columnName))
/**
*
$
column
.
comments
*/
#
if
($
column
.
columnName
==
$
pk
.
columnName
)
@
TableId
(
type
=
IdType
.
ASSIGN_ID
)
#
end
#
end
#
if
($
column
.
nullable
)
@
NotBlank
(
message
=
"$column.comments 不能为空"
)
#
end
#
if
($
column
.
maxLength
&&
$
column
.
attrType
==
'String'
)
@
Length
(
max
=$
column
.
maxLength
,
message
=
"$column.comments 不能超过$column.maxLength 个字符"
)
#
end
@
ExcelAttribute
(
name
=
"$column.comments"
#
if
($
column
.
nullable
),
isNotEmpty
=
true
,
errorInfo
=
"$column.comments 不能为空"
#
end
#
if
($
column
.
attrType
==
'LocalDate'
||
$
column
.
attrType
==
'LocalDateTime'
)
,
isDate
=
true
#
end
#
if
($
column
.
maxLength
),
maxLength
=
$
column
.
maxLength
#
end
)
@
Schema
(
description
=
"$column.comments"
#
if
($
column
.
hidden
),
hidden
=$
column
.
hidden
#
end
)
@
ExcelProperty
(
"$column.comments"
)
#
if
($
column
.
attrType
==
'LocalDate'
||
$
column
.
attrType
==
'LocalDateTime'
||
$
column
.
attrType
==
'Date'
)
private
Date
$
column
.
lowerAttrName
;
#
else
private
$
column
.
attrType
$
column
.
lowerAttrName
;
#
end
#
end
}
yifu-visual/yifu-codegen/src/main/resources/template/Service.java.vm
View file @
32746a5e
...
...
@@ -32,5 +32,11 @@ public interface ${className}Service extends IService<${className}> {
*
@
param
${
classname
}
${
comments
}
*
@
return
*/
IPage
<${
className
}>
get
${
className
}
Page
(
Page
<${
className
}>
page
,
${
className
}
${
classname
});
IPage
<${
className
}>
get
${
className
}
Page
(
Page
<${
className
}>
page
,
${
className
}
SearchVo
${
classname
});
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
void
listExport
(
HttpServletResponse
response
,
${
className
}
SearchVo
searchVo
);
List
<${
className
}>
noPageDiy
(${
className
}
SearchVo
searchVo
)
}
yifu-visual/yifu-codegen/src/main/resources/template/ServiceImpl.java.vm
View file @
32746a5e
...
...
@@ -36,7 +36,192 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c
*
@
return
*/
@
Override
public
IPage
<${
className
}>
get
${
className
}
Page
(
Page
<${
className
}>
page
,
${
className
}
${
classname
}){
public
IPage
<${
className
}>
get
${
className
}
Page
(
Page
<${
className
}>
page
,
${
className
}
SearchVo
${
classname
}){
return
baseMapper
.
get
${
className
}
Page
(
page
,${
classname
});
}
/**
*
${
comments
}
批量导入
*/
@
Override
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
){
}
/**
*
${
comments
}
批量导出
*
@
param
${
classname
}
${
comments
}
*
@
return
*/
@
Override
void
listExport
(
HttpServletResponse
response
,
${
className
}
SearchVo
searchVo
){
String
fileName
=
"不良记录批量导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
//
获取要导出的列表
List
<${
className
}>
list
=
new
ArrayList
<>();
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
response
.
setContentType
(
"multipart/form-data"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
//
这里
需要指定写用哪个
class
去写,然后写到第一个
sheet
,然后文件流会自动关闭
//
EasyExcel
.
write
(
out
,
TEmpBadRecord
.
class
).
sheet
(
"不良记录"
).
doWrite
(
list
);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
${
className
}.
class
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
){
for
(
int
i
=
0
;
i
<=
count
;
)
{
//
获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageDiy
(
searchVo
);
if
(
Common
.
isNotNull
(
list
)){
ExcelUtil
<${
className
}>
util
=
new
ExcelUtil
<>(${
className
}.
class
);
for
(${
className
}
vo
:
list
){
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
}
if
(
Common
.
isNotNull
(
list
)){
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(${
comments
}+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
index
++;
}
i
=
i
+
CommonConstants
.
EXCEL_EXPORT_LIMIT
;
if
(
Common
.
isNotNull
(
list
)){
list
.
clear
();
}
}
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(${
comments
}+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
)){
list
.
clear
();
}
out
.
flush
();
excelWriter
.
finish
();
}
catch
(
Exception
e
){
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!= out) {
out
.
close
();
}
}
catch
(
IOException
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
}
@
Override
public
List
<${
className
}>
noPageDiy
(${
className
}
SearchVo
searchVo
)
{
LambdaQueryWrapper
<${
className
}>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
)){
wrapper
.
in
(
TEmpBadRecord
::
getId
,
idList
);
}
if
(
searchVo
.
getLimitStart
()
>=
0
&&
searchVo
.
getLimitEnd
()
>
0
){
wrapper
.
last
(
" limit "
+
searchVo
.
getLimitStart
()
+
","
+
searchVo
.
getLimitEnd
());
}
wrapper
.
orderByDesc
(
BaseEntity
::
getCreateTime
);
return
baseMapper
.
selectList
(
wrapper
);
}
private
Long
noPageCountDiy
(${
className
}
SearchVo
searchVo
)
{
LambdaQueryWrapper
<${
className
}>
wrapper
=
buildQueryWrapper
(
searchVo
);
List
<
String
>
idList
=
Common
.
getList
(
searchVo
.
getIds
());
if
(
Common
.
isNotNull
(
idList
)){
wrapper
.
in
(${
className
}::
getId
,
idList
);
}
return
baseMapper
.
selectCount
(
wrapper
);
}
private
LambdaQueryWrapper
buildQueryWrapper
(${
className
}
SearchVo
entity
){
LambdaQueryWrapper
<${
className
}>
wrapper
=
Wrappers
.
lambdaQuery
();
if
(
ArrayUtil
.
isNotEmpty
(
entity
.
getCreateTimes
()))
{
wrapper
.
ge
(${
className
}::
getCreateTime
,
entity
.
getCreateTimes
()[
0
])
.
le
(${
className
}::
getCreateTime
,
entity
.
getCreateTimes
()[
1
]);
}
if
(
Common
.
isNotNull
(
entity
.
getCreateName
())){
wrapper
.
eq
(${
className
}::
getCreateName
,
entity
.
getCreateName
());
}
return
wrapper
;
}
@
Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<${
className
}
Vo
>
util1
=
new
ExcelUtil
<>(${
className
}
Vo
.
class
);;
//
写法
2
:
//
匿名内部类
不用额外写一个
DemoDataListener
//
这里
需要指定读用哪个
class
去读,然后读取第一个
sheet
文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
${
className
}
Vo
.
class
,
new
ReadListener
<${
className
}
Vo
>()
{
/**
*
单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*
临时存储
*/
private
List
<${
className
}
Vo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@
Override
public
void
invoke
(${
className
}
Vo
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
Integer
rowIndex
=
readRowHolder
.
getRowIndex
();
data
.
setRowIndex
(
rowIndex
+
1
);
ErrorMessage
errorMessage
=
util1
.
checkEntity
(
data
,
data
.
getRowIndex
());
if
(
Common
.
isNotNull
(
errorMessage
)){
errorMessageList
.
add
(
errorMessage
);
}
else
{
cachedDataList
.
add
(
data
);
}
if
(
cachedDataList
.
size
()
>=
BATCH_COUNT
)
{
saveData
();
//
存储完成清理
list
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
}
}
@
Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
saveData
();
}
/**
*
加上存储数据库
*/
private
void
saveData
()
{
log
.
info
(
"{}条数据,开始存储数据库!"
,
cachedDataList
.
size
());
import
${
className
}(
cachedDataList
,
errorMessageList
);
log
.
info
(
"存储数据库成功!"
);
}
}).
sheet
().
doRead
();
}
catch
(
Exception
e
){
log
.
error
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
,
e
);
return
R
.
failed
(
CommonConstants
.
IMPORT_DATA_ANALYSIS_ERROR
);
}
return
R
.
ok
(
errorMessageList
);
}
private
void
import
${
className
}(
List
<${
className
}
Vo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
//
个性化校验逻辑
ErrorMessage
errorMsg
;
//
执行数据插入操作
组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
${
className
}
Vo
excel
=
excelVOList
.
get
(
i
);
//
数据合法情况
TODO
//
插入
insertExcel
(
excel
,
emp
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
/**
*
插入
excel
bad
record
*/
private
void
insertExcel
(${
className
}
Vo
excel
)
{
${
className
}
insert
=
new
${
className
}();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
}
}
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