| | |
| | | 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();
|
| | | if (name == null || name.trim().length() == 0)
|
| | | if (StringUtil.isNullOrEmpty(name))
|
| | | throw new BrandInfoException(1, "名称不能为空");
|
| | |
|
| | | String searchKey = record.getSearchKey();
|
| | | if (StringUtil.isNullOrEmpty(searchKey))
|
| | | record.setSearchKey(name);
|
| | | |
| | | Integer state = record.getState();
|
| | | if (state == null)
|
| | | record.setState(0);
|
| | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | record.setUpdateTime(new Date());
|
| | | brandInfoMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | if (state == 1) {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | int goodsTotal = brandGoodsCaheService.addBrandGoods(record);
|
| | | record.setGoodsTotal(goodsTotal);
|
| | | brandInfoMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | |
|
| | | for (BrandInfo brandInfo : list) {
|
| | | String key = brandInfo.getName();
|
| | | if (StringUtil.isNullOrEmpty(key))
|
| | | String name = brandInfo.getName();
|
| | | String searchKey = brandInfo.getSearchKey();
|
| | | if (StringUtil.isNullOrEmpty(name) && StringUtil.isNullOrEmpty(searchKey))
|
| | | continue;
|
| | |
|
| | | // 添加商品
|