记得上下班打卡 | git大法好,push需谨慎

Commit 2f4b79c8 authored by 胡佳晨's avatar 胡佳晨

修改 支出多店铺 erp

parent 730ff243
......@@ -4,12 +4,12 @@ import com.liquidnet.service.base.ResponseDto;
public interface IGoblinErpService {
ResponseDto<Boolean> initErpStock(String spuId,int min);
ResponseDto<Boolean> initErpStock(String spuId,int min,String storeId);
ResponseDto<Boolean> pushTrade(String orderId);
ResponseDto<Boolean> syncErpLogistic();
ResponseDto<Boolean> checkGoodsNo(String specNo,String goodsNo);
ResponseDto<Boolean> checkGoodsNo(String specNo,String goodsNo,String storeId);
}
......@@ -16,12 +16,6 @@ import java.util.*;
@Slf4j
public class ErpWdtClient {
@Value("${liquidnet.erp.wdt.api.appKey}")
private String appkey;
@Value("${liquidnet.erp.wdt.api.sid}")
private String sid;
@Value("${liquidnet.erp.wdt.api.appsecret}")
private String appSecret;
@Value("${liquidnet.erp.wdt.url}")
private String baseUrl;
......@@ -67,12 +61,12 @@ public class ErpWdtClient {
return length;
}
public String execute(String url, Map<String, String> param) {
public String execute(String url, Map<String, String> param, String appKey, String sid, String appSecret) {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
param.put("appkey", this.appkey);
param.put("sid", this.sid);
param.put("appkey", appKey);
param.put("sid", sid);
param.put("timestamp", Long.toString(System.currentTimeMillis() / 1000));
param.put("sign", getErpSign(param, appSecret));
params.setAll(param);
......
......@@ -245,20 +245,5 @@ liquidnet:
erp:
wdt:
url: https://sandbox.wangdian.cn/openapi2/
api:
sid: apidevnew2
appKey: mdtk2-test
appsecret: 09335107b
client:
sid: apidevnew2
appKey: mdtk2-test
appsecret: 292c3b92
store:
shop_no: mdtk2-test
warehouse_no: mdtk2-test
platform_id: 127
contentSize: 50
redisSize: 1
#application-dev-end
\ No newline at end of file
......@@ -245,19 +245,4 @@ liquidnet:
erp:
wdt:
url: https://sandbox.wangdian.cn/openapi2/
api:
sid: apidevnew2
appKey: mdtk2-test
appsecret: 09335107b
client:
sid: apidevnew2
appKey: mdtk2-test
appsecret: 292c3b92
store:
shop_no: mdtk2-test
warehouse_no: mdtk2-test
platform_id: 127
contentSize: 50
redisSize: 1
#application-test-end
\ No newline at end of file
......@@ -23,13 +23,15 @@ public class WdtController {
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "spuId", value = "spuId"),
@ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "min", value = "间隔时间"),
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "storeId", value = "店铺id"),
})
public ResponseDto<Boolean> initErpStock(@RequestParam(value = "spuId", required = false) String spuId,
@RequestParam(value = "min", required = false) Integer min) {
@RequestParam(value = "min", required = false) Integer min,
@RequestParam(value = "storeId", required = false) String storeId) {
if ( min == null || min <= 0) {
min = 5;
}
return goblinErpService.initErpStock(spuId, min);
return goblinErpService.initErpStock(spuId, min,storeId);
}
......@@ -55,12 +57,13 @@ public class WdtController {
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spec_no", value = "商家编码"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "goods_no", value = "货品编号"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "store_id", value = "店铺id"),
})
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<Boolean> checkGoodsNo(@RequestParam(value = "spec_no") String spec_no,
@RequestParam(value = "goods_no") String goods_no) {
return goblinErpService.checkGoodsNo(spec_no,goods_no);
@RequestParam(value = "goods_no") String goods_no,
@RequestParam(value = "store_id") String store_id) {
return goblinErpService.checkGoodsNo(spec_no,goods_no,store_id);
}
}
......@@ -2901,26 +2901,26 @@ public class GoblinRedisUtils {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index + "");
List<Object> list = redisUtil.getRange(rdk);
List<String> data = CollectionUtil.arrayListString();
for (Object str :list){
for (Object str : list) {
data.add((String) str);
}
return data;
}
public String erpLeftPop(int index) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index + "");
Object obj = redisUtil.leftPop(rdk);
if(obj==null){
public String erpLeftPop(String shopNo) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(shopNo);
Object obj = redisUtil.leftPop(rdk);
if (obj == null) {
return null;
}else{
} else {
return (String) obj;
}
}
//添加erp订单
public int erpAddPush(int index,String orderId) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index+"");
return (int) redisUtil.rightPush(rdk,orderId);
public int erpAddErrorPush(String shopNo, String orderId) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat("error:" + shopNo);
return (int) redisUtil.rightPush(rdk, orderId);
}
/* ---------------------------------------- ---------------------------------------- */
......
......@@ -748,7 +748,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
String uid = orderVo.getUserId();
Integer orderStatusOld = orderVo.getStatus();
LocalDateTime now = LocalDateTime.now();
goblinOrderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting());
goblinOrderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting(),orderVo.getStoreId());
// 更新订单信息
if (StringUtil.isEmpty(syncOrderParam.getPaymentType())) {
orderVo.setPaymentType("");
......
......@@ -831,7 +831,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log.error("订单号为 {} 的订单正在退款 或者已退款", syncOrderParam.getOrderCode());
} else if (syncOrderParam.getStatus().equals(1) && orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_0.getValue()) {
log.error("订单号为 {} 的订单正常流程", syncOrderParam.getOrderCode());
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting());
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting(),orderVo.getStoreId());
storeOrder.setPaymentType(syncOrderParam.getPaymentType());
storeOrder.setPaymentId(syncOrderParam.getPaymentId());
storeOrder.setPayCode(syncOrderParam.getCode());
......
......@@ -640,7 +640,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
log.error("Mix订单Id为 {} 的订单正在退款 或者已退款", orderId);
} else if (status == 1) {
log.error("Mix订单Id {} 的订单正常流程", orderId);
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting());
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting(),orderVo.getStoreId());
storeOrder.setPaymentType(paymentType);
storeOrder.setPaymentId(paymentId);
storeOrder.setPayCode(code);
......@@ -736,7 +736,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
String uid = orderVo.getUserId();
Integer orderStatusOld = orderVo.getStatus();
LocalDateTime now = LocalDateTime.now();
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting());
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting(),orderVo.getStoreId());
// 更新订单信息
if (StringUtil.isEmpty(paymentType)) {
orderVo.setPaymentType("");
......
......@@ -39,10 +39,6 @@ public class GoblinOrderUtils {
private String candyUrl;
@Value("${liquidnet.service.order.url-pay.goblinRefundUrl}")
private String synUrl;
@Value("${liquidnet.erp.wdt.contentSize}")
private int contentSize;
@Value("${liquidnet.erp.wdt.redisSize}")
private int redisSize;
@Autowired
private IDragonOrderRefundsService dragonOrderRefundsService;
......@@ -256,8 +252,8 @@ public class GoblinOrderUtils {
GoblinUseResultVo returnVo = GoblinUseResultVo.getNew();
List<CouponOutLineVo> couponList = redisUtils.getOutLineCoupon();
boolean isOutLine = false;
for (CouponOutLineVo data: couponList) {
if(data.getStoreCouponId().equals(ucouponId)){
for (CouponOutLineVo data : couponList) {
if (data.getStoreCouponId().equals(ucouponId)) {
isOutLine = true;
BigDecimal tempPrice = totalPrice.subtract(totalPrice.multiply(BigDecimal.valueOf(data.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_DOWN));
returnVo.setSpuIds(CollectionUtil.linkedListString());
......@@ -265,7 +261,7 @@ public class GoblinOrderUtils {
returnVo.setCouType(data.getCouType());
}
}
if(isOutLine){
if (isOutLine) {
return returnVo;
}
try {
......@@ -571,18 +567,15 @@ public class GoblinOrderUtils {
}
public void addErpPush(String orderId, int erpHosting) {
public void addErpPush(String orderId, int erpHosting, String storeId) {
if (erpHosting == 0) {
} else {
redisUtils.erpAddPush(0, orderId);
// for (int i = 0; i < redisSize; i++) {
// boolean isFull = redisUtils.erpAddPush(i, orderId) > contentSize;
// if (isFull) {
// redisUtils.erpPopPush(i);
// } else {
// break;
// }
// }
GoblinStoreErpConfigVo vo = redisUtils.getStoreErpConfigVoByStoreId(storeId);
if (vo == null || vo.getShopNo().equals("")) {
} else {
redisUtils.erpAddPush(vo.getShopNo(), orderId);
}
}
}
}
......@@ -746,14 +746,20 @@ public class GoblinRedisUtils {
//添加erp订单
public int erpAddPush(int index,String orderId) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index+"");
public int erpAddPush(String shopNo,String orderId) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(shopNo);
return (int) redisUtil.rightPush(rdk,orderId);
}
//移除erp订单
public String erpPopPush(int index) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index+"");
public String erpPopPush(String shopNo) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(shopNo);
return (String) redisUtil.rightPop(rdk);
}
public GoblinStoreErpConfigVo getStoreErpConfigVoByStoreId(String storeId) {
String rk = GoblinRedisConst.BASIC_STORE_ERP_CONF.concat(storeId);
GoblinStoreErpConfigVo vo = (GoblinStoreErpConfigVo) redisUtil.get(rk);
return vo;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment