| | |
| | | @Override |
| | | public Integer create(BaseGoodsCreateOrUpdateRequest baseGoods) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>().eq("ISDELETED", Constants.ZERO).eq("name",baseGoods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | } |
| | | // if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>().eq("ISDELETED", Constants.ZERO).eq("name",baseGoods.getName()))>0){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | // } |
| | | |
| | | Integer integer = baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>().eq("ISDELETED", Constants.ZERO)); |
| | | BaseGoods insert = new BaseGoods(); |
| | |
| | | public void update(BaseGoodsCreateOrUpdateRequest baseGoods) { |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>() |
| | | .eq("ISDELETED",Constants.ZERO).ne("id",baseGoods.getId()) |
| | | .eq("name",baseGoods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | } |
| | | // if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>() |
| | | // .eq("ISDELETED",Constants.ZERO).ne("id",baseGoods.getId()) |
| | | // .eq("name",baseGoods.getName()))>0){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | // } |
| | | |
| | | UpdateWrapper<BaseGoods> wrapper = new UpdateWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入数据为空!"); |
| | | } |
| | | //处理批量上传 |
| | | String proDir =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PLATFORM).getCode(); |
| | | String proDir =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROJECTS).getCode(); |
| | | String platformDir =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PLATFORM).getCode(); |
| | | String basePath = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.GOODS_IMG_DIR).getCode() |
| | | + proDir + File.separator ; |
| | | + proDir + platformDir ; |
| | | OssModel ossModel = baseDataService.initOssModel(); |
| | | for (int index = 0; index < dataList.size(); index++) { |
| | | BaseGoodsImportDTO s = dataList.get(index); |
| | |
| | | brandQuery.lambda() |
| | | .eq(Brand::getIsdeleted,Constants.ZERO); |
| | | brandQuery.lambda() |
| | | .eq(Brand::getType,Constants.ZERO); |
| | | .eq(Brand::getType,Constants.ONE); |
| | | Brand brand = brandMapper.selectOne(brandQuery.last("limit 1")); |
| | | |
| | | if (Objects.isNull(brand)){ |
| | |
| | | File[] files = dir.listFiles(); |
| | | if(files!=null && files.length>0){ |
| | | for(File f:files){ |
| | | if(StringUtils.isBlank(baseCategory.getImgurl()) && isImgFile(f)){ |
| | | if(isImgFile(f)){ |
| | | //取第一张图片作为列表图 |
| | | baseGoods.setImgurl(baseDataService.getOssImgurl(ossModel,ossModel.getGoodsFolder(),f)); |
| | | } |
| | |
| | | for(int i=0;i<mulFiles.size();i++){ |
| | | String str = mulFiles.get(i); |
| | | Multifile f = new Multifile(); |
| | | f.setObjType(Constants.ZERO); |
| | | f.setObjType(Constants.ONE); |
| | | f.setName(str); |
| | | f.setType(Constants.ZERO); |
| | | f.setObjId(baseGoods.getId()); |