From 7f3b381e5c0a8719b16ee66b6c449550b93f255d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 11 Mar 2022 17:15:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AddUpDeductionExportDetailCmd.java | 20 + .../AddUpDeductionGetDetailListCmd.java | 12 +- .../AddUpSituationExportDetailCmd.java | 21 +- .../AddUpSituationGetDetailListCmd.java | 18 +- .../OtherDeductionExportDetailCmd.java | 21 + .../OtherDeductionGetDetailListCmd.java | 12 +- .../dto/AttendQuoteFieldListDTO.java | 50 +++ .../datacollection/po/AttendQuoteFieldPO.java | 67 +++ .../AttendQuoteFieldMapper.java | 91 ++++ .../datacollection/AttendQuoteFieldMapper.xml | 402 ++++++++++++++++++ 10 files changed, 693 insertions(+), 21 deletions(-) create mode 100644 src/com/engine/salary/entity/datacollection/dto/AttendQuoteFieldListDTO.java create mode 100644 src/com/engine/salary/entity/datacollection/po/AttendQuoteFieldPO.java create mode 100644 src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.java create mode 100644 src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.xml diff --git a/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java index 04fe6dbdb..6a5370981 100644 --- a/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java +++ b/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java @@ -4,13 +4,19 @@ import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; import com.engine.salary.biz.AddUpDeductionBiz; +import com.engine.salary.biz.EmployBiz; import com.engine.salary.entity.datacollection.AddUpDeduction; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; import com.engine.salary.exception.SalaryRunTimeException; +import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; +import java.util.Collections; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand { @@ -27,6 +33,7 @@ public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); + if (CollectionUtils.isEmpty(employeeList)) { + throw new SalaryRunTimeException("员工信息不存在"); + } + + //查询参数 + queryParam.setEmployeeId(po.getEmployeeId()); + //申报月份 + List declareMonth = queryParam.getDeclareMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + XSSFWorkbook workbook = biz.exportDetail(queryParam); return workbook; diff --git a/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetDetailListCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetDetailListCmd.java index 4796b1722..9785aadaf 100644 --- a/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetDetailListCmd.java +++ b/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetDetailListCmd.java @@ -57,7 +57,13 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand declareMonth = queryParam.getDeclareMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } String fields = " t1.id," + " t1.declare_month as declareMonth," + @@ -98,12 +104,6 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand declareMonth = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0"; Collection ids = queryParam.getIds(); if (CollectionUtils.isNotEmpty(ids)) { diff --git a/src/com/engine/salary/cmd/datacollection/AddUpSituationExportDetailCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpSituationExportDetailCmd.java index 5a3bca6fe..2e73ce9d6 100644 --- a/src/com/engine/salary/cmd/datacollection/AddUpSituationExportDetailCmd.java +++ b/src/com/engine/salary/cmd/datacollection/AddUpSituationExportDetailCmd.java @@ -4,13 +4,19 @@ import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; import com.engine.salary.biz.AddUpSituationBiz; +import com.engine.salary.biz.EmployBiz; import com.engine.salary.entity.datacollection.AddUpSituation; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; import com.engine.salary.exception.SalaryRunTimeException; +import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; +import java.util.Collections; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class AddUpSituationExportDetailCmd extends AbstractCommonCommand { @@ -28,7 +34,7 @@ public class AddUpSituationExportDetailCmd extends AbstractCommonCommand employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); + if (CollectionUtils.isEmpty(employeeList)) { + throw new SalaryRunTimeException("员工信息不存在"); + } + + //查询参数 + queryParam.setEmployeeId(po.getEmployeeId()); + //申报月份 + List taxYearMonths = queryParam.getTaxYearMonth(); + if (CollectionUtils.isNotEmpty(taxYearMonths)) { + queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + XSSFWorkbook workbook = biz.exportDetail(queryParam); return workbook; } diff --git a/src/com/engine/salary/cmd/datacollection/AddUpSituationGetDetailListCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpSituationGetDetailListCmd.java index 2594bde0f..ce330e943 100644 --- a/src/com/engine/salary/cmd/datacollection/AddUpSituationGetDetailListCmd.java +++ b/src/com/engine/salary/cmd/datacollection/AddUpSituationGetDetailListCmd.java @@ -57,6 +57,14 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand taxYearMonths = queryParam.getTaxYearMonth(); + if (CollectionUtils.isNotEmpty(taxYearMonths)) { + queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + String fields = " t1.id," + " t1.tax_year_month," + @@ -94,7 +102,7 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand table = new SalaryWeaTable(user, AddUpSituationRecordDTO.class); table.setBackfields(fields); table.setSqlform(fromSql); - table.setSqlwhere(makeSqlWhere()); + table.setSqlwhere(makeSqlWhere(queryParam)); table.setSqlorderby("t1.id DESC"); table.setSqlprimarykey("t1.id"); table.setSqlisdistinct("false"); @@ -106,14 +114,8 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand taxYearMonths = queryParam.getTaxYearMonth(); - if (CollectionUtils.isNotEmpty(taxYearMonths)) { - queryParam.setTaxYearMonth(taxYearMonths.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0 AND e.status not in (7)"; Collection ids = queryParam.getIds(); diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java index 97e2307fb..b5f79e97a 100644 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java +++ b/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java @@ -3,14 +3,20 @@ package com.engine.salary.cmd.datacollection; import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; +import com.engine.salary.biz.EmployBiz; import com.engine.salary.biz.OtherDeductionBiz; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.exception.SalaryRunTimeException; +import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; +import java.util.Collections; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class OtherDeductionExportDetailCmd extends AbstractCommonCommand { @@ -28,6 +34,7 @@ public class OtherDeductionExportDetailCmd extends AbstractCommonCommand employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); + if (CollectionUtils.isEmpty(employeeList)) { + throw new SalaryRunTimeException("员工信息不存在"); + } + + //构建参数 + queryParam.setEmployeeId(po.getEmployeeId()); + //申报月份 + List declareMonth = queryParam.getDeclareMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + + XSSFWorkbook workbook = biz.exportDetail(queryParam); return workbook; diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java index f361b2b75..3aea3f2fd 100644 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java +++ b/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java @@ -57,7 +57,13 @@ public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand declareMonth = queryParam.getDeclareMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } String fields = " t1.id," + " t1.declare_month as declareMonth," + @@ -97,12 +103,6 @@ public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand declareMonth = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0"; Collection ids = queryParam.getIds(); if (CollectionUtils.isNotEmpty(ids)) { diff --git a/src/com/engine/salary/entity/datacollection/dto/AttendQuoteFieldListDTO.java b/src/com/engine/salary/entity/datacollection/dto/AttendQuoteFieldListDTO.java new file mode 100644 index 000000000..7214fe82c --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/dto/AttendQuoteFieldListDTO.java @@ -0,0 +1,50 @@ +package com.engine.salary.entity.datacollection.dto; + +import com.engine.salary.annotation.SalaryTableColumn; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 数据采集-考勤引用字段列表 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AttendQuoteFieldListDTO { + //主键id + @JsonSerialize(using = ToStringSerializer.class) + @SalaryTableColumn(column = "id", display = false) + private Long id; + + @SalaryTableColumn(text = "字段名称", width = "10%", column = "fieldName") + private String fieldName; + + //来源。1:自定义、2:考勤模块 + @SalaryTableColumn(text = "来源", width = "10%", column = "sourceType") + private String sourceType; + + //来源。1:自定义、2:考勤模块 + private String sourceTypeValue; + + //字段类型。1:数值、2:文本 + @SalaryTableColumn(text = "类型", width = "10%", column = "fieldType") + private String fieldType; + + //是否启用。0:否、1:是 + @SalaryTableColumn(text = "是否启用", width = "10%", column = "enableStatus") + private Integer enableStatus; + + //备注 + @SalaryTableColumn(text = "备注", width = "10%", column = "description") + private String description; +} diff --git a/src/com/engine/salary/entity/datacollection/po/AttendQuoteFieldPO.java b/src/com/engine/salary/entity/datacollection/po/AttendQuoteFieldPO.java new file mode 100644 index 000000000..84d0647ab --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/po/AttendQuoteFieldPO.java @@ -0,0 +1,67 @@ +package com.engine.salary.entity.datacollection.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 考勤引用字段表 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AttendQuoteFieldPO { + /** + * 主键 + */ + private Long id; + /** + * 字段名称 + */ + private String fieldName; + /** + * 来源。1:自定义、2:考勤模块 + */ + private Integer sourceType; + /** + * 字段类型。1:数值、2:文本 + */ + private Integer fieldType; + /** + * 是否启用。0:否、1:是 + */ + private Integer enableStatus; + /** + * 编码(对应考勤模块字段) + */ + private String code; + /** + * 备注 + */ + private String description; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 创建人 + */ + private Long creator; + /** + * 是否已删除。0:未删除、1:已删除 + */ + private Integer deleteType; + /** + * 租户ID + */ + private String tenantKey; + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.java b/src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.java new file mode 100644 index 000000000..815c9213f --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.java @@ -0,0 +1,91 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO; +import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam; +import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AttendQuoteFieldMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + AttendQuoteFieldPO getById(Long id); + + /** + * 新增,忽略null字段 + * + * @param AttendQuoteFieldPO 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(AttendQuoteFieldPO AttendQuoteFieldPO); + + /** + * 修改,修改所有字段 + * + * @param AttendQuoteFieldPO 修改的记录 + * @return 返回影响行数 + */ + int update(AttendQuoteFieldPO AttendQuoteFieldPO); + + /** + * 修改,忽略null字段 + * + * @param AttendQuoteFieldPO 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(AttendQuoteFieldPO AttendQuoteFieldPO); + + /** + * 删除记录 + * + * @param AttendQuoteFieldPO 待删除的记录 + * @return 返回影响行数 + */ + int delete(AttendQuoteFieldPO AttendQuoteFieldPO); + + + + + + /** + * 查询数据采集-考勤引用字段列表 + * @param param + * @return + */ + List list(@Param("param") AttendQuoteFieldQueryParam param); + + + /** + * 批量删除数据采集-考勤引用字段 + * @param ids + */ + void deleteByIds(@Param("ids") Collection ids); + + /** + * 插入 + * @param saves + */ + void saveBatch(@Param("saves") List saves); + + /** + * 更新字段名 + * @param updates + */ + void updateNameByCode(@Param("updates") List updates); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.xml b/src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.xml new file mode 100644 index 000000000..dcfc4051d --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AttendQuoteFieldMapper.xml @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + t + . + id + , t.field_name + , t.source_type + , t.field_type + , t.enable_status + , t.code + , t.description + , t.create_time + , t.update_time + , t.creator + , t.delete_type + , t.tenant_key + + + + + + + + + + + INSERT INTO hrsa_attend_quote_field + + + + id, + + + field_name, + + + source_type, + + + field_type, + + + enable_status, + + + code, + + + description, + + + create_time, + + + update_time, + + + creator, + + + delete_type, + + + tenant_key, + + + + + #{id}, + + + #{fieldName}, + + + #{sourceType}, + + + #{fieldType}, + + + #{enableStatus}, + + + #{code}, + + + #{description}, + + + #{createTime}, + + + #{updateTime}, + + + #{creator}, + + + #{deleteType}, + + + #{tenantKey}, + + + + + + + UPDATE hrsa_attend_quote_field + + field_name=#{fieldName}, + source_type=#{sourceType}, + field_type=#{fieldType}, + enable_status=#{enableStatus}, + code=#{code}, + description=#{description}, + create_time=#{createTime}, + update_time=#{updateTime}, + creator=#{creator}, + delete_type=#{deleteType}, + tenant_key=#{tenantKey}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_attend_quote_field + + + field_name=#{fieldName}, + + + source_type=#{sourceType}, + + + field_type=#{fieldType}, + + + enable_status=#{enableStatus}, + + + code=#{code}, + + + description=#{description}, + + + create_time=#{createTime}, + + + update_time=#{updateTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + tenant_key=#{tenantKey}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_attend_quote_field + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + + t1 + . + id + , + t1.field_name, + t1.source_type, + t1.field_type, + t1.enable_status, + t1.description + + + + + AND t1.id IN + + #{id} + + + + AND t1.field_name like CONCAT('%',#{param.fieldName},'%') + + + + + AND t1.id IN + + #{id} + + + + AND t1.field_name like '%'||#{param.fieldName}||'%' + + + + + AND t1.id IN + + #{id} + + + + AND t1.field_name like '%'+#{param.fieldName}+'%' + + + + + + + + + INSERT INTO hrsa_attend_quote_field + (id,field_name,source_type,field_type,enable_status,code,description,create_time,update_time,creator,delete_type,tenant_key) + VALUES + + ( + #{item.id}, + #{item.fieldName}, + #{item.sourceType}, + #{item.fieldType}, + #{item.enableStatus}, + #{item.code}, + #{item.description}, + #{item.createTime},#{item.updateTime}, #{item.creator}, 0, #{item.tenantKey} + ) + + + + INSERT INTO hrsa_attend_quote_field + (id,field_name,source_type,field_type,enable_status,code,description,create_time,update_time,creator,delete_type,tenant_key) + + + select + #{item.id}, + #{item.fieldName}, + #{item.sourceType}, + #{item.fieldType}, + #{item.enableStatus}, + #{item.code}, + #{item.description}, + #{item.createTime},#{item.updateTime}, #{item.creator}, 0, #{item.tenantKey} + from dual + + + + INSERT INTO hrsa_attend_quote_field + (id,field_name,source_type,field_type,enable_status,code,description,create_time,update_time,creator,delete_type,tenant_key) + VALUES + + ( + #{item.id}, + #{item.fieldName}, + #{item.sourceType}, + #{item.fieldType}, + #{item.enableStatus}, + #{item.code}, + #{item.description}, + #{item.createTime},#{item.updateTime}, #{item.creator}, 0, #{item.tenantKey} + ) + + + + + update hrsa_attend_quote_field + + + + + when code=#{item.code} then #{item.fieldName} + + + + + + + when code=#{item.code} then #{item.updateTime} + + + + + where + + + + code in + + #{item.code} + + + + + \ No newline at end of file