导入往期累计
This commit is contained in:
parent
4d40deeada
commit
de0728665b
|
|
@ -2,7 +2,44 @@
|
|||
|
||||
<config name="薪酬管理权限" key="salary">
|
||||
|
||||
<module name="我的薪资福利" key="myBill">
|
||||
<page name="我的薪资福利" key="myBill">
|
||||
<opt name="查询" key="query"/>
|
||||
</page>
|
||||
</module>
|
||||
|
||||
<module name="配置" key="config">
|
||||
|
||||
<page name="薪资项目管理" key="salaryItem">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
|
||||
<page name="字段管理" key="salaryField">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
|
||||
</module>
|
||||
|
||||
|
||||
<module name="算薪" key="calculate">
|
||||
|
||||
<page name="社保福利方案" key="siScheme">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
|
||||
<page name="社保福利档案" key="siArchive">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
|
||||
<page name="社保福利台账" key="siAccount">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
|
||||
<page name="薪资账套" key="salarySob">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
|
|
|
|||
|
|
@ -26,5 +26,8 @@ public class BaseQueryParam {
|
|||
*/
|
||||
private OrderRuleVO orderRule;
|
||||
|
||||
/**
|
||||
* 数据过滤级别
|
||||
*/
|
||||
private AuthFilterTypeEnum filterType ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.engine.salary.entity.datacollection;
|
||||
|
||||
import com.engine.salary.annotation.Encrypt;
|
||||
import com.engine.salary.annotation.SalaryFormulaVar;
|
||||
import com.engine.salary.annotation.SalaryTable;
|
||||
import com.engine.salary.annotation.SalaryTableOperate;
|
||||
import com.engine.salary.annotation.*;
|
||||
import com.engine.hrmelog.annotation.ElogTransform;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -13,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 数据采集-累计情况表
|
||||
|
|
@ -24,6 +22,7 @@ import java.util.List;
|
|||
@SalaryTable(pageId = "a4f83287-e3f9-4275-9527-7d06e54y6238", fields = "id,addUpSubtraction", operates = {@SalaryTableOperate(text = "删除",index = "0")})
|
||||
//hrsa_add_up_situation
|
||||
@ElogTransform(name = "往期累计情况")
|
||||
@Auth(page = "addUpSituation")
|
||||
public class AddUpSituation {
|
||||
/**
|
||||
* 主键id
|
||||
|
|
@ -234,4 +233,7 @@ public class AddUpSituation {
|
|||
Collection<Long> employeeIds;
|
||||
Collection<Long> taxAgentIds;
|
||||
|
||||
|
||||
private Set<String> opts;
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
package com.engine.salary.entity.datacollection.dto;
|
||||
|
||||
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.annotation.*;
|
||||
import com.engine.salary.enums.auth.AuthCheckTypeEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
|
@ -13,6 +11,7 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 数据采集-考勤引用列表
|
||||
|
|
@ -30,6 +29,7 @@ import java.util.Date;
|
|||
@SalaryTableOperate(text = "查看", index = "0"),
|
||||
@SalaryTableOperate(text = "删除", index = "1")
|
||||
})
|
||||
@Auth(page = "attendQuote",checkType = AuthCheckTypeEnum.SOB)
|
||||
public class AttendQuoteListDTO {
|
||||
|
||||
@SalaryTableColumn(column = "id", display = false)
|
||||
|
|
@ -79,4 +79,6 @@ public class AttendQuoteListDTO {
|
|||
* 薪资账套id
|
||||
*/
|
||||
private Long salarySobId;
|
||||
|
||||
private Set<String> opts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.entity.taxagent.param;
|
||||
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -27,9 +26,4 @@ public class TaxAgentQueryParam extends BaseQueryParam {
|
|||
|
||||
//个税扣缴义务人名称
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数据过滤级别
|
||||
*/
|
||||
private AuthFilterTypeEnum filterType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
|
|
@ -22,6 +23,7 @@ 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;
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
|
|
@ -264,6 +266,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
|
||||
@Override
|
||||
public XSSFWorkbook export(AddUpSituationQueryParam queryParam) {
|
||||
queryParam.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
|
||||
// 获取操作按钮资源
|
||||
List<List<Object>> rowList = getExcelRowList(queryParam, true);
|
||||
|
||||
|
|
@ -302,10 +305,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
//排序配置
|
||||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
param.setOrderRule(orderRule);
|
||||
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(param);
|
||||
list = getAuthService(user).auth(list, AuthFilterTypeEnum.QUERY_DATA, AddUpSituationDTO.class);
|
||||
encryptUtil.decryptList(list, AddUpSituationDTO.class);
|
||||
SalaryI18nUtil.i18nList(list);
|
||||
List<AddUpSituationDTO> list = listAuth(param);
|
||||
|
||||
final List<List<Object>> dataRowList = Optional.ofNullable(list)
|
||||
.map(List::stream)
|
||||
|
|
@ -345,6 +345,14 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
return rowList;
|
||||
}
|
||||
|
||||
private List<AddUpSituationDTO> listAuth(AddUpSituationQueryParam param) {
|
||||
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(param);
|
||||
list = getAuthService(user).auth(list, param.getFilterType(), AddUpSituationDTO.class);
|
||||
encryptUtil.decryptList(list, AddUpSituationDTO.class);
|
||||
SalaryI18nUtil.i18nList(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出详情
|
||||
|
|
@ -449,6 +457,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
|
||||
@Override
|
||||
public XSSFWorkbook downloadTemplate(AddUpSituationQueryParam queryParam) {
|
||||
queryParam.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
|
||||
String sheetName = SalaryI18nUtil.getI18nLabel(101605, "往期累计情况导入模板");
|
||||
// 获取操作按钮资源
|
||||
List<List<Object>> rowList = getExcelRowList(queryParam, queryParam.isHasData());
|
||||
|
|
@ -520,10 +529,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
|
||||
@Override
|
||||
public Map<String, Object> importAddUpSituation(AddUpSituationImportParam importParam) {
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
|
||||
//查询对于人员信息导入筛选的全局配置
|
||||
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
|
|
@ -540,7 +547,9 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
Long currentEmployeeId = (long) user.getUID();
|
||||
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
|
||||
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
|
||||
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAuth(param);
|
||||
// 获取租户下所有的人员
|
||||
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).listEmployee();
|
||||
// 已经核算过的不可操作
|
||||
|
|
@ -607,7 +616,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
String idNo = dto.getIdNo();
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo,null);
|
||||
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo, null);
|
||||
|
||||
//当人员信息导入筛选的全局配置为"0"时,姓名才是必填项
|
||||
if (StringUtils.isBlank(userName) && "0".equals(confValue)) {
|
||||
|
|
@ -658,10 +667,9 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
} else {
|
||||
Optional<TaxAgentManageRangeEmployeeDTO> optionalTemp = taxAgentList.stream().filter(m -> m.getTaxAgentName().equals(taxAgentName)).findFirst();
|
||||
Optional<TaxAgentPO> optionalTemp = taxAgentList.stream().filter(m -> m.getName().equals(taxAgentName)).findFirst();
|
||||
if (optionalTemp.isPresent()) {
|
||||
po.setTaxAgentId(optionalTemp.get().getTaxAgentId());
|
||||
taxAgentEmployees = optionalTemp.get().getEmployeeList();
|
||||
po.setTaxAgentId(optionalTemp.get().getId());
|
||||
} else {
|
||||
//个税扣缴义务人不存在
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
|
|
@ -671,17 +679,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
}
|
||||
}
|
||||
|
||||
// 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) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())).findFirst();
|
||||
|
|
@ -932,12 +929,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
*/
|
||||
@Override
|
||||
public void createAddUpSituation(AddUpSituationParam addUpSituationParam) {
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
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());
|
||||
|
|
@ -989,16 +981,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
}
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
|
|
@ -1063,9 +1045,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
|
||||
@Override
|
||||
public void deleteSelectAddUpSituation(AddUpSituationDeleteParam deleteParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
String declareMonthStr = deleteParam.getTaxYearMonth();
|
||||
List<Long> deleteIds = deleteParam.getIds();
|
||||
|
|
@ -1078,17 +1057,24 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
// 判断是否有核算过
|
||||
List<AddUpSituation> deletePOList = new ArrayList<>();
|
||||
List<Long> deleteList = new ArrayList<>();
|
||||
|
||||
AddUpSituationQueryParam param = AddUpSituationQueryParam.builder().ids(deleteIds).build();
|
||||
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
|
||||
List<AddUpSituationDTO> addUpSituationDTOS = listAuth(param);
|
||||
if (CollectionUtil.isEmpty(addUpSituationDTOS)) {
|
||||
throw new SalaryRunTimeException("无权限删除数据!");
|
||||
}
|
||||
|
||||
deleteIds = SalaryEntityUtil.properties(addUpSituationDTOS, AddUpSituationDTO::getId, Collectors.toList());
|
||||
|
||||
|
||||
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 -> Objects.equals(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();
|
||||
|
|
@ -1119,11 +1105,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
@Override
|
||||
public void deleteAllAddUpSituation(AddUpSituationDeleteParam deleteParam) {
|
||||
String declareMonthStr = deleteParam.getTaxYearMonth();
|
||||
long currentEmployeeId = user.getUID();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
List<Long> taxAgentIds = taxAgentList.stream().map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId).collect(Collectors.toList());
|
||||
AddUpSituationBiz biz = new AddUpSituationBiz();
|
||||
Date declareMonthDate = new Date();
|
||||
try {
|
||||
|
|
@ -1131,24 +1113,20 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
} catch (Exception e) {
|
||||
throw new SalaryRunTimeException("日期异常");
|
||||
}
|
||||
AddUpSituation queryParam = null;
|
||||
AddUpSituation queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).build();
|
||||
|
||||
if (deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()) {
|
||||
// 设置了个税扣缴义务人
|
||||
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);
|
||||
queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(tai).build();
|
||||
} else {
|
||||
queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(taxAgentIds).build();
|
||||
queryParam.setTaxAgentIds(tai);
|
||||
}
|
||||
|
||||
// 获取所有想要删除的数据
|
||||
List<AddUpSituation> list = biz.listSome(queryParam);
|
||||
list = getAuthService(user).auth(list, AuthFilterTypeEnum.ADMIN_DATA, AddUpSituation.class);
|
||||
|
||||
LocalDate salaryMonthDate = LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER);
|
||||
String format = salaryMonthDate.plusMonths(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
// 获取已经核算的数据
|
||||
|
|
@ -1165,10 +1143,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
|
|||
biz.batchDeleteByIDS(deleteIds);
|
||||
|
||||
// 记录日志
|
||||
Collection<Long> finalTaxAgentIds = queryParam.getTaxAgentIds();
|
||||
List<String> taxAgentNames = taxAgentList.stream().filter(t -> finalTaxAgentIds.contains(t.getTaxAgentId()))
|
||||
.map(TaxAgentManageRangeEmployeeDTO::getTaxAgentName).collect(Collectors.toList());
|
||||
String name = declareMonthStr + " " + StringUtils.join(taxAgentNames, ",");
|
||||
String name = declareMonthStr +"-"+ deleteParam.getTaxAgentId();
|
||||
LoggerContext<AddUpSituation> loggerContext = new LoggerContext<>();
|
||||
loggerContext.setTargetName(name);
|
||||
loggerContext.setOperateType(OperateTypeEnum.CLEAR.getValue());
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO;
|
|||
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.AttendQuotePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.AttendQuoteMapper;
|
||||
|
|
@ -18,20 +18,22 @@ import com.engine.salary.service.AttendQuoteService;
|
|||
import com.engine.salary.service.SalaryAcctRecordService;
|
||||
import com.engine.salary.service.SalarySobService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.auth.AuthService;
|
||||
import com.engine.salary.service.auth.AuthServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.SalaryLoggerUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -56,42 +58,21 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic
|
|||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
public AuthService getAuthService(User user) {
|
||||
return ServiceUtil.getService(AuthServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<AttendQuoteListDTO> listPage(AttendQuoteQueryParam queryParam) {
|
||||
|
||||
List<String> declareMonth = queryParam.getSalaryYearMonth();
|
||||
// SalaryAcctRecordPO queryRecordParam = new SalaryAcctRecordPO();
|
||||
if (CollectionUtils.isNotEmpty(declareMonth)) {
|
||||
queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
queryParam.setSalaryYearMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
// LocalDateRange salaryMonth = LocalDateRange.builder().fromDate(SalaryDateUtil.dateStrToLocalDate(declareMonth.get(0)+"-01 00:00:00"))
|
||||
// .endDate(SalaryDateUtil.dateStrToLocalTime(declareMonth.get(1)+"-01 00:00:00")).build();
|
||||
// queryRecordParam.setSalaryMonths(salaryMonth);
|
||||
}
|
||||
|
||||
|
||||
long currentEmployeeId = user.getUID();
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
|
||||
if (needAuth) {
|
||||
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
|
||||
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
|
||||
if (CollectionUtils.isEmpty(salarySobIds)) {
|
||||
return new PageInfo<>(AttendQuoteListDTO.class);
|
||||
}
|
||||
queryParam.setSalarySobIds(salarySobIds);
|
||||
// queryRecordParam.setSalarySobIds(salarySobIds);
|
||||
}
|
||||
|
||||
// 获取已经归档的记录
|
||||
// List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listSome(queryRecordParam);
|
||||
// List<String> archivedRecords = salaryAcctRecordPOS.stream().filter(PO -> PO.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())
|
||||
// .map(PO -> SalaryDateUtil.getFormatYearMonth(PO.getSalaryMonth()) + PO.getSalarySobId())
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
|
||||
List<AttendQuoteListDTO> list = getAttendQuoteMapper().list(queryParam);
|
||||
// list.stream().forEach(DTO -> DTO.setCanDelete( !archivedRecords.contains( (SalaryDateUtil.getFormatYearMonth(DTO.getSalaryYearMonth()) + DTO.getSalarySobId().toString()) ) ));
|
||||
list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, AttendQuoteListDTO.class);
|
||||
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
|
||||
list, AttendQuoteListDTO.class);
|
||||
|
|
@ -103,8 +84,9 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic
|
|||
throw new SalaryRunTimeException("参数错误");
|
||||
}
|
||||
List<AttendQuoteListDTO> attendQuotes = biz.list(AttendQuoteQueryParam.builder().ids(ids).build());
|
||||
attendQuotes = getAuthService(user).auth(attendQuotes, AuthFilterTypeEnum.ADMIN_DATA, AttendQuoteListDTO.class);
|
||||
if (CollectionUtils.isEmpty(attendQuotes)) {
|
||||
throw new SalaryRunTimeException("要删除的数据不存在或已删除");
|
||||
throw new SalaryRunTimeException("无权限删除数据!");
|
||||
}
|
||||
|
||||
List<AttendQuoteListDTO> accountingAttendQuotes = attendQuotes.stream().filter(e -> e.getSalaryAccountingStatus().equals(1)).collect(Collectors.toList());
|
||||
|
|
|
|||
Loading…
Reference in New Issue