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
80f09c69
Commit
80f09c69
authored
Aug 22, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
9b0ce0e2
1739cbd6
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
346 additions
and
243 deletions
+346
-243
TSettleDomain.java
...ifu/cloud/plus/v1/yifu/archives/entity/TSettleDomain.java
+52
-0
TSettleDomainController.java
.../v1/yifu/archives/controller/TSettleDomainController.java
+14
-0
TSettleDomainService.java
...d/plus/v1/yifu/archives/service/TSettleDomainService.java
+3
-0
TSettleDomainServiceImpl.java
.../yifu/archives/service/impl/TSettleDomainServiceImpl.java
+29
-0
TSettleDomainMapper.xml
...ves-biz/src/main/resources/mapper/TSettleDomainMapper.xml
+10
-0
pom.xml
yifu-common/pom.xml
+1
-1
pom.xml
yifu-common/yifu-common-ekp/pom.xml
+2
-10
EkpSalaryProperties.java
...fu.cloud.plus.v1/yifu/ekp/config/EkpSalaryProperties.java
+32
-0
EkpSalaryUtil.java
...a/com/yifu.cloud.plus.v1/yifu/ekp/util/EkpSalaryUtil.java
+20
-0
spring.factories
...u-common-ekp/src/main/resources/META-INF/spring.factories
+2
-0
ekpSalaryConfig.properties
...-common-ekp/src/main/resources/ekpSalaryConfig.properties
+6
-0
WithMockSecurityContextFactory.java
...oud.plus.v1/yifu/test/WithMockSecurityContextFactory.java
+0
-85
WithMockOAuth2User.java
...loud.plus.v1/yifu/test/annotation/WithMockOAuth2User.java
+0
-29
OAuthMockKit.java
...va/com/yifu.cloud.plus.v1/yifu/test/kit/OAuthMockKit.java
+0
-29
TStatisticsBonusImportVo.java
...loud/plus/v1/yifu/salary/vo/TStatisticsBonusImportVo.java
+112
-0
TStatisticsBonusController.java
...v1/yifu/salary/controller/TStatisticsBonusController.java
+7
-9
TStatisticsBonusService.java
.../plus/v1/yifu/salary/service/TStatisticsBonusService.java
+13
-4
SalaryUploadServiceImpl.java
.../v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
+1
-1
TStatisticsBonusServiceImpl.java
...yifu/salary/service/impl/TStatisticsBonusServiceImpl.java
+42
-75
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TSettleDomain.java
View file @
80f09c69
...
...
@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.entity;
import
com.alibaba.excel.annotation.ExcelProperty
;
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.fasterxml.jackson.annotation.JsonFormat
;
...
...
@@ -26,6 +27,7 @@ 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
org.hibernate.validator.constraints.Length
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
...
...
@@ -344,5 +346,55 @@ public class TSettleDomain extends BaseEntity {
@ExcelProperty
(
"公积金类型0:缴费库;1:预估库"
)
@Schema
(
description
=
"公积金类型0:缴费库;1:预估库"
)
private
String
fundType
;
/**
* 商险结算类型0 合并 1 单独
*/
@ExcelAttribute
(
name
=
"商险结算类型0 合并 1 单独"
)
@ExcelProperty
(
"商险结算类型0 合并 1 单独"
)
@Schema
(
description
=
"商险结算类型0 合并 1 单独"
)
private
String
insuranceSettleType
;
/**
* 封面抬头
*/
@ExcelAttribute
(
name
=
"封面抬头"
,
maxLength
=
50
)
@Length
(
max
=
50
,
message
=
"封面抬头不能超过50个字符"
)
@ExcelProperty
(
"封面抬头"
)
private
String
invoiceTitle
;
/**
* 我司到款单位
*/
@ExcelAttribute
(
name
=
"我司到款单位"
,
maxLength
=
100
)
@ExcelProperty
(
"我司到款单位"
)
private
String
unitOfOurCompany
;
/**
* 所属客户编码
*/
@Schema
(
description
=
"所属客户编码"
)
private
String
customerNo
;
/**
* 所属客户名称
*/
@Schema
(
description
=
"所属客户名称"
)
private
String
customerName
;
/**
* 省
*/
@Schema
(
description
=
"省"
)
@TableField
(
exist
=
false
)
private
String
eProvince
;
/**
* 市
*/
@Schema
(
description
=
"市"
)
@TableField
(
exist
=
false
)
private
String
eCity
;
/**
* 县
*/
@Schema
(
description
=
"县"
)
@TableField
(
exist
=
false
)
private
String
eTown
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TSettleDomainController.java
View file @
80f09c69
...
...
@@ -238,4 +238,18 @@ public class TSettleDomainController {
return
ds
;
}
/**
* 修改项目表
*
* @param tSettleDomain 项目表
* @return R
*/
@Operation
(
summary
=
"修改项目表"
,
description
=
"修改项目表"
)
@SysLog
(
"修改项目表"
)
@PutMapping
(
"/updateProjectInfo"
)
@PreAuthorize
(
"@pms.hasPermission('tsettledomain_edit')"
)
public
R
updateProjectInfo
(
@RequestBody
TSettleDomain
tSettleDomain
)
{
return
tSettleDomainService
.
updateProjectInfo
(
tSettleDomain
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TSettleDomainService.java
View file @
80f09c69
...
...
@@ -22,6 +22,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
java.util.List
;
...
...
@@ -69,4 +70,6 @@ public interface TSettleDomainService extends IService<TSettleDomain> {
**/
List
<
TSettleDomainSelectVo
>
selectAllSettleDomainSelectVos
();
R
updateProjectInfo
(
TSettleDomain
tSettleDomain
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TSettleDomainServiceImpl.java
View file @
80f09c69
...
...
@@ -17,6 +17,8 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper
;
...
...
@@ -26,9 +28,12 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
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.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -109,6 +114,30 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
return
sdList
;
}
@Override
public
R
updateProjectInfo
(
TSettleDomain
tSettleDomain
)
{
if
(
Common
.
isNotNull
(
tSettleDomain
))
{
if
(
Common
.
isNotNull
(
tSettleDomain
.
getEProvince
()))
{
tSettleDomain
.
setProvince
(
Integer
.
valueOf
(
RedisUtil
.
redis
.
opsForValue
().
get
(
CacheConstants
.
AREA_VALUE
+
tSettleDomain
.
getEProvince
()).
toString
()));
}
if
(
Common
.
isNotNull
(
tSettleDomain
.
getECity
()))
{
tSettleDomain
.
setCity
(
Integer
.
valueOf
(
RedisUtil
.
redis
.
opsForValue
().
get
(
CacheConstants
.
AREA_VALUE
+
tSettleDomain
.
getECity
()).
toString
()));
}
if
(
Common
.
isNotNull
(
tSettleDomain
.
getETown
()))
{
tSettleDomain
.
setTown
(
Integer
.
valueOf
(
RedisUtil
.
redis
.
opsForValue
().
get
(
CacheConstants
.
AREA_VALUE
+
tSettleDomain
.
getETown
()).
toString
()));
}
TSettleDomain
tSettleDomainInfo
=
baseMapper
.
selectById
(
tSettleDomain
.
getId
());
if
(
Common
.
isNotNull
(
tSettleDomainInfo
))
{
baseMapper
.
updateById
(
tSettleDomain
);
}
else
{
baseMapper
.
insert
(
tSettleDomain
);
}
return
R
.
ok
();
}
else
{
return
R
.
failed
(
CommonConstants
.
PARAM_IS_NOT_ERROR
);
}
}
@Override
public
SetInfoVo
getSetInfoByCodes
(
List
<
String
>
codes
)
{
List
<
ProjectSetInfoVo
>
voList
=
baseMapper
.
getSetInfoByCodes
(
codes
);
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TSettleDomainMapper.xml
View file @
80f09c69
...
...
@@ -73,6 +73,11 @@
<result
property=
"backPayCycle"
column=
"BACK_PAY_CYCLE"
/>
<result
property=
"socialType"
column=
"SOCIAL_TYPE"
/>
<result
property=
"fundType"
column=
"FUND_TYPE"
/>
<result
property=
"insuranceSettleType"
column=
"INSURANCE_SETTLE_TYPE"
/>
<result
property=
"invoiceTitle"
column=
"INVOICE_TITLE"
/>
<result
property=
"unitOfOurCompany"
column=
"UNIT_OF_OUR_COMPANY"
/>
<result
property=
"customerNo"
column=
"CUSTOMER_NO"
/>
<result
property=
"customerName"
column=
"CUSTOMER_NAME"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -129,6 +134,11 @@
a.UPDATE_BY,
a.UPDATE_TIME,
a.SOCIAL_TYPE,
a.INSURANCE_SETTLE_TYPE,
a.CUSTOMER_NO,
a.CUSTOMER_NAME,
a.UNIT_OF_OUR_COMPANY,
a.INVOICE_TITLE,
a.FUND_TYPE
</sql>
...
...
yifu-common/pom.xml
View file @
80f09c69
...
...
@@ -38,9 +38,9 @@
<module>
yifu-common-mybatis
</module>
<module>
yifu-common-seata
</module>
<module>
yifu-common-security
</module>
<module>
yifu-common-test
</module>
<module>
yifu-common-dapr
</module>
<module>
yifu-common-swagger
</module>
<module>
yifu-common-ldap
</module>
<module>
yifu-common-ekp
</module>
</modules>
</project>
yifu-common/yifu-common-
test
/pom.xml
→
yifu-common/yifu-common-
ekp
/pom.xml
View file @
80f09c69
...
...
@@ -9,19 +9,11 @@
<version>
1.0.0
</version>
</parent>
<artifactId>
yifu-common-
test
</artifactId>
<artifactId>
yifu-common-
ekp
</artifactId>
<packaging>
jar
</packaging>
<description>
yifu
oauth 2.0 单元测试
工具类
</description>
<description>
yifu
EKP
工具类
</description>
<dependencies>
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-security
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-test
</artifactId>
</dependency>
</dependencies>
</project>
yifu-common/yifu-common-ekp/src/main/java/com/yifu.cloud.plus.v1/yifu/ekp/config/EkpSalaryProperties.java
0 → 100644
View file @
80f09c69
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.stereotype.Component
;
/**
* @Author fxj
* @Description 薪资明细对接
* @Date 11:57 2022/8/22
* @Param
* @return
**/
@Data
@Component
@PropertySource
(
"classpath:ekpSalaryConfig.properties"
)
@ConfigurationProperties
(
value
=
"ekp"
,
ignoreInvalidFields
=
false
)
public
class
EkpSalaryProperties
{
String
url
;
String
fdModelId
;
String
fdFlowId
;
String
docStatus
;
String
LoginName
;
String
docSubject
;
}
yifu-common/yifu-common-ekp/src/main/java/com/yifu.cloud.plus.v1/yifu/ekp/util/EkpSalaryUtil.java
0 → 100644
View file @
80f09c69
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
util
;
import
com.yifu.cloud.plus.v1.yifu.common.ekp.config.EkpSalaryProperties
;
import
lombok.extern.log4j.Log4j2
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
/**
* @Author fxj
* @Date 2022/7/11
* @Description
* @Version 1.0
*/
@Log4j2
@EnableConfigurationProperties
(
EkpSalaryProperties
.
class
)
public
class
EkpSalaryUtil
{
@Autowired
private
EkpSalaryProperties
ekpProperties
;
}
yifu-common/yifu-common-ekp/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
80f09c69
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.ekp.util.EkpSalaryUtil
\ No newline at end of file
yifu-common/yifu-common-ekp/src/main/resources/ekpSalaryConfig.properties
0 → 100644
View file @
80f09c69
ekp.url
=
http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
ekp.fdModelId
=
'181d7633ff8bc797276d0d3a54e80ad6'
ekp.fdFlowId
=
'182b40249c1bc940d7226b941c7a4183'
ekp.docStatus
=
'20'
ekp.LoginName
=
'admin'
ekp.docSubject
=
'\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3'
yifu-common/yifu-common-test/src/main/java/com/yifu.cloud.plus.v1/yifu/test/WithMockSecurityContextFactory.java
deleted
100644 → 0
View file @
9b0ce0e2
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
test
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.json.JSONUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder
;
import
com.yifu.cloud.plus.v1.yifu.test.annotation.WithMockOAuth2User
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.oauth2.client.OAuth2ClientContext
;
import
org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails
;
import
org.springframework.security.oauth2.common.DefaultOAuth2AccessToken
;
import
org.springframework.security.oauth2.provider.OAuth2Authentication
;
import
org.springframework.security.oauth2.provider.token.RemoteTokenServices
;
import
org.springframework.security.test.context.support.WithSecurityContextFactory
;
/**
* @author lengleng
* @date 2020/9/22
* <p>
* oauth2 上下文生成处理器
*/
public
class
WithMockSecurityContextFactory
implements
WithSecurityContextFactory
<
WithMockOAuth2User
>
{
@Override
public
SecurityContext
createSecurityContext
(
WithMockOAuth2User
oAuth2User
)
{
// 1. 请求认证中心获取token
String
token
=
getToken
(
oAuth2User
);
// 2. 解析认证中心返回用户
OAuth2Authentication
authentication
=
getUser
(
token
);
// 3. 构建 oauth2 上下文
SecurityContext
context
=
SecurityContextHolder
.
createEmptyContext
();
context
.
setAuthentication
(
authentication
);
// 4. 上下文保存 token
DefaultOAuth2AccessToken
accessToken
=
new
DefaultOAuth2AccessToken
(
token
);
OAuth2ClientContext
clientContext
=
SpringContextHolder
.
getBean
(
OAuth2ClientContext
.
class
);
clientContext
.
setAccessToken
(
accessToken
);
return
context
;
}
/**
* 请求认证中心获取token
* @param oAuth2User 账号、密码
* @return String token
*/
private
String
getToken
(
WithMockOAuth2User
oAuth2User
)
{
OAuth2ProtectedResourceDetails
clientProperties
=
SpringContextHolder
.
getBean
(
OAuth2ProtectedResourceDetails
.
class
);
String
result
=
HttpRequest
.
post
(
clientProperties
.
getAccessTokenUri
())
.
basicAuth
(
clientProperties
.
getClientId
(),
clientProperties
.
getClientSecret
())
.
form
(
"username"
,
oAuth2User
.
username
()).
form
(
"password"
,
oAuth2User
.
password
())
.
form
(
"grant_type"
,
"password"
).
form
(
"scope"
,
clientProperties
.
getScope
()).
execute
().
body
();
return
JSONUtil
.
parseObj
(
result
).
getStr
(
"access_token"
);
}
/**
* 使用token 获取用户详情
* @param token token
* @return user详细
*/
private
OAuth2Authentication
getUser
(
String
token
)
{
RemoteTokenServices
tokenServices
=
SpringContextHolder
.
getBean
(
RemoteTokenServices
.
class
);
return
tokenServices
.
loadAuthentication
(
token
);
}
}
yifu-common/yifu-common-test/src/main/java/com/yifu.cloud.plus.v1/yifu/test/annotation/WithMockOAuth2User.java
deleted
100644 → 0
View file @
9b0ce0e2
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
test
.
annotation
;
import
com.yifu.cloud.plus.v1.yifu.test.WithMockSecurityContextFactory
;
import
org.springframework.security.test.context.support.WithSecurityContext
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
/**
* @author lengleng
* @date 2020/9/22
* <p>
* WithMockOAuth2User 注解
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@WithSecurityContext
(
factory
=
WithMockSecurityContextFactory
.
class
)
public
@interface
WithMockOAuth2User
{
/**
* 用户名
*/
String
username
()
default
"admin"
;
/**
* 密码
*/
String
password
()
default
"123456"
;
}
\ No newline at end of file
yifu-common/yifu-common-test/src/main/java/com/yifu.cloud.plus.v1/yifu/test/kit/OAuthMockKit.java
deleted
100644 → 0
View file @
9b0ce0e2
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
test
.
kit
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.oauth2.client.OAuth2ClientContext
;
import
org.springframework.test.web.servlet.request.RequestPostProcessor
;
/**
* @author lengleng
* @date 2020/9/22
* <p>
* Mock 工具类
*/
public
class
OAuthMockKit
{
/**
* mock 请求增加统一请求头
* @return RequestPostProcessor 类似于拦截器
*/
public
static
RequestPostProcessor
token
()
{
return
mockRequest
->
{
OAuth2ClientContext
clientContext
=
SpringContextHolder
.
getBean
(
OAuth2ClientContext
.
class
);
String
token
=
clientContext
.
getAccessToken
().
getValue
();
mockRequest
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
String
.
format
(
"Bearer: %s"
,
token
));
return
mockRequest
;
};
}
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TStatisticsBonusImportVo.java
0 → 100644
View file @
80f09c69
/*
* 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
.
salary
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 全年一次性奖金申报表
*
* @author huyc
* @date 2022-08-14 21:31:15
*/
@Data
public
class
TStatisticsBonusImportVo
extends
RowIndex
implements
Serializable
{
/**
* 员工姓名
*/
@Length
(
max
=
32
,
message
=
"员工姓名 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"员工姓名"
,
maxLength
=
32
)
@Schema
(
description
=
"员工姓名"
)
@ExcelProperty
(
"员工姓名"
)
private
String
empName
;
/**
* 身份证号
*/
@Length
(
max
=
32
,
message
=
"身份证号 不能超过32 个字符"
)
@ExcelAttribute
(
name
=
"身份证号"
,
maxLength
=
32
)
@Schema
(
description
=
"身份证号"
)
@ExcelProperty
(
"身份证号"
)
private
String
empIdcard
;
/**
* 待发年终奖
*/
@ExcelAttribute
(
name
=
"待发年终奖"
)
@Schema
(
description
=
"待发年终奖"
)
@ExcelProperty
(
"待发年终奖"
)
private
BigDecimal
annualBonus
;
/**
* 待发12月工资
*/
@ExcelAttribute
(
name
=
"待发12月工资"
)
@Schema
(
description
=
"待发12月工资"
)
@ExcelProperty
(
"待发12月工资"
)
private
BigDecimal
annualTSalary
;
/**
* 12月工资是否已经发放
*/
@ExcelAttribute
(
name
=
"12月工资是否已经发放"
)
@Schema
(
description
=
"12月工资是否已经发放"
)
@ExcelProperty
(
"12月工资是否已经发放"
)
private
String
isTSend
;
/**
* 年终奖单独扣税12月税费
*/
@ExcelAttribute
(
name
=
"年终奖单独扣税12月税费"
)
@Schema
(
description
=
"年终奖单独扣税12月税费"
)
@ExcelProperty
(
"年终奖单独扣税12月税费"
)
private
BigDecimal
annualATax
;
/**
* 年终奖合并扣税12月税费
*/
@ExcelAttribute
(
name
=
"年终奖合并扣税12月税费"
)
@Schema
(
description
=
"年终奖合并扣税12月税费"
)
@ExcelProperty
(
"年终奖合并扣税12月税费"
)
private
BigDecimal
annualSTax
;
/**
* 最优方案-12月工资
*/
@ExcelAttribute
(
name
=
"最优方案-12月工资"
)
@Schema
(
description
=
"最优方案-12月工资"
)
@ExcelProperty
(
"最优方案-12月工资"
)
private
BigDecimal
bestPlanTSalary
;
/**
* 最优方案-年终奖
*/
@ExcelAttribute
(
name
=
"最优方案-年终奖"
)
@Schema
(
description
=
"最优方案-年终奖"
)
@ExcelProperty
(
"最优方案-年终奖"
)
private
BigDecimal
bestPlanBonus
;
/**
* 最优方案-12月扣税
*/
@ExcelAttribute
(
name
=
"最优方案-12月扣税"
)
@Schema
(
description
=
"最优方案-12月扣税"
)
@ExcelProperty
(
"最优方案-12月扣税"
)
private
BigDecimal
bestPlanTax
;
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TStatisticsBonusController.java
View file @
80f09c69
...
...
@@ -19,12 +19,12 @@ package com.yifu.cloud.plus.v1.yifu.salary.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.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusImportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
...
...
@@ -32,7 +32,6 @@ import lombok.RequiredArgsConstructor;
import
lombok.SneakyThrows
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
...
...
@@ -101,18 +100,17 @@ public class TStatisticsBonusController {
}
/**
* 全年一次性奖金申报表 批量导入
*
* 全年一次性奖金测算
* @author huyc
* @date 2022-08-14 21:31:15
**/
@SneakyThrows
@Operation
(
description
=
"
批量新增全年一次性奖金申报表
hasPermission('salary_tstatisticsbonus-batch-import')"
)
@SysLog
(
"
批量新增全年一次性奖金申报表
"
)
@Operation
(
description
=
"
全年一次性奖金测算
hasPermission('salary_tstatisticsbonus-batch-import')"
)
@SysLog
(
"
全年一次性奖金测算
"
)
@PostMapping
(
"/importListAdd"
)
@PreAuthorize
(
"@pms.hasPermission('salary_tstatisticsbonus-batch-import')"
)
public
R
<
List
<
ErrorMessage
>>
importListAdd
(
@RequestBody
MultipartFile
file
){
return
tStatisticsBonusService
.
importDiy
(
file
.
getInputStream
()
);
public
void
importListAdd
(
HttpServletResponse
response
,
@RequestBody
List
<
TStatisticsBonusImportVo
>
list
,
String
deptId
){
tStatisticsBonusService
.
importDiy
(
response
,
list
,
deptId
);
}
/**
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TStatisticsBonusService.java
View file @
80f09c69
...
...
@@ -20,13 +20,12 @@ package com.yifu.cloud.plus.v1.yifu.salary.service;
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.common.core.util.ErrorMessage
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusImportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.InputStream
;
import
java.util.List
;
/**
...
...
@@ -43,10 +42,20 @@ public interface TStatisticsBonusService extends IService<TStatisticsBonus> {
*/
IPage
<
TStatisticsBonus
>
getTStatisticsBonusPage
(
Page
<
TStatisticsBonus
>
page
,
TStatisticsBonusSearchVo
tStatisticsBonus
);
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
);
/**
* 全年一次性奖金申报表导出
* @param searchVo
* @return
*/
void
listExport
(
HttpServletResponse
response
,
TStatisticsBonusSearchVo
searchVo
);
/**
* 全年一次性奖金测算
* @param deptId 部门id
* @return
*/
void
importDiy
(
HttpServletResponse
response
,
List
<
TStatisticsBonusImportVo
>
list
,
String
deptId
);
List
<
TStatisticsBonus
>
noPageDiy
(
TStatisticsBonusSearchVo
searchVo
);
/**
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/SalaryUploadServiceImpl.java
View file @
80f09c69
...
...
@@ -1714,11 +1714,11 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
else
{
nowTaxY
=
getNowTax
(
actualSalarySum
);
relaySalary
=
BigDecimalUtils
.
safeAdd
(
actualSalarySumNow
,
nowTaxY
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
a
.
setSalaryTaxUnit
(
nowTaxY
);
a
.
setActualSalary
(
actualSalarySumNow
);
if
(
sumTax
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
nowTaxY
=
BigDecimalUtils
.
safeSubtract
(
nowTaxY
,
sumTax
).
setScale
(
SalaryConstants
.
PLACES
,
BigDecimal
.
ROUND_HALF_UP
);
}
a
.
setSalaryTaxUnit
(
nowTaxY
);
}
a
.
setRelaySalaryUnit
(
relaySalary
);
a
.
setRelaySalary
(
actualSalarySumNow
);
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TStatisticsBonusServiceImpl.java
View file @
80f09c69
...
...
@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsBonusMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusImportVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusVo
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -134,6 +135,47 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
}
}
/**
* 全年一次性奖金测算
* @param deptId 部门ID
* @return
*/
@Override
public
void
importDiy
(
HttpServletResponse
response
,
List
<
TStatisticsBonusImportVo
>
list
,
String
deptId
){
String
fileName
=
"全年一次性奖金测算导出"
+
DateUtil
.
getThisTime
()
+
".xlsx"
;
ServletOutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
TStatisticsBonus
.
class
).
build
();
int
index
=
0
;
if
(
list
.
size
()
>
CommonConstants
.
ZERO_INT
){
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"全年一次性奖金测算"
+
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
<
TStatisticsBonus
>
noPageDiy
(
TStatisticsBonusSearchVo
searchVo
)
{
LambdaQueryWrapper
<
TStatisticsBonus
>
wrapper
=
buildQueryWrapper
(
searchVo
);
...
...
@@ -203,79 +245,4 @@ public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMap
return
wrapper
;
}
@Override
public
R
<
List
<
ErrorMessage
>>
importDiy
(
InputStream
inputStream
)
{
List
<
ErrorMessage
>
errorMessageList
=
new
ArrayList
<>();
ExcelUtil
<
TStatisticsBonusVo
>
util1
=
new
ExcelUtil
<>(
TStatisticsBonusVo
.
class
);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try
{
EasyExcel
.
read
(
inputStream
,
TStatisticsBonusVo
.
class
,
new
ReadListener
<
TStatisticsBonusVo
>()
{
/**
* 单次缓存的数据量
*/
public
static
final
int
BATCH_COUNT
=
CommonConstants
.
BATCH_COUNT
;
/**
*临时存储
*/
private
List
<
TStatisticsBonusVo
>
cachedDataList
=
ListUtils
.
newArrayListWithExpectedSize
(
BATCH_COUNT
);
@Override
public
void
invoke
(
TStatisticsBonusVo
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
());
importTStatisticsBonus
(
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
importTStatisticsBonus
(
List
<
TStatisticsBonusVo
>
excelVOList
,
List
<
ErrorMessage
>
errorMessageList
)
{
// 个性化校验逻辑
ErrorMessage
errorMsg
;
// 执行数据插入操作 组装
for
(
int
i
=
0
;
i
<
excelVOList
.
size
();
i
++)
{
TStatisticsBonusVo
excel
=
excelVOList
.
get
(
i
);
// 插入
insertExcel
(
excel
);
errorMessageList
.
add
(
new
ErrorMessage
(
excel
.
getRowIndex
(),
CommonConstants
.
SAVE_SUCCESS
));
}
}
/**
* 插入excel bad record
*/
private
void
insertExcel
(
TStatisticsBonusVo
excel
)
{
TStatisticsBonus
insert
=
new
TStatisticsBonus
();
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