Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
位宇华
klck
Commits
5177d3f3
Commit
5177d3f3
authored
Aug 05, 2024
by
位宇华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
唐山矿代码提交
parent
4386434e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
482 additions
and
4 deletions
+482
-4
ruoyi-wages/pom.xml
ruoyi-wages/pom.xml
+5
-0
ruoyi-wages/src/main/java/com/ruoyi/system/controller/SalaryController.java
...in/java/com/ruoyi/system/controller/SalaryController.java
+25
-0
ruoyi-wages/src/main/java/com/ruoyi/system/listener/ExcelListener.java
...rc/main/java/com/ruoyi/system/listener/ExcelListener.java
+1
-4
ruoyi-wages/src/main/java/com/ruoyi/system/listener/TsExcelListener.java
.../main/java/com/ruoyi/system/listener/TsExcelListener.java
+45
-0
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/SalaryMapper.java
...s/src/main/java/com/ruoyi/system/mapper/SalaryMapper.java
+15
-0
ruoyi-wages/src/main/java/com/ruoyi/system/model/salary/SalaryExcelModel.java
.../java/com/ruoyi/system/model/salary/SalaryExcelModel.java
+304
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/SalarySaveService.java
...main/java/com/ruoyi/system/service/SalarySaveService.java
+9
-0
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/SalarySaveServiceImpl.java
.../com/ruoyi/system/service/impl/SalarySaveServiceImpl.java
+55
-0
ruoyi-wages/src/main/resources/mapper/system/SalaryMapper.xml
...i-wages/src/main/resources/mapper/system/SalaryMapper.xml
+23
-0
No files found.
ruoyi-wages/pom.xml
View file @
5177d3f3
...
...
@@ -84,6 +84,11 @@
<version>
1.5.10
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
<version>
3.3.1
</version>
</dependency>
<dependency>
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi-supplies
</artifactId>
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/controller/SalaryController.java
0 → 100644
View file @
5177d3f3
package
com.ruoyi.system.controller
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.service.SalarySaveService
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
@RestController
public
class
SalaryController
{
private
final
SalarySaveService
salarySaveService
;
public
SalaryController
(
SalarySaveService
salarySaveService
)
{
this
.
salarySaveService
=
salarySaveService
;
}
@PostMapping
(
"/salary/save"
)
public
AjaxResult
save
(
@RequestParam
(
"multipartFile"
)
MultipartFile
multipartFile
){
return
salarySaveService
.
save
(
multipartFile
);
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/listener/ExcelListener.java
View file @
5177d3f3
...
...
@@ -3,10 +3,7 @@ package com.ruoyi.system.listener;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
/**
* 2024/4/13
*/
public
class
ExcelListener
<
T
>
extends
AnalysisEventListener
<
T
>
{
public
class
ExcelListener
<
T
>
extends
AnalysisEventListener
<
T
>
{
@Override
public
void
invoke
(
T
t
,
AnalysisContext
analysisContext
)
{
...
...
ruoyi-wages/src/main/java/com/ruoyi/system/listener/TsExcelListener.java
0 → 100644
View file @
5177d3f3
package
com.ruoyi.system.listener
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.ruoyi.system.model.salary.SalaryExcelModel
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 2024/4/13
*/
public
class
TsExcelListener
<
T
>
extends
AnalysisEventListener
<
T
>
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
TsExcelListener
.
class
);
private
int
endRow
;
List
<
SalaryExcelModel
>
salaryExcelModelList
=
new
ArrayList
<>();
@Override
public
void
invoke
(
T
t
,
AnalysisContext
analysisContext
)
{
SalaryExcelModel
salaryExcelModel
=
(
SalaryExcelModel
)
t
;
if
(
StringUtils
.
equals
(
"汇总合计"
,
salaryExcelModel
.
getProjectName
()))
{
endRow
=
analysisContext
.
getCurrentRowNum
();
}
int
count
=
analysisContext
.
getCurrentRowNum
();
if
(
endRow
==
0
||
endRow
==
count
)
{
salaryExcelModelList
.
add
(
salaryExcelModel
);
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
analysisContext
)
{
logger
.
info
(
"解析完成!"
);
}
public
List
<
SalaryExcelModel
>
getSalaryExcelModelList
()
{
return
salaryExcelModelList
;
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/mapper/SalaryMapper.java
0 → 100644
View file @
5177d3f3
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.model.salary.SalaryExcelModel
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
SalaryMapper
{
/**
* 唐山矿
*
* @param salaryExcelModelList
*/
void
save
(
@Param
(
"salaryExcelModelList"
)
List
<
SalaryExcelModel
>
salaryExcelModelList
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/model/salary/SalaryExcelModel.java
0 → 100644
View file @
5177d3f3
package
com.ruoyi.system.model.salary
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
java.io.Serializable
;
public
class
SalaryExcelModel
implements
Serializable
{
private
Integer
id
;
//项目
@ExcelProperty
(
value
=
"项目"
)
private
String
projectName
;
//人数
@ExcelProperty
(
value
=
"人数"
)
private
Integer
personCount
;
//应付工资
@ExcelProperty
(
value
=
"应付工资"
)
private
String
salary
;
//医疗补贴
@ExcelProperty
(
value
=
"医疗补贴"
)
private
String
medicalSubsidy
;
//应付工资合计
@ExcelProperty
(
value
=
"应付工资合计"
)
private
String
sumSalary
;
//基本养老保险
@ExcelProperty
(
value
=
"基本养老保险"
)
private
String
oldInsurance
;
//年金
@ExcelProperty
(
value
=
"年金"
)
private
String
annuity
;
//基本医疗保险
@ExcelProperty
(
value
=
"基本医疗保险"
)
private
String
medicalInsurance
;
//补充医疗保险
@ExcelProperty
(
value
=
"补充医疗保险"
)
private
String
supplyMedicalInsurance
;
//生育保险
@ExcelProperty
(
value
=
"生育保险"
)
private
String
birthInsurance
;
//费用来源
@ExcelProperty
(
value
=
"费用来源"
)
private
String
sourceExpenses
;
//失业保险
@ExcelProperty
(
value
=
"失业保险"
)
private
String
unemploymentInsurance
;
//工伤保险
@ExcelProperty
(
value
=
"工伤保险"
)
private
String
injuryInsurance
;
//企业住房公积金
@ExcelProperty
(
value
=
"企业住房公积金"
)
private
String
companyHouseFund
;
//住房公积金
@ExcelProperty
(
value
=
"住房公积金"
)
private
String
houseFund
;
//工会经费
@ExcelProperty
(
value
=
"工会经费"
)
private
String
laborUnionDues
;
//提取职教费
@ExcelProperty
(
value
=
"提取职教费"
)
private
String
edufFees
;
//一孩
@ExcelProperty
(
value
=
"一孩"
)
private
String
oneChild
;
//班中餐
@ExcelProperty
(
value
=
"班中餐"
)
private
String
lunch
;
//长户险
@ExcelProperty
(
value
=
"长户险"
)
private
String
longAccountInsurance
;
//荣誉金
@ExcelProperty
(
value
=
"荣誉金"
)
private
String
honorMoney
;
//取暖补贴
@ExcelProperty
(
value
=
"取暖补贴"
)
private
String
warmSubsidy
;
//防暑降温
@ExcelProperty
(
value
=
"防暑降温"
)
private
String
heatPreventSubsidy
;
//所属矿
@ExcelProperty
(
value
=
"所属矿"
)
private
String
belongToCoal
;
private
String
creator
;
private
String
modify
;
public
String
getProjectName
()
{
return
projectName
;
}
public
void
setProjectName
(
String
projectName
)
{
this
.
projectName
=
projectName
;
}
public
Integer
getPersonCount
()
{
return
personCount
;
}
public
void
setPersonCount
(
Integer
personCount
)
{
this
.
personCount
=
personCount
;
}
public
String
getSalary
()
{
return
salary
;
}
public
void
setSalary
(
String
salary
)
{
this
.
salary
=
salary
;
}
public
String
getMedicalSubsidy
()
{
return
medicalSubsidy
;
}
public
void
setMedicalSubsidy
(
String
medicalSubsidy
)
{
this
.
medicalSubsidy
=
medicalSubsidy
;
}
public
String
getSumSalary
()
{
return
sumSalary
;
}
public
void
setSumSalary
(
String
sumSalary
)
{
this
.
sumSalary
=
sumSalary
;
}
public
String
getOldInsurance
()
{
return
oldInsurance
;
}
public
void
setOldInsurance
(
String
oldInsurance
)
{
this
.
oldInsurance
=
oldInsurance
;
}
public
String
getAnnuity
()
{
return
annuity
;
}
public
void
setAnnuity
(
String
annuity
)
{
this
.
annuity
=
annuity
;
}
public
String
getMedicalInsurance
()
{
return
medicalInsurance
;
}
public
void
setMedicalInsurance
(
String
medicalInsurance
)
{
this
.
medicalInsurance
=
medicalInsurance
;
}
public
String
getSupplyMedicalInsurance
()
{
return
supplyMedicalInsurance
;
}
public
void
setSupplyMedicalInsurance
(
String
supplyMedicalInsurance
)
{
this
.
supplyMedicalInsurance
=
supplyMedicalInsurance
;
}
public
String
getUnemploymentInsurance
()
{
return
unemploymentInsurance
;
}
public
void
setUnemploymentInsurance
(
String
unemploymentInsurance
)
{
this
.
unemploymentInsurance
=
unemploymentInsurance
;
}
public
String
getInjuryInsurance
()
{
return
injuryInsurance
;
}
public
void
setInjuryInsurance
(
String
injuryInsurance
)
{
this
.
injuryInsurance
=
injuryInsurance
;
}
public
String
getHouseFund
()
{
return
houseFund
;
}
public
void
setHouseFund
(
String
houseFund
)
{
this
.
houseFund
=
houseFund
;
}
public
String
getLaborUnionDues
()
{
return
laborUnionDues
;
}
public
void
setLaborUnionDues
(
String
laborUnionDues
)
{
this
.
laborUnionDues
=
laborUnionDues
;
}
public
String
getEdufFees
()
{
return
edufFees
;
}
public
void
setEdufFees
(
String
edufFees
)
{
this
.
edufFees
=
edufFees
;
}
public
String
getOneChild
()
{
return
oneChild
;
}
public
void
setOneChild
(
String
oneChild
)
{
this
.
oneChild
=
oneChild
;
}
public
String
getLunch
()
{
return
lunch
;
}
public
void
setLunch
(
String
lunch
)
{
this
.
lunch
=
lunch
;
}
public
String
getBirthInsurance
()
{
return
birthInsurance
;
}
public
void
setBirthInsurance
(
String
birthInsurance
)
{
this
.
birthInsurance
=
birthInsurance
;
}
public
String
getSourceExpenses
()
{
return
sourceExpenses
;
}
public
void
setSourceExpenses
(
String
sourceExpenses
)
{
this
.
sourceExpenses
=
sourceExpenses
;
}
public
String
getCompanyHouseFund
()
{
return
companyHouseFund
;
}
public
void
setCompanyHouseFund
(
String
companyHouseFund
)
{
this
.
companyHouseFund
=
companyHouseFund
;
}
public
String
getLongAccountInsurance
()
{
return
longAccountInsurance
;
}
public
void
setLongAccountInsurance
(
String
longAccountInsurance
)
{
this
.
longAccountInsurance
=
longAccountInsurance
;
}
public
String
getHonorMoney
()
{
return
honorMoney
;
}
public
void
setHonorMoney
(
String
honorMoney
)
{
this
.
honorMoney
=
honorMoney
;
}
public
String
getWarmSubsidy
()
{
return
warmSubsidy
;
}
public
void
setWarmSubsidy
(
String
warmSubsidy
)
{
this
.
warmSubsidy
=
warmSubsidy
;
}
public
String
getHeatPreventSubsidy
()
{
return
heatPreventSubsidy
;
}
public
void
setHeatPreventSubsidy
(
String
heatPreventSubsidy
)
{
this
.
heatPreventSubsidy
=
heatPreventSubsidy
;
}
public
String
getBelongToCoal
()
{
return
belongToCoal
;
}
public
void
setBelongToCoal
(
String
belongToCoal
)
{
this
.
belongToCoal
=
belongToCoal
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getCreator
()
{
return
creator
;
}
public
void
setCreator
(
String
creator
)
{
this
.
creator
=
creator
;
}
public
String
getModify
()
{
return
modify
;
}
public
void
setModify
(
String
modify
)
{
this
.
modify
=
modify
;
}
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/SalarySaveService.java
0 → 100644
View file @
5177d3f3
package
com.ruoyi.system.service
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
org.springframework.web.multipart.MultipartFile
;
public
interface
SalarySaveService
{
AjaxResult
save
(
MultipartFile
multipartFile
);
}
ruoyi-wages/src/main/java/com/ruoyi/system/service/impl/SalarySaveServiceImpl.java
0 → 100644
View file @
5177d3f3
package
com.ruoyi.system.service.impl
;
import
cn.hutool.core.lang.Snowflake
;
import
com.alibaba.excel.EasyExcel
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.system.listener.TsExcelListener
;
import
com.ruoyi.system.mapper.SalaryMapper
;
import
com.ruoyi.system.model.salary.SalaryExcelModel
;
import
com.ruoyi.system.service.SalarySaveService
;
import
lombok.SneakyThrows
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@Service
public
class
SalarySaveServiceImpl
implements
SalarySaveService
{
private
final
static
Set
<
String
>
COST_CHANNEL_SET
=
Stream
.
of
(
"基本生产原煤"
,
"基本生产洗煤"
,
"制造费用原煤"
,
"制造费用洗煤"
,
"选混煤"
,
"其他业务成本"
,
"其他应付款"
,
"管理费用"
,
"销售费用"
,
"其他业务支出"
).
collect
(
Collectors
.
toSet
());
static
Snowflake
snowflake
=
new
Snowflake
(
1
,
1
);
private
final
SalaryMapper
salaryMapper
;
public
SalarySaveServiceImpl
(
SalaryMapper
salaryMapper
)
{
this
.
salaryMapper
=
salaryMapper
;
}
@Override
@SneakyThrows
public
AjaxResult
save
(
MultipartFile
multipartFile
)
{
InputStream
inputStream
=
multipartFile
.
getInputStream
();
TsExcelListener
<
SalaryExcelModel
>
tsExcelListener
=
new
TsExcelListener
<>();
EasyExcel
.
read
(
inputStream
,
SalaryExcelModel
.
class
,
tsExcelListener
).
sheet
(
0
).
headRowNumber
(
3
).
doRead
();
List
<
SalaryExcelModel
>
salaryExcelModelList
=
tsExcelListener
.
getSalaryExcelModelList
().
stream
().
map
(
project
->
{
if
(
StringUtils
.
isNotBlank
(
project
.
getProjectName
()))
{
project
.
setProjectName
(
project
.
getProjectName
().
replaceAll
(
"[0-9\\p{Punct}]"
,
StringUtils
.
EMPTY
));
}
project
.
setBelongToCoal
(
"010101"
);
// project.setCreator(SecurityUtils.getLoginUser().getUsername());
// project.setModify(SecurityUtils.getLoginUser().getUsername());
return
project
;
}).
collect
(
Collectors
.
toList
());
List
<
SalaryExcelModel
>
list
=
salaryExcelModelList
.
stream
().
filter
(
v
->
!
COST_CHANNEL_SET
.
contains
(
v
.
getProjectName
())).
filter
(
v
->
StringUtils
.
isNotBlank
(
v
.
getProjectName
())).
collect
(
Collectors
.
toList
());
salaryMapper
.
save
(
list
);
return
AjaxResult
.
success
(
"保存成功!"
,
salaryExcelModelList
);
}
}
ruoyi-wages/src/main/resources/mapper/system/SalaryMapper.xml
0 → 100644
View file @
5177d3f3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.system.mapper.SalaryMapper"
>
<insert
id=
"save"
>
INSERT INTO ts_salary (org, person_count, medical_subsidy, sum_salary, old_insurance, annuity,
single_supply_medical_insurance, medical_insurance, supply_medical_insurance,
birth_insurance, source_expenses, unemployment_insurance, injury_insurance,
company_house_fund, house_fund,
labor_union_dues, edu_fees, one_child, long_account_insurance, lunch, honor_money,
warm_subsidy, heat_prevent_subsidy, belong_to_coal)
VALUES
<foreach
collection=
"salaryExcelModelList"
item=
"item"
index=
"index"
separator=
","
>
(#{item.projectName},#{item.personCount},#{item.medicalSubsidy},
#{item.sumSalary},#{item.oldInsurance},#{item.annuity},#{item.supplyMedicalInsurance},
#{item.medicalInsurance},#{item.supplyMedicalInsurance},#{item.birthInsurance},#{item.sourceExpenses},
#{item.unemploymentInsurance},#{item.injuryInsurance},#{item.companyHouseFund},#{item.houseFund},
#{item.laborUnionDues},#{item.edufFees},#{item.oneChild},#{item.longAccountInsurance},#{item.lunch},
#{item.honorMoney},#{item.warmSubsidy},#{item.heatPreventSubsidy},#{item.belongToCoal})
</foreach>
</insert>
</mapper>
\ No newline at end of file
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