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] =?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); + } } }