From fa3428b4bb32179a42d5618357c22fe2695716ae Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期三, 22 四月 2026 13:58:23 +0800
Subject: [PATCH] 修改全局的注入方式
---
src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java | 50 ++++++++++++++++++++++++++++++++------------------
1 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
index 5f399ca..a141327 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
@@ -5,9 +5,11 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto;
+import com.ruoyi.aftersalesservice.dto.CountDto;
import com.ruoyi.aftersalesservice.mapper.AfterSalesServiceMapper;
import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.aftersalesservice.service.AfterSalesServiceService;
+import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.SysDept;
@@ -19,11 +21,9 @@
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
-import com.ruoyi.sales.service.impl.SalesLedgerProductServiceImpl;
-import com.ruoyi.sales.service.impl.SalesLedgerServiceImpl;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -36,26 +36,20 @@
*/
@Service
@Slf4j
+@RequiredArgsConstructor
public class AfterSalesServiceServiceImpl extends ServiceImpl<AfterSalesServiceMapper, AfterSalesService> implements AfterSalesServiceService {
- @Autowired
- private AfterSalesServiceMapper afterSalesServiceMapper;
-
- @Autowired
- private SysDeptMapper sysDeptMapper;
-
- @Autowired
- private SysUserMapper sysUserMapper;
- @Autowired
- private ISalesLedgerProductService salesLedgerProductService;
- @Autowired
- private ISalesLedgerService salesLedgerService;
+ private final AfterSalesServiceMapper afterSalesServiceMapper;
+ private final SysDeptMapper sysDeptMapper;
+ private final SysUserMapper sysUserMapper;
+ private final ISalesLedgerProductService salesLedgerProductService;
+ private final ISalesLedgerService salesLedgerService;
@Override
- public IPage<AfterSalesService> listPage(Page page, AfterSalesService afterSalesService) {
+ public IPage<AfterSalesServiceNewDto> listPage(Page page, AfterSalesServiceNewDto afterSalesService) {
Long tenantId = SecurityUtils.getLoginUser().getTenantId();
SysDept sysDept = sysDeptMapper.selectDeptById(tenantId);
- IPage<AfterSalesService> afterSalesServiceIPage = afterSalesServiceMapper.listPage(page, afterSalesService);
+ IPage<AfterSalesServiceNewDto> afterSalesServiceIPage = afterSalesServiceMapper.listPage(page, afterSalesService);
afterSalesServiceIPage.getRecords().forEach(item -> {
item.setDeptName(sysDept.getDeptName());
});
@@ -74,6 +68,10 @@
SysUser sysUser = sysUserMapper.selectUserById(afterSalesServiceNewDto.getCheckUserId());
if(sysUser == null) throw new RuntimeException("瀹℃牳浜轰笉瀛樺湪");
afterSalesServiceNewDto.setCheckNickName(sysUser.getNickName());
+ if (StringUtils.isEmpty(afterSalesServiceNewDto.getAfterSalesServiceNo())) {
+ String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_");
+ afterSalesServiceNewDto.setAfterSalesServiceNo(string);
+ }
return this.save(afterSalesServiceNewDto);
}
@@ -82,7 +80,7 @@
AfterSalesService afterSalesService = afterSalesServiceMapper.selectById(id);
SalesLedger byId = salesLedgerService.getById(afterSalesService.getSalesLedgerId());
List<Long> collect = Arrays.stream(afterSalesService.getProductModelIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
- List<SalesLedgerProduct> list = salesLedgerProductService.list(new QueryWrapper<SalesLedgerProduct>().lambda().in(SalesLedgerProduct::getProductModelId, collect));
+ List<SalesLedgerProduct> list = salesLedgerProductService.list(new QueryWrapper<SalesLedgerProduct>().lambda().in(SalesLedgerProduct::getId, collect));
AfterSalesServiceNewDto afterSalesServiceNewDto = new AfterSalesServiceNewDto();
BeanUtils.copyProperties(afterSalesService, afterSalesServiceNewDto);
SalesLedgerDto salesLedgerDto = new SalesLedgerDto();
@@ -91,4 +89,20 @@
afterSalesServiceNewDto.setSalesLedgerDto(salesLedgerDto);
return afterSalesServiceNewDto;
}
+
+ @Override
+ public List<CountDto> countAfterSalesService() {
+ List<CountDto> stringIntegerHashMap = afterSalesServiceMapper.countAfterSalesService();
+ Integer total = 0;
+ for (CountDto countDto : stringIntegerHashMap) {
+ total += countDto.getCount();
+ }
+ CountDto countDto = new CountDto();
+ countDto.setStatus(3);
+ countDto.setCount(total);
+ stringIntegerHashMap.add(countDto);
+
+ return stringIntegerHashMap;
+
+ }
}
--
Gitblit v1.9.3