From 1e307e2f87d95c16a9ef2d4177ab683d15eb9430 Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Wed, 16 Nov 2022 15:18:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E8=B5=84=E5=9B=9E=E7=AE=97=EF=BC=8C?= =?UTF-8?q?=E8=96=AA=E8=B5=84=E8=B4=A6=E5=A5=97=E4=B8=AD=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E5=9B=9E=E7=AE=97=E9=A1=B9=E7=9B=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/SalarySobBackItemFormDTO.java | 52 +++++++++++++++++++ .../param/SalarySobBackItemSaveParam.java | 42 +++++++++++++++ .../service/SalarySobBackItemService.java | 8 +++ .../impl/SalarySobBackItemServiceImpl.java | 5 ++ .../salary/web/SalarySobController.java | 25 +++++---- .../wrapper/SalarySobBackItemWrapper.java | 33 ++++++++++++ 6 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 src/com/engine/salary/entity/salarysob/dto/SalarySobBackItemFormDTO.java create mode 100644 src/com/engine/salary/entity/salarysob/param/SalarySobBackItemSaveParam.java diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobBackItemFormDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobBackItemFormDTO.java new file mode 100644 index 000000000..8804ba72e --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobBackItemFormDTO.java @@ -0,0 +1,52 @@ +package com.engine.salary.entity.salarysob.dto; + +import com.engine.salary.enums.SalaryRoundingModeEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.Map; + +/** + * @author Harryxzy + * @date 2022/11/16 14:42 + * @description 薪资账套下的回算薪资项目详情 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SalarySobBackItemFormDTO { + + // 主键id + private Long id; + + // 薪资项目 + private List> salaryItem; + + // 字段类型 + private SalaryDataTypeEnum dataType; + + // 舍入规则 + private SalaryRoundingModeEnum roundingMode; + + // 保留小数位 + private String pattern; + + // 取值方式 + private SalaryValueTypeEnum valueType; + + // 公式id + private Long formulaId; + + // 公式内容 + private String formulaContent; + + // 个税申报表对应字段 + private String taxDeclarationColumn; + +} diff --git a/src/com/engine/salary/entity/salarysob/param/SalarySobBackItemSaveParam.java b/src/com/engine/salary/entity/salarysob/param/SalarySobBackItemSaveParam.java new file mode 100644 index 000000000..8feb93ad6 --- /dev/null +++ b/src/com/engine/salary/entity/salarysob/param/SalarySobBackItemSaveParam.java @@ -0,0 +1,42 @@ +package com.engine.salary.entity.salarysob.param; + +/** + * @author Harryxzy + * @date 2022/11/16 15:14 + * @description 薪资项目回算项目保存参数 + */ +public class SalarySobBackItemSaveParam { +// @ApiModelProperty("主键id") +// @NotNull(message = "主键id不允许为空") +// @JsonSerialize(using = ToStringSerializer.class) +// private Long id; +// +// @NotNull(message = "薪资账套id不允许为空") +// @ApiModelProperty("薪资账套id") +// private Long salarySobId; +// +// @NotNull(message = "薪资项目id不允许为空") +// @ApiModelProperty("薪资项目") +// private Long salaryItemId; +// +// @ApiModelProperty("字段类型") +// @NotNull(message = "LABEL:105096") +// private SalaryDataTypeEnum dataType; +// +// @ApiModelProperty("舍入规则") +// private SalaryRoundingModeEnum roundingMode; +// +// @ApiModelProperty("保留小数位") +// @Max(value = 5, message = "LABEL:85611") +// private Integer pattern; +// +// @ApiModelProperty("取值方式") +// @NotNull(message = "LABEL:85612") +// private SalaryValueTypeEnum valueType; +// +// @ApiModelProperty("公式") +// private Long formulaId; +// +// @ApiModelProperty("备注") +// private String description; +} diff --git a/src/com/engine/salary/service/SalarySobBackItemService.java b/src/com/engine/salary/service/SalarySobBackItemService.java index f500f679e..a681047b5 100644 --- a/src/com/engine/salary/service/SalarySobBackItemService.java +++ b/src/com/engine/salary/service/SalarySobBackItemService.java @@ -20,4 +20,12 @@ public interface SalarySobBackItemService { List listBySalarySobId(Long salarySobId); void batchInsert(List needInsertSalarySobBackItems); + + /** + * @description 获取薪资回算项目 + * @return SalarySobBackItemPO + * @author Harryxzy + * @date 2022/11/16 14:36 + */ + SalarySobBackItemPO getById(Long salarySobBackItemId); } diff --git a/src/com/engine/salary/service/impl/SalarySobBackItemServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobBackItemServiceImpl.java index dde38d2d9..b4a33b27a 100644 --- a/src/com/engine/salary/service/impl/SalarySobBackItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobBackItemServiceImpl.java @@ -29,4 +29,9 @@ public class SalarySobBackItemServiceImpl extends Service implements SalarySobBa getSalarySobBackItemMapper().batchInsert(needInsertSalarySobBackItems); } + @Override + public SalarySobBackItemPO getById(Long salarySobBackItemId) { + return getSalarySobBackItemMapper().getById(salarySobBackItemId); + } + } diff --git a/src/com/engine/salary/web/SalarySobController.java b/src/com/engine/salary/web/SalarySobController.java index e78b45ce9..e9e7d8922 100644 --- a/src/com/engine/salary/web/SalarySobController.java +++ b/src/com/engine/salary/web/SalarySobController.java @@ -303,19 +303,24 @@ public class SalarySobController { @Produces(MediaType.APPLICATION_JSON) public String getSalarySobBackItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value ="id") Long id) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getSalarySobBackItemWrapper(user)::getAggregate, id); -// WeaForm weaForm = salarySobBackItemWrapper.getForm(id, TenantContext.getCurrentTenantKey()); + return new ResponseResult(user).run(getSalarySobBackItemWrapper(user)::getForm, id); } -// @POST -// @Path("/backitem/save") -// @ApiOperation("保存薪资账套回算项目") -// @Produces(MediaType.APPLICATION_JSON) -// public String saveSalarySobBackItem(@RequestBody @Validated SalarySobBackItemSaveParam saveParam) { -// List dtos = salarySobBackItemWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); -// return WeaResult.success(dtos); -// } + /** + * @description 保存薪资账套回算项目 + * @return String + * @author Harryxzy + * @date 2022/11/16 15:05 + */ + @POST + @Path("/backitem/save") + @Produces(MediaType.APPLICATION_JSON) + public String saveSalarySobBackItem(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody SalarySobBackItemSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult>(user).run(getSalarySobBackItemWrapper(user)::save, saveParam); + return null; + } /**********************************薪资账套的回算项目 end*********************************/ diff --git a/src/com/engine/salary/wrapper/SalarySobBackItemWrapper.java b/src/com/engine/salary/wrapper/SalarySobBackItemWrapper.java index a2186c1f5..408a86cb2 100644 --- a/src/com/engine/salary/wrapper/SalarySobBackItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobBackItemWrapper.java @@ -3,16 +3,25 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.dto.SalarySobBackItemAggregateDTO; +import com.engine.salary.entity.salarysob.dto.SalarySobBackItemFormDTO; import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO; +import com.engine.salary.enums.SalaryRoundingModeEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.engine.salary.service.SalaryFormulaService; import com.engine.salary.service.SalaryItemService; import com.engine.salary.service.SalarySobBackItemService; +import com.engine.salary.service.SysSalaryItemService; import com.engine.salary.service.impl.SalaryFormulaServiceImpl; import com.engine.salary.service.impl.SalaryItemServiceImpl; import com.engine.salary.service.impl.SalarySobBackItemServiceImpl; +import com.engine.salary.service.impl.SysSalaryItemServiceImpl; import com.engine.salary.util.SalaryEntityUtil; +import com.google.common.collect.ImmutableMap; +import com.wbi.util.Util; import weaver.hrm.User; import java.util.*; @@ -37,6 +46,10 @@ public class SalarySobBackItemWrapper extends Service { return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user); } + private SysSalaryItemService getSysSalaryItemService(User user) { + return ServiceUtil.getService(SysSalaryItemServiceImpl.class, user); + } + /** * @description 查看详情 * @return SalarySobBackItemAggregateDTO @@ -89,4 +102,24 @@ public class SalarySobBackItemWrapper extends Service { } + public SalarySobBackItemFormDTO getForm(Long salarySobBackItemId) { + // 查询薪资账套的薪资回算项目 + SalarySobBackItemPO salarySobBackItem = getSalarySobBackItemService(user).getById(salarySobBackItemId); + // 查询薪资项目 + SalaryItemPO salaryItem = getSalaryItemService(user).getById(salarySobBackItem.getSalaryItemId()); + // 查询公式 + ExpressFormula expressFormula = getSalaryFormulaService(user).getExpressFormula(salarySobBackItem.getFormulaId()); + // 转换为dto + SalarySobBackItemFormDTO salarySobBackItemFormDTO = SalarySobBackItemFormDTO.builder() + .id(salarySobBackItem.getId()) + .salaryItem(Collections.singletonList((Map) ImmutableMap.of("id", Util.null2String(salaryItem.getId()), "name", salaryItem.getName()))) + .dataType(SalaryDataTypeEnum.parseByValue(salaryItem.getDataType())) + .roundingMode(SalaryRoundingModeEnum.parseByValue(salarySobBackItem.getValueType())) + .pattern(Util.null2String(salarySobBackItem.getPattern())) + .valueType(SalaryValueTypeEnum.parseByValue(salarySobBackItem.getValueType())) + .formulaId(salarySobBackItem.getFormulaId()) + .formulaContent(expressFormula == null ? "" : expressFormula.getFormula()) + .taxDeclarationColumn(SalaryItemBO.buildTaxDeclarationColumn(salaryItem.getCode())).build(); + return salarySobBackItemFormDTO; + } }