mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善
This commit is contained in:
@@ -222,4 +222,9 @@ public class ReflectUtils {
|
||||
|
||||
return objectMapper.convertValue(map, cls);
|
||||
}
|
||||
|
||||
public void invalidateAll() {
|
||||
fieldCache.invalidateAll();
|
||||
getFieldCache.invalidateAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,12 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
public class EmpSalaryBatchDto extends OrgCommonDto {
|
||||
|
||||
|
||||
@Comment("批次年月")
|
||||
private LocalDate batchYearMonth;
|
||||
|
||||
@Comment("批次号")
|
||||
private String batchNo;
|
||||
|
||||
|
||||
|
||||
@Comment("批次状态 0-初始化 1-编辑中 2-已送审 3-已审核 4-已归档")
|
||||
private String batchStatus;
|
||||
|
||||
@@ -30,7 +27,12 @@ public class EmpSalaryBatchDto extends OrgCommonDto {
|
||||
|
||||
private String archiveStatus;
|
||||
|
||||
|
||||
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
|
||||
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
|
||||
private String archiveStatusName;
|
||||
|
||||
private Integer cnt;
|
||||
private Integer cnt2;
|
||||
private Double yfheji;
|
||||
private Double kfheji;
|
||||
private Double sfheji;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.common.Ctx;
|
||||
import cn.lihongjie.coal.common.JpaUtils;
|
||||
import cn.lihongjie.coal.empSalary.service.EmpSalaryService;
|
||||
import cn.lihongjie.coal.empSalaryBatch.dto.BatchInitRequest;
|
||||
import cn.lihongjie.coal.empSalaryBatch.dto.CreateEmpSalaryBatchDto;
|
||||
@@ -19,6 +20,7 @@ import cn.lihongjie.coal.exception.BizException;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.persistence.Tuple;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
@@ -37,6 +39,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@@ -152,7 +156,30 @@ public class EmpSalaryBatchService
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
List<Tuple> tuples = em.createNativeQuery(
|
||||
"""
|
||||
|
||||
select count(s.id) as cnt,
|
||||
(select count(1) from t_employee e where e.organization_id = b.organization_id and ((e.emp_status = '1' and e.entry_date <= b.batch_year_month) or (e.emp_status = '2' and e.entry_date <= b.batch_year_month and e.resign_date!=null and e.resign_date >=b.batch_year_month) ) ) as cnt2,
|
||||
round(sum(s.yfheji)::::numeric, 2) as yfheji,
|
||||
round(sum(s.kfheji)::::numeric, 2) as kfheji,
|
||||
round(sum(s.sfheji)::::numeric, 2) as sfheji,
|
||||
b.id as id
|
||||
|
||||
from t_emp_salary_batch b left join t_emp_salary s on b.id = s.batch_id where b.id in :ids
|
||||
group by b.id
|
||||
|
||||
""",
|
||||
Tuple.class).setParameter("ids", page.map(EmpSalaryBatchEntity::getId).toList()).getResultList();
|
||||
|
||||
List<Map> maps = JpaUtils.convertTuplesToRawMap(tuples);
|
||||
|
||||
|
||||
Page<EmpSalaryBatchDto> pageDto = page.map(this.mapper::toDto);
|
||||
|
||||
|
||||
JpaUtils.mergeMapToPojo(pageDto.getContent(), maps, conversionService);
|
||||
return pageDto;
|
||||
}
|
||||
|
||||
public void archive(IdRequest dto) {
|
||||
|
||||
Reference in New Issue
Block a user