Authored by caoyan

Merge branch 'dev_确认收货优化' into test6.9.7

... ... @@ -18,7 +18,7 @@ public interface AbnormalPackageMapper {
int update(@Param("operateUid") Integer operateUid, @Param("updateTime") Integer updateTime, @Param("sellerWaybillCode") String sellerWaybillCode);
int selectValidCnt();
int selectValidCnt(@Param("sellerWaybillCode") String sellerWaybillCode);
List<String> selectValidSellerWaybillCodeList(@Param("buyerOrderReq") BuyerOrderReq buyerOrderReq);
}
... ...
package com.yoho.order.model;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.ToString;
/**
* @author caoyan
* @date 2018/9/12
... ...
... ... @@ -15,11 +15,14 @@
</sql>
<select id="selectValidCnt" resultType="java.lang.Integer">
select count(1) from abnormal_package where is_del = 0
select count(1) from abnormal_package where is_del = 0 and seller_waybillCode= #{sellerWaybillCode}
</select>
<select id="selectValidSellerWaybillCodeList" resultType="java.lang.String" parameterType="com.yoho.order.model.BuyerOrderReq">
select seller_waybillCode from abnormal_package where is_del=0
<if test="buyerOrderReq.sellerWaybillCode!=null and buyerOrderReq.sellerWaybillCode != ''">
seller_waybillCode = #{buyerOrderReq.sellerWaybillCode}
</if>
<if test="buyerOrderReq.start!=null and buyerOrderReq.size != null">
limit #{buyerOrderReq.start},#{buyerOrderReq.size}
</if>
... ...
... ... @@ -10,7 +10,6 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -74,6 +73,9 @@ public class BuyerOrderController {
@RequestMapping(value = "/batchConfirmReceive")
public ApiResponse batchConfirmReceive(BuyerOrderReq req) {
LOGGER.info("batchConfirmReceive in. req is {}", req);
if(StringUtils.isEmpty(req.getSellerWaybillCode())){
return new ApiResponse.ApiResponseBuilder().code(400).message("卖家快递单号不能为空").build();
}
buyerOrderService.batchConfirmReceive(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("确认收货成功").build();
}
... ... @@ -343,7 +345,7 @@ public class BuyerOrderController {
}
@RequestMapping(value = "/queryByOrderCodeOrWaybillCode")
public ApiResponse queryByOrderCodeOrWaybillCode(@RequestBody BuyerOrderReq req) {
public ApiResponse queryByOrderCodeOrWaybillCode(BuyerOrderReq req) {
LOGGER.info("queryByOrderCodeOrWaybillCode in. queryStr is {}", req.getQueryStr());
PageResponseBO<BuyerOrderResp> result = buyerOrderService.queryByOrderCodeOrWaybillCode(req.getQueryStr());
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
... ... @@ -426,6 +428,9 @@ public class BuyerOrderController {
@RequestMapping(value = "/queryByWaybillCode4Qc")
public ApiResponse queryByWaybillCode4Qc(BuyerOrderReq req) {
LOGGER.info("queryByWaybillCode4Qc in. queryStr is {}", req.getSellerWaybillCode());
if(StringUtils.isEmpty(req.getSellerWaybillCode())){
return new ApiResponse.ApiResponseBuilder().code(400).message("卖家快递单号不能为空").build();
}
JSONObject result = buyerOrderService.queryOrderBySellerWaybillCodeForQc(req.getSellerWaybillCode());
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
... ...
... ... @@ -290,7 +290,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
private static final Byte QC_STATUS_EXCEPTION = 4;
//待处理
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货
Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中
//待发货
private static final List<Byte> processingList = Lists.newArrayList(Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),//已取消(商品质检不通过)
... ... @@ -387,7 +388,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resultMap.put("problemNum", problemNum);
//查询异常包裹
resultMap.put("exceptionNum", abnormalPackageMapper.selectValidCnt());
resultMap.put("exceptionNum", abnormalPackageMapper.selectValidCnt(req.getQueryStr()));
return resultMap;
}
... ... @@ -728,6 +729,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
jsonObject.replace("receivedNum", receivedNum);
if(orderList.size() - receivedNum - canceledNum > 0 && canceledNum == 0){
jsonObject.replace("receiveBtn", jsonObject.getIntValue("isExceptionPackage") == 1 ? 0: 1);//0:按钮不展示 1:按钮展示
jsonObject.replace("exceptionBtn", jsonObject.getIntValue("isExceptionPackage") == 1 ? 0: 1);
}
}
... ... @@ -889,22 +891,20 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Override
public void batchConfirmReceive(BuyerOrderReq req) {
String orderCodes = req.getOrderCode();
if(StringUtils.isEmpty(orderCodes)) {
return;
}
String sellerWaybillCode = req.getSellerWaybillCode();
List<BuyerOrder> orderList = queryOrderByQueryStr(sellerWaybillCode, null, null);
List<String> orderCodes = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
String[] orderCodeArr = orderCodes.split(",");
UserHelper userHelper = new UserHelper();
int operateType =OperateTypeEnum.OPERATE_TYPE_CONFIRM_RECEIVE.getCode();
List<Long> orderCodeList = ListUtil.convertList(orderCodes, ",");
List<Long> orderCodeList = convertStringToLong(orderCodes);
List<BuyerOrder> buyerOrders = buyerOrderMapper.selectBatchByOrderCode(orderCodeList);
Map<String, BuyerOrder> orderMap = buyerOrders.stream().collect(Collectors.toMap(BuyerOrder::getOrderCode, item -> item));
for(int i=0; i<orderCodeArr.length; i++) {
String orderCode = orderCodeArr[i];
BuyerOrder buyerOrder = orderMap.get(orderCode);//buyerOrderMapper.selectByOrderCode(orderCode);
for(String orderCode : orderCodes) {
BuyerOrder buyerOrder = orderMap.get(orderCode);
if( Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal()!=buyerOrder.getStatus().byteValue()){
throw new ServiceException(400,"错误:订单"+orderCode +"状态变化,不允许确认收货,请重新刷新列表");
}
... ... @@ -920,6 +920,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
}
}
private List<Long> convertStringToLong(List<String> orderCodeList){
List<Long> list = Lists.newArrayList();
for(String item : orderCodeList){
list.add(Long.parseLong(item));
}
return list;
}
@Override
public void updateSellerDeliveryDeal(BuyerOrderReq req,boolean againFlag){
String orderCode = req.getOrderCode();
... ... @@ -2538,7 +2547,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Override
public PageResponseBO<String> queryAbnormalPackage(BuyerOrderReq req){
int total = abnormalPackageMapper.selectValidCnt();
int total = abnormalPackageMapper.selectValidCnt(req.getSellerWaybillCode());
if(total == 0){
return null;
}
... ...