绩效统计页面开发

This commit is contained in:
朱昊天
2026-07-10 17:25:23 +08:00
parent 9c9d3d4017
commit ea779e131e
8 changed files with 680 additions and 248 deletions

View File

@@ -85,6 +85,17 @@ public class PerfDeptSummaryController extends BaseController {
return toAjax(iPerfDeptSummaryService.updateByBo(bo));
}
/**
* 保存车间月度汇总(按 deptId + period 自动新增或更新)
* 前端统计页使用:将当前页面计算/展示的汇总数据落库到 perf_dept_summary 表。
*/
@Log(title = "车间月度汇总", businessType = BusinessType.OTHER)
@RepeatSubmit()
@PostMapping("/saveByPeriod")
public R<Void> saveByPeriod(@RequestBody PerfDeptSummaryBo bo) {
return toAjax(iPerfDeptSummaryService.saveByDeptPeriod(bo));
}
/**
* 删除车间月度汇总
*

View File

@@ -46,4 +46,9 @@ public interface IPerfDeptSummaryService {
* 校验并批量删除车间月度汇总信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 按 deptId + period 保存汇总(存在则更新,不存在则新增)
*/
Boolean saveByDeptPeriod(PerfDeptSummaryBo bo);
}

View File

@@ -18,6 +18,7 @@ import com.klp.perf.service.IPerfDeptSummaryService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.Objects;
/**
* 车间月度汇总Service业务层处理
@@ -121,4 +122,27 @@ public class PerfDeptSummaryServiceImpl implements IPerfDeptSummaryService {
}
return baseMapper.deleteBatchIds(ids) > 0;
}
/**
* 按 deptId + period 保存汇总(存在则更新,不存在则新增)
* 用于前端“统计页保存汇总”按钮:将页面计算出的数据落库到 perf_dept_summary 表。
*/
@Override
public Boolean saveByDeptPeriod(PerfDeptSummaryBo bo) {
if (bo == null || bo.getDeptId() == null || StringUtils.isBlank(bo.getPeriod())) {
return false;
}
if (bo.getId() != null) {
return updateByBo(bo);
}
PerfDeptSummary existed = baseMapper.selectOne(Wrappers.<PerfDeptSummary>lambdaQuery()
.eq(PerfDeptSummary::getDeptId, bo.getDeptId())
.eq(PerfDeptSummary::getPeriod, bo.getPeriod())
.last("limit 1"));
if (Objects.nonNull(existed)) {
bo.setId(existed.getId());
return updateByBo(bo);
}
return insertByBo(bo);
}
}