zwhui пре 1 година
родитељ
комит
a6f255c936

+ 1 - 0
wholesale/src/main/java/com/yhlxj/dao/model/entity/WholesaleUser.java

@@ -12,6 +12,7 @@ import java.util.Date;
  */
 @Data
 public class WholesaleUser extends BaseEntity {
+    private Long wholesaleId;
     private String username;
     /**
      * 用户昵称

+ 1 - 1
wholesale/src/main/java/com/yhlxj/service/wholesale/WholesaleUserService.java

@@ -10,5 +10,5 @@ import com.yhlxj.dao.model.entity.WholesaleUser;
 public interface WholesaleUserService extends IService<WholesaleUser> {
     WholesaleUser login(String username, String password) throws Exception;
 
-    WholesaleUser register(String username, String password) throws Exception;
+    WholesaleUser register(Long wholesaleId,String username, String password) throws Exception;
 }

+ 2 - 1
wholesale/src/main/java/com/yhlxj/service/wholesale/impl/WholesaleUserServiceImpl.java

@@ -35,12 +35,13 @@ public class WholesaleUserServiceImpl extends ServiceImpl<WholesaleUserMapper, W
 
 
     @Override
-    public WholesaleUser register(String username, String password) throws Exception {
+    public WholesaleUser register(Long wholesaleId,String username, String password) throws Exception {
         WholesaleUser wholesaleUser = baseMapper.selectOne(Wrappers.lambdaQuery(WholesaleUser.class).eq(WholesaleUser::getUsername, username));
         if (null != wholesaleUser) {
             throw new BusinessRuntimeException("用户已存在.");
         }
         wholesaleUser = new WholesaleUser();
+        wholesaleUser.setWholesaleId(wholesaleId);
         wholesaleUser.setUsername(username);
         String encodePasscode = Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.SHA256).setStringData(password).toBase64String();
         wholesaleUser.setPassword(encodePasscode);

+ 18 - 1
wholesale/src/main/java/com/yhlxj/web/controller/login/WholesaleUserController.java

@@ -9,11 +9,13 @@ import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.enums.GatewayApiCode;
 import com.yhlxj.dao.model.dto.Result;
 import com.yhlxj.dao.model.entity.WebInfo;
+import com.yhlxj.dao.model.entity.WholesaleNotice;
 import com.yhlxj.dao.model.entity.WholesaleUser;
 import com.yhlxj.dao.model.enums.GatewayResponse;
 import com.yhlxj.dao.model.request.WholesaleUserReq;
 import com.yhlxj.dao.model.view.WebInfoView;
 import com.yhlxj.service.wholesale.WebInfoService;
+import com.yhlxj.service.wholesale.WholesaleNoticeService;
 import com.yhlxj.service.wholesale.WholesaleUserService;
 import com.yhlxj.web.util.StpUserUtil;
 import com.yhlxj.web.util.StpWholesaleUtil;
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
+import java.util.List;
 
 /**
  * 用户登录
@@ -43,6 +46,8 @@ public class WholesaleUserController {
 
     private final HttpServletResponse response;
 
+    private final WholesaleNoticeService wholesaleNoticeService;
+
     /**
      * 批发网站登录
      */
@@ -80,7 +85,7 @@ public class WholesaleUserController {
         if (wholesaleUser.getUsername() == null || !Validator.isEmail(wholesaleUser.getUsername())) {
             throw BusinessRuntimeException.getInstance("请输入正确邮箱");
         }
-         WholesaleUser login = wholesaleUserService.register(wholesaleUser.getUsername(), wholesaleUser.getPassword());
+         WholesaleUser login = wholesaleUserService.register(wholesaleUser.getWholesaleId(),wholesaleUser.getUsername(), wholesaleUser.getPassword());
 
         //写回登陆信息
         StpUserUtil.login(login.getId());
@@ -147,4 +152,16 @@ public class WholesaleUserController {
         }
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
+
+    /**
+     * 查询公告
+     */
+    @GetMapping("/getNotice")
+    public Result<List<WholesaleNotice>> getNotice(Long wholesaleId,String platform) {
+        List<WholesaleNotice> list = wholesaleNoticeService.list(Wrappers.lambdaQuery(WholesaleNotice.class)
+                .eq(WholesaleNotice::getWholesaleId, wholesaleId)
+                .eq(WholesaleNotice::getPlatform, platform)
+                .eq(WholesaleNotice::getStatus, true));
+        return GatewayResponse.SUCCESS.newBuilder().toResult(list);
+    }
 }