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