diff --git a/resource/sqlupgrade/DM/sql202309040303.sql b/resource/sqlupgrade/DM/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/DM/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/GS/sql202309040303.sql b/resource/sqlupgrade/GS/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/GS/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/JC/sql202309040303.sql b/resource/sqlupgrade/JC/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/JC/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/resource/sqlupgrade/Mysql/sql202309040303.sql b/resource/sqlupgrade/Mysql/sql202309040303.sql new file mode 100644 index 000000000..09de22bfa --- /dev/null +++ b/resource/sqlupgrade/Mysql/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + request_id bigint not null comment '查询请求ID' , + request_status tinyint(1) default 1 not null comment '请求处理状态:10待处理 20处理中 99已完成' , + tax_year_month datetime not null comment '税款所属期' , + outer_request_id varchar(50) not null comment '外部接口查询请求ID' , + tax_agent_id bigint not null comment '个税扣缴义务人Id' +) +; + +alter table hrsa_add_up_deduction_request add lock_version int +; + +alter table hrsa_add_up_deduction_request modify column lock_version int default 0 +; + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key comment 'ID' , + create_time datetime comment '创建时间' , + update_time datetime comment '修改时间' , + creator bigint comment '创建人id' , + delete_type int default 0 comment '是否删除' , + tenant_key varchar(10) comment '租户KEY' , + request_id bigint not null comment '查询请求ID' , + employee_id bigint not null comment '员工ID' , + employee_type int not null comment '员工类型' , + tax_agent_id bigint not null comment '个税扣缴义务人ID' , + reason varchar(255) not null comment '失败原因' , + tax_year_month datetime not null comment '税款所属期' , + outer_request_id varchar(50) not null comment '外部接口查询请求id' +) +; \ No newline at end of file diff --git a/resource/sqlupgrade/Oracle/sql202309040303.sql b/resource/sqlupgrade/Oracle/sql202309040303.sql new file mode 100644 index 000000000..1e666275e --- /dev/null +++ b/resource/sqlupgrade/Oracle/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +) +/ + +alter table hrsa_add_up_deduction_request add lock_version int +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0 +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +) +/ \ No newline at end of file diff --git a/resource/sqlupgrade/PG/sql202309040303.sql b/resource/sqlupgrade/PG/sql202309040303.sql new file mode 100644 index 000000000..eefe81ecd --- /dev/null +++ b/resource/sqlupgrade/PG/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key , + create_time timestamp, + update_time timestamp, + creator bigint, + delete_type int default 0, + tenant_key varchar(10), + request_id bigint not null, + request_status smallint default 1 not null, + tax_year_month timestamp not null, + outer_request_id varchar(50) not null, + tax_agent_id bigint not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request alter column lock_version set default 0; +/ + + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key , + create_time timestamp, + update_time timestamp, + creator bigint, + delete_type int default 0, + tenant_key varchar(10), + request_id bigint not null, + employee_id bigint not null, + employee_type int not null, + tax_agent_id bigint not null, + reason varchar(255) not null, + tax_year_month timestamp not null, + outer_request_id varchar(50) not null +); +/ \ No newline at end of file diff --git a/resource/sqlupgrade/SQLServer/sql202309040303.sql b/resource/sqlupgrade/SQLServer/sql202309040303.sql new file mode 100644 index 000000000..bdfa19c5f --- /dev/null +++ b/resource/sqlupgrade/SQLServer/sql202309040303.sql @@ -0,0 +1,39 @@ +create table hrsa_add_up_deduction_request +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + request_id bigint not null, + request_status tinyint default 1 not null, + tax_year_month datetime not null, + outer_request_id nvarchar(50) not null, + tax_agent_id bigint not null +) +GO + +alter table hrsa_add_up_deduction_request add lock_version int +GO + +alter table hrsa_add_up_deduction_request add constraint df_lock_version_71db6820 default 0 for lock_version +GO + +create table hrsa_add_up_deduction_req_fail +( + id bigint primary key , + create_time datetime, + update_time datetime, + creator bigint, + delete_type int default 0, + tenant_key nvarchar(10), + request_id bigint not null, + employee_id bigint not null, + employee_type int not null, + tax_agent_id bigint not null, + reason nvarchar(255) not null, + tax_year_month datetime not null, + outer_request_id nvarchar(50) not null +) +GO \ No newline at end of file diff --git a/resource/sqlupgrade/ST/sql202309040303.sql b/resource/sqlupgrade/ST/sql202309040303.sql new file mode 100644 index 000000000..5805822bc --- /dev/null +++ b/resource/sqlupgrade/ST/sql202309040303.sql @@ -0,0 +1,40 @@ +create table hrsa_add_up_deduction_request +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + request_status number default 1 not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null, + tax_agent_id number not null +); +/ + +alter table hrsa_add_up_deduction_request add lock_version int; +/ + +alter table hrsa_add_up_deduction_request modify lock_version default 0; +/ + +create table hrsa_add_up_deduction_req_fail +( + id number primary key , + create_time date, + update_time date, + creator number, + delete_type int default 0, + tenant_key varchar2(10), + request_id number not null, + employee_id number not null, + employee_type int not null, + tax_agent_id number not null, + reason varchar2(255) not null, + tax_year_month date not null, + outer_request_id varchar2(50) not null +); +/ + diff --git a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java index ad132635e..ace90158f 100644 --- a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java +++ b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java @@ -1,6 +1,10 @@ package com.engine.salary.entity.datacollection.bo; +import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import com.engine.salary.entity.datacollection.response.QuerySpecialAmountFeedbackResponse; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.engine.salary.enums.SalaryOnOffEnum; @@ -8,6 +12,7 @@ import com.engine.salary.enums.employeedeclare.CardTypeEnum; import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum; import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum; import com.engine.salary.enums.employeedeclare.GenderEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum; import com.engine.salary.service.impl.AddUpDeductionServiceImpl; import com.engine.salary.util.SalaryDateUtil; @@ -17,10 +22,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @Description: 鏁版嵁閲囬泦 @@ -357,39 +359,40 @@ public class DataCollectionBO { return employeeList; } -// public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { -// return AddUpDeduction.builder() -// .id(IdGenerator.generate()) -// .addUpChildEducation(feedback.getLjznjyzc().toString()) -// .addUpContinuingEducation(feedback.getLjjxjyzc().toString()) -// .addUpHousingRent(feedback.getLjzfzjzc().toString()) -// .addUpInfantCare(feedback.getLjyyezhzc().toString()) -// .addUpHousingLoanInterest(feedback.getLjzfdklxzc().toString()) -// .addUpSupportElderly(feedback.getLjsylrzc().toString()) -// .addUpIllnessMedical("0") + public static AddUpDeduction buildAddUpDeductionPO(QuerySpecialAmountFeedbackResponse.Feedback feedback) { + return AddUpDeduction.builder() + .id(IdGenerator.generate()) + .addUpChildEducation(feedback.getLjznjyzc().toString()) + .addUpContinuingEducation(feedback.getLjjxjyzc().toString()) + .addUpHousingRent(feedback.getLjzfzjzc().toString()) + .addUpInfantCare(feedback.getLjyyezhzc().toString()) + .addUpHousingLoanInterest(feedback.getLjzfdklxzc().toString()) + .addUpSupportElderly(feedback.getLjsylrzc().toString()) + .addUpIllnessMedical("0") // .dataSource(EnumAddUpDeductionDataSource.ONLINE.getValue()) // .lastUpdateTime(LocalDateTime.now()) -// .updateTime(LocalDateTime.now()) -// .build(); -// } -// -// public static AddUpDeductionRequestFailPO buildAddUpDeductionRequestFailPO(AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, -// AddUpDeductionRequestPO requestPO, -// Long employeeId) { -// return AddUpDeductionRequestFailPO.builder() -// .id(IdGenerator.generate()) -// .requestId(requestPO.getRequestId()) -// .outerRequestId(requestPO.getOuterRequestId()) -// .taxYearMonth(requestPO.getTaxYearMonth()) -// .taxAgentId(requestPO.getTaxAgentId()) -// .employeeId(Optional.ofNullable(employeeId).orElse(0L)) -// .createTime(LocalDateTime.now()) -// .updateTime(LocalDateTime.now()) -// .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) -// .creator(requestWrapper.getCurrentEmployeeId()) -// .tenantKey(requestPO.getTenantKey()) -// .build(); -// } + .updateTime(new Date()) + .build(); + } + + public static AddUpDeductionRequestFailPO buildAddUpDeductionRequestFailPO(AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper, + AddUpDeductionRequestPO requestPO, + Long employeeId) { + Date now = new Date(); + return AddUpDeductionRequestFailPO.builder() + .id(IdGenerator.generate()) + .requestId(requestPO.getRequestId()) + .outerRequestId(requestPO.getOuterRequestId()) + .taxYearMonth(requestPO.getTaxYearMonth()) + .taxAgentId(requestPO.getTaxAgentId()) + .employeeId(employeeId) + .createTime(now) + .updateTime(now) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .creator(requestWrapper.getCurrentEmployeeId()) + .tenantKey(requestPO.getTenantKey()) + .build(); + } public static AddUpDeductionRequestResultDTO buildRequestResultDTO(Long requestId, AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper) { return AddUpDeductionRequestResultDTO.builder() diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java index 8ef9bc47d..7b0883452 100644 --- a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestFailPO.java @@ -1,13 +1,14 @@ package com.engine.salary.entity.datacollection.po; +import com.engine.salary.report.enums.EmployeeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; -import java.time.LocalDate; -import java.time.LocalDateTime; +import java.util.Collection; +import java.util.Date; /** * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ澶辫触琛 @@ -31,10 +32,10 @@ public class AddUpDeductionRequestFailPO implements Serializable { private Long id; //鍒涘缓鏃堕棿", ignore = true) - private LocalDateTime createTime; + private Date createTime; //淇敼鏃堕棿", ignore = true) - private LocalDateTime updateTime; + private Date updateTime; //鍒涘缓浜篿d", ignore = true) private long creator; @@ -61,12 +62,15 @@ public class AddUpDeductionRequestFailPO implements Serializable { private String reason; //绋庢鎵灞炴湡") - private LocalDate taxYearMonth; + private Date taxYearMonth; /** - * @see com.weaver.hrm.salary.enums.salaryaccounting.EmployeeTypeEnum + * @see EmployeeTypeEnum */ //浜哄憳绫诲瀷") private Integer employeeType; + + private Collection ids; + } diff --git a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java index 90a993052..6768edf3f 100644 --- a/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java +++ b/src/com/engine/salary/entity/datacollection/po/AddUpDeductionRequestPO.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +import java.util.Collection; import java.util.Date; /** @@ -19,49 +20,56 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor -//hrsa_add_up_deduction_request") -//鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ琛") +//hrsa_add_up_deduction_request +//鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎鍦ㄧ嚎鏌ヨ琛 public class AddUpDeductionRequestPO implements Serializable { private static final long serialVersionUID = 1452863635879051515L; - //ID") + //ID private long id; - //鍒涘缓鏃堕棿", ignore = true) + //鍒涘缓鏃堕棿" private Date createTime; - //淇敼鏃堕棿", ignore = true) + //淇敼鏃堕棿" private Date updateTime; - //鍒涘缓浜篿d", ignore = true) + //鍒涘缓浜篿d" private long creator; - //鏄惁鍒犻櫎", ignore = true) + //鏄惁鍒犻櫎" private int deleteType; - //绉熸埛KEY", ignore = true) + //绉熸埛KEY" private String tenantKey; - //涔愯閿佺増鏈", ignore = true) + //涔愯閿佺増鏈" private int lockVersion; - //鏌ヨ璇锋眰ID") + //鏌ヨ璇锋眰ID private Long requestId; - //澶栭儴鎺ュ彛鏌ヨ璇锋眰ID") + //澶栭儴鎺ュ彛鏌ヨ璇锋眰ID private String outerRequestId; /** * @see EnumAddUpDeductionRequestStatus */ - //璇锋眰澶勭悊鐘舵") + //璇锋眰澶勭悊鐘舵 private int requestStatus; - //绋庢鎵灞炴湡") + //绋庢鎵灞炴湡 private Date taxYearMonth; - //涓◣鎵g即涔夊姟浜篒D") + //涓◣鎵g即涔夊姟浜篒D private Long taxAgentId; + + + private Collection ids; + private Collection requestStatuss; + private Integer oldStatus; + private Integer oldLockVersion; + } diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java new file mode 100644 index 000000000..1a2287833 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.java @@ -0,0 +1,80 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestFailPO; +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AddUpDeductionRequestFailMapper { + + /** + * 鏌ヨ鎵鏈夎褰 + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listAll(); + + /** + * 鏉′欢鏌ヨ + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listSome(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + + /** + * 鏍规嵁涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return 杩斿洖璁板綍锛屾病鏈夎繑鍥瀗ull + */ + AddUpDeductionRequestFailPO getById(Long id); + + /** + * 鏂板锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionReqFail 鏂板鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int insertIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 鎵归噺鎻掑叆 + * + * @param list + */ + void batchInsert(@Param("collection") Collection list); + + /** + * 淇敼锛屼慨鏀规墍鏈夊瓧娈 + * + * @param addUpDeductionReqFail 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int update(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 淇敼锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionReqFail 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int updateIgnoreNull(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 鍒犻櫎璁板綍 + * + * @param addUpDeductionReqFail 寰呭垹闄ょ殑璁板綍 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int delete(AddUpDeductionRequestFailPO addUpDeductionReqFail); + + /** + * 鎵归噺鍒犻櫎璁板綍 + * @param ids 涓婚敭id闆嗗悎 + */ + void deleteByIds(@Param("ids") Collection ids); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml new file mode 100644 index 000000000..e0e740698 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestFailMapper.xml @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.employee_id + , t.employee_type + , t.id + , t.outer_request_id + , t.reason + , t.request_id + , t.tax_agent_id + , t.tax_year_month + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_add_up_deduction_req_fail + + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + employee_type, + + + id, + + + outer_request_id, + + + reason, + + + request_id, + + + tax_agent_id, + + + tax_year_month, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{employeeType}, + + + #{id}, + + + #{outerRequestId}, + + + #{reason}, + + + #{requestId}, + + + #{taxAgentId}, + + + #{taxYearMonth}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + + + select + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + from dual + + + + INSERT INTO hrsa_add_up_deduction_req_fail (id, create_time, update_time, creator, delete_type, tenant_key, + request_id, + employee_id, employee_type, tax_agent_id, reason, tax_year_month, + outer_request_id) + VALUES + + ( + #{item.id}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey}, + #{item.requestId}, + #{item.employeeId}, + #{item.employeeType}, + #{item.taxAgentId}, + #{item.reason}, + #{item.taxYearMonth}, + #{item.outerRequestId} + ) + + + + + + UPDATE hrsa_add_up_deduction_req_fail + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + employee_type=#{employeeType}, + outer_request_id=#{outerRequestId}, + reason=#{reason}, + request_id=#{requestId}, + tax_agent_id=#{taxAgentId}, + tax_year_month=#{taxYearMonth}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_req_fail + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + employee_type=#{employeeType}, + + + outer_request_id=#{outerRequestId}, + + + reason=#{reason}, + + + request_id=#{requestId}, + + + tax_agent_id=#{taxAgentId}, + + + tax_year_month=#{taxYearMonth}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_req_fail + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_add_up_deduction_req_fail + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java new file mode 100644 index 000000000..5df335a15 --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.java @@ -0,0 +1,80 @@ +package com.engine.salary.mapper.datacollection; + +import com.engine.salary.entity.datacollection.po.AddUpDeductionRequestPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface AddUpDeductionRequestMapper { + + /** + * 鏌ヨ鎵鏈夎褰 + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listAll(); + + /** + * 鏉′欢鏌ヨ + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listSome(AddUpDeductionRequestPO addUpDeductionRequest); + + + /** + * 鏍规嵁涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return 杩斿洖璁板綍锛屾病鏈夎繑鍥瀗ull + */ + AddUpDeductionRequestPO getById(Long id); + + /** + * 鏂板锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionRequest 鏂板鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int insertIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 鎵归噺鎻掑叆 + * + * @param addUpDeductionRequest + */ + void batchInsert(@Param("collection") List addUpDeductionRequest); + + /** + * 淇敼锛屼慨鏀规墍鏈夊瓧娈 + * + * @param addUpDeductionRequest 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int update(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 淇敼锛屽拷鐣ull瀛楁 + * + * @param addUpDeductionRequest 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int updateIgnoreNull(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 鍒犻櫎璁板綍 + * + * @param addUpDeductionRequest 寰呭垹闄ょ殑璁板綍 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int delete(AddUpDeductionRequestPO addUpDeductionRequest); + + /** + * 鎵归噺鍒犻櫎璁板綍 + * @param ids 涓婚敭id闆嗗悎 + */ + void deleteByIds(@Param("ids") Collection ids); + + int updateRequestStatusLockVersion(AddUpDeductionRequestPO build); +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml new file mode 100644 index 000000000..b25dca50d --- /dev/null +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionRequestMapper.xml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.id + , t.lock_version + , t.outer_request_id + , t.request_id + , t.request_status + , t.tax_agent_id + , t.tax_year_month + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_add_up_deduction_request + + + + create_time, + + + creator, + + + delete_type, + + + id, + + + lock_version, + + + outer_request_id, + + + request_id, + + + request_status, + + + tax_agent_id, + + + tax_year_month, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{id}, + + + #{lockVersion}, + + + #{outerRequestId}, + + + #{requestId}, + + + #{requestStatus}, + + + #{taxAgentId}, + + + #{taxYearMonth}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + + INSERT INTO hrsa_add_up_deduction_request + ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + VALUES + ( + + #{item.createTime}, + #{item.creator}, + #{item.deleteType}, + #{item.id}, + #{item.lockVersion}, + #{item.outerRequestId}, + #{item.requestId}, + #{item.requestStatus}, + #{item.taxAgentId}, + #{item.taxYearMonth}, + #{item.tenantKey}, + #{item.updateTime} + + ) + + + + + INSERT INTO hrsa_add_up_deduction_request ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + + select + #{item.createTime,jdbcType=DATE}, + #{item.creator,jdbcType=DOUBLE}, + #{item.deleteType,jdbcType=INTEGER}, + #{item.id,jdbcType=DOUBLE}, + #{item.lockVersion,jdbcType=INTEGER}, + #{item.outerRequestId,jdbcType=DOUBLE}, + #{item.requestId,jdbcType=DOUBLE}, + #{item.requestStatus,jdbcType=INTEGER}, + #{item.taxAgentId,jdbcType=DOUBLE}, + #{item.taxYearMonth,jdbcType=DATE}, + #{item.tenantKey,jdbcType=VARCHAR}, + #{item.updateTime,jdbcType=DATE} + from dual + + + + + + + INSERT INTO hrsa_add_up_deduction_request ( + create_time, + creator, + delete_type, + id, + lock_version, + outer_request_id, + request_id, + request_status, + tax_agent_id, + tax_year_month, + tenant_key, + update_time + ) + VALUES + ( + #{item.createTime}, + #{item.creator}, + #{item.deleteType}, + #{item.id}, + #{item.lockVersion}, + #{item.outerRequestId}, + #{item.requestId}, + #{item.requestStatus}, + #{item.taxAgentId}, + #{item.taxYearMonth}, + #{item.tenantKey}, + #{item.updateTime} + ) + + + + + + UPDATE hrsa_add_up_deduction_request + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + lock_version=#{lockVersion}, + outer_request_id=#{outerRequestId}, + request_id=#{requestId}, + request_status=#{requestStatus}, + tax_agent_id=#{taxAgentId}, + tax_year_month=#{taxYearMonth}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_request + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + lock_version=#{lockVersion}, + + + outer_request_id=#{outerRequestId}, + + + request_id=#{requestId}, + + + request_status=#{requestStatus}, + + + tax_agent_id=#{taxAgentId}, + + + tax_year_month=#{taxYearMonth}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_add_up_deduction_request + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_add_up_deduction_request + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + UPDATE hrsa_add_up_deduction_request + + request_status=#{requestStatus}, + lock_version=#{lockVersion}, + update_time=#{updateTime}, + + WHERE delete_type = 0 + AND request_status=#{oldStatus} + AND lock_version=#{oldLockVersion} + AND id = #{id} + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryArchiveService.java b/src/com/engine/salary/service/SalaryArchiveService.java index c240adcf3..dbeb2d865 100644 --- a/src/com/engine/salary/service/SalaryArchiveService.java +++ b/src/com/engine/salary/service/SalaryArchiveService.java @@ -240,4 +240,6 @@ public interface SalaryArchiveService { * @return */ List listPayEndDateIsNull(List employeeIds); + + List listByRunStatus(List asList); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index c8aeee357..70157b459 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -52,6 +52,8 @@ import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; import com.engine.salary.enums.taxdeclaration.EnumDeclareApiBusinessType; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionRequestFailMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionRequestMapper; import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.report.enums.EmployeeTypeEnum; @@ -75,7 +77,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.math.NumberUtils; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; @@ -86,7 +87,6 @@ import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.*; import java.util.*; -import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -157,6 +157,14 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class); } + private AddUpDeductionRequestMapper getAddUpDeductionRequestMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionRequestMapper.class); + } + + private AddUpDeductionRequestFailMapper getAddUpDeductionRequestFailMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionRequestFailMapper.class); + } + private ExtEmpService getExtEmpService(User user) { return ServiceUtil.getService(ExtEmpServiceImpl.class, user); } @@ -1285,8 +1293,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); long employeeId = (long) user.getUID(); boolean isChief = getTaxAgentService(user).isChief(employeeId); - List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAsChief(isOpenDevolution, isChief) : getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); - Set taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); + List taxAgents = !isOpenDevolution || isChief ? getTaxAgentService(user).listAll() : (List) getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); + List taxAgentIdSet = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList()); // 鑾峰彇钖祫妗f List salaryArchiveList = getSalaryArchiveService(user).listByRunStatus(Arrays.asList( SalaryArchiveStatusEnum.FIXED.getValue(), @@ -1363,7 +1371,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .creator(user.getUID()) .lockVersion(0) .build(); - addUpDeductionRequestMapper.insert(po); + getAddUpDeductionRequestMapper().insertIgnoreNull(po); } } @@ -1407,7 +1415,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction setExistedDataMap(requestWrapper); // 寮濮嬪鐞嗗弽棣堢粨鏋 TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper - = new TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper(requestPOList.get(0).getTaxYearMonth(), requestWrapper.getApiConfig(), EnumDeclareApiBusinessType.ADD_UP_DEDUCTION); + = new TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper(requestPOList.get(0).getTaxYearMonth(), requestWrapper.getApiConfig(), EnumDeclareApiBusinessType.ADD_UP_DEDUCTION, (long) user.getUID()); handleFeedbackData(requestWrapper, apiFlowUpdateWrapper); // 鎸佷箙鍖栨暟鎹 persistFeedbackData(requestWrapper); @@ -1419,30 +1427,22 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public PageInfo onlineFeedbackFail(AddUpDeductionRequestFailQueryParam queryParam) { - Page page = new LambdaQueryChainWrapper<>(addUpDeductionRequestFailMapper) - .eq(AddUpDeductionRequestFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestFailPO::getTenantKey) - .eq(AddUpDeductionRequestFailPO::getRequestId, queryParam.getRequestId()) - .page(new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), queryParam.getTotal(), true)); - + List addUpDeductionRequestFailPOS = getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(queryParam.getRequestId()).build()); + List list = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), addUpDeductionRequestFailPOS); // 鑾峰彇钖祫妗f AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, null); this.getEmployeeInfoMap(requestWrapper); - List listDTOList = page.getRecords().stream() - .map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList()); - PageInfo listDTOPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), false); - listDTOPage.setRecords(listDTOList); - return listDTOPage; + List listDTOList = list.stream().map(requestWrapper::buildAddUpDeductionRequestFailListDTO).collect(Collectors.toList()); + + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), listDTOList, AddUpDeductionRequestFailListDTO.class); + page.setTotal(addUpDeductionRequestFailPOS.size()); + return page; } @Override public List getAddUpDeductionRequestFailPOList(Long requestId) { - return new LambdaQueryChainWrapper<>(addUpDeductionRequestFailMapper) - .eq(AddUpDeductionRequestFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestFailPO::getTenantKey) - .eq(AddUpDeductionRequestFailPO::getRequestId, requestId) - .list(); + return getAddUpDeductionRequestFailMapper().listSome(AddUpDeductionRequestFailPO.builder().requestId(requestId).build()); } @Override @@ -1476,14 +1476,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction rows.add(row); } // 鐢熸垚琛ㄦ牸 - ExcelUtil.genWorkbookV2(rows,""); + ExcelUtil.genWorkbookV2(rows, ""); } - private void getEmployeeInfoMap(AddUpDeductionOnlineRequestWrapper wrapper) { // 韬唤璇佸彿 - List employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId,Collectors.toList()); + List employeeIds = SalaryEntityUtil.properties(wrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getEmployeeId); wrapper.setUserInfoUserIdMap(simpleUserInfoMap); @@ -1492,17 +1491,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); wrapper.setSimpleEmployeeMap(simpleEmployeeMap); // 澶栭儴浜哄憳淇℃伅 - List extEmployeePOS = getExtEmpService(user).listCanUse(wrapper.getCurrentEmployeeId()); + List extEmployeePOS = getExtEmpService(user).listAll(); Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getId, e -> e); wrapper.setExtEmployeePOMap(extEmployeePOMap); } private List getAddUpDeductionRequestPOS() { - return new LambdaQueryChainWrapper<>(addUpDeductionRequestMapper) - .eq(AddUpDeductionRequestPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestPO::getTenantKey) - .in(AddUpDeductionRequestPO::getRequestStatus, EnumAddUpDeductionRequestStatus.RUNNING.getValue()) - .list(); + return getAddUpDeductionRequestMapper().listSome(AddUpDeductionRequestPO.builder().requestStatus(EnumAddUpDeductionRequestStatus.RUNNING.getValue()).build()); } private void handleFeedbackData(AddUpDeductionOnlineRequestWrapper requestWrapper, TaxDeclarationApiBillingServiceImpl.ApiFlowUpdateWrapper apiFlowUpdateWrapper) { @@ -1510,8 +1505,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction DataCollectionEmployee simpleUserInfo = requestWrapper.getUserInfoIdNoMap().get(feedback.getZzhm()); Long extEmpId = requestWrapper.getExtEmployeeIdCardMap().get(feedback.getZzhm()); Long employeeId = Optional.ofNullable(simpleUserInfo) - .map(DataCollectionEmployee::getUser) - .map(IdEntity::getId) + .map(DataCollectionEmployee::getEmployeeId) .orElse(extEmpId); AddUpDeductionRequestPO requestPO = requestWrapper.getRequestPoMap().get(outerRequestId); @@ -1563,25 +1557,19 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); requestWrapper.setSimpleEmployeeMap(simpleEmployeeMap); // 鍐呴儴鍛樺伐锛堣韩浠借瘉淇℃伅锛 - List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId,Collectors.toList()); + List employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList()); List simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds); Map simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo); requestWrapper.setUserInfoIdNoMap(simpleUserInfoMap); // 澶栭儴鍛樺伐淇℃伅 - List extEmployeePOS = getExtEmpService(user).listCanUse(requestWrapper.getCurrentEmployeeId(), requestWrapper.getTenantKey()); - Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getCardNum, ExtEmpPO::getId); + List extEmployeePOS = getExtEmpService(user).listAll(); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployeePOS, ExtEmpPO::getIdNo, ExtEmpPO::getId); requestWrapper.setExtEmployeeIdCardMap(extEmployeePOMap); } private void setExistedDataMap(AddUpDeductionOnlineRequestWrapper requestWrapper) { - Set taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId); - List poList = new LambdaQueryChainWrapper<>(addUpDeductionMapper) - .select(AddUpDeduction::getId, AddUpDeduction::getTaxAgentId, AddUpDeduction::getEmployeeId) - .eq(AddUpDeduction::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeduction::getTenantKey, requestWrapper.getTenantKey()) - .eq(AddUpDeduction::getDeclareMonth, requestWrapper.getRequestPOList().get(0).getTaxYearMonth()) - .in(AddUpDeduction::getTaxAgentId, taxAgentIds) - .list(); + List taxAgentIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getTaxAgentId, Collectors.toList()); + List poList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().declareMonth(requestWrapper.getRequestPOList().get(0).getTaxYearMonth()).taxAgentIds(taxAgentIds).build()); requestWrapper.setExistedDataMap(SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId(), AddUpDeduction::getId)); } @@ -1618,20 +1606,20 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (!requestWrapper.getInsertList().isEmpty()) { List> insertPartition = Lists.partition(requestWrapper.getInsertList(), 1000); insertPartition.forEach(list -> { - list = dataSecurityService.encryptBatch(list, AddUpDeduction.class, requestWrapper.getTenantKey()); - addUpDeductionMapper.insertData(list); + list = encryptUtil.encryptList(list, AddUpDeduction.class); + getAddUpDeductionMapper().insertData(list); }); } if (!requestWrapper.getUpdateList().isEmpty()) { List> updatePartition = Lists.partition(requestWrapper.getUpdateList(), 1000); updatePartition.forEach(list -> { - list = dataSecurityService.encryptBatch(list, AddUpDeduction.class, requestWrapper.getTenantKey()); - addUpDeductionMapper.updateData(list); + list = encryptUtil.encryptList(list, AddUpDeduction.class); + getAddUpDeductionMapper().updateData(list); }); } if (!requestWrapper.getFailPOList().isEmpty()) { List> failPartition = Lists.partition(requestWrapper.getFailPOList(), 1000); - failPartition.forEach(list -> addUpDeductionRequestFailMapper.batchInsert(list)); + failPartition.forEach(list -> getAddUpDeductionRequestFailMapper().batchInsert(list)); } } @@ -1649,16 +1637,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction public void updateRequestStatus(List requestPOList, Integer oldStatus, Integer newStatus) { for (AddUpDeductionRequestPO requestPO : requestPOList) { - boolean update = new LambdaUpdateChainWrapper<>(addUpDeductionRequestMapper) - .set(AddUpDeductionRequestPO::getRequestStatus, newStatus) - .set(AddUpDeductionRequestPO::getUpdateTime, LocalDateTime.now()) - .set(AddUpDeductionRequestPO::getLockVersion, requestPO.getLockVersion() + 1) - .eq(AddUpDeductionRequestPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(AddUpDeductionRequestPO::getRequestStatus, oldStatus) - .eq(AddUpDeductionRequestPO::getId, requestPO.getId()) - .eq(AddUpDeductionRequestPO::getLockVersion, requestPO.getLockVersion()) - .update(); - SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "鏈嶅姟寮傚父锛岃绋嶅悗閲嶈瘯")); + int i = getAddUpDeductionRequestMapper().updateRequestStatusLockVersion(AddUpDeductionRequestPO.builder() + .requestStatus(newStatus) + .lockVersion(requestPO.getLockVersion() + 1) + .updateTime(new Date()) + .oldStatus(oldStatus) + .id(requestPO.getId()) + .oldLockVersion(oldStatus) + .build() + ); +// SalaryAssert.isTrue(update, SalaryI18nUtil.getI18nLabel(95828, "鏈嶅姟寮傚父锛岃绋嶅悗閲嶈瘯")); } } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 29530bfb3..d055ca9b2 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1292,4 +1292,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds); } + + @Override + public List listByRunStatus(List list) { + return getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().runStatusList(list).build()); + } } diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index ef2754c5e..3cec335d0 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -7,18 +7,18 @@ import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.wrapper.AddUpDeductionWrapper; -import io.swagger.annotations.ApiOperation; 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 org.jetbrains.annotations.Nullable; -import org.springframework.web.bind.annotation.RequestParam; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -37,7 +37,10 @@ import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -385,12 +388,9 @@ public class AddUpDeductionController { @Path("/online/request") @POST @Produces(MediaType.APPLICATION_JSON) - public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionMonthTaxAgentParam param) { - Map result = addUpDeductionWrapper.onlineRequest(param, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); - if (Objects.nonNull(result.get("msg"))) { - return WeaResult.fail(result.get("msg").toString()); - } - return WeaResult.success(null); + public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionMonthTaxAgentParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineRequest, param); } /** @@ -401,8 +401,9 @@ public class AddUpDeductionController { @Path("/online/feedback") @GET @Produces(MediaType.APPLICATION_JSON) - public String onlineFeedback() { - return WeaResult.success(addUpDeductionWrapper.onlineFeedback(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + public String onlineFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getAddUpDeductionWrapper(user)::onlineFeedback); } /** @@ -413,45 +414,48 @@ public class AddUpDeductionController { @Path("/online/feedback/fail") @POST @Produces(MediaType.APPLICATION_JSON) - public String onlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionRequestFailQueryParam queryParam) { - return WeaResult.success(addUpDeductionWrapper.onlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), queryParam)); + public String onlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRequestFailQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::onlineFeedbackFail, queryParam); } - /** - * 鍦ㄧ嚎鑾峰彇缁撴灉瀵煎嚭 - * - * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 - */ - @Path("/online/feedback/fail/export") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String exportOnlineFeedbackFail(@RequestParam Long requestId) { - return WeaResult.success(addUpDeductionWrapper.exportOnlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), requestId)); - } +// /** +// * 鍦ㄧ嚎鑾峰彇缁撴灉瀵煎嚭 +// * +// * @return WeaResult 鎺ュ彛杩斿洖淇℃伅 +// */ +// @Path("/online/feedback/fail/export") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public String exportOnlineFeedbackFail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam Long requestId) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::exportOnlineFeedbackFail, queryParam); +// return WeaResult.success(addUpDeductionWrapper.exportOnlineFeedbackFail(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey(), requestId)); +// } - /** - * 鍦ㄧ嚎鑾峰彇琛ㄥ崟 - * - * @return WeaResult 杩斿洖缁撴灉 - */ - @Path("/online/request/form") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String getForm() { - return WeaResult.success(addUpDeductionWrapper.getRequestForm()); - } +// /** +// * 鍦ㄧ嚎鑾峰彇琛ㄥ崟 +// * +// * @return WeaResult 杩斿洖缁撴灉 +// */ +// @Path("/online/request/form") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public String getForm() { +// return WeaResult.success(addUpDeductionWrapper.getRequestForm()); +// } - /** - * 鑷姩璁$畻娆℃湀 - * - * @param queryParam 鏌ヨ鏉′欢 - * @return WeaResult 杩斿洖缁撴灉 - */ - @Path("/autoCalculate") - @POST - @Produces(MediaType.APPLICATION_JSON) - public String autoCalculate(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionQueryParam queryParam) { - addUpDeductionWrapper.autoCalculate(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); - return WeaResult.success(null); - } +// /** +// * 鑷姩璁$畻娆℃湀 +// * +// * @param queryParam 鏌ヨ鏉′欢 +// * @return WeaResult 杩斿洖缁撴灉 +// */ +// @Path("/autoCalculate") +// @POST +// @Produces(MediaType.APPLICATION_JSON) +// public String autoCalculate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionQueryParam queryParam) { +// addUpDeductionWrapper.autoCalculate(queryParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); +// return WeaResult.success(null); +// } } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index 3ac0dfe17..dbd0abf80 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -5,10 +5,9 @@ import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam; -import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO; +import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; @@ -180,50 +179,50 @@ public class AddUpDeductionWrapper extends Service { return getAddUpDeductionService(user).autoAddAll(yearMonth, null); } - public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param, Long currentEmployeeId, String currentTenantKey) { - return addUpDeductionService.onlineRequest(param, currentEmployeeId, currentTenantKey); + public Map onlineRequest(AddUpDeductionMonthTaxAgentParam param) { + return getAddUpDeductionService(user).onlineRequest(param); } - public AddUpDeductionRequestResultDTO onlineFeedback(Long currentEmployeeId, String currentTenantKey) { - return addUpDeductionService.onlineFeedback(currentEmployeeId, currentTenantKey); + public AddUpDeductionRequestResultDTO onlineFeedback() { + return getAddUpDeductionService(user).onlineFeedback(); } - public WeaTable onlineFeedbackFail(Long currentEmployeeId, String currentTenantKey, AddUpDeductionRequestFailQueryParam queryParam) { + public PageInfo onlineFeedbackFail( AddUpDeductionRequestFailQueryParam queryParam) { if (queryParam.getRequestId() == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 153345, "鍦ㄧ嚎鑾峰彇鐨勮姹侷D涓嶅彲涓虹┖")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153345, "鍦ㄧ嚎鑾峰彇鐨勮姹侷D涓嶅彲涓虹┖")); } - Page page = addUpDeductionService.onlineFeedbackFail(currentEmployeeId, currentTenantKey, queryParam); - return SalaryFormatUtil.getInstance().buildTable(AddUpDeductionRequestFailListDTO.class, page); + PageInfo page = getAddUpDeductionService(user).onlineFeedbackFail( queryParam); + return page; } - public Map exportOnlineFeedbackFail(Long employeeId, String tenantKey, Long requestId) { - List poList = addUpDeductionService.getAddUpDeductionRequestFailPOList(requestId, tenantKey); - if (CollectionUtils.isEmpty(poList)) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95795, "鏁版嵁涓嶅瓨鍦") + "[id:%s]", requestId)); - } - // 鏋勫缓寮傛瀵煎嚭鍙傛暟 - Map map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail"); - map.put("sheetName", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 183778, "鍦ㄧ嚎鑾峰彇涓撻」闄勫姞鎵i櫎澶辫触鏁版嵁")); - LocalRunnable localRunnable = new LocalRunnable() { - @Override - public void execute() { - try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - addUpDeductionService.exportOnlineFeedbackFail(map, requestId, employeeId, tenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - } - }; - ThreadPoolUtil.execute(localRunnable); - return map; - } - - public WeaForm getRequestForm() { - WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); - WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); - item.setRequired(true); - weaForm.getItems().put("declareMonth", item); - return weaForm; - } +// public Map exportOnlineFeedbackFail( Long requestId) { +// List poList = getAddUpDeductionService(user).getAddUpDeductionRequestFailPOList(requestId); +// if (CollectionUtils.isEmpty(poList)) { +// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 95795, "鏁版嵁涓嶅瓨鍦") + "[id:%s]", requestId)); +// } +// // 鏋勫缓寮傛瀵煎嚭鍙傛暟 +// Map map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail"); +// map.put("sheetName", SalaryI18nUtil.getI18nLabel( 183778, "鍦ㄧ嚎鑾峰彇涓撻」闄勫姞鎵i櫎澶辫触鏁版嵁")); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// try { +// DSTenantKeyThreadVar.tenantKey.set(tenantKey); +// getAddUpDeductionService(user).exportOnlineFeedbackFail(map, requestId); +// } finally { +// DSTenantKeyThreadVar.tenantKey.remove(); +// } +// } +// }; +// ThreadPoolUtil.execute(localRunnable); +// return map; +// } +// +// public WeaForm getRequestForm() { +// WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO()); +// WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM"); +// item.setRequired(true); +// weaForm.getItems().put("declareMonth", item); +// return weaForm; +// } }