送货发票登记接口优化

pro
郑明梁 2 years ago
parent b9edabf126
commit e7e5cac0bb

@ -146,7 +146,7 @@ public class IoOrderController extends BaseController {
if (!customerId.equals("110")) {
filterOrderRequest.setFromCorp(customerId);
}
List<IoOrderResponse> list = orderService.getfilterList(filterOrderRequest);
List<IoOrderResponse> list = orderService.getfilterOrderList(filterOrderRequest);
for (IoOrderResponse ioOrderResponse : list) {
if (ioOrderResponse.getCheckStatus() == null) {
@ -154,7 +154,7 @@ public class IoOrderController extends BaseController {
}
FilterOrderDetailCodeRequest filterOrderDetailCodeRequest = new FilterOrderDetailCodeRequest();
filterOrderDetailCodeRequest.setOrderIdFk(ioOrderResponse.getBillNo());
List<IoOrderDetailCodeResponse> ioOrderDetailCodeResponses = orderDetailBizService.getfilterList(filterOrderDetailCodeRequest);
List<IoOrderDetailCodeResponse> ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(filterOrderDetailCodeRequest);
BigDecimal amount = new BigDecimal(0.00);
for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) {
if (ioOrderDetailCodeRespons.getCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) {
@ -162,8 +162,6 @@ public class IoOrderController extends BaseController {
}
}
ioOrderResponse.setAllAmount(amount);
}

@ -22,6 +22,8 @@ public interface IoOrderDao extends BaseMapperPlus<IoOrderDao, IoOrderEntity, Io
List<IoOrderResponse> getfilterList(FilterOrderRequest filterOrderRequest);
List<IoOrderResponse> getfilterOrderList(FilterOrderRequest filterOrderRequest);
/**
*
*

@ -23,6 +23,8 @@ public interface IoOrderDetailBizDao extends BaseMapperPlus<IoOrderDetailBizDao,
List<IoOrderDetailCodeResponse> getfilterList(FilterOrderDetailCodeRequest orderDetailBizRequest);
List<IoOrderDetailCodeResponse> getfilterOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest);
List<IoOrderInvoiceResponse> filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest);
IoOrderInvoiceResponse selectByinvoiceId(Long id);

@ -38,6 +38,8 @@ public interface IoOrderDetailBizService {
List<IoOrderDetailCodeResponse> getfilterList(FilterOrderDetailCodeRequest orderDetailBizRequest);
List<IoOrderDetailCodeResponse> getfilterOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest);
IoOrderDetailBizEntity selectByBatchNoAndBindRlFk(String batchNo, String bindRlFk);
List<IoOrderDetailBizEntity> checkOrderList(String orderId);

@ -56,6 +56,8 @@ public interface IoOrderService {
List<IoOrderResponse> getfilterList(FilterOrderRequest filterOrderRequest);
List<IoOrderResponse> getfilterOrderList(FilterOrderRequest filterOrderRequest);
/**
*
*

@ -132,6 +132,17 @@ public class IoOrderDetailBizServiceImpl implements IoOrderDetailBizService {
return ioOrderDetailBizDao.getfilterList(OrderDetailCodeRequest);
}
@Override
public List<IoOrderDetailCodeResponse> getfilterOrderList(FilterOrderDetailCodeRequest OrderDetailCodeRequest) {
if (null == OrderDetailCodeRequest) {
return Collections.emptyList();
}
if (null != OrderDetailCodeRequest.getPage() && null != OrderDetailCodeRequest.getLimit()) {
PageHelper.offsetPage((OrderDetailCodeRequest.getPage() - 1) * OrderDetailCodeRequest.getLimit(), OrderDetailCodeRequest.getLimit());
}
return ioOrderDetailBizDao.getfilterOrderList(OrderDetailCodeRequest);
}
@Override
public IoOrderDetailBizEntity selectByBatchNoAndBindRlFk(String batchNo, String bindRlFk) {
QueryWrapper<IoOrderDetailBizEntity> ew = new QueryWrapper<>();

@ -546,6 +546,17 @@ public class IoOrderServiceImpl implements IoOrderService {
return orderDao.getfilterList(filterOrderRequest);
}
@Override
public List<IoOrderResponse> getfilterOrderList(FilterOrderRequest filterOrderRequest) {
if (null == filterOrderRequest) {
return Collections.emptyList();
}
if (null != filterOrderRequest.getPage() && null != filterOrderRequest.getLimit()) {
PageHelper.offsetPage((filterOrderRequest.getPage() - 1) * filterOrderRequest.getLimit(), filterOrderRequest.getLimit());
}
return orderDao.getfilterOrderList(filterOrderRequest);
}
@Override
public List<IoOrderEntity> filterOrderList(FilterOrderRequest filterOrderRequest) {
if (null == filterOrderRequest) {

@ -2,85 +2,88 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.inout.IoOrderDao">
<select id="filterList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select io.*,
(select name from basic_bussiness_type bus where bus.action = io.action) billTypeName,
(select name from auth_dept ad where ad.code = io.deptCode) deptName,
(select name from auth_warehouse aw where aw.code = io.invCode) invName,
(select employeeName from auth_user au where au.id = io.createUser) createUserName,
(select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName,
(select employeeName from auth_user au3 where au3.id = io.reviewUser) reviewUserName,
(select employeeName from auth_user au4 where au4.id = io.checkUser) checkUserName,
(select name from auth_dept ad2 where ad2.code = io.fromDeptCode) fromDeptName,
(select name from auth_warehouse aw2 where aw2.code = io.fromInvCode) fromInvName,
(select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName,
(select name from basic_corp bc where bc.erpId = io.customerId) customerName
from io_order as io
SELECT
io.*,
bus.NAME AS billTypeName,
ad.NAME AS deptName,
aw.NAME AS invName,
bc.NAME AS fromCorpName,
COUNT(IF(dc.regStatus = 1, 1, NULL)) AS allCount,
COUNT(IF(dc.regStatus = 0, 1, NULL)) AS partCount
FROM
io_order io
LEFT JOIN basic_bussiness_type bus ON io.action = bus.action
LEFT JOIN auth_dept ad ON io.deptCode = ad.CODE
LEFT JOIN auth_warehouse aw ON io.invCode = aw.CODE
LEFT JOIN basic_corp bc ON io.fromCorp = bc.erpId
LEFT JOIN io_order_detail_code dc ON io.billNo = dc.orderIdFk
<where>
<if test="id != null and id != ''">
AND id = #{id}
AND io.id = #{id}
</if>
<if test="corpName != null and corpName != ''">
AND (SELECT NAME FROM auth_warehouse aw2 WHERE aw2.CODE = io.fromInvCode) like
concat('%', #{corpName}, '%')
</if>
<if test="action != null and action != ''">
AND action = #{action}
AND io.action = #{action}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
AND io.mainAction = #{mainAction}
</if>
<if test="billNo != null and billNo != ''">
AND billNo like concat('%', #{billNo}, '%')
AND io.billNo like concat('%', #{billNo}, '%')
</if>
<if test="corpOrderId != null and corpOrderId != ''">
AND corpOrderId = #{corpOrderId}
AND io.corpOrderId = #{corpOrderId}
</if>
<if test="fromCorp != null and fromCorp != ''">
AND fromCorp = #{fromCorp}
AND io.fromCorp = #{fromCorp}
</if>
<if test="deptCode != null and deptCode != ''">
AND deptCode = #{deptCode}
AND io.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
AND io.invCode = #{invCode}
</if>
<if test="busType != null">
AND busType = #{busType}
AND io.busType = #{busType}
</if>
<if test="inCodeStatus != null">
AND inCodeStatus = #{inCodeStatus}
AND io.inCodeStatus = #{inCodeStatus}
</if>
<if test="relKey != null">
AND relKey = #{relKey}
AND io.relKey = #{relKey}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND date_format(createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
AND date_format(io.createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="startAduditTime != null and startAduditTime != '' and endAduditTime != null and endAduditTime != ''">
AND date_format(auditTime, '%Y-%m-%d') between date_format(#{startAduditTime}, '%Y-%m-%d') and date_format(#{endAduditTime}, '%Y-%m-%d')
AND date_format(io.auditTime, '%Y-%m-%d') between date_format(#{startAduditTime}, '%Y-%m-%d') and date_format(#{endAduditTime}, '%Y-%m-%d')
</if>
<if test="actions != null and actions.size() != 0">
AND `action` in
AND io.`action` in
<foreach collection="actions" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="sourceTypes != null and sourceTypes.size() != 0">
AND fromType in
AND io.fromType in
<foreach collection="sourceTypes" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="statuses != null and statuses.size() != 0">
AND status in
AND io.status in
<foreach collection="statuses" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="dealStatuses != null and dealStatuses.size() != 0">
AND dealStatus in
AND io.dealStatus in
<foreach collection="dealStatuses" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
@ -92,48 +95,49 @@
</foreach>
</if>
<if test="status != null">
AND status = #{status}
AND io.status = #{status}
</if>
<if test="orderType != null">
AND orderType = #{orderType}
AND io.orderType = #{orderType}
</if>
<if test="supInoivceSearch != null">
<if test="invoiceActions1 != null and invoiceActions2 == null">
AND (`action` in
AND (io.`action` in
<foreach collection="invoiceActions1" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 10)
and io.status = 10)
</if>
<if test="invoiceActions1 == null and invoiceActions2 != null">
and (
`action` in
io.`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 7
and io.status = 7
)
</if>
<if test="invoiceActions1 != null and invoiceActions2 != null">
AND ((`action` in
AND ((io.`action` in
<foreach collection="invoiceActions1" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 10)
and io.status = 10)
or (
`action` in
io.`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 7)
and io.status = 7)
)
</if>
</if>
</where>
order by createTime desc
order by io.createTime desc
GROUP BY io.id
</select>
<select id="getfilterList" resultType="com.glxp.api.res.inout.IoOrderResponse">
@ -280,6 +284,7 @@
<select id="filterOrderList" resultType="com.glxp.api.entity.inout.IoOrderEntity">
select *
from io_order
@ -407,4 +412,152 @@
from io_order
where billNo = #{billNo}
</select>
<select id="getfilterOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select io.*,
(select name from basic_bussiness_type bus where bus.action = io.action) billTypeName,
(select name from auth_dept ad where ad.code = io.deptCode) deptName,
(select name from auth_warehouse aw where aw.code = io.invCode) invName,
(select employeeName from auth_user au where au.id = io.createUser) createUserName,
(select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName,
(select employeeName from auth_user au3 where au3.id = io.reviewUser) reviewUserName,
(select employeeName from auth_user au4 where au4.id = io.checkUser) checkUserName,
(select name from auth_dept ad2 where ad2.code = io.fromDeptCode) fromDeptName,
(select name from auth_warehouse aw2 where aw2.code = io.fromInvCode) fromInvName,
(select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName,
(select name from basic_corp bc where bc.erpId = io.customerId) customerName,
(SELECT count(*) FROM io_order_detail_code WHERE io_order_detail_code.orderIdFk = io.billNo
and io_order_detail_code.regStatus = 1
) AS allCout,
(SELECT count(*) FROM io_order_detail_code WHERE io_order_detail_code.orderIdFk = io.billNo
and io_order_detail_code.regStatus = 0
) As partCount
from io_order as io
<where>
<if test="id != null and id != ''">
AND id = #{id}
</if>
<if test="corpName != null and corpName != ''">
AND (SELECT NAME FROM auth_warehouse aw2 WHERE aw2.CODE = io.fromInvCode) like
concat('%', #{corpName}, '%')
</if>
<if test="action != null and action != ''">
AND action = #{action}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="billNo != null and billNo != ''">
AND billNo like concat('%', #{billNo}, '%')
</if>
<if test="corpOrderId != null and corpOrderId != ''">
AND corpOrderId = #{corpOrderId}
</if>
<if test="fromCorp != null and fromCorp != ''">
AND fromCorp = #{fromCorp}
</if>
<if test="deptCode != null and deptCode != ''">
AND deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<if test="busType != null">
AND busType = #{busType}
</if>
<if test="inCodeStatus != null">
AND inCodeStatus = #{inCodeStatus}
</if>
<if test="relKey != null">
AND relKey = #{relKey}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND date_format(createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="startAduditTime != null and startAduditTime != '' and endAduditTime != null and endAduditTime != ''">
AND date_format(auditTime, '%Y-%m-%d') between date_format(#{startAduditTime}, '%Y-%m-%d') and date_format(#{endAduditTime}, '%Y-%m-%d')
</if>
<if test="actions != null and actions.size() != 0">
AND `action` in
<foreach collection="actions" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="sourceTypes != null and sourceTypes.size() != 0">
AND fromType in
<foreach collection="sourceTypes" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="statuses != null and statuses.size() != 0">
AND status in
<foreach collection="statuses" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="dealStatuses != null and dealStatuses.size() != 0">
AND dealStatus in
<foreach collection="dealStatuses" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="orderIds != null and orderIds.size() != 0">
AND io.billNo in
<foreach collection="orderIds" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="orderType != null">
AND orderType = #{orderType}
</if>
<if test="supInoivceSearch != null">
<if test="invoiceActions1 != null and invoiceActions2 == null">
AND (`action` in
<foreach collection="invoiceActions1" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 10)
</if>
<if test="invoiceActions1 == null and invoiceActions2 != null">
and (
`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 7
)
</if>
<if test="invoiceActions1 != null and invoiceActions2 != null">
AND ((`action` in
<foreach collection="invoiceActions1" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 10)
or (
`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 7)
)
</if>
</if>
</where>
order by createTime desc
</select>
</mapper>

@ -111,4 +111,28 @@
</if>
</where>
</select>
<select id="getfilterOrderList" resultType="com.glxp.api.res.inout.IoOrderDetailCodeResponse">
select io_order_detail_code.*,
(select count(*)
FROM io_order_invoice
where io_order_invoice.orderIdFk = io_order_detail_code.orderIdFk) as sucCount
from io_order_detail_code
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="relId != null">
AND bindRlFk = #{relId}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="productName != null and productName != ''">
AND bp.cpmctymc like concat('%', #{productName}, '%')
</if>
</where>
group by io_order_detail_code.id
</select>
</mapper>

Loading…
Cancel
Save