Merge remote-tracking branch 'remotes/origin/master' into feature/v2-addWelfareArchives-1117
This commit is contained in:
commit
451968f122
|
|
@ -9,9 +9,11 @@ Oracle数据库中常见报错问题
|
|||
-- 删除原表HRSA_SALARY_TEMPLATE数据
|
||||
delete from HRSA_SALARY_TEMPLATE;
|
||||
|
||||
alter TABLE HRSA_SALARY_TEMPLATE MODIFY SALARY_ITEM_SETTING NULL;
|
||||
alter table HRSA_SALARY_TEMPLATE modify salary_item_setting long;
|
||||
alter table HRSA_SALARY_TEMPLATE modify salary_item_setting CLOB;
|
||||
insert into HRSA_SALARY_TEMPLATE select * from HRSA_SALARY_TEMPLAT_TEMPT ;
|
||||
alter TABLE HRSA_SALARY_TEMPLATE MODIFY SALARY_ITEM_SETTING NOT NULL;
|
||||
drop table HRSA_SALARY_TEMPLAT_TEMPT;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package com.api.salary.web;
|
||||
|
||||
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
|
||||
import com.huawei.shade.com.alibaba.fastjson.JSON;
|
||||
import com.huawei.shade.com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/bs/hrmsalary/addUpDeduction")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package com.api.salary.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/bs/hrmsalary/specialAddDeduction")
|
||||
public class SpecialAddDeductionController extends com.engine.salary.web.SpecialAddDeductionController {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,172 @@
|
|||
package com.engine.salary.biz;
|
||||
|
||||
import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SpecialAddDeductionBiz extends BaseBean {
|
||||
private SpecialAddDeductionMapper mapper() {
|
||||
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public SpecialAddDeductionPO getById(Long id) {
|
||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
SpecialAddDeductionPO byId = mapper.getById(id);
|
||||
return SpecialAddDeductionEncrypt.decrypt(byId);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SpecialAddDeductionRecordDTO> listDTOByParam(SpecialAddDeductionQueryParam param) {
|
||||
List<SpecialAddDeductionRecordDTO> specialAddDeductionRecordDTOS = mapper().listDtoByParam(param);
|
||||
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionRecordDTOS);
|
||||
}
|
||||
|
||||
|
||||
public List<SpecialAddDeductionListDTO> listByParam(SpecialAddDeductionQueryParam param) {
|
||||
List<SpecialAddDeductionListDTO> specialAddDeductionListDTOS = mapper().listByParam(param);
|
||||
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionListDTOS);
|
||||
}
|
||||
|
||||
public List<SpecialAddDeductionPO> listByTaxAgentIds(List<Long> taxAgentIds) {
|
||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
List<SpecialAddDeductionPO> pos = mapper.listByTaxAgentIds(taxAgentIds);
|
||||
return SpecialAddDeductionEncrypt.decrypt(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public void batchSave(List<SpecialAddDeductionPO> param) {
|
||||
if (CollectionUtils.isEmpty(param)) {
|
||||
return;
|
||||
}
|
||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
SpecialAddDeductionEncrypt.encrypt(param);
|
||||
List<List<SpecialAddDeductionPO>> partition = Lists.partition(param, 100);
|
||||
partition.forEach(mapper::batchInsert);
|
||||
sqlSession.commit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public void batchUpdate(List<SpecialAddDeductionPO> param) {
|
||||
if (CollectionUtils.isEmpty(param)) {
|
||||
return;
|
||||
}
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
SpecialAddDeductionEncrypt.encrypt(param);
|
||||
List<List<SpecialAddDeductionPO>> partition = Lists.partition(param, 100);
|
||||
partition.forEach(mapper::updateBatchSelective);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理导入数据
|
||||
*
|
||||
* @param pos
|
||||
*/
|
||||
public void handleImportData(List<SpecialAddDeductionPO> pos) {
|
||||
if (CollectionUtils.isEmpty(pos)) {
|
||||
return;
|
||||
}
|
||||
SpecialAddDeductionPO po = pos.get(0);
|
||||
// 多条相同人的则以第一条为准,如果逆序排列(用于重复的则以最后一条为准)Collections.reverse(pos);
|
||||
// 去重(通过记录的唯一条件(申报月份,人员id,个税扣缴义务人id)拼接)
|
||||
List<SpecialAddDeductionPO> finalPos = pos.stream()
|
||||
.collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(() ->
|
||||
new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))),
|
||||
ArrayList::new)
|
||||
);
|
||||
// 查询已有数据
|
||||
List<SpecialAddDeductionPO> list = listByTaxAgentIds(null);
|
||||
// 待修改的 本地已存在则更新【交集】
|
||||
List<SpecialAddDeductionPO> updateList = list.stream()
|
||||
.map(m -> finalPos.stream()
|
||||
.filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId()))
|
||||
.findFirst()
|
||||
.map(t -> t.setId(m.getId()))
|
||||
.orElse(null)
|
||||
).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
// 待新增的 导入比本地多,则新增【差集(导入 - local)】
|
||||
List<SpecialAddDeductionPO> saveList = finalPos.stream()
|
||||
.filter(m -> list.stream().noneMatch(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId()))
|
||||
).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
||||
// 修改
|
||||
if (CollectionUtils.isNotEmpty(updateList)) {
|
||||
batchUpdate(updateList);
|
||||
}
|
||||
// 保存
|
||||
if (CollectionUtils.isNotEmpty(saveList)) {
|
||||
batchSave(saveList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @description 批量删除
|
||||
*/
|
||||
public void batchDeleteByIds(List<Long> deleteIds) {
|
||||
if (CollectionUtils.isEmpty(deleteIds)) {
|
||||
return;
|
||||
}
|
||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
List<List<Long>> partition = Lists.partition(deleteIds, 100);
|
||||
partition.forEach(mapper::deleteByIds);
|
||||
sqlSession.commit();
|
||||
}
|
||||
}
|
||||
|
||||
public List<SpecialAddDeductionPO> getByEmployeeId(List<Long> employeeIds, Long taxAgentId) {
|
||||
if (CollectionUtils.isEmpty(employeeIds)) {
|
||||
employeeIds = Collections.emptyList();
|
||||
}
|
||||
return mapper().getByEmployeeIds(employeeIds, taxAgentId)
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(s -> s.getEmployeeId() != null)
|
||||
.map(SpecialAddDeductionEncrypt::decrypt)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.engine.salary.encrypt.datacollection;
|
||||
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* hrsa_special_add_deduction: 加解密
|
||||
* 字段:
|
||||
* children_education
|
||||
* continuing_education
|
||||
* housing_loan_interest
|
||||
* housing_rent
|
||||
* supporting_elder
|
||||
* serious_illness_treatment
|
||||
* infant_care
|
||||
*/
|
||||
public class SpecialAddDeductionEncrypt {
|
||||
private static final List<String> FIELDS = Arrays.asList(
|
||||
"childrenEducation", "continuingEducation", "supportingElder", "housingLoanInterest",
|
||||
"housingRent", "seriousIllnessTreatment", "infantCare");
|
||||
|
||||
public static <T> T encrypt(T obj) {
|
||||
if (obj == null) {
|
||||
return obj;
|
||||
}
|
||||
if(obj instanceof List) {
|
||||
return encrypt(obj);
|
||||
}
|
||||
Class<?> clazz = obj.getClass();
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
if (FIELDS.contains(field.getName())) {
|
||||
try {
|
||||
Object o = field.get(obj);
|
||||
if (o instanceof String) {
|
||||
Object value = AESEncryptUtil.encrypt((String)o);
|
||||
field.set(obj, value);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static <T> List<T> encrypt(List<T> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return list;
|
||||
}
|
||||
return list.stream().map(SpecialAddDeductionEncrypt::encrypt)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static <T> T decrypt(T obj) {
|
||||
if (obj == null) {
|
||||
return obj;
|
||||
}
|
||||
if(obj instanceof List) {
|
||||
return encrypt(obj);
|
||||
}
|
||||
Class<?> clazz = obj.getClass();
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
if (FIELDS.contains(field.getName())) {
|
||||
try {
|
||||
Object o = field.get(obj);
|
||||
if (o instanceof String) {
|
||||
Object value = AESEncryptUtil.decrypt((String)o);
|
||||
field.set(obj, value);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static <T> List<T> decrypt(List<T> list) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return list;
|
||||
}
|
||||
return list.stream().map(SpecialAddDeductionEncrypt::decrypt)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package com.engine.salary.entity.datacollection.dto;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.salary.annotation.SalaryTable;
|
||||
import com.engine.salary.annotation.SalaryTableColumn;
|
||||
import com.engine.salary.annotation.SalaryTableOperate;
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import com.engine.salary.util.excel.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 数据采集-专项附加扣除列表
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author lfc
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SalaryTable(pageId = "a4f85287-e3f9-6612-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX, operates = {
|
||||
@SalaryTableOperate(text = "查看明细")
|
||||
})
|
||||
public class SpecialAddDeductionListDTO {
|
||||
|
||||
|
||||
//主键id
|
||||
@SalaryTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
//员工id
|
||||
private Long employeeId;
|
||||
|
||||
//姓名
|
||||
@SalaryTableColumn(text = "姓名", width = "10%", column = "username")
|
||||
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
|
||||
@ExcelProperty(index = 0)
|
||||
private String username;
|
||||
|
||||
//个税扣缴义务人
|
||||
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
|
||||
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
|
||||
@ExcelProperty(index = 1)
|
||||
private String taxAgentName;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人id
|
||||
*/
|
||||
private Long taxAgentId;
|
||||
|
||||
//部门
|
||||
@SalaryTableColumn(text = "部门", width = "10%", column = "departmentName")
|
||||
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
|
||||
@ExcelProperty(index = 2)
|
||||
private String departmentName;
|
||||
|
||||
//手机号
|
||||
@SalaryTableColumn(text = "手机号", width = "10%", column = "mobile")
|
||||
@TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile")
|
||||
@ExcelProperty(index = 3)
|
||||
private String mobile;
|
||||
|
||||
//工号
|
||||
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
|
||||
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
|
||||
@ExcelProperty(index = 4)
|
||||
private String jobNum;
|
||||
|
||||
//证件号码
|
||||
@SalaryTableColumn(text = "证件号码", width = "10%", column = "idNo")
|
||||
@TableTitle(title = "证件号码", dataIndex = "idNo", key = "idNo")
|
||||
@ExcelProperty(index = 5)
|
||||
private String idNo;
|
||||
|
||||
//入职日期
|
||||
@ExcelProperty(index = 6)
|
||||
@SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate")
|
||||
@TableTitle(title = "入职日期", dataIndex = "hiredate", key = "hiredate")
|
||||
private String hiredate;
|
||||
|
||||
//子女教育
|
||||
@ExcelProperty(index = 7)
|
||||
@SalaryTableColumn(text = "子女教育", width = "10%", column = "childrenEducation")
|
||||
@TableTitle(title = "子女教育", dataIndex = "childrenEducation", key = "childrenEducation")
|
||||
private String childrenEducation;
|
||||
|
||||
//继续教育
|
||||
@ExcelProperty(index = 8)
|
||||
@SalaryTableColumn(text = "继续教育", width = "10%", column = "continuingEducation")
|
||||
@TableTitle(title = "继续教育", dataIndex = "continuingEducation", key = "continuingEducation")
|
||||
private String continuingEducation;
|
||||
|
||||
//住房贷款利息
|
||||
@ExcelProperty(index = 9)
|
||||
@SalaryTableColumn(text = "住房贷款利息", width = "10%", column = "housingLoanInterest")
|
||||
@TableTitle(title = "住房贷款利息", dataIndex = "housingLoanInterest", key = "housingLoanInterest")
|
||||
private String housingLoanInterest;
|
||||
|
||||
//住房租金
|
||||
@ExcelProperty(index = 10)
|
||||
@SalaryTableColumn(text = "住房租金", width = "10%", column = "housingRent")
|
||||
@TableTitle(title = "住房租金", dataIndex = "housingRent", key = "housingRent")
|
||||
private String housingRent;
|
||||
|
||||
//赡养老人
|
||||
@ExcelProperty(index = 11)
|
||||
@SalaryTableColumn(text = "赡养老人", width = "10%", column = "supportingElder")
|
||||
@TableTitle(title = "赡养老人", dataIndex = "supportingElder", key = "supportingElder")
|
||||
private String supportingElder;
|
||||
|
||||
//大病医疗
|
||||
@ExcelProperty(index = 12)
|
||||
@SalaryTableColumn(text = "大病医疗", width = "10%", column = "seriousIllnessTreatment")
|
||||
@TableTitle(title = "大病医疗", dataIndex = "seriousIllnessTreatment", key = "seriousIllnessTreatment")
|
||||
private String seriousIllnessTreatment;
|
||||
|
||||
//婴幼儿照护
|
||||
@ExcelProperty(index = 13)
|
||||
@SalaryTableColumn(text = "婴幼儿照护", width = "10%", column = "infantCare")
|
||||
@TableTitle(title = "婴幼儿照护", dataIndex = "infantCare", key = "infantCare")
|
||||
private String infantCare;
|
||||
|
||||
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
|
||||
@TableTitle(title = "操作", dataIndex = "operate", key = "operate")
|
||||
private String operate;
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.engine.salary.entity.datacollection.dto;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.salary.annotation.SalaryTable;
|
||||
import com.engine.salary.annotation.SalaryTableColumn;
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 其他免税扣除记录列表
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SalaryTable(pageId = "a4f85287-e3f9-6612-adn9-7d98e54y6rj8", tableType = WeaTableType.CHECKBOX)
|
||||
public class SpecialAddDeductionRecordDTO {
|
||||
|
||||
//主键id
|
||||
@SalaryTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
//员工id
|
||||
private Long employeeId;
|
||||
|
||||
private String username;
|
||||
|
||||
//个税扣缴义务人
|
||||
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
|
||||
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName")
|
||||
private String taxAgentName;
|
||||
/**
|
||||
* 个税扣缴义务人id
|
||||
*/
|
||||
private Long taxAgentId;
|
||||
|
||||
|
||||
//部门
|
||||
@SalaryTableColumn(text = "部门", width = "10%", column = "departmentName")
|
||||
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
|
||||
private String departmentName;
|
||||
|
||||
//手机号
|
||||
@SalaryTableColumn(text = "手机号", width = "10%", column = "mobile")
|
||||
@TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile")
|
||||
private String mobile;
|
||||
|
||||
private String idNo;
|
||||
|
||||
//工号
|
||||
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
|
||||
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
|
||||
private String jobNum;
|
||||
|
||||
//子女教育
|
||||
@SalaryTableColumn(text = "子女教育", width = "10%", column = "childrenEducation")
|
||||
@TableTitle(title = "子女教育", dataIndex = "childrenEducation", key = "childrenEducation")
|
||||
private String childrenEducation;
|
||||
|
||||
//继续教育
|
||||
@SalaryTableColumn(text = "继续教育", width = "10%", column = "continuingEducation")
|
||||
@TableTitle(title = "继续教育", dataIndex = "continuingEducation", key = "continuingEducation")
|
||||
private String continuingEducation;
|
||||
|
||||
//住房贷款利息
|
||||
@SalaryTableColumn(text = "住房贷款利息", width = "10%", column = "housingLoanInterest")
|
||||
@TableTitle(title = "住房贷款利息", dataIndex = "housingLoanInterest", key = "housingLoanInterest")
|
||||
private String housingLoanInterest;
|
||||
|
||||
//住房租金
|
||||
@SalaryTableColumn(text = "住房租金", width = "10%", column = "housingRent")
|
||||
@TableTitle(title = "住房租金", dataIndex = "housingRent", key = "housingRent")
|
||||
private String housingRent;
|
||||
|
||||
//赡养老人
|
||||
@SalaryTableColumn(text = "赡养老人", width = "10%", column = "supportingElder")
|
||||
@TableTitle(title = "赡养老人", dataIndex = "supportingElder", key = "supportingElder")
|
||||
private String supportingElder;
|
||||
|
||||
//大病医疗
|
||||
@SalaryTableColumn(text = "大病医疗", width = "10%", column = "seriousIllnessTreatment")
|
||||
@TableTitle(title = "大病医疗", dataIndex = "seriousIllnessTreatment", key = "seriousIllnessTreatment")
|
||||
private String seriousIllnessTreatment;
|
||||
|
||||
//大病医疗
|
||||
@SalaryTableColumn(text = "婴幼儿照护", width = "10%", column = "infantCare")
|
||||
@TableTitle(title = "婴幼儿照护", dataIndex = "infantCare", key = "infantCare")
|
||||
private String infantCare;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description 数据采集-专项附加扣除一键累计参数
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AddDeductionAutoAddParam {
|
||||
String yearMonth = "";
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 数据采集-累计专项附加扣除导入参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author lfc
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SpecialAddDeductionImportParam {
|
||||
|
||||
//上传文件id
|
||||
String imageId;
|
||||
|
||||
//个税扣缴义务人
|
||||
String taxAgentId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/26 9:50
|
||||
* @description 数据采集-其他免税扣除 编辑参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SpecialAddDeductionParam {
|
||||
|
||||
// 主键id
|
||||
private Long id;
|
||||
|
||||
// 员工id
|
||||
private Long employeeId;
|
||||
|
||||
private String username;
|
||||
|
||||
// 个税扣缴义务人
|
||||
private String taxAgentName;
|
||||
|
||||
// 个税扣缴义务人id
|
||||
private Long taxAgentId;
|
||||
|
||||
// 部门
|
||||
private String departmentName;
|
||||
|
||||
// 手机号
|
||||
private String mobile;
|
||||
|
||||
private String idNo;
|
||||
|
||||
// 工号
|
||||
private String jobNum;
|
||||
|
||||
/**
|
||||
* 子女教育
|
||||
*/
|
||||
private String childrenEducation;
|
||||
|
||||
/**
|
||||
* 继续教育
|
||||
*/
|
||||
private String continuingEducation;
|
||||
|
||||
/**
|
||||
* 住房贷款利息
|
||||
*/
|
||||
private String housingLoanInterest;
|
||||
|
||||
/**
|
||||
* 住房租金
|
||||
*/
|
||||
private String housingRent;
|
||||
|
||||
/**
|
||||
* 赡养老人
|
||||
*/
|
||||
private String supportingElder;
|
||||
|
||||
/**
|
||||
* 大病医疗
|
||||
*/
|
||||
private String seriousIllnessTreatment;
|
||||
|
||||
/**
|
||||
* 婴幼儿照护
|
||||
*/
|
||||
private String infantCare;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//数据采集-其他免税扣除查询参数
|
||||
public class SpecialAddDeductionQueryParam extends BaseQueryParam {
|
||||
|
||||
//主键id
|
||||
private Collection<Long> ids;
|
||||
|
||||
//关键字(姓名、部门、工号)
|
||||
private String keyword;
|
||||
|
||||
//主键id
|
||||
private Long id;
|
||||
|
||||
//姓名
|
||||
private String username;
|
||||
|
||||
//员工id
|
||||
private Long employeeId;
|
||||
|
||||
//个税扣缴义务人的主键id
|
||||
private Long taxAgentId;
|
||||
private Collection<Long> taxAgentIds;
|
||||
|
||||
//部门id
|
||||
private List<Long> departmentIds;
|
||||
|
||||
//工号
|
||||
private String jobNum;
|
||||
|
||||
//证件号
|
||||
private String idNo;
|
||||
|
||||
//入职日期
|
||||
private List<Date> hiredate;
|
||||
|
||||
//手机号
|
||||
private String mobile;
|
||||
|
||||
//其他免税扣除id(获取明细)
|
||||
private Long specialAddDeductionId;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lfc
|
||||
* @description 专项附加扣-除删除参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SpecialAddDeductionRecordDeleteParam {
|
||||
|
||||
// 删除id
|
||||
private List<Long> ids;
|
||||
|
||||
// 个税扣缴义务人
|
||||
private String taxAgentId;
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
package com.engine.salary.entity.datacollection.po;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 数据采集-专项附加扣除表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class SpecialAddDeductionPO {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 人员信息表的主键id
|
||||
*/
|
||||
private Long employeeId;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人的主键id
|
||||
*/
|
||||
private Long taxAgentId;
|
||||
|
||||
/**
|
||||
* 子女教育
|
||||
*/
|
||||
private String childrenEducation;
|
||||
|
||||
/**
|
||||
* 继续教育
|
||||
*/
|
||||
private String continuingEducation;
|
||||
|
||||
/**
|
||||
* 住房贷款利息
|
||||
*/
|
||||
private String housingLoanInterest;
|
||||
|
||||
/**
|
||||
* 住房租金
|
||||
*/
|
||||
private String housingRent;
|
||||
|
||||
/**
|
||||
* 赡养老人
|
||||
*/
|
||||
private String supportingElder;
|
||||
|
||||
/**
|
||||
* 大病医疗
|
||||
*/
|
||||
private String seriousIllnessTreatment;
|
||||
|
||||
/**
|
||||
* 婴幼儿照护
|
||||
*/
|
||||
private String infantCare;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 是否已删除。0:未删除、1:已删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantKey;
|
||||
}
|
||||
|
|
@ -123,6 +123,7 @@ public class SalaryArchiveExcelBO extends Service {
|
|||
|
||||
salaryArchiveErr = SalaryI18nUtil.getI18nLabel(101723, "该员工的薪资档案记录有误,请检查");
|
||||
numberErr = SalaryI18nUtil.getI18nLabel(100581, "请输入数字");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package com.engine.salary.mapper.datacollection;
|
||||
import java.util.Date;
|
||||
|
||||
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
|
|
@ -61,6 +62,8 @@ public interface AddUpDeductionMapper {
|
|||
*/
|
||||
void updateData(@Param("collection") List<AddUpDeduction> updateList);
|
||||
|
||||
void updateDataAndDeclareMonth(@Param("collection") List<AddUpDeduction> updateList);
|
||||
|
||||
List<AddUpDeductionRecordDTO> recordList(@Param("param") AddUpDeductionQueryParam param);
|
||||
|
||||
|
||||
|
|
@ -71,4 +74,8 @@ public interface AddUpDeductionMapper {
|
|||
* @date 2022/10/27 9:54
|
||||
*/
|
||||
void deleteData(@Param("collection")List<Long> longs);
|
||||
|
||||
int countByDeclareAfter(@Param("minDeclareMonth") Date minDeclareMonth,
|
||||
@Param("maxDeclareMonth") Date maxDeclareMonth,
|
||||
@Param("taxAgentIds") List<Long> taxAgentIds);
|
||||
}
|
||||
|
|
@ -1,6 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.engine.salary.mapper.datacollection.AddUpDeductionMapper">
|
||||
<sql id="Base_Column_List">
|
||||
add_up_child_education,
|
||||
add_up_continuing_education,
|
||||
add_up_housing_loan_interest,
|
||||
add_up_housing_rent,
|
||||
add_up_support_elderly,
|
||||
create_time,
|
||||
creator,
|
||||
declare_month,
|
||||
delete_type,
|
||||
employee_id,
|
||||
id,
|
||||
tax_agent_id,
|
||||
tenant_key,
|
||||
update_time,
|
||||
add_up_illness_medical,
|
||||
add_up_infant_care
|
||||
</sql>
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.AddUpDeduction">
|
||||
<result column="add_up_child_education" property="addUpChildEducation"/>
|
||||
<result column="add_up_continuing_education" property="addUpContinuingEducation"/>
|
||||
|
|
@ -553,6 +571,73 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateDataAndDeclareMonth" parameterType="java.util.List">
|
||||
update hrsa_add_up_deduction
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="add_up_child_education =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpChildEducation!=null">
|
||||
when id=#{item.id} then #{item.addUpChildEducation}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="add_up_continuing_education =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpContinuingEducation!=null">
|
||||
when id=#{item.id} then #{item.addUpContinuingEducation}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="add_up_housing_loan_interest =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpHousingLoanInterest!=null">
|
||||
when id=#{item.id} then #{item.addUpHousingLoanInterest}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="add_up_housing_rent =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpHousingRent!=null">
|
||||
when id=#{item.id} then #{item.addUpHousingRent}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="add_up_support_elderly =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpSupportElderly!=null">
|
||||
when id=#{item.id} then #{item.addUpSupportElderly}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="add_up_illness_medical =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpIllnessMedical!=null">
|
||||
when id=#{item.id} then #{item.addUpIllnessMedical}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="add_up_infant_care =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.addUpInfantCare!=null">
|
||||
when id=#{item.id} then #{item.addUpInfantCare}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="declare_month =case" suffix="end,">
|
||||
<foreach collection="collection" item="item" index="index">
|
||||
<if test="item.declareMonth!=null">
|
||||
when id=#{item.id} then #{item.declareMonth}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where
|
||||
id in
|
||||
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="recordList" resultType="com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO">
|
||||
SELECT
|
||||
<include refid="addUpDeductionColumn"/>
|
||||
|
|
@ -569,5 +654,23 @@
|
|||
ORDER BY t1.declare_month DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="countByDeclareAfter" resultType="java.lang.Integer">
|
||||
select
|
||||
count(*)
|
||||
from hrsa_add_up_deduction t1
|
||||
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
WHERE
|
||||
t1.delete_type = 0 AND t2.delete_type = 0
|
||||
AND e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<if test="taxAgentIds != null and taxAgentIds.size() != 0">
|
||||
and tax_agent_id in
|
||||
<foreach collection="taxAgentIds" item="taxAgentId" open="(" separator="," close=")">
|
||||
#{taxAgentId}
|
||||
</foreach>
|
||||
</if>
|
||||
and declare_month <![CDATA[>]]> #{minDeclareMonth} and declare_month <![CDATA[<]]> #{maxDeclareMonth}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.salary.mapper.datacollection;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SpecialAddDeductionMapper {
|
||||
int insertSelective(SpecialAddDeductionPO record);
|
||||
|
||||
int updateByPrimaryKeySelective(SpecialAddDeductionPO record);
|
||||
|
||||
SpecialAddDeductionPO getById(Long id);
|
||||
|
||||
int updateBatchSelective(@Param("list") List<SpecialAddDeductionPO> list);
|
||||
|
||||
int batchInsert(@Param("list") List<SpecialAddDeductionPO> list);
|
||||
|
||||
List<SpecialAddDeductionRecordDTO> listDtoByParam(@Param("param") SpecialAddDeductionQueryParam param);
|
||||
|
||||
List<SpecialAddDeductionPO> listByTaxAgentIds(@Param("taxAgentIds") List<Long> taxAgentIds);
|
||||
|
||||
List<SpecialAddDeductionListDTO> listByParam(@Param("param") SpecialAddDeductionQueryParam param);
|
||||
|
||||
int deleteByIds(@Param("ids")List<Long> id);
|
||||
|
||||
|
||||
List<SpecialAddDeductionPO> getByEmployeeIds(@Param("employeeIds") List<Long> employeeIds,
|
||||
@Param("taxAgentId") Long taxAgentId);
|
||||
|
||||
List<SpecialAddDeductionPO> listAll();
|
||||
}
|
||||
|
|
@ -0,0 +1,693 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table hrsa_special_add_deduction-->
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="employee_id" jdbcType="BIGINT" property="employeeId"/>
|
||||
<result column="tax_agent_id" jdbcType="BIGINT" property="taxAgentId"/>
|
||||
<result column="children_education" jdbcType="VARCHAR" property="childrenEducation"/>
|
||||
<result column="continuing_education" jdbcType="VARCHAR" property="continuingEducation"/>
|
||||
<result column="housing_loan_interest" jdbcType="VARCHAR" property="housingLoanInterest"/>
|
||||
<result column="housing_rent" jdbcType="VARCHAR" property="housingRent"/>
|
||||
<result column="supporting_elder" jdbcType="VARCHAR" property="supportingElder"/>
|
||||
<result column="serious_illness_treatment" jdbcType="VARCHAR" property="seriousIllnessTreatment"/>
|
||||
<result column="infant_care" jdbcType="VARCHAR" property="infantCare"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="creator" jdbcType="BIGINT" property="creator"/>
|
||||
<result column="delete_type" jdbcType="INTEGER" property="deleteType"/>
|
||||
<result column="tenant_key" jdbcType="VARCHAR" property="tenantKey"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t1.id,
|
||||
t1.employee_id,
|
||||
t1.tax_agent_id,
|
||||
t1.children_education,
|
||||
t1.continuing_education,
|
||||
t1.housing_loan_interest,
|
||||
t1.housing_rent,
|
||||
t1.supporting_elder,
|
||||
t1.serious_illness_treatment,
|
||||
t1.infant_care,
|
||||
t1.create_time,
|
||||
t1.update_time,
|
||||
t1.creator,
|
||||
t1.delete_type,
|
||||
t1.tenant_key
|
||||
</sql>
|
||||
|
||||
<sql id="Special_Column_List">
|
||||
t1.id,
|
||||
t1.employee_id,
|
||||
t2.id AS tax_agent_id,
|
||||
t2.name AS tax_agent_name,
|
||||
e.lastname as username,
|
||||
e.certificatenum as idNo,
|
||||
d.departmentname AS departmentName,
|
||||
e.mobile,
|
||||
e.workcode as job_num,
|
||||
e.companystartdate as hiredate,
|
||||
t1.children_education,
|
||||
t1.continuing_education,
|
||||
t1.housing_loan_interest,
|
||||
t1.housing_rent,
|
||||
t1.serious_illness_treatment,
|
||||
t1.supporting_elder,
|
||||
t1.infant_care
|
||||
</sql>
|
||||
|
||||
<sql id="paramSql">
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t1.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.specialAddDeductionId != null">
|
||||
AND t1.id = #{param.specialAddDeductionId}
|
||||
</if>
|
||||
<if test="param.employeeId != null">
|
||||
AND t1.employee_id = #{param.employeeId}
|
||||
</if>
|
||||
<!-- 关键字(姓名、部门、工号 -->
|
||||
<if test="param.keyword != null and param.keyword != ''">
|
||||
AND
|
||||
(
|
||||
e.lastname like CONCAT('%',#{param.keyword},'%')
|
||||
OR d.departmentname like CONCAT('%',#{param.keyword},'%')
|
||||
OR e.workcode like CONCAT('%',#{param.keyword},'%')
|
||||
)
|
||||
</if>
|
||||
<!-- 姓名 -->
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like CONCAT('%',#{param.username},'%')
|
||||
</if>
|
||||
<!-- 个税扣缴义务人 -->
|
||||
<if test="param.taxAgentId != null">
|
||||
AND t1.tax_agent_id = #{param.taxAgentId}
|
||||
</if>
|
||||
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
||||
AND t1.tax_agent_id IN
|
||||
<foreach collection="param.taxAgentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 部门 -->
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- 工号 -->
|
||||
<if test="param.jobNum != null and param.jobNum != ''">
|
||||
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
|
||||
</if>
|
||||
<!-- 入职日期 -->
|
||||
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
||||
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
||||
</if>
|
||||
<!-- 手机号 -->
|
||||
<if test="param.mobile != null and param.mobile != ''">
|
||||
AND e.mobile like CONCAT('%',#{param.mobile},'%')
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="paramSql" databaseId="oracle">
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t1.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.specialAddDeductionId != null">
|
||||
AND t1.id = #{param.specialAddDeductionId}
|
||||
</if>
|
||||
<if test="param.employeeId != null">
|
||||
AND t1.employee_id = #{param.employeeId}
|
||||
</if>
|
||||
|
||||
<if test="param.keyword != null and param.keyword != ''">
|
||||
AND
|
||||
(
|
||||
e.lastname like '%'||#{param.keyword}||'%'
|
||||
OR d.departmentname like '%'||#{param.keyword}||'%'
|
||||
OR e.workcode like '%'||#{param.keyword}||'%'
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'||#{param.username}||'%'
|
||||
</if>
|
||||
|
||||
<if test="param.taxAgentId != null">
|
||||
AND t1.tax_agent_id = #{param.taxAgentId}
|
||||
</if>
|
||||
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
||||
AND t1.tax_agent_id IN
|
||||
<foreach collection="param.taxAgentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.jobNum != null and param.jobNum != ''">
|
||||
AND e.workcode like '%'||#{param.jobNum}||'%'
|
||||
</if>
|
||||
|
||||
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
||||
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
||||
</if>
|
||||
|
||||
<if test="param.mobile != null and param.mobile != ''">
|
||||
AND e.mobile like '%'||#{param.mobile}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="paramSql" databaseId="sqlserver">
|
||||
<if test="param.ids != null and param.ids.size()>0">
|
||||
AND t1.id IN
|
||||
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.specialAddDeductionId != null">
|
||||
AND t1.id = #{param.specialAddDeductionId}
|
||||
</if>
|
||||
<if test="param.employeeId != null">
|
||||
AND t1.employee_id = #{param.employeeId}
|
||||
</if>
|
||||
|
||||
<if test="param.keyword != null and param.keyword != ''">
|
||||
AND
|
||||
(
|
||||
e.lastname like '%'+#{param.keyword}+'%'
|
||||
OR d.departmentname like '%'+#{param.keyword}+'%'
|
||||
OR e.workcode like '%'+#{param.keyword}+'%'
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'+#{param.username}+'%'
|
||||
</if>
|
||||
|
||||
<if test="param.taxAgentId != null">
|
||||
AND t1.tax_agent_id = #{param.taxAgentId}
|
||||
</if>
|
||||
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
||||
AND t1.tax_agent_id IN
|
||||
<foreach collection="param.taxAgentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
||||
AND d.id IN
|
||||
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="param.jobNum != null and param.jobNum != ''">
|
||||
AND e.workcode like '%'+#{param.jobNum}+'%'
|
||||
</if>
|
||||
|
||||
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
||||
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
||||
</if>
|
||||
|
||||
<if test="param.mobile != null and param.mobile != ''">
|
||||
AND e.mobile like '%'+#{param.mobile}+'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getById" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into hrsa_special_add_deduction
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="employeeId != null">
|
||||
employee_id,
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id,
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
children_education,
|
||||
</if>
|
||||
<if test="continuingEducation != null">
|
||||
continuing_education,
|
||||
</if>
|
||||
<if test="housingLoanInterest != null">
|
||||
housing_loan_interest,
|
||||
</if>
|
||||
<if test="housingRent != null">
|
||||
housing_rent,
|
||||
</if>
|
||||
<if test="supportingElder != null">
|
||||
supporting_elder,
|
||||
</if>
|
||||
<if test="seriousIllnessTreatment != null">
|
||||
serious_illness_treatment,
|
||||
</if>
|
||||
<if test="infantCare != null">
|
||||
infant_care,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
delete_type,
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="employeeId != null">
|
||||
#{employeeId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
#{taxAgentId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
#{childrenEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="continuingEducation != null">
|
||||
#{continuingEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="housingLoanInterest != null">
|
||||
#{housingLoanInterest,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="housingRent != null">
|
||||
#{housingRent,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="supportingElder != null">
|
||||
#{supportingElder,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="seriousIllnessTreatment != null">
|
||||
#{seriousIllnessTreatment,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="infantCare != null">
|
||||
#{infantCare,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=BIGINT},
|
||||
</if>
|
||||
0,
|
||||
<if test="tenantKey != null">
|
||||
#{tenantKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertSelective" databaseId="oracle"
|
||||
parameterType="com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO">
|
||||
<selectKey keyProperty="id" resultType="long" order="AFTER">
|
||||
select hrsa_special_a_d_id.currval from dual
|
||||
</selectKey>
|
||||
insert into hrsa_special_add_deduction
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="employeeId != null">
|
||||
employee_id,
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id,
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
children_education,
|
||||
</if>
|
||||
<if test="continuingEducation != null">
|
||||
continuing_education,
|
||||
</if>
|
||||
<if test="housingLoanInterest != null">
|
||||
housing_loan_interest,
|
||||
</if>
|
||||
<if test="housingRent != null">
|
||||
housing_rent,
|
||||
</if>
|
||||
<if test="supportingElder != null">
|
||||
supporting_elder,
|
||||
</if>
|
||||
<if test="seriousIllnessTreatment != null">
|
||||
serious_illness_treatment,
|
||||
</if>
|
||||
<if test="infantCare != null">
|
||||
infant_care,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
delete_type,
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="employeeId != null">
|
||||
#{employeeId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
#{taxAgentId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
#{childrenEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="continuingEducation != null">
|
||||
#{continuingEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="housingLoanInterest != null">
|
||||
#{housingLoanInterest,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="housingRent != null">
|
||||
#{housingRent,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="supportingElder != null">
|
||||
#{supportingElder,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="seriousIllnessTreatment != null">
|
||||
#{seriousIllnessTreatment,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="infantCare != null">
|
||||
#{infantCare,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=BIGINT},
|
||||
</if>
|
||||
0,
|
||||
<if test="tenantKey != null">
|
||||
#{tenantKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
parameterType="com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO">
|
||||
<!--@mbg.generated-->
|
||||
update hrsa_special_add_deduction
|
||||
<set>
|
||||
<if test="employeeId != null">
|
||||
employee_id = #{employeeId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id = #{taxAgentId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
children_education = #{childrenEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="continuingEducation != null">
|
||||
continuing_education = #{continuingEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="housingLoanInterest != null">
|
||||
housing_loan_interest = #{housingLoanInterest,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="housingRent != null">
|
||||
housing_rent = #{housingRent,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="supportingElder != null">
|
||||
supporting_elder = #{supportingElder,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="seriousIllnessTreatment != null">
|
||||
serious_illness_treatment = #{seriousIllnessTreatment,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="infantCare != null">
|
||||
infant_care = #{infantCare,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type = #{deleteType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key = #{tenantKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
update hrsa_special_add_deduction
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="employee_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.employeeId != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.employeeId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="tax_agent_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.taxAgentId != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.taxAgentId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="children_education = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.childrenEducation != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.childrenEducation,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="continuing_education = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.continuingEducation != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.continuingEducation,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="housing_loan_interest = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.housingLoanInterest != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.housingLoanInterest,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="housing_rent = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.housingRent != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.housingRent,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="supporting_elder = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.supportingElder != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.supportingElder,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="serious_illness_treatment = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.seriousIllnessTreatment != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.seriousIllnessTreatment,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="infant_care = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.infantCare != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.infantCare,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createTime != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateTime != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="creator = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.creator != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.creator,jdbcType=BIGINT}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="delete_type = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.deleteType != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.deleteType,jdbcType=INTEGER}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="tenant_key = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.tenantKey != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.tenantKey,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
<!--@mbg.generated-->
|
||||
insert into hrsa_special_add_deduction
|
||||
(employee_id, tax_agent_id, children_education, continuing_education,
|
||||
housing_loan_interest, housing_rent, supporting_elder, serious_illness_treatment,
|
||||
infant_care, create_time, update_time, creator, delete_type, tenant_key)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.employeeId,jdbcType=BIGINT}, #{item.taxAgentId,jdbcType=BIGINT},
|
||||
#{item.childrenEducation,jdbcType=VARCHAR}, #{item.continuingEducation,jdbcType=VARCHAR},
|
||||
#{item.housingLoanInterest,jdbcType=VARCHAR}, #{item.housingRent,jdbcType=VARCHAR},
|
||||
#{item.supportingElder,jdbcType=VARCHAR}, #{item.seriousIllnessTreatment,jdbcType=VARCHAR},
|
||||
#{item.infantCare,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{item.creator,jdbcType=BIGINT}, 0, #{item.tenantKey,jdbcType=VARCHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="map" databaseId="oracle">
|
||||
insert into hrsa_special_add_deduction
|
||||
(employee_id, tax_agent_id, children_education, continuing_education,
|
||||
housing_loan_interest, housing_rent, supporting_elder, serious_illness_treatment,
|
||||
infant_care, create_time, update_time, creator, delete_type, tenant_key)
|
||||
<foreach collection="list" item="item" separator=" union all ">
|
||||
select
|
||||
#{item.employeeId,jdbcType=BIGINT}, #{item.taxAgentId,jdbcType=BIGINT},
|
||||
#{item.childrenEducation,jdbcType=VARCHAR}, #{item.continuingEducation,jdbcType=VARCHAR},
|
||||
#{item.housingLoanInterest,jdbcType=VARCHAR}, #{item.housingRent,jdbcType=VARCHAR},
|
||||
#{item.supportingElder,jdbcType=VARCHAR}, #{item.seriousIllnessTreatment,jdbcType=VARCHAR},
|
||||
#{item.infantCare,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{item.creator,jdbcType=BIGINT}, 0, #{item.tenantKey,jdbcType=VARCHAR}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="listDtoByParam" resultType="com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO">
|
||||
select
|
||||
<include refid="Special_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
||||
WHERE
|
||||
t1.delete_type = 0 AND t2.delete_type = 0
|
||||
AND e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<include refid="paramSql"/>
|
||||
ORDER BY t1.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="listByTaxAgentIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
WHERE
|
||||
t1.delete_type = 0 AND t2.delete_type = 0
|
||||
AND e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<if test="taxAgentIds != null and taxAgentIds.size() != 0">
|
||||
AND t1.tax_agent_id IN
|
||||
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
||||
#{taxAgentId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listByParam" resultType="com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO">
|
||||
select
|
||||
<include refid="Special_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
|
||||
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
||||
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
||||
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
||||
WHERE
|
||||
t1.delete_type = 0 AND t2.delete_type = 0
|
||||
AND e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<include refid="paramSql"/>
|
||||
<if test="param.orderRule != null ">
|
||||
order by ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
update hrsa_special_add_deduction
|
||||
set delete_type = 1
|
||||
where id in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
) and delete_type = 0
|
||||
</delete>
|
||||
|
||||
<select id="getByEmployeeIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
<where>
|
||||
<if test="employeeIds != null and employeeIds.size() != 0">
|
||||
<foreach collection="employeeIds" item="employeeId" separator="," open="employee_id in (" close=") ">
|
||||
#{employeeId}
|
||||
</foreach>
|
||||
</if>
|
||||
and tax_agent_id = #{taxAgentId}
|
||||
and delete_type = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package com.engine.salary.mapper.salaryacct;
|
||||
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface SalaryAcctRecordMapper {
|
||||
|
||||
|
|
@ -71,4 +73,5 @@ public interface SalaryAcctRecordMapper {
|
|||
*/
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
List<SalaryAcctRecordPO> listByCreateDate(@Param(value = "createRange") LocalDateRange createRange, @Param(value = "salarySobIds") Set<Long> salarySobIds);
|
||||
}
|
||||
|
|
@ -117,6 +117,25 @@
|
|||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
<select id="listByCreateDate" resultType="com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_acct_record t
|
||||
WHERE delete_type = 0
|
||||
<if test="salarySobIds != null and salarySobIds.size()>0">
|
||||
AND salary_sob_id IN
|
||||
<foreach collection="salarySobIds" open="(" item="salarySobId" separator="," close=")">
|
||||
#{salarySobId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="createRange != null and createRange.fromDate != null">
|
||||
AND create_time <![CDATA[ >= ]]> #{createRange.fromDate}
|
||||
</if>
|
||||
<if test="createRange != null and createRange.endDate != null">
|
||||
AND create_time <![CDATA[ <= ]]> #{createRange.endDate}
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.mapper.sys;
|
|||
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SalarySysConfMapper {
|
||||
|
|
@ -64,4 +65,12 @@ public interface SalarySysConfMapper {
|
|||
SalarySysConfPO getOneByCode(String confKey);
|
||||
|
||||
int countByCode(String confKey);
|
||||
|
||||
/**
|
||||
* @description 获取个税申报功能重启时间
|
||||
* @return Date
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/9 21:09
|
||||
*/
|
||||
Date getTaxDeclarationRebootDate();
|
||||
}
|
||||
|
|
@ -233,5 +233,8 @@
|
|||
WHERE delete_type = 0
|
||||
AND conf_key = #{confKey}
|
||||
</select>
|
||||
<select id="getTaxDeclarationRebootDate" resultType="java.util.Date">
|
||||
select update_time from HRSA_SALARY_SYS_CONF WHERE conf_key = 'taxDeclarationFunction'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -12,6 +12,7 @@ import com.engine.salary.util.page.PageInfo;
|
|||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -147,4 +148,11 @@ public interface AddUpDeductionService {
|
|||
* @date 2022/10/31 11:33
|
||||
*/
|
||||
AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam id);
|
||||
|
||||
/**
|
||||
* 自动累计专项附加扣除
|
||||
* @return void
|
||||
* @author lfc
|
||||
*/
|
||||
String autoAddAll(Date yearMonth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,4 +215,8 @@ public interface SalaryArchiveService {
|
|||
String cancelStop(Collection<Long> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 处理异常数据
|
||||
*/
|
||||
Map<String, Object> handleRepeatData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据采集-其他免税扣除
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author lfc
|
||||
* @version 1.0
|
||||
**/
|
||||
public interface SpecialAddDeductionService {
|
||||
|
||||
/**
|
||||
* 通过id获取单条专项扣除记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SpecialAddDeductionPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 数据采集-其他免税扣除列表
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
PageInfo<SpecialAddDeductionListDTO> listPage(SpecialAddDeductionQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 获取数据采集-其他免税扣除详情
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
PageInfo<SpecialAddDeductionRecordDTO> recordListPage(SpecialAddDeductionQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
*/
|
||||
XSSFWorkbook export(SpecialAddDeductionQueryParam queryParam, boolean isTemplate);
|
||||
|
||||
/**
|
||||
* 导出详情
|
||||
*
|
||||
*/
|
||||
XSSFWorkbook exportDetail(SpecialAddDeductionQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 预览
|
||||
*/
|
||||
Map<String, Object> preview(SpecialAddDeductionImportParam importParam);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
Map<String, Object> importData(SpecialAddDeductionImportParam importParam);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取其他免税扣除数据
|
||||
*
|
||||
* @param declareMonth
|
||||
* @param employeeIds
|
||||
* @return
|
||||
*/
|
||||
List<SpecialAddDeductionPO> getSpecialAddDeductionList(YearMonth declareMonth, List<Long> employeeIds, Long taxAgentId);
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*/
|
||||
void editData(SpecialAddDeductionParam SpecialAddDeductionParam);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
void createData(SpecialAddDeductionParam SpecialAddDeductionParam);
|
||||
|
||||
/**
|
||||
* 删除所选数据
|
||||
*/
|
||||
void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam);
|
||||
|
||||
/**
|
||||
* 一键清空数据
|
||||
*/
|
||||
void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam);
|
||||
|
||||
List<SpecialAddDeductionPO> getSpecialAddDeductionPOByEmployee(List<Long> employeeId, Long taxAgentId);
|
||||
|
||||
SpecialAddDeductionRecordDTO getRecordById(Long id);
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
|
|
@ -10,6 +12,7 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.salary.biz.AddUpDeductionBiz;
|
||||
import com.engine.salary.biz.EmployBiz;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
|
||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionRecordStrDTOEncrypt;
|
||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionStrDTOEncrypt;
|
||||
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||
|
|
@ -20,6 +23,7 @@ import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam;
|
|||
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
|
||||
|
|
@ -57,13 +61,14 @@ import weaver.general.Util;
|
|||
import weaver.hrm.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
|
||||
|
||||
/**
|
||||
* 累计专项
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
|
|
@ -99,7 +104,11 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
}
|
||||
|
||||
private SalarySysConfService getSalarySysConfService(User user) {
|
||||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SpecialAddDeductionService getSpecialAddDeductionService(User user) {
|
||||
return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -283,7 +292,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
errorMessageMap.put("message", rowIndex + "员工信息不存在或者存在多个员工");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
}else{
|
||||
} else {
|
||||
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
||||
addUpDeduction.setEmployeeId(employeeId);
|
||||
}
|
||||
|
|
@ -401,12 +410,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
AddUpDeduction byId = addUpDeductionBiz.getById(addUpDeduction.getId());
|
||||
if(byId == null){
|
||||
if (byId == null) {
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
if(!canEdit){
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId));
|
||||
if (!canEdit) {
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
|
|
@ -436,7 +445,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
|
||||
//税款所属期
|
||||
String declareMonthStr = addUpDeductionRecordParam.getDeclareMonth();
|
||||
if(declareMonthStr == ""){
|
||||
if (declareMonthStr .equals("")) {
|
||||
throw new SalaryRunTimeException("税款所属期不能为空!");
|
||||
}
|
||||
// 获取所有个税扣缴义务人
|
||||
|
|
@ -464,7 +473,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
.updateTime(now)
|
||||
.creator((long) user.getUID())
|
||||
.declareMonth(declareMonth).build();
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == addUpDeductionRecordParam.getEmployeeId());
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpDeductionRecordParam.getEmployeeId()));
|
||||
if (!employeeSameId) {
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
|
|
@ -485,7 +494,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
}
|
||||
}
|
||||
|
||||
//fixme 分权判断
|
||||
//fixme 分权判断
|
||||
// if (openDevolution) {
|
||||
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId())).findFirst();
|
||||
// if (!optionalTaxAgentEmp.isPresent()) {
|
||||
|
|
@ -541,15 +550,15 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr);
|
||||
// 判断是否有核算过
|
||||
List<Long> deleteList = new ArrayList<>();
|
||||
for(int i=0; i<deleteIds.size(); i++){
|
||||
for (int i = 0; i < deleteIds.size(); i++) {
|
||||
Long id = deleteIds.get(i);
|
||||
AddUpDeduction byId = addUpDeductionBiz.getById(id);
|
||||
if(byId == null){
|
||||
if (byId == null) {
|
||||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst();
|
||||
if(!first.isPresent()){
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst();
|
||||
if (!first.isPresent()) {
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
// 判断用户是否存在
|
||||
|
|
@ -575,33 +584,33 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz();
|
||||
ArrayList<Date> declareMonthDate = new ArrayList<>();
|
||||
try {
|
||||
declareMonthDate.add(sdf.parse(declareMonthStr+"-01"));
|
||||
}catch (Exception e){
|
||||
declareMonthDate.add(sdf.parse(declareMonthStr + "-01"));
|
||||
} catch (Exception e) {
|
||||
throw new SalaryRunTimeException("日期异常");
|
||||
}
|
||||
AddUpDeductionQueryParam queryParam = null;
|
||||
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
|
||||
if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) {
|
||||
// 设置了个税扣缴义务人
|
||||
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId);
|
||||
if(!canDelete){
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId));
|
||||
if (!canDelete) {
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
|
||||
}
|
||||
ArrayList<Long> tai = new ArrayList<>();
|
||||
tai.add(taxAgentId);
|
||||
queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(tai).build();
|
||||
}else {
|
||||
queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(tai).build();
|
||||
} else {
|
||||
queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(taxAgentIds).build();
|
||||
}
|
||||
// 获取所有想要删除的数据
|
||||
List<AddUpDeductionDTO> list = addUpDeductionBiz.list(queryParam);
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr);
|
||||
for(AddUpDeductionDTO item : list){
|
||||
for (AddUpDeductionDTO item : list) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("员工:"+item.getUsername()+",在该年月中已完成核算并归档,不能进行一键清空!");
|
||||
throw new SalaryRunTimeException("员工:" + item.getUsername() + ",在该年月中已完成核算并归档,不能进行一键清空!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -619,16 +628,164 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
ids.add(param.getId());
|
||||
AddUpDeductionQueryParam build = AddUpDeductionQueryParam.builder().ids(ids).build();
|
||||
List<AddUpDeductionRecordDTO> addUpDeductionRecordDTOS = new AddUpDeductionBiz().recordList(build);
|
||||
if(addUpDeductionRecordDTOS==null || addUpDeductionRecordDTOS.size()==0){
|
||||
if (addUpDeductionRecordDTOS == null || addUpDeductionRecordDTOS.size() == 0) {
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
String taxAgentName = addUpDeductionRecordDTOS.get(0).getTaxAgentName();
|
||||
if(!taxAgentNames.contains(taxAgentName)){
|
||||
if (!taxAgentNames.contains(taxAgentName)) {
|
||||
throw new SalaryRunTimeException("您无权查看该数据!");
|
||||
}
|
||||
return addUpDeductionRecordDTOS.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String autoAddAll(Date yearMonth) {
|
||||
int uid = user.getUID();
|
||||
Boolean isChief = getTaxAgentService(user).isChief((long) uid);
|
||||
Collection<TaxAgentPO> taxAgents;
|
||||
if (isChief) {
|
||||
taxAgents = getTaxAgentService(user).listAll();
|
||||
} else {
|
||||
taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) uid);
|
||||
}
|
||||
LocalDateTime yearMonthTime = DateUtil.toLocalDateTime(yearMonth);
|
||||
//设置时间到下一年1月1号
|
||||
Instant instant = yearMonthTime.plusYears(1L)
|
||||
.withMonth(1).withDayOfMonth(1)
|
||||
.atZone(ZoneOffset.systemDefault()).toInstant();
|
||||
Date nextYearStart = Date.from(instant);
|
||||
int countByDeclareAfter = getAddUpDeductionMapper()
|
||||
.countByDeclareAfter(yearMonth, nextYearStart,
|
||||
taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList())
|
||||
);
|
||||
if (countByDeclareAfter > 0) {
|
||||
throw new SalaryRunTimeException("无法累计,请检查当前累计年度内该月后是否有累计专项附加扣除记录!");
|
||||
}
|
||||
List<AddUpDeduction> updateList = new ArrayList<>();
|
||||
List<AddUpDeduction> insertList = new ArrayList<>();
|
||||
List<Long> errorMessages = new ArrayList<>();
|
||||
List<SalaryAcctEmployeePO> accountedEmployeeData =
|
||||
getAccountedEmployeeData(DateUtil.format(yearMonth, "yyyy-MM"));
|
||||
for (TaxAgentPO taxAgent : taxAgents) {
|
||||
Collection<Long> employeeIds = getTaxAgentService(user)
|
||||
.listEmployeeIdsInTaxAgent(taxAgent.getId());
|
||||
List<SpecialAddDeductionPO> employeePOs = getSpecialAddDeductionService(user)
|
||||
.getSpecialAddDeductionPOByEmployee(null, taxAgent.getId());
|
||||
|
||||
|
||||
//获取上月员工数据,用于累加
|
||||
LocalDateTime lastMonthDateTime = yearMonthTime.minusMonths(1);
|
||||
YearMonth lastMonth = YearMonth.of(lastMonthDateTime.getYear(), lastMonthDateTime.getMonth());
|
||||
Map<Long, List<AddUpDeduction>> lastEmpInfo = getEmpInfoByYearMonth(taxAgent, employeePOs, lastMonth);
|
||||
|
||||
//获取当月员工数据,用于更新
|
||||
YearMonth currentMonth = YearMonth.of(yearMonthTime.getYear(), yearMonthTime.getMonth());
|
||||
Map<Long, List<AddUpDeduction>> currentEmpInfo = getEmpInfoByYearMonth(taxAgent, employeePOs, currentMonth);
|
||||
|
||||
employeePOs.forEach(employeePO -> {
|
||||
Long employeeId = employeePO.getEmployeeId();
|
||||
// 如果该员工当前月份已经核算,不做累计
|
||||
SalaryAcctEmployeePO anyAccountedEmployee = accountedEmployeeData.stream()
|
||||
.filter(e -> e.getEmployeeId().equals(employeeId))
|
||||
.filter(e -> e.getTaxAgentId().equals(taxAgent.getId()))
|
||||
.findAny().orElse(null);
|
||||
if (anyAccountedEmployee != null) {
|
||||
errorMessages.add(employeeId);
|
||||
return;
|
||||
}
|
||||
AddUpDeduction addUpDeduction = Optional.ofNullable(lastEmpInfo.get(employeeId))
|
||||
.flatMap(list -> list.stream().findFirst())
|
||||
.orElseGet(AddUpDeduction::new);
|
||||
this.combine(addUpDeduction, employeePO);
|
||||
|
||||
addUpDeduction.setEmployeeId(employeeId);
|
||||
addUpDeduction.setTaxAgentId(taxAgent.getId());
|
||||
addUpDeduction.setDeclareMonth(DateUtil.beginOfMonth(yearMonth));
|
||||
addUpDeduction.setCreator((long) user.getUID());
|
||||
addUpDeduction.setTenantKey(DEFAULT_TENANT_KEY);
|
||||
|
||||
//确认当期是否有已经累计的记录
|
||||
AddUpDeduction oldInfo = Optional.ofNullable(currentEmpInfo.get(employeeId))
|
||||
.flatMap(c -> c.stream().findFirst())
|
||||
.orElse(null);
|
||||
if (oldInfo == null) {
|
||||
addUpDeduction.setCreateTime(yearMonth);
|
||||
addUpDeduction.setUpdateTime(yearMonth);
|
||||
insertList.add(AddUpDeductionEncrypt.encryptAddUpDeduction(addUpDeduction));
|
||||
} else {
|
||||
addUpDeduction.setId(oldInfo.getId());
|
||||
addUpDeduction.setCreateTime(oldInfo.getCreateTime());
|
||||
addUpDeduction.setUpdateTime(yearMonth);
|
||||
updateList.add(AddUpDeductionEncrypt.encryptAddUpDeduction(addUpDeduction));
|
||||
}
|
||||
});
|
||||
}
|
||||
Lists.partition(insertList, 100)
|
||||
.forEach(l -> getAddUpDeductionMapper().insertData((List<AddUpDeduction>) l));
|
||||
Lists.partition(updateList, 100)
|
||||
.forEach(l -> getAddUpDeductionMapper().updateDataAndDeclareMonth((List<AddUpDeduction>) l));
|
||||
if (!errorMessages.isEmpty()) {
|
||||
String userNames = getSalaryEmployeeService(user)
|
||||
.listByIds(errorMessages)
|
||||
.stream()
|
||||
.map(DataCollectionEmployee::getUsername)
|
||||
.collect(Collectors.joining(","));
|
||||
return "一键累计完成!员工" + userNames + "在该年月已核算归档,跳过本次累计";
|
||||
}
|
||||
return "一键累计完成!";
|
||||
}
|
||||
|
||||
/**
|
||||
* 对每个扣除项做加法
|
||||
*
|
||||
* @param addUpDeduction 上次记录
|
||||
* @param employeePO 专项附加扣除值
|
||||
*/
|
||||
private void combine(AddUpDeduction addUpDeduction, SpecialAddDeductionPO employeePO) {
|
||||
final String zero = "0";
|
||||
String childEducation = Optional.ofNullable(addUpDeduction.getAddUpChildEducation()).orElse(zero);
|
||||
addUpDeduction.setAddUpChildEducation(plus(childEducation, employeePO.getChildrenEducation()));
|
||||
|
||||
String continuingEducation = Optional.ofNullable(addUpDeduction.getAddUpContinuingEducation()).orElse(zero);
|
||||
addUpDeduction.setAddUpContinuingEducation(plus(continuingEducation, employeePO.getContinuingEducation()));
|
||||
|
||||
String housingLoanInterest = Optional.ofNullable(addUpDeduction.getAddUpHousingLoanInterest()).orElse(zero);
|
||||
addUpDeduction.setAddUpHousingLoanInterest(plus(housingLoanInterest, employeePO.getHousingLoanInterest()));
|
||||
|
||||
String housingRent = Optional.ofNullable(addUpDeduction.getAddUpHousingRent()).orElse(zero);
|
||||
addUpDeduction.setAddUpHousingRent(plus(housingRent, employeePO.getHousingRent()));
|
||||
|
||||
String supportElderly = Optional.ofNullable(addUpDeduction.getAddUpSupportElderly()).orElse(zero);
|
||||
addUpDeduction.setAddUpSupportElderly(plus(supportElderly, employeePO.getSupportingElder()));
|
||||
|
||||
String illnessMedical = Optional.ofNullable(addUpDeduction.getAddUpIllnessMedical()).orElse(zero);
|
||||
addUpDeduction.setAddUpIllnessMedical(plus(illnessMedical, employeePO.getSeriousIllnessTreatment()));
|
||||
|
||||
String infantCare = Optional.ofNullable(addUpDeduction.getAddUpInfantCare()).orElse(zero);
|
||||
addUpDeduction.setAddUpInfantCare(plus(infantCare, employeePO.getInfantCare()));
|
||||
}
|
||||
|
||||
private String plus(String var0, String var1) {
|
||||
if (StrUtil.isEmpty(var0)) {
|
||||
var0 = "0";
|
||||
}
|
||||
if (StrUtil.isEmpty(var1)) {
|
||||
var1 = "0";
|
||||
}
|
||||
return new BigDecimal(var0)
|
||||
.add(new BigDecimal(var1))
|
||||
.toString();
|
||||
}
|
||||
|
||||
private Map<Long, List<AddUpDeduction>> getEmpInfoByYearMonth(TaxAgentPO taxAgent, List<SpecialAddDeductionPO> employeePOs, YearMonth lastMonth) {
|
||||
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionList(lastMonth,
|
||||
employeePOs.stream().map(SpecialAddDeductionPO::getEmployeeId).collect(Collectors.toList()),
|
||||
taxAgent.getId());
|
||||
return addUpDeductionList.stream()
|
||||
.filter(addUpDeduction -> taxAgent.getId().equals(addUpDeduction.getTaxAgentId()))
|
||||
.collect(Collectors.groupingBy(AddUpDeduction::getEmployeeId));
|
||||
}
|
||||
|
||||
|
||||
private void checkImportParam(AddUpDeductionImportParam importParam) {
|
||||
|
||||
|
|
@ -906,7 +1063,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
}
|
||||
List<AddUpDeductionDTO> list = new AddUpDeductionBiz().list(queryParam);
|
||||
|
||||
for(AddUpDeductionDTO dto : list) {
|
||||
for (AddUpDeductionDTO dto : list) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("username", Util.null2String(dto.getUsername()));
|
||||
resultMap.put("departmentName", Util.null2String(dto.getDepartmentName()));
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId));
|
||||
if(!canEdit){
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
|
|
@ -922,7 +922,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == addUpSituationParam.getEmployeeId());
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpSituationParam.getEmployeeId()));
|
||||
if(!employeeSameId){
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
|
|
@ -1033,7 +1033,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst();
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst();
|
||||
if(!first.isPresent()){
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
|
|
@ -1069,7 +1069,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
|
||||
// 设置了个税扣缴义务人
|
||||
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId);
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId));
|
||||
if(!canDelete){
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.enums.salaryformula.ReferenceTypeEnum;
|
||||
import com.engine.salary.formlua.entity.parameter.DataType;
|
||||
import com.engine.salary.service.FormulaRunService;
|
||||
import com.engine.salary.sys.enums.OpenEnum;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
|
@ -56,6 +58,8 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
String extendParam = expressFormula.getExtendParam();
|
||||
String sqlReturnKey = "";
|
||||
String datasourceId = "";
|
||||
String openDecrypt = "";
|
||||
String result = "";
|
||||
try {
|
||||
JsonNode jsonNode = objectMapper.readTree(extendParam);
|
||||
//返回值配置
|
||||
|
|
@ -71,6 +75,11 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
datasourceId = datasourceIdNode.asText();
|
||||
}
|
||||
}
|
||||
//是否需要解密
|
||||
JsonNode decrypt = jsonNode.get("openDecrypt");
|
||||
if (decrypt != null) {
|
||||
openDecrypt = decrypt.asText().trim();
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("express execute fail, sql extendParam parse fail", e);
|
||||
}
|
||||
|
|
@ -89,18 +98,22 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService
|
|||
RecordSetDataSource rs = new RecordSetDataSource(datasourceId);
|
||||
if (rs.executeSql(sql)) {
|
||||
if (rs.next()) {
|
||||
return rs.getString(sqlReturnKey);
|
||||
result = rs.getString(sqlReturnKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RecordSet rs = new RecordSet();
|
||||
if (rs.execute(sql)) {
|
||||
if (rs.next()) {
|
||||
return rs.getString(sqlReturnKey);
|
||||
result = rs.getString(sqlReturnKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
|
||||
if (OpenEnum.OPEN.getValue().equals(openDecrypt)) {
|
||||
result = AESEncryptUtil.decrypt(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object runFormula(ExpressFormula expressFormula, List<FormulaVar> formulaVars) throws Exception {
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId));
|
||||
if(!canEdit){
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
|
|
@ -622,7 +622,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
.declareMonth(declareMonth).build();
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == otherDeductionParam.getEmployeeId());
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , otherDeductionParam.getEmployeeId()));
|
||||
if(!employeeSameId){
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
|
|
@ -701,7 +701,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst();
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst();
|
||||
if(!first.isPresent()){
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
|
|
@ -737,7 +737,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
|
||||
// 设置了个税扣缴义务人
|
||||
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId);
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId));
|
||||
if(!canDelete){
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,8 +186,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
private void handleHistoryData(long currentEmployeeId) {
|
||||
//如果触发历史数据处理,则进行一次全量增员
|
||||
if (siArchivesBiz.createOldInsuranceBaseInfo(currentEmployeeId)) {
|
||||
//全量增员
|
||||
allStayAddToPay();
|
||||
|
||||
//批量增员
|
||||
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
|
||||
Collection<Long> stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()))
|
||||
.map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
if (stayAddIds.size() > 0) {
|
||||
stayAddToPay(stayAddIds);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -742,9 +748,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
*/
|
||||
@Override
|
||||
public Map<String, Object> allStayDelToStop() {
|
||||
long currentEmployeeId = user.getUID();
|
||||
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
|
||||
if (allBaseInfoList.size() > 0) {
|
||||
Collection<Long> stayDelIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()))
|
||||
//筛选当前人员可管辖(个税扣缴义务人)范围
|
||||
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
|
||||
List<Long> paymentOrganizationList = taxAgentList.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
|
||||
Collection<Long> stayDelIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) && paymentOrganizationList.contains(f.getPaymentOrganization()))
|
||||
.map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
if (stayDelIds.size() > 0) {
|
||||
return stayDelToStop(stayDelIds);
|
||||
|
|
@ -835,7 +846,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
}
|
||||
return flag;
|
||||
})
|
||||
.map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
.map(InsuranceArchivesFundSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopFundIds = toStopFundIds;
|
||||
toPayBaseInfoIdList = (List<Long>) CollectionUtils.union(toPayBaseInfoIdList, baseInfoPOList.stream().filter(f -> finalToStopFundIds.contains(f.getFundArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
||||
|
|
@ -856,7 +867,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
}
|
||||
return flag;
|
||||
})
|
||||
.map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
.map(InsuranceArchivesOtherSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopOtherIds = toStopOtherIds;
|
||||
toPayBaseInfoIdList = (List<Long>) CollectionUtils.union(toPayBaseInfoIdList, baseInfoPOList.stream().filter(f -> finalToStopOtherIds.contains(f.getOtherArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
||||
|
|
@ -914,9 +925,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
*/
|
||||
@Override
|
||||
public Map<String, Object> allStayAddToPay() {
|
||||
long currentEmployeeId = user.getUID();
|
||||
List<InsuranceArchivesBaseInfoPO> allBaseInfoList = getInsuranceBaseInfoMapper().listAll();
|
||||
if (allBaseInfoList.size() > 0) {
|
||||
Collection<Long> stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()))
|
||||
//筛选当前人员可管辖(个税扣缴义务人)范围
|
||||
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
|
||||
List<Long> paymentOrganizationList = taxAgentList.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
|
||||
Collection<Long> stayAddIds = allBaseInfoList.stream().filter(f->f.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue()) && paymentOrganizationList.contains(f.getPaymentOrganization()))
|
||||
.map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
|
||||
if (stayAddIds.size() > 0) {
|
||||
return stayAddToPay(stayAddIds);
|
||||
|
|
|
|||
|
|
@ -898,6 +898,15 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "社保方案不存在"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else if (StringUtils.isNotBlank((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")))
|
||||
&& schemeNameIdMap.get((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) != null
|
||||
&& !getInsuranceSchemeMapper().getById(schemeNameIdMap.get((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")))).getWelfareType().equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue())) {
|
||||
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "社保方案不属于社保福利类型"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
|
||||
} else {
|
||||
insuranceArchivesSocialSchemePO = buildSocialPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
||||
}
|
||||
|
|
@ -906,15 +915,32 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100323, "公积金方案不存在"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else {
|
||||
} else if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")))
|
||||
&& schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))) != null
|
||||
&& !getInsuranceSchemeMapper().getById(schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")))).getWelfareType().equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue())) {
|
||||
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "公积金方案不属于公积金福利类型"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
|
||||
}else {
|
||||
insuranceArchivesFundSchemePO = buildFundPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
||||
}
|
||||
if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) && schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) == null) {
|
||||
if (StringUtils.isNotBlank((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) && schemeNameIdMap.get((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) == null) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100324, "其他福利方案不存在"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
} else {
|
||||
} else if (StringUtils.isNotBlank((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))
|
||||
&& schemeNameIdMap.get((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) != null
|
||||
&& !getInsuranceSchemeMapper().getById(schemeNameIdMap.get((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))).getWelfareType().equals(WelfareTypeEnum.OTHER.getValue())) {
|
||||
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "其他福利方案不属于其他福利类型"));
|
||||
excelComments.add(errorMessageMap);
|
||||
isError = true;
|
||||
}else {
|
||||
insuranceArchivesOtherSchemePO = buildOtherPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
||||
}
|
||||
/**************校验申报基数**************/
|
||||
|
|
|
|||
|
|
@ -198,7 +198,19 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId)) {
|
||||
// 转换成薪资核算结果po
|
||||
SalaryAcctResultTempPO salaryAcctResultTempPO = new SalaryAcctResultTempPO()
|
||||
.setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId()).setSalaryAcctEmpId(salaryAcctEmployeePO.getId()).setEmployeeId(salaryAcctEmployeePO.getEmployeeId()).setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId()).setSalarySobId(salaryAcctEmployeePO.getSalarySobId()).setSalaryItemId(salaryItemPO.getId()).setResultValue(resultValue).setCalculateKey(salaryAcctCalculateBO.getCalculateKey()).setCreator((long) user.getUID()).setCreateTime(now).setUpdateTime(now).setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).setDeleteType(0);
|
||||
.setSalaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId())
|
||||
.setSalaryAcctEmpId(salaryAcctEmployeePO.getId())
|
||||
.setEmployeeId(salaryAcctEmployeePO.getEmployeeId())
|
||||
.setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId())
|
||||
.setSalarySobId(salaryAcctEmployeePO.getSalarySobId())
|
||||
.setSalaryItemId(salaryItemPO.getId())
|
||||
.setResultValue(resultValue)
|
||||
.setCalculateKey(salaryAcctCalculateBO.getCalculateKey())
|
||||
.setCreator((long) user.getUID())
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now)
|
||||
.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.setDeleteType(0);
|
||||
salaryAcctResultTempPOS.add(salaryAcctResultTempPO);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
|||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
|
@ -65,6 +68,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalarySendServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySysConfService getSalarySysConfService(User user){
|
||||
return ServiceUtil.getService(SalarySysConfServiceImpl.class,user);
|
||||
}
|
||||
|
||||
// private SalaryCheckResultService salaryCheckResultService;
|
||||
//
|
||||
// private SalaryCheckResultDetailService salaryCheckResultDetailService;
|
||||
|
|
@ -85,6 +92,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SalaryAcctRecordPO getById(Long id) {
|
||||
return getSalaryAcctRecordMapper().getById(id);
|
||||
|
|
@ -296,39 +304,137 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
//获取账套下的所有核算结果
|
||||
List<SalaryAcctRecordPO> salaryAcctRecords = listByTaxCycle(taxCycleYearRange,salarySobIds);
|
||||
|
||||
// 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算
|
||||
SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getTaxCycle().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(notDeclaredSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98751, "税款所属期{0}的薪资核算结果还未申报,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(notDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
// 获取个税申报功能状态
|
||||
TaxDeclarationFunctionEnum taxDeclarationFunctionEnum = getSalarySysConfService(user).getTaxDeclaration();
|
||||
|
||||
if(taxDeclarationFunctionEnum.getValue().equals(TaxDeclarationFunctionEnum.CLOSURE.getValue())){
|
||||
// 关闭了个税申报功能
|
||||
// 如果某个月(薪资所属期)还未归档,不可以新建之后月份的薪资核算
|
||||
SalaryAcctRecordPO notArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())
|
||||
&& e.getSalaryMonth().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getSalaryMonth().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if(Objects.nonNull(notArchivedSalaryAcctRecordPO)){
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98754, "薪资所属期{0}的薪资核算结果还未归档,不能新建薪资所属期{1}的薪资核算")
|
||||
.replace("{0}",SalaryDateUtil.localDate2YearMonth(notArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}",salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
// 如果有某个月(薪资所属期)已经归档了,不可以新建之前月份的薪资核算
|
||||
SalaryAcctRecordPO havaSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
|
||||
&& e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getSalaryMonth().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if(Objects.nonNull(havaSalaryAcctRecordPO)){
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98755, "薪资所属期{0}的薪资核算结果已经归档,不能新建薪资所属期{1}的薪资核算")
|
||||
.replace("{0}",SalaryDateUtil.localDate2YearMonth(havaSalaryAcctRecordPO.getSalaryMonth()).toString())
|
||||
.replace("{1}",salarySobCycleDTO.getSalaryMonth().toString()));
|
||||
}
|
||||
|
||||
}
|
||||
// 如果某个月(税款所属期)已经归档了,不可以新建之前月份的薪资核算
|
||||
SalaryAcctRecordPO hasArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
|
||||
&& e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(hasArchivedSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98752, "税款所属期{0}的薪资核算结果已经归档,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
if(taxDeclarationFunctionEnum.getValue().equals(TaxDeclarationFunctionEnum.OPEN.getValue())){
|
||||
// 开启了个税申报功能
|
||||
// 如果某个月(税款所属期)已经归档了,不可以新建之前月份的薪资核算
|
||||
SalaryAcctRecordPO hasArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
|
||||
&& e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(hasArchivedSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98752, "税款所属期{0}的薪资核算结果已经归档,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
// 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算
|
||||
SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getTaxCycle().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(notDeclaredSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98751, "税款所属期{0}的薪资核算结果还未申报,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(notDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
// 如果某个月(税款所属期)已经申报了,不可以新建本月以及之前月份的薪资核算
|
||||
SalaryAcctRecordPO hasDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getTaxCycle().compareTo(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))) >= 0)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(hasDeclaredSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98753, "税款所属期{0}的薪资核算结果已经申报,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
}
|
||||
// 如果某个月(税款所属期)已经申报了,不可以新建本月以及之前月份的薪资核算
|
||||
SalaryAcctRecordPO hasDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getTaxCycle().compareTo(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))) >= 0)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(hasDeclaredSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98753, "税款所属期{0}的薪资核算结果已经申报,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
if(taxDeclarationFunctionEnum.getValue().equals(TaxDeclarationFunctionEnum.REBOOT.getValue())){
|
||||
// 重启了个税申报功能(不去校验重启之前是否申报数据)
|
||||
// 如果某个月(薪资所属期)还未归档,不可以新建之后月份的薪资核算
|
||||
SalaryAcctRecordPO notArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())
|
||||
&& e.getSalaryMonth().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getSalaryMonth().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if(Objects.nonNull(notArchivedSalaryAcctRecordPO)){
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98754, "薪资所属期{0}的薪资核算结果还未归档,不能新建薪资所属期{1}的薪资核算")
|
||||
.replace("{0}",SalaryDateUtil.localDate2YearMonth(notArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}",salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
// 如果某个月(税款所属期)已经归档了,不可以新建之前月份的薪资核算
|
||||
SalaryAcctRecordPO hasArchivedSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())
|
||||
&& e.getTaxCycle().after(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(hasArchivedSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98752, "税款所属期{0}的薪资核算结果已经归档,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasArchivedSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
// 如果某个月(税款所属期)还未申报,不可以新建之后月份的薪资核算
|
||||
//获取账套下从重启月至所在年的最后一天的所有核算结果
|
||||
Date taxDeclarationRebootDate = getSalarySysConfService(user).getTaxDeclarationRebootDate();
|
||||
if(taxDeclarationRebootDate == null){
|
||||
throw new SalaryRunTimeException("个税申报功能异常");
|
||||
}
|
||||
|
||||
LocalDateRange taxCycleRebootYearRange = LocalDateRange.builder()
|
||||
.fromDate(taxDeclarationRebootDate)
|
||||
.endDate(SalaryDateUtil.getLastDayOfYear(taxDeclarationRebootDate))
|
||||
.build();
|
||||
// List<SalaryAcctRecordPO> salaryAcctRebootRecords = listByTaxCycle(taxCycleRebootYearRange,salarySobIds);
|
||||
List<SalaryAcctRecordPO> salaryAcctRebootRecords = listByCreateDate(taxCycleRebootYearRange,salarySobIds);
|
||||
SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRebootRecords.stream()
|
||||
.filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getTaxCycle().before(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(notDeclaredSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98751, "税款所属期{0}的薪资核算结果还未申报,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(notDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
|
||||
// 如果某个月(税款所属期)已经申报了,不可以新建本月以及之前月份的薪资核算
|
||||
SalaryAcctRecordPO hasDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getTaxCycle().compareTo(SalaryDateUtil.localDateToDate(salarySobCycleDTO.getTaxCycle().atDay(1))) >= 0)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(hasDeclaredSalaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98753, "税款所属期{0}的薪资核算结果已经申报,不能新建税款所属期{1}的薪资核算")
|
||||
.replace("{0}", SalaryDateUtil.localDate2YearMonth(hasDeclaredSalaryAcctRecordPO.getTaxCycle()).toString())
|
||||
.replace("{1}", salarySobCycleDTO.getTaxCycle().toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<SalaryAcctRecordPO> listByCreateDate(LocalDateRange taxCycleRebootYearRange, Set<Long> salarySobIds) {
|
||||
return getSalaryAcctRecordMapper().listByCreateDate(taxCycleRebootYearRange,salarySobIds);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -454,7 +560,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "薪资所属月为空"));
|
||||
}
|
||||
// 查询税款所在年的该个税扣缴义务人所有薪资核算记录
|
||||
//获取账套所属个税扣缴义务人的核算记录
|
||||
// 获取账套所属个税扣缴义务人的核算记录
|
||||
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||
Long taxAgentId = salarySobPO.getTaxAgentId();
|
||||
//查询扣缴义务人下的所有账套
|
||||
|
|
@ -474,8 +580,22 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
//撤回工资单
|
||||
getSalarySendService(user).revokeSalaryBill(salaryAcctRecordId);
|
||||
//删除个税申报表(个税申报表、个税申报表详情、往期累计情况)
|
||||
getTaxDeclarationService(user).delete(salaryAcctRecordPO);
|
||||
|
||||
TaxDeclarationFunctionEnum taxDeclaration = getSalarySysConfService(user).getTaxDeclaration();
|
||||
|
||||
// if(taxDeclaration.getValue().equals(TaxDeclarationFunctionEnum.OPEN.getValue())){
|
||||
// 开启了个税申报功能
|
||||
// 删除个税申报表(个税申报表、个税申报表详情、往期累计情况)
|
||||
getTaxDeclarationService(user).delete(salaryAcctRecordPO);
|
||||
// }else if(taxDeclaration.getValue().equals(TaxDeclarationFunctionEnum.REBOOT.getValue())){
|
||||
// // 重启个税申报功能
|
||||
// Date taxDeclarationRebootDateTemp = getSalarySysConfService(user).getTaxDeclarationRebootDate();
|
||||
// Date taxDeclarationRebootDate = SalaryDateUtil.getFirstDayDateOfMonthWithMinutesAndSeconds(taxDeclarationRebootDateTemp);
|
||||
// if(!taxDeclarationRebootDate.after(salaryAcctRecordPO.getTaxCycle())){
|
||||
// // 删除个税申报表(个税申报表、个税申报表详情、往期累计情况)
|
||||
// getTaxDeclarationService(user).delete(salaryAcctRecordPO);
|
||||
// }
|
||||
// }
|
||||
// 更新薪资核算记录的状态
|
||||
salaryAcctRecordPO.setStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue());
|
||||
salaryAcctRecordPO.setUpdateTime(new Date());
|
||||
|
|
|
|||
|
|
@ -1,19 +1,27 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.encrypt.report.SalaryAcctResultReportPOEncrypt;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.mapper.report.SalaryAcctResultReportMapper;
|
||||
import com.engine.salary.service.SalaryAcctReportService;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.enums.OpenEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.engine.salary.sys.constant.SalarySysConstant.DISPLAY_EMP_INFO_REPORT;
|
||||
|
||||
/**
|
||||
* 薪资报表
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
|
|
@ -28,6 +36,11 @@ public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctRe
|
|||
return MapperProxyFactory.getProxy(SalaryAcctResultReportMapper.class);
|
||||
}
|
||||
|
||||
|
||||
private SalarySysConfService getSalarySysConfService(User user) {
|
||||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪酬解密方法
|
||||
*
|
||||
|
|
@ -61,7 +74,11 @@ public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctRe
|
|||
@Override
|
||||
public void batchSave(Collection<SalaryAcctResultReportPO> pos) {
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
SalaryAcctResultReportPOEncrypt.encryptList(pos);
|
||||
SalarySysConfPO disPlay = getSalarySysConfService(user).getOneByCode(DISPLAY_EMP_INFO_REPORT);
|
||||
//默认不显示,关闭状态
|
||||
if (disPlay == null || OpenEnum.OFF.getValue().equals(disPlay.getConfValue())) {
|
||||
SalaryAcctResultReportPOEncrypt.encryptList(pos);
|
||||
}
|
||||
// List<List<SalaryAcctResultReportPO>> partition = Lists.partition((List) pos, 100);
|
||||
// partition.forEach(getSalaryAcctResultReportMapper()::batchInsert);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.*;
|
||||
|
|
@ -26,9 +26,9 @@ import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum;
|
|||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
|
||||
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.OpenEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
|
|
@ -62,6 +62,7 @@ import weaver.hrm.User;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -118,11 +119,6 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
return ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
private SalarySysConfMapper getSalarySysConfMapper() {
|
||||
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalaryArchivePO getById(Long salaryArchiveId) {
|
||||
return salaryArchiveMapper.getById(salaryArchiveId);
|
||||
|
|
@ -131,10 +127,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
@Override
|
||||
public List<SalaryArchivePO> listSome(SalaryArchivePO po) {
|
||||
Collection<Long> ids = po.getIds();
|
||||
if(CollectionUtils.isNotEmpty(ids)){
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
List<SalaryArchivePO> list = new ArrayList<>();
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) ids, 1000);
|
||||
partition.forEach(idss->{
|
||||
partition.forEach(idss -> {
|
||||
po.setIds(idss);
|
||||
list.addAll(getSalaryArchiveMapper().listSome(po));
|
||||
});
|
||||
|
|
@ -142,10 +138,10 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
}
|
||||
|
||||
Collection<Long> employeeIds = po.getEmployeeIds();
|
||||
if(CollectionUtils.isNotEmpty(employeeIds)){
|
||||
if (CollectionUtils.isNotEmpty(employeeIds)) {
|
||||
List<SalaryArchivePO> list = new ArrayList<>();
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) employeeIds, 1000);
|
||||
partition.forEach(emps->{
|
||||
partition.forEach(emps -> {
|
||||
po.setEmployeeIds(emps);
|
||||
list.addAll(getSalaryArchiveMapper().listSome(po));
|
||||
});
|
||||
|
|
@ -160,13 +156,24 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
public PageInfo<SalaryArchiveListDTO> listPage(SalaryArchiveQueryParam queryParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
|
||||
|
||||
// 1.历史数据处理
|
||||
handleHistory(currentEmployeeId);
|
||||
// 2.待停薪自动处理
|
||||
handleSuspendData(currentEmployeeId);
|
||||
// 3.增量数据处理
|
||||
handleChangeData(currentEmployeeId);
|
||||
/**
|
||||
* 异步处理档案数据
|
||||
*/
|
||||
String handleable = Util.null2String(Util_DataCache.getObjVal("salaryArchiveHandleable"));
|
||||
if (StringUtils.isBlank(handleable) || OpenEnum.OPEN.getValue().equals(handleable)) {
|
||||
new Thread() {
|
||||
public void run() {
|
||||
Util_DataCache.setObjVal("salaryArchiveHandleable", "0");
|
||||
// 1.历史数据处理
|
||||
handleHistory(currentEmployeeId);
|
||||
// 2.待停薪自动处理
|
||||
handleSuspendData(currentEmployeeId);
|
||||
// 3.增量数据处理
|
||||
handleChangeData(currentEmployeeId);
|
||||
Util_DataCache.setObjVal("salaryArchiveHandleable", "1");
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
|
||||
|
|
@ -1107,9 +1114,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
}
|
||||
|
||||
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
|
||||
.ids(ids)
|
||||
.runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
|
||||
.build());
|
||||
.ids(ids)
|
||||
.runStatus(SalaryArchiveStatusEnum.PENDING.getValue())
|
||||
.build());
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(oldList)) {
|
||||
|
|
@ -1192,9 +1199,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
|
||||
}
|
||||
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
|
||||
.ids(ids)
|
||||
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
|
||||
.build());
|
||||
.ids(ids)
|
||||
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
|
||||
.build());
|
||||
|
||||
if (CollectionUtils.isEmpty(oldList)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "档案不存在!"));
|
||||
|
|
@ -1241,9 +1248,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
}
|
||||
|
||||
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
|
||||
.ids(ids)
|
||||
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
|
||||
.build());
|
||||
.ids(ids)
|
||||
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
|
||||
.build());
|
||||
List<SalaryArchivePO> unableList = oldList.stream().filter(f -> Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().after(new Date())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(unableList)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115789, "最后发薪日必须晚于今天"));
|
||||
|
|
@ -1286,4 +1293,27 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
|||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> handleRepeatData() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
//获取所有薪资档案
|
||||
List<SalaryArchivePO> list = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build());
|
||||
AtomicInteger num = new AtomicInteger();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
Map<String, List<SalaryArchivePO>> maps = SalaryEntityUtil.group2Map(list, k -> k.getTaxAgentId() + "-" + k.getEmployeeId());
|
||||
maps.forEach((key, pos) -> {
|
||||
if (pos.size() > 1) {
|
||||
for (int i = 1; i < pos.size(); i++) {
|
||||
SalaryArchivePO salaryArchivePO = pos.get(i);
|
||||
getSalaryArchiveMapper().delete(salaryArchivePO);
|
||||
num.getAndIncrement();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
result.put("共处理", num.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,670 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.biz.EmployBiz;
|
||||
import com.engine.salary.biz.SpecialAddDeductionBiz;
|
||||
import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.service.AddUpDeductionService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.SpecialAddDeductionService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.excel.ExcelParseHelper;
|
||||
import com.engine.salary.util.excel.ExcelUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
|
||||
|
||||
public class SpecialAddDeductionServiceImpl extends Service implements SpecialAddDeductionService {
|
||||
|
||||
private SpecialAddDeductionBiz getSpecialAddDeductionBiz() {
|
||||
return new SpecialAddDeductionBiz();
|
||||
}
|
||||
|
||||
private SpecialAddDeductionMapper getSpecialAddDeductionMapper() {
|
||||
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private AddUpDeductionService getAddUpDeductionService(User user) {
|
||||
return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySysConfMapper getSalarySysConfMapper() {
|
||||
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
|
||||
}
|
||||
|
||||
private SalarySysConfService getSalarySysConfService(User user) {
|
||||
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpecialAddDeductionPO getById(Long id) {
|
||||
return getSpecialAddDeductionBiz().getById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<SpecialAddDeductionListDTO> listPage(SpecialAddDeductionQueryParam queryParam) {
|
||||
//排序配置
|
||||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
queryParam.setOrderRule(orderRule);
|
||||
|
||||
long employeeId = user.getUID();
|
||||
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
|
||||
if (needAuth) {
|
||||
putQueryRange(queryParam);
|
||||
}
|
||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionMapper().listByParam(queryParam);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
return new PageInfo<>(list, SpecialAddDeductionListDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<SpecialAddDeductionRecordDTO> recordListPage(SpecialAddDeductionQueryParam queryParam) {
|
||||
long employeeId = user.getUID();
|
||||
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
|
||||
if (needAuth) {
|
||||
putQueryRange(queryParam);
|
||||
}
|
||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDtoByParam(queryParam);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
|
||||
return new PageInfo<>(list, SpecialAddDeductionRecordDTO.class);
|
||||
}
|
||||
|
||||
private void putQueryRange(SpecialAddDeductionQueryParam queryParam) {
|
||||
Long employeeId = (long) user.getUID();
|
||||
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user)
|
||||
.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
|
||||
// 不是个税扣缴义务人管理员,限定搜索范围为当前登录人
|
||||
List<Long> taxAgentIdsAsEmployee = getTaxAgentService(user)
|
||||
.listAllTaxAgentsAsRange(Collections.singletonList(employeeId))
|
||||
.stream().filter(t -> t.getEmployeeId().equals(employeeId))
|
||||
.map(TaxAgentEmployeeTaxAgentDTO::getTaxAgentIds)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
queryParam.setTaxAgentIds(taxAgentIdsAsEmployee);
|
||||
queryParam.setEmployeeId(employeeId);
|
||||
} else {
|
||||
//管理员设置相应的个税扣缴义务人来筛选
|
||||
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> preview(SpecialAddDeductionImportParam importParam) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
Validate.notBlank(imageId, "imageId为空");
|
||||
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
|
||||
List<SpecialAddDeductionListDTO> SpecialAddDeductions =
|
||||
ExcelParseHelper.parse2Map(fileInputStream, SpecialAddDeductionListDTO.class, 0, 1, 14,
|
||||
"SpecialAddDeductionTemplate.xlsx");
|
||||
apidatas.put("preview", SpecialAddDeductions);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> importData(SpecialAddDeductionImportParam importParam) {
|
||||
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
|
||||
long currentEmployeeId = user.getUID();
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
|
||||
//查询对于人员信息导入筛选的全局配置
|
||||
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
||||
|
||||
//检验参数
|
||||
checkImportParam(importParam);
|
||||
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
Validate.notBlank(imageId, "imageId为空");
|
||||
//个税扣缴义务人
|
||||
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
|
||||
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
|
||||
List<SpecialAddDeductionListDTO> SpecialAddDeductions = ExcelParseHelper.parse2Map(fileInputStream, SpecialAddDeductionListDTO.class, 0, 1, 14, "SpecialAddDeductionTemplate.xlsx");
|
||||
|
||||
int total = SpecialAddDeductions.size();
|
||||
int index = 0;
|
||||
int successCount = 0;
|
||||
int errorCount = 0;
|
||||
|
||||
//人员信息
|
||||
List<DataCollectionEmployee> employees = employBiz.listEmployee();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
// 查询已有数据
|
||||
List<SpecialAddDeductionPO> list = getSpecialAddDeductionBiz()
|
||||
.listByTaxAgentIds(null);
|
||||
|
||||
// 错误excel内容
|
||||
List<Map> errorData = new ArrayList<>();
|
||||
//合规数据
|
||||
List<SpecialAddDeductionPO> eligibleData = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < SpecialAddDeductions.size(); i++) {
|
||||
SpecialAddDeductionListDTO dto = SpecialAddDeductions.get(i);
|
||||
|
||||
Date now = new Date();
|
||||
//待插入数据库对象
|
||||
SpecialAddDeductionPO po = SpecialAddDeductionPO.builder()
|
||||
.tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.creator((long) user.getUID())
|
||||
.build();
|
||||
|
||||
//异常点数量
|
||||
int errorSum = 0;
|
||||
|
||||
//行号
|
||||
String rowIndex = String.format("第%s行", i + 2);
|
||||
|
||||
//相同的姓名
|
||||
String userName = dto.getUsername();
|
||||
String deparmentName = dto.getDepartmentName();
|
||||
String mobile = dto.getMobile();
|
||||
String workcode = dto.getJobNum();
|
||||
List<Long> employeeSameIds = new ArrayList<>();
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
List<DataCollectionEmployee> emps = getSalaryEmployeeService(user)
|
||||
.matchImportEmployee(employees, userName, deparmentName, mobile, workcode, null);
|
||||
//含在职和离职,选在职数据
|
||||
if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) {
|
||||
employeeSameIds = emps.stream()
|
||||
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
||||
.map(DataCollectionEmployee::getEmployeeId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) {
|
||||
employeeSameIds = emps.stream()
|
||||
.map(DataCollectionEmployee::getEmployeeId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
//当人员信息导入筛选的全局配置为"0"时,姓名才是必填项
|
||||
if (StringUtils.isBlank(userName) && "0".equals(confValue)) {
|
||||
//姓名 不能为空
|
||||
//错误消息对象
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + "姓名不能为空");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", rowIndex + "员工信息不存在或者存在多个员工");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
} else {
|
||||
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null;
|
||||
if (employeeId != null && employeeId > 0) {
|
||||
po.setEmployeeId(employeeId);
|
||||
} else {
|
||||
//姓名错误,系统内不存在该姓名
|
||||
Map<String, String> errorMessageMap = new HashMap<>();
|
||||
errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String taxAgentName = dto.getTaxAgentName();
|
||||
if (StringUtils.isBlank(taxAgentName)) {
|
||||
//个税扣缴义务人不能为空
|
||||
Map<String, String> errorMessageMap = new HashMap<>();
|
||||
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
} else {
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> optionalTemp = taxAgentList.stream().filter(m -> m.getTaxAgentName().equals(taxAgentName)).findFirst();
|
||||
if (optionalTemp.isPresent()) {
|
||||
if (StringUtils.isNotEmpty(taxAgentId) && !optionalTemp.get().getTaxAgentId().equals(Long.valueOf(taxAgentId))) {
|
||||
//个税扣缴义务人与导入时选择的不一致
|
||||
Map<String, String> errorMessageMap = new HashMap<>();
|
||||
errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
} else {
|
||||
po.setTaxAgentId(optionalTemp.get().getTaxAgentId());
|
||||
}
|
||||
} else {
|
||||
//个税扣缴义务人不存在
|
||||
Map<String, String> errorMessageMap = new HashMap<>();
|
||||
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不存在或不在权限范围内");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 核心字段, 前端没有传入的项目用空值覆盖
|
||||
po.setInfantCare(dto.getInfantCare() == null ? "" : dto.getInfantCare())
|
||||
.setSeriousIllnessTreatment(dto.getSeriousIllnessTreatment() == null ? "" : dto.getSeriousIllnessTreatment())
|
||||
.setSupportingElder(dto.getSupportingElder() == null ? "" : dto.getSupportingElder())
|
||||
.setHousingRent(dto.getHousingRent() == null ? "" : dto.getHousingRent())
|
||||
.setHousingLoanInterest(dto.getHousingLoanInterest() == null ? "" : dto.getHousingLoanInterest())
|
||||
.setContinuingEducation(dto.getContinuingEducation() == null ? "" : dto.getContinuingEducation())
|
||||
.setChildrenEducation(dto.getChildrenEducation() == null ? "" : dto.getChildrenEducation());
|
||||
|
||||
|
||||
//fixme 分权判断
|
||||
if (errorSum == 0) {
|
||||
successCount += 1;
|
||||
// 合格数据
|
||||
eligibleData.add(po);
|
||||
} else {
|
||||
errorCount += 1;
|
||||
// 添加错误数据
|
||||
}
|
||||
}
|
||||
|
||||
//入库
|
||||
SpecialAddDeductionBiz.handleImportData(eligibleData);
|
||||
|
||||
apidatas.put("successCount", successCount);
|
||||
apidatas.put("errorCount", errorCount);
|
||||
apidatas.put("errorData", errorData);
|
||||
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
private void checkImportParam(SpecialAddDeductionImportParam importParam) {
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
//个税扣缴义务人
|
||||
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
|
||||
|
||||
if (StringUtils.isBlank(imageId)) {
|
||||
throw new SalaryRunTimeException("文件不存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param param
|
||||
* @param isTemplate
|
||||
* @return
|
||||
*/
|
||||
public XSSFWorkbook export(SpecialAddDeductionQueryParam param, boolean isTemplate) {
|
||||
|
||||
//获取操作按钮资源
|
||||
List<List<String>> rowList = getExcelRowList(param, isTemplate);
|
||||
|
||||
//获取excel
|
||||
return ExcelUtil.genWorkbook(rowList, "专项附加免税扣除");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取excel数据行
|
||||
*
|
||||
* @return 导出数据行集合
|
||||
*/
|
||||
private List<List<String>> getExcelRowList(SpecialAddDeductionQueryParam param, boolean isTemplate) {
|
||||
long employeeId = user.getUID();
|
||||
//excel标题
|
||||
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
|
||||
|
||||
List<List<String>> rowList = new ArrayList<>();
|
||||
rowList.add(title);
|
||||
if (!isTemplate) {
|
||||
// 非下载导入模版,查询数据填充
|
||||
List<List<String>> dataRowList = queryInfoForExcel(param, rowList);
|
||||
rowList.addAll(dataRowList);
|
||||
}
|
||||
return rowList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出详情列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public XSSFWorkbook exportDetail(SpecialAddDeductionQueryParam param) {
|
||||
|
||||
SpecialAddDeductionBiz biz = new SpecialAddDeductionBiz();
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
|
||||
Long id = param.getSpecialAddDeductionId();
|
||||
if (id == null) {
|
||||
throw new SalaryRunTimeException("id不能为空");
|
||||
}
|
||||
|
||||
SpecialAddDeductionPO po = biz.getById(id);
|
||||
if (po == null) {
|
||||
throw new SalaryRunTimeException(String.format("专项附加扣除不存在" + "[id:%s]", id));
|
||||
}
|
||||
|
||||
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
|
||||
if (CollectionUtils.isEmpty(employeeList)) {
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
|
||||
//构建参数
|
||||
param.setEmployeeId(po.getEmployeeId());
|
||||
|
||||
|
||||
//获取操作按钮资源
|
||||
List<List<String>> rowList = getExcelRowDetailList(param);
|
||||
|
||||
//获取excel
|
||||
return ExcelUtil.genWorkbook(rowList, "专项附加扣除明细");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出详情
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
private List<List<String>> getExcelRowDetailList(SpecialAddDeductionQueryParam param) {
|
||||
//excel标题
|
||||
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
|
||||
//查询详细信息
|
||||
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionBiz().listDTOByParam(param);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
final List<List<String>> dataRowList = Optional.ofNullable(list)
|
||||
.map(List::stream)
|
||||
.map(operatorStream -> operatorStream.map(dto -> {
|
||||
List<String> cellList = new ArrayList<>();
|
||||
cellList.add(Util.null2String(dto.getUsername()));
|
||||
cellList.add(Util.null2String(dto.getTaxAgentName()));
|
||||
cellList.add(Util.null2String(dto.getDepartmentName()));
|
||||
cellList.add(Util.null2String(dto.getMobile()));
|
||||
cellList.add(Util.null2String(dto.getJobNum()));
|
||||
cellList.add(Util.null2String(dto.getChildrenEducation()));
|
||||
cellList.add(Util.null2String(dto.getContinuingEducation()));
|
||||
cellList.add(Util.null2String(dto.getHousingLoanInterest()));
|
||||
cellList.add(Util.null2String(dto.getHousingRent()));
|
||||
cellList.add(Util.null2String(dto.getSupportingElder()));
|
||||
cellList.add(Util.null2String(dto.getSeriousIllnessTreatment()));
|
||||
cellList.add(Util.null2String(dto.getInfantCare()));
|
||||
return cellList;
|
||||
}).collect(Collectors.toList()))
|
||||
.orElse(Collections.emptyList());
|
||||
|
||||
List<List<String>> rowList = new ArrayList<>();
|
||||
rowList.add(title);
|
||||
rowList.addAll(dataRowList);
|
||||
return rowList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SpecialAddDeductionPO> getSpecialAddDeductionList(YearMonth declareMonth, List<Long> employeeIds, Long taxAgentId) {
|
||||
if (declareMonth == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100342, "参数有误:申报月份必传"));
|
||||
}
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
return SpecialAddDeductionBiz.listByTaxAgentIds(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
Long currentEmployeeId = (long) user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList =
|
||||
getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
SpecialAddDeductionPO byId = SpecialAddDeductionBiz.getById(specialAddDeductionParam.getId());
|
||||
if (byId == null) {
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
//管理员可以编辑该扣缴义务人数据,其他人可以编辑本人数据
|
||||
boolean canEdit = byId.getEmployeeId().equals((long) user.getUID())
|
||||
|| taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), byId.getTaxAgentId()));
|
||||
if (!canEdit) {
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
ArrayList<SpecialAddDeductionPO> updateList = new ArrayList<>();
|
||||
SpecialAddDeductionPO build = SpecialAddDeductionPO.builder()
|
||||
.id(specialAddDeductionParam.getId())
|
||||
.childrenEducation(specialAddDeductionParam.getChildrenEducation())
|
||||
.continuingEducation(specialAddDeductionParam.getContinuingEducation())
|
||||
.housingLoanInterest(specialAddDeductionParam.getHousingLoanInterest())
|
||||
.housingRent(specialAddDeductionParam.getHousingRent())
|
||||
.infantCare(specialAddDeductionParam.getInfantCare())
|
||||
.supportingElder(specialAddDeductionParam.getSupportingElder())
|
||||
.seriousIllnessTreatment(specialAddDeductionParam.getSeriousIllnessTreatment())
|
||||
.build();
|
||||
updateList.add(build);
|
||||
SpecialAddDeductionBiz.batchUpdate(updateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
//查询对于人员信息导入筛选的全局配置
|
||||
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
||||
|
||||
//人员信息
|
||||
List<DataCollectionEmployee> employees = employBiz.listEmployee();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
// 查询已有数据
|
||||
List<SpecialAddDeductionPO> list = getSpecialAddDeductionBiz().listByTaxAgentIds(null);
|
||||
//合规数据
|
||||
List<SpecialAddDeductionPO> insertData = new ArrayList<>();
|
||||
Date now = new Date();
|
||||
//待插入数据库对象
|
||||
SpecialAddDeductionPO po = SpecialAddDeductionPO.builder()
|
||||
.tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.creator((long) user.getUID())
|
||||
.build();
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
boolean employeeSameId = employees.stream()
|
||||
.anyMatch(e -> Objects.equals(e.getEmployeeId(), specialAddDeductionParam.getEmployeeId()));
|
||||
if (!employeeSameId) {
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
po.setEmployeeId(specialAddDeductionParam.getEmployeeId());
|
||||
String taxAgentName = specialAddDeductionParam.getTaxAgentName();
|
||||
if (StringUtils.isBlank(taxAgentName)) {
|
||||
//个税扣缴义务人不能为空
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不能为空");
|
||||
} else {
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> optionalTemp = taxAgentList.stream().filter(m -> m.getTaxAgentName().equals(taxAgentName)).findFirst();
|
||||
if (optionalTemp.isPresent()) {
|
||||
po.setTaxAgentId(optionalTemp.get().getTaxAgentId());
|
||||
} else {
|
||||
//个税扣缴义务人不存在或不在权限范围内
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
}
|
||||
//数据填充
|
||||
po.setContinuingEducation(specialAddDeductionParam.getContinuingEducation())
|
||||
.setChildrenEducation(specialAddDeductionParam.getChildrenEducation())
|
||||
.setHousingLoanInterest(specialAddDeductionParam.getHousingLoanInterest())
|
||||
.setHousingRent(specialAddDeductionParam.getHousingRent())
|
||||
.setSupportingElder(specialAddDeductionParam.getSupportingElder())
|
||||
.setSeriousIllnessTreatment(specialAddDeductionParam.getSeriousIllnessTreatment())
|
||||
.setInfantCare(specialAddDeductionParam.getInfantCare());
|
||||
//fixme 分权判断
|
||||
insertData.add(po);
|
||||
//入库
|
||||
SpecialAddDeductionBiz.handleImportData(insertData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList =
|
||||
getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
List<Long> deleteIds = deleteParam.getIds();
|
||||
List<Long> deleteList = new ArrayList<>();
|
||||
for (Long id : deleteIds) {
|
||||
SpecialAddDeductionPO byId = SpecialAddDeductionBiz.getById(id);
|
||||
if (byId == null) {
|
||||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
boolean isNotInRegion =
|
||||
taxAgentList.stream()
|
||||
.noneMatch(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId()));
|
||||
if (isNotInRegion) {
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
deleteList.add(byId.getId());
|
||||
}
|
||||
SpecialAddDeductionBiz.batchDeleteByIds(deleteList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList =
|
||||
getTaxAgentService(user).listTaxAgentAndEmployeeTree((long) user.getUID());
|
||||
List<Long> taxAgentIds = taxAgentList.stream()
|
||||
.map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId)
|
||||
.collect(Collectors.toList());
|
||||
SpecialAddDeductionBiz specialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
|
||||
if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) {
|
||||
// 设置了个税扣缴义务人
|
||||
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
|
||||
boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId));
|
||||
if (!canDelete) {
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
|
||||
}
|
||||
ArrayList<Long> tai = new ArrayList<>();
|
||||
tai.add(taxAgentId);
|
||||
taxAgentIds = tai;
|
||||
}
|
||||
// 获取所有想要删除的数据
|
||||
List<SpecialAddDeductionPO> list = specialAddDeductionBiz.listByTaxAgentIds(taxAgentIds);
|
||||
List<Long> deleteIds = list.stream().map(SpecialAddDeductionPO::getId).collect(Collectors.toList());
|
||||
specialAddDeductionBiz.batchDeleteByIds(deleteIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SpecialAddDeductionPO> getSpecialAddDeductionPOByEmployee(List<Long> employeeId, Long taxAgentId) {
|
||||
return getSpecialAddDeductionBiz().getByEmployeeId(employeeId, taxAgentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpecialAddDeductionRecordDTO getRecordById(Long id) {
|
||||
return getSpecialAddDeductionBiz()
|
||||
.listDTOByParam(SpecialAddDeductionQueryParam.builder().specialAddDeductionId(id).build())
|
||||
.stream().findFirst().orElse(null);
|
||||
}
|
||||
|
||||
private List<List<String>> queryInfoForExcel(SpecialAddDeductionQueryParam param, List<List<String>> rowList) {
|
||||
//排序配置
|
||||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
param.setOrderRule(orderRule);
|
||||
|
||||
if (getTaxAgentService(user).isOpenDevolution()) {
|
||||
putQueryRange(param);
|
||||
}
|
||||
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionBiz().listByParam(param);
|
||||
final List<List<String>> dataRowList = Optional.ofNullable(list)
|
||||
.map(List::stream)
|
||||
.map(operatorStream -> operatorStream.map(dto -> {
|
||||
List<String> cellList = new ArrayList<>();
|
||||
cellList.add(Util.null2String(dto.getUsername()));
|
||||
cellList.add(Util.null2String(dto.getTaxAgentName()));
|
||||
cellList.add(Util.null2String(dto.getDepartmentName()));
|
||||
cellList.add(Util.null2String(dto.getMobile()));
|
||||
cellList.add(Util.null2String(dto.getJobNum()));
|
||||
cellList.add(Util.null2String(dto.getIdNo()));
|
||||
cellList.add(Util.null2String(dto.getHiredate()));
|
||||
cellList.add(Util.null2String(dto.getChildrenEducation()));
|
||||
cellList.add(Util.null2String(dto.getContinuingEducation()));
|
||||
cellList.add(Util.null2String(dto.getHousingLoanInterest()));
|
||||
cellList.add(Util.null2String(dto.getHousingRent()));
|
||||
cellList.add(Util.null2String(dto.getSupportingElder()));
|
||||
cellList.add(Util.null2String(dto.getSeriousIllnessTreatment()));
|
||||
cellList.add(Util.null2String(dto.getInfantCare()));
|
||||
return cellList;
|
||||
}).collect(Collectors.toList()))
|
||||
.orElse(Collections.emptyList());
|
||||
return dataRowList;
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,11 @@ public class SalarySysConstant {
|
|||
*/
|
||||
public static final String OPEN_ACCT_RESULT_SUM = "OPEN_ACCT_RESULT_SUM";
|
||||
|
||||
/**
|
||||
* 是否显示脱敏表人员信息
|
||||
*/
|
||||
public static final String DISPLAY_EMP_INFO_REPORT = "DISPLAY_EMP_INFO_REPORT";
|
||||
|
||||
/**
|
||||
* 应用设置是否开启加密
|
||||
*/
|
||||
|
|
@ -45,4 +50,9 @@ public class SalarySysConstant {
|
|||
*/
|
||||
public static final String AES_ENCRYPT_IN_PROGRESS = "AES_ENCRYPT_IN_PROGRESS";
|
||||
public static final String ENCRYPT_IN_PROGRESS = "ENCRYPT_PROGRESS_";
|
||||
|
||||
/**
|
||||
* 需要申报功能
|
||||
*/
|
||||
public static final String TAX_DECLARATION_FUNCTION = "taxDeclarationFunction";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.sys.entity.param;
|
||||
|
||||
import com.engine.salary.sys.enums.OpenEnum;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -32,6 +33,7 @@ public class AppSettingSaveParam {
|
|||
*
|
||||
* @see OpenEnum
|
||||
*/
|
||||
@DataCheck(require = true,message = "是否开启核算结果合计列?")
|
||||
private String openAcctResultSum;
|
||||
|
||||
/**
|
||||
|
|
@ -39,4 +41,16 @@ public class AppSettingSaveParam {
|
|||
*/
|
||||
private String isOpenEncrypt;
|
||||
|
||||
/**
|
||||
* 是否关闭个税申报
|
||||
*/
|
||||
private String operateTaxDeclaration;
|
||||
|
||||
/**
|
||||
* 是否显示脱敏表人员信息
|
||||
* @see OpenEnum
|
||||
*/
|
||||
@DataCheck(require = true,message = "是否显示脱敏表人员信息?")
|
||||
private String displayEmpInfoReport;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,5 +39,17 @@ public class AppSettingVO {
|
|||
*/
|
||||
private String isOpenEncrypt;
|
||||
|
||||
/**
|
||||
* 是否开启个税申报功能
|
||||
*/
|
||||
private String isOpenTaxDeclaration;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 是否显示脱敏表人员信息
|
||||
* @see OpenEnum
|
||||
*/
|
||||
private String displayEmpInfoReport;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||
* @version 1.0
|
||||
**/
|
||||
public enum TaxDeclarationFunctionEnum implements BaseEnum<String> {
|
||||
OPEN("OPEN", "开启", 1),
|
||||
CLOSURE("CLOSURE", "关闭", 1),
|
||||
REBOOT("REBOOT", "重启", 1);
|
||||
OPEN("1", "开启申报功能", 1),
|
||||
CLOSURE("0", "关闭申报功能", 1),
|
||||
REBOOT("2", "重启", 1);
|
||||
|
||||
private String value;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.engine.salary.sys.entity.vo.AppSettingVO;
|
|||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -29,6 +30,12 @@ public interface SalarySysConfService {
|
|||
*/
|
||||
boolean operateTaxDeclarationFunction(TaxDeclarationFunctionEnum flag);
|
||||
|
||||
/**
|
||||
* 是否关闭了个税申报功能
|
||||
* @return BOOLEAN
|
||||
*/
|
||||
TaxDeclarationFunctionEnum getTaxDeclaration();
|
||||
|
||||
SalarySysConfPO getOneByCode(String code);
|
||||
|
||||
List<SalarySysConfPO> listSome(SalarySysConfPO build);
|
||||
|
|
@ -67,5 +74,18 @@ public interface SalarySysConfService {
|
|||
*/
|
||||
Map<String, Object> saveEncryptSetting(AppSettingSaveParam appSettingSaveParam);
|
||||
|
||||
/**
|
||||
* 加密进度
|
||||
* @param progressId
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getEncryptProgress(String progressId);
|
||||
|
||||
/**
|
||||
* @description 获取个税申报功能重启日期
|
||||
* @return Date
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/9 21:07
|
||||
*/
|
||||
Date getTaxDeclarationRebootDate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import com.api.formmode.mybatis.util.SqlProxyHandle;
|
|||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
|
||||
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||
|
|
@ -22,6 +24,7 @@ import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
|
|||
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
|
||||
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
|
||||
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
|
||||
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
|
||||
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
|
||||
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
|
||||
|
|
@ -127,6 +130,10 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
return MapperProxyFactory.getProxy(AddUpSituationMapper.class);
|
||||
}
|
||||
|
||||
private SpecialAddDeductionMapper getSpecialAddDeductionMapper() {
|
||||
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
|
||||
}
|
||||
|
||||
static SalarySysConfServiceImpl salarySysConfService = new SalarySysConfServiceImpl();
|
||||
|
||||
/**
|
||||
|
|
@ -138,9 +145,9 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
@Override
|
||||
public boolean operateTaxDeclarationFunction(TaxDeclarationFunctionEnum flag) {
|
||||
Date date = new Date();
|
||||
SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode("taxDeclarationFunction");
|
||||
SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode(TAX_DECLARATION_FUNCTION);
|
||||
if (taxDeclarationFunction == null) {
|
||||
taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey("taxDeclarationFunction").confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build();
|
||||
taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey(TAX_DECLARATION_FUNCTION).confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build();
|
||||
getSalarySysConfMapper().insertIgnoreNull(taxDeclarationFunction);
|
||||
} else {
|
||||
TaxDeclarationFunctionEnum oldFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue());
|
||||
|
|
@ -154,10 +161,10 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
taxDeclarationFunction.setTitle(flag.getDefaultLabel());
|
||||
taxDeclarationFunction.setUpdateTime(new Date());
|
||||
}
|
||||
//重启
|
||||
//重启 (从关闭到开启)
|
||||
if (flag == TaxDeclarationFunctionEnum.OPEN && oldFunctionEnum == TaxDeclarationFunctionEnum.CLOSURE) {
|
||||
taxDeclarationFunction.setConfValue(flag.getValue());
|
||||
taxDeclarationFunction.setTitle(flag.getDefaultLabel());
|
||||
taxDeclarationFunction.setConfValue(TaxDeclarationFunctionEnum.REBOOT.getValue());
|
||||
taxDeclarationFunction.setTitle(TaxDeclarationFunctionEnum.REBOOT.getDefaultLabel());
|
||||
taxDeclarationFunction.setUpdateTime(new Date());
|
||||
}
|
||||
getSalarySysConfMapper().updateIgnoreNull(taxDeclarationFunction);
|
||||
|
|
@ -165,6 +172,23 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取申报功能状态
|
||||
* @return Boolean
|
||||
* @author Harryxzy
|
||||
* @date 2022/11/7 17:05
|
||||
*/
|
||||
public TaxDeclarationFunctionEnum getTaxDeclaration(){
|
||||
SalarySysConfPO taxDeclarationFunction = salarySysConfService.getOneByCode(TAX_DECLARATION_FUNCTION);
|
||||
if(taxDeclarationFunction == null){
|
||||
// 默认开启
|
||||
return TaxDeclarationFunctionEnum.OPEN;
|
||||
}
|
||||
TaxDeclarationFunctionEnum taxDeclarationFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue());
|
||||
return taxDeclarationFunctionEnum;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SalarySysConfPO getOneByCode(String code) {
|
||||
return getSalarySysConfMapper().getOneByCode(code);
|
||||
|
|
@ -298,6 +322,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
public void saveAppSetting(AppSettingSaveParam param) {
|
||||
String openAcctResultSum = param.getOpenAcctResultSum();
|
||||
saveSettingByType(openAcctResultSum, OPEN_ACCT_RESULT_SUM, "开启核算结果合并", "app");
|
||||
saveSettingByType(param.getDisplayEmpInfoReport(), DISPLAY_EMP_INFO_REPORT, "是否显示脱敏表人员信息", "app");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -364,6 +389,12 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getTaxDeclarationRebootDate() {
|
||||
Date date = getSalarySysConfMapper().getTaxDeclarationRebootDate();
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者修改应用设置
|
||||
*
|
||||
|
|
@ -410,14 +441,32 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
case OPEN_APPLICATION_ENCRYPT:
|
||||
appSettingVO.setIsOpenEncrypt(salarySysConfPO.getConfValue());
|
||||
break;
|
||||
case DISPLAY_EMP_INFO_REPORT:
|
||||
appSettingVO.setDisplayEmpInfoReport(salarySysConfPO.getConfValue());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
List<SalarySysConfPO> taxDeclarationFunction = getSalarySysConfMapper().listSome(SalarySysConfPO.builder().deleteType(0).confKey(TAX_DECLARATION_FUNCTION).build());
|
||||
if(taxDeclarationFunction == null || taxDeclarationFunction.size() == 0 || (taxDeclarationFunction.get(0).getConfValue().equals(TaxDeclarationFunctionEnum.REBOOT.getValue()))){
|
||||
// 默认开启报税功能 或者重启状态时前端展示开启
|
||||
appSettingVO.setIsOpenTaxDeclaration("1");
|
||||
}else {
|
||||
appSettingVO.setIsOpenTaxDeclaration(taxDeclarationFunction.get(0).getConfValue());
|
||||
}
|
||||
//默认加密开启
|
||||
if (StringUtils.isEmpty(appSettingVO.getIsOpenEncrypt())) {
|
||||
appSettingVO.setIsOpenEncrypt("1");
|
||||
appSettingVO.setIsOpenEncrypt(OpenEnum.OPEN.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认不显示
|
||||
*/
|
||||
if (StringUtils.isEmpty(appSettingVO.getDisplayEmpInfoReport())) {
|
||||
appSettingVO.setDisplayEmpInfoReport(OpenEnum.OFF.getValue());
|
||||
}
|
||||
return appSettingVO;
|
||||
}
|
||||
|
|
@ -865,14 +914,41 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
}
|
||||
return 1;
|
||||
});
|
||||
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get();
|
||||
if (flag == 13) {
|
||||
Future<Integer> submit13 = fixedThreadPool.submit(() -> {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
List<SpecialAddDeductionPO> addUpSituations = getSpecialAddDeductionMapper().listAll();
|
||||
if (CollectionUtils.isNotEmpty(addUpSituations)) {
|
||||
addUpSituations.forEach(po -> {
|
||||
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
|
||||
SpecialAddDeductionEncrypt.decrypt(po);
|
||||
} else {
|
||||
SpecialAddDeductionEncrypt.encrypt(po);
|
||||
}
|
||||
});
|
||||
List<List<SpecialAddDeductionPO>> partition = Lists.partition(addUpSituations, 50);
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
partition.forEach(mapper::updateBatchSelective);
|
||||
sqlSession.commit();
|
||||
baseBean.writeLog("hrsa_special_add_deduction");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
sqlSession.rollback();
|
||||
baseBean.writeLog("hrsa_special_add_deduction:", e.getMessage());
|
||||
return 0;
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get() + submit13.get();
|
||||
if (flag == 14) {
|
||||
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "success", 30);
|
||||
} else {
|
||||
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
|
||||
}
|
||||
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
|
||||
return flag == 13;
|
||||
return flag == 14;
|
||||
} catch (Exception e) {
|
||||
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
|
||||
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
|
||||
|
|
|
|||
|
|
@ -240,6 +240,17 @@ public class SalaryDateUtil {
|
|||
cal.set(Calendar.DAY_OF_MONTH, last);
|
||||
return cal.getTime();
|
||||
}
|
||||
public static Date getFirstDayDateOfMonthWithMinutesAndSeconds(final Date date) {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
|
||||
cal.set(Calendar.DAY_OF_MONTH, last);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
public static Date getLastDayOfMonth(final Date date) {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
|
|
@ -265,6 +276,9 @@ public class SalaryDateUtil {
|
|||
return cal.getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getMonthBegin(String specifiedDay) {
|
||||
int year;
|
||||
int month;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.AddUpDeductionWrapper;
|
||||
|
|
@ -340,4 +340,27 @@ public class AddUpDeductionController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 一键自动累计
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/autoAddAll")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String autoAddAll(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@RequestBody AddDeductionAutoAddParam param) {
|
||||
DateTime date = null;
|
||||
if (StrUtil.isNotEmpty(param.getYearMonth())) {
|
||||
try {
|
||||
date = DateUtil.parse(param.getYearMonth(), "yyyy-MM");
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
// 放在service中处理,这里处理了页面上收不到
|
||||
}
|
||||
} else {
|
||||
date = DateUtil.beginOfMonth(new Date());
|
||||
}
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Date, String>(user).run(getAddUpDeductionWrapper(user)::autoAddAll, date);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -896,4 +896,15 @@ public class SalaryArchiveController {
|
|||
|
||||
|
||||
/******** 个税扣缴义务人调整记录 end ***********************************************************************************************/
|
||||
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/handleRepeatData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String SingleTaxAgentAdjustRecordList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Map<String, Object>>(user).run(getSalaryArchiveWrapper(user)::handleRepeatData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,16 +51,16 @@ public class SalarySystemConfigController {
|
|||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param flag
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/operateTaxDeclarationFunction")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String operateTaxDeclarationFunction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody String flag) {
|
||||
public String operateTaxDeclarationFunction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AppSettingSaveParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
return new ResponseResult<TaxDeclarationFunctionEnum, Boolean>(user).run(getSalarySystemConfigWrapper(user)::operateTaxDeclarationFunction, TaxDeclarationFunctionEnum.parseByValue(flag));
|
||||
return new ResponseResult<TaxDeclarationFunctionEnum, Boolean>(user).run(getSalarySystemConfigWrapper(user)::operateTaxDeclarationFunction, TaxDeclarationFunctionEnum.parseByValue(param.getOperateTaxDeclaration()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,332 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.SpecialAddDeductionWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.security.sasl.SaslException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据采集-专项附加扣除
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author lfc
|
||||
**/
|
||||
@Slf4j
|
||||
public class SpecialAddDeductionController {
|
||||
|
||||
private SpecialAddDeductionWrapper getSpecialAddDeductionWrapper(User user) {
|
||||
return ServiceUtil.getService(SpecialAddDeductionWrapper.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集-专项附加扣除列表的高级搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSearchCondition")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::getSearchCondition);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionQueryParam, PageInfo<SpecialAddDeductionListDTO>>(user).run(getSpecialAddDeductionWrapper(user)::list, queryParam);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/getSpecialAddDeduction")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Long id = param.getId();
|
||||
return new ResponseResult<Long, SpecialAddDeductionRecordDTO>(user).run(getSpecialAddDeductionWrapper(user)::getRecordById, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/getDetailList")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSpecialAddDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam queryParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionQueryParam, PageInfo<SpecialAddDeductionRecordDTO>>(user).run(getSpecialAddDeductionWrapper(user)::getDetailList, queryParam);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
SpecialAddDeductionQueryParam param = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSpecialAddDeductionWrapper(user).downloadTemplate(param);
|
||||
String fileName = "专项附加扣除导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("专项附加扣除导入模板异常", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
SpecialAddDeductionQueryParam param = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSpecialAddDeductionWrapper(user).export(param);
|
||||
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("专项附加扣除" + LocalDate.now() + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("专项附加扣除导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/exportDetail")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportDetail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
SpecialAddDeductionQueryParam param = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSpecialAddDeductionWrapper(user).exportDetail(param);
|
||||
|
||||
String fileName = "专项附加扣除明细" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("专项附加扣除明细导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SpecialAddDeductionQueryParam buildParam(HttpServletRequest request) {
|
||||
SpecialAddDeductionQueryParam param = new SpecialAddDeductionQueryParam();
|
||||
String ids = request.getParameter("ids");
|
||||
if (StringUtils.isNotBlank(ids)) {
|
||||
param.setIds(Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
String keyword = request.getParameter("keyword");
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
param.setKeyword(keyword);
|
||||
}
|
||||
String id = request.getParameter("id");
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
param.setId(Long.valueOf(id));
|
||||
}
|
||||
|
||||
String username = request.getParameter("username");
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
param.setUsername(username);
|
||||
}
|
||||
String employeeId = request.getParameter("employeeId");
|
||||
if (StringUtils.isNotBlank(employeeId)) {
|
||||
param.setEmployeeId(Long.valueOf(employeeId));
|
||||
}
|
||||
String taxAgentId = request.getParameter("taxAgentId");
|
||||
if (StringUtils.isNotBlank(taxAgentId)) {
|
||||
param.setTaxAgentId(Long.valueOf(taxAgentId));
|
||||
}
|
||||
String departmentIds = request.getParameter("departmentIds");
|
||||
if (StringUtils.isNotBlank(departmentIds)) {
|
||||
param.setDepartmentIds(Arrays.stream(departmentIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
String jobNum = request.getParameter("jobNum");
|
||||
if (StringUtils.isNotBlank(jobNum)) {
|
||||
param.setJobNum(jobNum);
|
||||
}
|
||||
String idNo = request.getParameter("idNo");
|
||||
if (StringUtils.isNotBlank(idNo)) {
|
||||
param.setIdNo(idNo);
|
||||
}
|
||||
String hiredate = request.getParameter("hiredate");
|
||||
if (StringUtils.isNotBlank(hiredate)) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
List<Date> dates = Arrays.stream(hiredate.split(",")).map(d -> {
|
||||
try {
|
||||
return format.parse(d);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}).collect(Collectors.toList());
|
||||
param.setHiredate(dates);
|
||||
}
|
||||
String mobile = request.getParameter("mobile");
|
||||
if (StringUtils.isNotBlank(mobile)) {
|
||||
param.setMobile(mobile);
|
||||
}
|
||||
String otherTaxExemptDeductionId = request.getParameter("otherTaxExemptDeductionId");
|
||||
if (StringUtils.isNotBlank(otherTaxExemptDeductionId)) {
|
||||
param.setSpecialAddDeductionId(Long.valueOf(otherTaxExemptDeductionId));
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/preview")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionImportParam importParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionImportParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::preview, importParam);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/importData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionImportParam importParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionImportParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::importData, importParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
* @description 编辑专项附加扣除
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/26 9:41
|
||||
*/
|
||||
@POST
|
||||
@Path("/editData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String editOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionParam otherDeductionParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::editData, otherDeductionParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
* @description 新建专项附加扣除
|
||||
* @author lfc
|
||||
*/
|
||||
@POST
|
||||
@Path("/createData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String createSpecialAddDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionParam specialAddDeductionParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::createData, specialAddDeductionParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
* @description 删除所选专项附加扣除
|
||||
* @author lfc
|
||||
*/
|
||||
@POST
|
||||
@Path("/deleteSelectData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionRecordDeleteParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::deleteSelectData, deleteParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
* @description 一键清空专项附加扣除
|
||||
* @author lfc
|
||||
*/
|
||||
@POST
|
||||
@Path("/deleteAllData")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String deleteAllOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionRecordDeleteParam deductionRecordDeleteParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SpecialAddDeductionRecordDeleteParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::deleteAllData, deductionRecordDeleteParam);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,10 +19,13 @@ import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
|||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -35,8 +38,12 @@ import java.util.stream.Collectors;
|
|||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class AddUpDeductionWrapper extends Service {
|
||||
|
||||
private final BaseBean baseBean = new BaseBean();
|
||||
private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log"));
|
||||
|
||||
private AddUpDeductionService getAddUpDeductionService(User user) {
|
||||
return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -148,7 +155,7 @@ public class AddUpDeductionWrapper extends Service {
|
|||
}
|
||||
|
||||
public void createAddUpDeduction(AddUpDeductionRecordParam addUpDeductionRecordParam) {
|
||||
getAddUpDeductionService(user).createAddUpDeduction(addUpDeductionRecordParam);
|
||||
getAddUpDeductionService(user).createAddUpDeduction(addUpDeductionRecordParam);
|
||||
}
|
||||
|
||||
public void deleteSelectAddUpDeduction(AddUpDeductionRecordDeleteParam deleteParam) {
|
||||
|
|
@ -162,4 +169,14 @@ public class AddUpDeductionWrapper extends Service {
|
|||
public AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam param) {
|
||||
return getAddUpDeductionService(user).getAddUpDeduction(param);
|
||||
}
|
||||
|
||||
public String autoAddAll(Date yearMonth) {
|
||||
if (isLog) {
|
||||
log.info("一键累计, 操作人 「{}」", user.getUsername());
|
||||
}
|
||||
if (yearMonth == null) {
|
||||
throw new SalaryRunTimeException("一键累计传入日期格式错误");
|
||||
}
|
||||
return getAddUpDeductionService(user).autoAddAll(yearMonth);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import com.engine.salary.entity.salaryarchive.param.*;
|
|||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
|
|
@ -323,16 +322,8 @@ public class SalaryArchiveWrapper extends Service {
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100465, "薪资档案员工信息不存在"));
|
||||
}
|
||||
|
||||
// 获取当前已生效个税扣缴义务人
|
||||
List<SalaryArchiveTaxAgentPO> taxAgentList = getSalaryArchiveService(user).getCurrentEffectiveTaxAgentList(Collections.singletonList(salaryArchiveId));
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentListDTO> taxAgentLists = getTaxAgentService(user).findAll();
|
||||
String taxAgent = "";
|
||||
if (CollectionUtils.isNotEmpty(taxAgentList)) {
|
||||
SalaryArchiveTaxAgentPO salaryArchiveTaxAgent = taxAgentList.get(0);
|
||||
Optional<TaxAgentListDTO> taxAgentOptional = taxAgentLists.stream().filter(f -> f.getId().equals(salaryArchiveTaxAgent.getTaxAgentId())).findFirst();
|
||||
taxAgent = taxAgentOptional.isPresent() ? taxAgentOptional.get().getName() : taxAgent;
|
||||
}
|
||||
Long taxAgentId = po.getTaxAgentId();
|
||||
TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxAgentId);
|
||||
|
||||
// 1.基本信息表单
|
||||
Map<String, Object> baseInfo = new HashMap<>();
|
||||
|
|
@ -343,7 +334,7 @@ public class SalaryArchiveWrapper extends Service {
|
|||
.position(employee.getJobtitleName() == null ? "" : employee.getJobtitleName())
|
||||
.hiredate(employee.getCompanystartdate())
|
||||
.mobile(employee.getMobile())
|
||||
.taxAgent(taxAgent)
|
||||
.taxAgent(taxAgent.getName())
|
||||
.build();
|
||||
baseInfo.put("employee", build);
|
||||
|
||||
|
|
@ -422,31 +413,6 @@ public class SalaryArchiveWrapper extends Service {
|
|||
return importTypes;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出薪资档案
|
||||
// *
|
||||
// * @param queryParam
|
||||
// * @param employeeId
|
||||
// * @param tenantKey
|
||||
// * @return
|
||||
// */
|
||||
// public Map<String, Object> exportList(SalaryArchiveQueryParam queryParam, Long employeeId, String tenantKey) {
|
||||
// // 构建异步导出参数
|
||||
// Map<String, Object> map = salaryBatchService.buildeExportParam("exportSalaryArchive");
|
||||
// String username = UserContext.getCurrentUser().getUsername();
|
||||
// String eteamsId = TenantRpcContext.getEteamsId();
|
||||
// taskExecutor.execute(() -> {
|
||||
// try {
|
||||
// DSTenantKeyThreadVar.tenantKey.set(tenantKey);
|
||||
// getSalaryArchiveService(user).exportList(map, username, eteamsId, queryParam, employeeId, tenantKey);
|
||||
// } finally {
|
||||
// DSTenantKeyThreadVar.tenantKey.remove();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
|
|
@ -561,15 +527,6 @@ public class SalaryArchiveWrapper extends Service {
|
|||
return getSalaryArchiveExcelService(user).processInit(importData);
|
||||
}
|
||||
|
||||
|
||||
// public Map<String, Object> importSalaryArchiveSalaryItemAdjust(SalaryArchiveImportActionParam importData) {
|
||||
// importData.setListType("FIXED");
|
||||
// importData.setImportType("salaryItemAdjust");
|
||||
// importData.setAddData(true);
|
||||
// return getSalaryArchiveExcelService(user).processInit(importData);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 停薪
|
||||
*
|
||||
|
|
@ -581,4 +538,7 @@ public class SalaryArchiveWrapper extends Service {
|
|||
}
|
||||
|
||||
|
||||
public Map<String, Object> handleRepeatData() {
|
||||
return getSalaryArchiveService(user).handleRepeatData();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import com.engine.salary.util.page.SalaryPageUtil;
|
|||
import com.engine.salary.util.valid.RuntimeTypeEnum;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import tebie.applib.api.O;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -134,7 +133,6 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
}
|
||||
|
||||
public Map<String, Object> saveEncryptSetting(AppSettingSaveParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
return getSalarySysConfService(user).saveEncryptSetting(param);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,203 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.util.ConditionFactory;
|
||||
import com.api.browser.util.ConditionType;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.SpecialAddDeductionService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
||||
import com.engine.salary.service.impl.SpecialAddDeductionServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 专项附加扣除
|
||||
*/
|
||||
public class SpecialAddDeductionWrapper extends Service {
|
||||
private SpecialAddDeductionService getSpecialAddDeductionService(User user) {
|
||||
return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user);
|
||||
}
|
||||
private TaxAgentService getTaxAgentV2Service(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
/**
|
||||
* 数据采集-专项附加扣除列表的高级搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getSearchCondition() {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//条件组
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
|
||||
//文本输入框
|
||||
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
|
||||
username.setInputType("input");
|
||||
username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行
|
||||
username.setFieldcol(16); //条件输入框所占宽度,默认值18
|
||||
username.setLabelcol(8);
|
||||
username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2
|
||||
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
|
||||
conditionItems.add(username);
|
||||
|
||||
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentName", "4");
|
||||
departmentName.setInputType("browser");
|
||||
departmentName.setColSpan(2);
|
||||
departmentName.setFieldcol(16);
|
||||
departmentName.setLabelcol(8);
|
||||
departmentName.setViewAttr(2);
|
||||
departmentName.setIsQuickSearch(false);
|
||||
departmentName.setLabel("部门");
|
||||
conditionItems.add(departmentName);
|
||||
|
||||
|
||||
SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT, 25034, "jobNum");
|
||||
jobNum.setInputType("input");
|
||||
jobNum.setColSpan(2);
|
||||
jobNum.setFieldcol(16);
|
||||
jobNum.setLabelcol(8);
|
||||
jobNum.setViewAttr(2);
|
||||
jobNum.setLabel("工号");
|
||||
conditionItems.add(jobNum);
|
||||
|
||||
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
|
||||
|
||||
apidatas.put("condition", addGroups);
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集-专项附加扣除列表(分页)
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<SpecialAddDeductionListDTO> list(SpecialAddDeductionQueryParam queryParam) {
|
||||
return getSpecialAddDeductionService(user).listPage(queryParam);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集-专项附加扣除详情列表(分页)
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<SpecialAddDeductionRecordDTO> getDetailList(SpecialAddDeductionQueryParam queryParam) {
|
||||
Long id = queryParam.getSpecialAddDeductionId();
|
||||
|
||||
SpecialAddDeductionPO po = getSpecialAddDeductionService(user).getById(id);
|
||||
if (po == null) {
|
||||
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100415, "专项附加扣除不存在") + "[id:%s]", id));
|
||||
}
|
||||
queryParam.setEmployeeId(po.getEmployeeId());
|
||||
|
||||
return getSpecialAddDeductionService(user).recordListPage(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出-专项附加扣除列表
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public XSSFWorkbook export(SpecialAddDeductionQueryParam queryParam) {
|
||||
return getSpecialAddDeductionService(user).export(queryParam, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出-专项附加扣除详情列表
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public XSSFWorkbook exportDetail(SpecialAddDeductionQueryParam queryParam) {
|
||||
Long id = queryParam.getSpecialAddDeductionId();
|
||||
SpecialAddDeductionPO po = getSpecialAddDeductionService(user).getById(id);
|
||||
if (po == null) {
|
||||
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 100415, "专项附加扣除不存在") + "[id:%s]", id));
|
||||
}
|
||||
return getSpecialAddDeductionService(user).exportDetail(queryParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
*
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public XSSFWorkbook downloadTemplate(SpecialAddDeductionQueryParam queryParam) {
|
||||
return getSpecialAddDeductionService(user).export(queryParam, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览
|
||||
*/
|
||||
public Map<String, Object> preview(SpecialAddDeductionImportParam importParam){
|
||||
return getSpecialAddDeductionService(user).preview(importParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
public Map<String, Object> importData(SpecialAddDeductionImportParam importParam){
|
||||
return getSpecialAddDeductionService(user).importData(importParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*/
|
||||
public void editData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||||
getSpecialAddDeductionService(user).editData(specialAddDeductionParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
public void createData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||||
getSpecialAddDeductionService(user).createData(specialAddDeductionParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除所选数据
|
||||
*/
|
||||
public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||||
getSpecialAddDeductionService(user).deleteSelectData(deleteParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键清空所有数据
|
||||
*/
|
||||
public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||||
getSpecialAddDeductionService(user).deleteAllData(deleteParam);
|
||||
}
|
||||
|
||||
public SpecialAddDeductionRecordDTO getRecordById(Long id) {
|
||||
if (id == null) {
|
||||
throw new SalaryRunTimeException("专项附加扣除主键[id]必传");
|
||||
}
|
||||
return getSpecialAddDeductionService(user).getRecordById(id);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue