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
61251f62
Commit
61251f62
authored
Jan 17, 2025
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huych-含风险项目商险不购买申请提交
parent
ce53a2e9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
106 deletions
+162
-106
CacheConstants.java
...oud/plus/v1/yifu/common/core/constant/CacheConstants.java
+6
-0
ResultConstants.java
...ud/plus/v1/yifu/common/core/constant/ResultConstants.java
+2
-0
TInsuranceUnpurchaseApplyServiceImpl.java
...ry/service/impl/TInsuranceUnpurchaseApplyServiceImpl.java
+154
-106
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/CacheConstants.java
View file @
61251f62
...
...
@@ -102,6 +102,10 @@ public interface CacheConstants {
**/
String
EVERYDAY_SALARY_FORM_CODE
=
"everyday_salary_form_code"
;
String
EVERYDAY_UNBUY_FORM_CODE
=
"everyday_unbuy_form_code"
;
String
EVERYDAY_UNBUYINFO_FORM_CODE
=
"everyday_unbuyinfo_form_code"
;
/**
* @Description: 派单申请编码
* @Author: fxj
...
...
@@ -178,6 +182,8 @@ public interface CacheConstants {
String
EMP_ADD_LOCK
=
"emp_add_lock"
;
String
UNBUY_ADD_LOCK
=
"unbuy_add_lock"
;
String
SALARY_ACCOUNT_EXPORT_LOCK
=
"salary_account_export_lock"
;
String
SALARY_ACCOUNT_AUDIT_EXPORT_LOCK
=
"salary_account_audit_export_lock"
;
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/ResultConstants.java
View file @
61251f62
...
...
@@ -22,6 +22,8 @@ public class ResultConstants {
public
static
final
String
NO_GETLOCK_DATA
=
"当前用户操作处理中,请稍后重试!"
;
public
static
final
String
NO_GETLOCK_DATA_SEARCH
=
"多用户同时请求中,请稍后重试!"
;
public
static
final
String
NO_UNBUY_GETLOCK_DATA
=
"当前项目编码和不购买类型的数据处理中,请稍后重试!"
;
public
static
final
String
NO_ID
=
"操作失败,id不能为空!"
;
public
static
final
String
FILE_UPLOADING_DATA
=
"附件排队上传中,请稍后重试!"
;
public
static
final
String
FILE_DOWN_LOAD_DATA
=
"导出排队下载中,请稍后重试!"
;
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TInsuranceUnpurchaseApplyServiceImpl.java
View file @
61251f62
...
...
@@ -9,9 +9,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
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.exception.CheckedException
;
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.DateUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil
;
...
...
@@ -37,6 +39,9 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchasePersonCardVo;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.lang.ArrayUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -79,6 +84,9 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
@Resource
@Lazy
private
TInsuranceUnpurchaseApplyAuditProcess
tInsuranceUnpurchaseApplyAuditProcess
;
// 缓存信息
@Resource
private
CacheManager
cacheManager
;
/**
* 含风险项目不购买申请表简单分页查询
...
...
@@ -158,14 +166,23 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
@Override
public
R
addApply
(
TInsuranceUnpurchaseApply
tInsuranceUnpurchaseApply
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
// 获取redis分布式事务锁
String
key
=
CacheConstants
.
UNBUY_ADD_LOCK
+
CommonConstants
.
DOWN_LINE_STRING
+
tInsuranceUnpurchaseApply
.
getDeptNo
()
+
CommonConstants
.
DOWN_LINE_STRING
+
tInsuranceUnpurchaseApply
.
getReasonType
();
String
requestId
;
try
{
requestId
=
RedisDistributedLock
.
getLock
(
key
,
"10"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
ResultConstants
.
NO_UNBUY_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
try
{
requestId
=
RedisDistributedLock
.
getLock
(
key
,
"10"
);
if
(
Common
.
isNotNull
(
requestId
))
{
//字段长度校验
if
(
Common
.
isNotNull
(
tInsuranceUnpurchaseApply
.
getReasonInfo
())
&&
tInsuranceUnpurchaseApply
.
getReasonInfo
().
length
()
>
200
)
{
return
R
.
failed
(
"原因说明不能超过两百个字符"
);
}
try
{
//获取明细当日最大申请编号
String
applyDetail
;
applyDetail
=
baseMapper
.
getMaxInusuranceDetailCode
();
//暂存不做校验
if
(
CommonConstants
.
ONE_STRING
.
equals
(
tInsuranceUnpurchaseApply
.
getSaveFlag
()))
{
if
(
Common
.
isEmpty
(
tInsuranceUnpurchaseApply
.
getId
()))
{
...
...
@@ -192,7 +209,6 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
person
.
setEmpIdcardNo
(
vo
.
getEmpIdcardNo
());
person
.
setEmpName
(
vo
.
getEmpName
());
person
.
setPost
(
vo
.
getPost
());
person
.
setApplyNoDetail
(
getDetailCode
(
applyDetail
,
vo
.
getRowIndex
()));
initValue
(
tInsuranceUnpurchaseApply
,
person
);
personList
.
add
(
person
);
}
...
...
@@ -217,7 +233,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
setValue
(
tInsuranceUnpurchaseApply
,
user
);
tInsuranceUnpurchaseApply
.
setCreateTimeZc
(
LocalDateTime
.
now
());
baseMapper
.
updateById
(
tInsuranceUnpurchaseApply
);
createProcessLog
(
tInsuranceUnpurchaseApply
,
user
);
createProcessLog
(
tInsuranceUnpurchaseApply
,
user
);
//更新附件
updateFileId
(
tInsuranceUnpurchaseApply
);
//先删除明细表数据再重新生成
...
...
@@ -229,7 +245,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
person
.
setEmpIdcardNo
(
vo
.
getEmpIdcardNo
());
person
.
setEmpName
(
vo
.
getEmpName
());
person
.
setPost
(
vo
.
getPost
());
person
.
setApplyNoDetail
(
getDetailCode
(
applyDetail
,
vo
.
getRowIndex
()
));
person
.
setApplyNoDetail
(
getCodeDetail
(
));
person
.
setCreateTime
(
tInsuranceUnpurchaseApply
.
getCreateTimeZc
());
initValue
(
tInsuranceUnpurchaseApply
,
person
);
personInfoList
.
add
(
person
);
...
...
@@ -245,7 +261,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
tInsuranceUnpurchaseApply
.
setCreateUserDeptId
(
user
.
getDeptId
().
toString
());
tInsuranceUnpurchaseApply
.
setApplyNo
(
applyNo
);
baseMapper
.
insert
(
tInsuranceUnpurchaseApply
);
createProcessLog
(
tInsuranceUnpurchaseApply
,
user
);
createProcessLog
(
tInsuranceUnpurchaseApply
,
user
);
//更新附件
updateFileId
(
tInsuranceUnpurchaseApply
);
List
<
TInsuranceUnpurchasePerson
>
personInfoList
=
new
ArrayList
<>();
...
...
@@ -254,7 +270,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
person
.
setEmpIdcardNo
(
vo
.
getEmpIdcardNo
());
person
.
setEmpName
(
vo
.
getEmpName
());
person
.
setPost
(
vo
.
getPost
());
person
.
setApplyNoDetail
(
getDetailCode
(
applyDetail
,
vo
.
getRowIndex
()
));
person
.
setApplyNoDetail
(
getCodeDetail
(
));
person
.
setCreateTime
(
tInsuranceUnpurchaseApply
.
getCreateTimeZc
());
initValue
(
tInsuranceUnpurchaseApply
,
person
);
personInfoList
.
add
(
person
);
...
...
@@ -265,11 +281,14 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
return
R
.
failed
(
personList
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
R
.
failed
(
"系统异常,保存、更新失败!"
);
}
return
R
.
ok
(
tInsuranceUnpurchaseApply
);
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_UNBUY_GETLOCK_DATA
);
}
}
finally
{
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
}
}
@Override
...
...
@@ -433,27 +452,56 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
}
//获取申请编码
public
String
getCode
()
{
public
synchronized
String
getCode
()
{
String
nowDay
=
DateUtil
.
getThisDay
();
int
nowNums
=
1
;
int
nowNums
;
String
empCode
=
null
;
Cache
cache
=
cacheManager
.
getCache
(
CacheConstants
.
EVERYDAY_UNBUY_FORM_CODE
);
if
(
cache
!=
null
)
{
try
{
Object
nowNumObj
=
cache
.
get
(
nowDay
);
if
(
Common
.
isNotNull
(
nowNumObj
))
{
SimpleValueWrapper
value
=
(
SimpleValueWrapper
)
nowNumObj
;
nowNums
=
(
Integer
)
value
.
get
()
+
1
;
}
else
{
empCode
=
baseMapper
.
getMaxInusuranceCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
}
}
catch
(
NumberFormatException
e
)
{
log
.
error
(
"获取含风险项目不购买商险申请时出错:"
+
empCode
);
nowNums
=
1
;
}
cache
.
put
(
nowDay
,
nowNums
);
}
else
{
empCode
=
baseMapper
.
getMaxInusuranceCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
}
return
"SXBGM"
+
nowDay
+
this
.
getThreeNum
(
String
.
valueOf
(
nowNums
));
}
//获取申请编码
public
String
getDetailCode
(
String
empCode
,
String
row
)
{
public
synchronized
String
getCodeDetail
()
{
String
nowDay
=
DateUtil
.
getThisDay
();
int
nowNums
=
1
;
int
nowNums
;
String
empCode
=
null
;
Cache
cache
=
cacheManager
.
getCache
(
CacheConstants
.
EVERYDAY_UNBUYINFO_FORM_CODE
);
if
(
cache
!=
null
)
{
try
{
nowNums
=
Integer
.
parseInt
(
empCode
)
+
Integer
.
parseInt
(
row
);
Object
nowNumObj
=
cache
.
get
(
nowDay
);
if
(
Common
.
isNotNull
(
nowNumObj
))
{
SimpleValueWrapper
value
=
(
SimpleValueWrapper
)
nowNumObj
;
nowNums
=
(
Integer
)
value
.
get
()
+
1
;
}
else
{
empCode
=
baseMapper
.
getMaxInusuranceDetailCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
}
}
catch
(
NumberFormatException
e
)
{
log
.
error
(
"获取含风险项目不购买商险申请明细时出错:"
+
empCode
);
nowNums
=
1
;
}
cache
.
put
(
nowDay
,
nowNums
);
}
else
{
empCode
=
baseMapper
.
getMaxInusuranceDetailCode
();
nowNums
=
Integer
.
parseInt
(
empCode
)
+
1
;
}
return
"SXBGMMX"
+
nowDay
+
this
.
getFiveNum
(
String
.
valueOf
(
nowNums
));
}
...
...
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