|
|
@@ -5,7 +5,6 @@ import com.uas.platform.b2b.core.util.DateUtils;
|
|
|
import com.uas.platform.b2b.core.util.StringUtil;
|
|
|
import com.uas.platform.b2b.core.util.ThreadUtils;
|
|
|
import com.uas.platform.b2b.dao.ProductDao;
|
|
|
-import com.uas.platform.b2b.dao.ProductStatusDao;
|
|
|
import com.uas.platform.b2b.dao.ProductTempDao;
|
|
|
import com.uas.platform.b2b.dao.ProductUsersDao;
|
|
|
import com.uas.platform.b2b.model.Product;
|
|
|
@@ -61,9 +60,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
@Autowired
|
|
|
private RoleService roleService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ProductStatusDao productStatusDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ProductTempDao productTempDao;
|
|
|
|
|
|
@@ -114,12 +110,11 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
prod.setPrid(productList.get(0).getId());
|
|
|
prod.setUseruu(useruu);
|
|
|
ProductUtils.updateProductUsersOne(prod);
|
|
|
-// productUsersDao.save(prod);
|
|
|
logger.log("个人产品库增加产品", "关联:" + productList.get(0).getId());
|
|
|
map.put("success", "新增成功");
|
|
|
} else {// 不存在的话新增再绑定
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("mmsssss");
|
|
|
- if(null == prodInfo.getCode()) {
|
|
|
+ if (null == prodInfo.getCode()) {
|
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
|
prodInfo.setCode(code);
|
|
|
} else {
|
|
|
@@ -130,11 +125,11 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
|
|
|
}
|
|
|
List<Role> roles = roleService.findByEnUUAndUserUU(enuu, useruu);
|
|
|
- if(!CollectionUtils.isEmpty(roles)) {
|
|
|
- for(Role role : roles) {
|
|
|
- if(role.getDesc().equals("业务员") || role.getDesc().equals("销售经理")) {
|
|
|
+ if (!CollectionUtils.isEmpty(roles)) {
|
|
|
+ for (Role role : roles) {
|
|
|
+ if (role.getDesc().equals("业务员") || role.getDesc().equals("销售经理")) {
|
|
|
prodInfo.setIsSale(Constant.YES);
|
|
|
- } else if(role.getDesc().equals("采购员")) {
|
|
|
+ } else if (role.getDesc().equals("采购员")) {
|
|
|
prodInfo.setIsPurchase(Constant.YES);
|
|
|
}
|
|
|
}
|
|
|
@@ -167,7 +162,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
@Override
|
|
|
public void deleteById(Long id) throws Exception {
|
|
|
ProductUtils.deleteProductUser(id);
|
|
|
-// productUsersDao.delete(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -185,16 +179,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
int total = 0;
|
|
|
short isSale = Constant.YES;
|
|
|
short isPurchase = Constant.NO;
|
|
|
-// List<Role> roles = roleService.findByEnUUAndUserUU(enUU, userUU);
|
|
|
-// if(!CollectionUtils.isEmpty(roles)) {
|
|
|
-// for(Role role : roles) {
|
|
|
-// if(role.getDesc().equals("业务员") || role.getDesc().equals("销售经理")) {
|
|
|
-// isSale = Constant.YES;
|
|
|
-// } else if(role.getDesc().equals("采购员")) {
|
|
|
-// isPurchase = Constant.YES;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
String importId = StringUtil.getRandomNumber(8);
|
|
|
if (headerRow != null) {
|
|
|
for (int r = 3; r <= rowNum; r++) {
|
|
|
@@ -326,7 +310,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
checkTempProducts(temps, modelMap);
|
|
|
// 保存到公共库
|
|
|
saveToDataCenter(temps, modelMap);
|
|
|
- System.out.println("总耗时:" + (System.currentTimeMillis() - start));
|
|
|
}
|
|
|
return modelMap;
|
|
|
}
|
|
|
@@ -337,7 +320,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
* @param temps
|
|
|
*/
|
|
|
private void checkTempProducts(List<ProductTemp> temps, ModelMap modelMap) {
|
|
|
- long start = System.currentTimeMillis();
|
|
|
if (!CollectionUtils.isEmpty(temps)) {
|
|
|
String importId = temps.get(0).getPr_import_id();
|
|
|
// 放入数据库
|
|
|
@@ -356,7 +338,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
if (!CollectionUtils.isEmpty(userExisted)) {
|
|
|
modelMap.put("alters", userExisted);
|
|
|
}
|
|
|
- System.out.println("校验:" + (System.currentTimeMillis() - start));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -369,28 +350,15 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
String importId = temps.get(0).getPr_import_id();
|
|
|
// 已匹配+未匹配到的物料
|
|
|
List<Product> products = productTempDao.getProducts(importId);
|
|
|
- System.out.println("取匹配后结果:" + (System.currentTimeMillis() - start));
|
|
|
start = System.currentTimeMillis();
|
|
|
try {
|
|
|
// 更新物料并插入个人物料
|
|
|
ModelMap map = ProductUtils.paginationUpdateAndAddToProductUser(products);
|
|
|
- System.out.println("更新物料:" + (System.currentTimeMillis() - start));
|
|
|
if ("true".equals(map.get("success"))) {
|
|
|
modelMap.put("success", null != map.get("result") ? map.get("result") : 0);
|
|
|
} else {
|
|
|
modelMap.put("error", "物料添加失败(" + null != map.get("message") ? map.get("message") : "" + ")");
|
|
|
}
|
|
|
-// start = System.currentTimeMillis();
|
|
|
-// if (!CollectionUtils.isEmpty(idList)) {
|
|
|
-// // 更新个人物料
|
|
|
-// List<ProductUsers> productUsersList = productTempDao.getNotMatchedProductUsers(importId,
|
|
|
-// temps.get(0).getPr_enuu(), temps.get(0).getPr_useruu(), idList);
|
|
|
-// if (!CollectionUtils.isEmpty(productUsersList)) {
|
|
|
-// ProductUtils.updateProductUsersByBatch(productUsersList);
|
|
|
-// modelMap.put("success", productUsersList.size());
|
|
|
-// System.out.println("更新个人物料:" + (System.currentTimeMillis() - start));
|
|
|
-// }
|
|
|
-// }
|
|
|
} catch (Exception e) {
|
|
|
modelMap.put("error", "物料添加失败(" + e.getMessage() + ")");
|
|
|
}
|
|
|
@@ -399,9 +367,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
|
|
|
@Override
|
|
|
public ModelMap coverToUserProd(String ids) throws Exception {
|
|
|
-// ids.replace("["," ");
|
|
|
-// ids.replace("]"," ");
|
|
|
-// Integer count = productUsersDao.coverToUserProd(ids, SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu());
|
|
|
// 这里更换成调用公共服务接口
|
|
|
List<Long> idList = JSON.parseArray(ids, Long.class);
|
|
|
Integer count = ProductUtils.coverToUserProd(idList, SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU());
|
|
|
@@ -439,7 +404,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
prod.setPrid(id);
|
|
|
prod.setDate(new Date());
|
|
|
ProductUtils.updateProductUsersOne(prod);
|
|
|
-// prod = productUsersDao.save(prod);
|
|
|
logger.log("我的产品库", "新增了我产品信息", "物料id:" + id);
|
|
|
}
|
|
|
}
|
|
|
@@ -451,8 +415,6 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("访问接口方法异常");
|
|
|
}
|
|
|
-// List<ProductUsers> prods = productUsersDao.findAll(idList);
|
|
|
-// productUsersDao.delete(prods);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -461,12 +423,11 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
* @param productId
|
|
|
*/
|
|
|
public void coverToMyProduct(final Long productId, final Long enuu, final Long useruu, final String method) {
|
|
|
- logger.log("我的产品库", method + ":" + productId);
|
|
|
+ logger.log(useruu, enuu,"我的产品库", "更新我的物料库", method + ":" + productId);
|
|
|
ThreadUtils.task(new Runnable() {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
-// productUsersDao.coverToUserByPrid(productId, enuu, useruu);
|
|
|
ProductUsers productUsers = productUsersDao.findByEnuuAndUseruuAndPrid(enuu, useruu, productId);
|
|
|
if (null == productUsers) {
|
|
|
try {
|