rsyncOpPageTimer问题修复

售后同步问题-未完全完成
20230922-ljl-fixBug
daixiaogang 1 year ago
parent 2c3b301e64
commit ee3c204c71

@ -1,18 +1,55 @@
package com.ms.api.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.doudian.open.api.afterSale_Detail.data.*;
import com.doudian.open.api.afterSale_Detail.data.AfterSaleDetailData;
import com.doudian.open.api.afterSale_Detail.data.AfterSaleInfo;
import com.doudian.open.api.afterSale_Detail.data.AfterSaleShopRemarksItem;
import com.doudian.open.api.afterSale_Detail.data.ArbitrateInfo;
import com.doudian.open.api.afterSale_Detail.data.Exchange;
import com.doudian.open.api.afterSale_Detail.data.LogisticsInfo;
import com.doudian.open.api.afterSale_Detail.data.OrderInfo;
import com.doudian.open.api.afterSale_Detail.data.PriceProtectionDetail;
import com.doudian.open.api.afterSale_Detail.data.Resend;
import com.doudian.open.api.afterSale_Detail.data.Return;
import com.doudian.open.api.afterSale_Detail.data.SkuOrderInfosItem;
import com.doudian.open.api.afterSale_Detail.data.ValueAddedServicesItem;
import com.doudian.open.api.afterSale_Detail.param.AfterSaleDetailParam;
import com.ms.api.common.ApiResult;
import com.ms.api.consts.*;
import com.ms.api.consts.AfterSaleConst;
import com.ms.api.consts.LogisticsConst;
import com.ms.api.consts.RedisKeyConst;
import com.ms.api.consts.StatusConst;
import com.ms.api.consts.TblConst;
import com.ms.api.service.AfterSaleService;
import com.ms.api.tool.CommonTool;
import com.ms.api.util.DdRequestUtil;
import com.ms.dal.entity.*;
import com.ms.dal.mapper.*;
import com.ms.dal.entity.AfterSale;
import com.ms.dal.entity.AfterSaleExchangeSkuInfo;
import com.ms.dal.entity.AfterSalePriceProtectionDetail;
import com.ms.dal.entity.AfterSaleRsyncQueue;
import com.ms.dal.entity.AftersaleArbitrate;
import com.ms.dal.entity.DdAftersaleMsg;
import com.ms.dal.entity.Shop;
import com.ms.dal.mapper.AfterSaleExchangeSkuInfoMapper;
import com.ms.dal.mapper.AfterSaleMapper;
import com.ms.dal.mapper.AfterSalePriceProtectionDetailMapper;
import com.ms.dal.mapper.AfterSaleRsyncQueueMapper;
import com.ms.dal.mapper.AftersaleArbitrateMapper;
import com.ms.dal.mapper.DdAftersaleMsgMapper;
import com.ms.dal.mapper.ShopMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -21,10 +58,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
*
*/
@ -215,6 +248,22 @@ public class AfterSaleServiceImpl implements AfterSaleService {
}
if (ObjectUtil.isNotNull(aftersaleUpdateData)) {
aftersaleUpdateData.setGmtCreate(new Date());
aftersaleUpdateData.setApplyRemark(StrUtil.isNotBlank(aftersaleUpdateData.getApplyRemark()) ? aftersaleUpdateData.getRejectRemark() : "");
aftersaleUpdateData.setReason(StrUtil.isNotBlank(aftersaleUpdateData.getReason()) ? aftersaleUpdateData.getReason() : "");
aftersaleUpdateData.setSellerOrderRemark(StrUtil.isNotBlank(aftersaleUpdateData.getSellerOrderRemark()) ? aftersaleUpdateData.getSellerOrderRemark() : "");
aftersaleUpdateData.setTypeDesc(StrUtil.isNotBlank(aftersaleUpdateData.getTypeDesc()) ? aftersaleUpdateData.getTypeDesc() : "");
aftersaleUpdateData.setLogisticsCode(StrUtil.isNotBlank(aftersaleUpdateData.getLogisticsCode()) ? aftersaleUpdateData.getLogisticsCode() : "");
aftersaleUpdateData.setLogisticsName(StrUtil.isNotBlank(aftersaleUpdateData.getLogisticsName()) ? aftersaleUpdateData.getLogisticsName() : "");
aftersaleUpdateData.setDeadlineType(ObjectUtil.isNotNull(aftersaleUpdateData.getDeadlineType()) ? aftersaleUpdateData.getDeadlineType() : 0);
aftersaleUpdateData.setExchangeLogisticsCode(StrUtil.isNotBlank(aftersaleUpdateData.getExchangeLogisticsCode()) ? aftersaleUpdateData.getExchangeLogisticsCode() : "");
aftersaleUpdateData.setExchangeLogisticsName(StrUtil.isNotBlank(aftersaleUpdateData.getExchangeLogisticsName()) ? aftersaleUpdateData.getExchangeLogisticsName() : "");
aftersaleUpdateData.setEvidenceOssPath(StrUtil.isNotBlank(aftersaleUpdateData.getEvidenceOssPath()) ? aftersaleUpdateData.getEvidenceOssPath() : "");
aftersaleUpdateData.setRejectReason(StrUtil.isNotBlank(aftersaleUpdateData.getRejectReason()) ? aftersaleUpdateData.getRejectReason() : "");
aftersaleUpdateData.setRejectRemark(StrUtil.isNotBlank(aftersaleUpdateData.getRejectRemark()) ? aftersaleUpdateData.getRejectRemark() : "");
aftersaleUpdateData.setResendLogisticsCode(StrUtil.isNotBlank(aftersaleUpdateData.getResendLogisticsCode()) ? aftersaleUpdateData.getResendLogisticsCode() : "");
aftersaleUpdateData.setResendLogisticsName(StrUtil.isNotBlank(aftersaleUpdateData.getResendLogisticsName()) ? aftersaleUpdateData.getResendLogisticsName() : "");
afterSaleMapper.insert(aftersaleUpdateData);
}
return ApiResult.ok();

@ -2264,7 +2264,7 @@ public class OpOrderServiceImpl implements OpOrderService {
}
} else {
for (List<OpOrderRsyncPageQueue> queuePagesChunk : queuePagesChunks) {
opOrderRsyncPageQueueMapper.insertBatch(queuePagesChunk);
opOrderRsyncPageBufferMapper.insertBatch(queuePagesChunk);
}
}
OpOrderRsyncQueue opOrderRsyncQueue = new OpOrderRsyncQueue();

@ -1,14 +1,18 @@
package com.ms.api.spi.timer;
import cn.hutool.core.util.ObjectUtil;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.ApiResult;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.TimerBaseService;
import com.ms.api.dto.ItemDTO;
import com.ms.api.service.OpOrderService;
import com.ms.api.task.RsyncOpPageTaskService;
import com.ms.dal.entity.OpOrderRsyncPageQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +23,9 @@ public class RsyncOpPageTimerService extends TimerBaseService implements Extensi
@Autowired
RsyncOpPageTaskService rsyncOpPageTaskService;
@Autowired
private OpOrderService opOrderService;
@Override
public BaseResponse<Ret> handle(BaseRequest<ItemDTO> req) {
try {
@ -28,6 +35,13 @@ public class RsyncOpPageTimerService extends TimerBaseService implements Extensi
e.printStackTrace();
return R.ok(Ret.fail(e.getMessage()));
}
// OpOrderRsyncPageQueue task = rsyncOpPageTaskService.lockRsyncOpQueue(0L);
// ApiResult result = rsyncOpPageTaskService.doRsyncOpQueue(task);
// if (ObjectUtil.isNull(result) || result.isSuccess()) {
// return R.ok(Ret.success());
// }
// opOrderService.clearRsyncOpPageQueue(task);
// return R.ok(Ret.success());
}
}

@ -106,7 +106,7 @@ public class RsyncOpPageTaskService extends TaskBaseService {
return result;
}
private ApiResult doRsyncOpQueue(OpOrderRsyncPageQueue queueMsg) {
public ApiResult doRsyncOpQueue(OpOrderRsyncPageQueue queueMsg) {
return opOrderService.rsyncOpOrderPage(queueMsg);
}
@ -127,7 +127,7 @@ public class RsyncOpPageTaskService extends TaskBaseService {
opOrderService.clearRsyncOpPageQueue(ret.getData());
}
private OpOrderRsyncPageQueue lockRsyncOpQueue(Long timerLockId) {
public OpOrderRsyncPageQueue lockRsyncOpQueue(Long timerLockId) {
return opOrderRsyncPageQueueService.lockSolidRedisQueue(timerLockId, false);
}

@ -3,6 +3,7 @@ package com.ms.dal.mapper;
import java.util.List;
import com.ms.dal.entity.OpOrderRsyncPageBuffer;
import com.ms.dal.entity.OpOrderRsyncPageQueue;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -29,4 +30,7 @@ public interface OpOrderRsyncPageBufferMapper {
List<OpOrderRsyncPageBuffer> selectByBufferIdAndLimit(@Param("startBufferId")Long startBufferId, @Param("limit")int limit);
void deleteByIdList(@Param("deleteBufferIds")List<Long> deleteBufferIds);
void insertBatch(List<OpOrderRsyncPageQueue> queuePagesChunk);
}

@ -8,7 +8,7 @@
<id property="afterSaleId" column="after_sale_id" jdbcType="BIGINT"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="pId" column="p_id" jdbcType="VARCHAR"/>
<result property="pId" column="pid" jdbcType="VARCHAR"/>
<result property="aftersaleType" column="aftersale_type" jdbcType="TINYINT"/>
<result property="aftersaleTypeText" column="aftersale_type_text" jdbcType="VARCHAR"/>
<result property="applyRemark" column="apply_remark" jdbcType="VARCHAR"/>
@ -41,7 +41,7 @@
</resultMap>
<sql id="Base_Column_List">
after_sale_id,shop_id,order_id,p_id,
after_sale_id,shop_id,order_id,pid,
aftersale_type,aftersale_type_text,apply_remark,
reason,seller_order_remark,type_desc,
aftersale_status,refund_type,refund_status,
@ -94,7 +94,7 @@
</delete>
<insert id="insert" keyColumn="after_sale_id" keyProperty="afterSaleId" parameterType="com.ms.dal.entity.AfterSale" useGeneratedKeys="true">
insert into after_sale
( after_sale_id,shop_id,order_id,p_id
( after_sale_id,shop_id,order_id,pid
,aftersale_type,aftersale_type_text,apply_remark
,reason,seller_order_remark,type_desc
,aftersale_status,refund_type,refund_status
@ -123,7 +123,7 @@
<if test="afterSaleId != null">after_sale_id,</if>
<if test="shopId != null">shop_id,</if>
<if test="orderId != null">order_id,</if>
<if test="pId != null">p_id,</if>
<if test="pId != null">pid,</if>
<if test="aftersaleType != null">aftersale_type,</if>
<if test="aftersaleTypeText != null">aftersale_type_text,</if>
<if test="applyRemark != null">apply_remark,</if>
@ -200,7 +200,7 @@
order_id = #{orderId,jdbcType=VARCHAR},
</if>
<if test="pId != null">
p_id = #{pId,jdbcType=VARCHAR},
pid = #{pId,jdbcType=VARCHAR},
</if>
<if test="aftersaleType != null">
aftersale_type = #{aftersaleType,jdbcType=TINYINT},
@ -297,7 +297,7 @@
set
shop_id = #{shopId,jdbcType=BIGINT},
order_id = #{orderId,jdbcType=VARCHAR},
p_id = #{pId,jdbcType=VARCHAR},
pid = #{pId,jdbcType=VARCHAR},
aftersale_type = #{aftersaleType,jdbcType=TINYINT},
aftersale_type_text = #{aftersaleTypeText,jdbcType=VARCHAR},
apply_remark = #{applyRemark,jdbcType=VARCHAR},

@ -92,6 +92,20 @@
<if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<insert id="insertBatch" useGeneratedKeys="true" keyColumn="op_order_rsync_page_buffer_id" keyProperty="opOrderRsyncPageBufferId" >
insert into op_order_rsync_page_buffer
( op_order_rsync_page_buffer_id,op_order_rsync_queue_id,shop_id
,gmt_start_modified,gmt_end_modified,page_size
,page,page_count,preview_total
,gmt_create,gmt_modified)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{opOrderRsyncPageBufferId,jdbcType=BIGINT},#{opOrderRsyncQueueId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT}
,#{gmtStartModified,jdbcType=TIMESTAMP},#{gmtEndModified,jdbcType=TIMESTAMP},#{pageSize,jdbcType=TINYINT}
,#{page,jdbcType=SMALLINT},#{pageCount,jdbcType=SMALLINT},#{previewTotal,jdbcType=SMALLINT}
,#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP})
</foreach>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.ms.dal.entity.OpOrderRsyncPageBuffer">
update op_order_rsync_page_buffer
<set>

Loading…
Cancel
Save