Commit a1947598 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.5.2' into MVP1.5.2

parents 16e091b0 a57b9a73
...@@ -7,7 +7,7 @@ spec: # 资源规范字段 ...@@ -7,7 +7,7 @@ spec: # 资源规范字段
selector: # 选择器 selector: # 选择器
matchLabels: # 匹配标签 matchLabels: # 匹配标签
app: yifu-social app: yifu-social
replicas: 1 # 声明副本数目 replicas: 2 # 声明副本数目
#revisionHistoryLimit: 3 # 保留历史版本 #revisionHistoryLimit: 3 # 保留历史版本
#strategy: # 策略 #strategy: # 策略
# rollingUpdate: # 滚动更新 # rollingUpdate: # 滚动更新
......
...@@ -264,13 +264,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -264,13 +264,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//对比对象 //对比对象
TEmployeeProject compareProject = this.getById(id); TEmployeeProject compareProject = this.getById(id);
if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || if (tEmployeeProject.getContractStatus() == CommonConstants.dingleDigitIntArray[1] ||
tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] ||
tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] ||
tEmployeeProject.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) { tEmployeeProject.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) {
return R.failed("人员在该项目下存在进行中/未完结的服务,禁止删除"); return R.failed("人员在该项目下存在进行中/未完结的服务,禁止删除");
} }
// 未作废,在用 或 审核中
long contractCount = contractInfoMapper.selectCount(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard,tEmployeeProject.getEmpIdcard())
.eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo())
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_INT)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_INT))
);
if (contractCount > CommonConstants.ZERO_INT){
return R.failed("人员在该项目下存在合同可用或在途,禁止删除");
}
//逻辑删除项目档案 //逻辑删除项目档案
tEmployeeProject.setDeleteFlag(CommonConstants.ONE_STRING); tEmployeeProject.setDeleteFlag(CommonConstants.ONE_STRING);
baseMapper.updateById(tEmployeeProject); baseMapper.updateById(tEmployeeProject);
...@@ -416,9 +431,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -416,9 +431,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo()) .eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo())
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING) .and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.or() .or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_INT)
.or() .or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING)) .eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_INT))
); );
if (contractCount > CommonConstants.ZERO_INT){ if (contractCount > CommonConstants.ZERO_INT){
errorTemp.append("合同可用或在途、"); errorTemp.append("合同可用或在途、");
...@@ -612,9 +627,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -612,9 +627,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo()) .eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo())
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING) .and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.or() .or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_INT)
.or() .or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING)) .eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_INT))
); );
if (contractCount > CommonConstants.ZERO_INT){ if (contractCount > CommonConstants.ZERO_INT){
errorTemp.append("合同可用或在途、"); errorTemp.append("合同可用或在途、");
......
...@@ -42,6 +42,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils; ...@@ -42,6 +42,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -95,6 +96,8 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T ...@@ -95,6 +96,8 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
for(String userId : userIdList){ for(String userId : userIdList){
redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_VOS_BY_USERID +"_"+userId); redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_VOS_BY_USERID +"_"+userId);
redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_NOS_BY_USERID +"_"+userId); redisUtil.remove(CacheConstants.WXHR_SETTLE_DOMAIN_NOS_BY_USERID +"_"+userId);
redisUtil.remove(CacheConstants.DATA_AUTH_DETAILS +"_0");
redisUtil.remove(CacheConstants.DATA_AUTH_DETAILS +"_1");
// 清空userinfo // 清空userinfo
Objects.requireNonNull(cacheManager.getCache(CacheConstants.USER_DETAILS)).clear(); Objects.requireNonNull(cacheManager.getCache(CacheConstants.USER_DETAILS)).clear();
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ user.getUsername()); redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ user.getUsername());
......
...@@ -136,4 +136,19 @@ public interface CacheConstants { ...@@ -136,4 +136,19 @@ public interface CacheConstants {
*/ */
public static final String WXHR_SETTLE_DOMAIN_NOS_BY_USERID = ServiceNameConstants.ARCHIVES_SERVICE + "_SettleDomainNosByUserId"; public static final String WXHR_SETTLE_DOMAIN_NOS_BY_USERID = ServiceNameConstants.ARCHIVES_SERVICE + "_SettleDomainNosByUserId";
String PUSH_PAYMENT_SOCIAL_FUND_CACHE = "push_payment_social_fund_cache";
String PAYMENT_SOCIAL_THREE_IMPORT = "payment_social_three_import";
String PAYMENT_SOCIAL_IMPORT = "payment_social_import";
String PAYMENT_FUND_IMPORT = "payment_fund_import";
String PAYMENT_SOCIAL_PUSH = "payment_social_push";
String PAYMENT_DISPATCH_BATCH_ADD_IMPORT = "payment_dispatch_batch_add_import";
String PAYMENT_DISPATCH_BATCH_REDUCE_IMPORT = "payment_dispatch_batch_reduce_import";
String PAYMENT_PRE_DISPATCH_BATCH_ADD_IMPORT = "payment_pre_dispatch_batch_add_import";
} }
...@@ -474,8 +474,6 @@ public interface CommonConstants { ...@@ -474,8 +474,6 @@ public interface CommonConstants {
public static final String PAYMENT_SOCIAL_WAIT_EXPORT = "payment_social_wait_export"; public static final String PAYMENT_SOCIAL_WAIT_EXPORT = "payment_social_wait_export";
public static final String PAYMENT_SOCIAL_PUSH = "payment_social_push";
//百分之一 1/100 //百分之一 1/100
public static final BigDecimal ONE_OF_PERCENT = new BigDecimal("0.01"); public static final BigDecimal ONE_OF_PERCENT = new BigDecimal("0.01");
......
local key = KEYS[1];
local threadId = ARGV[1];
local releaseTime = ARGV[2];
if(redis.call('exists', key) == 0) then
redis.call('hset', key, threadId, '1');
redis.call('expire', key, releaseTime);
return 1;
end;
if(redis.call('hexists', key, threadId) == 1) then
redis.call('hincrby', key, threadId, '1');
redis.call('expire', key, releaseTime);
return 1;
end;
return 0;
local key = KEYS[1]; -- 第1个参数,锁的key
local threadId = ARGV[1]; -- 第2个参数,线程唯一标识
local releaseTime = ARGV[2]; -- 第3个参数,锁的自动释放时间
if(redis.call('exists', key) == 0) then -- 判断锁是否已存在
redis.call('hset', key, threadId, '1'); -- 不存在, 则获取锁
redis.call('expire', key, releaseTime); -- 设置有效期
return 1; -- 返回结果
end;
if(redis.call('hexists', key, threadId) == 1) then -- 锁已经存在,判断threadId是否是自己
redis.call('hincrby', key, threadId, '1'); -- 如果是自己,则重入次数+1
redis.call('expire', key, releaseTime); -- 设置有效期
return 1; -- 返回结果
end;
return 0; -- 代码走到这里,说明获取锁的不是自己,获取锁失败
local key = KEYS[1]; -- 第1个参数,锁的key
local threadId = ARGV[1]; -- 第2个参数,线程唯一标识
if (redis.call('HEXISTS', key, threadId) == 0) then -- 判断当前锁是否还是被自己持有
return nil; -- 如果已经不是自己,则直接返回
end;
local count = redis.call('HINCRBY', key, threadId, -1); -- 是自己的锁,则重入次数-1
if (count == 0) then -- 判断是否重入次数是否已经为0
redis.call('DEL', key); -- 等于0说明可以释放锁,直接删除
return nil;
end;
local key = KEYS[1];
local threadId = ARGV[1];
if (redis.call('HEXISTS', key, threadId) == 0) then
return nil;
end;
local count = redis.call('HINCRBY', key, threadId, -1);
if (count == 0) then
redis.call('DEL', key);
return nil;
end;
...@@ -1950,6 +1950,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1950,6 +1950,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
detailList.add(detail); detailList.add(detail);
this.updateById(detail);
try { try {
//获取项目信息 //获取项目信息
if (null != mapSelectVo) { if (null != mapSelectVo) {
...@@ -2042,9 +2043,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2042,9 +2043,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
log.info("登记保单保费一条耗时:" + (d2 - d1)); log.info("登记保单保费一条耗时:" + (d2 - d1));
} }
//批量更新和插入数据 //批量更新和插入数据
if (!detailList.isEmpty()) {
this.updateBatchById(detailList);
}
if (!settleList.isEmpty()) { if (!settleList.isEmpty()) {
tInsuranceSettleService.updateBatchById(settleList); tInsuranceSettleService.updateBatchById(settleList);
settleList.clear(); settleList.clear();
......
...@@ -21,8 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -21,8 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SocialAndFundReduceVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.SocialAndFundReduceVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
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.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; 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.core.util.R;
...@@ -312,7 +315,24 @@ public class TDispatchInfoController { ...@@ -312,7 +315,24 @@ public class TDispatchInfoController {
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-import')") //@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId){ public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId){
return tDispatchInfoService.importDiy(file.getInputStream(),orderId); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_DISPATCH_BATCH_ADD_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 {
return tDispatchInfoService.importDiy(file.getInputStream(),orderId);
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -377,7 +397,24 @@ public class TDispatchInfoController { ...@@ -377,7 +397,24 @@ public class TDispatchInfoController {
@PostMapping("/importListReduce") @PostMapping("/importListReduce")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-reduce')") //@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-reduce')")
public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId){ public R<List<ErrorMessage>> importListReduce(@RequestBody MultipartFile file, @RequestParam(required = false)String orderId){
return tDispatchInfoService.importReduceDiy(file.getInputStream(),orderId); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_DISPATCH_BATCH_REDUCE_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 {
return tDispatchInfoService.importReduceDiy(file.getInputStream(),orderId);
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
......
...@@ -18,11 +18,18 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;/* ...@@ -18,11 +18,18 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;/*
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.ErrorDetailVO; import com.yifu.cloud.plus.v1.yifu.common.core.vo.ErrorDetailVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; 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.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialSearchVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.HaveSalaryNoSocialSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
...@@ -148,7 +155,24 @@ public class TPaymentInfoController { ...@@ -148,7 +155,24 @@ public class TPaymentInfoController {
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')") @PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
public R<List<ErrorDetailVO>> importListAdd(@RequestBody MultipartFile file, @RequestParam String random) { public R<List<ErrorDetailVO>> importListAdd(@RequestBody MultipartFile file, @RequestParam String random) {
return tPaymentInfoService.importSocialDiy(file.getInputStream()); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_SOCIAL_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 {
return tPaymentInfoService.importSocialDiy(file.getInputStream());
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -163,7 +187,24 @@ public class TPaymentInfoController { ...@@ -163,7 +187,24 @@ public class TPaymentInfoController {
@PostMapping("/importListSocialHeFei") @PostMapping("/importListSocialHeFei")
public R<List<ErrorDetailVO>> importListSocialHeFei(@RequestBody MultipartFile file, @RequestParam String random, public R<List<ErrorDetailVO>> importListSocialHeFei(@RequestBody MultipartFile file, @RequestParam String random,
@RequestParam(value = "type") String type) { @RequestParam(value = "type") String type) {
return tPaymentInfoService.importSocialHeFeiDiy(file.getInputStream(), random, type); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_SOCIAL_THREE_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 {
return tPaymentInfoService.importSocialHeFeiDiy(file.getInputStream(), random, type);
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -178,7 +219,24 @@ public class TPaymentInfoController { ...@@ -178,7 +219,24 @@ public class TPaymentInfoController {
@PostMapping("/batchImportPaymentFundInfo") @PostMapping("/batchImportPaymentFundInfo")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')") @PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
public R<List<ErrorDetailVO>> importListFund(@RequestBody MultipartFile file) { public R<List<ErrorDetailVO>> importListFund(@RequestBody MultipartFile file) {
return tPaymentInfoService.batchImportPaymentFundInfo(file.getInputStream()); YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_FUND_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
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 {
return tPaymentInfoService.batchImportPaymentFundInfo(file.getInputStream());
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
} }
/** /**
...@@ -418,8 +476,7 @@ public class TPaymentInfoController { ...@@ -418,8 +476,7 @@ public class TPaymentInfoController {
@SysLog("手动推送社保缴费库明细的数据") @SysLog("手动推送社保缴费库明细的数据")
@PostMapping("/pushPaymentSocialFundInfo") @PostMapping("/pushPaymentSocialFundInfo")
public R<Boolean> pushPaymentSocialFundInfo(@RequestBody TPaymentInfoSearchVo searchVo) { public R<Boolean> pushPaymentSocialFundInfo(@RequestBody TPaymentInfoSearchVo searchVo) {
tPaymentInfoService.pushPaymentSocialFundInfo(searchVo); return tPaymentInfoService.pushPaymentSocialFundInfo(searchVo);
return R.ok();
} }
/** /**
......
...@@ -23,6 +23,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -23,6 +23,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.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.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
...@@ -240,6 +242,14 @@ public class TPreDispatchInfoController { ...@@ -240,6 +242,14 @@ public class TPreDispatchInfoController {
if (null == user || null == user.getId()) { if (null == user || null == user.getId()) {
return R.failed(CommonConstants.USER_FAIL); return R.failed(CommonConstants.USER_FAIL);
} }
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_PRE_DISPATCH_BATCH_ADD_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
String requestId;
try {
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
ExcelUtil<TPreDispatchInfo> util1 = null; ExcelUtil<TPreDispatchInfo> util1 = null;
try { try {
jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", ""); jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", "");
...@@ -265,6 +275,9 @@ public class TPreDispatchInfoController { ...@@ -265,6 +275,9 @@ public class TPreDispatchInfoController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR); return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
} }
} }
......
...@@ -149,7 +149,7 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> { ...@@ -149,7 +149,7 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
TPaymentVo getPaymentSocialAndFound(TPaymentInfo info); TPaymentVo getPaymentSocialAndFound(TPaymentInfo info);
void pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo); R<Boolean> pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo);
/** /**
* 批量标识可以推送的数据 * 批量标识可以推送的数据
......
...@@ -24,6 +24,7 @@ import com.alibaba.excel.read.listener.ReadListener; ...@@ -24,6 +24,7 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder; import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils; import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.lock.annotation.Lock4j;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
...@@ -1132,6 +1133,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -1132,6 +1133,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Date: 2022-08-01 15:01 * @Date: 2022-08-01 15:01
* @return: java.lang.String * @return: java.lang.String
**/ **/
@Lock4j(keys = "getDispatchApplyCode", expire = 60000, acquireTimeout = 1000)
private synchronized String getApplyCode() { private synchronized String getApplyCode() {
String nowDay = DateUtil.getThisDay(); String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_DISPATCH_CODE); Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_DISPATCH_CODE);
...@@ -2844,6 +2846,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -2844,6 +2846,16 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setContractName(empVo.getContractName()); dispatch.setContractName(empVo.getContractName());
dispatch.setContractSubName(empVo.getContractSubName()); dispatch.setContractSubName(empVo.getContractSubName());
} }
// 社保公积金派减派单兼容 划转逻辑
if ( Common.isNotNull(dispatch.getSocialId())){
dispatch.setSettleDomain(socialFund.getSettleDomain());
dispatch.setSettleDomainCode(socialFund.getSettleDomainCode());
dispatch.setSettleDomainName(socialFund.getSettleDomainName());
}else if (Common.isNotNull(dispatch.getFundId()) && Common.isEmpty(dispatch.getSocialId())){
dispatch.setSettleDomain(socialFund.getSettleDomainFund());
dispatch.setSettleDomainCode(socialFund.getSettleDomainCodeFund());
dispatch.setSettleDomainName(socialFund.getSettleDomainNameFund());
}
return dispatch; return dispatch;
} }
...@@ -3800,7 +3812,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3800,7 +3812,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
UpProjectSocialFundVo vo = new UpProjectSocialFundVo(); UpProjectSocialFundVo vo = new UpProjectSocialFundVo();
// 社保状态 社保状态(字典): 0 无社保 1 处理中 2.部分购买 3.正常 4.已派减 // 社保状态 社保状态(字典): 0 无社保 1 处理中 2.部分购买 3.正常 4.已派减
initSocialFundStatus(socialInfo, providentFund, vo,sf); initSocialFundStatus(socialInfo, providentFund, vo,sf);
if (Common.isNotNull(vo.getSocialStatus())){ if (Common.isNotNull(vo.getSocialStatus()) || Common.isNotNull(vo.getFundStatus())){
vo.setEmpIdCard(dis.getEmpIdcard()); vo.setEmpIdCard(dis.getEmpIdcard());
vo.setDepartNo(dis.getSettleDomainCode()); vo.setDepartNo(dis.getSettleDomainCode());
R<Boolean> resUp = archivesDaprUtil.updateProjectSocialFund(vo); R<Boolean> resUp = archivesDaprUtil.updateProjectSocialFund(vo);
......
...@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo; ...@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain; import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo; 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.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
...@@ -269,7 +270,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -269,7 +270,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override @Override
public R<Boolean> removeInFoById(String id) { public R<Boolean> removeInFoById(String id) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CacheConstants.PAYMENT_SOCIAL_PUSH;
if (Common.isNotNull(redisUtil.get(key))) { if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!"); return R.failed("用户正在推送实缴数据中禁止删除!");
} }
...@@ -297,7 +298,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -297,7 +298,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return R.failed(CommonConstants.NO_DATA_TO_HANDLE); return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
} }
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CacheConstants.PAYMENT_SOCIAL_PUSH;
if (Common.isNotNull(redisUtil.get(key))) { if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!"); return R.failed("用户正在推送实缴数据中禁止删除!");
} }
...@@ -339,7 +340,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -339,7 +340,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String socialCreateMonth, String socialPayMonth) { String socialCreateMonth, String socialPayMonth) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CacheConstants.PAYMENT_SOCIAL_PUSH;
if (Common.isNotNull(redisUtil.get(key))) { if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!"); return R.failed("用户正在推送实缴数据中禁止删除!");
} }
...@@ -2811,10 +2812,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2811,10 +2812,14 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
@Override @Override
public void pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo) { public R<Boolean> pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH; String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CacheConstants.PAYMENT_SOCIAL_PUSH;
redisUtil.set(key, user.getId(), 36000L); if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中,禁止重复推送!");
} else {
redisUtil.set(key, user.getId(), 1200L);
}
Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap(); Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap();
//手动推送未推送的社保公积金明细数据 //手动推送未推送的社保公积金明细数据
...@@ -2833,6 +2838,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2833,6 +2838,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
redisUtil.remove(redisKey); redisUtil.remove(redisKey);
} }
redisUtil.remove(key); redisUtil.remove(key);
return R.ok();
} }
@Override @Override
......
...@@ -326,6 +326,7 @@ ...@@ -326,6 +326,7 @@
a.UPDATE_TIME, a.UPDATE_TIME,
a.UPDATE_BY, a.UPDATE_BY,
a.CREATE_NAME, a.CREATE_NAME,
a.BPO_FLAG,
a.CREATE_TIME a.CREATE_TIME
</sql> </sql>
<sql id="tPaymentInfo_where"> <sql id="tPaymentInfo_where">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment