|
|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
package org.dromara.oa.erp.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
import org.dromara.system.api.RemoteCodeRuleService;
|
|
|
|
|
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
@ -48,6 +50,9 @@ public class ErpTimesheetSummaryServiceImpl implements IErpTimesheetSummaryServi
|
|
|
|
|
private final ErpTimesheetSummaryDetailMapper detailMapper;
|
|
|
|
|
private final ErpTimesheetStandardMonthMapper standardMonthMapper;
|
|
|
|
|
|
|
|
|
|
@DubboReference
|
|
|
|
|
private RemoteCodeRuleService remoteCodeRuleService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询月汇总工时信息
|
|
|
|
|
*
|
|
|
|
|
@ -119,23 +124,9 @@ public class ErpTimesheetSummaryServiceImpl implements IErpTimesheetSummaryServi
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean insertByBo(ErpTimesheetSummaryBo bo) {
|
|
|
|
|
if (StringUtils.isBlank(bo.getSummaryCode())) {
|
|
|
|
|
// 生成规则:TS + 月份代码(yyyyMM) + 4位递增序列(0001)
|
|
|
|
|
String prefix = "TS" + bo.getMonthCode();
|
|
|
|
|
ErpTimesheetSummary lastOne = baseMapper.selectOne(new LambdaQueryWrapper<ErpTimesheetSummary>()
|
|
|
|
|
.likeRight(ErpTimesheetSummary::getSummaryCode, prefix)
|
|
|
|
|
.orderByDesc(ErpTimesheetSummary::getSummaryCode)
|
|
|
|
|
.last("limit 1"));
|
|
|
|
|
int nextNum = 1;
|
|
|
|
|
if (lastOne != null) {
|
|
|
|
|
String lastCode = lastOne.getSummaryCode();
|
|
|
|
|
if (lastCode.length() >= 4) {
|
|
|
|
|
try {
|
|
|
|
|
nextNum = Integer.parseInt(lastCode.substring(lastCode.length() - 4)) + 1;
|
|
|
|
|
} catch (NumberFormatException ignored) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
bo.setSummaryCode(prefix + String.format("%04d", nextNum));
|
|
|
|
|
// 使用远程编码规则服务生成编号
|
|
|
|
|
String summaryCode = remoteCodeRuleService.selectCodeRuleCode("1033");
|
|
|
|
|
bo.setSummaryCode(summaryCode);
|
|
|
|
|
}
|
|
|
|
|
if (bo.getUserId() == null) {
|
|
|
|
|
bo.setUserId(LoginHelper.getUserId());
|
|
|
|
|
|