From 10d988084bb0e8e5b37296d4484d634a2219f59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 6 Aug 2024 10:32:57 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salaryitem/config/FormulaConfig.java | 62 +++++ .../salaryitem/config/FormulaVarConfig.java | 44 ++++ .../salaryitem/config/SalaryItemConfig.java | 134 +++++++++++ .../salaryitem/dto/SalaryItemConfig.java | 221 ++++++++++++++++++ .../param/SalaryItemExportParam.java | 26 +++ .../mapper/salaryitem/SalaryItemMapper.java | 4 + .../mapper/salaryitem/SalaryItemMapper.xml | 176 +++++++++++--- .../salary/service/SalaryItemService.java | 4 + .../service/impl/SalaryItemServiceImpl.java | 22 +- .../salary/web/SalaryItemController.java | 15 +- .../salary/wrapper/SalaryItemWrapper.java | 10 + 11 files changed, 676 insertions(+), 42 deletions(-) create mode 100644 src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java create mode 100644 src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java create mode 100644 src/com/engine/salary/entity/salaryitem/config/SalaryItemConfig.java create mode 100644 src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java create mode 100644 src/com/engine/salary/entity/salaryitem/param/SalaryItemExportParam.java diff --git a/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java b/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java new file mode 100644 index 000000000..ba3f45f5e --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java @@ -0,0 +1,62 @@ +package com.engine.salary.entity.salaryitem.config; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.util.List; + + +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class FormulaConfig { + + /** + * 名称 + */ + private String name; + /** + * 备注 + */ + private String description; + /** + * 模块 + */ + private String module; + /** + * 用途 + */ + private String useFor; + /** + * 引用类型 + */ + private String referenceType; + /** + * 返回类型 + */ + private String returnType; + /** + * 校验类型 + */ + private String validateType; + /** + * 扩展参数 + */ + private String extendParam; + /** + * 公式内容 + */ + private String formula; + + /** + * 公式实际运行脚本 + */ + private String formulaRunScript; + + + private List vars; + +} diff --git a/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java b/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java new file mode 100644 index 000000000..0144a4055 --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java @@ -0,0 +1,44 @@ +package com.engine.salary.entity.salaryitem.config; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + + +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class FormulaVarConfig { + + /** + * 名称 + */ + private String name; + /** + * 公式id + */ + private Long formulaId; + /** + * 字段id + */ + private String fieldId; + /** + * 字段名称 + */ + private String fieldName; + /** + * 字段类型,number,string + */ + private String fieldType; + /** + * 来源 + */ + private String source; + /** + * 排序 + */ + private Integer orderIndex; + +} diff --git a/src/com/engine/salary/entity/salaryitem/config/SalaryItemConfig.java b/src/com/engine/salary/entity/salaryitem/config/SalaryItemConfig.java new file mode 100644 index 000000000..2e0d85f7c --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/config/SalaryItemConfig.java @@ -0,0 +1,134 @@ +package com.engine.salary.entity.salaryitem.config; + +import com.engine.salary.enums.SalaryRoundingModeEnum; +import com.engine.salary.enums.SalarySystemTypeEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + + +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class SalaryItemConfig { + /** + * 主键id + */ + private Long id; + + /** + * 名称 + */ + private String name; + + /** + * 编号 + */ + private String code; + + /** + * 是否是系统项目 + * + * @see SalarySystemTypeEnum + */ + private Integer systemType; + + /** + * 系统薪资项目的id(是从哪个系统薪资项目复制过来的) + */ + private Long sysSalaryItemId; + + /** + * 默认使用。0:默认不适用、1:默认使用 + */ + private Integer useDefault; + + /** + * 薪资档案引用。0:薪资档案未引用、1:薪资档案引用 + */ + private Integer useInEmployeeSalary; + + /** + * 核算时隐藏 + */ + private Integer hideDefault; + + /** + * 进位规则 + * + * @see SalaryRoundingModeEnum + */ + private Integer roundingMode; + + /** + * 保留的小数位数 + */ + private Integer pattern; + + /** + * 取值方式 + * + * @see SalaryValueTypeEnum + */ + private Integer valueType; + + /** + * 字段类型 + * + * @see SalaryDataTypeEnum + */ + private String dataType; + + /** + * 公式 + */ + private Long formulaId; + + /** + * 备注 + */ + private String description; + + /** + * 是否可以编辑。0:不可编辑、1:可编辑 + */ + private Integer canEdit; + + /** + * 可见性 + */ + private Integer sharedType; + + /** + * 可见范围 + */ + private String taxAgentIds; + + /** + * 0不可删除,1可删除 + */ + private Integer canDelete; + + /** + * 排序 + */ + private Integer sortedIndex; + + /** + * 宽度 + */ + private Integer width; + + /** + * 默认值 + */ + private String defaultValue; + + + private FormulaConfig formula; + +} diff --git a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java new file mode 100644 index 000000000..2219ac013 --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java @@ -0,0 +1,221 @@ +package com.engine.salary.entity.salaryitem.dto; + +import com.engine.salary.enums.SalaryRoundingModeEnum; +import com.engine.salary.enums.SalarySystemTypeEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.util.List; + + +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class SalaryItemConfig { + /** + * 主键id + */ + private Long id; + + /** + * 名称 + */ + private String name; + + /** + * 编号 + */ + private String code; + + /** + * 是否是系统项目 + * + * @see SalarySystemTypeEnum + */ + private Integer systemType; + + /** + * 系统薪资项目的id(是从哪个系统薪资项目复制过来的) + */ + private Long sysSalaryItemId; + + /** + * 默认使用。0:默认不适用、1:默认使用 + */ + private Integer useDefault; + + /** + * 薪资档案引用。0:薪资档案未引用、1:薪资档案引用 + */ + private Integer useInEmployeeSalary; + + /** + * 核算时隐藏 + */ + private Integer hideDefault; + + /** + * 进位规则 + * + * @see SalaryRoundingModeEnum + */ + private Integer roundingMode; + + /** + * 保留的小数位数 + */ + private Integer pattern; + + /** + * 取值方式 + * + * @see SalaryValueTypeEnum + */ + private Integer valueType; + + /** + * 字段类型 + * + * @see SalaryDataTypeEnum + */ + private String dataType; + + /** + * 公式 + */ + private Long formulaId; + + /** + * 备注 + */ + private String description; + + /** + * 是否可以编辑。0:不可编辑、1:可编辑 + */ + private Integer canEdit; + + /** + * 可见性 + */ + private Integer sharedType; + + /** + * 可见范围 + */ + private String taxAgentIds; + + /** + * 0不可删除,1可删除 + */ + private Integer canDelete; + + /** + * 排序 + */ + private Integer sortedIndex; + + /** + * 宽度 + */ + private Integer width; + + /** + * 默认值 + */ + private String defaultValue; + + + private Formula formula; + + @Data + static + class Formula { + + /** + * 名称 + */ + private String name; + /** + * 备注 + */ + private String description; + /** + * 模块 + */ + private String module; + /** + * 用途 + */ + private String useFor; + /** + * 引用类型 + */ + private String referenceType; + /** + * 返回类型 + */ + private String returnType; + /** + * 校验类型 + */ + private String validateType; + /** + * 扩展参数 + */ + private String extendParam; + /** + * 公式内容 + */ + private String formula; + + /** + * 公式实际运行脚本 + */ + private String formulaRunScript; + + private List vars; + + @Data + static + class formulaVar { + + /** + * 名称 + */ + private String name; + /** + * 公式id + */ + private Long formulaId; + /** + * 字段id + */ + private String fieldId; + /** + * 字段名称 + */ + private String fieldName; + /** + * 字段类型,number,string + */ + private String fieldType; + /** + * 来源 + */ + private String source; + /** + * 排序 + */ + private Integer orderIndex; + } + + + } + +} diff --git a/src/com/engine/salary/entity/salaryitem/param/SalaryItemExportParam.java b/src/com/engine/salary/entity/salaryitem/param/SalaryItemExportParam.java new file mode 100644 index 000000000..bf368aa9e --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/param/SalaryItemExportParam.java @@ -0,0 +1,26 @@ +package com.engine.salary.entity.salaryitem.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 导出参数 + *

Copyright: Copyright (c) 2024

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SalaryItemExportParam { + + private List ids; + +} diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java index 52ee57b51..fd85bbf52 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java @@ -1,5 +1,6 @@ package com.engine.salary.mapper.salaryitem; +import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import org.apache.ibatis.annotations.Param; @@ -68,4 +69,7 @@ public interface SalaryItemMapper { void batchUpdateSortedIndex(@Param("collection")List salaryItemPOS); + List getConfig(@Param("ids") Collection ids); + + } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml index 7b8f39b3b..6a8733468 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml @@ -406,12 +406,12 @@ update_time, creator, delete_type, tenant_key, data_type, shared_type, tax_agent_ids) VALUES - (#{item.id},#{item.name}, #{item.code}, #{item.systemType}, #{item.sysSalaryItemId}, - #{item.useDefault}, #{item.useInEmployeeSalary}, #{item.roundingMode}, - #{item.pattern}, - #{item.valueType}, #{item.formulaId}, #{item.description}, #{item.canEdit}, - #{item.createTime}, #{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}, #{item.dataType}, - #{item.sharedType}, #{item.taxAgentIds}) + (#{item_id},#{item_name}, #{item_code}, #{item_systemType}, #{item_sysSalaryItemId}, + #{item_useDefault}, #{item_useInEmployeeSalary}, #{item_roundingMode}, + #{item_pattern}, + #{item_valueType}, #{item_formulaId}, #{item_description}, #{item_canEdit}, + #{item_createTime}, #{item_updateTime}, #{item_creator}, 0, #{item_tenantKey}, #{item_dataType}, + #{item_sharedType}, #{item_taxAgentIds}) @@ -422,27 +422,27 @@ select - #{item.id,jdbcType=DOUBLE}, - #{item.name,jdbcType=VARCHAR}, - #{item.code,jdbcType=VARCHAR}, - #{item.systemType,jdbcType=INTEGER}, - #{item.sysSalaryItemId,jdbcType=DOUBLE}, - #{item.useDefault,jdbcType=INTEGER}, - #{item.useInEmployeeSalary,jdbcType=INTEGER}, - #{item.roundingMode,jdbcType=INTEGER}, - #{item.pattern,jdbcType=INTEGER}, - #{item.valueType,jdbcType=INTEGER}, - #{item.formulaId,jdbcType=DOUBLE}, - #{item.description,jdbcType=VARCHAR}, - #{item.canEdit,jdbcType=INTEGER}, - #{item.createTime,jdbcType=DATE}, - #{item.updateTime,jdbcType=DATE}, - #{item.creator,jdbcType=DOUBLE}, + #{item_id,jdbcType=DOUBLE}, + #{item_name,jdbcType=VARCHAR}, + #{item_code,jdbcType=VARCHAR}, + #{item_systemType,jdbcType=INTEGER}, + #{item_sysSalaryItemId,jdbcType=DOUBLE}, + #{item_useDefault,jdbcType=INTEGER}, + #{item_useInEmployeeSalary,jdbcType=INTEGER}, + #{item_roundingMode,jdbcType=INTEGER}, + #{item_pattern,jdbcType=INTEGER}, + #{item_valueType,jdbcType=INTEGER}, + #{item_formulaId,jdbcType=DOUBLE}, + #{item_description,jdbcType=VARCHAR}, + #{item_canEdit,jdbcType=INTEGER}, + #{item_createTime,jdbcType=DATE}, + #{item_updateTime,jdbcType=DATE}, + #{item_creator,jdbcType=DOUBLE}, 0, - #{item.tenantKey,jdbcType=VARCHAR}, - #{item.dataType,jdbcType=VARCHAR}, - #{item.sharedType,jdbcType=INTEGER}, - #{item.taxAgentIds,jdbcType=VARCHAR} + #{item_tenantKey,jdbcType=VARCHAR}, + #{item_dataType,jdbcType=VARCHAR}, + #{item_sharedType,jdbcType=INTEGER}, + #{item_taxAgentIds,jdbcType=VARCHAR} from dual @@ -453,12 +453,12 @@ rounding_mode, pattern, value_type, formula_id, description, can_edit, create_time, update_time, creator, delete_type, tenant_key, data_type, shared_type, tax_agent_ids) VALUES - (#{item.id},#{item.name}, #{item.code}, #{item.systemType}, #{item.sysSalaryItemId}, - #{item.useDefault}, #{item.useInEmployeeSalary}, #{item.roundingMode}, - #{item.pattern}, - #{item.valueType}, #{item.formulaId}, #{item.description}, #{item.canEdit}, - #{item.createTime}, #{item.updateTime}, #{item.creator}, 0, #{item.tenantKey}, #{item.dataType}, - #{item.sharedType}, #{item.taxAgentIds}) + (#{item_id},#{item_name}, #{item_code}, #{item_systemType}, #{item_sysSalaryItemId}, + #{item_useDefault}, #{item_useInEmployeeSalary}, #{item_roundingMode}, + #{item_pattern}, + #{item_valueType}, #{item_formulaId}, #{item_description}, #{item_canEdit}, + #{item_createTime}, #{item_updateTime}, #{item_creator}, 0, #{item_tenantKey}, #{item_dataType}, + #{item_sharedType}, #{item_taxAgentIds}) @@ -476,8 +476,8 @@ - - when id=#{item.id} then #{item.sortedIndex} + + when id=#{item_id} then #{item_sortedIndex} @@ -485,7 +485,7 @@ where id in - #{item.id} + #{item_id} @@ -582,5 +582,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + item.name as item_name + , item.code as item_code + , item.system_type as item_system_type + , item.sys_salary_item_id as item_sys_salary_item_id + , item.use_default as item_use_default + , item.use_in_employee_salary as item_use_in_employee_salary + , item.rounding_mode as item_rounding_mode + , item.pattern as item_pattern + , item.value_type as item_value_type + , item.formula_id as item_formula_id + , item.description as item_description + , item.can_edit as item_can_edit + , item.can_delete as item_can_delete + , item.data_type as item_data_type + , item.shared_type as item_shared_type + , item.tax_agent_ids as item_tax_agent_ids + , item.sorted_index as item_sorted_index + , item.hide_default as item_hide_default + , item.width as item_width + , item.default_value as item_default_value + + + + + , formula.name as formula_name + , formula.description as formula_description + , formula.module as formula_module + , formula.use_for as formula_use_for + , formula.reference_type as formula_reference_type + , formula.return_type as formula_return_type + , formula.validate_type as formula_validate_type + , formula.extend_param as formula_extend_param + , formula.formula as formula_formula + , formula.formulaRunScript as formula_formulaRunScript + + + + , var.name as var_name + , var.formula_id as var_formula_id + , var.field_id as var_field_id + , var.field_name as var_field_name + , var.field_type as var_field_type + , var.source as var_source + , var.order_index as var_order_index + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index ba661cc27..c5b2a35ae 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -1,5 +1,7 @@ package com.engine.salary.service; +import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam; @@ -147,4 +149,6 @@ public interface SalaryItemService { * @param syncSalaryItemParam */ void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam); + + List getConfig(SalaryItemExportParam param); } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index a63bec4e6..ce1a641dc 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -1,15 +1,18 @@ package com.engine.salary.service.impl; import cn.hutool.core.util.StrUtil; +import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.biz.SalaryItemBiz; import com.engine.salary.biz.SysSalaryItemBiz; import com.engine.salary.config.SalaryElogConfig; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.salaryformula.po.FormulaPO; import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; +import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam; @@ -24,6 +27,7 @@ import com.engine.salary.enums.SalarySystemTypeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.sicategory.SharedTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.salaryitem.SalaryItemMapper; import com.engine.salary.service.*; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -80,8 +84,10 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } private SysSalaryItemBiz sysSalaryItemBiz = new SysSalaryItemBiz(); -// @Autowired -// private LoggerTemplate salaryItemLoggerTemplate; + + private SalaryItemMapper getSalaryItemMapper() { + return SqlProxyHandle.getProxy(SalaryItemMapper.class); + } @Override public SalaryItemPO getById(Long id) { @@ -505,4 +511,14 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService return UsingItem.builder().build(); } + + + + + @Override + public List getConfig(SalaryItemExportParam param) { + return getSalaryItemMapper().getConfig(param.getIds()); + } + + } diff --git a/src/com/engine/salary/web/SalaryItemController.java b/src/com/engine/salary/web/SalaryItemController.java index cae184b9b..aea4c47f5 100644 --- a/src/com/engine/salary/web/SalaryItemController.java +++ b/src/com/engine/salary/web/SalaryItemController.java @@ -2,13 +2,11 @@ package com.engine.salary.web; import com.engine.common.util.ServiceUtil; import com.engine.salary.component.WeaFormOption; +import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO; import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO; -import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; -import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; -import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam; -import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam; +import com.engine.salary.entity.salaryitem.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryI18nUtil; @@ -183,6 +181,15 @@ public class SalaryItemController { return new ResponseResult(user).run(getSalaryItemWrapper(user)::update, saveParam); } + + @POST + @Path("/export") + @Produces(MediaType.APPLICATION_JSON) + public String updateSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemExportParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSalaryItemWrapper(user)::export, param); + } + /**********************************自定义薪资项目 end*********************************/ diff --git a/src/com/engine/salary/wrapper/SalaryItemWrapper.java b/src/com/engine/salary/wrapper/SalaryItemWrapper.java index 1407d0f8d..5660c58de 100644 --- a/src/com/engine/salary/wrapper/SalaryItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryItemWrapper.java @@ -8,8 +8,10 @@ import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.salaryformula.ExpressFormula; import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO; +import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO; import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; +import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam; @@ -303,4 +305,12 @@ public class SalaryItemWrapper extends Service { public void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam) { getSalaryItemService(user).syncSalaryItemToSalarySobItem(syncSalaryItemParam); } + + public List export(SalaryItemExportParam param) { + + return getSalaryItemService(user).getConfig(param); + + + + } } From bd6e30b63bc2582b60a5a2c00789fe3fca00a30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 6 Aug 2024 14:24:08 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salaryitem/config/FormulaConfig.java | 4 + .../salaryitem/config/FormulaVarConfig.java | 5 + .../salaryitem/dto/SalaryItemConfig.java | 221 ------------------ .../param/SalaryItemImportParam.java | 26 +++ .../engine/salary/enums/SalaryOnOffEnum.java | 22 +- .../salary/enums/SalaryRoundingModeEnum.java | 2 +- .../salary/enums/SalaryValueTypeEnum.java | 4 +- .../mapper/salaryitem/SalaryItemMapper.java | 2 +- .../mapper/salaryitem/SalaryItemMapper.xml | 16 +- .../salary/service/SalaryItemService.java | 2 +- .../service/impl/SalaryItemServiceImpl.java | 2 +- .../salary/web/SalaryItemController.java | 37 ++- .../salary/wrapper/SalaryItemWrapper.java | 48 +++- 13 files changed, 146 insertions(+), 245 deletions(-) delete mode 100644 src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java create mode 100644 src/com/engine/salary/entity/salaryitem/param/SalaryItemImportParam.java diff --git a/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java b/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java index ba3f45f5e..9930fa059 100644 --- a/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java +++ b/src/com/engine/salary/entity/salaryitem/config/FormulaConfig.java @@ -13,6 +13,10 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor public class FormulaConfig { + /** + * 主键id + */ + private Long id; /** * 名称 diff --git a/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java b/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java index 0144a4055..32707b286 100644 --- a/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java +++ b/src/com/engine/salary/entity/salaryitem/config/FormulaVarConfig.java @@ -12,6 +12,11 @@ import lombok.experimental.Accessors; @AllArgsConstructor public class FormulaVarConfig { + /** + * 主键id + */ + private Long id; + /** * 名称 */ diff --git a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java b/src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java deleted file mode 100644 index 2219ac013..000000000 --- a/src/com/engine/salary/entity/salaryitem/dto/SalaryItemConfig.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.engine.salary.entity.salaryitem.dto; - -import com.engine.salary.enums.SalaryRoundingModeEnum; -import com.engine.salary.enums.SalarySystemTypeEnum; -import com.engine.salary.enums.SalaryValueTypeEnum; -import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.List; - - -@Data -@Accessors(chain = true) -@NoArgsConstructor -@AllArgsConstructor -public class SalaryItemConfig { - /** - * 主键id - */ - private Long id; - - /** - * 名称 - */ - private String name; - - /** - * 编号 - */ - private String code; - - /** - * 是否是系统项目 - * - * @see SalarySystemTypeEnum - */ - private Integer systemType; - - /** - * 系统薪资项目的id(是从哪个系统薪资项目复制过来的) - */ - private Long sysSalaryItemId; - - /** - * 默认使用。0:默认不适用、1:默认使用 - */ - private Integer useDefault; - - /** - * 薪资档案引用。0:薪资档案未引用、1:薪资档案引用 - */ - private Integer useInEmployeeSalary; - - /** - * 核算时隐藏 - */ - private Integer hideDefault; - - /** - * 进位规则 - * - * @see SalaryRoundingModeEnum - */ - private Integer roundingMode; - - /** - * 保留的小数位数 - */ - private Integer pattern; - - /** - * 取值方式 - * - * @see SalaryValueTypeEnum - */ - private Integer valueType; - - /** - * 字段类型 - * - * @see SalaryDataTypeEnum - */ - private String dataType; - - /** - * 公式 - */ - private Long formulaId; - - /** - * 备注 - */ - private String description; - - /** - * 是否可以编辑。0:不可编辑、1:可编辑 - */ - private Integer canEdit; - - /** - * 可见性 - */ - private Integer sharedType; - - /** - * 可见范围 - */ - private String taxAgentIds; - - /** - * 0不可删除,1可删除 - */ - private Integer canDelete; - - /** - * 排序 - */ - private Integer sortedIndex; - - /** - * 宽度 - */ - private Integer width; - - /** - * 默认值 - */ - private String defaultValue; - - - private Formula formula; - - @Data - static - class Formula { - - /** - * 名称 - */ - private String name; - /** - * 备注 - */ - private String description; - /** - * 模块 - */ - private String module; - /** - * 用途 - */ - private String useFor; - /** - * 引用类型 - */ - private String referenceType; - /** - * 返回类型 - */ - private String returnType; - /** - * 校验类型 - */ - private String validateType; - /** - * 扩展参数 - */ - private String extendParam; - /** - * 公式内容 - */ - private String formula; - - /** - * 公式实际运行脚本 - */ - private String formulaRunScript; - - private List vars; - - @Data - static - class formulaVar { - - /** - * 名称 - */ - private String name; - /** - * 公式id - */ - private Long formulaId; - /** - * 字段id - */ - private String fieldId; - /** - * 字段名称 - */ - private String fieldName; - /** - * 字段类型,number,string - */ - private String fieldType; - /** - * 来源 - */ - private String source; - /** - * 排序 - */ - private Integer orderIndex; - } - - - } - -} diff --git a/src/com/engine/salary/entity/salaryitem/param/SalaryItemImportParam.java b/src/com/engine/salary/entity/salaryitem/param/SalaryItemImportParam.java new file mode 100644 index 000000000..15e2476af --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/param/SalaryItemImportParam.java @@ -0,0 +1,26 @@ +package com.engine.salary.entity.salaryitem.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 导入参数 + *

Copyright: Copyright (c) 2024

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SalaryItemImportParam { + + /** + * 上传文件id + */ + String imageId; +} diff --git a/src/com/engine/salary/enums/SalaryOnOffEnum.java b/src/com/engine/salary/enums/SalaryOnOffEnum.java index 7afb5aab0..d2662bb30 100644 --- a/src/com/engine/salary/enums/SalaryOnOffEnum.java +++ b/src/com/engine/salary/enums/SalaryOnOffEnum.java @@ -3,12 +3,13 @@ package com.engine.salary.enums; /** - * @description: 是、否 - * @author: xiajun - * @modified By: xiajun - * @date: Created in 10/28/21 5:50 PM - * @version:v1.0 - */ + * 开关枚举 + *

Copyright: Copyright (c) 2024

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public enum SalaryOnOffEnum implements BaseEnum { ON(1, "是", 84967), @@ -40,4 +41,13 @@ public enum SalaryOnOffEnum implements BaseEnum { public Integer getLabelId() { return labelId; } + + public static SalaryOnOffEnum parseByValue(int value) { + for (SalaryOnOffEnum item : values()) { + if (item.getValue().equals(value)) { + return item; + } + } + return OFF; + } } diff --git a/src/com/engine/salary/enums/SalaryRoundingModeEnum.java b/src/com/engine/salary/enums/SalaryRoundingModeEnum.java index 288aa7b07..702b921e4 100644 --- a/src/com/engine/salary/enums/SalaryRoundingModeEnum.java +++ b/src/com/engine/salary/enums/SalaryRoundingModeEnum.java @@ -67,6 +67,6 @@ public enum SalaryRoundingModeEnum implements BaseEnum { return modeEnum; } } - return null; + return ROUNDING; } } diff --git a/src/com/engine/salary/enums/SalaryValueTypeEnum.java b/src/com/engine/salary/enums/SalaryValueTypeEnum.java index 7d82d47d1..77bf5e71f 100644 --- a/src/com/engine/salary/enums/SalaryValueTypeEnum.java +++ b/src/com/engine/salary/enums/SalaryValueTypeEnum.java @@ -51,7 +51,7 @@ public enum SalaryValueTypeEnum implements BaseEnum { return salaryValueTypeEnum; } } - return null; + return INPUT; } @@ -65,6 +65,6 @@ public enum SalaryValueTypeEnum implements BaseEnum { return enumAry[i].getDefaultLabel(); } } - return ""; + return INPUT.getDefaultLabel(); } } diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java index fd85bbf52..ddb8054f3 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java @@ -1,6 +1,6 @@ package com.engine.salary.mapper.salaryitem; -import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import org.apache.ibatis.annotations.Param; diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml index 6a8733468..966955eb4 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml @@ -604,6 +604,7 @@ + @@ -615,6 +616,7 @@ + @@ -628,7 +630,8 @@ - item.name as item_name + item.id as item_id + ,item.name as item_name , item.code as item_code , item.system_type as item_system_type , item.sys_salary_item_id as item_sys_salary_item_id @@ -652,6 +655,7 @@ + , formula.id as formula_id , formula.name as formula_name , formula.description as formula_description , formula.module as formula_module @@ -665,6 +669,7 @@ + , var.id as var_id , var.name as var_name , var.formula_id as var_formula_id , var.field_id as var_field_id @@ -684,6 +689,15 @@ left join hrsa_formula formula on item.formula_id = formula.id left join hrsa_formula_var var on var.formula_id = formula.id where item.delete_type=0 and formula.delete_type=0 and var.delete_type=0 + and item.use_in_employee_salary = 0 + and system_type = 0 + + + AND id IN + + #{id} + + diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index c5b2a35ae..cf15b101d 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -1,6 +1,6 @@ package com.engine.salary.service; -import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index ce1a641dc..7ca53abcc 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -11,7 +11,7 @@ import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.entity.salaryformula.po.FormulaPO; import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; -import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; diff --git a/src/com/engine/salary/web/SalaryItemController.java b/src/com/engine/salary/web/SalaryItemController.java index aea4c47f5..755c52360 100644 --- a/src/com/engine/salary/web/SalaryItemController.java +++ b/src/com/engine/salary/web/SalaryItemController.java @@ -2,7 +2,7 @@ package com.engine.salary.web; import com.engine.common.util.ServiceUtil; import com.engine.salary.component.WeaFormOption; -import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandleParam; import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO; import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO; @@ -15,6 +15,7 @@ import com.engine.salary.wrapper.SalaryItemWrapper; import com.engine.salary.wrapper.SysSalaryItemWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -23,6 +24,11 @@ import javax.servlet.http.HttpServletResponse; import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.time.LocalDate; import java.util.Collection; import java.util.List; import java.util.Map; @@ -184,10 +190,35 @@ public class SalaryItemController { @POST @Path("/export") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemExportParam param) { + try { + User user = HrmUserVarify.getUser(request, response); + XSSFWorkbook workbook = getSalaryItemWrapper(user).export(param); + String time = LocalDate.now().toString(); + String fileName = "薪资项目" + time; + try { + fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + StreamingOutput output = outputStream -> { + workbook.write(outputStream); + outputStream.flush(); + }; + response.setContentType("application/octet-stream"); + return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); + } catch (Exception e) { + throw e; + } + } + + @POST + @Path("/import") @Produces(MediaType.APPLICATION_JSON) - public String updateSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemExportParam param) { + public String importSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemImportParam importParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getSalaryItemWrapper(user)::export, param); + return new ResponseResult>(user).run(getSalaryItemWrapper(user)::importSalaryItem, importParam); } /**********************************自定义薪资项目 end*********************************/ diff --git a/src/com/engine/salary/wrapper/SalaryItemWrapper.java b/src/com/engine/salary/wrapper/SalaryItemWrapper.java index 5660c58de..6a77fbc89 100644 --- a/src/com/engine/salary/wrapper/SalaryItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryItemWrapper.java @@ -2,19 +2,17 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.component.WeaFormOption; import com.engine.salary.config.SalaryElogConfig; -import com.engine.hrmelog.entity.dto.LoggerContext; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.salaryformula.ExpressFormula; import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO; -import com.engine.salary.entity.salaryitem.dto.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO; import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; -import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; -import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam; -import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; -import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam; +import com.engine.salary.entity.salaryitem.param.*; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; @@ -28,14 +26,19 @@ import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.excel.ExcelParseHelper; +import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.file.ImageFileManager; import weaver.hrm.User; +import java.io.InputStream; import java.util.*; /** @@ -292,6 +295,7 @@ public class SalaryItemWrapper extends Service { /** * 获取薪资项目在哪些账套中使用 + * * @param salaryItemId */ public List> getSalarySobBySalaryItem(Long salaryItemId) { @@ -300,17 +304,45 @@ public class SalaryItemWrapper extends Service { /** * 将薪资项目管理中的信息同步至账套 + * * @param syncSalaryItemParam */ public void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam) { getSalaryItemService(user).syncSalaryItemToSalarySobItem(syncSalaryItemParam); } - public List export(SalaryItemExportParam param) { + public XSSFWorkbook export(SalaryItemExportParam param) { - return getSalaryItemService(user).getConfig(param); + String[] titles = {"名称", "默认使用", "核算时隐藏", "进位规则", "保留的小数位数", "取值方式", "字段类型", "公式", "备注", "排序", "宽度", "默认值"}; + List configs = getSalaryItemService(user).getConfig(param); + List> rows = new ArrayList<>(); + rows.add(Arrays.asList(titles)); + configs.forEach(e -> { + List row = new ArrayList<>(); + row.add(e.getName()); + row.add(SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); + row.add(e.getHideDefault()); + row.add(SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); + row.add(e.getPattern()); + row.add(SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); + row.add(e.getDataType()); + row.add("e.getFormula()"); + row.add(e.getDescription()); + row.add(e.getSortedIndex()); + row.add(e.getWidth()); + row.add(e.getDefaultValue()); + rows.add(row); + }); + + return ExcelUtil.genWorkbookV2(rows, "薪资项目"); + } + + public void importSalaryItem(SalaryItemImportParam param) { + InputStream fileInputStream = null; + fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); + List addUpDeductions = ExcelParseHelper.parse2Map(fileInputStream, AddUpDeductionDTO.class, 0, 1, 14, "addUpDeductionTemplate.xlsx"); } } From 48120f8e248abaefd91f256a13cb1f63cf3e8bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 7 Aug 2024 09:06:09 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/SalaryItemExcelConfig.java | 114 ++++++++++++++ .../engine/salary/enums/SalaryOnOffEnum.java | 9 ++ .../salary/enums/SalaryRoundingModeEnum.java | 9 ++ .../salary/enums/SalaryValueTypeEnum.java | 9 ++ .../enums/salaryitem/SalaryDataTypeEnum.java | 2 +- .../mapper/salaryitem/SalaryItemMapper.java | 2 + .../mapper/salaryitem/SalaryItemMapper.xml | 47 ++++-- .../salary/service/SalaryItemService.java | 10 +- .../service/impl/SalaryItemServiceImpl.java | 143 ++++++++++++++++-- .../engine/salary/util/db/IdGenerator.java | 5 + .../engine/salary/util/excel/ExcelHead.java | 4 +- .../util/excel/ImportExcelResponse.java | 27 ++++ .../salary/web/SalaryItemController.java | 4 +- .../salary/wrapper/SalaryItemWrapper.java | 30 ++-- 14 files changed, 372 insertions(+), 43 deletions(-) create mode 100644 src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java create mode 100644 src/com/engine/salary/util/excel/ImportExcelResponse.java diff --git a/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java b/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java new file mode 100644 index 000000000..cd6d37c83 --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java @@ -0,0 +1,114 @@ +package com.engine.salary.entity.salaryitem.config; + +import com.engine.salary.enums.SalaryRoundingModeEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; +import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import com.engine.salary.util.excel.ExcelHead; +import com.engine.salary.util.excel.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + + +@Data +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +public class SalaryItemExcelConfig { + + /** + * 名称 + */ + @ExcelHead(title="名称",dataIndex = "name") + @ExcelProperty(index = 0) + private String name; + + /** + * 默认使用。0:默认不适用、1:默认使用 + */ + @ExcelHead(title="是否默认使用",dataIndex = "useDefault") + @ExcelProperty(index = 1) + private String useDefault; + + /** + * 核算是否隐藏 + */ + @ExcelHead(title="核算是否隐藏",dataIndex = "hideDefault") + @ExcelProperty(index = 2) + private String hideDefault; + + /** + * 进位规则 + * + * @see SalaryRoundingModeEnum + */ + @ExcelHead(title="进位规则",dataIndex = "roundingMode") + @ExcelProperty(index = 3) + private String roundingMode; + + /** + * 保留的小数位数 + */ + @ExcelHead(title="保留的小数位数",dataIndex = "pattern") + @ExcelProperty(index = 4) + private String pattern; + + /** + * 取值方式 + * + * @see SalaryValueTypeEnum + */ + @ExcelHead(title="取值方式",dataIndex = "valueType") + @ExcelProperty(index = 5) + private String valueType; + + /** + * 字段类型 + * + * @see SalaryDataTypeEnum + */ + @ExcelHead(title="字段类型",dataIndex = "dataType") + @ExcelProperty(index = 6) + private String dataType; + + /** + * 公式 + */ + @ExcelHead(title="公式",dataIndex = "formula") + @ExcelProperty(index = 7) + private String formula; + + @ExcelHead(title="sql返回字段",dataIndex = "sqlReturnKey") + @ExcelProperty(index = 8) + private String sqlReturnKey; + + /** + * 排序 + */ + @ExcelHead(title="排序",dataIndex = "sortedIndex") + @ExcelProperty(index = 9) + private String sortedIndex; + + /** + * 宽度 + */ + @ExcelHead(title="宽度",dataIndex = "width") + @ExcelProperty(index = 10) + private String width; + + /** + * 默认值 + */ + @ExcelHead(title="默认值",dataIndex = "defaultValue") + @ExcelProperty(index = 11) + private String defaultValue; + + /** + * 备注 + */ + @ExcelHead(title="备注",dataIndex = "description") + @ExcelProperty(index = 12) + private String description; + +} diff --git a/src/com/engine/salary/enums/SalaryOnOffEnum.java b/src/com/engine/salary/enums/SalaryOnOffEnum.java index d2662bb30..99b31eb4d 100644 --- a/src/com/engine/salary/enums/SalaryOnOffEnum.java +++ b/src/com/engine/salary/enums/SalaryOnOffEnum.java @@ -50,4 +50,13 @@ public enum SalaryOnOffEnum implements BaseEnum { } return OFF; } + + public static SalaryOnOffEnum parseByDefaultLabel(String defaultLabel) { + for (SalaryOnOffEnum item : values()) { + if (item.getDefaultLabel().equals(defaultLabel)) { + return item; + } + } + return OFF; + } } diff --git a/src/com/engine/salary/enums/SalaryRoundingModeEnum.java b/src/com/engine/salary/enums/SalaryRoundingModeEnum.java index 702b921e4..a47733891 100644 --- a/src/com/engine/salary/enums/SalaryRoundingModeEnum.java +++ b/src/com/engine/salary/enums/SalaryRoundingModeEnum.java @@ -69,4 +69,13 @@ public enum SalaryRoundingModeEnum implements BaseEnum { } return ROUNDING; } + + public static SalaryRoundingModeEnum parseByDefaultLabel(String defaultLabel) { + for (SalaryRoundingModeEnum modeEnum : SalaryRoundingModeEnum.values()) { + if (Objects.equals(modeEnum.getDefaultLabel(), defaultLabel)) { + return modeEnum; + } + } + return ROUNDING; + } } diff --git a/src/com/engine/salary/enums/SalaryValueTypeEnum.java b/src/com/engine/salary/enums/SalaryValueTypeEnum.java index 77bf5e71f..3f50e75fc 100644 --- a/src/com/engine/salary/enums/SalaryValueTypeEnum.java +++ b/src/com/engine/salary/enums/SalaryValueTypeEnum.java @@ -54,6 +54,15 @@ public enum SalaryValueTypeEnum implements BaseEnum { return INPUT; } + public static SalaryValueTypeEnum parseByDefaultLabel(String defaultLabel) { + for (SalaryValueTypeEnum salaryValueTypeEnum : SalaryValueTypeEnum.values()) { + if (Objects.equals(salaryValueTypeEnum.getDefaultLabel(), defaultLabel)) { + return salaryValueTypeEnum; + } + } + return INPUT; + } + public static String getDefaultLabelByValue(Integer value) { if (value == null) { diff --git a/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java b/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java index 07bffd40c..b5b1a483b 100644 --- a/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java +++ b/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java @@ -51,7 +51,7 @@ public enum SalaryDataTypeEnum implements BaseEnum { return salaryDataTypeEnum; } } - return null; + return STRING; } public static String getDefaultLabelByValue(String value) { diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java index ddb8054f3..38e3aebfd 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java @@ -68,8 +68,10 @@ public interface SalaryItemMapper { void batchUpdateSortedIndex(@Param("collection")List salaryItemPOS); + SalaryItemPO getByName(String name); List getConfig(@Param("ids") Collection ids); + } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml index 966955eb4..4e5fc222a 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml @@ -582,6 +582,13 @@ + + @@ -651,11 +658,30 @@ , item.hide_default as item_hide_default , item.width as item_width , item.default_value as item_default_value + , f.formula_id + , f.formula_name + , f.formula_description + , f.formula_module + , f.formula_use_for + , f.formula_reference_type + , f.formula_return_type + , f.formula_validate_type + , f.formula_extend_param + , f.formula_formula + , f.formula_formulaRunScript + , f.var_id + , f.var_name + , f.var_formula_id + , f.var_field_id + , f.var_field_name + , f.var_field_type + , f.var_source + , f.var_order_index - , formula.id as formula_id + formula.id as formula_id , formula.name as formula_name , formula.description as formula_description , formula.module as formula_module @@ -682,16 +708,19 @@ + select + + from hrsa_salary_item item + where item.delete_type=0 and item.use_in_employee_salary = 1 + + AND item.id IN + + #{id} + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java index 38e3aebfd..1d53a8f3c 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java @@ -72,6 +72,8 @@ public interface SalaryItemMapper { List getConfig(@Param("ids") Collection ids); + List getAllConfig(@Param("ids") Collection ids); + } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml index c7b44dfa9..30f1a6bbd 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml @@ -610,7 +610,7 @@ - + @@ -622,7 +622,7 @@ - + @@ -722,7 +722,31 @@ where item.delete_type=0 and item.use_in_employee_salary = 0 and system_type = 0 - AND id IN + AND item.id IN + + #{id} + + + + + + SELECT @@ -509,6 +508,28 @@ and name = #{name} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.java index 8a2155271..865e47591 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.java +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.java @@ -1,5 +1,6 @@ package com.engine.salary.mapper.taxagent; +import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; import com.engine.salary.entity.taxagent.po.TaxAgentEmployeePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; @@ -69,4 +70,6 @@ public interface TaxAgentMapper { List listEmployee(); + List getAllConfig(); + } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml index b39f69b49..20d164b94 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml @@ -263,5 +263,19 @@ where e.status not in (7) + + + + + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryArchiveItemService.java b/src/com/engine/salary/service/SalaryArchiveItemService.java index 70f53e9d9..d640fe17a 100644 --- a/src/com/engine/salary/service/SalaryArchiveItemService.java +++ b/src/com/engine/salary/service/SalaryArchiveItemService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO; import com.engine.salary.entity.salaryarchive.param.SalaryArchiveItemSaveParam; import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustBeforeParam; @@ -156,4 +157,5 @@ public interface SalaryArchiveItemService { * @date 2022/11/14 13:38 */ String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam); + List getAllConfig(); } diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index 58037abe8..04c3e9257 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -153,6 +153,8 @@ public interface SalaryItemService { List getConfig(SalaryItemExportParam param); + List getAllConfig(SalaryItemExportParam param); + Map preview(SalaryItemImportParam param); ImportExcelResponse importSalaryItem(SalaryItemImportParam param); diff --git a/src/com/engine/salary/service/SalarySobService.java b/src/com/engine/salary/service/SalarySobService.java index bef31a87e..cd2689cc0 100644 --- a/src/com/engine/salary/service/SalarySobService.java +++ b/src/com/engine/salary/service/SalarySobService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.entity.salarysob.config.SalarySobConfig; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobDisableParam; @@ -154,4 +155,6 @@ public interface SalarySobService { * @return */ List listByTaxAgentIds(Collection taxAgentIds); + + List getConfig(Long taxAgentId); } diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java index bab08d143..cfe02dda0 100644 --- a/src/com/engine/salary/service/TaxAgentService.java +++ b/src/com/engine/salary/service/TaxAgentService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; @@ -258,4 +259,5 @@ public interface TaxAgentService { * @return */ Collection listEmployeeIdsInTaxAgent(Long taxAgentId); + List getAllConfig(); } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 19c39e199..5144ccdf8 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -8,6 +8,7 @@ import com.engine.salary.biz.SalaryItemBiz; import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO; import com.engine.salary.entity.salaryarchive.param.*; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; @@ -20,6 +21,7 @@ import com.engine.salary.enums.salaryarchive.SalaryArchiveFieldTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.archive.SalaryArchiveItemMapper; import com.engine.salary.service.SalaryArchiveItemService; import com.engine.salary.service.SalaryArchiveService; import com.engine.salary.service.SalaryEmployeeService; @@ -27,6 +29,7 @@ import com.engine.salary.service.TaxAgentService; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryLoggerUtil; +import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.valid.ValidUtil; @@ -55,6 +58,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi private SalaryItemBiz salaryItemMapper = new SalaryItemBiz(); private SalaryArchiveItemBiz salaryArchiveItemMapper = new SalaryArchiveItemBiz(); + private SalaryArchiveItemMapper getSalaryArchiveItemMapper() { + return MapperProxyFactory.getProxy(SalaryArchiveItemMapper.class); + } + + @Override public SalaryArchiveItemPO getById(Long salaryArchiveItemId) { return salaryArchiveItemMapper.getById(salaryArchiveItemId); @@ -267,6 +275,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi return StringUtils.EMPTY; } + @Override + public List getAllConfig() { + return getSalaryArchiveItemMapper().getAllConfig(null); + } + /** * @return null * @description 构建薪资档案中调薪的更新PO diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index fc7828baa..6703fdc30 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -540,6 +540,11 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService return getSalaryItemMapper().getConfig(param.getIds()); } + @Override + public List getAllConfig(SalaryItemExportParam param) { + return getSalaryItemMapper().getAllConfig(param.getIds()); + } + @Override public Map preview(SalaryItemImportParam param) { InputStream fileInputStream = null; @@ -717,8 +722,8 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService row.add(SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); row.add(e.getPattern()); row.add(SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); - row.add(e.getFormula() == null ? "" : e.getFormula().getFormula()); - row.add(e.getFormula() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormula().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); + row.add(e.getFormulaConfig() == null ? "" : e.getFormulaConfig().getFormula()); + row.add(e.getFormulaConfig() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormulaConfig().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); row.add(e.getSortedIndex()); row.add(e.getWidth()); row.add(e.getDefaultValue()); @@ -750,8 +755,8 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService row.add(SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); row.add(e.getPattern()); row.add(SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); - row.add(e.getFormula() == null ? "" : e.getFormula().getFormula()); - row.add(e.getFormula() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormula().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); + row.add(e.getFormulaConfig() == null ? "" : e.getFormulaConfig().getFormula()); + row.add(e.getFormulaConfig() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormulaConfig().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); row.add(e.getSortedIndex()); row.add(e.getWidth()); row.add(e.getDefaultValue()); diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 28dcef63a..6fb14f13f 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -12,6 +12,7 @@ import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO; import com.engine.salary.entity.salarysob.bo.*; +import com.engine.salary.entity.salarysob.config.SalarySobConfig; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.param.*; import com.engine.salary.entity.salarysob.po.*; @@ -784,6 +785,11 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { return getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentIds(taxAgentIds).build()); } + @Override + public List getConfig(Long taxAgentId) { + return getSalarySobMapper().getConfig(taxAgentId); + } + public List filterByAdmin(List salarySobPOS) { long employeeId = user.getUID(); diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index aa0890cb7..9c004b049 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -13,11 +13,13 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; +import com.engine.salary.entity.salarysob.config.SalarySobConfig; import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam; import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; +import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; @@ -89,6 +91,11 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { } + private SalarySobService getSalarySobService(User user) { + return ServiceUtil.getService(SalarySobServiceImpl.class, user); + } + + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } @@ -797,5 +804,15 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { return SalaryEntityUtil.properties(taxAgentEmpPOS, TaxAgentEmpPO::getEmployeeId); } + @Override + public List getAllConfig() { + List allConfig = getTaxAgentMapper().getAllConfig(); + allConfig.forEach(config->{ + List sobConfigs = getSalarySobService(user).getConfig(config.getId()); + config.setSalarySobConfigs(sobConfigs); + }); + return allConfig; + } + } diff --git a/src/com/engine/salary/web/SalarySystemConfigController.java b/src/com/engine/salary/web/SalarySystemConfigController.java index ae1b52d67..636b31767 100644 --- a/src/com/engine/salary/web/SalarySystemConfigController.java +++ b/src/com/engine/salary/web/SalarySystemConfigController.java @@ -199,6 +199,7 @@ public class SalarySystemConfigController { /** * 薪资核算人员匹配规则 + * * @param request * @param response * @param param @@ -214,6 +215,7 @@ public class SalarySystemConfigController { /** * 工资单反馈 + * * @param request * @param response * @param param @@ -229,6 +231,7 @@ public class SalarySystemConfigController { /** * 撤回个税申报 + * * @param request * @param response * @param param @@ -244,6 +247,7 @@ public class SalarySystemConfigController { /** * 删除档案 + * * @param request * @param response * @param param @@ -318,4 +322,40 @@ public class SalarySystemConfigController { User user = HrmUserVarify.getUser(request, response); return new ResponseResult>(user).run(getSalarySystemConfigWrapper(user)::getEncryptProgress, progressId); } + + // @POST +// @Path("/downloadConfig") +// @Produces(MediaType.APPLICATION_OCTET_STREAM) +// public Response downloadConfig(@Context HttpServletRequest request, @Context HttpServletResponse response) { +// try { +// User user = HrmUserVarify.getUser(request, response); +// XSSFWorkbook workbook = getAddUpDeductionWrapper(user).downloadTemplate(queryParam); +// String fileName = "累计专项附加扣除导入模板" + LocalDate.now(); +// try { +// fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); +// } catch (UnsupportedEncodingException e) { +// e.printStackTrace(); +// } +// +// StreamingOutput output = outputStream -> { +// workbook.write(outputStream); +// outputStream.flush(); +// }; +// response.setContentType("application/octet-stream"); +// return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); +// } catch (Exception e) { +// log.error("累计专项附加扣除导入模板异常", e); +// throw e; +// } +// +// } + @POST + @Path("/downloadConfig") + @Produces(MediaType.APPLICATION_JSON) + public String downloadConfig(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::downloadConfig); + + } + } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 46b470aa4..5065ce298 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -2,6 +2,17 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.salary.entity.config.SalaryConfig; +import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; +import com.engine.salary.entity.taxagent.config.TaxAgentConfig; +import com.engine.salary.service.SalaryArchiveItemService; +import com.engine.salary.service.SalaryItemService; +import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.impl.SalaryArchiveItemServiceImpl; +import com.engine.salary.service.impl.SalaryItemServiceImpl; +import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.sys.entity.param.AppSettingSaveParam; import com.engine.salary.sys.entity.param.MatchEmployeeModeSaveParam; import com.engine.salary.sys.entity.param.OrderRuleParam; @@ -17,6 +28,7 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; +import com.thoughtworks.xstream.XStream; import org.apache.commons.lang3.StringUtils; import weaver.general.BaseBean; import weaver.hrm.User; @@ -39,6 +51,18 @@ public class SalarySystemConfigWrapper extends Service { return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private SalaryItemService getSalaryItemService(User user) { + return ServiceUtil.getService(SalaryItemServiceImpl.class, user); + } + + private SalaryArchiveItemService getSalaryArchiveItemService(User user) { + return ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user); + } + + private TaxAgentService getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + } + public Map info() { BaseBean baseBean = new BaseBean(); String log = baseBean.getPropValue("hrmSalary", "log"); @@ -136,12 +160,12 @@ public class SalarySystemConfigWrapper extends Service { public AppSettingVO appSetting() { - return getSalarySysConfService(user).appSetting(); + return getSalarySysConfService(user).appSetting(); } public Map saveEncryptSetting(AppSettingSaveParam param) { - return getSalarySysConfService(user).saveEncryptSetting(param); + return getSalarySysConfService(user).saveEncryptSetting(param); } public Map getEncryptProgress(String progressId) { @@ -167,4 +191,25 @@ public class SalarySystemConfigWrapper extends Service { public void saveSalarySendFeedback(SalarySysConfPO param) { getSalarySysConfService(user).saveSalarySendFeedback(param); } + + public Object downloadConfig() { + XStream xStream = new XStream(); + //由于使用的注解,将自动检测注解开启 + xStream.autodetectAnnotations(true); + + SalaryConfig salaryConfig = new SalaryConfig(); + List salaryItemConfigs = getSalaryItemService(user).getAllConfig(SalaryItemExportParam.builder().build()); + salaryConfig.setSalaryItemConfigs(salaryItemConfigs); + + List archiveFieldConfigs = getSalaryArchiveItemService(user).getAllConfig(); + salaryConfig.setArchiveFieldConfig(archiveFieldConfigs); + + List taxAgentConfigs = getTaxAgentService(user).getAllConfig(); + salaryConfig.setTaxAgentConfigs(taxAgentConfigs); + + String s = xStream.toXML(salaryConfig); + System.out.println(s); + return s; + + } } From 8611358c6c5a76f071c7f6a34c47c42244fa4d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 8 Aug 2024 11:03:55 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/SalarySystemConfigController.java | 56 ++++++++++--------- .../wrapper/SalarySystemConfigWrapper.java | 10 +++- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/com/engine/salary/web/SalarySystemConfigController.java b/src/com/engine/salary/web/SalarySystemConfigController.java index 636b31767..8b00036f4 100644 --- a/src/com/engine/salary/web/SalarySystemConfigController.java +++ b/src/com/engine/salary/web/SalarySystemConfigController.java @@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse; import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import java.util.Map; @Slf4j @@ -323,36 +324,37 @@ public class SalarySystemConfigController { return new ResponseResult>(user).run(getSalarySystemConfigWrapper(user)::getEncryptProgress, progressId); } - // @POST -// @Path("/downloadConfig") -// @Produces(MediaType.APPLICATION_OCTET_STREAM) -// public Response downloadConfig(@Context HttpServletRequest request, @Context HttpServletResponse response) { -// try { -// User user = HrmUserVarify.getUser(request, response); -// XSSFWorkbook workbook = getAddUpDeductionWrapper(user).downloadTemplate(queryParam); -// String fileName = "累计专项附加扣除导入模板" + LocalDate.now(); -// try { -// fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); -// } catch (UnsupportedEncodingException e) { -// e.printStackTrace(); -// } -// -// StreamingOutput output = outputStream -> { -// workbook.write(outputStream); -// outputStream.flush(); -// }; -// response.setContentType("application/octet-stream"); -// return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); -// } catch (Exception e) { -// log.error("累计专项附加扣除导入模板异常", e); -// throw e; -// } -// -// } @POST @Path("/downloadConfig") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response downloadConfig(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User user = HrmUserVarify.getUser(request, response); + XSSFWorkbook workbook = getSalarySystemConfigWrapper(user).downloadConfig(queryParam); + String fileName = "累计专项附加扣除导入模板" + LocalDate.now(); + try { + fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + StreamingOutput output = outputStream -> { + workbook.write(outputStream); + outputStream.flush(); + }; + response.setContentType("application/octet-stream"); + return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); + } catch (Exception e) { + log.error("累计专项附加扣除导入模板异常", e); + throw e; + } + + } + + @POST + @Path("/downloadConfig1") @Produces(MediaType.APPLICATION_JSON) - public String downloadConfig(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String downloadConfig1(@Context HttpServletRequest request, @Context HttpServletResponse response) { User user = HrmUserVarify.getUser(request, response); return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::downloadConfig); diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 5065ce298..c18ba3458 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -29,10 +29,12 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.CompactWriter; import org.apache.commons.lang3.StringUtils; import weaver.general.BaseBean; import weaver.hrm.User; +import java.io.*; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -207,8 +209,12 @@ public class SalarySystemConfigWrapper extends Service { List taxAgentConfigs = getTaxAgentService(user).getAllConfig(); salaryConfig.setTaxAgentConfigs(taxAgentConfigs); - String s = xStream.toXML(salaryConfig); - System.out.println(s); + String xml = xStream.toXML(salaryConfig); + System.out.println(xml); + Writer writer = new StringWriter(); + xStream.marshal(xml, new CompactWriter(writer)); + OutputStream output = new ByteArrayOutputStream(); + xStream.marshal(xml, new CompactWriter(new OutputStreamWriter(output))); return s; } From 83a408afa2b9bcd670657356d526b9dd46372a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 8 Aug 2024 16:53:31 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/config/SalaryBillConfig.java | 14 -- .../salary/entity/config/SalaryConfig.java | 15 +- .../config/ArchiveFieldConfig.java | 168 +-------------- .../salaryformula/config/FormluaConfig.java | 27 +++ .../entity/salaryformula/po/FormulaPO.java | 33 +++ .../entity/salaryformula/po/FormulaVar.java | 29 +++ .../config/SalaryItemAllConfig.java | 23 ++ .../entity/salaryitem/po/SalaryItemPO.java | 55 +++++ .../salarysob/config/SalarySobConfig.java | 98 ++------- .../salarysob/po/SalarySobAdjustRulePO.java | 25 +++ .../salarysob/po/SalarySobBackItemPO.java | 45 +++- .../salarysob/po/SalarySobEmpFieldPO.java | 23 ++ .../salarysob/po/SalarySobItemGroupPO.java | 31 ++- .../entity/salarysob/po/SalarySobItemPO.java | 98 ++++++--- .../entity/salarysob/po/SalarySobPO.java | 37 ++++ .../archive/SalaryArchiveItemMapper.java | 3 - .../archive/SalaryArchiveItemMapper.xml | 16 -- .../mapper/salarysob/SalarySobMapper.java | 2 - .../mapper/salarysob/SalarySobMapper.xml | 22 -- .../service/SalaryArchiveItemService.java | 4 +- .../salary/service/SalaryFormulaService.java | 3 + .../salary/service/SalaryItemService.java | 3 + .../salary/service/SalarySobItemService.java | 2 + .../salary/service/TaxAgentService.java | 2 + .../impl/SalaryArchiveItemServiceImpl.java | 21 +- .../impl/SalaryFormulaServiceImpl.java | 7 + .../service/impl/SalaryItemServiceImpl.java | 10 +- .../impl/SalarySobItemServiceImpl.java | 4 + .../service/impl/SalarySobServiceImpl.java | 119 +++++++---- .../sys/entity/param/uploadConfigParam.java | 25 +++ .../engine/salary/util/xml/XStreamUtil.java | 68 ++++++ .../web/SalarySystemConfigController.java | 46 ++-- .../wrapper/SalarySystemConfigWrapper.java | 200 ++++++++++++++++-- 33 files changed, 847 insertions(+), 431 deletions(-) delete mode 100644 src/com/engine/salary/entity/config/SalaryBillConfig.java create mode 100644 src/com/engine/salary/entity/salaryformula/config/FormluaConfig.java create mode 100644 src/com/engine/salary/entity/salaryitem/config/SalaryItemAllConfig.java create mode 100644 src/com/engine/salary/sys/entity/param/uploadConfigParam.java create mode 100644 src/com/engine/salary/util/xml/XStreamUtil.java diff --git a/src/com/engine/salary/entity/config/SalaryBillConfig.java b/src/com/engine/salary/entity/config/SalaryBillConfig.java deleted file mode 100644 index 688ef4e7d..000000000 --- a/src/com/engine/salary/entity/config/SalaryBillConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.engine.salary.entity.config; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class SalaryBillConfig { - private Long id; -} diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index f15811d2d..8958b03f9 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -1,7 +1,8 @@ package com.engine.salary.entity.config; import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; -import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; +import com.engine.salary.entity.salaryformula.config.FormluaConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamImplicit; @@ -29,13 +30,17 @@ public class SalaryConfig { //社保方案 + //公式配置 + @XStreamAlias("FormluaConfig") + private FormluaConfig formluaConfig; + //薪资项目 - @XStreamImplicit - private List salaryItemConfigs; + @XStreamAlias("SalaryItemConfig") + private SalaryItemAllConfig salaryItemConfig; //字段管理 - @XStreamImplicit - private List archiveFieldConfig; + @XStreamAlias("ArchiveFieldConfig") + private ArchiveFieldConfig archiveFieldConfigs; //扣缴义务人 @XStreamImplicit diff --git a/src/com/engine/salary/entity/salaryarchive/config/ArchiveFieldConfig.java b/src/com/engine/salary/entity/salaryarchive/config/ArchiveFieldConfig.java index 1e77b158b..bd4a1568a 100644 --- a/src/com/engine/salary/entity/salaryarchive/config/ArchiveFieldConfig.java +++ b/src/com/engine/salary/entity/salaryarchive/config/ArchiveFieldConfig.java @@ -1,176 +1,24 @@ package com.engine.salary.entity.salaryarchive.config; -import com.engine.salary.enums.SalaryRoundingModeEnum; -import com.engine.salary.enums.SalarySystemTypeEnum; -import com.engine.salary.enums.SalaryValueTypeEnum; -import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.thoughtworks.xstream.annotations.XStreamAlias; -import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; + +import java.util.List; @Data -@Accessors(chain = true) +@Builder @NoArgsConstructor @AllArgsConstructor @XStreamAlias("ArchiveFieldConfig") public class ArchiveFieldConfig { - /** - * 主键id - */ - @XStreamAlias("id") - @XStreamAsAttribute - private Long id; - /** - * 名称 - */ - @XStreamAlias("name") - @XStreamAsAttribute - private String name; - - /** - * 编号 - */ - @XStreamAlias("code") - @XStreamAsAttribute - private String code; - - /** - * 是否是系统项目 - * - * @see SalarySystemTypeEnum - */ - @XStreamAlias("systemType") - @XStreamAsAttribute - private Integer systemType; - - /** - * 系统薪资项目的id(是从哪个系统薪资项目复制过来的) - */ - @XStreamAlias("sysSalaryItemId") - @XStreamAsAttribute - private Long sysSalaryItemId; - - /** - * 默认使用。0:默认不适用、1:默认使用 - */ - @XStreamAlias("useDefault") - @XStreamAsAttribute - private Integer useDefault; - - /** - * 薪资档案引用。0:薪资档案未引用、1:薪资档案引用 - */ - @XStreamAlias("useInEmployeeSalary") - @XStreamAsAttribute - private Integer useInEmployeeSalary; - - /** - * 核算时隐藏 - */ - @XStreamAlias("hideDefault") - @XStreamAsAttribute - private Integer hideDefault; - - /** - * 进位规则 - * - * @see SalaryRoundingModeEnum - */ - @XStreamAlias("roundingMode") - @XStreamAsAttribute - private Integer roundingMode; - - /** - * 保留的小数位数 - */ - @XStreamAlias("pattern") - @XStreamAsAttribute - private Integer pattern; - - /** - * 取值方式 - * - * @see SalaryValueTypeEnum - */ - @XStreamAlias("valueType") - @XStreamAsAttribute - private Integer valueType; - - /** - * 字段类型 - * - * @see SalaryDataTypeEnum - */ - @XStreamAlias("dataType") - @XStreamAsAttribute - private String dataType; - - /** - * 公式 - */ - @XStreamAlias("formulaId") - @XStreamAsAttribute - private Long formulaId; - - /** - * 备注 - */ - @XStreamAlias("description") - @XStreamAsAttribute - private String description; - - /** - * 是否可以编辑。0:不可编辑、1:可编辑 - */ - @XStreamAlias("canEdit") - @XStreamAsAttribute - private Integer canEdit; - - /** - * 可见性 - */ - @XStreamAlias("sharedType") - @XStreamAsAttribute - private Integer sharedType; - - /** - * 可见范围 - */ - @XStreamAlias("taxAgentIds") - @XStreamAsAttribute - private String taxAgentIds; - - /** - * 0不可删除,1可删除 - */ - @XStreamAlias("canDelete") - @XStreamAsAttribute - private Integer canDelete; - - /** - * 排序 - */ - @XStreamAlias("sortedIndex") - @XStreamAsAttribute - private Integer sortedIndex; - - /** - * 宽度 - */ - @XStreamAlias("width") - @XStreamAsAttribute - private Integer width; - - /** - * 默认值 - */ - @XStreamAlias("defaultValue") - @XStreamAsAttribute - private String defaultValue; + @XStreamImplicit + List salaryItems; } diff --git a/src/com/engine/salary/entity/salaryformula/config/FormluaConfig.java b/src/com/engine/salary/entity/salaryformula/config/FormluaConfig.java new file mode 100644 index 000000000..b84cf4f51 --- /dev/null +++ b/src/com/engine/salary/entity/salaryformula/config/FormluaConfig.java @@ -0,0 +1,27 @@ +package com.engine.salary.entity.salaryformula.config; + +import com.engine.salary.entity.salaryformula.po.FormulaPO; +import com.engine.salary.entity.salaryformula.po.FormulaVar; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamImplicit; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("FormluaConfig") +public class FormluaConfig { + + @XStreamImplicit + private List formulas; + + @XStreamImplicit + private List formulaVars; + +} diff --git a/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java b/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java index 36770bd56..ecfae85b7 100644 --- a/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java +++ b/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java @@ -1,5 +1,7 @@ package com.engine.salary.entity.salaryformula.po; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -12,68 +14,99 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor +@XStreamAlias("Formula") public class FormulaPO { /** * id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 名称 */ + @XStreamAlias("name") + @XStreamAsAttribute private String name; /** * 备注 */ + @XStreamAlias("description") + @XStreamAsAttribute private String description; /** * 模块 */ + @XStreamAlias("module") + @XStreamAsAttribute private String module; /** * 用途 */ + @XStreamAlias("useFor") + @XStreamAsAttribute private String useFor; /** * 引用类型 */ + @XStreamAlias("referenceType") + @XStreamAsAttribute private String referenceType; /** * 返回类型 */ + @XStreamAlias("returnType") + @XStreamAsAttribute private String returnType; /** * 校验类型 */ + @XStreamAlias("validateType") + @XStreamAsAttribute private String validateType; /** * 扩展参数 */ + @XStreamAlias("extendParam") + @XStreamAsAttribute private String extendParam; /** * 公式内容 */ + @XStreamAlias("formula") + @XStreamAsAttribute private String formula; /** * 公式实际运行脚本 */ + @XStreamAlias("formulaRunScript") + @XStreamAsAttribute private String formulaRunScript; /** * 创建人 */ + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除0否1是 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 修改时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; //主键id集合 diff --git a/src/com/engine/salary/entity/salaryformula/po/FormulaVar.java b/src/com/engine/salary/entity/salaryformula/po/FormulaVar.java index 6630f0c49..79f6bf88e 100644 --- a/src/com/engine/salary/entity/salaryformula/po/FormulaVar.java +++ b/src/com/engine/salary/entity/salaryformula/po/FormulaVar.java @@ -1,5 +1,8 @@ package com.engine.salary.entity.salaryformula.po; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamOmitField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -12,58 +15,84 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor +@XStreamAlias("FormulaVar") public class FormulaVar { /** * id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 名称 */ + @XStreamAlias("name") + @XStreamAsAttribute private String name; /** * 公式id */ + @XStreamAlias("formulaId") + @XStreamAsAttribute private Long formulaId; /** * 字段id */ + @XStreamAlias("fieldId") + @XStreamAsAttribute private String fieldId; /** * 字段名称 */ + @XStreamAlias("fieldName") + @XStreamAsAttribute private String fieldName; /** * 字段类型,number,string */ + @XStreamAlias("fieldType") + @XStreamAsAttribute private String fieldType; /** * 来源 */ + @XStreamAlias("source") + @XStreamAsAttribute private String source; /** * 排序 */ + @XStreamAlias("orderIndex") + @XStreamAsAttribute private Integer orderIndex; /** * 创建人 */ + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除,0否1是 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 修改时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; //值 + @XStreamOmitField private String content; diff --git a/src/com/engine/salary/entity/salaryitem/config/SalaryItemAllConfig.java b/src/com/engine/salary/entity/salaryitem/config/SalaryItemAllConfig.java new file mode 100644 index 000000000..06e657bb5 --- /dev/null +++ b/src/com/engine/salary/entity/salaryitem/config/SalaryItemAllConfig.java @@ -0,0 +1,23 @@ +package com.engine.salary.entity.salaryitem.config; + +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamImplicit; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("SalaryItemConfig") +public class SalaryItemAllConfig { + + @XStreamImplicit + List salaryItems; +} diff --git a/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java b/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java index 1224b0c56..ceb0a0877 100644 --- a/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java +++ b/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java @@ -5,6 +5,8 @@ import com.engine.salary.enums.SalaryRoundingModeEnum; import com.engine.salary.enums.SalarySystemTypeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -27,24 +29,31 @@ import java.util.Date; @AllArgsConstructor //hrsa_salary_item @ElogTransform(name = "薪资项目") +@XStreamAlias("SalaryItem") public class SalaryItemPO { /** * 主键id */ @ElogTransform(name = "主键id") + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 名称 */ @ElogTransform(name = "名称") + @XStreamAlias("name") + @XStreamAsAttribute private String name; /** * 编号 */ @ElogTransform(name = "编号") + @XStreamAlias("code") + @XStreamAsAttribute private String code; /** @@ -53,30 +62,40 @@ public class SalaryItemPO { * @see SalarySystemTypeEnum */ @ElogTransform(name = "是否是系统项目") + @XStreamAlias("systemType") + @XStreamAsAttribute private Integer systemType; /** * 系统薪资项目的id(是从哪个系统薪资项目复制过来的) */ @ElogTransform(name = "系统薪资项目的id") + @XStreamAlias("sysSalaryItemId") + @XStreamAsAttribute private Long sysSalaryItemId; /** * 默认使用。0:默认不适用、1:默认使用 */ @ElogTransform(name = "默认使用") + @XStreamAlias("useDefault") + @XStreamAsAttribute private Integer useDefault; /** * 薪资档案引用。0:薪资档案未引用、1:薪资档案引用 */ @ElogTransform(name = "薪资档案引用") + @XStreamAlias("useInEmployeeSalary") + @XStreamAsAttribute private Integer useInEmployeeSalary; /** * 核算时隐藏 */ @ElogTransform(name = "核算时隐藏") + @XStreamAlias("hideDefault") + @XStreamAsAttribute private Integer hideDefault; /** @@ -85,12 +104,16 @@ public class SalaryItemPO { * @see SalaryRoundingModeEnum */ @ElogTransform(name = "进位规则") + @XStreamAlias("roundingMode") + @XStreamAsAttribute private Integer roundingMode; /** * 保留的小数位数 */ @ElogTransform(name = "保留的小数位数") + @XStreamAlias("pattern") + @XStreamAsAttribute private Integer pattern; /** @@ -99,6 +122,8 @@ public class SalaryItemPO { * @see SalaryValueTypeEnum */ @ElogTransform(name = "取值方式") + @XStreamAlias("valueType") + @XStreamAsAttribute private Integer valueType; /** @@ -107,54 +132,72 @@ public class SalaryItemPO { * @see SalaryDataTypeEnum */ @ElogTransform(name = "字段类型") + @XStreamAlias("dataType") + @XStreamAsAttribute private String dataType; /** * 公式 */ @ElogTransform(name = "公式") + @XStreamAlias("formulaId") + @XStreamAsAttribute private Long formulaId; /** * 备注 */ @ElogTransform(name = "备注") + @XStreamAlias("description") + @XStreamAsAttribute private String description; /** * 是否可以编辑。0:不可编辑、1:可编辑 */ @ElogTransform(name = "是否可以编辑") + @XStreamAlias("canEdit") + @XStreamAsAttribute private Integer canEdit; /** * 租户key */ @ElogTransform(name = "租户key") + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; /** * 创建人id */ @ElogTransform(name = "创建人id") + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除 */ @ElogTransform(name = "是否删除") + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ @ElogTransform(name = "创建时间") + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ @ElogTransform(name = "更新时间") + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; //查询条件 @@ -166,35 +209,47 @@ public class SalaryItemPO { * 可见性 */ @ElogTransform(name = "可见性") + @XStreamAlias("sharedType") + @XStreamAsAttribute private Integer sharedType; /** * 可见范围 */ @ElogTransform(name = "可见范围") + @XStreamAlias("taxAgentIds") + @XStreamAsAttribute private String taxAgentIds; /** * 0不可删除,1可删除 */ @ElogTransform(name = "是否已经删除") + @XStreamAlias("canDelete") + @XStreamAsAttribute private Integer canDelete; /** * 排序 */ @ElogTransform(name = "排序") + @XStreamAlias("sortedIndex") + @XStreamAsAttribute private Integer sortedIndex; /** * 宽度 */ @ElogTransform(name = "宽度") + @XStreamAlias("width") + @XStreamAsAttribute private Integer width; /** * 默认值 */ @ElogTransform(name = "默认值") + @XStreamAlias("defaultValue") + @XStreamAsAttribute private String defaultValue; } diff --git a/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java b/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java index 14692502e..12d0455c8 100644 --- a/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java +++ b/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java @@ -1,12 +1,15 @@ package com.engine.salary.entity.salarysob.config; +import com.engine.salary.entity.salarysob.po.*; import com.thoughtworks.xstream.annotations.XStreamAlias; -import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + @Data @Builder @NoArgsConstructor @@ -14,91 +17,22 @@ import lombok.NoArgsConstructor; @XStreamAlias("SalarySobConfig") public class SalarySobConfig { - /** - * 主键id - */ - @XStreamAlias("id") - @XStreamAsAttribute - private Long id; + @XStreamAlias("salarySob") + private SalarySobPO salarySob; - /** - * 名称 - */ - @XStreamAlias("name") - @XStreamAsAttribute - private String name; + @XStreamImplicit + private List salarySobEmpFields; - /** - * 个税扣缴义务人的主键id - */ - @XStreamAlias("taxAgentId") - @XStreamAsAttribute - private Long taxAgentId; + @XStreamImplicit + private List salarySobItemGroups; - /** - * 应税项目。1:正常工资薪金所得 - */ - @XStreamAlias("incomeCategory") - @XStreamAsAttribute - private Integer incomeCategory; + @XStreamImplicit + private List salarySobItems; - /** - * 薪资周期。1:上上月、2:上月、3:本月、4:下月 - */ - @XStreamAlias("salaryCycleType") - @XStreamAsAttribute - private Integer salaryCycleType; + @XStreamImplicit + private List salarySobBackItems; - /** - * 薪资周期的起始日期 - */ - @XStreamAlias("salaryCycleFromDay") - @XStreamAsAttribute - private Integer salaryCycleFromDay; - - /** - * 税款所属期。1:上上月、2:上月、3:本月、4:下月 - */ - @XStreamAlias("taxCycleType") - @XStreamAsAttribute - private Integer taxCycleType; - - /** - * 考勤周期。1:上上月、2:上月、3:本月、4:下月 - */ - @XStreamAlias("attendCycleType") - @XStreamAsAttribute - private Integer attendCycleType; - - /** - * 考勤周期的起始日期 - */ - @XStreamAlias("attendCycleFromDay") - @XStreamAsAttribute - private Integer attendCycleFromDay; - - /** - * 社保福利所属期。1:上上月、2:上月、3:本月、4:下月 - */ - @XStreamAlias("socialSecurityCycleType") - @XStreamAsAttribute - private Integer socialSecurityCycleType; - - /** - * 是否禁用。0:正常使用、1:禁用 - */ - @XStreamAlias("disable") - @XStreamAsAttribute - private Integer disable; - - /** - * 描述 - */ - @XStreamAlias("description") - @XStreamAsAttribute - private String description; - - -// private List salaryBillConfigs; + @XStreamImplicit + private List salarySobAdjustRules; } diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobAdjustRulePO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobAdjustRulePO.java index bf646ede5..ad793ed46 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobAdjustRulePO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobAdjustRulePO.java @@ -1,6 +1,8 @@ package com.engine.salary.entity.salarysob.po; import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -24,26 +26,35 @@ import java.util.Date; @AllArgsConstructor @Builder //hrsa_salary_sob_adjust_rule +@XStreamAlias("SalarySobAdjustRule") public class SalarySobAdjustRulePO { /** * 主键id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 薪资账套id */ + @XStreamAlias("salarySobId") + @XStreamAsAttribute private Long salarySobId; /** * 薪资项目id */ + @XStreamAlias("salaryItemId") + @XStreamAsAttribute private Long salaryItemId; /** * 生效日期 */ + @XStreamAlias("dayOfMonth") + @XStreamAsAttribute private Integer dayOfMonth; /** @@ -51,6 +62,8 @@ public class SalarySobAdjustRulePO { * * @see SalarySobAdjustRuleTypeEnum */ + @XStreamAlias("beforeAdjustmentType") + @XStreamAsAttribute private Integer beforeAdjustmentType; /** @@ -58,31 +71,43 @@ public class SalarySobAdjustRulePO { * * @see SalarySobAdjustRuleTypeEnum */ + @XStreamAlias("afterAdjustmentType") + @XStreamAsAttribute private Integer afterAdjustmentType; /** * 租户key */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; /** * 创建人id */ + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; Collection ids; diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java index 793d64bfe..6eedc4a77 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java @@ -4,6 +4,8 @@ import com.engine.salary.enums.SalaryRoundingModeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -26,26 +28,35 @@ import java.util.stream.Collectors; @Builder @NoArgsConstructor @AllArgsConstructor +@XStreamAlias("SalarySobBackItem") public class SalarySobBackItemPO{ /** * 主键id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 薪资账套id */ + @XStreamAlias("salarySobId") + @XStreamAsAttribute private Long salarySobId; /** * 薪资项目id */ + @XStreamAlias("salaryItemId") + @XStreamAsAttribute private Long salaryItemId; /** * 薪资项目code */ + @XStreamAlias("salaryItemCode") + @XStreamAsAttribute private String salaryItemCode; /** @@ -53,6 +64,8 @@ public class SalarySobBackItemPO{ * * @see SalaryDataTypeEnum */ + @XStreamAlias("dataType") + @XStreamAsAttribute private String dataType; /** @@ -60,11 +73,15 @@ public class SalarySobBackItemPO{ * * @see SalaryRoundingModeEnum */ + @XStreamAlias("roundingMode") + @XStreamAsAttribute private Integer roundingMode; /** * 保留的小数位数 */ + @XStreamAlias("pattern") + @XStreamAsAttribute private Integer pattern; /** @@ -72,52 +89,72 @@ public class SalarySobBackItemPO{ * * @see SalaryValueTypeEnum */ + @XStreamAlias("valueType") + @XStreamAsAttribute private Integer valueType; /** * 公式id */ + @XStreamAlias("formulaId") + @XStreamAsAttribute private Long formulaId; /** * 0:已发项目、1:补发薪资项目 */ + @XStreamAlias("backCalcType") + @XStreamAsAttribute private Integer backCalcType; + /** + * 默认值 + */ + @XStreamAlias("defaultValue") + @XStreamAsAttribute + private String defaultValue; + /** * 租户key */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute @JsonIgnore private String tenantKey; /** * 创建人id */ + @XStreamAlias("creator") + @XStreamAsAttribute @JsonIgnore private Long creator; /** * 是否删除 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute @JsonIgnore private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute @JsonIgnore private Date createTime; /** * 更新时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute @JsonIgnore private Date updateTime; - /** - * 默认值 - */ - private String defaultValue; + diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobEmpFieldPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobEmpFieldPO.java index ddac5dcf9..e92f33bf1 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobEmpFieldPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobEmpFieldPO.java @@ -1,5 +1,7 @@ package com.engine.salary.entity.salarysob.po; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -27,56 +29,77 @@ import java.util.stream.Collectors; @NoArgsConstructor @AllArgsConstructor //hrsa_salary_sob_emp_field +@XStreamAlias("SalarySobEmpField") public class SalarySobEmpFieldPO { /** * 主键id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 薪资账套id */ + @XStreamAlias("salarySobId") + @XStreamAsAttribute private Long salarySobId; /** * 字段code */ + @XStreamAlias("fieldCode") + @XStreamAsAttribute private String fieldCode; /** * 排序字段 */ + @XStreamAlias("sortedIndex") + @XStreamAsAttribute private Integer sortedIndex; /** * 是否可以删除 */ + @XStreamAlias("canDelete") + @XStreamAsAttribute private Integer canDelete; /** * 租户key */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; /** * 创建人id */ + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; Collection ids; diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java index 97469a997..ce3a569ae 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java @@ -1,5 +1,7 @@ package com.engine.salary.entity.salarysob.po; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -25,60 +27,85 @@ import java.util.stream.Collectors; @NoArgsConstructor @AllArgsConstructor //hrsa_salary_sob_item_group +@XStreamAlias("SalarySobItemGroup") public class SalarySobItemGroupPO { /** * 主键id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 薪资账套的id */ + @XStreamAlias("salarySobId") + @XStreamAsAttribute private Long salarySobId; /** * 薪资账套中薪资项目分组的名称 */ + @XStreamAlias("name") + @XStreamAsAttribute private String name; /** * 排序字段 */ + @XStreamAlias("sortedIndex") + @XStreamAsAttribute private Integer sortedIndex; /** * 备注 */ + @XStreamAlias("description") + @XStreamAsAttribute private String description; + + //该分类是否隐藏(0不隐藏,1隐藏) + @XStreamAlias("itemHide") + @XStreamAsAttribute + private Long itemHide; + /** * 租户key */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; /** * 创建人id */ + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; - //该分类是否隐藏(0不隐藏,1隐藏) - private Long itemHide; Collection ids; diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java index 19a6db873..0f8482201 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java @@ -3,6 +3,8 @@ package com.engine.salary.entity.salarysob.po; import com.engine.hrmelog.annotation.ElogTransform; import com.engine.salary.enums.SalaryRoundingModeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -29,83 +31,73 @@ import java.util.stream.Collectors; @AllArgsConstructor //hrsa_salary_sob_item @ElogTransform( name="薪资账套薪资项目" ) +@XStreamAlias("SalarySobItem") public class SalarySobItemPO { /** * 主键id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 薪资账套的id */ + @XStreamAlias("salarySobId") + @XStreamAsAttribute private Long salarySobId; /** * 薪资项目的id */ + @XStreamAlias("salaryItemId") + @XStreamAsAttribute private Long salaryItemId; /** * 薪资账套薪资项目分组id */ + @XStreamAlias("salarySobItemGroupId") + @XStreamAsAttribute private Long salarySobItemGroupId; /** * 公式 */ + @XStreamAlias("formulaId") + @XStreamAsAttribute private Long formulaId; /** * 排序字段 */ + @XStreamAlias("sortedIndex") + @XStreamAsAttribute private Integer sortedIndex; /** * 备注 */ + @XStreamAlias("description") + @XStreamAsAttribute private String description; - /** - * 是否可以删除。0:不可删除、1:可以删除 - */ - private Integer canDelete; - - /** - * 租户key - */ - private String tenantKey; - - /** - * 创建人id - */ - private Long creator; - - /** - * 是否删除 - */ - private Integer deleteType; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 更新时间 - */ - private Date updateTime; /** * 进位规则 * * @see SalaryRoundingModeEnum */ + @XStreamAlias("roundingMode") + @XStreamAsAttribute private Integer roundingMode; /** * 保留的小数位数 */ + @XStreamAlias("pattern") + @XStreamAsAttribute private Integer pattern; /** @@ -113,17 +105,65 @@ public class SalarySobItemPO { * * @see SalaryValueTypeEnum */ + @XStreamAlias("valueType") + @XStreamAsAttribute private Integer valueType; //该分类是否隐藏(0不隐藏,1隐藏) + @XStreamAlias("itemHide") + @XStreamAsAttribute private Long itemHide; /** * 默认值 */ + @XStreamAlias("defaultValue") + @XStreamAsAttribute private String defaultValue; + /** + * 是否可以删除。0:不可删除、1:可以删除 + */ + @XStreamAlias("canDelete") + @XStreamAsAttribute + private Integer canDelete; + + /** + * 租户key + */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute + private String tenantKey; + + /** + * 创建人id + */ + @XStreamAlias("creator") + @XStreamAsAttribute + private Long creator; + + /** + * 是否删除 + */ + @XStreamAlias("deleteType") + @XStreamAsAttribute + private Integer deleteType; + + /** + * 创建时间 + */ + @XStreamAlias("createTime") + @XStreamAsAttribute + private Date createTime; + + /** + * 更新时间 + */ + @XStreamAlias("updateTime") + @XStreamAsAttribute + private Date updateTime; + //in Collection ids; Collection salarySobIds; diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java index 942731380..b75eb5976 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java @@ -2,6 +2,8 @@ package com.engine.salary.entity.salarysob.po; import com.engine.hrmelog.annotation.ElogTransform; import com.engine.salary.util.valid.Compare; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,6 +23,7 @@ import java.util.Date; @AllArgsConstructor @ElogTransform( name="薪资账套" ) //hrsa_salary_sob +@XStreamAlias("SalarySobPO") public class SalarySobPO { /** @@ -28,6 +31,8 @@ public class SalarySobPO { */ @ElogTransform( name="主键" ) @Compare + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** @@ -35,12 +40,16 @@ public class SalarySobPO { */ @ElogTransform( name="名称" ) @Compare + @XStreamAlias("name") + @XStreamAsAttribute private String name; /** * 个税扣缴义务人的主键id */ @ElogTransform( name="个税扣缴义务人id" ) + @XStreamAlias("taxAgentId") + @XStreamAsAttribute private Long taxAgentId; /** @@ -48,6 +57,8 @@ public class SalarySobPO { */ @ElogTransform( name="薪资类型" ) @Compare + @XStreamAlias("incomeCategory") + @XStreamAsAttribute private Integer incomeCategory; /** @@ -55,6 +66,8 @@ public class SalarySobPO { */ @ElogTransform( name="薪资周期" ) @Compare + @XStreamAlias("salaryCycleType") + @XStreamAsAttribute private Integer salaryCycleType; /** @@ -62,6 +75,8 @@ public class SalarySobPO { */ @ElogTransform( name="薪资周期起始日期" ) @Compare + @XStreamAlias("salaryCycleFromDay") + @XStreamAsAttribute private Integer salaryCycleFromDay; /** @@ -69,6 +84,8 @@ public class SalarySobPO { */ @ElogTransform( name="税款所属期" ) @Compare + @XStreamAlias("taxCycleType") + @XStreamAsAttribute private Integer taxCycleType; /** @@ -76,6 +93,8 @@ public class SalarySobPO { */ @ElogTransform( name="考勤周期" ) @Compare + @XStreamAlias("attendCycleType") + @XStreamAsAttribute private Integer attendCycleType; /** @@ -83,6 +102,8 @@ public class SalarySobPO { */ @ElogTransform( name="考勤周期起始日期" ) @Compare + @XStreamAlias("attendCycleFromDay") + @XStreamAsAttribute private Integer attendCycleFromDay; /** @@ -90,48 +111,64 @@ public class SalarySobPO { */ @ElogTransform( name="社保福利所属期" ) @Compare + @XStreamAlias("socialSecurityCycleType") + @XStreamAsAttribute private Integer socialSecurityCycleType; /** * 是否禁用。0:正常使用、1:禁用 */ @ElogTransform( name="是否禁用" ) + @XStreamAlias("disable") + @XStreamAsAttribute private Integer disable; /** * 描述 */ @ElogTransform( name="描述" ) + @XStreamAlias("description") + @XStreamAsAttribute private String description; /** * 创建人 */ @ElogTransform( name="创建人" ) + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 创建时间 */ @ElogTransform( name="创建时间" ) + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ @ElogTransform( name="更新时间" ) + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; /** * 是否已删除。0:未删除、1:已删除 */ @ElogTransform( name="是否已删除" ) + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 租户ID */ @ElogTransform( name="租户" ) + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; Collection ids; diff --git a/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.java b/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.java index c96deb548..78e83be7b 100644 --- a/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.java +++ b/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.java @@ -1,13 +1,11 @@ package com.engine.salary.mapper.archive; -import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO; import com.engine.salary.entity.salaryarchive.param.SalaryArchiveItemQueryParam; import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustRecordQueryParam; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import org.apache.ibatis.annotations.Param; -import java.util.Collection; import java.util.List; public interface SalaryArchiveItemMapper { @@ -99,5 +97,4 @@ public interface SalaryArchiveItemMapper { int batchUpdate(@Param("collection") List pos); - List getAllConfig(@Param("ids") Collection ids); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.xml b/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.xml index 4a3619497..ff6f3ee20 100644 --- a/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.xml +++ b/src/com/engine/salary/mapper/archive/SalaryArchiveItemMapper.xml @@ -1193,21 +1193,5 @@ - - - - \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java index c22bc4fe5..999c805d1 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java +++ b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java @@ -1,6 +1,5 @@ package com.engine.salary.mapper.salarysob; -import com.engine.salary.entity.salarysob.config.SalarySobConfig; import com.engine.salary.entity.salarysob.po.SalarySobPO; import org.apache.ibatis.annotations.Param; @@ -55,5 +54,4 @@ public interface SalarySobMapper { List listByName(SalarySobPO build); - List getConfig(Long taxAgentId); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml index c8602279c..59f40120d 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml @@ -508,28 +508,6 @@ and name = #{name} - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryArchiveItemService.java b/src/com/engine/salary/service/SalaryArchiveItemService.java index d640fe17a..573aa0aa3 100644 --- a/src/com/engine/salary/service/SalaryArchiveItemService.java +++ b/src/com/engine/salary/service/SalaryArchiveItemService.java @@ -157,5 +157,7 @@ public interface SalaryArchiveItemService { * @date 2022/11/14 13:38 */ String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam); - List getAllConfig(); + + + ArchiveFieldConfig getConfig(); } diff --git a/src/com/engine/salary/service/SalaryFormulaService.java b/src/com/engine/salary/service/SalaryFormulaService.java index 618011426..2fbe3f3d4 100644 --- a/src/com/engine/salary/service/SalaryFormulaService.java +++ b/src/com/engine/salary/service/SalaryFormulaService.java @@ -1,6 +1,7 @@ package com.engine.salary.service; import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryformula.param.SalaryFormulaMockParam; import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam; import com.engine.salary.entity.salaryformula.po.FormulaPO; @@ -56,4 +57,6 @@ public interface SalaryFormulaService { List listByIds(List formulaIds); void update(FormulaPO formulaPO); + + FormluaConfig getFormluaConfig(); } diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index 04c3e9257..b2edbbc7f 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.param.*; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; @@ -151,6 +152,8 @@ public interface SalaryItemService { */ void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam); + SalaryItemAllConfig getConfig(); + List getConfig(SalaryItemExportParam param); List getAllConfig(SalaryItemExportParam param); diff --git a/src/com/engine/salary/service/SalarySobItemService.java b/src/com/engine/salary/service/SalarySobItemService.java index c640291e3..63a01c6d5 100644 --- a/src/com/engine/salary/service/SalarySobItemService.java +++ b/src/com/engine/salary/service/SalarySobItemService.java @@ -1,5 +1,7 @@ package com.engine.salary.service; +import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO; diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java index cfe02dda0..65ac2c77c 100644 --- a/src/com/engine/salary/service/TaxAgentService.java +++ b/src/com/engine/salary/service/TaxAgentService.java @@ -259,5 +259,7 @@ public interface TaxAgentService { * @return */ Collection listEmployeeIdsInTaxAgent(Long taxAgentId); + + List getAllConfig(); } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 5144ccdf8..74ae1de51 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -13,6 +13,7 @@ import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO; import com.engine.salary.entity.salaryarchive.param.*; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; +import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; @@ -22,10 +23,7 @@ import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.archive.SalaryArchiveItemMapper; -import com.engine.salary.service.SalaryArchiveItemService; -import com.engine.salary.service.SalaryArchiveService; -import com.engine.salary.service.SalaryEmployeeService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.*; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryLoggerUtil; @@ -76,6 +74,10 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + private SalaryItemService getSalaryItemService(User user) { + return ServiceUtil.getService(SalaryItemServiceImpl.class, user); + } + private SalaryArchiveService getSalaryArchiveService(User user) { return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user); } @@ -275,10 +277,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi return StringUtils.EMPTY; } - @Override - public List getAllConfig() { - return getSalaryArchiveItemMapper().getAllConfig(null); - } + /** * @return null @@ -739,4 +738,10 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi } + @Override + public ArchiveFieldConfig getConfig() { + List salaryItemPOList = getSalaryItemService(user).listByParam(SalaryItemSearchParam.builder().useInEmployeeSalary(1).build()); + return ArchiveFieldConfig.builder().salaryItems(salaryItemPOList).build(); + } + } diff --git a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java index 9d1a125df..9a32da966 100644 --- a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java @@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryformula.param.SalaryFormulaMockParam; import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam; import com.engine.salary.entity.salaryformula.po.FormulaPO; @@ -401,4 +402,10 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe getFormulaMapper().updateIgnoreNull(formulaPO); } + @Override + public FormluaConfig getFormluaConfig() { + List formulaPOS = getFormulaMapper().listAll(); + List formulaVars = getFormulaVarMapper().listAll(); + return FormluaConfig.builder().formulas(formulaPOS).formulaVars(formulaVars).build(); + } } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index 6703fdc30..85675ca8f 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -14,6 +14,7 @@ import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam; import com.engine.salary.entity.salaryformula.po.FormulaPO; import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; +import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemExcelConfig; import com.engine.salary.entity.salaryitem.param.*; @@ -494,6 +495,12 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } } + @Override + public SalaryItemAllConfig getConfig() { + List salaryItemPOList = listByParam(SalaryItemSearchParam.builder().useInEmployeeSalary(0).build()); + return SalaryItemAllConfig.builder().salaryItems(salaryItemPOList).build(); + } + @Data @Builder @NoArgsConstructor @@ -741,10 +748,9 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService ExcelUtil.parseHeader(SalaryItemExcelConfig.class, titles, dataIndexList); - List> rows = new ArrayList<>(); rows.add(titles); - if (param.isHasData()){ + if (param.isHasData()) { List configs = getConfig(SalaryItemExportParam.builder().build()); configs.forEach(e -> { List row = new ArrayList<>(); diff --git a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java index c85257886..13a277b66 100644 --- a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java @@ -10,7 +10,10 @@ import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig; +import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryformula.ExpressFormula; +import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; +import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO; import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO; @@ -585,4 +588,5 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe return salarySobItemFormDTO; } + } diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 6fb14f13f..bc10a146b 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -80,6 +80,23 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { // return MapperProxyFactory.getProxy(SalarySobBackItemMapper.class); // } + private SalarySobItemService getSalarySobItemService(User user) { + return ServiceUtil.getService(SalarySobItemServiceImpl.class, user); + } + + private SalarySobItemGroupService getSalarySobItemGroupService(User user) { + return ServiceUtil.getService(SalarySobItemGroupServiceImpl.class, user); + } + + private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) { + return ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user); + } + + private SalarySobAdjustRuleService getSalarySobAdjustRuleService(User user) { + return ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user); + } + + private SalarySobMapper getSalarySobMapper() { return MapperProxyFactory.getProxy(SalarySobMapper.class); } @@ -284,15 +301,15 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { // 保存薪资账套 salarySobMapper.insert(salarySobPO); // 记录日志 - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId(String.valueOf(salarySobPO.getId())); - loggerContext.setTargetName(salarySobPO.getName()); - loggerContext.setOperateType(OperateTypeEnum.ADD.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新建薪资账套")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新建薪资账套") + ": " + salarySobPO.getName()); - loggerContext.setNewValues(salarySobPO); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId(String.valueOf(salarySobPO.getId())); + loggerContext.setTargetName(salarySobPO.getName()); + loggerContext.setOperateType(OperateTypeEnum.ADD.getValue()); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新建薪资账套")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新建薪资账套") + ": " + salarySobPO.getName()); + loggerContext.setNewValues(salarySobPO); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); // 新建薪资账套时,保存默认的员工信息字段 saveDefaultEmpField(salarySobPO); // 新建薪资账套时,保存默认的薪资项目 @@ -556,18 +573,18 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { salarySobPO.setUpdateTime(new Date()); salarySobMapper.updateById(salarySobPO); // 记录日志 - String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ? - SalaryI18nUtil.getI18nLabel(0, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(0, "启用薪资账套"); - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId("" + salarySobPO.getId()); - loggerContext.setTargetName(salarySobPO.getName()); - loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(operateTypeName); - loggerContext.setOperatedesc(operateTypeName + ": " + salarySobPO.getName()); - loggerContext.setOldValues(oldSalarySobPO); - loggerContext.setNewValues(salarySobPO); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ? + SalaryI18nUtil.getI18nLabel(0, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(0, "启用薪资账套"); + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + salarySobPO.getId()); + loggerContext.setTargetName(salarySobPO.getName()); + loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); + loggerContext.setOperateTypeName(operateTypeName); + loggerContext.setOperatedesc(operateTypeName + ": " + salarySobPO.getName()); + loggerContext.setOldValues(oldSalarySobPO); + loggerContext.setNewValues(salarySobPO); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); } @Override @@ -622,18 +639,18 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { getSalarySobBackItemService(user).deleteBySalarySobIds(ids); // 删除薪资账套的校验规则 getSalarySobCheckRuleService(user).deleteBySalarySobIds(ids); - // 记录日志 - salarySobPOS.forEach(salarySobPO -> { - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId("" + salarySobPO.getId()); - loggerContext.setTargetName(salarySobPO.getName()); - loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); - loggerContext.setOldValues(salarySobPO); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); - }); + // 记录日志 + salarySobPOS.forEach(salarySobPO -> { + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + salarySobPO.getId()); + loggerContext.setTargetName(salarySobPO.getName()); + loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); + loggerContext.setOldValues(salarySobPO); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + }); } @Override @@ -728,15 +745,15 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (CollectionUtils.isNotEmpty(result.getSalarySobCheckRules())) { getSalarySobCheckRuleService(user).batchSave(result.getSalarySobCheckRules()); } - // 记录日志 - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId("" + result.getSalarySob().getId()); - loggerContext.setTargetName(result.getSalarySob().getName()); - loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套") + ": " + salarySobPO.getName()); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + // 记录日志 + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + result.getSalarySob().getId()); + loggerContext.setTargetName(result.getSalarySob().getName()); + loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套") + ": " + salarySobPO.getName()); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); } @Override @@ -787,7 +804,23 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { @Override public List getConfig(Long taxAgentId) { - return getSalarySobMapper().getConfig(taxAgentId); + List salarySobPOS = getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentId(taxAgentId).build()); + return salarySobPOS.stream().map(salarySobPO -> { + Long salarySobId = salarySobPO.getId(); + List salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salarySobId); + List salarySobItemGroupPOS = getSalarySobItemGroupService(user).listBySalarySobId(salarySobId); + List salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salarySobId); + List salarySobBackItemPOS = getSalarySobBackItemService(user).listBySalarySobId(salarySobId); + List salarySobAdjustRulePOS = getSalarySobAdjustRuleService(user).listBySalarySobId(salarySobId); + return SalarySobConfig.builder() + .salarySob(salarySobPO) + .salarySobEmpFields(salarySobEmpFieldPOS) + .salarySobItemGroups(salarySobItemGroupPOS) + .salarySobItems(salarySobItemPOS) + .salarySobBackItems(salarySobBackItemPOS) + .salarySobAdjustRules(salarySobAdjustRulePOS) + .build(); + }).collect(Collectors.toList()); } diff --git a/src/com/engine/salary/sys/entity/param/uploadConfigParam.java b/src/com/engine/salary/sys/entity/param/uploadConfigParam.java new file mode 100644 index 000000000..50c2f6c9e --- /dev/null +++ b/src/com/engine/salary/sys/entity/param/uploadConfigParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.sys.entity.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 初始化薪酬配置 + *

Copyright: Copyright (c) 2024

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class uploadConfigParam { + + //上传文件id + String imageId; + +} diff --git a/src/com/engine/salary/util/xml/XStreamUtil.java b/src/com/engine/salary/util/xml/XStreamUtil.java new file mode 100644 index 000000000..d0a30e215 --- /dev/null +++ b/src/com/engine/salary/util/xml/XStreamUtil.java @@ -0,0 +1,68 @@ +package com.engine.salary.util.xml; + +import cn.hutool.core.util.StrUtil; +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.HierarchicalStreamDriver; +import com.thoughtworks.xstream.io.naming.NoNameCoder; +import com.thoughtworks.xstream.io.xml.DomDriver; +import com.thoughtworks.xstream.security.AnyTypePermission; + +import java.util.Objects; + +public class XStreamUtil { + //new NoNameCoder() 解决 _ 被序列化成 __ 的问题 + private static final NoNameCoder noNameCoder = new NoNameCoder(); + + private static XStream xStream = new XStream(new DomDriver("UTF-8", noNameCoder)); + + private static XStream getxStream(HierarchicalStreamDriver driver){ + if(Objects.isNull(driver)){ + return xStream; + } + return new XStream(driver); + } + + public static T unmarshal(String pkgName, Class cla, String xmlStr, HierarchicalStreamDriver driver) { + xStream = getxStream(driver); + + if (StrUtil.isEmpty(pkgName)) { + //高版本为了解决安全漏洞,增加了白名单机制, 如果不设置这个权限可能会报错 + xStream.addPermission(AnyTypePermission.ANY); + } else { + //设置允许解析的包,如果不想设置可以用 addPermission(AnyTypePermission.ANY) 代替 + xStream.allowTypesByWildcard(new String[]{pkgName}); + } + + //支持注解,不然使用的XStream注解不会生效且不报错 + xStream.autodetectAnnotations(true); + xStream.processAnnotations(cla); + + //忽略未知属性, 如果不添加这个,当Xml报文中出现实体中没有的属性时会报错 No such field + xStream.ignoreUnknownElements(); + + return (T) xStream.fromXML(xmlStr); + } + + public static T unmarshal(String pkgName, Class cla, String xmlStr) { + return unmarshal(pkgName, cla, xmlStr, null); + } + + public static T unmarshal(Class cla, String xmlStr) { + return unmarshal(null, cla, xmlStr, null); + } + + public static String marshal(Object o, DomDriver driver) { + xStream = getxStream(driver); + + //支持注解,不然使用的 @XStreamAlias() 注解不会生效而且不会报错 + xStream.autodetectAnnotations(true); + + //注册自定义时间转换器,使得XStream全局支持LocalDateTime, 或者不在这里注册,使用@XStreamConverter(LocalDateTimeConverter.class)注解在单一字段上 +// xStream.registerConverter(new LocalDateTimeConverter()); + return xStream.toXML(o); + } + + public static String marshal(Object o){ + return marshal(o, null); + } +} diff --git a/src/com/engine/salary/web/SalarySystemConfigController.java b/src/com/engine/salary/web/SalarySystemConfigController.java index 8b00036f4..2b80395a3 100644 --- a/src/com/engine/salary/web/SalarySystemConfigController.java +++ b/src/com/engine/salary/web/SalarySystemConfigController.java @@ -1,16 +1,15 @@ package com.engine.salary.web; import com.engine.common.util.ServiceUtil; -import com.engine.salary.sys.entity.param.AppSettingSaveParam; -import com.engine.salary.sys.entity.param.MatchEmployeeModeSaveParam; -import com.engine.salary.sys.entity.param.OrderRuleParam; -import com.engine.salary.sys.entity.param.SalarySysConfQueryParam; +import com.engine.salary.entity.config.SalaryConfig; +import com.engine.salary.sys.entity.param.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.xml.XStreamUtil; import com.engine.salary.wrapper.SalarySystemConfigWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.extern.slf4j.Slf4j; @@ -23,6 +22,14 @@ import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.io.BufferedWriter; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; import java.util.Map; @Slf4j @@ -330,33 +337,42 @@ public class SalarySystemConfigController { public Response downloadConfig(@Context HttpServletRequest request, @Context HttpServletResponse response) { try { User user = HrmUserVarify.getUser(request, response); - XSSFWorkbook workbook = getSalarySystemConfigWrapper(user).downloadConfig(queryParam); - String fileName = "累计专项附加扣除导入模板" + LocalDate.now(); + SalaryConfig salaryConfig = getSalarySystemConfigWrapper(user).downloadConfig(); + +// XStream xStream = new XStream(); +// //由于使用的注解,将自动检测注解开启 +// xStream.autodetectAnnotations(true); +// String xml = xStream.toXML(salaryConfig); + String xml = XStreamUtil.marshal(salaryConfig); + + String fileName = "薪酬配置" + LocalDate.now(); try { - fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); + fileName = URLEncoder.encode(fileName + ".xml", "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } StreamingOutput output = outputStream -> { - workbook.write(outputStream); - outputStream.flush(); + Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); + writer.write(xml); + writer.flush(); }; + + response.setContentType("application/octet-stream"); return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); } catch (Exception e) { - log.error("累计专项附加扣除导入模板异常", e); - throw e; + log.error("下载薪酬配置", e); + throw new RuntimeException("下载薪酬配置", e); } - } @POST - @Path("/downloadConfig1") + @Path("/uploadConfig") @Produces(MediaType.APPLICATION_JSON) - public String downloadConfig1(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String initConfig(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody uploadConfigParam param) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::downloadConfig); + return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param); } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index c18ba3458..9da1343ea 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -4,19 +4,18 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.config.SalaryConfig; import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; -import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; -import com.engine.salary.entity.salaryitem.param.SalaryItemExportParam; +import com.engine.salary.entity.salaryformula.config.FormluaConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.service.SalaryArchiveItemService; +import com.engine.salary.service.SalaryFormulaService; import com.engine.salary.service.SalaryItemService; import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.impl.SalaryArchiveItemServiceImpl; +import com.engine.salary.service.impl.SalaryFormulaServiceImpl; import com.engine.salary.service.impl.SalaryItemServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; -import com.engine.salary.sys.entity.param.AppSettingSaveParam; -import com.engine.salary.sys.entity.param.MatchEmployeeModeSaveParam; -import com.engine.salary.sys.entity.param.OrderRuleParam; -import com.engine.salary.sys.entity.param.SalarySysConfQueryParam; +import com.engine.salary.sys.entity.param.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; @@ -28,13 +27,16 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.xml.CompactWriter; +import com.engine.salary.util.xml.XStreamUtil; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.IOUtils; +import weaver.file.ImageFileManager; import weaver.general.BaseBean; import weaver.hrm.User; import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -65,6 +67,10 @@ public class SalarySystemConfigWrapper extends Service { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + private SalaryFormulaService getSalaryFormulaService(User user) { + return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user); + } + public Map info() { BaseBean baseBean = new BaseBean(); String log = baseBean.getPropValue("hrmSalary", "log"); @@ -194,28 +200,176 @@ public class SalarySystemConfigWrapper extends Service { getSalarySysConfService(user).saveSalarySendFeedback(param); } - public Object downloadConfig() { - XStream xStream = new XStream(); - //由于使用的注解,将自动检测注解开启 - xStream.autodetectAnnotations(true); + public SalaryConfig downloadConfig() { SalaryConfig salaryConfig = new SalaryConfig(); - List salaryItemConfigs = getSalaryItemService(user).getAllConfig(SalaryItemExportParam.builder().build()); - salaryConfig.setSalaryItemConfigs(salaryItemConfigs); - List archiveFieldConfigs = getSalaryArchiveItemService(user).getAllConfig(); - salaryConfig.setArchiveFieldConfig(archiveFieldConfigs); + + FormluaConfig formluaConfig = getSalaryFormulaService(user).getFormluaConfig(); + salaryConfig.setFormluaConfig(formluaConfig); + + SalaryItemAllConfig salaryItemConfig = getSalaryItemService(user).getConfig(); + salaryConfig.setSalaryItemConfig(salaryItemConfig); + + ArchiveFieldConfig archiveFieldConfig = getSalaryArchiveItemService(user).getConfig(); + salaryConfig.setArchiveFieldConfigs(archiveFieldConfig); List taxAgentConfigs = getTaxAgentService(user).getAllConfig(); salaryConfig.setTaxAgentConfigs(taxAgentConfigs); - String xml = xStream.toXML(salaryConfig); - System.out.println(xml); - Writer writer = new StringWriter(); - xStream.marshal(xml, new CompactWriter(writer)); - OutputStream output = new ByteArrayOutputStream(); - xStream.marshal(xml, new CompactWriter(new OutputStreamWriter(output))); - return s; + return salaryConfig; + } + public void uploadConfig(uploadConfigParam param) { + Date now = new Date(); + InputStream fileInputStream = null; + try { + fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); + Reader reader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8); + BufferedReader bufferedReader = new BufferedReader(reader); + String line; + StringBuilder xml = new StringBuilder(); + while ((line = bufferedReader.readLine()) != null) { + xml.append(line); + } + + SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString()); + System.out.println(config); + +// List configs = ExcelParseHelper.parse2Map(fileInputStream, SalaryItemExcelConfig.class, 0, 1, 13, EXCEL_TYPE_XLSX); +// +// // 错误excel内容 +// ImportExcelResponse response = ImportExcelResponse.builder().totalCount(configs.size()).successCount(configs.size()).errorCount(0).errorData(new ArrayList<>()).build(); +// +// List sysSalaryItemPOS = sysSalaryItemBiz.listAll(); +// Set sysItems = SalaryEntityUtil.properties(sysSalaryItemPOS, SysSalaryItemPO::getName); +// +// List adds = new ArrayList<>(); +// List updates = new ArrayList<>(); +// Map> formulaItems = new HashMap<>(); +// for (int i = 0; i < configs.size(); i++) { +// String rowIndex = String.format("第%s行", i + 2); +// SalaryItemExcelConfig config = configs.get(i); +// String name = config.getName(); +// SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByDefaultLabel(config.getValueType()); +// SalaryDataTypeEnum salaryDataTypeEnum = SalaryDataTypeEnum.parseByValue(config.getDataType()); +// SalaryItemPO itemPO = getByName(name); +// if (itemPO == null) { +// +// if (sysItems.contains(name)) { +// ImportExcelResponse.Error error = ImportExcelResponse.Error.builder().message(String.format("%s“%s”的名称与系统名称冲突", rowIndex, name)).build(); +// response.setSuccessCount(response.getSuccessCount() - 1); +// response.setErrorCount(response.getErrorCount() + 1); +// response.getErrorData().add(error); +// continue; +// } +// +// itemPO = SalaryItemPO.builder() +// .id(IdGenerator.generate()) +// .code(IdGenerator.getUUID()) +// .name(name) +// .systemType(SalarySystemTypeEnum.CUSTOM.getValue()) +// .sysSalaryItemId(org.apache.commons.lang3.math.NumberUtils.LONG_ZERO) +// .useDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getUseDefault()).getValue()) +// .useInEmployeeSalary(SalaryOnOffEnum.OFF.getValue()) +// .hideDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getHideDefault()).getValue()) +// .roundingMode(SalaryRoundingModeEnum.parseByDefaultLabel(config.getRoundingMode()).getValue()) +// .pattern(NumberUtil.isNumber(config.getPattern()) ? Integer.parseInt(config.getPattern()) : 2) +// .valueType(salaryValueTypeEnum.getValue()) +// .dataType(salaryDataTypeEnum.getValue()) +// //后补 +// .formulaId(0L) +// .description(config.getDescription()) +// .canEdit(org.apache.commons.lang3.math.NumberUtils.INTEGER_ONE) +// .creator((long) user.getUID()) +// .deleteType(0) +// .createTime(now) +// .updateTime(now) +// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) +// .sharedType(0) +// .taxAgentIds("") +// .sortedIndex(NumberUtil.isNumber(config.getSortedIndex()) ? Integer.parseInt(config.getSortedIndex()) : null) +// .width(NumberUtil.isNumber(config.getWidth()) ? Integer.parseInt(config.getWidth()) : null) +// .defaultValue(config.getDefaultValue()) +// .build(); +// adds.add(itemPO); +// } else { +// +// if (SalarySystemTypeEnum.parseByValue(itemPO.getSystemType()) == SalarySystemTypeEnum.SYSTEM) { +// ImportExcelResponse.Error error = ImportExcelResponse.Error.builder().message(String.format("%s“%s”是系统薪资项目不支持修改", rowIndex, name)).build(); +// response.setSuccessCount(response.getSuccessCount() - 1); +// response.setErrorCount(response.getErrorCount() + 1); +// response.getErrorData().add(error); +// continue; +// } +// +// itemPO.setUseDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getUseDefault()).getValue()); +// itemPO.setHideDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getHideDefault()).getValue()); +// itemPO.setRoundingMode(SalaryRoundingModeEnum.parseByDefaultLabel(config.getRoundingMode()).getValue()); +// itemPO.setPattern(NumberUtil.isNumber(config.getPattern()) ? Integer.parseInt(config.getPattern()) : 2); +// itemPO.setValueType(salaryValueTypeEnum.getValue()); +// itemPO.setDataType(salaryDataTypeEnum.getValue()); +// //后补 +// itemPO.setFormulaId(0L); +// itemPO.setDescription(config.getDescription()); +// itemPO.setUpdateTime(now); +// itemPO.setSortedIndex(NumberUtil.isNumber(config.getSortedIndex()) ? Integer.parseInt(config.getSortedIndex()) : null); +// itemPO.setWidth(NumberUtil.isNumber(config.getWidth()) ? Integer.parseInt(config.getWidth()) : null); +// itemPO.setDefaultValue(config.getDefaultValue()); +// updates.add(itemPO); +// } +// +// //解析公式 +// if (salaryValueTypeEnum == SalaryValueTypeEnum.FORMULA || salaryValueTypeEnum == SalaryValueTypeEnum.SQL) { +// Long id = itemPO.getId(); +// String formula = config.getFormula(); +// String sqlReturnKey = config.getSqlReturnKey(); +// Map map = new HashMap<>(); +// map.put("rowIndex", rowIndex); +// map.put("formula", formula); +// map.put("sqlReturnKey", sqlReturnKey); +// formulaItems.put(id, map); +// } +// } +// +// adds.forEach(getSalaryItemMapper()::insertIgnoreNull); +// updates.forEach(getSalaryItemMapper()::updateIgnoreNull); +// +// for (Long id : formulaItems.keySet()) { +// SalaryItemPO itemPO = getById(id); +// Map map = formulaItems.get(id); +// String rowIndex = map.get("rowIndex"); +// String formula = map.get("formula"); +// String sqlReturnKey = map.get("sqlReturnKey"); +// SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(itemPO.getValueType()); +// SalaryDataTypeEnum salaryDataTypeEnum = SalaryDataTypeEnum.parseByValue(itemPO.getDataType()); +// SalaryFormulaSaveParam saveParam = SalaryFormulaSaveParam.builder() +// .name(itemPO.getName()) +// .module("salary") +// .useFor("salaryitem") +// .referenceType(salaryValueTypeEnum == SalaryValueTypeEnum.FORMULA ? ReferenceTypeEnum.FORMULA.getValue() : ReferenceTypeEnum.SQL.getValue()) +// .returnType(salaryDataTypeEnum == SalaryDataTypeEnum.STRING ? ReturnTypeEnum.STRING.getValue() : ReturnTypeEnum.NUMBER.getValue()) +// .validateType(salaryDataTypeEnum == SalaryDataTypeEnum.STRING ? ReturnTypeEnum.STRING.getValue() : ReturnTypeEnum.NUMBER.getValue()) +// .extendParam("{\"isCustomFunction\":\"0\",\"sqlReturnKey\":\"" + sqlReturnKey + "\",\"openDecrypt\":\"0\",\"datasource\":{\"datasourceId\":\"\"}}") +// .formula(formula) +// .build(); +// +// try { +// FormulaPO formulaPO = getSalaryFormulaService(user).save(saveParam); +// itemPO.setFormulaId(formulaPO.getId()); +// getSalaryItemMapper().updateIgnoreNull(itemPO); +// } catch (Exception e) { +// ImportExcelResponse.Error error = ImportExcelResponse.Error.builder().message(String.format("%s“%s”的公式设置有误:%s", rowIndex, itemPO.getName(), e.getMessage())).build(); +// response.setSuccessCount(response.getSuccessCount() - 1); +// response.setErrorCount(response.getErrorCount() + 1); +// response.getErrorData().add(error); +// } +// } +// return response; + } catch (IOException e) { + e.printStackTrace(); + } finally { + IOUtils.closeQuietly(fileInputStream); + } } } From 6532225da3d05294cf055c1d88deceacb7dd84cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 8 Aug 2024 18:04:50 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/entity/config/SalaryConfig.java | 2 +- .../service/SalaryArchiveItemService.java | 2 ++ .../salary/service/SalaryFormulaService.java | 3 +- .../salary/service/SalaryItemService.java | 2 ++ .../impl/SalaryArchiveItemServiceImpl.java | 7 ++++ .../impl/SalaryFormulaServiceImpl.java | 30 +++++++++++++++- .../service/impl/SalaryItemServiceImpl.java | 34 ++++++++++++++++--- .../wrapper/SalarySystemConfigWrapper.java | 19 ++++++++--- 8 files changed, 86 insertions(+), 13 deletions(-) diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index 8958b03f9..5203a2ed2 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -40,7 +40,7 @@ public class SalaryConfig { //字段管理 @XStreamAlias("ArchiveFieldConfig") - private ArchiveFieldConfig archiveFieldConfigs; + private ArchiveFieldConfig archiveFieldConfig; //扣缴义务人 @XStreamImplicit diff --git a/src/com/engine/salary/service/SalaryArchiveItemService.java b/src/com/engine/salary/service/SalaryArchiveItemService.java index 573aa0aa3..0489b7ce6 100644 --- a/src/com/engine/salary/service/SalaryArchiveItemService.java +++ b/src/com/engine/salary/service/SalaryArchiveItemService.java @@ -160,4 +160,6 @@ public interface SalaryArchiveItemService { ArchiveFieldConfig getConfig(); + + void parseConfig(ArchiveFieldConfig config); } diff --git a/src/com/engine/salary/service/SalaryFormulaService.java b/src/com/engine/salary/service/SalaryFormulaService.java index 2fbe3f3d4..56e287ea9 100644 --- a/src/com/engine/salary/service/SalaryFormulaService.java +++ b/src/com/engine/salary/service/SalaryFormulaService.java @@ -58,5 +58,6 @@ public interface SalaryFormulaService { void update(FormulaPO formulaPO); - FormluaConfig getFormluaConfig(); + FormluaConfig getConfig(); + void parseConfig(FormluaConfig config); } diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index b2edbbc7f..e10090439 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -153,6 +153,7 @@ public interface SalaryItemService { void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam); SalaryItemAllConfig getConfig(); + void parseConfig(SalaryItemAllConfig salaryItemConfig); List getConfig(SalaryItemExportParam param); @@ -165,4 +166,5 @@ public interface SalaryItemService { XSSFWorkbook export(SalaryItemExportParam param); XSSFWorkbook downloadTemplate(SalaryItemDownloadTemplateParam param); + } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 74ae1de51..3bc93be56 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -744,4 +744,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi return ArchiveFieldConfig.builder().salaryItems(salaryItemPOList).build(); } + @Override + public void parseConfig(ArchiveFieldConfig config) { + + Optional.ofNullable(config.getSalaryItems()).orElse(new ArrayList<>()) + .forEach(); + } + } diff --git a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java index 9a32da966..3da81da93 100644 --- a/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryFormulaServiceImpl.java @@ -20,6 +20,7 @@ import com.engine.salary.service.FormulaRunService; import com.engine.salary.service.RemoteExcelService; import com.engine.salary.service.SalaryFormulaService; import com.engine.salary.util.JsonUtil; +import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; @@ -403,9 +404,36 @@ public class SalaryFormulaServiceImpl extends Service implements SalaryFormulaSe } @Override - public FormluaConfig getFormluaConfig() { + public FormluaConfig getConfig() { List formulaPOS = getFormulaMapper().listAll(); List formulaVars = getFormulaVarMapper().listAll(); return FormluaConfig.builder().formulas(formulaPOS).formulaVars(formulaVars).build(); } + + @Override + public void parseConfig(FormluaConfig config) { + List formulaPOS = getFormulaMapper().listAll(); + Set formulas = SalaryEntityUtil.properties(formulaPOS, FormulaPO::getId); + + Optional.ofNullable(config.getFormulas()) + .orElse(new ArrayList<>()) + .forEach(formulaPO -> { + Long id = formulaPO.getId(); + if (!formulas.contains(id)) { + getFormulaMapper().insertIgnoreNull(formulaPO); + } + }); + + List formulaVarPOs = getFormulaVarMapper().listAll(); + Set formulaVars = SalaryEntityUtil.properties(formulaVarPOs, FormulaVar::getId); + Optional.ofNullable(config.getFormulaVars()) + .orElse(new ArrayList<>()) + .forEach(po -> { + Long id = po.getId(); + if (!formulaVars.contains(id)) { + getFormulaVarMapper().insertIgnoreNull(po); + } + }); + + } } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index 85675ca8f..b6e851a91 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -495,11 +495,6 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } } - @Override - public SalaryItemAllConfig getConfig() { - List salaryItemPOList = listByParam(SalaryItemSearchParam.builder().useInEmployeeSalary(0).build()); - return SalaryItemAllConfig.builder().salaryItems(salaryItemPOList).build(); - } @Data @Builder @@ -772,4 +767,33 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } return ExcelUtil.genWorkbookV2(rows, "薪资项目"); } + + @Override + public SalaryItemAllConfig getConfig() { + List salaryItemPOList = listByParam(SalaryItemSearchParam.builder().useInEmployeeSalary(0).build()); + return SalaryItemAllConfig.builder().salaryItems(salaryItemPOList).build(); + } + + @Override + public void parseConfig(SalaryItemAllConfig salaryItemConfig) { + List salaryItemPOList = listAll(); + Set ids = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getId); + Set names = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getName); + Set codes = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getCode); + + Optional.ofNullable(salaryItemConfig.getSalaryItems()) + .orElse(new ArrayList<>()) + .forEach(itemPO -> { + //todo 异常提示 + if (ids.contains(itemPO.getId())) { + + }else if(names.contains(itemPO.getName())){ + + }else if(codes.contains(itemPO.getCode())){ + + }else { + getSalaryItemMapper().insertIgnoreNull(itemPO); + } + }) + } } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 9da1343ea..764abe18d 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -36,7 +36,6 @@ import weaver.hrm.User; import java.io.*; import java.nio.charset.StandardCharsets; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -205,14 +204,14 @@ public class SalarySystemConfigWrapper extends Service { SalaryConfig salaryConfig = new SalaryConfig(); - FormluaConfig formluaConfig = getSalaryFormulaService(user).getFormluaConfig(); + FormluaConfig formluaConfig = getSalaryFormulaService(user).getConfig(); salaryConfig.setFormluaConfig(formluaConfig); SalaryItemAllConfig salaryItemConfig = getSalaryItemService(user).getConfig(); salaryConfig.setSalaryItemConfig(salaryItemConfig); ArchiveFieldConfig archiveFieldConfig = getSalaryArchiveItemService(user).getConfig(); - salaryConfig.setArchiveFieldConfigs(archiveFieldConfig); + salaryConfig.setArchiveFieldConfig(archiveFieldConfig); List taxAgentConfigs = getTaxAgentService(user).getAllConfig(); salaryConfig.setTaxAgentConfigs(taxAgentConfigs); @@ -221,7 +220,6 @@ public class SalarySystemConfigWrapper extends Service { } public void uploadConfig(uploadConfigParam param) { - Date now = new Date(); InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); @@ -234,7 +232,18 @@ public class SalarySystemConfigWrapper extends Service { } SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString()); - System.out.println(config); + + FormluaConfig formluaConfig = config.getFormluaConfig(); + getSalaryFormulaService(user).parseConfig(formluaConfig); + + SalaryItemAllConfig salaryItemConfig = config.getSalaryItemConfig(); + getSalaryItemService(user).parseConfig(salaryItemConfig); + + ArchiveFieldConfig archiveFieldConfig = config.getArchiveFieldConfig(); + getSalaryArchiveItemService(user).parseConfig(archiveFieldConfig); + + List taxAgentConfigs = config.getTaxAgentConfigs(); + // List configs = ExcelParseHelper.parse2Map(fileInputStream, SalaryItemExcelConfig.class, 0, 1, 13, EXCEL_TYPE_XLSX); // From dd257ec53e700a668f02aeffc608d60dc1d87930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 9 Aug 2024 09:22:27 +0800 Subject: [PATCH 11/23] =?UTF-8?q?xml=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/entity/config/SalaryConfig.java | 4 + .../salarysob/config/SalarySobConfig.java | 2 +- .../entity/salarysob/po/SalarySobPO.java | 6 +- .../taxagent/config/TaxAgentConfig.java | 33 +--- .../entity/taxagent/po/TaxAgentBasePO.java | 18 ++ .../salary/entity/taxagent/po/TaxAgentPO.java | 35 +++- .../salary/service/SalarySobService.java | 2 + .../salary/service/TaxAgentBaseService.java | 4 + .../salary/service/TaxAgentService.java | 4 +- .../impl/SalaryArchiveItemServiceImpl.java | 26 ++- .../service/impl/SalaryItemServiceImpl.java | 2 +- .../service/impl/SalarySobServiceImpl.java | 55 ++++++ .../service/impl/TaxAgentBaseServiceImpl.java | 29 ++++ .../service/impl/TaxAgentServiceImpl.java | 49 ++++-- .../wrapper/SalarySystemConfigWrapper.java | 162 ++---------------- 15 files changed, 230 insertions(+), 201 deletions(-) diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index 5203a2ed2..c1bba915d 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -4,6 +4,7 @@ import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; @@ -42,6 +43,9 @@ public class SalaryConfig { @XStreamAlias("ArchiveFieldConfig") private ArchiveFieldConfig archiveFieldConfig; + @XStreamAlias("TaxAgentBaseConfig") + private TaxAgentBasePO taxAgentBaseConfig; + //扣缴义务人 @XStreamImplicit private List taxAgentConfigs; diff --git a/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java b/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java index 12d0455c8..b367cc5cf 100644 --- a/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java +++ b/src/com/engine/salary/entity/salarysob/config/SalarySobConfig.java @@ -17,7 +17,7 @@ import java.util.List; @XStreamAlias("SalarySobConfig") public class SalarySobConfig { - @XStreamAlias("salarySob") + @XStreamAlias("SalarySob") private SalarySobPO salarySob; @XStreamImplicit diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java index b75eb5976..231d6f866 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java @@ -4,6 +4,7 @@ import com.engine.hrmelog.annotation.ElogTransform; import com.engine.salary.util.valid.Compare; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamOmitField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -23,7 +24,7 @@ import java.util.Date; @AllArgsConstructor @ElogTransform( name="薪资账套" ) //hrsa_salary_sob -@XStreamAlias("SalarySobPO") +@XStreamAlias("SalarySob") public class SalarySobPO { /** @@ -31,8 +32,7 @@ public class SalarySobPO { */ @ElogTransform( name="主键" ) @Compare - @XStreamAlias("id") - @XStreamAsAttribute + @XStreamOmitField private Long id; /** diff --git a/src/com/engine/salary/entity/taxagent/config/TaxAgentConfig.java b/src/com/engine/salary/entity/taxagent/config/TaxAgentConfig.java index d22426bde..be17791cd 100644 --- a/src/com/engine/salary/entity/taxagent/config/TaxAgentConfig.java +++ b/src/com/engine/salary/entity/taxagent/config/TaxAgentConfig.java @@ -1,8 +1,8 @@ package com.engine.salary.entity.taxagent.config; import com.engine.salary.entity.salarysob.config.SalarySobConfig; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.thoughtworks.xstream.annotations.XStreamAlias; -import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; import lombok.Builder; @@ -18,35 +18,8 @@ import java.util.List; @XStreamAlias("TaxAgentConfig") public class TaxAgentConfig { - /** - * 主键id - */ - @XStreamAlias("id") - @XStreamAsAttribute - private Long id; - - /** - * 名称 - */ - @XStreamAlias("name") - @XStreamAsAttribute - private String name; - - - /** - * 备注 - */ - @XStreamAlias("description") - @XStreamAsAttribute - private String description; - - - /** - * 排序 - */ - @XStreamAlias("sortedIndex") - @XStreamAsAttribute - private Integer sortedIndex; + @XStreamAlias("TaxAgent") + private TaxAgentPO taxAgent; //薪资账套 @XStreamImplicit diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java index 6930031f9..58e02c10e 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java @@ -1,5 +1,7 @@ package com.engine.salary.entity.taxagent.po; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,41 +23,57 @@ import java.util.Date; @NoArgsConstructor @AllArgsConstructor //hrsa_tax_agent_base") +@XStreamAlias("TaxAgentBase") public class TaxAgentBasePO { /** * 主键id */ + @XStreamAlias("id") + @XStreamAsAttribute private Long id; /** * 分权开关 */ + @XStreamAlias("devolutionStatus") + @XStreamAsAttribute private Integer devolutionStatus; /** * 租户key */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; /** * 创建人id */ + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java index 819bf3aaf..65b688baa 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java @@ -1,6 +1,9 @@ package com.engine.salary.entity.taxagent.po; import com.engine.hrmelog.annotation.ElogTransform; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamOmitField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -24,64 +27,86 @@ import java.util.Date; //hrsa_tax_agent") //个税扣缴义务人表") @ElogTransform(name = "个税扣缴义务人") +@XStreamAlias("TaxAgent") public class TaxAgentPO { /** * 主键id */ @ElogTransform(name = "主键id") + @XStreamOmitField private Long id; /** * 名称 */ @ElogTransform(name = "名称") + @XStreamAlias("name") + @XStreamAsAttribute private String name; /** * 代缴机构 */ // @ElogTransform(name = "代缴机构") + @XStreamAlias("paymentAgency") + @XStreamAsAttribute private String paymentAgency; + + /** + * 排序 + */ + @XStreamAlias("sortedIndex") + @XStreamAsAttribute + private Integer sortedIndex; + /** * 备注 */ @ElogTransform(name = "备注") + @XStreamAlias("description") + @XStreamAsAttribute private String description; /** * 租户key */ + @XStreamAlias("tenantKey") + @XStreamAsAttribute private String tenantKey; /** * 创建人id */ @ElogTransform(name = "创建人id") + @XStreamAlias("creator") + @XStreamAsAttribute private Long creator; /** * 是否删除 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ @ElogTransform(name = "创建时间") + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 更新时间 */ - @ElogTransform(name = "更新时间") + @ElogTransform(name = "updateTime") + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; - /** - * 排序 - */ - private Integer sortedIndex; private Collection ids; } diff --git a/src/com/engine/salary/service/SalarySobService.java b/src/com/engine/salary/service/SalarySobService.java index cd2689cc0..7fed5ee31 100644 --- a/src/com/engine/salary/service/SalarySobService.java +++ b/src/com/engine/salary/service/SalarySobService.java @@ -157,4 +157,6 @@ public interface SalarySobService { List listByTaxAgentIds(Collection taxAgentIds); List getConfig(Long taxAgentId); + + void parseConfig(Long taxAgentId, List salarySobConfigs); } diff --git a/src/com/engine/salary/service/TaxAgentBaseService.java b/src/com/engine/salary/service/TaxAgentBaseService.java index ab795d52c..6c70f4e4a 100644 --- a/src/com/engine/salary/service/TaxAgentBaseService.java +++ b/src/com/engine/salary/service/TaxAgentBaseService.java @@ -34,4 +34,8 @@ public interface TaxAgentBaseService { * @return */ String save(TaxAgentSaveBaseParam saveBaseParam); + + TaxAgentBasePO getConfig(); + + void parseConfig(TaxAgentBasePO config); } diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java index 65ac2c77c..db580e8a0 100644 --- a/src/com/engine/salary/service/TaxAgentService.java +++ b/src/com/engine/salary/service/TaxAgentService.java @@ -261,5 +261,7 @@ public interface TaxAgentService { Collection listEmployeeIdsInTaxAgent(Long taxAgentId); - List getAllConfig(); + List getConfig(); + + void parseConfig(List configs); } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 3bc93be56..a40d8f8eb 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.SalaryArchiveBiz; @@ -23,6 +24,7 @@ import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.archive.SalaryArchiveItemMapper; +import com.engine.salary.mapper.salaryitem.SalaryItemMapper; import com.engine.salary.service.*; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -60,6 +62,10 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi return MapperProxyFactory.getProxy(SalaryArchiveItemMapper.class); } + private SalaryItemMapper getSalaryItemMapper() { + return SqlProxyHandle.getProxy(SalaryItemMapper.class); + } + @Override public SalaryArchiveItemPO getById(Long salaryArchiveItemId) { @@ -746,9 +752,25 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi @Override public void parseConfig(ArchiveFieldConfig config) { + List salaryItemPOList = getSalaryItemService(user).listAll(); + Set ids = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getId); + Set names = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getName); + Set codes = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getCode); - Optional.ofNullable(config.getSalaryItems()).orElse(new ArrayList<>()) - .forEach(); + Optional.ofNullable(config.getSalaryItems()) + .orElse(new ArrayList<>()) + .forEach(itemPO -> { + //todo 异常提示 + if (ids.contains(itemPO.getId())) { + + }else if(names.contains(itemPO.getName())){ + + }else if(codes.contains(itemPO.getCode())){ + + }else { + getSalaryItemMapper().insertIgnoreNull(itemPO); + } + }); } } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index b6e851a91..04ca27940 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -794,6 +794,6 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService }else { getSalaryItemMapper().insertIgnoreNull(itemPO); } - }) + }); } } diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index bc10a146b..06af17fad 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -823,6 +823,61 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { }).collect(Collectors.toList()); } + @Override + public void parseConfig(Long taxAgentId, List salarySobConfigs) { + long uid = user.getUID(); + List salarySobPOS = listByTaxAgentId(taxAgentId); + Map sobPOMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getName); + + Optional.ofNullable(salarySobConfigs) + .orElse(new ArrayList<>()) + .forEach(salarySobConfig -> { + SalarySobPO salarySobPO = salarySobConfig.getSalarySob(); + String sobPOName = salarySobPO.getName(); + if (sobPOMap.containsKey(sobPOName)) { + salarySobPO = sobPOMap.get(sobPOName); + } else { + salarySobPO.setCreator(uid); + getSalarySobMapper().insertIgnoreNull(salarySobPO); + } + + List salarySobItems = salarySobConfig.getSalarySobItems(); + for (SalarySobItemPO salarySobItem : salarySobItems) { + salarySobItem.setSalarySobId(salarySobPO.getId()); + salarySobItem.setCreator(uid); + } + getSalarySobItemService(user).batchSave(salarySobItems); + + List salarySobEmpFields = salarySobConfig.getSalarySobEmpFields(); + for (SalarySobEmpFieldPO salarySobEmpField : salarySobEmpFields) { + salarySobEmpField.setSalarySobId(salarySobPO.getId()); + salarySobEmpField.setCreator(uid); + } + getSalarySobEmpFieldService(user).batchSave(salarySobEmpFields); + + List salarySobItemGroups = salarySobConfig.getSalarySobItemGroups(); + for (SalarySobItemGroupPO salarySobItemGroup : salarySobItemGroups) { + salarySobItemGroup.setSalarySobId(salarySobPO.getId()); + salarySobItemGroup.setCreator(uid); + } + getSalarySobItemGroupService(user).batchSave(salarySobItemGroups); + + List salarySobBackItems = salarySobConfig.getSalarySobBackItems(); + for (SalarySobBackItemPO salarySobBackItem : salarySobBackItems) { + salarySobBackItem.setSalarySobId(salarySobPO.getId()); + salarySobBackItem.setCreator(uid); + } + getSalarySobBackItemService(user).batchInsert(salarySobBackItems); + + List salarySobAdjustRules = salarySobConfig.getSalarySobAdjustRules(); + for (SalarySobAdjustRulePO salarySobAdjustRule : salarySobAdjustRules) { + salarySobAdjustRule.setSalarySobId(salarySobPO.getId()); + salarySobAdjustRule.setCreator(uid); + } + getSalarySobAdjustRuleService(user).batchSave(salarySobAdjustRules); + }); + } + public List filterByAdmin(List salarySobPOS) { long employeeId = user.getUID(); diff --git a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java index d31a2a6de..b851cbeab 100644 --- a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java @@ -95,6 +95,35 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ return StringUtils.EMPTY; } + @Override + public TaxAgentBasePO getConfig() { + Date now = new Date(); + TaxAgentBasePO baseInfo = getBaseInfo(); + if (baseInfo == null) { + baseInfo = TaxAgentBasePO.builder() + .id(IdGenerator.generate()) + .devolutionStatus(0) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); + } + return baseInfo; + } + + @Override + public void parseConfig(TaxAgentBasePO config) { + TaxAgentBasePO baseInfo = getBaseInfo(); + if (baseInfo == null) { + config.setCreator((long) user.getUID()); + getTaxAgentBaseMapper().insertIgnoreNull(config); + }else { + baseInfo.setDevolutionStatus(config.getDevolutionStatus()); + getTaxAgentBaseMapper().updateIgnoreNull(baseInfo); + } + } + /** * 检查是否有未归档数据 * diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index 9c004b049..4afc39341 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -475,7 +475,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { getTaxAgentMapper().deleteByIds(ids); // 记录日志 - taxAgents.forEach(e ->{ + taxAgents.forEach(e -> { LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setUser(user); loggerContext.setTargetId(e.getId().toString()); @@ -504,12 +504,12 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { } // 被社保福利档案引用 List socialByPaymentOrganization = getInsuranceBaseInfoMapper().getSocialByPaymentOrganization(id); - if(CollectionUtils.isNotEmpty(socialByPaymentOrganization)){ + if (CollectionUtils.isNotEmpty(socialByPaymentOrganization)) { throw new SalaryRunTimeException("存在社保福利档案引用"); } // 被社保福利台账引用 List insuranceArchiveList = getInsuranceAccountBatchMapper().list(InsuranceAccountBatchParam.builder().taxAgents(Collections.singletonList(id)).build()); - if(CollectionUtils.isNotEmpty(insuranceArchiveList)){ + if (CollectionUtils.isNotEmpty(insuranceArchiveList)) { throw new SalaryRunTimeException("存在社保福利台账引用"); } //被社保福利档案引用 @@ -796,22 +796,47 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { } - @Override public Collection listEmployeeIdsInTaxAgent(Long taxAgentId) { - List taxAgentEmpPOS = getTaxAgentEmpService(user).listByTaxAgentIds(Collections.singletonList(taxAgentId),UseEmployeeTypeEnum.ALL); + List taxAgentEmpPOS = getTaxAgentEmpService(user).listByTaxAgentIds(Collections.singletonList(taxAgentId), UseEmployeeTypeEnum.ALL); return SalaryEntityUtil.properties(taxAgentEmpPOS, TaxAgentEmpPO::getEmployeeId); } @Override - public List getAllConfig() { - List allConfig = getTaxAgentMapper().getAllConfig(); - allConfig.forEach(config->{ - List sobConfigs = getSalarySobService(user).getConfig(config.getId()); - config.setSalarySobConfigs(sobConfigs); - }); - return allConfig; + public List getConfig() { + List taxAgentPOS = getTaxAgentMapper().listAll(); + return taxAgentPOS.stream() + .map(taxAgentPO -> { + List sobConfigs = getSalarySobService(user).getConfig(taxAgentPO.getId()); + return TaxAgentConfig.builder().taxAgent(taxAgentPO).salarySobConfigs(sobConfigs).build(); + }) + .collect(Collectors.toList()); + } + + @Override + public void parseConfig(List configs) { + List taxAgentPOS = listAll(); + Map agentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getName); + + Optional.ofNullable(configs) + .orElse(new ArrayList<>()) + .forEach(config -> { + TaxAgentPO taxAgent = config.getTaxAgent(); + String name = taxAgent.getName(); + if (agentPOMap.containsKey(name)) { + //存在扣缴义务人 + taxAgent = agentPOMap.get(name); + } else { + //新增扣缴义务人 + taxAgent.setId(null); + taxAgent.setCreator((long) user.getUID()); + getTaxAgentMapper().insertIgnoreNull(taxAgent); + } + + getSalarySobService(user).parseConfig(taxAgent.getId(), config.getSalarySobConfigs()); + + }); } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 764abe18d..eb25f376b 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -7,14 +7,9 @@ import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; -import com.engine.salary.service.SalaryArchiveItemService; -import com.engine.salary.service.SalaryFormulaService; -import com.engine.salary.service.SalaryItemService; -import com.engine.salary.service.TaxAgentService; -import com.engine.salary.service.impl.SalaryArchiveItemServiceImpl; -import com.engine.salary.service.impl.SalaryFormulaServiceImpl; -import com.engine.salary.service.impl.SalaryItemServiceImpl; -import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import com.engine.salary.service.*; +import com.engine.salary.service.impl.*; import com.engine.salary.sys.entity.param.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; @@ -70,6 +65,10 @@ public class SalarySystemConfigWrapper extends Service { return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user); } + private TaxAgentBaseService getTaxAgentBaseService(User user) { + return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user); + } + public Map info() { BaseBean baseBean = new BaseBean(); String log = baseBean.getPropValue("hrmSalary", "log"); @@ -213,7 +212,10 @@ public class SalarySystemConfigWrapper extends Service { ArchiveFieldConfig archiveFieldConfig = getSalaryArchiveItemService(user).getConfig(); salaryConfig.setArchiveFieldConfig(archiveFieldConfig); - List taxAgentConfigs = getTaxAgentService(user).getAllConfig(); + TaxAgentBasePO taxAgentBaseConfig = getTaxAgentBaseService(user).getConfig(); + salaryConfig.setTaxAgentBaseConfig(taxAgentBaseConfig); + + List taxAgentConfigs = getTaxAgentService(user).getConfig(); salaryConfig.setTaxAgentConfigs(taxAgentConfigs); return salaryConfig; @@ -233,148 +235,16 @@ public class SalarySystemConfigWrapper extends Service { SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString()); - FormluaConfig formluaConfig = config.getFormluaConfig(); - getSalaryFormulaService(user).parseConfig(formluaConfig); + getSalaryFormulaService(user).parseConfig(config.getFormluaConfig()); - SalaryItemAllConfig salaryItemConfig = config.getSalaryItemConfig(); - getSalaryItemService(user).parseConfig(salaryItemConfig); + getSalaryItemService(user).parseConfig(config.getSalaryItemConfig()); - ArchiveFieldConfig archiveFieldConfig = config.getArchiveFieldConfig(); - getSalaryArchiveItemService(user).parseConfig(archiveFieldConfig); + getSalaryArchiveItemService(user).parseConfig(config.getArchiveFieldConfig()); - List taxAgentConfigs = config.getTaxAgentConfigs(); + getTaxAgentBaseService(user).parseConfig(config.getTaxAgentBaseConfig()); + getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs()); -// List configs = ExcelParseHelper.parse2Map(fileInputStream, SalaryItemExcelConfig.class, 0, 1, 13, EXCEL_TYPE_XLSX); -// -// // 错误excel内容 -// ImportExcelResponse response = ImportExcelResponse.builder().totalCount(configs.size()).successCount(configs.size()).errorCount(0).errorData(new ArrayList<>()).build(); -// -// List sysSalaryItemPOS = sysSalaryItemBiz.listAll(); -// Set sysItems = SalaryEntityUtil.properties(sysSalaryItemPOS, SysSalaryItemPO::getName); -// -// List adds = new ArrayList<>(); -// List updates = new ArrayList<>(); -// Map> formulaItems = new HashMap<>(); -// for (int i = 0; i < configs.size(); i++) { -// String rowIndex = String.format("第%s行", i + 2); -// SalaryItemExcelConfig config = configs.get(i); -// String name = config.getName(); -// SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByDefaultLabel(config.getValueType()); -// SalaryDataTypeEnum salaryDataTypeEnum = SalaryDataTypeEnum.parseByValue(config.getDataType()); -// SalaryItemPO itemPO = getByName(name); -// if (itemPO == null) { -// -// if (sysItems.contains(name)) { -// ImportExcelResponse.Error error = ImportExcelResponse.Error.builder().message(String.format("%s“%s”的名称与系统名称冲突", rowIndex, name)).build(); -// response.setSuccessCount(response.getSuccessCount() - 1); -// response.setErrorCount(response.getErrorCount() + 1); -// response.getErrorData().add(error); -// continue; -// } -// -// itemPO = SalaryItemPO.builder() -// .id(IdGenerator.generate()) -// .code(IdGenerator.getUUID()) -// .name(name) -// .systemType(SalarySystemTypeEnum.CUSTOM.getValue()) -// .sysSalaryItemId(org.apache.commons.lang3.math.NumberUtils.LONG_ZERO) -// .useDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getUseDefault()).getValue()) -// .useInEmployeeSalary(SalaryOnOffEnum.OFF.getValue()) -// .hideDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getHideDefault()).getValue()) -// .roundingMode(SalaryRoundingModeEnum.parseByDefaultLabel(config.getRoundingMode()).getValue()) -// .pattern(NumberUtil.isNumber(config.getPattern()) ? Integer.parseInt(config.getPattern()) : 2) -// .valueType(salaryValueTypeEnum.getValue()) -// .dataType(salaryDataTypeEnum.getValue()) -// //后补 -// .formulaId(0L) -// .description(config.getDescription()) -// .canEdit(org.apache.commons.lang3.math.NumberUtils.INTEGER_ONE) -// .creator((long) user.getUID()) -// .deleteType(0) -// .createTime(now) -// .updateTime(now) -// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) -// .sharedType(0) -// .taxAgentIds("") -// .sortedIndex(NumberUtil.isNumber(config.getSortedIndex()) ? Integer.parseInt(config.getSortedIndex()) : null) -// .width(NumberUtil.isNumber(config.getWidth()) ? Integer.parseInt(config.getWidth()) : null) -// .defaultValue(config.getDefaultValue()) -// .build(); -// adds.add(itemPO); -// } else { -// -// if (SalarySystemTypeEnum.parseByValue(itemPO.getSystemType()) == SalarySystemTypeEnum.SYSTEM) { -// ImportExcelResponse.Error error = ImportExcelResponse.Error.builder().message(String.format("%s“%s”是系统薪资项目不支持修改", rowIndex, name)).build(); -// response.setSuccessCount(response.getSuccessCount() - 1); -// response.setErrorCount(response.getErrorCount() + 1); -// response.getErrorData().add(error); -// continue; -// } -// -// itemPO.setUseDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getUseDefault()).getValue()); -// itemPO.setHideDefault(SalaryOnOffEnum.parseByDefaultLabel(config.getHideDefault()).getValue()); -// itemPO.setRoundingMode(SalaryRoundingModeEnum.parseByDefaultLabel(config.getRoundingMode()).getValue()); -// itemPO.setPattern(NumberUtil.isNumber(config.getPattern()) ? Integer.parseInt(config.getPattern()) : 2); -// itemPO.setValueType(salaryValueTypeEnum.getValue()); -// itemPO.setDataType(salaryDataTypeEnum.getValue()); -// //后补 -// itemPO.setFormulaId(0L); -// itemPO.setDescription(config.getDescription()); -// itemPO.setUpdateTime(now); -// itemPO.setSortedIndex(NumberUtil.isNumber(config.getSortedIndex()) ? Integer.parseInt(config.getSortedIndex()) : null); -// itemPO.setWidth(NumberUtil.isNumber(config.getWidth()) ? Integer.parseInt(config.getWidth()) : null); -// itemPO.setDefaultValue(config.getDefaultValue()); -// updates.add(itemPO); -// } -// -// //解析公式 -// if (salaryValueTypeEnum == SalaryValueTypeEnum.FORMULA || salaryValueTypeEnum == SalaryValueTypeEnum.SQL) { -// Long id = itemPO.getId(); -// String formula = config.getFormula(); -// String sqlReturnKey = config.getSqlReturnKey(); -// Map map = new HashMap<>(); -// map.put("rowIndex", rowIndex); -// map.put("formula", formula); -// map.put("sqlReturnKey", sqlReturnKey); -// formulaItems.put(id, map); -// } -// } -// -// adds.forEach(getSalaryItemMapper()::insertIgnoreNull); -// updates.forEach(getSalaryItemMapper()::updateIgnoreNull); -// -// for (Long id : formulaItems.keySet()) { -// SalaryItemPO itemPO = getById(id); -// Map map = formulaItems.get(id); -// String rowIndex = map.get("rowIndex"); -// String formula = map.get("formula"); -// String sqlReturnKey = map.get("sqlReturnKey"); -// SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(itemPO.getValueType()); -// SalaryDataTypeEnum salaryDataTypeEnum = SalaryDataTypeEnum.parseByValue(itemPO.getDataType()); -// SalaryFormulaSaveParam saveParam = SalaryFormulaSaveParam.builder() -// .name(itemPO.getName()) -// .module("salary") -// .useFor("salaryitem") -// .referenceType(salaryValueTypeEnum == SalaryValueTypeEnum.FORMULA ? ReferenceTypeEnum.FORMULA.getValue() : ReferenceTypeEnum.SQL.getValue()) -// .returnType(salaryDataTypeEnum == SalaryDataTypeEnum.STRING ? ReturnTypeEnum.STRING.getValue() : ReturnTypeEnum.NUMBER.getValue()) -// .validateType(salaryDataTypeEnum == SalaryDataTypeEnum.STRING ? ReturnTypeEnum.STRING.getValue() : ReturnTypeEnum.NUMBER.getValue()) -// .extendParam("{\"isCustomFunction\":\"0\",\"sqlReturnKey\":\"" + sqlReturnKey + "\",\"openDecrypt\":\"0\",\"datasource\":{\"datasourceId\":\"\"}}") -// .formula(formula) -// .build(); -// -// try { -// FormulaPO formulaPO = getSalaryFormulaService(user).save(saveParam); -// itemPO.setFormulaId(formulaPO.getId()); -// getSalaryItemMapper().updateIgnoreNull(itemPO); -// } catch (Exception e) { -// ImportExcelResponse.Error error = ImportExcelResponse.Error.builder().message(String.format("%s“%s”的公式设置有误:%s", rowIndex, itemPO.getName(), e.getMessage())).build(); -// response.setSuccessCount(response.getSuccessCount() - 1); -// response.setErrorCount(response.getErrorCount() + 1); -// response.getErrorData().add(error); -// } -// } -// return response; } catch (IOException e) { e.printStackTrace(); } finally { From 71c9bd35644676e5e548c5f5026f835f50d0a9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 9 Aug 2024 15:53:36 +0800 Subject: [PATCH 12/23] =?UTF-8?q?xml=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/entity/config/SalaryConfig.java | 8 ++++---- .../engine/salary/wrapper/SalarySystemConfigWrapper.java | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index c1bba915d..b15de947d 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -20,14 +20,14 @@ import java.util.List; @AllArgsConstructor @XStreamAlias("SalaryConfig") public class SalaryConfig { -// //版本 + // //版本 // @XStreamAlias("version") // @XStreamAsAttribute // private String version; // -// //基本信息 -//// @XStreamImplicit -// private List modules; +//公式配置 + @XStreamAlias("FormluaConfig") + private FormluaConfig formluaConfig; //社保方案 diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index eb25f376b..4c42ffc38 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -198,10 +198,13 @@ public class SalarySystemConfigWrapper extends Service { getSalarySysConfService(user).saveSalarySendFeedback(param); } + + public SalaryConfig downloadConfig() { SalaryConfig salaryConfig = new SalaryConfig(); + List salarySysConfPOS = getSalarySysConfService(user).listSome(SalarySysConfPO.builder().build()); FormluaConfig formluaConfig = getSalaryFormulaService(user).getConfig(); salaryConfig.setFormluaConfig(formluaConfig); From 31cd3981e2f5ef081a6b1d847ee0ac0a56a029ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 9 Aug 2024 17:30:44 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/entity/config/SalaryConfig.java | 6 +-- .../service/impl/SalaryItemServiceImpl.java | 46 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index b15de947d..96e4d57df 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -31,9 +31,9 @@ public class SalaryConfig { //社保方案 - //公式配置 - @XStreamAlias("FormluaConfig") - private FormluaConfig formluaConfig; +// //公式配置 +// @XStreamAlias("FormluaConfig") +// private FormluaConfig formluaConfig; //薪资项目 @XStreamAlias("SalaryItemConfig") diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index 04ca27940..ba417e573 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -718,18 +718,18 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService configs.forEach(e -> { List row = new ArrayList<>(); row.add(e.getName()); - row.add(SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); - row.add(SalaryOnOffEnum.parseByValue(e.getHideDefault()).getDefaultLabel()); - row.add(SalaryDataTypeEnum.parseByValue(e.getDataType()).getDefaultLabel()); - row.add(SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); - row.add(e.getPattern()); - row.add(SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); + row.add(e.getUseDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); + row.add(e.getHideDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getHideDefault()).getDefaultLabel()); + row.add(SalaryDataTypeEnum.parseByValue(Util.null2String(e.getDataType())).getDefaultLabel()); + row.add(e.getRoundingMode() == null ? "四舍五入" : SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); + row.add(e.getPattern() == null ? "2" : e.getPattern()); + row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); row.add(e.getFormulaConfig() == null ? "" : e.getFormulaConfig().getFormula()); row.add(e.getFormulaConfig() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormulaConfig().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); - row.add(e.getSortedIndex()); - row.add(e.getWidth()); - row.add(e.getDefaultValue()); - row.add(e.getDescription()); + row.add(e.getSortedIndex() == null ? "" : e.getSortedIndex()); + row.add(e.getWidth() == null ? "" : e.getWidth()); + row.add(e.getDefaultValue() == null ? "" : e.getDefaultValue()); + row.add(e.getDescription()== null ? "" : e.getDescription()); rows.add(row); }); @@ -750,18 +750,18 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService configs.forEach(e -> { List row = new ArrayList<>(); row.add(e.getName()); - row.add(SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); - row.add(SalaryOnOffEnum.parseByValue(e.getHideDefault()).getDefaultLabel()); - row.add(SalaryDataTypeEnum.parseByValue(e.getDataType()).getDefaultLabel()); - row.add(SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); - row.add(e.getPattern()); - row.add(SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); + row.add(e.getUseDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); + row.add(e.getHideDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getHideDefault()).getDefaultLabel()); + row.add(SalaryDataTypeEnum.parseByValue(Util.null2String(e.getDataType())).getDefaultLabel()); + row.add(e.getRoundingMode() == null ? "四舍五入" : SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); + row.add(e.getPattern() == null ? "2" : e.getPattern()); + row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); row.add(e.getFormulaConfig() == null ? "" : e.getFormulaConfig().getFormula()); row.add(e.getFormulaConfig() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormulaConfig().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); - row.add(e.getSortedIndex()); - row.add(e.getWidth()); - row.add(e.getDefaultValue()); - row.add(e.getDescription()); + row.add(e.getSortedIndex() == null ? "" : e.getSortedIndex()); + row.add(e.getWidth() == null ? "" : e.getWidth()); + row.add(e.getDefaultValue() == null ? "" : e.getDefaultValue()); + row.add(e.getDescription()== null ? "" : e.getDescription()); rows.add(row); }); } @@ -787,11 +787,11 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService //todo 异常提示 if (ids.contains(itemPO.getId())) { - }else if(names.contains(itemPO.getName())){ + } else if (names.contains(itemPO.getName())) { - }else if(codes.contains(itemPO.getCode())){ + } else if (codes.contains(itemPO.getCode())) { - }else { + } else { getSalaryItemMapper().insertIgnoreNull(itemPO); } }); From b83d45efa0d790c908aca099af83923696e03a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 12 Aug 2024 10:02:46 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/wiki/删除档案.txt | 3 +++ .../salary/entity/config/SalaryConfig.java | 12 +++++----- .../po/InsuranceArchivesBaseInfoPO.java | 2 ++ .../engine/salary/sys/config/SysConfig.java | 23 +++++++++++++++++++ .../salary/sys/entity/po/SalarySysConfPO.java | 23 +++++++++++++++++++ .../sys/service/SalarySysConfService.java | 4 ++++ .../impl/SalarySysConfServiceImpl.java | 14 +++++++++++ .../wrapper/SalarySystemConfigWrapper.java | 5 ++-- 8 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 src/com/engine/salary/sys/config/SysConfig.java diff --git a/resource/wiki/删除档案.txt b/resource/wiki/删除档案.txt index 2ac8d7d2c..a3a0c6dbd 100644 --- a/resource/wiki/删除档案.txt +++ b/resource/wiki/删除档案.txt @@ -20,6 +20,9 @@ update hrsa_salary_archive set delete_type=3 where tax_agent_id=扣缴义务人 二、删除停薪员工档案 update hrsa_salary_archive set delete_type=3 where run_status in ('STOP_FROM_PENDING','STOP_FROM_SUSPEND') +二、删除停薪员工社保档案 +update hrsa_insurance_base_info set delete_type=3 where run_status in ('4','5') + 三、删除指定人员档案 diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index 96e4d57df..1a71f68ef 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -5,6 +5,7 @@ import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import com.engine.salary.sys.config.SysConfig; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; @@ -25,15 +26,14 @@ public class SalaryConfig { // @XStreamAsAttribute // private String version; // -//公式配置 - @XStreamAlias("FormluaConfig") - private FormluaConfig formluaConfig; + @XStreamAlias("SysConfig") + private SysConfig sysConfig; //社保方案 -// //公式配置 -// @XStreamAlias("FormluaConfig") -// private FormluaConfig formluaConfig; + //公式配置 + @XStreamAlias("FormluaConfig") + private FormluaConfig formluaConfig; //薪资项目 @XStreamAlias("SalaryItemConfig") diff --git a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseInfoPO.java b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseInfoPO.java index 0a5dd7b01..7de87c044 100644 --- a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseInfoPO.java +++ b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesBaseInfoPO.java @@ -2,6 +2,7 @@ package com.engine.salary.entity.siarchives.po; import com.engine.hrmelog.annotation.ElogTransform; import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; +import com.engine.salary.enums.siaccount.EmployeeStatusEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -90,6 +91,7 @@ public class InsuranceArchivesBaseInfoPO { /** * 福利执行状态 + * @see EmployeeStatusEnum */ @ElogTransform(name = "福利执行状态") private String runStatus; diff --git a/src/com/engine/salary/sys/config/SysConfig.java b/src/com/engine/salary/sys/config/SysConfig.java new file mode 100644 index 000000000..3da7f8818 --- /dev/null +++ b/src/com/engine/salary/sys/config/SysConfig.java @@ -0,0 +1,23 @@ +package com.engine.salary.sys.config; + +import com.engine.salary.sys.entity.po.SalarySysConfPO; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamImplicit; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("SysConfig") +public class SysConfig { + + @XStreamImplicit + private List salarySysConfs; + +} diff --git a/src/com/engine/salary/sys/entity/po/SalarySysConfPO.java b/src/com/engine/salary/sys/entity/po/SalarySysConfPO.java index 6a2d231ec..bc75d7a95 100644 --- a/src/com/engine/salary/sys/entity/po/SalarySysConfPO.java +++ b/src/com/engine/salary/sys/entity/po/SalarySysConfPO.java @@ -4,6 +4,9 @@ package com.engine.salary.sys.entity.po; import com.engine.salary.annotation.TableTitle; import com.engine.salary.util.valid.DataCheck; import com.engine.salary.util.valid.RuntimeTypeEnum; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamOmitField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -15,54 +18,74 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor +@XStreamAlias("SalarySysConf") public class SalarySysConfPO { @DataCheck(require = true, runtime = RuntimeTypeEnum.UPDATE, message = "id为空") + @XStreamOmitField private Long id; /** * 标识 */ @TableTitle(title = "标识", dataIndex = "confKey", key = "confKey") @DataCheck(require = true, message = "标识为空") + @XStreamAlias("confKey") + @XStreamAsAttribute private String confKey; /** * 值 */ @TableTitle(title = "值", dataIndex = "confValue", key = "confValue") @DataCheck(require = true, message = "标识为空") + @XStreamAlias("confValue") + @XStreamAsAttribute private String confValue; /** * 标题 */ @TableTitle(title = "标题", dataIndex = "title", key = "title") @DataCheck(require = true, message = "标题为空") + @XStreamAlias("title") + @XStreamAsAttribute private String title; /** * 所属模块 */ @TableTitle(title = "所属模块", dataIndex = "module", key = "module") + @XStreamAlias("module") + @XStreamAsAttribute private String module; /** * 排序权重 */ @TableTitle(title = "排序权重", dataIndex = "orderWeight", key = "orderWeight") + @XStreamAlias("orderWeight") + @XStreamAsAttribute private Integer orderWeight; /** * 描述 */ @TableTitle(title = "描述", dataIndex = "description", key = "description") + @XStreamAlias("description") + @XStreamAsAttribute private String description; /** * 是否已删除,0否,1是 */ + @XStreamAlias("deleteType") + @XStreamAsAttribute private Integer deleteType; /** * 创建时间 */ + @XStreamAlias("createTime") + @XStreamAsAttribute private Date createTime; /** * 修改时间 */ + @XStreamAlias("updateTime") + @XStreamAsAttribute private Date updateTime; } \ No newline at end of file diff --git a/src/com/engine/salary/sys/service/SalarySysConfService.java b/src/com/engine/salary/sys/service/SalarySysConfService.java index 345c2187a..aca487ab1 100644 --- a/src/com/engine/salary/sys/service/SalarySysConfService.java +++ b/src/com/engine/salary/sys/service/SalarySysConfService.java @@ -1,5 +1,6 @@ package com.engine.salary.sys.service; +import com.engine.salary.sys.config.SysConfig; import com.engine.salary.sys.entity.param.AppSettingSaveParam; import com.engine.salary.sys.entity.param.OrderRuleParam; import com.engine.salary.sys.entity.po.SalarySysConfPO; @@ -137,4 +138,7 @@ public interface SalarySysConfService { * @param app */ void saveSettingByType(String confValue, String confKey, String title, String app); + + SysConfig getConfig(); + void parseConfig(SysConfig config); } diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java index 24050fafc..497a2f4be 100644 --- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java +++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java @@ -38,6 +38,7 @@ import com.engine.salary.mapper.siarchives.SocialSchemeMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper; +import com.engine.salary.sys.config.SysConfig; import com.engine.salary.sys.constant.SalarySysConstant; import com.engine.salary.sys.entity.param.AppSettingSaveParam; import com.engine.salary.sys.entity.param.OrderRuleParam; @@ -509,6 +510,19 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe } } + @Override + public SysConfig getConfig() { + SysConfig sysConfig = new SysConfig(); + List salarySysConfPOS = getSalarySysConfMapper().listAll(); + sysConfig.setSalarySysConfs(salarySysConfPOS); + return sysConfig; + } + + @Override + public void parseConfig(SysConfig config) { + + } + /** * 开启/关闭加解密 * @param confValue diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 4c42ffc38..5b424bd69 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -10,6 +10,7 @@ import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; import com.engine.salary.service.*; import com.engine.salary.service.impl.*; +import com.engine.salary.sys.config.SysConfig; import com.engine.salary.sys.entity.param.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; @@ -203,8 +204,8 @@ public class SalarySystemConfigWrapper extends Service { public SalaryConfig downloadConfig() { SalaryConfig salaryConfig = new SalaryConfig(); - - List salarySysConfPOS = getSalarySysConfService(user).listSome(SalarySysConfPO.builder().build()); + SysConfig sysConfig = getSalarySysConfService(user).getConfig(); + salaryConfig.setSysConfig(sysConfig); FormluaConfig formluaConfig = getSalaryFormulaService(user).getConfig(); salaryConfig.setFormluaConfig(formluaConfig); From ecb0f6f7bcffa13dc5ab23cfb7e725664cd69ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 12 Aug 2024 15:16:06 +0800 Subject: [PATCH 15/23] =?UTF-8?q?excel=E5=AF=BC=E5=85=A5=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/SalaryItemExcelConfig.java | 2 +- .../enums/salaryitem/SalaryDataTypeEnum.java | 10 + .../mapper/salaryitem/SalaryItemMapper.java | 6 +- .../mapper/salaryitem/SalaryItemMapper.xml | 183 ++++-------------- .../salary/service/SalaryItemService.java | 5 +- .../service/impl/SalaryItemServiceImpl.java | 53 ++--- 6 files changed, 82 insertions(+), 177 deletions(-) diff --git a/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java b/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java index d567f2d86..ab04abfae 100644 --- a/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java +++ b/src/com/engine/salary/entity/salaryitem/config/SalaryItemExcelConfig.java @@ -81,7 +81,7 @@ public class SalaryItemExcelConfig { @ExcelHead(title="sql返回字段",dataIndex = "sqlReturnKey") @ExcelProperty(index = 8) - private String sqlReturnKey; + private String extendParam; /** * 排序 diff --git a/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java b/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java index b5b1a483b..fa5c76f40 100644 --- a/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java +++ b/src/com/engine/salary/enums/salaryitem/SalaryDataTypeEnum.java @@ -1,6 +1,7 @@ package com.engine.salary.enums.salaryitem; import com.engine.salary.enums.BaseEnum; +import com.engine.salary.enums.SalaryValueTypeEnum; import java.util.Arrays; import java.util.Objects; @@ -66,4 +67,13 @@ public enum SalaryDataTypeEnum implements BaseEnum { } return ""; } + + public static SalaryDataTypeEnum parseByDefaultLabel(String defaultLabel) { + for (SalaryDataTypeEnum typeEnum : SalaryDataTypeEnum.values()) { + if (Objects.equals(typeEnum.getDefaultLabel(), defaultLabel)) { + return typeEnum; + } + } + return STRING; + } } diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java index 1d53a8f3c..fad7541ab 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.java @@ -1,6 +1,6 @@ package com.engine.salary.mapper.salaryitem; -import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemExcelConfig; import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import org.apache.ibatis.annotations.Param; @@ -70,9 +70,7 @@ public interface SalaryItemMapper { SalaryItemPO getByName(String name); - List getConfig(@Param("ids") Collection ids); - - List getAllConfig(@Param("ids") Collection ids); + List getConfig(@Param("ids") Collection ids); diff --git a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml index 30f1a6bbd..e099ec2b3 100644 --- a/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml +++ b/src/com/engine/salary/mapper/salaryitem/SalaryItemMapper.xml @@ -31,7 +31,10 @@ - t.id, + t + . + id + , t.name, t.code, t.system_type, @@ -589,138 +592,49 @@ WHERE name = #{name} AND delete_type = 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - item.id as item_id - ,item.name as item_name - , item.code as item_code - , item.system_type as item_system_type - , item.sys_salary_item_id as item_sys_salary_item_id - , item.use_default as item_use_default - , item.use_in_employee_salary as item_use_in_employee_salary - , item.rounding_mode as item_rounding_mode - , item.pattern as item_pattern - , item.value_type as item_value_type - , item.formula_id as item_formula_id - , item.description as item_description - , item.can_edit as item_can_edit - , item.can_delete as item_can_delete - , item.data_type as item_data_type - , item.shared_type as item_shared_type - , item.tax_agent_ids as item_tax_agent_ids - , item.sorted_index as item_sorted_index - , item.hide_default as item_hide_default - , item.width as item_width - , item.default_value as item_default_value - , f.formula_id - , f.formula_name - , f.formula_description - , f.formula_module - , f.formula_use_for - , f.formula_reference_type - , f.formula_return_type - , f.formula_validate_type - , f.formula_extend_param - , f.formula_formula - , f.formula_formulaRunScript - , f.var_id - , f.var_name - , f.var_formula_id - , f.var_field_id - , f.var_field_name - , f.var_field_type - , f.var_source - , f.var_order_index + item.name as name + , item.use_default as use_default + , item.hide_default as hide_default + , item.data_type as data_type + , item.rounding_mode as rounding_mode + , item.pattern as pattern + , item.value_type as value_type + , f.formula as formula + , f.extend_param as extend_param + , item.sorted_index as sorted_index + , item.width as width + , item.default_value as default_value + , item.description as description - - formula.id as formula_id - , formula.name as formula_name - , formula.description as formula_description - , formula.module as formula_module - , formula.use_for as formula_use_for - , formula.reference_type as formula_reference_type - , formula.return_type as formula_return_type - , formula.validate_type as formula_validate_type - , formula.extend_param as formula_extend_param - , formula.formula as formula_formula - , formula.formulaRunScript as formula_formulaRunScript - - - - , var.id as var_id - , var.name as var_name - , var.formula_id as var_formula_id - , var.field_id as var_field_id - , var.field_name as var_field_name - , var.field_type as var_field_type - , var.source as var_source - , var.order_index as var_order_index - - - - - \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index e10090439..f9a760dcb 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -1,7 +1,7 @@ package com.engine.salary.service; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; -import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; +import com.engine.salary.entity.salaryitem.config.SalaryItemExcelConfig; import com.engine.salary.entity.salaryitem.param.*; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.enums.SalarySystemTypeEnum; @@ -155,9 +155,8 @@ public interface SalaryItemService { SalaryItemAllConfig getConfig(); void parseConfig(SalaryItemAllConfig salaryItemConfig); - List getConfig(SalaryItemExportParam param); + List getConfig(SalaryItemExportParam param); - List getAllConfig(SalaryItemExportParam param); Map preview(SalaryItemImportParam param); diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index ba417e573..07126915c 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -15,7 +15,6 @@ import com.engine.salary.entity.salaryformula.po.FormulaPO; import com.engine.salary.entity.salaryformula.po.FormulaVar; import com.engine.salary.entity.salaryitem.bo.SalaryItemBO; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; -import com.engine.salary.entity.salaryitem.config.SalaryItemConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemExcelConfig; import com.engine.salary.entity.salaryitem.param.*; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; @@ -538,14 +537,10 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService @Override - public List getConfig(SalaryItemExportParam param) { + public List getConfig(SalaryItemExportParam param) { return getSalaryItemMapper().getConfig(param.getIds()); } - @Override - public List getAllConfig(SalaryItemExportParam param) { - return getSalaryItemMapper().getAllConfig(param.getIds()); - } @Override public Map preview(SalaryItemImportParam param) { @@ -585,7 +580,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService SalaryItemExcelConfig config = configs.get(i); String name = config.getName(); SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByDefaultLabel(config.getValueType()); - SalaryDataTypeEnum salaryDataTypeEnum = SalaryDataTypeEnum.parseByValue(config.getDataType()); + SalaryDataTypeEnum salaryDataTypeEnum = SalaryDataTypeEnum.parseByDefaultLabel(config.getDataType()); SalaryItemPO itemPO = getByName(name); if (itemPO == null) { @@ -656,7 +651,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService if (salaryValueTypeEnum == SalaryValueTypeEnum.FORMULA || salaryValueTypeEnum == SalaryValueTypeEnum.SQL) { Long id = itemPO.getId(); String formula = config.getFormula(); - String sqlReturnKey = config.getSqlReturnKey(); + String sqlReturnKey = config.getExtendParam(); Map map = new HashMap<>(); map.put("rowIndex", rowIndex); map.put("formula", formula); @@ -711,21 +706,28 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService List dataIndexList = Lists.newArrayList(); ExcelUtil.parseHeader(SalaryItemExcelConfig.class, titles, dataIndexList); - List configs = getConfig(param); + List configs = getConfig(param); List> rows = new ArrayList<>(); rows.add(titles); configs.forEach(e -> { List row = new ArrayList<>(); row.add(e.getName()); - row.add(e.getUseDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); - row.add(e.getHideDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getHideDefault()).getDefaultLabel()); + row.add(e.getUseDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(Integer.parseInt(e.getUseDefault())).getDefaultLabel()); + row.add(e.getHideDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(Integer.parseInt(e.getHideDefault())).getDefaultLabel()); row.add(SalaryDataTypeEnum.parseByValue(Util.null2String(e.getDataType())).getDefaultLabel()); - row.add(e.getRoundingMode() == null ? "四舍五入" : SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); + row.add(e.getRoundingMode() == null ? "四舍五入" : SalaryRoundingModeEnum.parseByValue(Integer.parseInt(e.getRoundingMode())).getDefaultLabel()); row.add(e.getPattern() == null ? "2" : e.getPattern()); - row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); - row.add(e.getFormulaConfig() == null ? "" : e.getFormulaConfig().getFormula()); - row.add(e.getFormulaConfig() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormulaConfig().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); + row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(Integer.parseInt(e.getValueType())).getDefaultLabel()); + row.add(e.getFormula() == null ? "" : e.getFormula()); + String sqlReturnKey = ""; + if(e.getExtendParam() != null){ + sqlReturnKey = JsonUtil.parseMap(Util.null2String(e.getExtendParam()), String.class).getOrDefault("sqlReturnKey", ""); + if("null".equals(sqlReturnKey)){ + sqlReturnKey = ""; + } + } + row.add(sqlReturnKey); row.add(e.getSortedIndex() == null ? "" : e.getSortedIndex()); row.add(e.getWidth() == null ? "" : e.getWidth()); row.add(e.getDefaultValue() == null ? "" : e.getDefaultValue()); @@ -746,18 +748,25 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService List> rows = new ArrayList<>(); rows.add(titles); if (param.isHasData()) { - List configs = getConfig(SalaryItemExportParam.builder().build()); + List configs = getConfig(SalaryItemExportParam.builder().build()); configs.forEach(e -> { List row = new ArrayList<>(); row.add(e.getName()); - row.add(e.getUseDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getUseDefault()).getDefaultLabel()); - row.add(e.getHideDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(e.getHideDefault()).getDefaultLabel()); + row.add(e.getUseDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(Integer.parseInt(e.getUseDefault())).getDefaultLabel()); + row.add(e.getHideDefault() == null ? "否" : SalaryOnOffEnum.parseByValue(Integer.parseInt(e.getHideDefault())).getDefaultLabel()); row.add(SalaryDataTypeEnum.parseByValue(Util.null2String(e.getDataType())).getDefaultLabel()); - row.add(e.getRoundingMode() == null ? "四舍五入" : SalaryRoundingModeEnum.parseByValue(e.getRoundingMode()).getDefaultLabel()); + row.add(e.getRoundingMode() == null ? "四舍五入" : SalaryRoundingModeEnum.parseByValue(Integer.parseInt(e.getRoundingMode())).getDefaultLabel()); row.add(e.getPattern() == null ? "2" : e.getPattern()); - row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(e.getValueType()).getDefaultLabel()); - row.add(e.getFormulaConfig() == null ? "" : e.getFormulaConfig().getFormula()); - row.add(e.getFormulaConfig() == null ? "" : JsonUtil.parseMap(Util.null2String(e.getFormulaConfig().getExtendParam()), String.class).getOrDefault("sqlReturnKey", "")); + row.add(e.getValueType() == null ? "输入" : SalaryValueTypeEnum.parseByValue(Integer.parseInt(e.getValueType())).getDefaultLabel()); + row.add(e.getFormula() == null ? "" : e.getFormula()); + String sqlReturnKey = ""; + if(e.getExtendParam() != null){ + sqlReturnKey = JsonUtil.parseMap(Util.null2String(e.getExtendParam()), String.class).getOrDefault("sqlReturnKey", ""); + if("null".equals(sqlReturnKey)){ + sqlReturnKey = ""; + } + } + row.add(sqlReturnKey); row.add(e.getSortedIndex() == null ? "" : e.getSortedIndex()); row.add(e.getWidth() == null ? "" : e.getWidth()); row.add(e.getDefaultValue() == null ? "" : e.getDefaultValue()); From 845f117d9c5bdf93de17a93c44c8c1333b181147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 12 Aug 2024 17:17:52 +0800 Subject: [PATCH 16/23] =?UTF-8?q?excel=E5=AF=BC=E5=85=A5=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/SalaryFormulaService.java | 1 + .../salary/service/SalaryItemService.java | 1 + .../impl/SalaryArchiveItemServiceImpl.java | 29 ++++++++++++------- .../service/impl/SalaryItemServiceImpl.java | 26 ++++++++++------- .../sys/service/SalarySysConfService.java | 1 + .../impl/SalarySysConfServiceImpl.java | 20 +++++++++++++ .../web/SalarySystemConfigController.java | 7 ++--- .../wrapper/SalarySystemConfigWrapper.java | 27 +++++++++++++---- 8 files changed, 80 insertions(+), 32 deletions(-) diff --git a/src/com/engine/salary/service/SalaryFormulaService.java b/src/com/engine/salary/service/SalaryFormulaService.java index 56e287ea9..03058dd3d 100644 --- a/src/com/engine/salary/service/SalaryFormulaService.java +++ b/src/com/engine/salary/service/SalaryFormulaService.java @@ -59,5 +59,6 @@ public interface SalaryFormulaService { void update(FormulaPO formulaPO); FormluaConfig getConfig(); + void parseConfig(FormluaConfig config); } diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index f9a760dcb..4a30697ab 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -153,6 +153,7 @@ public interface SalaryItemService { void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam); SalaryItemAllConfig getConfig(); + void parseConfig(SalaryItemAllConfig salaryItemConfig); List getConfig(SalaryItemExportParam param); diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index a40d8f8eb..1c688a8f3 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -752,22 +752,29 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi @Override public void parseConfig(ArchiveFieldConfig config) { + long uid = user.getUID(); List salaryItemPOList = getSalaryItemService(user).listAll(); - Set ids = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getId); - Set names = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getName); - Set codes = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getCode); + Map idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId); + Map nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName); + Map codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode); - Optional.ofNullable(config.getSalaryItems()) + Optional.ofNullable(config .getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { - //todo 异常提示 - if (ids.contains(itemPO.getId())) { + if (idMap.containsKey(itemPO.getId())) { + getSalaryItemMapper().updateIgnoreNull(itemPO); + } else if (nameMap.containsKey(itemPO.getName())) { + SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); + itemPO.setId(salaryItemPO.getId()); + itemPO.setCreator(uid); + getSalaryItemMapper().updateIgnoreNull(itemPO); - }else if(names.contains(itemPO.getName())){ - - }else if(codes.contains(itemPO.getCode())){ - - }else { + } else if (codeMap.containsKey(itemPO.getCode())) { + SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode()); + itemPO.setId(salaryItemPO.getId()); + itemPO.setCreator(uid); + getSalaryItemMapper().updateIgnoreNull(itemPO); + } else { getSalaryItemMapper().insertIgnoreNull(itemPO); } }); diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index 07126915c..96b188bf3 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -785,21 +785,27 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService @Override public void parseConfig(SalaryItemAllConfig salaryItemConfig) { + long uid = user.getUID(); List salaryItemPOList = listAll(); - Set ids = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getId); - Set names = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getName); - Set codes = SalaryEntityUtil.properties(salaryItemPOList, SalaryItemPO::getCode); + Map idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId); + Map nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName); + Map codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode); Optional.ofNullable(salaryItemConfig.getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { - //todo 异常提示 - if (ids.contains(itemPO.getId())) { - - } else if (names.contains(itemPO.getName())) { - - } else if (codes.contains(itemPO.getCode())) { - + if (idMap.containsKey(itemPO.getId())) { + getSalaryItemMapper().updateIgnoreNull(itemPO); + } else if (nameMap.containsKey(itemPO.getName())) { + SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); + itemPO.setId(salaryItemPO.getId()); + itemPO.setCreator(uid); + getSalaryItemMapper().updateIgnoreNull(itemPO); + } else if (codeMap.containsKey(itemPO.getCode())) { + SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode()); + itemPO.setId(salaryItemPO.getId()); + itemPO.setCreator(uid); + getSalaryItemMapper().updateIgnoreNull(itemPO); } else { getSalaryItemMapper().insertIgnoreNull(itemPO); } diff --git a/src/com/engine/salary/sys/service/SalarySysConfService.java b/src/com/engine/salary/sys/service/SalarySysConfService.java index aca487ab1..b11e547f1 100644 --- a/src/com/engine/salary/sys/service/SalarySysConfService.java +++ b/src/com/engine/salary/sys/service/SalarySysConfService.java @@ -140,5 +140,6 @@ public interface SalarySysConfService { void saveSettingByType(String confValue, String confKey, String title, String app); SysConfig getConfig(); + void parseConfig(SysConfig config); } diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java index 497a2f4be..6abb450b7 100644 --- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java +++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java @@ -65,6 +65,7 @@ import weaver.hrm.User; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; +import java.util.stream.Collectors; import static com.engine.salary.sys.constant.SalarySysConstant.*; import static java.util.concurrent.Executors.newFixedThreadPool; @@ -514,17 +515,36 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe public SysConfig getConfig() { SysConfig sysConfig = new SysConfig(); List salarySysConfPOS = getSalarySysConfMapper().listAll(); + //去除加密配置 + salarySysConfPOS = salarySysConfPOS.stream().filter(po -> !po.getConfKey().equals(OPEN_APPLICATION_ENCRYPT)).collect(Collectors.toList()); sysConfig.setSalarySysConfs(salarySysConfPOS); return sysConfig; } @Override public void parseConfig(SysConfig config) { + List salarySysConfs = config.getSalarySysConfs(); + if (CollectionUtils.isEmpty(salarySysConfs)) { + return; + } + + salarySysConfs.forEach(po -> { + SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey()); + if (sysConfPO == null) { + getSalarySysConfMapper().insertIgnoreNull(po); + } else { + sysConfPO.setConfValue(po.getConfValue()); + getSalarySysConfMapper().updateIgnoreNull(sysConfPO); + } + + }); + } /** * 开启/关闭加解密 + * * @param confValue */ public void updateEncrypt(String confValue) { diff --git a/src/com/engine/salary/web/SalarySystemConfigController.java b/src/com/engine/salary/web/SalarySystemConfigController.java index 2b80395a3..84953493d 100644 --- a/src/com/engine/salary/web/SalarySystemConfigController.java +++ b/src/com/engine/salary/web/SalarySystemConfigController.java @@ -8,6 +8,7 @@ import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.util.ResponseResult; +import com.engine.salary.util.excel.ImportExcelResponse; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.xml.XStreamUtil; import com.engine.salary.wrapper.SalarySystemConfigWrapper; @@ -339,10 +340,6 @@ public class SalarySystemConfigController { User user = HrmUserVarify.getUser(request, response); SalaryConfig salaryConfig = getSalarySystemConfigWrapper(user).downloadConfig(); -// XStream xStream = new XStream(); -// //由于使用的注解,将自动检测注解开启 -// xStream.autodetectAnnotations(true); -// String xml = xStream.toXML(salaryConfig); String xml = XStreamUtil.marshal(salaryConfig); String fileName = "薪酬配置" + LocalDate.now(); @@ -372,7 +369,7 @@ public class SalarySystemConfigController { @Produces(MediaType.APPLICATION_JSON) public String initConfig(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody uploadConfigParam param) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param); + return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param); } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 5b424bd69..00d18d198 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -8,6 +8,7 @@ import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.*; import com.engine.salary.service.impl.*; import com.engine.salary.sys.config.SysConfig; @@ -19,6 +20,7 @@ import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.excel.ImportExcelResponse; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; @@ -32,9 +34,7 @@ import weaver.hrm.User; import java.io.*; import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 累计专项附加扣除 @@ -200,8 +200,12 @@ public class SalarySystemConfigWrapper extends Service { } - public SalaryConfig downloadConfig() { + Boolean chief = getTaxAgentService(user).isChief((long) user.getUID()); + if (!chief) { + throw new SalaryRunTimeException("您不是薪酬总管理员,无法迁入出配置!"); + } + SalaryConfig salaryConfig = new SalaryConfig(); SysConfig sysConfig = getSalarySysConfService(user).getConfig(); @@ -225,7 +229,14 @@ public class SalarySystemConfigWrapper extends Service { return salaryConfig; } - public void uploadConfig(uploadConfigParam param) { + public ImportExcelResponse uploadConfig(uploadConfigParam param) { + Boolean chief = getTaxAgentService(user).isChief((long) user.getUID()); + if (!chief) { + throw new SalaryRunTimeException("您不是薪酬总管理员,无法迁入配置!"); + } + + ImportExcelResponse response = ImportExcelResponse.builder().build(); + InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); @@ -239,6 +250,8 @@ public class SalarySystemConfigWrapper extends Service { SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString()); + getSalarySysConfService(user).parseConfig(config.getSysConfig()); + getSalaryFormulaService(user).parseConfig(config.getFormluaConfig()); getSalaryItemService(user).parseConfig(config.getSalaryItemConfig()); @@ -249,8 +262,10 @@ public class SalarySystemConfigWrapper extends Service { getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs()); + return response; } catch (IOException e) { - e.printStackTrace(); + response.setErrorData(Collections.singletonList(ImportExcelResponse.Error.builder().message("文件读取失败!").build())); + return response; } finally { IOUtils.closeQuietly(fileInputStream); } From 9d26e1228fa0aaf31a11f80add237cd00502e255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 13 Aug 2024 18:15:04 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E8=96=AA=E9=85=AC=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/entity/config/SalaryConfig.java | 6 +- .../entity/salaryformula/po/FormulaPO.java | 6 + .../entity/salaryitem/po/SalaryItemPO.java | 4 + .../salarysob/po/SalarySobBackItemPO.java | 7 + .../salarysob/po/SalarySobItemGroupPO.java | 4 + .../entity/salarysob/po/SalarySobItemPO.java | 8 + .../salary/mapper/formula/FormulaMapper.java | 4 +- .../salary/mapper/formula/FormulaMapper.xml | 6 + .../salary/service/SalaryFormulaService.java | 6 +- .../service/SalarySobBackItemService.java | 3 + .../service/SalarySobItemGroupService.java | 2 + .../salary/service/SalarySobItemService.java | 4 +- .../salary/service/TaxAgentService.java | 1 - .../impl/SalaryArchiveItemServiceImpl.java | 8 +- .../impl/SalaryFormulaServiceImpl.java | 57 +++-- .../service/impl/SalaryItemServiceImpl.java | 38 ++- .../impl/SalarySobBackItemServiceImpl.java | 42 +++- .../impl/SalarySobItemGroupServiceImpl.java | 67 ++++++ .../impl/SalarySobItemServiceImpl.java | 36 ++- .../service/impl/SalarySobServiceImpl.java | 223 ++++++++---------- .../service/impl/TaxAgentServiceImpl.java | 1 - .../impl/SalarySysConfServiceImpl.java | 1 + .../wrapper/SalarySystemConfigWrapper.java | 19 +- 23 files changed, 378 insertions(+), 175 deletions(-) diff --git a/src/com/engine/salary/entity/config/SalaryConfig.java b/src/com/engine/salary/entity/config/SalaryConfig.java index 1a71f68ef..175f6426f 100644 --- a/src/com/engine/salary/entity/config/SalaryConfig.java +++ b/src/com/engine/salary/entity/config/SalaryConfig.java @@ -1,7 +1,6 @@ package com.engine.salary.entity.config; import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; -import com.engine.salary.entity.salaryformula.config.FormluaConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; import com.engine.salary.entity.taxagent.config.TaxAgentConfig; import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; @@ -31,10 +30,6 @@ public class SalaryConfig { //社保方案 - //公式配置 - @XStreamAlias("FormluaConfig") - private FormluaConfig formluaConfig; - //薪资项目 @XStreamAlias("SalaryItemConfig") private SalaryItemAllConfig salaryItemConfig; @@ -43,6 +38,7 @@ public class SalaryConfig { @XStreamAlias("ArchiveFieldConfig") private ArchiveFieldConfig archiveFieldConfig; + //分权基础设置 @XStreamAlias("TaxAgentBaseConfig") private TaxAgentBasePO taxAgentBaseConfig; diff --git a/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java b/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java index ecfae85b7..8d688dd94 100644 --- a/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java +++ b/src/com/engine/salary/entity/salaryformula/po/FormulaPO.java @@ -2,6 +2,7 @@ package com.engine.salary.entity.salaryformula.po; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -9,6 +10,7 @@ import lombok.NoArgsConstructor; import java.util.Collection; import java.util.Date; +import java.util.List; @Data @Builder @@ -111,4 +113,8 @@ public class FormulaPO { //主键id集合 private Collection ids; + + + @XStreamImplicit + private List formulaVars; } \ No newline at end of file diff --git a/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java b/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java index ceb0a0877..e39198b51 100644 --- a/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java +++ b/src/com/engine/salary/entity/salaryitem/po/SalaryItemPO.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.salaryitem.po; import com.engine.hrmelog.annotation.ElogTransform; +import com.engine.salary.entity.salaryformula.po.FormulaPO; import com.engine.salary.enums.SalaryRoundingModeEnum; import com.engine.salary.enums.SalarySystemTypeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; @@ -252,4 +253,7 @@ public class SalaryItemPO { @XStreamAlias("defaultValue") @XStreamAsAttribute private String defaultValue; + + @XStreamAlias("Formula") + FormulaPO formula; } diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java index 6eedc4a77..d5c91dddf 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobBackItemPO.java @@ -1,5 +1,7 @@ package com.engine.salary.entity.salarysob.po; +import com.engine.salary.entity.salaryformula.po.FormulaPO; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.enums.SalaryRoundingModeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; @@ -156,6 +158,11 @@ public class SalarySobBackItemPO{ + @XStreamAlias("SalaryItem") + private SalaryItemPO salaryItem; + + @XStreamAlias("Formula") + FormulaPO formula; /** diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java index ce3a569ae..258f0f67f 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobItemGroupPO.java @@ -2,6 +2,7 @@ package com.engine.salary.entity.salarysob.po; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; +import com.thoughtworks.xstream.annotations.XStreamImplicit; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -106,6 +107,9 @@ public class SalarySobItemGroupPO { @XStreamAsAttribute private Date updateTime; + @XStreamImplicit + private List salarySobItems; + Collection ids; diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java index 0f8482201..011f992c4 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobItemPO.java @@ -1,6 +1,8 @@ package com.engine.salary.entity.salarysob.po; import com.engine.hrmelog.annotation.ElogTransform; +import com.engine.salary.entity.salaryformula.po.FormulaPO; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.enums.SalaryRoundingModeEnum; import com.engine.salary.enums.SalaryValueTypeEnum; import com.thoughtworks.xstream.annotations.XStreamAlias; @@ -164,6 +166,12 @@ public class SalarySobItemPO { @XStreamAsAttribute private Date updateTime; + @XStreamAlias("SalaryItem") + private SalaryItemPO salaryItem; + + @XStreamAlias("Formula") + private FormulaPO formula; + //in Collection ids; Collection salarySobIds; diff --git a/src/com/engine/salary/mapper/formula/FormulaMapper.java b/src/com/engine/salary/mapper/formula/FormulaMapper.java index a723e133e..874e026ba 100644 --- a/src/com/engine/salary/mapper/formula/FormulaMapper.java +++ b/src/com/engine/salary/mapper/formula/FormulaMapper.java @@ -15,7 +15,9 @@ public interface FormulaMapper { * @return 返回集合,没有返回空List */ List listAll(); - + + List list2All(); + /** * 条件查询 * diff --git a/src/com/engine/salary/mapper/formula/FormulaMapper.xml b/src/com/engine/salary/mapper/formula/FormulaMapper.xml index f60e4e484..6fa8c2ba8 100644 --- a/src/com/engine/salary/mapper/formula/FormulaMapper.xml +++ b/src/com/engine/salary/mapper/formula/FormulaMapper.xml @@ -48,6 +48,12 @@ WHERE delete_type = 0 + + + + diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index f7c9372e2..b9206c735 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -157,6 +157,7 @@ public interface SalaryItemService { void parseConfig(SalaryItemAllConfig salaryItemConfig); Long add(SalaryItemPO salaryItemPO); + SalaryItemPO getItem(SalaryItemPO salaryItemPO); List getConfig(SalaryItemExportParam param); diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 403249cb6..00e886887 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -29,6 +29,7 @@ import com.engine.salary.service.*; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryLoggerUtil; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; @@ -761,12 +762,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi Optional.ofNullable(config .getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { - if (idMap.containsKey(itemPO.getId())) { - itemPO.setCode(null); - itemPO.setName(null); - itemPO.setCreator(uid); - getSalaryItemMapper().updateIgnoreNull(itemPO); - } else if (nameMap.containsKey(itemPO.getName())) { + if (nameMap.containsKey(itemPO.getName())) { SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); itemPO.setId(salaryItemPO.getId()); //不许修改code @@ -781,6 +777,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi itemPO.setCreator(uid); getSalaryItemMapper().updateIgnoreNull(itemPO); } else { + itemPO.setId(IdGenerator.generate()); getSalaryItemMapper().insertIgnoreNull(itemPO); } }); diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index a8c9afbe8..bdf86e28f 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -824,17 +824,22 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } + @Override + public SalaryItemPO getItem(SalaryItemPO salaryItemPO) { + SalaryItemPO po = getByName(salaryItemPO.getName()); + if (po == null) { + po = getSalaryItemMapper().getByCode(salaryItemPO.getCode()); + } + return po; + } + + private Long add(SalaryItemPO itemPO, Map idMap, Map nameMap, Map codeMap) { long uid = user.getUID(); Long formulaId = getSalaryFormulaService(user).add(itemPO.getFormula()); itemPO.setFormulaId(formulaId); - if (idMap.containsKey(itemPO.getId())) { - itemPO.setCode(null); - itemPO.setName(null); - itemPO.setCreator(uid); - getSalaryItemMapper().updateIgnoreNull(itemPO); - } else if (nameMap.containsKey(itemPO.getName())) { + if (nameMap.containsKey(itemPO.getName())) { SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); itemPO.setId(salaryItemPO.getId()); //不许修改code @@ -849,6 +854,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService itemPO.setCreator(uid); getSalaryItemMapper().updateIgnoreNull(itemPO); } else { + itemPO.setId(IdGenerator.generate()); getSalaryItemMapper().insertIgnoreNull(itemPO); } diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 4f33cef76..6ecf631ac 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -42,6 +42,7 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; @@ -62,6 +63,7 @@ import java.util.stream.Collectors; * @author qiantao * @version 1.0 **/ +@Slf4j public class SalarySobServiceImpl extends Service implements SalarySobService { @@ -592,18 +594,18 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { salarySobPO.setUpdateTime(new Date()); salarySobMapper.updateById(salarySobPO); // 记录日志 - String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ? - SalaryI18nUtil.getI18nLabel(0, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(0, "启用薪资账套"); - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId("" + salarySobPO.getId()); - loggerContext.setTargetName(salarySobPO.getName()); - loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(operateTypeName); - loggerContext.setOperatedesc(operateTypeName + ": " + salarySobPO.getName()); - loggerContext.setOldValues(oldSalarySobPO); - loggerContext.setNewValues(salarySobPO); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + String operateTypeName = Objects.equals(disableParam.getDisable(), NumberUtils.INTEGER_ONE) ? + SalaryI18nUtil.getI18nLabel(0, "禁用薪资账套") : SalaryI18nUtil.getI18nLabel(0, "启用薪资账套"); + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + salarySobPO.getId()); + loggerContext.setTargetName(salarySobPO.getName()); + loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); + loggerContext.setOperateTypeName(operateTypeName); + loggerContext.setOperatedesc(operateTypeName + ": " + salarySobPO.getName()); + loggerContext.setOldValues(oldSalarySobPO); + loggerContext.setNewValues(salarySobPO); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); } @Override @@ -658,18 +660,18 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { getSalarySobBackItemService(user).deleteBySalarySobIds(ids); // 删除薪资账套的校验规则 getSalarySobCheckRuleService(user).deleteBySalarySobIds(ids); - // 记录日志 - salarySobPOS.forEach(salarySobPO -> { - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId("" + salarySobPO.getId()); - loggerContext.setTargetName(salarySobPO.getName()); - loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); - loggerContext.setOldValues(salarySobPO); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); - }); + // 记录日志 + salarySobPOS.forEach(salarySobPO -> { + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + salarySobPO.getId()); + loggerContext.setTargetName(salarySobPO.getName()); + loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除薪资账套")); + loggerContext.setOldValues(salarySobPO); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + }); } @Override @@ -764,15 +766,15 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (CollectionUtils.isNotEmpty(result.getSalarySobCheckRules())) { getSalarySobCheckRuleService(user).batchSave(result.getSalarySobCheckRules()); } - // 记录日志 - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setUser(user); - loggerContext.setTargetId("" + result.getSalarySob().getId()); - loggerContext.setTargetName(result.getSalarySob().getName()); - loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套") + ": " + salarySobPO.getName()); - SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); + // 记录日志 + LoggerContext loggerContext = new LoggerContext<>(); + loggerContext.setUser(user); + loggerContext.setTargetId("" + result.getSalarySob().getId()); + loggerContext.setTargetName(result.getSalarySob().getName()); + loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(98570, "复制薪资账套") + ": " + salarySobPO.getName()); + SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext); } @Override @@ -885,9 +887,13 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { SalaryItemPO salaryItemPO = salaryItemNameMap.get(salaryItem.getName()); if (salaryItemPO != null) { sobItem.setSalaryItemId(salaryItemPO.getId()); - }else{ - Long itemId = getSalaryItemService(user).add(salaryItem); - sobItem.setSalaryItemId(itemId); + } else { + SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem); + if (itemPO != null) { + sobItem.setSalaryItemId(itemPO.getId()); + }else { + log.error("item not found:{}",salaryItem); + } } } @@ -918,10 +924,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (salaryItem != null) { SalaryItemPO salaryItemPO = salaryItemNameMap.get(salaryItem.getName()); if (salaryItemPO != null) { - sobItem.setSalaryItem(salaryItemPO); - }else{ - Long itemId = getSalaryItemService(user).add(salaryItem); - sobItem.setSalaryItemId(itemId); + sobItem.setSalaryItemId(salaryItemPO.getId()); + } else { + SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem); + if (itemPO != null) { + sobItem.setSalaryItemId(itemPO.getId()); + }else { + log.error("item not found:{}",salaryItem); + } } } }); @@ -946,10 +956,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { if (salaryItem != null) { SalaryItemPO salaryItemPO = salaryItemNameMap.get(salaryItem.getName()); if (salaryItemPO != null) { - salarySobBackItem.setSalaryItem(salaryItemPO); - }else{ - Long itemId = getSalaryItemService(user).add(salaryItem); - salarySobBackItem.setSalaryItemId(itemId); + salarySobBackItem.setSalaryItemId(salaryItemPO.getId()); + } else { + SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem); + if (itemPO != null) { + salarySobBackItem.setSalaryItemId(itemPO.getId()); + }else { + log.error("item not found:{}",salaryItem); + } } } } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index e3d24d810..912d2c587 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -25,6 +25,7 @@ import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import com.engine.salary.util.xml.XStreamUtil; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.util.IOUtils; import weaver.file.ImageFileManager; @@ -49,6 +50,7 @@ import java.util.Map; * @author qiantao * @version 1.0 **/ +@Slf4j public class SalarySystemConfigWrapper extends Service { private SalarySysConfService getSalarySysConfService(User user) { @@ -267,7 +269,8 @@ public class SalarySystemConfigWrapper extends Service { return response; } catch (Exception e) { - response.setErrorData(Collections.singletonList(ImportExcelResponse.Error.builder().message("文件读取失败!").build())); + log.error("迁入失败",e); + response.setErrorData(Collections.singletonList(ImportExcelResponse.Error.builder().message("迁入失败!").build())); return response; } finally { IOUtils.closeQuietly(fileInputStream); From 673699dfb8b9268aa9acbe7b625613a883e4b219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 16 Aug 2024 11:18:27 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/cache/SalaryCacheKey.java | 3 + .../service/SalaryArchiveItemService.java | 3 +- .../salary/service/SalaryItemService.java | 4 +- .../salary/service/SalarySobService.java | 3 +- .../salary/service/TaxAgentBaseService.java | 3 +- .../salary/service/TaxAgentService.java | 3 +- .../impl/SalaryArchiveItemServiceImpl.java | 21 ++++- .../service/impl/SalaryItemServiceImpl.java | 34 +++---- .../service/impl/SalarySobServiceImpl.java | 38 ++++++-- .../service/impl/TaxAgentBaseServiceImpl.java | 13 ++- .../service/impl/TaxAgentServiceImpl.java | 21 ++++- ...onfigParam.java => UploadConfigParam.java} | 2 +- .../sys/entity/vo/UploadConfigResponse.java | 30 ++++++ .../sys/service/SalarySysConfService.java | 3 +- .../impl/SalarySysConfServiceImpl.java | 40 ++++---- .../salary/web/SalaryCommonController.java | 2 +- .../web/SalarySystemConfigController.java | 6 +- .../salary/wrapper/SalaryCommonWrapper.java | 2 +- .../wrapper/SalarySystemConfigWrapper.java | 92 ++++++++++++------- 19 files changed, 227 insertions(+), 96 deletions(-) rename src/com/engine/salary/sys/entity/param/{uploadConfigParam.java => UploadConfigParam.java} (92%) create mode 100644 src/com/engine/salary/sys/entity/vo/UploadConfigResponse.java diff --git a/src/com/engine/salary/cache/SalaryCacheKey.java b/src/com/engine/salary/cache/SalaryCacheKey.java index 642a499c7..4d0d19280 100644 --- a/src/com/engine/salary/cache/SalaryCacheKey.java +++ b/src/com/engine/salary/cache/SalaryCacheKey.java @@ -70,4 +70,7 @@ public class SalaryCacheKey { public final static String SALARY_REPORT_DATA = "SALARY_REPORT_DATA_"; + public final static String UPLOAD_SALARY_CONFIG = "UPLOAD_SALARY_CONFIG"; + + } diff --git a/src/com/engine/salary/service/SalaryArchiveItemService.java b/src/com/engine/salary/service/SalaryArchiveItemService.java index 0489b7ce6..9d9081bd8 100644 --- a/src/com/engine/salary/service/SalaryArchiveItemService.java +++ b/src/com/engine/salary/service/SalaryArchiveItemService.java @@ -7,6 +7,7 @@ import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustBeforeParam; import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustRecordQueryParam; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -161,5 +162,5 @@ public interface SalaryArchiveItemService { ArchiveFieldConfig getConfig(); - void parseConfig(ArchiveFieldConfig config); + UploadConfigResponse.Result parseConfig(ArchiveFieldConfig config); } diff --git a/src/com/engine/salary/service/SalaryItemService.java b/src/com/engine/salary/service/SalaryItemService.java index b9206c735..3fa1409d6 100644 --- a/src/com/engine/salary/service/SalaryItemService.java +++ b/src/com/engine/salary/service/SalaryItemService.java @@ -6,6 +6,7 @@ import com.engine.salary.entity.salaryitem.param.*; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.enums.SalarySystemTypeEnum; import com.engine.salary.service.impl.SalaryItemServiceImpl; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.excel.ImportExcelResponse; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -154,9 +155,8 @@ public interface SalaryItemService { SalaryItemAllConfig getConfig(); - void parseConfig(SalaryItemAllConfig salaryItemConfig); + UploadConfigResponse.Result parseConfig(SalaryItemAllConfig salaryItemConfig); - Long add(SalaryItemPO salaryItemPO); SalaryItemPO getItem(SalaryItemPO salaryItemPO); List getConfig(SalaryItemExportParam param); diff --git a/src/com/engine/salary/service/SalarySobService.java b/src/com/engine/salary/service/SalarySobService.java index a83e5a1a6..1056846fc 100644 --- a/src/com/engine/salary/service/SalarySobService.java +++ b/src/com/engine/salary/service/SalarySobService.java @@ -8,6 +8,7 @@ import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam; import com.engine.salary.entity.salarysob.param.SalarySobListQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.page.PageInfo; import java.time.YearMonth; @@ -160,5 +161,5 @@ public interface SalarySobService { List getConfig(Long taxAgentId); - void parseConfig(Long taxAgentId, List salarySobConfigs); + List parseConfig(Long taxAgentId, List salarySobConfigs); } diff --git a/src/com/engine/salary/service/TaxAgentBaseService.java b/src/com/engine/salary/service/TaxAgentBaseService.java index 6c70f4e4a..de468d8df 100644 --- a/src/com/engine/salary/service/TaxAgentBaseService.java +++ b/src/com/engine/salary/service/TaxAgentBaseService.java @@ -2,6 +2,7 @@ package com.engine.salary.service; import com.engine.salary.entity.taxagent.param.TaxAgentSaveBaseParam; import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; /** * 个税扣缴义务人基础信息 @@ -37,5 +38,5 @@ public interface TaxAgentBaseService { TaxAgentBasePO getConfig(); - void parseConfig(TaxAgentBasePO config); + UploadConfigResponse.Result parseConfig(TaxAgentBasePO config); } diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java index 3f798adcd..bd2dedab4 100644 --- a/src/com/engine/salary/service/TaxAgentService.java +++ b/src/com/engine/salary/service/TaxAgentService.java @@ -12,6 +12,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentEmployeePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.page.PageInfo; import java.util.Collection; @@ -262,5 +263,5 @@ public interface TaxAgentService { List getConfig(); - void parseConfig(List configs); + List parseConfig(List configs); } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 00e886887..1c28ed5b2 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.util.StrUtil; import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; @@ -26,6 +27,7 @@ import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.archive.SalaryArchiveItemMapper; import com.engine.salary.mapper.salaryitem.SalaryItemMapper; import com.engine.salary.service.*; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryLoggerUtil; @@ -752,18 +754,25 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi } @Override - public void parseConfig(ArchiveFieldConfig config) { + public UploadConfigResponse.Result parseConfig(ArchiveFieldConfig config) { + UploadConfigResponse.Result result = UploadConfigResponse.Result.builder() + .message("档案字段加载完毕") + .success(new ArrayList<>()) + .warning(new ArrayList<>()) + .error(new ArrayList<>()) + .build(); long uid = user.getUID(); List salaryItemPOList = getSalaryItemService(user).listAll(); - Map idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId); Map nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName); Map codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode); - Optional.ofNullable(config .getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { if (nameMap.containsKey(itemPO.getName())) { SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); + if (!StrUtil.equals(salaryItemPO.getCode(), itemPO.getCode())) { + result.getWarning().add(String.format("警告,档案字段[%s]名称已存在,但项目code不一致,迁入code:%s,当前系统code:%s", itemPO.getName(), itemPO.getCode(), salaryItemPO.getCode())); + } itemPO.setId(salaryItemPO.getId()); //不许修改code itemPO.setCode(null); @@ -771,6 +780,9 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi getSalaryItemMapper().updateIgnoreNull(itemPO); } else if (codeMap.containsKey(itemPO.getCode())) { SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode()); + if (!StrUtil.equals(salaryItemPO.getName(), itemPO.getName())) { + result.getWarning().add(String.format("警告,档案字段[%s]code已存在,但项目code不一致,迁入名称:%s,当前系统名称:%s", itemPO.getName(), itemPO.getName(), salaryItemPO.getName())); + } itemPO.setId(salaryItemPO.getId()); //不许修改名字 itemPO.setName(null); @@ -780,7 +792,10 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi itemPO.setId(IdGenerator.generate()); getSalaryItemMapper().insertIgnoreNull(itemPO); } + result.getSuccess().add(String.format("成功,薪资项目[%s]加载成功", itemPO.getName())); }); + + return result; } } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index bdf86e28f..4b10460ab 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -31,6 +31,7 @@ import com.engine.salary.enums.sicategory.SharedTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.salaryitem.SalaryItemMapper; import com.engine.salary.service.*; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.JsonUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -799,29 +800,23 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } @Override - public void parseConfig(SalaryItemAllConfig salaryItemConfig) { + public UploadConfigResponse.Result parseConfig(SalaryItemAllConfig salaryItemConfig) { + UploadConfigResponse.Result result = UploadConfigResponse.Result.builder() + .message("薪资项目加载完毕") + .success(new ArrayList<>()) + .warning(new ArrayList<>()) + .error(new ArrayList<>()) + .build(); List salaryItemPOList = listAll(); - Map idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId); Map nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName); Map codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode); Optional.ofNullable(salaryItemConfig.getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { - add(itemPO, idMap, nameMap, codeMap); + add(itemPO, nameMap, codeMap, result); }); - } - - @Override - public Long add(SalaryItemPO itemPO) { - - List salaryItemPOList = listAll(); - Map idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId); - Map nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName); - Map codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode); - - return add(itemPO, idMap, nameMap, codeMap); - + return result; } @Override @@ -834,13 +829,16 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService } - private Long add(SalaryItemPO itemPO, Map idMap, Map nameMap, Map codeMap) { + private Long add(SalaryItemPO itemPO, Map nameMap, Map codeMap, UploadConfigResponse.Result result) { long uid = user.getUID(); Long formulaId = getSalaryFormulaService(user).add(itemPO.getFormula()); itemPO.setFormulaId(formulaId); if (nameMap.containsKey(itemPO.getName())) { SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); + if (!StrUtil.equals(salaryItemPO.getCode(), itemPO.getCode())) { + result.getWarning().add(String.format("警告,薪资项目[%s]名称已存在,但项目code不一致,迁入code:%s,当前系统code:%s", itemPO.getName(), itemPO.getCode(), salaryItemPO.getCode())); + } itemPO.setId(salaryItemPO.getId()); //不许修改code itemPO.setCode(null); @@ -848,6 +846,9 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService getSalaryItemMapper().updateIgnoreNull(itemPO); } else if (codeMap.containsKey(itemPO.getCode())) { SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode()); + if (!StrUtil.equals(salaryItemPO.getName(), itemPO.getName())) { + result.getWarning().add(String.format("警告,薪资项目[%s]code已存在,但项目code不一致,迁入名称:%s,当前系统名称:%s", itemPO.getName(), itemPO.getName(), salaryItemPO.getName())); + } itemPO.setId(salaryItemPO.getId()); //不许修改名字 itemPO.setName(null); @@ -857,6 +858,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService itemPO.setId(IdGenerator.generate()); getSalaryItemMapper().insertIgnoreNull(itemPO); } + result.getSuccess().add(String.format("成功,薪资项目[%s]加载成功", itemPO.getName())); return itemPO.getId(); } diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 6ecf631ac..e97956523 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -30,6 +30,7 @@ import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.salarysob.SalarySobMapper; import com.engine.salary.mapper.taxagent.TaxAgentExtRangeMapper; import com.engine.salary.service.*; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; @@ -838,7 +839,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { } @Override - public void parseConfig(Long taxAgentId, List salarySobConfigs) { + public List parseConfig(Long taxAgentId, List salarySobConfigs) { + List results = new ArrayList<>(); long uid = user.getUID(); List salarySobPOS = listByTaxAgentId(taxAgentId); Map sobPOMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getName); @@ -849,6 +851,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { Optional.ofNullable(salarySobConfigs).orElse(new ArrayList<>()).forEach(salarySobConfig -> { SalarySobPO salarySobPO = salarySobConfig.getSalarySob(); String sobPOName = salarySobPO.getName(); + + UploadConfigResponse.Result result = UploadConfigResponse.Result.builder() + .message(String.format("账套:%s基础信息加载完毕", sobPOName)) + .success(new ArrayList<>()) + .warning(new ArrayList<>()) + .error(new ArrayList<>()) + .build(); + if (sobPOMap.containsKey(sobPOName)) { SalarySobPO oldSob = sobPOMap.get(sobPOName); salarySobPO.setId(oldSob.getId()); @@ -860,6 +870,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { getSalarySobMapper().insertIgnoreNull(salarySobPO); } + result.getSuccess().add(String.format("账套:%s基础信息加载成功", sobPOName)); + Long sobId = salarySobPO.getId(); getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singletonList(sobId)); List salarySobEmpFields = salarySobConfig.getSalarySobEmpFields(); @@ -870,7 +882,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { } getSalarySobEmpFieldService(user).batchSave(salarySobEmpFields); } - + result.getSuccess().add(String.format("账套:%s人员字段加载成功", sobPOName)); getSalarySobItemService(user).deleteBySalarySobIds(Collections.singletonList(sobId)); List salarySobItems = salarySobConfig.getSalarySobItems(); @@ -891,8 +903,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem); if (itemPO != null) { sobItem.setSalaryItemId(itemPO.getId()); - }else { - log.error("item not found:{}",salaryItem); + } else { + result.getError().add(String.format("错误,账套:%s,薪资项目:%s,未找到对应薪资项目id", sobPOName, salaryItem.getName())); + log.error("item not found:{}", salaryItem); } } } @@ -929,8 +942,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem); if (itemPO != null) { sobItem.setSalaryItemId(itemPO.getId()); - }else { - log.error("item not found:{}",salaryItem); + } else { + result.getError().add(String.format("错误,账套:%s,薪资项目:%s,未找到对应薪资项目id", sobPOName, salaryItem.getName())); + log.error("item not found:{}", salaryItem); } } } @@ -940,6 +954,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { } getSalarySobItemGroupService(user).batchSave(salarySobItemGroups); } + result.getSuccess().add(String.format("账套:%s薪资项目加载成功", sobPOName)); getSalarySobBackItemService(user).deleteBySalarySobIds(Collections.singletonList(sobId)); List salarySobBackItems = salarySobConfig.getSalarySobBackItems(); @@ -961,14 +976,16 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem); if (itemPO != null) { salarySobBackItem.setSalaryItemId(itemPO.getId()); - }else { - log.error("item not found:{}",salaryItem); + } else { + result.getError().add(String.format("错误,账套:%s,薪资项目:%s,未找到对应薪资项目id", sobPOName, salaryItem.getName())); + log.error("item not found:{}", salaryItem); } } } } getSalarySobBackItemService(user).batchInsert(salarySobBackItems); } + result.getSuccess().add(String.format("账套:%s回算加载成功", sobPOName)); getSalarySobAdjustRuleService(user).deleteBySalarySobIds(Collections.singletonList(sobId)); List salarySobAdjustRules = salarySobConfig.getSalarySobAdjustRules(); @@ -980,7 +997,12 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { } getSalarySobAdjustRuleService(user).batchSave(salarySobAdjustRules); } + result.getSuccess().add(String.format("账套:%s调薪计薪规则加载成功", sobPOName)); + + results.add(result); }); + + return results; } diff --git a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java index b851cbeab..9294c5b9d 100644 --- a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java @@ -13,6 +13,7 @@ import com.engine.salary.mapper.taxagent.TaxAgentBaseMapper; import com.engine.salary.service.SIAccountService; import com.engine.salary.service.SalaryAcctRecordService; import com.engine.salary.service.TaxAgentBaseService; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.db.IdGenerator; @@ -20,6 +21,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import weaver.hrm.User; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -113,15 +115,22 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ } @Override - public void parseConfig(TaxAgentBasePO config) { + public UploadConfigResponse.Result parseConfig(TaxAgentBasePO config) { + UploadConfigResponse.Result result = UploadConfigResponse.Result.builder().message("分权配置加载完毕") + .success(new ArrayList<>()) + .warning(new ArrayList<>()) + .error(new ArrayList<>()) + .build(); TaxAgentBasePO baseInfo = getBaseInfo(); if (baseInfo == null) { config.setCreator((long) user.getUID()); getTaxAgentBaseMapper().insertIgnoreNull(config); - }else { + } else { baseInfo.setDevolutionStatus(config.getDevolutionStatus()); getTaxAgentBaseMapper().updateIgnoreNull(baseInfo); } + result.getSuccess().add("分权加载完毕,分权" + (config.getDevolutionStatus() == 1 ? "开启" : "关闭 ")); + return result; } /** diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index a5ac92e71..8375cb1f7 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -4,9 +4,9 @@ import com.engine.common.service.HrmCommonService; import com.engine.common.service.impl.HrmCommonServiceImpl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryAuthConstant; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -43,6 +43,7 @@ import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper; import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper; import com.engine.salary.mapper.taxagent.TaxAgentMapper; import com.engine.salary.service.*; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; @@ -815,7 +816,9 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { } @Override - public void parseConfig(List configs) { + public List parseConfig(List configs) { + List results = new ArrayList<>(); + List taxAgentPOS = listAll(); Map agentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getName); @@ -824,6 +827,14 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { .forEach(config -> { TaxAgentPO taxAgent = config.getTaxAgent(); String name = taxAgent.getName(); + + UploadConfigResponse.Result taxResult = UploadConfigResponse.Result.builder() + .message(String.format("扣缴义务人%s加载完毕", name)) + .success(new ArrayList<>()) + .warning(new ArrayList<>()) + .error(new ArrayList<>()) + .build(); + if (agentPOMap.containsKey(name)) { //存在扣缴义务人 taxAgent = agentPOMap.get(name); @@ -832,10 +843,14 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { taxAgent.setCreator((long) user.getUID()); getTaxAgentMapper().insertIgnoreNull(taxAgent); } + taxResult.getSuccess().add(String.format("%s加载成功", name)); + results.add(taxResult); - getSalarySobService(user).parseConfig(taxAgent.getId(), config.getSalarySobConfigs()); + List sobResults = getSalarySobService(user).parseConfig(taxAgent.getId(), config.getSalarySobConfigs()); + results.addAll(sobResults); }); + return results; } diff --git a/src/com/engine/salary/sys/entity/param/uploadConfigParam.java b/src/com/engine/salary/sys/entity/param/UploadConfigParam.java similarity index 92% rename from src/com/engine/salary/sys/entity/param/uploadConfigParam.java rename to src/com/engine/salary/sys/entity/param/UploadConfigParam.java index 50c2f6c9e..6e104addc 100644 --- a/src/com/engine/salary/sys/entity/param/uploadConfigParam.java +++ b/src/com/engine/salary/sys/entity/param/UploadConfigParam.java @@ -17,7 +17,7 @@ import lombok.NoArgsConstructor; @Builder @NoArgsConstructor @AllArgsConstructor -public class uploadConfigParam { +public class UploadConfigParam { //上传文件id String imageId; diff --git a/src/com/engine/salary/sys/entity/vo/UploadConfigResponse.java b/src/com/engine/salary/sys/entity/vo/UploadConfigResponse.java new file mode 100644 index 000000000..f15dda773 --- /dev/null +++ b/src/com/engine/salary/sys/entity/vo/UploadConfigResponse.java @@ -0,0 +1,30 @@ +package com.engine.salary.sys.entity.vo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class UploadConfigResponse { + + private boolean finish; + + private List results; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Result { + String message; + List success; + List warning; + List error; + } +} diff --git a/src/com/engine/salary/sys/service/SalarySysConfService.java b/src/com/engine/salary/sys/service/SalarySysConfService.java index b11e547f1..91eab5317 100644 --- a/src/com/engine/salary/sys/service/SalarySysConfService.java +++ b/src/com/engine/salary/sys/service/SalarySysConfService.java @@ -6,6 +6,7 @@ import com.engine.salary.sys.entity.param.OrderRuleParam; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import java.util.Date; @@ -141,5 +142,5 @@ public interface SalarySysConfService { SysConfig getConfig(); - void parseConfig(SysConfig config); + UploadConfigResponse.Result parseConfig(SysConfig config); } diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java index 39113a738..bcd6aa3cc 100644 --- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java +++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.sys.service.impl; +import cn.hutool.core.collection.CollectionUtil; import com.api.formmode.mybatis.util.SqlProxyHandle; import com.cloudstore.dev.api.util.Util_DataCache; import com.engine.common.util.ServiceUtil; @@ -45,6 +46,7 @@ import com.engine.salary.sys.entity.param.OrderRuleParam; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.sys.enums.*; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.util.SalaryEntityUtil; @@ -522,25 +524,31 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe } @Override - public void parseConfig(SysConfig config) { + public UploadConfigResponse.Result parseConfig(SysConfig config) { + UploadConfigResponse.Result result = UploadConfigResponse.Result.builder() + .message("系统配置加载完毕") + .success(new ArrayList<>()) + .warning(new ArrayList<>()) + .error(new ArrayList<>()) + .build(); + List salarySysConfs = config.getSalarySysConfs(); - if (CollectionUtils.isEmpty(salarySysConfs)) { - return; + if (CollectionUtil.isNotEmpty((salarySysConfs))) { + + salarySysConfs.forEach(po -> { + SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey()); + if (sysConfPO == null) { + po.setId(IdGenerator.generate()); + getSalarySysConfMapper().insertIgnoreNull(po); + } else { + sysConfPO.setConfValue(po.getConfValue()); + getSalarySysConfMapper().updateIgnoreNull(sysConfPO); + } + result.getSuccess().add(String.format("[%s]配置,key:[%s],value:[%s]", po.getTitle(), po.getConfKey(), po.getConfValue())); + }); } - salarySysConfs.forEach(po -> { - SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey()); - if (sysConfPO == null) { - po.setId(IdGenerator.generate()); - getSalarySysConfMapper().insertIgnoreNull(po); - } else { - sysConfPO.setConfValue(po.getConfValue()); - getSalarySysConfMapper().updateIgnoreNull(sysConfPO); - } - - }); - - + return result; } /** diff --git a/src/com/engine/salary/web/SalaryCommonController.java b/src/com/engine/salary/web/SalaryCommonController.java index ca7a439dc..7f1637a5c 100644 --- a/src/com/engine/salary/web/SalaryCommonController.java +++ b/src/com/engine/salary/web/SalaryCommonController.java @@ -40,7 +40,7 @@ public class SalaryCommonController { @Produces(MediaType.APPLICATION_JSON) public String getCacheInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "key") String key) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getSalaryCommonWrapper(user)::getCacheInfo, key); + return new ResponseResult(user).run(getSalaryCommonWrapper(user)::getCacheInfo, key); } @GET diff --git a/src/com/engine/salary/web/SalarySystemConfigController.java b/src/com/engine/salary/web/SalarySystemConfigController.java index 84953493d..4586af8e3 100644 --- a/src/com/engine/salary/web/SalarySystemConfigController.java +++ b/src/com/engine/salary/web/SalarySystemConfigController.java @@ -6,9 +6,9 @@ import com.engine.salary.sys.entity.param.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.util.ResponseResult; -import com.engine.salary.util.excel.ImportExcelResponse; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.xml.XStreamUtil; import com.engine.salary.wrapper.SalarySystemConfigWrapper; @@ -367,9 +367,9 @@ public class SalarySystemConfigController { @POST @Path("/uploadConfig") @Produces(MediaType.APPLICATION_JSON) - public String initConfig(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody uploadConfigParam param) { + public String initConfig(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody UploadConfigParam param) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param); + return new ResponseResult(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param); } diff --git a/src/com/engine/salary/wrapper/SalaryCommonWrapper.java b/src/com/engine/salary/wrapper/SalaryCommonWrapper.java index baec86d91..982c1e5e9 100644 --- a/src/com/engine/salary/wrapper/SalaryCommonWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryCommonWrapper.java @@ -13,7 +13,7 @@ public class SalaryCommonWrapper extends Service { return ServiceUtil.getService(SalaryCacheServiceImpl.class, user); } - public String getCacheInfo(String key) { + public Object getCacheInfo(String key) { return getSalaryCacheService(user).get(key); } diff --git a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java index 912d2c587..d6a2c3f3c 100644 --- a/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySystemConfigWrapper.java @@ -2,6 +2,7 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.entity.config.SalaryConfig; import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig; import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig; @@ -15,11 +16,11 @@ import com.engine.salary.sys.entity.param.*; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.AppSettingVO; import com.engine.salary.sys.entity.vo.OrderRuleVO; +import com.engine.salary.sys.entity.vo.UploadConfigResponse; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryEntityUtil; -import com.engine.salary.util.excel.ImportExcelResponse; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; @@ -37,7 +38,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.StandardCharsets; -import java.util.Collections; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -77,6 +78,10 @@ public class SalarySystemConfigWrapper extends Service { return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user); } + private SalaryCacheService getSalaryCacheService(User user) { + return ServiceUtil.getService(SalaryCacheServiceImpl.class, user); + } + public Map info() { BaseBean baseBean = new BaseBean(); String log = baseBean.getPropValue("hrmSalary", "log"); @@ -236,44 +241,61 @@ public class SalarySystemConfigWrapper extends Service { return salaryConfig; } - public ImportExcelResponse uploadConfig(uploadConfigParam param) { + public UploadConfigResponse uploadConfig(UploadConfigParam param) { Boolean chief = getTaxAgentService(user).isChief((long) user.getUID()); if (!chief) { throw new SalaryRunTimeException("您不是薪酬总管理员,无法迁入配置!"); } - ImportExcelResponse response = ImportExcelResponse.builder().build(); - - InputStream fileInputStream = null; - try { - fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); - Reader reader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8); - BufferedReader bufferedReader = new BufferedReader(reader); - String line; - StringBuilder xml = new StringBuilder(); - while ((line = bufferedReader.readLine()) != null) { - xml.append(line); - } - - SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString()); - - getSalarySysConfService(user).parseConfig(config.getSysConfig()); - - getSalaryItemService(user).parseConfig(config.getSalaryItemConfig()); - - getSalaryArchiveItemService(user).parseConfig(config.getArchiveFieldConfig()); - - getTaxAgentBaseService(user).parseConfig(config.getTaxAgentBaseConfig()); - - getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs()); - - return response; - } catch (Exception e) { - log.error("迁入失败",e); - response.setErrorData(Collections.singletonList(ImportExcelResponse.Error.builder().message("迁入失败!").build())); - return response; - } finally { - IOUtils.closeQuietly(fileInputStream); + UploadConfigResponse lastResponse = getSalaryCacheService(user).get(SalaryCacheKey.UPLOAD_SALARY_CONFIG); + if (lastResponse != null && !lastResponse.isFinish()) { + throw new SalaryRunTimeException("迁入任务进行中,请等待上次任务完成!"); } + +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { + UploadConfigResponse response = UploadConfigResponse.builder().finish(false).results(new ArrayList<>()).build(); + getSalaryCacheService(user).set(SalaryCacheKey.UPLOAD_SALARY_CONFIG, response); + + InputStream fileInputStream = null; + try { + fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); + Reader reader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8); + BufferedReader bufferedReader = new BufferedReader(reader); + String line; + StringBuilder xml = new StringBuilder(); + while ((line = bufferedReader.readLine()) != null) { + xml.append(line); + } + + SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString()); + + UploadConfigResponse.Result sysConfigResult = getSalarySysConfService(user).parseConfig(config.getSysConfig()); + response.getResults().add(sysConfigResult); + + UploadConfigResponse.Result salaryItemResult = getSalaryItemService(user).parseConfig(config.getSalaryItemConfig()); + response.getResults().add(salaryItemResult); + + UploadConfigResponse.Result archiveFieldResult = getSalaryArchiveItemService(user).parseConfig(config.getArchiveFieldConfig()); + response.getResults().add(archiveFieldResult); + + UploadConfigResponse.Result taxAgentBaseResult = getTaxAgentBaseService(user).parseConfig(config.getTaxAgentBaseConfig()); + response.getResults().add(taxAgentBaseResult); + + List results = getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs()); + response.getResults().addAll(results); + } catch (Exception e) { + log.error("加载失败", e); + } finally { + response.setFinish(true); + IOUtils.closeQuietly(fileInputStream); + } + getSalaryCacheService(user).set(SalaryCacheKey.UPLOAD_SALARY_CONFIG, response); +// } +// }; +// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "UPLOAD_SALARY_CONFIG", localRunnable); + + return response; } } From cd8d4601afd8dba420faef051da77205a306bfd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 19 Aug 2024 09:49:49 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E5=85=A8=E9=87=8F=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SalaryArchiveItemServiceImpl.java | 61 +++++++++++-------- .../service/impl/SalaryItemServiceImpl.java | 9 ++- .../impl/SalarySysConfServiceImpl.java | 21 ++++--- 3 files changed, 56 insertions(+), 35 deletions(-) diff --git a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java index 1c28ed5b2..01b94c051 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveItemServiceImpl.java @@ -37,6 +37,7 @@ import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -55,6 +56,7 @@ import java.util.stream.Collectors; * @author qiantao * @version 1.0 **/ +@Slf4j public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchiveItemService { private SalaryArchiveBiz salaryArchiveMapper = new SalaryArchiveBiz(); @@ -94,6 +96,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi private SalaryEmployeeService getSalaryEmployeeService(User user) { return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } + /** * 获取未生效 lt * @@ -281,13 +284,12 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi salaryArchiveItem, saiNew, user - ); + ); } return StringUtils.EMPTY; } - /** * @return null * @description 构建薪资档案中调薪的更新PO @@ -765,34 +767,41 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi List salaryItemPOList = getSalaryItemService(user).listAll(); Map nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName); Map codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode); - Optional.ofNullable(config .getSalaryItems()) + Optional.ofNullable(config.getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { - if (nameMap.containsKey(itemPO.getName())) { - SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); - if (!StrUtil.equals(salaryItemPO.getCode(), itemPO.getCode())) { - result.getWarning().add(String.format("警告,档案字段[%s]名称已存在,但项目code不一致,迁入code:%s,当前系统code:%s", itemPO.getName(), itemPO.getCode(), salaryItemPO.getCode())); + try { + + + if (nameMap.containsKey(itemPO.getName())) { + SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName()); + if (!StrUtil.equals(salaryItemPO.getCode(), itemPO.getCode())) { + result.getWarning().add(String.format("警告,档案字段[%s]名称已存在,但项目code不一致,迁入code:%s,当前系统code:%s", itemPO.getName(), itemPO.getCode(), salaryItemPO.getCode())); + } + itemPO.setId(salaryItemPO.getId()); + //不许修改code + itemPO.setCode(null); + itemPO.setCreator(uid); + getSalaryItemMapper().updateIgnoreNull(itemPO); + } else if (codeMap.containsKey(itemPO.getCode())) { + SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode()); + if (!StrUtil.equals(salaryItemPO.getName(), itemPO.getName())) { + result.getWarning().add(String.format("警告,档案字段[%s]code已存在,但项目code不一致,迁入名称:%s,当前系统名称:%s", itemPO.getName(), itemPO.getName(), salaryItemPO.getName())); + } + itemPO.setId(salaryItemPO.getId()); + //不许修改名字 + itemPO.setName(null); + itemPO.setCreator(uid); + getSalaryItemMapper().updateIgnoreNull(itemPO); + } else { + itemPO.setId(IdGenerator.generate()); + getSalaryItemMapper().insertIgnoreNull(itemPO); } - itemPO.setId(salaryItemPO.getId()); - //不许修改code - itemPO.setCode(null); - itemPO.setCreator(uid); - getSalaryItemMapper().updateIgnoreNull(itemPO); - } else if (codeMap.containsKey(itemPO.getCode())) { - SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode()); - if (!StrUtil.equals(salaryItemPO.getName(), itemPO.getName())) { - result.getWarning().add(String.format("警告,档案字段[%s]code已存在,但项目code不一致,迁入名称:%s,当前系统名称:%s", itemPO.getName(), itemPO.getName(), salaryItemPO.getName())); - } - itemPO.setId(salaryItemPO.getId()); - //不许修改名字 - itemPO.setName(null); - itemPO.setCreator(uid); - getSalaryItemMapper().updateIgnoreNull(itemPO); - } else { - itemPO.setId(IdGenerator.generate()); - getSalaryItemMapper().insertIgnoreNull(itemPO); + result.getSuccess().add(String.format("成功,薪资项目[%s]加载成功", itemPO.getName())); + } catch (Exception e) { + log.error("{}字段加载异常,", itemPO.getName(), e); + result.getError().add(String.format("错误,档案字段[%s]加载异常,%s", itemPO.getName(), e.getMessage())); } - result.getSuccess().add(String.format("成功,薪资项目[%s]加载成功", itemPO.getName())); }); return result; diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index 4b10460ab..2fe2faa6b 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -49,6 +49,7 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Sheet; @@ -72,6 +73,7 @@ import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX; * @author qiantao * @version 1.0 **/ +@Slf4j public class SalaryItemServiceImpl extends Service implements SalaryItemService { private SalaryItemBiz salaryItemBiz = new SalaryItemBiz(); @@ -814,7 +816,12 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService Optional.ofNullable(salaryItemConfig.getSalaryItems()) .orElse(new ArrayList<>()) .forEach(itemPO -> { - add(itemPO, nameMap, codeMap, result); + try { + add(itemPO, nameMap, codeMap, result); + } catch (Exception e) { + log.error("{}项目加载异常,", itemPO.getName(), e); + result.getError().add(String.format("错误,薪资项目[%s]加载异常,%s", itemPO.getName(), e.getMessage())); + } }); return result; } diff --git a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java index bcd6aa3cc..956e6f7cd 100644 --- a/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java +++ b/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java @@ -536,15 +536,20 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe if (CollectionUtil.isNotEmpty((salarySysConfs))) { salarySysConfs.forEach(po -> { - SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey()); - if (sysConfPO == null) { - po.setId(IdGenerator.generate()); - getSalarySysConfMapper().insertIgnoreNull(po); - } else { - sysConfPO.setConfValue(po.getConfValue()); - getSalarySysConfMapper().updateIgnoreNull(sysConfPO); + try { + SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey()); + if (sysConfPO == null) { + po.setId(IdGenerator.generate()); + getSalarySysConfMapper().insertIgnoreNull(po); + } else { + sysConfPO.setConfValue(po.getConfValue()); + getSalarySysConfMapper().updateIgnoreNull(sysConfPO); + } + result.getSuccess().add(String.format("[%s]配置,key:[%s],value:[%s]", po.getTitle(), po.getConfKey(), po.getConfValue())); + } catch (Exception e) { + log.error(String.format("错误,[%s]配置加载异常,key:[%s],value:[%s]", po.getTitle(), po.getConfKey(), po.getConfValue()), e); + result.getError().add(String.format("错误,[%s]配置加载异常,key:[%s],value:[%s],原因:%s", po.getTitle(), po.getConfKey(), po.getConfValue(), e.getMessage())); } - result.getSuccess().add(String.format("[%s]配置,key:[%s],value:[%s]", po.getTitle(), po.getConfKey(), po.getConfValue())); }); } From 9121268815c393b1b5eaecb83a5788c012274606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 20 Aug 2024 09:29:14 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=B4=A6=E5=A5=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/service/impl/SalarySobServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index e97956523..f1ff59e93 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -863,6 +863,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { SalarySobPO oldSob = sobPOMap.get(sobPOName); salarySobPO.setId(oldSob.getId()); salarySobPO.setCreator(uid); + salarySobPO.setTaxAgentId(oldSob.getTaxAgentId()); getSalarySobMapper().updateIgnoreNull(salarySobPO); } else { salarySobPO.setCreator(uid); From 2a58b4972b3ff2c5e1aca63a0b011f40dc89e83a Mon Sep 17 00:00:00 2001 From: Harryxzy Date: Tue, 20 Aug 2024 13:48:31 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E8=96=AA=E8=B5=84=E6=A0=B8=E7=AE=97?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=94=AF=E6=8C=81vlookup=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SalaryAcctExcelService.java | 3 ++- .../impl/SalaryAcctExcelServiceImpl.java | 22 ++++++++++++------- .../salary/util/excel/ExcelParseHelper.java | 21 ++++++++++++++++++ .../salary/web/SalaryAcctController.java | 3 ++- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/com/engine/salary/service/SalaryAcctExcelService.java b/src/com/engine/salary/service/SalaryAcctExcelService.java index b86ef0da0..44aed9df9 100644 --- a/src/com/engine/salary/service/SalaryAcctExcelService.java +++ b/src/com/engine/salary/service/SalaryAcctExcelService.java @@ -4,6 +4,7 @@ import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.entity.salaryacct.dto.SalaryAcctImportFieldDTO; import com.engine.salary.entity.salaryacct.param.*; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.util.excel.ExcelPreviewDTO; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.util.List; @@ -113,7 +114,7 @@ public interface SalaryAcctExcelService { Map preview(SalaryAcctImportParam param); - Map previewImportSalaryAcctResult(SalaryAcctImportParam param); + ExcelPreviewDTO previewImportSalaryAcctResult(SalaryAcctImportParam param); void cacheImportField(List salaryItems); diff --git a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java index 7f2e440e1..01aee1e36 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java @@ -47,6 +47,7 @@ import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.*; import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.excel.ExcelParseHelper; +import com.engine.salary.util.excel.ExcelPreviewDTO; import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtilPlus; import com.engine.salary.util.page.PageInfo; @@ -63,7 +64,9 @@ import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.BeanUtils; @@ -985,7 +988,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc } @Override - public Map previewImportSalaryAcctResult(SalaryAcctImportParam param) { + public ExcelPreviewDTO previewImportSalaryAcctResult(SalaryAcctImportParam param) { //1、参数校验 ValidUtil.doValidator(param); @@ -995,11 +998,13 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc InputStream fileInputStream = null; try { fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); - Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); - map.put("headers", ExcelSupport.getSheetHeader(sheet, 1)); - map.put("list", ExcelParseHelper.parse2List(sheet, 2, 1)); - return map; - + Workbook workbook = ExcelSupport.parseFile(fileInputStream, EXCEL_TYPE_XLSX); + // 创建一个公式求值器对象 + FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); + Sheet sheet = workbook.getSheetAt(0); + return ExcelPreviewDTO.builder() + .headers(ExcelSupport.getSheetHeader(sheet, 1)) + .list(ExcelParseHelper.parse2List(sheet, evaluator, 2, 1)).build(); } finally { IOUtils.closeQuietly(fileInputStream); } @@ -1074,7 +1079,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); - Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); + Workbook workbook = ExcelSupport.parseFile(fileInputStream, EXCEL_TYPE_XLSX); + Sheet sheet = workbook.getSheetAt(0); // 错误提示信息 @@ -1094,7 +1100,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc // List> data = ExcelParseHelper.parse2Map(sheet, 1); List> data; // if (StringUtils.equals("importSalaryAcctResult", importType)) { - data = ExcelParseHelper.parse2Map(sheet, 2, 1); + data = ExcelParseHelper.parse2Map(workbook, 0, 2, 1); // } else { // data = ExcelParseHelper.parse2Map(sheet, 1); // } diff --git a/src/com/engine/salary/util/excel/ExcelParseHelper.java b/src/com/engine/salary/util/excel/ExcelParseHelper.java index c19bb7b8a..9da6eb545 100644 --- a/src/com/engine/salary/util/excel/ExcelParseHelper.java +++ b/src/com/engine/salary/util/excel/ExcelParseHelper.java @@ -204,6 +204,27 @@ public class ExcelParseHelper { return result; } + public static List> parse2Map(Workbook workbook, int sheetIndex, int rowIndex, int headerRowIndex) { + // 创建一个公式求值器对象 + FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); + Sheet sheet = workbook.getSheetAt(sheetIndex); + int rowCount = sheet.getPhysicalNumberOfRows(); // 总行数 + int cellCount = sheet.getRow(headerRowIndex).getPhysicalNumberOfCells(); // 总列数 + + List sheetHeader = ExcelSupport.getSheetHeader(sheet, headerRowIndex); + + List> result = new ArrayList<>(); + for (; rowIndex < rowCount; rowIndex++) { + Map cellResult = new HashMap<>(); + for (int j = 0; j < cellCount; j++) { + String key = sheetHeader.get(j); + cellResult.put(key, ExcelSupport.getCellValue(sheet, evaluator, rowIndex, j)); + } + result.add(cellResult); + } + return result; + } + /** * 将sheet数据转为map * diff --git a/src/com/engine/salary/web/SalaryAcctController.java b/src/com/engine/salary/web/SalaryAcctController.java index 68e029c08..48ae48837 100644 --- a/src/com/engine/salary/web/SalaryAcctController.java +++ b/src/com/engine/salary/web/SalaryAcctController.java @@ -9,6 +9,7 @@ import com.engine.salary.service.SalaryAcctExcelService; import com.engine.salary.service.impl.SalaryAcctExcelServiceImpl; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.excel.ExcelPreviewDTO; import com.engine.salary.util.page.PageInfo; import com.engine.salary.wrapper.*; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -691,7 +692,7 @@ public class SalaryAcctController { @Produces(MediaType.APPLICATION_JSON) public String importSalaryAcctResultPreview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctImportParam param) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getSalaryAcctExcelService(user)::previewImportSalaryAcctResult, param); + return new ResponseResult(user).run(getSalaryAcctExcelService(user)::previewImportSalaryAcctResult, param); } // **********************************薪资核算结果 end*********************************/