Commit 9008190b authored by 姬鋆屾's avatar 姬鋆屾
parents 937271b3 dd030c75
......@@ -3,6 +3,8 @@ package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.module.bussinesscard.model.BussinesscardEntity;
import com.mortals.xhx.module.bussinesscard.service.BussinesscardService;
import com.mortals.xhx.module.staff.dao.StaffDao;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
......@@ -21,6 +23,8 @@ import java.util.List;
public class StaffViewsByDayInitTaskImpl implements ITaskExcuteService {
@Autowired
private StaffService staffService;
@Autowired
private BussinesscardService bussinesscardService;
@Override
public void excuteTask(ITask task) throws AppException {
......@@ -35,6 +39,17 @@ public class StaffViewsByDayInitTaskImpl implements ITaskExcuteService {
if(updateList.size()>0){
staffService.update(updateList);
}
List<BussinesscardEntity> bussinesscardList = bussinesscardService.getAllList();
List<BussinesscardEntity> updateBussinesscard = new ArrayList<>();
for (BussinesscardEntity entity:bussinesscardList){
BussinesscardEntity update = new BussinesscardEntity();
update.setId(entity.getId());
update.setViewsByDay(0);
updateBussinesscard.add(update);
}
if(updateBussinesscard.size()>0){
bussinesscardService.update(updateBussinesscard);
}
}
@Override
......
......@@ -104,12 +104,19 @@ public class BussinesscardController extends BaseCRUDJsonBodyMappingController<B
private void saveRecord(BussinesscardEntity entity, Context context){
if(entity!=null){
if(context!=null&&context.getUser()!=null){
bussinesscardRecordService.saveRecord(entity, context);
UserEntity userEntity = userService.get(context.getUser().getId());
if(userEntity!=null){
//非本人浏览时才增加浏览次数
if(!(userEntity.getStaffId()!=null && userEntity.getStaffId().longValue() ==entity.getStaffId().longValue())){
if(!(userEntity.getStaffId()!=null && userEntity.getStaffId().longValue()==entity.getStaffId().longValue())){
staffService.saveView(entity.getStaffId());
Map condition = new HashMap();
condition.put("id",entity.getId());
Map data = new HashMap();
data.put("sumViewsIncrement",1);
data.put("viewsByDayIncrement",1);
service.getDao().update(data,condition);
bussinesscardRecordService.saveRecord(entity, context);
}
}
}
......
......@@ -133,15 +133,18 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
@Override
public List<ProductEntity> getProductEntitiesByCompanyId(ProductEntity entity, List<CompanyProductEntity> companyProducList) {
List<ProductEntity> productList = companyProducList.stream().map(item -> {
List<ProductEntity> productList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(companyProducList)){
companyProducList.forEach(item->{
ProductEntity productEntity = this.getCache(item.getProductId().toString());
if (!ObjectUtils.isEmpty(productEntity)) {
productEntity.setCompanyId(entity.getCompanyId());
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(item.getId())).stream().map(i -> i.getCategoryId().toString()).collect(Collectors.joining(","));
productEntity.setCategoryId(categoryIds);
productList.add(productEntity);
}
});
}
return productEntity;
}).collect(Collectors.toList());
return productList;
}
......@@ -331,6 +334,10 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
}else {
entity.setFavoriteStatus(0);
}
String categoryIds = productCategoryService.find(new ProductCategoryQuery().productId(entity.getId())).stream().map(i -> i.getCategoryId().toString()).distinct().collect(Collectors.joining(","));
String companyIds = companyProductService.find(new CompanyProductQuery().productId(entity.getId())).stream().map(i -> i.getCompanyId().toString()).distinct().collect(Collectors.joining(","));
entity.setCompanyId(companyIds);
entity.setCategoryId(categoryIds);
}
return entity;
}
......
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