问题修复
This commit is contained in:
parent
d1d997734e
commit
cccd16603f
|
|
@ -200,10 +200,14 @@ public class OptionalEbomApi extends BaseApi {
|
|||
dto.setParentRowId(null);
|
||||
}
|
||||
|
||||
if(this.optionalEbomImportChildService.insertOption(dto)){
|
||||
return ResultVO.success(true);
|
||||
}else{
|
||||
return ResultVO.error(STATE.Error,"添加配置失败");
|
||||
try {
|
||||
if (this.optionalEbomImportChildService.insertOption(dto)) {
|
||||
return ResultVO.success(true);
|
||||
} else {
|
||||
return ResultVO.error(STATE.Error, "添加配置失败");
|
||||
}
|
||||
}catch (NflgBusinessException e){
|
||||
return ResultVO.error(e.getState(), e.getMsg());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.alibaba.excel.write.handler.CellWriteHandler;
|
|||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
|
|
@ -141,10 +142,13 @@ public class EasyExcelUtil {
|
|||
|
||||
|
||||
public static void setExportHeader(HttpServletResponse response, String fileName) throws Exception {
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
// response.setCharacterEncoding("utf-8");
|
||||
// fileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
// response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
|
||||
EecExcelUtil.setResponseExcelHeader(response, fileName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
|
|
@ -15,17 +16,17 @@ import com.nflg.product.bomnew.pojo.dto.OptionalEbomImportChildAddDTO;
|
|||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomImportChildDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDelDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.OptionalEbomImportChildQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +35,10 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class OptionalEbomImportChildService extends ServiceImpl<OptionalEbomImportChildMapper, OptionalEbomImportChildEntity> {
|
||||
|
||||
|
||||
@Resource
|
||||
private OptionalEbomImportService optionalEbomImportService;
|
||||
|
||||
public List<OptionalEbomImportChildVO> getByRootRowIdList(Long rootRowId) {
|
||||
return getBaseMapper().getByRootRowIdList(rootRowId);
|
||||
}
|
||||
|
|
@ -52,12 +57,25 @@ public class OptionalEbomImportChildService extends ServiceImpl<OptionalEbomImpo
|
|||
*/
|
||||
public Boolean insertOption(OptionalEbomImportChildAddDTO dto) throws NflgBusinessException {
|
||||
|
||||
//选配检查parentId是否存在
|
||||
if ( Objects.equals(dto.getPartType(), OptionalBomConstant.PartTypeEnum.PART_TYPE_RADIO.getValue())){
|
||||
|
||||
OptionalEbomImportEntity optionalEbomImportEntity =optionalEbomImportService.getById(dto.getParentRowId());
|
||||
if(optionalEbomImportEntity==null){
|
||||
throw new NflgBusinessException(STATE.BusinessError,"添加数据的选项id未找到");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String nos = dto.getDrawingNo();
|
||||
//先统一后分割
|
||||
String[] array = nos.replace(";", ";").split(";");
|
||||
List<String> listNo = Arrays.stream(array).collect(Collectors.toList());
|
||||
|
||||
List<BaseMaterialVO> materialListVo = SpringUtil.getBean(MaterialMainService.class).initMaterialForAnyNo(listNo);
|
||||
if(CollectionUtil.isEmpty(materialListVo)){
|
||||
throw new NflgBusinessException(STATE.BusinessError,"未查询到图号/物料相关数据");
|
||||
}
|
||||
List<OptionalEbomImportChildEntity> optionList = Convert.convert(new TypeReference<List<OptionalEbomImportChildEntity>>() {
|
||||
}, materialListVo);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue