|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.glxp.api.controller.inout;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
@ -7,13 +8,19 @@ 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.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.exception.JsonException;
|
|
|
|
|
import com.glxp.api.req.inout.FilterCodeRequest;
|
|
|
|
|
import com.glxp.api.req.inout.FilterOrderDetailBizRequest;
|
|
|
|
|
import com.glxp.api.req.inout.YcFileCodeUploadRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoCodeResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderDetailBizResponse;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderDetailBizService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import com.glxp.api.service.inout.impl.IoCodeService;
|
|
|
|
|
import com.glxp.api.util.Excel.ExcelHandler;
|
|
|
|
|
import com.glxp.api.util.Excel.ExcelTemplateEnum;
|
|
|
|
@ -26,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -37,6 +45,10 @@ public class IoCodeController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private IoCodeService ioCodeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private IoOrderService ioOrderService;
|
|
|
|
|
@Resource
|
|
|
|
|
private IoOrderDetailBizService ioOrderDetailBizService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询单据正式码表数据
|
|
|
|
@ -112,12 +124,46 @@ public class IoCodeController extends BaseController {
|
|
|
|
|
throw new JsonException("单据编号不能为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取订单的详情
|
|
|
|
|
IoOrderEntity ioOrderEntity = ioOrderService.findByBillNo(billNo);
|
|
|
|
|
if (ioOrderEntity == null) {
|
|
|
|
|
throw new JsonException("单据未找到!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取biz表
|
|
|
|
|
FilterOrderDetailBizRequest orderDetailBizRequest = new FilterOrderDetailBizRequest();
|
|
|
|
|
orderDetailBizRequest.setOrderIdFk(billNo);
|
|
|
|
|
List<IoOrderDetailBizResponse> ioOrderDetailBizResponses = ioOrderDetailBizService.filterList(orderDetailBizRequest);
|
|
|
|
|
if (CollUtil.isEmpty(ioOrderDetailBizResponses)) {
|
|
|
|
|
throw new JsonException("单据业务明细未找到!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FilterCodeRequest filterCodeRequest = new FilterCodeRequest();
|
|
|
|
|
List<YcFileCodeUploadVo> exportExcelList = new ArrayList<>();
|
|
|
|
|
String ycBillNo = ioOrderEntity.getYcBillNo();
|
|
|
|
|
filterCodeRequest.setYcBillNo(ycBillNo);
|
|
|
|
|
|
|
|
|
|
//遍历biz获取codeList
|
|
|
|
|
for (int i = 0; i < ioOrderDetailBizResponses.size(); i++) {
|
|
|
|
|
IoOrderDetailBizResponse ioOrderDetailBizResponse = ioOrderDetailBizResponses.get(i);
|
|
|
|
|
|
|
|
|
|
filterCodeRequest.setYcBizNo(ioOrderDetailBizResponse.getYcBizNo());
|
|
|
|
|
filterCodeRequest.setRelId(String.valueOf(ioOrderDetailBizResponse.getBindRlFk()));
|
|
|
|
|
filterCodeRequest.setBatchNo(ioOrderDetailBizResponse.getBatchNo());
|
|
|
|
|
|
|
|
|
|
List<YcFileCodeUploadVo> list = ioCodeService.filterListexcelExport(filterCodeRequest);
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
exportExcelList.addAll(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<YcFileCodeUploadVo> list = ioCodeService.filterListexcelExport(ycFileCodeUploadRequest);
|
|
|
|
|
excelHandler.exportExcel(response, list, YcFileCodeUploadVo.class, "UDI_"+billNo+"追溯码导出", "追溯码");
|
|
|
|
|
excelHandler.exportExcel(response, exportExcelList, YcFileCodeUploadVo.class, "UDI_"+billNo+"追溯码导出", "追溯码");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RenException("导出失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|