发货需求信息模板,导入
This commit is contained in:
parent
ecc0ce3bae
commit
dd608fe24d
@ -100,6 +100,20 @@ public class JeecgController<T, S extends IService<T>> {
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
protected ModelAndView exportTemplate(List<?> pageList, Class<?> clazz, String title) {
|
||||
// AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, title);
|
||||
mv.addObject(NormalExcelConstants.CLASS, clazz);
|
||||
ExportParams exportParams = new ExportParams(null, null, title);
|
||||
exportParams.setImageBasePath(upLoadPath);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setFixedTitle(false);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
/**
|
||||
* 根据每页sheet数量导出多sheet
|
||||
*
|
||||
|
@ -18,6 +18,7 @@ import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.tms.carinout.vehicleinout.entity.VehicleParam;
|
||||
import org.jeecg.modules.tms.outbound.deliverydemand.entity.DeliveryDemand;
|
||||
import org.jeecg.modules.tms.outbound.deliverydemand.entity.DeliveryDemandExcel;
|
||||
import org.jeecg.modules.tms.outbound.deliverydemand.service.IDeliveryDemandService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -199,6 +200,16 @@ public class DeliveryDemandController extends JeecgController<DeliveryDemand, ID
|
||||
return super.exportXls(request, deliveryDemand, DeliveryDemand.class, "发货需求");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/exportTemplate")
|
||||
public ModelAndView exportTemplate() {
|
||||
List<DeliveryDemandExcel> deliveryDemandExcelList = new ArrayList<>();
|
||||
return super.exportTemplate(deliveryDemandExcelList, DeliveryDemandExcel.class, "发货需求模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
@ -209,7 +220,50 @@ public class DeliveryDemandController extends JeecgController<DeliveryDemand, ID
|
||||
//@RequiresPermissions("tms_delivery_demand:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DeliveryDemand.class);
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<DeliveryDemandExcel> deliveryDemandExcelList = ExcelImportUtil.importExcel(file.getInputStream(), DeliveryDemandExcel.class, params);
|
||||
long start = System.currentTimeMillis();
|
||||
List<DeliveryDemandDetail> demandDetails = new ArrayList<>();
|
||||
for (DeliveryDemandExcel excel: deliveryDemandExcelList) {
|
||||
List<DeliveryDemandDetail> deliveryDemandDetailList = excel.getDeliveryDemandDetailList();
|
||||
DeliveryDemand deliveryDemand = BeanUtil.toBean(excel, DeliveryDemand.class);
|
||||
deliveryDemandService.save(deliveryDemand);
|
||||
deliveryDemandDetailList.forEach(item -> {
|
||||
item.setDeliveryDemandId(deliveryDemand.getId());
|
||||
});
|
||||
demandDetails.addAll(deliveryDemandDetailList);
|
||||
}
|
||||
// 新增到明细表
|
||||
deliveryDemandDetailService.saveBatch(demandDetails);
|
||||
log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
return Result.ok("文件导入成功!数据行数:");
|
||||
} catch (Exception e) {
|
||||
//update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
if(msg!=null && msg.indexOf("Duplicate entry")>=0){
|
||||
return Result.error("文件导入失败:有重复数据!");
|
||||
}else{
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
}
|
||||
//update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,16 +93,16 @@ public class DeliveryDemand implements Serializable {
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "到货时间")
|
||||
private java.util.Date deliveryDate;
|
||||
/**取货地点*/
|
||||
@Excel(name = "取货地点", width = 15)
|
||||
@Dict(dicCode = "pick_up_hub")
|
||||
@ApiModelProperty(value = "取货地点")
|
||||
private java.lang.String pickUpHub;
|
||||
/**送货地点*/
|
||||
@Excel(name = "送货地点", width = 15, dicCode = "delivery_address")
|
||||
@Excel(name = "送货地点", width = 15)
|
||||
@Dict(dicCode = "delivery_address")
|
||||
@ApiModelProperty(value = "送货地点")
|
||||
private java.lang.String deliveryAddress;
|
||||
/**取货仓库*/
|
||||
@Excel(name = "取货仓库", width = 15, dicCode = "pick_up_hub")
|
||||
@Dict(dicCode = "pick_up_hub")
|
||||
@ApiModelProperty(value = "取货仓库")
|
||||
private java.lang.String pickUpHub;
|
||||
/**发货单*/
|
||||
// @Excel(name = "发货单", width = 15)
|
||||
@ApiModelProperty(value = "发货单")
|
||||
|
@ -1,119 +0,0 @@
|
||||
package org.jeecg.modules.tms.outbound.deliverydemand.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 发货需求
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("tms_delivery_demand")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="tms_delivery_demand对象", description="发货需求")
|
||||
public class DeliveryDemandDetail implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**发货类型*/
|
||||
@Excel(name = "发货类型", width = 15, dicCode = "ship_type")
|
||||
@Dict(dicCode = "ship_type")
|
||||
@ApiModelProperty(value = "发货类型")
|
||||
private String shipType;
|
||||
/**料号*/
|
||||
@Excel(name = "料号", width = 15)
|
||||
@ApiModelProperty(value = "料号")
|
||||
private String pn;
|
||||
/**规格*/
|
||||
@Excel(name = "规格", width = 15)
|
||||
@ApiModelProperty(value = "规格")
|
||||
private String spec;
|
||||
/**发货数量*/
|
||||
@Excel(name = "发货数量", width = 15)
|
||||
@ApiModelProperty(value = "发货数量")
|
||||
private Integer shipNumber;
|
||||
/**单位*/
|
||||
@Excel(name = "单位", width = 15, dicCode = "unit")
|
||||
@Dict(dicCode = "unit")
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unit;
|
||||
/**预估托盘数*/
|
||||
@Excel(name = "预估托盘数", width = 15)
|
||||
@ApiModelProperty(value = "预估托盘数")
|
||||
private Integer palletsNum;
|
||||
/**发货时间*/
|
||||
@Excel(name = "发货时间", width = 20, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private Date shipDate;
|
||||
/**送货地点*/
|
||||
@Excel(name = "送货地点", width = 15, dicCode = "delivery_address")
|
||||
@Dict(dicCode = "delivery_address")
|
||||
@ApiModelProperty(value = "送货地点")
|
||||
private String deliveryAddress;
|
||||
/**取货仓库*/
|
||||
@Excel(name = "取货仓库", width = 15, dicCode = "pick_up_hub")
|
||||
@Dict(dicCode = "pick_up_hub")
|
||||
@ApiModelProperty(value = "取货仓库")
|
||||
private String pickUpHub;
|
||||
/**发货单*/
|
||||
@Excel(name = "发货单", width = 15)
|
||||
@ApiModelProperty(value = "发货单")
|
||||
private String invoice;
|
||||
/**销售人员*/
|
||||
@Excel(name = "销售人员", width = 15)
|
||||
@ApiModelProperty(value = "销售人员")
|
||||
private String salesperson;
|
||||
/**作业备注*/
|
||||
@Excel(name = "作业备注", width = 15)
|
||||
@ApiModelProperty(value = "作业备注")
|
||||
private String workNotes;
|
||||
/**当前状态*/
|
||||
@Excel(name = "当前状态", width = 15, dicCode = "current_status")
|
||||
@Dict(dicCode = "current_status")
|
||||
@ApiModelProperty(value = "当前状态")
|
||||
private String currentStatus;
|
||||
/**用车需求编号*/
|
||||
@Excel(name = "用车需求编号", width = 15)
|
||||
@ApiModelProperty(value = "用车需求编号")
|
||||
private String vdNo;
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package org.jeecg.modules.tms.outbound.deliverydemand.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.modules.tms.outbound.deliverydemanddetail.entity.DeliveryDemandDetail;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 发货需求
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class DeliveryDemandExcel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**发货类型*/
|
||||
@Excel(name = "发货类型", width = 15, dicCode = "ship_type", needMerge = true)
|
||||
@Dict(dicCode = "ship_type")
|
||||
@ApiModelProperty(value = "发货类型")
|
||||
private java.lang.String shipType;
|
||||
/**料号*/
|
||||
@ApiModelProperty(value = "料号")
|
||||
private java.lang.String pn;
|
||||
/**规格*/
|
||||
@ApiModelProperty(value = "规格")
|
||||
private java.lang.String spec;
|
||||
/**发货数量*/
|
||||
@Excel(name = "发货数量", width = 15, needMerge = true)
|
||||
@ApiModelProperty(value = "发货数量")
|
||||
private java.lang.Integer shipNumber;
|
||||
/**单位*/
|
||||
@Dict(dicCode = "unit")
|
||||
@ApiModelProperty(value = "单位")
|
||||
private java.lang.String unit;
|
||||
/**预估托盘数*/
|
||||
@Excel(name = "预估托盘数", width = 15, needMerge = true)
|
||||
@ApiModelProperty(value = "预估托盘数")
|
||||
private java.lang.Integer palletsNum;
|
||||
/**发货时间*/
|
||||
@Excel(name = "发货时间", width = 20, format = "yyyy-MM-dd", needMerge = true)
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "发货时间")
|
||||
private java.util.Date shipDate;
|
||||
/**到货时间*/
|
||||
@Excel(name = "到货时间", width = 20, format = "yyyy-MM-dd", needMerge = true)
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "到货时间")
|
||||
private java.util.Date deliveryDate;
|
||||
/**送货地点*/
|
||||
@Excel(name = "送货地点", width = 15, needMerge = true)
|
||||
@Dict(dicCode = "delivery_address")
|
||||
@ApiModelProperty(value = "送货地点")
|
||||
private java.lang.String deliveryAddress;
|
||||
/**取货仓库*/
|
||||
@Excel(name = "取货仓库", width = 15, needMerge = true)
|
||||
@Dict(dicCode = "pick_up_hub")
|
||||
@ApiModelProperty(value = "取货仓库")
|
||||
private java.lang.String pickUpHub;
|
||||
/**发货单*/
|
||||
@ApiModelProperty(value = "发货单")
|
||||
private java.lang.String invoice;
|
||||
/**销售人员*/
|
||||
@ApiModelProperty(value = "销售人员")
|
||||
private java.lang.String salesperson;
|
||||
/**作业备注*/
|
||||
@Excel(name = "作业备注", width = 15, needMerge = true)
|
||||
@ApiModelProperty(value = "作业备注")
|
||||
private java.lang.String workNotes;
|
||||
/**当前状态 0-创建, 1-已合并需求, 2-计算车辆需求中, 3-发送车辆需求, 4-等待装车,
|
||||
* 5-车辆离厂(完成), 6-取消, 7-超期无效*/
|
||||
@Excel(name = "当前状态", width = 15, dicCode = "current_status")
|
||||
@Dict(dicCode = "current_status")
|
||||
@ApiModelProperty(value = "当前状态")
|
||||
private java.lang.String currentStatus;
|
||||
/**用车需求编号*/
|
||||
@ApiModelProperty(value = "用车需求编号")
|
||||
private String vdNo;
|
||||
@TableField(exist = false)
|
||||
@ExcelCollection(name = "发货明细")
|
||||
private List<DeliveryDemandDetail> deliveryDemandDetailList;
|
||||
}
|
@ -57,13 +57,13 @@ public class DeliveryDemandDetail implements Serializable {
|
||||
@Excel(name = "发货单", width = 15)
|
||||
@ApiModelProperty(value = "发货单")
|
||||
private String invoice;
|
||||
/**取货仓库*/
|
||||
@Excel(name = "取货仓库", width = 15)
|
||||
@ApiModelProperty(value = "取货仓库")
|
||||
/**发货仓库*/
|
||||
@Excel(name = "发货仓库", width = 15)
|
||||
@ApiModelProperty(value = "发货仓库")
|
||||
private String pickUpHub;
|
||||
/**取货仓库编码*/
|
||||
@Excel(name = "取货仓库编码", width = 15)
|
||||
@ApiModelProperty(value = "取货仓库编码")
|
||||
/**发货仓库编码*/
|
||||
@Excel(name = "发货仓库编码", width = 15)
|
||||
@ApiModelProperty(value = "发货仓库编码")
|
||||
private String pickUpHubCode;
|
||||
/**料号*/
|
||||
@Excel(name = "料号", width = 15)
|
||||
@ -86,7 +86,6 @@ public class DeliveryDemandDetail implements Serializable {
|
||||
@ApiModelProperty(value = "单位")
|
||||
private String unit;
|
||||
/**发货需求id*/
|
||||
@Excel(name = "发货需求id", width = 15)
|
||||
@ApiModelProperty(value = "发货需求id")
|
||||
private String deliveryDemandId;
|
||||
@TableField(exist = false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user