fix:合同改单,废单时与新华三保持数据同步

dev_1.0.2^2
UNISINSIGHT\rdpnr_jiangpeng 2026-03-20 16:49:46 +08:00
parent 2373b13fc6
commit 6b62162e8d
19 changed files with 402 additions and 26 deletions

View File

@ -4,10 +4,7 @@ import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.service.IDeliveryListService;
import com.ruoyi.sip.service.IInventoryDeliveryService;
import com.ruoyi.sip.service.IOrderInfoService;
import com.ruoyi.sip.service.IProjectOrderInfoService;
import com.ruoyi.sip.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -34,16 +31,15 @@ public class ExternalController {
private IDeliveryListService deliveryListService;
@Autowired
private IOrderInfoService orderInfoService;
@Autowired
private IProjectOrderInfoService projectOrderInfoService;
@Autowired
private IInventoryDeliveryService deliveryService;
@Autowired
private IProjectOrderInfoRecallService projectOrderInfoRecallService;
private final static String API_KEY = "c7f858d0-30b8-4b7f-9ea1-0ccf5ceb1c54";
@GetMapping("/v1/order/info")
@Anonymous
public AjaxResult getOrderInfo(@Validated ApiDataQueryDto dto, @RequestHeader(value = "apiKey",required = false) String apiKey) {
@ -68,4 +64,17 @@ public class ExternalController {
}
return AjaxResult.success(deliveryService.getNumberInfo(dto));
}
@GetMapping("/v1/order/recall/info")
@Anonymous
public AjaxResult getOrderRecallInfo(@Validated ApiDataQueryDto dto, @RequestHeader(value = "apiKey",required = false) String apiKey) {
if (StringUtils.isEmpty(apiKey)) {
return AjaxResult.error("apiKey不能为空");
}
if (!API_KEY.equals(apiKey)){
return AjaxResult.error("鉴权失败");
}
return AjaxResult.success(projectOrderInfoRecallService.getOrderRecallInfo(dto));
}
}

View File

@ -171,7 +171,7 @@ public class InventoryDeliveryController extends BaseController
@ResponseBody
public AjaxResult remove(Long id)
{
return toAjax(inventoryDeliveryService.deleteInventoryOuterById(id));
return toAjax(inventoryDeliveryService.deleteInventoryOuterById(id, true));
}
@Log(title = "发货记录", businessType = BusinessType.DELETE)
@PostMapping( "/recall")

View File

@ -101,7 +101,7 @@ public class VueDeliveryController extends BaseController {
@Log(title = "发货记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable(value = "id") Long id) {
return toAjax(inventoryDeliveryService.deleteInventoryOuterById(id));
return toAjax(inventoryDeliveryService.deleteInventoryOuterById(id, true));
}
/**

View File

@ -91,6 +91,7 @@ public class InventoryDelivery extends BaseEntity
public enum DeliveryStatusEnum {
WAIT_DELIVERY("0","待发货"),
CONFIRM_DELIVERY("1","已发货"),
RECALL_DELIVERY("2","撤回"),
;
private final String code;

View File

@ -292,6 +292,11 @@ public class ProjectOrderInfo extends BaseEntity {
private String keyword;
/**
*
*/
private Integer operationVersion;
@Getter
public enum OrderStatus {
WAIT_COMMIT("0", "待提交"),

View File

@ -0,0 +1,44 @@
package com.ruoyi.sip.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* project_order_info_recall
*
* @author ruoyi
* @date 2025-03-20
*/
@Data
public class ProjectOrderInfoRecall extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键,自增 */
private Long id;
/** 合同编号 */
@Excel(name = "合同编号")
private String orderCode;
/** 版本号 */
@Excel(name = "版本号")
private Integer versionCode;
/** 操作版本 */
@Excel(name = "操作版本")
private Integer operationVersion;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 创建人 id */
@Excel(name = "创建人 id")
private String createBy;
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.InventoryDelivery;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.vo.DeliveryApproveVo;
import com.ruoyi.sip.vo.DeliveryInfoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -67,4 +68,7 @@ public interface InventoryDeliveryMapper
List<InventoryDelivery> selectQuantityByOrderCodeStatus(@Param("orderCode") String orderCode, @Param("status") String code);
List<DeliveryInfoVo> listSn(ApiDataQueryDto dto);
List<DeliveryApproveVo> selectDeliveryApproveList(@Param("id") Long id);
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.InventoryDelivery;
import com.ruoyi.sip.domain.ProjectOrderInfo;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
@ -84,4 +86,6 @@ public interface ProjectOrderInfoMapper
List<ProjectOrderInfo> listLog(ProjectOrderInfo projectOrderInfo);
List<InventoryDelivery> selectInentoryDeliveryByProjectOrderInfoId(@Param("id") Long id);
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.ProjectOrderInfoRecall;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.vo.ProjectOrderInfoRecallVO;
/**
* Mapper
*
* @author ruoyi
* @date 2025-03-20
*/
public interface ProjectOrderInfoRecallMapper
{
/**
*
*
* @param projectOrderInfoRecall
* @return
*/
int insertProjectOrderInfoRecall(ProjectOrderInfoRecall projectOrderInfoRecall);
List<ProjectOrderInfoRecallVO> getOrderRecallInfo(ApiDataQueryDto dto);
}

View File

@ -64,7 +64,7 @@ public interface IInventoryDeliveryService
void statusUpdate(InventoryDelivery inventoryDelivery);
int deleteInventoryOuterById(Long id);
int deleteInventoryOuterById(Long id, boolean realDeleted);
List<DeliveryInfoVo> getNumberInfo(ApiDataQueryDto dto);

View File

@ -0,0 +1,27 @@
package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.domain.ProjectOrderInfoRecall;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.vo.ProjectOrderInfoRecallVO;
/**
* Service
*
* @author ruoyi
* @date 2025-03-20
*/
public interface IProjectOrderInfoRecallService
{
/**
*
*
* @param projectOrderInfoRecall
* @return
*/
int insertProjectOrderInfoRecall(ProjectOrderInfoRecall projectOrderInfoRecall);
List<ProjectOrderInfoRecallVO> getOrderRecallInfo(ApiDataQueryDto dto);
}

View File

@ -3,6 +3,8 @@ package com.ruoyi.sip.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.dto.inventory.ProductDetail;
import com.ruoyi.sip.dto.inventory.ProductWarehouseInfo;
@ -10,7 +12,9 @@ import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.mapper.InventoryDeliveryMapper;
import com.ruoyi.sip.mapper.ProjectOrderInfoMapper;
import com.ruoyi.sip.service.*;
import com.ruoyi.sip.vo.DeliveryApproveVo;
import com.ruoyi.sip.vo.ExecutionOrderVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -55,6 +59,8 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
private TodoService todoService;
@Autowired
private IProjectProductInfoBakService projectProductInfoBakService;
@Autowired
private IProjectOrderInfoRecallService projectOrderInfoRecallService;
@Override
public ExecutionOrderVo selectInfo(Long id) {
ExecutionOrderVo vo = new ExecutionOrderVo();
@ -237,6 +243,14 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
@Override
@Transactional(rollbackFor = Exception.class)
public void recall(Long id) {
List<InventoryDelivery> inventoryDeliveryList = projectOrderInfoMapper.selectInentoryDeliveryByProjectOrderInfoId(id);
for (InventoryDelivery inventoryDelivery : inventoryDeliveryList) {
List<DeliveryApproveVo> deliveryApproveVoList = deliveryMapper.selectDeliveryApproveList(inventoryDelivery.getId());
if (CollectionUtils.isNotEmpty(deliveryApproveVoList)) {
throw new ServiceException("存在已完成或审批中的应收、应付信息,无法执行撤回操作");
}
}
//查询订单
ProjectOrderInfo projectOrderInfo = projectOrderInfoMapper.selectProjectOrderInfoById(id);
//还原数据
@ -249,8 +263,16 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
updateOrder.setVersionCode(String.valueOf(Integer.parseInt(projectOrderInfo.getVersionCode())+1));
updateOrder.setOrderStatus(ProjectOrderInfo.OrderStatus.APPROVE_REJECT.getCode());
updateOrder.setActualPurchaseAmount(projectOrderInfo.getShipmentAmount());
updateOrder.setUpdateTime(new Date());
updateOrder.setId(id);
projectOrderInfoMapper.updateProjectOrderInfo(updateOrder);
//订单撤回记录
ProjectOrderInfoRecall projectOrderInfoRecall = new ProjectOrderInfoRecall();
projectOrderInfoRecall.setOrderCode(projectOrderInfo.getOrderCode());
projectOrderInfoRecall.setVersionCode(Integer.parseInt(projectOrderInfo.getVersionCode()));
projectOrderInfoRecall.setOperationVersion(projectOrderInfo.getOperationVersion());
projectOrderInfoRecall.setCreateBy(ShiroUtils.getUserId().toString());
projectOrderInfoRecallService.insertProjectOrderInfoRecall(projectOrderInfoRecall);
//剔除流程
todoService.deleteTodoByBusinessKey(projectOrderInfo.getOrderCode());
//修改库存
@ -265,7 +287,13 @@ public class ExecutionTrackServiceImpl implements IExecutionTrackService {
//累计发货
List<InventoryDelivery> inventoryDeliveries = deliveryMapper.selectQuantityByOrderCodeStatus(projectOrderInfo.getOrderCode(), InventoryDelivery.DeliveryStatusEnum.CONFIRM_DELIVERY.getCode());
if (CollUtil.isNotEmpty(inventoryDeliveries)) {
deliveryMapper.deleteInventoryDeliveryByIds(inventoryOuters.stream().map(item -> item.getId().toString()).toArray(String[]::new));
// deliveryMapper.deleteInventoryDeliveryByIds(inventoryOuters.stream().map(item -> item.getId().toString()).toArray(String[]::new));
for (InventoryDelivery inventoryDeliverie : inventoryDeliveries) {
InventoryDelivery updateDelivery = new InventoryDelivery();
updateDelivery.setId(inventoryDeliverie.getId());
updateDelivery.setDeliveryStatus(InventoryDelivery.DeliveryStatusEnum.RECALL_DELIVERY.getCode());
deliveryMapper.updateInventoryDelivery(updateDelivery);
}
}
Map<String, Long> deliveryMap = inventoryDeliveries.stream().collect(Collectors.toMap(InventoryDelivery::getProductCode, InventoryDelivery::getQuantity, Long::sum));
Map<String, ProductInfo> updateMap = new HashMap<>();

View File

@ -17,7 +17,9 @@ import com.ruoyi.sip.dto.inventory.InventoryDeliveryDetailExcelDto;
import com.ruoyi.sip.mapper.InventoryOuterDetailMapper;
import com.ruoyi.sip.mapper.InventoryOuterMapper;
import com.ruoyi.sip.service.*;
import com.ruoyi.sip.vo.DeliveryApproveVo;
import com.ruoyi.sip.vo.DeliveryInfoVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
@ -318,7 +320,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
}
@Override
public int deleteInventoryOuterById(Long id) {
public int deleteInventoryOuterById(Long id, boolean realDelete) {
InventoryDelivery inventoryDelivery = inventoryDeliveryMapper.selectInventoryDeliveryById(id);
//还原库存信息
InventoryInfo inventoryInfo = new InventoryInfo();
@ -328,8 +330,17 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
if (CollUtil.isNotEmpty(inventoryInfos)) {
inventoryInfoService.clearOutInfo(inventoryInfos.stream().map(InventoryInfo::getId).collect(Collectors.toList()));
}
deliveryDetailService.deleteOmsInventoryDeliveryDetailByDeliveryId(id);
return inventoryDeliveryMapper.deleteInventoryDeliveryById(id);
if (realDelete) {
// 原逻辑删除库存表以及sn码的关联
deliveryDetailService.deleteOmsInventoryDeliveryDetailByDeliveryId(id);
return inventoryDeliveryMapper.deleteInventoryDeliveryById(id);
} else {
// 2026-03-19新逻辑仅修改发货单状态为撤回不删除库存表
inventoryDelivery = new InventoryDelivery();
inventoryDelivery.setId(id);
inventoryDelivery.setDeliveryStatus(InventoryDelivery.DeliveryStatusEnum.RECALL_DELIVERY.getCode());
return inventoryDeliveryMapper.updateInventoryDelivery(inventoryDelivery);
}
}
@Override
@ -362,10 +373,13 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
@Override
public void recall(Long id) {
//todo 判断应付或应收状态 不允许退
List<DeliveryApproveVo> deliveryApproveVoList = inventoryDeliveryMapper.selectDeliveryApproveList(id);
if (CollectionUtils.isNotEmpty(deliveryApproveVoList)) {
throw new ServiceException("存在已完成或审批中的应收、应付信息,无法执行撤回操作");
}
InventoryDelivery inventoryDelivery = inventoryDeliveryMapper.selectInventoryDeliveryById(id);
deleteInventoryOuterById(id);
deleteInventoryOuterById(id, false);
List<ProjectProductInfo> projectProductInfos = projectProductInfoService.listDeliveryProductByOrderCode(Collections.singletonList(inventoryDelivery.getOrderCode()));
//软硬件之和
long sum = projectProductInfos.stream().mapToLong(ProjectProductInfo::getQuantity).sum();
@ -394,6 +408,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
updateOrder.setUpdateTime(new Date());
updateOrder.setUpdateBy(ShiroUtils.getUserId().toString());
updateOrder.setDeliveryStatus(sum == allSum ? ProjectOrderInfo.DeliveryStatusEnum.ALL_DELIVERY.getCode() : ProjectOrderInfo.DeliveryStatusEnum.PART_DELIVERY.getCode());
updateOrder.setOperationVersion(updateOrder.getOperationVersion() + 1);
projectOrderInfoService.updateProjectOrderInfoByCode(updateOrder);
//修改累计发货数量
productInfoService.updateCumulativeCount(-inventoryDelivery.getQuantity(), inventoryDelivery.getProductCode());

View File

@ -0,0 +1,49 @@
package com.ruoyi.sip.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.sip.dto.ApiDataQueryDto;
import com.ruoyi.sip.vo.ProjectOrderInfoRecallVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.ProjectOrderInfoRecallMapper;
import com.ruoyi.sip.domain.ProjectOrderInfoRecall;
import com.ruoyi.sip.service.IProjectOrderInfoRecallService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author ruoyi
* @date 2025-03-20
*/
@Service
public class ProjectOrderInfoRecallServiceImpl implements IProjectOrderInfoRecallService
{
@Autowired
private ProjectOrderInfoRecallMapper projectOrderInfoRecallMapper;
/**
*
*
* @param projectOrderInfoRecall
* @return
*/
@Override
public int insertProjectOrderInfoRecall(ProjectOrderInfoRecall projectOrderInfoRecall)
{
projectOrderInfoRecall.setCreateTime(DateUtils.getNowDate());
if (StringUtils.isEmpty(projectOrderInfoRecall.getCreateBy())) {
projectOrderInfoRecall.setCreateBy(ShiroUtils.getUserId().toString());
}
return projectOrderInfoRecallMapper.insertProjectOrderInfoRecall(projectOrderInfoRecall);
}
@Override
public List<ProjectOrderInfoRecallVO> getOrderRecallInfo(ApiDataQueryDto dto) {
return projectOrderInfoRecallMapper.getOrderRecallInfo(dto);
}
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.sip.vo;
import lombok.Data;
@Data
public class DeliveryApproveVo {
/**
* ID
*/
private Long id;
/**
*
*/
private Integer approveStatus;
/**
*
*/
private String approveType;
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.sip.vo;
import lombok.Data;
import java.util.Date;
@Data
public class ProjectOrderInfoRecallVO {
//合同号
private String orderCode;
//版本号
private String versionCode;
private Date lastUpdateTime;
}

View File

@ -81,9 +81,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="listSn" resultType="com.ruoyi.sip.vo.DeliveryInfoVo">
SELECT
t3.order_code,t5.version_code,t5.project_id ,t2.product_sn as 'serialNumber' ,t2.product_code,t4.description
as 'productDescription',t4.type as 'productType',t1.delivery_time as service_start_time,
t1.update_time as 'lastUpdateTime'
t3.order_code,
(ifnull(t5.version_code,0) + ifnull(t5.operation_version,0)) AS version_code,
t5.project_id ,
t2.product_sn as 'serialNumber' ,
t2.product_code,
t4.description as 'productDescription',
t4.type as 'productType',
t1.delivery_time as service_start_time,
t1.update_time as 'lastUpdateTime'
FROM
oms_inventory_delivery t1
inner JOIN oms_inventory_info t2 ON t1.outer_code = t2.outer_code
@ -178,4 +184,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectDeliveryApproveList" resultType="com.ruoyi.sip.vo.DeliveryApproveVo">
select t1.id,t4.approve_status,'FK' as data_type
from oms_inventory_delivery as t1
inner join oms_payable_bill as t2
on t1.outer_code = t2.inventory_code
inner join oms_payable_payment_detail as t3
on t2.id = t3.payable_bill_id
inner join oms_payment_bill as t4
on t3.payment_bill_code = t4.payment_bill_code
where ifnull(t4.approve_status,0) in (1,2)
and t1.id = #{id}
union all
select t1.id,t4.approve_status,'SP' as data_type
from oms_inventory_delivery as t1
inner join oms_payable_bill as t2
on t1.outer_code = t2.inventory_code
inner join oms_payable_ticket_detail as t3
on t2.id = t3.payable_bill_id
inner join oms_ticket_bill as t4
on t3.ticket_bill_code = t4.ticket_bill_code
where ifnull(t4.approve_status,0) in (1,2)
and t1.id = #{id}
union all
select t1.id,t4.approve_status,'SK' as data_type
from oms_inventory_delivery as t1
inner join oms_receivable_bill as t2
on t1.outer_code = t2.inventory_code
inner join oms_receivable_receipt_detail as t3
on t2.id = t3.receivable_bill_id
inner join oms_receipt_bill as t4
on t3.receipt_bill_code = t4.receipt_bill_code
where ifnull(t4.approve_status,0) in (1,2)
and t1.id = #{id}
union all
select t1.id,t4.approve_status,'KP' as data_type
from oms_inventory_delivery as t1
inner join oms_receivable_bill as t2
on t1.outer_code = t2.inventory_code
inner join oms_receivable_invoice_detail as t3
on t2.id = t3.receivable_bill_id
inner join oms_invoice_bill as t4
on t3.invoice_bill_code = t4.invoice_bill_code
where ifnull(t4.approve_status,0) in (1,2)
and t1.id = #{id}
</select>
</mapper>

View File

@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="paymentMethod" column="payment_method" />
<result property="paymentRatio" column="payment_ratio" />
<result property="paymentDescription" column="payment_description" />
<result property="operationVersion" column="operation_version" />
</resultMap>
<sql id="selectProjectOrderInfoVo">
@ -44,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
shipment_amount, actual_purchase_amount, order_end_time, delivery_time, company_delivery, notifier,finance_status,
notifier_email, notifier_phone, duty, duty_email, duty_phone, order_channel, partner_code, supplier,notifier_address,
remark, order_status, create_by, create_time, update_by, update_time,version_code,process_type,process_template,discount_fold,
delivery_status,sign_status,outer_status,approve_time,payment_method,payment_ratio,payment_description,order_type
delivery_status,sign_status,outer_status,approve_time,payment_method,payment_ratio,payment_description,order_type,operation_version
from project_order_info t1
</sql>
@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description,t1.operation_version
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code,t2.partner_name project_partner_name
,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address
@ -332,7 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
t1.order_code,
t2.project_name AS 'order_name',
t1.version_code,
(ifnull(t1.version_code,0) + ifnull(t1.operation_version,0)) AS version_code,
t3.contact_person AS 'sale_name',
t3.contact_email AS 'sale_email' ,
t4.customer_name as 'customer_name',
@ -377,7 +378,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description,t1.operation_version
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code,t2.partner_name project_partner_name
,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address
@ -599,6 +600,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="paymentMethod != null and paymentMethod != ''">payment_method,</if>
<if test="paymentRatio != null">payment_ratio,</if>
<if test="paymentDescription != null and paymentDescription != ''">payment_description,</if>
<if test="operationVersion != null">operation_version,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
@ -641,6 +643,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="paymentMethod != null and paymentMethod != ''">#{paymentMethod},</if>
<if test="paymentRatio != null">#{paymentRatio},</if>
<if test="paymentDescription != null and paymentDescription != ''">#{paymentDescription},</if>
<if test="operationVersion != null">#{operationVersion},</if>
</trim>
</insert>
<insert id="bakData">
@ -685,7 +688,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
process_type,
process_template,
order_type,
discount_fold)
discount_fold,
operation_version)
select id,
project_id,
province,
@ -727,7 +731,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
process_type,
process_template,
order_type,
discount_fold
discount_fold,
operation_version
from project_order_info
where order_code = #{orderCode}
</insert>
@ -780,6 +785,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="paymentRatio != null">payment_ratio = #{paymentRatio},</if>
<if test="paymentDescription != null and paymentDescription != ''">payment_description = #{paymentDescription},</if>
<if test="financeStatus != null and financeStatus != ''">finance_status = #{financeStatus},</if>
<if test="operationVersion != null">operation_version = #{operationVersion},</if>
</trim>
where id = #{id}
</update>
@ -796,6 +802,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="paymentMethod != null and paymentMethod != ''">payment_method = #{paymentMethod},</if>
<if test="paymentRatio != null">payment_ratio = #{paymentRatio},</if>
<if test="paymentDescription != null and paymentDescription != ''">payment_description = #{paymentDescription},</if>
<if test="operationVersion != null">operation_version = #{operationVersion},</if>
<if test="versionCode != null">
<choose>
@ -852,4 +859,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectInentoryDeliveryByProjectOrderInfoId" resultType="com.ruoyi.sip.domain.InventoryDelivery">
select t3.*
from project_order_info as t1
inner join oms_inventory_outer as t2
on t1.order_code = t2.order_code
inner join oms_inventory_delivery as t3
on t2.outer_code = t3.outer_code
where t1.id = #{id}
</select>
</mapper>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sip.mapper.ProjectOrderInfoRecallMapper">
<resultMap type="ProjectOrderInfoRecall" id="ProjectOrderInfoRecallResult">
<result property="id" column="id" />
<result property="orderCode" column="order_code" />
<result property="versionCode" column="version_code" />
<result property="operationVersion" column="operation_version" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
</resultMap>
<sql id="selectProjectOrderInfoRecallVo">
select id, order_code, version_code, operation_version, create_time, create_by
from project_order_info_recall
</sql>
<insert id="insertProjectOrderInfoRecall" parameterType="ProjectOrderInfoRecall" useGeneratedKeys="true" keyProperty="id">
insert into project_order_info_recall
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderCode != null and orderCode != ''">order_code,</if>
<if test="versionCode != null">version_code,</if>
<if test="operationVersion != null">operation_version,</if>
<if test="createBy != null">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
<if test="versionCode != null">#{versionCode},</if>
<if test="operationVersion != null">#{operationVersion},</if>
<if test="createBy != null">#{createBy},</if>
</trim>
</insert>
<select id="getOrderRecallInfo" parameterType="com.ruoyi.sip.dto.ApiDataQueryDto" resultType="com.ruoyi.sip.vo.ProjectOrderInfoRecallVO">
select order_code, (ifnull(version_code,0) + ifnull(operation_version,0)) as version_code, create_time as last_update_time
from project_order_info_recall
<where>
<choose>
<when test="queryStartTime!=null and queryEndTime!=null">
and create_time between #{queryStartTime} and #{queryEndTime}
</when>
<when test="queryStartTime!=null">
and create_time <![CDATA[ >= ]]> #{queryStartTime}
</when>
<when test="queryEndTime!=null">
and create_time <![CDATA[ <= ]]> #{queryEndTime}
</when>
</choose>
</where>
</select>
</mapper>