| | |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.Brand; |
| | | import com.doumee.service.business.BrandService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | return ApiResponse.success(baseCategory); |
| | | } |
| | | |
| | | @ApiOperation("å表 - SaaSH5") |
| | | @PostMapping("/saasList") |
| | | public ApiResponse<List<Category>> saasList (@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.findListSaaS(category)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import com.doumee.service.business.GoodsService; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @ApiOperation("å表 - H5") |
| | | @PostMapping("/list") |
| | | public ApiResponse<List<Goods>> findList (@RequestBody Goods goods) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | goods.setCompanyId(user.getCompanyId()); |
| | | return ApiResponse.success(goodsService.findList(goods)); |
| | | } |
| | | |
| | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.system.dto.LoginDTO; |
| | | import com.doumee.dao.system.dto.UpdatePwdDto; |
| | | import com.doumee.dao.system.dto.WebLoginDTO; |
| | | import com.doumee.service.system.SystemLoginService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | private SystemLoginService systemLoginService; |
| | | |
| | | @PreventRepeat(limit = 10, lockTime = 10000) |
| | | @ApiOperation("ç»å½") |
| | | @ApiOperation("ç»å½ - å端") |
| | | @PostMapping("/login") |
| | | public ApiResponse<String> login (@Validated @RequestBody LoginDTO dto, HttpServletRequest request) { |
| | | return ApiResponse.success(systemLoginService.loginByPassword(dto, Constants.ONE, request)); |
| | | } |
| | | |
| | | @PreventRepeat(limit = 10, lockTime = 10000) |
| | | @ApiOperation("ç»å½ - H5") |
| | | @PostMapping("/loginH5") |
| | | public ApiResponse<String> loginH5 (@Validated @RequestBody WebLoginDTO dto, HttpServletRequest request) { |
| | | LoginDTO loginDTO = new LoginDTO(); |
| | | BeanUtils.copyProperties(dto,loginDTO); |
| | | return ApiResponse.success(systemLoginService.loginByPassword(loginDTO, Constants.TWO, request)); |
| | | } |
| | | |
| | | @ApiOperation("éåºç»å½") |
| | | @PostMapping("/logout") |
| | | public ApiResponse logout () { |
| | |
| | | Map<String, String> map = new LinkedHashMap<>(); |
| | | // è·¯å¾æ¦æªé
ç½® |
| | | // è·¯å¾æ¦æªé
ç½® |
| | | // map.put("/system/dictData/companyUserRules","anon"); |
| | | // map.put("/system/login", "anon"); |
| | | // map.put("/system/logout", "anon"); |
| | | // map.put("/common/captcha", "anon"); |
| | | // map.put("/business/areas/*", "anon"); |
| | | // map.put("/public/uploadPicture","anon"); |
| | | // map.put("/public/uploadLocal","anon"); |
| | | |
| | | map.put("/system/dictData/companyUserRules","anon"); |
| | | map.put("/system/login", "anon"); |
| | | map.put("/system/logout", "anon"); |
| | | map.put("/system/loginH5", "anon"); |
| | | map.put("/common/captcha", "anon"); |
| | | map.put("/business/areas/*", "anon"); |
| | | map.put("/public/uploadPicture","anon"); |
| | | map.put("/public/uploadLocal","anon"); |
| | | |
| | | |
| | | map.put("/business/company/register", "anon"); |
| | | map.put("/business/labels/page","anon"); |
| | | map.put("/business/*/list","anon"); |
| | | map.put("/business/goods/goodsPage","anon"); |
| | | map.put("/business/goods/h5Image","anon"); |
| | | map.put("/business/goods/export","anon"); |
| | | map.put("/business/goods/listForH5","anon"); |
| | | |
| | | |
| | | // - æ¾è¡swagger |
| | | map.put("/doc.html", "anon"); |
| | | map.put("/webjars/**", "anon"); |
| | |
| | | import com.doumee.dao.business.model.dto.BaseGoodsCreateOrUpdateRequest; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsDTO; |
| | | import com.doumee.service.business.BaseGoodsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | baseGoodsService.update(baseGoods); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("导å
¥æ¨¡æ¿") |
| | | @PostMapping("/importExcel") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), |
| | | }) |
| | | @RequiresPermissions("business:basegoods:create") |
| | | public ApiResponse<Integer> importExcel (@ApiParam(value = "file") MultipartFile file) { |
| | | return ApiResponse.success(baseGoodsService.importBaseGoodsBatch(file)); |
| | | } |
| | | } |
| | |
| | | map.put("/system/dictData/companyUserRules","anon"); |
| | | map.put("/system/login", "anon"); |
| | | map.put("/system/logout", "anon"); |
| | | map.put("/system/loginH5", "anon"); |
| | | map.put("/common/captcha", "anon"); |
| | | map.put("/business/areas/*", "anon"); |
| | | map.put("/public/uploadPicture","anon"); |
| | |
| | | map.put("/system/dictData/companyUserRules","anon"); |
| | | map.put("/system/login", "anon"); |
| | | map.put("/system/logout", "anon"); |
| | | map.put("/system/loginH5", "anon"); |
| | | map.put("/common/captcha", "anon"); |
| | | map.put("/business/areas/*", "anon"); |
| | | map.put("/business/company/register", "anon"); |
| | |
| | | public static final String ENDPOINT = "ENDPOINT"; |
| | | public static final String RESOURCE_PATH = "RESOURCE_PATH"; |
| | | public static final String WEB_PARAM = "WEB_PARAM"; |
| | | public static final String MAIN_COLOR = "MAIN_COLOR"; |
| | | public static final String BG_IMG = "BG_IMG"; |
| | | public static final String TOP_IMG = "TOP_IMG"; |
| | | public static final String PK_IMG = "PK_IMG"; |
| | | public static final String RANGE_SIZE = "RANGE_SIZE"; |
| | | |
| | | |
| | | public static final String SYSTEM ="SYSTEM"; |
| | |
| | | @TableField(exist = false) |
| | | private List<CateParam> paramList; |
| | | |
| | | @ApiModelProperty(value = "屿§1 å表å¼") |
| | | @ApiModelProperty(value = "屿§1 å表å¼" ,hidden = true) |
| | | @TableField(exist = false) |
| | | private List<CateAttr> attrFirstList; |
| | | |
| | | @ApiModelProperty(value = "屿§2 å表å¼") |
| | | @ApiModelProperty(value = "屿§2 å表å¼" ,hidden = true) |
| | | @TableField(exist = false) |
| | | private List<CateAttr> attrSecondList; |
| | | |
| | |
| | | @TableField(exist = false) |
| | | private List<CateBudget> budgetList; |
| | | |
| | | @ApiModelProperty(value = "屿§1 å表å¼") |
| | | @TableField(exist = false) |
| | | private List<CateParamSelect> cateParamFirstList; |
| | | |
| | | @ApiModelProperty(value = "屿§2 å表å¼") |
| | | @TableField(exist = false) |
| | | private List<CateParamSelect> cateParamSecondList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.model.dto; |
| | | |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author T14 |
| | | */ |
| | | @Data |
| | | @ApiModel("忰屿§å¼") |
| | | public class BaseGoodsImportDTO { |
| | | |
| | | @ApiModelProperty(value = "ååID") |
| | | @ExcelColumn(name="ååID") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "åååç§°") |
| | | @ExcelColumn(name="åååç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "ååç±»å«") |
| | | @ExcelColumn(name="ååç±»å«") |
| | | private String categoryName; |
| | | |
| | | @ApiModelProperty(value = "åååç") |
| | | @ExcelColumn(name="åååç") |
| | | private String brandName; |
| | | |
| | | @ApiModelProperty(value = "æå¯¼ä»·") |
| | | @ExcelColumn(name="æå¯¼ä»·") |
| | | private BigDecimal zdPrice; |
| | | |
| | | @ApiModelProperty(value = "å
¥æä»·") |
| | | @ExcelColumn(name="å
¥æä»·") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty(value = "产ååæ°") |
| | | @ExcelColumn(name="产ååæ°") |
| | | private String baseGoodsParamString; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.system.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author Eva.Caesar Liu |
| | | * @date 2023/02/14 11:14 |
| | | */ |
| | | @Data |
| | | @ApiModel("H5主æç»å½åæ°") |
| | | public class WebLoginDTO implements Serializable { |
| | | |
| | | @NotBlank(message = "ç¨æ·åä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "ç¨æ·å") |
| | | private String username; |
| | | |
| | | @NotBlank(message = "å¯ç ä¸è½ä¸ºç©º") |
| | | @ApiModelProperty(value = "å¯ç ") |
| | | private String password; |
| | | |
| | | } |
| | |
| | | import com.doumee.dao.business.model.BaseGoods; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsCreateOrUpdateRequest; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsDTO; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return long |
| | | */ |
| | | long count(BaseGoods baseGoods); |
| | | |
| | | |
| | | |
| | | /** |
| | | * ä¼ä¸ç¨æ·æ¹é导å
¥ |
| | | * @param file |
| | | * @return |
| | | */ |
| | | Integer importBaseGoodsBatch(MultipartFile file); |
| | | } |
| | |
| | | */ |
| | | List<Category> findList(Category category); |
| | | |
| | | List<Category> findListSaaS(Category category); |
| | | |
| | | List<Category> companyFindList(Category category); |
| | | /** |
| | | * æ¥è¯¢ç±»å« |
| | |
| | | |
| | | BaseCategory baseCategory1 = baseCategoryMapper.selectOne(wrapper); |
| | | if (Objects.nonNull(baseCategory1)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"å类信æ¯è¡¨"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(),"å类信æ¯å·²åå¨"); |
| | | } |
| | | BaseCategory baseCategory2 = new BaseCategory(); |
| | | baseCategory2.setCreator(loginUserInfo.getId()); |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.annotation.excel.ExcelImporter; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsCreateOrUpdateRequest; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsDTO; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsImportDTO; |
| | | import com.doumee.dao.business.model.dto.BaseGoodsParamCreatRequest; |
| | | import com.doumee.service.business.BaseGoodsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç´ æåº-ååä¿¡æ¯è¡¨Serviceå®ç° |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/07 11:41 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class BaseGoodsServiceImpl implements BaseGoodsService { |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private GoodsMapper goodsMapper; |
| | | |
| | | @Autowired |
| | | private BaseCategoryMapper baseCategoryMapper; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(BaseGoodsCreateOrUpdateRequest baseGoods) { |
| | |
| | | .selectAs(BaseCategory::getName,BaseGoods::getCategoryName) |
| | | .eq(BaseGoods::getIsdeleted, Constants.ZERO) |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getName()), BaseGoods::getName,pageWrap.getModel().getName()) |
| | | .eq(pageWrap.getModel().getId()!=null,BaseGoods::getId, pageWrap.getModel().getId()) |
| | | .like(pageWrap.getModel().getId()!=null,BaseGoods::getId, pageWrap.getModel().getId()) |
| | | .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()); |
| | |
| | | QueryWrapper<BaseGoods> wrapper = new QueryWrapper<>(baseGoods); |
| | | return baseGoodsMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer importBaseGoodsBatch(MultipartFile file) { |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | try { |
| | | |
| | | ExcelImporter ie = new ExcelImporter(file,0,0); |
| | | List<BaseGoodsImportDTO> dataList = ie.getDataList(BaseGoodsImportDTO.class,null); |
| | | if(dataList == null || dataList.size() ==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对ä¸èµ·ï¼å½å
¥æ°æ®ä¸ºç©ºï¼"); |
| | | } |
| | | List<String> comNameList = dataList.stream().map(s -> s.getName().trim()).distinct().collect(Collectors.toList()); |
| | | |
| | | if (!(dataList.size() == comNameList.size())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"åååç§°æå·²åå¨"); |
| | | } |
| | | |
| | | // List<String> collect1 = dataList.stream().filter(s->{ |
| | | // if (StringUtils.isBlank(s.getBrandName())){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | // }else { |
| | | // return true; |
| | | // } |
| | | // }).map(s -> s.getCategoryName()).collect(Collectors.toList()); |
| | | // QueryWrapper<BaseCategory> wrapper = new QueryWrapper<>(); |
| | | // wrapper.lambda() |
| | | // .in(BaseCategory::getName,collect1); |
| | | // List<BaseCategory> baseCategories = baseCategoryMapper.selectList(wrapper); |
| | | |
| | | dataList.forEach(s->{ |
| | | |
| | | BaseGoods baseGoods = new BaseGoods(); |
| | | baseGoods.setCreator(user.getId()); |
| | | baseGoods.setCreateDate(new Date()); |
| | | baseGoods.setEditor(user.getId()); |
| | | baseGoods.setEditDate(new Date()); |
| | | baseGoods.setIsdeleted(Constants.ZERO); |
| | | baseGoods.setName(s.getName()); |
| | | baseGoods.setStatus(Constants.ZERO); |
| | | |
| | | if (StringUtils.isBlank(s.getCategoryName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"ååç±»å«ä¸å¯ä¸ºç©º"); |
| | | } |
| | | QueryWrapper<BaseCategory> categoryQuery = new QueryWrapper<>(); |
| | | categoryQuery.lambda() |
| | | .eq(BaseCategory::getName,s.getCategoryName()); |
| | | BaseCategory baseCategory = baseCategoryMapper.selectOne(categoryQuery); |
| | | |
| | | |
| | | QueryWrapper<Brand> brandQuery = new QueryWrapper<>(); |
| | | brandQuery.lambda() |
| | | .eq(Brand::getName,s.getBrandName()); |
| | | Brand brand = brandMapper.selectOne(brandQuery); |
| | | |
| | | // baseGoods.setImgurl(); |
| | | baseGoods.setCategoryId(baseCategory.getId()); |
| | | baseGoods.setBrandId(brand.getId()); |
| | | baseGoodsMapper.insert(baseGoods); |
| | | |
| | | String baseGoodsParamString = s.getBaseGoodsParamString(); |
| | | List<List<String>> collect = Arrays.asList(baseGoodsParamString.split("\n")) |
| | | .stream().map(s1 -> Arrays.asList(s1.split("[ï¼,:]")) ).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(collect)){ |
| | | Integer i = 0; |
| | | collect.forEach(s2->{ |
| | | if (!CollectionUtils.isEmpty(baseCategory.getBaseCateParamList())){ |
| | | |
| | | BaseCateParam baseCateParam = baseCategory.getBaseCateParamList() |
| | | .stream().filter(s3 -> s3.getName().equals(s2.get(0))).findFirst() |
| | | .orElseThrow(()->new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"é
ç½®åæ°ä¸åå¨")); |
| | | BaseGoodsParam baseGoodsParam = new BaseGoodsParam(); |
| | | baseGoodsParam.setCreator(user.getId()); |
| | | baseGoodsParam.setCreateDate(new Date()); |
| | | baseGoodsParam.setEditor(user.getId()); |
| | | baseGoodsParam.setEditDate(new Date()); |
| | | baseGoodsParam.setIsdeleted(Constants.ZERO); |
| | | baseGoodsParam.setName(baseCateParam.getName()); |
| | | baseGoodsParam.setRemark(baseCateParam.getRemark()); |
| | | baseGoodsParam.setStatus(Constants.ZERO); |
| | | baseGoodsParam.setSortnum(i+Constants.ONE); |
| | | baseGoodsParam.setPramaId(baseCateParam.getId()); |
| | | baseGoodsParam.setVal(s2.size() > 1 ? s2.get(1) : null ); |
| | | baseGoodsParam.setGoodsId(baseGoods.getId()); |
| | | baseGoodsParamMapper.insert(baseGoodsParam); |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | }); |
| | | }catch (Exception e) { |
| | | log.error(String.format("æ¹éæå
¥å¼å¸¸%s ",e.getMessage())); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),e.getMessage()); |
| | | }finally { |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | if (Constants.equalsInteger(user.getType(), Constants.UserType.SYSTEM.getKey())) { |
| | | wrapper.lambda().eq(Brand::getType,Constants.ONE); |
| | | }else { |
| | | wrapper.lambda().and(wapper ->{wapper.eq(Brand::getType,brand.getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO);} ); |
| | | wrapper.lambda().and(i->i.eq(Brand::getCompanyId,user.getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO) |
| | | ); |
| | | } |
| | | List<Brand> list = brandMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | |
| | | if (Objects.isNull(user.getCompanyId())) { |
| | | queryWrapper.lambda().eq(Brand::getType,Constants.ONE); |
| | | }else { |
| | | queryWrapper.lambda().and(wreapper->{ |
| | | wreapper.eq(Brand::getType,pageWrap.getModel().getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO);}); |
| | | |
| | | queryWrapper.lambda().and(i->i.eq(Brand::getCompanyId,user.getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO) |
| | | ); |
| | | } |
| | | queryWrapper.lambda().orderByAsc(Brand::getSortnum); |
| | | IPage<Brand> brandIPage = brandMapper.selectPage(page, queryWrapper); |
| | |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CateAttrMapper; |
| | | import com.doumee.dao.business.CateParamMapper; |
| | | import com.doumee.dao.business.CateParamSelectMapper; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.CategoryService; |
| | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | | private CateParamSelectMapper cateParamSelectMapper; |
| | | |
| | | @Override |
| | | public Integer create(Category category) { |
| | |
| | | |
| | | @Override |
| | | public List<Category> findList(Category category) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<Category> wrapper = new QueryWrapper<>(category) |
| | | .eq("STATUS",Constants.ZERO) |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq("COMPANY_ID",user.getCompanyId()) |
| | | .orderByAsc(" SORTNUM "); |
| | | List<Category> list = categoryMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.FILE_DIR).getCode() |
| | | + 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 "))); |
| | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Category> findListSaaS(Category category) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!user.getType().equals(Constants.UserType.ZHUBO.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ç¨æ·ç±»å«é误ï¼é主æç¨æ·!"); |
| | | } |
| | | QueryWrapper<Category> wrapper = new QueryWrapper<>(category) |
| | | .eq("STATUS",Constants.ZERO) |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq("COMPANY_ID",user.getCompanyId()) |
| | | .orderByAsc(" SORTNUM "); |
| | | List<Category> list = categoryMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.FILE_DIR).getCode() |
| | | + 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 "))); |
| | | this.getParamSelect(c); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public void getParamSelect(Category category){ |
| | | List<CateParam> cateParamList = cateParamMapper.selectList(new QueryWrapper<CateParam>() |
| | | .eq("CATEGORY_ID",category.getId()) |
| | | .eq("ISSELECT",Constants.ONE) |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .orderByAsc(" SORTNUM ") |
| | | .last(" limit 2 ") |
| | | ); |
| | | if(!Objects.isNull(cateParamList)&&cateParamList.size()>Constants.ZERO){ |
| | | for (int i = 0; i < cateParamList.size(); i++) { |
| | | CateParam cateParam = cateParamList.get(i); |
| | | List<CateParamSelect> cateParamSelectList = cateParamSelectMapper.selectList(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",cateParam.getId()) |
| | | .eq("ISDELETED",Constants.ZERO)); |
| | | if(i==0){ |
| | | category.setAttrFirst(cateParam.getName()); |
| | | category.setCateParamFirstList(cateParamSelectList); |
| | | }else if(i==1){ |
| | | category.setAttrSecond(cateParam.getName()); |
| | | category.setCateParamSecondList(cateParamSelectList); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Category> findListForGoods(Integer goodsId) { |
| | | QueryWrapper<Category> wrapper = new QueryWrapper<Category>() |
| | |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .orderByAsc(" SORTNUM "); |
| | | List<Category> list = categoryMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.FILE_DIR).getCode() |
| | | + 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 "))); |
| | |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .orderByAsc(" SORTNUM "); |
| | | List<Category> list = categoryMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.CATEGORY_IMG).getCode(); |
| | | for (Category c:list) { |
| | | c.setPrefixUrl(prefixUrl); |
| | | c.setBudgetList(cateBudgetMapper.selectList(new QueryWrapper<CateBudget>().eq("STATUS",Constants.ZERO).eq("CATEGORY_ID",c.getId()).orderByAsc(" SORTNUM "))); |
| | |
| | | import com.doumee.service.business.BaseDataService; |
| | | import com.doumee.service.business.GoodsService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.java.Log; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | |
| | | @Override |
| | | public void export(HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | try { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | String fileName = "产å导å
¥è¡¨"+System.currentTimeMillis()+".xlsx"; |
| | | // è·åæä»¶è¾å
¥æµ |
| | | InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("static/file/goodsExcelTemp.xlsx"); |
| | |
| | | // sheet.getPhysicalNumberOfRows()è·åæ»çè¡æ° |
| | | // 循ç¯è¯»åæ¯ä¸è¡ |
| | | Row row = sheet.createRow(1); |
| | | List<Category> categoryList = categoryMapper.selectList(new QueryWrapper<Category>().eq("ISDELETED",0)); |
| | | List<Category> categoryList = categoryMapper.selectList( |
| | | new QueryWrapper<Category>().eq("ISDELETED",0) |
| | | .eq("COMPANY_ID",loginUserInfo.getCompanyId()) |
| | | ); |
| | | categoryList.forEach(i->{ |
| | | i.setParamList(cateParamMapper.selectList(new QueryWrapper<CateParam>().eq("ISDELETED",0).eq("CATEGORY_ID",i.getId()))); |
| | | }); |
| | |
| | | .apply(!Objects.isNull(pageWrap.getModel()) && !Objects.isNull(pageWrap.getModel().getEPrice()), " t.PRICE <= "+pageWrap.getModel().getEPrice()+" "); |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | IPage<Goods> goodsIPage = goodsJoinMapper.selectJoinPage(page, Goods.class, queryWrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); |
| | | goodsIPage.getRecords().forEach(i->{ |
| | | i.setPrefixUrl(prefixUrl); |
| | | i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); |
| | |
| | | |
| | | @Override |
| | | public List<Goods> findListForH5(GoodsRequest goodsRequest) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!loginUserInfo.getType().equals(Constants.UserType.ZHUBO.getKey())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"é主æç¨æ·æ æ³ä½¿ç¨"); |
| | | } |
| | | MPJLambdaWrapper<Goods> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Goods.class); |
| | | queryWrapper.selectAs(Category::getName, Goods::getCategoryName); |
| | |
| | | queryWrapper.leftJoin(Brand.class, Brand::getId, Goods::getBrandId); |
| | | queryWrapper.eq(Goods::getStatus,Constants.ZERO); |
| | | queryWrapper.eq(Goods::getIsdeleted,Constants.ZERO); |
| | | queryWrapper.eq(Goods::getCompanyId,loginUserInfo.getCompanyId()); |
| | | queryWrapper.eq(!Objects.isNull(goodsRequest) && !Objects.isNull(goodsRequest.getCategoryId()), Goods::getCategoryId, goodsRequest.getCategoryId()) |
| | | .eq(!Objects.isNull(goodsRequest) && !Objects.isNull(goodsRequest.getBrandId()), Goods::getBrandId, goodsRequest.getBrandId()) |
| | | .and(!Objects.isNull(goodsRequest) && StringUtils.isNotBlank(goodsRequest.getKeyword()), |
| | |
| | | .apply(!Objects.isNull(goodsRequest) && !Objects.isNull(goodsRequest.getEPrice()), " t.PRICE <= "+goodsRequest.getEPrice()+" "); |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | List<Goods> goodsList = goodsJoinMapper.selectJoinList(Goods.class,queryWrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); |
| | | goodsList.forEach(i->{ |
| | | i.setPrefixUrl(prefixUrl); |
| | | i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); |
| | |
| | | if(!Objects.isNull(webParam)){ |
| | | webParam.setResourcePath(systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.WEB_PARAM).getCode()); |
| | | }else{ |
| | | webParam = new WebParam(); |
| | | webParam.setResourcePath(systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode() + |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.WEB_PARAM).getCode()); |
| | | webParam.setBgImg(systemDictDataBiz.queryByCode(Constants.WEB_PARAM,Constants.BG_IMG).getCode()); |
| | | webParam.setTopImg(systemDictDataBiz.queryByCode(Constants.WEB_PARAM,Constants.TOP_IMG).getCode()); |
| | | webParam.setPkImg(systemDictDataBiz.queryByCode(Constants.WEB_PARAM,Constants.PK_IMG).getCode()); |
| | | webParam.setMainColor(systemDictDataBiz.queryByCode(Constants.WEB_PARAM,Constants.MAIN_COLOR).getCode()); |
| | | webParam.setRangeSize(systemDictDataBiz.queryByCode(Constants.WEB_PARAM,Constants.RANGE_SIZE).getCode()); |
| | | } |
| | | return webParam; |
| | | } |
| | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.system.dto.LoginDTO; |
| | | import com.doumee.dao.system.model.SystemLoginLog; |
| | |
| | | loginLog.setOsInfo(Utils.User_Client.getOS(request)); |
| | | loginLog.setServerIp(Utils.Server.getIP()); |
| | | // æ ¡éªéªè¯ç |
| | | try { |
| | | if(captchaCheck){ |
| | | captchaService.check(dto.getUuid(), dto.getCode()); |
| | | if(type!= Constants.TWO){ |
| | | try { |
| | | if(captchaCheck){ |
| | | captchaService.check(dto.getUuid(), dto.getCode()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); |
| | | loginLog.setSuccess(Boolean.FALSE); |
| | | systemLoginLogService.create(loginLog); |
| | | throw e; |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); |
| | | loginLog.setSuccess(Boolean.FALSE); |
| | | systemLoginLogService.create(loginLog); |
| | | throw e; |
| | | } |
| | | // æ ¡éªç¨æ·ååå¯ç |
| | | Subject subject = SecurityUtils.getSubject(); |