|  |  | 
 |  |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public int save(PltProduct p) { | 
 |  |  |         //判断产品不能重名 | 
 |  |  |         if (dao.exists(p.name, p.id)) { | 
 |  |  |             throw new RuntimeException("产品名称重复"); | 
 |  |  |         //判断产品 名称和型号 不能重名 | 
 |  |  |         if (dao.exists(p.name.trim(), p.type.trim() ,p.id)) { | 
 |  |  |             throw new RuntimeException("已经存在相同的产品名称&型号"); | 
 |  |  |         } | 
 |  |  |         int flag=0; | 
 |  |  |         do { | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public int update(PltProduct p) { | 
 |  |  |         if (dao.exists(p.name, p.id)) { | 
 |  |  |             throw new RuntimeException("产品名称重复"); | 
 |  |  |         if (dao.exists(p.name.trim(), p.type.trim(),p.id)) { | 
 |  |  |             throw new RuntimeException("已经存在相同的产品名称&型号"); | 
 |  |  |         } | 
 |  |  |         int count = dao.updateByPrimaryKeySelective(p); | 
 |  |  |         //删除旧数据,重新插入 | 
 |  |  | 
 |  |  |                      return; | 
 |  |  |                  } | 
 |  |  |                  FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); | 
 |  |  |                  doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId; | 
 |  |  |                  doc.webUrl = fileRestVo.fileWebDownloadPath + doc.fileId; | 
 |  |  |                  doc.orgName = file.orgName; | 
 |  |  |                  doc.extName = file.extName; | 
 |  |  |              }); | 
 |  |  | 
 |  |  |                     item.qrCode = "data:image/jpeg;base64," + Base64.encode(codes); | 
 |  |  |                     item = addWebUrl(item); | 
 |  |  |                 } catch (IOException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                     log.error("IOException:",e); | 
 |  |  |                 } catch (WriterException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                     log.error("WriterException:",e); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |         return rsVo ; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加产品文档关联 | 
 |  |  |      * @param proId 产品id | 
 |  |  |      * @param fileId 文档id | 
 |  |  |      * @return 更新数量 | 
 |  |  |      */ | 
 |  |  |     public int addDoc(long proId,long fileId,String fileType){ | 
 |  |  |         PltProductFile pf=new PltProductFile(); | 
 |  |  |         pf.fileId = fileId; | 
 |  |  |         pf.proId = proId; | 
 |  |  |         pf.fileType = fileType; | 
 |  |  |         return pfDao.insertSelective(pf); | 
 |  |  |     } | 
 |  |  | //    /** | 
 |  |  | //     * 添加产品文档关联 | 
 |  |  | //     * @param proId 产品id | 
 |  |  | //     * @param fileId 文档id | 
 |  |  | //     * @return 更新数量 | 
 |  |  | //     */ | 
 |  |  | //    public int addDoc(long proId,long fileId,String fileType){ | 
 |  |  | //        PltProductFile pf=new PltProductFile(); | 
 |  |  | //        pf.fileId = fileId; | 
 |  |  | //        pf.proId = proId; | 
 |  |  | //        pf.fileType = fileType; | 
 |  |  | //        return pfDao.insertSelective(pf); | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 查询产品关联文档 | 
 |  |  |      * @param proId 产品id | 
 |  |  |      * @return 返回关联文档集合 | 
 |  |  |      */ | 
 |  |  |     public List<OthFile> selectDoc(long proId){ | 
 |  |  |         return othFileMapper.selectByProId(proId); | 
 |  |  |     } | 
 |  |  | //    /** | 
 |  |  | //     * 查询产品关联文档 | 
 |  |  | //     * @param proId 产品id | 
 |  |  | //     * @return 返回关联文档集合 | 
 |  |  | //     */ | 
 |  |  | //    public List<OthFile> selectDoc(long proId){ | 
 |  |  | //        return othFileMapper.selectByProId(proId); | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public List<PltProduct> selectAll(QueryVo queryVo) { | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); | 
 |  |  |         return dao.selectAll(params); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public void downloadDoc(HttpServletResponse response) { | 
 |  |  |         PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(1)); | 
 |  |  |     public List<PltProduct> getProduct(Long orderId) { | 
 |  |  |         return dao.selectByOrderId(orderId); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    public void downloadDoc(HttpServletResponse response) { | 
 |  |  | //        PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(1)); | 
 |  |  | //    } | 
 |  |  | } |