diff --git a/resource/sqlupgrade/Mysql/sql202412190103CZGYMTCYXGS.sql b/resource/sqlupgrade/Mysql/sql202412190103CZGYMTCYXGS.sql new file mode 100644 index 000000000..e10b1401c --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202412190103CZGYMTCYXGS.sql @@ -0,0 +1,11 @@ +ALTER TABLE hrsa_salary_sob ADD attend_cycle_end_day int NULL +; + +ALTER TABLE hrsa_salary_sob ADD attend_type int NULL +; + +ALTER TABLE hrsa_salary_sob ADD attend_cycle_type2 int NULL +; + +update hrsa_salary_sob set attend_cycle_type2 = 3, attend_cycle_end_day = 25, attend_type=1 +; \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202412190103CZGYMTCYXGS.sql b/resource/sqlupgrade/SQLServer/sql202412190103CZGYMTCYXGS.sql new file mode 100644 index 000000000..5eda0cef4 --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202412190103CZGYMTCYXGS.sql @@ -0,0 +1,11 @@ +ALTER TABLE hrsa_salary_sob ADD attend_cycle_end_day int NULL +GO + +ALTER TABLE hrsa_salary_sob ADD attend_type int NULL +GO + +ALTER TABLE hrsa_salary_sob ADD attend_cycle_type2 int NULL +GO + +update hrsa_salary_sob set attend_cycle_type2 = 3, attend_cycle_end_day = 25, attend_type=1 +GO \ No newline at end of file diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java index e84a890ee..04aecb256 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java @@ -46,6 +46,9 @@ public class SalarySobBO { .taxCycleType(saveParam.getTaxCycleType()) .attendCycleType(saveParam.getAttendCycleType()) .attendCycleFromDay(saveParam.getAttendCycleFromDay()) + .attendCycleType2(saveParam.getAttendCycleType2()) + .attendCycleEndDay(saveParam.getAttendCycleEndDay()) + .attendType(saveParam.getAttendType()) .socialSecurityCycleType(saveParam.getSocialSecurityCycleType()) .disable(NumberUtils.INTEGER_ZERO) .creator(employeeId) @@ -141,6 +144,9 @@ public class SalarySobBO { .setTaxCycleType(salarySobPO.getTaxCycleType()) .setAttendCycleType(salarySobPO.getAttendCycleType()) .setAttendCycleFromDay(salarySobPO.getAttendCycleFromDay()) + .setAttendCycleType2(salarySobPO.getAttendCycleType2()) + .setAttendCycleEndDay(salarySobPO.getAttendCycleEndDay()) + .setAttendType(salarySobPO.getAttendType()) .setSocialSecurityCycleType(salarySobPO.getSocialSecurityCycleType()) .setTaxAgentId(salarySobPO.getTaxAgentId()) .setDescription(salarySobPO.getDescription()); diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobCycleBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobCycleBO.java index 37a505a31..dcfa831ff 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobCycleBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobCycleBO.java @@ -39,6 +39,7 @@ public class SalarySobCycleBO { .socialSecurityCycle(buildCycle(salaryMonth, salarySob.getSocialSecurityCycleType())) .salaryCycle(buildCycleDateRange(salaryMonth, salarySob.getSalaryCycleType(), salarySob.getSalaryCycleFromDay())) .attendCycle(buildCycleDateRange(salaryMonth, salarySob.getAttendCycleType(), salarySob.getAttendCycleFromDay())) + .attendCycle2(buildCycleDateRange2(salaryMonth, salarySob.getAttendCycleType2(), salarySob.getAttendCycleEndDay())) .build(); salarySobCycleDTO.setSalaryDate(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth(), 1)); @@ -106,4 +107,27 @@ public class SalarySobCycleBO { .endDate(Date.from(endInstant)) .build(); } + + /** + * 定制考勤周期,指定考勤周期的结束日期 + * 根据薪资所属月、薪资账套所设置的薪资周期(或考勤周期)、薪资周期起始日(活考勤周期起始日)计算出薪资账套的薪资周期、考勤周期的具体日期范围 + * + * @param salaryMonth 薪资所属月 + * @param cycleType 薪资账套所设置的薪资周期(或考勤周期) + * @param endDay 薪资账套所设置的薪资周期结束日期 + * @return + */ + private static LocalDateRange buildCycleDateRange2(YearMonth salaryMonth, Integer cycleType, Integer endDay) { + YearMonth result = buildCycle(salaryMonth, cycleType); + if (result == null) { + return null; + } + LocalDate fromDate = result.atDay(1); + LocalDate endDate = result.atDay(endDay); + + return LocalDateRange.builder() + .fromDate(SalaryDateUtil.localDateToDate(fromDate)) + .endDate(SalaryDateUtil.localDateToDate(endDate)) + .build(); + } } diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobBasicFormDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobBasicFormDTO.java index 131668372..570844192 100644 --- a/src/com/engine/salary/entity/salarysob/dto/SalarySobBasicFormDTO.java +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobBasicFormDTO.java @@ -71,6 +71,23 @@ public class SalarySobBasicFormDTO { //考勤周期起始日期") private Integer attendCycleFromDay; + + /** + * 定制考勤周期2 + * @see SalaryCycleTypeEnum + */ + private Integer attendCycleType2; + + /** + * 定制考勤周期,指定考勤周期的结束日期 + */ + private Integer attendCycleEndDay; + + /** + * 采用哪个考勤周期,0正常,1定制 + */ + private Integer attendType; + /** * 福利台账月份 * @see SalaryCycleTypeEnum diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobCycleDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobCycleDTO.java index 70a688b10..19a125496 100644 --- a/src/com/engine/salary/entity/salarysob/dto/SalarySobCycleDTO.java +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobCycleDTO.java @@ -47,6 +47,8 @@ public class SalarySobCycleDTO { //考勤周期") private LocalDateRange attendCycle; + private LocalDateRange attendCycle2; + /** * 公式变量 diff --git a/src/com/engine/salary/entity/salarysob/param/SalarySobBasicSaveParam.java b/src/com/engine/salary/entity/salarysob/param/SalarySobBasicSaveParam.java index bd86de4d6..3d8858134 100644 --- a/src/com/engine/salary/entity/salarysob/param/SalarySobBasicSaveParam.java +++ b/src/com/engine/salary/entity/salarysob/param/SalarySobBasicSaveParam.java @@ -83,6 +83,21 @@ public class SalarySobBasicSaveParam { @DataCheck(require = true, message = "考勤周期起始日期不允许为空") private Integer attendCycleFromDay; + /** + * 定制考勤周期。1:上上月、2:上月、3:本月、4:下月 + */ + private Integer attendCycleType2; + + /** + * 定制考勤周期,指定考勤周期的结束日期 + */ + private Integer attendCycleEndDay; + + /** + * 采用哪个考勤周期,0正常,1定制 + */ + private Integer attendType; + /** * 福利台账月份不允许为空 * diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java index 231d6f866..0d163673c 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java @@ -106,6 +106,21 @@ public class SalarySobPO { @XStreamAsAttribute private Integer attendCycleFromDay; + /** + * 考勤周期2。1:上上月、2:上月、3:本月、4:下月 + */ + private Integer attendCycleType2; + + /** + * 定制考勤周期,指定考勤周期的结束日期 + */ + private Integer attendCycleEndDay; + + /** + * 采用哪个考勤周期,0正常,1定制 + */ + private Integer attendType; + /** * 社保福利所属期。1:上上月、2:上月、3:本月、4:下月 */ diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml index 59f40120d..395f593be 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml @@ -19,6 +19,9 @@ + + + @@ -42,6 +45,9 @@ , t.delete_type , t.tenant_key , t.tax_agent_id + , t.attend_cycle_type2 + , t.attend_cycle_end_day + , t.attend_type @@ -162,6 +168,15 @@ attend_cycle_from_day, + + attend_cycle_type2, + + + attend_cycle_end_day, + + + attend_type, + social_security_cycle_type, @@ -215,6 +230,15 @@ #{attendCycleFromDay}, + + #{attendCycleType2}, + + + #{attendCycleEndDay}, + + + #{attendType}, + #{socialSecurityCycleType}, @@ -279,6 +303,15 @@ attend_cycle_from_day, + + attend_cycle_type2, + + + attend_cycle_end_day, + + + attend_type, + social_security_cycle_type, @@ -332,6 +365,15 @@ #{attendCycleFromDay}, + + #{attendCycleType2}, + + + #{attendCycleEndDay}, + + + #{attendType}, + #{socialSecurityCycleType}, @@ -373,6 +415,9 @@ tax_cycle_type=#{taxCycleType}, attend_cycle_type=#{attendCycleType}, attend_cycle_from_day=#{attendCycleFromDay}, + attend_cycle_type2=#{attendCycleType2}, + attend_cycle_end_day=#{attendCycleEndDay}, + attend_type=#{attendType}, social_security_cycle_type=#{socialSecurityCycleType}, disable=#{disable}, description=#{description}, @@ -411,6 +456,15 @@ attend_cycle_from_day=#{attendCycleFromDay}, + + attend_cycle_type2=#{attendCycleType2}, + + + attend_cycle_end_day=#{attendCycleEndDay}, + + + attend_type=#{attendType}, + social_security_cycle_type=#{socialSecurityCycleType}, diff --git a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java index 48648cc57..a8203f848 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java @@ -390,7 +390,13 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa // 4.获取考勤模块数据 - List> attendQuoteSyncData = getAttendQuoteDataFromRemoteAttend(salarySobCycleDTO.getAttendCycle(), employeeIds, attendQuoteFields); + LocalDateRange attendCycle; + if (salarySobPO.getAttendType() == 0) { + attendCycle = salarySobCycleDTO.getAttendCycle(); + } else { + attendCycle = salarySobCycleDTO.getAttendCycle2(); + } + List> attendQuoteSyncData = getAttendQuoteDataFromRemoteAttend(attendCycle, employeeIds, attendQuoteFields); List pos = new ArrayList<>(); List values = new ArrayList<>(); // 5.考勤引用数据处理 @@ -398,7 +404,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa if (CollectionUtils.isNotEmpty(attendQuoteSyncData)) { // 3.生成考勤引用 - AttendQuotePO attendQuote = getAttendQuote(AttendQuoteSourceTypeEnum.QUOTE, salarySobId, year, month, syncParam.getDescription()); + AttendQuotePO attendQuote = getAttendQuote(AttendQuoteSourceTypeEnum.QUOTE, salarySobId, year, month, syncParam.getDescription(), attendCycle); for (Long employeeId : employeeIds) { AttendQuoteDataPO po = new AttendQuoteDataPO(); @@ -471,7 +477,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa * @param month * @return */ - private AttendQuotePO getAttendQuote(AttendQuoteSourceTypeEnum sourceType, Long salarySobId, int year, int month, String description) { + private AttendQuotePO getAttendQuote(AttendQuoteSourceTypeEnum sourceType, Long salarySobId, int year, int month, String description, LocalDateRange attendCycle) { SalarySobCycleDTO salarySobCycle = getSalarySobService(user).getSalarySobCycle(salarySobId, YearMonth.of(year, month)); Date salaryYearMonthDayDate = SalaryDateUtil.localDateToDate(YearMonth.of(year, month).atDay(1)); @@ -485,7 +491,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa LocalDateRange salaryCycleRange = salarySobCycle.getSalaryCycle(); LocalDateRange attendCycleRange = salarySobCycle.getAttendCycle(); // 考勤周期 - attendQuote.setAttendCycle(SalaryDateUtil.getFormatLocalDate(attendCycleRange.getFromDate()) + " ~ " + SalaryDateUtil.getFormatLocalDate(attendCycleRange.getEndDate())); + attendQuote.setAttendCycle(SalaryDateUtil.getFormatLocalDate(attendCycle.getFromDate()) + " ~ " + SalaryDateUtil.getFormatLocalDate(attendCycle.getEndDate())); // 薪资周期 attendQuote.setSalaryCycle(SalaryDateUtil.getFormatLocalDate(salaryCycleRange.getFromDate()) + " ~ " + SalaryDateUtil.getFormatLocalDate(salaryCycleRange.getEndDate())); attendQuote.setSalaryYearMonth(salaryYearMonthDayDate); @@ -686,8 +692,16 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa List employees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL); // 获取已设置的可同步的考勤字段 List attendQuoteFields = getAttendQuoteSetFields(AttendQuoteSourceTypeEnum.IMPORT); + // 获取薪资账套 + SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salarySobId, YearMonth.of(year, month)); + LocalDateRange attendCycle; + if (salarySobPO.getAttendType() == 0) { + attendCycle = salarySobCycleDTO.getAttendCycle(); + } else { + attendCycle = salarySobCycleDTO.getAttendCycle2(); + } // 生成获取考勤引用 - AttendQuotePO attendQuote = getAttendQuote(AttendQuoteSourceTypeEnum.IMPORT, salarySobId, year, month, StringUtils.EMPTY); + AttendQuotePO attendQuote = getAttendQuote(AttendQuoteSourceTypeEnum.IMPORT, salarySobId, year, month, StringUtils.EMPTY, attendCycle); int total = 0; diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index ee9066254..ec5c60e36 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -565,6 +565,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { .setTaxCycleType(saveParam.getTaxCycleType()) .setAttendCycleType(saveParam.getAttendCycleType()) .setAttendCycleFromDay(saveParam.getAttendCycleFromDay()) + .setAttendCycleType2(saveParam.getAttendCycleType2()) + .setAttendCycleEndDay(saveParam.getAttendCycleEndDay()) + .setAttendType(saveParam.getAttendType()) .setSocialSecurityCycleType(saveParam.getSocialSecurityCycleType()) .setDescription(saveParam.getDescription()) .setUpdateTime(new Date()); @@ -731,6 +734,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { .taxCycleType(salarySobPO.getTaxCycleType()) .attendCycleType(salarySobPO.getAttendCycleType()) .attendCycleFromDay(salarySobPO.getAttendCycleFromDay()) + .attendCycleType2(salarySobPO.getAttendCycleType2()) + .attendCycleEndDay(salarySobPO.getAttendCycleEndDay()) + .attendType(salarySobPO.getAttendType()) .socialSecurityCycleType(salarySobPO.getSocialSecurityCycleType()) .disable(salarySobPO.getDisable()) .creator((long) user.getUID())