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
392d2ebf
Commit
392d2ebf
authored
Jun 16, 2025
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.7.12-瓜子导入offer
parent
b74c946f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
253 additions
and
4 deletions
+253
-4
TGzOfferInfoImportVo.java
.../cloud/plus/v1/yifu/archives/vo/TGzOfferInfoImportVo.java
+125
-0
TGzOfferInfoController.java
...s/v1/yifu/archives/controller/TGzOfferInfoController.java
+18
-0
TGzOfferInfoService.java
...ud/plus/v1/yifu/archives/service/TGzOfferInfoService.java
+9
-2
TGzOfferInfoServiceImpl.java
...1/yifu/archives/service/impl/TGzOfferInfoServiceImpl.java
+94
-2
application-dev.yml
.../yifu-archives-biz/src/main/resources/application-dev.yml
+7
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/TGzOfferInfoImportVo.java
0 → 100644
View file @
392d2ebf
/*
* 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
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 导入-瓜子offer信息接收表
*
* @author hgw
* @date 2025-6-16 17:37:47
*/
@Data
public
class
TGzOfferInfoImportVo
extends
RowIndex
implements
Serializable
{
@ExcelAttribute
(
name
=
"人员类别编码"
,
maxLength
=
2
)
private
String
empType
;
@ExcelAttribute
(
name
=
"人员类别名称"
,
maxLength
=
32
)
private
String
empTypeDescr
;
/**
* 外签类型:A: 洼地外签/ B:属地外签
*/
@ExcelAttribute
(
name
=
"外签类型"
,
maxLength
=
2
)
private
String
outSginType
;
/**
* 合同公司主体:公司信息表
*/
@ExcelAttribute
(
name
=
"合同公司主体"
,
maxLength
=
20
)
private
String
com
ра
n
у
;
@ExcelAttribute
(
name
=
"姓名"
,
maxLength
=
50
)
private
String
name
;
@ExcelAttribute
(
name
=
"姓名拼音"
,
maxLength
=
100
)
private
String
nameAc
;
@ExcelAttribute
(
name
=
"姓氏拼音"
,
maxLength
=
50
)
private
String
lastNameAc
;
@ExcelAttribute
(
name
=
"名字拼音"
,
maxLength
=
50
)
private
String
firstNameAc
;
@ExcelAttribute
(
name
=
"国籍编码"
,
maxLength
=
10
)
private
String
country
;
@ExcelAttribute
(
name
=
"国籍描述"
,
maxLength
=
30
)
private
String
countryDescr
;
@ExcelAttribute
(
name
=
"证件类型编码"
,
maxLength
=
6
)
private
String
nationalIdType
;
@ExcelAttribute
(
name
=
"证件类型描述"
,
maxLength
=
30
)
private
String
nationalIdTypeDescr
;
@ExcelAttribute
(
name
=
"证件号码"
,
maxLength
=
50
)
private
String
nationalId
;
@ExcelAttribute
(
name
=
"性别"
,
maxLength
=
10
)
private
String
sex
;
@ExcelAttribute
(
name
=
"个人手机号"
,
maxLength
=
30
)
private
String
phone
;
@ExcelAttribute
(
name
=
"个人邮箱"
,
maxLength
=
100
)
private
String
email
;
@ExcelAttribute
(
name
=
"直接上级姓名"
,
maxLength
=
200
)
private
String
supervisorName
;
@ExcelAttribute
(
name
=
"职务描述"
,
maxLength
=
50
)
private
String
jobcodeDescr
;
@ExcelAttribute
(
name
=
"工作地点"
,
maxLength
=
12
)
private
String
workLocation
;
@ExcelAttribute
(
name
=
"工作地点描述"
,
maxLength
=
12
)
private
String
workLocationDescr
;
/**
* 预计入职日期:yyyy-MM-dd
*/
@ExcelAttribute
(
name
=
"预计入职日期"
,
isDate
=
true
)
private
Date
expEntryDate
;
@ExcelAttribute
(
name
=
"部门名称"
,
maxLength
=
200
)
private
String
deptName
;
/**
* 基本工资,两位小数
*/
@ExcelAttribute
(
name
=
"基本工资"
)
private
BigDecimal
basePay
;
/**
* 绩效工资,两位小数
*/
@ExcelAttribute
(
name
=
"绩效工资"
)
private
BigDecimal
perfomPay
;
@ExcelAttribute
(
name
=
"年终奖月数"
)
private
Integer
yearBonusMonth
;
@ExcelAttribute
(
name
=
"社保缴纳地编码"
,
maxLength
=
12
)
private
String
socialInsuranceLocation
;
@ExcelAttribute
(
name
=
"社保缴纳地"
,
maxLength
=
30
)
private
String
socialInsuranceLocationDescr
;
@ExcelAttribute
(
name
=
"社保基数"
)
private
BigDecimal
socialInsuranceBase
;
@ExcelAttribute
(
name
=
"公积金基数"
)
private
BigDecimal
houseAccFundBaseMax
;
/**
* 是否转正后缴纳公积金(Y:是 N:否)
*/
@ExcelAttribute
(
name
=
"是否转正后缴纳公积金"
,
maxLength
=
1
)
private
String
beRegularEmpPay
;
@ExcelAttribute
(
name
=
"申请人邮箱"
,
maxLength
=
60
)
private
String
applyUserEmail
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TGzOfferInfoController.java
View file @
392d2ebf
...
...
@@ -19,15 +19,20 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService
;
import
lombok.SneakyThrows
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
/**
...
...
@@ -96,4 +101,17 @@ public class TGzOfferInfoController {
return
R
.
ok
(
tGzOfferInfoService
.
updateById
(
tGzOfferInfo
));
}
/**
* 批量导入瓜子offer
* @author hgw
* @date 2025-06-16 14:29:13
**/
@SneakyThrows
@Operation
(
description
=
"批量导入瓜子offer"
)
@SysLog
(
"批量导入瓜子offer"
)
@PostMapping
(
"/importGzOfferList"
)
public
R
<
List
<
ErrorMessage
>>
importGzOfferList
(
@RequestBody
MultipartFile
file
){
return
tGzOfferInfoService
.
importDiy
(
file
.
getInputStream
());
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TGzOfferInfoService.java
View file @
392d2ebf
...
...
@@ -17,10 +17,15 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
java.io.InputStream
;
import
java.util.List
;
/**
* 瓜子offer信息接收表
...
...
@@ -36,4 +41,6 @@ public interface TGzOfferInfoService extends IService<TGzOfferInfo> {
*/
IPage
<
TGzOfferInfo
>
getTGzOfferInfoPage
(
Page
<
TGzOfferInfo
>
page
,
TGzOfferInfo
tGzOfferInfo
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TGzOfferInfoServiceImpl.java
View file @
392d2ebf
...
...
@@ -16,15 +16,31 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzOfferInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TGzOfferInfoImportVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 瓜子offer信息接收表
...
...
@@ -46,4 +62,80 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
return
baseMapper
.
getTGzOfferInfoPage
(
page
,
tGzOfferInfo
);
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TGzOfferInfoImportVo
>
util1
=
new
ExcelUtil
<>(
TGzOfferInfoImportVo
.
class
);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
TGzOfferInfoImportVo
.
class
,
new
ReadListener
<
TGzOfferInfoImportVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
TGzOfferInfoImportVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
TGzOfferInfoImportVo
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
());
importTDispatchExportLog
(
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
importTDispatchExportLog
(
List
<
TGzOfferInfoImportVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
TGzOfferInfoImportVo
excel
;
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
excel
=
excelVOList
.
get
(
i
);
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
TGzOfferInfoImportVo
excel
)
{
TGzOfferInfo
insert
=
new
TGzOfferInfo
();
BeanUtil
.
copyProperties
(
excel
,
insert
);
this
.
save
(
insert
);
}
}
yifu-archives/yifu-archives-biz/src/main/resources/application-dev.yml
View file @
392d2ebf
...
...
@@ -31,4 +31,11 @@ mybatis-plus:
map-underscore-to-camel-case
:
true
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
wx
:
corpid
:
wwbcb090af0dfe50e5
corpsecret
:
16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid
:
1000010
authUrl
:
https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName
:
https://test-wx.worfu.com
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