fix:修复导出阳光采购平台追溯码上传数据

dev_unify
chenhc 3 months ago
parent d656f3e53d
commit 59bf6cd536

@ -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("导出失败");
}
}
}

@ -37,5 +37,5 @@ public interface IoCodeDao extends BaseMapperPlus<IoCodeDao, IoCodeEntity, IoCod
List<IoCodeResponse> findByCodeSumReCount(List<String> codes);
List<YcFileCodeUploadVo> filterListexcelExport(YcFileCodeUploadRequest filterCodeRequest);
List<YcFileCodeUploadVo> filterListexcelExport(FilterCodeRequest filterCodeRequest);
}

@ -17,7 +17,7 @@ public class YcFileCodeUploadVo {
@ExcelProperty("交易明细编号")
@ColumnWidth(30)
private String detailNo;
private String ycBizNo;
@ExcelProperty("追溯码")
@ColumnWidth(60)

@ -72,5 +72,6 @@ public class FilterCodeRequest extends ListPageRequest {
*
*/
private String ycBillNo;
private String ycBizNo;
}

@ -1,5 +1,6 @@
package com.glxp.api.res.inout;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.math.BigDecimal;
@ -190,4 +191,11 @@ public class IoOrderDetailBizResponse {
private String prepnUnit;
/**
*
*/
@TableField(value = "ycBizNo")
private String ycBizNo;
}

@ -172,7 +172,7 @@ public class IoCodeService extends ServiceImpl<IoCodeDao, IoCodeEntity> {
return ioCodeDao.findByCodeSumReCount(codes);
}
public List<YcFileCodeUploadVo> filterListexcelExport(YcFileCodeUploadRequest filterCodeRequest) {
public List<YcFileCodeUploadVo> filterListexcelExport(FilterCodeRequest filterCodeRequest) {
return ioCodeDao.filterListexcelExport(filterCodeRequest);
}
}

@ -110,19 +110,15 @@
<select id="filterListexcelExport" resultType="com.glxp.api.entity.alihealth.YcFileCodeUploadVo">
select ic.code,#{ycBillNo} as ycBillNo,#{detailNo} as detailNo
select ic.code,#{ycBillNo} as ycBillNo,#{ycBizNo} as ycBizNo
from io_code ic
left join auth_dept ad on ic.deptCode = ad.code
left join auth_warehouse aw on ic.invCode = aw.code
left join auth_space on auth_space.code = ic.warehouseCode
left join basic_udirel bu on bu.id = ic.relId
left join basic_products bp on bu.uuid = bp.uuid
left join basic_corp bc on bc.erpId = ic.supId
<where>
<if test="code != null and code != ''">
AND ic.code = #{code}
<if test="relId != null and relId != ''">
AND ic.relId = #{relId}
</if>
<if test="batchNo != null and batchNo != ''">
AND ic.batchNo = #{batchNo}
</if>
</where>
group by ic.id
</select>

Loading…
Cancel
Save