Merge branch 'release/2.9.5.2309.01' into release/个税版本

This commit is contained in:
钱涛 2023-09-21 16:58:15 +08:00
commit 0545c6eb8c
99 changed files with 5394 additions and 643 deletions

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type number default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
report_ids varchar2(500),
start_time varchar2(30),
end_time varchar2(30),
push_channel varchar2(30),
email_account varchar2(30),
mark varchar2(100),
push_title varchar2(30),
email_account_id number,
remind NUMBER
);
/
create table hrsa_report_push_detail
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type int default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
employee_id NUMBER(38,0),
push_time varchar2(30),
push_status varchar2(5),
reback_time varchar2(30),
reback_status varchar2(5),
batch_id NUMBER(38,0),
view_status varchar2(10)
);
/

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type number default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
report_ids varchar2(500),
start_time varchar2(30),
end_time varchar2(30),
push_channel varchar2(30),
email_account varchar2(30),
mark varchar2(100),
push_title varchar2(30),
email_account_id number,
remind NUMBER
);
/
create table hrsa_report_push_detail
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type int default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
employee_id NUMBER(38,0),
push_time varchar2(30),
push_status varchar2(5),
reback_time varchar2(30),
reback_status varchar2(5),
batch_id NUMBER(38,0),
view_status varchar2(10)
);
/

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type number default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
report_ids varchar2(500),
start_time varchar2(30),
end_time varchar2(30),
push_channel varchar2(30),
email_account varchar2(30),
mark varchar2(100),
push_title varchar2(30),
email_account_id number,
remind NUMBER
);
/
create table hrsa_report_push_detail
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type int default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
employee_id NUMBER(38,0),
push_time varchar2(30),
push_status varchar2(5),
reback_time varchar2(30),
reback_status varchar2(5),
batch_id NUMBER(38,0),
view_status varchar2(10)
);
/

View File

@ -0,0 +1,41 @@
create table hrsa_report_push
(
id bigint primary key comment 'ID' ,
create_time datetime default now() comment '创建时间' ,
update_time datetime default now() comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
msg_id bigint comment '消息id' ,
report_ids varchar(500) comment '快照id' ,
start_time varchar(30) comment '有效开始时间' ,
end_time varchar(30) comment '有效结束时间' ,
push_channel varchar(30) comment '分享渠道' ,
email_account varchar(30) comment '邮件账号' ,
mark varchar(100) comment '分享说明' ,
push_title varchar(30) comment '推送标题' ,
email_account_id bigint,
remind int
)
;
create table hrsa_report_push_detail
(
id bigint primary key comment 'ID' ,
create_time datetime default now() comment '创建时间' ,
update_time datetime default now() comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
msg_id bigint comment '消息id' ,
employee_id bigint comment '员工id' ,
push_time varchar(30) comment '分享时间' ,
push_status varchar(5) comment '分享状态' ,
reback_time varchar(30) comment '撤回时间' ,
reback_status varchar(5) comment '撤回状态' ,
batch_id bigint comment '批次id',
view_status varchar(10)
)
;

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type number default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
report_ids varchar2(500),
start_time varchar2(30),
end_time varchar2(30),
push_channel varchar2(30),
email_account varchar2(30),
mark varchar2(100),
push_title varchar2(30),
email_account_id number,
remind NUMBER
)
/
create table hrsa_report_push_detail
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type int default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
employee_id NUMBER(38,0),
push_time varchar2(30),
push_status varchar2(5),
reback_time varchar2(30),
reback_status varchar2(5),
batch_id NUMBER(38,0),
view_status varchar2(10)
)
/

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id bigint primary key ,
create_time timestamp default now(),
update_time timestamp default now(),
creator bigint,
delete_type int default 0,
tenant_key varchar(10),
msg_id bigint,
report_ids varchar(500),
start_time varchar(30),
end_time varchar(30),
push_channel varchar(30),
email_account varchar(30),
mark varchar(100) ,
push_title varchar(30),
email_account_id bigint,
remind int
)
;
create table hrsa_report_push_detail
(
id bigint primary key,
create_time timestamp default now(),
update_time timestamp default now() ,
creator bigint,
delete_type int default 0 ,
tenant_key varchar(10),
msg_id bigint ,
employee_id bigint,
push_time varchar(30) ,
push_status varchar(5) ,
reback_time varchar(30) ,
reback_status varchar(5) ,
batch_id bigint,
view_status varchar(10)
)
;

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id bigint primary key,
create_time datetime default getdate(),
update_time datetime default getdate(),
creator bigint,
delete_type int default 0,
tenant_key VARCHAR(255),
msg_id bigint,
report_ids VARCHAR(255),
start_time VARCHAR(255),
end_time VARCHAR(255),
push_channel VARCHAR(255),
email_account VARCHAR(255),
email_account_id bigint,
mark VARCHAR(255),
push_title VARCHAR(255),
remind int
)
GO
create table hrsa_report_push_detail
(
id bigint primary key ,
create_time datetime default getdate(),
update_time datetime default getdate(),
creator bigint,
delete_type int default 0,
tenant_key VARCHAR(255),
msg_id bigint,
employee_id bigint,
push_time VARCHAR(255),
push_status VARCHAR(255),
reback_time VARCHAR(255),
reback_status VARCHAR(255),
batch_id bigint,
view_status VARCHAR(255)
)
GO

View File

@ -0,0 +1,40 @@
create table hrsa_report_push
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type number default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
report_ids varchar2(500),
start_time varchar2(30),
end_time varchar2(30),
push_channel varchar2(30),
email_account varchar2(30),
mark varchar2(100),
push_title varchar2(30),
email_account_id number,
remind NUMBER
);
/
create table hrsa_report_push_detail
(
id NUMBER(38,0) primary key ,
create_time DATE default sysdate,
update_time DATE default sysdate,
creator NUMBER(38,0),
delete_type int default 0,
tenant_key varchar2(10),
msg_id NUMBER(38,0),
employee_id NUMBER(38,0),
push_time varchar2(30),
push_status varchar2(5),
reback_time varchar2(30),
reback_status varchar2(5),
batch_id NUMBER(38,0),
view_status varchar2(10)
);
/

View File

@ -0,0 +1,8 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/salaryreport/salary/statistics/push")
public class SalaryStatisticsPushController extends com.engine.salary.report.web.SalaryStatisticsPushController{
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportActionParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
@ -66,7 +66,7 @@ public class CheckEditSIArchiveAction implements Action {
//福利执行状态
String runStatus = list.stream().filter(f -> f.salaryName.equals("档案状态")).findFirst().map(CheckEditSIArchiveAction.SalaryField::getValue).orElse("1");
SIArchiveImportActionParam build = SIArchiveImportActionParam.builder()
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();

View File

@ -1,7 +1,7 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportActionParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
@ -65,7 +65,7 @@ public class EditSIArchiveAction implements Action {
//福利执行状态
String runStatus = list.stream().filter(f -> f.salaryName.equals("档案状态")).findFirst().map(EditSIArchiveAction.SalaryField::getValue).orElse("1");
SIArchiveImportActionParam build = SIArchiveImportActionParam.builder()
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();

View File

@ -0,0 +1,181 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 编辑并增员福利档案
* @Date: 2023/9/8
**/
@Slf4j
public class EditToPaySIArchiveAction implements Action {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<EditToPaySIArchiveAction.SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = fieldMap.get(processField);
list.add(new EditToPaySIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, EditToPaySIArchiveAction.SalaryField::getSalaryName, EditToPaySIArchiveAction.SalaryField::getValue));
//福利执行状态
String runStatus = EmployeeStatusEnum.STAY_ADD.getValue();
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(EditToPaySIArchiveAction.SalaryField::getValue).orElse("1");
//更新/新建档案数据
Map<String, Object> map = getSISchemeService(new User(Integer.parseInt(uid))).addSIArchive(build);
List errorNotice = (List) map.get("errorData");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("福利档案编辑并增员存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorData");
StringBuilder message = new StringBuilder("");
for (Map<String, String> comments : excelComments) {
message.append(comments.get("message")).append("\n");
}
requestInfo.getRequestManager().setMessage(message.toString());
return FAILURE_AND_CONTINUE;
}
//增员
String taxAgentName = importData.get(0).get("个税扣缴义务人").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf(taxAgentPOS.get(0).getId());
Long employeeId = Long.valueOf(list.stream().filter(f -> f.salaryName.equals("员工id")).findFirst().map(EditToPaySIArchiveAction.SalaryField::getValue).orElse("-1"));
User user = new User(Integer.parseInt(uid));
// 获取福利档案基础信息
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待增员,无法进行增员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//增员
Map<String, Object> resultMap = getSIArchivesService(user).stayAddToPay(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("福利档案编辑并增员异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
class SalaryField {
private String processField;
private String salaryName;
private String value;
public String getProcessField() {
return processField;
}
public void setProcessField(String processField) {
this.processField = processField;
}
public String getSalaryName() {
return salaryName;
}
public void setSalaryName(String salaryName) {
this.salaryName = salaryName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public SalaryField(String processField, String salaryName, String value) {
this.processField = processField;
this.salaryName = salaryName;
this.value = value;
}
}
}

View File

@ -0,0 +1,184 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.service.impl.SISchemeServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 编辑并减员福利档案
* @Date: 2023/9/8
**/
@Slf4j
public class EditToStopSIArchiveAction implements Action {
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.class,user);
}
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<EditToStopSIArchiveAction.SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = fieldMap.get(processField);
list.add(new EditToStopSIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, EditToStopSIArchiveAction.SalaryField::getSalaryName, EditToStopSIArchiveAction.SalaryField::getValue));
//福利执行状态
String runStatus = EmployeeStatusEnum.PAYING.getValue();
SIArchiveImportParam build = SIArchiveImportParam.builder()
.importDatas(importData)
.runStatus(runStatus)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(EditToStopSIArchiveAction.SalaryField::getValue).orElse("1");
User user = new User(Integer.parseInt(uid));
//更新/新建档案数据
Map<String, Object> map = getSISchemeService(new User(Integer.parseInt(uid))).addSIArchive(build);
List errorNotice = (List) map.get("errorData");
if (CollectionUtils.isNotEmpty(errorNotice)) {
log.error("福利档案编辑并减员存在异常 requestId:{} ,参数:{}, map:{}", requestInfo.getRequestid(), build, map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorData");
StringBuilder message = new StringBuilder("");
for (Map<String, String> comments : excelComments) {
message.append(comments.get("message")).append("\n");
}
requestInfo.getRequestManager().setMessage(message.toString());
return FAILURE_AND_CONTINUE;
}
//刷新福利档案状态
getSIArchivesService(user).handleStayDelData(Integer.parseInt(uid));
//减员
String taxAgentName = importData.get(0).get("个税扣缴义务人").toString();
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf(taxAgentPOS.get(0).getId());
Long employeeId = Long.valueOf(list.stream().filter(f -> f.salaryName.equals("员工id")).findFirst().map(EditToStopSIArchiveAction.SalaryField::getValue).orElse("-1"));
// 获取福利档案
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(taxAgentId, employeeId);
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待减员,无法进行减员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//减员
Map<String, Object> resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("福利档案编辑并减员异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
class SalaryField {
private String processField;
private String salaryName;
private String value;
public String getProcessField() {
return processField;
}
public void setProcessField(String processField) {
this.processField = processField;
}
public String getSalaryName() {
return salaryName;
}
public void setSalaryName(String salaryName) {
this.salaryName = salaryName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public SalaryField(String processField, String salaryName, String value) {
this.processField = processField;
this.salaryName = salaryName;
this.value = value;
}
}
}

View File

@ -82,7 +82,7 @@ public class StayAddToPaySIArchiveAction implements Action {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long taxAgentId = Long.valueOf(taxAgentPOS.get(0).getId());
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
//操作人

View File

@ -0,0 +1,250 @@
package com.engine.salary.action;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.enums.sicategory.IsUseEnum;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.*;
import weaver.workflow.request.RequestManager;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 更新福利方案明细信息action
* @Date: 2023/9/18
**/
@Slf4j
public class UpdateSISchemeDetailAction implements Action {
private EncryptUtil encryptUtil = new EncryptUtil();
private InsuranceSchemeMapper getInsuranceSchemeMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private ICategoryMapper getICategoryMapper() {
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
RequestManager requestManager = requestInfo.getRequestManager();
User user = requestManager.getUser();
DetailTable[] detailTables = requestInfo.getDetailTableInfo().getDetailTable();
List<Map<String, String>> detailList = new ArrayList<>();
if (detailTables.length > 0) {
for(DetailTable dt : detailTables) {
Row[] s = dt.getRow();
for (Row r : s) {
Cell[] c = r.getCell();
Map<String, String> detailMap = Arrays.stream(c).collect(Collectors.toMap(Cell::getName,
property -> Util.null2String(property.getValue())));
detailList.add(detailMap);
}
}
}
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
//遍历取出明细表中对应数据
int detailNo = 0;
List<ICategoryPO> listAll = getICategoryMapper().listAll().stream().filter(f -> f.getIsUse().equals(IsUseEnum.START.getValue())).collect(Collectors.toList());
List<InsuranceSchemePO> schemeList = getInsuranceSchemeMapper().listAll();
List<InsuranceSchemeDetailPO> updateSchemeDetails = new ArrayList<>();
for (Map<String, String> map : detailList) {
detailNo++;
List<UpdateSISchemeDetailAction.SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = map.get(processField);
list.add(new UpdateSISchemeDetailAction.SalaryField(processField, salaryName, value));
}
rs.beforFirst();
// 流程数据
Map<String, Object> importDataMap = SalaryEntityUtil.convert2Map(list, UpdateSISchemeDetailAction.SalaryField::getSalaryName, UpdateSISchemeDetailAction.SalaryField::getValue);
//设置更新对象元素
String schemeId = importDataMap.getOrDefault("福利方案id", "").toString();
String schemeName = importDataMap.getOrDefault("福利方案名称", "").toString();
//查询福利方案
InsuranceSchemePO targetSchemePO = new InsuranceSchemePO();
if (StringUtils.isNotBlank(schemeId)) {
targetSchemePO = schemeList.stream().filter(f -> f.getId().equals(Long.valueOf(schemeId))).findFirst().orElse(null);
} else if (StringUtils.isNotBlank(schemeName)) {
targetSchemePO = schemeList.stream().filter(f -> f.getSchemeName().equals(schemeName)).findFirst().orElse(null);
} else {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利方案id和福利方案名称至少填写一个");
return FAILURE_AND_CONTINUE;
}
if (targetSchemePO == null) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利方案id和福利方案名称信息有误无法匹配到已有福利方案");
return FAILURE_AND_CONTINUE;
}
//查询福利方案下的福利项明细
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(targetSchemePO.getId());
if (insuranceSchemeDetailPOS.size() > 0) {
encryptUtil.decryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
} else {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "该福利方案不存在福利项明细,无法进行修改!");
return FAILURE_AND_CONTINUE;
}
String paymentScope = importDataMap.getOrDefault("缴纳对象", "").toString();
if (StringUtils.isBlank(paymentScope)) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "缴纳对象必填!");
return FAILURE_AND_CONTINUE;
}
String insuranceId = importDataMap.getOrDefault("福利项id", "").toString();
String insuranceName = importDataMap.getOrDefault("福利项名称", "").toString();
InsuranceSchemeDetailPO targetSchemeDetailPO = new InsuranceSchemeDetailPO();
if (StringUtils.isNotBlank(insuranceId)) {
targetSchemeDetailPO = insuranceSchemeDetailPOS.stream()
.filter(f -> f.getInsuranceId().equals(Long.valueOf(insuranceId)) && f.getPaymentScope().equals(Integer.valueOf(paymentScope)))
.findFirst().orElse(null);
} else if (StringUtils.isNotBlank(insuranceName)) {
List<ICategoryPO> targetCategoryPOs = listAll.stream().filter(f -> f.getInsuranceName().equals(insuranceName)).collect(Collectors.toList());
if (targetCategoryPOs .size() == 1) {
targetSchemeDetailPO = insuranceSchemeDetailPOS.stream()
.filter(f -> f.getInsuranceId().equals(targetCategoryPOs.get(0).getId()) && f.getPaymentScope().equals(Integer.valueOf(paymentScope)))
.findFirst().orElse(null);
} else if (targetCategoryPOs.size() > 1) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利项名称匹配到多个福利项!");
return FAILURE_AND_CONTINUE;
}
} else {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利项id和福利项名称至少填写一个");
return FAILURE_AND_CONTINUE;
}
if (targetSchemeDetailPO == null) {
requestInfo.getRequestManager().setMessage("错误行" + detailNo + ":" + "福利项id和福利项名称信息有误无法匹配到方案已有福利项");
return FAILURE_AND_CONTINUE;
}
String isPayment = importDataMap.getOrDefault("是否缴费", "").toString();
if (StringUtils.isNotBlank(isPayment)) {
targetSchemeDetailPO.setIsPayment(Integer.valueOf(isPayment));
}
String upperLimit = importDataMap.getOrDefault("基数上限", "").toString();
if (StringUtils.isNotBlank(upperLimit)) {
targetSchemeDetailPO.setUpperLimit(upperLimit);
}
String lowerLimit = importDataMap.getOrDefault("基数下限", "").toString();
if (StringUtils.isNotBlank(lowerLimit)) {
targetSchemeDetailPO.setLowerLimit(lowerLimit);
}
String paymentProportion = importDataMap.getOrDefault("缴纳比例", "").toString();
if (StringUtils.isNotBlank(paymentProportion)) {
targetSchemeDetailPO.setPaymentProportion(paymentProportion);
}
String fixedCost = importDataMap.getOrDefault("固定费用", "").toString();
if (StringUtils.isNotBlank(fixedCost)) {
targetSchemeDetailPO.setFixedCost(fixedCost);
}
String validNum = importDataMap.getOrDefault("有效小数位", "").toString();
if (StringUtils.isNotBlank(validNum)) {
targetSchemeDetailPO.setValidNum(Integer.valueOf(validNum));
}
String rententionRule = importDataMap.getOrDefault("进位规则", "").toString();
if (StringUtils.isNotBlank(rententionRule)) {
targetSchemeDetailPO.setRententionRule(Integer.valueOf(rententionRule));
}
targetSchemeDetailPO.setUpdateTime(new Date());
updateSchemeDetails.add(targetSchemeDetailPO);
}
//更新方案明细
if (updateSchemeDetails.size() > 0) {
encryptUtil.encryptList(updateSchemeDetails, InsuranceSchemeDetailPO.class);
updateSchemeDetails.forEach(getInsuranceSchemeDetailMapper()::updateAll);
}
} catch (Exception e) {
log.error("福利方案更新异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
class SalaryField {
private String processField;
private String salaryName;
private String value;
public String getProcessField() {
return processField;
}
public void setProcessField(String processField) {
this.processField = processField;
}
public String getSalaryName() {
return salaryName;
}
public void setSalaryName(String salaryName) {
this.salaryName = salaryName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public SalaryField(String processField, String salaryName, String value) {
this.processField = processField;
this.salaryName = salaryName;
this.value = value;
}
}
}

View File

@ -163,7 +163,11 @@ public class SIAccountBiz extends Service {
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
//系统人员福利台账明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统各人员台账明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
PageInfo<InsuranceAccountDetailPO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
list, InsuranceAccountDetailPO.class);
@ -610,6 +614,14 @@ public class SIAccountBiz extends Service {
}
});
}
//避免福利档案的方案未设置基数导致核算时遗漏这些福利项的核算遍历下方案相关福利项并将遗漏的福利项id添加
if(otherPerson.size() > 0) {
otherPerson.forEach((id, object) -> {
if (!needArchivesPerson.contains(id)) {
needArchivesPerson.add(id);
}
});
}
//判断核算周期核算月福利起始缴纳月的关系
checkCycleSettingWithStartMonth(otherPerson, billMonth, otherPO.getOtherStartTime());
@ -672,6 +684,14 @@ public class SIAccountBiz extends Service {
}
});
}
//避免福利档案的方案未设置基数导致核算时遗漏这些福利项的核算遍历下方案相关福利项并将遗漏的福利项id添加
if(otherCom.size() > 0) {
otherCom.forEach((id, object) -> {
if (!needArchivesCom.contains(id)) {
needArchivesCom.add(id);
}
});
}
//判断核算周期核算月福利起始缴纳月的关系
checkCycleSettingWithStartMonth(otherCom, billMonth, otherPO.getOtherStartTime());
@ -752,6 +772,14 @@ public class SIAccountBiz extends Service {
}
});
}
//避免福利档案的方案未设置基数导致核算时遗漏这些福利项的核算遍历下方案相关福利项并将遗漏的福利项id添加
if(fundperson.size() > 0) {
fundperson.forEach((id, object) -> {
if (!needArchivesPerson.contains(id)) {
needArchivesPerson.add(id);
}
});
}
//判断核算周期核算月福利起始缴纳月的关系
checkCycleSettingWithStartMonth(fundperson, billMonth, fundPO.getFundStartTime());
@ -813,6 +841,14 @@ public class SIAccountBiz extends Service {
}
});
}
//避免福利档案的方案未设置基数导致核算时遗漏这些福利项的核算遍历下方案相关福利项并将遗漏的福利项id添加
if(fundCom.size() > 0) {
fundCom.forEach((id, object) -> {
if (!needArchivesCom.contains(id)) {
needArchivesCom.add(id);
}
});
}
//判断核算周期核算月福利起始缴纳月的关系
checkCycleSettingWithStartMonth(fundCom, billMonth, fundPO.getFundStartTime());
@ -896,6 +932,14 @@ public class SIAccountBiz extends Service {
}
});
}
//避免福利档案的方案未设置基数导致核算时遗漏这些福利项的核算遍历下方案相关福利项并将遗漏的福利项id添加
if(schemeperson.size() > 0) {
schemeperson.forEach((id, object) -> {
if (!needArchivesPerson.contains(id)) {
needArchivesPerson.add(id);
}
});
}
//判断核算周期核算月福利起始缴纳月的关系
checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime());
@ -957,6 +1001,14 @@ public class SIAccountBiz extends Service {
}
});
}
//避免福利档案的方案未设置基数导致核算时遗漏这些福利项的核算遍历下方案相关福利项并将遗漏的福利项id添加
if(schemeCom.size() > 0) {
schemeCom.forEach((id, object) -> {
if (!needArchivesCom.contains(id)) {
needArchivesCom.add(id);
}
});
}
//判断核算周期核算月福利起始缴纳月的关系
checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime());

View File

@ -29,6 +29,7 @@ import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
@ -691,6 +692,13 @@ public class SIArchivesBiz {
}
encryptUtil.encrypt(updateOtherInfo, InsuranceArchivesOtherSchemePO.class);
otherSchemeMapper.updateById(updateOtherInfo);
//更新base_info表状态
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null && baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
//对于非系统人员编辑后状态切换为正在缴纳
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
}
sqlSession.commit();
} else {
otherSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesOtherSchemePO.builder()
@ -729,6 +737,10 @@ public class SIArchivesBiz {
.paymentOrganization(param.getPaymentOrganization())
.build());
baseInfoPO.setOtherArchivesId(otherInfos.get(0).getId());
//对于非系统人员编辑后状态切换为正在缴纳
if (baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
}
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));
@ -790,7 +802,13 @@ public class SIArchivesBiz {
}
encryptUtil.encrypt(updateFundInfo, InsuranceArchivesFundSchemePO.class);
fundSchemeMapper.updateById(updateFundInfo);
//更新base_info表状态
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null && baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
//对于非系统人员编辑后状态切换为正在缴纳
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
}
sqlSession.commit();
} else {
fundSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesFundSchemePO.builder()
@ -831,6 +849,10 @@ public class SIArchivesBiz {
.paymentOrganization(param.getPaymentOrganization())
.build());
baseInfoPO.setFundArchivesId(fundInfos.get(0).getId());
//对于非系统人员编辑后状态切换为正在缴纳
if (baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
}
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));
@ -899,7 +921,13 @@ public class SIArchivesBiz {
}
encryptUtil.encrypt(updateSocialInfo, InsuranceArchivesSocialSchemePO.class);
socialSchemeMapper.updateById(updateSocialInfo);
//更新base_info表状态
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null && baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
//对于非系统人员编辑后状态切换为正在缴纳
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
}
sqlSession.commit();
} else {
socialSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesSocialSchemePO.builder()
@ -940,6 +968,10 @@ public class SIArchivesBiz {
.paymentOrganization(param.getPaymentOrganization())
.build());
baseInfoPO.setSocialArchivesId(socialInfos.get(0).getId());
//对于非系统人员编辑后状态切换为正在缴纳
if (baseInfoPO.getEmployeeType() != null && baseInfoPO.getEmployeeType().equals(DataCollectionEmployeeTypeEnum.EXT_EMPLOYEE.getValue())) {
baseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
}
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));

View File

@ -10,6 +10,7 @@ import weaver.conn.mybatis.MyBatisFactory;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
public class SalarySobItemBiz {
@ -154,4 +155,18 @@ public class SalarySobItemBiz {
sqlSession.close();
}
}
public void update(SalarySobItemPO salarySobItemPO) {
if (Objects.isNull(salarySobItemPO)) {
return;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobItemMapper mapper = sqlSession.getMapper(SalarySobItemMapper.class);
mapper.updateIgnoreNull(salarySobItemPO);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
}

View File

@ -13,6 +13,11 @@ public class WeaTableColumnGroup extends WeaTableColumn {
*/
private String lockStatus;
/**
* 保留小数位数
*/
private Integer pattern;
private List<WeaTableColumnGroup> children;
public WeaTableColumnGroup() {
@ -20,22 +25,32 @@ public class WeaTableColumnGroup extends WeaTableColumn {
public WeaTableColumnGroup(String width, String text, String column) {
super(width, text, column);
this.pattern = 0;
}
public WeaTableColumnGroup(String width, String text, String column, String lockStatus) {
super(width, text, column);
this.lockStatus = lockStatus;
this.pattern = 0;
}
public WeaTableColumnGroup(String width, String text, String column, String lockStatus, Integer pattern) {
super(width, text, column);
this.lockStatus = lockStatus;
this.pattern = pattern;
}
public WeaTableColumnGroup(String width, String text, String column, List<WeaTableColumnGroup> children) {
super(width, text, column);
this.children = children;
this.pattern = 0;
}
public WeaTableColumnGroup(String width, String text, String column, List<WeaTableColumnGroup> children, String lockStatus) {
super(width, text, column);
this.children = children;
this.lockStatus = lockStatus;
this.pattern = 0;
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryBill.po;
import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum;
import com.engine.salary.enums.salarybill.BillConfimStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -66,7 +67,8 @@ public class SalarySendInfoPO {
private Integer billReadStatus;
/**
* 确认状态 0未确认1已确认
* 确认状态 0未确认1已确认2已反馈
* @see BillConfimStatusEnum
*/
private Integer billConfirmStatus;

View File

@ -207,7 +207,9 @@ public class CalculateFormulaVarBO {
Map<Long, SalaryAcctResultPO> salaryAcctResultPOMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryItemId);
formulaVarValues.addAll(salaryAcctCalculateBO.getIssuedFieldIds().stream()
.map(fieldId -> {
String originResultValue = salaryAcctResultPOMap.get(salaryCodeItemMap.get(fieldId)).getOriginResultValue();
String originResultValue = salaryAcctResultPOMap.getOrDefault(
salaryCodeItemMap.get(fieldId),SalaryAcctResultPO.builder().originResultValue("").build())
.getOriginResultValue();
String fieldId2 = SalaryFormulaReferenceEnum.ISSUED.getValue()
+ SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR
+ fieldId;

View File

@ -140,9 +140,9 @@ public class SalaryAcctResultBO {
List<WeaTableColumnGroup> childrenColumns = Lists.newArrayList();
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue()));
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
} else {
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue()));
childrenColumns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
}
}
WeaTableColumnGroup weaTableColumnWapper = new WeaTableColumnGroup("150", salarySobItemGroupDTO.getName(), String.valueOf(salarySobItemGroupDTO.getId()), childrenColumns);
@ -151,18 +151,18 @@ public class SalaryAcctResultBO {
// 没有分类的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue()));
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
} else {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue()));
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
}
}
// 回算的薪资项目
for (SalarySobItemDTO salarySobItemDTO : salarySobItemAggregateDTO.getBackCalcItems()) {
if (lockSalaryItemIds.contains(salarySobItemDTO.getSalaryItemId())) {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue()));
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.LOCK.getValue(), salarySobItemDTO.getPattern()));
} else {
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue()));
columns.add(new WeaTableColumnGroup("150", salarySobItemDTO.getName(), "" + salarySobItemDTO.getSalaryItemId(), LockStatusEnum.UNLOCK.getValue(), salarySobItemDTO.getPattern()));
}
}
@ -493,7 +493,7 @@ public class SalaryAcctResultBO {
Map<Long, String> resultValueMap,
Map<String, SalaryAcctResultListColumnDTO> formulaContentMap) {
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(Optional.ofNullable(salaryItemPO).map(SalaryItemPO::getValueType).orElse(0));
SalaryValueTypeEnum salaryValueTypeEnum = SalaryValueTypeEnum.parseByValue(Optional.ofNullable(salarySobItemPO).map(SalarySobItemPO::getValueType).orElse(0));
String itemFormulaContent;
if(Objects.equals(salaryValueTypeEnum.getValue(),SalaryValueTypeEnum.FORMULA.getValue())){
itemFormulaContent = Optional.ofNullable(formulaContentMap.get(salarySobItemPO.getSalaryItemId().toString())).map(SalaryAcctResultListColumnDTO::getFormulaContent).orElse("");

View File

@ -11,11 +11,13 @@ import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportHandlePar
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryarchive.*;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -351,12 +353,12 @@ public class SalaryArchiveExcelBO extends Service {
String validType = importHandleParam.getEmpValidType();
List<DataCollectionEmployee> emps = new ArrayList<>();
//外部人员
if(importHandleParam.isExtEmp()){
if (importHandleParam.isExtEmp()) {
emps = importHandleParam.getEmployees().stream().filter(e ->
(StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobileName) || Objects.equals(e.getMobile(), mobileName))).collect(Collectors.toList());
}else {
} else {
if ("0".equals(validType)) {
//0代表姓名+部门+手机号的匹配原则1代表工号为唯一匹配原则
emps = importHandleParam.getEmployees().stream().filter(e ->
@ -651,6 +653,30 @@ public class SalaryArchiveExcelBO extends Service {
effectiveTime, finalSalaryArchive, adjustReason, importHandleParam, key.toString(), cellVal, map);
}
}
//账套关联
Long finalEmployeeId = employeeId;
String sobIds = Optional.ofNullable(map.get("薪资账套ids")).orElse("").toString();
List<SalarySobRangeSaveParam> salarySobRangeSaveParams = new ArrayList<>();
if (StringUtils.isNotBlank(sobIds)) {
salarySobRangeSaveParams = Arrays.stream(sobIds.split(",")).map(Long::valueOf).map(sobId -> {
SalarySobRangeSaveParam.SalarySobRangeTargetParam salarySobRangeTargetParam = new SalarySobRangeSaveParam.SalarySobRangeTargetParam();
salarySobRangeTargetParam.setTargetId(finalEmployeeId);
salarySobRangeTargetParam.setTargetType(TargetTypeEnum.EMPLOYEE);
salarySobRangeTargetParam.setEmployeeStatus(SalaryEmployeeStatusEnum.values());
SalarySobRangeSaveParam sobRangeSaveParam = new SalarySobRangeSaveParam();
sobRangeSaveParam.setSalarySobId(sobId);
sobRangeSaveParam.setTargetParams(Collections.singletonList(salarySobRangeTargetParam));
sobRangeSaveParam.setIncludeType(1);
sobRangeSaveParam.setEmployeeStatus(SalaryEmployeeStatusEnum.values());
return sobRangeSaveParam;
}).collect(Collectors.toList());
}
// 如果当前校验行没问题,修改起始发薪日期和最终发薪日期等
if (!isError) {
Optional<SalaryArchivePO> optionalUpdate = importHandleParam.getSalaryArchiveUpdates().stream().filter(f -> f.getId().equals(finalSalaryArchive.getId())).findFirst();
@ -666,6 +692,8 @@ public class SalaryArchiveExcelBO extends Service {
saves.add(finalSalaryArchive);
importHandleParam.setSalaryArchiveSaves(saves);
}
//保存账套关联
importHandleParam.setSalaryArchiveSobSaves(salarySobRangeSaveParams);
} else {
// 将前面添加好的数据给过滤掉
importHandleParam.setSalaryArchiveSaves(importHandleParam.getSalaryArchiveSaves().stream().filter(f -> !finalSalaryArchive.getId().equals(f.getId())).collect(Collectors.toList()));

View File

@ -4,6 +4,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
@ -170,5 +171,5 @@ public class SalaryArchiveImportHandleParam {
/**
* 薪资档案-账套关联
*/
// List<SalaryArchiveSobPO> salaryArchiveSobSaves;
List<SalarySobRangeSaveParam> salaryArchiveSobSaves;
}

View File

@ -0,0 +1,30 @@
package com.engine.salary.entity.salaryitem.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Harryxzy
* @ClassName SyncSalaryItemParam
* @date 2023/08/30 17:51
* @description 同步薪资项目到账套中参数
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SyncSalaryItemParam {
// 薪资项目id
@DataCheck(require = true, message = "薪资项目id不能为空")
private Long salaryItemId;
// 薪资账套id
@DataCheck(require = true, message = "薪资账套不能为空")
private List<Long> salarySobIds;
}

View File

@ -191,6 +191,9 @@ public class SalarySobDuplicateBO {
.description(salarySobItem.getDescription())
.canDelete(salarySobItem.getCanDelete())
.itemHide(salarySobItem.getItemHide())
.roundingMode(salarySobItem.getRoundingMode())
.pattern(salarySobItem.getPattern())
.valueType(salarySobItem.getValueType())
.creator(employeeId)
.createTime(now)
.updateTime(now)

View File

@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class InsuranceAcctDetailImportFieldDTO {
//字段id
// private String fieldId;
private String fieldId;
//薪资项目名称
private String salaryItemName;

View File

@ -0,0 +1,56 @@
package com.engine.salary.entity.siarchives.param;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
/**
* @Author: sy
* @Description: 社保福利档案导入处理参数
* @Date: 2022/11/10
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SIArchiveImportParam {
/**
* 上传文件id
*/
String imageId;
/**
* 导入类型
*
* @see EmployeeStatusEnum
*/
String runStatus;
/**
* 导入数据
*
*/
List<Map<String,Object>> importDatas;
private boolean addData;
/**
* 待生成的人员范围
*/
List<TaxAgentRangeSaveParam> taxAgentRanges;
/**
* 是否是流程
*/
boolean isProcess;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.sischeme.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.enums.sicategory.PaymentTypeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -24,5 +25,22 @@ public class InsuranceSchemeParam extends BaseQueryParam {
private WelfareTypeEnum welfareTypeEnum;
/**
* 缴纳类型
*/
private PaymentTypeEnum paymentTypeEnum;
/**
* 方案名称
*/
private String schemeName;
/**
* 缴纳类型
*/
private Integer paymentType;
/**
* 福利类型
*/
private Integer welfareType;
}

View File

@ -18,6 +18,13 @@ public class SISchemaImportParam {
@DataCheck(require = true,message = "imageId为空")
String imageId;
//福利执行状态
/**
* 福利执行状态
*/
String runStatus;
/**
* 是否是外部人员
*/
boolean isExtEmp;
}

View File

@ -19,13 +19,6 @@ import java.util.Objects;
**/
public enum SalaryEmployeeStatusEnum implements BaseEnum<Integer> {
// ALL(10, "全部", 85155),
// //在职,对应人力资源表中状态试用0正式1临时2试用延期3
// NORMAL(1, "试用,正式,临时,临时延期", 100120),
// //离职老,对应人力资源表中状态解雇4离职5退休6
// UNAVAILABLE(2, "解雇,离职,退休", 85902),
TRIAL(0, "试用", 100121),
FORMAL(1, "正式", 100122),

View File

@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
* @className
@ -19,477 +20,478 @@ import java.util.List;
* @Author
* @date
*/
public class LogicServiceImpl implements LogicService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public DataType not(Object... objects) {
DataType resultdataType=new DataType();
resultdataType.setDataType(DataType.BOOL);
Class[] typeObjects=new Class[]{boolean.class};
IgnoreParamFilter.commonFilter("NOT",1,1,typeObjects,objects);
Object object=objects[0];
if(object == null){
resultdataType.setContent(false);
return resultdataType;
}
Boolean cnd;
if(object instanceof DataType){
DataType dataType=(DataType)object;
cnd=dataType.getContent()!=null?((Boolean) dataType.getContent()):false;
}else{
cnd=(boolean)object;
}
public class LogicServiceImpl implements LogicService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
resultdataType.setContent(!cnd);
return resultdataType;
}
@Override
public DataType not(Object... objects) {
DataType resultdataType = new DataType();
resultdataType.setDataType(DataType.BOOL);
Class[] typeObjects = new Class[]{boolean.class};
IgnoreParamFilter.commonFilter("NOT", 1, 1, typeObjects, objects);
Object object = objects[0];
if (object == null) {
resultdataType.setContent(false);
return resultdataType;
}
Boolean cnd;
if (object instanceof DataType) {
DataType dataType = (DataType) object;
cnd = dataType.getContent() != null ? ((Boolean) dataType.getContent()) : false;
} else {
cnd = (boolean) object;
}
@Override
public DataType isEmpty(Object... objs) {
int number=IgnoreParamFilter.getSetFuncNumber(FuncNames.ISEMPTY.toString());
if(objs.length!=1){
throw new RuntimeException("ISEMPTY函数只允许一个参数");
}
boolean result=false;
if(null==objs||objs.length==0){
DataType dataType=new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(true);
return dataType;
}
for(int i=0;i<objs.length;i++){
Object obj=objs[i];
if(obj == null){
DataType dataType=new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(true);
return dataType;
}
if(obj instanceof DataType){
DataType objDataType=(DataType)obj;
if(objDataType.getDataType().equalsIgnoreCase(DataType.NUMBER)){
Object numberContent=objDataType.getContent();
if(numberContent==null||numberContent.toString().equalsIgnoreCase("")){
result= true;
break;
}
}
}
obj= ExcelParamUtil.getParamContent(obj,"");
if(null==obj||null==ExcelParamUtil.getParamContent(obj,"")||ExcelParamUtil.getParamContent(obj,"").equals("")){
result= true;
break;
}
}
DataType dataType=new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(result);
return dataType;
}
resultdataType.setContent(!cnd);
return resultdataType;
}
@Override
public DataType isTrue(Object... objects){
int number=IgnoreParamFilter.getSetFuncNumber(FuncNames.TRUE.toString());
if(objects.length>0){
throw new RuntimeException("TRUE函数不能有参数");
}
DataType dataType=new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(true);
return dataType;
}
@Override
public DataType isFalse(Object... objects){
int number=IgnoreParamFilter.getSetFuncNumber(FuncNames.FALSE.toString());
if(objects.length>0){
JSONObject errorJson=ErrorUtil.buildError(FuncNames.FALSE.toString(),number,number,"FALSE函数不能有参数");
throw new RuntimeException(errorJson.getString("msg"));
}
DataType dataType=new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(false);
return dataType;
}
@Override
public DataType isEmpty(Object... objs) {
int number = IgnoreParamFilter.getSetFuncNumber(FuncNames.ISEMPTY.toString());
if (objs.length != 1) {
throw new RuntimeException("ISEMPTY函数只允许一个参数");
}
boolean result = false;
if (null == objs || objs.length == 0) {
DataType dataType = new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(true);
return dataType;
}
for (int i = 0; i < objs.length; i++) {
Object obj = objs[i];
if (obj == null) {
DataType dataType = new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(true);
return dataType;
}
if (obj instanceof DataType) {
DataType objDataType = (DataType) obj;
if (objDataType.getDataType().equalsIgnoreCase(DataType.NUMBER)) {
Object numberContent = objDataType.getContent();
if (numberContent == null || numberContent.toString().equalsIgnoreCase("")) {
result = true;
break;
}
}
}
obj = ExcelParamUtil.getParamContent(obj, "");
if (null == obj || null == ExcelParamUtil.getParamContent(obj, "") || ExcelParamUtil.getParamContent(obj, "").equals("")) {
result = true;
break;
}
}
DataType dataType = new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(result);
return dataType;
}
@Override
public DataType isTrue(Object... objects) {
int number = IgnoreParamFilter.getSetFuncNumber(FuncNames.TRUE.toString());
if (objects.length > 0) {
throw new RuntimeException("TRUE函数不能有参数");
}
DataType dataType = new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(true);
return dataType;
}
@Override
public DataType isFalse(Object... objects) {
int number = IgnoreParamFilter.getSetFuncNumber(FuncNames.FALSE.toString());
if (objects.length > 0) {
JSONObject errorJson = ErrorUtil.buildError(FuncNames.FALSE.toString(), number, number, "FALSE函数不能有参数");
throw new RuntimeException(errorJson.getString("msg"));
}
DataType dataType = new DataType();
dataType.setDataType(DataType.BOOL);
dataType.setContent(false);
return dataType;
}
@Override
public DataType and(Object... objs) {
IgnoreParamFilter.filterLogicAndORFunc(objs,"AND");
Object result;
int trueCount=0;
int falseCount=0;
DataType dataType=new DataType();
for(int i=0;i<objs.length;i++){
boolean bool;
if(objs[i] instanceof DataType){
DataType paramdataType=(DataType)objs[i];
bool=paramdataType.getContent()!=null?((Boolean) paramdataType.getContent()):false;
//如果参数存在底层Logic运算把运算记录加入到当前AND函数的运算记录中
if(paramdataType.getSubLogic()!=null && paramdataType.getSubLogic().size()>0){
dataType.getSubLogic().addAll(paramdataType.getSubLogic());
}
}else{
bool=(boolean)objs[i];
}
@Override
public DataType and(Object... objs) {
IgnoreParamFilter.filterLogicAndORFunc(objs, "AND");
Object result;
int trueCount = 0;
int falseCount = 0;
DataType dataType = new DataType();
for (int i = 0; i < objs.length; i++) {
boolean bool;
if (objs[i] instanceof DataType) {
DataType paramdataType = (DataType) objs[i];
bool = paramdataType.getContent() != null ? ((Boolean) paramdataType.getContent()) : false;
//如果参数存在底层Logic运算把运算记录加入到当前AND函数的运算记录中
if (paramdataType.getSubLogic() != null && paramdataType.getSubLogic().size() > 0) {
dataType.getSubLogic().addAll(paramdataType.getSubLogic());
}
} else {
bool = (boolean) objs[i];
}
if(bool){
trueCount++;
}else{
falseCount++;
}
}
if(trueCount==objs.length){
result= true;
}else{
result= false;
}
if (bool) {
trueCount++;
} else {
falseCount++;
}
}
if (trueCount == objs.length) {
result = true;
} else {
result = false;
}
dataType.setDataType(DataType.BOOL);
dataType.setContent(result);
dataType.getSubLogic().add("and");
dataType.setDataType(DataType.BOOL);
dataType.setContent(result);
dataType.getSubLogic().add("and");
LogicUtils.buildAndOrFilterParam("AND",dataType,objs);
return dataType;
}
LogicUtils.buildAndOrFilterParam("AND", dataType, objs);
return dataType;
}
@Override
public DataType or(Object... objs) {
IgnoreParamFilter.filterLogicAndORFunc(objs,"OR");
Object result;
int trueCount=0;
int falseCount=0;
DataType dataType=new DataType();
for(int i=0;i<objs.length;i++){
boolean bool;
if(objs[i] instanceof DataType){
DataType paramdataType=(DataType)objs[i];
bool=paramdataType.getContent()!=null?((Boolean) paramdataType.getContent()):false;
//如果参数存在底层Logic运算把运算记录加入到当前AND函数的运算记录中
if(paramdataType.getSubLogic()!=null && paramdataType.getSubLogic().size()>0){
dataType.getSubLogic().addAll(paramdataType.getSubLogic());
}
}else{
bool=(boolean)objs[i];
}
if(bool){
trueCount++;
}else{
falseCount++;
}
}
if(trueCount>0){
result= true;
}else{
result= false;
}
@Override
public DataType or(Object... objs) {
IgnoreParamFilter.filterLogicAndORFunc(objs, "OR");
Object result;
int trueCount = 0;
int falseCount = 0;
DataType dataType = new DataType();
for (int i = 0; i < objs.length; i++) {
boolean bool;
if (objs[i] instanceof DataType) {
DataType paramdataType = (DataType) objs[i];
bool = paramdataType.getContent() != null ? ((Boolean) paramdataType.getContent()) : false;
//如果参数存在底层Logic运算把运算记录加入到当前AND函数的运算记录中
if (paramdataType.getSubLogic() != null && paramdataType.getSubLogic().size() > 0) {
dataType.getSubLogic().addAll(paramdataType.getSubLogic());
}
} else {
bool = (boolean) objs[i];
}
if (bool) {
trueCount++;
} else {
falseCount++;
}
}
if (trueCount > 0) {
result = true;
} else {
result = false;
}
dataType.setDataType(DataType.BOOL);
dataType.setContent(result);
dataType.getSubLogic().add("or");
LogicUtils.buildAndOrFilterParam("OR",dataType,objs);
return dataType;
}
dataType.setDataType(DataType.BOOL);
dataType.setContent(result);
dataType.getSubLogic().add("or");
LogicUtils.buildAndOrFilterParam("OR", dataType, objs);
return dataType;
}
@Override
public DataType likeFunc(Object... objects) {
IgnoreParamFilter.filterLikeFunc(objects);
Object object = objects[0];
Object result = false;
String txtS = "";
if (object instanceof DataType) {
txtS = ExcelParamUtil.getParamContent(object, "string").toString();
} else {
txtS = object.toString();
}
if (null == txtS || txtS.trim().equals("")) {
return new DataType(DataType.BOOL, false);
}
Object[] partamArray = (Object[]) objects[1];
for (int i = 0; i < partamArray.length; i++) {
Object cnd = partamArray[i];
String cndStr = "";
if (cnd instanceof DataType) {
DataType cndJson = (DataType) cnd;
cndStr = ExcelParamUtil.getParamContent(cndJson, "string").toString();
} else {
cndStr = cnd.toString();
}
@Override
public DataType likeFunc(Object... objects) {
IgnoreParamFilter.filterLikeFunc(objects);
Object object=objects[0];
Object result=false;
String txtS="";
if(object instanceof DataType){
txtS=ExcelParamUtil.getParamContent(object,"string").toString();
}else {
txtS=object.toString();
}
if(null==txtS||txtS.trim().equals("")){
return new DataType(DataType.BOOL,false);
}
Object[] partamArray=(Object[])objects[1];
for(int i=0;i<partamArray.length;i++){
Object cnd=partamArray[i];
String cndStr="";
if(cnd instanceof DataType){
DataType cndJson=(DataType)cnd;
cndStr=ExcelParamUtil.getParamContent(cndJson,"string").toString();
}else {
cndStr=cnd.toString();
}
int ridx=txtS.indexOf(cndStr);
if(ridx>=0?true:false){
result=ridx>=0?true:false;
break;
}
int ridx = txtS.indexOf(cndStr);
if (ridx >= 0 ? true : false) {
result = ridx >= 0 ? true : false;
break;
}
}
DataType dataType=new DataType(DataType.BOOL,result);
LogicUtils.buildLikeFilterParam(dataType,objects);
return dataType;
}
}
DataType dataType = new DataType(DataType.BOOL, result);
LogicUtils.buildLikeFilterParam(dataType, objects);
return dataType;
}
@Override
public DataType ifs(Object... objects) {
int number=IgnoreParamFilter.getSetFuncNumber(FuncNames.IFS.toString());
if(objects.length==0 || objects.length%2!=1 || objects.length<3){
JSONObject errorJson=ErrorUtil.buildError(FuncNames.IFS.toString(),number,number,"IFS函数的参数必须大于3个且为单数");
throw new RuntimeException(errorJson.getString("msg"));
}
int testI;
for(testI=1;testI<=objects.length;testI++){
if(testI%2>0 && testI!=objects.length){
Object cndObj=objects[testI-1];
if(!(cndObj instanceof Boolean) && !(cndObj instanceof DataType)){
JSONObject errorJson= ErrorUtil.buildError(FuncNames.IFS.toString(),number,number,"IFS函数条件必须为真假值");
throw new RuntimeException(errorJson.getString("msg"));
}else if(cndObj instanceof DataType){
DataType boolDataType=(DataType)cndObj;
if(boolDataType.getContent()!=null && !(boolDataType.getContent() instanceof Boolean)){
JSONObject errorJson=ErrorUtil.buildError(FuncNames.IFS.toString(),number,number,"IFS函数条件必须为真假值");
throw new RuntimeException(errorJson.getString("msg"));
}
}
}
}
@Override
public DataType ifs(Object... objects) {
int number = IgnoreParamFilter.getSetFuncNumber(FuncNames.IFS.toString());
if (objects.length == 0 || objects.length % 2 != 1 || objects.length < 3) {
JSONObject errorJson = ErrorUtil.buildError(FuncNames.IFS.toString(), number, number, "IFS函数的参数必须大于3个且为单数");
throw new RuntimeException(errorJson.getString("msg"));
}
int testI;
for (testI = 1; testI <= objects.length; testI++) {
if (testI % 2 > 0 && testI != objects.length) {
Object cndObj = objects[testI - 1];
if (!(cndObj instanceof Boolean) && !(cndObj instanceof DataType)) {
JSONObject errorJson = ErrorUtil.buildError(FuncNames.IFS.toString(), number, number, "IFS函数条件必须为真假值");
throw new RuntimeException(errorJson.getString("msg"));
} else if (cndObj instanceof DataType) {
DataType boolDataType = (DataType) cndObj;
if (boolDataType.getContent() != null && !(boolDataType.getContent() instanceof Boolean)) {
JSONObject errorJson = ErrorUtil.buildError(FuncNames.IFS.toString(), number, number, "IFS函数条件必须为真假值");
throw new RuntimeException(errorJson.getString("msg"));
}
}
}
}
boolean paramCheck=checkParamType(objects);
if(!paramCheck){
JSONObject errorJson=ErrorUtil.buildError(FuncNames.IFS.toString(),number,number,"IFS函数多个条件的返回值必须一致");
throw new RuntimeException(errorJson.getString("msg"));
}
boolean paramCheck = checkParamType(objects);
if (!paramCheck) {
JSONObject errorJson = ErrorUtil.buildError(FuncNames.IFS.toString(), number, number, "IFS函数多个条件的返回值必须一致");
throw new RuntimeException(errorJson.getString("msg"));
}
int i;
for(i=1;i<=objects.length;i++){
if(i%2==0){
Object cndObj=objects[i-2];
if(cndObj instanceof Boolean){
Boolean cnd=(Boolean)cndObj;
if(cnd){
if(objects[i-1] instanceof DataType){
return (DataType) objects[i-1];
}else{
return new DataType(DataType.returnType(ExcelParamUtil.getParamType(objects[i-1].getClass().getName())),objects[i-1]);
}
int i;
for (i = 1; i <= objects.length; i++) {
if (i % 2 == 0) {
Object cndObj = objects[i - 2];
if (cndObj instanceof Boolean) {
Boolean cnd = (Boolean) cndObj;
if (cnd) {
if (objects[i - 1] instanceof DataType) {
return (DataType) objects[i - 1];
} else {
return new DataType(DataType.returnType(ExcelParamUtil.getParamType(objects[i - 1].getClass().getName())), objects[i - 1]);
}
// return new DataType(DataType.BOOL,objects[i-1]);
}
}else if(cndObj instanceof DataType){
DataType boolData=(DataType)cndObj;
Boolean cnd=boolData.getContent()!=null?( (Boolean)boolData.getContent() ) : false;
if(cnd){
if(objects[i-1] instanceof DataType){
return (DataType) objects[i-1];
}else {
return new DataType(DataType.returnType(ExcelParamUtil.getParamType(objects[i-1].getClass().getName())),objects[i-1]);
}
}
} else if (cndObj instanceof DataType) {
DataType boolData = (DataType) cndObj;
Boolean cnd = boolData.getContent() != null ? ((Boolean) boolData.getContent()) : false;
if (cnd) {
if (objects[i - 1] instanceof DataType) {
return (DataType) objects[i - 1];
} else {
return new DataType(DataType.returnType(ExcelParamUtil.getParamType(objects[i - 1].getClass().getName())), objects[i - 1]);
}
}
}
}
}
//如果没有条件符合返回默认值最后一个参数为默认值
Object result=ExcelParamUtil.getParamContent(objects[objects.length-1],"");
if(result instanceof DataType){
return (DataType)result;
}else{
return new DataType(DataType.returnType(ExcelParamUtil.getParamType(result.getClass().getName())),result);
}
}
}
}
}
//如果没有条件符合返回默认值最后一个参数为默认值
Object result = ExcelParamUtil.getParamContent(objects[objects.length - 1], "");
if (result instanceof DataType) {
return (DataType) result;
} else {
return new DataType(DataType.returnType(ExcelParamUtil.getParamType(result.getClass().getName())), result);
}
}
}
@Override
public DataType find(Object... objects) {
@Override
public DataType find(Object... objects) {
return new DataType(DataType.BOOL,finds(objects));
}
return new DataType(DataType.BOOL, finds(objects));
}
@Override
public DataType switchs(Object... objects) {
if(objects.length==0||objects==null){
throw new RuntimeException("参数不能为空");
}
if(objects.length<4){
throw new RuntimeException("switch函数的参数长度必须大于4个");
}
if(objects.length%2!=0){
throw new RuntimeException("switch函数的参数长度必须为双数");
}
Object source=objects[0];
Object defaultValue=objects[objects.length-1];
if(source instanceof DataType){
source=ExcelParamUtil.getParamContent(source,"");
}
if(defaultValue instanceof DataType){
defaultValue=ExcelParamUtil.getParamContent(defaultValue,"");
}
Object result=null;
for (int i=1;i<objects.length-1;i++){
if(i%2!=0){
Object param=objects[i];
Object value=null;
if(param instanceof DataType){
value=ExcelParamUtil.getParamContent(param,"");
}else{
value=param;
}
if(source.equals(value)){
result=objects[i+1];
break;
}
}
}
if(result==null){
result=defaultValue;
}
@Override
public DataType switchs(Object... objects) {
if (objects == null || objects.length == 0) {
throw new RuntimeException("参数不能为空");
}
if (objects.length < 4) {
throw new RuntimeException("switch函数的参数长度必须大于4个");
}
if (objects.length % 2 != 0) {
throw new RuntimeException("switch函数的参数长度必须为双数");
}
Object source = objects[0];
Object defaultValue = objects[objects.length - 1];
if (source instanceof DataType) {
source = ExcelParamUtil.getParamContent(source, "");
}
if (defaultValue instanceof DataType) {
defaultValue = ExcelParamUtil.getParamContent(defaultValue, "");
}
Object result = null;
for (int i = 1; i < objects.length - 1; i++) {
if (i % 2 != 0) {
Object param = objects[i];
Object value = null;
if (param instanceof DataType) {
value = ExcelParamUtil.getParamContent(param, "");
} else {
value = param;
}
if (Objects.equals(source.toString(),value.toString())) {
result = objects[i + 1];
break;
}
}
}
if (result == null) {
result = defaultValue;
}
return new DataType(DataType.BOOL,result);
}
return new DataType(DataType.BOOL, result);
}
public Boolean finds(Object... objects){
public Boolean finds(Object... objects) {
if(null==objects || objects.length<2){
throw new RuntimeException("参数不能为空");
}
if (null == objects || objects.length < 2) {
throw new RuntimeException("参数不能为空");
}
//获取查找类型 1用第二个参数去第一个里面找2用第一个参数去第二个里面找
String type=null;
int vali=2;
if(objects.length>=3 ){
if(objects[objects.length-1] instanceof Integer){
vali=Integer.parseInt(objects[objects.length-1].toString());
if(vali!=1&&vali!=2){
throw new RuntimeException("FIND函数第三个参数只允许1和2");
}
}else{
throw new RuntimeException("FIND函数第三个参数只允许1和2");
}
}
//获取查找类型 1用第二个参数去第一个里面找2用第一个参数去第二个里面找
String type = null;
int vali = 2;
if (objects.length >= 3) {
if (objects[objects.length - 1] instanceof Integer) {
vali = Integer.parseInt(objects[objects.length - 1].toString());
if (vali != 1 && vali != 2) {
throw new RuntimeException("FIND函数第三个参数只允许1和2");
}
} else {
throw new RuntimeException("FIND函数第三个参数只允许1和2");
}
}
//将参数转换成List要判断参数是数组还是单个对象
List<Object> objs1=null;
List<Object> objs2=null;
if(objects[0] instanceof Object[]){
Object[] transObj=(Object[])objects[0];
objs1=Arrays.asList(transObj);
}else{
objs1=Arrays.asList(objects[0]);
}
if(objects[1] instanceof Object[]){
Object[] transObj=(Object[])objects[1];
objs2=Arrays.asList(transObj);
}else{
objs2=Arrays.asList(objects[1]);
}
//将参数转换成List要判断参数是数组还是单个对象
List<Object> objs1 = null;
List<Object> objs2 = null;
if (objects[0] instanceof Object[]) {
Object[] transObj = (Object[]) objects[0];
objs1 = Arrays.asList(transObj);
} else {
objs1 = Arrays.asList(objects[0]);
}
if (objects[1] instanceof Object[]) {
Object[] transObj = (Object[]) objects[1];
objs2 = Arrays.asList(transObj);
} else {
objs2 = Arrays.asList(objects[1]);
}
if(objs1.size()==0 || objs2.size() == 0 ){
throw new RuntimeException("参数不能为空");
}
if (objs1.size() == 0 || objs2.size() == 0) {
throw new RuntimeException("参数不能为空");
}
//判断参数类型是否一致
List<Object> all=new ArrayList<>();
all.addAll(objs1);
all.addAll(objs2);
for (Object obj:all){
String localType="";
if(obj instanceof DataType){
String paramType=ExcelParamUtil.getParamType(obj);
if(!paramType.toLowerCase().equals("option")){
localType=ExcelParamUtil.checkParamType(paramType);
}else{
localType=paramType;
}
}else{
localType=ExcelParamUtil.checkParamType(ExcelParamUtil.getParamType(obj.getClass().getName()));
}
if(type==null){
type=localType;
}else{
if(!type.equalsIgnoreCase(localType)){
throw new RuntimeException("参数类型不一致");
}
}
}
//判断参数类型是否一致
List<Object> all = new ArrayList<>();
all.addAll(objs1);
all.addAll(objs2);
for (Object obj : all) {
String localType = "";
if (obj instanceof DataType) {
String paramType = ExcelParamUtil.getParamType(obj);
if (!paramType.toLowerCase().equals("option")) {
localType = ExcelParamUtil.checkParamType(paramType);
} else {
localType = paramType;
}
} else {
localType = ExcelParamUtil.checkParamType(ExcelParamUtil.getParamType(obj.getClass().getName()));
}
if (type == null) {
type = localType;
} else {
if (!type.equalsIgnoreCase(localType)) {
throw new RuntimeException("参数类型不一致");
}
}
}
//根据超找类型判断谁是查找目标谁是查找依据
List<Object> targetList=new ArrayList<>();
List<Object> keyList=new ArrayList<>();
switch (vali){
case 1:
targetList=transOptionData(objs1);
keyList=transOptionData(objs2);
break;
case 2:
targetList=transOptionData(objs2);
keyList=transOptionData(objs1);
break;
default:
throw new RuntimeException("查找类型错误");
}
//根据超找类型判断谁是查找目标谁是查找依据
List<Object> targetList = new ArrayList<>();
List<Object> keyList = new ArrayList<>();
switch (vali) {
case 1:
targetList = transOptionData(objs1);
keyList = transOptionData(objs2);
break;
case 2:
targetList = transOptionData(objs2);
keyList = transOptionData(objs1);
break;
default:
throw new RuntimeException("查找类型错误");
}
for (Object keyO:keyList){
for (Object target:targetList){
if(keyO.equals(target)){
return true;
}
}
}
for (Object keyO : keyList) {
for (Object target : targetList) {
if (keyO.equals(target)) {
return true;
}
}
}
return false;
}
return false;
}
private List<Object> transOptionData(List<Object> dataList){
List<Object> contentArrays=new ArrayList<>();
for (Object data:dataList){
Object param1=ExcelParamUtil.getParamContent(data,"");
//获取依据数据的类型
String keyType="";
if(data instanceof DataType){
keyType=ExcelParamUtil.getParamType(data);
}else{
keyType=ExcelParamUtil.getParamType(data.getClass().getName());
}
keyType=ExcelParamUtil.checkParamType(keyType);
private List<Object> transOptionData(List<Object> dataList) {
List<Object> contentArrays = new ArrayList<>();
for (Object data : dataList) {
Object param1 = ExcelParamUtil.getParamContent(data, "");
//获取依据数据的类型
String keyType = "";
if (data instanceof DataType) {
keyType = ExcelParamUtil.getParamType(data);
} else {
keyType = ExcelParamUtil.getParamType(data.getClass().getName());
}
keyType = ExcelParamUtil.checkParamType(keyType);
if(keyType.toLowerCase().equals(DataType.OPTION)){
contentArrays.addAll(Arrays.asList(param1.toString().split(",")));
}else if(data instanceof Character){
contentArrays.add(param1.toString());
}else if(keyType.toLowerCase().equals("number")){
contentArrays.add(Double.parseDouble(param1.toString()));
}else{
contentArrays.add(param1);
}
}
return contentArrays;
}
if (keyType.toLowerCase().equals(DataType.OPTION)) {
contentArrays.addAll(Arrays.asList(param1.toString().split(",")));
} else if (data instanceof Character) {
contentArrays.add(param1.toString());
} else if (keyType.toLowerCase().equals("number")) {
contentArrays.add(Double.parseDouble(param1.toString()));
} else {
contentArrays.add(param1);
}
}
return contentArrays;
}
private boolean checkParamType(Object[] objects){
boolean result=false;
String type=null;
for (int i=1;i<=objects.length;i++){
if(i%2==0){
Object obj=objects[i-1];
String typeStr=ExcelParamUtil.getParamType(obj);
typeStr=ExcelParamUtil.checkParamType(typeStr);
logger.info(typeStr);
if(type==null){
type=typeStr;
}else{
result=typeStr.equalsIgnoreCase(type);
if(!result){
return result;
}
private boolean checkParamType(Object[] objects) {
boolean result = false;
String type = null;
for (int i = 1; i <= objects.length; i++) {
if (i % 2 == 0) {
Object obj = objects[i - 1];
String typeStr = ExcelParamUtil.getParamType(obj);
typeStr = ExcelParamUtil.checkParamType(typeStr);
logger.info(typeStr);
if (type == null) {
type = typeStr;
} else {
result = typeStr.equalsIgnoreCase(type);
if (!result) {
return result;
}
}
}
}
String typeStr=ExcelParamUtil.checkParamType(ExcelParamUtil.getParamType(objects[objects.length-1]));
result=type.equalsIgnoreCase(typeStr);
return result;
}
}
}
}
String typeStr = ExcelParamUtil.checkParamType(ExcelParamUtil.getParamType(objects[objects.length - 1]));
result = type.equalsIgnoreCase(typeStr);
return result;
}
}

View File

@ -21,4 +21,8 @@ public interface InsuranceExportMapper {
List<AccountExportPO> exportAccount(@Param("paymentStatus") Integer paymentStatus, @Param("param") InsuranceExportParam param);
List<AccountExportPO> exportRecessionAccount(@Param("paymentStatus") Integer paymentStatus, @Param("param") InsuranceExportParam param);
List<AccountExportPO> exportExtAccount(@Param("paymentStatus") Integer paymentStatus, @Param("param") InsuranceExportParam param);
List<ExcelAccountExportPO> exportExtExcelAccount(@Param("param") InsuranceComparisonResultQueryParam param);
}

View File

@ -193,4 +193,102 @@
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
</select>
<select id="exportExtAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO">
SELECT a.*,
e.username AS userName,
e.mobile AS telephone,
d.departmentname AS departmentName,
e.status AS userStatus,
e.workcode AS workcode
FROM (
SELECT *
from hrsa_bill_detail
WHERE delete_type = 0
AND bill_month = #{param.billMonth}
AND payment_status = #{paymentStatus}
AND payment_organization = #{param.paymentOrganization}
) a
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
where e.status not in (7)
<!-- 排序 -->
</select>
<select id="exportExtAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO" databaseId="oracle">
SELECT a.*,
e.username AS userName,
e.mobile AS telephone,
d.departmentname AS departmentName,
e.status AS userStatus,
e.workcode AS workcode
FROM (
SELECT *
from hrsa_bill_detail
WHERE delete_type = 0
AND bill_month = #{param.billMonth}
AND payment_status = #{paymentStatus}
AND payment_organization = #{param.paymentOrganization}
) a
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
where e.status not in (7)
<!-- 排序 -->
</select>
<select id="exportExtAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO" databaseId="sqlserver">
SELECT a.*,
e.username AS userName,
e.mobile AS telephone,
d.departmentname AS departmentName,
e.status AS userStatus,
e.workcode AS workcode
FROM (
SELECT *
from hrsa_bill_detail
WHERE delete_type = 0
AND bill_month = #{param.billMonth}
AND payment_status = #{paymentStatus}
AND payment_organization = #{param.paymentOrganization}
) a
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
where e.status not in (7)
<!-- 排序 -->
</select>
<select id="exportExtExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO">
SELECT
a.*,e.username AS userName,e.mobile AS telephone,d.departmentname AS departmentName,e.status AS userStatus,e.workcode AS workcode
FROM(
SELECT * from hrsa_excel_bill_detail
WHERE delete_type = 0 AND bill_month = #{param.billMonth} AND payment_status = #{param.paymentStatus} AND payment_organization = #{param.paymentOrganization}
)a
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
where e.status not in (7)
</select>
<select id="exportExtExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO" databaseId="oracle">
SELECT
a.*,e.username AS userName,e.mobile AS telephone,d.departmentname AS departmentName,e.status AS userStatus,e.workcode AS workcode
FROM(
SELECT * from hrsa_excel_bill_detail
WHERE delete_type = 0 AND bill_month = #{param.billMonth} AND payment_status = #{param.paymentStatus} AND payment_organization = #{param.paymentOrganization}
)a
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
where e.status not in (7)
</select>
<select id="exportExtExcelAccount" resultType="com.engine.salary.entity.siexport.po.ExcelAccountExportPO" databaseId="sqlserver">
SELECT
a.*,e.username AS userName,e.mobile AS telephone,d.departmentname AS departmentName,e.status AS userStatus,e.workcode AS workcode
FROM(
SELECT * from hrsa_excel_bill_detail
WHERE delete_type = 0 AND bill_month = #{param.billMonth} AND payment_status = #{param.paymentStatus} AND payment_organization = #{param.paymentOrganization}
)a
LEFT JOIN hrsa_external_employee e ON e.ID = a.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
where e.status not in (7)
</select>
</mapper>

View File

@ -87,6 +87,8 @@ public interface EmployMapper {
List<HrmInfoDTO> listHrmInfoByIdAndName(@Param("param") HrmQueryParam param);
List<HrmInfoDTO> listExtHrmInfoByIdAndName(@Param("param") HrmQueryParam param);
/**
* 根据部门名称查询部门

View File

@ -8,7 +8,8 @@
d.DEPARTMENTNAME as departmentName,
e.status,
e.mobile,
e.workcode
e.workcode,
'false' as extEmp
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
where e.status not in (7)
@ -385,4 +386,64 @@
where e.status not in (7)
AND e.enddate >= #{dismissDate}
</select>
<select id="listExtHrmInfoByIdAndName" resultType="com.engine.salary.entity.hrm.dto.HrmInfoDTO">
select e.id as employeeId,
e.username as username
from hrsa_external_employee e
where 1=1
<if test="param.ids != null and param.ids.size()>0">
AND e.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.userName != null and param.userName != ''">
AND
(
e.username like CONCAT('%',#{param.userName},'%')
)
</if>
</select>
<select id="listExtHrmInfoByIdAndName" resultType="com.engine.salary.entity.hrm.dto.HrmInfoDTO" databaseId="sqlserver">
select e.id as employeeId,
e.username as username
from hrsa_external_employee e
where 1=1
<if test="param.ids != null and param.ids.size()>0">
AND e.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.userName != null and param.userName != ''">
AND
(
e.username like '%'+#{param.userName}+'%'
)
</if>
</select>
<select id="listExtHrmInfoByIdAndName" resultType="com.engine.salary.entity.hrm.dto.HrmInfoDTO" databaseId="oracle">
select e.id as employeeId,
e.username as username
from hrsa_external_employee e
where 1=1
<if test="param.ids != null and param.ids.size()>0">
AND e.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.userName != null and param.userName != ''">
AND
(
e.username like '%'||#{param.userName}||'%'
)
</if>
</select>
</mapper>

View File

@ -239,7 +239,8 @@
d.DEPARTMENTNAME as departmentName,
e.status,
e.mobile,
e.workcode
e.workcode,
'true' as extEmp
from hrsa_external_employee e
left join hrmdepartment d on e.department_id = d.id
</select>

View File

@ -0,0 +1,83 @@
package com.engine.salary.mapper.report;
import com.engine.salary.report.entity.po.SalaryStatisticsPushPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushMapper
* @date 2023/09/11 10:36
* @description 报表分享
*/
public interface SalaryStatisticsPushMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalaryStatisticsPushPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalaryStatisticsPushPO> listSome(SalaryStatisticsPushPO SalaryStatisticsPushPO);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalaryStatisticsPushPO getById(Long id);
/**
* 新增忽略null字段
*
* @param SalaryStatisticsPushPO 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalaryStatisticsPushPO SalaryStatisticsPushPO);
/**
* 修改修改所有字段
*
* @param SalaryStatisticsPushPO 修改的记录
* @return 返回影响行数
*/
int update(SalaryStatisticsPushPO SalaryStatisticsPushPO);
/**
* 修改忽略null字段
*
* @param SalaryStatisticsPushPO 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalaryStatisticsPushPO SalaryStatisticsPushPO);
/**
* 删除记录
*
* @param SalaryStatisticsPushPO 待删除的记录
* @return 返回影响行数
*/
int delete(SalaryStatisticsPushPO SalaryStatisticsPushPO);
/**
* 获取该用户最新创建的分享记录
* @param empId
*/
List<SalaryStatisticsPushPO> listLatestRecordByCreator(@Param("empId") Long empId);
/**
* 根据报表id模糊查询
* @param reportId
* @return
*/
List<SalaryStatisticsPushPO> listByReportIdAndIds(@Param("reportId") String reportId, @Param("ids") List<Long> ids);
}

View File

@ -0,0 +1,358 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.report.SalaryStatisticsPushMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
<result column="id" property="id" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
<result column="report_ids" property="reportIds" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
<result column="push_channel" property="pushChannel" />
<result column="email_account" property="emailAccount" />
<result column="mark" property="mark" />
<result column="push_title" property="pushTitle" />
<result column="email_account_id" property="emailAccountId" />
<result column="remind" property="remind" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, t.report_ids
, t.start_time
, t.end_time
, t.push_channel
, t.email_account
, t.mark
, t.push_title
, t.email_account_id
, t.remind
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="reportIds != null">
AND report_ids = #{reportIds}
</if>
<if test="startTime != null">
AND start_time = #{startTime}
</if>
<if test="endTime != null">
AND end_time = #{endTime}
</if>
<if test="pushChannel != null">
AND push_channel = #{pushChannel}
</if>
<if test="emailAccount != null">
AND email_account = #{emailAccount}
</if>
<if test="mark != null">
AND mark = #{mark}
</if>
<if test="pushTitle != null">
AND push_title = #{pushTitle}
</if>
<if test="emailAccountId != null">
AND email_account_id = #{emailAccountId}
</if>
<if test="remind != null">
AND remind = #{remind}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<select id="listLatestRecordByCreator"
resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
AND creator = #{empId}
ORDER BY create_time DESC
</select>
<select id="listByReportIdAndIds" resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="reportId != null and reportId != ''">
AND t.report_ids like CONCAT('%',#{reportId},'%')
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="listByReportIdAndIds" resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO" databaseId="oracle">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="reportId != null and reportId != ''">
AND t.report_ids like '%'||#{reportId}||'%'
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="listByReportIdAndIds" resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO" databaseId="sqlserver">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push t
WHERE delete_type = 0
<if test="reportId != null and reportId != ''">
AND t.report_ids like '%'+#{reportId}+'%'
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
INSERT INTO hrsa_report_push
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="reportIds != null">
report_ids,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="pushChannel != null">
push_channel,
</if>
<if test="emailAccount != null">
email_account,
</if>
<if test="mark != null">
mark,
</if>
<if test="pushTitle != null">
push_title,
</if>
<if test="emailAccountId != null">
email_account_id,
</if>
<if test="remind != null">
remind,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null" >
#{id},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="reportIds != null" >
#{reportIds},
</if>
<if test="startTime != null" >
#{startTime},
</if>
<if test="endTime != null" >
#{endTime},
</if>
<if test="pushChannel != null" >
#{pushChannel},
</if>
<if test="emailAccount != null" >
#{emailAccount},
</if>
<if test="mark != null" >
#{mark},
</if>
<if test="pushTitle != null" >
#{pushTitle},
</if>
<if test="emailAccountId != null" >
#{emailAccountId},
</if>
<if test="remind != null" >
#{remind},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
UPDATE hrsa_report_push
<set>
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
report_ids=#{reportIds},
start_time=#{startTime},
end_time=#{endTime},
push_channel=#{pushChannel},
email_account=#{emailAccount},
mark=#{mark},
push_title=#{pushTitle},
email_account_id=#{emailAccountId},
remind=#{remind},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
UPDATE hrsa_report_push
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="reportIds != null" >
report_ids=#{reportIds},
</if>
<if test="startTime != null" >
start_time=#{startTime},
</if>
<if test="endTime != null" >
end_time=#{endTime},
</if>
<if test="pushChannel != null" >
push_channel=#{pushChannel},
</if>
<if test="emailAccount != null" >
email_account=#{emailAccount},
</if>
<if test="mark != null" >
mark=#{mark},
</if>
<if test="pushTitle != null" >
push_title=#{pushTitle},
</if>
<if test="emailAccountId != null" >
email_account_id=#{emailAccountId},
</if>
<if test="remind != null" >
remind=#{remind},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushPO">
UPDATE hrsa_report_push
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
</mapper>

View File

@ -0,0 +1,81 @@
package com.engine.salary.mapper.report;
import com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushPOMapper
* @date 2023/09/11 11:01
* @description 报表分享明细
*/
public interface salaryStatisticsPushDetailMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalaryStatisticsPushDetailPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<SalaryStatisticsPushDetailPO> listSome(SalaryStatisticsPushDetailPO SalaryStatisticsPushDetailPO);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalaryStatisticsPushDetailPO getById(Long id);
/**
* 新增忽略null字段
*
* @param SalaryStatisticsPushDetailPO 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalaryStatisticsPushDetailPO SalaryStatisticsPushDetailPO);
/**
* 修改修改所有字段
*
* @param SalaryStatisticsPushDetailPO 修改的记录
* @return 返回影响行数
*/
int update(SalaryStatisticsPushDetailPO SalaryStatisticsPushDetailPO);
/**
* 修改忽略null字段
*
* @param SalaryStatisticsPushDetailPO 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalaryStatisticsPushDetailPO SalaryStatisticsPushDetailPO);
/**
* 删除记录
*
* @param SalaryStatisticsPushDetailPO 待删除的记录
* @return 返回影响行数
*/
int delete(SalaryStatisticsPushDetailPO SalaryStatisticsPushDetailPO);
/**
* 根据批次id查询
* @param batchIds
*/
List<SalaryStatisticsPushDetailPO> queryPushDetailPOByBatchId(@Param("batchIds") List<Long> batchIds);
/**
* 根据批次id员工id查询
* @param
*/
List<SalaryStatisticsPushDetailPO> queryPushDetailPOByBatchIdAndEmpIds(@Param("batchId")Long batchId, @Param("empIds")List<Long> sharedBy);
}

View File

@ -0,0 +1,319 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.report.salaryStatisticsPushDetailMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
<result column="id" property="id" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="tenant_key" property="tenantKey" />
<result column="msg_id" property="msgId" />
<result column="employee_id" property="employeeId" />
<result column="push_time" property="pushTime" />
<result column="push_status" property="pushStatus" />
<result column="reback_time" property="rebackTime" />
<result column="reback_status" property="rebackStatus" />
<result column="batch_id" property="batchId" />
<result column="view_status" property="viewStatus" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, t.msg_id
, t.employee_id
, t.push_time
, t.push_status
, t.reback_time
, t.reback_status
, t.batch_id
, t.view_status
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push_detail t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push_detail t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push_detail t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="msgId != null">
AND msg_id = #{msgId}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="pushTime != null">
AND push_time = #{pushTime}
</if>
<if test="pushStatus != null">
AND push_status = #{pushStatus}
</if>
<if test="rebackTime != null">
AND reback_time = #{rebackTime}
</if>
<if test="rebackStatus != null">
AND reback_status = #{rebackStatus}
</if>
<if test="batchId != null">
AND batch_id = #{batchId}
</if>
<if test="viewStatus != null">
AND view_status = #{viewStatus}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<select id="queryPushDetailPOByBatchId"
resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push_detail t
WHERE delete_type = 0
<if test="batchIds != null and batchIds.size()>0">
AND batch_id IN
<foreach collection="batchIds" open="(" item="batchId" separator="," close=")">
#{batchId}
</foreach>
</if>
</select>
<select id="queryPushDetailPOByBatchIdAndEmpIds"
resultType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_report_push_detail t
WHERE delete_type = 0
AND batch_id = #{batchId}
<if test="empIds != null and empIds.size()>0">
AND employee_id IN
<foreach collection="empIds" open="(" item="empId" separator="," close=")">
#{empId}
</foreach>
</if>
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
INSERT INTO hrsa_report_push_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="msgId != null">
msg_id,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="pushTime != null">
push_time,
</if>
<if test="pushStatus != null">
push_status,
</if>
<if test="rebackTime != null">
reback_time,
</if>
<if test="rebackStatus != null">
reback_status,
</if>
<if test="batchId != null">
batch_id,
</if>
<if test="viewStatus != null">
view_status,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null" >
#{id},
</if>
<if test="createTime != null" >
#{createTime},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="msgId != null" >
#{msgId},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="pushTime != null" >
#{pushTime},
</if>
<if test="pushStatus != null" >
#{pushStatus},
</if>
<if test="rebackTime != null" >
#{rebackTime},
</if>
<if test="rebackStatus != null" >
#{rebackStatus},
</if>
<if test="batchId != null" >
#{batchId},
</if>
<if test="viewStatus != null" >
#{viewStatus},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
UPDATE hrsa_report_push_detail
<set>
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
msg_id=#{msgId},
employee_id=#{employeeId},
push_time=#{pushTime},
push_status=#{pushStatus},
reback_time=#{rebackTime},
reback_status=#{rebackStatus},
batch_id=#{batchId},
view_status=#{viewStatus},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
UPDATE hrsa_report_push_detail
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="msgId != null" >
msg_id=#{msgId},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="pushTime != null" >
push_time=#{pushTime},
</if>
<if test="pushStatus != null" >
push_status=#{pushStatus},
</if>
<if test="rebackTime != null" >
<if test="rebackTime == ''">
reback_time = null,
</if>
<if test="rebackTime != ''">
reback_time=#{rebackTime},
</if>
</if>
<if test="rebackStatus != null" >
reback_status=#{rebackStatus},
</if>
<if test="batchId != null" >
batch_id=#{batchId},
</if>
<if test="viewStatus != null" >
view_status=#{viewStatus},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO">
UPDATE hrsa_report_push_detail
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
</mapper>

View File

@ -24,6 +24,14 @@ public interface InsuranceAccountDetailMapper {
*/
List<InsuranceAccountDetailPO> list(@Param("param") InsuranceAccountDetailParam queryParam);
/**
* 查询正常缴纳列表_非系统人员
*
* @param queryParam
* @return
*/
List<InsuranceAccountDetailPO> extList(@Param("param") InsuranceAccountDetailParam queryParam);
/**
* 通过id查询
*/

View File

@ -254,6 +254,94 @@
</if>
</sql>
<sql id="extParamSql">
<if test="param.userName != null and param.userName != ''">
AND
(
e.userName like CONCAT('%',#{param.userName},'%')
)
</if>
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like CONCAT('%',#{param.workcode},'%')
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
<if test="param.recessionMonthList != null and param.recessionMonthList.size()>0">
AND t.bill_month IN
<foreach collection="param.recessionMonthList" open="(" item="recessionMonth" separator="," close=")">
#{recessionMonth}
</foreach>
</if>
<if test="param.taxAgents != null and param.taxAgents.size()>0">
AND t.payment_organization IN
<foreach collection="param.taxAgents" open="(" item="taxAgent" separator="," close=")">
#{taxAgent}
</foreach>
</if>
</sql>
<sql id="extParamSql" databaseId="oracle">
<if test="param.userName != null and param.userName != ''">
AND
(
e.userName like '%'||#{param.userName}||'%'
)
</if>
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'||#{param.workcode}||'%'
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
<if test="param.recessionMonthList != null and param.recessionMonthList.size()>0">
AND t.bill_month IN
<foreach collection="param.recessionMonthList" open="(" item="recessionMonth" separator="," close=")">
#{recessionMonth}
</foreach>
</if>
<if test="param.taxAgents != null and param.taxAgents.size()>0">
AND t.payment_organization IN
<foreach collection="param.taxAgents" open="(" item="taxAgent" separator="," close=")">
#{taxAgent}
</foreach>
</if>
</sql>
<sql id="extParamSql" databaseId="sqlserver">
<if test="param.userName != null and param.userName != ''">
AND
(
e.userName like '%'+#{param.userName}+'%'
)
</if>
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'+#{param.workcode}+'%'
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
<if test="param.recessionMonthList != null and param.recessionMonthList.size()>0">
AND t.bill_month IN
<foreach collection="param.recessionMonthList" open="(" item="recessionMonth" separator="," close=")">
#{recessionMonth}
</foreach>
</if>
<if test="param.taxAgents != null and param.taxAgents.size()>0">
AND t.payment_organization IN
<foreach collection="param.taxAgents" open="(" item="taxAgent" separator="," close=")">
#{taxAgent}
</foreach>
</if>
</sql>
<select id="list" resultMap="BaseResultMap">
SELECT
@ -274,6 +362,22 @@
</if>
</select>
<select id="extList" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
hrsa_bill_detail t
left join hrsa_external_employee e on e.ID = t.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.department_id
LEFT JOIN hrmsubcompany c ON c.id = e.subcompany_id
WHERE t.delete_type = 0
and e.status not in (7)
<include refid="paramSqlCommon"/>
<include refid="extParamSql"/>
<!-- 排序 -->
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT
t.employee_id,t.social_sum,t.fund_sum,t.other_sum,t.fund_pay_org,t.social_pay_org,

View File

@ -17,6 +17,7 @@ public interface InsuranceCompensationMapper {
List<InsuranceCompensationPO> queryByBillMonthAndPayOrg(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
InsuranceCompensationPO getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO);
List<InsuranceCompensationPO> getListByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO);
List<InsuranceCompensationPO> getByBillMonthPayOrgEmpIds(InsuranceCompensationPO insuranceCompensationPO);

View File

@ -208,6 +208,7 @@
WHERE t.bill_month = #{billMonth}
AND t.payment_organization = #{paymentOrganization}
AND t.delete_type = 0
ORDER BY t.employee_id, t.create_time
</select>
<!-- 根据账单月份、个税扣缴义务人、人员id获取单条记录 -->
@ -221,6 +222,17 @@
AND t.delete_type = 0
</select>
<!-- 根据账单月份、个税扣缴义务人、人员id获取多条记录 -->
<select id="getListByBillMonthPayOrgEmpId" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_compensation_log t
WHERE t.bill_month = #{billMonth}
AND t.payment_organization = #{paymentOrganization}
AND t.employee_id = #{employeeId}
AND t.delete_type = 0
</select>
<!-- 根据账单月份、个税扣缴义务人、人员ids获取记录list -->
<select id="getByBillMonthPayOrgEmpIds" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
SELECT

View File

@ -336,6 +336,12 @@
<if test="fixedCost != null" >
fixed_cost=#{fixedCost},
</if>
<if test="validNum != null" >
valid_num=#{validNum},
</if>
<if test="rententionRule != null" >
rentention_rule=#{rententionRule},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>

View File

@ -1,5 +1,6 @@
package com.engine.salary.mapper.sischeme;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import org.apache.ibatis.annotations.Param;
@ -61,6 +62,8 @@ public interface InsuranceSchemeMapper {
List<InsuranceSchemePO> listByWelfareType(@Param("welfareType")Integer welfareType);
List<InsuranceSchemePO> list(InsuranceSchemeParam param);
void deleteByIds(@Param("ids")Collection<Long> ids);
}

View File

@ -36,6 +36,22 @@
, t.tax_agent_ids
</sql>
<sql id="paramSql">
<!-- 关键字(方案名称) -->
<if test="schemeName != null and schemeName != ''">
AND scheme_name like CONCAT('%',#{schemeName},'%')
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="schemeName != null and schemeName != ''">
AND scheme_name like '%'||#{schemeName}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="schemeName != null and schemeName != ''">
AND scheme_name like '%'+#{schemeName}+'%'
</if>
</sql>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
@ -175,6 +191,22 @@
order by id desc
</select>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_social_security_scheme t
WHERE t.delete_type = 0
<include refid="paramSql"/>
<if test="welfareType != null and welfareType != ''">
AND
t.welfare_type = #{welfareType}
</if>
<if test="paymentType != null">
AND
t.payment_type = #{paymentType}
</if>
order by id desc
</select>
<update id="deleteByIds">
UPDATE hrsa_social_security_scheme

View File

@ -1,8 +1,8 @@
package com.engine.salary.process.salaryArchive;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveFormDTO;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
@ -18,6 +18,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
@ -86,13 +87,41 @@ public class SalaryArchiveActionAPI {
return new ResponseResult<SalaryArchiveImportActionParam, Map<String, Object>>(user).run(getSalaryArchiveWrapper(user)::adjustmentSalaryArchive, importData);
}
/**
* 获取档案信息默认需要传人员和扣缴义务人id若只传人员id发现多个发薪档案会抛出异常提示
*
* 废弃该接口仅返回基础信息前端调用较为复杂以后才有获取生效数据接口
* @param request
* @param response
* @param param
* @return 档案基础信息
*/
@POST
@Path("/salaryArchiveInfo")
@Produces(MediaType.APPLICATION_JSON)
public String adjustmentSalaryArchive(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveQueryParam param) {
@Deprecated
public String adjustmentSalaryArchive(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveProcessQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryArchiveQueryParam, SalaryArchivePO>(user).run(getSalaryArchiveWrapper(user)::getSalaryArchiveInfo, param);
return new ResponseResult<SalaryArchiveProcessQueryParam, SalaryArchivePO>(user).run(getSalaryArchiveWrapper(user)::getSalaryArchiveInfo, param);
}
/**
* 获取档案信息默认需要传人员和扣缴义务人id若只传人员id发现多个发薪档案会抛出异常提示
*
* 废弃该接口仅返回基础信息前端调用较为复杂以后才有获取生效数据接口
* @param request
* @param response
* @param param
* @return 档案基础信息
*/
@POST
@Path("/v2/salaryArchiveInfo")
@Produces(MediaType.APPLICATION_JSON)
public String salaryArchiveInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryArchiveProcessQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryArchiveProcessQueryParam, List<SalaryArchiveFormDTO>>(user).run(getSalaryArchiveWrapper(user)::getSalaryArchiveInfoV2, param);
}
}

View File

@ -0,0 +1,44 @@
package com.engine.salary.process.salaryArchive;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.List;
/**
* 薪资档案
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//薪资档案查询参数
public class SalaryArchiveInfo {
private Collection<Long> ids;
/**
* 员工id
*/
private Long employeeId;
/**
* 扣缴义务人id
*/
private Long taxAgentId;
/**
* 档案状态
* @see SalaryArchiveStatusEnum
*/
private List<String> runStatusList;
}

View File

@ -0,0 +1,44 @@
package com.engine.salary.process.salaryArchive;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.List;
/**
* 薪资档案
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//薪资档案查询参数
public class SalaryArchiveProcessQueryParam {
private Collection<Long> ids;
/**
* 员工id
*/
private Long employeeId;
/**
* 扣缴义务人id
*/
private Long taxAgentId;
/**
* 档案状态
* @see SalaryArchiveStatusEnum
*/
private List<String> runStatusList;
}

View File

@ -1,7 +1,7 @@
package com.engine.salary.process.siArchives;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.param.SIArchiveImportActionParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.impl.SISchemeServiceImpl;
@ -40,11 +40,11 @@ public class SIArchiveActionAPI {
@POST
@Path("/checkImportSIArchiveListAdd")
@Produces(MediaType.APPLICATION_JSON)
public String checkImportSIArchiveListAdd(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveImportActionParam importData) {
public String checkImportSIArchiveListAdd(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveImportParam importData) {
User user = HrmUserVarify.getUser(request, response);
importData.setRunStatus(EmployeeStatusEnum.STAY_ADD.getValue());
importData.setAddData(false);
return new ResponseResult<SIArchiveImportActionParam, Map<String, Object>>(user).run(getService(user)::checkSIArchiveAdd, importData);
return new ResponseResult<SIArchiveImportParam, Map<String, Object>>(user).run(getService(user)::checkSIArchiveAdd, importData);
}
/**
@ -55,10 +55,10 @@ public class SIArchiveActionAPI {
@POST
@Path("/addSIArchive")
@Produces(MediaType.APPLICATION_JSON)
public String addSIArchive(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveImportActionParam importData) {
public String addSIArchive(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveImportParam importData) {
User user = HrmUserVarify.getUser(request, response);
importData.setRunStatus(EmployeeStatusEnum.STAY_ADD.getValue());
importData.setAddData(true);
return new ResponseResult<SIArchiveImportActionParam, Map<String, Object>>(user).run(getService(user)::addSIArchive, importData);
return new ResponseResult<SIArchiveImportParam, Map<String, Object>>(user).run(getService(user)::addSIArchive, importData);
}
}

View File

@ -0,0 +1,25 @@
package com.engine.salary.report.entity.dto;
import com.engine.salary.util.page.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 薪酬报表推送详情
* @Author: zhangheng
* @CreateDate: 2023/5/23
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsPushDetail {
private SalaryStatisticsPushDetailFormDTO detailForm;
private PageInfo<SalaryStatisticsPushDetailTableDTO> detailTable;
}

View File

@ -0,0 +1,36 @@
package com.engine.salary.report.entity.dto;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 薪酬报表推送详情表单
* @Author: zhangheng
* @CreateDate: 2023/5/23
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsPushDetailFormDTO {
@TableTitle(title = "分享报表", dataIndex = "reportName", key = "reportName")
private String reportName;
@TableTitle(title = "报表查看有效时间", dataIndex = "effectiveTime", key = "effectiveTime")
private String effectiveTime;
@TableTitle(title = "邮件账号", dataIndex = "emailAccount", key = "emailAccount")
private String emailAccount;
@TableTitle(title = "报表分享渠道", dataIndex = "channel", key = "channel")
private String channel;
@TableTitle(title = "分享说明", dataIndex = "remark", key = "remark")
private String remark;
}

View File

@ -0,0 +1,48 @@
package com.engine.salary.report.entity.dto;
import com.engine.salary.annotation.TableTitle;
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;
/**
* @Description: 薪酬统计维度列表
* @Author: zhangheng
* @CreateDate: 2023/5/23
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsPushDetailTableDTO {
// 主键id
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@TableTitle(title = "姓名", dataIndex = "userName", key = "userName")
private String userName;
@JsonSerialize(using = ToStringSerializer.class)
private Long employeeId;
@TableTitle(title = "分享时间", dataIndex = "pushTime", key = "pushTime")
private String pushTime;
@TableTitle(title = "分享状态", dataIndex = "pushStatus", key = "pushStatus")
private String pushStatus;
@TableTitle(title = "查看状态", dataIndex = "viewStatus", key = "viewStatus")
private String viewStatus;
@TableTitle(title = "撤回时间", dataIndex = "rebackTime", key = "rebackTime")
private String rebackTime;
@TableTitle(title = "撤回状态", dataIndex = "rebackStatus", key = "rebackStatus")
private String rebackStatus;
}

View File

@ -0,0 +1,42 @@
package com.engine.salary.report.entity.dto;
import com.engine.salary.annotation.TableTitle;
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;
/**
* @Description: 薪酬统计维度列表
* @Author: zhangheng
* @CreateDate: 2023/5/23
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsPushTableDTO {
// 主键id
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@TableTitle(title = "分享报表", dataIndex = "reportName", key = "reportName")
private String reportName;
// 数据查询有效时间
@TableTitle(title = "数据查询有效时间", dataIndex = "effectiveTime", key = "effectiveTime")
private String effectiveTime;
// 分享成功的被分享人
@TableTitle(title = "分享成功的被分享人", dataIndex = "successPush", key = "successPush")
private String successPush;
// 被分享人查看情况
@TableTitle(title = "被分享人查看情况", dataIndex = "sharedView", key = "sharedView")
private String sharedView;
}

View File

@ -80,4 +80,8 @@ public class SalaryStatisticsDataPerspectiveQueryParam extends BaseQueryParam {
@JsonIgnore
// 离职日期
private List<Date> leavedate;
// 是否是分享报表
private boolean isShare;
}

View File

@ -0,0 +1,26 @@
package com.engine.salary.report.entity.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushDetailParam
* @date 2023/09/11 15:40
* @description 获取发送消息记录详情
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsPushDetailParam extends BaseQueryParam {
// 主键id
private Long id;
// 姓名
private String userNameSearch;
}

View File

@ -0,0 +1,64 @@
package com.engine.salary.report.entity.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Description: 消息发送
* @Author: zhangheng
* @CreateDate: 2023/5/23
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryStatisticsPushParam {
/*********************************前端传送参数*******************************************/
// 快照id列表
private List<String> reportIds;
// 分享主题
private String pushTitle;
// 被分享人
private List<Long> sharedBy;
// 开始时间
private String startTime;
// 结束时间
private String endTime;
// 消息渠道
private List<Integer> pushChannel;
// 已查看提醒
private Integer remind;
// 邮件地址
private String emailAdress;
// 邮件账号id
private Long emailAccountId;
// 分享说明
private String mark;
// 渠道组件值
private String config;
// 渠道组件业务id
private Long businessId;
/**********************************后端补齐参数*********************************************/
// 域名
private String domain;
// 分享批次id
private Long id;
}

View File

@ -78,4 +78,10 @@ public class SalaryStatisticsReportDataQueryParam extends BaseQueryParam {
//统计单位
private Integer unitType;
// 是否是分享报表
private boolean isShare;
// "分享批次id
private Long batchId;
}

View File

@ -0,0 +1,68 @@
package com.engine.salary.report.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description:
* @Author: zhangheng
* @CreateDate: 2023/5/17
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//@TableName(value = "hrsa_report_push_detail", autoResultMap = true)
public class SalaryStatisticsPushDetailPO implements Serializable {
// 主键id
private Long id;
// 批次id
private Long batchId;
// 消息id
private Long msgId;
// 员工id
private Long employeeId;
// 分享时间
private String pushTime;
// 分享状态
private String pushStatus;
// 撤回时间
private String rebackTime;
// 撤回状态
private String rebackStatus;
// 被分享人查看情况
private String viewStatus;
// 租户key
private String tenantKey;
// 创建人id
private Long creator;
// 是否删除
private Integer deleteType;
// 创建时间
private Date createTime;
// 更新时间
private Date updateTime;
private List<Long> ids;
}

View File

@ -0,0 +1,71 @@
package com.engine.salary.report.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description:
* @Author: zhangheng
* @CreateDate: 2023/5/17
* @Version: v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//@TableName(value = "hrsa_report_push", autoResultMap = true)
public class SalaryStatisticsPushPO implements Serializable {
// 主键id
private Long id;
// 报表id
private String reportIds;
// 消息标题
private String pushTitle;
// 有效开始时间
private String startTime;
// 有效结束时间
private String endTime;
// 分享渠道
private String pushChannel;
// 邮件账号id
private Long emailAccountId;
// 邮件账号
private String emailAccount;
// 分享说明
private String mark;
// 已查看提醒
private Integer remind;
// 租户key
private String tenantKey;
// 创建人id
private Long creator;
// 是否删除
private Integer deleteType;
// 创建时间
private Date createTime;
// 更新时间
private Date updateTime;
private List<Long> ids;
}

View File

@ -0,0 +1,85 @@
package com.engine.salary.report.service;
import com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO;
import java.util.List;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushDetailService
* @date 2023/09/13 15:10
* @description
*/
public interface SalaryStatisticsPushDetailService {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<SalaryStatisticsPushDetailPO> listAll();
List<SalaryStatisticsPushDetailPO> listSome(SalaryStatisticsPushDetailPO po);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
SalaryStatisticsPushDetailPO getById(Long id);
/**
* 新增忽略null字段
*
* @param po 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(SalaryStatisticsPushDetailPO po);
/**
* 修改修改所有字段
*
* @param po 修改的记录
* @return 返回影响行数
*/
int update(SalaryStatisticsPushDetailPO po);
/**
* 修改忽略null字段
*
* @param po 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(SalaryStatisticsPushDetailPO po);
/**
* 删除记录
*
* @param po 待删除的记录
* @return 返回影响行数
*/
int delete(SalaryStatisticsPushDetailPO po);
/**
* 根据批次id查询
* @param batchIds
*/
List<SalaryStatisticsPushDetailPO> queryPushDetailPOByBatchIds(List<Long> batchIds);
/**
* 根据批次id员工id查询
* @param
*/
List<SalaryStatisticsPushDetailPO> queryPushDetailPOByBatchIdAndEmpIds(Long batchId, List<Long> sharedBy);
/**
* 根据被分享人获取分享记录列表
* @param uid
* @return
*/
List<SalaryStatisticsPushDetailPO> getSuccessPushDetailListByReceiver(Long uid);
}

View File

@ -0,0 +1,86 @@
package com.engine.salary.report.service;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushDetail;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushTableDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsPushDetailParam;
import com.engine.salary.report.entity.param.SalaryStatisticsPushParam;
import com.engine.salary.report.entity.po.SalaryStatisticsPushPO;
import com.engine.salary.util.page.PageInfo;
import java.util.List;
import java.util.Map;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushService
* @date 2023/09/11 10:15
* @description 薪酬统计报表消息推送
*/
public interface SalaryStatisticsPushService {
Map<String, Object> getPushForm();
/**
* 获取分享记录列表
* @param baseQueryParam
*/
PageInfo<SalaryStatisticsPushTableDTO> getPushTable(BaseQueryParam baseQueryParam);
/**
* 获取发送消息记录详情
* @param param
* @return
*/
SalaryStatisticsPushDetail getPushDetail(SalaryStatisticsPushDetailParam param);
/**
* 分享报表
* @param param
*/
void push(SalaryStatisticsPushParam param);
void addSharedPush(SalaryStatisticsPushParam param);
// void rePush(Long id, Long employeeId, String tenantKey);
/**
* 撤回分享
* @param id 分享明细id
*/
void cancel(Long id);
/**
* 撤回该批次所有分享
* @param id 分享批次id
*/
void cancelAll(Long id);
// SalaryStatisticsPushPO getById(Long id, String tenantKey);
// List<SalaryStatisticsPushDetailPO> getPushDetailsById(Long batchId, String tenantKey);
void updateReportViewStatus(List<Long> batchId, Long uid);
// void sendViewedMsg(Long batchId, Long reportId, Long employeeId, String tenantKey);
/**
* 根据用户获取有效没有过期撤回的分享记录
* @param uid
* @return
*/
List<SalaryStatisticsPushPO> getSuccessPushListByReceiver(Long uid);
/**
* 根据报表id分享批次id获取有效的分享记录
* @param reportId
* @return
*/
List<SalaryStatisticsPushPO> getPushListByReportIdAndIds(Long reportId, List<Long> ids);
/**
* 校验当前登录人员是否有权查看被分享的报表
* @param reportId
* @return
*/
List<SalaryStatisticsPushPO> shareReportValid(Long reportId, Long uid);
}

View File

@ -37,6 +37,13 @@ public interface SalaryStatisticsReportService {
*/
List<SalaryStatisticsReportPO> list();
/**
* 根据创建人获取薪酬报表列表
*
* @return
*/
List<SalaryStatisticsReportPO> listByCreator(Long uid);
/**
* 获取单个薪酬统计报表
*
@ -45,6 +52,8 @@ public interface SalaryStatisticsReportService {
*/
SalaryStatisticsReportPO getById(Long id);
List<SalaryStatisticsReportPO> getByIds(List<Long> ids);
/**
* 保存薪酬统计报表
*

View File

@ -0,0 +1,107 @@
package com.engine.salary.report.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.mapper.report.salaryStatisticsPushDetailMapper;
import com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO;
import com.engine.salary.report.service.SalaryStatisticsPushDetailService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushDetailServiceImpl
* @date 2023/09/13 15:13
* @description
*/
public class SalaryStatisticsPushDetailServiceImpl extends Service implements SalaryStatisticsPushDetailService {
private salaryStatisticsPushDetailMapper getsalaryStatisticsPushDetailMapper() {
return MapperProxyFactory.getProxy(salaryStatisticsPushDetailMapper.class);
}
@Override
public List<SalaryStatisticsPushDetailPO> listAll() {
return getsalaryStatisticsPushDetailMapper().listAll();
}
@Override
public List<SalaryStatisticsPushDetailPO> listSome(SalaryStatisticsPushDetailPO po) {
return getsalaryStatisticsPushDetailMapper().listSome(po);
}
@Override
public SalaryStatisticsPushDetailPO getById(Long id) {
return getsalaryStatisticsPushDetailMapper().getById(id);
}
@Override
public int insertIgnoreNull(SalaryStatisticsPushDetailPO po) {
return getsalaryStatisticsPushDetailMapper().insertIgnoreNull(po);
}
@Override
public int update(SalaryStatisticsPushDetailPO po) {
return getsalaryStatisticsPushDetailMapper().update(po);
}
@Override
public int updateIgnoreNull(SalaryStatisticsPushDetailPO po) {
return getsalaryStatisticsPushDetailMapper().updateIgnoreNull(po);
}
@Override
public int delete(SalaryStatisticsPushDetailPO po) {
return getsalaryStatisticsPushDetailMapper().delete(po);
}
/**
* 根据批次id查询
* @param batchIds
*/
public List<SalaryStatisticsPushDetailPO> queryPushDetailPOByBatchIds(List<Long> batchIds) {
if (CollectionUtils.isEmpty(batchIds)) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition(batchIds, 999);
List<SalaryStatisticsPushDetailPO> list = new ArrayList<>();
partition.forEach(l -> {
list.addAll(getsalaryStatisticsPushDetailMapper().queryPushDetailPOByBatchId(l));
});
return list;
}
/**
* 根据批次id员工id查询
* @param
*/
public List<SalaryStatisticsPushDetailPO> queryPushDetailPOByBatchIdAndEmpIds(Long batchId, List<Long> sharedBy) {
if (CollectionUtils.isEmpty(sharedBy) || ObjectUtils.isEmpty(batchId)) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition(sharedBy, 999);
List<SalaryStatisticsPushDetailPO> list = new ArrayList<>();
partition.forEach(l -> {
list.addAll(getsalaryStatisticsPushDetailMapper().queryPushDetailPOByBatchIdAndEmpIds(batchId, l));
});
return list;
}
public List<SalaryStatisticsPushDetailPO> getSuccessPushDetailListByReceiver(Long uid) {
List<SalaryStatisticsPushDetailPO> detailList = listSome(SalaryStatisticsPushDetailPO.builder()
.employeeId(uid)
.pushStatus("true")
.deleteType(NumberUtils.INTEGER_ZERO)
.build());
// 过滤已经撤回的
return detailList.stream().filter(po -> !(Objects.equals(po.getRebackStatus(), "true"))).collect(Collectors.toList());
}
}

View File

@ -0,0 +1,776 @@
package com.engine.salary.report.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.report.SalaryStatisticsPushMapper;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushDetail;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushDetailFormDTO;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushDetailTableDTO;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushTableDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsPushDetailParam;
import com.engine.salary.report.entity.param.SalaryStatisticsPushParam;
import com.engine.salary.report.entity.po.SalaryStatisticsPushDetailPO;
import com.engine.salary.report.entity.po.SalaryStatisticsPushPO;
import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
import com.engine.salary.report.service.SalaryStatisticsPushDetailService;
import com.engine.salary.report.service.SalaryStatisticsPushService;
import com.engine.salary.report.service.SalaryStatisticsReportService;
import com.engine.salary.report.util.ReportTimeUtil;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushServiceImpl
* @date 2023/09/11 10:15
* @description 薪酬统计报表消息推送
*/
public class SalaryStatisticsPushServiceImpl extends Service implements SalaryStatisticsPushService {
private SalaryStatisticsPushMapper getSalaryStatisticsPushMapper() {
return MapperProxyFactory.getProxy(SalaryStatisticsPushMapper.class);
}
private SalaryStatisticsPushDetailService getSalaryStatisticsPushDetailService(User user) {
return ServiceUtil.getService(SalaryStatisticsPushDetailServiceImpl.class, user);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalaryStatisticsReportService getSalaryStatisticsReportService(User user) {
return ServiceUtil.getService(SalaryStatisticsReportServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@Override
public Map<String, Object> getPushForm() {
Map<String, Object> resultMap = new HashMap<>();
// items
// 分享报表item
List<Map<String, Object>> reportOptions = buildReportIdsOptions(Long.valueOf(user.getUID()));
resultMap.put("reportOptions", reportOptions);
// data
resultMap.putAll(formData(Long.valueOf(user.getUID())));
return resultMap;
}
private Map<String, Object> formData(Long employeeId) {
Map<String, Object> data = new HashMap<>();
SalaryStatisticsPushPO pushPO = getListByEmployeeId(employeeId);
data.put("pushTitle", pushPO.getPushTitle());
data.put("mark", pushPO.getMark());
if (pushPO.getRemind() == null) {
data.put("remind", "1");
} else {
data.put("remind", pushPO.getRemind().toString());
}
return data;
}
private SalaryStatisticsPushPO getListByEmployeeId(Long uid) {
List<SalaryStatisticsPushPO> list = getSalaryStatisticsPushMapper().listLatestRecordByCreator(uid);
if (CollectionUtils.isEmpty(list)) {
return SalaryStatisticsPushPO.builder().build();
}
return list.get(0);
}
private List<Map<String, Object>> buildReportIdsOptions(Long employeeId) {
List<Map<String, Object>> reportIdsOptions = new ArrayList<>();
List<SalaryStatisticsReportPO> reportPOS = getSalaryStatisticsReportService(user).listAll();
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
// 只能够分享创建人是本人的报表
reportPOS = reportPOS.stream().filter(po -> po.getCreator().compareTo(employeeId) == 0).collect(Collectors.toList());
}
reportPOS.forEach( po -> {
Map<String, Object> option = new HashMap<>();
option.put("id", po.getId().toString());
option.put("reportName", po.getReportName());
reportIdsOptions.add(option);
});
return reportIdsOptions;
}
@Override
public SalaryStatisticsPushDetail getPushDetail(SalaryStatisticsPushDetailParam param) {
SalaryStatisticsPushPO salaryStatisticsPushPO = getSalaryStatisticsPushMapper().getById(param.getId());
if (Objects.isNull(salaryStatisticsPushPO)) {
throw new SalaryRunTimeException("该分享记录不存在");
}
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth && salaryStatisticsPushPO.getCreator().compareTo(Long.valueOf(user.getUID())) != 0) {
throw new SalaryRunTimeException("无权查看该分享记录");
}
SalaryStatisticsPushDetail result = new SalaryStatisticsPushDetail();
result.setDetailForm(buildDetailForm(salaryStatisticsPushPO));
result.setDetailTable(buildDetailTable(param));
return result;
}
@Override
public void push(SalaryStatisticsPushParam param) {
// 生成分享链接中的id参数
param.setId(createAndGetBatchId(param));
sendMsg(param);
}
// public void configSave(SalaryStatisticsPushParam param, String tenantkey, Long employeeId) {
// if (StringUtils.isNotEmpty(param.getConfig())) {
// CreateRuleEntity createRule = new CreateRuleEntity()
// .setName(SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 220428, "分享报表"))
// .setUser(new UserEntity(employeeId, tenantkey))
// .setModule(MessageModule.HRSA)
// .setEvent(MessageEvent.REPORT_SHARING)
// .setBusinessId(param.getBusinessId().toString())
// .setConfig(param.getConfig());
// log.info("RuleRest.createRuleV2 -> config ====== {}", param.getConfig());
// WeaResult<Long> weaResult = ruleRest.createRuleV2(createRule);
// SalaryAssert.isTrue(weaResult.isStatus(), SalaryI18nUtil.getI18nLabel(184008, "RPC接口创建规则失败"));
// }
// }
@Override
public void addSharedPush(SalaryStatisticsPushParam param) {
SalaryStatisticsPushPO pushPO = getSalaryStatisticsPushMapper().getById(param.getId());
Collection<Long> sharedBy = sharedByValid(param.getSharedBy(), param.getId());
if (CollectionUtils.isEmpty(sharedBy)) {
return;
}
SalaryStatisticsPushParam pushParam = new SalaryStatisticsPushParam();
pushParam.setReportIds(Arrays.asList(pushPO.getReportIds().split(",")));
pushParam.setPushTitle(pushPO.getPushTitle());
// pushParam.setEmailAccountId(pushPO.getEmailAccountId());
// pushParam.setEmailAdress(pushParam.getEmailAdress());
pushParam.setSharedBy((List<Long>) sharedBy);
pushParam.setStartTime(pushPO.getStartTime());
pushParam.setEndTime(pushPO.getEndTime());
// pushParam.setPushChannel(Arrays.stream(pushPO.getPushChannel().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
pushParam.setMark(pushPO.getMark());
pushParam.setId(pushPO.getId());
sendMsg(pushParam);
}
public Collection<Long> sharedByValid(List<Long> sharedBy, Long batchId) {
List<SalaryStatisticsPushDetailPO> list = getSalaryStatisticsPushDetailService(user).queryPushDetailPOByBatchIdAndEmpIds(batchId, sharedBy);
List<SalaryStatisticsPushDetailPO> finalList = list;
// 获取需要分享或重新分享的人
sharedBy = sharedBy.stream().filter(shareId -> {
List<SalaryStatisticsPushDetailPO> collect = finalList.stream().filter(po -> Objects.equals(po.getEmployeeId(), shareId)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)) {
return true;
}
boolean enabledSend = collect.stream().anyMatch(po -> Objects.equals(po.getPushStatus(), "true") && !Objects.equals(po.getRebackStatus(), "true"));
return !enabledSend;
}).collect(Collectors.toList());
return sharedBy;
}
public void sendMsg(SalaryStatisticsPushParam param) {
// 获取被分享人
List<DataCollectionEmployee> receivers = getSalaryEmployeeService(user).getEmployeeByIds(param.getSharedBy());
// 发送消息
receivers.forEach(receiver -> {
// 发送消息...
// 发送成功
doSuccess(receiver, param);
});
}
// @Override
// public void rePush(Long id, Long employeeId, String tenantKey) {
// SalaryStatisticsPushDetailPO detailPO = salaryStatisticsPushDetailMapper.selectById(id);
// SalaryStatisticsPushPO pushPO = salaryStatisticsPushMapper.selectById(detailPO.getBatchId());
// SalaryStatisticsPushParam param = new SalaryStatisticsPushParam();
// param.setReportIds(Arrays.asList(pushPO.getReportIds().split(",")));
// param.setPushTitle(pushPO.getPushTitle());
// param.setEmailAdress(pushPO.getEmailAccount());
// param.setEmailAccountId(pushPO.getEmailAccountId());
// param.setSharedBy(Collections.singletonList(detailPO.getEmployeeId()));
// param.setStartTime(pushPO.getStartTime());
// param.setEndTime(pushPO.getEndTime());
// param.setPushChannel(Arrays.stream(pushPO.getPushChannel().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
// param.setMark(pushPO.getMark());
// param.setId(pushPO.getId());
// sendMsg(param, employeeId, tenantKey);
// }
@Override
public void cancel(Long id) {
SalaryStatisticsPushDetailPO detailPO = getSalaryStatisticsPushDetailService(user).getById(id);
if (ObjectUtils.isEmpty(detailPO)) {
throw new SalaryRunTimeException("该明细不存在");
}
cancelSingle(detailPO);
}
public void cancelSingle(SalaryStatisticsPushDetailPO detailPO) {
// 撤回消息...
// 撤回分享记录
doCancelResult(detailPO);
}
@Override
public void cancelAll(Long id) {
// 根据分享批次id获取所有的分享明细
List<SalaryStatisticsPushDetailPO> salaryStatisticsPushDetailPOS = getSalaryStatisticsPushDetailService(user).queryPushDetailPOByBatchIds(Collections.singletonList(id));
salaryStatisticsPushDetailPOS.forEach(po -> cancelSingle(po));
}
// public List<SalaryStatisticsPushDetailPO> getSalatyPushDetailPOSBybatchId(Long batchId, String tenantKey) {
// return new LambdaQueryChainWrapper<>(salaryStatisticsPushDetailMapper)
// .eq(SalaryStatisticsPushDetailPO::getTenantKey, tenantKey)
// .eq(SalaryStatisticsPushDetailPO::getBatchId, batchId)
// .eq(SalaryStatisticsPushDetailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
// .isNull(SalaryStatisticsPushDetailPO::getRebackStatus)
// .list();
// }
//
// @Override
// public SalaryStatisticsPushPO getById(Long id, String tenantKey) {
// return salaryStatisticsPushMapper.selectById(id);
// }
//
// @Override
// public List<SalaryStatisticsPushDetailPO> getPushDetailsById(Long batchId, String tenantKey) {
// return new LambdaQueryChainWrapper<>(salaryStatisticsPushDetailMapper)
// .eq(SalaryStatisticsPushDetailPO::getTenantKey, tenantKey)
// .eq(SalaryStatisticsPushDetailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
// .eq(SalaryStatisticsPushDetailPO::getBatchId, batchId)
// .list();
// }
@Override
public void updateReportViewStatus(List<Long> batchId, Long uid) {
List<SalaryStatisticsPushDetailPO> salaryStatisticsPushDetailPOS = getSalaryStatisticsPushDetailService(user).queryPushDetailPOByBatchIds(batchId);
salaryStatisticsPushDetailPOS.stream().filter(po -> Objects.equals(po.getPushStatus(), "true") && !(Objects.equals(po.getRebackStatus(), "true")) && Objects.equals(uid, po.getEmployeeId()))
.collect(Collectors.toList()).forEach(e -> {
e.setViewStatus("true");
e.setUpdateTime(new Date());
getSalaryStatisticsPushDetailService(user).updateIgnoreNull(e);
});
}
// @Override
// public void sendViewedMsg(Long batchId, Long reportId, Long employeeId, String tenantKey) {
// SalaryStatisticsPushPO pushPO = salaryStatisticsPushMapper.selectById(batchId);
// if (!Objects.equals(1, pushPO.getRemind())) {
// return;
// }
// List<SalaryStatisticsPushDetailPO> salaryStatisticsPushDetailPOS = queryPushDetailPOByBatchId(batchId, tenantKey);
// List<SalaryStatisticsPushDetailPO> detailPOList = salaryStatisticsPushDetailPOS.stream().filter(po -> Objects.equals(po.getPushStatus(), "true") && po.getRebackStatus() == null && Objects.equals(employeeId, po.getEmployeeId())).collect(Collectors.toList());
// if (CollectionUtils.isEmpty(detailPOList)) {
// return;
// }
// SalaryStatisticsPushParam param = new SalaryStatisticsPushParam();
// param.setPushTitle(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 227925, "报表已查看提醒"));
// param.setSharedBy(Collections.singletonList(pushPO.getCreator()));
// param.setPushChannel(Collections.singletonList(MessageChannelEnum.IM.getType()));
// param.setMark(buildViewMark(pushPO, detailPOList, employeeId, tenantKey));
// SendMessageEntity entity = buildSendMessage(param, employeeId, tenantKey);
// entity.getEntity().setPcUrl("");
// entity.getEntity().setH5Url("");
// entity.getEntity().setPcLinkeType(0);
// entity.getEntity().setH5LinkeType(0);
// List<UserEntity> receivers = buildReceivers(param, tenantKey);
// // 发送消息
// receivers.forEach(receiver -> {
// entity.setReceivers(Collections.singletonList(receiver));
// try {
// asyncSystemMessageRest.sendMsg(entity);
// } catch (Exception e) {
// log.error("查看消息发送失败", e);
// }
// });
// }
//
// public String buildViewMark(SalaryStatisticsPushPO pushPO, List<SalaryStatisticsPushDetailPO> detailPOList, Long employeeId, String tenantkey) {
// SimpleEmployee employee = hrmCommonEmployeeService.getById(employeeId);
// if (employee == null) {
// return SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 227926, "消息创建人已不存在");
// }
// return employee.getUsername() +
// SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 227927, "已查看您分享的报表。") +
// SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 227928, "分享主题:") +
// pushPO.getPushTitle() + "" +
// SalaryI18nUtil.getI18nLabel(tenantkey, employeeId, 233590, "分享时间:") +
// detailPOList.get(0).getPushTime() +
// "";
// }
//
public void doCancelResult(SalaryStatisticsPushDetailPO detailPO) {
// 判断撤回消息是否成功...
// 消息撤回成功的话撤回分享记录
detailPO.setRebackStatus("true");
detailPO.setRebackTime(ReportTimeUtil.getFormatLocalDateTime(LocalDateTime.now()));
getSalaryStatisticsPushDetailService(user).updateIgnoreNull(detailPO);
}
// public CancleMessageEntity buildCancelMessageEntity(SalaryStatisticsPushDetailPO po, Long employeeId, String tenantKey) {
// SalaryStatisticsPushPO pushPO = salaryStatisticsPushMapper.selectById(po.getBatchId());
// CancleMessageEntity cancleMessageEntity = new CancleMessageEntity();
// cancleMessageEntity.setMsgId(po.getMsgId());
// cancleMessageEntity.setModule(MessageModule.HRSA);
// cancleMessageEntity.setEvent(MessageEvent.REPORT_SHARING);
// cancleMessageEntity.setText(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 221630, "此消息已收回,如有问题,请联系管理员"));
// Entity entity = new Entity();
// entity.setId(String.valueOf(IdGenerator.generate()));
// entity.setModule(EntityType.hrmsalary.name());
// entity.setName(pushPO.getPushTitle());
// cancleMessageEntity.setEntity(entity);
// UserEntity user = new UserEntity(employeeId, tenantKey);
// SimpleEmployee employeeById = hrmCommonEmployeeService.getEmployeeById(employeeId, tenantKey);
// user.setName(employeeById.getUsername());
// cancleMessageEntity.setOperator(user);
// return cancleMessageEntity;
// }
public void doSuccess(DataCollectionEmployee receiver, SalaryStatisticsPushParam param) {
List<SalaryStatisticsPushDetailPO> pushDetailByBatchIdAndEmpId = getSalaryStatisticsPushDetailService(user).listSome(SalaryStatisticsPushDetailPO.builder()
.batchId(param.getId())
.employeeId(receiver.getEmployeeId())
.build());
Date now = new Date();
if (CollectionUtils.isEmpty(pushDetailByBatchIdAndEmpId)) {
SalaryStatisticsPushDetailPO detailPO = SalaryStatisticsPushDetailPO.builder()
.id(IdGenerator.generate())
.batchId(param.getId())
// .msgId(result.getData())
.pushStatus("true")
.pushTime(ReportTimeUtil.getFormatLocalDateTime(LocalDateTime.now()))
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.employeeId(receiver.getEmployeeId())
.updateTime(now)
.creator(Long.valueOf(user.getUID()))
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
getSalaryStatisticsPushDetailService(user).insertIgnoreNull(detailPO);
} else {
SalaryStatisticsPushDetailPO PO = pushDetailByBatchIdAndEmpId.get(0);
PO.setPushStatus("true");
PO.setRebackStatus("");
PO.setRebackTime("");
PO.setViewStatus("false");
// PO.setMsgId(result.getData());
PO.setPushTime(ReportTimeUtil.getFormatLocalDateTime(LocalDateTime.now()));
PO.setUpdateTime(now);
PO.setCreator(Long.valueOf(user.getUID()));
getSalaryStatisticsPushDetailService(user).updateIgnoreNull(PO);
}
}
// public void delBatchId(Long id) {
// SalaryStatisticsPushPO pushPO = salaryStatisticsPushMapper.selectById(id);
// pushPO.setDeleteType(DeleteTypeEnum.PHYSICAL_DELETED.getValue());
// salaryStatisticsPushMapper.updateById(pushPO);
// }
//
// public void paramValid(SalaryStatisticsPushParam param, Long employeeId, String tenantKey) {
// channelCheck(param, employeeId, tenantKey);
// emileCheck(param, employeeId, tenantKey);
// bridgeCheck(param, employeeId, tenantKey);
// }
public Long createAndGetBatchId(SalaryStatisticsPushParam param) {
Date now = new Date();
SalaryStatisticsPushPO pushPO = SalaryStatisticsPushPO.builder()
.id(IdGenerator.generate())
.creator(Long.valueOf(user.getUID()))
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(now)
.updateTime(now)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
// .pushChannel(buildChannelString(param))
.startTime(param.getStartTime())
.endTime(param.getEndTime())
.remind(param.getRemind())
// .emailAccount(param.getEmailAdress())
// .emailAccountId(param.getEmailAccountId())
.mark(param.getMark())
// .pushTitle(param.getPushTitle())
.reportIds(String.join(",", param.getReportIds()))
.build();
getSalaryStatisticsPushMapper().insertIgnoreNull(pushPO);
return pushPO.getId();
}
// public String buildChannelString(SalaryStatisticsPushParam param) {
// Set<MessageChannelEnum> channelEnums = buildChannel(param);
// List<String> channelType = channelEnums.stream().map(e -> String.valueOf(e.getType())).collect(Collectors.toList());
// return String.join(",", channelType);
// }
//
//
// public void channelCheck(SalaryStatisticsPushParam param, Long employeeId, String tenantKey) {
// if (CollectionUtils.isEmpty(param.getPushChannel())) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 221582, "至少有一个发送通道"));
// }
// }
//
// public void emileCheck(SalaryStatisticsPushParam param, Long employeeId, String tenantKey) {
// if (param.getPushChannel().contains(MessageChannelEnum.EMAIL.getType())) {
// if (!isEnableEmail(tenantKey)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 221580, "邮件模块未采购,不可使用邮件通道!"));
// }
// // 接收者邮箱校验
// List<SimpleEmployee> employeeByIds = hrmCommonEmployeeService.getEmployeeByIds(param.getSharedBy(), tenantKey);
// List<String> usernameList = new ArrayList<>();
// employeeByIds.forEach(employee -> {
// if (StringUtils.isEmpty(employee.getEmail())) {
// usernameList.add(employee.getUsername());
// }
// });
// if (CollectionUtils.isNotEmpty(usernameList)) {
// throw new SalaryRunTimeException(String.join(",", usernameList) + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 221578, "没有可用邮箱,请先配置再发送!"));
// }
// if (StringUtils.isEmpty(param.getEmailAdress())) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 224278, "发送邮箱不可为空"));
// }
// }
// }
//
// public void bridgeCheck(SalaryStatisticsPushParam param, Long employeeId, String tenantKey) {
// if (param.getPushChannel().contains(MessageChannelEnum.CLOUD_BRIDGE.getType()) && !isEnableEbridge(tenantKey)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 221581, "云桥模块未采购,不可使用云桥通道!"));
// }
// }
//
// public SendMessageEntity buildSendMessage(SalaryStatisticsPushParam param, Long employeeId, String tenantKey) {
// // 域名
// param.setDomain(weaverConfigUtils.getValueFromDataMap("primary.domain"));
// SendMessageEntity entity = new SendMessageEntity();
// // 模块
// entity.setModule(MessageModule.HRSA);
// // 消息事件
// entity.setEvent(MessageEvent.REPORT_SHARING);
// // 消息通道
// entity.setChannels(buildChannel(param));
// // 主题
// entity.setText(param.getPushTitle());
// // 发送者信息
// entity.setSender(buildSendEntity(employeeId, tenantKey));
// // 接收者
// entity.setReceivers(buildReceivers(param, tenantKey));
// // emile消息体
// entity.setEmailInfo(buildEmailEntity(param, employeeId, tenantKey));
// // im消息体
// entity.setEntity(buildImEntity(param));
// // 消息内容 im和bridge公用
// entity.setText(param.getMark());
// // 云桥
// entity.setTitle(param.getPushTitle());
// return entity;
// }
//
// public UserEntity buildSendEntity(Long employeeId, String tenantKey) {
// SimpleEmployee employeeById = hrmCommonEmployeeService.getEmployeeById(employeeId, tenantKey);
// UserEntity userEntity = new UserEntity();
// userEntity.setEmployeeId(employeeId);
// userEntity.setTenantKey(tenantKey);
// userEntity.setName(employeeById.getUsername());
// return userEntity;
// }
//
//
// public List<UserEntity> buildReceivers(SalaryStatisticsPushParam param, String tenantKey) {
// List<SimpleEmployee> simpleEmployeeList = hrmCommonEmployeeService.getEmployeeByIds(param.getSharedBy(), tenantKey);
// return simpleEmployeeList.stream().map(employee -> {
// UserEntity userEntity = new UserEntity();
// userEntity.setEmployeeId(employee.getEmployeeId());
// userEntity.setTenantKey(tenantKey);
// userEntity.setEmail(employee.getEmail());
// return userEntity;
// }).collect(Collectors.toList());
// }
//
// public Entity buildImEntity(SalaryStatisticsPushParam param) {
// Entity imEntity = new Entity();
// imEntity.setId(IDGenerator.generateId());
// imEntity.setName(param.getPushTitle());
// imEntity.setModule("hrmsalary");
// imEntity.setPcLinkeType(2);
// imEntity.setH5LinkeType(2);
// imEntity.setPcUrl(buildPcUrl(param));
// imEntity.setH5Url(buildPcUrl(param));
// return imEntity;
// }
//
// public String buildPcUrl(SalaryStatisticsPushParam param) {
// return param.getDomain() + String.format("/sp/ebdpage/view/828107636586323968?id=%s&share=true", param.getId());
// }
//
// public EmailEntity buildEmailEntity(SalaryStatisticsPushParam param, Long employeeId, String tenantKey) {
// EmailEntity emailEntity = new EmailEntity();
// if (param.getEmailAccountId() == null) {
// return emailEntity;
// }
// emailEntity.setEmailSubject(param.getPushTitle());
// emailEntity.setEmailContent(buildEmailContent(param));
// emailEntity.setMailUserAccountId(param.getEmailAccountId());
// return emailEntity;
// }
//
// public String buildEmailContent(SalaryStatisticsPushParam param) {
// String emailContent = "<div>" +
// "<div style=fontSize: '12px'>" +
// param.getMark() +
// "</div>" +
// "<a href='" + buildPcUrl(param) + "'" + "target='_blank' style=fontSize: '12px', color: 'var(--primary)', cursor: 'pointer', textDecoration: 'none' rel='noreferrer'>" + buildPcUrl(param) + "</a>" +
// "</div>";
// return emailContent;
// }
//
// public Set<MessageChannelEnum> buildChannel(SalaryStatisticsPushParam param) {
// Set<MessageChannelEnum> channelEnums = new HashSet<>();
// if (param.getPushChannel().contains(MessageChannelEnum.EMAIL.getType())) {
// channelEnums.add(MessageChannelEnum.EMAIL);
// }
// if (param.getPushChannel().contains(MessageChannelEnum.CLOUD_BRIDGE.getType())) {
// channelEnums.add(MessageChannelEnum.CLOUD_BRIDGE);
// }
// if (param.getPushChannel().contains(MessageChannelEnum.IM.getType())) {
// channelEnums.add(MessageChannelEnum.IM);
// }
// return channelEnums;
// }
//
// public Boolean isEnableEmail(String tenantKey) {
//// boolean isPayModule = remoteTenantService.isPayModule(tenantKey, EntityType.email.name());
//// boolean checkDisplayModule = CollectionUtils.emptyIfNull(baseEnvInfoService.listDisplayModules(tenantKey)).stream().anyMatch(m -> m.equals(EntityType.email.name()));
//// return isPayModule && checkDisplayModule;
// return CollectionUtils.emptyIfNull(baseEnvInfoService.listDisplayModules(tenantKey)).stream().anyMatch(m -> m.equals(EntityType.email.name()));
// }
//
// public Boolean isEnableEbridge(String tenantKey) {
// return CollectionUtils.emptyIfNull(baseEnvInfoService.listDisplayModules(tenantKey)).stream().anyMatch(m -> m.equals("wechatEnterprise"));
// }
public SalaryStatisticsPushDetailFormDTO buildDetailForm(SalaryStatisticsPushPO salaryStatisticsPushPO) {
List<Long> reportIds = Arrays.stream(salaryStatisticsPushPO.getReportIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
List<String> reportNames = getSalaryStatisticsReportService(user).getByIds(reportIds).stream().map(SalaryStatisticsReportPO::getReportName).collect(Collectors.toList());
SalaryStatisticsPushDetailFormDTO formDTO = SalaryStatisticsPushDetailFormDTO.builder()
.remark(salaryStatisticsPushPO.getMark())
.effectiveTime(salaryStatisticsPushPO.getStartTime() + "-" + salaryStatisticsPushPO.getEndTime())
.reportName(String.join("", reportNames))
.build();
return formDTO;
}
public PageInfo<SalaryStatisticsPushDetailTableDTO> buildDetailTable(SalaryStatisticsPushDetailParam param) {
List<SalaryStatisticsPushDetailPO> salaryStatisticsPushDetailPOS = getSalaryStatisticsPushDetailService(user).queryPushDetailPOByBatchIds(Arrays.asList(param.getId()));
PageInfo<SalaryStatisticsPushDetailTableDTO> dtoPage = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), SalaryStatisticsPushDetailTableDTO.class);
List<SalaryStatisticsPushDetailTableDTO> records = salaryStatisticsPushDetailPOS.stream().map(po -> {
return SalaryStatisticsPushDetailTableDTO.builder()
.id(po.getId())
.pushStatus(buildStatus(po.getPushStatus()))
.pushTime(po.getPushTime())
.rebackStatus(buildStatus(po.getRebackStatus()))
.viewStatus(buildViewStatus(po.getViewStatus()))
.rebackTime(po.getRebackTime())
.userName(buildUserName(po.getEmployeeId()))
.employeeId(po.getEmployeeId())
.build();
}).collect(Collectors.toList());
if (StringUtils.isNotEmpty(param.getUserNameSearch())) {
records = records.stream().filter(record -> record.getUserName().contains(param.getUserNameSearch())).collect(Collectors.toList());
}
dtoPage.setList(records);
dtoPage.setTotal(records.size());
return dtoPage;
}
public String buildUserName(Long employeeId) {
DataCollectionEmployee employeeById = getSalaryEmployeeService(user).getEmployeeById(employeeId);
if (employeeById != null) {
return employeeById.getUsername();
}
return "";
}
public String buildViewStatus(String status) {
if (Objects.equals(status, "true")) {
return SalaryI18nUtil.getI18nLabel(0, "已查看");
} else {
return SalaryI18nUtil.getI18nLabel(0, "未查看");
}
}
public String buildStatus(String status) {
if (StringUtils.isEmpty(status)) {
return "";
}
if (Objects.equals("true", status)) {
return SalaryI18nUtil.getI18nLabel(0, "成功");
}
if (Objects.equals("false", status)) {
return SalaryI18nUtil.getI18nLabel(0, "失败");
}
return "";
}
@Override
public PageInfo<SalaryStatisticsPushTableDTO> getPushTable(BaseQueryParam param) {
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
List<SalaryStatisticsPushPO> salaryStatisticsPushPOS;
if (needAuth) {
salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().creator(Long.valueOf(user.getUID())).build());
} else {
salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().build());
}
salaryStatisticsPushPOS = SalaryPageUtil.subList(param.getCurrent(), param.getPageSize(), salaryStatisticsPushPOS);
PageInfo<SalaryStatisticsPushTableDTO> dtoPageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), SalaryStatisticsPushTableDTO.class);
if (CollectionUtils.isNotEmpty(salaryStatisticsPushPOS)) {
// 获取报表名称 key:报表id value报表名称
List<Long> reportIds = salaryStatisticsPushPOS.stream().map(po -> Arrays.asList(StringUtils.split(po.getReportIds(), ",")))
.flatMap(Collection::stream).distinct().map(Long::valueOf).collect(Collectors.toList());
Map<Long, String> statisticsNameMap = SalaryEntityUtil.convert2Map(getSalaryStatisticsReportService(user).getByIds(reportIds), SalaryStatisticsReportPO::getId, SalaryStatisticsReportPO::getReportName);
// 获取报表分享明细 key:批次id value分享明细列表
List<Long> batchIds = salaryStatisticsPushPOS.stream().map(po -> Long.valueOf(po.getId())).collect(Collectors.toList());
Map<Long, List<SalaryStatisticsPushDetailPO>> groupByBatchId;
if (CollectionUtils.isNotEmpty(batchIds)) {
groupByBatchId = SalaryEntityUtil.group2Map(
getSalaryStatisticsPushDetailService(user).queryPushDetailPOByBatchIds(batchIds),
SalaryStatisticsPushDetailPO::getBatchId);
} else {
groupByBatchId = Collections.emptyMap();
}
List<SalaryStatisticsPushTableDTO> dtoList = salaryStatisticsPushPOS.stream().map(po -> {
return SalaryStatisticsPushTableDTO.builder()
.reportName(buildReportName(po.getReportIds(), statisticsNameMap))
.effectiveTime(StringUtils.isEmpty(po.getStartTime()) ? "" : po.getStartTime()
+ "——" + (StringUtils.isEmpty(po.getEndTime()) ? "" : po.getEndTime()))
.id(po.getId())
.successPush(buildSuccessPush(groupByBatchId.get(po.getId())))
.sharedView(buildSharedView(groupByBatchId.get(po.getId())))
.build();
}).collect(Collectors.toList());
dtoPageInfo.setList(dtoList);
dtoPageInfo.setTotal(dtoList.size());
}
return dtoPageInfo;
}
public String buildSharedView(List<SalaryStatisticsPushDetailPO> list) {
List<Long> successEmpIds = list.stream().filter(po -> Objects.equals(po.getPushStatus(), "true") && !(Objects.equals(po.getRebackStatus(), "true"))).map(SalaryStatisticsPushDetailPO::getEmployeeId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(successEmpIds)) {
return "0/0";
}
List<Long> viewEmpIds = list.stream().filter(po -> Objects.equals(po.getViewStatus(), "true")).map(SalaryStatisticsPushDetailPO::getEmployeeId).collect(Collectors.toList());
return viewEmpIds.size() + "/" + successEmpIds.size();
}
public String buildSuccessPush(List<SalaryStatisticsPushDetailPO> list) {
List<DataCollectionEmployee> employeeByIds = getSalaryEmployeeService(user).getEmployeeByIds(list.stream().filter(po -> Objects.equals(po.getPushStatus(), "true") && !(Objects.equals(po.getRebackStatus(), "true"))).map(SalaryStatisticsPushDetailPO::getEmployeeId).collect(Collectors.toList()));
Set<String> employeeName = employeeByIds.stream().map(DataCollectionEmployee::getUsername).collect(Collectors.toSet());
return String.join("", employeeName);
}
public String buildReportName(String reportIds, Map<Long, String> statisticsNameMap) {
List<String> ids = Arrays.asList(reportIds.split(","));
List<String> reportName = Lists.newArrayList();
ids.forEach(id -> {
String name = statisticsNameMap.get(Long.valueOf(id));
if (name != null) {
reportName.add(name);
}
});
return String.join("", reportName);
}
@Override
public List<SalaryStatisticsPushPO> getSuccessPushListByReceiver(Long uid) {
List<Long> batchIds = getSalaryStatisticsPushDetailService(user).getSuccessPushDetailListByReceiver(uid)
.stream().map(SalaryStatisticsPushDetailPO::getBatchId).collect(Collectors.toList());
// 根据batchId获取分享记录
if (CollectionUtils.isEmpty(batchIds)) {
return Collections.emptyList();
}
List<SalaryStatisticsPushPO> pushList = new ArrayList<>();
List<List<Long>> partition = Lists.partition((List<Long>)batchIds, 1000);
partition.forEach(ids -> {
pushList.addAll(getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().ids(ids).build()));
});
return filterReportByTime(pushList);
}
@Override
public List<SalaryStatisticsPushPO> getPushListByReportIdAndIds(Long reportId, List<Long> ids) {
List<SalaryStatisticsPushPO> pushList = getSalaryStatisticsPushMapper().listByReportIdAndIds(reportId.toString(), ids);
pushList = pushList.stream().filter( push -> {
return Arrays.asList(push.getReportIds().split(",")).contains(reportId.toString());
}).collect(Collectors.toList());
return pushList;
}
List<SalaryStatisticsPushPO> filterReportByTime(List<SalaryStatisticsPushPO> pushList){
// 报表分享时间校验
String formatLocalDateTime = SalaryDateUtil.getFormatLocalDate(LocalDateTime.now());
List<SalaryStatisticsPushPO> result = pushList.stream().filter(pushPO -> {
if (pushPO.getStartTime().compareTo(formatLocalDateTime) > 0 || (StringUtils.isNotEmpty(pushPO.getEndTime()) && pushPO.getEndTime().compareTo(formatLocalDateTime) < 0)) {
return false;
}
return true;
}).collect(Collectors.toList());
return result;
}
@Override
public List<SalaryStatisticsPushPO> shareReportValid(Long reportId, Long uid) {
// 获取该员工所有被分享成功的明细
List<SalaryStatisticsPushDetailPO> successPushDetailList = getSalaryStatisticsPushDetailService(user).getSuccessPushDetailListByReceiver(uid);
// 根据报表id分享批次id查询分享批次信息
List<Long> batchIds = successPushDetailList.stream().map(SalaryStatisticsPushDetailPO::getBatchId).collect(Collectors.toList());
List<SalaryStatisticsPushPO> pushList= getPushListByReportIdAndIds(reportId,batchIds);
if (CollectionUtils.isEmpty(pushList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"暂无权限查看该报表"));
}
// 校验是否在分享的有效时间内
pushList = filterReportByTime(pushList);
if (CollectionUtils.isEmpty(pushList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"该报表的分享不在有效期内,无法查看"));
}
return pushList;
}
}

View File

@ -132,11 +132,29 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
return getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().build());
}
@Override
public List<SalaryStatisticsReportPO> listByCreator(Long uid) {
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
return getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().creator(uid).build());
}
return getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().build());
}
@Override
public SalaryStatisticsReportPO getById(Long id) {
return getSalaryStatisticsReportMapper().getById(id);
}
@Override
public List<SalaryStatisticsReportPO> getByIds(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Collections.emptyList();
}
return getSalaryStatisticsReportMapper().listSome(SalaryStatisticsReportPO.builder().ids(ids).build());
}
/**
* 根据名称模糊查询
*

View File

@ -0,0 +1,143 @@
package com.engine.salary.report.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushDetail;
import com.engine.salary.report.entity.dto.SalaryStatisticsPushTableDTO;
import com.engine.salary.report.entity.param.SalaryStatisticsPushDetailParam;
import com.engine.salary.report.entity.param.SalaryStatisticsPushParam;
import com.engine.salary.report.service.SalaryStatisticsPushService;
import com.engine.salary.report.service.impl.SalaryStatisticsPushServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author Harryxzy
* @ClassName SalaryStatisticsPushController
* @date 2023/09/11 10:08
* @description 薪酬统计报表消息推送
*/
public class SalaryStatisticsPushController {
private SalaryStatisticsPushService getSalaryStatisticsPushService(User user) {
return ServiceUtil.getService(SalaryStatisticsPushServiceImpl.class, user);
}
/**
* 获取发送消息form
*
* @return obj
*/
@GET
@Path("/getForm")
@Produces(MediaType.APPLICATION_JSON)
public String getPushForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Void, Map<String, Object>>(user).run(getSalaryStatisticsPushService(user)::getPushForm);
}
/**
* 获取分享记录列表
*
* @return obj
*/
@POST
@Path("/getTable")
@Produces(MediaType.APPLICATION_JSON)
public String getPushTable(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody BaseQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<BaseQueryParam, PageInfo<SalaryStatisticsPushTableDTO>>(user).run(getSalaryStatisticsPushService(user)::getPushTable, param);
}
/**
* 获取发送消息记录详情
*
* @return obj
*/
@POST
@Path("/getDetail")
@Produces(MediaType.APPLICATION_JSON)
public String getPushDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsPushDetailParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsPushDetailParam, SalaryStatisticsPushDetail>(user).run(getSalaryStatisticsPushService(user)::getPushDetail, param);
}
/**
* 分享报表
*
* @return obj
*/
@POST
@Path("/sendMsg")
@Produces(MediaType.APPLICATION_JSON)
public String push(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsPushParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsPushParam, Void>(user).run(getSalaryStatisticsPushService(user)::push, param);
}
/**
* 追加分享人发送消息
*
* @return obj
*/
@POST
@Path("/addSharedSendMsg")
@Produces(MediaType.APPLICATION_JSON)
public String addSharePush(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryStatisticsPushParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryStatisticsPushParam, String>(user).run(getSalaryStatisticsPushService(user)::addSharedPush, param);
}
// /**
// * 发送消息
// *
// * @return obj
// */
// @GetMapping("/reSendMsg")
// @ApiOperation("重新发送消息")
// @WeaPermission(publicPermission = true)
// public WeaResult<String> push(@RequestParam Long id) {
// salaryStatisticsPushService.rePush(id, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success("");
// }
/**
* 撤回消息
*
* @return obj
*/
@GET
@Path("/cancel")
@Produces(MediaType.APPLICATION_JSON)
public String cancel(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Void>(user).run(getSalaryStatisticsPushService(user)::cancel, id);
}
/**
* 撤回全部消息
*
* @return obj
*/
@GET
@Path("/cancelAll")
@Produces(MediaType.APPLICATION_JSON)
public String cancelAll(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Void>(user).run(getSalaryStatisticsPushService(user)::cancelAll, id);
}
}

View File

@ -6,6 +6,7 @@ import com.engine.salary.report.wrapper.SalaryStatisticsReportWrapper;
import com.engine.salary.util.ResponseResult;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -150,9 +151,9 @@ public class SalaryStatisticsReportController {
SalaryStatisticsReportDataQueryParam param = SalaryStatisticsReportDataQueryParam.builder()
.id(Long.parseLong(request.getParameter("id")))
.dimensionId(Long.parseLong(request.getParameter("dimensionId")))
.isShare(StringUtils.equals(request.getParameter("isShare"), "true"))
.build();
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = getSalaryStatisticsReportWrapper(user).exportData(param);
XSSFWorkbook workbook = (XSSFWorkbook) map.get("workbook");

View File

@ -17,23 +17,12 @@ import com.engine.salary.report.entity.bo.SalaryStatisticsReportBO;
import com.engine.salary.report.entity.param.*;
import com.engine.salary.report.entity.po.SalaryStatisticsDimensionPO;
import com.engine.salary.report.entity.po.SalaryStatisticsItemPO;
import com.engine.salary.report.entity.po.SalaryStatisticsPushPO;
import com.engine.salary.report.entity.po.SalaryStatisticsReportPO;
import com.engine.salary.report.service.SalaryStatisticsDimensionService;
import com.engine.salary.report.service.SalaryStatisticsItemService;
import com.engine.salary.report.service.SalaryStatisticsReportService;
import com.engine.salary.report.service.SubTableExportService;
import com.engine.salary.report.service.impl.SalaryStatisticsDimensionServiceImpl;
import com.engine.salary.report.service.impl.SalaryStatisticsItemServiceImpl;
import com.engine.salary.report.service.impl.SalaryStatisticsReportServiceImpl;
import com.engine.salary.report.service.impl.SubTableExportServiceImpl;
import com.engine.salary.service.SalaryAcctEmployeeService;
import com.engine.salary.service.SalaryAcctResultService;
import com.engine.salary.service.SalaryCacheService;
import com.engine.salary.service.SalaryItemService;
import com.engine.salary.service.impl.SalaryAcctEmployeeServiceImpl;
import com.engine.salary.service.impl.SalaryAcctResultServiceImpl;
import com.engine.salary.service.impl.SalaryCacheServiceImpl;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
import com.engine.salary.report.service.*;
import com.engine.salary.report.service.impl.*;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.*;
import com.engine.salary.util.excel.ExcelUtilPlus;
import com.engine.salary.util.page.PageInfo;
@ -42,6 +31,7 @@ import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.PageIdConst;
import weaver.hrm.User;
@ -95,6 +85,19 @@ public class SalaryStatisticsReportWrapper extends Service {
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
private SalaryStatisticsPushService getSalaryStatisticsPushService(User user) {
return ServiceUtil.getService(SalaryStatisticsPushServiceImpl.class, user);
}
private SalaryStatisticsPushDetailService getSalaryStatisticsPushDetailService(User user) {
return ServiceUtil.getService(SalaryStatisticsPushDetailServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
/**
* 报表列表
*
@ -102,16 +105,27 @@ public class SalaryStatisticsReportWrapper extends Service {
* @return
*/
public List<Map<String, Object>> list(SalaryStatisticsReportQueryParam queryParam) {
Long uid = Long.valueOf(user.getUID());
// 初始化
getSalaryStatisticsDimensionService(user).init((long) user.getUID());
getSalaryStatisticsDimensionService(user).init(uid);
// 所有人能够看到自己创建的报表,薪酬总管理员能够查看所有报表
List<SalaryStatisticsReportPO> reportList = getSalaryStatisticsReportService(user).listByCreator(uid);
List<Long> reportIds = reportList.stream().map(SalaryStatisticsReportPO::getId).collect(Collectors.toList());
// 获取所有没有撤回没有过期的报表ID不包含过期失效的
List<SalaryStatisticsPushPO> pushList = getSalaryStatisticsPushService(user).getSuccessPushListByReceiver(uid);
List<Long> sharedReportIds = pushList.stream().map(po -> Arrays.asList(StringUtils.split(po.getReportIds(), ",")))
.flatMap(Collection::stream).distinct().map(Long::valueOf).collect(Collectors.toList());
sharedReportIds = sharedReportIds.stream().filter(id -> !reportIds.contains(id)).collect(Collectors.toList());
reportList.addAll(getSalaryStatisticsReportService(user).getByIds(sharedReportIds));
List<SalaryStatisticsReportPO> reportList = getSalaryStatisticsReportService(user).list();
if (StringUtils.isNotEmpty(queryParam.getReportName())) {
reportList = reportList.stream().filter(rp -> rp.getReportName().contains(queryParam.getReportName())).collect(Collectors.toList());
}
List<SalaryStatisticsDimensionPO> salaryStatisticsDimensionList = this.getSalaryStatisticsDimensionService(user).listAll();
Map<String, String> salaryStatisticsDimensionMap = SalaryEntityUtil.convert2Map(salaryStatisticsDimensionList, k -> k.getId().toString(), SalaryStatisticsDimensionPO::getDimName);
List<Map<String, Object>> result = new ArrayList<>();
List<Long> finalSharedReportIds = sharedReportIds;
reportList.forEach(po -> {
Map<String, Object> temp = new HashMap<>();
temp.put("id", po.getId().toString());
@ -120,6 +134,7 @@ public class SalaryStatisticsReportWrapper extends Service {
List<String> dimNames = Arrays.stream(po.getDimension().split(",")).map(dim -> Optional.ofNullable(salaryStatisticsDimensionMap.get(dim)).orElse("")).collect(Collectors.toList());
temp.put("dimension", StringUtils.join(dimNames, ","));
temp.put("dimensionId", po.getDimension());
temp.put("isShare", finalSharedReportIds.contains(po.getId()));
result.add(temp);
});
return result;
@ -252,13 +267,33 @@ public class SalaryStatisticsReportWrapper extends Service {
if (dimension == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在"));
}
// weaTable对象
Map<String, Object> weaTable = new HashMap<>();
// 查询报表配置
SalaryStatisticsReportPO po = this.getSalaryStatisticsReportService(user).getById(id);
if (po == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161845, "薪酬统计报表不存在"));
}
if (param.isShare()) {
// 是被分享的报表
Long uid = Long.valueOf(user.getUID());
// 校验查看权限获取有效的分享记录
List<SalaryStatisticsPushPO> pushList = getSalaryStatisticsPushService(user).shareReportValid(param.getId(), uid);
List<Long> batchIds = pushList.stream().map(SalaryStatisticsPushPO::getId).collect(Collectors.toList());
getSalaryStatisticsPushService(user).updateReportViewStatus(batchIds, uid);
// salaryStatisticsPushService.sendViewedMsg(param.getBatchId(), param.getId(), employeeId, tenantKey);
// 如果是被分享的报表校验分享权限通过后将user赋值为报表创建人
User creator = new User();
creator.setUid(po.getCreator().intValue());
user = creator;
} else {
// 判断报表是否是登陆人创建的,或薪酬总管理员
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth && NumberUtils.compare(po.getCreator().intValue(), user.getUID()) != 0) {
throw new SalaryRunTimeException("无权限查看该报表!");
}
}
// weaTable对象
Map<String, Object> weaTable = new HashMap<>();
// 查询自定义统计项目
List<SalaryStatisticsItemPO> salaryStatisticsItemList = this.getSalaryStatisticsItemService(user).listByStatisticsReportId(po.getId());
@ -324,7 +359,7 @@ public class SalaryStatisticsReportWrapper extends Service {
if (dimension == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在"));
}
sharedReportCheck(param.isShare(), po);
// 参数转换
SalaryStatisticsReportBO.poToQueryParam(param, po);
@ -400,6 +435,8 @@ public class SalaryStatisticsReportWrapper extends Service {
if (dimension == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(161300, "统计维度不存在"));
}
// 校验报表权限如果是被分享报表修改User
sharedReportCheck(param.isShare(), po);
// 查询自定义统计项目中所有薪资项目id
List<SalaryStatisticsItemPO> salaryStatisticsItemPOS = getSalaryStatisticsItemService(user).listByStatisticsReportId(param.getId());
List<Long> salaryItemIds = salaryStatisticsItemPOS.stream().filter(item -> StringUtils.isNotBlank(item.getItemValue())).map(p -> p.getItemValue().split(","))
@ -431,6 +468,30 @@ public class SalaryStatisticsReportWrapper extends Service {
return resultMap;
}
/**
* 权限校验
* @param isShared 是否是被分享的报表
* @param po 报表po
*/
private void sharedReportCheck(boolean isShared, SalaryStatisticsReportPO po) {
if (isShared) {
// 是被分享的报表
Long uid = Long.valueOf(user.getUID());
// 校验分享查看权限
getSalaryStatisticsPushService(user).shareReportValid(po.getId(), uid);
// 如果是被分享的报表校验分享权限通过后将user赋值为报表创建人
User creator = new User();
creator.setUid(po.getCreator().intValue());
user = creator;
} else {
// 判断报表是否是登陆人创建的,或薪酬总管理员
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth && NumberUtils.compare(po.getCreator().intValue(), user.getUID()) != 0) {
throw new SalaryRunTimeException("无权限查看该报表!");
}
}
}
private List<WeaTableColumn> buildDataPerspectiveTableColumns(List<SalaryItemPO> salaryItems) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();

View File

@ -101,4 +101,6 @@ public interface SIArchivesService {
* @param longs
*/
void deleteArchive(Collection<Long> longs);
void handleStayDelData(long currentEmployeeId);
}

View File

@ -1,8 +1,12 @@
package com.engine.salary.service;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.List;
import java.util.Map;
/**
* @Author weaver_cl
* @Description:
@ -25,4 +29,6 @@ public interface SIExportService {
* @return
*/
XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param);
List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list);
}

View File

@ -2,12 +2,11 @@ package com.engine.salary.service;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportActionParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeDetailUpdateParam;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -66,15 +65,15 @@ public interface SISchemeService {
List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, Long employeeId);
Map<String, Object> preview(SISchemaImportParam siSchemaImportParam);
Map<String, Object> preview(SIArchiveImportParam param);
Map<String, Object> batchImportEbatch(SISchemaImportParam param);
Map<String, Object> batchImportEbatch(SIArchiveImportParam param);
XSSFWorkbook exportTemplate(InsuranceArchivesListParam param);
Map<String, Object> checkSIArchiveAdd(SIArchiveImportActionParam siArchiveImportActionParam);
Map<String, Object> checkSIArchiveAdd(SIArchiveImportParam param);
Map<String, Object> addSIArchive(SIArchiveImportActionParam siArchiveImportActionParam);
Map<String, Object> addSIArchive(SIArchiveImportParam param);
/**
* 编辑方案明细表数据

View File

@ -2,6 +2,7 @@ package com.engine.salary.service;
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.engine.salary.service.impl.SalaryItemServiceImpl;
@ -9,6 +10,7 @@ import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -133,5 +135,16 @@ public interface SalaryItemService {
*/
void batchUpdateSortedIndex(List<SalaryItemPO> values);
/**
* 获取薪资项目在哪些账套中使用
* @param salaryItemId
* @return
*/
List<Map<String, Object>> getSalarySobBySalaryItem(Long salaryItemId);
/**
* 将薪资项目管理中的信息同步至账套
* @param syncSalaryItemParam
*/
void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam);
}

View File

@ -126,4 +126,6 @@ public interface SalarySobItemService {
* 薪资项目的详情
*/
SalarySobItemFormDTO getSalaryItemForm(SalarySobItemPO param);
void update(SalarySobItemPO po);
}

View File

@ -174,7 +174,7 @@ public interface TaxAgentService {
*
* @return
*/
List<Map<String, Object>> selectList();
List<Map<String, Object>> selectList(boolean needAuth);
/**
* 获取作为管理员的个税扣缴义务人的下拉列表

View File

@ -38,6 +38,7 @@ import org.springframework.beans.BeanUtils;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import java.io.InputStream;
import java.util.*;
@ -340,7 +341,10 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
Long employeeId = 0L;
String username = (String) map.getOrDefault(SalaryI18nUtil.getI18nLabel(25034, "姓名"), "");
String departmentName = (String) map.getOrDefault(SalaryI18nUtil.getI18nLabel(27511, "部门"), "");
String departmentFullName = (String) map.getOrDefault(SalaryI18nUtil.getI18nLabel(27511, "部门"), "");
String[] split = departmentFullName.split(">");
String departmentName = split[split.length - 1];
String subcompanyName = (String) map.getOrDefault(SalaryI18nUtil.getI18nLabel(33553, "分部"), "");
String companystartdate = (String) map.getOrDefault(SalaryI18nUtil.getI18nLabel(1516, "入职日期"), "");
@ -363,6 +367,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
//校验部门分部
List<SubCompanyInfo> subCompanyInfos = new ArrayList<>();
List<DeptInfo> deptInfos = new ArrayList<>();
List<DeptInfo> targetDeptRange = new ArrayList<>();
if (StringUtils.isNotBlank(subcompanyName)) {
subCompanyInfos = getEmployMapper().getSubCompanyInfosByName(subcompanyName);
if (subCompanyInfos.size() == 0) {
@ -373,7 +378,18 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
}
}
if (StringUtils.isNotBlank(departmentName)) {
deptInfos = getEmployMapper().getDeptInfosByName(departmentName);
List<DeptInfo> toDealDeptInfos = getEmployMapper().getDeptInfosByName(departmentName);
//筛选出匹配导入部门全路径的部门信息
DepartmentComInfo dci = new DepartmentComInfo();
deptInfos = toDealDeptInfos.stream().filter(f -> {
try {
String departmentRealPath = dci.getDepartmentRealPath(f.getId().toString());
return departmentRealPath.contains(departmentFullName);
} catch (Exception e) {
throw new SalaryRunTimeException(e.getMessage());
}
}).collect(Collectors.toList());
if (deptInfos.size() == 0) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
@ -409,7 +425,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
if(subCompanyInfos.size() == 0 && deptInfos.size() > 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "系统中存在重复部门信息,无法指定当前人员关联的唯一部门,请通过填写部门所属的分部信息来缩小部门筛选范围"));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "系统中存在重复部门信息,无法指定当前人员关联的唯一部门,请细化部门上级部门或填写部门所属的分部信息来缩小部门筛选范围"));
excelComments.add(errorMessageMap);
} else if (subCompanyInfos.size() > 1 && deptInfos.size() == 0) {
//部门结果数为0分部结果数大于1则无法匹配
@ -432,7 +448,7 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
} else if (targetDeptInfos.size() > 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "该组数据中的部门和分部信息在系统中出现多组匹配的部门和分组合,无法指定唯一的部门和分部组合"));
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "该组数据中的部门和分部信息在系统中出现多组匹配的部门和分组合,无法指定唯一的部门和分部组合"));
excelComments.add(errorMessageMap);
} else {
targetSubCompanyInfos = subCompanyInfos.stream().filter(f -> f.getId().equals(targetDeptInfos.get(0).getSubcompanyid1())).collect(Collectors.toList());

View File

@ -148,7 +148,11 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar
insuranceExportParam.setBillMonth(queryParam.getBillMonth());
insuranceExportParam.setPaymentOrganization(queryParam.getPaymentOrganization());
insuranceExportParam.setOrderRule(orderRule);
//系统人员核算明细
List<AccountExportPO> accountExportPOS = getInsuranceExportMapper().exportAccount(queryParam.getPaymentStatus(), insuranceExportParam);
//非系统人员核算明细
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(queryParam.getPaymentStatus(), insuranceExportParam);
accountExportPOS.addAll(extAccountExportPOS);
//如果入参包含姓名信息
if (queryParam.getUserName() != null) {
accountExportPOS = accountExportPOS.stream().filter(v -> v.getUserName().contains(queryParam.getUserName())).collect(Collectors.toList());
@ -165,7 +169,11 @@ public class SIAComparisonResultServiceImpl extends Service implements SIACompar
encryptUtil.decryptList(accountExportPOS, AccountExportPO.class);
//2-查询线下对比数据
//系统人员对比数据
List<ExcelAccountExportPO> excelAccountExportPOS = getInsuranceExportMapper().exportExcelAccount(queryParam);
//非系统人员对比数据
List<ExcelAccountExportPO> extExcelAccountExportPOS = getInsuranceExportMapper().exportExtExcelAccount(queryParam);
excelAccountExportPOS.addAll(extExcelAccountExportPOS);
encryptUtil.decryptList(excelAccountExportPOS, ExcelAccountExportPO.class);
//整理线上核算记录相关的福利方案并以此整理需要对比的福利项类别数据

View File

@ -18,6 +18,7 @@ import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAcctDetailImportFieldDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.ExcelInsuranceDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
@ -71,8 +72,10 @@ import com.engine.salary.util.page.Column;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import com.engine.salary.wrapper.SalaryFormulaWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mzlion.core.utils.BeanUtils;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -197,6 +200,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private SalaryFormulaWrapper getSalaryFormulaWrapper(User user) {
return (SalaryFormulaWrapper) ServiceUtil.getService(SalaryFormulaWrapper.class, user);
}
public SIExportService getSIExportService(User user) {
return ServiceUtil.getService(SIExportServiceImpl.class, user);
}
@Override
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long) user.getUID();
@ -346,7 +357,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
//系统人员核算明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统人员核算明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
PageInfo<InsuranceAccountDetailPO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(),queryParam.getPageSize(),
list, InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
@ -412,7 +427,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
//系统人员核算明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统人员核算明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
PageInfo<InsuranceAccountDetailPO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(),queryParam.getPageSize(),
list, InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
@ -469,7 +488,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
queryParam.setOrderRule(orderRule);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
//系统人员核算明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统人员核算明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list, InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
@ -943,32 +966,32 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
InsuranceAccountDetailPO repairSiAcct = siAcctResultWithEmpAndPayStatus.get(item.getEmployeeId() + "_" + PaymentStatusEnum.REPAIR.getValue());
InsuranceAccountDetailPO balanceSiAcct = siAcctResultWithEmpAndPayStatus.get(item.getEmployeeId() + "_" + PaymentStatusEnum.BALANCE.getValue());
//取正常缴纳的福利基数信息
if (StringUtils.isNotEmpty(commonSiAcct.getSocialPaymentBaseString())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialPaymentBaseString())) {
Map<String, Object> socialBaseJson = JSON.parseObject(commonSiAcct.getSocialPaymentBaseString(), new HashMap<String, Object>().getClass());
socialBaseJson.forEach((k, v) -> {
record.put(k + "socialBase", v);
});
}
if (StringUtils.isNotEmpty(commonSiAcct.getFundPaymentBaseString())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundPaymentBaseString())) {
Map<String, Object> fundBaseJson = JSON.parseObject(commonSiAcct.getFundPaymentBaseString(), new HashMap<String, Object>().getClass());
fundBaseJson.forEach((k, v) -> {
record.put(k + "fundBase", v);
});
}
if (StringUtils.isNotEmpty(commonSiAcct.getOtherPaymentBaseString())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getOtherPaymentBaseString())) {
Map<String, Object> otherBaseJson = JSON.parseObject(commonSiAcct.getOtherPaymentBaseString(), new HashMap<String, Object>().getClass());
otherBaseJson.forEach((k, v) -> {
record.put(k + "otherBase", v);
});
}
//社保-正常缴纳
if (StringUtils.isNotEmpty(commonSiAcct.getSocialPerJson())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialPerJson())) {
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getSocialPerJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "socialCommonPer", v);
});
}
if (StringUtils.isNotEmpty(commonSiAcct.getSocialComJson())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialComJson())) {
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getSocialComJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "socialCommonCom", v);
@ -1008,13 +1031,13 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
record.put("socialComBalanceSum", balanceSiAcct != null ? balanceSiAcct.getSocialComSum() : new BigDecimal("0"));
//公积金-正常缴纳
if (StringUtils.isNotEmpty(commonSiAcct.getFundPerJson())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundPerJson())) {
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getFundPerJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "fundCommonPer", v);
});
}
if (StringUtils.isNotEmpty(commonSiAcct.getFundComJson())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundComJson())) {
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getFundComJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "fundCommonCom", v);
@ -1054,13 +1077,13 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
record.put("fundComBalanceSum", balanceSiAcct != null ? balanceSiAcct.getFundComSum() : new BigDecimal("0"));
//其他福利-正常缴纳
if (StringUtils.isNotEmpty(commonSiAcct.getOtherPerJson())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getOtherPerJson())) {
Map<String, Object> otherJson = JSON.parseObject(commonSiAcct.getOtherPerJson(), new HashMap<String, Object>().getClass());
otherJson.forEach((k, v) -> {
record.put(k + "otherCommonPer", v);
});
}
if (StringUtils.isNotEmpty(commonSiAcct.getOtherComJson())) {
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getOtherComJson())) {
Map<String, Object> otherJson = JSON.parseObject(commonSiAcct.getOtherComJson(), new HashMap<String, Object>().getClass());
otherJson.forEach((k, v) -> {
record.put(k + "otherCommonCom", v);
@ -1463,7 +1486,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
@Override
public XSSFWorkbook exportImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
ValidUtil.doValidator(param);
Long employeeId = (long) user.getUID();
// 必须选择导入模板所需的薪资项目(福利项)
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
@ -1476,18 +1499,52 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
SalaryI18nUtil.getI18nLabel(86317, "工号"),
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
"账单月份");
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth");
// List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth");
List<String> dataIndexList = Lists.newArrayList("userName", "department", "mobile", "workcode", "socialPayOrg", "billMonth");
// 查询福利核算项目
List<String> welfareNames = (List<String>) param.getWelfareNames();
headerList.addAll(welfareNames);
//匹配welfareName对应的id
List<InsuranceAcctDetailImportFieldDTO> welfareList = getSalaryFormulaWrapper(user).welfareList();
Map<String, String> welfareNameMap = welfareList.stream().collect(Collectors.toMap(InsuranceAcctDetailImportFieldDTO::getSalaryItemName, InsuranceAcctDetailImportFieldDTO::getFieldId, (key1, key2) -> key2));
welfareNames.forEach(f -> {
if (StringUtils.isNotBlank(welfareNameMap.get(f))) {
dataIndexList.add(welfareNameMap.get(f));
}
});
// excel导出的数据
// //查询当前已有的正常缴纳数据
// List<Map<String, Object>> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
// // excel导出的数据
// List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
// rows.add(headerList);
// for (Map<String, Object> map : resultMapList) {
// List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
// for (String dataIndex : dataIndexList) {
// row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
// }
// rows.add(row);
// }
InsuranceExportParam exportParam = new InsuranceExportParam();
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
exportParam.setOrderRule(orderRule);
exportParam.setBillMonth(param.getBillMonth());
exportParam.setPaymentOrganization(param.getPaymentOrganization().toString());
List<AccountExportPO> accountExportPOS = new ArrayList<>();
accountExportPOS = getInsuranceExportMapper().exportAccount(PaymentStatusEnum.COMMON.getValue(), exportParam);
//非系统人员核算明细
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(PaymentStatusEnum.COMMON.getValue(), exportParam);
accountExportPOS.addAll(extAccountExportPOS);
encryptUtil.decryptList(accountExportPOS, AccountExportPO.class);
// 数据组装
List<Map<String, Object>> records = getSIExportService(user).buildCommonRecords(accountExportPOS);
// excel导出的数据
//查询当前已有的正常缴纳数据
List<Map<String, Object>> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
// excel导出的数据
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(records.size());
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
for (Map<String, Object> map : records) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
for (String dataIndex : dataIndexList) {
row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
@ -1524,7 +1581,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
// Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
// 获取租户下所有的人员
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG);
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
// 失败的数量
int failCount = 0;
@ -2282,7 +2339,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
// 获取租户下所有的人员
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG);
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
// 失败的数量
int failCount = 0;
@ -3235,7 +3292,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
//系统人员核算明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统人员核算明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(list, employeeId);
@ -3270,7 +3331,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
queryParam.setOrderRule(orderRule);
//系统人员核算明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统人员核算明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(list, employeeId);
@ -3305,7 +3370,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
queryParam.setOrderRule(orderRule);
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
//系统人员核算明细
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
//非系统人员核算明细
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
list.addAll(extList);
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
//数据组装
List<Map<String, Object>> records = getService(user).buildCommonRecords(list, employeeId);
@ -3343,7 +3412,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
value = value.add(addValue);
}
sumRow.put(numKey,value);
// sumRow.put(numKey,value);
sumRow.put(numKey,String.format("%.2f", value));
}
return sumRow;
}

View File

@ -209,8 +209,9 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
* 福利档案中待减员数据自动处理
* @param currentEmployeeId
*/
@Override
@Transactional(rollbackFor = Exception.class)
private void handleStayDelData(long currentEmployeeId) {
public void handleStayDelData(long currentEmployeeId) {
log.info("福利档案中待减员数据自动处理逻辑开始:");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
String today = simpleDateFormat.format(new Date());
@ -659,7 +660,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
//获取所有福利档案基础信息
List<InsuranceArchivesBaseInfoPO> archiveListDTOS = getInsuranceBaseInfoMapper().listAll();
list = archiveListDTOS.stream().filter(dto -> taxAgentIds.contains(dto.getPaymentOrganization()) && !Objects.equals(dto.getEmployeeType(), 1)).collect(Collectors.toList());
list = archiveListDTOS.stream().filter(dto -> taxAgentIds.contains(dto.getPaymentOrganization())).collect(Collectors.toList());
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId);
//不是管理员看不到数据返回空
@ -668,7 +669,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
}
} else {
list = getInsuranceBaseInfoMapper().listAll().stream().filter(dto -> !Objects.equals(dto.getEmployeeType(), 1)).collect(Collectors.toList());;
list = getInsuranceBaseInfoMapper().listAll();
}
@ -676,24 +677,32 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
long payTotal = 0L;
long stayDelTotal = 0L;
long stopTotal = 0L;
long extTotal = 0L;
for (InsuranceArchivesBaseInfoPO baseInfoPO : list) {
if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())) {
stayAddTotal += 1;
} else if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())) {
payTotal += 1;
if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())) {
stayDelTotal += 1;
Integer employeeType = baseInfoPO.getEmployeeType();
if (employeeType == null || employeeType == 0) {
if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_ADD.getValue())) {
stayAddTotal += 1;
} else if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())) {
payTotal += 1;
if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())) {
stayDelTotal += 1;
}
} else if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_ADD.getValue()) || baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue())) {
stopTotal += 1;
}
} else if (baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_ADD.getValue()) || baseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue())) {
stopTotal += 1;
} else {
extTotal += 1;
}
}
result.put("stayAdd", stayAddTotal);
result.put("paying", payTotal);
result.put("stayDel", stayDelTotal);
result.put("stopPay", stopTotal);
result.put("ext", extTotal);
return result;
}

View File

@ -17,6 +17,7 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siaccount.po.InsuranceCompensationConfigPO;
import com.engine.salary.entity.siaccount.po.InsuranceCompensationPO;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
@ -25,10 +26,7 @@ import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siaccount.InsuranceCompensationConfigMapper;
import com.engine.salary.mapper.siaccount.InsuranceCompensationMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.service.ColumnBuildService;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.SICategoryService;
import com.engine.salary.service.SICompensationService;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -84,6 +82,9 @@ public class SICompensationServiceImpl extends Service implements SICompensation
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
/**
* 可调差人员
*/
@ -104,6 +105,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation
partition.forEach(p -> {
param.setIds(p);
resultData.addAll(getEmployMapper().listHrmInfoByIdAndName(param));
resultData.addAll(getEmployMapper().listExtHrmInfoByIdAndName(param));
});
}
@ -199,20 +201,21 @@ public class SICompensationServiceImpl extends Service implements SICompensation
} else {
encryptUtil.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
//判断是否已有调差数据个税扣缴义务人+账单月份+人员id
InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder()
.billMonth(insuranceAccountDetailPO.getBillMonth())
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
.employeeId(insuranceAccountDetailPO.getEmployeeId())
.build());
if (nowCompensation != null) {
temp.put("error", SalaryI18nUtil.getI18nLabel(121039, "当前月在该缴纳组织下已存在调差数据"));
}
// InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder()
// .billMonth(insuranceAccountDetailPO.getBillMonth())
// .paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
// .employeeId(insuranceAccountDetailPO.getEmployeeId())
// .build());
//
// if (nowCompensation != null) {
// temp.put("error", SalaryI18nUtil.getI18nLabel(121039, "当前月在该缴纳组织下已存在调差数据"));
// }
//处理调差数据
BigDecimal total = new BigDecimal("0");
List<String> categoryTypeList = Arrays.asList(compensation.getCategoryType().split(","));
if (nowCompensation == null && StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) {
if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap<String, String>().getClass());
for (Map.Entry<String, String> entry : socialJson.entrySet()) {
String insuranceId = entry.getKey();
@ -271,7 +274,8 @@ public class SICompensationServiceImpl extends Service implements SICompensation
public Map<String, Object> compensationAccount(List<InsuranceCompensationDTO> list) {
long currentEmployeeId = user.getUID();
List<DataCollectionEmployee> allEmployees = getEmployMapper().listAll();
// List<DataCollectionEmployee> allEmployees = getEmployMapper().listAll();
List<DataCollectionEmployee> allEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
Map<Long, String> usernameMap = SalaryEntityUtil.convert2Map(allEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername);
Map<String, Object> result = new HashMap<>();
@ -280,9 +284,49 @@ public class SICompensationServiceImpl extends Service implements SICompensation
//过滤
list = list.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(InsuranceCompensationDTO::getTarget))), ArrayList::new));
new TreeSet<>(Comparator.comparing((o -> o.getTarget() + ";" + o.getAdjustTo() + ";" + o.getCategoryType())))), ArrayList::new));
//根据target分组
Map<Long, List<InsuranceCompensationDTO>> compensationGroupInfoMap= list.stream().collect(Collectors.groupingBy(InsuranceCompensationDTO::getTarget));
//取福利项id和name的关联map
List<ICategoryPO> socialWelfareList = getICategoryMapper().listAll().stream().filter(e -> e.getWelfareType() == 1).collect(Collectors.toList());
Map<Long, String> welfareNameMap = socialWelfareList.stream().collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName, (key1, key2) -> key2));
for (InsuranceCompensationDTO param : list) {
//判断统计调差福利类型即categoryType中是否存在同保存批次重复福利项
List<InsuranceCompensationDTO> waitJudgeCompensations = compensationGroupInfoMap.get(param.getTarget()).stream().
filter(f -> !f.getTarget().equals(param.getTarget()) && !f.getAdjustTo().equals(param.getAdjustTo()) && !f.getCategoryType().equals(param.getCategoryType())).collect(Collectors.toList());
if (waitJudgeCompensations.size() > 0) {
boolean judgeResult = true;
for (InsuranceCompensationDTO judgeParam : waitJudgeCompensations) {
List<String> toDealWelfareTypeList = Arrays.asList(param.getCategoryType().split(","));
List<String> toJudgeWelfareTypeList = Arrays.asList(judgeParam.getCategoryType().split(","));
// toDealWelfareTypeList.retainAll(toJudgeWelfareTypeList);
List<String> intersectionList = (List<String>) SalaryEntityUtil.intersectionForList(toDealWelfareTypeList, toJudgeWelfareTypeList);
if (intersectionList.size() > 0) {
StringBuilder toDealWelfareNames = new StringBuilder();
StringBuilder sameWelfareNames = new StringBuilder();
for(String str : toDealWelfareTypeList) {
if (welfareNameMap.get(Long.valueOf(str)) != null) {
toDealWelfareNames.append(welfareNameMap.get(Long.valueOf(str))).append("");
}
}
for(String str : intersectionList) {
if (welfareNameMap.get(Long.valueOf(str)) != null) {
sameWelfareNames.append(welfareNameMap.get(Long.valueOf(str))).append("");
}
}
errorList.add(usernameMap.get(param.getEmployeeId()) + "-" + toDealWelfareNames.deleteCharAt(toDealWelfareNames.length() - 1)
+ "-调差失败:提交数据中,统计调差福利类型有重合部分!" + "重合福利部分为:" + sameWelfareNames.deleteCharAt(sameWelfareNames.length() - 1));
judgeResult = false;
break;
}
}
if (!judgeResult) {
continue;
}
}
if (StringUtils.isBlank(param.getAdjustmentTotal()) || "0".equals(param.getAdjustmentTotal()) || "0.00".equals(param.getAdjustmentTotal())) {
errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差数额不正确!");
continue;
@ -291,23 +335,68 @@ public class SICompensationServiceImpl extends Service implements SICompensation
errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败公司核算金额为0请检查数据是否属实或者当前人员已存在该月调差数据");
continue;
}
if (param.getAdjustTo() == null) {
errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差到的福利未设置!");
continue;
}
InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(param.getTarget());
if (insuranceAccountDetailPO == null) {
errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差对象不存在!");
continue;
}
if (!param.getCategoryType().contains(param.getAdjustTo().toString())) {
errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差到的福利未正确设置!");
continue;
}
//判断是否已有调差数据个税扣缴义务人+账单月份+人员id
InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder()
// InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder()
// .billMonth(insuranceAccountDetailPO.getBillMonth())
// .paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
// .employeeId(insuranceAccountDetailPO.getEmployeeId())
// .build());
// if (nowCompensation != null) {
// errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差对象在当前月该缴纳组织下已存在调差数据!");
// continue;
// }
List<InsuranceCompensationPO> nowCompensationList = getInsuranceCompensationMapper().getListByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder()
.billMonth(insuranceAccountDetailPO.getBillMonth())
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
.employeeId(insuranceAccountDetailPO.getEmployeeId())
.build());
if (nowCompensation != null) {
errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差对象在当前月该缴纳组织下已存在调差数据!");
continue;
if (nowCompensationList.size() > 0) {
boolean judgeResult = true;
for (InsuranceCompensationPO judgePO : nowCompensationList) {
List<String> toDealWelfareTypeList = Arrays.asList(param.getCategoryType().split(","));
List<String> toJudgeWelfareTypeList = Arrays.asList(judgePO.getCategoryType().split(","));
List<String> intersectionList = (List<String>) SalaryEntityUtil.intersectionForList(toDealWelfareTypeList, toJudgeWelfareTypeList);
if (intersectionList.size() > 0) {
StringBuilder toDealWelfareNames = new StringBuilder();
StringBuilder sameWelfareNames = new StringBuilder();
for(String str : toDealWelfareTypeList) {
if (welfareNameMap.get(Long.valueOf(str)) != null) {
toDealWelfareNames.append(welfareNameMap.get(Long.valueOf(str))).append("");
}
}
for(String str : intersectionList) {
if (welfareNameMap.get(Long.valueOf(str)) != null) {
sameWelfareNames.append(welfareNameMap.get(Long.valueOf(str))).append("");
}
}
errorList.add(usernameMap.get(param.getEmployeeId()) + "-" + toDealWelfareNames.deleteCharAt(toDealWelfareNames.length() - 1)
+ "-调差失败:相同福利不可以多次调差!" + "相同部分为:" + sameWelfareNames.deleteCharAt(sameWelfareNames.length() - 1));
judgeResult = false;
break;
}
}
if (!judgeResult) {
continue;
}
}
encryptUtil.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap<String, String>().getClass());
@ -372,7 +461,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation
if (errorList.size() == 0) {
result.put("data", "全部调差成功!");
} else {
result.put("data", "存在调差失败项!");
result.put("data", "存在调差失败项!" + "失败数量为:" + errorList.size() + "。具体有以下:");
}
result.put("errorMessage", errorList);
result.put("successIds", idList);

View File

@ -158,6 +158,9 @@ public class SIExportServiceImpl extends Service implements SIExportService {
List<AccountExportPO> accountExportPOS = new ArrayList<>();
if (paymentStatus.equals(PaymentStatusEnum.RECESSION.getValue())) {
accountExportPOS = getInsuranceExportMapper().exportRecessionAccount(paymentStatus, param);
//非系统人员核算明细
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(paymentStatus, param);
accountExportPOS.addAll(extAccountExportPOS);
// 分权逻辑
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
@ -174,6 +177,9 @@ public class SIExportServiceImpl extends Service implements SIExportService {
}
} else {
accountExportPOS = getInsuranceExportMapper().exportAccount(paymentStatus, param);
//非系统人员核算明细
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(paymentStatus, param);
accountExportPOS.addAll(extAccountExportPOS);
}
// //过滤出福利档案基础信息表中runStatus为正在缴纳和待减员的人员
@ -201,7 +207,7 @@ public class SIExportServiceImpl extends Service implements SIExportService {
records = buildCommonRecords(accountExportPOS);
List<List<Object>> excelSheetData = new ArrayList<>();
//工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案");
String sheetName = SalaryI18nUtil.getI18nLabel(0, "社保福利台账");
excelSheetData.add(Arrays.asList(columns.stream().map(WeaTableColumn::getText).toArray(String[]::new)));
//合计
boolean total = false;
@ -239,8 +245,8 @@ public class SIExportServiceImpl extends Service implements SIExportService {
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName, total);
}
private List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
@Override
public List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
List<Map<String, Object>> result = new ArrayList<>();
List<TaxAgentPO> paymentList = getTaxAgentMapper().listAll();

View File

@ -14,19 +14,21 @@ import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportActionParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeDetailUpdateParam;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
@ -39,10 +41,7 @@ import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIImportService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.*;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.service.SalarySysConfService;
@ -146,6 +145,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
public TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeGetFormCmd(params, user));
@ -194,11 +197,16 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
@Override
public PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam queryParam) {
SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
queryParam.setWelfareType(queryParam.getWelfareTypeEnum().getValue());
if (queryParam.getPaymentTypeEnum() != null) {
queryParam.setPaymentType(queryParam.getPaymentTypeEnum().getValue());
}
Long currentEmployeeId = (long) user.getUID();
List<InsuranceSchemePO> insuranceSchemePOS;
Boolean needAuth = getTaxAgentService().isNeedAuth(currentEmployeeId);
if (needAuth) {
insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
// insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
insuranceSchemePOS = getInsuranceSchemeMapper().list(queryParam);
Boolean isAdminEnable = getTaxAgentService().isAdminEnable((long) user.getUID());
if (isAdminEnable) {
//管理员
@ -217,7 +225,8 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceSchemePOS = new ArrayList<>();
}
} else {
insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
// insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
insuranceSchemePOS = getInsuranceSchemeMapper().list(queryParam);
}
PageInfo<InsuranceSchemeListDTO> dtoPage = new PageInfo<>(InsuranceSchemeListDTO.class);
@ -608,7 +617,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
* 导入的数据插入到数据库中
*/
@Override
public Map<String, Object> preview(SISchemaImportParam param) {
public Map<String, Object> preview(SIArchiveImportParam param) {
ValidUtil.doValidator(param);
InputStream fileInputStream = null;
try {
@ -626,15 +635,16 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
/**
* 导入的数据插入到数据库中
*/
public Map<String, Object> batchImportEbatch(SISchemaImportParam param) {
public Map<String, Object> batchImportEbatch(SIArchiveImportParam param) {
ValidUtil.doValidator(param);
param.setProcess(false);
if (StringUtils.isBlank(param.getRunStatus())) {
throw new SalaryRunTimeException("福利档案执行状态未在导入条件设置中添加!");
}
// List<ExcelSheet> excelSheets = message.getBatchFile().getExcelSheets();
// 租户key
// String tenantKey = message.getTenantKey().toLowerCase();
// String tenantKey = message.getTenantKey().toLowerCase();EditSIArchiveAction
//操作员id
Long creator = (long) user.getUID();
//获取所有福利类型的id-name结合
@ -699,7 +709,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
singleAccount.add(cellData);
}
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree, param.getRunStatus());
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree, param);
if (isError) {
errorCount += 1;
// 添加错误数据
@ -716,7 +726,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
// }
// 数据入库处理
handleImportData(insuranceArchivesAccountPOS);
handleImportData(insuranceArchivesAccountPOS, param);
// 发送导入回调信息
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);
@ -755,8 +765,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
return userState;
}
public boolean singleAccountCheck(List<Map<String, Object>> singleAccount, Map<Long, String> welfareMap, List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS, List<DataCollectionEmployee> employeeByIds, List<Map<String, String>> excelComments, int i, Map<String, Long> schemeNameIdMap, Map<String, Long> paymentNameIdMap, Long creator, int index, Boolean openDevolution, List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeTree, String runStatus) {
public boolean singleAccountCheck(List<Map<String, Object>> singleAccount, Map<Long, String> welfareMap,
List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS, List<DataCollectionEmployee> employeeByIds,
List<Map<String, String>> excelComments, int i, Map<String, Long> schemeNameIdMap,
Map<String, Long> paymentNameIdMap, Long creator, int index, Boolean openDevolution,
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeTree, SIArchiveImportParam param) {
boolean isError = false;
String runStatus = param.getRunStatus();
// String userName = (String) singleAccount.get(0).get(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
// String deparmentName = (String) singleAccount.get(1).get(SalaryI18nUtil.getI18nLabel(86185, "部门"));
// String mobile = (String) singleAccount.get(2).get(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
@ -878,27 +894,33 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
isError = true;
}
if (openDevolution && !isError) {
if (!isError) {
Long paymentOrgId = paymentNameIdMap.get(paymentOrg);
TaxAgentManageRangeEmployeeDTO taxAgentManageRangeEmployeeDTO = taxAgentManageRangeEmployeeTree.stream().filter(tax -> tax.getTaxAgentId().equals(paymentOrgId)).findFirst().get();
Optional<Long> o = taxAgentManageRangeEmployeeDTO.getEmployeeList().stream().map(TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee::getEmployeeId).filter(e -> e.equals(employeeId)).findFirst();
if (!o.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据不在个税扣缴义务人人员范围内,不可导入"));
excelComments.add(errorMessageMap);
isError = true;
if (param.isProcess()) {
//流程中自动将人员添加进个税扣缴义务人中
TaxAgentManageRangeSaveParam.TaxAgentSubAdminRangeTargetParam taxAgentSubAdminRangeTargetParam = new TaxAgentManageRangeSaveParam.TaxAgentSubAdminRangeTargetParam();
taxAgentSubAdminRangeTargetParam.setTargetId(employeeId);
taxAgentSubAdminRangeTargetParam.setTargetType(TargetTypeEnum.EMPLOYEE);
TaxAgentRangeSaveParam taxAgentRangeSaveParam = new TaxAgentRangeSaveParam();
taxAgentRangeSaveParam.setTaxAgentId(paymentOrgId);
taxAgentRangeSaveParam.setIncludeType(1);
taxAgentRangeSaveParam.setEmployeeStatus(Arrays.asList("0", "1", "2", "3", "4", "5", "6"));
taxAgentRangeSaveParam.setTargetParams(Collections.singletonList(taxAgentSubAdminRangeTargetParam));
taxAgentRangeSaveParam.setSync(true);
param.setTaxAgentRanges(Collections.singletonList(taxAgentRangeSaveParam));
} else {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据不在个税扣缴义务人人员范围内,不可导入"));
excelComments.add(errorMessageMap);
isError = true;
}
}
// //判断是否存在其他个税扣缴义务人下的该员工福利档案
// // 所有福利档案基础信息数据
// List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
// List<InsuranceArchivesBaseInfoPO> otherTaxBaseInfos = baseInfoPOList.stream().filter(f -> f.getEmployeeId().equals(employeeId) && !f.getPaymentOrganization().equals(paymentOrgId)).collect(Collectors.toList());
// if (otherTaxBaseInfos.size() > 0) {
// Map<String, String> errorMessageMap = Maps.newHashMap();
// errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据相关人员已存在其他个税扣缴义务人下的福利档案,不可导入"));
// excelComments.add(errorMessageMap);
// isError = true;
// }
}
@ -1044,7 +1066,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
}
}
//生成福利档案基础信息数据
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = buildBaseInfoPO(employeeId, singleAccount, paymentNameIdMap, creator, runStatus);
InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO = buildBaseInfoPO(employeeId, singleAccount, paymentNameIdMap, creator, runStatus, employees.get(0).isExtEmp());
if (!isError) {
insuranceArchivesAccountPO.setSocial(insuranceArchivesSocialSchemePO);
insuranceArchivesAccountPO.setFund(insuranceArchivesFundSchemePO);
@ -1127,13 +1149,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesSocialSchemePO.setSocialSchemeId(socialSchemeId);
}
String socialStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
if (StringUtils.isNotBlank(socialStartDate) && socialStartDate.length() > 7) {
if (StringUtils.isNotBlank(socialStartDate) && socialStartDate.length() >= 7) {
socialStartDate = socialStartDate.substring(0, 7);
insuranceArchivesSocialSchemePO.setSocialStartTime(socialStartDate);
}
String socialEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
if (StringUtils.isNotBlank(socialEndDate) && socialEndDate.length() > 7) {
if (StringUtils.isNotBlank(socialEndDate) && socialEndDate.length() >= 7) {
socialEndDate = socialEndDate.substring(0, 7);
insuranceArchivesSocialSchemePO.setSocialEndTime(socialEndDate);
}
@ -1215,13 +1237,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesFundSchemePO.setSupplementFundAccount(supplementFundAccount);
}
String fundStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
if (StringUtils.isNotBlank(fundStartDate) && fundStartDate.length() > 7) {
if (StringUtils.isNotBlank(fundStartDate) && fundStartDate.length() >= 7) {
fundStartDate = fundStartDate.substring(0, 7);
insuranceArchivesFundSchemePO.setFundStartTime(fundStartDate);
}
String fundEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
if (StringUtils.isNotBlank(fundEndDate) && fundEndDate.length() > 7) {
if (StringUtils.isNotBlank(fundEndDate) && fundEndDate.length() >= 7) {
fundEndDate = fundEndDate.substring(0, 7);
insuranceArchivesFundSchemePO.setFundEndTime(fundEndDate);
}
@ -1291,13 +1313,13 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesOtherSchemePO.setOtherSchemeId(otherSchemeId);
}
String otherStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
if (StringUtils.isNotBlank(otherStartDate) && otherStartDate.length() > 7) {
if (StringUtils.isNotBlank(otherStartDate) && otherStartDate.length() >= 7) {
otherStartDate = otherStartDate.substring(0, 7);
insuranceArchivesOtherSchemePO.setOtherStartTime(otherStartDate);
}
String otherEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
if (StringUtils.isNotBlank(otherEndDate) && otherEndDate.length() > 7) {
if (StringUtils.isNotBlank(otherEndDate) && otherEndDate.length() >= 7) {
otherEndDate = otherEndDate.substring(0, 7);
insuranceArchivesOtherSchemePO.setOtherEndTime(otherEndDate);
}
@ -1332,7 +1354,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
return insuranceArchivesOtherSchemePO;
}
public InsuranceArchivesBaseInfoPO buildBaseInfoPO(Long employeeId, List<Map<String, Object>> singleAccount, Map<String, Long> paymentNameIdMap, Long creator, String runStatus) {
public InsuranceArchivesBaseInfoPO buildBaseInfoPO(Long employeeId, List<Map<String, Object>> singleAccount, Map<String, Long> paymentNameIdMap, Long creator, String runStatus, Boolean isExtEmp) {
if (employeeId == null) {
return null;
}
@ -1346,11 +1368,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
insuranceArchivesBaseInfoPO.setUpdateTime(new Date());
insuranceArchivesBaseInfoPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceArchivesBaseInfoPO.setPaymentOrganization(paymentNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91497, "个税扣缴义务人")).get(SalaryI18nUtil.getI18nLabel(91497, "个税扣缴义务人"))));
if (isExtEmp) {
insuranceArchivesBaseInfoPO.setEmployeeType(1);
}
return insuranceArchivesBaseInfoPO;
}
public void handleImportData(List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS) {
public void handleImportData(List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS, SIArchiveImportParam param) {
//导入社保档案
List<InsuranceArchivesSocialSchemePO> socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(socialSchemePOS)) {
@ -1430,6 +1455,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
List<List<InsuranceArchivesBaseInfoPO>> partition = Lists.partition(newInsuranceArchivesBaseInfoList, 100);
partition.forEach(getInsuranceBaseInfoMapper()::batchSave);
}
//新增人员范围会自动生成人员档案
if (CollectionUtils.isNotEmpty(param.getTaxAgentRanges())) {
param.getTaxAgentRanges().forEach(getTaxAgentManageRangeService(user)::save);
}
}
@ -1456,31 +1485,26 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
/**
* 校验待新增的社保福利档案数据
*
* @param siArchiveImportActionParam
* @return
*/
@Override
public Map<String, Object> checkSIArchiveAdd(SIArchiveImportActionParam siArchiveImportActionParam) {
siArchiveImportActionParam.setAddData(false);
return processAddSIArchive(siArchiveImportActionParam);
public Map<String, Object> checkSIArchiveAdd(SIArchiveImportParam param) {
param.setAddData(false);
return processAddSIArchive(param);
}
/**
* 新增社保福利档案
*
* @param siArchiveImportActionParam
* @return
*/
@Override
public Map<String, Object> addSIArchive(SIArchiveImportActionParam siArchiveImportActionParam) {
siArchiveImportActionParam.setAddData(true);
return processAddSIArchive(siArchiveImportActionParam);
public Map<String, Object> addSIArchive(SIArchiveImportParam param) {
param.setAddData(true);
return processAddSIArchive(param);
}
private Map<String, Object> processAddSIArchive(SIArchiveImportActionParam param) {
private Map<String, Object> processAddSIArchive(SIArchiveImportParam param) {
ValidUtil.doValidator(param);
param.setProcess(true);
if (StringUtils.isBlank(param.getRunStatus())) {
throw new SalaryRunTimeException("福利档案执行状态未在导入条件设置中添加!");
@ -1563,7 +1587,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
singleAccount.add(cellData);
}
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree, param.getRunStatus());
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree, param);
if (isError) {
errorCount += 1;
// 添加错误数据
@ -1581,7 +1605,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
// 数据入库处理
if (param.isAddData()) {
handleImportData(insuranceArchivesAccountPOS);
handleImportData(insuranceArchivesAccountPOS, param);
}
// 发送导入回调信息
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);

View File

@ -54,6 +54,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -61,6 +62,7 @@ import weaver.file.ImageFileManager;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -330,6 +332,11 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (openSum != null && StringUtils.isNotBlank(openSum.getConfValue()) && OpenEnum.parseByValue(openSum.getConfValue()) == OpenEnum.OPEN) {
total = true;
Map<String, Object> sumRow = getSalaryAcctResultService(user).sumRow(queryParam);
sumRow.forEach((k,v) -> {
if (NumberUtils.isCreatable(v.toString())) {
sumRow.put(k,new BigDecimal(v.toString()));
}
});
if(sumRow !=null){
sumRow.put("taxAgentName", "总计");
resultMapList.add(sumRow);
@ -337,19 +344,26 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
}
// excel导出的数据
String DATA_TYPE_SUFFIX = "_type";
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
for (Map<String, Object> map : resultMapList) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerColumnGroup.size());
for (WeaTableColumnGroup weaTableColumn : headerColumnGroup) {
row.add(map.getOrDefault(weaTableColumn.getColumn(), StringUtils.EMPTY));
String fieldType = (String) map.getOrDefault(weaTableColumn.getColumn().toString() + DATA_TYPE_SUFFIX, StringUtils.EMPTY);
if (StringUtils.equals("number", fieldType)) {
row.add(new BigDecimal(StringUtils.isBlank(map.get(weaTableColumn.getColumn()).toString()) ? "0" :map.get(weaTableColumn.getColumn()).toString()));
} else {
row.add(map.getOrDefault(weaTableColumn.getColumn(), StringUtils.EMPTY));
}
}
rows.add(row);
}
String sheetName = "薪资核算结果";
// return ExcelUtil.genWorkbookV2(rows, sheetName, total);
return ExcelUtilPlus.genWorkbookWithChildTitleColumn(rows, sheetName, total);
return ExcelUtilPlus.genWorkbookWithChildTitleColumnWithExcelFormat(rows, sheetName, total);
}

View File

@ -14,6 +14,7 @@ import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
@ -86,6 +87,10 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
private SalarySobRangeService getSalarySobRangeService(User user) {
return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
}
public SalarySysConfService getSalarySysConfService(User user) {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
@ -582,10 +587,6 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
// 错误sheet数据
List<Map<String, Object>> errorData = new ArrayList<>();
// 获取匹配规则
SalarySysConfPO salarySysConfPO = getSalarySysConfService(user).getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
for (int i = 0; i < data.size(); i++) {
Map<String, Object> map = data.get(i);
@ -820,7 +821,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
List<SalaryArchiveItemPO> salaryArchiveItemSaves = importHandleParam.getSalaryArchiveItemSaves();
List<Long> salaryArchiveItemDelSalaryItemIds = importHandleParam.getSalaryArchiveItemDelSalaryItemIds();
List<TaxAgentRangeSaveParam> taxAgentRanges = importHandleParam.getTaxAgentRanges();
// List<SalaryArchiveSobPO> salaryArchiveSobSaves = importHandleParam.getSalaryArchiveSobSaves();
List<SalarySobRangeSaveParam> salaryArchiveSobSaves = importHandleParam.getSalaryArchiveSobSaves();
// 新增薪资档案
@ -859,5 +860,9 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
if (CollectionUtils.isNotEmpty(taxAgentRanges)) {
taxAgentRanges.forEach(getTaxAgentManageRangeService(user)::save);
}
if (CollectionUtils.isNotEmpty(salaryArchiveSobSaves)) {
salaryArchiveSobSaves.forEach(getSalarySobRangeService(user)::save);
}
}
}

View File

@ -10,10 +10,12 @@ import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
@ -24,11 +26,13 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.hrm.User;
@ -69,6 +73,10 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
return ServiceUtil.getService(SalarySobBackItemServiceImpl.class, user);
}
public SalarySobService getSalarySobService(User user) {
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
}
private SysSalaryItemBiz sysSalaryItemBiz = new SysSalaryItemBiz();
//
@ -391,6 +399,43 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
salaryItemBiz.batchUpdateSortedIndex(values);
}
@Override
public List<Map<String, Object>> getSalarySobBySalaryItem(Long salaryItemId) {
// 查询所有启用的薪资账套
List<SalarySobItemPO> salarySobItemList = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(salaryItemId));
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobItemList, SalarySobItemPO::getSalarySobId);
List<SalarySobPO> salarySobs = getSalarySobService(user).listByIds(salarySobIds);
return salarySobs.stream().map(m -> {
Map<String, Object> map = new HashMap<>();
map.put("id", String.valueOf(m.getId()));
map.put("content", m.getName());
return map;
}).collect(Collectors.toList());
}
@Override
public void syncSalaryItemToSalarySobItem(SyncSalaryItemParam param) {
ValidUtil.doValidator(param);
// 获取薪资项目信息
SalaryItemPO salaryItemPO = salaryItemBiz.getById(param.getSalaryItemId());
if (ObjectUtils.isEmpty(salaryItemPO)) {
throw new SalaryRunTimeException("薪资项目不存在或已被删除");
}
// 获取薪资账套中薪资项目信息
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(param.getSalaryItemId()));
salarySobItemPOS = salarySobItemPOS.stream().filter( po -> param.getSalarySobIds().contains(po.getSalarySobId())).collect(Collectors.toList());
// 更新薪资账套中的薪资项目信息
Date now = new Date();
for (SalarySobItemPO sobItem : salarySobItemPOS) {
sobItem.setFormulaId(salaryItemPO.getFormulaId());
sobItem.setRoundingMode(salaryItemPO.getRoundingMode());
sobItem.setPattern(salaryItemPO.getPattern());
sobItem.setValueType(salaryItemPO.getValueType());
sobItem.setDescription(salaryItemPO.getDescription());
sobItem.setUpdateTime(now);
getSalarySobItemService(user).update(sobItem);
}
}
@Data
@Builder

View File

@ -613,7 +613,13 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
map.put("salaryAcctResult", salaryAcctResultS);
// 工资单发送人是否已确认
if (NumberUtils.compare(salaryTemplate.getAckFeedbackStatus(),1) == 0) {
map.put("confirmStatus", salarySendInfo.getBillConfirmStatus() == null ? "0" : salarySendInfo.getBillConfirmStatus().toString());
// 反馈后还可以确认或反馈按钮确认后2个按钮消失
Integer confirmStatus = salarySendInfo.getBillConfirmStatus();
if (confirmStatus == null || confirmStatus != BillConfimStatusEnum.CONFIRMED.getValue()) {
map.put("confirmStatus", "0");
} else {
map.put("confirmStatus", "1");
}
map.put("sendEmployeeId", salarySendInfo.getSendEmployeeId());
}else{
map.put("confirmStatus", "1");

View File

@ -731,6 +731,11 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
salarySobItemMapper.deleteItemShowBySalarySobId(salarySobIds);
}
@Override
public void update(SalarySobItemPO po) {
salarySobItemMapper.update(po);
}
@Override
public SalarySobItemFormDTO getSalaryItemForm(SalarySobItemPO param) {
SalarySobItemFormDTO salarySobItemFormDTO = new SalarySobItemFormDTO();

View File

@ -485,10 +485,10 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
// //生成档案
getSalaryArchiveService(user).handleChangeData(1L);
// //生成社保福利档案
// String welSign = (String) Util_DataCache.getObjVal("welfareChangeSign");
// if (welSign == null || "0".equals(welSign)) {
// getSIArchivesService(user).handleChangeData(1L);
// }
String welSign = (String) Util_DataCache.getObjVal("welfareChangeSign");
if (welSign == null || "0".equals(welSign)) {
getSIArchivesService(user).handleChangeData(1L);
}
}

View File

@ -551,9 +551,11 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
}
@Override
public List<Map<String, Object>> selectList() {
public List<Map<String, Object>> selectList(boolean needAuth) {
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
taxAgents = handleForDevolution(taxAgents, (long) user.getUID(), true);
if (needAuth) {
taxAgents = handleForDevolution(taxAgents, (long) user.getUID(), true);
}
return taxAgents.stream().map(m -> {
Map<String, Object> map = new HashMap<>(2);
map.put("id", String.valueOf(m.getId()));

View File

@ -6,10 +6,16 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.BeanUtils;
import java.awt.Color;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ExcelUtilPlus {
/**
@ -342,7 +348,8 @@ public class ExcelUtilPlus {
return workbook;
}
public static XSSFWorkbook genWorkbookWithChildTitleColumn(List<List<Object>> rowList, String sheetName, boolean lastRowRed) {
// 数值项目修改excel单元格格式为数值
public static XSSFWorkbook genWorkbookWithChildTitleColumnWithExcelFormat(List<List<Object>> rowList, String sheetName, boolean lastRowRed) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
@ -413,6 +420,195 @@ public class ExcelUtilPlus {
XSSFRow row0 = sheet.createRow(0);
XSSFRow row1 = sheet.createRow(1);
// 保留小数位数
List<Integer> patternList = new ArrayList<>();
List<Object> header = rowList.get(0);
int startIndex = 0;
for (int i = 0; i < header.size(); i++) {
WeaTableColumnGroup columnGroupItem = (WeaTableColumnGroup) header.get(i);
if (columnGroupItem.getChildren() == null) {
sheet.addMergedRegion(new CellRangeAddress(0, 1, startIndex, startIndex));
XSSFCell rowZeroCell = row0.createCell(startIndex, CellType.STRING);
rowZeroCell.setCellValue(columnGroupItem.getText().toString());
rowZeroCell.setCellStyle(titleCellStyle);
XSSFCell rowOneCell = row1.createCell(startIndex, CellType.STRING);
rowOneCell.setCellValue(columnGroupItem.getText().toString());
rowOneCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(startIndex,Math.max(12, columnGroupItem.getText().length()*4)*256);
startIndex++;
patternList.add(columnGroupItem.getPattern());
} else {
List<WeaTableColumnGroup> childrenList = columnGroupItem.getChildren();
int endIndex = startIndex + childrenList.size() - 1;
if (endIndex > startIndex) {
sheet.addMergedRegion(new CellRangeAddress(0, 0, startIndex, endIndex));
}
XSSFCell cell = row0.createCell(startIndex, CellType.STRING);
cell.setCellValue(columnGroupItem.getText().toString());
cell.setCellStyle(childTitleCellStyle);
for (int j = 0; j < childrenList.size(); j++) {
WeaTableColumnGroup childrenItem = (WeaTableColumnGroup) childrenList.get(j);
XSSFCell subHeader = row1.createCell(startIndex + j, CellType.STRING);
subHeader.setCellValue(childrenItem.getText().toString());
subHeader.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(startIndex + j,Math.max(12, childrenItem.getText().length()*4)*256);
patternList.add(childrenItem.getPattern());
}
startIndex += childrenList.size();
}
}
HashMap<Integer, XSSFCellStyle> numberCellStyleMap = new HashMap<Integer, XSSFCellStyle>();
HashMap<Integer, XSSFCellStyle> numberRedCellStyleMap = new HashMap<Integer, XSSFCellStyle>();
XSSFDataFormat df = workbook.createDataFormat();
patternList.stream().distinct().forEach(p -> {
String start = "0.";
if (p==0) {
start ="0";
}
XSSFCellStyle numberRedCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(redCellStyle, numberRedCellStyle);
numberRedCellStyle.setFont(redFont);
short format = df.getFormat(start + Stream.generate(() -> "0").limit(p).collect(Collectors.joining()) + "_ ");
numberRedCellStyle.setDataFormat(format);
// 最后一行红色
numberRedCellStyleMap.put(p, numberRedCellStyle);
XSSFCellStyle numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
numberCellStyleMap.put(p, numberCellStyle);
});
for (int rowIndex = 1; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex + 1);
float height = 18;
float finalHeight = 18;
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
if (lastRowRed && rowIndex == rowList.size() - 1) {
cell.setCellStyle(redCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
if (lastRowRed && rowIndex == rowList.size() - 1) {
cell.setCellStyle(numberRedCellStyleMap.get(patternList.get(cellIndex)));
} else {
cell.setCellStyle(numberCellStyleMap.get(patternList.get(cellIndex)));
}
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
//判断是否要调整高度
int width = sheet.getColumnWidth(cellIndex) / 256;
finalHeight = getFinalHeight(o, width, finalHeight, height);
}
row.setHeightInPoints(finalHeight);
}
return workbook;
}
public static XSSFWorkbook genWorkbookWithChildTitleColumn(List<List<Object>> rowList, String sheetName, boolean lastRowRed) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setBold(true);
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
titleCellStyle.setBorderLeft(BorderStyle.THIN);
titleCellStyle.setBorderRight(BorderStyle.THIN);
titleCellStyle.setBorderTop(BorderStyle.THIN);
titleCellStyle.setBorderBottom(BorderStyle.THIN);
XSSFCellStyle childTitleCellStyle = workbook.createCellStyle();
childTitleCellStyle.setFont(titleFont);
childTitleCellStyle.setAlignment(HorizontalAlignment.LEFT);
childTitleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
childTitleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
childTitleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
childTitleCellStyle.setBorderLeft(BorderStyle.THIN);
childTitleCellStyle.setBorderRight(BorderStyle.THIN);
childTitleCellStyle.setBorderTop(BorderStyle.THIN);
childTitleCellStyle.setBorderBottom(BorderStyle.THIN);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
XSSFCellStyle redCellStyle = workbook.createCellStyle();
XSSFFont redFont = workbook.createFont();
redFont.setFontName("宋体");
redFont.setFontHeightInPoints((short) 10);// 设置字体大小
redFont.setColor(new XSSFColor(new Color(0xFF3333), null));
redFont.setBold(true);
redCellStyle.setWrapText(true);
redCellStyle.setFont(redFont);// 选择需要用到的字体格式
redCellStyle.setBorderLeft(BorderStyle.THIN);
redCellStyle.setBorderRight(BorderStyle.THIN);
redCellStyle.setBorderTop(BorderStyle.THIN);
redCellStyle.setBorderBottom(BorderStyle.THIN);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
//处理合并单元格
XSSFRow row0 = sheet.createRow(0);
XSSFRow row1 = sheet.createRow(1);
List<Object> header = rowList.get(0);
int startIndex = 0;
for (int i = 0; i < header.size(); i++) {

View File

@ -4,11 +4,11 @@ import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
import com.engine.salary.entity.siarchives.param.SIArchiveImportParam;
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeDetailUpdateParam;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeReqParam;
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.service.SIAccountService;
@ -231,18 +231,18 @@ public class SISchemeController {
@POST
@Path("/preview")
@Produces(MediaType.APPLICATION_JSON)
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SISchemaImportParam queryParam) {
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveImportParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SISchemaImportParam, Map<String, Object>>(user).run(getService(user)::preview, queryParam);
return new ResponseResult<SIArchiveImportParam, Map<String, Object>>(user).run(getService(user)::preview, queryParam);
}
@POST
@Path("/importBatch")
@Produces(MediaType.APPLICATION_JSON)
public String batchImportEbatch(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SISchemaImportParam queryParam) {
public String batchImportEbatch(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SIArchiveImportParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SISchemaImportParam, Map<String, Object>>(user).run(getService(user)::batchImportEbatch, queryParam);
return new ResponseResult<SIArchiveImportParam, Map<String, Object>>(user).run(getService(user)::batchImportEbatch, queryParam);
}

View File

@ -8,6 +8,7 @@ import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam;
import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.ResponseResult;
@ -112,6 +113,28 @@ public class SalaryItemController {
return new ResponseResult<Long, SalaryItemFormDTO>(user).run(getSalaryItemWrapper(user)::getForm, id);
}
/**
* 获取哪些账套中使用了该薪资项目
*/
@GET
@Path("/getSalarySobBySalaryItem")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobBySalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, List<Map<String, Object>>>(user).run(getSalaryItemWrapper(user)::getSalarySobBySalaryItem, id);
}
/**
* 将薪资项目管理中的信息同步至账套
*/
@POST
@Path("/syncSalaryItemToSalarySobItem")
@Produces(MediaType.APPLICATION_JSON)
public String syncSalaryItemToSalarySobItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SyncSalaryItemParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SyncSalaryItemParam, String>(user).run(getSalaryItemWrapper(user)::syncSalaryItemToSalarySobItem, param);
}
/**
* "获取薪资项目可选的类型(与属性有联动)"
*

View File

@ -15,6 +15,7 @@ import com.engine.salary.wrapper.TaxAgentBaseWrapper;
import com.engine.salary.wrapper.TaxAgentSubAdminWrapper;
import com.engine.salary.wrapper.TaxAgentWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -362,7 +363,8 @@ public class TaxAgentController {
@Produces(MediaType.APPLICATION_JSON)
public String selectList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, List<Map<String, Object>>>(user).run(getTaxAgentWrapper(user)::selectList);
boolean needAuth = !StringUtils.equals("true", request.getParameter("isShare"));
return new ResponseResult<Boolean, List<Map<String, Object>>>(user).run(getTaxAgentWrapper(user)::selectList, needAuth);
}
@GET

View File

@ -20,6 +20,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryarchive.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.process.salaryArchive.SalaryArchiveProcessQueryParam;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryI18nUtil;
@ -53,7 +54,6 @@ public class SalaryArchiveWrapper extends Service {
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@ -442,7 +442,7 @@ public class SalaryArchiveWrapper extends Service {
* @return
*/
public XSSFWorkbook downloadTemplate(SalaryArchiveQueryParam queryParam) {
if(!queryParam.isExtSalaryArchiveList()){
if (!queryParam.isExtSalaryArchiveList()) {
if (queryParam.getListType() == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(109712, "列表类型必传"));
} else {
@ -567,14 +567,19 @@ public class SalaryArchiveWrapper extends Service {
return getSalaryArchiveService(user).handleRepeatData();
}
public SalaryArchivePO getSalaryArchiveInfo(SalaryArchiveQueryParam param) {
SalaryArchivePO po = SalaryArchivePO.builder().employeeId(param.getEmployeeId()).build();
@Deprecated
public SalaryArchivePO getSalaryArchiveInfo(SalaryArchiveProcessQueryParam param) {
if (param.getEmployeeId() == null) {
throw new SalaryRunTimeException("人员id为空!");
}
SalaryArchivePO po = SalaryArchivePO.builder().employeeId(param.getEmployeeId()).build();
if (param.getTaxAgentId() != null) {
po.setTaxAgentId(param.getTaxAgentId());
}
if (CollectionUtils.isNotEmpty(param.getRunStatusList())) {
po.setRunStatusList(param.getRunStatusList());
}
List<SalaryArchivePO> list = getSalaryArchiveService(user).listSome(po);
if (CollectionUtils.isEmpty(list)) {
throw new SalaryRunTimeException("薪资档案不存在!");
@ -585,9 +590,30 @@ public class SalaryArchiveWrapper extends Service {
return list.get(0);
}
public List<SalaryArchiveFormDTO> getSalaryArchiveInfoV2(SalaryArchiveProcessQueryParam param) {
if (param.getEmployeeId() == null) {
throw new SalaryRunTimeException("人员id为空!");
}
SalaryArchivePO po = SalaryArchivePO.builder().employeeId(param.getEmployeeId()).build();
if (param.getTaxAgentId() != null) {
po.setTaxAgentId(param.getTaxAgentId());
}
if (CollectionUtils.isNotEmpty(param.getRunStatusList())) {
po.setRunStatusList(param.getRunStatusList());
}
List<SalaryArchivePO> list = getSalaryArchiveService(user).listSome(po);
if (CollectionUtils.isEmpty(list)) {
throw new SalaryRunTimeException("薪资档案不存在!");
}
return list.stream().map(a->getFrom(a.getId())).collect(Collectors.toList());
}
/**
* 删除薪资档案
*
* @param salaryArchiveIds
*/
public void deleteSalaryArchive(Collection<Long> salaryArchiveIds) {

View File

@ -111,20 +111,20 @@ public class SalaryFormulaWrapper extends Service {
param.setSourceId("welfare");
//获取福利类薪资项目
List<FormulaVar> list = getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam());
list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差"))).collect(Collectors.toList());
list = list.stream().filter(f -> !(f.getName().contains("正常缴纳") || f.getName().contains("补缴") || f.getName().contains("补差") || f.getName().contains("申报基数"))).collect(Collectors.toList());
//提取出福利类项目名称
for (FormulaVar formulaVar : list) {
InsuranceAcctDetailImportFieldDTO insuranceAcctDetailImportFieldDTO = new InsuranceAcctDetailImportFieldDTO();
// insuranceAcctDetailImportFieldDTO.setFieldId(formulaVar.getFieldId());
insuranceAcctDetailImportFieldDTO.setFieldId(formulaVar.getFieldId().contains("welfare_") ? formulaVar.getFieldId().substring(8) : formulaVar.getFieldId());
insuranceAcctDetailImportFieldDTO.setSalaryItemName(formulaVar.getName());
welfareList.add(insuranceAcctDetailImportFieldDTO);
}
welfareList.add(new InsuranceAcctDetailImportFieldDTO("社保合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("公积金合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("其他福利合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("socialSum","社保合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("fundSum","公积金合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("otherSum","其他福利合计"));
welfareList.add(new InsuranceAcctDetailImportFieldDTO("total","合计"));
return welfareList;
}

View File

@ -10,6 +10,7 @@ import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.param.SyncSalaryItemParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
@ -236,8 +237,8 @@ public class SalaryItemWrapper extends Service {
if (SalaryDataTypeEnum.parseByValue(saveParam.getDataType()) == null) {
throw new SalaryRunTimeException("字段类型异常");
}
if (saveParam.getName().contains("{") || saveParam.getName().contains("}")) {
throw new SalaryRunTimeException("薪资项目名称中不得包含大括号");
if (saveParam.getName().contains("{") || saveParam.getName().contains("}") || saveParam.getName().contains(".")) {
throw new SalaryRunTimeException("薪资项目名称中不得包含大括号或点");
}
}
@ -262,4 +263,19 @@ public class SalaryItemWrapper extends Service {
}
/**
* 获取薪资项目在哪些账套中使用
* @param salaryItemId
*/
public List<Map<String, Object>> getSalarySobBySalaryItem(Long salaryItemId) {
return getSalaryItemService(user).getSalarySobBySalaryItem(salaryItemId);
}
/**
* 将薪资项目管理中的信息同步至账套
* @param syncSalaryItemParam
*/
public void syncSalaryItemToSalarySobItem(SyncSalaryItemParam syncSalaryItemParam) {
getSalaryItemService(user).syncSalaryItemToSalarySobItem(syncSalaryItemParam);
}
}

View File

@ -293,8 +293,8 @@ public class TaxAgentWrapper extends Service {
*
* @return
*/
public List<Map<String, Object>> selectList() {
return getTaxAgentService(user).selectList();
public List<Map<String, Object>> selectList(boolean needAuth) {
return getTaxAgentService(user).selectList(needAuth);
}
public List<Map<String, Object>> selectListAsAdmin() {