This commit is contained in:
钱涛 2022-06-09 17:45:28 +08:00
parent 7f8d317846
commit b8972bcd43
27 changed files with 461 additions and 420 deletions

View File

@ -47,6 +47,8 @@ public class AddUpDeductionQueryParam extends BaseQueryParam {
//个税扣缴义务人的主键id
private Long taxAgentId;
private Collection<Long> taxAgentIds;
//部门id
private List<Long> departmentIds;

View File

@ -42,6 +42,7 @@ public class AddUpSituationQueryParam extends BaseQueryParam {
//个税扣缴义务人的主键id
private Long taxAgentId;
private List<Long> taxAgentIds;
//部门id
private List<Long> departmentIds;

View File

@ -38,6 +38,7 @@ public class OtherDeductionQueryParam extends BaseQueryParam {
//个税扣缴义务人的主键id
private Long taxAgentId;
private Collection<Long> taxAgentIds;
//部门id
private List<Long> departmentIds;

View File

@ -48,4 +48,7 @@ public class SalaryArchiveQueryParam extends BaseQueryParam {
private String importType;
private Collection<Long> employeeIds;
//导出模板时是否包含数据
private Boolean hasData;
}

View File

@ -3,6 +3,7 @@ package com.engine.salary.entity.salarysob.bo;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
@ -79,12 +80,14 @@ public class SalarySobRangeBO {
public static List<SalarySobRangeListDTO> convert2ListDTO(List<SalarySobRangePO> salarySobRanges,
List<DataCollectionEmployee> employeeComInfos,
List<DeptInfo> departmentComInfos,
List<SubCompanyInfo> subCompanyInfos,
List<PositionInfo> positionComInfos) {
if (CollectionUtils.isEmpty(salarySobRanges)) {
return Collections.emptyList();
}
Map<Long, String> employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername);
Map<Long, String> departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, DeptInfo::getId, DeptInfo::getName);
Map<Long, String> subCompanyComInfoMap = SalaryEntityUtil.convert2Map(subCompanyInfos, SubCompanyInfo::getId, SubCompanyInfo::getName);
Map<Long, String> positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, PositionInfo::getId, PositionInfo::getName);
return salarySobRanges.stream()
.map(salarySobRangePO -> {
@ -98,7 +101,7 @@ public class SalarySobRangeBO {
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
.orElse(StringUtils.EMPTY))
.targetId(salarySobRangePO.getTargetId())
.targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, positionComInfoMap))
.targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, subCompanyComInfoMap,positionComInfoMap))
.employeeStatus(Optional.ofNullable(salaryEmployeeStatusEnum)
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
.orElse(StringUtils.EMPTY))
@ -119,6 +122,7 @@ public class SalarySobRangeBO {
private static String buildTargetName(SalarySobRangePO salarySobRange,
Map<Long, String> employeeComInfoMap,
Map<Long, String> departmentComInfoMap,
Map<Long, String> subCompanyComInfoMap,
Map<Long, String> positionComInfoMap) {
TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRange.getTargetType());
if (Objects.isNull(targetTypeEnum)) {
@ -129,6 +133,8 @@ public class SalarySobRangeBO {
return employeeComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
case DEPT:
return departmentComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
case SUBCOMPANY:
return subCompanyComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
case POSITION:
return positionComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY);
default:

View File

@ -134,6 +134,12 @@
<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
@ -190,7 +196,12 @@
<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=")">
@ -246,7 +257,12 @@
<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=")">

View File

@ -153,6 +153,12 @@
<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
@ -211,7 +217,12 @@
<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=")">
@ -269,7 +280,12 @@
<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=")">

View File

@ -365,6 +365,12 @@
<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
@ -421,7 +427,12 @@
<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=")">
@ -477,7 +488,12 @@
<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=")">

View File

@ -420,6 +420,12 @@
#{targetId}
</foreach>
</if>
<if test="param.targetType == 'SUBCOMPANY'">
em.subcompanyid1 IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">
#{targetId}
</foreach>
</if>
<if test="param.targetType == 'POSITION'">
em.jobtitle IN
<foreach collection="param.targetIds" open="(" item="targetId" separator="," close=")">

View File

@ -284,7 +284,6 @@
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.operator},
#{item.createTime},
#{item.updateTime},
#{item.creator},

View File

@ -5,7 +5,6 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeQueryParam;
import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeSaveParam;
import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.util.page.PageInfo;
@ -95,7 +94,7 @@ public interface TaxAgentManageRangeService {
*
* @param saveParam
*/
void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam);
// void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam);
/**
* 根据主键id删除管理范围

View File

@ -61,10 +61,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
return MapperProxyFactory.getProxy(AddUpDeductionMapper.class);
}
private TaxAgentService getTaxAgentV2Service(User user) {
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
}
@ -89,17 +89,17 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
//文本输入框
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username");
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
username.setInputType("input");
username.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
username.setFieldcol(16); //条件输入框所占宽度默认值18
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,"departmentIds","4");
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentIds", "4");
departmentName.setInputType("browser");
departmentName.setColSpan(2);
departmentName.setFieldcol(16);
@ -110,7 +110,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
conditionItems.add(departmentName);
SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT,25034, "jobNum");
SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT, 25034, "jobNum");
jobNum.setInputType("input");
jobNum.setColSpan(2);
jobNum.setFieldcol(16);
@ -120,8 +120,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
conditionItems.add(jobNum);
SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT,25034, "idNo");
SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo");
idNo.setInputType("input");
idNo.setColSpan(2);
idNo.setFieldcol(16);
@ -132,8 +131,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
//日期范围选项
List<SearchConditionOption> dateOptions = new ArrayList<SearchConditionOption>();
dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()),true));//指定日期范围(必须为6)
SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate","hiredate"});
dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6)
SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"});
hiredate.setInputType("rangepicker");
hiredate.setFormat("yyyy-MM-dd");
hiredate.setFieldcol(16);
@ -144,7 +143,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
conditionItems.add(hiredate);
SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT,25034, "mobile");
SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile");
mobile.setInputType("input");
mobile.setColSpan(2);
mobile.setFieldcol(16);
@ -153,9 +152,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
mobile.setLabel("手机号");
conditionItems.add(mobile);
addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems));
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
apidatas.put("condition",addGroups);
apidatas.put("condition", addGroups);
return apidatas;
}
@ -163,6 +162,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
@Override
public Map<String, Object> importAddUpDeduction(AddUpDeductionImportParam importParam) {
long currentEmployeeId = user.getUID();
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
Map<String, Object> apidatas = new HashMap<String, Object>();
EmployBiz employBiz = new EmployBiz();
@ -177,7 +177,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
String imageId = Util.null2String(importParam.getImageId());
Validate.notBlank(imageId, "imageId为空");
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentV2Service(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
//个税扣缴义务人
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
// 获取租户下所有的人员
@ -289,13 +289,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
// 分权判断
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
if (openDevolution) {
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.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(addUpDeduction.getEmployeeId()) && f.getTaxAgentId().equals(addUpDeduction.getTaxAgentId())).findFirst();
@ -373,7 +376,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
@Override
public Map<String, Object> preview(AddUpDeductionImportParam importParam ) {
public Map<String, Object> preview(AddUpDeductionImportParam importParam) {
Map<String, Object> apidatas = new HashMap<String, Object>();
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
@ -404,51 +407,38 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
long employeeId = user.getUID();
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
return new PageInfo<>(list, AddUpDeductionDTO.class);
} else {
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 填充总数和当页数据
// 分页参数
PageInfo<AddUpDeductionDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionDTO.class);
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list));
return dtoPage;
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpDeductionDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
return new PageInfo<>(list, AddUpDeductionDTO.class);
}
@Override
public PageInfo<AddUpDeductionRecordDTO> recordListPage(AddUpDeductionQueryParam queryParam) {
long employeeId = (long) user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, AddUpDeductionRecordDTO.class);
} else {
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 分页参数
// 填充总数和当页数据
PageInfo<AddUpDeductionRecordDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionRecordDTO.class);
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list));
return dtoPage;
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if(needAuth){
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpDeductionRecordDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, AddUpDeductionRecordDTO.class);
}
@ -533,9 +523,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
// 开启分权并且不是薪酬模块总管理员
if (getTaxAgentV2Service(user).isOpenDevolution() && !isChief) {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (getTaxAgentService(user).isOpenDevolution() && !isChief) {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeduction> lastList = getLastListByModifier(employeeId, tenantKey);
list = list.stream().filter(f ->
// 作为管理员
@ -665,9 +655,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
List<AddUpDeductionDTO> list = new AddUpDeductionBiz().list(param);
// 开启分权并且不是薪酬模块总管理员
if (getTaxAgentV2Service(user).isOpenDevolution() && !isChief) {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (getTaxAgentService(user).isOpenDevolution() && !isChief) {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<AddUpDeductionPO> lastList = getLastListByModifier(employeeId);
list = list.stream().filter(f ->
// 作为管理员

View File

@ -169,49 +169,38 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
}
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentService(user).isOpenDevolution() || getTaxAgentService(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(queryParam);
return new PageInfo<>(list, AddUpSituationDTO.class);
} else {
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if(needAuth){
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 分页参数
PageInfo<AddUpSituationDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpSituationDTO.class);
// 填充总数和当页数据
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list));
return dtoPage;
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpSituationDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpSituationDTO> list = getAddUpSituationMapper().list(queryParam);
return new PageInfo<>(list, AddUpSituationDTO.class);
}
@Override
public PageInfo<AddUpSituationRecordDTO> recordListPage(AddUpSituationQueryParam queryParam) {
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentService(user).isOpenDevolution() || getTaxAgentService(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpSituationRecordDTO> list = getAddUpSituationMapper().recordList(queryParam);
return new PageInfo<>(list, AddUpSituationRecordDTO.class);
} else {
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if(needAuth){
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<AddUpSituationRecordDTO> list = getAddUpSituationMapper().recordList(queryParam);
// 分页参数
PageInfo<AddUpSituationRecordDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpSituationRecordDTO.class);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 填充总数和当页数据
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list));
return dtoPage;
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpSituationRecordDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AddUpSituationRecordDTO> list = getAddUpSituationMapper().recordList(queryParam);
return new PageInfo<>(list, AddUpSituationRecordDTO.class);
}
@Override
@ -541,6 +530,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>();
EmployBiz employBiz = new EmployBiz();
AddUpSituationBiz biz = new AddUpSituationBiz();
@ -665,13 +656,16 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
}
// 分权判断
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(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();

View File

@ -422,6 +422,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
log.error("获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage()));
return attendQuoteSyncData;
}
log.info("同步的考勤数据:{}", JSONUtils.toJSONString(attendQuoteSyncData));
return attendQuoteSyncData;
}

View File

@ -60,20 +60,26 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic
@Override
public PageInfo<AttendQuoteListDTO> listPage(AttendQuoteQueryParam queryParam) {
List<String> declareMonth = queryParam.getSalaryYearMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
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);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<AttendQuoteListDTO> list = getAttendQuoteMapper().list(queryParam);
return new PageInfo<>(list, AttendQuoteListDTO.class);
}

View File

@ -11,7 +11,6 @@ import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
@ -53,13 +52,15 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
private OtherDeductionMapper getOtherDeductionMapper() {
return MapperProxyFactory.getProxy(OtherDeductionMapper.class);
}
private TaxAgentService getTaxAgentV2Service(User user) {
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);
}
@ -79,54 +80,35 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
}
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(queryParam);
return new PageInfo<>(list, OtherDeductionListDTO.class);
} else {
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 分页参数
PageInfo<OtherDeductionListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), OtherDeductionListDTO.class);
// 填充总数和当页数据
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list));
return dtoPage;
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(OtherDeductionListDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(queryParam);
return new PageInfo<>(list, OtherDeductionListDTO.class);
}
@Override
public PageInfo<OtherDeductionRecordDTO> recordListPage(OtherDeductionQueryParam queryParam) {
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, OtherDeductionRecordDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<OtherDeductionPO> lastList = getLastListByModifier(employeeId, tenantKey);
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 分页参数
PageInfo<OtherDeductionRecordDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), OtherDeductionRecordDTO.class);
// 填充总数和当页数据
dtoPage.setTotal(list.size());
dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list));
return dtoPage;
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(OtherDeductionRecordDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, OtherDeductionRecordDTO.class);
}
@ -151,6 +133,9 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
public Map<String, Object> importData(OtherDeductionImportParam importParam) {
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
long currentEmployeeId = user.getUID();
Map<String, Object> apidatas = new HashMap<String, Object>();
EmployBiz employBiz = new EmployBiz();
@ -180,7 +165,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
//人员信息
List<DataCollectionEmployee> employees = employBiz.listEmployee();
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentV2Service(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
//税款所属期
Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01");
// 获取已经核算的数据
@ -304,13 +289,15 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
// 分权判断
OtherDeductionPO finalPoE = po;
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
if (openDevolution) {
OtherDeductionPO finalPoE = po;
Optional<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
// 判断是否有核算过
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
@ -378,7 +365,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
List<List<String>> rowList = getExcelRowList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除");
return ExcelUtil.genWorkbook(rowList, "其他免税扣除");
}
@ -394,8 +381,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(param);
// 开启分权并且不是薪酬模块总管理员
if (getTaxAgentV2Service(user).isOpenDevolution() && !getTaxAgentV2Service(user).isChief(employeeId)) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (getTaxAgentService(user).isOpenDevolution() && !getTaxAgentService(user).isChief(employeeId)) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
@ -429,7 +416,6 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
}
/**
* 导出详情列表
*
@ -469,7 +455,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
List<List<String>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细");
return ExcelUtil.genWorkbook(rowList, "其他免税扣除明细");
}

View File

@ -310,6 +310,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
@Override
public XSSFWorkbook downloadTemplate(SalaryArchiveImportTypeEnum salaryArchiveImportTypeEnum, SalaryArchiveQueryParam queryParam) {
long employeeId = user.getUID();
boolean isInit = salaryArchiveImportTypeEnum.getValue().equals(SalaryArchiveImportTypeEnum.INIT.getValue());
boolean isTaxAgentAdjust = salaryArchiveImportTypeEnum.getValue().equals(SalaryArchiveImportTypeEnum.TAXAGENTADJUST.getValue());
boolean isSalaryItemAdjust = salaryArchiveImportTypeEnum.getValue().equals(SalaryArchiveImportTypeEnum.SALARYITEMADJUST.getValue());
@ -347,34 +348,38 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
header.add(salaryItem.getName());
}
}
// 获取所有个税扣缴义务人
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
List<SalaryArchiveListDTO> salaryArchives = list(queryParam);
List<Map<String, Object>> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE);
// 组装数据
List<List<Object>> rows = new ArrayList<>();
rows.add(header);
listMaps.forEach(e -> {
List<Object> row = new ArrayList<>();
row.add(e.get("username").toString());
row.add(e.get("taxAgentName").toString());
if (isTaxAgentAdjust || isSalaryItemAdjust) {
row.add(isTaxAgentAdjust ? e.get("taxAgentEffectiveTime") : "");
}
row.add("");
row.add(e.get("departmentName").toString());
row.add(e.get("mobile") == null ? "" : e.get("mobile").toString());
row.add(e.get("employeeStatus").toString());
// 调薪
if (isInit || isSalaryItemAdjust) {
// 薪资项目数据
for (SalaryItemPO salaryItem : salaryItems) {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
//模板是否含数据
if (queryParam.getHasData() != null && queryParam.getHasData()) {
// 获取所有个税扣缴义务人
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
List<SalaryArchiveListDTO> salaryArchives = list(queryParam);
List<Map<String, Object>> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE);
listMaps.forEach(e -> {
List<Object> row = new ArrayList<>();
row.add(e.get("username").toString());
row.add(e.get("taxAgentName").toString());
if (isTaxAgentAdjust || isSalaryItemAdjust) {
row.add(isTaxAgentAdjust ? e.get("taxAgentEffectiveTime") : "");
}
}
rows.add(row);
});
row.add("");
row.add(e.get("departmentName").toString());
row.add(e.get("mobile") == null ? "" : e.get("mobile").toString());
row.add(e.get("employeeStatus").toString());
// 调薪
if (isInit || isSalaryItemAdjust) {
// 薪资项目数据
for (SalaryItemPO salaryItem : salaryItems) {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
}
}
rows.add(row);
});
}
// 3.表数据
// 4.注释
List<ExcelComment> excelComments = Lists.newArrayList();
@ -958,7 +963,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
errorMessageMap.put("message", rowindex + "个税扣缴义务人不存在");
excelComments.add(errorMessageMap);
isError = true;
}else if(!taxAgents.contains(taxAgentId)){
} else if (!taxAgents.contains(taxAgentId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + "没有该个税扣缴义务人的权限");
excelComments.add(errorMessageMap);

View File

@ -8,6 +8,7 @@ import com.engine.salary.biz.SalarySobRangeBiz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO;
import com.engine.salary.entity.salarysob.bo.SalarySobRangeSaveBO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
@ -89,6 +90,15 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
})
.collect(Collectors.toList());
// 查询分部信息
List<SubCompanyInfo> subCompanyInfos = salarySobRangePOS.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()))
.map(SalarySobRangePO::getTargetId)
.map(id -> {
return SubCompanyInfo.builder().id(id).name(orgBiz.getSubcompanyShow(String.valueOf(id), "0", "-")).build();
})
.collect(Collectors.toList());
// 查询岗位信息
List<Long> positionIds = salarySobRangePOS.stream()
@ -98,7 +108,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
List<PositionInfo> positionInfos = employBiz.listPositionInfo(positionIds);
// 薪资账套的人员范围po转换成列表dto
List<SalarySobRangeListDTO> salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos, positionInfos);
List<SalarySobRangeListDTO> salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos,subCompanyInfos, positionInfos);
// 根据对象名称过滤
if (StringUtils.isNotEmpty(queryParam.getTargetName())) {
salarySobRangeListDTOS = salarySobRangeListDTOS.stream()

View File

@ -5,6 +5,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO;
import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum;
import com.engine.salary.mapper.taxagent.TaxAgentEmpChangeMapper;
import com.engine.salary.service.TaxAgentEmpChangeService;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;
import javax.annotation.Resource;
@ -22,16 +23,19 @@ import java.util.List;
public class TaxAgentEmpChangeServiceImpl extends Service implements TaxAgentEmpChangeService {
@Resource
private TaxAgentEmpChangeMapper taxAgentEmpChangeMapper;
private TaxAgentEmpChangeMapper getTaxAgentEmpChangeMapper() {
return MapperProxyFactory.getProxy(TaxAgentEmpChangeMapper.class);
}
@Override
public List<TaxAgentEmpChangePO> listAll() {
return taxAgentEmpChangeMapper.listAll();
return getTaxAgentEmpChangeMapper().listAll();
}
@Override
public List<TaxAgentEmpChangePO> listAllByModule(TaxAgentEmpChangeModuleEnum moduleTypeEnum) {
return taxAgentEmpChangeMapper.listSome(TaxAgentEmpChangePO.builder().moduleType(moduleTypeEnum.getValue()).build());
return getTaxAgentEmpChangeMapper().listSome(TaxAgentEmpChangePO.builder().moduleType(moduleTypeEnum.getValue()).build());
}
@Override
@ -39,12 +43,12 @@ public class TaxAgentEmpChangeServiceImpl extends Service implements TaxAgentEmp
if (CollectionUtils.isEmpty(ids)) {
return Boolean.FALSE;
}
taxAgentEmpChangeMapper.deleteByIds(ids);
getTaxAgentEmpChangeMapper().deleteByIds(ids);
return Boolean.TRUE;
}
@Override
public void batchInsert(List<TaxAgentEmpChangePO> taxAgentEmpChangeList) {
taxAgentEmpChangeMapper.batchInsert(taxAgentEmpChangeList);
getTaxAgentEmpChangeMapper().batchInsert(taxAgentEmpChangeList);
}
}

View File

@ -14,7 +14,6 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO;
import com.engine.salary.entity.taxagent.param.*;
import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
@ -34,10 +33,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.transaction.annotation.Transactional;
import weaver.hrm.User;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
@ -51,6 +51,9 @@ import java.util.stream.Collectors;
@Slf4j
public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentManageRangeService {
private static final ExecutorService taskExecutor = Executors.newFixedThreadPool(5);
private TaxAgentManageRangeMapper getTaxAgentManageRangeMapper() {
return MapperProxyFactory.getProxy(TaxAgentManageRangeMapper.class);
}
@ -60,20 +63,13 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
}
private TaxAgentSubAdminService taxAgentSubAdminService;
// private TaxAgentSubAdminService getTaxAgentSubAdminService(User user) {
// return ServiceUtil.getService(TaxAgentSubAdminServiceImpl.class, user);
// }
private TaxAgentEmpService getTaxAgentEmpService(User user) {
return ServiceUtil.getService(TaxAgentEmpServiceImpl.class, user);
}
private TaxAgentSubAdminEmpService taxAgentSubAdminEmployeeService;
// private TaxAgentSubAdminEmpService getTaxAgentSubAdminEmpService(User user) {
// return ServiceUtil.getService(TaxAgentSubAdminEmpServiceImpl.class, user);
// }
// private ComInfoCache comInfoCache;
private EmployMapper getEmployMapper() {
return MapperProxyFactory.getProxy(EmployMapper.class);
@ -387,14 +383,15 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
}
private void syncLocalEmp(Long taxAgentId, List<DataCollectionEmployee> allSalaryEmployees, List<TaxAgentManageRangePO> allSubAdminRanges) {
new Thread() {
public void run() {
try {
syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID());
} finally {
}
}
}.start();
log.info("开始同步人员step1");
taskExecutor.execute(() -> {
syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID());
});
// new Thread() {
// public void run() {
// syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID());
// }
// }.start();
}
/**
@ -411,79 +408,78 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam) {
// 查询薪资账套
TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId());
if (Objects.isNull(taxAgentSubAdmin)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106687, "参数错误,分管理员不存在或者已被删除"));
}
// 查询已有的管理范围
List<TaxAgentManageRangePO> taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId());
List<TaxAgentManageRangePO> taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList());
// 处理一下本次的保存参数如果原来添加过对应的人员/部门/岗位那么本次不需要新增只需要更新
TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), (long) user.getUID());
// 当前库中所有分管理员的管理范围
List<TaxAgentManageRangePO> allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId());
/** 检查当前分管理员的范围与其他分管理员人员范围===========================start */
// 当前分管理员的范围
List<TaxAgentManageRangePO> allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges);
// 其他分管理员的范围
List<TaxAgentManageRangePO> otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList());
allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges());
allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges());
// 当前分管理员的所有人员
List<DataCollectionEmployee> currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent);
// 其他分管理员的所有人员
List<DataCollectionEmployee> otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist);
for (DataCollectionEmployee se : currentSubAdminSalaryEmployees) {
Optional<DataCollectionEmployee> optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst();
if (optionalSe.isPresent()) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员"));
}
}
/** 检查当前分管理员的范围与其他分管理员人员范围===========================end */
/** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================start */
// 所属个税扣缴义务人的所有分管理员的管理范围
List<TaxAgentManageRangePO> allSubAdminRanges = Lists.newArrayList(allSubAdminRangesExist);
allSubAdminRanges.addAll(result.getNeedInsertTaxAgentManageRanges());
allSubAdminRanges.addAll(result.getNeedUpdateTaxAgentManageRanges());
// 去重
allSubAdminRanges = allSubAdminRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType()))
), ArrayList::new));
// 所属个税扣缴义务人的所有人员
List<TaxAgentManageRangePO> allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId());
List<DataCollectionEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges);
// 所有分管理员的所有人员
List<DataCollectionEmployee> allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges);
List<Long> allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId()));
if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围"));
}
/** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */
// 保存
if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) {
result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range));
// todo this.saveBatch(result.getNeedInsertTaxAgentManageRanges());
}
if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) {
result.getNeedUpdateTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range));
// todo this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges());
}
/** 同步本地人员范围的关联人员=========================== */
List<TaxAgentManageRangePO> finalAllSubAdminRanges = allSubAdminRanges;
syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges);
// 记录日志 todo
}
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam) {
// // 查询薪资账套
// TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId());
// if (Objects.isNull(taxAgentSubAdmin)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106687, "参数错误,分管理员不存在或者已被删除"));
// }
// // 查询已有的管理范围
// List<TaxAgentManageRangePO> taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId());
// List<TaxAgentManageRangePO> taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList());
// // 处理一下本次的保存参数如果原来添加过对应的人员/部门/岗位那么本次不需要新增只需要更新
// TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), (long) user.getUID());
//
// // 当前库中所有分管理员的管理范围
// List<TaxAgentManageRangePO> allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId());
// /** 检查当前分管理员的范围与其他分管理员人员范围===========================start */
// // 当前分管理员的范围
// List<TaxAgentManageRangePO> allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges);
// // 其他分管理员的范围
// List<TaxAgentManageRangePO> otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList());
// allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges());
// allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges());
//
// // 当前分管理员的所有人员
// List<DataCollectionEmployee> currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent);
// // 其他分管理员的所有人员
// List<DataCollectionEmployee> otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist);
// for (DataCollectionEmployee se : currentSubAdminSalaryEmployees) {
// Optional<DataCollectionEmployee> optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst();
// if (optionalSe.isPresent()) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员"));
// }
// }
// /** 检查当前分管理员的范围与其他分管理员人员范围===========================end */
//
// /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================start */
// // 所属个税扣缴义务人的所有分管理员的管理范围
// List<TaxAgentManageRangePO> allSubAdminRanges = Lists.newArrayList(allSubAdminRangesExist);
// allSubAdminRanges.addAll(result.getNeedInsertTaxAgentManageRanges());
// allSubAdminRanges.addAll(result.getNeedUpdateTaxAgentManageRanges());
// // 去重
// allSubAdminRanges = allSubAdminRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
// Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType()))
// ), ArrayList::new));
// // 所属个税扣缴义务人的所有人员
// List<TaxAgentManageRangePO> allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId());
// List<DataCollectionEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges);
// // 所有分管理员的所有人员
// List<DataCollectionEmployee> allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges);
// List<Long> allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
// allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId()));
// if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围"));
// }
// /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */
//
// // 保存
// if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) {
// result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range));
//// todo this.saveBatch(result.getNeedInsertTaxAgentManageRanges());
// }
// if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) {
// result.getNeedUpdateTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range));
//// todo this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges());
// }
// /** 同步本地人员范围的关联人员=========================== */
// List<TaxAgentManageRangePO> finalAllSubAdminRanges = allSubAdminRanges;
//
// syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges);
// // 记录日志 todo
// }
/**
@ -649,12 +645,17 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
* @param employeeId
*/
private void syncLocalEmp(Long taxAgentId, List<DataCollectionEmployee> allSalaryEmployees, List<TaxAgentManageRangePO> allSubAdminRanges, Long employeeId) {
List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees));
// 同步个税扣缴义务人的人员
getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId);
log.info("同步个税扣缴人员范围");
try {
List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees));
// 同步个税扣缴义务人的人员
getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId);
// List<TaxAgentSubAdminEmpSaveParam> subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges);
// 同步分管理员的人员
// 同步分管理员的人员
// taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId);
} catch (Exception e) {
log.error("同步个税扣缴人员范围异常", e);
}
}
}

View File

@ -168,7 +168,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
@Override
public Boolean isDefaultOpen(Long currentEmployeeId) {
return true;
return getTaxAgentBaseService(user).isOpenDevolution();
// return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId);
}

View File

@ -14,7 +14,6 @@ import weaver.general.BaseBean;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
@ -26,55 +25,17 @@ public class ResponseResult<T, R> {
private static final long serialVersionUID = 1L;
private final User user;
private boolean permission = true;
private final HrmCommonService hrmCommonService = new HrmCommonServiceImpl();
private final BaseBean baseBean = new BaseBean();
private final Boolean isLog = "ture".equals(baseBean.getPropValue("hrmSalary", "log"));
private final String salaryAdminRoleId = baseBean.getPropValue("hrmSalary", "salaryAdminRoleId");
private final Boolean isPermission = "true".equals(baseBean.getPropValue("hrmSalary", "isPermission"));
public ResponseResult(User user) {
this.user = user;
}
public ResponseResult(User user, boolean permission) {
this.user = user;
this.permission = permission;
}
private void permission() {
if (isPermission && permission) {
if (user == null) {
throw new SalaryRunTimeException("获取登录人员信息失败");
}
List<Object> roleInfo = hrmCommonService.getRoleInfo(user.getUID());
roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && m.get("roleid").toString().equals(salaryAdminRoleId)).findFirst().orElseThrow(() -> new SalaryRunTimeException("无权限"));
}
}
/**
* 成功返回
*/
private static String Ok(Map<String, Object> map) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("status", true);
apidatas.put("data", map);
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
/**
* 失败返回
*/
private static String Error(String message) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("status", false);
apidatas.put("errormsg", message);
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
/**
* 统一返回方法
@ -84,7 +45,6 @@ public class ResponseResult<T, R> {
if (isLog) {
log.info("run salary api , param {}", t);
}
permission();
return Ok(f.apply(t));
} catch (SalaryRunTimeException e) {
return Error(e.getMessage());
@ -106,7 +66,6 @@ public class ResponseResult<T, R> {
if (isLog) {
log.info("run salary api , param {}", t);
}
permission();
f.accept(t);
return Ok();
} catch (SalaryRunTimeException e) {
@ -130,7 +89,6 @@ public class ResponseResult<T, R> {
if (isLog) {
log.info("run salary api");
}
permission();
return Ok(f.get());
} catch (SalaryRunTimeException e) {
return Error(e.getMessage());
@ -151,7 +109,11 @@ public class ResponseResult<T, R> {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("status", true);
apidatas.put("data", r);
return getJsonString(apidatas);
String success = getJsonString(apidatas);
if (isLog) {
log.info("run salary api success return {}", success);
}
return success;
}
private static String getJsonString(Object apidatas) {
@ -174,4 +136,16 @@ public class ResponseResult<T, R> {
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
/**
* 失败返回
*/
private static String Error(String message) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("status", false);
apidatas.put("errormsg", message);
return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect);
}
}

View File

@ -433,7 +433,7 @@ public class SalaryBillController {
// throw new SalaryRunTimeException(SalrayCheckSecondAuthConstant.CHECK_SECOND_FAIL_NO_TOKEN);
// }
// queryParam.setEmployeeId((long) user.getUID());
return new ResponseResult<SalaryBillQueryParam, Map<String, Object>>(user, false).run(getSalarySendWrapper(user)::mySalaryBillList, queryParam);
return new ResponseResult<SalaryBillQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::mySalaryBillList, queryParam);
}
/**
@ -450,7 +450,7 @@ public class SalaryBillController {
// throw new SalaryRunTimeException(SalrayCheckSecondAuthConstant.CHECK_SECOND_FAIL_NO_TOKEN);
// }
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Map<String, Object>>(user, false).run(getSalarySendWrapper(user)::mySalaryBill, salaryInfoId);
return new ResponseResult<Long, Map<String, Object>>(user).run(getSalarySendWrapper(user)::mySalaryBill, salaryInfoId);
}
/******** 工资单发放 end ***********************************************************************************************/

View File

@ -54,17 +54,14 @@ public class AttendQuoteWrapper extends Service {
* @return
*/
public PageInfo<AttendQuoteListDTO> list(AttendQuoteQueryParam queryParam) {
List<String> declareMonth = queryParam.getSalaryYearMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
PageInfo<AttendQuoteListDTO> page = getAttendQuoteService(user).listPage(queryParam);
List<AttendQuoteListDTO> list = page.getList();
list.forEach(m -> m.setSourceType(AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(m.getSourceType()))));
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(m -> m.setSourceType(AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(m.getSourceType()))));
page.setList(list);
}
page.setList(list);
return page;
}
@ -102,7 +99,6 @@ public class AttendQuoteWrapper extends Service {
/**
* 检查是否可以操作
*
*
* @return
*/
public Boolean checkOperation(AttendQuoteCheckOperationParam checkOperationParam) {

View File

@ -87,21 +87,27 @@ public class SalarySendWrapper extends Service {
//分权获取当前人员管理的账套
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
if(needAuth){
List<SalarySendListDTO> list = new ArrayList<>();
if (needAuth) {
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
queryParam.setSalarySobIds(salarySobIds);
if (CollectionUtils.isNotEmpty(salarySobIds)) {
queryParam.setSalarySobIds(salarySobIds);
SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
list = salarySendMapper.list(queryParam);
}
} else {
SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
list = salarySendMapper.list(queryParam);
}
SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<SalarySendListDTO> list = salarySendMapper.list(queryParam);
PageInfo<SalarySendListDTO> pageInfo = new PageInfo<>(list, SalarySendListDTO.class);
List<SalarySendListDTO> pageList = pageInfo.getList();
List<Long> salarySobIds = pageList.stream().map(SalarySendListDTO::getSalarySobId).distinct().collect(Collectors.toList());
// 获取默认模板
if(salarySobIds.size() > 0) {
if (salarySobIds.size() > 0) {
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(salarySobIds);
pageList.forEach(e -> {
// 已发放
@ -134,9 +140,9 @@ public class SalarySendWrapper extends Service {
datas.put("pageInfo", pageInfo);
datas.put("datas", pageList);
datas.put("columns", columns);
datas.put("dataKey",result.getResultMap());
datas.put("dataKey", result.getResultMap());
return datas;
}catch(Exception e) {
} catch (Exception e) {
throw new SalaryRunTimeException(e.getMessage());
} finally {
sqlSession.close();
@ -145,17 +151,18 @@ public class SalarySendWrapper extends Service {
/**
* 创建表展示字段
*
* @return
*/
private List<WeaTableColumn> buildWeaTableColumns() {
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id");
idColumn.setDisplay(WeaBoolAttr.FALSE);
list.add(new WeaTableColumn("10%","薪资所属月", "salaryYearMonth"));
list.add(new WeaTableColumn("35%","薪资账套", "salarySob"));
list.add(new WeaTableColumn("25%","工资单模板", "template"));
list.add(new WeaTableColumn("15%","已发放", "sendSituation"));
list.add(new WeaTableColumn("15%","最后发送时间", "lastSendTime"));
list.add(new WeaTableColumn("10%", "薪资所属月", "salaryYearMonth"));
list.add(new WeaTableColumn("35%", "薪资账套", "salarySob"));
list.add(new WeaTableColumn("25%", "工资单模板", "template"));
list.add(new WeaTableColumn("15%", "已发放", "sendSituation"));
list.add(new WeaTableColumn("15%", "最后发送时间", "lastSendTime"));
return list;
}
@ -183,9 +190,9 @@ public class SalarySendWrapper extends Service {
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
//文本输入框
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username");
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
username.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
username.setFieldcol(16); //条件输入框所占宽度默认值18
username.setFieldcol(16); //条件输入框所占宽度默认值18
username.setLabelcol(8);
username.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
@ -193,9 +200,9 @@ public class SalarySendWrapper extends Service {
conditionItems.add(username);
// 个税扣缴义务人
SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent");
SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent");
taxAgent.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
taxAgent.setFieldcol(16); //条件输入框所占宽度默认值18
taxAgent.setFieldcol(16); //条件输入框所占宽度默认值18
taxAgent.setLabelcol(8);
List<SearchConditionOption> searchConditionOptions = new ArrayList<>();
Collection<TaxAgentListDTO> taxAgentLists = getTaxAgentService(user).findAll();
@ -207,7 +214,7 @@ public class SalarySendWrapper extends Service {
conditionItems.add(taxAgent);
// 部门
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"department","4");
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "department", "4");
departmentName.setColSpan(2);
departmentName.setFieldcol(16);
departmentName.setLabelcol(8);
@ -218,7 +225,7 @@ public class SalarySendWrapper extends Service {
conditionItems.add(departmentName);
// 岗位
SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER,502227,"position","24");
SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "position", "24");
position.setColSpan(2);
position.setFieldcol(16);
position.setLabelcol(8);
@ -229,9 +236,9 @@ public class SalarySendWrapper extends Service {
conditionItems.add(position);
//状态
SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent");
SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent");
status.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
status.setFieldcol(16); //条件输入框所占宽度默认值18
status.setFieldcol(16); //条件输入框所占宽度默认值18
status.setLabelcol(8);
List<SearchConditionOption> userStatusOptions = new ArrayList<>();
UserStatusEnum.getList().forEach(e -> userStatusOptions.add(new SearchConditionOption(e.get("id"), e.get("content"))));
@ -244,11 +251,11 @@ public class SalarySendWrapper extends Service {
//入职日期
SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate");
hiredate.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
hiredate.setFieldcol(16); //条件输入框所占宽度默认值18
hiredate.setFieldcol(16); //条件输入框所占宽度默认值18
hiredate.setLabelcol(8);
hiredate.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
Map<String, Object> otherParams1 = new HashMap<String, Object>();
otherParams1.put("format","yyyy-MM-dd");
otherParams1.put("format", "yyyy-MM-dd");
hiredate.setOtherParams(otherParams1);
hiredate.setInputType("day");
hiredate.setMode("day");
@ -258,7 +265,7 @@ public class SalarySendWrapper extends Service {
//发送状态
SearchConditionItem sendStatus = conditionFactory.createCondition(ConditionType.SELECT, 25034, "sendStatus");
sendStatus.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
sendStatus.setFieldcol(16); //条件输入框所占宽度默认值18
sendStatus.setFieldcol(16); //条件输入框所占宽度默认值18
sendStatus.setLabelcol(8);
List<SearchConditionOption> sendStatusOptions = new ArrayList<>();
UserStatusEnum.getList().forEach(e -> sendStatusOptions.add(new SearchConditionOption(e.get("id"), e.get("content"))));
@ -268,9 +275,9 @@ public class SalarySendWrapper extends Service {
sendStatus.setLabel("发送状态"); //设置文本值 这个将覆盖多语言标签的值
conditionItems.add(sendStatus);
addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems));
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
apidatas.put("condition",addGroups);
apidatas.put("condition", addGroups);
return apidatas;
}
@ -316,28 +323,29 @@ public class SalarySendWrapper extends Service {
result.success();
datas.put("pageInfo", pageInfo);
datas.put("datas",list);
datas.put("columns",columns);
datas.put("dataKey",result.getResultMap());
datas.put("datas", list);
datas.put("columns", columns);
datas.put("dataKey", result.getResultMap());
return datas;
}
/**
* 工资单信息列表
*
* @return
*/
private List<WeaTableColumn> buildInfoListWeaTableColumns() {
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id");
idColumn.setDisplay(WeaBoolAttr.TRUE);
list.add(new WeaTableColumn("20%","姓名", "username"));
list.add(new WeaTableColumn("20%","个税扣缴义务人", "taxAgent"));
list.add(new WeaTableColumn("20%","部门", "department"));
list.add(new WeaTableColumn("20%","手机号", "mobile"));
list.add(new WeaTableColumn("20%","工号", "jobNum"));
list.add(new WeaTableColumn("20%","发送状态", "sendStatus"));
list.add(new WeaTableColumn("20%","操作", "operation"));
list.add(new WeaTableColumn("20%", "姓名", "username"));
list.add(new WeaTableColumn("20%", "个税扣缴义务人", "taxAgent"));
list.add(new WeaTableColumn("20%", "部门", "department"));
list.add(new WeaTableColumn("20%", "手机号", "mobile"));
list.add(new WeaTableColumn("20%", "工号", "jobNum"));
list.add(new WeaTableColumn("20%", "发送状态", "sendStatus"));
list.add(new WeaTableColumn("20%", "操作", "operation"));
return list;
}
@ -386,9 +394,9 @@ public class SalarySendWrapper extends Service {
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
//文本输入框
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username");
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
username.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
username.setFieldcol(16); //条件输入框所占宽度默认值18
username.setFieldcol(16); //条件输入框所占宽度默认值18
username.setLabelcol(8);
username.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
@ -396,9 +404,9 @@ public class SalarySendWrapper extends Service {
conditionItems.add(username);
// 个税扣缴义务人
SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent");
SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent");
taxAgent.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
taxAgent.setFieldcol(16); //条件输入框所占宽度默认值18
taxAgent.setFieldcol(16); //条件输入框所占宽度默认值18
taxAgent.setLabelcol(8);
List<SearchConditionOption> searchConditionOptions = new ArrayList<>();
Collection<TaxAgentListDTO> taxAgentLists = getTaxAgentService(user).findAll();
@ -410,7 +418,7 @@ public class SalarySendWrapper extends Service {
conditionItems.add(taxAgent);
// 部门
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"department","4");
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "department", "4");
departmentName.setColSpan(2);
departmentName.setFieldcol(16);
departmentName.setLabelcol(8);
@ -421,7 +429,7 @@ public class SalarySendWrapper extends Service {
conditionItems.add(departmentName);
// 岗位
SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER,502227,"position","24");
SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "position", "24");
position.setColSpan(2);
position.setFieldcol(16);
position.setInputType("");
@ -432,9 +440,9 @@ public class SalarySendWrapper extends Service {
conditionItems.add(position);
//状态
SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent");
SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent");
status.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
status.setFieldcol(16); //条件输入框所占宽度默认值18
status.setFieldcol(16); //条件输入框所占宽度默认值18
status.setLabelcol(8);
List<SearchConditionOption> userStatusOptions = new ArrayList<>();
UserStatusEnum.getList().forEach(e -> userStatusOptions.add(new SearchConditionOption(e.get("id"), e.get("content"))));
@ -447,11 +455,11 @@ public class SalarySendWrapper extends Service {
//入职日期
SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate");
hiredate.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
hiredate.setFieldcol(16); //条件输入框所占宽度默认值18
hiredate.setFieldcol(16); //条件输入框所占宽度默认值18
hiredate.setLabelcol(8);
hiredate.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
Map<String, Object> otherParams1 = new HashMap<String, Object>();
otherParams1.put("format","yyyy-MM-dd");
otherParams1.put("format", "yyyy-MM-dd");
hiredate.setOtherParams(otherParams1);
hiredate.setInputType("day");
hiredate.setMode("day");
@ -461,16 +469,16 @@ public class SalarySendWrapper extends Service {
//合并计税
SearchConditionItem mergeCountTax = conditionFactory.createCondition(ConditionType.CHECKBOX, 25034, "mergeCountTax");
mergeCountTax.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
mergeCountTax.setFieldcol(16); //条件输入框所占宽度默认值18
mergeCountTax.setFieldcol(16); //条件输入框所占宽度默认值18
mergeCountTax.setLabelcol(8);
mergeCountTax.setInputType("switch");
mergeCountTax.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
mergeCountTax.setLabel("合并计税"); //设置文本值 这个将覆盖多语言标签的值
conditionItems.add(mergeCountTax);
addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems));
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
apidatas.put("condition",addGroups);
apidatas.put("condition", addGroups);
return apidatas;
}
@ -534,8 +542,8 @@ public class SalarySendWrapper extends Service {
datas.put("pageInfo", pageInfo);
datas.put("datas", listMaps);
datas.put("columns",columns);
datas.put("dataKey",result.getResultMap());
datas.put("columns", columns);
datas.put("dataKey", result.getResultMap());
return datas;
}
@ -544,11 +552,11 @@ public class SalarySendWrapper extends Service {
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id");
idColumn.setDisplay(WeaBoolAttr.TRUE);
list.add(new WeaTableColumn("100px","姓名", "username"));
list.add(new WeaTableColumn("100px","个税扣缴义务人", "taxAgent"));
list.add(new WeaTableColumn("100px","部门", "department"));
list.add(new WeaTableColumn("100px","手机号", "mobile"));
list.add(new WeaTableColumn("100px","工号", "jobNum"));
list.add(new WeaTableColumn("100px", "姓名", "username"));
list.add(new WeaTableColumn("100px", "个税扣缴义务人", "taxAgent"));
list.add(new WeaTableColumn("100px", "部门", "department"));
list.add(new WeaTableColumn("100px", "手机号", "mobile"));
list.add(new WeaTableColumn("100px", "工号", "jobNum"));
return list;
}
@ -578,7 +586,7 @@ public class SalarySendWrapper extends Service {
*/
public Map<String, Object> mySalaryBillList(SalaryBillQueryParam queryParam) {
Map<String, Object> datas = new HashMap<>();
queryParam.setEmployeeId((long)user.getUID());
queryParam.setEmployeeId((long) user.getUID());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
queryParam.setSalaryMonth(
queryParam.getSalaryYearMonth().stream().map(e -> {
@ -613,8 +621,8 @@ public class SalarySendWrapper extends Service {
datas.put("pageInfo", pageInfo);
datas.put("datas", records);
datas.put("columns",columns);
datas.put("dataKey",result.getResultMap());
datas.put("columns", columns);
datas.put("dataKey", result.getResultMap());
return datas;
}
@ -623,14 +631,13 @@ public class SalarySendWrapper extends Service {
List<WeaTableColumn> list = new ArrayList<>();
WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id");
idColumn.setDisplay(WeaBoolAttr.TRUE);
list.add(new WeaTableColumn("20%","薪资所属月", "salaryYearMonth"));
list.add(new WeaTableColumn("40%","个税扣缴义务人", "taxAgent"));
list.add(new WeaTableColumn("40%","发放时间", "sendTime"));
list.add(new WeaTableColumn("20%", "薪资所属月", "salaryYearMonth"));
list.add(new WeaTableColumn("40%", "个税扣缴义务人", "taxAgent"));
list.add(new WeaTableColumn("40%", "发放时间", "sendTime"));
return list;
}
/**
* 我的工资单
*

View File

@ -153,10 +153,10 @@ public class TaxAgentSubAdminWrapper extends Service {
* @param saveParam
* @return
*/
public String saveRange(TaxAgentSubAdminRangeSaveParam saveParam) {
taxAgentManageRangeService.save4SubAdmin(saveParam);
return StringUtils.EMPTY;
}
// public String saveRange(TaxAgentSubAdminRangeSaveParam saveParam) {
// taxAgentManageRangeService.save4SubAdmin(saveParam);
// return StringUtils.EMPTY;
// }
/**
* 删除管理范围

View File

@ -89,9 +89,11 @@ public class TaxAgentWrapper extends Service {
Boolean isChief = isChief(currentEmployeeId);
Boolean isDefaultOpen = getTaxAgentService(user).isDefaultOpen(currentEmployeeId);
Boolean isAdminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId);
Boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
resultMap.put("isChief", isChief);
resultMap.put("isDefaultOpen", isDefaultOpen);
resultMap.put("isAdminEnable", isAdminEnable);
resultMap.put("isOpenDevolution", isOpenDevolution);
return resultMap;
}