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

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

修改 支出多店铺 erp

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