mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、部分接口板件孔/造型数量sql规范性修正、部分接口排版面字段补充;2、禅道bug#1679修复;3、需求#37实现;
This commit is contained in:
@@ -87,6 +87,11 @@
|
||||
<artifactId>cf-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Job 定时任务相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
|
||||
+3
@@ -67,6 +67,9 @@ public class PackageDetailsRespVO {
|
||||
@Schema(description = "是否有孔")
|
||||
private Boolean isRowHole;
|
||||
|
||||
@Schema(description = "排版面")
|
||||
private Integer holeArrange;
|
||||
|
||||
@Schema(description = "加工组")
|
||||
private String processGroup;
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class OrderViewPlatePageRespVO {
|
||||
private Boolean isRowHole;
|
||||
|
||||
@Schema(description = "排版面")
|
||||
private Integer holeFace;
|
||||
private Integer holeArrange;
|
||||
|
||||
@Schema(description = "开门类型")
|
||||
private Integer openDoorType;
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ public class OrdersViewPlatesPageDO {
|
||||
/**
|
||||
* 排版面
|
||||
*/
|
||||
private Integer holeFace;
|
||||
private Integer holeArrange;
|
||||
|
||||
/**
|
||||
* 开门类型
|
||||
|
||||
+7
@@ -224,4 +224,11 @@ public interface GoodsMapper extends BaseMapperX<GoodsDO> {
|
||||
* @return
|
||||
*/
|
||||
List<Long> getParentOrderIdsByGoodsIds(@Param("goodsIds") List<String> goodsId, @Param("orderIds") List<Long> orderIds);
|
||||
|
||||
/**
|
||||
* 物理删除订单材质
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+17
-3
@@ -261,11 +261,18 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
.eqIfPresent(OrderDO::getId, id));
|
||||
}
|
||||
|
||||
// 查询修改时间距离当天日期为30的订单
|
||||
default List<Long> selectOrderListByUpdateTime() {
|
||||
/**
|
||||
* 查询修改时间距离当天日期为30的订单
|
||||
*
|
||||
* @param organId
|
||||
* @return
|
||||
*/
|
||||
default List<Long> selectOrderListByUpdateTime(Long organId) {
|
||||
return selectList(new LambdaQueryWrapper<OrderDO>()
|
||||
.eq(OrderDO::getDeleted, OrderDeletedEnum.DELETED.getStatus())
|
||||
.lt(OrderDO::getUpdateTime, LocalDateTime.now().minusDays(30))).stream().map(OrderDO::getId).toList();
|
||||
.lt(OrderDO::getUpdateTime, LocalDateTime.now().minusDays(30))
|
||||
.eq(OrderDO::getOrganId, organId)
|
||||
).stream().map(OrderDO::getId).toList();
|
||||
}
|
||||
|
||||
default int updateOrderListStatus(List<Long> orderIds, Integer status,Long organId) {
|
||||
@@ -393,4 +400,11 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
||||
* @return
|
||||
*/
|
||||
List<OrderPackNumDO> selectPackPartsNum(@Param("orderIds") Collection<Long> orderIds);
|
||||
|
||||
/**
|
||||
* 物理删除订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("orderIds") List<Long> orderIds);
|
||||
}
|
||||
|
||||
+7
@@ -204,4 +204,11 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
|
||||
* @return
|
||||
*/
|
||||
List<OrderBodyPlateNumDO> selectPlateNumAndArea(@Param("orderBodyIds") Collection<Long> orderBodyIds, @Param("delete") Boolean delete);
|
||||
|
||||
/**
|
||||
* 物理删除订单材质
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+6
@@ -152,4 +152,10 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
|
||||
|
||||
List<OrderIds> selectFilterGoodsPlateList(@Param(Constants.WRAPPER) Wrapper<OrderGroupDO> wrapper);
|
||||
|
||||
/**
|
||||
* 物理删除订单材质
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+7
@@ -352,4 +352,11 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
@Param("pageSize") int pageSize,
|
||||
@Param("bodyIds") Set<Long> bodyIds,
|
||||
@Param("compIds") Set<Long> componentIds);
|
||||
|
||||
/**
|
||||
* 物理删除订单材质
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+6
@@ -151,4 +151,10 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
|
||||
|
||||
List<LabelOrderPartsData> selectLabelOrderPartsData(@Param("orderIds") List<Long> orderIds, @Param("organId") Long organId);
|
||||
|
||||
/**
|
||||
* 物理删除订单配件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+7
@@ -88,4 +88,11 @@ public interface OrderComponentMapper extends BaseMapperX<OrderComponentDO> {
|
||||
* @param componentIds
|
||||
*/
|
||||
void updateOrderComponentsDeletedStatus(@Param("orderId") Long orderId, @Param("componentIds") List<Long> componentIds, @Param("delete") boolean delete);
|
||||
|
||||
/**
|
||||
* 物理删除订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> id);
|
||||
}
|
||||
+7
@@ -458,4 +458,11 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
* @return
|
||||
*/
|
||||
IPage<OrdersViewPlatesPageDO> selectPlanPlateInfoPage(@Param("page") IPage<OrdersViewPlatesPageDO> page, @Param("planIds") List<Long> planIds, @Param("orderIds") Set<Long> orderIds);
|
||||
|
||||
/**
|
||||
* 物理删除订单材质
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int physicalDeleteByOrderIds(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+9
-9
@@ -150,19 +150,19 @@ public class OrderInfoVersionControlServiceImpl implements OrderInfoVersionContr
|
||||
.collect(Collectors.toMap(OrderDO::getId, Function.identity()));
|
||||
|
||||
List<OrderPackNumDO> orderPackPlateNumDOS = orderMapper.selectPackPlateNum(orderIds);
|
||||
List<OrderPackNumDO> orderPackPartsNumDOS = orderMapper.selectPackPartsNum(orderIds);
|
||||
Map<Long, Integer> orderPackPartsNumMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(orderPackPartsNumDOS)) {
|
||||
orderPackPartsNumMap = orderPackPartsNumDOS.stream()
|
||||
.collect(Collectors.toMap(OrderPackNumDO::getOrderId, OrderPackNumDO::getPartsNum));
|
||||
}
|
||||
// List<OrderPackNumDO> orderPackPartsNumDOS = orderMapper.selectPackPartsNum(orderIds);
|
||||
// Map<Long, Integer> orderPackPartsNumMap = new HashMap<>();
|
||||
// if (CollUtil.isNotEmpty(orderPackPartsNumDOS)) {
|
||||
// orderPackPartsNumMap = orderPackPartsNumDOS.stream()
|
||||
// .collect(Collectors.toMap(OrderPackNumDO::getOrderId, OrderPackNumDO::getPartsNum));
|
||||
// }
|
||||
|
||||
for (OrderPackNumDO orderPackPlateNumDO : orderPackPlateNumDOS) {
|
||||
Long orderId = orderPackPlateNumDO.getOrderId();
|
||||
// 当前订单下已打包板件
|
||||
Integer plateNum = orderPackPlateNumDO.getPlateNum();
|
||||
// 当前订单下已打包配件
|
||||
Integer partsNum = orderPackPartsNumMap.getOrDefault(orderId, 0);
|
||||
// // 当前订单下已打包配件
|
||||
// Integer partsNum = orderPackPartsNumMap.getOrDefault(orderId, 0);
|
||||
|
||||
OrderDO orderDO = orderMap.get(orderId);
|
||||
|
||||
@@ -175,7 +175,7 @@ public class OrderInfoVersionControlServiceImpl implements OrderInfoVersionContr
|
||||
.eq(OrderDO::getId, orderId)
|
||||
.eq(OrderDO::getVersion, version)
|
||||
.set(OrderDO::getPackedPlatesCount, plateNum)
|
||||
.set(OrderDO::getPackedPartsCount, partsNum)
|
||||
// .set(OrderDO::getPackedPartsCount, partsNum)
|
||||
.set(OrderDO::getVersion, version + 1);
|
||||
int update = orderMapper.update(updateWrapper);
|
||||
if (update == 0) {
|
||||
|
||||
+7
@@ -230,4 +230,11 @@ public interface OrderService {
|
||||
* @return
|
||||
*/
|
||||
List<OrderPrintInfoRespVO> getOrderPrintInfo(List<Long> orderIds);
|
||||
|
||||
/**
|
||||
* 订单作废超过30天清理
|
||||
*
|
||||
* @param organId
|
||||
*/
|
||||
void expireByOrganId(Long organId);
|
||||
}
|
||||
+225
-9
@@ -7,10 +7,11 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.enums.DeletedCodeEnum;
|
||||
import com.cf.imes.framework.common.enums.OrderPackageStatusEnum;
|
||||
@@ -46,6 +47,7 @@ import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemTempDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
@@ -61,6 +63,7 @@ import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemTempBatchMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemTempMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.planitem.PlanItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
|
||||
@@ -81,11 +84,13 @@ import com.cf.imes.module.executor.util.deviseData.structure.PlateDetail;
|
||||
import com.cf.imes.module.executor.util.elasticsearch.EsUtils;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataTypeVo;
|
||||
import com.cf.imes.module.infra.api.file.FileApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.aop.framework.AopContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -116,6 +121,7 @@ import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Resource
|
||||
@@ -151,9 +157,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
@Resource
|
||||
private IdentifierGenerator identifierGenerator;
|
||||
|
||||
@Resource
|
||||
private PartsMapper partsMapper;
|
||||
|
||||
@@ -183,6 +186,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Lazy
|
||||
private PackService packService;
|
||||
|
||||
@Resource
|
||||
private OrderComponentMapper orderComponentMapper;
|
||||
|
||||
@Resource
|
||||
private OrderInfoVersionControlService orderInfoVersionControlService;
|
||||
|
||||
@@ -932,11 +938,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
orderMapper.deleteOrder(orderId, getUserOrganId()); // 订单删除
|
||||
|
||||
// 删除板材的造型数据 es
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL.getIndex());
|
||||
// 删除备注信息 es
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PARTS_REMARK_MODEL.getIndex());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1899,4 +1900,219 @@ public class OrderServiceImpl implements OrderService {
|
||||
);
|
||||
return BeanUtil.copyToList(orderDOS, OrderPrintInfoRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("imes_prod")
|
||||
@Transactional(
|
||||
rollbackFor = Exception.class,
|
||||
propagation = Propagation.REQUIRES_NEW)
|
||||
public void expireByOrganId(Long organId) {
|
||||
try {
|
||||
List<Long> orderDOList = orderMapper.selectOrderListByUpdateTime(organId);
|
||||
|
||||
if (CollUtil.isNotEmpty(orderDOList)) {
|
||||
// 每10条订单删除一次
|
||||
List<List<Long>> split = CollUtil.split(orderDOList, 10);
|
||||
// 订单各种组成每1000条删除一次,直到完全删除
|
||||
for (List<Long> orderIdBatch : split) {
|
||||
goodsClean(orderIdBatch);
|
||||
orderBodyClean(orderDOList);
|
||||
orderGroupClean(orderDOList);
|
||||
orderPartsClean(orderDOList);
|
||||
orderItemClean(orderDOList);
|
||||
plateClean(orderDOList);
|
||||
orderComponentClean(orderDOList);
|
||||
orderClean(orderDOList);
|
||||
}
|
||||
System.out.println("=======1清理1111111111111111");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("订单作废30天清理异常,组织{}", organId, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单材质
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void goodsClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = goodsMapper.selectList(
|
||||
Wrappers.<GoodsDO>lambdaQuery()
|
||||
.select(GoodsDO::getId)
|
||||
.in(GoodsDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(GoodsDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
goodsMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单柜体
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void orderBodyClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = orderBodyMapper.selectList(
|
||||
Wrappers.<OrderBodyDO>lambdaQuery()
|
||||
.select(OrderBodyDO::getId)
|
||||
.in(OrderBodyDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(OrderBodyDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
orderBodyMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单加工组
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void orderGroupClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = orderGroupMapper.selectList(
|
||||
Wrappers.<OrderGroupDO>lambdaQuery()
|
||||
.select(OrderGroupDO::getId)
|
||||
.in(OrderGroupDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(OrderGroupDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
orderGroupMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单配件
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void orderPartsClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = orderPartsMapper.selectList(
|
||||
Wrappers.<OrderPartsDO>lambdaQuery()
|
||||
.select(OrderPartsDO::getId)
|
||||
.in(OrderPartsDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(OrderPartsDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
orderPartsMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单关联明细
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void orderItemClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = orderItemMapper.selectList(
|
||||
Wrappers.<OrderItemDO>lambdaQuery()
|
||||
.select(OrderItemDO::getId)
|
||||
.in(OrderItemDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(OrderItemDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
orderItemMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单板件
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void plateClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = plateMapper.selectList(
|
||||
Wrappers.<PlateDO>lambdaQuery()
|
||||
.select(PlateDO::getId)
|
||||
.in(PlateDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(PlateDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
plateMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单部件
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void orderComponentClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = orderComponentMapper.selectList(
|
||||
Wrappers.<OrderComponentDO>lambdaQuery()
|
||||
.select(OrderComponentDO::getId)
|
||||
.in(OrderComponentDO::getOrderId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(OrderComponentDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
orderComponentMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 物理删除订单
|
||||
*
|
||||
* @param orderIds
|
||||
*/
|
||||
public void orderClean(List<Long> orderIds) {
|
||||
while (true) {
|
||||
List<Long> ids = orderMapper.selectList(
|
||||
Wrappers.<OrderDO>lambdaQuery()
|
||||
.select(OrderDO::getId)
|
||||
.in(OrderDO::getId, orderIds)
|
||||
.last("limit 1000")
|
||||
).stream()
|
||||
.map(OrderDO::getId)
|
||||
.toList();
|
||||
if (ids.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
orderMapper.physicalDeleteByOrderIds(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.cf.imes.module.executor.service.order.intervalometer;
|
||||
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.organ.core.job.OrganJob;
|
||||
import com.cf.imes.module.executor.service.order.OrderService;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 订单定时处理器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OrderInvalidCleanJob {
|
||||
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
@XxlJob("orderInvalidCleanJob")
|
||||
@OrganJob
|
||||
public void execute() {
|
||||
orderService.expireByOrganId(OrganContextHolder.getOrganId());
|
||||
}
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
package com.cf.imes.module.executor.service.order.intervalometer;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PARTS_REMARK_MODEL;
|
||||
import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL;
|
||||
|
||||
|
||||
/**
|
||||
* 订单定时处理器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@DS("slave")
|
||||
public class OrderScheduledImpl {
|
||||
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Resource
|
||||
private RawGoodsMapper rawGoodsMapper;
|
||||
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Resource
|
||||
private OrderPartsMapper orderPartsMapper;
|
||||
|
||||
@Resource
|
||||
private PlateMapper plateMapper;
|
||||
|
||||
@Resource
|
||||
private OrderBodyMapper orderBodyMapper;
|
||||
|
||||
@Resource
|
||||
private OrderGroupMapper orderGroupMapper;
|
||||
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
|
||||
// @Scheduled(cron = "0 0 2 * * ?")
|
||||
@OrganIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void fixedDeletedOrder() {
|
||||
|
||||
List<Long> orderDOList = orderMapper.selectOrderListByUpdateTime();
|
||||
|
||||
// 作废 订单表,body,group,goods,parts,plate,raw_goods,item
|
||||
rawGoodsMapper.deleteBatch(orderDOList);
|
||||
goodsMapper.deleteBatch(orderDOList);
|
||||
orderItemMapper.deleteBatch(orderDOList);
|
||||
orderBodyMapper.deleteBatch(orderDOList);
|
||||
orderGroupMapper.deleteBatch(orderDOList);
|
||||
|
||||
orderPartsMapper.deleteBatch(orderDOList);
|
||||
plateMapper.deleteBatch(orderDOList);
|
||||
|
||||
orderMapper.deleteBatchIds(orderDOList); // 订单删除
|
||||
|
||||
// 删除板材的造型数据 es
|
||||
orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PLATE_MODEL.getIndex());
|
||||
// 删除备注信息 es
|
||||
orderInputProcessor.deleteByOrderId(orderDOList, ORDER_PARTS_REMARK_MODEL.getIndex());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -621,5 +621,13 @@
|
||||
|
||||
</select>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_goods
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
+9
-1
@@ -934,7 +934,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectPackPlateNum" resultType="com.cf.imes.module.executor.dal.dataobject.order.OrderPackNumDO">
|
||||
select o.id as orderId, count(oi.plate_id) as plateNum
|
||||
select o.id as orderId, count(distinct oi.plate_id) as plateNum
|
||||
from orders o
|
||||
left join order_item oi
|
||||
on o.organ_id = oi.organ_id
|
||||
@@ -964,4 +964,12 @@
|
||||
) t
|
||||
group by order_id
|
||||
</select>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from orders
|
||||
where id in
|
||||
<foreach item="orderIds" collection="orderIds" open="(" separator="," close=")">
|
||||
#{orderIds}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+8
@@ -95,4 +95,12 @@
|
||||
</foreach>
|
||||
GROUP BY oi.body_id
|
||||
</select>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_body
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+7
@@ -101,4 +101,11 @@
|
||||
|
||||
</select>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_group
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+8
@@ -1027,4 +1027,12 @@
|
||||
LIMIT #{pageSize}
|
||||
|
||||
</select>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_item
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+8
@@ -629,4 +629,12 @@
|
||||
and op.id = #{partsId};
|
||||
|
||||
</update>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_parts
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+8
@@ -151,4 +151,12 @@
|
||||
</foreach>
|
||||
and deleted != #{delete}
|
||||
</update>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_component
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+42
-34
@@ -472,7 +472,7 @@
|
||||
op.open_door_type as openDoorType,
|
||||
op.offset_x as offsetX,
|
||||
op.offset_y as offsetY,
|
||||
(op.unregular_point_count > 0 ) AS isSpecialShaped,
|
||||
CASE WHEN op.unregular_point_count > 0 THEN 1 ELSE 0 END AS isSpecialShaped,
|
||||
op.is_sculpt as isSculpt,
|
||||
op.is_side_sculpt AS sideModel,
|
||||
op.is_row_hole as isRowHole,
|
||||
@@ -480,13 +480,13 @@
|
||||
op.model_data as modelData,
|
||||
op.is_2v as is2v,
|
||||
op.is_side_2v as isSide2v,
|
||||
(op.front_model_count > 0 AND op.back_model_count > 0) AS doubleSideModel,
|
||||
(op.front_hole_count > 0 AND op.back_hole_count > 0) AS doubleSideHole,
|
||||
(op.front_model_count > 0) AS frontModel,
|
||||
(op.back_model_count > 0) AS backModel,
|
||||
(op.front_hole_count > 0) AS frontHole,
|
||||
(op.back_hole_count > 0) AS backHole,
|
||||
(op.side_hole_count > 0) AS sideHole
|
||||
CASE WHEN op.front_model_count > 0 AND op.back_model_count > 0 THEN 1 ELSE 0 END AS doubleSideModel,
|
||||
CASE WHEN op.front_hole_count > 0 AND op.back_hole_count > 0 THEN 1 ELSE 0 END AS doubleSideHole,
|
||||
CASE WHEN op.front_model_count > 0 THEN 1 ELSE 0 END AS frontModel,
|
||||
CASE WHEN op.back_model_count > 0 THEN 1 ELSE 0 END AS backModel,
|
||||
CASE WHEN op.front_hole_count > 0 THEN 1 ELSE 0 END AS frontHole,
|
||||
CASE WHEN op.back_hole_count > 0 THEN 1 ELSE 0 END AS backHole,
|
||||
CASE WHEN op.side_hole_count > 0 THEN 1 ELSE 0 END AS sideHole
|
||||
|
||||
FROM order_plate op
|
||||
|
||||
@@ -588,20 +588,20 @@
|
||||
op.open_door_type as openDoorType,
|
||||
op.offset_x as offsetX,
|
||||
op.offset_y as offsetY,
|
||||
(op.unregular_point_count > 0 ) AS isSpecialShaped,
|
||||
CASE WHEN op.unregular_point_count > 0 THEN 1 ELSE 0 END AS isSpecialShaped,
|
||||
op.is_sculpt as isSculpt,
|
||||
op.is_row_hole as isRowHole,
|
||||
op.remark as remark,
|
||||
op.model_data as modelData,
|
||||
op.is_2v as is2v,
|
||||
op.is_side_2v as isSide2v,
|
||||
(op.front_model_count > 0 AND op.back_model_count > 0) AS doubleSideModel,
|
||||
(op.front_hole_count > 0 AND op.back_hole_count > 0) AS doubleSideHole,
|
||||
(op.front_model_count > 0) AS frontModel,
|
||||
(op.back_model_count > 0) AS backModel,
|
||||
(op.front_hole_count > 0) AS frontHole,
|
||||
(op.back_hole_count > 0) AS backHole,
|
||||
(op.side_hole_count > 0) AS sideHole
|
||||
CASE WHEN op.front_model_count > 0 AND op.back_model_count > 0 THEN 1 ELSE 0 END AS doubleSideModel,
|
||||
CASE WHEN op.front_hole_count > 0 AND op.back_hole_count > 0 THEN 1 ELSE 0 END AS doubleSideHole,
|
||||
CASE WHEN op.front_model_count > 0 THEN 1 ELSE 0 END AS frontModel,
|
||||
CASE WHEN op.back_model_count > 0 THEN 1 ELSE 0 END AS backModel,
|
||||
CASE WHEN op.front_hole_count > 0 THEN 1 ELSE 0 END AS frontHole,
|
||||
CASE WHEN op.back_hole_count > 0 THEN 1 ELSE 0 END AS backHole,
|
||||
CASE WHEN op.side_hole_count > 0 THEN 1 ELSE 0 END AS sideHole
|
||||
|
||||
FROM order_plate op
|
||||
|
||||
@@ -1507,21 +1507,21 @@
|
||||
p.reserved_edge_down AS reservedEdgeDown,
|
||||
p.area,
|
||||
p.texture,
|
||||
(p.unregular_point_count > 0 ) AS isSpecialShaped,
|
||||
CASE WHEN p.unregular_point_count > 0 THEN 1 ELSE 0 END AS isSpecialShaped,
|
||||
p.is_sculpt ,
|
||||
p.is_side_sculpt AS sideModel,
|
||||
p.is_row_hole,
|
||||
p.hole_face,
|
||||
p.hole_arrange,
|
||||
p.open_door_type,
|
||||
p.is_2v as is2v,
|
||||
p.is_side_2v as isSide2v,
|
||||
(p.front_model_count > 0 AND p.back_model_count > 0) AS doubleSideModel,
|
||||
(p.front_hole_count > 0 AND p.back_hole_count > 0) AS doubleSideHole,
|
||||
(p.front_model_count > 0) AS frontModel,
|
||||
(p.back_model_count > 0) AS backModel,
|
||||
(p.front_hole_count > 0) AS frontHole,
|
||||
(p.back_hole_count > 0) AS backHole,
|
||||
(p.side_hole_count > 0) AS sideHole,
|
||||
CASE WHEN p.front_model_count > 0 AND p.back_model_count > 0 THEN 1 ELSE 0 END AS doubleSideModel,
|
||||
CASE WHEN p.front_hole_count > 0 AND p.back_hole_count > 0 THEN 1 ELSE 0 END AS doubleSideHole,
|
||||
CASE WHEN p.front_model_count > 0 THEN 1 ELSE 0 END AS frontModel,
|
||||
CASE WHEN p.back_model_count > 0 THEN 1 ELSE 0 END AS backModel,
|
||||
CASE WHEN p.front_hole_count > 0 THEN 1 ELSE 0 END AS frontHole,
|
||||
CASE WHEN p.back_hole_count > 0 THEN 1 ELSE 0 END AS backHole,
|
||||
CASE WHEN p.side_hole_count > 0 THEN 1 ELSE 0 END AS sideHole,
|
||||
p.split_height,
|
||||
p.split_width,
|
||||
og.material,
|
||||
@@ -1644,21 +1644,21 @@
|
||||
p.reserved_edge_down AS reservedEdgeDown,
|
||||
p.area,
|
||||
p.texture,
|
||||
(p.unregular_point_count > 0 ) AS isSpecialShaped,
|
||||
CASE WHEN p.unregular_point_count > 0 THEN 1 ELSE 0 END AS isSpecialShaped,
|
||||
p.is_sculpt ,
|
||||
p.is_side_sculpt AS sideModel,
|
||||
p.is_row_hole,
|
||||
p.hole_face,
|
||||
p.hole_arrange,
|
||||
p.open_door_type,
|
||||
p.is_2v as is2v,
|
||||
p.is_side_2v as isSide2v,
|
||||
(p.front_model_count > 0 AND p.back_model_count > 0) AS doubleSideModel,
|
||||
(p.front_hole_count > 0 AND p.back_hole_count > 0) AS doubleSideHole,
|
||||
(p.front_model_count > 0) AS frontModel,
|
||||
(p.back_model_count > 0) AS backModel,
|
||||
(p.front_hole_count > 0) AS frontHole,
|
||||
(p.back_hole_count > 0) AS backHole,
|
||||
(p.side_hole_count > 0) AS sideHole,
|
||||
CASE WHEN p.front_model_count > 0 AND p.back_model_count > 0 THEN 1 ELSE 0 END AS doubleSideModel,
|
||||
CASE WHEN p.front_hole_count > 0 AND p.back_hole_count > 0 THEN 1 ELSE 0 END AS doubleSideHole,
|
||||
CASE WHEN p.front_model_count > 0 THEN 1 ELSE 0 END AS frontModel,
|
||||
CASE WHEN p.back_model_count > 0 THEN 1 ELSE 0 END AS backModel,
|
||||
CASE WHEN p.front_hole_count > 0 THEN 1 ELSE 0 END AS frontHole,
|
||||
CASE WHEN p.back_hole_count > 0 THEN 1 ELSE 0 END AS backHole,
|
||||
CASE WHEN p.side_hole_count > 0 THEN 1 ELSE 0 END AS sideHole,
|
||||
p.split_height,
|
||||
p.split_width,
|
||||
og.material,
|
||||
@@ -1678,6 +1678,14 @@
|
||||
and p.deleted = false
|
||||
</select>
|
||||
|
||||
<delete id="physicalDeleteByOrderIds">
|
||||
delete from order_plate
|
||||
where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<resultMap id="orderItemMap" type="com.cf.imes.module.executor.controller.admin.manage.query.vo.pack.PackageDetailsRespVO">
|
||||
<result property="packageNo" column="packageId"/>
|
||||
<result property="roomName" column="roomName"/>
|
||||
|
||||
Reference in New Issue
Block a user