Authored by qinchao

物流

package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.QualityCheck;
import org.apache.ibatis.annotations.Param;
public interface QualityCheckMapper {
int updateByOrderCode(@Param("orderCode") Long orderCode,@Param("status") int status);
QualityCheck selectByOrderCode(@Param("orderCode") Long orderCode);
int updateByOrderCode(@Param("orderCode") Long orderCode,@Param("status") int status,@Param("updateTime") Integer updateTime);
}
\ No newline at end of file
... ...
... ... @@ -31,4 +31,8 @@ public class ExpressInfo {
//具体调拨信息的编码 EnumExpressDataOperateTransferCode
private Integer operateTransferCode;
////// 质检信息
private QualityCheck qualityCheck;
}
\ No newline at end of file
... ...
... ... @@ -20,5 +20,9 @@ public class QualityCheck {
private String imageUrl;
private Integer createTime;
private Integer updateTime;
}
\ No newline at end of file
... ...
... ... @@ -8,14 +8,21 @@
<result column="type" jdbcType="TINYINT" property="type" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, order_code, check_text, type, status, image_url
id, order_code, check_text, type, status, image_url,create_time,update_time
</sql>
<select id="selectByOrderCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from quality_check where order_code = #{orderCode}
</select>
<update id="updateByOrderCode">
update quality_check
set status = #{status}
set status = #{status},update_time=#{updateTime}
where order_code = #{orderCode}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -344,7 +344,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
DateUtil.getCurrentTimeSecond())) {
logger.info("Buyer Order miniFaultAccept (OrderRequest) {} ,update status success ", orderRequest);
//更新瑕疵确认结果
int updateNum = qualityCheckMapper.updateByOrderCode(orderCode,EnumQualityCheckStatus.PASS.getCode());
int updateNum = qualityCheckMapper.updateByOrderCode(orderCode,EnumQualityCheckStatus.PASS.getCode(),DateUtil.getCurrentTimeSecond());
logger.info("Buyer Order miniFaultAccept (OrderRequest) {} ,update quality check record status num {} ", orderRequest,updateNum);
//记录新的调拨信息
... ... @@ -388,7 +388,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
if(result!=null&&result.getCode()==200){
//更新瑕疵确认结果
int updateNum = qualityCheckMapper.updateByOrderCode(orderCode,EnumQualityCheckStatus.REJECT_BY_BUYER.getCode());
int updateNum = qualityCheckMapper.updateByOrderCode(orderCode,EnumQualityCheckStatus.REJECT_BY_BUYER.getCode(), DateUtil.getCurrentTimeSecond());
logger.info("Buyer Order miniFaultReject (OrderRequest) {} ,update quality check record status num {} ", orderRequest,updateNum);
//TODO 发消息
... ...
... ... @@ -9,6 +9,7 @@ import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
import com.yohobuy.ufo.model.order.resp.MiniFaultConfirm;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.constant.ExpressInfoConstant;
... ... @@ -90,6 +91,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
@Autowired
private OrderStatusFlowService orderStatusFlowService;
@Autowired
private QualityCheckMapper qualityCheckMapper;
//private static String EXPRESS_MQ_SEND = "logistics.logistics_data";
//private static String EXPRESS_MQ_SEND = "order.updateChangeRefundOrderExpressInfo";
private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
... ... @@ -364,12 +368,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
//2.设定最近一个阶段的物流
expressInfoRespBo.setExpressInfoDetailList(Lists.newArrayList());
List<ExpressInfo> expressInfoList = getExpressInfoListByStage(actor, orderCode, expressType);
constructExpressInfo(expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
constructExpressInfo(actor,expressInfoList, expressInfoRespBo.getExpressInfoDetailList());
//3.设定鉴定的物流调拨信息
expressInfoRespBo.setJudgeExpressInfoDetailList(Lists.newArrayList());
List<ExpressInfo> judgeExpressInfoList=getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode());
constructExpressInfo(judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
constructExpressInfo(actor,judgeExpressInfoList, expressInfoRespBo.getJudgeExpressInfoDetailList());
//4.获取上一阶段的辅助物流信息
List<ExpressInfoDetail> supplementExpressInfoDetailList = Lists.newArrayList();
... ... @@ -395,6 +399,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
// 2 卖家发货 == 平台鉴定 -- 交易成功 ,其中卖家发货和平台鉴定点亮
// 3 卖家发货 == 平台鉴定 == 交易成功 ,全部点亮
// 4 卖家发货 == 平台鉴定 == 交易失败 ,全部点亮
//5 卖家发货 == 交易关闭 ,全部点亮
expressInfoRespBo.setStage(1);
if(OrderStatus.PLATFORM_RECEIVE.getCode()==status
||OrderStatus.PLATFORM_CHECKING.getCode()==status){
... ... @@ -403,6 +408,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
expressInfoRespBo.setStage(3);
}else if(OrderStatus.CHECKING_FAKE.getCode()==status){
expressInfoRespBo.setStage(4);
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==status){
expressInfoRespBo.setStage(5);
}
}
... ... @@ -415,7 +422,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
//卖家物流详细
List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor, orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
constructExpressInfo(previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
}else if(EnumExpressType.EXPRESS_TYPE_3.getCode().intValue()==expressType.intValue()
||EnumExpressType.EXPRESS_TYPE_REBACK.getCode().intValue()==expressType.intValue()){
//卖家这个时候看自己上一阶段的物流
... ... @@ -425,7 +432,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
constructWayBillInfo(orderCode,EnumExpressType.EXPRESS_TYPE_1.getCode(),expressInfoRespBo);
}
List<ExpressInfo> previousExpressInfoList = getExpressInfoListByStage(actor,orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
constructExpressInfo(previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
constructExpressInfo(actor,previousExpressInfoList, expressInfoRespBo.getSupplementExpressInfoDetailList());
}
}
... ... @@ -505,17 +512,32 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
if(EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER.getCode().equals(expressType)){
LOGGER.info("getExpressInfoListByStage out because of expressType is judge center ,orderCode = {} ,expressType = {} ",orderCode,expressType);
List<ExpressInfo> ls = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode,expressType);
if(actor!=null&&TabType.BUY==actor&&CollectionUtils.isNotEmpty(ls)){
if(actor!=null&&CollectionUtils.isNotEmpty(ls)){
for(ExpressInfo info:ls){
if(info.getOperateTransferCode()==null){
continue;
}
if(EnumExpressDataOperateTransferCode.mini_fault_create.getCode()==info.getOperateTransferCode()){
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_create_buyer.getOperateTransferDesc());
if(TabType.BUY==actor){
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_create_buyer.getOperateTransferDesc());
}
//存在需要瑕疵确认的信息
QualityCheck qualityCheck = qualityCheckMapper.selectByOrderCode(orderCode);
if(qualityCheck!=null
&&qualityCheck.getType()!=null
&&EnumQualityCheckType.MINI_FAULT.getCode()==qualityCheck.getType().intValue()){
info.setQualityCheck(qualityCheck);
}
}else if(EnumExpressDataOperateTransferCode.mini_fault_accept.getCode()==info.getOperateTransferCode()){
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_accept_buyer.getOperateTransferDesc());
if(TabType.BUY==actor){
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_accept_buyer.getOperateTransferDesc());
}
}else if(EnumExpressDataOperateTransferCode.mini_fault_reject.getCode()==info.getOperateTransferCode()){
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_reject_buyer.getOperateTransferDesc());
if(TabType.BUY==actor){
info.setAcceptRemark(EnumExpressDataOperateTransferCode.mini_fault_reject_buyer.getOperateTransferDesc());
}
}
}
}
... ... @@ -562,7 +584,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
ExpressInfo last=expressInfoList_All.get(0);
List<ExpressInfo> expressInfoList = Arrays.asList(last);
List<ExpressInfoDetail> expressInfoDetailList= Lists.newArrayList();
constructExpressInfo(expressInfoList,expressInfoDetailList);
constructExpressInfo(actor,expressInfoList,expressInfoDetailList);
LOGGER.info("queryLastExpressDetailInfo.queryExpressDetailInfo result = {}", JSON.toJSONString(expressInfoDetailList));
return expressInfoDetailList;
... ... @@ -634,7 +656,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
private void constructExpressInfo(List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> detailList) {
private void constructExpressInfo(TabType actor,List<ExpressInfo> expressInfoList, List<ExpressInfoDetail> detailList) {
if (CollectionUtils.isNotEmpty(expressInfoList)) {
for (ExpressInfo expressInfo : expressInfoList) {
ExpressInfoDetail expressInfoDetail = new ExpressInfoDetail();
... ... @@ -643,6 +665,22 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
// 运单信息
expressInfoDetail.setAcceptRemark(expressInfo.getAcceptRemark());
expressInfoDetail.setCreateTimeStr(DateUtil.formatDate(expressInfo.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
//瑕疵确认信息
if(expressInfo.getQualityCheck()!=null){
QualityCheck qualityCheck = expressInfo.getQualityCheck();
boolean showBtn=false;
if(TabType.BUY==actor&&qualityCheck.getStatus()!=null&&EnumQualityCheckStatus.WAIT_CONFIRM.getCode()==qualityCheck.getStatus().intValue()){
showBtn=true;
}
MiniFaultConfirm miniFaultConfirm=new MiniFaultConfirm();
miniFaultConfirm.setShowBtn(showBtn);
miniFaultConfirm.setCreateTime(qualityCheck.getCreateTime());
miniFaultConfirm.setText(qualityCheck.getCheckText());
miniFaultConfirm.setImageUrls(StringUtils.isEmpty(qualityCheck.getImageUrl())?new ArrayList<>():Arrays.asList(qualityCheck.getImageUrl().split(",")));
expressInfoDetail.setMiniFaultConfirm(miniFaultConfirm);
}
detailList.add(expressInfoDetail);
}
}
... ...