fix: 企标新增报错

This commit is contained in:
2024-07-22 12:00:45 +08:00
parent 642a26d22b
commit f78acf6d73
3 changed files with 15 additions and 40 deletions
@@ -1,33 +1,23 @@
package com.jero.modules.laws.enterprise.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.CommonAPI;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.SysDictItemCore;
import com.jero.modules.activiti.util.ExcelUtils;
import com.jero.modules.laws.common.service.ILawsCommonService;
import com.jero.modules.laws.common.util.ImportUtil;
import com.jero.modules.laws.common.vo.ManyStandardSelectionBox;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlanImport;
import com.jero.modules.laws.enterprise.entity.dto.ESPlanQueryDTO;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardPlanVo;
import com.jero.modules.laws.enterprise.mapper.EnterpriseStandardPlanMapper;
import com.jero.modules.laws.enterprise.service.ESSequenceNumberProvider;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -36,12 +26,10 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ThinkBook
@@ -52,7 +40,7 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = JeroBootException.class)
@Slf4j
public class EnterpriseStandardPlanServiceImpl extends ServiceImpl<EnterpriseStandardPlanMapper, EnterpriseStandardPlan>
implements EnterpriseStandardPlanService, ESSequenceNumberProvider {
implements EnterpriseStandardPlanService {
@Resource
private ImportUtil importUtil;
@@ -126,19 +114,19 @@ public class EnterpriseStandardPlanServiceImpl extends ServiceImpl<EnterpriseSta
}
}
@Override
public List<String> getSequenceNumbers(String esCodeDictValue, String esNameCodeDictValue, String categoryCodeDictValue) {
// 已经存在的标准
LambdaQueryWrapper<EnterpriseStandardPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getEnStandardCode, esCodeDictValue);
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getEnNameCode, esNameCodeDictValue);
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getStandardCategoryCode, categoryCodeDictValue);
lambdaQueryWrapper.isNotNull(EnterpriseStandardPlan::getNewEnStandardNo);
List<EnterpriseStandardPlan> espList = this.list(lambdaQueryWrapper);
return espList.stream().map(EnterpriseStandardPlan::getNewEnStandardNo)
.map(EnterpriseStandardUtil::getSequenceNoFromStandardNo).collect(Collectors.toList());
}
// @Override
// public List<String> getSequenceNumbers(String esCodeDictValue, String esNameCodeDictValue, String categoryCodeDictValue) {
// // 已经存在的标准
// LambdaQueryWrapper<EnterpriseStandardPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(EnterpriseStandardPlan::getEnStandardCode, esCodeDictValue);
// lambdaQueryWrapper.eq(EnterpriseStandardPlan::getEnNameCode, esNameCodeDictValue);
// lambdaQueryWrapper.eq(EnterpriseStandardPlan::getStandardCategoryCode, categoryCodeDictValue);
// lambdaQueryWrapper.isNotNull(EnterpriseStandardPlan::getNewEnStandardNo);
// List<EnterpriseStandardPlan> espList = this.list(lambdaQueryWrapper);
//
// return espList.stream().map(EnterpriseStandardPlan::getNewEnStandardNo)
// .map(EnterpriseStandardUtil::getSequenceNoFromStandardNo).collect(Collectors.toList());
// }
@Override
public void importAnnualRevisionPlan(MultipartFile file, HttpServletResponse response) throws IOException {
@@ -13,7 +13,6 @@ import com.jero.modules.activiti.service.ProcessAllService;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
import com.jero.modules.laws.enterprise.service.ESSequenceNumberProvider;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import lombok.extern.slf4j.Slf4j;
@@ -47,9 +46,6 @@ public class EnterpriseStandardUtil {
@Resource
private ILawsEnterpriseStandardService esService;
@Resource
private EnterpriseStandardPlanService espService;
@Resource
private ProcessAllService processAllService;
@@ -82,7 +78,7 @@ public class EnterpriseStandardUtil {
if (!sortedNumbers.isEmpty()) {
expectedNumber = sortedNumbers.get(sortedNumbers.size() - 1) + 1; // 获取最大的数字并+1
}
return String.format("%04d", expectedNumber);
return String.format("%03d", expectedNumber);
}
/**
@@ -322,12 +318,6 @@ public class EnterpriseStandardUtil {
esWrapper.eq(LawsEnterpriseStandard::getDelFlag, YesOrNoEnum.NO.getInteger());
List<String> numList = esService.list(esWrapper)
.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList());
// 判断是否和企标计划库中重复
LambdaQueryWrapper<EnterpriseStandardPlan> planWrapper = new LambdaQueryWrapper<>();
planWrapper.in(EnterpriseStandardPlan::getNewEnStandardNo, standardNumbers);
planWrapper.eq(EnterpriseStandardPlan::getDelFlag, YesOrNoEnum.NO.getInteger());
numList.addAll(espService.list(planWrapper)
.stream().map(EnterpriseStandardPlan::getNewEnStandardNo).collect(Collectors.toList()));
// 判断是否和立项流程中重复
// 已经撤回的立项流程不需要判断重复
LambdaQueryWrapper<ProcessAll> processAllLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.activiti.process.common.enums.StandardStateEnum;
import com.jero.modules.laws.localTool.entity.StandardEarlyWarning;
import com.jero.modules.laws.localTool.mapper.LawsStandardEarlyWarningMapper;
import com.jero.modules.laws.localTool.service.ILawsStandardEarlyWarningService;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
@@ -32,8 +31,6 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
private ILawsDomesticStandardService domesticStandardService;
@Resource
private ILawsEnterpriseStandardService enterpriseStandardService;
@Resource
private LawsStandardEarlyWarningMapper lawsStandardEarlyWarningMapper;
/**
* @Author: liao