|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
import com.alibaba.dubbo.common.utils.CollectionUtils;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.uas.platform.b2b.core.util.ThreadUtils;
|
|
|
import com.uas.platform.b2b.dao.ProductDao;
|
|
|
import com.uas.platform.b2b.dao.ProductUsersDao;
|
|
|
@@ -95,7 +96,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
prod.setUseruu(useruu);
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.updateProductUsersOne(prod);
|
|
|
- productUsersDao.save(prod);
|
|
|
+// productUsersDao.save(prod);
|
|
|
logger.log("个人产品库增加产品", "关联:" + productList.get(0).getId());
|
|
|
map.put("success", "新增成功");
|
|
|
} else {// 不存在的话新增再绑定
|
|
|
@@ -129,17 +130,17 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
prodInfo.setStandard(Constant.NO);
|
|
|
prodInfo.setErpDate(new Date());
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
- ProductUtils.updateOne(prodInfo);
|
|
|
- prodInfo = productDao.save(prodInfo);
|
|
|
+ Long proId = ProductUtils.updateOne(prodInfo);
|
|
|
+// prodInfo = productDao.save(prodInfo);
|
|
|
ProductUsers prod = new ProductUsers();
|
|
|
prod.setDate(new Date());
|
|
|
prod.setEnuu(enuu);
|
|
|
- prod.setPrid(prodInfo.getId());
|
|
|
+ prod.setPrid(proId);
|
|
|
prod.setUseruu(useruu);
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.updateProductUsersOne(prod);
|
|
|
productUsersDao.save(prod);
|
|
|
- logger.log("个人产品库增加产品", "关联:" + prodInfo.getId());
|
|
|
+ logger.log("个人产品库增加产品", "关联:" + proId);
|
|
|
map.put("success", "新增成功");
|
|
|
}
|
|
|
} else {
|
|
|
@@ -152,7 +153,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
public void deleteById(Long id) throws Exception {
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.deleteProductUser(id);
|
|
|
- productUsersDao.delete(id);
|
|
|
+// productUsersDao.delete(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -279,11 +280,11 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
}
|
|
|
}
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
- ProductUtils.updateOne(product);
|
|
|
- product = productDao.save(product);
|
|
|
+ Long proId = ProductUtils.updateOne(product);
|
|
|
+// product = productDao.save(product);
|
|
|
prod.setDate(new Date());
|
|
|
prod.setEnuu(enuu);
|
|
|
- prod.setPrid(product.getId());
|
|
|
+ prod.setPrid(proId);
|
|
|
prod.setUseruu(useruu);
|
|
|
} else {
|
|
|
Product oldProd = prods.get(0);
|
|
|
@@ -303,7 +304,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
try {
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.updateProductUsersByBatch(productUsers);
|
|
|
- productUsers = productUsersDao.save(productUsers);
|
|
|
+// productUsers = productUsersDao.save(productUsers);
|
|
|
modelMap.put("success", productUsers.size());
|
|
|
if(alters.size() > 0)
|
|
|
modelMap.put("alters", alters);
|
|
|
@@ -325,7 +326,8 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
// ids.replace("]"," ");
|
|
|
// Integer count = productUsersDao.coverToUserProd(ids, SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu());
|
|
|
// 这里更换成调用公共服务接口
|
|
|
- Integer count = ProductUtils.coverToUserProd(ids, SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU());
|
|
|
+ List<Long> idList = JSON.parseArray(ids, Long.class);
|
|
|
+ Integer count = ProductUtils.coverToUserProd(idList, SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU());
|
|
|
logger.log("我的产品库", "新增了我产品信息", "size:" + count);
|
|
|
return new ModelMap("count", count);
|
|
|
}
|
|
|
@@ -346,14 +348,14 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
product.setIsSale(Constant.YES);
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.updateOne(product);
|
|
|
- productDao.save(product);
|
|
|
+// productDao.save(product);
|
|
|
}
|
|
|
} else if(role.getDesc().equals("采购员")) {
|
|
|
if(product.getIsPurchase() == null || product.getIsPurchase().equals(Constant.NO)) {
|
|
|
product.setIsPurchase(Constant.YES);
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.updateOne(product);
|
|
|
- productDao.save(product);
|
|
|
+// productDao.save(product);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -364,9 +366,9 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
prod.setPrid(id);
|
|
|
prod.setDate(new Date());
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
- ProductUtils.updateProductUsersOne(prod);
|
|
|
- prod = productUsersDao.save(prod);
|
|
|
- logger.log("我的产品库", "新增了我产品信息", "id:" + prod.getId());
|
|
|
+ Long prId = ProductUtils.updateProductUsersOne(prod);
|
|
|
+// prod = productUsersDao.save(prod);
|
|
|
+ logger.log("我的产品库", "新增了我产品信息", "id:" + prId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -374,8 +376,8 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
public void deleteByBatch(List<Long> idList) throws Exception {
|
|
|
// TODO 因为这里要求数据即存即用,从公共库同步过来可能会有延迟,暂时两边都存;之后要修改为只调用公共服务方法
|
|
|
ProductUtils.deleteProductUserByBatch(idList);
|
|
|
- List<ProductUsers> prods = productUsersDao.findAll(idList);
|
|
|
- productUsersDao.delete(prods);
|
|
|
+// List<ProductUsers> prods = productUsersDao.findAll(idList);
|
|
|
+// productUsersDao.delete(prods);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -393,9 +395,12 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
ProductUsers productUsers = productUsersDao.findByEnuuAndUseruuAndPrid(enuu, useruu, productId);
|
|
|
if (null == productUsers) {
|
|
|
try {
|
|
|
- ProductUtils.coverToUserProd(String.valueOf(productId), enuu, useruu);
|
|
|
+ List<Long> idList = new ArrayList<>();
|
|
|
+ idList.add(productId);
|
|
|
+ ProductUtils.coverToUserProd(idList, enuu, useruu);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
+ logger.log("我的产品库", method + ":" + productId + "转入失败", useruu, null);
|
|
|
}
|
|
|
}
|
|
|
}
|