Authored by tanling

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

... ... @@ -15,22 +15,27 @@ import java.util.Map;
public enum TransferCase {
APPRAISE_SUCCESS(1),
APPRAISE_FAIL(2),
SELLER_PLAY_BUYER(3),
DELIVER_TIME_OUT(4),
BUYER_CANCEL_BEFORE_SELLER_DELIVER(5),
BUYER_CANCEL_BEFORE_DEPOT_RECEIVE(6);
APPRAISE_SUCCESS(1, "鉴定通过[货款->卖家]"),
APPRAISE_FAIL(2, "鉴定不通过[保证金->买家]"),
SELLER_PLAY_BUYER(3,"有买家时卖家不卖[保证金->买家]"),
DELIVER_TIME_OUT(4,"卖家超时发货[保证金->买家]"),
BUYER_CANCEL_BEFORE_SELLER_DELIVER(5,"卖家未发货时买家取消[部分货款->卖家]"),
BUYER_CANCEL_BEFORE_DEPOT_RECEIVE(6,"卖家已发货时买家取消[部分货款->卖家]");
private int code;
private String info;
TransferCase(int code) {
TransferCase(int code, String info) {
this.code = code;
this.info = info;
}
public int getCode() {
return code;
}
public String getInfo() {
return info;
}
private static Map<Integer, TransferCase> cache;
... ...
... ... @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2018/9/25
*/
@RestController
@RequestMapping(value="/order/appraise")
@RequestMapping(value="/erp/order/appraise")
@ServiceDesc("orderAppraise")
public class AppraiseController {
... ...
... ... @@ -225,7 +225,7 @@ public class BuyerOrderController {
@IgnoreSession
@IgnoreSignature
@RequestMapping(value = "/confirmReceive")
@RequestMapping(value = "/erp/confirmReceive")
@ResponseBody
public ApiResponse confirmReceive(@RequestBody OrderRequest request) {
LOG.info("method ufo.depot.confirmReceive in, req is {}", request);
... ...
... ... @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value="/order/buyerOrderMeta")
@RequestMapping(value="/erp/order/buyerOrderMeta")
@ServiceDesc("orderBuyerOrderMeta")
public class BuyerOrderMeta4PlatformController {
private final Logger logger = LoggerUtils.getBuyerOrderLogger();
... ...
... ... @@ -271,7 +271,7 @@ public class PaymentController {
@IgnoreSignature
@IgnoreSession
//@RequestMapping(params = "method=ufo.order.manualDealMon")
@RequestMapping(value="/manualDealMon")
@RequestMapping(value="/erp/manualDealMon")
public ApiResponse manualDealMon(@RequestBody ManualDealRequest req) {
try {
paymentService.manualDeal(req);
... ...
... ... @@ -185,7 +185,7 @@ public class SellerOrderController {
* @return
* @throws GatewayException
*/
@RequestMapping(value="/offShelveByErp")
@RequestMapping(value="/erp/offShelveByErp")
@ResponseBody
@IgnoreSession
@IgnoreSignature
... ...
... ... @@ -624,11 +624,11 @@ public class PaymentServiceImpl implements IPaymentService {
transfer.setAlipayAccount(account.getAlipayAccount());
}
String alipayAccount = transfer.getAlipayAccount();
JSONObject jsonObject = null;
// 转账
try {
logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
JSONObject jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
if (jsonObject == null) {
logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
transfer.setStatus(3);
... ... @@ -651,7 +651,12 @@ public class PaymentServiceImpl implements IPaymentService {
}
} catch (Exception e) {
logger.warn("transferMonErr 转账失败 , orderCode is {}, msg is {}", buyerOrderCode, e.getMessage());
alarm("转账失败", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferType + ")转账失败,msg=" + e.getMessage());
String alarmMsg = "订单号:" + buyerOrderCode + ",操作类型:" + transferCase.getInfo() + ",msg=" + e.getMessage();
if (jsonObject != null) {
alarmMsg += ",阿里返回DETAIL=" + jsonObject.toJSONString();
}
logger.info("transferMonErr 转账失败 , alarmMsg is {}", alarmMsg);
alarm("转账失败", "ufo.order.transferMon", alarmMsg);
transfer.setStatus(3);
if(e instanceof ServiceException) {
throw new ServiceException(((ServiceException) e).getCode(), e.getMessage());
... ... @@ -733,9 +738,10 @@ public class PaymentServiceImpl implements IPaymentService {
logger.info("transAllEarnest参数检查成功!");
// 转账
JSONObject jsonObject = null;
try {
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, alipayAccount, amount);
JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), alipayId, alipayAccount, amount);
jsonObject = alipayService.transferMoney(Long.toString(orderCode), alipayId, alipayAccount, amount);
if (jsonObject == null) {
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
transfer.setStatus(3);
... ... @@ -759,7 +765,12 @@ public class PaymentServiceImpl implements IPaymentService {
}
} catch (Exception e) {
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
alarm("转账失败", "ufo.order.transAllEarnest", "订单号:" + orderCode + "操作类型(" + 6 + ")转账失败,msg=" + e.getMessage());
String alarmMsg = "订单号:" + orderCode + ",操作类型(商家退出入驻退保证金),msg=" + e.getMessage();
if (jsonObject != null) {
alarmMsg += ",阿里返回DETAIL=" + jsonObject.toJSONString();
}
logger.info("transAllEarnestErr 转账失败 , alarmMsg is {}", alarmMsg);
alarm("转账失败", "ufo.order.transAllEarnest", alarmMsg);
transfer.setStatus(3);
if(e instanceof ServiceException) {
throw new ServiceException(((ServiceException) e).getCode(), e.getMessage());
... ... @@ -925,12 +936,13 @@ public class PaymentServiceImpl implements IPaymentService {
}
// '1:买家uid; 2:卖家uid','1:保证金;2:货款;3:补偿款', '1:用户收入; 2:用户支出'
PayRefundBo refundBo = null;
try {
if (/* 退货款 */((tradeBills.getUserType() == 1 && tradeBills.getTradeType() == 2 && tradeBills.getIncomeOutcome() == 1)
/* 退保证金(普通用户) */
|| (tradeBills.getUserType() == 2 && tradeBills.getTradeType() == 1 && tradeBills.getIncomeOutcome() == 1 && !isMerchantExit))) {
logger.warn("manualDeal人工退款 , tradeBills is {}", tradeBills);
PayRefundBo refundBo = manualRefund(orderCode, amount);
refundBo = manualRefund(orderCode, amount);
if (refundBo.getRefundStatus() == RefundContant.PAYMENT_REFUND_RESULTCODE_SUCCESS) {
// 加新流水
tradeBills.setDealRelateId(tradeBills.getId());
... ... @@ -945,8 +957,12 @@ public class PaymentServiceImpl implements IPaymentService {
}
} catch (Exception e) {
logger.warn("manualDealErr 退款失败 , tradeBillsId is {}, msg is {}", tradeBillsId, e.getMessage());
alarm("人工处理退款失败", "ufo.order.manualDeal",
"订单号:" + orderCode + "操作类型(退款)转账失败,流水id=" + tradeBillsId + ",msg=" + e.getMessage());
String alarmMsg = "订单号:" + orderCode + ",操作类型(退款),流水id=" + tradeBillsId + ",msg=" + e.getMessage();
if (refundBo != null) {
alarmMsg += ",DETAIL=" + JSON.toJSONString(refundBo);
}
logger.info("manualDealErr 退款失败 , alarmMsg is {}", alarmMsg);
alarm("人工处理退款失败", "ufo.order.manualDeal", alarmMsg );
preSuccess.setDealStatus(0);
tradeBillsMapper.updateToFailByPrimaryKey(preSuccess);
if (e instanceof ServiceException) {
... ... @@ -955,6 +971,7 @@ public class PaymentServiceImpl implements IPaymentService {
throw new ServiceException(500, "退款失败id=" + tradeBillsId);
}
}
JSONObject jsonObject = null;
try {
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode);
if (transfer == null) {
... ... @@ -964,7 +981,7 @@ public class PaymentServiceImpl implements IPaymentService {
throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId);
}
JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
if (jsonObject == null) {
logger.warn("manualDeal 转账失败 , req is {}", req);
throw new ServiceException(500, "转账失败:阿里接口返回null");
... ... @@ -991,8 +1008,12 @@ public class PaymentServiceImpl implements IPaymentService {
}
} catch (Exception e) {
logger.warn("manualDealErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
alarm("人工处理转账失败", "ufo.order.manualDeal",
"订单号:" + orderCode + "操作类型(退款)转账失败,流水id=" + tradeBillsId + ",msg=" + e.getMessage());
String alarmMsg = "订单号:" + orderCode + ",操作类型(转账),流水id=" + tradeBillsId + ",msg=" + e.getMessage();
if (jsonObject != null) {
alarmMsg += ",阿里返回DETAIL=" + jsonObject.toJSONString();
}
logger.info("manualDealErr 转账失败 , alarmMsg is {}", alarmMsg);
alarm("人工处理转账失败", "ufo.order.manualDeal", alarmMsg);
preSuccess.setDealStatus(0);
tradeBillsMapper.updateToFailByPrimaryKey(preSuccess);
if (e instanceof ServiceException) {
... ...
... ... @@ -138,11 +138,12 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
* @param alipayAccount
* @param transferAmount
* @return
* @throws Exception
*/
public JSONObject transferMoney(String transferOrderCode, String alipayUid, String alipayAccount, BigDecimal transferAmount){
public JSONObject transferMoney(String transferOrderCode, String alipayUid, String alipayAccount, BigDecimal transferAmount) throws Exception{
Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount);
String respTxt = sendOpenApiRequest(transferOrderCode, queryParams);
String respTxt = sendOpenApiRequestWithException(transferOrderCode, queryParams);
JSONObject result = null;
... ... @@ -173,6 +174,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
logger.info("[{}] trade openapi resp: {}", orderCode, response);
return response;
}
private String sendOpenApiRequestWithException(String orderCode, Map<String, String> paramMap) throws Exception {
logger.info("[{}] send openapi request: {}", orderCode, paramMap);
String response = httpClient.postFormData(AlipayConfig.OPENAPI_URL, paramMap);
logger.info("[{}] trade openapi resp: {}", orderCode, response);
return response;
}
private PayQueryBo queryOpenApiConvert(String orderCode, String respText) {
... ...
... ... @@ -364,6 +364,11 @@ public class ProductController {
cacheAop.clearCache(
ProductController.class.getMethod("queryStorageInfo", new Class[] { Integer.class }),
new Object[] { storageId });
LOG.info("clearCache queryStorageSuggestPrice storageId = {}, ", storageId);
cacheAop.clearCache(
ProductController.class.getMethod("queryStorageSuggestPrice", new Class[] { Collection.class }),
new Object[] { storageId });
}
}
} catch (Exception e) {
... ...
... ... @@ -230,7 +230,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
}
result = productChainMapper.selectByTagId(tagId);
if(result != null){
clientCache.set(kb.getKey(), 10 * 60 , result );//10分钟
clientCache.setEx(kb, result,10 * 60 );//10分钟
}
logger.info("queryTransactionIdByTagId from db success! tagId={},result={}", tagId,result);
return result;
... ... @@ -281,15 +281,14 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyRelation:").appendVar(authUid);
IdentifyRelation result = clientCache.get(kb, IdentifyRelation.class);
if( result != null){
logger.info("queryIdentifyRelation from cache success! authUid={}", authUid);
logger.info("queryIdentifyRelation from cache success! authUid={}, result={}", authUid, result);
return result;
}
result = identifyRelationMapper.selectByauthUid(authUid);
if(result != null){
clientCache.set(kb.getKey(), 2 * 60 * 60, result );//两小时
clientCache.setEx(kb, result, 2 * 60 * 60 );//两小时
}
logger.info("queryIdentifyRelation from db success! authUid={}, result={}", authUid, result);
return result;
}
... ... @@ -299,13 +298,14 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
appendVar(tagId).appendVar(":").appendVar(nfcUid);
IdentifyRecord result = clientCache.get(kb, IdentifyRecord.class);
if( result != null){
logger.info("queryIdentifyRecord from cache success! tagId={},nfcUid={} ",tagId, nfcUid );
logger.info("queryIdentifyRecord from cache success! tagId={},nfcUid={},result={} ",tagId, nfcUid,result );
return result;
}
result = identifyRecordsMapper.selectByTagAndNfcId(tagId, nfcUid);
if(result != null){
clientCache.set(kb.getKey(), 5 * 60, result );
clientCache.setEx(kb, result, 5 * 60 );
}
logger.info("queryIdentifyRecord from db success! tagId={},nfcUid={},result={} ",tagId, nfcUid,result );
return result;
}
... ... @@ -319,13 +319,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyResultInfo:").
appendVar(tagId).appendVar(":").appendVar(nfcUid);
clientCache.set(kb.getKey(), 5 * 60, result );
clientCache.setEx(kb, result,5 * 60 );
}
private ProductIdentifyResp getIdentifyFromCache(String tagId, String nfcUid) {
RedisKeyBuilder kb = new RedisKeyBuilder().appendFixed("ufo:product:identifyResultInfo:").
appendVar(tagId).appendVar(":").appendVar(nfcUid);
ProductIdentifyResp identifyResp = clientCache.get(kb.getKey(), ProductIdentifyResp.class);
ProductIdentifyResp identifyResp = clientCache.get(kb, ProductIdentifyResp.class);
return identifyResp;
}
... ...
... ... @@ -83,7 +83,6 @@ public class InBoxController {
*/
@RequestMapping(params = "method=ufo.users.addInbox")
@IgnoreSession
@IgnoreSignature
public ApiResponse addInbox(@RequestParam(name = "uid") int uid,
@RequestParam(name = "type") Integer type,
@RequestParam(name = "businessType") Integer businessType,
... ...
... ... @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
* Created by craig.qin on 2018/9/11.
*/
@RestController
@RequestMapping(value="/user/realNameAuthorize")
@RequestMapping(value="/erp/user/realNameAuthorize")
@ServiceDesc("userRealNameAuthorize")
public class RealNameAuthorize4PlatformController {
private Logger logger = LoggerFactory.getLogger(RealNameAuthorize4PlatformController.class);
... ...