This commit is contained in:
钱涛 2022-06-22 19:26:05 +08:00
parent 15fbf8ac91
commit e1a075cab3
7 changed files with 54 additions and 107 deletions

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryBill.dto;
import com.engine.salary.annotation.TableTitle;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
@ -18,64 +19,33 @@ import lombok.NoArgsConstructor;
//@TableOperates(tableType = WeaTableTypeEnum.CHECKBOX)
public class SalarySendInfoListDTO {
// @ApiModelProperty("主键id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private Long employeeId;
// @ApiModelProperty("姓名")
// @WeaFormat(
// label = "姓名",
// labelId = 85429,
// tableColumn = @TableColumn(width = "20%")
// )
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
private String username;
// @ApiModelProperty("个税扣缴义务人")
// @WeaFormat(
// label = "个税扣缴义务人",
// labelId = 86184,
// tableColumn = @TableColumn(width = "20%")
// )
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgent", key = "taxAgent")
private String taxAgent;
// @ApiModelProperty("部门")
// @WeaFormat(
// label = "部门",
// labelId = 86185,
// tableColumn = @TableColumn(width = "20%")
// )
@TableTitle(title = "部门", dataIndex = "department", key = "department")
private String department;
// @ApiModelProperty("手机号")
// @WeaFormat(
// label = "手机号",
// labelId = 86186,
// tableColumn = @TableColumn(width = "20%")
// )
@TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile")
private String mobile;
// @ApiModelProperty("工号")
// @WeaFormat(
// label = "工号",
// labelId = 86317,
// tableColumn = @TableColumn(width = "20%")
// )
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
private String jobNum;
// @ApiModelProperty("发送状态")
// @WeaFormat(
// label = "发送状态",
// labelId = 93242,
// tableColumn = @TableColumn(width = "20%")
// )
@TableTitle(title = "发送状态", dataIndex = "sendStatus", key = "sendStatus")
private String sendStatus;
// @WeaFormat(
// label = "操作",
// labelId = 94303,
// tableColumn = @TableColumn(width = "20%")
// )
private String operation;
}

View File

@ -35,7 +35,6 @@ public interface SalarySendService {
/**
* 薪资核算-归档撤销工资单
* @param salaryAccountingId
* @param currentTenantKey
* @return
*/
void revokeSalaryBill(Long salaryAccountingId);

View File

@ -11,7 +11,6 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.exception.SalaryRunTimeException;
@ -453,8 +452,9 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
}
// 查询薪资所属月所在年的所有薪资核算记录
List<SalaryAcctRecordPO> salaryAcctRecordPOS = listBySalaryMonth(yearRange);
List<SalaryAcctRecordPO> selfSalaryAcctRecordPOS = filterByAuthority(salaryAcctRecordPOS);
// 如果已经存在之后月份的薪资核算记录了就不允许重新核算本月了
SalaryAcctRecordPO afterSalaryAcctRecordPO = salaryAcctRecordPOS.stream()
SalaryAcctRecordPO afterSalaryAcctRecordPO = selfSalaryAcctRecordPOS.stream()
.filter(po -> po.getSalaryMonth().compareTo(salaryAcctRecordPO.getSalaryMonth()) > 0)
.findAny()
.orElse(null);
@ -463,14 +463,14 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
.replace("{0}", SalaryDateUtil.localDate2YearMonth(afterSalaryAcctRecordPO.getSalaryMonth()).toString())
.replace("{1}", SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()).toString()));
}
// 更新薪资核算记录的状态
salaryAcctRecordPO.setStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue());
salaryAcctRecordPO.setUpdateTime(new Date());
getSalaryAcctRecordMapper().updateIgnoreNull(salaryAcctRecordPO);
//撤回工资单
getSalarySendService(user).revokeSalaryBill(salaryAcctRecordId);
//删除个税申报表(个税申报表个税申报表详情往期累计情况)
getTaxDeclarationService(user).deleteBySalaryMonth(salaryAcctRecordPO);
// 更新薪资核算记录的状态
salaryAcctRecordPO.setStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue());
salaryAcctRecordPO.setUpdateTime(new Date());
getSalaryAcctRecordMapper().updateIgnoreNull(salaryAcctRecordPO);
// 记录日志
// String targetName = getLogTargetNameById(salaryAcctRecordPO.getId(), tenantKey);
// LoggerContext<SalaryAcctRecordPO> loggerContext = new LoggerContext<>();
@ -534,28 +534,20 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
* 开启分权后需要判断是否能查看对应的薪资核算记录
*
* @param salaryAcctRecords
* @param employeeId
* @return
*/
private List<SalaryAcctRecordPO> filterByAuthority(List<SalaryAcctRecordPO> salaryAcctRecords, Long employeeId) {
private List<SalaryAcctRecordPO> filterByAuthority(List<SalaryAcctRecordPO> salaryAcctRecords) {
if (CollectionUtils.isEmpty(salaryAcctRecords)) {
return salaryAcctRecords;
}
// 薪资核算记录id
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecords, SalaryAcctRecordPO::getId);
// 查询薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(salaryAcctRecordIds);
// 查询当前人员可以查看的人员范围
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
Set<String> simpleEmployeeKeySet = SalaryEntityUtil.properties(taxAgentEmployees, taxAgentEmployeeDTO -> taxAgentEmployeeDTO.getEmployeeId() + "-" + taxAgentEmployeeDTO.getTaxAgentId());
Set<Long> canViewSalaryAcctRecordIds = salaryAcctEmployees.stream()
.filter(salaryAcctEmployeePO -> {
return simpleEmployeeKeySet.contains(salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
})
.map(SalaryAcctEmployeePO::getSalaryAcctRecordId)
.collect(Collectors.toSet());
return salaryAcctRecords.stream()
.filter(salaryAcctRecordPO -> canViewSalaryAcctRecordIds.contains(salaryAcctRecordPO.getId()))
.collect(Collectors.toList());
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
//开启分权
if(openDevolution){
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByAdmin();
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
return salaryAcctRecords.stream().filter(record -> salarySobIds.contains(record.getSalarySobId())).collect(Collectors.toList());
}
return salaryAcctRecords;
}
}

View File

@ -12,7 +12,6 @@ import com.engine.salary.biz.SalarySendBiz;
import com.engine.salary.biz.SalarySendInfoBiz;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.constant.SalaryTemplateSalaryItemSetGroupConstant;
import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.encrypt.salaryacct.SalaryAcctResultPOEncrypt;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryBill.dto.*;
@ -42,6 +41,7 @@ import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
@ -247,7 +247,8 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
SalarySendPO build = SalarySendPO.builder().salaryAccountingId(salaryAccountingId).deleteType(0).build();
List<SalarySendPO> salarySends = getSalarySendMapper().listSome(build);
if (CollectionUtils.isEmpty(salarySends)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100505, "工资单不存在"));
return;
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100505, "工资单不存在"));
}
SalarySendPO salarySend = salarySends.get(0);
@ -403,6 +404,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
@Override
public PageInfo<SalarySendInfoListDTO> salarySendInfoListPage(SalarySendInfoQueryParam queryParam) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<SalarySendInfoListDTO> page = salarySendInfoMapper.list(queryParam);
PageInfo<SalarySendInfoListDTO> result = new PageInfo<>(page, SalarySendInfoListDTO.class);
return result;
@ -417,6 +419,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
@Override
public PageInfo<SalarySendDetailListDTO> salarySendInfoDetailListPage(SalarySendDetailQueryParam queryParam) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<SalarySendDetailListDTO> list = salarySendInfoMapper.detailList(queryParam);
PageInfo<SalarySendDetailListDTO> pageInfo = new PageInfo<>(list, SalarySendDetailListDTO.class);
return pageInfo;

View File

@ -13,6 +13,7 @@ import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
@ -32,6 +33,7 @@ import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.mapper.salarysob.SalarySobMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryI18nUtil;
@ -113,6 +115,9 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
private AddUpSituationMapper getAddUpSituationMapper() {
return MapperProxyFactory.getProxy(AddUpSituationMapper.class);
}
private SalarySobMapper getSalarySobMapper() {
return MapperProxyFactory.getProxy(SalarySobMapper.class);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
@ -513,6 +518,12 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
return Boolean.TRUE;
}
//账套
List<SalarySobPO> salarySobPOS = getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentIds(ids).build());
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}

View File

@ -1,14 +1,12 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryBill.dto.SalarySendBaseInfoDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateBaseFormDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateShowFormDTO;
import com.engine.salary.entity.salaryBill.dto.*;
import com.engine.salary.entity.salaryBill.param.*;
import com.engine.salary.enums.salarybill.SalarySendStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalarySendWrapper;
import com.engine.salary.wrapper.SalaryTemplateWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -254,7 +252,7 @@ public class SalaryBillController {
@Produces(MediaType.APPLICATION_JSON)
public String infoList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySendInfoQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
}
/**
@ -300,7 +298,7 @@ public class SalaryBillController {
// 包含未发送已撤回
queryParam.setSendStatuss(Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue()));
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
// WeaTable<SalarySendInfoListDTO> weaTable = salarySendWrapper.infoList(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// weaTable.setOperatesPermission(new LinkedList<>());
@ -322,7 +320,7 @@ public class SalaryBillController {
queryParam.setSendStatuss(Arrays.asList(SalarySendStatusEnum.ALREADYSEND.getValue()));
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySendInfoQueryParam, Map<String, Object>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
return new ResponseResult<SalarySendInfoQueryParam, PageInfo<SalarySendInfoListDTO>>(user).run(getSalarySendWrapper(user)::infoList, queryParam);
}
/**

View File

@ -287,47 +287,24 @@ public class SalarySendWrapper extends Service {
* @param queryParam
* @return
*/
public Map<String, Object> infoList(SalarySendInfoQueryParam queryParam) {
public PageInfo<SalarySendInfoListDTO> infoList(SalarySendInfoQueryParam queryParam) {
Map<String, Object> datas = new HashMap<>(16);
SalarySendInfoQueryParam.checkParam(queryParam);
// 发送状态
if (queryParam.getSendStatus() != null) {
queryParam.setSendStatusVal(queryParam.getSendStatus().getValue());
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
PageInfo<SalarySendInfoListDTO> pageInfo = getSalarySendService(user).salarySendInfoListPage(queryParam);
List<SalarySendInfoListDTO> list = pageInfo.getList();
list.forEach(e -> {
// 发放状态
int sendStatus = Integer.parseInt(e.getSendStatus());
e.setSendStatus(SalarySendStatusEnum.getDefaultLabelByValue(sendStatus));
e.setOperation(SalarySendStatusEnum.getNameByValue(sendStatus));
// e.setOperation(SalarySendStatusEnum.getNameByValue(sendStatus));
});
List<WeaTableColumn> columns = buildInfoListWeaTableColumns();
WeaTable table = new WeaTable();
table.setColumns(columns);
//设置check是否可用
List<WeaTableCheckboxpopedom> checkboxpopedomList = new ArrayList<>();
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
checkboxpopedom.setPopedompara("column:system_type");
checkboxpopedom.setShowmethod("com.engine.salary.transmethod.TaxRateTransMethod.getCheckBoxPopedom");
checkboxpopedomList.add(checkboxpopedom);
table.setCheckboxList(checkboxpopedomList);
table.setCheckboxpopedom(null);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
datas.put("pageInfo", pageInfo);
datas.put("datas", list);
datas.put("columns", columns);
datas.put("dataKey", result.getResultMap());
return datas;
return pageInfo;
}
/**
@ -501,7 +478,6 @@ public class SalarySendWrapper extends Service {
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Collections.singletonList(salarySend.getSalarySobId()));
List<SalaryTemplateSalaryItemListDTO> salaryItems = getSalarySendService(user).getSalaryItemsSetting(CollectionUtils.isNotEmpty(salaryTemplates) ? salaryTemplates.get(0) : null);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
// 2.获取基本数据
PageInfo<SalarySendDetailListDTO> pageInfo = getSalarySendService(user).salarySendInfoDetailListPage(queryParam);
@ -514,8 +490,6 @@ public class SalarySendWrapper extends Service {
// 是否合并计税
// TODO: 1/25/22 判断是否合并计税
// Page<Map<String, Object>> listPage = new Page<>(page.getCurrent(), page.getPageSize(), page.getTotal(), page.isSearchCount());
// listPage.setRecords(listMaps);
List<WeaTableColumn> columns = buildDetailListWeaTableColumns();