Authored by mali

Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.10

@@ -6,11 +6,12 @@ import com.yoho.message.sdk.service.ufo.IUFOSendService; @@ -6,11 +6,12 @@ import com.yoho.message.sdk.service.ufo.IUFOSendService;
6 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; 6 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; 7 import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
8 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel; 8 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
  9 +import com.yohobuy.ufo.model.order.vo.GoodsVo;
  10 +import com.yohobuy.ufo.model.order.vo.ProductVo;
  11 +import com.yohoufo.dal.order.AppraiseOrderGoodsMapper;
  12 +import com.yohoufo.dal.order.AppraiseOrderStorageMapper;
9 import com.yohoufo.dal.order.SellerOrderMapper; 13 import com.yohoufo.dal.order.SellerOrderMapper;
10 -import com.yohoufo.dal.order.model.AppraiseOrder;  
11 -import com.yohoufo.dal.order.model.BuyerOrder;  
12 -import com.yohoufo.dal.order.model.SellerOrder;  
13 -import com.yohoufo.dal.order.model.SellerOrderGoods; 14 +import com.yohoufo.dal.order.model.*;
14 import com.yohoufo.dal.product.ProductMapper; 15 import com.yohoufo.dal.product.ProductMapper;
15 import com.yohoufo.dal.product.model.Product; 16 import com.yohoufo.dal.product.model.Product;
16 import com.yohoufo.inboxclient.model.InBoxResponse; 17 import com.yohoufo.inboxclient.model.InBoxResponse;
@@ -30,7 +31,7 @@ import java.math.BigDecimal; @@ -30,7 +31,7 @@ import java.math.BigDecimal;
30 import java.util.Arrays; 31 import java.util.Arrays;
31 import java.util.List; 32 import java.util.List;
32 import java.util.Map; 33 import java.util.Map;
33 -import java.util.Optional; 34 +import java.util.Objects;
34 import java.util.concurrent.ArrayBlockingQueue; 35 import java.util.concurrent.ArrayBlockingQueue;
35 import java.util.concurrent.ExecutorService; 36 import java.util.concurrent.ExecutorService;
36 import java.util.concurrent.ThreadPoolExecutor; 37 import java.util.concurrent.ThreadPoolExecutor;
@@ -62,6 +63,12 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -62,6 +63,12 @@ public class InBoxFacade extends BaseNoticeFacade{
62 private SellerOrderMapper sellerOrderMapper; 63 private SellerOrderMapper sellerOrderMapper;
63 64
64 @Autowired 65 @Autowired
  66 + private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
  67 +
  68 + @Autowired
  69 + private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
  70 +
  71 + @Autowired
65 private IUFOSendService ufoSendService; 72 private IUFOSendService ufoSendService;
66 73
67 @Autowired 74 @Autowired
@@ -1016,52 +1023,233 @@ public class InBoxFacade extends BaseNoticeFacade{ @@ -1016,52 +1023,233 @@ public class InBoxFacade extends BaseNoticeFacade{
1016 log.warn("notice user renew deposit goods fail, uid {}, sog {}", uid, sog, e); 1023 log.warn("notice user renew deposit goods fail, uid {}, sog {}", uid, sog, e);
1017 } 1024 }
1018 } 1025 }
1019 - 1026 + GoodsVo buildProductInfo(long orderCode){
  1027 + AppraiseOrderGoods paog = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode);
  1028 + AppraiseOrderStorage paos = appraiseOrderStorageMapper.selectByOrderCode(orderCode);
  1029 + return GoodsVo.builder()
  1030 + .productName(paog.getProductName())
  1031 + .productCode(paog.getProductCode())
  1032 + .sizeName(Objects.nonNull(paos) ? paos.getSizeName() : null)
  1033 + .build();
  1034 + }
1020 1035
1021 public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){ 1036 public void sellerDepositOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
1022 - switch (targetStatus){  
1023 - case WAITING_PAY:  
1024 -  
1025 - break; 1037 + log.info("enter sellerDepositOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
  1038 + try {
  1039 + //
  1040 + InboxBusinessTypeEnum inboxType = null;
  1041 + InboxBusinessTypeEnum smsType = null;
  1042 +
  1043 + Object[] inboxParams = null,
  1044 + smsParams = null;
  1045 + switch (targetStatus){
  1046 + case WAITING_PAY:
  1047 + //inbox
  1048 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_WAITING_PAY;
  1049 + inboxParams = new Object[]{orderCode};
  1050 + break;
1026 1051
1027 - case CANCEL_BEFORE_PAY: 1052 + case CANCEL_BEFORE_PAY:
  1053 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_SELF_CANCEL;
  1054 + inboxParams = new Object[]{orderCode};
  1055 + break;
1028 1056
1029 - break;  
1030 - case HAS_PAYED: 1057 + case HAS_PAYED:
  1058 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_PAID;
  1059 + inboxParams = new Object[]{orderCode};
  1060 + //sms
  1061 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_PAID;
  1062 + smsParams = new Object[]{orderCode};
  1063 + break;
  1064 + case CANCEL_BEFORE_DELIVER:
  1065 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_CANCEL_BEFORE_DELIVER;
  1066 + inboxParams = new Object[]{orderCode};
  1067 + //sms
  1068 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_CANCEL_BEFORE_DELIVER;
  1069 + smsParams = new Object[]{orderCode};
  1070 + break;
  1071 + case SEND_OUT_TIMEOUT:
  1072 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_DELIVER_TIMEOUT;
  1073 + inboxParams = new Object[]{orderCode};
  1074 + //sms
  1075 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_DELIVER_TIMEOUT;
  1076 + smsParams = new Object[]{orderCode};
  1077 + break;
  1078 + case PLATFORM_RECEIVE:
  1079 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_PLATFORM_RECEIVE;
  1080 + inboxParams = new Object[]{orderCode};
  1081 + //sms
  1082 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_PLATFORM_RECEIVE;
  1083 + smsParams = new Object[]{orderCode};
  1084 + break;
  1085 + case SHAM_SEND_OUT:
  1086 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_MISS_GOODS;
  1087 + // get product info 「商品名称」「尺码」「货号」
  1088 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1089 + break;
  1090 + case QUALITY_CHECK_FAKE:
  1091 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FIND_FLAW_OR_BIGGER;
  1092 + //get product info 「商品名称」「尺码」「货号」
  1093 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1094 + break;
1031 1095
1032 - break;  
1033 - case CANCEL_BEFORE_DELIVER: 1096 + case PLATFORM_APPRAISE_UNSURE:
  1097 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_UNSURE;
  1098 + //get product info 「商品名称」「尺码」「货号」
  1099 + inboxParams = buildParams4SellerDepositOrder(orderCode);
1034 1100
1035 - break;  
1036 - case SEND_OUT_TIMEOUT: 1101 + break;
  1102 + case JUDGE_PASS:
  1103 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_PASS;
  1104 + //get product info 「商品名称」「尺码」「货号」
  1105 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1106 + break;
1037 1107
1038 - break;  
1039 - case PLATFORM_RECEIVE: 1108 + case CHECKING_FAKE:
  1109 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_APPRAISE_FAKE;
  1110 + //get product info 「商品名称」「尺码」「货号」
  1111 + inboxParams = buildParams4SellerDepositOrder(orderCode);
  1112 + break;
1040 1113
1041 - break;  
1042 - case SHAM_SEND_OUT: 1114 + case FINISH:
  1115 + inboxType = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
  1116 + inboxParams = new Object[]{orderCode};
  1117 + //sms
  1118 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_DEPOSIT_ORDER_FINISH_APPRAISE_SUMMARY;
  1119 + smsParams = new Object[]{orderCode};
  1120 + break;
  1121 + }
1043 1122
1044 - break;  
1045 - case QUALITY_CHECK_FAKE:  
1046 1123
1047 - break; 1124 + Notice notice = newNotice(uid).withLogPrefix("seller Deposit Order Notice 4 " + targetStatus.name());
  1125 + if (Objects.nonNull(inboxType)){
  1126 + notice.withInBox(inboxType, inboxParams);
  1127 + }
  1128 + if (Objects.nonNull(smsType)) {
  1129 + notice.withSms(smsType, smsParams);
  1130 + }
  1131 + notice.send();
  1132 + } catch (Exception e) {
  1133 + log.warn("notice seller deposit order fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
  1134 + }
  1135 + }
1048 1136
1049 - case PLATFORM_APPRAISE_UNSURE: 1137 + public void paidAppraiseOrderNotice(int uid,long orderCode, AppraiseOrderStatus targetStatus){
  1138 + log.info("enter paidAppraiseOrderNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
  1139 + try {
  1140 + //
  1141 + InboxBusinessTypeEnum inboxType = null;
  1142 + InboxBusinessTypeEnum smsType = null;
1050 1143
1051 - break;  
1052 - case JUDGE_PASS: 1144 + switch (targetStatus){
  1145 + case HAS_PAYED:
  1146 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PAID;
  1147 + break;
1053 1148
1054 - break; 1149 + case PLATFORM_RECEIVE:
  1150 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_PLATFORM_RECEIVE;
  1151 + break;
  1152 + case SHAM_SEND_OUT:
  1153 + break;
  1154 + case QUALITY_CHECK_FAKE:
  1155 + break;
1055 1156
1056 - case CHECKING_FAKE: 1157 + case PLATFORM_APPRAISE_UNSURE:
  1158 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_UNSURE;
  1159 + //get product info 「商品名称」「尺码」「货号」
  1160 + //sms
  1161 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_UNSURE;
  1162 + break;
  1163 + case JUDGE_PASS:
  1164 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_PASS;
  1165 + //sms
  1166 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_PASS;
  1167 + break;
1057 1168
1058 - break; 1169 + case CHECKING_FAKE:
  1170 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_APPRAISE_FAKE;
  1171 + //sms
  1172 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_APPRAISE_FAKE;
  1173 + break;
1059 1174
1060 - case FINISH: 1175 + case FINISH:
  1176 + break;
  1177 + }
  1178 + boolean smsRequired = Objects.nonNull(smsType);
  1179 + Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode);
  1180 + Object[] smsParams = smsRequired ? inboxParams : null;
1061 1181
1062 - break; 1182 + Notice notice = newNotice(uid).withLogPrefix("paid Appraise Order Notice 4 " + targetStatus.name());
  1183 + if (Objects.nonNull(inboxType)){
  1184 + notice.withInBox(inboxType, inboxParams);
  1185 + }
  1186 + if (smsRequired) {
  1187 + notice.withSms(smsType, smsParams);
  1188 + }
  1189 + notice.send();
  1190 + } catch (Exception e) {
  1191 + log.warn("paidAppraiseOrderNotice fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
1063 } 1192 }
1064 1193
1065 } 1194 }
  1195 + private Object[] buildParams4SellerDepositOrder(long orderCode){
  1196 + GoodsVo goodsVo;
  1197 + goodsVo = buildProductInfo(orderCode);
  1198 + return new Object[]{orderCode, goodsVo.getProductName(), goodsVo.getSizeName(), goodsVo.getProductCode()};
  1199 + }
1066 1200
  1201 + private Object[] buildParams4PaidAppraiseOrder(long orderCode){
  1202 + GoodsVo goodsVo;
  1203 + goodsVo = buildProductInfo(orderCode);
  1204 + //get product info 「商品名称」「货号」
  1205 + return new Object[]{ goodsVo.getProductName(), goodsVo.getProductCode()};
  1206 + }
  1207 +
  1208 + public void paidAppraiseOrderDeliverBackNotice(int uid,long orderCode, String expressNumber, AppraiseOrderStatus targetStatus){
  1209 + log.info("enter paidAppraiseOrderDeliverBackNotice uid {} orderCode {} targetStatus {}", uid, orderCode, targetStatus);
  1210 + try {
  1211 + //
  1212 + InboxBusinessTypeEnum inboxType = null;
  1213 + InboxBusinessTypeEnum smsType = null;
  1214 +
  1215 + switch (targetStatus){
  1216 + case PLATFORM_APPRAISE_UNSURE:
  1217 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_UNSURE;
  1218 + //sms
  1219 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_UNSURE;
  1220 + break;
  1221 + case JUDGE_PASS:
  1222 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_PASS;
  1223 + //sms
  1224 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_PASS;
  1225 + break;
  1226 +
  1227 + case CHECKING_FAKE:
  1228 + inboxType = InboxBusinessTypeEnum.NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_FAKE;
  1229 + //sms
  1230 + smsType = InboxBusinessTypeEnum.SMS_NOTICE_PAID_APPRAISE_ORDER_DELIVER_AFTER_APPRAISE_FAKE;
  1231 + break;
  1232 +
  1233 + }
  1234 + boolean smsRequired = Objects.nonNull(smsType);
  1235 + Object[] inboxParams = buildParams4PaidAppraiseOrder(orderCode);
  1236 + Object[] smsParams = smsRequired ? inboxParams : null;
  1237 +
  1238 +
  1239 + Notice notice = newNotice(uid).withLogPrefix("paidAppraiseOrder Deliver Back Notice 4 " + targetStatus.name());
  1240 + if (Objects.nonNull(inboxType)){
  1241 + notice.withInBox(inboxType, inboxParams);
  1242 + }
  1243 + if (smsRequired) {
  1244 + //set expressNumber
  1245 + smsParams[2] = expressNumber;
  1246 +
  1247 + notice.withSms(smsType, smsParams);
  1248 + }
  1249 + notice.send();
  1250 + } catch (Exception e) {
  1251 + log.warn("paidAppraiseOrder Deliver Back Notice fail, uid {}, orderCode {} status {}", uid, orderCode, targetStatus, e);
  1252 + }
  1253 +
  1254 + }
1067 } 1255 }