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

View File

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

View File

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