From 1d68d2eec415e5f4ef508033ded1dbead1d300ae Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期四, 09 四月 2026 14:12:39 +0800
Subject: [PATCH] feat(staff): 支持默认密码设置并完善用户信息关联
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 0e9f52f..e46f2cf 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -2,6 +2,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
@@ -52,6 +53,7 @@
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.stereotype.Service;
@@ -107,21 +109,8 @@
private final CommonFileServiceImpl commonFileService;
private final ShippingInfoMapper shippingInfoMapper;
private final InvoiceLedgerMapper invoiceLedgerMapper;
- private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
- private final SalesLedgerWorkMapper salesLedgerWorkMapper;
- private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
private final InvoiceRegistrationMapper invoiceRegistrationMapper;
- private final ProductOrderMapper productOrderMapper;
- private final ProcessRouteMapper processRouteMapper;
- private final ProductProcessRouteMapper productProcessRouteMapper;
- private final ProcessRouteItemMapper processRouteItemMapper;
- private final ProductProcessRouteItemMapper productProcessRouteItemMapper;
- private final ProductWorkOrderMapper productWorkOrderMapper;
- private final ProductionProductMainMapper productionProductMainMapper;
- private final ProductionProductOutputMapper productionProductOutputMapper;
- private final ProductionProductInputMapper productionProductInputMapper;
- private final QualityInspectMapper qualityInspectMapper;
private final RedisTemplate<String, String> redisTemplate;
@Autowired
private SysDeptMapper sysDeptMapper;
@@ -135,8 +124,9 @@
@Autowired
private ProductStructureMapper productStructureMapper;
@Autowired
+ @Lazy
private ProductionProductMainService productionProductMainService;
- ;
+
@Autowired
private SysUserMapper sysUserMapper;
@@ -681,7 +671,7 @@
salesLedger.setTenantId(customer.getTenantId());
// 3. 鏂板鎴栨洿鏂颁富琛�
if (salesLedger.getId() == null) {
- String contractNo = generateSalesContractNo();
+ String contractNo = generateSalesContractNoBy8Date();
salesLedger.setSalesContractNo(contractNo);
salesLedgerMapper.insert(salesLedger);
} else {
@@ -825,6 +815,20 @@
return entity;
}
+ public String generateSalesContractNoBy8Date(){
+ String yyMM = DateUtil.format(new Date(), "yyMM");
+ // 鏌ヨ涓�涓湀鏈夊灏戣鍗�
+ Date begin = DateUtil.beginOfMonth(new Date());
+ Date end = DateUtil.endOfMonth(new Date());
+ LambdaQueryWrapper<SalesLedger> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.between(SalesLedger::getEntryDate, begin, end);
+ long count = salesLedgerMapper.selectCount(queryWrapper);
+ Long seq = Optional.of(count).orElse(0L) + 1;
+ return String.format("%s%04d", yyMM, seq);
+ }
+
+
+
@Transactional(readOnly = true)
public String generateSalesContractNo() {
LocalDate currentDate = LocalDate.now();
--
Gitblit v1.9.3