Commit f87b4e7f authored by huyuchen's avatar huyuchen

Merge branch 'develop'

# Conflicts:
#	yifu-insurances/yifu-insurances-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/insurances/service/insurance/impl/TInsuranceDetailServiceImpl.java
#	yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
parents a2d290fc 7a3b7d91
......@@ -7,7 +7,7 @@ spec: # 资源规范字段
selector: # 选择器
matchLabels: # 匹配标签
app: yifu-social
replicas: 1 # 声明副本数目
replicas: 2 # 声明副本数目
#revisionHistoryLimit: 3 # 保留历史版本
#strategy: # 策略
# rollingUpdate: # 滚动更新
......
......@@ -397,4 +397,7 @@ public class TEmployeeProject extends BaseEntity {
@TableField(exist = false)
private String odlDeptId;
@TableField(exist = false)
private String oldDeptNo;
}
......@@ -36,4 +36,15 @@ public class ContractAlertSearchVo extends TEmpContractAlert {
* 查询数据止
**/
private int limitEnd;
/**
* @Author fxj
* 合同截止时间区间查询--开始
**/
private LocalDateTime contractEndStart;
/**
* @Author fxj
* 合同截止时间区间查询--截止
**/
private LocalDateTime contractEndEnd;
}
......@@ -30,7 +30,6 @@ 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.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
......@@ -386,4 +385,18 @@ public class TEmployeeContractInfoController {
tEmployeeContractInfoService.exportAuditContractInfo(contractInfo, response);
}
/**
* @param empIdCard 身份证
* @param deptId 项目id
* @Description: 通过身份证与项目id查询
* @Author: hgw
* @Date: 2023/3/9 14:30
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过身份证与项目id查询", description = "通过身份证与项目id查询")
@PostMapping("/getContractByEmpIdCardAndDeptId")
public R<String> getContractByEmpIdCardAndDeptId(@RequestParam String empIdCard, @RequestParam String deptId) {
return tEmployeeContractInfoService.getContractByEmpIdCardAndDeptId(empIdCard, deptId);
}
}
......@@ -21,10 +21,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpContractBusinessPageVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportAuditVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeContractSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -105,4 +105,8 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
, @Param("settleDomainIds") List<String> settleDomainIds, @Param("alertMonth")Integer alertMonth);
List<EmpContractBusinessPageVo> getOtherContractBusinessInfo(@Param("empId")String empId, @Param("contractId")String contractId);
void updateContractChange(@Param("idCard")String empIdcard, @Param("deptNo")String deptNo, @Param("oldDeptNo")String odlDeptNo);
int getContractByEmpIdCardAndDeptId(@Param("empIdCard") String empIdCard, @Param("deptId") String deptId);
}
......@@ -184,4 +184,6 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
List<EmpContractBusinessPageVo> getOtherContractBusinessInfo(String empId, String contractId);
R<String> getContractByEmpIdCardAndDeptId(String mpIdCard, String deptId);
}
......@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpChangeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TSettleDomainMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCustomerInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService;
......@@ -64,6 +65,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
private final TEmployeeLogServiceImpl tEmployeeLogService;
private final TEmployeeContractInfoMapper contractInfoMapper;
@Autowired
private final SocialDaprUtils socialDaprUtils;
......@@ -117,6 +120,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", updateTEmployeeProject.getId(), tEmployeeProjectOld, updateTEmployeeProject);
updateTEmployeeProject.setOdlDeptId(tEmployeeProjectOld.getDeptId());
updateTEmployeeProject.setOldDeptNo(tEmployeeProjectOld.getDeptNo());
tEmployeeProjectService.updateById(updateTEmployeeProject);
tEmpChangeInfo.setProId(updateTEmployeeProject.getId());
......@@ -141,6 +145,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
updateSocialFoundVo.setFlag(CommonConstants.ONE_STRING);
socialDaprUtils.updateSocialAndFoundInfo(updateSocialFoundVo);
}
// 合同同步划转---只划转在用合同 fxj 2023-03-06
contractInfoMapper.updateContractChange(updateTEmployeeProject.getEmpIdcard(),updateTEmployeeProject.getDeptNo(),updateTEmployeeProject.getOldDeptNo());
}
//保存档案划转记录
......@@ -235,6 +241,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", updateTEmployeePro.getId(), tEmployeeProjectOld, updateTEmployeePro);
updateTEmployeePro.setOdlDeptId(tEmployeeProjectOld.getDeptId());
updateTEmployeePro.setOldDeptNo(tEmployeeProjectOld.getDeptNo());
updateList.add(updateTEmployeePro);
}
} else {
......@@ -272,6 +279,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
updateSocialFoundVo.setFlag(CommonConstants.ONE_STRING);
socialDaprUtils.updateSocialAndFoundInfo(updateSocialFoundVo);
}
// 合同同步划转---只划转在用合同 fxj 2023-03-06
contractInfoMapper.updateContractChange(tEmployeeProject.getEmpIdcard(),tEmployeeProject.getDeptNo(),tEmployeeProject.getOldDeptNo());
}
}
return R.ok();
......
......@@ -65,6 +65,12 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
@Override
public IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo) {
LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo);
if (Common.isNotNull(searchVo.getContractEndStart())){
wrapper.ge(TEmpContractAlert::getContractEnd,searchVo.getContractEndStart());
}
if (Common.isNotNull(searchVo.getContractEndEnd())){
wrapper.le(TEmpContractAlert::getContractEnd,searchVo.getContractEndEnd());
}
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql() + " order by CREATE_TIME desc");
} else {
......@@ -80,7 +86,12 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
if (Common.isNotNull(idList)){
wrapper.in(TEmpContractAlert::getId,idList);
}
wrapper.ne(TEmpContractAlert::getId,CommonConstants.ZERO_STRING);
if (Common.isNotNull(searchVo.getContractEndStart())){
wrapper.ge(TEmpContractAlert::getContractEnd,searchVo.getContractEndStart());
}
if (Common.isNotNull(searchVo.getContractEndEnd())){
wrapper.le(TEmpContractAlert::getContractEnd,searchVo.getContractEndEnd());
}
if (Common.isNotNull(searchVo.getAuthSql())) {
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains("a.")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("a.", " "));
......@@ -96,6 +107,12 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
if (Common.isNotNull(idList)){
wrapper.in(TEmpContractAlert::getId,idList);
}
if (Common.isNotNull(searchVo.getContractEndStart())){
wrapper.ge(TEmpContractAlert::getContractEnd,searchVo.getContractEndStart());
}
if (Common.isNotNull(searchVo.getContractEndEnd())){
wrapper.le(TEmpContractAlert::getContractEnd,searchVo.getContractEndEnd());
}
if (Common.isNotNull(searchVo.getAuthSql())) {
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains("a.")) {
searchVo.setAuthSql(searchVo.getAuthSql().replace("a.", " "));
......@@ -171,7 +188,6 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
private LambdaQueryWrapper buildQueryWrapper(ContractAlertSearchVo entity){
LambdaQueryWrapper<TEmpContractAlert> wrapper = Wrappers.lambdaQuery();
wrapper.ne(TEmpContractAlert::getId,CommonConstants.ZERO_STRING);
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TEmpContractAlert::getCreateTime, entity.getCreateTimes()[0])
.le(TEmpContractAlert::getCreateTime,
......@@ -307,6 +323,11 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
)){
return;
}
if (Common.isEmpty(project)){
return;
}
}else {
return;
}
TEmpContractAlert alert = alertMap.get(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo());
// 存在多个审核通过的数据 用最新的审核通过的合同覆盖已有的
......
......@@ -25,6 +25,7 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.lock.annotation.Lock4j;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -321,7 +322,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
* @return: java.lang.String
**/
@Override
public synchronized String getCode(boolean isNew) {
@Lock4j(expire = 60000, acquireTimeout = 1000)
public String getCode(boolean isNew) {
String nowDay = DateUtil.getThisDay();
int nowNums;
String empCode = null;
......@@ -1517,5 +1519,15 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
public List<EmpContractBusinessPageVo> getOtherContractBusinessInfo(String empId, String contractId) {
return baseMapper.getOtherContractBusinessInfo(empId,contractId);
}
@Override
public R<String> getContractByEmpIdCardAndDeptId(String mpIdCard, String deptId) {
int count = baseMapper.getContractByEmpIdCardAndDeptId(mpIdCard, deptId);
if (count >0) {
return R.ok();
} else {
return R.failed("未找到合同");
}
}
}
......@@ -25,6 +25,7 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.lock.annotation.Lock4j;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -1438,7 +1439,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getCode() {
@Lock4j(expire = 60000, acquireTimeout = 1000)
private String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CODE);
Object nowNumObj = cache.get(nowDay);
......
......@@ -264,13 +264,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//对比对象
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.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) {
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);
baseMapper.updateById(tEmployeeProject);
......@@ -416,9 +431,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo())
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_INT)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING))
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_INT))
);
if (contractCount > CommonConstants.ZERO_INT){
errorTemp.append("合同可用或在途、");
......@@ -612,9 +627,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeContractInfo::getDeptNo,tEmployeeProject.getDeptNo())
.and(obj->obj.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_INT)
.or()
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING))
.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_INT))
);
if (contractCount > CommonConstants.ZERO_INT){
errorTemp.append("合同可用或在途、");
......
......@@ -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 lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......
......@@ -779,5 +779,28 @@
</if>
ORDER BY a.CREATE_TIME DESC
</select>
<!-- 根据员工ID更新合同在用状态 -->
<update id="updateContractChange">
update t_employee_contract_info a,t_settle_domain b
set a.DEPT_NO=b.DEPART_NO,
a.SETTLE_DOMAIN=b.id,
a.UNIT_NO=b.CUSTOMER_NO,
a.CUSTOMER_ID=b.CUSTOMER_ID,
a.SUBJECT_DEPART=b.DEPART_NAME,
a.SUBJECT_UNIT=b.CUSTOMER_NAME
where a.EMP_IDCARD = #{idCard} and a.DEPT_NO = #{oldDeptNo} and b.DEPART_NO= #{deptNo} and b.DELETE_FLAG='0';
</update>
<select id="getContractByEmpIdCardAndDeptId" resultType="java.lang.Integer">
select
count(1)
from t_employee_contract_info e
where e.EMP_IDCARD = #{empIdCard} and e.SETTLE_DOMAIN = #{deptId}
and e.DELETE_FLAG = '0'
AND (
( e.AUDIT_STATUS = '2' AND e.IN_USE = '0' )
OR
( e.AUDIT_STATUS = '1' AND e.IN_USE = '1' )
)
</select>
</mapper>
......@@ -75,6 +75,11 @@
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-log</artifactId>
</dependency>
<dependency>
<groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-core</artifactId>
<version>3.6.4</version>
</dependency>
</dependencies>
<build>
......
//package com.yifu.cloud.plus.v1.yifu.auth.config;
//
//import org.jasig.cas.client.authentication.AuthenticationFilter;
//import org.jasig.cas.client.session.SingleSignOutFilter;
//import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
//import org.jasig.cas.client.util.HttpServletRequestWrapperFilter;
//import org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.stereotype.Component;
//
//import java.util.*;
//
//@Configuration
//@Component
//public class CASAutoConfig {
//
// /**
// * SingleSignOutHttpSessionListener 添加监听器
// * 用于单点退出,该过滤器用于实现单点登出功能,可选配置
// *
// * @author licancan
// * @param
// * @return {@link ServletListenerRegistrationBean<EventListener>}
// */
// @Bean
// public ServletListenerRegistrationBean<EventListener> singleSignOutListenerRegistration() {
// ServletListenerRegistrationBean<EventListener> registrationBean = new ServletListenerRegistrationBean<EventListener>();
// registrationBean.setListener(new SingleSignOutHttpSessionListener());
// registrationBean.setOrder(1);
// return registrationBean;
// }
//
// /**
// * SingleSignOutFilter 登出过滤器
// * 该过滤器用于实现单点登出功能,可选配置
// *
// * @author licancan
// * @param
// * @return {@link FilterRegistrationBean}
// */
// @Bean
// public FilterRegistrationBean filterSingleRegistration() {
// FilterRegistrationBean registration = new FilterRegistrationBean();
// registration.setFilter(new SingleSignOutFilter());
// // 设定匹配的路径
// registration.addUrlPatterns("/*");
// Map<String, String> initParameters = new HashMap();
// initParameters.put("casServerUrlPrefix", CASproperties.CAS_SERVER_LOGIN_PATH);
// registration.setInitParameters(initParameters);
// // 设定加载的顺序
// registration.setOrder(2);
// return registration;
// }
//
// /**
// * AuthenticationFilter 授权过滤器
// *
// * @author licancan
// * @param
// * @return {@link FilterRegistrationBean}
// */
// @Bean
// public FilterRegistrationBean filterAuthenticationRegistration() {
//
// FilterRegistrationBean registration = new FilterRegistrationBean();
// Map<String, String> initParameters = new HashMap();
//
// registration.setFilter(new AuthenticationFilter());
// //registration.addUrlPatterns("*.html");
// initParameters.put("casServerLoginUrl", CASproperties.CAS_SERVER_PATH);
// initParameters.put("serverName", CASproperties.CLIENT_SERVER_NAME);
//
// // 不拦截的请求
// initParameters.put("ignorePattern", "^.*[.](js|css|gif|png|zip)$");
//
// // 表示过滤所有
//// initParameters.put("ignoreUrlPatternType", "com.yifu.cloud.plus.v1.yifu.auth.filter.SimpleUrlPatternMatcherStrategy");
//
// registration.setInitParameters(initParameters);
// // 设定加载的顺序
// registration.setOrder(3);
// return registration;
// }
//
//
// /**
// * Cas30ProxyReceivingTicketValidationFilter 验证过滤器
// * 该过滤器负责对Ticket的校验工作,必须启用它
// *
// * @author licancan
// * @param
// * @return {@link FilterRegistrationBean}
// */
// @Bean
// public FilterRegistrationBean filterValidationRegistration() {
// FilterRegistrationBean registration = new FilterRegistrationBean();
// registration.setFilter(new Cas30ProxyReceivingTicketValidationFilter());
// // 设定匹配的路径
// //registration.addUrlPatterns("*.html");
// Map<String, String> initParameters = new HashMap();
// initParameters.put("casServerUrlPrefix", CASproperties.CAS_SERVER_PATH);
// initParameters.put("serverName", CASproperties.CLIENT_SERVER_NAME);
//
// // 是否对serviceUrl进行编码,默认true:设置false可以在302对URL跳转时取消显示;jsessionid=xxx的字符串
// // 观察CommonUtils.constructServiceUrl方法可以看到
// //initParameters.put("encodeServiceUrl", "false");
// registration.setInitParameters(initParameters);
// // 设定加载的顺序
// registration.setOrder(4);
// return registration;
// }
//
// /**
// * 该过滤器用于单点登录功能 ,对HttpServletRequest请求包装, 可通过HttpServletRequest的getRemoteUser()方法获得登录用户的登录名
// * @return
// */
// @Bean
// public FilterRegistrationBean casHttpServletRequestWrapperFilter(){
// FilterRegistrationBean authenticationFilter = new FilterRegistrationBean();
// authenticationFilter.setFilter(new HttpServletRequestWrapperFilter());
// authenticationFilter.setOrder(5);
// List<String> urlPatterns = new ArrayList<>();
// urlPatterns.add("/*");
// authenticationFilter.setUrlPatterns(urlPatterns);
// return authenticationFilter;
// }
//
// /**
// * HttpServletRequestWrapperFilter wraper过滤器
// * 该过滤器负责实现HttpServletRequest请求的包裹,
// * 比如允许开发者通过HttpServletRequest的getRemoteUser()方法获得SSO登录用户的登录名,可选配置。
// *
// * @author licancan
// * @param
// * @return {@link FilterRegistrationBean}
// */
// @Bean
// public FilterRegistrationBean filterWrapperRegistration() {
// FilterRegistrationBean registration = new FilterRegistrationBean();
// registration.setFilter(new HttpServletRequestWrapperFilter());
// // 设定匹配的路径
// registration.addUrlPatterns("/*");
// // 设定加载的顺序
// registration.setOrder(6);
// return registration;
// }
//}
package com.yifu.cloud.plus.v1.yifu.auth.config;
public class CASproperties {
/**
* 当前应用程序的baseUrl(注意最后面的斜线)
*/
public static String CLIENT_SERVER_NAME = "https://qas-mvp-1.worfu.com/";
/**
* 当前应用程序的登陆界面
*/
public static String CLIENT_LOGIN_PAGE = "https://qas-mvp-1.worfu.com/login";
/**
* CAS服务器地址
*/
public static String CAS_SERVER_PATH = "http://192.168.1.62:8443/cas";
/**
* CAS登陆服务器地址
*/
public static String CAS_SERVER_LOGIN_PATH = "http://192.168.1.62:8443/cas/login";
/**
* CAS登出服务器地址
*/
public static String CAS_SERVER_LOGOUT_PATH = "http://192.168.1.62:8443/cas/logout";
public static String SPRING_SECURITY_CAS_SERVER = "http://192.168.1.62:8443/cas/v1/tickets";
}
......@@ -20,10 +20,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yifu.cloud.plus.v1.yifu.auth.filter.PasswordDecoderFilter;
import com.yifu.cloud.plus.v1.yifu.auth.handler.YifuAuthenticationFailureHandlerImpl;
import com.yifu.cloud.plus.v1.yifu.auth.handler.YifuClientLoginSuccessHandler;
import com.yifu.cloud.plus.v1.yifu.common.security.component.CasAuthenticationProvider;
import com.yifu.cloud.plus.v1.yifu.common.security.component.YifuDaoAuthenticationProvider;
import com.yifu.cloud.plus.v1.yifu.common.security.grant.CustomAppAuthenticationProvider;
import com.yifu.cloud.plus.v1.yifu.common.security.handler.FormAuthenticationFailureHandler;
import com.yifu.cloud.plus.v1.yifu.common.security.handler.SsoLogoutSuccessHandler;
import com.yifu.cloud.plus.v1.yifu.common.security.service.YifuUserDetailsServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
......@@ -72,6 +74,9 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private TokenStore tokenStore;
@Autowired
private YifuUserDetailsServiceImpl usernameUserDetailService;
@Override
@SneakyThrows
protected void configure(HttpSecurity http) {
......@@ -97,6 +102,7 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
auth.authenticationProvider(daoAuthenticationProvider);
// 自定义的认证模式
auth.authenticationProvider(new CustomAppAuthenticationProvider());
auth.authenticationProvider(casAuthenticationProvider());
}
@Bean
......@@ -142,6 +148,16 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}
@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider provider = new CasAuthenticationProvider();
// 设置userDetailsService
provider.setUserDetailsService(usernameUserDetailService);
// 禁止隐藏用户未找到异常
provider.setHideUserNotFoundExceptions(false);
return provider;
}
/**
* @author fxj
* @date 2022/5/27 17:22
......
......@@ -3,15 +3,23 @@ package com.yifu.cloud.plus.v1.yifu.auth.filter;
import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
import com.yifu.cloud.plus.v1.yifu.auth.config.CASproperties;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.security.token.CasAuthenticationToken;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.http.*;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
......@@ -23,7 +31,7 @@ import javax.servlet.http.HttpServletResponse;
* @date 2022年05月27日 11:14
* @description
*/
@Log4j2
@Slf4j
@Data
@Order(-1)
@RequiredArgsConstructor
......@@ -33,7 +41,6 @@ public class PasswordDecoderFilter extends UsernamePasswordAuthenticationFilter
/**
* 解密登录前端密码 秘钥
*/
//private String encodeKey = "thanks,pig4cloud";
private String encodeKey = "thanks,yifucloud";
private boolean postOnly = true;
......@@ -43,17 +50,41 @@ public class PasswordDecoderFilter extends UsernamePasswordAuthenticationFilter
if (this.postOnly && !request.getMethod().equals("POST")) {
throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
} else {
AbstractAuthenticationToken authRequest;
String result = request.getParameter("cas");
String username = this.obtainUsername(request);
username = username != null ? username : "";
username = username.trim();
String password = this.obtainPassword(request);
password = password != null ? decryptAES(password) : "";
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);
this.setDetails(request, authRequest);
if (Common.isNotNull(result)) {
try {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("service", CASproperties.CLIENT_LOGIN_PAGE);
HttpEntity<MultiValueMap<String,Object>> entity = new org.springframework.http.HttpEntity<>(wholeForm,headers);
ResponseEntity<String> obj = restTemplate.exchange(CASproperties.SPRING_SECURITY_CAS_SERVER + "/" + result, HttpMethod.POST, entity, String.class);
if (obj.getStatusCode().value() == 200) {
String st = obj.getBody();
log.info("Successful service ticket request: " + st);
}
} catch (Exception e) {
log.error(e.getMessage());
throw new AuthenticationServiceException("验证失败!");
}
authRequest = new CasAuthenticationToken(username, null);
} else {
String password = this.obtainPassword(request);
password = password != null ? decryptAES(password) : "";
authRequest = new UsernamePasswordAuthenticationToken(username, password);
setDetails(request, authRequest);
}
return this.getAuthenticationManager().authenticate(authRequest);
}
}
/**
* 原文解密
* @return
......@@ -66,4 +97,9 @@ public class PasswordDecoderFilter extends UsernamePasswordAuthenticationFilter
// 解密
return aes.decryptStr(password);
}
private void setDetails(HttpServletRequest request,
AbstractAuthenticationToken authRequest) {
authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
}
}
//package com.yifu.cloud.plus.v1.yifu.auth.filter;
//
//import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
//
//import java.util.Arrays;
//import java.util.List;
//
//public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
//
// /**
// * 判断是否匹配这个字符串
// *
// * @author licancan
// * @param url 用户请求的连接
// * @return {@link boolean} true:不拦截 false:必须得登录了
// */
// @Override
// public boolean matches(String url) {
// List<String> list = Arrays.asList(
// "/login",
// "/restLogin"
// );
// String name = url.substring(url.lastIndexOf("/"));
//
// // String url = "http://127.0.0.1:8082/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb";
// // 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb 现象
// // 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 /login 即可
//
// if (name.indexOf("?") != -1) {
// name = name.substring(0, name.indexOf("?"));
// }
// boolean result = list.contains(name);
// if (!result) {
// System.out.println("拦截URL:" + url);
// }
// return result;
// }
//
// /**
// * 正则表达式的规则,这个地方可以是web传递过来的
// *
// * @author licancan
// * @param pattern
// * @return void
// */
// @Override
// public void setPattern(String pattern) {
// System.out.println(11111);
// }
//}
package com.yifu.cloud.plus.v1.yifu.auth.util;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import java.util.logging.Logger;
public class LoginUtils {
private static final Logger LOG = Logger.getLogger(LoginUtils.class.getName());
/**
* 登录
*
* @author licancan
* @param server cas服务端获取tgt地址
* @param username 用户名
* @param password 密码
* @param service 需要跳转的应用地址
* @return {@link String}
*/
public static String getTicket(final String server, final String username, final String password, final String service) {
//重定向
return getServiceTicket(server, getTicketGrantingTicket(server, username, password), service);
}
/**
* 获取ST
*
* @author licancan
* @param server cas服务端获取tgt地址
* @param ticketGrantingTicket tgt
* @param service 需要跳转的应用地址
* @return {@link String}
*/
private static String getServiceTicket(final String server, final String ticketGrantingTicket, final String service) {
if (ticketGrantingTicket == null){
return null;
}
try {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("service",service);
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<>(wholeForm,headers);
ResponseEntity<String> obj = restTemplate.exchange(server + "/" + ticketGrantingTicket, HttpMethod.POST, entity, String.class);
if (obj.getStatusCode().value() == 200) {
LOG.info("Successful service ticket request: " + obj.getBody());
return obj.getBody();
} else {
LOG.warning("Invalid response code (" + obj.getStatusCode().value() + ") from CAS server!");
LOG.info("Response (1k): " + obj.getBody());
}
} catch (Exception e) {
LOG.warning(e.getMessage());
}
return null;
}
/**
* 获取 TGT
*
* @author licancan
* @param server cas服务端获取tgt地址
* @param username 用户名
* @param password 密码
* @return {@link String}
*/
private static String getTicketGrantingTicket(final String server, final String username, final String password) {
try {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("username",username);
wholeForm.add("password",password);
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<>(wholeForm,headers);
ResponseEntity<String> obj = restTemplate.exchange(server, HttpMethod.POST, entity, String.class);
if (obj.getStatusCode().value() == 201) {
LOG.info("Successful ticket granting ticket request: " + obj.getBody());
return obj.getBody();
} else {
LOG.warning("Invalid response code (" + obj.getStatusCode().value() + ") from CAS server!");
LOG.info("Response (1k): " + obj.getBody());
}
} catch (Exception e) {
LOG.warning(e.getMessage());
}
return null;
}
//从cas中获取用户名
public static String getAccountNameFromCas(HttpServletRequest request) {
Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
if (assertion != null) {
AttributePrincipal principal = assertion.getPrincipal();
return principal.getName();
} else {
return null;
}
}
public static void main(final String[] args) {
final String server = "http://192.168.1.62:8443/cas/v1/tickets";
final String username = "zhangfei2";
final String password = "123456";
final String service = "http://127.0.0.1:8888/login";
LOG.info(getTicket(server, username, password, service));
}
}
......@@ -31,7 +31,8 @@ public class ChecksUtil {
private static final String API_URL = "https://api.253.com/open/idcard/id-card-auth";
private static final String API_URL_MOBILE = "https://api.253.com/open/unn/batch-ucheck";
private static final String API_URL_BANK_NO ="https://api.253.com/open/bankcard/card-auth";
private static final String API_URL_BANK_NO_TWO ="https://api.253.com/open/bankcard/card-two-auth";
private static final String API_URL_BANK_NO_TWO ="https://api.253.com/open/bankcard/card-two-auth";
private static final String API_URL_BANK_NO_THREE ="https://api.253.com/open/bankcard/card-three-auth";
private static JsonParser jsonParser = new JsonParser();
public static void checkIdCard(TCheckIdCard checkIdCard, boolean canCheck) {
......@@ -96,7 +97,28 @@ public class ChecksUtil {
return R.ok(checkBankNo);
}
}
/**
* @Author fxj
* @Description 银行卡四要素标准版 校验
* @Date 17:50 2022/6/20
* @param name 姓名 是 [string]
* @param cardNo 银行卡号,限单个 是 [string]
**/
public static R<TCheckBankNo> checkBankNoThree(String name, String cardNo, String idNum, boolean canCheck) {
if (canCheck) {
// 1.调用银行卡信息校验api
return checkBankNoThreeMethod(name,cardNo,idNum);
} else {
TCheckBankNo checkBankNo = new TCheckBankNo();
checkBankNo.setBankNo(cardNo);
checkBankNo.setName(name);
checkBankNo.setMessage(ChecksConstants.CHECK_CONFIG_ACCESS);
checkBankNo.setResult("01");
checkBankNo.setType(CommonConstants.ONE_STRING);
checkBankNo.setRemark(ChecksConstants.CHECK_CONFIG_ACCESS);
return R.ok(checkBankNo);
}
}
public static R<TCheckBankNo> checkBankNoTwoMethod(String name, String cardNo) {
final JsonObject jsonObject = ChecksUtil.invokeBankNoTwoAuth(name,cardNo);
TCheckBankNo checkBankNo = new TCheckBankNo();
......@@ -131,6 +153,40 @@ public class ChecksUtil {
return R.ok(checkBankNo);
}
private static R<TCheckBankNo> checkBankNoThreeMethod(String name, String cardNo, String idNum) {
final JsonObject jsonObject = ChecksUtil.invokeBankNoThreeAuth(name,cardNo,idNum);
TCheckBankNo checkBankNo = new TCheckBankNo();
// 2.处理返回结果
if (jsonObject != null) {
//响应code码。200000:成功,其他失败
String code = jsonObject.get(ChecksConstants.CODE).getAsString();
if (ChecksConstants.CODE_200000.equals(code) && jsonObject.get(ChecksConstants.DATA) != null) {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
// 校验状态码 200000:成功,其他失败
JsonObject resJson = jsonObject.get(ChecksConstants.DATA).getAsJsonObject();
String message = jsonObject.get(ChecksConstants.MESSAGE).getAsString();
if (Common.isNotNull(resJson)){
checkBankNo.setBankNo(cardNo);
checkBankNo.setBankName(getJsonElementValue(resJson.getAsJsonObject().get("bankName")));
checkBankNo.setCardCategory(getJsonElementValue(resJson.getAsJsonObject().get("cardCategory")));
checkBankNo.setCardType(getJsonElementValue(resJson.getAsJsonObject().get("cardType")));
checkBankNo.setResult(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.RESULT)));
checkBankNo.setMessage(message);
checkBankNo.setRemark(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.REMARK)));
checkBankNo.setType(CommonConstants.ONE_STRING);
checkBankNo.setName(name);
}
} else {
// 记录错误日志,正式项目中请换成log打印
return R.failed("银行卡号校验失败:"+jsonObject.get(ChecksConstants.MESSAGE).getAsString());
}
} else {
return R.failed(ChecksConstants.NO_DATA_RESULT);
}
return R.ok(checkBankNo);
}
private static String getJsonElementValue(JsonElement temp){
return Common.isNotNull(temp)?temp.getAsString():CommonConstants.EMPTY_STRING;
}
......@@ -273,4 +329,18 @@ public class ChecksUtil {
}
return null;
}
private static JsonObject invokeBankNoThreeAuth(String name,String cardNo,String idNum) {
Map<String, String> params = new HashMap<>();
params.put(ChecksConstants.APP_ID, APP_ID);
params.put(ChecksConstants.APP_KEY, APP_KEY_IDCARD);
params.put(ChecksConstants.NAME, name);
params.put(ChecksConstants.CARD_NO, cardNo);
params.put(ChecksConstants.ID_NUM, idNum);
String result = HttpUtils.post(API_URL_BANK_NO_THREE, params);
// 解析json,并返回结果
if (Common.isNotNull(result)){
return jsonParser.parse(result).getAsJsonObject();
}
return null;
}
}
package com.yifu.cloud.plus.v1.check.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @Author fxj
* @Date 2023/3/3
* @Description
* @Version 1.0
*/
@Data
public class CheckBankNoThreeVo extends RowIndex implements Serializable {
/**
* 银行卡号
*/
@Schema(description ="银行卡号")
@ExcelProperty(value ="银行卡号")
private String bankNo;
/**
* 姓名
*/
@Schema(description ="姓名")
@ExcelProperty(value ="姓名")
private String name;
/**
* 身份证
*/
@Schema(description ="身份证")
@ExcelProperty(value ="身份证")
private String idNum;
}
......@@ -23,14 +23,17 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.service.TCheckBankNoService;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
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 io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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 java.util.List;
import java.util.concurrent.ExecutionException;
......@@ -153,4 +156,31 @@ public class TCheckBankNoController {
return tCheckBankNoService.checkBankNo(name, bankNo);
}
/**
* 银行卡号校验
* @param checkBankNo 姓名 是 [string] 身份证号码,限单个 是 [string] 银行卡号,限单个 是 [string]银行预留手机号,仅支持国内11位号码
*/
@Operation(description = "银行卡号校验")
@SysLog("银行卡号校验" )
@Inner
@PostMapping("/inner/checkBankNoThree" )
public CheckBankNoVo checkBankNoThreeInner(@RequestBody TCheckBankNo checkBankNo) {
return tCheckBankNoService.checkBankNoThree(checkBankNo.getName(),checkBankNo.getBankNo(),checkBankNo.getIdNum());
}
/**
* 批量新增员工工作信息
*
* @param file
* @return
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量新增员工工作信息 hasPermission('archives_tempworkrecording_importListAdd')")
@SysLog("批量新增员工工作信息")
@PostMapping("/importListAdd")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return tCheckBankNoService.importDiy(file.getInputStream());
}
}
......@@ -21,8 +21,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.io.InputStream;
import java.util.List;
import java.util.concurrent.ExecutionException;
......@@ -42,6 +44,8 @@ public interface TCheckBankNoService extends IService<TCheckBankNo> {
**/
R<TCheckBankNo> checkBankNo(String name, String cardNo);
CheckBankNoVo checkBankNoThree(String name, String cardNo, String idNum);
CheckBankNoVo checkBankNoTwo(String name, String cardNo);
/**
......@@ -53,4 +57,5 @@ public interface TCheckBankNoService extends IService<TCheckBankNo> {
**/
CheckBatchVo checkBankNoBatch(List<TCheckBankNo> list) throws ExecutionException, InterruptedException;
R<List<ErrorMessage>> importDiy(InputStream inputStream);
}
......@@ -16,6 +16,11 @@
*/
package com.yifu.cloud.plus.v1.check.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.constant.ChecksConstants;
......@@ -24,20 +29,24 @@ import com.yifu.cloud.plus.v1.check.mapper.TCheckBankNoMapper;
import com.yifu.cloud.plus.v1.check.service.TCanCheckService;
import com.yifu.cloud.plus.v1.check.service.TCheckBankNoService;
import com.yifu.cloud.plus.v1.check.utils.ChecksUtil;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoThreeVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.concurrent.*;
/**
......@@ -73,7 +82,30 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
return resR;
}
}
@Override
public CheckBankNoVo checkBankNoThree(String name, String cardNo, String idNum) {
CheckBankNoVo vo = new CheckBankNoVo();
if (Common.isEmpty(name) || Common.isEmpty(cardNo)){
vo.setRes(R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_BANK_NO_REQUEST_PARAM_ERROR)));
return vo;
}
synchronized (this){
TCheckBankNo checkBankNo = baseMapper.selectOne(Wrappers.<TCheckBankNo>query().lambda()
.eq(TCheckBankNo::getBankNo,cardNo)
.eq(TCheckBankNo::getName,name)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(checkBankNo)){
vo.setRes(R.ok(checkBankNo));
return vo;
}
R<TCheckBankNo> resR = ChecksUtil.checkBankNoThree(name,cardNo,idNum,canCheckService.getCanCheck());
if (Common.isNotNull(resR) && Common.isNotNull(resR.getData())){
baseMapper.insert(resR.getData());
}
vo.setRes(resR);
return vo;
}
}
@Override
public CheckBankNoVo checkBankNoTwo(String name, String cardNo) {
CheckBankNoVo vo = new CheckBankNoVo();
......@@ -251,4 +283,99 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
}
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<CheckBankNoThreeVo> util1 = new ExcelUtil<>(CheckBankNoThreeVo.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, CheckBankNoThreeVo.class, new ReadListener<CheckBankNoThreeVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<CheckBankNoThreeVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(CheckBankNoThreeVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
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() {
importRecord(cachedDataList,errorMessageList);
}
}).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 importRecord(List<CheckBankNoThreeVo> cachedDataList, List<ErrorMessage> errorMessageList) {
if (Common.isNotNull(cachedDataList)){
CheckBankNoVo vo;
TCheckBankNo checkBankNo;
List<CheckBankNoVo> res = new ArrayList<>();
for (CheckBankNoThreeVo threeVo:cachedDataList){
vo = new CheckBankNoVo();
if (Common.isEmpty(threeVo.getName()) || Common.isEmpty(threeVo.getBankNo())|| Common.isEmpty(threeVo.getIdNum())){
vo.setRes(R.failed(MsgUtils.getMessage(ErrorCodes.CHECKS_BANK_NO_REQUEST_PARAM_ERROR)));
res.add(vo);
}
synchronized (this){
checkBankNo = baseMapper.selectOne(Wrappers.<TCheckBankNo>query().lambda()
.eq(TCheckBankNo::getBankNo,threeVo.getBankNo())
.eq(TCheckBankNo::getName,threeVo.getName())
.eq(TCheckBankNo::getIdNum,threeVo.getIdNum())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(checkBankNo)){
vo.setRes(R.ok(checkBankNo));
res.add(vo);
}
R<TCheckBankNo> resR = ChecksUtil.checkBankNoThree(threeVo.getName(),threeVo.getBankNo(),threeVo.getIdNum(),canCheckService.getCanCheck());
if (Common.isNotNull(resR) && Common.isNotNull(resR.getData())){
baseMapper.insert(resR.getData());
}
vo.setRes(resR);
res.add(vo);
if (resR.getCode()==200){
log.error(threeVo.getBankNo()+"|"
+threeVo.getIdNum()+"|"
+threeVo.getName()+"|"
+resR.getData().getResult()+"|"
+resR.getData().getRemark());
}else {
log.error(threeVo.getBankNo()+"|"
+threeVo.getIdNum()+"|"
+threeVo.getName()+"|"
+resR.getMsg());
}
}
}
}
}
}
......@@ -136,4 +136,19 @@ public interface CacheConstants {
*/
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 {
public static final String PAYMENT_SOCIAL_WAIT_EXPORT = "payment_social_wait_export";
public static final String PAYMENT_SOCIAL_PUSH = "payment_social_push";
//百分之一 1/100
public static final BigDecimal ONE_OF_PERCENT = new BigDecimal("0.01");
......
......@@ -19,6 +19,6 @@ public class ResultConstants {
public static final String REQUEST_LOCK_FAIL = "获取锁失败";
public static final String DATA_IMPORT_PARSING_RESULT = "数据导入解析!数据行数:";
public static final String NO_SELECT_DATA = "请选择数据";
public static final String NO_GETLOCK_DATA = "获取锁失败,10秒后重试!";
public static final String NO_GETLOCK_DATA = "当前用户操作处理中,请稍后重试!";
public static final String NO_ID = "操作失败,id不能为空!";
}
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;
package com.yifu.cloud.plus.v1.yifu.common.security.component;
import com.yifu.cloud.plus.v1.yifu.common.security.token.CasAuthenticationToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
/**
* cas验证登陆
*/
@Slf4j
public class CasAuthenticationProvider extends MyAbstractUserDetailsAuthenticationProvider {
private UserDetailsService userDetailsService;
@Override
protected void additionalAuthenticationChecks(UserDetails var1, Authentication authentication) throws AuthenticationException {
}
@Override
protected Authentication createSuccessAuthentication(Object principal, Authentication authentication, UserDetails user) {
CasAuthenticationToken result = new CasAuthenticationToken(principal, authentication.getCredentials(), user.getAuthorities());
result.setDetails(authentication.getDetails());
return result;
}
@Override
protected UserDetails retrieveUser(String casUserName, Authentication authentication) throws AuthenticationException {
UserDetails loadedUser;
try {
loadedUser = this.getUserDetailsService().loadUserByUsername(casUserName);
} catch (UsernameNotFoundException var6) {
throw var6;
} catch (Exception var7) {
log.info("CasAuthenticationProvider>>>>>>",var7);
throw new InternalAuthenticationServiceException(var7.getMessage(), var7);
}
if(loadedUser == null) {
throw new InternalAuthenticationServiceException("UserDetailsService returned null, which is an interface contract violation");
} else {
return loadedUser;
}
}
@Override
public boolean supports(Class<?> authentication) {
return CasAuthenticationToken.class.isAssignableFrom(authentication);
}
public UserDetailsService getUserDetailsService() {
return userDetailsService;
}
public void setUserDetailsService(UserDetailsService userDetailsService) {
this.userDetailsService = userDetailsService;
}
}
package com.yifu.cloud.plus.v1.yifu.common.security.component;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceAware;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.authentication.*;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
import org.springframework.security.core.userdetails.UserCache;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsChecker;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.core.userdetails.cache.NullUserCache;
import org.springframework.util.Assert;
/**
* Created by fp295 on 2023/3/14.
* 自定义 AuthenticationProvider, 以使用自定义的 MyAuthenticationToken
*/
public abstract class MyAbstractUserDetailsAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
protected final Log logger = LogFactory.getLog(this.getClass());
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private UserCache userCache = new NullUserCache();
private boolean forcePrincipalAsString = false;
protected boolean hideUserNotFoundExceptions = true;
private UserDetailsChecker preAuthenticationChecks = new DefaultPreAuthenticationChecks();
private UserDetailsChecker postAuthenticationChecks = new DefaultPostAuthenticationChecks();
private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
protected abstract void additionalAuthenticationChecks(UserDetails var1, Authentication var2) throws AuthenticationException;
public final void afterPropertiesSet() throws Exception {
Assert.notNull(this.userCache, "A user cache must be set");
Assert.notNull(this.messages, "A message source must be set");
this.doAfterPropertiesSet();
}
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
String username = authentication.getPrincipal() == null?"NONE_PROVIDED":authentication.getName();
boolean cacheWasUsed = true;
UserDetails user = this.userCache.getUserFromCache(username);
if(user == null) {
cacheWasUsed = false;
try {
user = this.retrieveUser(username, authentication);
} catch (UsernameNotFoundException var6) {
this.logger.debug("User \'" + username + "\' not found");
if(this.hideUserNotFoundExceptions) {
throw new BadCredentialsException(this.messages.getMessage("MyAbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
throw var6;
}
Assert.notNull(user, "retrieveUser returned null - a violation of the interface contract");
}
try {
this.preAuthenticationChecks.check(user);
this.additionalAuthenticationChecks(user, authentication);
} catch (AuthenticationException var7) {
if(!cacheWasUsed) {
throw var7;
}
cacheWasUsed = false;
user = this.retrieveUser(username, authentication);
this.preAuthenticationChecks.check(user);
this.additionalAuthenticationChecks(user, authentication);
}
this.postAuthenticationChecks.check(user);
if(!cacheWasUsed) {
this.userCache.putUserInCache(user);
}
Object principalToReturn = user;
if(this.forcePrincipalAsString) {
principalToReturn = user.getUsername();
}
return this.createSuccessAuthentication(principalToReturn, authentication, user);
}
protected abstract Authentication createSuccessAuthentication(Object principal, Authentication authentication, UserDetails user);
protected void doAfterPropertiesSet() throws Exception {
}
public UserCache getUserCache() {
return this.userCache;
}
public boolean isForcePrincipalAsString() {
return this.forcePrincipalAsString;
}
public boolean isHideUserNotFoundExceptions() {
return this.hideUserNotFoundExceptions;
}
protected abstract UserDetails retrieveUser(String var1, Authentication var2) throws AuthenticationException;
public void setForcePrincipalAsString(boolean forcePrincipalAsString) {
this.forcePrincipalAsString = forcePrincipalAsString;
}
public void setHideUserNotFoundExceptions(boolean hideUserNotFoundExceptions) {
this.hideUserNotFoundExceptions = hideUserNotFoundExceptions;
}
public void setMessageSource(MessageSource messageSource) {
this.messages = new MessageSourceAccessor(messageSource);
}
public void setUserCache(UserCache userCache) {
this.userCache = userCache;
}
protected UserDetailsChecker getPreAuthenticationChecks() {
return this.preAuthenticationChecks;
}
public void setPreAuthenticationChecks(UserDetailsChecker preAuthenticationChecks) {
this.preAuthenticationChecks = preAuthenticationChecks;
}
protected UserDetailsChecker getPostAuthenticationChecks() {
return this.postAuthenticationChecks;
}
public void setPostAuthenticationChecks(UserDetailsChecker postAuthenticationChecks) {
this.postAuthenticationChecks = postAuthenticationChecks;
}
public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) {
this.authoritiesMapper = authoritiesMapper;
}
private class DefaultPostAuthenticationChecks implements UserDetailsChecker {
private DefaultPostAuthenticationChecks() {
}
public void check(UserDetails user) {
if(!user.isCredentialsNonExpired()) {
MyAbstractUserDetailsAuthenticationProvider.this.logger.debug("User account credentials have expired");
throw new CredentialsExpiredException(MyAbstractUserDetailsAuthenticationProvider.this.messages.getMessage("MyAbstractUserDetailsAuthenticationProvider.credentialsExpired", "User credentials have expired"));
}
}
}
private class DefaultPreAuthenticationChecks implements UserDetailsChecker {
private DefaultPreAuthenticationChecks() {
}
public void check(UserDetails user) {
if(!user.isAccountNonLocked()) {
MyAbstractUserDetailsAuthenticationProvider.this.logger.debug("User account is locked");
throw new LockedException(MyAbstractUserDetailsAuthenticationProvider.this.messages.getMessage("MyAbstractUserDetailsAuthenticationProvider.locked", "用户帐号已被锁定"));
} else if(!user.isEnabled()) {
MyAbstractUserDetailsAuthenticationProvider.this.logger.debug("User account is disabled");
throw new DisabledException(MyAbstractUserDetailsAuthenticationProvider.this.messages.getMessage("MyAbstractUserDetailsAuthenticationProvider.disabled", "用户未激活"));
} else if(!user.isAccountNonExpired()) {
MyAbstractUserDetailsAuthenticationProvider.this.logger.debug("User account is expired");
throw new AccountExpiredException(MyAbstractUserDetailsAuthenticationProvider.this.messages.getMessage("MyAbstractUserDetailsAuthenticationProvider.expired", "用户帐号已过期"));
}
}
}
}
package com.yifu.cloud.plus.v1.yifu.common.security.token;
import org.springframework.security.core.GrantedAuthority;
import java.util.Collection;
/**
* cas token
*/
public class CasAuthenticationToken extends MyAuthenticationToken {
public CasAuthenticationToken(Object principal, Object credentials) {
super(principal, credentials);
}
public CasAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) {
super(principal, credentials, authorities);
}
}
package com.yifu.cloud.plus.v1.yifu.common.security.token;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import java.util.Collection;
/**
* 自定义AbstractAuthenticationToken,
*/
public class MyAuthenticationToken extends AbstractAuthenticationToken {
private static final long serialVersionUID = 110L;
protected final Object principal;
protected Object credentials;
/**
* This constructor can be safely used by any code that wishes to create a
* <code>UsernamePasswordAuthenticationToken</code>, as the {@link
* #isAuthenticated()} will return <code>false</code>.
*
*/
public MyAuthenticationToken(Object principal, Object credentials) {
super(null);
this.principal = principal;
this.credentials = credentials;
this.setAuthenticated(false);
}
/**
* This constructor should only be used by <code>AuthenticationManager</code> or <code>AuthenticationProvider</code>
* implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = <code>true</code>)
* token token.
*
* @param principal
* @param credentials
* @param authorities
*/
public MyAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities) {
super(authorities);
this.principal = principal;
this.credentials = credentials;
super.setAuthenticated(true);
}
@Override
public Object getCredentials() {
return this.credentials;
}
@Override
public Object getPrincipal() {
return this.principal;
}
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
if(isAuthenticated) {
throw new IllegalArgumentException("Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
} else {
super.setAuthenticated(false);
}
}
public void eraseCredentials() {
super.eraseCredentials();
this.credentials = null;
}
}
......@@ -337,13 +337,17 @@ public class InsurancesConstants {
*/
public static final String BUY_STANDARD_NOT_EMPTY = "购买标准不能为空";
/**
* 变更后保单开始时间、变更后保单结束时间、变更后投保类型个字段至少填写一个
* 变更后保单开始时间、变更后保单结束时间、变更后投保类型、变更后购买标准四个字段至少填写一个
*/
public static final String CHOOSE_ONE_OF_THREE = "变更后保单开始时间、变更后保单结束时间、变更后投保类型个字段至少填写一个";
public static final String CHOOSE_ONE_OF_THREE = "变更后保单开始时间、变更后保单结束时间、变更后投保类型、变更后购买标准四个字段至少填写一个";
/**
* 购买标准不存在
*/
public static final String BUY_STANDARD_NOT_EXIST = "购买标准不存在";
/**
* 变更后的购买标准不存在
*/
public static final String CHANGE_BUY_STANDARD_NOT_EXIST = "变更后的购买标准不存在";
/**
* 商险购买地省名称不能为空
*/
......
......@@ -37,6 +37,12 @@ public class InsuranceInsuredDetailParam implements Serializable {
@Schema(description = "变更后投保类型 1新增 3批增")
private Integer buyType;
/**
* 变更后的购买标准
*/
@Schema(description = "变更后的购买标准")
private String buyStandard;
/**
* 变更原因
*/
......
......@@ -57,6 +57,12 @@ public class InsuranceInsuredParam implements Serializable {
@Schema(description = "购买标准")
private String buyStandard;
/**
* 变更后的购买标准
*/
@Schema(description = "变更后的购买标准")
private String buyStandardNew;
/**
* 变更后保单开始时间
*/
......
......@@ -97,8 +97,8 @@ public class InsuranceWarnExportVo implements Serializable {
* 实际保费
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保费")
@Schema(name = "保费")
@ExcelProperty(value = "实际保费")
@Schema(name = "实际保费")
private BigDecimal actualPremium;
/**
* 创建人
......@@ -120,8 +120,8 @@ public class InsuranceWarnExportVo implements Serializable {
* 投保办理状态 1待投保 2投保中 3已投保 4投保退回 5 已减员
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "办理状态")
@Schema(name = "办理状态")
@ExcelProperty(value = "状态")
@Schema(name = "状态")
private String buyHandleStatus;
/**
* 出险状态(0未出险;1已出险)
......@@ -192,13 +192,13 @@ public class InsuranceWarnExportVo implements Serializable {
private String remark;
/**
/* *//**
* 商险购买地省
*/
*//*
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "商险购买地省")
@Schema(name = "商险购买地省")
private String insuranceProvince;
private String insuranceProvince;*/
/**
* 商险购买地
*/
......@@ -256,11 +256,11 @@ public class InsuranceWarnExportVo implements Serializable {
private BigDecimal estimatePremium;
/**
* 结算类型 (0、与薪资合并结算 1、单独结算)
* 结算类型 (0、与薪资结算 1、单独结算)
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "结算类型")
@Schema(description = "结算类型 (0、与薪资合并结算 1、单独结算)")
@Schema(description = "结算类型 (0、与薪资结算 1、单独结算)")
private String settleType;
/**
......
......@@ -106,7 +106,7 @@ public class TInsurancesWarnController {
@SysLog("到期提醒批量忽略")
@PutMapping("/batchexpireIgnore")
@PreAuthorize("@pms.hasPermission('wxhr:insurance_expireignore')")
public R<Object> batchexpireIgnore(@RequestBody String ids) {
public R<Object> batchexpireIgnore(@RequestBody List<String> ids) {
return insuranceDetailService.batchexpireIgnore(ids);
}
......
......@@ -516,7 +516,7 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
R<Integer> getExpireInsuranceWarn();
R<Object> batchexpireIgnore(String ids);
R<Object> batchexpireIgnore(List<String> ids);
R<Object> expireIgnore(TBusinessInsuranceVo vo);
......
......@@ -2196,8 +2196,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceInsuredParam> listSuccess = operateList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(listSuccess)){
TInsuranceDetail detail;
for (InsuranceInsuredParam success : listSuccess) {
TInsuranceDetail detail = success.getDetail();
detail = success.getDetail();
if (Optional.ofNullable(detail).isPresent()){
TInsuranceDetail oldDetail = new TInsuranceDetail();
BeanCopyUtils.copyProperties(detail,oldDetail);
......@@ -2210,6 +2211,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Objects.nonNull(success.getBuyType())){
detail.setBuyType(success.getBuyType());
}
if (Common.isNotNull(success.getBuyStandardNew())) {
detail.setBuyStandard(success.getBuyStandardNew());
}
detailList.add(detail);
//变更记录
tBusinessOperateService.saveModificationRecord(detail.getId(),oldDetail,detail,success.getReason());
......@@ -2223,21 +2227,24 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
StringBuilder sb = new StringBuilder();
sb.append("操作人:" + user.getNickname() + ";操作时间:" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
if (!oldDetail.getPolicyStart().toString().equals(detail.getPolicyStart().toString())) {
sb.append(";变更前保单开始时间:" + oldDetail.getPolicyStart() + ";变更后保单开始时间:" + detail.getPolicyStart().toString());
sb.append(";变更前保单开始时间:" + oldDetail.getPolicyStart() + ";变更后保单开始时间:" + detail.getPolicyStart());
}
if (!oldDetail.getPolicyEnd().toString().equals(detail.getPolicyEnd().toString())) {
sb.append(";变更前保单结束时间:" + oldDetail.getPolicyEnd() + ";变更后保单结束时间:" + detail.getPolicyEnd().toString());
sb.append(";变更前保单结束时间:" + oldDetail.getPolicyEnd() + ";变更后保单结束时间:" + detail.getPolicyEnd());
}
if (!oldDetail.getBuyType().equals(detail.getBuyType())) {
sb.append(";变更前投保类型:" + getBuyType(oldDetail.getBuyType()) + ";变更后投保类型:" + getBuyType(detail.getBuyType()));
}
if (!oldDetail.getBuyStandard().equals(detail.getBuyStandard())) {
sb.append(";变更前购买标准:" + oldDetail.getBuyStandard() + ";变更后购买标准:" + detail.getBuyStandard());
}
if (StringUtils.isNotBlank(success.getReason())){
sb.append(";变更原因:" + success.getReason());
}
EkpUpdateParam ekpUpdateParam = new EkpUpdateParam();
ekpUpdateParam.setFd_3b5bf02d3b8fc4(detail.getPolicyStart().toString());
ekpUpdateParam.setFd_3b5bf02e1d47cc(detail.getPolicyEnd().toString());
ekpUpdateParam.setFd_3b5bf02fa14596(getBuyType(detail.getBuyType()));
ekpUpdateParam.setFd_3b5bf02d3b8fc4(success.getPolicyStartNew());
ekpUpdateParam.setFd_3b5bf02e1d47cc(success.getPolicyEndNew());
ekpUpdateParam.setFd_3b5bf02fa14596(getBuyType(success.getBuyType()));
ekpUpdateParam.setFd_3b5bf031b52314(detail.getBuyStandard());
ekpUpdateParam.setFd_3b5bf032d7a822(detail.getId() + "_" + detail.getDefaultSettleId());
ekpUpdateParam.setFd_3b5bf0b7b4c058(sb.toString());
......@@ -2256,7 +2263,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//操作记录
//addOperate(detailList,user,InsurancesConstants.UPDATE_INSURED,null,CommonConstants.ONE_INT);
if (operateList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) {
operateList = null;
}
......@@ -2279,7 +2285,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (StringUtils.isBlank(param.getId())){
return R.failed(InsurancesConstants.ID_IS_EMPTY);
}
if (StringUtils.isBlank(param.getPolicyStart()) && StringUtils.isBlank(param.getPolicyEnd()) && Objects.isNull(param.getBuyType())){
if (StringUtils.isBlank(param.getPolicyStart()) && StringUtils.isBlank(param.getPolicyEnd())
&& Objects.isNull(param.getBuyType()) && StringUtils.isBlank(param.getBuyStandard())){
return R.failed(InsurancesConstants.CHOOSE_ONE_OF_THREE);
}
if (StringUtils.isNotBlank(param.getPolicyStart())){
......@@ -2324,6 +2331,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Objects.nonNull(param.getBuyType())){
byId.setBuyType(param.getBuyType());
}
if (Objects.nonNull(param.getBuyStandard())){
//判断变更后购买标准是否存在
//购买标准
TInsuranceTypeStandard typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandard())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, byId.getInsuranceTypeId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()) {
return R.failed(InsurancesConstants.CHANGE_BUY_STANDARD_NOT_EXIST);
}
byId.setBuyStandard(param.getBuyStandard());
}
//变更记录
tBusinessOperateService.saveModificationRecord(byId.getId(),old,byId,param.getReason());
......@@ -2344,6 +2365,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (!old.getBuyType().equals(param.getBuyType())) {
sb.append(";变更前投保类型:" + getBuyType(old.getBuyType()) + ";变更后投保类型:" + getBuyType(param.getBuyType()));
}
if (!old.getBuyStandard().equals(param.getBuyStandard())) {
sb.append(";变更前购买标准:" + old.getBuyStandard() + ";变更后购买标准:" + param.getBuyStandard());
}
if (StringUtils.isNotBlank(param.getReason())){
sb.append(";变更原因:" + param.getReason());
}
......@@ -3796,6 +3820,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private List<InsuranceInsuredParam> updateInsuranceInsuredCheck(List<InsuranceInsuredParam> paramList, List<TInsuranceAreaRes> insuranceAreaResList){
List<InsuranceInsuredParam> collect = paramList.stream().distinct().collect(Collectors.toList());
TInsuranceDetail detail;
TInsuranceTypeStandard typeStandard;
for (InsuranceInsuredParam param : collect) {
param.setFlag(CommonConstants.ONE_STRING);
// 必填校验
......@@ -3835,7 +3860,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyStartNew()) && StringUtils.isBlank(param.getPolicyEndNew()) && StringUtils.isBlank(param.getBuyTypeStr())){
if (StringUtils.isBlank(param.getPolicyStartNew()) && StringUtils.isBlank(param.getPolicyEndNew())
&& StringUtils.isBlank(param.getBuyTypeStr()) && StringUtils.isBlank(param.getBuyStandardNew())){
param.setErrorMessage(InsurancesConstants.CHOOSE_ONE_OF_THREE);
continue;
}
......@@ -3917,6 +3943,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.REPLACE_NOT_ALLOW);
continue;
}
//判断变更后购买标准是否存在
if (Common.isNotNull(param.getBuyStandardNew())) {
//购买标准
typeStandard = tInsuranceTypeStandardService.getOne(Wrappers.<TInsuranceTypeStandard>query().lambda()
.eq(TInsuranceTypeStandard::getBuyStandard, param.getBuyStandardNew())
.eq(TInsuranceTypeStandard::getInsuranceTypeId, detail.getInsuranceTypeId())
.eq(TInsuranceTypeStandard::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(typeStandard).isPresent()) {
param.setErrorMessage(InsurancesConstants.CHANGE_BUY_STANDARD_NOT_EXIST);
continue;
}
}
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
param.setFlag(CommonConstants.ZERO_STRING);
......@@ -7398,12 +7438,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
@Override
public R<Object> batchexpireIgnore(String ids) {
public R<Object> batchexpireIgnore(List<String> ids) {
if (Common.isEmpty(ids)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
List<String> idList = Common.getList(ids);
baseMapper.batchexpireIgnore(idList);
baseMapper.batchexpireIgnore(ids);
return R.ok();
}
......@@ -7470,7 +7509,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
boolean isTrue = true;
for (ErrorMessage message : errorMessageList) {
if (!CommonConstants.SAVE_SUCCESS.equals(message.getMessage())) {
if (!CommonConstants.UPDATE_SUCCESS.equals(message.getMessage())) {
isTrue = false;
break;
}
......@@ -7490,7 +7529,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (entity == null) {
return R.failed("未查询到相关商险订单");
}
entity.setExpireIgnoreFlag(vo.getExpireIgnoreFlag());
entity.setExpireIgnoreFlag(CommonConstants.ZERO_STRING);
baseMapper.updateById(entity);
return R.ok();
}
......
......@@ -1592,11 +1592,13 @@
a.ACTUAL_PREMIUM,
a.CREATE_NAME,
a.CREATE_TIME,
"已办理" as "BUY_HANDLE_STATUS",
"已投保" as "BUY_HANDLE_STATUS",
a.POLICY_NO,
a.MEDICAL_QUOTA,
a.DIE_DISABLE_QUOTA,
a.SETTLE_TYPE,
case when a.SETTLE_TYPE = 0 then "与薪资结算"
when a.SETTLE_TYPE = 1 then "单独结算"
else null end as "SETTLE_TYPE" ,
a.SETTLE_MONTH,
a.INVOICE_NO,
r2.REPLACE_TIME,
......@@ -1604,7 +1606,6 @@
a.UNIT_NAME as "customerName",
a.UNIT_NO,
a.REMARK,
a.INSURANCE_PROVINCE_NAME,
a.INSURANCE_CITY_NAME,
case when a.IS_EFFECT = 0 then "有效"
when a.IS_EFFECT = 1 then "无效"
......
......@@ -404,7 +404,9 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
.last(CommonConstants.LAST_ONE_SQL)
);
if (Optional.ofNullable(one).isPresent()){
return R.failed(OrderConstants.ORDER_NO_IS_EXIST);
//1.5.2-hyc 订单编号重复的删除状态更新为已删除
one.setDeleteFlag(CommonConstants.ONE_INT);
baseMapper.updateById(one);
}
if (Common.isEmpty(vo.getCreateName())){
return R.failed(OrderConstants.ORDER_NAME_IS_EMPTY);
......
/*
* 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.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 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 javax.validation.constraints.NotBlank;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
@Data
@TableName("t_bank_set")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "开户行配置表")
public class TBankSet extends BaseEntity {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id")
@Schema(description = "id")
private String id;
/**
* bankName
*/
@ExcelAttribute(name = "开户行", isNotEmpty = true, errorInfo = "开户行不能为空", maxLength = 100)
@NotBlank(message = "开户行不能为空")
@Length(max = 100, message = "开户行不能超过100个字符")
@ExcelProperty("开户行")
@Schema(description = "开户行")
private String bankName;
/**
* 是否删除0:正常;1:已删除
*/
@ExcelAttribute(name = "是否删除0:正常;1:已删除")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("是否删除0:正常;1:已删除")
private String deleteFlag;
}
\ No newline at end of file
/*
* 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.yifu.cloud.plus.v1.yifu.salary.entity.TBankSet;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
@Data
public class TBankSetSearchVo extends TBankSet {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
/*
* 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.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
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 javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
@Data
public class TBankSetVo extends RowIndex implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "id 不能为空")
@Length(max = 32, message = "id 不能超过32 个字符")
@ExcelAttribute(name = "id", isNotEmpty = true, errorInfo = "id 不能为空", maxLength = 32)
@Schema(description = "id")
@ExcelProperty("id")
private String id;
/**
* bankName
*/
@NotBlank(message = "bankName 不能为空")
@Length(max = 50, message = "bankName 不能超过50 个字符")
@ExcelAttribute(name = "bankName", isNotEmpty = true, errorInfo = "bankName 不能为空", maxLength = 50)
@Schema(description = "bankName")
@ExcelProperty("bankName")
private String bankName;
/**
* 创建人id
*/
@Length(max = 64, message = "创建人id 不能超过64 个字符")
@ExcelAttribute(name = "创建人id", maxLength = 64)
@Schema(description = "创建人id")
@ExcelProperty("创建人id")
private String createBy;
/**
* 创建人姓名
*/
@Length(max = 64, message = "创建人姓名 不能超过64 个字符")
@ExcelAttribute(name = "创建人姓名", maxLength = 64)
@Schema(description = "创建人姓名")
@ExcelProperty("创建人姓名")
private String createName;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间", isDate = true)
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private Date createTime;
/**
* 更新人id
*/
@Length(max = 32, message = "更新人id 不能超过32 个字符")
@ExcelAttribute(name = "更新人id", maxLength = 32)
@Schema(description = "更新人id")
@ExcelProperty("更新人id")
private String updateBy;
/**
* 更新时间
*/
@ExcelAttribute(name = "更新时间", isDate = true)
@Schema(description = "更新时间")
@ExcelProperty("更新时间")
private Date updateTime;
}
/*
* 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.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.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.salary.entity.TBankSet;
import com.yifu.cloud.plus.v1.yifu.salary.service.TBankSetService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TBankSetSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tbankset")
@Tag(name = "开户行配置表管理")
public class TBankSetController {
private final TBankSetService tBankSetService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBankSet 开户行配置表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBankSet>> getTBankSetPage(Page<TBankSet> page, TBankSetSearchVo tBankSet) {
return new R<>(tBankSetService.getTBankSetPage(page, tBankSet));
}
/**
* 不分页查询
*
* @param tBankSet 开户行配置表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<TBankSet>> getTBankSetNoPage(@RequestBody TBankSetSearchVo tBankSet) {
return R.ok(tBankSetService.noPageDiy(tBankSet));
}
/**
* 通过id查询开户行配置表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('salary_tbankset_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('salary_tbankset_get')")
public R<TBankSet> getById(@PathVariable("id") String id) {
return R.ok(tBankSetService.getById(id));
}
/**
* 新增开户行配置表
*
* @param tBankSet 开户行配置表
* @return R
*/
@Operation(summary = "新增开户行配置表", description = "新增开户行配置表:hasPermission('salary_tbankset_add')")
@SysLog("新增开户行配置表")
@PostMapping
@PreAuthorize("@pms.hasPermission('salary_tbankset_add')")
public R<Boolean> save(@RequestBody TBankSet tBankSet) {
if (Common.isEmpty(tBankSet.getBankName())) {
return R.failed("开户行不可为空!");
}
List<TBankSet> tBankSetList = tBankSetService.getList(tBankSet.getBankName(), null);
if (tBankSetList != null && !tBankSetList.isEmpty()) {
return R.failed("已存在该开户行!");
}
return R.ok(tBankSetService.save(tBankSet));
}
/**
* 修改开户行配置表
*
* @param tBankSet 开户行配置表
* @return R
*/
@Operation(summary = "修改开户行配置表", description = "修改开户行配置表:hasPermission('salary_tbankset_edit')")
@SysLog("修改开户行配置表")
@PutMapping
@PreAuthorize("@pms.hasPermission('salary_tbankset_edit')")
public R<Boolean> updateById(@RequestBody TBankSet tBankSet) {
List<TBankSet> tBankSetList = tBankSetService.getList(tBankSet.getBankName(), tBankSet.getId());
if (tBankSetList != null && !tBankSetList.isEmpty()) {
return R.failed("已存在该开户行!");
}
return R.ok(tBankSetService.updateById(tBankSet));
}
/**
* 通过id删除开户行配置表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除开户行配置表", description = "通过id删除开户行配置表:hasPermission('salary_tbankset_del')")
@SysLog("通过id删除开户行配置表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('salary_tbankset_del')")
public R<Boolean> removeById(@PathVariable String id) {
TBankSet bankSet = tBankSetService.getById(id);
if (bankSet != null) {
bankSet.setDeleteFlag(CommonConstants.STATUS_DEL);
tBankSetService.updateById(bankSet);
return R.ok();
} else {
return R.failed("未找到!");
}
}
/**
* 开户行配置表 批量导入
*
* @author hgw
* @date 2023-03-06 11:54:21
**/
@SneakyThrows
@Operation(description = "批量新增开户行配置表 hasPermission('salary_tbankset-batch-import')")
@SysLog("批量新增开户行配置表")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('salary_tbankset-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
return tBankSetService.importDiy(file.getInputStream());
}
/**
* 开户行配置表 批量导出
*
* @author hgw
* @date 2023-03-06 11:54:21
**/
@Operation(description = "导出开户行配置表 hasPermission('salary_tbankset-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('salary_tbankset-export')")
public void export(HttpServletResponse response, @RequestBody TBankSetSearchVo searchVo) {
tBankSetService.listExport(response, searchVo);
}
}
/*
* 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.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TBankSet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
@Mapper
public interface TBankSetMapper extends BaseMapper<TBankSet> {
/**
* 开户行配置表简单分页查询
*
* @param tBankSet 开户行配置表
* @return
*/
IPage<TBankSet> getTBankSetPage(Page<TBankSet> page, @Param("tBankSet") TBankSet tBankSet);
List<String> getTBankSetList(@Param("bankName") String bankName);
}
/*
* 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.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.TBankSet;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TBankSetSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
public interface TBankSetService extends IService<TBankSet> {
/**
* 开户行配置表简单分页查询
* @param tBankSet 开户行配置表
* @return
*/
IPage<TBankSet> getTBankSetPage(Page<TBankSet> page, TBankSetSearchVo tBankSet);
/**
* @param bankName 开户行
* @Description: 获取Map
* @Author: hgw
* @Date: 2023/3/6 15:23
* @return: java.util.Map<java.lang.String, java.lang.String>
**/
Map<String, String> getBankMap(String bankName);
R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, TBankSetSearchVo searchVo);
List<TBankSet> noPageDiy(TBankSetSearchVo searchVo);
/**
* @param bankName
* @param id
* @Description: 获取list
* @Author: hgw
* @Date: 2023/3/10 18:08
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.salary.entity.TBankSet>
**/
List<TBankSet> getList(String bankName, String id);
}
......@@ -84,6 +84,8 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
private final TSalaryStandardIssueResService tSalaryStandardIssueResService;
private final TBankSetService tBankSetService;
// 缓存信息
private final CacheManager cacheManager;
......@@ -212,9 +214,11 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
}
}
}
Map<String, String> bankMap = tBankSetService.getBankMap(null);
util1.getJsonStringToList(user, vo, dept, configSalary, salaryConfigMap, isMustMap,
empIdCardMap, empNameMap, isDuplicateName, checkListY, invoiceTitle,
employeeService, checkMap, specialMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService);
employeeService, checkMap, specialMap, ownEmployeeMap, ownDeptMap, tSalaryAccountService, bankMap);
List<TSalaryAccountVo> saList = util1.getEntityList();
if ((null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty())) {
......
/*
* 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.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TBankSet;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TBankSetMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TBankSetService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TBankSetSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TBankSetVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 开户行配置表
*
* @author hgw
* @date 2023-03-06 11:54:21
*/
@Log4j2
@Service
public class TBankSetServiceImpl extends ServiceImpl<TBankSetMapper, TBankSet> implements TBankSetService {
/**
* 开户行配置表简单分页查询
*
* @param tBankSet 开户行配置表
* @return
*/
@Override
public IPage<TBankSet> getTBankSetPage(Page<TBankSet> page, TBankSetSearchVo tBankSet) {
return baseMapper.getTBankSetPage(page, tBankSet);
}
/**
* 开户行Map
* @param bankName 开户行
* @return
*/
@Override
public Map<String, String> getBankMap(String bankName) {
List<String> sList = baseMapper.getTBankSetList(bankName);
Map<String, String> bankMap = new HashMap<>();
if (sList != null && !sList.isEmpty()) {
for (String s : sList) {
bankMap.put(s,s);
}
}
return bankMap;
}
/**
* 开户行配置表批量导出
*
* @param searchVo 开户行配置表
* @return
*/
@Override
public void listExport(HttpServletResponse response, TBankSetSearchVo searchVo) {
String fileName = "开户行配置表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TBankSet> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
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, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, TBankSet.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i = i + CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcelFactory.writerSheet("开户行配置表" + index).build();
excelWriter.write(list, writeSheet);
index++;
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcelFactory.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<TBankSet> noPageDiy(TBankSetSearchVo searchVo) {
LambdaQueryWrapper<TBankSet> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TBankSet::getId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
}
private Long noPageCountDiy(TBankSetSearchVo searchVo) {
LambdaQueryWrapper<TBankSet> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TBankSet::getId, idList);
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TBankSetSearchVo entity) {
LambdaQueryWrapper<TBankSet> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TBankSet::getCreateTime, entity.getCreateTimes()[0])
.le(TBankSet::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())) {
wrapper.eq(TBankSet::getCreateName, entity.getCreateName());
}
wrapper.eq(TBankSet:: getDeleteFlag, CommonConstants.STATUS_NORMAL);
return wrapper;
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TBankSetVo> util1 = new ExcelUtil<>(TBankSetVo.class);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcelFactory.read(inputStream, TBankSetVo.class, new ReadListener<TBankSetVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<TBankSetVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TBankSetVo 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());
importTBankSet(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 importTBankSet(List<TBankSetVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
TBankSetVo excel = excelVOList.get(i);
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
}
/**
* 插入excel bad record
*/
private void insertExcel(TBankSetVo excel) {
TBankSet insert = new TBankSet();
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
@Override
public List<TBankSet> getList(String bankName, String id) {
LambdaQueryWrapper<TBankSet> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TBankSet:: getDeleteFlag, CommonConstants.STATUS_NORMAL);
wrapper.eq(TBankSet:: getBankName, bankName);
if (Common.isNotNull(id)) {
wrapper.ne(TBankSet:: getId, id);
}
return baseMapper.selectList(wrapper);
}
}
......@@ -45,6 +45,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmployeeMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TBankSetService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
......@@ -77,6 +78,8 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
@Autowired
private DaprCheckProperties checkProperties;
@Autowired
private TBankSetService tBankSetService;
/**
* 薪酬人员表简单分页查询
*
......@@ -538,6 +541,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
// 开户行省市的区域暂存
String areaStr;
boolean curTaxMonth;
Map<String, String> bankMap = tBankSetService.getBankMap(null);
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (excel != null) {
......@@ -551,6 +555,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
emp.setTaxMonth(excel.getTaxMonth());
}
if (Common.isNotNull(excel.getBankName())) {
if (bankMap.get(excel.getBankName()) == null) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.BANK_NAME_ERROR));
continue;
}
emp.setBankName(excel.getBankName());
}
if (Common.isNotNull(excel.getBankSubName())) {
......@@ -677,7 +685,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
return false;
}
}
this.saveBatch(empList);
this.saveOrUpdateBatch(empList);
}
return true;
}
......@@ -715,6 +723,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
List<TSalaryEmployee> saveList = new ArrayList<>();
List<TSalaryEmployee> updateList = new ArrayList<>();
TSettleDomain dept = vo.getDept();
Map<String, String> bankMap = tBankSetService.getBankMap(null);
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (excel != null) {
......@@ -740,6 +749,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
}
if (Common.isNotNull(excel.getBankName())) {
if (bankMap.get(excel.getBankName()) == null) {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.BANK_NAME_ERROR));
continue;
}
emp.setBankName(excel.getBankName());
}
if (Common.isNotNull(excel.getBankSubName())) {
......@@ -809,6 +822,10 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.TAX_MONTH_LENGTH));
continue;
}
if (bankMap.get(excel.getBankName()) == null) {
errorMessageList.add(new ErrorMessage((i + 2), SalaryConstants.BANK_NAME_ERROR));
continue;
}
String pre = this.checkNewEmpBankAndPhone(excel, true);
if (pre != null) {
errorMessageList.add(new ErrorMessage((i + 2), pre));
......
......@@ -69,7 +69,7 @@ public class SalaryAccountUtil implements Serializable {
, Map<String, TSalaryEmployee> empIdCardMap, Map<String, TSalaryEmployee> empNameMap, boolean isDuplicateName
, List<String> checkListY, String invoiceTitle, TSalaryEmployeeService tSalaryEmployeeService
, Map<String, Integer> checkMap, Map<String, BigDecimal> specialMap, Map<String, Integer> ownEmployeeMap
, Map<String, Integer> ownDeptMap, TSalaryAccountService tSalaryAccountService) {
, Map<String, Integer> ownDeptMap, TSalaryAccountService tSalaryAccountService, Map<String, String> bankMap) {
String jsonStr = vo.getJsonString();
String salaryType = vo.getSalaryType();
Integer isIssue = vo.getIsIssue();
......@@ -388,7 +388,7 @@ public class SalaryAccountUtil implements Serializable {
if (!notLabour) {
R<TSalaryEmployee> eR = this.getNewEmp(newEmp, i, errorList, notLabour, entity, salaryType, dept, user
, salaryStyle, salaryGiveTimeFlag, invoiceTitle, tSalaryAccountService
, tSalaryEmployeeService);
, tSalaryEmployeeService, bankMap);
if (eR.getCode() != 200) {
continue;
} else {
......@@ -403,7 +403,7 @@ public class SalaryAccountUtil implements Serializable {
if (emp != null) {
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, emp, saiList, salaryGiveTimeFlag, isNewEmployee, empName, salaryStyle
, nowMonth, updateEmpList, checkBankInfoEmpList, i))
, nowMonth, updateEmpList, checkBankInfoEmpList, i, bankMap))
continue;
}
if (saiList != null && !saiList.isEmpty()) {
......@@ -470,7 +470,7 @@ public class SalaryAccountUtil implements Serializable {
if (!this.setNewEmpBase(newEmps, newEmps.getLineNums(), errorList, notLabour
, entity, salaryType, dept, user, entity.getSalaryStyle()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle
, entity.getSaiList())) {
, entity.getSaiList(), bankMap)) {
continue;
}
newEmps.setSalaryGiveTime(entity.getSalaryGiveTime());
......@@ -492,7 +492,7 @@ public class SalaryAccountUtil implements Serializable {
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime())
, CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())
, otherEmp.getEmpName(), entity.getSalaryStyle()
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getLineNums())) {
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getLineNums(), bankMap)) {
isContinue = false;
}
}
......@@ -539,7 +539,7 @@ public class SalaryAccountUtil implements Serializable {
, Map<String, Integer> ownDeptMap, String salaryType, Integer isIssue, List<ErrorMessage> errorList
, TSalaryAccountVo entity, TSalaryEmployee emp, List<TSalaryAccountItemVo> saiList
, boolean salaryGiveTimeFlag, boolean isNewEmployee, String empName, String salaryStyle, String nowMonth
, List<TSalaryEmployee> updateEmpList, List<TSalaryEmployee> checkBankInfoEmpList, int i) {
, List<TSalaryEmployee> updateEmpList, List<TSalaryEmployee> checkBankInfoEmpList, int i, Map<String, String> bankMap) {
TSalaryAccountItemVo sai;
String error;
if (Common.isEmpty(emp.getEmpName())) {
......@@ -630,6 +630,11 @@ public class SalaryAccountUtil implements Serializable {
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
if (bankMap.get(emp.getBankName()) == null) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行总行-不符合财务要求,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
entity.setBankName(emp.getBankName());
entity.setBankNo(emp.getBankNo());
entity.setBankProvince(String.valueOf(emp.getBankProvince()));
......@@ -637,6 +642,11 @@ public class SalaryAccountUtil implements Serializable {
entity.setBankSubName(emp.getBankSubName());
} else {
if (Common.isNotNull(emp.getBankName())) {
if (bankMap.get(emp.getBankName()) == null) {
error = "第" + (i + 2) + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-发放方式为银行发放,但是-开户行总行-不符合财务要求,请去薪酬人员查询处更新!";
errorList.add(new ErrorMessage((i + 2), error));
return true;
}
entity.setBankName(emp.getBankName());
} else {
entity.setBankName(null);
......@@ -696,7 +706,7 @@ public class SalaryAccountUtil implements Serializable {
private R<TSalaryEmployee> getNewEmp(TSalaryEmployee newEmp, int i, List<ErrorMessage> errorList, boolean notLabour
, TSalaryAccountVo entity, String salaryType, TSettleDomainSelectVo dept, YifuUser user, String salaryStyle
, boolean salaryGiveTimeFlag, String invoiceTitle, TSalaryAccountService tSalaryAccountService
, TSalaryEmployeeService tSalaryEmployeeService) {
, TSalaryEmployeeService tSalaryEmployeeService, Map<String, String> bankMap) {
String newEmpStr = "新员工";
if (!notLabour) {
newEmpStr = "劳务费";
......@@ -756,6 +766,11 @@ public class SalaryAccountUtil implements Serializable {
errorList.add(new ErrorMessage((i + 2), error));
return R.failed();
} else {
if (bankMap.get(entity.getBankName()) == null) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行总行-不符合财务要求,请去【开户行配置】菜单查询!";
errorList.add(new ErrorMessage((i + 2), error));
return R.failed();
}
newEmp.setBankName(entity.getBankName());
}
if (Common.isEmpty(entity.getBankProvince()) || Common.isEmpty(entity.getBankCity())) {
......@@ -793,6 +808,11 @@ public class SalaryAccountUtil implements Serializable {
}
} else {
if (Common.isNotNull(entity.getBankName())) {
if (bankMap.get(entity.getBankName()) == null) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行总行-不符合财务要求,请去【开户行配置】菜单查询!";
errorList.add(new ErrorMessage((i + 2), error));
return R.failed();
}
newEmp.setBankName(entity.getBankName());
}
if (Common.isNotNull(entity.getBankNo())) {
......@@ -847,7 +867,7 @@ public class SalaryAccountUtil implements Serializable {
private boolean setNewEmpBase(TSalaryEmployee newEmp, int i, List<ErrorMessage> errorList, boolean notLabour
, TSalaryAccountVo entity, String salaryType, TSettleDomainSelectVo dept, YifuUser user, String salaryStyle
, boolean salaryGiveTimeFlag, String invoiceTitle, List<TSalaryAccountItemVo> saiList) {
, boolean salaryGiveTimeFlag, String invoiceTitle, List<TSalaryAccountItemVo> saiList, Map<String, String> bankMap) {
String newEmpStr = "新员工";
if (!notLabour) {
newEmpStr = "劳务费";
......@@ -914,6 +934,11 @@ public class SalaryAccountUtil implements Serializable {
errorList.add(new ErrorMessage((i + 2), error));
return false;
} else {
if (bankMap.get(entity.getBankName()) == null) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行总行-不符合财务要求,请去【开户行配置】菜单查询!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
newEmp.setBankName(entity.getBankName());
}
if (Common.isEmpty(entity.getBankProvince()) || Common.isEmpty(entity.getBankCity())) {
......@@ -951,6 +976,11 @@ public class SalaryAccountUtil implements Serializable {
}
} else {
if (Common.isNotNull(entity.getBankName())) {
if (bankMap.get(entity.getBankName()) == null) {
error = "第" + (i + 2) + "行:" + newEmpStr + "-开户行总行-不符合财务要求,请去【开户行配置】菜单查询!";
errorList.add(new ErrorMessage((i + 2), error));
return false;
}
newEmp.setBankName(entity.getBankName());
}
if (Common.isNotNull(entity.getBankNo())) {
......
......@@ -184,6 +184,7 @@ public class SalaryConstants {
public static final String DATA_MUST = "未获取到表格数据!";
public static final String ID_CARD_MUST = "身份证不可为空!";
public static final String NOT_HAVE_EMP = "根据身份证、项目编码未找到人员!";
public static final String BANK_NAME_ERROR = "开户行总行错误,不符合财务要求,请查询开户行配置!";
public static final String PROVINCE_ERROR = "开户行省错误!";
public static final String CITY_ERROR = "开户行市错误!";
public static final String CUR_TAX_INFO = "当前项目薪酬人员已维护计税月份,计税月份沿用系统原值,其他字段已更新!";
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ 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)
~
-->
<!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.TBankSetMapper">
<resultMap id="tBankSetMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TBankSet">
<id property="id" column="ID"/>
<result property="bankName" column="BANK_NAME"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.BANK_NAME,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME,
a.DELETE_FLAG
</sql>
<sql id="tBankSet_where">
<if test="tBankSet != null">
<if test="tBankSet.id != null and tBankSet.id.trim() != ''">
AND a.ID = #{tBankSet.id}
</if>
<if test="tBankSet.bankName != null and tBankSet.bankName.trim() != ''">
AND a.BANK_NAME like concat('%', #{tBankSet.bankName},'%')
</if>
<if test="tBankSet.createBy != null and tBankSet.createBy.trim() != ''">
AND a.CREATE_BY = #{tBankSet.createBy}
</if>
<if test="tBankSet.createName != null and tBankSet.createName.trim() != ''">
AND a.CREATE_NAME = #{tBankSet.createName}
</if>
<if test="tBankSet.createTime != null">
AND a.CREATE_TIME = #{tBankSet.createTime}
</if>
<if test="tBankSet.updateBy != null and tBankSet.updateBy.trim() != ''">
AND a.UPDATE_BY = #{tBankSet.updateBy}
</if>
<if test="tBankSet.updateTime != null">
AND a.UPDATE_TIME = #{tBankSet.updateTime}
</if>
</if>
</sql>
<!--tBankSet简单分页查询-->
<select id="getTBankSetPage" resultMap="tBankSetMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bank_set a
<where>
a.DELETE_FLAG = '0'
<include refid="tBankSet_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!--list-->
<select id="getTBankSetList" resultType="java.lang.String">
SELECT
a.BANK_NAME
FROM t_bank_set a
where a.DELETE_FLAG = '0'
<if test="bankName != null and bankName.trim() != ''">
and a.BANK_NAME = #{bankName}
</if>
order by a.CREATE_TIME desc
</select>
</mapper>
......@@ -112,11 +112,11 @@ public class TDispatchInfo extends BaseEntity {
/**
* 员工电话 (手机号码)
*/
@Length(max = 32, message = "员工电话 不能超过32个字符" )
@ExcelAttribute(name = "员工电话", maxLength = 32)
@Schema(description = "员工电话" )
@Length(max = 32, message = "手机号码 不能超过32个字符" )
@ExcelAttribute(name = "手机号码", maxLength = 32)
@Schema(description = "手机号码" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工电话" )
@ExcelProperty("手机号码" )
private String empMobile;
/**
* 民族
......
......@@ -69,6 +69,13 @@ public class FundHandleExportVo implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号码" )
private String empMobile;
@ExcelAttribute(name = "身份证所在地")
@Schema(description = "身份证所在地" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证所在地" )
private String idCardAddress;
/**
* 创建人姓名
*/
......
......@@ -153,6 +153,13 @@ public class SocialHandleExportVo implements Serializable {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号码" )
private String empMobile;
@ExcelAttribute(name = "身份证所在地")
@Schema(description = "身份证所在地" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证所在地" )
private String idCardAddress;
/**
* 户口性质
*/
......
......@@ -76,6 +76,18 @@ public class TDispatchAuditExportVo {
@ExcelProperty("项目名称")
private String settleDomainName;
@ExcelAttribute(name = "手机号码", maxLength = 32)
@Schema(description = "手机号码" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号码" )
private String empMobile;
@ExcelAttribute(name = "身份证所在地")
@Schema(description = "身份证所在地" )
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证所在地" )
private String idCardAddress;
@ExcelAttribute(name = "社保户", maxLength = 50)
@Schema(description = "社保户")
@HeadFontStyle(fontHeightInPoints = 11)
......
......@@ -70,4 +70,12 @@ public class TPaymentInfoSearchVo extends TPaymentInfo {
@Schema(description = "查询limit 数据条数")
private int limitEnd;
/**
* @Author fxj
* 区域查询辅助字段:0 不包含下级 1 包含下级
**/
@Schema(description = "0 不包含下级 1 包含下级")
private String areaFlag;
}
......@@ -21,8 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
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.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.ResultConstants;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -47,6 +50,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -312,7 +316,29 @@ public class TDispatchInfoController {
@PostMapping("/importListAdd")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-import')")
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 {
if (Common.isNotNull(requestId)) {
//主动释放锁
return tDispatchInfoService.importDiy(file.getInputStream(),orderId);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
......@@ -377,7 +403,49 @@ public class TDispatchInfoController {
@PostMapping("/importListReduce")
//@PreAuthorize("@pms.hasPermission('demo_tdispatchinfo-batch-reduce')")
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 {
if (Common.isNotNull(requestId)) {
//主动释放锁
return tDispatchInfoService.importReduceDiy(file.getInputStream(),orderId);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
* @Author huyc
* @Description 单个派减
* @Date 16:54 2023/3/9
* @Param
* @return
**/
@Operation(description = "单个派减")
@SysLog("单个派减")
@PostMapping("/reduceSocialAndFund")
public R<List<ErrorMessage>> reduceSocialAndFund(@RequestBody TDispatchReduceVo excelVOList,
@RequestParam(required = false) String orderId) {
List<TDispatchReduceVo> list = new ArrayList<>();
list.add(excelVOList);
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
tDispatchInfoService.batchReduceDispatch(list, errorMessageList, user, orderId);
return R.ok(errorMessageList);
}
/**
......@@ -501,4 +569,19 @@ public class TDispatchInfoController {
}
return new SocialAndFundReduceVo();
}
/**
* @param importVo
* @Description: 单个派增
* @Author: hgw
* @Date: 2023/3/10 15:35
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
@Operation(summary = "单个派增 权限:social_dispatchinfo_add", description = "单个派增")
@PostMapping("/dispatchAdd")
@PreAuthorize("@pms.hasPermission('social_dispatchinfo_add')")
public R<List<ErrorMessage>> dispatchAdd(@RequestBody TDispatchImportVo importVo) {
return tDispatchInfoService.dispatchAdd(importVo);
}
}
......@@ -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.toolkit.Wrappers;
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.R;
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.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.salary.vo.HaveSalaryNoSocialSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentBySalaryVo;
......@@ -148,7 +155,28 @@ public class TPaymentInfoController {
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
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 {
if (Common.isNotNull(requestId)) {
return tPaymentInfoService.importSocialDiy(file.getInputStream());
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
......@@ -163,7 +191,28 @@ public class TPaymentInfoController {
@PostMapping("/importListSocialHeFei")
public R<List<ErrorDetailVO>> importListSocialHeFei(@RequestBody MultipartFile file, @RequestParam String random,
@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 {
if (Common.isNotNull(requestId)) {
return tPaymentInfoService.importSocialHeFeiDiy(file.getInputStream(), random, type);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
......@@ -178,7 +227,28 @@ public class TPaymentInfoController {
@PostMapping("/batchImportPaymentFundInfo")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
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 {
if (Common.isNotNull(requestId)) {
return tPaymentInfoService.batchImportPaymentFundInfo(file.getInputStream());
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
}
/**
......
......@@ -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.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.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
......@@ -240,31 +242,46 @@ public class TPreDispatchInfoController {
if (null == user || null == user.getId()) {
return R.failed(CommonConstants.USER_FAIL);
}
ExcelUtil<TPreDispatchInfo> util1 = null;
// 获取redis分布式事务锁
String key = CacheConstants.PAYMENT_PRE_DISPATCH_BATCH_ADD_IMPORT + CommonConstants.DOWN_LINE_STRING + user.getId();
String requestId;
try {
jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", "");
util1 = new ExcelUtil<>(TPreDispatchInfo.class);
util1.getJsonStringToList(jsonString, null);
List<TPreDispatchInfo> listInfo = util1.getEntityList();
//用于返回错误信息
List<ErrorMessage> errorInfo = new ArrayList<>();
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
for (ErrorMessage errorMessage: util1.getErrorInfo()) {
errorInfo.add(errorMessage);
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
if (Common.isNotNull(requestId)) {
ExcelUtil<TPreDispatchInfo> util1 = null;
try {
jsonString = URLDecoder.decode(jsonString, CommonConstants.UTF8).replace("=", "");
util1 = new ExcelUtil<>(TPreDispatchInfo.class);
util1.getJsonStringToList(jsonString, null);
List<TPreDispatchInfo> listInfo = util1.getEntityList();
//用于返回错误信息
List<ErrorMessage> errorInfo = new ArrayList<>();
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
for (ErrorMessage errorMessage: util1.getErrorInfo()) {
errorInfo.add(errorMessage);
}
}
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchSavePreDisPatchAdd(listInfo, user,socialHouse,fundHouse,
departId,errorInfo);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
}
List<ErrorMessage> newErrorList = errorInfo.stream().sorted(Comparator.comparing(ErrorMessage::getLineNum))
.collect(Collectors.toList());
return R.ok(newErrorList);
} catch (Exception e) {
e.printStackTrace();
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
}finally {
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
}
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchSavePreDisPatchAdd(listInfo, user,socialHouse,fundHouse,
departId,errorInfo);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
}
List<ErrorMessage> newErrorList = errorInfo.stream().sorted(Comparator.comparing(ErrorMessage::getLineNum))
.collect(Collectors.toList());
return R.ok(newErrorList);
} catch (Exception e) {
e.printStackTrace();
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
} else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
}
......
......@@ -44,7 +44,7 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
* @param tPaymentInfo 缴费库
* @return
*/
IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, @Param("tPaymentInfo") TPaymentInfo tPaymentInfo);
IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, @Param("tPaymentInfo") TPaymentInfoSearchVo tPaymentInfo);
/**
* 缴费库简单分页查询
......
......@@ -33,6 +33,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
/**
* 派单信息记录表
*
......@@ -61,7 +63,7 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
@ShardingTransactionType(TransactionType.BASE)
void importTDispatchInfo(List<TDispatchImportVo> excelVOList,
List<ErrorMessage> errorMessageList,
YifuUser user, String orderId);
YifuUser user, String orderId, Map<String, String> idCardMap);
R<List<ErrorMessage>> importReduceDiy(InputStream inputStream, String orderId);
......@@ -98,4 +100,12 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
**/
SocialAndFundReduceVo getSocialAndFundReduceInfo(String empId);
/**
* @param importVo
* @Description: 单个派增
* @Author: hgw
* @Date: 2023/3/10 15:46
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
R<List<ErrorMessage>> dispatchAdd(TDispatchImportVo importVo);
}
......@@ -42,7 +42,7 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
* @param tPaymentInfo 缴费库
* @return
*/
IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfo tPaymentInfo);
IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo);
/**
* 缴费库批量导入社保
......
......@@ -1914,16 +1914,14 @@ public class TForecastLibraryServiceImpl extends ServiceImpl<TForecastLibraryMap
}
}
}
if (Common.isNotNull(socialFundInfo.getSocialId())
&& CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
if (Common.isNotNull(socialFundInfo.getSocialId()) && CommonConstants.FOUR_STRING.equals(socialFundInfo.getSocialStatus())
|| CommonConstants.THREE_STRING.equals(socialFundInfo.getSocialStatus())) {
//获取所有的预估数据
List<TForecastLibrary> librarySocialInfoList1 = new ArrayList<>();
List<TForecastLibrary> librarySocialInfoList = baseMapper.selectList(Wrappers.<TForecastLibrary>query().lambda()
.eq(TForecastLibrary::getEmpIdcard, empIdCard)
.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
//.eq(TForecastLibrary::getDataType, CommonConstants.ZERO_INT)
.eq(TForecastLibrary::getSettleDomainId, socialFundInfo.getSettleDomain())
.in(TForecastLibrary::getSocialPayMonth, payMonthList));
if (Common.isNotNull(librarySocialInfoList)) {
......
......@@ -35,9 +35,12 @@ 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.vo.TSettleDomainListVo;
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.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
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.vo.ErrorDetailVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -142,7 +145,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
* @return
*/
@Override
public IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfo tPaymentInfo) {
public IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
return baseMapper.getTPaymentInfoPage(page, tPaymentInfo);
}
......@@ -269,7 +272,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public R<Boolean> removeInFoById(String id) {
YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH;
String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING +user.getId() ;
if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!");
}
......@@ -297,7 +300,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH;
String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING +user.getId() ;
if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!");
}
......@@ -339,7 +342,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String socialCreateMonth, String socialPayMonth) {
YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH;
String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING +user.getId() ;
if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中禁止删除!");
}
......@@ -2813,31 +2816,43 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
public R<Boolean> pushPaymentSocialFundInfo(TPaymentInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_PUSH;
String key = CacheConstants.PAYMENT_SOCIAL_PUSH + CommonConstants.DOWN_LINE_STRING +user.getId() ;
if (Common.isNotNull(redisUtil.get(key))) {
return R.failed("用户正在推送实缴数据中,禁止重复推送!");
} else {
redisUtil.set(key, user.getId(), 1200L);
}
Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap();
//手动推送未推送的社保公积金明细数据
createPaymentSocialInfoReal(user, searchVo, mapSelectVo);
createPaymentFundInfoReal(user, searchVo, mapSelectVo);
//推送社保公积金收入数据
String redisKey = String.valueOf(UUID.randomUUID()).replaceAll("-", "") + "_incomePush";
createPaymentInfoIncomeReal(user, searchVo, mapSelectVo, redisKey);
createPaymentFundIncomeReal(user, searchVo, mapSelectVo, redisKey);
//推送失败的数据重新推送
if (Common.isNotNull(redisUtil.get(redisKey))) {
List<TIncome> list = (List<TIncome>) redisUtil.get(redisKey);
for (TIncome income : list) {
doJointSocialTask.asynchronousEkpIncomePaymentT(income);
// 获取redis分布式事务锁
String requestId;
try {
requestId = RedisDistributedLock.getLock(key,"10");
} catch (Exception e) {
throw new RuntimeException(ResultConstants.NO_GETLOCK_DATA+CommonConstants.DOWN_LINE_STRING+e.getMessage());
}
if (Common.isNotNull(requestId)) {
Map<String, TSettleDomainSelectVo> mapSelectVo = this.getSelectVoMap();
//手动推送未推送的社保公积金明细数据
createPaymentSocialInfoReal(user, searchVo, mapSelectVo);
createPaymentFundInfoReal(user, searchVo, mapSelectVo);
//推送社保公积金收入数据
String redisKey = String.valueOf(UUID.randomUUID()).replaceAll("-", "") + "_incomePush";
createPaymentInfoIncomeReal(user, searchVo, mapSelectVo, redisKey);
createPaymentFundIncomeReal(user, searchVo, mapSelectVo, redisKey);
//推送失败的数据重新推送
if (Common.isNotNull(redisUtil.get(redisKey))) {
List<TIncome> list = (List<TIncome>) redisUtil.get(redisKey);
for (TIncome income : list) {
doJointSocialTask.asynchronousEkpIncomePaymentT(income);
}
redisUtil.remove(redisKey);
}
redisUtil.remove(redisKey);
redisUtil.remove(key);
//主动释放锁
RedisDistributedLock.unlock(key, requestId);
return R.ok();
}else {
return R.failed(ResultConstants.NO_GETLOCK_DATA);
}
redisUtil.remove(key);
return R.ok();
}
@Override
......
......@@ -382,7 +382,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
}
// 档案地市没问题 开始派单处理
if (errorMessageList.size() == CommonConstants.ZERO_INT) {
dispatchInfoService.importTDispatchInfo(importVoList, errorMessageList, user, null);
dispatchInfoService.importTDispatchInfo(importVoList, errorMessageList, user, null, new HashMap<>());
}
// 处理派增结果
errorMessage = handleDispatchAddRes(preInfo, errorMessageList);
......@@ -2544,7 +2544,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
}
// 档案地市没问题 开始派单处理
if (!Common.isNotNull(errorMessageList)){
dispatchInfoService.importTDispatchInfo(importVoList, errorMessageList, user, null);
dispatchInfoService.importTDispatchInfo(importVoList, errorMessageList, user, null, new HashMap<>());
}
// 处理派增结果
handleDispatchAddRes(pre, errorMessageList);
......
......@@ -178,6 +178,9 @@
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="belongUnitName" column="BELONG_UNIT_NAME"/>
<result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
<result property="empMobile" column="EMP_MOBILE"/>
<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
<result property="type" column="TYPE"/>
<result property="socialHouseholdName" column="SOCIAL_HOUSEHOLD_NAME"/>
<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
......@@ -818,6 +821,8 @@
select
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_MOBILE,
a.ID_CARD_ADDRESS,
a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.TYPE,
......@@ -880,6 +885,7 @@
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="empType" column="EMP_TYPE"/>
<result property="empMobile" column="EMP_MOBILE"/>
<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
<result property="empNational" column="EMP_NATIONAL"/>
<result property="type" column="TYPE"/>
<result property="settleDomain" column="SETTLE_DOMAIN_NAME"/>
......@@ -927,6 +933,7 @@
<result property="belongUnit" column="BELONG_UNIT_NAME"/>
<result property="settleDomain" column="SETTLE_DOMAIN_NAME"/>
<result property="empMobile" column="EMP_MOBILE"/>
<result property="idCardAddress" column="ID_CARD_ADDRESS"/>
<result property="createUserName" column="CREATE_NAME"/>
<result property="providentHouseholdName" column="PROVIDENT_HOUSEHOLD_NAME"/>
......@@ -969,6 +976,7 @@
a.EMP_TYPE,
a.POST,
a.EMP_MOBILE,
a.ID_CARD_ADDRESS,
a.EMP_REGIS_TYPE,
a.EMP_NATIONAL,
a.WORKING_HOURS,
......@@ -1043,6 +1051,7 @@
a.BELONG_UNIT_NAME,
a.SETTLE_DOMAIN_NAME,
a.EMP_MOBILE,
a.ID_CARD_ADDRESS,
a.CREATE_NAME,
a.PROVIDENT_HOUSEHOLD_NAME,
......
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