From 15032d66c35c8154316a4f0170f3b6f470bf4c50 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 29 四月 2026 18:01:20 +0800
Subject: [PATCH] fix:1.报工合格数量更改
---
src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java | 110 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 85 insertions(+), 25 deletions(-)
diff --git a/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java b/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java
index d3c4bed..5f4c3a8 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java
@@ -2,70 +2,109 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceExeclDto;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto;
import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.aftersalesservice.service.AfterSalesServiceService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption;
+import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.service.ISalesLedgerService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
* @author :yys
* @date : 2025/7/30 9:27
*/
@RestController
-@Api(tags = "鍞悗鏈嶅姟")
+@Tag(name = "鍞悗鏈嶅姟")
@RequestMapping("/afterSalesService")
+@AllArgsConstructor
public class AfterSalesServiceController extends BaseController {
- @Autowired
private AfterSalesServiceService afterSalesServiceService;
-
- @Autowired
private SysUserMapper sysUserMapper;
+ private ISalesLedgerService salesLedgerService;
@GetMapping("/listPage")
- @ApiOperation("鍞悗鏈嶅姟-鍒嗛〉鏌ヨ")
+ @Operation(summary = "鍞悗鏈嶅姟-鍒嗛〉鏌ヨ")
@Log(title = "鍞悗鏈嶅姟-鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
- public AjaxResult listPage(Page page, AfterSalesService afterSalesService) {
- IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService);
+ public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) {
+ IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService);
return AjaxResult.success(listPage);
}
+ @Log(title = "鍞悗鏈嶅姟-鍙嶉鐧昏", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ @Operation(summary = "鍞悗鏈嶅姟-鍙嶉鐧昏")
+ public void export(HttpServletResponse response) {
+ Page page = new Page(-1,-1);
+ AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto();
+ IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService);
+ List<AfterSalesServiceExeclDto> list = new ArrayList<>();
+ listPage.getRecords().forEach(item -> {
+ AfterSalesServiceExeclDto dto = new AfterSalesServiceExeclDto();
+ BeanUtils.copyProperties(item, dto);
+ dto.setStatusName(item.getStatus().toString());
+ list.add(dto);
+ });
+ ExcelUtil<AfterSalesServiceExeclDto> util = new ExcelUtil<AfterSalesServiceExeclDto>(AfterSalesServiceExeclDto.class);
+ util.exportExcel(response, list , "鍙嶉鐧昏");
+ }
+
+ @Log(title = "鍞悗鏈嶅姟-鍞悗澶勭悊", businessType = BusinessType.EXPORT)
+ @PostMapping("/exportTwo")
+ @Operation(summary = "鍞悗鏈嶅姟-鍞悗澶勭悊")
+ public void exportTwo(HttpServletResponse response) {
+ Page page = new Page(-1,-1);
+ AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto();
+ IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService);
+ listPage.getRecords().forEach(item -> {
+ item.setStatusName(item.getStatus().toString());
+ });
+ ExcelUtil<AfterSalesServiceNewDto> util = new ExcelUtil<AfterSalesServiceNewDto>(AfterSalesServiceNewDto.class);
+ util.exportExcel(response, listPage.getRecords() , "鍞悗澶勭悊");
+ }
+
@PostMapping("/add")
- @ApiOperation("鍞悗鏈嶅姟-鏂板")
+ @Operation(summary = "鍞悗鏈嶅姟-鏂板")
@Log(title = "鍞悗鏈嶅姟-鏂板", businessType = BusinessType.INSERT)
- public AjaxResult add(@RequestBody AfterSalesService afterSalesService) {
- afterSalesService.setStatus(1);
- SysUser sysUser = sysUserMapper.selectUserById(afterSalesService.getCheckUserId());
- if(sysUser == null) throw new RuntimeException("瀹℃牳浜轰笉瀛樺湪");
- afterSalesService.setCheckNickName(sysUser.getNickName());
- boolean save = afterSalesServiceService.save(afterSalesService);
- return save ? AjaxResult.success() : AjaxResult.error();
+ public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) {
+ return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error();
}
@PostMapping("/update")
- @ApiOperation("鍞悗鏈嶅姟-淇敼")
+ @Operation(summary = "鍞悗鏈嶅姟-淇敼")
@Log(title = "鍞悗鏈嶅姟-淇敼", businessType = BusinessType.UPDATE)
- public AjaxResult update(@RequestBody AfterSalesService afterSalesService) {
- boolean update = afterSalesServiceService.updateById(afterSalesService);
+ public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) {
+ if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) {
+ String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream()
+ .map(String::valueOf)
+ .collect(Collectors.joining(","));
+ afterSalesServiceNewDto.setProductModelIds(productModelIds);
+ }
+ boolean update = afterSalesServiceService.updateById(afterSalesServiceNewDto);
return update ? AjaxResult.success() : AjaxResult.error();
}
@DeleteMapping("/delete")
- @ApiOperation("鍞悗鏈嶅姟-鍒犻櫎")
+ @Operation(summary = "鍞悗鏈嶅姟-鍒犻櫎")
@Log(title = "鍞悗鏈嶅姟-鍒犻櫎", businessType = BusinessType.DELETE)
public AjaxResult delete(@RequestBody List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
@@ -76,7 +115,7 @@
}
@PostMapping("/dispose")
- @ApiOperation("鍞悗鏈嶅姟-澶勭悊")
+ @Operation(summary = "鍞悗鏈嶅姟-澶勭悊")
@Log(title = "鍞悗鏈嶅姟-澶勭悊", businessType = BusinessType.UPDATE)
public AjaxResult dispose(@RequestBody AfterSalesService afterSalesService) {
AfterSalesService byId = afterSalesServiceService.getById(afterSalesService.getId());
@@ -85,9 +124,30 @@
SysUser sysUser = sysUserMapper.selectUserById(afterSalesService.getDisposeUserId());
if(sysUser == null) throw new RuntimeException("澶勭悊浜轰笉瀛樺湪");
afterSalesService.setDisposeNickName(sysUser.getNickName());
+ afterSalesService.setStatus(2);
boolean update = afterSalesServiceService.updateById(afterSalesService);
return update ? AjaxResult.success() : AjaxResult.error();
}
+ @GetMapping("listSalesLedger")
+ @Operation(summary = "鍞悗鏈嶅姟-鑾峰彇閿�鍞彴璐�")
+ public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) {
+ IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page);
+ return AjaxResult.success(list);
+ }
+
+
+ @GetMapping("getById")
+ @Operation(summary = "鍞悗鏈嶅姟-鏍规嵁id鑾峰彇璇︽儏")
+ public AjaxResult getById(Long id) {
+ return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id));
+ }
+
+ @Operation(summary = "鍞悗鏈嶅姟-缁熻宸ュ崟鎯呭喌")
+ @GetMapping("count")
+ public AjaxResult count() {
+ return AjaxResult.success(afterSalesServiceService.countAfterSalesService());
+ }
+
}
--
Gitblit v1.9.3