累计、其他免税、往期 新增、删除、一键清空、编辑功能
This commit is contained in:
parent
ddd0c49cdd
commit
1f29ac67eb
|
|
@ -204,4 +204,25 @@ public class AddUpSituationBiz extends BaseBean {
|
|||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 批量删除数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:39
|
||||
*/
|
||||
public void batchDeleteByIDS(List<Long> deleteIds) {
|
||||
if (CollectionUtils.isEmpty(deleteIds)) {
|
||||
return;
|
||||
}
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
|
||||
List<List<Long>> partition = Lists.partition(deleteIds, 100);
|
||||
partition.forEach(mapper::deleteData);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据采集-累计情况表
|
||||
|
|
@ -40,6 +41,7 @@ public class AddUpSituation {
|
|||
* 税款所属期
|
||||
*/
|
||||
private Date taxYearMonth;
|
||||
private List<Date> taxYearMonthRange;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:14
|
||||
* @description 往期累计情况编辑参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AddUpSituationParam {
|
||||
|
||||
//主键id
|
||||
private Long id;
|
||||
|
||||
//员工id
|
||||
private Long employeeId;
|
||||
|
||||
//申报年月
|
||||
private String taxYearMonth;
|
||||
|
||||
//姓名
|
||||
private String username;
|
||||
|
||||
//个税扣缴义务人
|
||||
private String taxAgentName;
|
||||
|
||||
//个税扣缴义务人id
|
||||
private Long taxAgentId;
|
||||
|
||||
//部门
|
||||
private String departmentName;
|
||||
|
||||
//手机号
|
||||
private String mobile;
|
||||
|
||||
//工号
|
||||
private String jobNum;
|
||||
|
||||
|
||||
//累计收入额
|
||||
private String addUpIncome;
|
||||
|
||||
//累计减除费用
|
||||
private String addUpSubtraction;
|
||||
|
||||
//累计社保个人合计
|
||||
private String addUpSocialSecurityTotal;
|
||||
|
||||
//累计公积金个人合计
|
||||
private String addUpAccumulationFundTotal;
|
||||
|
||||
//累计子女教育
|
||||
private String addUpChildEducation;
|
||||
|
||||
//累计继续教育
|
||||
private String addUpContinuingEducation;
|
||||
|
||||
//累计住房贷款利息
|
||||
private String addUpHousingLoanInterest;
|
||||
|
||||
//累计住房租金
|
||||
private String addUpHousingRent;
|
||||
|
||||
//累计赡养老人
|
||||
private String addUpSupportElderly;
|
||||
|
||||
//累计大病医疗
|
||||
private String addUpIllnessMedical;
|
||||
|
||||
//累计企业(职业)年金及其他福利
|
||||
private String addUpEnterpriseAndOther;
|
||||
|
||||
//累计其他扣除
|
||||
private String addUpOtherDeduction;
|
||||
|
||||
//累计免税收入
|
||||
private String addUpTaxExemptIncome;
|
||||
|
||||
//累计准予扣除的捐赠额
|
||||
private String addUpAllowedDonation;
|
||||
|
||||
//累计减免税额
|
||||
private String addUpTaxSavings;
|
||||
|
||||
//累计已预扣预缴税额
|
||||
private String addUpAdvanceTax;
|
||||
|
||||
//累计婴幼儿照护
|
||||
private String addUpInfantCare;
|
||||
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import com.engine.salary.entity.datacollection.AddUpSituation;
|
|||
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -62,4 +61,9 @@ public interface AddUpSituationMapper {
|
|||
void deleteByTaxYearMonthAndTaxAgentIds(@Param("param") AddUpSituation params);
|
||||
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
void deleteData(List<Long> longs);
|
||||
}
|
||||
|
|
@ -64,6 +64,17 @@
|
|||
, t.add_up_infant_care
|
||||
</sql>
|
||||
|
||||
<!--批量删除-->
|
||||
<update id="deleteData">
|
||||
UPDATE hrsa_add_up_situation t
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
|
|
@ -719,6 +730,9 @@
|
|||
#{employeeId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.taxYearMonthRange != null and param.taxYearMonthRange.size() > 1">
|
||||
AND ( tax_year_month BETWEEN #{param.taxYearMonthRange[0]} AND #{param.taxYearMonthRange[1]})
|
||||
</if>
|
||||
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
||||
AND tax_agent_id IN
|
||||
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.engine.salary.service;
|
|||
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
|
@ -74,4 +76,35 @@ public interface AddUpSituationService {
|
|||
|
||||
void batchSave(List<AddUpSituation> list);
|
||||
|
||||
/**
|
||||
* @description 编辑数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:03
|
||||
*/
|
||||
void editAddUpSituation(AddUpSituationParam addUpSituationParam);
|
||||
|
||||
/**
|
||||
* @description 新建数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:03
|
||||
*/
|
||||
void createAddUpSituation(AddUpSituationParam addUpSituationParam);
|
||||
|
||||
/**
|
||||
* @description 删除所选数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:35
|
||||
*/
|
||||
void deleteSelectAddUpSituation(AddUpDeductionRecordDeleteParam deleteParam);
|
||||
|
||||
/**
|
||||
* @description 一键清空所有数据
|
||||
* @return null
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:35
|
||||
*/
|
||||
void deleteAllAddUpSituation(AddUpDeductionRecordDeleteParam deleteParam);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -395,6 +395,21 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
public void editAddUpDeduction(AddUpDeductionRecordParam addUpDeduction) {
|
||||
AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz();
|
||||
String declareMonthStr = addUpDeduction.getDeclareMonth();
|
||||
|
||||
Long currentEmployeeId = (long) user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
AddUpDeduction byId = addUpDeductionBiz.getById(addUpDeduction.getId());
|
||||
if(byId == null){
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
if(!canEdit){
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
|
||||
// 已经核算过的不可操作
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr);
|
||||
|
|
@ -403,14 +418,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId()) && f.getTaxAgentId().equals(addUpDeduction.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!");
|
||||
}else {
|
||||
ArrayList<AddUpDeduction> updateList = new ArrayList<>();
|
||||
AddUpDeduction build = AddUpDeduction.builder().id(addUpDeduction.getId()).addUpChildEducation(addUpDeduction.getAddUpChildEducation()).addUpContinuingEducation(addUpDeduction.getAddUpContinuingEducation()).addUpHousingLoanInterest(addUpDeduction.getAddUpHousingLoanInterest()).addUpHousingRent(addUpDeduction.getAddUpHousingRent()).addUpSupportElderly(addUpDeduction.getAddUpSupportElderly()).addUpIllnessMedical(addUpDeduction.getAddUpIllnessMedical()).addUpInfantCare(addUpDeduction.getAddUpInfantCare()).build();
|
||||
updateList.add(build);
|
||||
addUpDeductionBiz.batchUpdate(updateList);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<AddUpDeduction> updateList = new ArrayList<>();
|
||||
AddUpDeduction build = AddUpDeduction.builder().id(addUpDeduction.getId()).addUpChildEducation(addUpDeduction.getAddUpChildEducation()).addUpContinuingEducation(addUpDeduction.getAddUpContinuingEducation()).addUpHousingLoanInterest(addUpDeduction.getAddUpHousingLoanInterest()).addUpHousingRent(addUpDeduction.getAddUpHousingRent()).addUpSupportElderly(addUpDeduction.getAddUpSupportElderly()).addUpIllnessMedical(addUpDeduction.getAddUpIllnessMedical()).addUpInfantCare(addUpDeduction.getAddUpInfantCare()).build();
|
||||
updateList.add(build);
|
||||
addUpDeductionBiz.batchUpdate(updateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -530,6 +543,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
for(int i=0; i<deleteIds.size(); i++){
|
||||
Long id = deleteIds.get(i);
|
||||
AddUpDeduction byId = addUpDeductionBiz.getById(id);
|
||||
if(byId == null){
|
||||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst();
|
||||
if(!first.isPresent()){
|
||||
|
|
@ -961,7 +977,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
salaryAcctRecords.forEach(e -> {
|
||||
boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue();
|
||||
if (isAccounted) {
|
||||
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId())));
|
||||
// list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId())));
|
||||
list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(e.getId())));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ import com.engine.salary.entity.datacollection.AddUpSituation;
|
|||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
||||
|
|
@ -819,6 +821,272 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 编辑数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:32
|
||||
*/
|
||||
@Override
|
||||
public void editAddUpSituation(AddUpSituationParam addUpSituationParam) {
|
||||
Long currentEmployeeId = (long) user.getUID();
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
//税款所属期
|
||||
String taxYearMonthStr = addUpSituationParam.getTaxYearMonth();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
AddUpSituation byId = biz.getById(addUpSituationParam.getId());
|
||||
if(byId == null){
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
if(!canEdit){
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
// 已经核算过的不可操作
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(taxYearMonthStr);
|
||||
|
||||
// 判断是否有核算过
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpSituationParam.getEmployeeId()) && f.getTaxAgentId().equals(addUpSituationParam.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!");
|
||||
}
|
||||
}
|
||||
ArrayList<AddUpSituation> updateList = new ArrayList<>();
|
||||
AddUpSituation build = AddUpSituation.builder().id(addUpSituationParam.getId()).addUpIncome(addUpSituationParam.getAddUpIncome()).addUpSubtraction(addUpSituationParam.getAddUpSubtraction())
|
||||
.addUpSocialSecurityTotal(addUpSituationParam.getAddUpSocialSecurityTotal()).addUpAccumulationFundTotal(addUpSituationParam.getAddUpAccumulationFundTotal())
|
||||
.addUpChildEducation(addUpSituationParam.getAddUpChildEducation()).addUpContinuingEducation(addUpSituationParam.getAddUpContinuingEducation())
|
||||
.addUpHousingLoanInterest(addUpSituationParam.getAddUpHousingLoanInterest()).addUpHousingRent(addUpSituationParam.getAddUpHousingRent())
|
||||
.addUpSupportElderly(addUpSituationParam.getAddUpSupportElderly()).addUpIllnessMedical(addUpSituationParam.getAddUpIllnessMedical())
|
||||
.addUpEnterpriseAndOther(addUpSituationParam.getAddUpEnterpriseAndOther()).addUpOtherDeduction(addUpSituationParam.getAddUpOtherDeduction())
|
||||
.addUpTaxExemptIncome(addUpSituationParam.getAddUpTaxExemptIncome()).addUpAllowedDonation(addUpSituationParam.getAddUpAllowedDonation())
|
||||
.addUpTaxSavings(addUpSituationParam.getAddUpTaxSavings()).addUpAdvanceTax(addUpSituationParam.getAddUpAdvanceTax())
|
||||
.addUpInfantCare(addUpSituationParam.getAddUpInfantCare()).build();
|
||||
updateList.add(build);
|
||||
biz.batchUpdate(updateList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新建数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:04
|
||||
*/
|
||||
@Override
|
||||
public void createAddUpSituation(AddUpSituationParam addUpSituationParam) {
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
|
||||
//查询对于人员信息导入筛选的全局配置
|
||||
//SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
//String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
||||
Long currentEmployeeId = (long) user.getUID();
|
||||
//税款所属期
|
||||
String taxYearMonthStr = Util.null2String(addUpSituationParam.getTaxYearMonth());
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
// 获取租户下所有的人员
|
||||
List<DataCollectionEmployee> employees = employBiz.listEmployee();
|
||||
// 已经核算过的不可操作
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(taxYearMonthStr);
|
||||
//税款所属期
|
||||
Date taxYearMonth = SalaryDateUtil.localDateToDate(LocalDate.parse(taxYearMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER));
|
||||
// 查询已有数据
|
||||
List<AddUpSituation> list = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxYearMonth(taxYearMonth).build());
|
||||
Date now = new Date();
|
||||
//合规数据
|
||||
List<AddUpSituation> insertList = new ArrayList<>();
|
||||
|
||||
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> taxAgentEmployees = Lists.newArrayList();
|
||||
|
||||
//待插入数据库对象
|
||||
AddUpSituation po = AddUpSituation.builder().tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.creator((long) user.getUID())
|
||||
.year(Integer.valueOf(taxYearMonthStr.split("-")[0]))
|
||||
.taxYearMonth(taxYearMonth)
|
||||
.build();
|
||||
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == addUpSituationParam.getEmployeeId());
|
||||
if(!employeeSameId){
|
||||
throw new SalaryRunTimeException("员工信息不存在");
|
||||
}
|
||||
po.setEmployeeId(addUpSituationParam.getEmployeeId());
|
||||
String taxAgentName = addUpSituationParam.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());
|
||||
taxAgentEmployees = optionalTemp.get().getEmployeeList();
|
||||
} else {
|
||||
//个税扣缴义务人不存在
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
}
|
||||
|
||||
// fixme 分权判断,若员工离职后,不在扣缴义务人范围内,会有异常
|
||||
// if (openDevolution) {
|
||||
// Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst();
|
||||
// if (!optionalTaxAgentEmp.isPresent()) {
|
||||
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
// errorMessageMap.put("message", rowIndex + "该条数据不在个税扣缴义务人人员范围内,不可导入");
|
||||
// errorData.add(errorMessageMap);
|
||||
// errorSum += 1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 判断是否有核算过
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())).findFirst();
|
||||
boolean isExist = list.stream().anyMatch(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId()));
|
||||
if (optionalAcctEmp.isPresent() && isExist) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可导入");
|
||||
}
|
||||
}
|
||||
|
||||
//累计收入额
|
||||
String addUpIncome = addUpSituationParam.getAddUpIncome();
|
||||
po.setAddUpIncome(Util.null2String(addUpIncome));
|
||||
//累计减除费用
|
||||
String addUpSubtraction = addUpSituationParam.getAddUpSubtraction();
|
||||
po.setAddUpSubtraction(addUpSubtraction);
|
||||
//累计社保个人合计
|
||||
String addUpSocialSecurityTotal = addUpSituationParam.getAddUpSocialSecurityTotal();
|
||||
po.setAddUpSocialSecurityTotal(addUpSocialSecurityTotal);
|
||||
//累计公积金个人合计
|
||||
String addUpAccumulationFundTotal = addUpSituationParam.getAddUpAccumulationFundTotal();
|
||||
po.setAddUpAccumulationFundTotal(addUpAccumulationFundTotal);
|
||||
//累计子女教育
|
||||
String addUpChildEducation = addUpSituationParam.getAddUpChildEducation();
|
||||
po.setAddUpChildEducation(Util.null2String(addUpChildEducation));
|
||||
//累计继续教育
|
||||
String addUpContinuingEducation = addUpSituationParam.getAddUpContinuingEducation();
|
||||
po.setAddUpContinuingEducation(Util.null2String(addUpContinuingEducation));
|
||||
//累计住房贷款利息
|
||||
String addUpHousingLoanInterest = addUpSituationParam.getAddUpHousingLoanInterest();
|
||||
po.setAddUpHousingLoanInterest(Util.null2String(addUpHousingLoanInterest));
|
||||
//累计住房租金
|
||||
String addUpHousingRent = addUpSituationParam.getAddUpHousingRent();
|
||||
po.setAddUpHousingRent(Util.null2String(addUpHousingRent));
|
||||
//累计赡养老人
|
||||
String addUpSupportElderly = addUpSituationParam.getAddUpSupportElderly();
|
||||
po.setAddUpSupportElderly(Util.null2String(addUpSupportElderly));
|
||||
//累计企业(职业)年金及其他福利
|
||||
String addUpEnterpriseAndOther = addUpSituationParam.getAddUpEnterpriseAndOther();
|
||||
po.setAddUpEnterpriseAndOther(addUpEnterpriseAndOther);
|
||||
//累计其他扣除
|
||||
String addUpOtherDeduction = addUpSituationParam.getAddUpOtherDeduction();
|
||||
po.setAddUpOtherDeduction(addUpOtherDeduction);
|
||||
//累计免税收入
|
||||
String addUpTaxExemptIncome = addUpSituationParam.getAddUpTaxExemptIncome();
|
||||
po.setAddUpTaxExemptIncome(addUpTaxExemptIncome);
|
||||
//累计准予扣除的捐赠额
|
||||
String addUpAllowedDonation = addUpSituationParam.getAddUpAllowedDonation();
|
||||
po.setAddUpAllowedDonation(addUpAllowedDonation);
|
||||
//累计已预扣预缴税额
|
||||
String addUpAdvanceTax = addUpSituationParam.getAddUpAdvanceTax();
|
||||
po.setAddUpAdvanceTax(addUpAdvanceTax);
|
||||
po.setAddUpIllnessMedical(addUpSituationParam.getAddUpIllnessMedical());
|
||||
po.setAddUpTaxSavings(addUpSituationParam.getAddUpTaxSavings());
|
||||
po.setAddUpInfantCare(addUpSituationParam.getAddUpInfantCare());
|
||||
insertList.add(po);
|
||||
|
||||
//入库
|
||||
biz.handleImportData(insertList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSelectAddUpSituation(AddUpDeductionRecordDeleteParam deleteParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
String declareMonthStr = deleteParam.getDeclareMonth();
|
||||
List<Long> deleteIds = deleteParam.getIds();
|
||||
// 已经核算过的不可操作
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
|
||||
// 判断是否有核算过
|
||||
List<Long> deleteList = new ArrayList<>();
|
||||
for(int i=0; i<deleteIds.size(); i++){
|
||||
Long id = deleteIds.get(i);
|
||||
AddUpSituation byId = biz.getById(id);
|
||||
if(byId == null){
|
||||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst();
|
||||
if(!first.isPresent()){
|
||||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
// 判断用户是否存在
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(byId.getEmployeeId()) && f.getTaxAgentId().equals(byId.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("所选数据在该年月中已经核算过并归档,不可进行删除!");
|
||||
}
|
||||
}
|
||||
deleteList.add(byId.getId());
|
||||
}
|
||||
biz.batchDeleteByIDS(deleteList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllAddUpSituation(AddUpDeductionRecordDeleteParam deleteParam) {
|
||||
String declareMonthStr = deleteParam.getDeclareMonth();
|
||||
long currentEmployeeId = user.getUID();
|
||||
LocalDate beginLocalDate = LocalDate.of(SalaryEntityUtil.string2Integer(declareMonthStr), 1, 1);
|
||||
LocalDate endLocalDate = LocalDate.of(SalaryEntityUtil.string2Integer(declareMonthStr), 12, 1);
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
List<Long> taxAgentIds = taxAgentList.stream().map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId).collect(Collectors.toList());
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
Date beginDate = SalaryDateUtil.localDateToDate(beginLocalDate);
|
||||
Date endDate = SalaryDateUtil.localDateToDate(endLocalDate);
|
||||
ArrayList<Date> dateRange = new ArrayList<>();
|
||||
dateRange.add(beginDate);
|
||||
dateRange.add(endDate);
|
||||
AddUpSituation queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(taxAgentIds).build();
|
||||
// 获取所有想要删除的数据
|
||||
List<AddUpSituation> list = biz.listSome(queryParam);
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = new ArrayList<>();
|
||||
for(int i=1;i<=12;i++){
|
||||
String monthStr="";
|
||||
if(i<10){
|
||||
monthStr = declareMonthStr + "-0"+i;
|
||||
}else {
|
||||
monthStr = declareMonthStr + "-"+i;
|
||||
}
|
||||
|
||||
List<SalaryAcctEmployeePO> employees = getAddUpDeductionService(user).getAccountedEmployeeData(monthStr);
|
||||
salaryAcctEmployees.addAll(employees);
|
||||
}
|
||||
salaryAcctEmployees = salaryAcctEmployees.stream().distinct().collect(Collectors.toList());
|
||||
for(AddUpSituation 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("有员工在该年月中已经完成核算并归档,不能进行一键清空!");
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Long> deleteIds = list.stream().map(AddUpSituation::getId).collect(Collectors.toList());
|
||||
biz.batchDeleteByIDS(deleteIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<AddUpSituation> list) {
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
|
|||
|
|
@ -560,6 +560,20 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
public void editData(OtherDeductionParam otherDeductionParam) {
|
||||
String declareMonthStr = otherDeductionParam.getDeclareMonth();
|
||||
OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz();
|
||||
|
||||
Long currentEmployeeId = (long) user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
OtherDeductionPO byId = OtherDeductionBiz.getById(otherDeductionParam.getId());
|
||||
if(byId == null){
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
if(!canEdit){
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
|
||||
// 判断是否有核算过
|
||||
|
|
@ -567,13 +581,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(otherDeductionParam.getEmployeeId()) && f.getTaxAgentId().equals(otherDeductionParam.getTaxAgentId())).findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!");
|
||||
}else{
|
||||
ArrayList<OtherDeductionPO> updateList = new ArrayList<>();
|
||||
OtherDeductionPO build = OtherDeductionPO.builder().id(otherDeductionParam.getId()).businessHealthyInsurance(otherDeductionParam.getBusinessHealthyInsurance()).taxDelayEndowmentInsurance(otherDeductionParam.getTaxDelayEndowmentInsurance()).otherDeduction(otherDeductionParam.getOtherDeduction()).deductionAllowedDonation(otherDeductionParam.getDeductionAllowedDonation()).build();
|
||||
updateList.add(build);
|
||||
OtherDeductionBiz.batchUpdate(updateList);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<OtherDeductionPO> updateList = new ArrayList<>();
|
||||
OtherDeductionPO build = OtherDeductionPO.builder().id(otherDeductionParam.getId()).businessHealthyInsurance(otherDeductionParam.getBusinessHealthyInsurance()).taxDelayEndowmentInsurance(otherDeductionParam.getTaxDelayEndowmentInsurance()).otherDeduction(otherDeductionParam.getOtherDeduction()).deductionAllowedDonation(otherDeductionParam.getDeductionAllowedDonation()).build();
|
||||
updateList.add(build);
|
||||
OtherDeductionBiz.batchUpdate(updateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -675,7 +688,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
long currentEmployeeId = user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz();
|
||||
OtherDeductionBiz otherDeductionBiz = new OtherDeductionBiz();
|
||||
String declareMonthStr = deleteParam.getDeclareMonth();
|
||||
List<Long> deleteIds = deleteParam.getIds();
|
||||
// 已经核算过的不可操作
|
||||
|
|
@ -685,7 +698,10 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
List<Long> deleteList = new ArrayList<>();
|
||||
for(int i=0; i<deleteIds.size(); i++){
|
||||
Long id = deleteIds.get(i);
|
||||
OtherDeductionPO byId = OtherDeductionBiz.getById(id);
|
||||
OtherDeductionPO byId = otherDeductionBiz.getById(id);
|
||||
if(byId == null){
|
||||
throw new SalaryRunTimeException("数据不存在或已被删除!");
|
||||
}
|
||||
// 判断是否在个税扣缴义务人范围内
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst();
|
||||
if(!first.isPresent()){
|
||||
|
|
@ -700,7 +716,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
|
|||
}
|
||||
deleteList.add(byId.getId());
|
||||
}
|
||||
OtherDeductionBiz.batchDeleteByIDS(deleteList);
|
||||
otherDeductionBiz.batchDeleteByIDS(deleteList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class SalaryDateUtil {
|
|||
public static final FastDateFormat DATE_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd");
|
||||
public static final FastDateFormat DATETIME_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public static final DateTimeFormatter YEAR_FORMATTER = DateTimeFormatter.ofPattern("yyyy");
|
||||
public static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
public static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
|
|
@ -271,6 +272,62 @@ public class AddUpSituationController {
|
|||
return new ResponseResult<AddUpSituationImportParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::importAddUpSituation, importParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 编辑数据
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:10
|
||||
*/
|
||||
@POST
|
||||
@Path("/editAddUpSituation")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String editAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpSituationParam addUpSituation) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<AddUpSituationParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::editAddUpSituation, addUpSituation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新建数据
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:10
|
||||
*/
|
||||
@POST
|
||||
@Path("/createAddUpSituation")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String createAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpSituationParam addUpSituation) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<AddUpSituationParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::createAddUpSituation, addUpSituation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 删除所选数据 逻辑未确定
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:10
|
||||
*/
|
||||
// @POST
|
||||
// @Path("/deleteSelectAddUpSituation")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String deleteSelectAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam addUpSituationDeleteParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::deleteSelectAddUpSituation, addUpSituationDeleteParam);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @description 一键清空 逻辑未确定
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:10
|
||||
*/
|
||||
// @POST
|
||||
// @Path("/deleteAllAddUpSituation")
|
||||
// @Produces(MediaType.APPLICATION_JSON)
|
||||
// public String deleteAllAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam addUpSituationDeleteParam) {
|
||||
// User user = HrmUserVarify.getUser(request, response);
|
||||
// return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::deleteAllAddUpSituation, addUpSituationDeleteParam);
|
||||
// }
|
||||
|
||||
@POST
|
||||
@Path("/preview")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.AddUpSituationService;
|
||||
|
|
@ -128,4 +130,43 @@ public class AddUpSituationWrapper extends Service {
|
|||
return getAddUpSituationService(user).importAddUpSituation(importParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 编辑数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 21:30
|
||||
*/
|
||||
public void editAddUpSituation(AddUpSituationParam addUpSituationParam) {
|
||||
getAddUpSituationService(user).editAddUpSituation(addUpSituationParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新建数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:00
|
||||
*/
|
||||
public void createAddUpSituation(AddUpSituationParam addUpSituationParam) {
|
||||
getAddUpSituationService(user).createAddUpSituation(addUpSituationParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 删除所选数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:34
|
||||
*/
|
||||
public void deleteSelectAddUpSituation(AddUpDeductionRecordDeleteParam deleteParam) {
|
||||
getAddUpSituationService(user).deleteSelectAddUpSituation(deleteParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 一键清空数据
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/27 22:34
|
||||
*/
|
||||
public void deleteAllAddUpSituation(AddUpDeductionRecordDeleteParam deleteParam) {
|
||||
getAddUpSituationService(user).deleteAllAddUpSituation(deleteParam);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue