|
@@ -391,6 +391,20 @@ public class SecondHandServiceImpl implements SecondHandService {
|
|
|
}
|
|
|
|
|
|
private ResponseJson saveSecondHandProduct(SecondDto secondDto) {
|
|
|
+ //根据银行卡判断是否注册过特殊二手供应商,有则挂在之前的供应商名下,否则注册新供应商
|
|
|
+ Integer shopId = secondHandMapper.findSecondShop(secondDto.getCardNumber());
|
|
|
+ if (null == shopId || shopId <= 0) {
|
|
|
+ //保存为特殊二手供应商
|
|
|
+ ShopVo shopVo = new ShopVo();
|
|
|
+ //1个人,2公司
|
|
|
+ String name = 1 == secondDto.getPublishIdentity() ? secondDto.getContactName() : secondDto.getCompanyName();
|
|
|
+ shopVo.setName(name);
|
|
|
+ shopVo.setLinkMan(secondDto.getContactName());
|
|
|
+ shopVo.setContractMobile(secondDto.getContactMobile());
|
|
|
+ shopVo.setCardNumber(secondDto.getCardNumber());
|
|
|
+ secondHandMapper.insertShop(shopVo);
|
|
|
+ shopId=shopVo.getShopId();
|
|
|
+ }
|
|
|
// 设置日期时间格式
|
|
|
Date date = new Date();
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
@@ -410,7 +424,7 @@ public class SecondHandServiceImpl implements SecondHandService {
|
|
|
product.setProductCategory(2);
|
|
|
product.setPreferredFlag(0);
|
|
|
// 默认发布到二手供应商
|
|
|
- product.setShopId(1252);
|
|
|
+ product.setShopId(shopId);
|
|
|
product.setSellNumber(secondDto.getStock());
|
|
|
product.setCostPrice(0d);
|
|
|
product.setCostCheckFlag(2);
|