From f9e4883831956328e73f4df77c8d6887a0f8d70b Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期一, 11 五月 2026 10:41:46 +0800
Subject: [PATCH] 小程序   接口开发

---
 server/dmmall_service/src/main/java/com/doumee/service/business/InviteRecordService.java          |    8 ++
 server/dmmall_service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java         |   24 ++++++++
 server/dmmall_service/src/main/java/com/doumee/service/business/ShopService.java                  |    8 ++
 server/.gitignore                                                                                 |    3 
 server/dmmall_service/src/main/java/com/doumee/dao/web/dto/shop/ShopUpdatePwdDTO.java             |   16 +++++
 server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java        |   24 +------
 server/dmmall_web/src/main/java/com/doumee/api/web/SharesApi.java                                 |   10 +++
 server/dmmall_web/src/main/java/com/doumee/api/web/ShopApi.java                                   |   11 +++
 server/dmmall_service/src/main/java/com/doumee/service/business/impl/InviteRecordServiceImpl.java |   24 ++++++++
 9 files changed, 107 insertions(+), 21 deletions(-)

diff --git a/server/.gitignore b/server/.gitignore
index 6d4d538..a897f61 100644
--- a/server/.gitignore
+++ b/server/.gitignore
@@ -26,4 +26,5 @@
 unpackage/ 
 mini-program/unpackage/
 mini-program/node_modules/
-mini-program/mp-weixin/
\ No newline at end of file
+mini-program/mp-weixin/
+/CLAUDE.md
diff --git a/server/dmmall_service/src/main/java/com/doumee/dao/web/dto/shop/ShopUpdatePwdDTO.java b/server/dmmall_service/src/main/java/com/doumee/dao/web/dto/shop/ShopUpdatePwdDTO.java
new file mode 100644
index 0000000..7c49753
--- /dev/null
+++ b/server/dmmall_service/src/main/java/com/doumee/dao/web/dto/shop/ShopUpdatePwdDTO.java
@@ -0,0 +1,16 @@
+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;
+}
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/InviteRecordService.java b/server/dmmall_service/src/main/java/com/doumee/service/business/InviteRecordService.java
index 547e39e..7dbcc6b 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/InviteRecordService.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/InviteRecordService.java
@@ -19,6 +19,14 @@
     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;
     /**
      * 鍒涘缓
      *
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/ShopService.java b/server/dmmall_service/src/main/java/com/doumee/service/business/ShopService.java
index 689a720..12d2496 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/ShopService.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/ShopService.java
@@ -218,4 +218,12 @@
 
 
     void logOut(String token,Integer shopId);
+
+    /**
+     * 缁忛攢鍟嗕慨鏀瑰瘑鐮�
+     * @param shopId 鍟嗘埛ID
+     * @param oldPassword 鏃у瘑鐮�
+     * @param newPassword 鏂板瘑鐮�
+     */
+    void updatePwd(Integer shopId, String oldPassword, String newPassword);
 }
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
index 0d731d5..71ef791 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -372,17 +372,9 @@
                     .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(), "鍟嗗搧淇℃伅鏌ヨ鏃犳晥 ");
         }
@@ -409,14 +401,6 @@
                  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());
             }
@@ -432,7 +416,7 @@
 
         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()," 涓婃灦澶辫触");
             }
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/InviteRecordServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/InviteRecordServiceImpl.java
index ea46af2..232406b 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/InviteRecordServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/InviteRecordServiceImpl.java
@@ -173,6 +173,30 @@
     }
 
 
+    @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(), "灏忕▼搴忓垎浜爜涓婁紶澶辫触");
+    }
+
+
 
 
 
diff --git a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
index 13ea867..5604bf5 100644
--- a/server/dmmall_service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
+++ b/server/dmmall_service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
@@ -1000,5 +1000,29 @@
         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));
+    }
+
 
 }
diff --git a/server/dmmall_web/src/main/java/com/doumee/api/web/SharesApi.java b/server/dmmall_web/src/main/java/com/doumee/api/web/SharesApi.java
index b9cb8da..546f25c 100644
--- a/server/dmmall_web/src/main/java/com/doumee/api/web/SharesApi.java
+++ b/server/dmmall_web/src/main/java/com/doumee/api/web/SharesApi.java
@@ -59,6 +59,16 @@
         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 = "灏忕▼搴忕")
diff --git a/server/dmmall_web/src/main/java/com/doumee/api/web/ShopApi.java b/server/dmmall_web/src/main/java/com/doumee/api/web/ShopApi.java
index b468909..dee9d64 100644
--- a/server/dmmall_web/src/main/java/com/doumee/api/web/ShopApi.java
+++ b/server/dmmall_web/src/main/java/com/doumee/api/web/ShopApi.java
@@ -183,6 +183,17 @@
         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("淇敼鎴愬姛");
+    }
+
 
 
 

--
Gitblit v1.9.3