| | |
| | | unpackage/ |
| | | mini-program/unpackage/ |
| | | mini-program/node_modules/ |
| | | mini-program/mp-weixin/ |
| | | mini-program/mp-weixin/ |
| | | /CLAUDE.md |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.web.dto.shop; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("ç»éåä¿®æ¹å¯ç 请æ±") |
| | | public class ShopUpdatePwdDTO { |
| | | |
| | | @ApiModelProperty("æ§å¯ç ") |
| | | private String oldPassword; |
| | | |
| | | @ApiModelProperty("æ°å¯ç ") |
| | | private String newPassword; |
| | | } |
| | |
| | | String createShareImg(Integer userType,Integer memberId,String posterImg) throws Exception; |
| | | |
| | | String createShopMiniProgramCode(Integer shopId) throws Exception; |
| | | |
| | | /** |
| | | * çæä¼å端å°ç¨åºå享ç ï¼çº¯å°ç¨åºç ï¼æ æµ·æ¥åæï¼ |
| | | * @param memberId ä¼åID |
| | | * @return OSSæä»¶è·¯å¾ |
| | | * @throws Exception |
| | | */ |
| | | String createMemberMiniProgramCode(Integer memberId) throws Exception; |
| | | /** |
| | | * å建 |
| | | * |
| | |
| | | |
| | | |
| | | void logOut(String token,Integer shopId); |
| | | |
| | | /** |
| | | * ç»éåä¿®æ¹å¯ç |
| | | * @param shopId åæ·ID |
| | | * @param oldPassword æ§å¯ç |
| | | * @param newPassword æ°å¯ç |
| | | */ |
| | | void updatePwd(Integer shopId, String oldPassword, String newPassword); |
| | | } |
| | |
| | | .eq(GoodsSku::getIsdeleted,Constants.ZERO) |
| | | .in(GoodsSku::getGoodsId,idList)); |
| | | } |
| | | long shopNum = shopMapper.selectCount(new QueryWrapper<Shop>().lambda() |
| | | .eq(Shop::getIsdeleted,Constants.ZERO) |
| | | .eq(Shop::getStatus,Constants.ZERO)); |
| | | MPJLambdaWrapper<Goods> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(Goods.class); |
| | | queryWrapper.select("(select count(s.id) from shop_goods_relation s " + |
| | | "left join shop g on s.SHOP_ID =g.id " + |
| | | "where g.status=0 and s.ISDELETED=0 and s.GOODS_ID=t.id) as pricedShopNum "); |
| | | queryWrapper.eq(GoodsSku::getIsdeleted,Constants.ZERO); |
| | | queryWrapper.in(Goods::getId,idList); |
| | | List<Goods> goodsList= goodsAdminJoinMapper.selectJoinList(Goods.class,queryWrapper); |
| | | List<Goods> goodsList= goodsMapper.selectList(new QueryWrapper<Goods>().lambda() |
| | | .eq(Goods::getIsdeleted,Constants.ZERO) |
| | | .in(Goods::getId,idList)); |
| | | if(goodsList==null || goodsList.size() == 0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "ååä¿¡æ¯æ¥è¯¢æ æ "); |
| | | } |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":ååååå°æªè®¾ç½®é¶å®ä»·ï¼æ æ³ä¸æ¶"); |
| | | } |
| | | } |
| | | if(Constants.formatLongNum(goods.getPricedShopNum()) < shopNum){ |
| | | //é»è®¤skuä¿¡æ¯ |
| | | s =false; |
| | | if(idList.size()==1){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":ææªè®¾ç½®ä¾è´§ä»·çç»éåï¼æ æ³ä¸æ¶"); |
| | | } |
| | | |
| | | } |
| | | if(s){ |
| | | idList2.add(param.getId()); |
| | | } |
| | |
| | | |
| | | if(successNum != idList.size()){ |
| | | if( idList.size()>1){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "æå䏿¶ååæ°ï¼ã"+successNum+"ãï¼ä¸æ¶å¤±è´¥ï¼ã"+(idList.size()-successNum)+"ã个åå,请确ä¿å¾
䏿¶ååçåéå®ä»·åä¾è´§ä»·å·²è®¾ç½®"); |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "æå䏿¶ååæ°ï¼ã"+successNum+"ãï¼ä¸æ¶å¤±è´¥ï¼ã"+(idList.size()-successNum)+"ã个åå,请确ä¿å¾
䏿¶ååçéå®ä»·å·²è®¾ç½®"); |
| | | }else { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode()," 䏿¶å¤±è´¥"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String createMemberMiniProgramCode(Integer memberId) throws Exception { |
| | | InputStream inputStream = Constants.generateWxMiniImgStream( |
| | | "uid_"+memberId, |
| | | "/pages/index/index", |
| | | true); |
| | | if (inputStream == null) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "å°ç¨åºå享ç çæå¤±è´¥"); |
| | | } |
| | | ALiYunUtil obs = new ALiYunUtil( |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode() |
| | | ,systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode()); |
| | | |
| | | String shareFolder = systemDictDataBiz.queryByCode(Constants.OSS, Constants.SHARES_FILE).getCode(); |
| | | String key = DateUtil.getNowShortDate() + "/" + UUID.randomUUID().toString() + ".jpg"; |
| | | String fileName = shareFolder + key; |
| | | if (obs.uploadOnlineObject(inputStream,systemDictDataBiz.queryByCode(Constants.OSS, Constants.BUCKETNAME).getCode(), fileName,null)) { |
| | | return key; |
| | | } |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "å°ç¨åºå享ç ä¸ä¼ 失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | redisTemplate.delete(token); |
| | | } |
| | | |
| | | @Override |
| | | public void updatePwd(Integer shopId, String oldPassword, String newPassword){ |
| | | if(StringUtils.isBlank(oldPassword) || StringUtils.isBlank(newPassword)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "æ§å¯ç åæ°å¯ç ä¸è½ä¸ºç©º"); |
| | | } |
| | | if(oldPassword.equals(newPassword)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "æ°å¯ç ä¸è½ä¸æ§å¯ç ç¸å"); |
| | | } |
| | | Shop shop = shopMapper.selectById(shopId); |
| | | if(shop == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "åæ·ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | String oldPwd = Utils.Secure.encryptPassword(oldPassword, shop.getSalt()); |
| | | if(!oldPwd.equals(shop.getPassword())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "æ§å¯ç é误"); |
| | | } |
| | | String newSalt = RandomStringUtils.randomAlphabetic(6); |
| | | String newPwd = Utils.Secure.encryptPassword(newPassword, newSalt); |
| | | shopMapper.update(null, new UpdateWrapper<Shop>().lambda() |
| | | .set(Shop::getPassword, newPwd) |
| | | .set(Shop::getSalt, newSalt) |
| | | .eq(Shop::getId, shopId)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | return ApiResponse.success(inviteRecordService.createShareImg(Constants.ZERO,getMemberId(),null)); |
| | | } |
| | | |
| | | @LoginRequired |
| | | @ApiOperation(value = "çæä¼åå享ç ", notes = "å°ç¨åºç«¯") |
| | | @GetMapping("/getMemberShareCode") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "ç¨æ·tokenå¼", required = true) |
| | | }) |
| | | public ApiResponse<String> getMemberShareCode() throws Exception { |
| | | return ApiResponse.success(inviteRecordService.createMemberMiniProgramCode(getMemberId())); |
| | | } |
| | | |
| | | |
| | | @LoginShopRequired |
| | | @ApiOperation(value = "åæ·çæé请海æ¥", notes = "å°ç¨åºç«¯") |
| | |
| | | return ApiResponse.success("æä½æå"); |
| | | } |
| | | |
| | | @LoginShopRequired |
| | | @ApiOperation("ç»éå - ä¿®æ¹å¯ç ") |
| | | @PostMapping("/updatePwd") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "ç¨æ·tokenå¼", required = true), |
| | | }) |
| | | public ApiResponse updatePwd(@RequestBody ShopUpdatePwdDTO dto) { |
| | | shopService.updatePwd(getShopId(), dto.getOldPassword(), dto.getNewPassword()); |
| | | return ApiResponse.success("ä¿®æ¹æå"); |
| | | } |
| | | |
| | | |
| | | |
| | | |