From 1def07febf17e36217228569a0b4352adaae6189 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期二, 23 四月 2024 11:52:03 +0800
Subject: [PATCH] 保修数量修改
---
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java | 124 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 124 insertions(+), 0 deletions(-)
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java
index 02b0f8c..1082564 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java
@@ -1,11 +1,29 @@
package org.jeecg.modules.mdc.service.impl;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto;
import org.jeecg.modules.mdc.entity.MdcProcessQuantity;
import org.jeecg.modules.mdc.mapper.MdcProcessQuantityMapper;
+import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcProcessQuantityService;
+import org.jeecg.modules.mdc.vo.MdcProcessQuantityVo;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.stereotype.Service;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
@@ -17,4 +35,110 @@
@Service
public class MdcProcessQuantityServiceImpl extends ServiceImpl<MdcProcessQuantityMapper, MdcProcessQuantity> implements IMdcProcessQuantityService {
+ @Resource
+ private IMdcEquipmentService mdcEquipmentService;
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ *
+ * @param userId
+ * @param page
+ * @param mdcProcessQuantity
+ * @param req
+ * @return
+ */
+ @Override
+ public IPage<MdcProcessQuantityDto> pageList(String userId, Page<MdcProcessQuantityDto> page, MdcProcessQuantityVo mdcProcessQuantity, HttpServletRequest req) {
+ List<String> equipmentIds = new ArrayList<>();
+ if (StringUtils.isNotEmpty(mdcProcessQuantity.getParentId()) && StringUtils.isEmpty(mdcProcessQuantity.getEquipmentId())) {
+ if ("2".equals(mdcProcessQuantity.getTypeTree())) {
+ //閮ㄩ棬灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcProcessQuantity.getParentId());
+ } else {
+ //浜х嚎灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProcessQuantity.getParentId());
+ }
+ } else if (StringUtils.isNotEmpty(mdcProcessQuantity.getEquipmentId())) {
+ //鍗曞彴璁惧淇℃伅
+ mdcProcessQuantity.setMdcSectionIds(Collections.singletonList(mdcProcessQuantity.getEquipmentId()));
+ } else {
+ //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭�
+ if ("2".equals(mdcProcessQuantity.getTypeTree())) {
+ //閮ㄩ棬灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
+ } else {
+ //浜х嚎灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
+ }
+ }
+
+ if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) {
+ mdcProcessQuantity.setMdcSectionIds(equipmentIds);
+ }
+
+ if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) {
+ return null;
+ }
+ return this.baseMapper.pageList(page, mdcProcessQuantity);
+ }
+
+ /**
+ * 瀵煎嚭
+ *
+ * @param userId
+ * @param mdcProcessQuantity
+ * @return
+ */
+ @Override
+ public ModelAndView exportXls(String userId, MdcProcessQuantityVo mdcProcessQuantity) {
+ List<String> equipmentIds = new ArrayList<>();
+ if (StringUtils.isNotEmpty(mdcProcessQuantity.getParentId()) && StringUtils.isEmpty(mdcProcessQuantity.getEquipmentId())) {
+ if ("2".equals(mdcProcessQuantity.getTypeTree())) {
+ //閮ㄩ棬灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcProcessQuantity.getParentId());
+ } else {
+ //浜х嚎灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProcessQuantity.getParentId());
+ }
+ } else if (StringUtils.isNotEmpty(mdcProcessQuantity.getEquipmentId())) {
+ //鍗曞彴璁惧淇℃伅
+ mdcProcessQuantity.setMdcSectionIds(Collections.singletonList(mdcProcessQuantity.getEquipmentId()));
+ } else {
+ //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭�
+ if ("2".equals(mdcProcessQuantity.getTypeTree())) {
+ //閮ㄩ棬灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
+ } else {
+ //浜х嚎灞傜骇
+ equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
+ }
+ }
+ if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) {
+ mdcProcessQuantity.setMdcSectionIds(equipmentIds);
+ }
+ if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) {
+ return null;
+ }
+ // Step.2 AutoPoi 瀵煎嚭Excel
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+ List<MdcProcessQuantityDto> processQuantityDtos = this.baseMapper.list(mdcProcessQuantity);
+ // 瀵煎嚭鏂囦欢鍚嶇О
+ mv.addObject(NormalExcelConstants.FILE_NAME, "鍔犲伐鏁伴噺鍒楄〃");
+ mv.addObject(NormalExcelConstants.CLASS, MdcProcessQuantityDto.class);
+ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛
+ //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犲伐鏁伴噺鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "鍔犲伐鏁伴噺"));
+ //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------
+ mv.addObject(NormalExcelConstants.DATA_LIST, processQuantityDtos);
+ return mv;
+ }
+
+ /**
+ * 鏍规嵁id鏌ヨ
+ */
+ @Override
+ public MdcProcessQuantityDto findById(String id) {
+ return this.baseMapper.findById(id);
+ }
}
--
Gitblit v1.9.3