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
713a27f0
Commit
713a27f0
authored
Jun 20, 2023
by
wangzb
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.5.4' into MVP1.5.4
parents
75d3ed8d
17fd572a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
391 additions
and
0 deletions
+391
-0
SalaryTask.java
...n/java/com/yifu/cloud/plus/v1/job/compont/SalaryTask.java
+13
-0
TAverageSalary.java
...yifu/cloud/plus/v1/yifu/salary/entity/TAverageSalary.java
+64
-0
TAverageSalaryVo.java
...m/yifu/cloud/plus/v1/yifu/salary/vo/TAverageSalaryVo.java
+39
-0
TAverageSalaryController.java
...s/v1/yifu/salary/controller/TAverageSalaryController.java
+98
-0
TAverageSalaryMapper.java
...loud/plus/v1/yifu/salary/mapper/TAverageSalaryMapper.java
+44
-0
TAverageSalaryService.java
...ud/plus/v1/yifu/salary/service/TAverageSalaryService.java
+26
-0
TAverageSalaryServiceImpl.java
...1/yifu/salary/service/impl/TAverageSalaryServiceImpl.java
+52
-0
application.yml
...salary/yifu-salary-biz/src/main/resources/application.yml
+1
-0
TAverageSalaryMapper.xml
...ry-biz/src/main/resources/mapper/TAverageSalaryMapper.xml
+54
-0
No files found.
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/SalaryTask.java
View file @
713a27f0
...
...
@@ -127,5 +127,18 @@ public class SalaryTask {
log
.
info
(
"------------定时生成本期申报-定时任务结束------------"
);
}
/**
* @Author hgw
* @Description 前12月平均工资(MVP-TDC接口)
* @Date 2023-6-19 16:31:32
* @Param
* @return
**/
public
void
doCreateAverageSalary
()
{
log
.
info
(
"------------定时生成【前12月平均工资】-定时任务开始------------"
);
HttpDaprUtil
.
invokeMethodPost
(
daprSalarylProperties
.
getAppUrl
(),
daprSalarylProperties
.
getAppId
(),
"/taveragesalary/inner/doCreateAverageSalary"
,
""
,
Object
.
class
,
SecurityConstants
.
FROM_IN
);
log
.
info
(
"------------定时生成【前12月平均工资】-定时任务结束------------"
);
}
}
\ No newline at end of file
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/entity/TAverageSalary.java
0 → 100644
View file @
713a27f0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.HeadFontStyle
;
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.core.constant.ExcelAttribute
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* 前12月平均工资(MVP-TDC接口)
* 保留上月与本月,删除上上月数据,用以比对差异部分,推送到TDC
*
* @author hgw
* @date 2023-6-19 15:54:50
*/
@Getter
@Setter
@TableName
(
"t_average_salary"
)
@Tag
(
name
=
"前12月平均工资"
)
public
class
TAverageSalary
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* id
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
value
=
"id"
)
private
String
id
;
/**
* 身份证号
*/
@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
;
/**
* 结算月
*/
@ExcelAttribute
(
name
=
"生成月"
,
isNotEmpty
=
true
,
errorInfo
=
"生成月不能为空"
,
maxLength
=
6
)
@NotBlank
(
message
=
"生成月不能为空"
)
@Length
(
max
=
6
,
message
=
"生成月不能超过20个字符"
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"生成月"
)
private
String
createMonth
;
}
yifu-salary/yifu-salary-api/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/vo/TAverageSalaryVo.java
0 → 100644
View file @
713a27f0
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
0 → 100644
View file @
713a27f0
/*
* 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
.
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.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.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* 前12月平均工资(MVP-TDC接口)
*
* @author hgw
* @date 2023-6-19 16:27:44
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/taveragesalary"
)
@Tag
(
name
=
"前12月平均工资(MVP-TDC接口)"
)
public
class
TAverageSalaryController
{
private
final
TAverageSalaryService
tAverageSalaryService
;
/**
* @Description: 定时任务-前12月平均工资
* @Author: hgw
* @Date: 2023-6-19 16:29:50
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
@Inner
@Operation
(
description
=
"定时任务-前12月平均工资"
)
@PostMapping
(
"/inner/doCreateAverageSalary"
)
public
void
doCreateAverageSalary
()
{
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
0 → 100644
View file @
713a27f0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
mapper
;
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.vo.TAverageSalaryVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 前12月平均工资(MVP-TDC接口)
*
* @author hgw
* @date 2023-6-19 16:24:41
*/
@Mapper
public
interface
TAverageSalaryMapper
extends
BaseMapper
<
TAverageSalary
>
{
/**
* 删除多余的数据
*
* @return
*/
int
deleteByCreateMonth
();
/**
* @param
* @Description: 新增新数据
* @Author: hgw
* @Date: 2023/6/19 16:10
* @return: int
**/
int
insertAverageSalary
();
/**
* @return
* @Author fxj
* @Description 获取-前12月平均工资数据 取值增量
* @Date 10:26 2023/6/20
* @Param
**/
List
<
TAverageSalaryVo
>
getAverageSalary
(
@Param
(
"idNum"
)
List
<
String
>
idNum
);
}
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/TAverageSalaryService.java
0 → 100644
View file @
713a27f0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
;
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.vo.TAverageSalaryVo
;
import
java.util.List
;
/**
* @Author hgw
* @Description 前12月平均工资(MVP-TDC接口)
* @Date 2023-6-19 16:25:54
**/
public
interface
TAverageSalaryService
extends
IService
<
TAverageSalary
>
{
/**
* @Description: 删除本月与上上月数据,生成本月数据
* @Author: hgw
* @Date: 2023/6/19 16:26
* @return: void
**/
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
0 → 100644
View file @
713a27f0
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
salary
.
service
.
impl
;
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.Common
;
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.mapper.TAverageSalaryMapper
;
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
java.util.ArrayList
;
import
java.util.List
;
/**
* @Author hgw
* @Description 前12月平均工资(MVP-TDC接口)
* @Date 2023-6-19 16:25:16
**/
@Service
(
"tAverageSalaryService"
)
public
class
TAverageSalaryServiceImpl
extends
ServiceImpl
<
TAverageSalaryMapper
,
TAverageSalary
>
implements
TAverageSalaryService
{
/**
* @Description: 删除本月与上上月数据,生成本月数据
* @Author: hgw
* @Date: 2023/6/19 16:32
* @return: void
**/
@Override
public
void
createAverageSalary
()
{
baseMapper
.
deleteByCreateMonth
();
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
(
Common
.
getList
(
idNum
)),
CommonConstants
.
RESULT_DATA_SUCESS
);
}
}
yifu-salary/yifu-salary-biz/src/main/resources/application.yml
View file @
713a27f0
...
...
@@ -39,6 +39,7 @@ security:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
-
/taveragesalary/getAverageSalary
...
...
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TAverageSalaryMapper.xml
0 → 100644
View file @
713a27f0
<?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.yifu.cloud.plus.v1.yifu.salary.mapper.TAverageSalaryMapper"
>
<resultMap
id=
"tAverageSalaryMap"
type=
"com.yifu.cloud.plus.v1.yifu.salary.entity.TAverageSalary"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"empIdcard"
column=
"EMP_IDCARD"
/>
<result
property=
"averageSalary"
column=
"AVERAGE_SALARY"
/>
<result
property=
"createMonth"
column=
"CREATE_MONTH"
/>
</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
from t_average_salary
where CREATE_MONTH in (
DATE_FORMAT(now(), '%Y%m'), DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 2 MONTH), '%Y%m')
)
</delete>
<!-- 生成需要的数据 -->
<insert
id=
"insertAverageSalary"
>
insert into t_average_salary
select CONCAT(DATE_FORMAT(now(), '%Y%m-'), a.ID) ID
, a.EMP_IDCARD
, round(sum(a.RELAY_SALARY) / ifnull(count(DISTINCT a.SALARY_MONTH), 1), 2) AVERAGE_SALARY
, DATE_FORMAT(now(), '%Y%m') CREATE_MONTH
from t_salary_account a
where a.SALARY_MONTH >= date_format(DATE_SUB(NOW(), INTERVAL 1 YEAR), '%Y%m')
GROUP BY a.EMP_IDCARD
</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.size > 0"
>
AND x.EMP_IDCARD in
<foreach
item=
"item"
index=
"index"
collection=
"idNum"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</select>
</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