bug修改

This commit is contained in:
lym
2024-09-02 11:52:27 +08:00
parent 4470c9d620
commit 0bea56dd27
9 changed files with 28 additions and 25 deletions
@@ -147,10 +147,10 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
IPage<OrderGoodsResp> selectOrderIds(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
// 生产单预警统计
List<OrderOverdueRespVO> selectOrderNear(@Param("today") LocalDateTime today, @Param("orderDate") LocalDateTime orderDate, @Param("organId") Long organId);
List<OrderOverdueRespVO> selectOrderNear(@Param("orderDate") LocalDate orderDate, @Param("organId") Long organId);
// 生产单逾期统计
List<OrderOverdueRespVO> selectOrderOverdue(@Param("today") LocalDateTime today, @Param("organId") Long organId);
List<OrderOverdueRespVO> selectOrderOverdue(@Param("today") LocalDate today, @Param("organId") Long organId);
/**
* 生产单数量统计
@@ -46,11 +46,12 @@ public interface OrderBodyMapper extends BaseMapperX<OrderBodyDO> {
}
// 单个修改删除状态 by id
default int updateDeletedById(Long id, Integer deleted, Long organId) {
default int updateDeletedById(Long id, Integer deleted, Long organId, Long orderId) {
return update(new LambdaUpdateWrapper<OrderBodyDO>()
.set(OrderBodyDO::getDeleted, deleted)
.eq(OrderBodyDO::getId, id)
.eq(OrderBodyDO::getOrganId, organId));
.eq(OrderBodyDO::getOrganId, organId)
.eq(OrderBodyDO::getOrderId, orderId));
}
default int deletedByOrderId(Long orderId, Long organId) {
@@ -40,11 +40,12 @@ public interface OrderGroupMapper extends BaseMapperX<OrderGroupDO> {
}
// 单个修改删除状态 by bodyId
default int updateDeletedById(Long id, Integer deleted, Long organId) {
default int updateDeletedById(Long id, Integer deleted, Long organId, Long orderId) {
return update(new LambdaUpdateWrapper<OrderGroupDO>()
.set(OrderGroupDO::getDeleted, deleted)
.eq(OrderGroupDO::getBodyId, id)
.eq(OrderGroupDO::getOrganId, organId));
.eq(OrderGroupDO::getOrganId, organId)
.eq(OrderGroupDO::getOrderId, orderId));
}
default int deletedById(Long id, Long organId) {
@@ -70,7 +70,7 @@ public interface OrderPartsMapper extends BaseMapperX<OrderPartsDO> {
List<PrintOrderPartsRespVO> selectPartList( @Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
List<Long> selectPartsIdListByBodyId(@Param("bodyId") Long bodyId, @Param("organId") Long organId);
List<Long> selectPartsIdListByBodyId(@Param("bodyId") Long bodyId, @Param("organId") Long organId, @Param("orderId") Long orderId);
int countPartsByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
@@ -110,7 +110,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
return update(wrapper);
}
void updateDeletedById(@Param("plateIds") List<Long> plateIds, @Param("deleted") Integer deleted, @Param("organId") Long organId);
void updateDeletedById(@Param("plateIds") List<Long> plateIds, @Param("deleted") Integer deleted, @Param("organId") Long organId, @Param("orderId") Long orderId);
int countPlateByOrderId(@Param("orderId") Long orderId, @Param("organId") Long organId, @Param("deleted") Integer deleted);
@@ -161,6 +161,7 @@ public class OrderServiceImpl implements OrderService {
// 将 deliveryDate 设置为 orderDate 后的第 30 天
deliveryDate = orderDate.plusMonths(1);
}
updateReqVO.setDeliveryDate(deliveryDate.atStartOfDay());
// 更新
OrderDO updateObj = BeanUtils.toBean(updateReqVO, OrderDO.class);
if (updateReqVO.getCustomOrderNo() == null || updateReqVO.getCustomOrderNo().equals("")) {
@@ -263,12 +264,12 @@ public class OrderServiceImpl implements OrderService {
if (CollectionUtils.isNotEmpty(bodyIds)) {
bodyIds.forEach(id -> {
// 逻辑删除
orderBodyMapper.updateDeletedById(id, status, getUserOrganId());// 柜体
orderGroupMapper.updateDeletedById(id, status, getUserOrganId());// 加工组
orderBodyMapper.updateDeletedById(id, status, getUserOrganId(), orderId);// 柜体
orderGroupMapper.updateDeletedById(id, status, getUserOrganId(), orderId);// 加工组
if (CollectionUtils.isNotEmpty(plateDOList) ){
// (删除小板) 小板变为删除状态
plateMapper.updateDeletedById(plateDOList, status, getUserOrganId());
plateMapper.updateDeletedById(plateDOList, status, getUserOrganId(), orderId);
// 删除大板
List<PlateDO> goodsIdList = plateMapper.selectPlateNum(orderId, getUserOrganId());
Map<Long, List<PlateDO>> goodsIdMap = goodsIdList.stream()
@@ -296,7 +297,7 @@ public class OrderServiceImpl implements OrderService {
}
}
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(id, getUserOrganId()); // 配件
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(id, getUserOrganId(), orderId); // 配件
orderPartsMapper.updateDeletedById(partsList, status, getUserOrganId());
});
}
@@ -563,16 +564,16 @@ public class OrderServiceImpl implements OrderService {
public Map<String, List<OrderOverdueRespVO>> getOrderWarn() {
Map<String, List<OrderOverdueRespVO>> map = new HashMap<>();
LocalDateTime yesterdayDay = LocalDateTime.now().minus(1, ChronoUnit.DAYS).withHour(23).withMinute(59).withSecond(59);
LocalDate yesterday = LocalDate.now().minus(1, ChronoUnit.DAYS);
LocalDateTime today = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
LocalDateTime tomorrowDay = LocalDateTime.now().plus(1, ChronoUnit.DAYS).withHour(23).withMinute(59).withSecond(59);
LocalDate todayDate = LocalDate.now();
LocalDate tomorrow = LocalDate.now().plus(1, ChronoUnit.DAYS);
// 查询预警单
List<OrderOverdueRespVO> orderNearVOS = orderMapper.selectOrderNear(today, tomorrowDay, OrganContextHolder.getOrganId());
List<OrderOverdueRespVO> orderNearVOS = orderMapper.selectOrderNear(tomorrow, OrganContextHolder.getOrganId());
map.put("orderNearVOS", orderNearVOS);
// 查询超时单
List<OrderOverdueRespVO> orderOverdueVOS = orderMapper.selectOrderOverdue(yesterdayDay, OrganContextHolder.getOrganId());
List<OrderOverdueRespVO> orderOverdueVOS = orderMapper.selectOrderOverdue(todayDate, OrganContextHolder.getOrganId());
map.put("orderOverdueVOS", orderOverdueVOS);
return map;
}
@@ -150,16 +150,16 @@
o.splitter,
o.remark,
CONCAT(
LPAD(FLOOR(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date ) / (24 * 60 * 60)), 2, '0'), '天 ',
LPAD(FLOOR(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)) / (60 * 60)), 2, '0'), ':',
LPAD(FLOOR(MOD(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) / 60), 2, '0'), ':',
LPAD(MOD(MOD(TIMESTAMPDIFF(SECOND, #{today}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) % 60, 2, '0')
LPAD(FLOOR(TIMESTAMPDIFF(SECOND, #{orderDate}, o.delivery_date ) / (24 * 60 * 60)), 2, '0'), '天 ',
LPAD(FLOOR(MOD(TIMESTAMPDIFF(SECOND, #{orderDate}, o.delivery_date), (24 * 60 * 60)) / (60 * 60)), 2, '0'), ':',
LPAD(FLOOR(MOD(MOD(TIMESTAMPDIFF(SECOND, #{orderDate}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) / 60), 2, '0'), ':',
LPAD(MOD(MOD(TIMESTAMPDIFF(SECOND, #{orderDate}, o.delivery_date), (24 * 60 * 60)), (60 * 60)) % 60, 2, '0')
) AS becomeDue
from orders o
where o.organ_id = #{organId}
and o.deleted = 0
and o.status != 4
and o.delivery_date between #{today} and #{orderDate}
and o.delivery_date = #{orderDate}
</select>
<select id="selectOrderOverdue" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
@@ -193,7 +193,7 @@
where o.organ_id = #{organId}
and o.deleted = 0
and o.status != 4
and #{today} > DATE(o.delivery_date)
and #{today} >= DATE(o.delivery_date)
</select>
<select id="selectOrderCountProducePeriod" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO">
@@ -112,7 +112,7 @@
<select id="selectPartsIdListByBodyId" resultType="java.lang.Long">
SELECT parts_id FROM order_item
WHERE body_id = #{bodyId} AND organ_id = #{organId}
WHERE body_id = #{bodyId} AND organ_id = #{organId} and order_id = #{orderId}
</select>
@@ -404,7 +404,7 @@
<foreach item="plateId" collection="plateIds" open="(" separator="," close=")">
#{plateId}
</foreach>
AND organ_id = #{organId}
AND organ_id = #{organId} and order_id = #{orderId}
</update>
<delete id="deletedById">