feat: 阳采追溯码导出

dev_unify
chenhc 3 months ago
parent 63aab5a655
commit 5fb4ffb529

@ -1,19 +1,32 @@
package com.glxp.api.controller.inout; package com.glxp.api.controller.inout;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.controller.BaseController; import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.alihealth.YcFileCodeUploadVo;
import com.glxp.api.entity.inout.IoCodeEntity; 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.FilterCodeRequest;
import com.glxp.api.req.inout.YcFileCodeUploadRequest;
import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.inout.IoCodeResponse; import com.glxp.api.res.inout.IoCodeResponse;
import com.glxp.api.service.inout.impl.IoCodeService; 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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -89,4 +102,22 @@ public class IoCodeController extends BaseController {
return ResultVOUtils.page(pageInfo); 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<YcFileCodeUploadVo> list = ioCodeService.filterListexcelExport(ycFileCodeUploadRequest);
excelHandler.exportExcel(response, list, YcFileCodeUploadVo.class, "UDI_"+billNo+"追溯码导出", "追溯码");
} catch (Exception e) {
throw new RenException("导出失败");
}
}
} }

@ -1,8 +1,10 @@
package com.glxp.api.dao.inout; package com.glxp.api.dao.inout;
import com.glxp.api.dao.BaseMapperPlus; import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.alihealth.YcFileCodeUploadVo;
import com.glxp.api.entity.inout.IoCodeEntity; import com.glxp.api.entity.inout.IoCodeEntity;
import com.glxp.api.req.inout.FilterCodeRequest; 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.IoCodeResponse;
import java.util.List; import java.util.List;
@ -33,4 +35,7 @@ public interface IoCodeDao extends BaseMapperPlus<IoCodeDao, IoCodeEntity, IoCod
* @return * @return
*/ */
List<IoCodeResponse> findByCodeSumReCount(List<String> codes); List<IoCodeResponse> findByCodeSumReCount(List<String> codes);
List<YcFileCodeUploadVo> filterListexcelExport(YcFileCodeUploadRequest filterCodeRequest);
} }

@ -1,13 +1,17 @@
package com.glxp.api.entity.alihealth; package com.glxp.api.entity.alihealth;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data; import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpServletResponse;
@Data @Data
public class YcFileCodeUploadVo { public class YcFileCodeUploadVo {
@ExcelProperty("订单编号") @ExcelProperty("订单编号")
private String billNo; private String ycBillNo;
@ExcelProperty("交易明细编号") @ExcelProperty("交易明细编号")
private String detailNo; private String detailNo;
@ -15,3 +19,4 @@ public class YcFileCodeUploadVo {
@ExcelProperty("追溯码") @ExcelProperty("追溯码")
private String code; private String code;
} }

@ -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;
}

@ -12,9 +12,11 @@ import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.inout.IoCodeDao; import com.glxp.api.dao.inout.IoCodeDao;
import com.glxp.api.dao.inout.IoCodeTempDao; import com.glxp.api.dao.inout.IoCodeTempDao;
import com.glxp.api.dao.inout.IoOrderDao; 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.IoCodeEntity;
import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.req.inout.FilterCodeRequest; 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.IoCodeResponse;
import com.glxp.api.res.inout.IoCodeTempResponse; import com.glxp.api.res.inout.IoCodeTempResponse;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -169,4 +171,8 @@ public class IoCodeService extends ServiceImpl<IoCodeDao, IoCodeEntity> {
public List<IoCodeResponse> findByCodeSumReCount(List<String> codes) { public List<IoCodeResponse> findByCodeSumReCount(List<String> codes) {
return ioCodeDao.findByCodeSumReCount(codes); return ioCodeDao.findByCodeSumReCount(codes);
} }
public List<YcFileCodeUploadVo> filterListexcelExport(YcFileCodeUploadRequest filterCodeRequest) {
return ioCodeDao.filterListexcelExport(filterCodeRequest);
}
} }

@ -109,6 +109,24 @@
</select> </select>
<select id="filterListexcelExport" resultType="com.glxp.api.entity.alihealth.YcFileCodeUploadVo">
select ic.code,#{ycBillNo} as ycBillNo,#{detailNo} as detailNo
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>
</where>
group by ic.id
</select>
<select id="filterDrugList" resultType="com.glxp.api.res.inout.IoCodeResponse"> <select id="filterDrugList" resultType="com.glxp.api.res.inout.IoCodeResponse">
select ic.*, select ic.*,
bp.cpmctymc productName, bp.cpmctymc productName,

Loading…
Cancel
Save