diff --git a/src/main/java/com/glxp/api/controller/inout/IoCodeController.java b/src/main/java/com/glxp/api/controller/inout/IoCodeController.java index bb181e19..8950bba2 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoCodeController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoCodeController.java @@ -1,19 +1,32 @@ package com.glxp.api.controller.inout; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.alihealth.YcFileCodeUploadVo; import com.glxp.api.entity.inout.IoCodeEntity; +import com.glxp.api.exception.JsonException; import com.glxp.api.req.inout.FilterCodeRequest; +import com.glxp.api.req.inout.YcFileCodeUploadRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.inout.IoCodeResponse; import com.glxp.api.service.inout.impl.IoCodeService; +import com.glxp.api.util.Excel.ExcelHandler; +import com.glxp.api.util.Excel.ExcelTemplateEnum; +import com.glxp.api.util.Excel.Exception.RenException; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.Date; import java.util.List; /** @@ -89,4 +102,22 @@ public class IoCodeController extends BaseController { return ResultVOUtils.page(pageInfo); } + @Resource + ExcelHandler excelHandler; + + @GetMapping("/udiwms/inout/code/filterList/excelExport") + public void excelExport(YcFileCodeUploadRequest ycFileCodeUploadRequest, HttpServletResponse response) { + String billNo = ycFileCodeUploadRequest.getBillNo(); + if (StrUtil.isEmpty(billNo)) { + throw new JsonException("单据编号不能为空!"); + } + + try { + List list = ioCodeService.filterListexcelExport(ycFileCodeUploadRequest); + excelHandler.exportExcel(response, list, YcFileCodeUploadVo.class, "UDI_"+billNo+"追溯码导出", "追溯码"); + } catch (Exception e) { + throw new RenException("导出失败"); + } + } + } diff --git a/src/main/java/com/glxp/api/dao/inout/IoCodeDao.java b/src/main/java/com/glxp/api/dao/inout/IoCodeDao.java index 8ed6ec89..f4e14183 100644 --- a/src/main/java/com/glxp/api/dao/inout/IoCodeDao.java +++ b/src/main/java/com/glxp/api/dao/inout/IoCodeDao.java @@ -1,8 +1,10 @@ package com.glxp.api.dao.inout; import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.entity.alihealth.YcFileCodeUploadVo; import com.glxp.api.entity.inout.IoCodeEntity; import com.glxp.api.req.inout.FilterCodeRequest; +import com.glxp.api.req.inout.YcFileCodeUploadRequest; import com.glxp.api.res.inout.IoCodeResponse; import java.util.List; @@ -33,4 +35,7 @@ public interface IoCodeDao extends BaseMapperPlus findByCodeSumReCount(List codes); + + + List filterListexcelExport(YcFileCodeUploadRequest filterCodeRequest); } diff --git a/src/main/java/com/glxp/api/entity/alihealth/YcFileCodeUploadVo.java b/src/main/java/com/glxp/api/entity/alihealth/YcFileCodeUploadVo.java index 2f82481f..70756486 100644 --- a/src/main/java/com/glxp/api/entity/alihealth/YcFileCodeUploadVo.java +++ b/src/main/java/com/glxp/api/entity/alihealth/YcFileCodeUploadVo.java @@ -1,13 +1,17 @@ package com.glxp.api.entity.alihealth; import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.annotations.ApiOperation; import lombok.Data; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.http.HttpServletResponse; @Data public class YcFileCodeUploadVo { @ExcelProperty("订单编号") - private String billNo; + private String ycBillNo; @ExcelProperty("交易明细编号") private String detailNo; @@ -15,3 +19,4 @@ public class YcFileCodeUploadVo { @ExcelProperty("追溯码") private String code; } + diff --git a/src/main/java/com/glxp/api/req/inout/YcFileCodeUploadRequest.java b/src/main/java/com/glxp/api/req/inout/YcFileCodeUploadRequest.java new file mode 100644 index 00000000..b97879a9 --- /dev/null +++ b/src/main/java/com/glxp/api/req/inout/YcFileCodeUploadRequest.java @@ -0,0 +1,20 @@ +package com.glxp.api.req.inout; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +@Data +public class YcFileCodeUploadRequest { + + @ExcelProperty("订单编号") + private String ycBillNo; + + @ExcelProperty("交易明细编号") + private String detailNo; + + @ExcelProperty("追溯码") + private String code; + + private String billNo; +} + diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java b/src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java index 0d82fbbc..5b0ebdae 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoCodeService.java @@ -12,9 +12,11 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.dao.inout.IoCodeDao; import com.glxp.api.dao.inout.IoCodeTempDao; import com.glxp.api.dao.inout.IoOrderDao; +import com.glxp.api.entity.alihealth.YcFileCodeUploadVo; import com.glxp.api.entity.inout.IoCodeEntity; import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.req.inout.FilterCodeRequest; +import com.glxp.api.req.inout.YcFileCodeUploadRequest; import com.glxp.api.res.inout.IoCodeResponse; import com.glxp.api.res.inout.IoCodeTempResponse; import org.springframework.stereotype.Service; @@ -169,4 +171,8 @@ public class IoCodeService extends ServiceImpl { public List findByCodeSumReCount(List codes) { return ioCodeDao.findByCodeSumReCount(codes); } + + public List filterListexcelExport(YcFileCodeUploadRequest filterCodeRequest) { + return ioCodeDao.filterListexcelExport(filterCodeRequest); + } } diff --git a/src/main/resources/mybatis/mapper/inout/IoCodeDao.xml b/src/main/resources/mybatis/mapper/inout/IoCodeDao.xml index d61e8434..373d6673 100644 --- a/src/main/resources/mybatis/mapper/inout/IoCodeDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoCodeDao.xml @@ -109,6 +109,24 @@ + +