|
@@ -6,8 +6,10 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.ledger.entity.WfSubscription;
|
|
|
import com.xjrsoft.module.oa.entity.OfficialDocumentReceived;
|
|
|
+import com.xjrsoft.module.oa.mapper.OfficialDocumentPostMapper;
|
|
|
import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedMapper;
|
|
|
import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedService;
|
|
|
+import com.xjrsoft.module.oa.utils.PostNumberUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -29,40 +31,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class OfficialDocumentReceivedServiceImpl extends MPJBaseServiceImpl<OfficialDocumentReceivedMapper, OfficialDocumentReceived> implements IOfficialDocumentReceivedService {
|
|
|
+ private final OfficialDocumentReceivedMapper officialDocumentReceivedMapper;
|
|
|
@Override
|
|
|
- public Boolean dataHandle(Long formId) {
|
|
|
- OfficialDocumentReceived officialDocumentReceived = this.getById(formId);
|
|
|
-
|
|
|
- if (officialDocumentReceived != null) {
|
|
|
-
|
|
|
- Date receivedDate = officialDocumentReceived.getReceivedDate();
|
|
|
- LocalDate localDate = receivedDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
-
|
|
|
- String year = String.valueOf(localDate.getYear());
|
|
|
-
|
|
|
- //获取当前内存中的最大编号
|
|
|
- LambdaQueryWrapper<OfficialDocumentReceived> officialDocumentReceivedLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- officialDocumentReceivedLambdaQueryWrapper
|
|
|
- .select(OfficialDocumentReceived.class, x -> VoToColumnUtil.fieldsToColumns(OfficialDocumentReceived.class).contains(x.getProperty()))
|
|
|
- .likeRight(OfficialDocumentReceived::getReceivedNumber, year)
|
|
|
- .orderByDesc(OfficialDocumentReceived::getReceivedNumber)
|
|
|
- .last("limit 1");
|
|
|
- OfficialDocumentReceived officialDocumentReceivedMax = this.getOne(officialDocumentReceivedLambdaQueryWrapper);
|
|
|
-
|
|
|
- OfficialDocumentReceived officialDocumentReceivedNew = new OfficialDocumentReceived();
|
|
|
- officialDocumentReceivedNew.setId(officialDocumentReceived.getId());
|
|
|
- if (officialDocumentReceivedMax != null) {
|
|
|
- String number = officialDocumentReceivedMax.getReceivedNumber();
|
|
|
-
|
|
|
- int num = Integer.parseInt(number);
|
|
|
- num = num + 1;
|
|
|
-
|
|
|
- officialDocumentReceivedNew.setReceivedNumber(String.valueOf(num));
|
|
|
- } else {
|
|
|
- officialDocumentReceivedNew.setReceivedNumber(year + "001");
|
|
|
- }
|
|
|
- return this.updateById(officialDocumentReceivedNew);
|
|
|
- }
|
|
|
- return true;
|
|
|
+ public String getMaxReceivedNumber() {
|
|
|
+ Integer maxReceivedNumber = officialDocumentReceivedMapper.getMaxReceivedNumber();
|
|
|
+ return PostNumberUtil.initMaxPostNumber(maxReceivedNumber, 3);
|
|
|
}
|
|
|
}
|