Authored by caoyan

质检优化

  1 +package com.yoho.order.dal;
  2 +
  3 +import org.apache.ibatis.annotations.Param;
  4 +
  5 +import com.yoho.order.model.AbnormalOrder;
  6 +
  7 +/**
  8 + * Created by caoyan on 2019/7/29.
  9 + */
  10 +public interface AbnormalOrderMapper {
  11 +
  12 + AbnormalOrder selectByOrderCode(@Param("orderCode") String orderCode);
  13 +
  14 + int insert(AbnormalOrder abnormalOrder);
  15 +
  16 + int update(AbnormalOrder abnormalOrder);
  17 +
  18 +}
  1 +package com.yoho.order.model;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author caoyan
  7 + * @date 2019/7/29
  8 + */
  9 +public class AbnormalOrder implements Serializable {
  10 +
  11 +
  12 + private static final long serialVersionUID = 2607922995706119816L;
  13 +
  14 + private Integer id;
  15 +
  16 + private String orderCode;
  17 +
  18 + private Integer type;
  19 +
  20 + private Integer createTime;
  21 +
  22 + private Integer operateUid;
  23 +
  24 + private Integer updateTime;
  25 +
  26 + public Integer getId() {
  27 + return id;
  28 + }
  29 +
  30 + public void setId(Integer id) {
  31 + this.id = id;
  32 + }
  33 +
  34 + public String getOrderCode() {
  35 + return orderCode;
  36 + }
  37 +
  38 + public void setOrderCode(String orderCode) {
  39 + this.orderCode = orderCode;
  40 + }
  41 +
  42 + public Integer getType() {
  43 + return type;
  44 + }
  45 +
  46 + public void setType(Integer type) {
  47 + this.type = type;
  48 + }
  49 +
  50 + public Integer getCreateTime() {
  51 + return createTime;
  52 + }
  53 +
  54 + public void setCreateTime(Integer createTime) {
  55 + this.createTime = createTime;
  56 + }
  57 +
  58 + public Integer getOperateUid() {
  59 + return operateUid;
  60 + }
  61 +
  62 + public void setOperateUid(Integer operateUid) {
  63 + this.operateUid = operateUid;
  64 + }
  65 +
  66 + public Integer getUpdateTime() {
  67 + return updateTime;
  68 + }
  69 +
  70 + public void setUpdateTime(Integer updateTime) {
  71 + this.updateTime = updateTime;
  72 + }
  73 +
  74 + @Override
  75 + public String toString() {
  76 + return "AbnormalOrder{" +
  77 + "id=" + id +
  78 + ", orderCode='" + orderCode + '\'' +
  79 + ", type='" + type + '\'' +
  80 + ", createTime='" + createTime + '\'' +
  81 + ", operateUid='" + operateUid + '\'' +
  82 + ", updateTime='" + updateTime + '\'' +
  83 + '}';
  84 + }
  85 +}
@@ -136,4 +136,6 @@ public class BuyerOrderReq extends PageRequestBO{ @@ -136,4 +136,6 @@ public class BuyerOrderReq extends PageRequestBO{
136 private Integer region;//0:大陆 1:香港 136 private Integer region;//0:大陆 1:香港
137 137
138 private String settleFailReason; 138 private String settleFailReason;
  139 +
  140 + private Integer abnormalType;//订单异常类型,1:卖家多发货 2:卖家少发货 3:卖家发错货
139 } 141 }
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.order.dal.AbnormalOrderMapper">
  4 + <resultMap id="BaseResultMap" type="com.yoho.order.model.AbnormalOrder">
  5 + <result column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="order_code" property="orderCode" jdbcType="BIGINT" />
  7 + <result column="type" property="type" jdbcType="INTEGER" />
  8 + <result column="create_time" property="createTime" jdbcType="INTEGER" />
  9 + <result column="operate_uid" property="operateUid" jdbcType="INTEGER" />
  10 + <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  11 + </resultMap>
  12 +
  13 + <sql id="Base_Column_List">
  14 + id, order_code, type, create_time, operate_uid, update_time
  15 + </sql>
  16 +
  17 + <insert id="insert" parameterType="com.yoho.order.model.AbnormalOrder">
  18 + insert into abnormal_order(order_code, type, create_time, operate_uid, update_time)
  19 + values (#{orderCode}, #{type}, #{createTime}, #{operateUid}, #{updateTime})
  20 + </insert>
  21 +
  22 + <select id="selectByOrderCode" resultMap="BaseResultMap">
  23 + select <include refid="Base_Column_List" />
  24 + from abnormal_order where order_code = #{orderCode}
  25 + </select>
  26 +
  27 + <update id="update" parameterType="com.yoho.order.model.AbnormalOrder">
  28 + update abnormal_order set type=#{type}, operate_uid=#{operateUid}, update_time=#{updateTime}
  29 + where order_code=#{orderCode}
  30 + </update>
  31 +</mapper>
@@ -673,4 +673,14 @@ public class BuyerOrderController { @@ -673,4 +673,14 @@ public class BuyerOrderController {
673 boolean result = buyerOrderService.queryIsDepotNoDiffer(req); 673 boolean result = buyerOrderService.queryIsDepotNoDiffer(req);
674 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build(); 674 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
675 } 675 }
  676 +
  677 + @RequestMapping(value = "/updateAbnormalOrder")
  678 + public ApiResponse updateAbnormalOrder(BuyerOrderReq req) {
  679 + LOGGER.info("updateAbnormalOrder in. param is {}", req);
  680 + if(StringUtils.isEmpty(req.getOrderCode()) || null == req.getAbnormalType()) {
  681 + return new ApiResponse.ApiResponseBuilder().data("").code(400).message("订单号或异常类型不能为空").build();
  682 + }
  683 + int result = buyerOrderService.updateAbnormalOrder(req);
  684 + return new ApiResponse.ApiResponseBuilder().code(200).message("操作成功").data(result).build();
  685 + }
676 } 686 }
@@ -156,4 +156,6 @@ public interface IBuyerOrderService { @@ -156,4 +156,6 @@ public interface IBuyerOrderService {
156 int updateAbnormalPackageToDealed(String sellerWaybillCode); 156 int updateAbnormalPackageToDealed(String sellerWaybillCode);
157 157
158 boolean queryIsDepotNoDiffer(BuyerOrderReq req); 158 boolean queryIsDepotNoDiffer(BuyerOrderReq req);
  159 +
  160 + int updateAbnormalOrder(BuyerOrderReq req);
159 } 161 }
@@ -45,6 +45,7 @@ import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations; @@ -45,6 +45,7 @@ import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations;
45 import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; 45 import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
46 import com.yoho.core.rest.client.ServiceCaller; 46 import com.yoho.core.rest.client.ServiceCaller;
47 import com.yoho.error.exception.ServiceException; 47 import com.yoho.error.exception.ServiceException;
  48 +import com.yoho.order.dal.AbnormalOrderMapper;
48 import com.yoho.order.dal.AbnormalPackageMapper; 49 import com.yoho.order.dal.AbnormalPackageMapper;
49 import com.yoho.order.dal.AppraiseAddressMapper; 50 import com.yoho.order.dal.AppraiseAddressMapper;
50 import com.yoho.order.dal.BuyerOrderGoodsMapper; 51 import com.yoho.order.dal.BuyerOrderGoodsMapper;
@@ -68,6 +69,7 @@ import com.yoho.order.dal.SignForPackageMapper; @@ -68,6 +69,7 @@ import com.yoho.order.dal.SignForPackageMapper;
68 import com.yoho.order.dal.StorageDepositMapper; 69 import com.yoho.order.dal.StorageDepositMapper;
69 import com.yoho.order.dal.StoredSellerMapper; 70 import com.yoho.order.dal.StoredSellerMapper;
70 import com.yoho.order.dal.ZhimaCertMapper; 71 import com.yoho.order.dal.ZhimaCertMapper;
  72 +import com.yoho.order.model.AbnormalOrder;
71 import com.yoho.order.model.AbnormalPackage; 73 import com.yoho.order.model.AbnormalPackage;
72 import com.yoho.order.model.AppraiseAddress; 74 import com.yoho.order.model.AppraiseAddress;
73 import com.yoho.order.model.BuyerOrder; 75 import com.yoho.order.model.BuyerOrder;
@@ -273,6 +275,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -273,6 +275,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
273 private ProductSortMapper productSortMapper; 275 private ProductSortMapper productSortMapper;
274 276
275 @Autowired 277 @Autowired
  278 + private AbnormalOrderMapper abnormalOrderMapper;
  279 +
  280 + @Autowired
276 private ClearanceRecordService clearanceRecordService; 281 private ClearanceRecordService clearanceRecordService;
277 282
278 private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address"; 283 private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
@@ -1218,15 +1223,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1218,15 +1223,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1218 return true;//一致 1223 return true;//一致
1219 } 1224 }
1220 1225
  1226 + @Override
  1227 + public int updateAbnormalOrder(BuyerOrderReq req) {
  1228 + AbnormalOrder order = abnormalOrderMapper.selectByOrderCode(req.getOrderCode());
  1229 + int num = 0;
  1230 + if(null != order) {
  1231 + order.setOperateUid(new UserHelper().getUserId());
  1232 + order.setUpdateTime(DateUtil.getCurrentTimeSeconds());
  1233 + order.setType(req.getAbnormalType());
  1234 + num = abnormalOrderMapper.update(order);
  1235 + }else {
  1236 + order = new AbnormalOrder();
  1237 + order.setOrderCode(req.getOrderCode());
  1238 + order.setType(req.getAbnormalType());
  1239 + order.setCreateTime(DateUtil.getCurrentTimeSeconds());
  1240 + order.setOperateUid(new UserHelper().getUserId());
  1241 + abnormalOrderMapper.insert(order);
  1242 + }
  1243 +
  1244 + return num;
  1245 + }
  1246 +
1221 private String convertDepotNoStr(Integer depotNo) { 1247 private String convertDepotNoStr(Integer depotNo) {
1222 if(null == depotNo) { 1248 if(null == depotNo) {
1223 return ""; 1249 return "";
1224 } 1250 }
1225 1251
1226 if(depotNo.equals(DEPOT_NO_BEIJING)) { 1252 if(depotNo.equals(DEPOT_NO_BEIJING)) {
1227 - return "南京";  
1228 - }else if(depotNo.equals(DEPOT_NO_NANJING)) {  
1229 return "北京"; 1253 return "北京";
  1254 + }else if(depotNo.equals(DEPOT_NO_NANJING)) {
  1255 + return "南京";
1230 }else if(depotNo.equals(DEPOT_NO_HONGKONG)) { 1256 }else if(depotNo.equals(DEPOT_NO_HONGKONG)) {
1231 return "香港"; 1257 return "香港";
1232 } 1258 }
@@ -2486,6 +2512,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -2486,6 +2512,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
2486 2512
2487 queryStorageDeposit(resp, buyerOrder.getOrderCode()); //查询寄存信息 2513 queryStorageDeposit(resp, buyerOrder.getOrderCode()); //查询寄存信息
2488 2514
  2515 + queryAbnormalOrder(resp, buyerOrder.getOrderCode());//查询异常订单信息
  2516 +
2489 resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes(), sellerGoods.getRegion())); 2517 resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes(), sellerGoods.getRegion()));
2490 2518
2491 return resp; 2519 return resp;
@@ -3940,6 +3968,23 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -3940,6 +3968,23 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
3940 resp.setStatusStr(resp.getStatusStr() + extraInfo); 3968 resp.setStatusStr(resp.getStatusStr() + extraInfo);
3941 } 3969 }
3942 3970
  3971 + private void queryAbnormalOrder(QcOrderDetailResp resp, String orderCode) { // 查询异常订单信息
  3972 + AbnormalOrder order = abnormalOrderMapper.selectByOrderCode(orderCode);
  3973 + if(null == order) {
  3974 + return;
  3975 + }
  3976 +
  3977 + resp.setAbnormalTypeStr(convertAbnormalType(order.getType()));
  3978 + }
  3979 +
  3980 + private String convertAbnormalType(Integer type) {
  3981 + switch(type) {
  3982 + case 1: return "卖家多发货";
  3983 + case 2: return "卖家少发货";
  3984 + case 3: return "卖家发错货";
  3985 + default: return "";
  3986 + }
  3987 + }
3943 3988
3944 /** 3989 /**
3945 * 根据订单号查询具体的物流公司 3990 * 根据订单号查询具体的物流公司
@@ -252,10 +252,9 @@ public class StorageDepositServiceImpl implements IStorageDepositService, IBusin @@ -252,10 +252,9 @@ public class StorageDepositServiceImpl implements IStorageDepositService, IBusin
252 } 252 }
253 } 253 }
254 254
255 - //4、校验货位号是否存在  
256 - DepositShelfCode shelfCodeDb = depositShelfCodeMapper.selectByShelfCode(shelfCode);  
257 - if(null == shelfCodeDb || !shelfCode.startsWith("U")) {  
258 - throw new ServiceException(400, "货位号:"+shelfCode+"不存在或格式错误"); 255 + //4、校验货位号格式
  256 + if(StringUtils.isNotEmpty(shelfCode) && !shelfCode.startsWith("U")) {
  257 + throw new ServiceException(400, "货位号:"+shelfCode+"格式错误");
259 } 258 }
260 259
261 String orderNoStr = shelfCode.replace("U", "").replace("-", ""); 260 String orderNoStr = shelfCode.replace("U", "").replace("-", "");
@@ -534,6 +533,13 @@ public class StorageDepositServiceImpl implements IStorageDepositService, IBusin @@ -534,6 +533,13 @@ public class StorageDepositServiceImpl implements IStorageDepositService, IBusin
534 req.setDepotNo(depotNo); 533 req.setDepotNo(depotNo);
535 req.setSize(100); 534 req.setSize(100);
536 list = storageDepositMapper.selectByCondition(req); 535 list = storageDepositMapper.selectByCondition(req);
  536 + if(CollectionUtils.isEmpty(list)){//按货位号来查
  537 + req = new StorageDepositReq();
  538 + req.setShelfCode(queryStr);
  539 + req.setDepotNo(depotNo);
  540 + req.setSize(100);
  541 + list = storageDepositMapper.selectByCondition(req);
  542 + }
537 if(CollectionUtils.isEmpty(list)){ 543 if(CollectionUtils.isEmpty(list)){
538 return Lists.newArrayList(); 544 return Lists.newArrayList();
539 } 545 }
@@ -62,6 +62,7 @@ datasources: @@ -62,6 +62,7 @@ datasources:
62 - com.yoho.order.dal.ClearanceRecordMapper 62 - com.yoho.order.dal.ClearanceRecordMapper
63 - com.yoho.order.dal.ProductSizeMapper 63 - com.yoho.order.dal.ProductSizeMapper
64 - com.yoho.order.dal.DepositShelfCodeMapper 64 - com.yoho.order.dal.DepositShelfCodeMapper
  65 + - com.yoho.order.dal.AbnormalOrderMapper
65 66
66 ufo_resource: 67 ufo_resource:
67 servers: 68 servers:
@@ -63,6 +63,7 @@ datasources: @@ -63,6 +63,7 @@ datasources:
63 - com.yoho.order.dal.ClearanceRecordMapper 63 - com.yoho.order.dal.ClearanceRecordMapper
64 - com.yoho.order.dal.ProductSizeMapper 64 - com.yoho.order.dal.ProductSizeMapper
65 - com.yoho.order.dal.DepositShelfCodeMapper 65 - com.yoho.order.dal.DepositShelfCodeMapper
  66 + - com.yoho.order.dal.AbnormalOrderMapper
66 67
67 ufo_resource: 68 ufo_resource:
68 servers: 69 servers: