Commit b0cc4f7a authored by huyuchen's avatar huyuchen

预派单 代码修改

parent 4dea8708
......@@ -275,6 +275,8 @@ public interface CommonConstants {
String DATA_CAN_NOT_EMPTY = "数据不可为空";
String NO_DATA_TO_HANDLE = "无数据可操作!";
String PLEASE_LOG_IN = "请登录!";
String SEX_MAN = "1";
......
package com.yifu.cloud.plus.v1.yifu.common.core.redis;
/**
* @program: master
* @description: 分布式锁
* @author: pwang
* @create: 2020-06-01 15:51
**/
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.scripting.support.ResourceScriptSource;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* redis分布式式锁
*
* @Author pwang
* @Date 2020-06-02 14:53
* @return
**/
@Slf4j
public class RedisDistributedLock {
private static final StringRedisTemplate redisTemplate = SpringContextHolder.getBean(StringRedisTemplate.class);
private static final DefaultRedisScript<Long> LOCK_SCRIPT;
private static final DefaultRedisScript<Object> UNLOCK_SCRIPT;
private static String prefix = "RedisDistributedLock_";
static {
// 加载释放锁的脚本
LOCK_SCRIPT = new DefaultRedisScript<>();
LOCK_SCRIPT.setScriptSource(new ResourceScriptSource(new ClassPathResource("lock.lua")));
LOCK_SCRIPT.setResultType(Long.class);
// 加载释放锁的脚本
UNLOCK_SCRIPT = new DefaultRedisScript<>();
UNLOCK_SCRIPT.setScriptSource(new ResourceScriptSource(new ClassPathResource("unlock.lua")));
}
/**
* 获取锁
*
* @param lockName 锁名称
* @param releaseTime 超时时间(单位:秒)
* @return key 解锁标识
*/
public static String getLock(String lockName, String releaseTime) {
// 存入的线程信息的前缀,防止与其它JVM中线程信息冲突
String key = UUID.randomUUID().toString();
// 执行脚本
Long result = redisTemplate.execute(
LOCK_SCRIPT,
Collections.singletonList(prefix.concat(lockName)),
key + Thread.currentThread().getId(), releaseTime);
// 判断结果
if (result != null && result.intValue() == 1) {
return key;
} else {
return null;
}
}
/**
* 默认三秒过期
* @Author pwang
* @Date 2021-07-30 18:00
* @param lockName
* @return
**/
public static String getLock(String lockName) {
return getLock(lockName,"3");
}
/**
* 释放锁
*
* @param lockName 锁名称
* @param key 解锁标识
*/
public static void unlock(String lockName, String key) {
// 执行脚本
redisTemplate.execute(
UNLOCK_SCRIPT,
Collections.singletonList(prefix.concat(lockName)),
key + Thread.currentThread().getId(), null);
}
/**
* 锁在给定的等待时间内空闲,则获取锁成功 返回true, 否则返回false,作为阻塞式锁使用
*
* @param key 锁键
* @param releaseTime 超时时间(单位:秒)
* @param timeout 尝试获取锁时长,建议传递500,结合实践单位,则可表示500毫秒
* @param unit,建议传递TimeUnit.MILLISECONDS
* @return requestId
* @throws InterruptedException
*/
public static String tryLock(String key, String releaseTime, long timeout, TimeUnit unit) throws InterruptedException {
//纳秒
long begin = System.nanoTime();
if (null == unit) {
unit = TimeUnit.MILLISECONDS;
}
do {
//LOGGER.debug("{}尝试获得{}的锁.", value, key);
String result = getLock(key, releaseTime);
if (Common.isNotNull(result)) {
/* log.debug(value + "-成功获取{}的锁,设置锁过期时间为{}秒 ", key, timeout);*/
return result;
} else {
// 存在锁 ,但可能获取不到,原因是获取的一刹那间
}
if (timeout == 0) {
break;
}
//在其睡眠的期间,锁可能被解,也可能又被他人占用,但会尝试继续获取锁直到指定的时间
Thread.sleep(10);
} while ((System.nanoTime() - begin) < unit.toNanos(timeout));
//因超时没有获得锁
return null;
}
/**
* 默认保存时间3秒,锁获取时间3000毫秒
* @Author pwang
* @Date 2020-06-02 15:00
* @param key
* @return
**/
public static String tryLock(String key) throws InterruptedException {
return tryLock(key, "3", 3000, null);
}
/**
* @param key
* @param time
* @Author: wangan
* @Date: 2020/9/30
* @Description: 审批时间较长。需要设置超过3秒时间
* @return: java.lang.String
**/
public static String tryLockAndTime(String key,String time) throws InterruptedException {
return tryLock(key, time, 3000, null);
}
}
package com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @description: 社保导入线程池初始化配置
* @author: wangweiguo
* @date: 2021/6/30
*/
public class YFSocialImportThreadPoolExecutor extends ThreadPoolExecutor {
private static final int CORE_POOL_SIZE = 8;
private static final int MAX_POOL_SIZE = 12;
private static final long KEEP_ALIVE_TIME = 15;
private static final int CAPACITY = 1024;
/**
* @description: 社保导入线程池构造方法
* @param yfThreadFactory
* @return:
* @author: wangweiguo
* @date: 2021/8/4
*/
public YFSocialImportThreadPoolExecutor(YFThreadFactory yfThreadFactory) {
super(CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<>(CAPACITY), yfThreadFactory, (runnable, executor) -> {
try {
final Thread t = new Thread(runnable, "Temporary task executor");
t.start();
} catch (Throwable e) {
throw new RejectedExecutionException(
"Failed to start a new thread", e);
}
});
}
/**
* @description: 获取剩余可以添加的任务数量
* @return: int
* @author: wangweiguo
* @date: 2021/8/4
*/
public int getResidualCapacity() {
return CAPACITY - this.getQueue().size() + this.getPoolSize() - this.getActiveCount();
}
}
package com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @description:
* @author: wangweiguo
* @date: 2021/6/30
*/
public class YFThreadFactory implements ThreadFactory {
private final AtomicInteger poolNumber = new AtomicInteger(1);
private final ThreadGroup threadGroup;
private final AtomicInteger threadNumber = new AtomicInteger(1);
public final String namePrefix;
YFThreadFactory(String name){
SecurityManager s = System.getSecurityManager();
threadGroup = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
if (null==name || "".equals(name.trim())){
name = "pool";
}
namePrefix = name +"-"+
poolNumber.getAndIncrement() +
"-thread-";
}
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(threadGroup, r,
namePrefix + threadNumber.getAndIncrement(),
0);
if (t.isDaemon())
t.setDaemon(false);
if (t.getPriority() != Thread.NORM_PRIORITY)
t.setPriority(Thread.NORM_PRIORITY);
return t;
}
}
package com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @description: 线程池配置添加到spring管理,并初始化线程池名称
* @author: wangweiguo
* @date: 2021/6/30
*/
@Configuration
public class YFThreadPoolConfig {
@Bean(name = "yfSocialImportThreadPoolExecutor")
YFSocialImportThreadPoolExecutor yfSocialImportThreadPoolExecutor(@Qualifier("yfThreadFactory") YFThreadFactory yfThreadFactory) {
return new YFSocialImportThreadPoolExecutor(yfThreadFactory);
}
@Bean(name = "yfThreadFactory")
YFThreadFactory yfThreadFactory() {
return new YFThreadFactory("social_import");
}
}
......@@ -372,4 +372,223 @@ public class TPaymentInfo extends BaseEntity {
@ExcelProperty("财务账单ID")
private String financeBillId;
/**
* 单位社保补缴利息
*/
@ExcelAttribute(name = "单位社保补缴利息" )
@ExcelProperty("单位社保补缴利息")
private BigDecimal companyAccrual;
/**
* 个人社保补缴利息
*/
@ExcelAttribute(name = "个人社保补缴利息" )
@ExcelProperty("个人社保补缴利息")
private BigDecimal personalAccrual;
/**
* 单位养老基数
*/
@ExcelAttribute(name = "单位养老基数" )
@ExcelProperty("单位养老基数")
private BigDecimal unitPensionSet;
/**
* 单位医疗基数
*/
@ExcelAttribute(name = "单位医疗基数" )
@ExcelProperty("单位医疗基数")
private BigDecimal unitMedicalSet;
/**
* 单位失业基数
*/
@ExcelAttribute(name = "单位失业基数" )
@ExcelProperty("单位失业基数")
private BigDecimal unitUnemploymentSet;
/**
* 单位工伤基数
*/
@ExcelAttribute(name = "单位工伤基数" )
@ExcelProperty("单位工伤基数")
private BigDecimal unitInjurySet;
/**
* 单位生育基数
*/
@ExcelAttribute(name = "单位生育基数" )
@ExcelProperty("单位生育基数")
private BigDecimal unitBirthSet;
/**
* 个人养老基数
*/
@ExcelAttribute(name = "个人养老基数" )
@ExcelProperty("个人养老基数")
private BigDecimal personalPensionSet;
/**
* 个人医疗基数
*/
@ExcelAttribute(name = "个人医疗基数" )
@ExcelProperty("个人医疗基数")
private BigDecimal personalMedicalSet;
/**
* 个人失业基数
*/
@ExcelAttribute(name = "个人失业基数" )
@ExcelProperty("个人失业基数")
private BigDecimal personalUnemploymentSet;
/**
* 单位养老比例
*/
@ExcelAttribute(name = "单位养老比例" )
@ExcelProperty("单位养老比例")
private BigDecimal unitPensionPer;
/**
* 单位医疗比例
*/
@ExcelAttribute(name = "单位医疗比例" )
@ExcelProperty("单位医疗比例")
private BigDecimal unitMedicalPer;
/**
* 单位失业比例
*/
@ExcelAttribute(name = "单位失业比例" )
@ExcelProperty("单位失业比例")
private BigDecimal unitUnemploymentPer;
/**
* 单位工伤比例
*/
@ExcelAttribute(name = "单位工伤比例" )
@ExcelProperty("单位工伤比例")
private BigDecimal unitInjuryPer;
/**
* 单位生育比例
*/
@ExcelAttribute(name = "单位生育比例" )
@ExcelProperty("单位生育比例")
private BigDecimal unitBirthPer;
/**
* 个人养老比例
*/
@ExcelAttribute(name = "个人养老比例" )
@ExcelProperty("个人养老比例")
private BigDecimal personalPensionPer;
/**
* 个人医疗比例
*/
@ExcelAttribute(name = "个人医疗比例" )
@ExcelProperty("个人医疗比例")
private BigDecimal personalMedicalPer;
/**
* 个人失业比例
*/
@ExcelAttribute(name = "个人失业比例" )
@ExcelProperty("个人失业比例")
private BigDecimal personalUnemploymentPer;
/**
* 单位大病比例
*/
@ExcelAttribute(name = "单位大病比例" )
@ExcelProperty("单位大病比例")
private BigDecimal unitBigailmentPer;
/**
* 个人大病比例
*/
@ExcelAttribute(name = "个人大病比例" )
@ExcelProperty("个人大病比例")
private BigDecimal personalBigailmentPer;
/**
* 单位养老金额
*/
@ExcelAttribute(name = "单位养老金额" )
@ExcelProperty("单位养老金额")
private BigDecimal unitPensionMoney;
/**
* 单位医疗金额
*/
@ExcelAttribute(name = "单位医疗金额" )
@ExcelProperty("单位医疗金额")
private BigDecimal unitMedicalMoney;
/**
* 单位失业金额
*/
@ExcelAttribute(name = "单位失业金额" )
@ExcelProperty("单位失业金额")
private BigDecimal unitUnemploymentMoney;
/**
* 单位工伤金额
*/
@ExcelAttribute(name = "单位工伤金额" )
@ExcelProperty("单位工伤金额")
private BigDecimal unitInjuryMoney;
/**
* 单位生育金额
*/
@ExcelAttribute(name = "单位生育金额" )
@ExcelProperty("单位生育金额")
private BigDecimal unitBirthMoney;
/**
* 单位大病金额
*/
@ExcelAttribute(name = "单位大病金额" )
@ExcelProperty("单位大病金额")
private BigDecimal unitBigmailmentMoney;
/**
* 个人养老金额
*/
@ExcelAttribute(name = "个人养老金额" )
@ExcelProperty("个人养老金额")
private BigDecimal personalPensionMoney;
/**
* 个人医疗金额
*/
@ExcelAttribute(name = "个人医疗金额" )
@ExcelProperty("个人医疗金额")
private BigDecimal personalMedicalMoney;
/**
* 个人失业金额
*/
@ExcelAttribute(name = "个人失业金额" )
@ExcelProperty("个人失业金额")
private BigDecimal personalUnemploymentMoney;
/**
* 个人大病金额
*/
@ExcelAttribute(name = "个人大病金额" )
@ExcelProperty("个人大病金额")
private BigDecimal personalBigmailmentMoney;
/**
* 公积金编号
*/
@ExcelAttribute(name = "公积金编号" , maxLength = 50 )
@Size(max = 50, message = "公积金编号不可超过50位")
@ExcelProperty("公积金编号")
private String providentNo;
/**
* 单位公积金基数
*/
@ExcelAttribute(name = "单位公积金基数" )
@ExcelProperty("单位公积金基数")
private BigDecimal unitProvidentSet;
/**
* 单边公积金比例
*/
@ExcelAttribute(name = "单边公积金比例" )
@ExcelProperty("单边公积金比例")
private BigDecimal providentPercent;
/**
* 单位公积金费用
*/
@ExcelAttribute(name = "单位公积金费用" )
@ExcelProperty("单位公积金费用")
private BigDecimal unitProvidentSum;
/**
* 个人公积金基数
*/
@ExcelAttribute(name = "个人公积金基数" )
@ExcelProperty("个人公积金基数")
private BigDecimal personalProidentSet;
/**
* 个人公积金费用
*/
@ExcelAttribute(name = "个人公积金费用" )
@ExcelProperty("个人公积金费用")
private BigDecimal personalProvidentSum;
}
/*
* 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.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
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.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
/**
* @author huyc
* @date 2022-07-25 14:08:58
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_payment_info_import_log")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "")
public class TPaymentInfoImportLog extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
private Integer id;
/**
* 姓名
*/
@ExcelAttribute(name = "姓名", maxLength = 50)
@Length(max = 50, message = "姓名不能超过50个字符")
@ExcelProperty("姓名")
private String empName;
/**
* 身份证号
*/
@ExcelAttribute(name = "身份证号", maxLength = 32)
@Length(max = 32, message = "身份证号不能超过32个字符")
@ExcelProperty("身份证号")
private String idCard;
/**
* 错误信息
*/
@ExcelAttribute(name = "错误信息", maxLength = 500)
@Length(max = 500, message = "错误信息不能超过500个字符")
@ExcelProperty("错误信息")
private String errMsg;
/**
* 问题行数
*/
@ExcelAttribute(name = "问题行数")
@ExcelProperty("问题行数")
private Integer line;
/**
* 导入标识key
*/
@ExcelAttribute(name = "导入标识key", maxLength = 64)
@Length(max = 64, message = "导入标识key不能超过64个字符")
@ExcelProperty("导入标识key")
private String randomKey;
}
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
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 java.io.Serializable;
import java.math.BigDecimal;
/**
* @ClassName TPaymentHeFeiVo
* @Description 合肥三险导入 养老 工伤 失业 生育
* @author huyc
* @date 2022-07-26 17:01:22
*/
@Data
public class TPaymentHeFeiVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@Length(max = 20, message = "员工姓名不能超过20个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 员工编码
*/
@Length(max = 32, message = "员工编码不能超过32个字符")
@ExcelAttribute(name = "员工编码", maxLength = 32)
@Schema(description = "员工编码")
@ExcelProperty("员工编码")
private String empNo;
/**
* 员工ID
*/
@Length(max = 32, message = "员工ID不能超过32个字符")
@ExcelAttribute(name = "员工ID", maxLength = 32)
@Schema(description = "员工ID")
@ExcelProperty("员工ID")
private String empId;
/**
* 员工身份证
*/
@Length(max = 100, message = "不能超过100个字符")
@ExcelAttribute(name = "身份证号", isNotEmpty = true, maxLength = 100,errorInfo = "身份证字段不可为空!")
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 社保编号
*/
@Length(max = 20, message = "社保编号不能超过20个字符")
@ExcelAttribute(name = "社保编号", maxLength = 20)
@Schema(description = "社保编号")
@ExcelProperty("社保编号")
private String socialSecurityNo;
/**
* 社保缴纳地
*/
@Length(max = 50, message = "社保缴纳地不能超过50个字符")
@ExcelAttribute(name = "社保缴纳地", isNotEmpty = true, errorInfo = "社保缴纳地不可为空", maxLength = 50)
@Schema(description = "社保缴纳地")
@ExcelProperty("社保缴纳地")
private String socialPayAddr;
/**
* 社保缴纳地-省
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保缴纳地-省", maxLength = 32, isDataId = true, isArea = true, parentField = "")
@Schema(description = "社保缴纳地-省")
@ExcelProperty("社保缴纳地-省")
private Integer socialProvince;
/**
* 社保缴纳地-市
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保缴纳地-市", maxLength = 32, isDataId = true, isArea = true, parentField = "socialProvince")
@Schema(description = "社保缴纳地-市")
@ExcelProperty("社保缴纳地-市")
private Integer socialCity;
/**
* 社保缴纳地-县
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保缴纳地-县", maxLength = 32, isDataId = true, isArea = true, parentField = "socialCity")
@Schema(description = "社保缴纳地-县")
@ExcelProperty("社保缴纳地-县")
private Integer socialTown;
/**
* 社保缴纳月份empNo
*/
@Length(max = 6, message = "社保缴纳月份不能超过6个字符")
@ExcelAttribute(name = "社保缴纳月份", isNotEmpty = true, errorInfo = "社保缴纳月份不可为空", maxLength = 6)
@Schema(description = "社保缴纳月份")
@ExcelProperty("社保缴纳月份")
private String socialPayMonth;
/**
* 社保生成月份
*/
@Length(max = 6, message = "社保生成月份不能超过6个字符")
@ExcelAttribute(name = "社保生成月份", isNotEmpty = true, errorInfo = "社保生成月份不可为空", maxLength = 6)
@Schema(description = "社保生成月份")
@ExcelProperty("社保生成月份")
private String socialCreateMonth;
/**
* 参保险种: 养老保险,失业保险, 工伤保险
*/
@ExcelAttribute(name = "参保险种")
@Schema(description = "参保险种")
@ExcelProperty("参保险种")
private String riskType;
/**
* 个人缴费基数
*/
@ExcelAttribute(name = "个人缴费基数")
@Schema(description = "个人缴费基数")
@ExcelProperty("个人缴费基数")
private BigDecimal personalSet;
/**
* 单位缴费基数
*/
@ExcelAttribute(name = "单位缴费基数")
@Schema(description = "单位缴费基数")
@ExcelProperty("单位缴费基数")
private BigDecimal unitSet;
/**
* 个人缴费额
*/
@ExcelAttribute(name = "个人缴费额")
@Schema(description = "个人缴费额")
@ExcelProperty("个人缴费额")
private BigDecimal personalMoney;
/**
* 单位缴费额
*/
@ExcelAttribute(name = "单位缴费额")
@Schema(description = "单位缴费额")
@ExcelProperty("单位缴费额")
private BigDecimal unitMoney;
/**
* 医保基数
*/
@ExcelAttribute(name = "医保基数")
@Schema(description = "医保基数")
@ExcelProperty("医保基数")
private BigDecimal medicalSet;
/**
* 医保单位缴费
*/
@ExcelAttribute(name = "医保单位缴费")
@Schema(description = "医保单位缴费")
@ExcelProperty("医保单位缴费")
private BigDecimal unitMedicalMoney;
/**
* 医保个人缴费
*/
@ExcelAttribute(name = "医保个人缴费")
@Schema(description = "医保个人缴费")
@ExcelProperty("医保个人缴费")
private BigDecimal personalMedicalMoney;
/**
* 单位医疗救助金 (对应单位大病)
*/
@ExcelAttribute(name = "单位医疗救助金")
@Schema(description = "单位医疗救助金")
@ExcelProperty("单位医疗救助金")
private BigDecimal unitBigailmentMoney;
/**
* 个人医疗救助金 (对应个人大病)
*/
@ExcelAttribute(name = "个人医疗救助金")
@Schema(description = "个人医疗救助金")
@ExcelProperty("个人医疗救助金")
private BigDecimal personalBigailmentMoney;
/**
* 社保ID
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "社保ID", maxLength = 32, isDataId = true)
@Schema(description = "社保ID")
@ExcelProperty("社保ID")
private String socialId;
/**
* 公积金ID
*/
@Length(max = 32, message = "不能超过32个字符")
@ExcelAttribute(name = "公积金ID", maxLength = 32, isDataId = true)
@Schema(description = "公积金ID")
@ExcelProperty("公积金ID")
private String fundId;
}
/*
* 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.social.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.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author huyc
* @date 2022-07-25 14:08:58
*/
@Data
public class TPaymentInfoImportLogVo extends RowIndex implements Serializable {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "主键 不能为空")
@ExcelAttribute(name = "主键", isNotEmpty = true, errorInfo = "主键 不能为空")
@Schema(description = "主键")
@ExcelProperty("主键")
private Integer id;
/**
* 姓名
*/
@Length(max = 50, message = "姓名 不能超过50 个字符")
@ExcelAttribute(name = "姓名", maxLength = 50)
@Schema(description = "姓名")
@ExcelProperty("姓名")
private String empName;
/**
* 身份证号
*/
@Length(max = 32, message = "身份证号 不能超过32 个字符")
@ExcelAttribute(name = "身份证号", maxLength = 32)
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String idCard;
/**
* 错误信息
*/
@Length(max = 500, message = "错误信息 不能超过500 个字符")
@ExcelAttribute(name = "错误信息", maxLength = 500)
@Schema(description = "错误信息")
@ExcelProperty("错误信息")
private String errMsg;
/**
* 问题行数
*/
@ExcelAttribute(name = "问题行数")
@Schema(description = "问题行数")
@ExcelProperty("问题行数")
private Integer line;
/**
* 导入标识key
*/
@Length(max = 64, message = "导入标识key 不能超过64 个字符")
@ExcelAttribute(name = "导入标识key", maxLength = 64)
@Schema(description = "导入标识key")
@ExcelProperty("导入标识key")
private String randomKey;
}
/*
* 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.social.vo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 缴费库
*
* @author huyc
* @date 2022-07-22 17:01:22
*/
@Data
public class TPaymentInfoSearchVo extends TPaymentInfo {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,id数组")
private List<String> idList;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
package com.yifu.cloud.plus.v1.yifu.social.constants;
/**
* 缴费库导入静态数据
* @Author huyc
* @Date 2022-07-27
**/
public class PaymentConstants {
public static final String saveFailExistsSocialSettlement = "社保数据已生成核准表,无法删除!";
public static final String saveFailExistsSalarySocialSettlement = "社保数据已工资结算,无法删除!";
public static final String saveFailExistsFundSettlement = "公积金数据已生成核准表,无法删除!";
public static final String saveFailExistsSalaryFundSettlement = "公积金数据已工资结算,无法删除!";
public static final String saveFailExistsAgentSettlement = "对应缴费库数据已生成代理类结算单,无法删除!";
public static final String saveFailExistsFinanceBillSettlement = "数据已生成财务账单,无法删除!";
public static final String PENSION_RISK = "养老保险";
public static final String PENSION = "养老";
public static final String UNEMPLOYEEMENT_RISK = "失业保险";
public static final String UNEMPLOYEEMENT = "失业";
public static final String INJURY_RISK = "工伤保险";
public static final String INJURY = "工伤";
public static final String MEDICAL = "医疗";
}
......@@ -11,4 +11,12 @@ public class SocialConstants {
public static final String EMP_NAME_ERROR = "员工姓名错误!";
public static final String DIFF_TYPE_ONE = "预估";
public static final String DIFF_TYPE_TWO = "差额";
public static final String YL = "养老";
public static final String DB = "大病";
public static final String SY = "失业";
public static final String BIR = "生育";
public static final String GS = "工伤";
public static final String YB = "医保";
}
/*
package com.yifu.cloud.plus.v1.yifu.social.controller;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -15,15 +15,15 @@
* Author: lengleng (wangiegie@gmail.com)
*/
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.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.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.service.TPaymentInfoService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import lombok.SneakyThrows;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
......@@ -31,15 +31,16 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 缴费库
*
* @author huyc
* @date 2022-07-14 18:53:42
* @author fxj
* @date 2022-07-22 17:01:22
*/
@RestController
@RequiredArgsConstructor
......@@ -56,46 +57,23 @@ public class TPaymentInfoController {
* @param tPaymentInfo 缴费库
* @return
*/
@Operation(summary = "简单分页查询", description = "简单分页查询")
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TPaymentInfo>> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfo tPaymentInfo) {
public R<IPage<TPaymentInfo>> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfoSearchVo tPaymentInfo) {
return new R<>(tPaymentInfoService.getTPaymentInfoPage(page,tPaymentInfo));
}
/**
* 不分页查询
* @param tPaymentInfo 缴费库
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage" )
public R<List<TPaymentInfo>> getTPaymentInfoNoPage(@RequestBody TPaymentInfo tPaymentInfo) {
return R.ok(tPaymentInfoService.list(Wrappers.query(tPaymentInfo)));
}
/**
* 通过id查询缴费库
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('social_tpaymentinfo_get')")
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}" )
public R<TPaymentInfo> getById(@PathVariable("id" ) String id) {
return R.ok(tPaymentInfoService.getById(id));
}
/**
* 新增缴费库
* @param tPaymentInfo 缴费库
* @return R
*/
@Operation(summary = "新增缴费库", description = "新增缴费库:hasPermission('social_tpaymentinfo_add')")
@SysLog("新增缴费库" )
@PostMapping
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_add')" )
public R<Boolean> save(@RequestBody TPaymentInfo tPaymentInfo) {
return R.ok(tPaymentInfoService.save(tPaymentInfo));
}
/**
* 修改缴费库
* @param tPaymentInfo 缴费库
......@@ -122,4 +100,108 @@ public class TPaymentInfoController {
return R.ok(tPaymentInfoService.removeById(id));
}
/**
* 按类型删除
* @author huyc
* @date 2022-07-22 17:01:22
* @param id
* @param type
* @return
**/
@Operation(summary = "按类型删除", description = "按类型删除:hasPermission('social_tpaymentinfo_del')")
@SysLog("按类型删除缴费库")
@GetMapping("/removeByIdAndType")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_del')")
public R<Boolean> removeByIdAndType(@RequestParam String id, @RequestParam String type) {
return tPaymentInfoService.removeByIdAndType(id,type);
}
/**
* 通过id查询单条记录(包含明细)
* @param id
* @return R
*/
@Operation(summary = "通过id查询单条记录")
@GetMapping("/allInfo/{id}")
public R getAllInfoById(@PathVariable("id") String id) {
return tPaymentInfoService.getAllInfoById(id);
}
/**
* 省市社保 批量导入
* @author huyc
* @date 2022-07-22
**/
@SneakyThrows
@Operation(description = "导入省市社保 hasPermission('social_tpaymentinfo_batchImport')")
@SysLog("批量新增缴费库")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file, @RequestParam String random){
return tPaymentInfoService.importSocialDiy(file.getInputStream(),random);
}
/**
* 导入省市社保-合肥三险
* @author huyc
* @date 2022-07-22
**/
@SneakyThrows
@Operation(description = "导入省市社保-合肥三险 hasPermission('social_tpaymentinfo_batchImport')")
@SysLog("批量新增缴费库-合肥三险")
@PostMapping("/importListSocialHeFei")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
public R<List<ErrorMessage>> importListSocialHeFei(@RequestBody MultipartFile file, @RequestParam String random,
@RequestParam(value = "type") String type){
return tPaymentInfoService.importSocialHeFeiDiy(file.getInputStream(),random,type);
}
/**
* 导入公积金
* @author huyc
* @date 2022-07-27
**/
@SneakyThrows
@Operation(description = "导入公积金 hasPermission('social_tpaymentinfo_batchImport')")
@SysLog("导入公积金")
@PostMapping("/batchImportPaymentFundInfo")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_batchImport')")
public R<List<ErrorMessage>> importListFund(@RequestBody MultipartFile file){
return tPaymentInfoService.batchImportPaymentFundInfo(file.getInputStream());
}
/**
* 缴费库 批量导出
* @author huyc
* @date 2022-07-22
**/
@Operation(description = "导出缴费库 hasPermission('social_tpaymentinfo_export')")
@PostMapping("/export")
// @PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
public void export(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
tPaymentInfoService.listExport(response,searchVo);
}
/**
* 删除当前登录人当前月的社保或公积金数据
* @param type 0 全部删除 1 删除社保 2 删除公积金 必填
* @param settleDepartId 结算主体ID 可选
* @param unitId 单位ID 可选
* @param empIdCard 员工身份证 可选
* @param socialHouseId 社保户 可选
* @param fundHouseId 公积金户 可选
* @return R
*/
@Operation(description = "删除(social_tpaymentinfo_del)")
@SysLog("删除缴费库")
@PostMapping("/removeBatchByIdsAndType")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_del')")
public R removeBatchByIdsAndType(@RequestParam(name = "type",required = true) String type,
@RequestParam(name = "settleDepartId",required = false) String settleDepartId,
@RequestParam(name = "unitId",required = false) String unitId,
@RequestParam(name = "empIdCard",required = false) String empIdCard,
@RequestParam(name = "socialHouseId",required = false) String socialHouseId,
@RequestParam(name = "fundHouseId",required = false) String fundHouseId) {
return tPaymentInfoService.removeBatchByIdsAndType(type,settleDepartId,unitId,empIdCard,socialHouseId,fundHouseId);
}
}
/*
* 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.social.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
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.social.service.TPaymentInfoImportLogService;
import com.yifu.cloud.plus.v1.yifu.social.util.ServiceUtil;
import org.apache.commons.lang.StringUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
*
*
* @author huyc
* @date 2022-07-25 14:08:58
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tpaymentinfoimportlog" )
@Tag(name = "管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class TPaymentInfoImportLogController {
private final TPaymentInfoImportLogService tPaymentInfoImportLogService;
private final RedisUtil redisUtil;
@Operation(description = "导出社保导入日志")
@GetMapping("/exportPaymentInfoLog")
public void exportPaymentInfoLog(HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
String key = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
String importRandom = (String) redisUtil.get(key);
if (StringUtils.isBlank(importRandom)) {
ServiceUtil.runTimeExceptionDiy("当前社保数据还未导入完成或者数据不存在");
}
String res = tPaymentInfoImportLogService.exportPaymentInfoLog(response, importRandom);
if (Common.isNotNull(res)){
ServiceUtil.runTimeExceptionDiy(res);
}
}
/**
* @description: 清空社保导入日志表
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Void>
* @author: huyc
* @date: 2022/7/25
*/
@Inner
@DeleteMapping("/inner/delPaymentInfoLog")
public R<Void> delPaymentInfoLog() {
boolean flag = tPaymentInfoImportLogService.remove(new QueryWrapper<>());
if (flag) {
return R.ok();
} else {
return R.failed("操作失败!");
}
}
}
/*
* 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.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfoImportLog;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author huyc
* @date 2022-07-25 14:08:58
*/
@Mapper
public interface TPaymentInfoImportLogMapper extends BaseMapper<TPaymentInfoImportLog> {
}
......@@ -21,9 +21,13 @@ 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.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 缴费库
*
......@@ -38,4 +42,56 @@ public interface TPaymentInfoMapper extends BaseMapper<TPaymentInfo> {
* @return
*/
IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, @Param("tPaymentInfo") TPaymentInfo tPaymentInfo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
Integer selectCountTPaymentInfo(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 缴费库简单分页查询
* @param searchVo 缴费库
* @return
*/
List<TPaymentInfo> getTPaymentInfoNoPage(@Param("tPaymentInfo") TPaymentInfoSearchVo searchVo);
/**
* 更新社保或者公积金
* @param tPaymentInfo 缴费库
* @return
*/
int updateDeleteInfo(@Param("tPaymentInfo")TPaymentInfo tPaymentInfo);
/**
* 通过ID获取缴费库 及社保、公积金明细
* @param id
* @return
**/
TPaymentInfoVo getAllInfoById(String id);
/**
* 查询要删除的数据
* @param queryEntity
* @return
**/
List<TPaymentInfo> selectListForDelete(@Param("queryEntity")TPaymentInfo queryEntity);
/*
* 已存在社保缴费库数据 非删除状态
* @param months
* @param idcards
* @return
* */
List<TPaymentInfo> selectListForPaymentImport(@Param("months")List<String> months, @Param("idcards")List<String> idcards);
/*
* 已存在社保缴费库数据 非删除状态
* @param months
* @param idcards
* @return
* */
List<TPaymentInfoVo> selectPaymentAllInfoByMonthAndIdCard(@Param("months")List<String> months, @Param("idcards")List<String> idcards);
}
......@@ -38,17 +38,50 @@ public interface TPreDispatchInfoMapper extends BaseMapper<TPreDispatchInfo> {
/**
* 预派单记录简单分页查询
* @param tPreDispatchInfo 预派单记录
* @author huyc
* @date 2022-07-14
* @return
*/
IPage<TPreDispatchInfo> getTPreDispatchInfoPage(Page<TPreDispatchInfo> page, @Param("tPreDispatchInfo") TPreDispatchInfo tPreDispatchInfo);
/*
* 清空预派单默认的派单合同信息
* @param preInfo
* @author huyc
* @date 2022-07-14
* */
void clearContractInfo(List<String> idList);
/*
* 修改资料是否提交状态
* @param tPreDispatchInfo
* @author huyc
* @date 2022-07-14
* */
void modifyDataSubmitStatus(@Param("idList")List<String> idList, @Param("status")String status);
/*
* 更新派单信息
* @param tPreDispatchInfo
* @author huyc
* @date 2022-07-14
* */
int updatePreDispatchInfoById(TPreDispatchInfo tPreDispatchInfo);
/*
* 处理派单结果
* @param preInfo
* @author huyc
* @date 2022-07-14
* */
void updatePreStatusById(TPreDispatchInfo preInfo);
/**
* 获取导出的数据
* @param tPreDispatchInfo 预派单记录
* @author huyc
* @date 2022-07-14
* @return
*/
List<TPreDispatchExportVo> getListForExport(@Param("tPreDispatchInfo")TPreDispatchInfo tPreDispatchInfo);
}
/*
* 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.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfoImportLog;
import javax.servlet.http.HttpServletResponse;
/**
*
*
* @author huyc
* @date 2022-07-25 14:08:58
*/
public interface TPaymentInfoImportLogService extends IService<TPaymentInfoImportLog> {
/**
* @description: 导出社保导入日志
* @param response
* @param random
* @return: void
* @author: huyc
* @date: 2022/7/25
*/
String exportPaymentInfoLog(HttpServletResponse response, String random);
}
/*
package com.yifu.cloud.plus.v1.yifu.social.service;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -15,18 +15,22 @@
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.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.social.entity.TPaymentInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.social.vo.TPaymentInfoSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/**
* 缴费库
*
* @author huyc
* @date 2022-07-14 18:53:42
* @date 2022-07-22 17:01:22
*/
public interface TPaymentInfoService extends IService<TPaymentInfo> {
/**
......@@ -35,4 +39,68 @@ public interface TPaymentInfoService extends IService<TPaymentInfo> {
* @return
*/
IPage<TPaymentInfo> getTPaymentInfoPage(Page<TPaymentInfo> page, TPaymentInfo tPaymentInfo);
/**
* 缴费库批量导入社保
* @param inputStream
* @return
*/
R<List<ErrorMessage>> importSocialDiy(InputStream inputStream, String random);
/**
* 批量新增缴费库-合肥三险
* @param inputStream
* @param random
* @param type
* @return
*/
R<List<ErrorMessage>> importSocialHeFeiDiy(InputStream inputStream, String random, String type);
/**
* 批量导入公积金
* @param inputStream
* @return
*/
R<List<ErrorMessage>> batchImportPaymentFundInfo(InputStream inputStream);
/**
* 导出缴费库
* @param response
* @param searchVo
* @return
*/
void listExport(HttpServletResponse response, TPaymentInfoSearchVo searchVo);
/**
* 按类型删除
* @Author huyc
* @Date 2022-07-24
* @param id
* @param type
* @return
**/
R<Boolean> removeByIdAndType(String id, String type);
/**
* 通过ID获取缴费库 及社保、公积金明细
* @Author huyc
* @Date 2022-07-24
* @param id
* @return
**/
R getAllInfoById(String id);
/**
* 删除当月 当前登录人的 指定类型的缴费库数据
* @Author huyc
* @Date 2022-07-27
* @param type
* @param settleDepartId
* @param unitId
* @param empIdCard
* @param socialHouseId
* @param fundHouseId
* @return
**/
R removeBatchByIdsAndType(String type, String settleDepartId, String unitId, String empIdCard, String socialHouseId, String fundHouseId);
}
/*
* 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.social.service.impl;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
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.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfoImportLog;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoImportLogMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TPaymentInfoImportLogService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoImportLogVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author huyc
* @date 2022-07-25 14:08:58
*/
@Log4j2
@Service
public class TPaymentInfoImportLogServiceImpl extends ServiceImpl<TPaymentInfoImportLogMapper, TPaymentInfoImportLog> implements TPaymentInfoImportLogService {
/**
* @param response
* @param random
* @description: 导出社保导入日志
* @return: void
* @author: huyc
* @date: 2022/7/25
*/
@Override
public String exportPaymentInfoLog(HttpServletResponse response, String random) {
String fileName = "社保导入日志" + DateUtil.getThisTime() + ".xlsx";
List<TPaymentInfoImportLogVo> list = new ArrayList<>();
List<TPaymentInfoImportLog> paymentInfoImportLogList = lambdaQuery()
.eq(TPaymentInfoImportLog::getRandomKey, random).orderByAsc(TPaymentInfoImportLog::getLine).list();
if (CollectionUtils.isEmpty(paymentInfoImportLogList)) {
return "导出数据为空";
}
paymentInfoImportLogList.forEach(v -> {
TPaymentInfoImportLogVo paymentInfoLogVO = new TPaymentInfoImportLogVo();
BeanUtils.copyProperties(v, paymentInfoLogVO);
list.add(paymentInfoLogVO);
});
ServletOutputStream out = null;
try {
out = response.getOutputStream();
ExcelUtil<TPaymentInfoImportLogVo> util = new ExcelUtil<>(TPaymentInfoImportLogVo.class);
for (TPaymentInfoImportLogVo vo : list) {
util.convertEntity(vo, null, null, null);
}
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(getExportFieldNameDetailByClass(TPaymentInfoImportLogVo.class)).sheet("社保导入日志")
.doWrite(list);
out.flush();
} catch (IOException e) {
log.error("导出缴费库导入记录异常!", e);
e.printStackTrace();
return "操作失败,发生异常!";
}
return null;
}
private Set<String> getExportFieldNameDetailByClass(Class<?> clazz) {
Set<String> exportfieldsName = new HashSet<>();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
ExcelAttribute annotation = field.getAnnotation(ExcelAttribute.class);
if (annotation != null && Common.isNotNull(annotation.name()) && annotation.needExport()) {
exportfieldsName.add(annotation.name());
}
}
return exportfieldsName;
}
}
<?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.social.mapper.TPaymentInfoImportLogMapper">
<resultMap id="tPaymentInfoImportLogMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfoImportLog">
<id property="id" column="id"/>
<result property="empName" column="emp_name"/>
<result property="idCard" column="id_card"/>
<result property="errMsg" column="err_msg"/>
<result property="line" column="line"/>
<result property="randomKey" column="random_key"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.emp_name,
a.id_card,
a.err_msg,
a.line,
a.random_key
</sql>
<sql id="tPaymentInfoImportLog_where">
<if test="tPaymentInfoImportLog != null">
<if test="tPaymentInfoImportLog.id != null">
AND a.id = #{tPaymentInfoImportLog.id}
</if>
<if test="tPaymentInfoImportLog.empName != null and tPaymentInfoImportLog.empName.trim() != ''">
AND a.emp_name = #{tPaymentInfoImportLog.empName}
</if>
<if test="tPaymentInfoImportLog.idCard != null and tPaymentInfoImportLog.idCard.trim() != ''">
AND a.id_card = #{tPaymentInfoImportLog.idCard}
</if>
<if test="tPaymentInfoImportLog.errMsg != null and tPaymentInfoImportLog.errMsg.trim() != ''">
AND a.err_msg = #{tPaymentInfoImportLog.errMsg}
</if>
<if test="tPaymentInfoImportLog.line != null">
AND a.line = #{tPaymentInfoImportLog.line}
</if>
<if test="tPaymentInfoImportLog.randomKey != null and tPaymentInfoImportLog.randomKey.trim() != ''">
AND a.random_key = #{tPaymentInfoImportLog.randomKey}
</if>
</if>
</sql>
<!--tPaymentInfoImportLog简单分页查询-->
<select id="getTPaymentInfoImportLogPage" resultMap="tPaymentInfoImportLogMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_payment_info_import_log a
<where>
1=1
<include refid="tPaymentInfoImportLog_where"/>
</where>
</select>
</mapper>
......@@ -561,6 +561,7 @@
1=1
<include refid="tPreDispatchInfo_where"/>
</where>
ORDER BY a.CREATE_TIME desc
</select>
<!--tPreDispatchInfo无分页查询-->
<select id="getListForExport" resultMap="tPreDispatchExportMap">
......
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