company_admin/src/components/business/OperaCategoryWindow.vue
@@ -225,6 +225,12 @@ // 调用新建接口 this.isWorking = true if (!this.form.id) { let arr = [] this.form.budgetList.forEach(item => { if (item.maxamount || item.minamount) { arr.push(item) } }) companyCreate({ paramList: this.form.tableData, type: this.form.type, @@ -232,7 +238,7 @@ platCateId: this.form.platCateId, name: this.form.name, imgurl: this.form.imgurl, budgetList: this.form.budgetList budgetList: arr }) .then(() => { this.visible = false @@ -246,6 +252,12 @@ this.isWorking = false }) } else { let arr = [] this.form.budgetList.forEach(item => { if (item.maxamount || item.minamount) { arr.push(item) } }) companyUpdateById({ id: this.form.id, paramList: this.form.tableData, @@ -254,7 +266,7 @@ platCateId: this.form.platCateId, name: this.form.name, imgurl: this.form.imgurl, budgetList: this.form.budgetList budgetList: arr }) .then(() => { this.visible = false company_admin/src/utils/request.js
@@ -3,6 +3,7 @@ import pkg from '../../package' import { trim } from './util' import cache from '../plugins/cache' import { Message } from 'element-ui' axios.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8' const axiosInstance = axios.create({ @@ -40,6 +41,7 @@ // 新建响应拦截器 axiosInstance.interceptors.response.use((response) => { console.log(response.status) // 请求失败 if (response.status !== 200) { return Promise.reject(new Error('服务器繁忙,请稍后再试')) company_admin/src/views/business/goods.vue
@@ -286,7 +286,9 @@ }).then(res => { this.$tip.apiSuccess('更新成功') }).finally(() => { // this.search() this.search() }).catch(err => { this.$message.warning({ message: err.message }) }) }, turnNum (nums) { server/company/src/main/java/com/doumee/api/business/CategoryController.java
@@ -100,7 +100,6 @@ @RequiresPermissions("business:category:update") public ApiResponse companyUpdateById(@RequestBody Category category) { categoryService.companyUpdateById(category); cateParamSelectService.dealCateParamSelect(); return ApiResponse.success(null); } server/company/src/main/java/com/doumee/config/shiro/ShiroRealm.java
@@ -100,7 +100,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业信息已被禁用,如有疑问请联系系统管理员!"); } if(DateUtil.compareDate(new Date(),DateUtil.addDaysToDate(company.getOepnValidDate(),1))<=Constants.ZERO){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业信息已过期,如有疑问请联系系统管理员!"); throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业账号已过期,如需继续使用,请联系您的业务经理"); } user.setCompany(company); } server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java
@@ -114,7 +114,7 @@ queryUserDto.setDeleted(Boolean.FALSE); SystemUser user = systemUserService.findOne(queryUserDto); if (user != null) { throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); } // 验证工号 if (StringUtils.isNotBlank(systemUser.getEmpNo())) { @@ -175,7 +175,7 @@ queryUserDto.setDeleted(Boolean.FALSE); user = systemUserService.findOne(queryUserDto); if (user != null && !user.getId().equals(systemUser.getId())) { throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); } } @@ -250,7 +250,7 @@ queryUserDto.setDeleted(Boolean.FALSE); SystemUser user = systemUserService.findOne(queryUserDto); if (user != null) { throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); } if(createCompanyUserDTO.getType().equals(Constants.UserType.ZHUBO.getKey())){ Company company = companyService.findById(loginUserInfo.getCompanyId()); @@ -258,8 +258,10 @@ zbUserNum.setCompanyId(loginUserInfo.getCompanyId()); zbUserNum.setDeleted(Boolean.FALSE); zbUserNum.setType(Constants.UserType.ZHUBO.getKey()); if(systemUserService.findList(zbUserNum).size()>=company.getUserNum()){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,已超出企业可分配主播数量,如有疑问请联系系统管理员!"); if(!Objects.isNull(company.getUserNum())&&company.getUserNum()!=Constants.ZERO){ if(systemUserService.findList(zbUserNum).size()>=company.getUserNum()){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,已超出企业可分配主播数量,如有疑问请联系系统管理员!"); } } } SystemUser systemUser = new SystemUser(); server/service/src/main/java/com/doumee/service/business/impl/BaseGoodsServiceImpl.java
@@ -399,7 +399,7 @@ .eq(pageWrap.getModel().getCategoryId()!=null,BaseGoods::getCategoryId, pageWrap.getModel().getCategoryId()) .eq(pageWrap.getModel().getBrandId()!=null,BaseGoods::getBrandId, pageWrap.getModel().getBrandId()) .eq(pageWrap.getModel().getStatus()!=null,BaseGoods::getStatus, pageWrap.getModel().getStatus()) .notExists(user.getType().equals(Constants.UserType.COMPANY.getKey())," select 1 from goods g where g.GOODS_ID = t.id and g.TYPE = 1 and g.company_id = "+user.getCompanyId()+" "); .notExists(user.getType().equals(Constants.UserType.COMPANY.getKey())," select 1 from goods g where g.GOODS_ID = t.id and g.TYPE = 1 and g.ISDELETED = 0 and g.company_id = "+user.getCompanyId()+" "); queryWrapper.orderByDesc(Goods::getId); PageData<BaseGoods> pageData =PageData.from(baseGoodsJoinMapper.selectJoinPage(page,BaseGoods.class,queryWrapper)); String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java
@@ -153,6 +153,7 @@ QueryWrapper<Brand> wrapper = new QueryWrapper<>(brand); wrapper.lambda().eq(Brand::getIsdeleted,Constants.ZERO); // wrapper.lambda().eq(Brand::getStatus,Constants.ZERO); wrapper.lambda().orderByAsc(Brand::getType); wrapper.lambda().orderByAsc(Brand::getSortnum); // 类型 0企业 1平台 if (Constants.equalsInteger(user.getType(), Constants.UserType.SYSTEM.getKey())) { server/service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -227,8 +227,8 @@ } } this.dealCateAttr(category.getAttrFirstList(),Constants.ZERO,category.getId(),user); this.dealCateAttr(category.getAttrSecondList(),Constants.ONE,category.getId(),user); // this.dealCateAttr(category.getAttrFirstList(),Constants.ZERO,category.getId(),user); // this.dealCateAttr(category.getAttrSecondList(),Constants.ONE,category.getId(),user); // cateAttrMapper.delete(new QueryWrapper<CateAttr>().eq("CATEGORY_ID",category.getId())); // List<CateAttr> attrFirst = category.getAttrFirstList(); // if(!Objects.isNull(attrFirst)&&attrFirst.size()> Constants.ZERO){ @@ -292,20 +292,7 @@ category.setShortPinyin(PinYinUtil.getFirstSpell(category.getName())); categoryMapper.updateById(category); //处理属性配置 cateParamMapper.delete(new QueryWrapper<CateParam>().eq("CATEGORY_ID",category.getId())); List<CateParam> paramList = category.getParamList(); if(!Objects.isNull(paramList)&¶mList.size()> Constants.ZERO){ for (int i = 0; i < paramList.size(); i++) { CateParam cateParam = paramList.get(i); cateParam.setCreator(user.getId()); cateParam.setCreateDate(new Date()); cateParam.setIsdeleted(Constants.ZERO); cateParam.setSortnum(i+Constants.ONE); cateParam.setStatus(Constants.ZERO); cateParam.setCategoryId(category.getId()); cateParamMapper.insert(cateParam); } } this.dealCateParam(category.getParamList(),category.getId(),user); cateBudgetMapper.delete(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",category.getId())); List<CateBudget> budgetList = category.getBudgetList(); if(!Objects.isNull(budgetList)&&budgetList.size()> Constants.ZERO){ @@ -323,60 +310,54 @@ } public void dealCateAttr(List<CateAttr> cateAttrList,Integer type,Integer categoryId,LoginUserInfo user){ List<CateAttr> oldCateAttrList = cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId).eq("TYPE",type)); List<CateAttr> addCateAttr = new ArrayList<>(); List<CateAttr> updCateAttr = new ArrayList<>(); List<CateAttr> delCateAttr = new ArrayList<>(); for (CateAttr oldCateAttr:oldCateAttrList) { public void dealCateParam(List<CateParam> cateParamList,Integer categoryId,LoginUserInfo userInfo ){ List<CateParam> oldCateParamList = cateParamMapper.selectList(new QueryWrapper<CateParam>() .eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId)); List<CateParam> updCateParam = new ArrayList<>(); List<CateParam> delCateParam = new ArrayList<>(); for (CateParam oldCateParam:oldCateParamList) { Boolean flag = false; for (CateAttr cateAttr:cateAttrList) { if(oldCateAttr.getName().equals(cateAttr.getName())){ updCateAttr.add(oldCateAttr); for (CateParam cateParam:cateParamList) { if(oldCateParam.getId().equals(cateParam.getId())){ updCateParam.add(cateParam); flag = true; break; } } if(!flag){ delCateAttr.add(oldCateAttr); delCateParam.add(oldCateParam); } } CateAttr maxCateAttr = cateAttrMapper.selectOne(new QueryWrapper<CateAttr>().eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",categoryId).eq("TYPE",type).orderByDesc(" SORTNUM ").last(" limit 1 ")); CateParam maxCateParam = cateParamMapper.selectOne(new QueryWrapper<CateParam>().eq("ISDELETED",Constants.ZERO) .eq("CATEGORY_ID",categoryId).orderByDesc(" SORTNUM ").last(" limit 1 ")); Integer nextSortNum = 0; if(!Objects.isNull(maxCateAttr)){ nextSortNum = maxCateAttr.getSortnum(); if(!Objects.isNull(maxCateParam)){ nextSortNum = maxCateParam.getSortnum(); } //处理新增数据 for (CateAttr cateAttr:cateAttrList) { Boolean flag = false; for (CateAttr oldCateAttr:oldCateAttrList) { if(cateAttr.getName().equals(oldCateAttr.getName())){ flag = true; break; } } if(!flag){ nextSortNum = nextSortNum + 1; cateAttr.setCreator(user.getId()); cateAttr.setCreateDate(new Date()); cateAttr.setIsdeleted(Constants.ZERO); cateAttr.setSortnum(nextSortNum); cateAttr.setStatus(Constants.ZERO); cateAttr.setCategoryId(categoryId); cateAttr.setType(type); addCateAttr.add(cateAttr); for (CateParam cateParam:cateParamList) { if(Objects.isNull(cateParam.getId())){ nextSortNum ++ ; cateParam.setCreator(userInfo.getId()); cateParam.setCreateDate(new Date()); cateParam.setIsdeleted(Constants.ZERO); cateParam.setSortnum(nextSortNum); cateParam.setStatus(Constants.ZERO); cateParam.setCategoryId(categoryId); cateParamMapper.insert(cateParam); } } addCateAttr.forEach(i->{ cateAttrMapper.insert(i); delCateParam.forEach(i->{ cateParamMapper.deleteById(i.getId()); }); delCateAttr.forEach(i->{ i.setIsdeleted(Constants.ONE); updCateParam.forEach(i->{ i.setEditDate(new Date()); i.setEditor(user.getId()); cateAttrMapper.updateById(i); i.setEditor(userInfo.getId()); cateParamMapper.updateById(i); }); } @Override public void updateDisableById(Category category) { @@ -451,9 +432,8 @@ + systemDictDataBiz.queryByCode(Constants.OSS, Constants.CATEGORY_IMG).getCode(); for (Category c:list) { c.setPrefixUrl(prefixUrl); // c.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); // c.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("CATEGORY_ID",c.getId()) .orderByAsc(" SORTNUM "))); this.getParamSelect(c); } return list; @@ -465,6 +445,7 @@ .eq("CATEGORY_ID",category.getId()) .eq("ISSELECT",Constants.ONE) .eq("ISDELETED",Constants.ZERO) .eq("ISSHOW",Constants.ONE) .orderByAsc(" SORTNUM ") .last(" limit 2 ") ); @@ -504,8 +485,12 @@ c.setAttrFirstList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ZERO).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); c.setAttrSecondList(cateAttrMapper.selectList(new QueryWrapper<CateAttr>().eq("TYPE",Constants.ONE).eq("ISDELETED",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); c.setParamList(cateParamMapper.selectList(new QueryWrapper<CateParam>() .select(" * , ( select gp.VAL from goods_param gp where gp.GOODS_ID = "+goodsId+" and gp.PRAMA_ID = cate_param.id limit 1 ) as val ") .eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); .select(" * , ( select gp.VAL from goods_param gp where gp.GOODS_ID = "+goodsId+" and gp.PRAMA_ID = cate_param.id limit 1 ) as val ") .eq("CATEGORY_ID",c.getId()) .eq("ISSHOW",Constants.ONE) .eq("STATUS",Constants.ZERO) .eq("ISDELETED",Constants.ZERO) .orderByAsc(" SORTNUM "))); } return list; } server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -229,6 +229,7 @@ Goods goods = new Goods(); goods.setIsdeleted(Constants.ZERO); goods.setGoodsId(model.getId()); goods.setCompanyId(user.getCompanyId()); if(goodsMapper.selectCount(new QueryWrapper<>(goods))>0){ //如果已经同步过,跳过此次同步 return null; @@ -284,16 +285,16 @@ if(Constants.equalsInteger(Constants.ONE, param.getType())){ for(PlatGoodsParam p: param.getGoodsParamList()){ if(Constants.equalsInteger(model.getId(),p.getGoodsId())){ return p.getPrice(); return p.getPrice().setScale(0,BigDecimal.ROUND_CEILING); } } } //如果没有配置入手价,安装加价系数来计算 if(model.getCateRatePrice()==null){ model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate()); } //返回 return Constants.formatBigdecimal(model.getPrice()).multiply(model.getCateRatePrice()).multiply(param.getRate()); // if(model.getCateRatePrice()==null){ // model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate()); // } //返回 .multiply(model.getCateRatePrice()) return (Constants.formatBigdecimal(model.getPrice()).multiply(param.getRate())).setScale(0,BigDecimal.ROUND_CEILING); } @@ -329,6 +330,7 @@ multifile.setObjId(goods.getId()); multifile.setType(Constants.ZERO); multifile.setObjType(Constants.ZERO); multifile.setCompanyId(goods.getCompanyId()); multifileMapper.insert(multifile); } } @@ -343,20 +345,6 @@ goodsParam.setSortnum(i+Constants.ONE); goodsParam.setGoodsId(goods.getId()); goodsParamMapper.insert(goodsParam); //存储 cate_param_select 查询是否已存在 // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ // CateParamSelect cateParamSelect = new CateParamSelect(); // cateParamSelect.setCreator(user.getId()); // cateParamSelect.setCreateDate(new Date()); // cateParamSelect.setName(goodsParam.getVal()); // cateParamSelect.setIsdeleted(Constants.ZERO); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelect.setParamId(goodsParam.getPramaId()); // cateParamSelect.setCategoryId(goods.getCategoryId()); // cateParamSelect.setStatus(Constants.ZERO); // cateParamSelectMapper.insert(cateParamSelect); // }; } } return goods.getId(); @@ -441,7 +429,8 @@ }else{ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前登录用户类别错误,无法进行该操作"); } if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("COMPANY_ID",user.getCompanyId()).eq("ISDELETED",Constants.ZERO).ne("id",goods.getId()).eq("name",goods.getName()))>0){ if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("COMPANY_ID",user.getCompanyId()) .eq("ISDELETED",Constants.ZERO).ne("id",goods.getId()).eq("name",goods.getName()))>0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+goods.getName()+"】已存在"); }; goods.setStatus(Constants.ZERO); @@ -465,6 +454,7 @@ multifile.setSortnum(i+Constants.ONE); multifile.setObjId(goods.getId()); multifile.setType(Constants.ZERO); multifile.setCompanyId(goods.getCompanyId()); multifile.setObjType(Constants.ZERO); multifileMapper.insert(multifile); } @@ -519,7 +509,7 @@ throw new BusinessException(ResponseStatus.DATA_EMPTY); } //拉式商品 且 上架时,需要限制 平台商品是否已下架 if(dbGoods.getType().equals(Constants.goodsType.PULL)&&goods.getStatus().equals(Constants.ZERO)){ if(dbGoods.getType().equals(Constants.goodsType.PULL.getValue())&&goods.getStatus().equals(Constants.ZERO)){ BaseGoods baseGoods = baseGoodsMapper.selectById(dbGoods.getGoodsId()); if(Objects.isNull(baseGoods)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到平台商品信息"); @@ -557,7 +547,7 @@ continue; } //拉式商品 且 上架时,需要限制 平台商品是否已下架 if(dbGoods.getType().equals(Constants.goodsType.PULL)&&batchDisableDTO.getStatus().equals(Constants.ZERO)){ if(dbGoods.getType().equals(Constants.goodsType.PULL.getValue())&&batchDisableDTO.getStatus().equals(Constants.ZERO)){ BaseGoods baseGoods = baseGoodsMapper.selectById(dbGoods.getGoodsId()); if(Objects.isNull(baseGoods)||!baseGoods.getStatus().equals(Constants.ZERO)){ errNum++; @@ -1075,7 +1065,9 @@ goodsIPage.getRecords().forEach(i->{ i.setPrefixUrl(prefixUrl); i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>().eq("GOODS_ID",i.getId()).orderByAsc(" SORTNUM "))); i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>() .eq("GOODS_ID",i.getId()) .orderByAsc(" SORTNUM "))); }); return PageData.from(goodsIPage); } @@ -1117,7 +1109,10 @@ goodsList.forEach(i->{ i.setPrefixUrl(prefixUrl); i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>().eq("GOODS_ID",i.getId()).orderByAsc(" SORTNUM "))); i.setGoodsParamList(goodsParamMapper.selectList( new QueryWrapper<GoodsParam>().eq("GOODS_ID",i.getId()) .apply(" name in ( select cp.NAME from cate_param cp where cp.CATEGORY_ID = "+i.getCategoryId()+" and cp.ISSHOW = 1 and cp.ISDELETED = 0 and cp.STATUS = 0 ) ") .orderByAsc(" SORTNUM "))); }); return goodsList; } server/service/src/main/java/com/doumee/service/impl/CateParamSelectServiceImpl.java
@@ -168,7 +168,7 @@ //新增当前企业可以使用的数据 cateParamSelectMapper.insertBatch(loginUserInfo.getCompanyId(),loginUserInfo.getId()); }catch (Exception e){ e.printStackTrace(); }finally { redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,false); }