GetPictures

博客提及进入相册管理时获取图片列表,还给出了转载来源https://www.cnblogs.com/konimeter/archive/2005/10/18/257279.html 。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

获取图片列表(进入相册管理的时候)

ContractedBlock.gifExpandedBlockStart.gifGetPictures
None.gif        public override ThreadSet GetPictures(GalleryThreadQuery query)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
using( SqlConnection connection = GetSqlConnection() ) 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
using(SqlCommand command = new SqlCommand(databaseOwner + ".cs_gallery_Threads_GetThreadSet", connection))
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    command.CommandType 
= CommandType.StoredProcedure;
InBlock.gif
InBlock.gif                    command.Parameters.Add(
"@SectionID", SqlDbType.Int).Value = query.SectionID;
InBlock.gif                    command.Parameters.Add(
"@PageIndex", SqlDbType.Int, 4).Value = query.PageIndex;
InBlock.gif                    command.Parameters.Add(
"@PageSize", SqlDbType.Int, 4).Value = query.PageSize;
InBlock.gif                    command.Parameters.Add(
"@sqlPopulate", SqlDbType.NText).Value = SqlGenerator.BuildGalleryThreadQuery(query, databaseOwner);
InBlock.gif                    command.Parameters.Add(
"@UserID", SqlDbType.Int).Value = query.UserID;
InBlock.gif                    command.Parameters.Add(
"@IncludeCategories", SqlDbType.Bit).Value = query.IncludeCategories;
InBlock.gif                    command.Parameters.Add(
"@TotalRecords", SqlDbType.Int).Direction = ParameterDirection.Output;
InBlock.gif                    command.Parameters.Add(SettingsIDParameter());
InBlock.gif
InBlock.gif                    ThreadSet ts 
= new ThreadSet();
InBlock.gif
InBlock.gif                    
// Execute the command
InBlock.gif                    
InBlock.gif                    
//If we want to display the list of categories for the post, we will need to 
InBlock.gif                    
//use a dataset so we can join the child records
InBlock.gif
                    if(query.IncludeCategories)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        DataSet ds 
= new DataSet();
InBlock.gif                        SqlDataAdapter da 
= new SqlDataAdapter(command);
InBlock.gif
InBlock.gif                        
//wait as long as possible to open the conn
InBlock.gif
                        connection.Open();
InBlock.gif                        da.Fill(ds);
InBlock.gif                        connection.Close();
InBlock.gif
InBlock.gif                        
//keep a referece to the relation since it is used in the GetChildRows look up anyway
InBlock.gif
                        DataRelation relation = new DataRelation("Categories",ds.Tables[0].Columns["PostID"],ds.Tables[1].Columns["PostID"],false);
InBlock.gif                        ds.Relations.Add(relation);
InBlock.gif                        
InBlock.gif                        DataRowCollection posts 
= ds.Tables[0].Rows;
InBlock.gif                        
foreach(DataRow dr in posts)
InBlock.gif                            ts.Threads.Add(PopulatePictureFromIDataReader(dr, relation));
InBlock.gif                        ds.Clear();
InBlock.gif                        ds.Dispose();
InBlock.gif
InBlock.gif                        ts.TotalRecords 
= (int) command.Parameters["@TotalRecords"].Value;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
//No categories needed, so we can use a datareader.
InBlock.gif

InBlock.gif                        connection.Open();
InBlock.gif                        
using(SqlDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection))
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                        
InBlock.gif                            
while(dr.Read())
InBlock.gif                                ts.Threads.Add(PopulatePictureFromIDataReader(dr));
InBlock.gif
InBlock.gif                            dr.NextResult();
InBlock.gif                            ts.TotalRecords 
= (int) command.Parameters["@TotalRecords"].Value;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

InBlock.gif
InBlock.gif                    
return ts;
InBlock.gif
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

转载于:https://www.cnblogs.com/konimeter/archive/2005/10/18/257279.html

try { File excelFile = FileUtil.loadTemp(excel.getOriginalFilename(), excel.getInputStream()); Workbook workbook = new Workbook(excelFile.getAbsolutePath()); Worksheet firstWorksheet = workbook.getWorksheets().get(0); firstWorksheet.autoFitRows(); firstWorksheet.autoFitColumns(); if (image != null) { File imageFile = FileUtil.loadTemp(image.getOriginalFilename(), image.getInputStream()); int pictureIndex = firstWorksheet.getPictures().add(1, 1, imageFile.getAbsolutePath()); int maxRow = firstWorksheet.getCells().getMaxDataRow(); int maxColumn = firstWorksheet.getCells().getMaxDataColumn(); Picture picture = firstWorksheet.getPictures().get(pictureIndex); int pictureTopRow = maxRow + 2; int pictureLeftColumn = 0; picture.setUpperLeftRow(pictureTopRow); picture.setUpperLeftColumn(pictureLeftColumn); double rowHeight = picture.getHeightInch() * 72; if (rowHeight > 409) { rowHeight = 409; } firstWorksheet.getCells().setRowHeight(pictureTopRow, rowHeight); double pictureWidth = picture.getWidthInch() * 72; int pictureRightColumn = pictureLeftColumn + (int) (pictureWidth / 8.43); for (int column = pictureLeftColumn; column <= pictureRightColumn; column++) { firstWorksheet.getCells().setColumnWidth(column, 8.43); } } File tempFile = FileUtil.newTempFile(DateUtil.today().concat(ExcelTypeEnum.XLSX.getValue())); workbook.save(tempFile.getAbsolutePath(), com.aspose.cells.SaveFormat.XLSX); FileInputStream stream = new FileInputStream(tempFile); FileUtil.downFile(response, tempFile.getName(), stream); } catch (Exception e) { log.error("业务异常:{}", e.getMessage()); MessageException.throwMsg("业务异常"); } 我需要设置表格自适应宽度
05-25
分析下列防御性代码的真实逻辑: public Result<Object> listSuite(@RequestBody ResQueryVo resQueryVo) { if (!StringUtils.hasText(resQueryVo.getCpbh())) { return new Result<>(500, null, "cpbh不能为空!"); } List<String> cpbhList = processCpbh(resQueryVo.getCpbh()); String cpbhQuery = ""; if (cpbhList == null) { cpbhQuery = resQueryVo.getCpbh(); } List<String> countryList = resQueryVo.getArea(); List<ResPictureVo> artWorksList = baseMapper.queryResourcePictureByCpbh2(cpbhList, cpbhQuery, countryList); List<ResCountryNum> queryCountryNum = baseMapper.queryCountryNum(cpbhList, cpbhQuery, countryList); List<ResSuitVo> waBaseResult = baseMapper.queryResourceSuit(cpbhList, cpbhQuery, countryList); // 处理 waBaseResult List<TemuOMSuite> waResultList = new ArrayList<>(); for (ResSuitVo waResult : waBaseResult) { TemuOMSuite tmpModel = new TemuOMSuite(); tmpModel.setLanguage(waResult.getLanguaeg()); tmpModel.setWAID(String.valueOf(waResult.getWaid())); tmpModel.setId(String.valueOf(waResult.getId())); tmpModel.setCpbh(waResult.getSku()); tmpModel.setCountry(waResult.getCountry()); TemuDataInfoOM dataInfo = new TemuDataInfoOM(); dataInfo.setTitle(waResult.getTitle()); dataInfo.setBulletPoint(waResult.getBulletPoint()); dataInfo.setDescription(waResult.getDescription()); dataInfo.setFeatures(waResult.getFeature()); dataInfo.setSpecifications(waResult.getSpecification()); dataInfo.setInstructions(waResult.getInstructions()); dataInfo.setPackageIncludes(waResult.getPackageIncludes()); tmpModel.setData_info(dataInfo); waResultList.add(tmpModel); } // 生成最终的 suiteList List<TemuSuiteOM> suiteList = new ArrayList<>(); for (ResPictureVo item : artWorksList) { TemuSuiteOM tmpSuite = new TemuSuiteOM(); tmpSuite.setPictures(new ArrayList<>()); tmpSuite.setDescriptions(new ArrayList<>()); tmpSuite.setUser_info(new TemuUser()); // 获取与当前 SKU 相同的 artList List<ResPictureVo> artList = artWorksList.stream() .filter(t -> t.getSku().equals(item.getSku())) .collect(Collectors.toList()); // 调用 ArtTaskToQMArt 方法,假设此方法已经实现 for (ResPictureVo t : artList) { tmpSuite.getPictures().addAll(artTaskToQMArt(t)); // 假设 ArtTaskToQMArt 已经实现 } // 获取 WAID 列表并匹配描述信息 List<String> tmpWAIDList = artWorksList.stream() .map(t -> String.valueOf(t.getWaid())) .distinct() .collect(Collectors.toList()); if (tmpWAIDList != null && !tmpWAIDList.isEmpty()) { List<TemuOMSuite> waList = waResultList.stream() .filter(t -> tmpWAIDList.contains(t.getWAID())) .collect(Collectors.toList()); tmpSuite.getDescriptions().addAll(waList); } // 设置用户信息 tmpSuite.getUser_info().setUser_id(String.valueOf(item.getAmzyyUserID())); tmpSuite.getUser_info().setUser_name(item.getAmzyyUserName()); // 将生成的 tmpSuite 添加到 suiteList suiteList.add(tmpSuite); } String[] skus = resQueryVo.getCpbh().split("[^A-Za-z0-9-]+"); for (int i = 0; i < queryCountryNum.size(); i++) { ResCountryNum resCountryNum = queryCountryNum.get(i); String country = resCountryNum.getCountry(); Integer num = resCountryNum.getNum(); for (int j = 0; j < skus.length; j++) { String sku = skus[j]; Integer fileGroupNum = pimCpbhImageTypeDimensionMapper.queryGroupTypeByCpbh(sku, country); if (null == fileGroupNum || !fileGroupNum.equals(num)) { pimCpbhImageTypeDimensionMapper.updateFileGroupByCpbh(sku, num, country); } } } pimpmMinioImagePathMapper.updateFileGroupByCpbh(resQueryVo.getCpbh(), suiteList.size()); return new Result<>(200, suiteList, "操作成功!"); }
最新发布
06-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值