xiongchao 3 سال پیش
والد
کامیت
f10992fac7

+ 2 - 2
platform-dao/src/main/java/com/platform/dao/enums/SbInfoChildEnum.java

@@ -14,11 +14,11 @@ import lombok.Getter;
 public enum SbInfoChildEnum {
 
     /**
-     * 子
+     * 子设备
      */
     IS_CHILD(1),
     /**
-     * 父
+     * 父设备
      */
     IS_PARENT(2),
     /**

+ 112 - 57
platform-dao/src/main/java/com/platform/dao/util/CustomExcelImportUtil.java

@@ -11,6 +11,8 @@ import com.platform.dao.entity.sb.SbModel;
 import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
 import com.platform.dao.entity.store.SpareStore;
 import com.platform.dao.enums.CheckStandardTypeEnum;
+import com.platform.dao.enums.SbInfoChildEnum;
+import com.platform.dao.enums.SbInfoShowEnum;
 import com.platform.dao.vo.export.sb.ExportSbInfoVO;
 import com.platform.dao.vo.query.sparepartmanage.SparePartInfoVO;
 import com.platform.dao.vo.sb.SbInfoVO;
@@ -458,34 +460,12 @@ public class CustomExcelImportUtil {
     }
 
     public static void main(String[] args) throws IOException, InvalidFormatException {
-        /*String[] files = {"C:\\Users\\cyz\\Desktop\\设备管理软件初始化数据准备-苏丹分公司-0123\\乌干达\\设备管理软件初始化数据准备-乌干达7.3KM项目-0129-备件.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达111项目-0125-备件.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达MBRARA项目-0130-备件.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达六桥项目-0128-备件.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达四桥项目-0129-备件.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-利比里亚-1225-备件.xlsx"};
-        */
-        /*String[] files = {"C:\\Users\\cyz\\Desktop\\设备管理软件初始化数据准备-苏丹分公司-0123\\乌干达\\设备管理软件初始化数据准备-乌干达7.3KM项目-0129-设备.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达111项目-0125-设备.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达MBRARA项目-0130-设备.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达六桥项目-0128-设备.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达四桥项目-0129-设备.xlsx",
-                "C:\\\\Users\\\\cyz\\\\Desktop\\\\设备管理软件初始化数据准备-苏丹分公司-0123\\\\乌干达\\\\设备管理软件初始化数据准备-乌干达办事处-设备.xlsx"};
-*/
-       /* String[] files = {"C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-东帝汶.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-肯尼亚.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-利比里亚.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-卢旺达.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-孟加拉.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-苏丹.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-坦桑尼亚.xls",
-                "C:\\Users\\cyz\\Desktop\\固定资产0207(1)\\固定资产折旧明细表-2020年12月-苏丹.xls"};*/
-        String[] files = {"C:\\Users\\cyz\\Desktop\\C-001 (OS-M235) - 副本.xls"};
+        String[] files = {"C:\\Users\\cyz\\Downloads\\设备基础信息20210627125310010.xls"};
         InputStream inputstream = new FileInputStream(files[0]);
         LocalDateTime now = LocalDateTime.now();
        //  List<SparePartInfoVO> list = importSparePartInfoList(now, inputstream);
-        // List<SbInfoVO> list = importSbInfoList(inputstream);
-        List<CheckStandard> list = importCheckStandardList(inputstream);
+        List<SbInfoVO> list = importListByUpdateALl(inputstream);
+       // List<CheckStandard> list = importCheckStandardList(inputstream);
 
         list.forEach(item -> {
             System.out.println(item.toString());
@@ -909,6 +889,16 @@ public class CustomExcelImportUtil {
                 }
                 record.setStatus(getSbInfoStatus(row.getCell(18).getStringCellValue()));
                 record.setRemark(row.getCell(19).getStringCellValue().trim());
+                System.out.println("row.getPhysicalNumberOfCells(): " + row.getPhysicalNumberOfCells());
+                // 主子设备和是否大屏显示
+                if(row.getPhysicalNumberOfCells()>20){
+                    record.setIsChild(getChild(row.getCell(20).getStringCellValue().trim()));
+                    record.setIsShow(getShow(row.getCell(21).getStringCellValue().trim()));
+                    record.setPositionId(row.getCell(22).getStringCellValue().trim());
+                }else{// 默认值
+                    record.setIsChild(SbInfoChildEnum.IS_NORMAL.getValue());
+                    record.setIsShow(SbInfoShowEnum.NOT_SHOW.getValue());
+                }
 
             } catch (Exception e) {
                 error.append(index).append(",");
@@ -923,6 +913,28 @@ public class CustomExcelImportUtil {
         return result;
     }
 
+    private static Integer getChild(String trim) {
+        if(StringUtils.isBlank(trim)){
+            return SbInfoChildEnum.IS_NORMAL.getValue();
+        }else if("子设备".equals(trim)){
+            return SbInfoChildEnum.IS_CHILD.getValue();
+        }else  if("父设备".equals(trim)){
+            return SbInfoChildEnum.IS_PARENT.getValue();
+        }else{
+            return SbInfoChildEnum.IS_NORMAL.getValue();
+        }
+    }
+
+    private static Integer getShow(String trim) {
+        if(StringUtils.isBlank(trim)){
+            return SbInfoShowEnum.NOT_SHOW.getValue();
+        }else if("不显示".equals(trim)){
+            return SbInfoShowEnum.NOT_SHOW.getValue();
+        }else{
+            return SbInfoShowEnum.IS_SHOWING.getValue();
+        }
+    }
+
     /**
      * 导入点检标准
      *
@@ -1024,7 +1036,7 @@ public class CustomExcelImportUtil {
 
     }
 
-    public static List<SbInfo> importSbInfoListForUpdateValue(InputStream inputstream) throws IOException, InvalidFormatException {
+    public static List<SbInfoVO> importListByUpdateALl(InputStream inputstream) throws IOException, InvalidFormatException {
         if (inputstream == null) {
             return Collections.emptyList();
         }
@@ -1039,46 +1051,89 @@ public class CustomExcelImportUtil {
         }
         Sheet sheet = book.getSheetAt(0);
         int rowCounts = sheet.getLastRowNum();
-        List<SbInfo> result = new ArrayList<>(rowCounts);
-        SbInfo record = null;
+        List<SbInfoVO> result = new ArrayList<>(rowCounts);
+        SbInfoVO record = null;
 
         StringBuffer error = new StringBuffer();
-        for (int i = 1; i <= rowCounts; i++) {
-            record = new SbInfo();
+        for (int i = 2; i <= rowCounts; i++) {
+            record = new SbInfoVO();
             Row row = sheet.getRow(i);
             String index = row.getCell(1).getStringCellValue() + "";
             try {
                 //i,j i:行 j:列
-                record.setFinancingNo(row.getCell(1).getStringCellValue());
-                record.setInitialValue(new Double(getCellValue(row.getCell(3)).replace(",","")));
-                record.setCutValue(new Double(getCellValue(row.getCell(4)).replace(",","")));
-                double currentValue = BigDecimalUtil.sub(record.getInitialValue(), record.getCutValue());
-                currentValue = currentValue<0?0:currentValue;
-                record.setCurrentValue(currentValue);
-                String startDate = getCellValue(row.getCell(5));
-                if (startDate.contains(".")) {
-                    if (startDate.contains("E7")) {
-                        record.setStartDate(DateUtils.strToLocalDate(startDate.replace(".", "").replace("E7", ""), DateUtils.PATTERNYMD));
-                    } else if (startDate.endsWith(".0")) {
-                        record.setStartDate(DateUtils.strToLocalDate(ExcelDoubleToDate(startDate), DateUtils.PATTERN_YMD));
-                    } else {
-                        record.setStartDate(DateUtils.strToLocalDate(startDate, DateUtils.PATTERN_YMD_DOT));
-                    }
-                } else if (startDate.contains("-")) {
-                    record.setStartDate(DateUtils.strToLocalDate(startDate, DateUtils.PATTERN_YMD));
-                } else {
-                    record.setStartDate(DateUtils.strToLocalDate(startDate, DateUtils.PATTERNYMD));
-                }
-                if("4".equals(getCellValue(row.getCell(6)))){
-                    record.setMonth(new BigDecimal(48));
+                record.setId(row.getCell(0).getStringCellValue().trim());
+                record.setNo(row.getCell(1).getStringCellValue().trim());
+                record.setZbh(getCellValue(row.getCell(2)));
+                record.setName(row.getCell(3).getStringCellValue().trim().replace("'", ""));
+                record.setModel(getCellValue(row.getCell(4)).trim());
+                String level = getCellValue(row.getCell(5));
+                if(StringUtils.isBlank(level)){
+                    record.setLevel(1);
                 }else{
-                    record.setMonth(new BigDecimal(getCellValue(row.getCell(6))));
+                    record.setLevel(getLevel(level));
                 }
-                record.setUsedMonth(new BigDecimal(getCellValue(row.getCell(7))));
-                if(row.getLastCellNum() == 9){
-                    record.setRate(new BigDecimal(getCellValue(row.getCell(8))));
+                String value = getCellValue(row.getCell(6));
+                if(StringUtils.isBlank(value)){
+                    record.setInitialValue(0.0);
                 }else{
-                    record.setRate(new BigDecimal(0));
+                    record.setInitialValue(new Double(value));
+                }
+                record.setTypeName(row.getCell(7).getStringCellValue().trim());
+                record.setUseType(getUseType(row.getCell(8).getStringCellValue().trim()));
+                record.setZz(getCellValue(row.getCell(9)));
+                record.setCph(getCellValue(row.getCell(10)));
+                record.setZzh(getCellValue(row.getCell(11)));
+                record.setProducerId(row.getCell(12).getStringCellValue().trim());
+                record.setSaveUserName(row.getCell(13).getStringCellValue().trim());
+                record.setRepairUserName(row.getCell(14).getStringCellValue().trim());
+                record.setRepairUserNameSecond(row.getCell(15).getStringCellValue().trim());
+                if (StringUtils.isBlank(getCellValue(row.getCell(16)))) {
+                    record.setBuyDate(DateUtils.strToLocalDate("2014-01-01", DateUtils.PATTERN_YMD));
+                } else {
+                    record.setBuyDate(DateUtils.strToLocalDate((getCellValue(row.getCell(16)).substring(0, 4) + "-01-01"), DateUtils.PATTERN_YMD));
+                }
+                if (StringUtils.isBlank(getCellValue(row.getCell(17)))) {
+                    record.setStartDate(DateUtils.strToLocalDate("2019-01-01", DateUtils.PATTERN_YMD));
+                } else {
+                    if (getCellValue(row.getCell(17)).contains(".")) {
+                        if (getCellValue(row.getCell(17)).contains("E7")) {
+                            record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)).replace(".", "").replace("E7", ""), DateUtils.PATTERNYMD));
+                        } else if (getCellValue(row.getCell(17)).endsWith(".0")) {
+                            record.setStartDate(DateUtils.strToLocalDate(ExcelDoubleToDate(getCellValue(row.getCell(17))), DateUtils.PATTERN_YMD));
+                        } else {
+                            record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)), DateUtils.PATTERN_YMD_DOT));
+                        }
+                    } else if (getCellValue(row.getCell(17)).contains("-")) {
+                        record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)), DateUtils.PATTERN_YMD));
+                    } else {
+                        if(getCellValue(row.getCell(17)).contains("/")){
+                            String[] strList = getCellValue(row.getCell(17)).split("/");
+                            if(strList.length == 3){
+                                if(strList[1].length() == 1){
+                                    strList[1] = "0" + strList[1];
+                                }
+                                if(strList[2].length() == 1){
+                                    strList[2] = "0" + strList[2];
+                                }
+                            }
+                            String newDate = strList[0] + "-" + strList[1] + "-" + strList[2];
+                            record.setStartDate(DateUtils.strToLocalDate(newDate, DateUtils.PATTERN_YMD));
+                        }else{
+                            record.setStartDate(DateUtils.strToLocalDate(getCellValue(row.getCell(17)), DateUtils.PATTERNYMD));
+                        }
+                    }
+                }
+                record.setStatus(getSbInfoStatus(row.getCell(18).getStringCellValue()));
+                record.setRemark(row.getCell(19).getStringCellValue().trim());
+                System.out.println("row.getPhysicalNumberOfCells(): " + row.getPhysicalNumberOfCells());
+                // 主子设备和是否大屏显示
+                if(row.getPhysicalNumberOfCells()>20){
+                    record.setIsChild(getChild(row.getCell(20).getStringCellValue().trim()));
+                    record.setIsShow(getShow(row.getCell(21).getStringCellValue().trim()));
+                    record.setPositionId(row.getCell(22).getStringCellValue().trim());
+                }else{// 默认值
+                    record.setIsChild(SbInfoChildEnum.IS_NORMAL.getValue());
+                    record.setIsShow(SbInfoShowEnum.NOT_SHOW.getValue());
                 }
             } catch (Exception e) {
                 error.append(index).append(",");

+ 15 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/sb/ExportSbInfoVO.java

@@ -121,5 +121,20 @@ public class ExportSbInfoVO implements Serializable {
      */
     @Excel(name = "备注", orderNum = "20")
     private String remark;
+    /**
+     * 是否子设备
+     */
+    @Excel(name = "是否子设备", orderNum = "21", dicCode="SB_IS_CHILD")
+    private Integer isChild;
+    /**
+     * 是否大屏显示
+     */
+    @Excel(name = "是否大屏显示", orderNum = "22", dicCode="SB_IS_SHOW")
+    private Integer isShow;
+    /**
+     * 存放位置
+     */
+    @Excel(name = "存放位置", orderNum = "23")
+    private String positionId;
 
 }

+ 1 - 3
platform-rest/src/main/java/com/platform/rest/controller/sb/SbInfoController.java

@@ -286,9 +286,7 @@ public class SbInfoController {
         if(type == 1){
             result = sbInfoService.importListByAdd( file);
         }else if(type == 2){
-            result = sbInfoService.importListByUpdateValue(file);
-        }else{
-            result = sbInfoService.importListByUpdate(file);
+            result = sbInfoService.importListByUpdateALl(file);
         }
         return new R<>(result);
     }

+ 0 - 2
platform-service/src/main/java/com/platform/service/sb/SbInfoService.java

@@ -182,8 +182,6 @@ public interface SbInfoService extends IBaseService<SbInfo, SbInfoDTO> {
     void updateQrCode(SbInfoDTO model);
 
     String importListByAdd(MultipartFile file);
-    String importListByUpdateValue(MultipartFile file);
-    String importListByUpdate(MultipartFile file);
     String importListByUpdateALl(MultipartFile file);
 
     /**

+ 68 - 93
platform-service/src/main/java/com/platform/service/sb/impl/SbInfoServiceImpl.java

@@ -1038,121 +1038,96 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
         }
     }
 
+    /**
+     * 全部参数修改
+     *
+     * @param file
+     * @return
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String importListByUpdateValue(MultipartFile file) {
+    public String importListByUpdateALl(MultipartFile file) {
 
         int addNum = 0;
         List<String> modelError = new ArrayList<String>();
         List<SbInfo> updateList = new ArrayList<SbInfo>();
         try {
-            List<SbInfo> items = CustomExcelImportUtil.importSbInfoListForUpdateValue(file.getInputStream());
+            List<SbInfoVO> items = CustomExcelImportUtil.importListByUpdateALl(file.getInputStream());
             if (!CollectionUtils.isEmpty(items)) {
-                List<SbInfo> list = mapper.selectAll();
-                LocalDateTime now = LocalDateTime.now();
-                for (SbInfo sbInfo : list) {
-                    for (SbInfo item : items) {
-                        if(StringUtils.isNotBlank(item.getFinancingNo())){
-                            if(item.getFinancingNo().equals(sbInfo.getFinancingNo())){
-                                sbInfo.setInitialValue(item.getInitialValue());
-                                sbInfo.setCurrentValue(item.getCurrentValue());
-                                sbInfo.setRate(item.getRate());
-                                sbInfo.setMonth(item.getMonth());
-                                sbInfo.setCutValue(item.getCutValue());
-                                sbInfo.setUsedMonth(item.getUsedMonth());
-                                updateList.add(item);
+                if (!CollectionUtils.isEmpty(items)) {
+                    List<SbInfoVO> addItems = new ArrayList<SbInfoVO>();
+                    List<SysUser> users = sysUserMapper.selectAll();
+                    List<FirmProducer> producerList = firmProducerMapper.selectAll();
+                    LocalDateTime now = LocalDateTime.now();
+                    for (SbInfoVO item : items) {
+                        boolean findSaveUser = false;
+                        for (SysUser user : users) {
+                            if(user.getRealName().equals(item.getSaveUserName())){
+                                item.setSaveUser(user.getUserId());
+                                item.setUseUser(user.getUserId());
+                                findSaveUser = true;
                                 break;
                             }
                         }
-                    }
-                }
-                if(!CollectionUtils.isEmpty(updateList)){
-                    this.updateBatchValue(updateList);
-                }
-        }
-        return "总计更新折旧:"+ (updateList.size());
-        } catch (Exception e) {
-            throw new BusinessException(e.getMessage());
-        }
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public String importListByUpdate(MultipartFile file) {
+                        if(!findSaveUser){
+                            throw new BusinessException("找不到使用人员,请先添加, 名称" + item.getSaveUser());
+                        }
+                        if(StringUtils.isNotBlank(item.getRepairUserName())){
+                            boolean findRepairUser = false;
+                            for (SysUser user : users) {
+                                if(user.getRealName().equals(item.getRepairUserName())){
+                                    item.setRepairUser(user.getUserId());
+                                    findRepairUser = true;
+                                    break;
+                                }
+                            }
+                            if(!findRepairUser){
+                                throw new BusinessException("找不到维修人员,请先添加, 名称" + item.getRepairUser());
+                            }
+                        }
+                        if(StringUtils.isNotBlank(item.getRepairUserNameSecond())){
+                            boolean findRepairUser = false;
+                            for (SysUser user : users) {
+                                if(user.getRealName().equals(item.getRepairUserNameSecond())){
+                                    item.setRepairUserSecond(user.getUserId());
+                                    findRepairUser = true;
+                                    break;
+                                }
+                            }
+                            if(!findRepairUser){
+                                throw new BusinessException("找不到第二维修人员,请先添加, 名称" + item.getRepairUser());
+                            }
+                        }
 
-        int addNum = 0;
-        List<String> modelError = new ArrayList<String>();
-        List<SbInfo> updateList = new ArrayList<SbInfo>();
-        try {
-            List<SbInfo> items = CustomExcelImportUtil.importSbInfoListForUpdateValue(file.getInputStream());
-            if (!CollectionUtils.isEmpty(items)) {
-                List<SbInfo> list = mapper.selectAll();
-                LocalDateTime now = LocalDateTime.now();
-                for (SbInfo sbInfo : list) {
-                    for (SbInfo item : items) {
-                        if(StringUtils.isNotBlank(item.getFinancingNo())){
-                            if(item.getFinancingNo().equals(sbInfo.getFinancingNo())){
-                                sbInfo.setInitialValue(item.getInitialValue());
-                                sbInfo.setCurrentValue(item.getCurrentValue());
-                                sbInfo.setRate(item.getRate());
-                                sbInfo.setMonth(item.getMonth());
-                                sbInfo.setCutValue(item.getCutValue());
-                                sbInfo.setUsedMonth(item.getUsedMonth());
-                                updateList.add(item);
+                        List<SbType> typeList = sbTypeMapper.selectAll();
+                        boolean find = false;
+                        for (SbType type : typeList) {
+                            if(type.getName().equals(item.getTypeName())){
+                                item.setTypeId(type.getId());
+                                find = true;
                                 break;
                             }
                         }
-                    }
-                }
-                if(!CollectionUtils.isEmpty(updateList)){
-                    this.updateBatchValue(updateList);
-                }
-            }
-            return "总计更新折旧:"+ (updateList.size());
-        } catch (Exception e) {
-            throw new BusinessException(e.getMessage());
-        }
-    }
-
-    /**
-     * 全部修改
-     *
-     * @param file
-     * @return
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public String importListByUpdateALl(MultipartFile file) {
+                        if(!find){
+                            throw new BusinessException("找不到设备类型,请先添加:" + item.getTypeName());
+                        }
 
-        int addNum = 0;
-        List<String> modelError = new ArrayList<String>();
-        List<SbInfo> updateList = new ArrayList<SbInfo>();
-        try {
-            List<SbInfo> items = CustomExcelImportUtil.importSbInfoForUpdateAll(file.getInputStream());
-            if (!CollectionUtils.isEmpty(items)) {
-                List<SbInfo> list = mapper.selectAll();
-                LocalDateTime now = LocalDateTime.now();
-                for (SbInfo sbInfo : list) {
-                    for (SbInfo item : items) {
-                        if(StringUtils.isNotBlank(item.getFinancingNo())){
-                            if(item.getFinancingNo().equals(sbInfo.getFinancingNo())){
-                                sbInfo.setInitialValue(item.getInitialValue());
-                                sbInfo.setCurrentValue(item.getCurrentValue());
-                                sbInfo.setRate(item.getRate());
-                                sbInfo.setMonth(item.getMonth());
-                                sbInfo.setCutValue(item.getCutValue());
-                                sbInfo.setUsedMonth(item.getUsedMonth());
-                                updateList.add(item);
+                        boolean findProdcuer = false;
+                        for (FirmProducer producer : producerList) {
+                            if(producer.getName().equals(item.getProducerId())){
+                                item.setProducerId(producer.getId());
+                                findProdcuer = true;
                                 break;
                             }
                         }
+                        if(!findProdcuer){
+                            throw new BusinessException("找不到生产商,请先添加:" + item.getProducerId());
+                        }
+                        mapper.updateByPrimaryKey(BeanConverterUtil.copyObjectProperties(item, SbInfo.class));
                     }
                 }
-                if(!CollectionUtils.isEmpty(updateList)){
-                    this.updateBatchValue(updateList);
-                }
             }
-            return "总计更新:"+ (updateList.size());
+            return "总计更新:"+ (items.size());
         } catch (Exception e) {
             throw new BusinessException(e.getMessage());
         }