|
@@ -98,12 +98,15 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
Long useruu = SystemSession.getUser().getUserUU();
|
|
Long useruu = SystemSession.getUser().getUserUU();
|
|
|
List<ProductUsers> productUsers = productUsersDao.findByEnuuAndUseruuAndTitleAndCmpCodeAndBrand(enuu, useruu, prodInfo.getTitle(), prodInfo.getCmpCode(), prodInfo.getBrand());
|
|
List<ProductUsers> productUsers = productUsersDao.findByEnuuAndUseruuAndTitleAndCmpCodeAndBrand(enuu, useruu, prodInfo.getTitle(), prodInfo.getCmpCode(), prodInfo.getBrand());
|
|
|
- if(CollectionUtils.isEmpty(productUsers)) {// 如果不存在则进行其他操作,存在不处理(先查询非标)
|
|
|
|
|
|
|
+ // 如果不存在则进行其他操作,存在不处理(先查询非标)
|
|
|
|
|
+ if (CollectionUtils.isEmpty(productUsers)) {
|
|
|
List<Product> productList = productDao.findByTitleAndCmpCodeAndBrandAndEnUU(prodInfo.getTitle(), prodInfo.getCmpCode(), prodInfo.getBrand(), SystemSession.getUser().getEnterprise().getUu());
|
|
List<Product> productList = productDao.findByTitleAndCmpCodeAndBrandAndEnUU(prodInfo.getTitle(), prodInfo.getCmpCode(), prodInfo.getBrand(), SystemSession.getUser().getEnterprise().getUu());
|
|
|
- if(CollectionUtils.isEmpty(productList)) {// 如果非标不存在再查询标准
|
|
|
|
|
|
|
+ // 如果非标不存在再查询标准
|
|
|
|
|
+ if (CollectionUtils.isEmpty(productList)) {
|
|
|
productList = productDao.findByTitleAndPcmpcodeAndPbrandAndEnUU(prodInfo.getTitle(), prodInfo.getCmpCode(), prodInfo.getBrand(), SystemSession.getUser().getEnterprise().getUu());
|
|
productList = productDao.findByTitleAndPcmpcodeAndPbrandAndEnUU(prodInfo.getTitle(), prodInfo.getCmpCode(), prodInfo.getBrand(), SystemSession.getUser().getEnterprise().getUu());
|
|
|
}
|
|
}
|
|
|
- if(!CollectionUtils.isEmpty(productList)) { // 如果存在,找出其中一个进行绑定
|
|
|
|
|
|
|
+ // 如果存在,找出其中一个进行绑定
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(productList)) {
|
|
|
ProductUsers prod = new ProductUsers();
|
|
ProductUsers prod = new ProductUsers();
|
|
|
prod.setDate(new Date());
|
|
prod.setDate(new Date());
|
|
|
prod.setEnuu(enuu);
|
|
prod.setEnuu(enuu);
|
|
@@ -118,10 +121,12 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
|
prodInfo.setCode(code);
|
|
prodInfo.setCode(code);
|
|
|
} else {
|
|
} else {
|
|
|
- List<Product> products = productDao.findByEnUUAndCode(enuu, prodInfo.getCode());
|
|
|
|
|
|
|
+ List<Product> products = ProductUtils.findByEnUUAndCode(enuu, prodInfo.getCode());
|
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
|
- if(products.size() != 0) // 如果该企业下该编号的物料存在,重新赋值
|
|
|
|
|
|
|
+ // 如果该企业下该编号的物料存在,重新赋值
|
|
|
|
|
+ if (products.size() != 0) {
|
|
|
prodInfo.setCode(code);
|
|
prodInfo.setCode(code);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
List<Role> roles = roleService.findByEnUUAndUserUU(enuu, useruu);
|
|
List<Role> roles = roleService.findByEnUUAndUserUU(enuu, useruu);
|
|
@@ -135,8 +140,9 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
prodInfo.setEnUU(enuu);
|
|
prodInfo.setEnUU(enuu);
|
|
|
- if (null == prodInfo.getUnit())
|
|
|
|
|
|
|
+ if (null == prodInfo.getUnit()) {
|
|
|
prodInfo.setUnit("PCS");
|
|
prodInfo.setUnit("PCS");
|
|
|
|
|
+ }
|
|
|
prodInfo.setSourceApp("B2B");
|
|
prodInfo.setSourceApp("B2B");
|
|
|
prodInfo.setIsPubsale(Constant.NO);
|
|
prodInfo.setIsPubsale(Constant.NO);
|
|
|
prodInfo.setIsShow(Constant.NO);
|
|
prodInfo.setIsShow(Constant.NO);
|
|
@@ -166,7 +172,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ModelMap releaseByWorkbook(Workbook workbook) {
|
|
public ModelMap releaseByWorkbook(Workbook workbook) {
|
|
|
- long start = System.currentTimeMillis();
|
|
|
|
|
ModelMap modelMap = new ModelMap();
|
|
ModelMap modelMap = new ModelMap();
|
|
|
List<ProductTemp> temps = new ArrayList<>();
|
|
List<ProductTemp> temps = new ArrayList<>();
|
|
|
Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
@@ -317,7 +322,8 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
/**
|
|
/**
|
|
|
* 将物料信息同步到个人信息库
|
|
* 将物料信息同步到个人信息库
|
|
|
*
|
|
*
|
|
|
- * @param productId
|
|
|
|
|
|
|
+ * @param temps 临时物料
|
|
|
|
|
+ * @param modelMap
|
|
|
*/
|
|
*/
|
|
|
private void checkTempProducts(List<ProductTemp> temps, ModelMap modelMap) {
|
|
private void checkTempProducts(List<ProductTemp> temps, ModelMap modelMap) {
|
|
|
if (!CollectionUtils.isEmpty(temps)) {
|
|
if (!CollectionUtils.isEmpty(temps)) {
|
|
@@ -345,12 +351,10 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
* 保存到公共库
|
|
* 保存到公共库
|
|
|
*/
|
|
*/
|
|
|
private void saveToDataCenter(List<ProductTemp> temps, ModelMap modelMap){
|
|
private void saveToDataCenter(List<ProductTemp> temps, ModelMap modelMap){
|
|
|
- long start = System.currentTimeMillis();
|
|
|
|
|
if (!CollectionUtils.isEmpty(temps)) {
|
|
if (!CollectionUtils.isEmpty(temps)) {
|
|
|
String importId = temps.get(0).getPr_import_id();
|
|
String importId = temps.get(0).getPr_import_id();
|
|
|
// 已匹配+未匹配到的物料
|
|
// 已匹配+未匹配到的物料
|
|
|
List<Product> products = productTempDao.getProducts(importId);
|
|
List<Product> products = productTempDao.getProducts(importId);
|
|
|
- start = System.currentTimeMillis();
|
|
|
|
|
try {
|
|
try {
|
|
|
// 更新物料并插入个人物料
|
|
// 更新物料并插入个人物料
|
|
|
ModelMap map = ProductUtils.paginationUpdateAndAddToProductUser(products);
|
|
ModelMap map = ProductUtils.paginationUpdateAndAddToProductUser(products);
|
|
@@ -379,7 +383,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
Long useruu = SystemSession.getUser().getUserUU();
|
|
Long useruu = SystemSession.getUser().getUserUU();
|
|
|
Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
Long enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
ProductUsers productUsers = productUsersDao.findByEnuuAndUseruuAndPrid(enuu, useruu, id);
|
|
ProductUsers productUsers = productUsersDao.findByEnuuAndUseruuAndPrid(enuu, useruu, id);
|
|
|
- if(null == productUsers) {
|
|
|
|
|
|
|
+ if (null == productUsers) {
|
|
|
Product product = productDao.findOne(id);
|
|
Product product = productDao.findOne(id);
|
|
|
List<Role> roles = roleService.findByEnUUAndUserUU(enuu, useruu);
|
|
List<Role> roles = roleService.findByEnUUAndUserUU(enuu, useruu);
|
|
|
// 根据当前用户角色更新物料销售采购属性
|
|
// 根据当前用户角色更新物料销售采购属性
|
|
@@ -438,7 +442,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
Product newProduct = new Product();
|
|
Product newProduct = new Product();
|
|
|
BeanUtils.copyProperties(product, newProduct);
|
|
BeanUtils.copyProperties(product, newProduct);
|
|
|
// 将客户物料转入到本企业
|
|
// 将客户物料转入到本企业
|
|
|
- List<Product> products = productDao.findByEnUUAndCode(enuu, product.getCode());
|
|
|
|
|
|
|
+ List<Product> products = ProductUtils.findByEnUUAndCode(enuu, product.getCode());
|
|
|
if (CollectionUtils.isEmpty(products)) {
|
|
if (CollectionUtils.isEmpty(products)) {
|
|
|
newProduct.setId(null);
|
|
newProduct.setId(null);
|
|
|
newProduct.setSourceId(product.getId());
|
|
newProduct.setSourceId(product.getId());
|