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
ea4234ab
Commit
ea4234ab
authored
Jun 20, 2023
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DTC 平均工资接口
parent
32ffaee2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
144 additions
and
14 deletions
+144
-14
TAverageSalary.java
...yifu/cloud/plus/v1/yifu/salary/entity/TAverageSalary.java
+2
-2
TAverageSalaryVo.java
...m/yifu/cloud/plus/v1/yifu/salary/vo/TAverageSalaryVo.java
+39
-0
TAverageSalaryController.java
...s/v1/yifu/salary/controller/TAverageSalaryController.java
+41
-0
TAverageSalaryMapper.java
...loud/plus/v1/yifu/salary/mapper/TAverageSalaryMapper.java
+12
-0
TAverageSalaryService.java
...ud/plus/v1/yifu/salary/service/TAverageSalaryService.java
+5
-0
TAverageSalaryServiceImpl.java
...1/yifu/salary/service/impl/TAverageSalaryServiceImpl.java
+18
-0
TAverageSalaryMapper.xml
...ry-biz/src/main/resources/mapper/TAverageSalaryMapper.xml
+27
-12
No files found.
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TAverageSalary.java
View file @
ea4234ab
...
@@ -25,7 +25,7 @@ import java.math.BigDecimal;
...
@@ -25,7 +25,7 @@ import java.math.BigDecimal;
*/
*/
@Getter
@Getter
@Setter
@Setter
@TableName
(
"t_
min
_salary"
)
@TableName
(
"t_
average
_salary"
)
@Tag
(
name
=
"前12月平均工资"
)
@Tag
(
name
=
"前12月平均工资"
)
public
class
TAverageSalary
implements
Serializable
{
public
class
TAverageSalary
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -50,7 +50,7 @@ public class TAverageSalary implements Serializable {
...
@@ -50,7 +50,7 @@ public class TAverageSalary implements Serializable {
@ExcelAttribute
(
name
=
"应发薪酬"
)
@ExcelAttribute
(
name
=
"应发薪酬"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"应发薪酬"
)
@ExcelProperty
(
"应发薪酬"
)
private
BigDecimal
relay
Salary
;
private
BigDecimal
average
Salary
;
/**
/**
* 结算月
* 结算月
...
...
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TAverageSalaryVo.java
0 → 100644
View file @
ea4234ab
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.HeadFontStyle
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 前12月平均工资(MVP-TDC接口)
* 保留上月与本月,删除上上月数据,用以比对差异部分,推送到TDC
*
* @author hgw
* @date 2023-6-19 15:54:50
*/
@Data
public
class
TAverageSalaryVo
implements
Serializable
{
/**
* 身份证号
*/
@ExcelAttribute
(
name
=
"身份证号"
,
maxLength
=
25
)
@Length
(
max
=
25
,
message
=
"身份证号不能超过25个字符"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"身份证号"
)
private
String
empIdcard
;
/**
* 应发薪酬(劳务费、稿酬)
*/
@ExcelAttribute
(
name
=
"应发薪酬"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"应发薪酬"
)
private
BigDecimal
averageSalary
;
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/controller/TAverageSalaryController.java
View file @
ea4234ab
...
@@ -17,15 +17,25 @@
...
@@ -17,15 +17,25 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
controller
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
controller
;
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.constant.ResultConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.redis.RedisDistributedLock
;
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.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAverageSalaryService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAverageSalaryService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TAverageSalaryVo
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
/**
* 前12月平均工资(MVP-TDC接口)
* 前12月平均工资(MVP-TDC接口)
...
@@ -53,5 +63,36 @@ public class TAverageSalaryController {
...
@@ -53,5 +63,36 @@ public class TAverageSalaryController {
public
void
doCreateAverageSalary
()
{
public
void
doCreateAverageSalary
()
{
tAverageSalaryService
.
createAverageSalary
();
tAverageSalaryService
.
createAverageSalary
();
}
}
/**
* @Author fxj
* @Description 获取-前12月平均工资数据
* @Date 10:20 2023/6/20
* @Param
* @return
**/
@Operation
(
description
=
"获取-前12月平均工资数据"
)
@GetMapping
(
"/getAverageSalary"
)
public
R
<
List
<
TAverageSalaryVo
>>
getAverageSalary
(
String
idNum
)
{
// 获取redis分布式事务锁
String
key
=
CacheConstants
.
PAYMENT_DISPATCH_BATCH_ADD_IMPORT
+
CommonConstants
.
DOWN_LINE_STRING
+
"getAverageSalary"
;
String
requestId
;
try
{
requestId
=
RedisDistributedLock
.
getLock
(
key
,
"10"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
try
{
if
(
Common
.
isNotNull
(
requestId
))
{
//主动释放锁
return
tAverageSalaryService
.
getAverageSalary
(
idNum
);
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
finally
{
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
}
}
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/mapper/TAverageSalaryMapper.java
View file @
ea4234ab
...
@@ -2,7 +2,11 @@ package com.yifu.cloud.plus.v1.yifu.salary.mapper;
...
@@ -2,7 +2,11 @@ package com.yifu.cloud.plus.v1.yifu.salary.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TAverageSalaryVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 前12月平均工资(MVP-TDC接口)
* 前12月平均工资(MVP-TDC接口)
...
@@ -29,4 +33,12 @@ public interface TAverageSalaryMapper extends BaseMapper<TAverageSalary> {
...
@@ -29,4 +33,12 @@ public interface TAverageSalaryMapper extends BaseMapper<TAverageSalary> {
**/
**/
int
insertAverageSalary
();
int
insertAverageSalary
();
/**
* @return
* @Author fxj
* @Description 获取-前12月平均工资数据 取值增量
* @Date 10:26 2023/6/20
* @Param
**/
List
<
TAverageSalaryVo
>
getAverageSalary
(
@Param
(
"idNum"
)
String
idNum
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TAverageSalaryService.java
View file @
ea4234ab
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TAverageSalaryVo
;
import
java.util.List
;
/**
/**
* @Author hgw
* @Author hgw
...
@@ -18,4 +22,5 @@ public interface TAverageSalaryService extends IService<TAverageSalary> {
...
@@ -18,4 +22,5 @@ public interface TAverageSalaryService extends IService<TAverageSalary> {
**/
**/
void
createAverageSalary
();
void
createAverageSalary
();
R
<
List
<
TAverageSalaryVo
>>
getAverageSalary
(
String
idNum
);
}
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TAverageSalaryServiceImpl.java
View file @
ea4234ab
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TAverageSalaryMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.mapper.TAverageSalaryMapper
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAverageSalaryService
;
import
com.yifu.cloud.plus.v1.yifu.salary.service.TAverageSalaryService
;
import
com.yifu.cloud.plus.v1.yifu.salary.vo.TAverageSalaryVo
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* @Author hgw
* @Author hgw
* @Description 前12月平均工资(MVP-TDC接口)
* @Description 前12月平均工资(MVP-TDC接口)
...
@@ -26,6 +32,18 @@ public class TAverageSalaryServiceImpl extends ServiceImpl<TAverageSalaryMapper,
...
@@ -26,6 +32,18 @@ public class TAverageSalaryServiceImpl extends ServiceImpl<TAverageSalaryMapper,
baseMapper
.
insertAverageSalary
();
baseMapper
.
insertAverageSalary
();
}
}
/**
* @return
* @Author fxj
* @Description 获取-前12月平均工资数据
* @Date 10:25 2023/6/20
* @Param
**/
@Override
public
R
<
List
<
TAverageSalaryVo
>>
getAverageSalary
(
String
idNum
)
{
return
R
.
ok
(
baseMapper
.
getAverageSalary
(
idNum
),
CommonConstants
.
RESULT_DATA_SUCESS
);
}
}
}
...
...
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TAverageSalaryMapper.xml
View file @
ea4234ab
...
@@ -7,30 +7,45 @@
...
@@ -7,30 +7,45 @@
<resultMap
id=
"tAverageSalaryMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary"
>
<resultMap
id=
"tAverageSalaryMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary"
>
<id
property=
"id"
column=
"ID"
/>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"
relaySalary"
column=
"RELAY
_SALARY"
/>
<result
property=
"
averageSalary"
column=
"AVERAGE
_SALARY"
/>
<result
property=
"createMonth"
column=
"CREATE_MONTH"
/>
<result
property=
"createMonth"
column=
"CREATE_MONTH"
/>
</resultMap>
</resultMap>
<resultMap
id=
"tAverageSalaryVoMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.vo.TAverageSalaryVo"
>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"averageSalary"
column=
"AVERAGE_SALARY"
/>
</resultMap>
<!-- 删除不需要的数据 -->
<!-- 删除不需要的数据 -->
<delete
id=
"deleteByCreateMonth"
>
<delete
id=
"deleteByCreateMonth"
>
delete
delete
from t_average_salary
from t_average_salary
where CREATE_MONTH in (
where CREATE_MONTH in (
DATE_FORMAT(now(),'%Y%m')
DATE_FORMAT(now(), '%Y%m'), DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 2 MONTH), '%Y%m')
,DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 2 MONTH), '%Y%m')
)
)
</delete>
</delete>
<!-- 生成需要的数据 -->
<!-- 生成需要的数据 -->
<insert
id=
"insertAverageSalary"
>
<insert
id=
"insertAverageSalary"
>
insert into t_average_salary
insert into t_average_salary
select
select CONCAT(DATE_FORMAT(now(), '%Y%m-'), a.ID) ID
CONCAT(DATE_FORMAT(now(),'%Y%m-'),a.ID) ID
, a.EMP_IDCARD
,a.EMP_IDCARD
, round(sum(a.RELAY_SALARY) / ifnull(count(DISTINCT a.SALARY_MONTH), 1), 2) AVERAGE_SALARY
,round(sum(a.RELAY_SALARY)/ifnull(count(DISTINCT a.SALARY_MONTH),1),2) AVERAGE_SALARY
, DATE_FORMAT(now(), '%Y%m') CREATE_MONTH
,DATE_FORMAT(now(),'%Y%m') CREATE_MONTH
from t_salary_account a
from t_salary_account a
where a.SALARY_MONTH >= date_format(DATE_SUB(NOW(),
INTERVAL 1 YEAR), '%Y%m'
)
where a.SALARY_MONTH >= date_format(DATE_SUB(NOW(),
INTERVAL 1 YEAR), '%Y%m'
)
GROUP BY a.EMP_IDCARD
GROUP BY a.EMP_IDCARD
</insert>
</insert>
<select
id=
"getAverageSalary"
resultMap=
"tAverageSalaryVoMap"
>
select x.* from
(select a.EMP_IDCARD,a.AVERAGE_SALARY from view_average_cur_month a) x
LEFT JOIN
(select a.EMP_IDCARD,a.AVERAGE_SALARY from view_average_last_month a) y
on x.EMP_IDCARD=y.EMP_IDCARD
where (x.AVERAGE_SALARY
<![CDATA[ <> ]]>
IFNULL(y.AVERAGE_SALARY,-1))
<if
test=
"idNum != null and idNum != ''"
>
and x.EMP_IDCARD = #{idNum}
</if>
</select>
</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