发票修改优化

pro
anthonywj 2 years ago
parent c57e232dfb
commit 82c73f6eb3

@ -75,6 +75,8 @@ public class IoOrderController extends BaseController {
IoAddInoutService ioAddInoutService;
@Resource
IoCheckInoutService ioCheckInoutService;
@Resource
IoOrderInvoiceService orderInvoiceService;
/**
*
@ -133,7 +135,6 @@ public class IoOrderController extends BaseController {
if (StrUtil.isNotEmpty(filterOrderRequest.getSupInoivceSearch())) {
orderService.setInvoiceFiltes(filterOrderRequest);
}
if (filterOrderRequest.getSourceLocalType() != null) {
if (filterOrderRequest.getSourceLocalType() == 1) {
filterOrderRequest.setSourceTypes(Arrays.asList(1, 2, 3, 4, 5));
@ -141,7 +142,6 @@ public class IoOrderController extends BaseController {
filterOrderRequest.setSourceTypes(Arrays.asList(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17));
}
}
String customerId = getCustomerId();
if (!customerId.equals("110")) {
filterOrderRequest.setFromCorp(customerId);
@ -152,20 +152,9 @@ public class IoOrderController extends BaseController {
if (ioOrderResponse.getCheckStatus() == null) {
ioOrderResponse.setCheckStatus(0 + "");
}
FilterOrderDetailCodeRequest filterOrderDetailCodeRequest = new FilterOrderDetailCodeRequest();
filterOrderDetailCodeRequest.setOrderIdFk(ioOrderResponse.getBillNo());
List<IoOrderDetailCodeResponse> ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(filterOrderDetailCodeRequest);
BigDecimal amount = new BigDecimal(0.00);
for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) {
if (ioOrderDetailCodeRespons.getReCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) {
amount = amount.add(new BigDecimal(ioOrderDetailCodeRespons.getReCount()).multiply(ioOrderDetailCodeRespons.getPrice()));
}
}
ioOrderResponse.setAllAmount(amount);
ioOrderResponse = orderInvoiceService.findRegStausByBillNo(ioOrderResponse);
}
PageInfo<IoOrderResponse> pageInfo = new PageInfo<>(list);
return ResultVOUtils.page(pageInfo);
}

@ -703,25 +703,25 @@ public class IoOrderDetailBizController extends BaseController {
@GetMapping("/udiwms/inout/bizDetail/filterBizOrderList")
public BaseResponse filterBizOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest) {
List<IoOrderDetailCodeResponse> ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(orderDetailBizRequest);
for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) {
if (ioOrderDetailCodeRespons.getReCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) {
ioOrderDetailCodeRespons.setAmount(new BigDecimal(ioOrderDetailCodeRespons.getReCount()).multiply(ioOrderDetailCodeRespons.getPrice()));
List<IoOrderInvoiceEntity> orderInvoiceEntities = ioOrderInvoiceService.findByBillNo(orderDetailBizRequest.getOrderIdFk());
for (IoOrderDetailCodeResponse orderDetailCodeEntity : ioOrderDetailCodeResponses) {
if (orderDetailCodeEntity.getReCount() != 0 && orderDetailCodeEntity.getPrice() != null) {
orderDetailCodeEntity.setAmount(new BigDecimal(orderDetailCodeEntity.getReCount()).multiply(orderDetailCodeEntity.getPrice()));
}
String msg = "";
IoOrderInvoiceRequest ioOrderInvoiceEntity = new IoOrderInvoiceRequest();
ioOrderInvoiceEntity.setOrderIdFk(ioOrderDetailCodeRespons.getOrderIdFk());
ioOrderInvoiceEntity.setBatchNo(ioOrderDetailCodeRespons.getBatchNo());
ioOrderInvoiceEntity.setBindRlFk(ioOrderDetailCodeRespons.getBindRlFk().toString());
List<IoOrderInvoiceEntity> ioOrderInvoiceEntityList = ioOrderInvoiceService.selectOrderInvoice(ioOrderInvoiceEntity);
for (IoOrderInvoiceEntity obj : ioOrderInvoiceEntityList) {
if (StrUtil.isNotEmpty(obj.getInvoiceEncode())) {
msg += "," + obj.getInvoiceEncode();
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
if (StrUtil.trimToEmpty(orderInvoiceEntity.getBatchNo()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo()))
&& StrUtil.trimToEmpty(orderInvoiceEntity.getBindRlFk()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBindRlFk() + ""))) {
orderDetailCodeEntity.setRegStatus(true);
if (StrUtil.isNotEmpty(orderInvoiceEntity.getInvoiceEncode())) {
msg += "," + orderInvoiceEntity.getInvoiceEncode();
}
}
}
if (msg.length() > 1) {
msg = msg.substring(1);
}
ioOrderDetailCodeRespons.setInvoiceCodes(msg);
orderDetailCodeEntity.setInvoiceCodes(msg);
}
PageInfo<IoOrderDetailCodeResponse> pageInfo = new PageInfo<>(ioOrderDetailCodeResponses);
return ResultVOUtils.page(pageInfo);

@ -26,6 +26,7 @@ public interface IoOrderDetailBizDao extends BaseMapperPlus<IoOrderDetailBizDao,
List<IoOrderDetailCodeResponse> getfilterOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest);
List<IoOrderInvoiceResponse> filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest);
IoOrderInvoiceResponse selectByinvoiceId(Long id);
/**

@ -252,6 +252,8 @@ public class IoOrderResponse {
private String relKey; //关联单据唯一键
private Integer suppleCount; //补单次数
private int invoiceStatus;//发票登记状态0未登记1未全部登记2已全部登记
public String getFromName() {

@ -423,7 +423,6 @@ public class IoCheckInoutService {
bizEntity.setCheckSuccess(true);
codeEntity.setCheckSuccess(true);
codeEntity.setPrice(bizEntity.getPrice());
orderInvoiceService.updateRegStatus(codeEntity);
}
break;
}

@ -45,6 +45,7 @@ public interface IoOrderDetailBizService {
List<IoOrderDetailBizEntity> checkOrderList(String orderId);
List<IoOrderInvoiceResponse> filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest);
IoOrderInvoiceResponse selectByinvoiceId(Long id);
Boolean updateOrderDetailBiz(IoOrderDetailBizEntity ioOrderDetailBizEntity);

@ -5,6 +5,7 @@ import com.glxp.api.entity.inout.IoCodeRelEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
import com.glxp.api.req.inout.IoOrderInvoiceRequest;
import com.glxp.api.res.inout.IoOrderResponse;
import java.util.List;
@ -24,5 +25,7 @@ public interface IoOrderInvoiceService extends IService<IoOrderInvoiceEntity> {
// 更新发票状态
boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity);
IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse);
boolean findRegStausByProduct(String billNo);
}

@ -1,6 +1,7 @@
package com.glxp.api.service.inout.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.inout.IoCodeRelMapper;
@ -10,6 +11,7 @@ import com.glxp.api.entity.inout.IoCodeRelEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
import com.glxp.api.req.inout.IoOrderInvoiceRequest;
import com.glxp.api.res.inout.IoOrderResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -81,4 +83,45 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper,
orderDetailCodeDao.updateById(orderDetailCodeEntity);
return true;
}
@Override
public IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse) {
List<IoOrderInvoiceEntity> orderInvoiceEntities = ioOrderInvoiceMapper.selectList(new QueryWrapper<IoOrderInvoiceEntity>().eq("orderIdFk", orderResponse.getBillNo()));
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().eq("orderIdFk", orderResponse.getBillNo()));
if (CollUtil.isNotEmpty(orderDetailCodeEntities)) {
BigDecimal amount = new BigDecimal(0.00);
for (IoOrderDetailCodeEntity orderDetailCodeEntity : orderDetailCodeEntities) {
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
if (StrUtil.trimToEmpty(orderInvoiceEntity.getBatchNo()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo()))
&& StrUtil.trimToEmpty(orderInvoiceEntity.getBindRlFk()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBindRlFk() + ""))) {
orderDetailCodeEntity.setRegStatus(true);
}
}
if (orderDetailCodeEntity.getReCount() != 0 && orderDetailCodeEntity.getPrice() != null) {
amount = amount.add(new BigDecimal(orderDetailCodeEntity.getReCount()).multiply(orderDetailCodeEntity.getPrice()));
}
}
orderResponse.setAllAmount(amount);
} else
return orderResponse;
int isAll = 0;
for (IoOrderDetailCodeEntity orderDetailCodeEntity : orderDetailCodeEntities) {
if (orderDetailCodeEntity.isRegStatus()) {
isAll++;
}
}
if (orderDetailCodeEntities.size() == isAll)
orderResponse.setInvoiceStatus(2);//已全部登记
else if(isAll >0){
orderResponse.setInvoiceStatus(1);//未全部登记
}
return orderResponse;
}
@Override
public boolean findRegStausByProduct(String billNo) {
return false;
}
}

@ -3,17 +3,17 @@
<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
(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
<where>
<if test="id != null and id != ''">
@ -21,7 +21,7 @@
</if>
<if test="corpName != null and corpName != ''">
AND (SELECT NAME FROM auth_warehouse aw2 WHERE aw2.CODE = io.fromInvCode) like
concat('%', #{corpName}, '%')
concat('%', #{corpName}, '%')
</if>
<if test="action != null and action != ''">
AND action = #{action}
@ -109,12 +109,12 @@
<if test="invoiceActions1 == null and invoiceActions2 != null">
and (
`action` in
`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">
@ -123,13 +123,13 @@
#{item}
</foreach>
and status = 10)
or (
`action` in
or (
`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 7)
)
)
</if>
</if>
</where>
@ -138,23 +138,27 @@
<select id="getfilterList" 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
(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 != ''">
@ -162,7 +166,7 @@
</if>
<if test="corpName != null and corpName != ''">
AND (SELECT NAME FROM auth_warehouse aw2 WHERE aw2.CODE = io.fromInvCode) like
concat('%', #{corpName}, '%')
concat('%', #{corpName}, '%')
</if>
<if test="action != null and action != ''">
AND action = #{action}
@ -250,12 +254,12 @@
<if test="invoiceActions1 == null and invoiceActions2 != null">
and (
`action` in
`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">
@ -264,22 +268,19 @@
#{item}
</foreach>
and status = 10)
or (
`action` in
or (
`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and status = 7)
)
)
</if>
</if>
</where>
</select>
<select id="filterOrderList" resultType="com.glxp.api.entity.inout.IoOrderEntity">
select *
from io_order
@ -330,7 +331,6 @@
]]>
</if>
</where>
</select>
@ -410,28 +410,24 @@
<select id="getfilterOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
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 allCout,
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
SELECT io.*,
bus.NAME AS billTypeName,
ad.NAME AS deptName,
aw.NAME AS invName,
bc.NAME AS fromCorpName
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 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}, '%')
concat('%', #{corpName}, '%')
</if>
<if test="action != null and action != ''">
AND io.action = #{action}
@ -519,12 +515,12 @@
<if test="invoiceActions1 == null and invoiceActions2 != null">
and (
io.`action` in
io.`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and io.status = 7
)
)
</if>
<if test="invoiceActions1 != null and invoiceActions2 != null">
@ -533,31 +529,24 @@
#{item}
</foreach>
and io.status = 10)
or (
io.`action` in
or (
io.`action` in
<foreach collection="invoiceActions2" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
and io.status = 7)
)
)
</if>
</if>
</where>
GROUP BY io.id
<choose>
<when test="(orderBy!=null ) and (sort=='desc' or sort=='asc')">
order by ${orderBy} ${sort}
<when test="(orderBy != null) and (sort == 'desc' or sort == 'asc')">
order by ${orderBy} ${sort}
</when>
<otherwise>
order by updateTime desc
</otherwise>
</choose>
</select>
</mapper>

@ -113,10 +113,7 @@
</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
select *
from io_order_detail_code
<where>
<if test="orderIdFk != null and orderIdFk != ''">

Loading…
Cancel
Save