parent
e512a2868a
commit
1d43e980e7
|
|
@ -443,16 +443,17 @@ public class AddUpDeductionServiceImpl extends Service implements 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) {
|
||||
AddUpDeduction po = addUpDeductionBiz.getById(addUpDeduction.getId());
|
||||
if (po == null) {
|
||||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId));
|
||||
if (!canEdit) {
|
||||
// 获取所有个税扣缴义务人
|
||||
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
|
||||
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
|
||||
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAuth(param);
|
||||
List<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentList, TaxAgentPO::getId, Collectors.toList());
|
||||
Long taxAgentId = po.getTaxAgentId();
|
||||
if (!taxAgentIds.contains(taxAgentId)) {
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
|
|
@ -481,7 +482,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
||||
loggerContext.setOperateTypeName(name);
|
||||
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "累计专项附加扣除") + "-" + SalaryI18nUtil.getI18nLabel(0, "编辑"));
|
||||
loggerContext.setOldValues(byId);
|
||||
loggerContext.setOldValues(po);
|
||||
loggerContext.setNewValues(newValue);
|
||||
loggerContext.setUser(user);
|
||||
SalaryElogConfig.addUpDeductionLoggerTemplate.write(loggerContext);
|
||||
|
|
@ -489,10 +490,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
|
||||
@Override
|
||||
public void createAddUpDeduction(AddUpDeductionRecordParam addUpDeductionRecordParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz();
|
||||
|
||||
//税款所属期
|
||||
String declareMonthStr = addUpDeductionRecordParam.getDeclareMonth();
|
||||
if (declareMonthStr.equals("")) {
|
||||
|
|
@ -502,8 +499,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
|
||||
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
|
||||
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAuth(param);
|
||||
//个税扣缴义务人
|
||||
String taxAgentId = Util.null2String(addUpDeductionRecordParam.getTaxAgentId());
|
||||
// 获取租户下所有的人员
|
||||
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listEmployee();
|
||||
// 已经核算过的不可操作
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.engine.salary.entity.datacollection.param.VariableItemSaveParam;
|
|||
import com.engine.salary.entity.datacollection.po.VariableItemPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaPO;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.VariableItemMapper;
|
||||
|
|
@ -22,14 +21,16 @@ 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.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.conn.util.IdGenerator;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -95,20 +96,6 @@ public class VariableItemServiceImpl extends Service implements VariableItemServ
|
|||
@Override
|
||||
public PageInfo<VariableItemListDTO> listPage(VariableItemQueryParam queryParam) {
|
||||
List<VariableItemPO> variableItemPOS = listAll();
|
||||
Long employeeId = Long.valueOf(user.getUID());
|
||||
// 判断是否是“总管理员”
|
||||
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
|
||||
// 是否开启分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
if (BooleanUtils.isTrue(openDevolution) && !isChief) {
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
|
||||
List<Long> taxAgentIds = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
// 无权限
|
||||
return new PageInfo<>();
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(queryParam.getItemName())) {
|
||||
variableItemPOS = variableItemPOS.stream().filter(po -> po.getName().contains(queryParam.getItemName())).collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -146,7 +133,7 @@ public class VariableItemServiceImpl extends Service implements VariableItemServ
|
|||
.name(saveParam.getName())
|
||||
.code(IdGenerator.getUUID())
|
||||
.dataType(saveParam.getDataType())
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.creator((long) user.getUID())
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
|
|
@ -241,8 +228,7 @@ public class VariableItemServiceImpl extends Service implements VariableItemServ
|
|||
if (CollectionUtils.containsAny(usingVariableItemIds, itemIds)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "浮动薪资档案中正在使用该薪资项目,不允许删除"));
|
||||
}
|
||||
itemIds.stream().forEach(id -> getVariableItemMapper().delete(VariableItemPO.builder().id(id).build()));
|
||||
;
|
||||
itemIds.forEach(id -> getVariableItemMapper().delete(VariableItemPO.builder().id(id).build()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue