Merge remote-tracking branch 'origin/dev' into dev

pull/8040/head
Qiuyi LI 2025-02-25 10:20:16 +01:00
commit 98450c0294
3 changed files with 24 additions and 27 deletions

View File

@ -9,6 +9,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
@ -164,29 +165,24 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
/**
* excel
*
* @param request
* @param skuIds
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> selections = new ArrayList<>();
request.getParameterMap().forEach((k,v) -> {
if(k.equals("selections[]")) {
selections.addAll(Arrays.asList(v));
}
});
List<SkuWeight> exportList = skuWeightService.exportToExcel(selections);
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "SKU重量");
mv.addObject(NormalExcelConstants.CLASS, SkuWeight.class);
ExportParams exportParams=new ExportParams("SKU重量报表", "导出人:" + sysUser.getRealname(), "SKU重量");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(@RequestParam(value = "selections[]", required = false) List<String> skuIds) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<SkuWeightPage> skuWeightList;
if (skuIds == null || skuIds.isEmpty()) {
skuWeightList = skuWeightService.listLatestWeights();
} else {
skuWeightList = skuWeightService.listLatestWeightForSkus(skuIds);
}
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "SKU重量列表");
mv.addObject(NormalExcelConstants.CLASS, SkuWeightPage.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("SKU重量数据", "导出人:" + sysUser.getRealname(), "SKU重量"));
mv.addObject(NormalExcelConstants.DATA_LIST, skuWeightList);
return mv;
}
/**
* excel
@ -208,7 +204,7 @@ public class SkuWeightController extends JeecgController<SkuWeight, ISkuWeightSe
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();
try (InputStream inputStream = file.getInputStream()){
Workbook workbook = new XSSFWorkbook(inputStream);
Workbook workbook = new HSSFWorkbook(inputStream);
Sheet firstSheet = workbook.getSheetAt(0);
int firstRow = firstSheet.getFirstRowNum();
int lastRow = firstSheet.getLastRowNum();

View File

@ -2,12 +2,10 @@ package org.jeecg.modules.business.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@ -57,6 +55,9 @@ public class Credit implements Serializable {
@Dict(dictTable = "client WHERE active = '1'", dicText = "internal_code", dicCode = "id")
@ApiModelProperty(value = "client_id")
private java.lang.String clientId;
@Excel(name = "description", width = 15)
@ApiModelProperty(value = "description")
private java.lang.String description;
/**amount*/
@Excel(name = "amount", width = 15)
@ApiModelProperty(value = "amount")

View File

@ -17,7 +17,7 @@ public class SkuWeightPage {
@Excel(name = "重量", width = 15)
@ApiModelProperty(value = "重量")
private Integer weight;
@Excel(name = "生效日期", width = 15)
@Excel(name = "生效日期", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "生效日期")
private Date effectiveDate;
}