Authored by mali

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

Conflicts:
	order/src/main/java/com/yoho/ufo/order/service/IBuyerOrderService.java
	order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
... ... @@ -26,4 +26,20 @@ public interface ExpressRecordMapper {
*/
ExpressRecord selectByOrderCodeAndExpressType( @Param("orderCode") Long orderCode, @Param("expressType") Integer expressType);
/**
* 根据物流单号和物流类型查询快递信息
* @param wayBillCode
* @param code
* @return
*/
List<ExpressRecord> selectByWayBillCodeAndExpressType(@Param("wayBillCode") String wayBillCode, @Param("expressType") Integer expressType);
/**
* 根据订单号和物流类型更新鉴定室
* @param orderCodeList
* @param expressType
* @param depotNum
* @return
*/
int updateDeptNoByOrder(@Param("orderCodeList") List<Long> orderCodeList, @Param("expressType") Integer expressType, @Param("depotNum") Integer depotNum);
}
\ No newline at end of file
... ...
... ... @@ -110,4 +110,12 @@ public interface SellerOrderGoodsMapper {
* @return
*/
int updateByCondition(@Param("condition") SellerOrderGoods condition, @Param("updateTo") SellerOrderGoods updateTo);
/**
* 根据skup更新鉴定室
* @param skupList
* @param depotNum
* @return
*/
int updateDeptNoBySkups(@Param("skupList")List<Integer> skupList, @Param("depotNum")Integer depotNum);
}
\ No newline at end of file
... ...
... ... @@ -79,4 +79,12 @@ public interface StoragePriceMapper {
int updateOneStatusByeAnothers(@Param("oldskup") Integer oldskup, @Param("newskup") Integer newskup);
/**
* 批量更新库存的鉴定室
* @param skupList
* @param depotNo
* @return
*/
int updateBatchDepotNum(@Param("skupList") List<Integer> skupList, @Param("depotNum") Integer depotNo);
}
\ No newline at end of file
... ...
... ... @@ -40,5 +40,24 @@
where order_code = #{orderCode} and express_type = #{expressType}
limit 1
</select>
<select id="selectByWayBillCodeAndExpressType" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM express_record
where waybill_code = #{wayBillCode} and express_type = #{expressType}
</select>
<update id="updateDeptNoByOrder" >
update express_record
<set>
<if test="depotNum != null">
depot_num = #{depotNum,jdbcType=INTEGER},
</if>
</set>
where order_code in
<foreach collection="orderCodeList" item="orderCode" open="(" close=")" separator=",">
#{orderCode, jdbcType=BIGINT}
</foreach>
and express_type = #{expressType, jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -482,4 +482,16 @@
</if>
</update>
<update id="updateDeptNoBySkups" >
update seller_order_goods
<set>
<if test="depotNum != null">
depot_no = #{depotNum,jdbcType=INTEGER},
</if>
</set>
where id in
<foreach collection="skupList" item="skup" open="(" close=")" separator=",">
#{skup, jdbcType=INTEGER}
</foreach>
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -238,4 +238,13 @@
a.skup = #{newskup,jdbcType=INTEGER} and b.skup = #{oldskup,jdbcType=INTEGER}
</update>
<update id="updateBatchDepotNum">
update storage_price set depot_num = #{depotNum,jdbcType=INTEGER},
update_time = unix_timestamp()
where skup in
<foreach item="item" index="index" collection="skupList" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -197,5 +197,15 @@ public class AppraiseController {
appraiseService.deliverGoods(appraiseExpressInfoBo);
return new ApiResponse();
}*/
/**
* TODO 手机质检: 修改鉴定室
*/
@RequestMapping(value="/updateDeptNo")
@IgnoreSession
@IgnoreSignature
public ApiResponse updateDeptNo(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo){
logger.info("method in updateDeptNo, appraiseExpressInfoBo {}", appraiseExpressInfoBo);
appraiseService.updateDeptNo(appraiseExpressInfoBo);
return new ApiResponse();
}
}
... ...
... ... @@ -42,9 +42,11 @@ import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.OrderOperateRecordService;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.PaymentHelper;
import com.yohoufo.order.utils.PubThreadFactory;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -61,6 +63,7 @@ import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Created by chenchao on 2018/9/27.
... ... @@ -143,6 +146,8 @@ public class AppraiseService {
//@Value("${order.seller.earnestmoney.miniFaultRejectPunishFee:0}")
private Double miniFaultRejectPunishFee = 0D;
@Autowired
private ProductProxyService productProxyService;
/**
* 触发物流
... ... @@ -867,6 +872,8 @@ public class AppraiseService {
}
}
@Data
class RefundMoneyResultModel {
boolean refundGoodsMoneyFlag;
... ... @@ -1422,4 +1429,35 @@ public class AppraiseService {
}
/**
* 根据物流单号修改鉴定室
* @param appraiseExpressInfoBo
*/
public void updateDeptNo(AppraiseExpressInfoBo appraiseExpressInfoBo) {
List<Long> orderCodeList = null;
if (null == appraiseExpressInfoBo.getOrderCode() && StringUtils.isNotEmpty(appraiseExpressInfoBo.getWayBillCode())) {
List<ExpressRecord> expressRecords = expressRecordMapper.selectByWayBillCodeAndExpressType(appraiseExpressInfoBo.getWayBillCode(),
EnumExpressType.EXPRESS_TYPE_1.getCode());
orderCodeList = expressRecords.stream().filter(item -> null == item.getDepotNum() || !item.getDepotNum().equals(appraiseExpressInfoBo.getDepotNum()))
.map(ExpressRecord::getOrderCode).collect(Collectors.toList()); // 是否存在不符合的鉴定室
} else if (null != appraiseExpressInfoBo.getOrderCode()) {
orderCodeList = Lists.newArrayList(appraiseExpressInfoBo.getOrderCode());
}
if (CollectionUtils.isNotEmpty(orderCodeList)) {
LOGGER.info("updateDeptNo method in orderCodeList = {}", orderCodeList);
List<BuyerOrderGoods> buyerOrderGoodses = buyerOrderGoodsMapper.selectByOrderCodeList(null, orderCodeList);
if (CollectionUtils.isNotEmpty(buyerOrderGoodses)) {
List<Integer> skupList = buyerOrderGoodses.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
sellerOrderGoodsMapper.updateDeptNoBySkups(skupList, appraiseExpressInfoBo.getDepotNum());
expressRecordMapper.updateDeptNoByOrder(orderCodeList, EnumExpressType.EXPRESS_TYPE_1.getCode(), appraiseExpressInfoBo.getDepotNum());
productProxyService.setBatchDepotNum(skupList, appraiseExpressInfoBo.getDepotNum());
}
}
}
}
... ...
... ... @@ -68,6 +68,8 @@ public class ProductProxyService extends AbsProxyService{
private static final String UFO_SECONDHAND_COPYINFO= "ufo.secondhand.copyInfo";
private static final String BATCH_UPDATE_SKUP_DEPOTNO = "ufo.product.updateSkupDepotNo"; // 根据库存的鉴定室
public boolean subtractStorage(Integer productId, Integer skup){
ApiResponse resp = ufoServiceCaller.call(SUBTRACT_STORAGE, productId, skup);
... ... @@ -459,4 +461,9 @@ public class ProductProxyService extends AbsProxyService{
logger.info("finish {} -> preSkup {} currentSkup {}", method, preSkup, currentSkup);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
public ApiResponse setBatchDepotNum(List<Integer> skupList, Integer depotNum){
ApiResponse apiResponse = ufoServiceCaller.call(BATCH_UPDATE_SKUP_DEPOTNO, skupList, depotNum);
return apiResponse;
}
}
... ...
package com.yohoufo.product.controller;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.request.StoragePriceBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.product.service.impl.StoragePriceService;
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;
import java.util.List;
/**
* Created by li.ma on 2019/6/27.
*/
@RestController
public class StoragePriceController {
private final Logger LOG = LoggerFactory.getLogger(ProductController.class);
@Autowired
private StoragePriceService storagePriceService;
// 更新skup的鉴定室
@RequestMapping(params = "method=ufo.product.updateSkupDepotNo")
public ApiResponse updateSkupDepotNo(@RequestParam(value = "skupList", required = true) List<Integer> skupList,
@RequestParam(value = "depotNo", required = true) Integer depotNo) {
LOG.info("in method=ufo.product.updateSkupDepotNo skupList = {} ; depotNo is {}", skupList, depotNo);
try {
storagePriceService.updateSkupDepotNo(skupList, depotNo);
return new ApiResponse();
} catch (Exception e) {
LOG.error("ufo.product.updateSkupDepotNo! skupList : " + skupList, e);
int code = (e instanceof ServiceException) ? ((ServiceException) e).getCode() : 500;
return new ApiResponse(code, e.getMessage(), Boolean.FALSE);
}
}
}
... ...
package com.yohoufo.product.service.impl;
import com.yohoufo.dal.product.StoragePriceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Created by li.ma on 2019/6/27.
*/
@Service
public class StoragePriceService {
@Autowired
private StoragePriceMapper storagePriceMapper;
public int updateSkupDepotNo(List<Integer> skupList, Integer depotNo) {
return storagePriceMapper.updateBatchDepotNum(skupList, depotNo);
}
}
... ...