新增单据详情,发票、确认状态,同步更新,

dev
anthonywj 2 years ago
parent 1003d2ec8f
commit 8a8965e1e7

@ -68,4 +68,6 @@ public interface IoOrderDao extends BaseMapperPlus<IoOrderDao, IoOrderEntity, Io
* @return
*/
List<String> selectWaitSubmitOrder(@Param("thirdSys") String thirdSys);
boolean updateOrder(IoOrderEntity orderEntity);
}

@ -1,5 +1,6 @@
package com.glxp.api.service.inout.impl;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.inout.IoOrderInvoiceMapper;
@ -41,6 +42,8 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl<IoOrderInvoiceMapper,
@Override
public boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity) {
if (ioOrderInvoiceEntity.getId() == null)
ioOrderInvoiceEntity.setId(IdUtil.getSnowflakeNextId());
return ioOrderInvoiceMapper.insert(ioOrderInvoiceEntity) > 0;
}

@ -14,9 +14,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.*;
import com.glxp.api.dao.basic.*;
import com.glxp.api.dao.inout.IoCodeLostMapper;
import com.glxp.api.dao.inout.IoCodeRelMapper;
import com.glxp.api.dao.inout.IoOrderInvoiceMapper;
import com.glxp.api.dao.inout.*;
import com.glxp.api.dao.purchase.*;
import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao;
import com.glxp.api.dto.RelaySyncDto;
@ -55,6 +53,7 @@ import org.apache.ibatis.session.TransactionIsolationLevel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -1347,7 +1346,6 @@ public class HeartService {
try {
List<IoOrderEntity> orderEntities = syncDataResponse.getOrderEntities();
for (IoOrderEntity orderEntity : orderEntities) {
SyncDataBustypeEntity syncDataBustypeEntity = syncDataBustypeService.findByAction(orderEntity.getAction(), 2);
orderEntity.setUpdateTime(null);
orderEntity.setFromType(ConstantStatus.FROM_UDISP);
@ -1375,7 +1373,8 @@ public class HeartService {
ioCheckInoutService.check(orderEntity.getBillNo());
}
}
} else {
updateOrderDb(syncDataResponse, orderEntity);
}
}
if (fileJson != null && fileJson.size() > 0) {
@ -1830,7 +1829,6 @@ public class HeartService {
List<IoOrderDetailBizEntity> orderDetailBizEntities = syncDataResponse.getOrderDetailBizEntities();
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
if (bizEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
bizEntity.setId(null);
orderDetailBizService.insert(bizEntity);
}
}
@ -1841,7 +1839,6 @@ public class HeartService {
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = syncDataResponse.getOrderDetailCodeEntities();
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
if (codeEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
codeEntity.setId(null);
orderDetailCodeService.insert(codeEntity);
}
}
@ -1864,7 +1861,49 @@ public class HeartService {
List<IoOrderInvoiceEntity> orderInvoiceEntities = syncDataResponse.getOrderInvoiceEntities();
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
if (orderInvoiceEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
orderInvoiceEntity.setId(IdUtil.getSnowflakeNextId());
orderInvoiceService.insertInvoice(orderInvoiceEntity);
}
}
}
}
@Resource
IoOrderDetailBizDao ioOrderDetailBizDao;
@Resource
IoOrderDetailCodeDao ioOrderDetailCodeDao;
@Resource
IoOrderDao orderDao;
@Resource
public void updateOrderDb(SpsSyncOrderResponse syncDataResponse, IoOrderEntity orderEntity) {
orderDao.updateOrder(orderEntity);
//更新业务详情
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailBizEntities())) {
List<IoOrderDetailBizEntity> orderDetailBizEntities = syncDataResponse.getOrderDetailBizEntities();
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
if (bizEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
ioOrderDetailBizDao.insertOrUpdate(bizEntity);
}
}
}
//更新码详情
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities())) {
List<IoOrderDetailCodeEntity> orderDetailCodeEntities = syncDataResponse.getOrderDetailCodeEntities();
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
if (codeEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
ioOrderDetailCodeDao.insertOrUpdate(codeEntity);
}
}
}
//更新发票信息
if (CollUtil.isNotEmpty(syncDataResponse.getOrderInvoiceEntities())) {
List<IoOrderInvoiceEntity> orderInvoiceEntities = syncDataResponse.getOrderInvoiceEntities();
for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) {
if (orderInvoiceEntity.getOrderIdFk().equals(orderEntity.getBillNo())) {
orderInvoiceService.insertInvoice(orderInvoiceEntity);
}
}

@ -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>
@ -140,20 +140,24 @@
<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
(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
(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
@ -196,10 +200,12 @@
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')
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')
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
@ -320,7 +326,7 @@
</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')
date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[
@ -340,7 +346,7 @@
FROM basic_bussiness_type
WHERE supplementOrderType IS NOT NULL
OR supplementOrderType
!= '')
!= '')
</select>
<select id="selectBillNos" resultType="com.glxp.api.res.inout.OrderNoResult">
@ -351,17 +357,17 @@
<select id="selectUploadOrder" 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>
io.dealStatus = 3
@ -382,7 +388,7 @@
</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')
date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="startTime != null and startTime != '' and (endTime == null or endTime == '')">
AND date_format(createTime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d')
@ -409,13 +415,24 @@
<select id="selectWaitSubmitOrder" resultType="java.lang.String">
select t.billNo
from io_order t
left join thr_system_bus_api t1 on t.action = t1.code
left join thr_system_bus_api t1 on t.action = t1.code
<where>
t.status = 7
and exportStatus = 0
and exportStatus = 0
<if test="thirdSys != null and thirdSys != ''">
AND t1.thirdSys = #{thirdSys}
</if>
</where>
</select>
<update id="updateOrder" parameterType="com.glxp.api.entity.inout.IoOrderEntity">
UPDATE io_order
<trim prefix="set" suffixOverrides=",">
<if test="checkStatus != null">
checkStatus=#{checkStatus},
</if>
</trim>
WHERE billNo = #{billNo}
</update>
</mapper>

Loading…
Cancel
Save