| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
| | | @Resource
|
| | | private BrandShopCaheService brandShopCaheService;
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | | |
| | | @Override
|
| | | public void saveObject(MultipartFile file, BrandInfo record) throws BrandInfoException {
|
| | | String name = record.getName();
|
| | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | record.setUpdateTime(new Date());
|
| | | brandInfoMapper.updateByPrimaryKey(record);
|
| | | |
| | | |
| | | if (state == 0){
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | brandGoodsCaheService.removeByBrandId(id);
|
| | | brandShopCaheService.removeByBrandId(id);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | if (state == 1) {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | int goodsTotal = brandGoodsCaheService.addBrandGoods(record);
|
| | | record.setGoodsTotal(goodsTotal);
|
| | | brandInfoMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | for (Long id: list) {
|
| | | brandGoodsCaheService.removeByBrandId(id);
|
| | | brandShopCaheService.removeByBrandId(id);
|
| | | }
|
| | | }
|
| | | });
|
| | | |
| | | return brandInfoMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | |
|
| | |
| | | return brandClassShopService.countBrandShopinfo(cid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void removeAgoByDate(Date date) {
|
| | | // 删除商品
|
| | | brandGoodsCaheService.removeAgoByDate(date);
|
| | | |
| | | // 删除店铺
|
| | | brandShopCaheService.removeAgoByDate(date);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public void addShopAndGoods(long start, int count) {
|
| | | List<BrandInfo> list = brandInfoMapper.listValidAll(start, count);
|