feat: 添加导出错误信息到excel的接口,数据由前端传过来
This commit is contained in:
parent
ca66acc0a3
commit
8f1fb6c330
|
|
@ -239,4 +239,16 @@ public class DQBomApi extends BaseApi {
|
||||||
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
|
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
|
||||||
return ResultVO.success(dQBomService.getBomException(query));
|
return ResultVO.success(dQBomService.getBomException(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出错误信息到excel
|
||||||
|
* @param messages 错误信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("exportErrorToExcel")
|
||||||
|
@ApiOperation("导出错误信息到excel")
|
||||||
|
public void exportErrorToExcel(@Valid @RequestBody @NotNull List<OperationErrorMsgVO> messages
|
||||||
|
, HttpServletResponse response) throws IOException {
|
||||||
|
EecExcelUtil.export(response, messages, OperationErrorMsgVO.class, "错误信息");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,12 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import nflg.product.common.vo.ResultVO;
|
import nflg.product.common.vo.ResultVO;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -30,6 +33,10 @@ public class TestApi {
|
||||||
@Resource
|
@Resource
|
||||||
SapOpUtilService sapOpUtilService;
|
SapOpUtilService sapOpUtilService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sap接口测试
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("sap")
|
@GetMapping("sap")
|
||||||
@ApiOperation("sap接口测试")
|
@ApiOperation("sap接口测试")
|
||||||
public ResultVO<List<OperationErrorMsgVO>> workDetailsListByPage() {
|
public ResultVO<List<OperationErrorMsgVO>> workDetailsListByPage() {
|
||||||
|
|
@ -52,4 +59,19 @@ public class TestApi {
|
||||||
sapDto.setT1(t1s);
|
sapDto.setT1(t1s);
|
||||||
return ResultVO.success(sapOpUtilService.importToSapV2(sapDto, null));
|
return ResultVO.success(sapOpUtilService.importToSapV2(sapDto, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取异常信息
|
||||||
|
* @param num 数量
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("getErrors")
|
||||||
|
@ApiOperation("获取异常信息")
|
||||||
|
public ResultVO<List<OperationErrorMsgVO>> getErrors(@Valid @RequestParam("num") @NotNull Integer num) {
|
||||||
|
List<OperationErrorMsgVO> msgs = new ArrayList<>();
|
||||||
|
for (int i = 0; i < num; i++) {
|
||||||
|
msgs.add(OperationErrorMsgVO.create("主键数据:" + i, "错误描述:" + i));
|
||||||
|
}
|
||||||
|
return ResultVO.success(msgs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.nflg.product.bomnew.pojo.vo;
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.ttzero.excel.annotation.ExcelColumn;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -11,6 +12,7 @@ import java.io.Serializable;
|
||||||
public class OperationErrorMsgBaseVO implements Serializable {
|
public class OperationErrorMsgBaseVO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("错误描述")
|
@ApiModelProperty("错误描述")
|
||||||
|
@ExcelColumn("异常信息")
|
||||||
public String msg;
|
public String msg;
|
||||||
|
|
||||||
public OperationErrorMsgBaseVO() {
|
public OperationErrorMsgBaseVO() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.nflg.product.bomnew.pojo.vo;
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.ttzero.excel.annotation.ExcelColumn;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
@ -8,9 +10,11 @@ import java.io.Serializable;
|
||||||
* @author 曹鹏飞
|
* @author 曹鹏飞
|
||||||
* @date 2024-03-21 14:49:05
|
* @date 2024-03-21 14:49:05
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class OperationErrorMsgVO extends OperationErrorMsgBaseVO implements Serializable {
|
public class OperationErrorMsgVO extends OperationErrorMsgBaseVO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("主键数据")
|
@ApiModelProperty("主键数据")
|
||||||
|
@ExcelColumn("所在行")
|
||||||
public String primaryKey;
|
public String primaryKey;
|
||||||
|
|
||||||
public OperationErrorMsgVO() {
|
public OperationErrorMsgVO() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue