diff --git a/src/com/engine/salary/mapper/SQLMapper.java b/src/com/engine/salary/mapper/SQLMapper.java index 4d998fa88..9afff661a 100644 --- a/src/com/engine/salary/mapper/SQLMapper.java +++ b/src/com/engine/salary/mapper/SQLMapper.java @@ -15,4 +15,6 @@ import java.util.Map; **/ public interface SQLMapper { List runSQL(@Param("sql") String sql); + + List listLong(@Param("sql") String sql); } diff --git a/src/com/engine/salary/mapper/SQLMapper.xml b/src/com/engine/salary/mapper/SQLMapper.xml index bba76972c..b487b3f53 100644 --- a/src/com/engine/salary/mapper/SQLMapper.xml +++ b/src/com/engine/salary/mapper/SQLMapper.xml @@ -4,4 +4,9 @@ + + + diff --git a/src/com/engine/salary/remote/attend/service/impl/RemoteAttend4SalaryServiceImpl.java b/src/com/engine/salary/remote/attend/service/impl/RemoteAttend4SalaryServiceImpl.java index eeddfd41d..c54bbf10b 100644 --- a/src/com/engine/salary/remote/attend/service/impl/RemoteAttend4SalaryServiceImpl.java +++ b/src/com/engine/salary/remote/attend/service/impl/RemoteAttend4SalaryServiceImpl.java @@ -2,12 +2,15 @@ package com.engine.salary.remote.attend.service.impl; import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.fastjson.JSONObject; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.kq.cmd.report.GetKQReportCmd; import com.engine.salary.mapper.datacollection.AttendQuoteFieldMapper; import com.engine.salary.remote.attend.cmd.GetSearchListCmd; import com.engine.salary.remote.attend.entity.Attend4Salary; import com.engine.salary.remote.attend.service.RemoteAttend4SalaryService; +import com.engine.salary.sys.service.SalarySysConfService; +import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.db.MapperProxyFactory; @@ -20,11 +23,14 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import weaver.general.BaseBean; import weaver.general.Util; +import weaver.hrm.User; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; +import static com.engine.salary.sys.constant.SalarySysConstant.ATTENDANCE_SERIAL_COLLECTION_BTN; + @Slf4j public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAttend4SalaryService { private final Boolean isLog = "true".equals(new BaseBean().getPropValue("hrmSalary", "log")); @@ -33,12 +39,23 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt return MapperProxyFactory.getProxy(AttendQuoteFieldMapper.class); } + private SalarySysConfService getSalarySysConfService(User user) { + return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); + } + + //是否采集考勤班次数据 + boolean isCollectAttendanceSerial = "1".equals(getSalarySysConfService(user).getValueByCode(ATTENDANCE_SERIAL_COLLECTION_BTN)); + + @Override public List> getColumns() { - //兼容获取班次信息字段 - List attendanceSerials = getAttendQuoteFieldMapper().getAttendanceSerials(); - String attendanceSerial = Joiner.on(",").join((Iterable) attendanceSerials); + //是否采集考勤班次数据 + String attendanceSerial = ""; + if (isCollectAttendanceSerial) { + List attendanceSerials = getAttendQuoteFieldMapper().getAttendanceSerials(); + attendanceSerial = Joiner.on(",").join((Iterable) attendanceSerials); + } Map paramsMap = new HashMap(); paramsMap.put("typeselect", "3"); @@ -146,7 +163,7 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt paramsMap.put("resourceId", String.join(",", resourceIds)); paramsMap.put("isNoAccount", "1"); //班次 - paramsMap.put("attendanceSerial", attend4Salary.getAttendanceSerial()); + paramsMap.put("attendanceSerial", isCollectAttendanceSerial ? attend4Salary.getAttendanceSerial() : ""); paramsMap.put("isFromMyAttendance", "1"); Map temp = new HashMap(); temp.put("data", JSONObject.toJSONString(paramsMap)); diff --git a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java index c516bb229..9d990ea50 100644 --- a/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java +++ b/src/com/engine/salary/report/wrapper/SalaryStatisticsReportWrapper.java @@ -472,7 +472,7 @@ public class SalaryStatisticsReportWrapper extends Service { SalaryStatisticsItemPO salaryStatisticsItemPO = salaryStatisticsItemMap.get(salaryItemId); if (salaryStatisticsItemPO != null) { Optional textItemOptional = Arrays.stream(salaryStatisticsItemPO.getItemValue().split(",")).filter(itemId -> !numberItemIds.contains(itemId)).findFirst(); - row.add((!textItemOptional.isPresent() && NumberUtils.isCreatable(Utils.null2String(map.get(k)))) ? new BigDecimal(Utils.null2String(map.get(k))) : map.getOrDefault(k, StringUtils.EMPTY)); + row.add((!textItemOptional.isPresent() && NumberUtils.isCreatable(Utils.null2String(map.get(k)).replaceAll(",", ""))) ? new BigDecimal(Utils.null2String(map.get(k)).replaceAll(",", "")) : map.getOrDefault(k, StringUtils.EMPTY)); } else { row.add(map.getOrDefault(k, StringUtils.EMPTY)); } diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index 95e423ea0..dde1ff92c 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -3565,7 +3565,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService } List isPaymentList = insuranceSchemeDetailPOList.stream() .filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue()) && f.getPaymentScope().equals(paymentScope)).collect(Collectors.toList()); - log.info("自动调整 isPaymentList", isPaymentList.size()); + log.info("自动调整 isPaymentList: {}", isPaymentList.size()); if (isPaymentList.size() > 0) { InsuranceSchemeDetailPO insuranceSchemeDetailPO = isPaymentList.get(0); @@ -3584,7 +3584,6 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService } } else { log.info("自动调整 福利明细项属于未缴费状态,不对上下限进行约束"); - return null; } } log.info("自动调整后 基数信息{}", paymentBaseJson); diff --git a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java index ce89f8196..67aff3ecd 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java @@ -1082,9 +1082,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc stopWatch.stop(); // 租户下所有的人员 stopWatch.start("薪资核算确认的人员"); - List salaryEmployees = getSalaryEmployeeService(user).listAllForReport(); - Map salaryEmployeeMap = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getUsername, DataCollectionEmployee::getEmployeeId); - Map emps = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getEmployeeId); + List employeeIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); + List salaryEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); stopWatch.stop(); // 租户下所有的个税扣缴义务人 stopWatch.start("租户下所有的个税扣缴义务人"); diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index c428e20b9..30662220c 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -50,6 +50,7 @@ import com.engine.salary.enums.salarybill.*; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.engine.salary.enums.salarysend.SalarySendGrantTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.SQLMapper; import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper; import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper; import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper; @@ -65,6 +66,7 @@ import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.IdGenerator; +import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -198,6 +200,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService return ServiceUtil.getService(SalaryBillBaseSetServiceImpl.class, user); } + private SQLMapper getSQLMapper() { + return MapperProxyFactory.getProxy(SQLMapper.class); + } + @Override public SalarySendPO getById(Long salarySendId) { return mapper.getById(salarySendId); @@ -479,9 +485,18 @@ public class SalarySendServiceImpl extends Service implements SalarySendService if (salarySendInfo == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在")); } + Long employeeId = salarySendInfo.getEmployeeId(); + if (currentEmployeeId.compareTo(employeeId) != 0) { - if (currentEmployeeId.compareTo(salarySendInfo.getEmployeeId()) != 0) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单")); + //主账号可以查看次账号工资单 + String sql = "select id from Hrmresource a where belongto= " + currentEmployeeId; + List belongtoIds = getSQLMapper().listLong(sql); + if (CollUtil.isNotEmpty(belongtoIds) && belongtoIds.contains(employeeId)) { + //切换user +// this.user = new User(new Integer(employeeId + "")); + } else { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单")); + } } // 获取默认模板信息 @@ -562,7 +577,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService // 获取薪资项目数据 Long salaryAcctRecordId = salarySendInfo.getSalaryAcctRecordId(); - List salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).employeeId(currentEmployeeId).build()); + List salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).employeeId(employeeId).build()); if (CollUtil.isEmpty(salaryAcctResultPOS)) { throw new SalaryRunTimeException("薪资核算结果不存在!"); } @@ -641,16 +656,16 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId()); - DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salarySendInfo.getEmployeeId()); + DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(employeeId); SalaryAcctEmployeePO acctEmployeePO = getSalaryAcctEmployeeService(user).getById(salaryAcctResultPOS.get(0).getSalaryAcctEmpId()); SalaryAcctEmployeeBO.copyAcctEmp(simpleEmployee, acctEmployeePO); buildEmployeeInfo(employeeInformation, simpleEmployee, taxAgentPO.getName(), SalaryAcctResultBO.buildEmployeeFieldName()); map.put("employeeInformation", employeeInformation); map.put("salaryGroups", itemSetListDTOS); - salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salaryMonth, currentEmployeeId)); + salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salaryMonth, employeeId)); // 工资单水印文本型动态变量 == 处理 - handleSalaryWatermark(salaryTemplate, salarySendInfo, currentEmployeeId); + handleSalaryWatermark(salaryTemplate, salarySendInfo, employeeId); map.put("salaryTemplate", salaryTemplate); map.put("salaryAcctResult", salaryAcctResultS); @@ -704,7 +719,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService MonthTypeEnum monthType = salaryBillViewingLimitSetting.getMonthType(); LocalDate localDate; if (monthType == MonthTypeEnum.SALARY_DATE) { - localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth()+1).withDayOfMonth(1); + localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth() + 1).withDayOfMonth(1); } else { localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth()); } @@ -720,7 +735,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService * @param salaryTemplate * @param salarySendInfo */ - private void handleSalaryWatermark(SalaryTemplatePO salaryTemplate, SalarySendInfoPO salarySendInfo, Long currentEmployeeId) { + private void handleSalaryWatermark(SalaryTemplatePO salaryTemplate, SalarySendInfoPO salarySendInfo, Long employeeId) { SalaryBillWatermarkDTO salaryBillWatermark = JsonUtil.parseObject(salaryTemplate.getSalaryWatermark(), SalaryBillWatermarkDTO.class); if (Objects.isNull(salaryBillWatermark) || Boolean.FALSE.equals(salaryBillWatermark.getWatermarkStatus())) { return; @@ -734,7 +749,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService boolean needQueryEmp = (boolean) salaryBillWatermark.getWmSetting().getOrDefault("needQueryEmp", false); DataCollectionEmployee simpleEmployee = null; if (needQueryEmp) { - simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(currentEmployeeId); + simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(employeeId); } String wmText = salaryBillWatermark.getWmSetting().getOrDefault("wmText", StringUtils.EMPTY).toString(); @@ -865,12 +880,12 @@ public class SalarySendServiceImpl extends Service implements SalarySendService * * @param theme * @param salaryMonth - * @param currentEmployeeId + * @param employeeId * @return */ - private String getBillTitle(String theme, Date salaryMonth, Long currentEmployeeId) { + private String getBillTitle(String theme, Date salaryMonth, Long employeeId) { String companyName = ""; - if (currentEmployeeId != null) { + if (employeeId != null) { ResourceComInfo resourceComInfo = null; SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); try { @@ -879,7 +894,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } catch (Exception e) { log.error("资源异常", e); } - companyName = subCompanyComInfo.getSubCompanyname(resourceComInfo.getSubCompanyID(currentEmployeeId + "")); + companyName = subCompanyComInfo.getSubCompanyname(resourceComInfo.getSubCompanyID(employeeId + "")); } return theme.replace("${companyName}", companyName) .replace("${salaryMonth}", new SimpleDateFormat("yyyy年MM月").format(salaryMonth)) @@ -934,7 +949,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService .jobtitleName(simpleEmployee.getJobtitleName()) .jobtitleId(simpleEmployee.getJobtitleId()) .status(simpleEmployee.getStatus() == null ? "" : simpleEmployee.getStatus()) - .statusName(simpleEmployee.getStatus() == null ? "" : UserStatusEnum.parseByValue(new Integer(Util.null2s(simpleEmployee.getStatus(),"1"))).getDefaultLabel()) + .statusName(simpleEmployee.getStatus() == null ? "" : UserStatusEnum.parseByValue(new Integer(Util.null2s(simpleEmployee.getStatus(), "1"))).getDefaultLabel()) .accountTypeName(simpleEmployee.getAccountType() == null ? "" : AccountTypeEnum.parseByValue(simpleEmployee.getAccountType()).getDefaultLabel()) .telephone(StringUtils.isEmpty(simpleEmployee.getTelephone()) ? "" : simpleEmployee.getTelephone()) .username(StringUtils.isEmpty(simpleEmployee.getUsername()) ? "" : simpleEmployee.getUsername()) @@ -1328,64 +1343,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } -// /** -// * 发送消息 -// * -// * @param salarySend -// * @param enableSendList -// * @param salaryTemplate -// * @param currentTenantKey -// */ -// private void sendMessage(SalarySendPO salarySend, List> enableSendList, SalaryTemplatePO salaryTemplate, String tenantName) { -// if (StringUtils.isNotBlank(salaryTemplate.getBackground())) { -// FileData fileByte = fileDownloadClient.getFileByte(Long.valueOf(salaryTemplate.getBackground()), currentTenantKey); -// String encode = Base64Encoder.encode(fileByte.getData()); -// salaryTemplate.setBackground(encode); -// } -// // 邮箱打开 -// boolean isEmailOpen = salaryTemplate.getEmailStatus().equals(SalaryTemplateWhetherEnum.TRUE.getValue()); -// -// LocalDate salaryMonth = salarySend.getSalaryMonth(); -// String yearI18n = SalaryI18nUtil.getI18nLabel( 100325, "年"); -// String monthI18n = SalaryI18nUtil.getI18nLabel( 100326, "月"); -// String text = salaryMonth.getYear() + -// yearI18n + -// salaryMonth.getMonth().getValue() + -// monthI18n + -// SalaryI18nUtil.getI18nLabel( 100520, "工资待发明细"); -// -// UserEntity sendUser = null; -// // 标题 -// String title = getBillTitle(salaryTemplate.getTheme(), salaryMonth, tenantName); -// -// // 获取所有人员信息 -// List ids = enableSendList.stream().map(e->Long.valueOf(e.get("employeeId").toString())).collect(Collectors.toList()); -// List allEmployees = hrmCommonEmployeeService.getEmployeeByIds(ids, currentTenantKey); -// List listDTOS = JSONArray.parseArray(salaryTemplate.getSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class); -// Optional optionalEmployeeInformation = listDTOS.stream().filter(e -> SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID.equals(e.getGroupId())).findFirst(); -// SalaryTemplateSalaryItemSetListDTO employeeInformation = optionalEmployeeInformation.orElse(null); -// Map employeeField = SalaryAcctResultBO.buildEmployeeFieldName(); -// enableSendList.forEach(e -> { -// Optional optionalSimpleEmployee = allEmployees.stream().filter(f->f.getEmployeeId().equals(Long.valueOf(e.get("employeeId").toString()))).findFirst(); -// if (optionalSimpleEmployee.isPresent()) { -// buildEmployeeInfo(employeeInformation, optionalSimpleEmployee.get(), e.get("taxAgent").toString(), employeeField); -// } -// -// List receivers = Collections.singletonList( -// SalarySendBO.buildUser(Long.valueOf(e.get("employeeId").toString()), e.get("email") == null ? "" : e.get("email").toString(), currentTenantKey)); -// Entity entity = SalarySendBO.buildEntity(e.get("id").toString(), SalaryI18nUtil.getI18nLabel( 94626, "工资单")); -// EmailEntity emailInfo = new EmailEntity(); -// // 邮箱打开 -// if (isEmailOpen) { -// String emailContent = SalarySendBO.buildEmailContent(e, employeeInformation, title, salaryTemplate); -// emailInfo = SalarySendBO.buildEmailInfo(text, emailContent, salaryTemplate.getSendEmailId()); -// } -// SendMessageEntity message = SalarySendBO.buildSendMessageEntity(text, sendUser, receivers, entity, emailInfo); -// log.info("开始发送============:{}", JsonUtil.toJsonString(message)); -// // 开始发送 -// log.info("发送结果===:{}", JsonUtil.toJsonString(asyncSystemMessageRest.sendMsg(message))); -// }); -// } @Override public Map withdraw(SalarySendWithdrawParam param) { diff --git a/src/com/engine/salary/sys/constant/SalarySysConstant.java b/src/com/engine/salary/sys/constant/SalarySysConstant.java index 4f5966095..7a3c052be 100644 --- a/src/com/engine/salary/sys/constant/SalarySysConstant.java +++ b/src/com/engine/salary/sys/constant/SalarySysConstant.java @@ -214,4 +214,7 @@ public class SalarySysConstant { * 快照时间点 */ public static final String SHOT_EMP_TIME_TYPE = "SHOT_EMP_TIME_TYPE"; + + //是否采集考勤班次数据,0:关闭 1:开启 + public static final String ATTENDANCE_SERIAL_COLLECTION_BTN = "ATTENDANCE_SERIAL_COLLECTION_BTN"; }