|
@@ -1,10 +1,13 @@
|
|
|
package com.yhlxj.web.controller.login;
|
|
package com.yhlxj.web.controller.login;
|
|
|
|
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.lang.Validator;
|
|
import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
|
|
+import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
import com.cyksj.enums.GatewayApiCode;
|
|
|
import com.yhlxj.dao.model.dto.Result;
|
|
import com.yhlxj.dao.model.dto.Result;
|
|
|
import com.yhlxj.dao.model.entity.WebInfo;
|
|
import com.yhlxj.dao.model.entity.WebInfo;
|
|
@@ -83,7 +86,7 @@ public class WholesaleUserController {
|
|
|
if (wholesaleUser.getUsername() == null || !Validator.isEmail(wholesaleUser.getUsername())) {
|
|
if (wholesaleUser.getUsername() == null || !Validator.isEmail(wholesaleUser.getUsername())) {
|
|
|
throw BusinessRuntimeException.getInstance("请输入正确邮箱");
|
|
throw BusinessRuntimeException.getInstance("请输入正确邮箱");
|
|
|
}
|
|
}
|
|
|
- WholesaleUser login = wholesaleUserService.register(wholesaleUser.getWholesaleId(),wholesaleUser.getUsername(), wholesaleUser.getPassword());
|
|
|
|
|
|
|
+ WholesaleUser login = wholesaleUserService.register(wholesaleUser.getWholesaleId(), wholesaleUser.getUsername(), wholesaleUser.getPassword());
|
|
|
|
|
|
|
|
//写回登陆信息
|
|
//写回登陆信息
|
|
|
StpUserUtil.login(login.getId());
|
|
StpUserUtil.login(login.getId());
|
|
@@ -105,7 +108,7 @@ public class WholesaleUserController {
|
|
|
if (webInfo == null) {
|
|
if (webInfo == null) {
|
|
|
throw new BusinessRuntimeException("店铺不存在.");
|
|
throw new BusinessRuntimeException("店铺不存在.");
|
|
|
}
|
|
}
|
|
|
- if (!webInfo.getStatus()){
|
|
|
|
|
|
|
+ if (!webInfo.getStatus()) {
|
|
|
throw new BusinessRuntimeException("店铺已关闭.");
|
|
throw new BusinessRuntimeException("店铺已关闭.");
|
|
|
}
|
|
}
|
|
|
WebInfoView view = new WebInfoView();
|
|
WebInfoView view = new WebInfoView();
|
|
@@ -152,15 +155,15 @@ public class WholesaleUserController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 查询公告
|
|
|
|
|
|
|
+ * 查询公告列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/getNotice")
|
|
@GetMapping("/getNotice")
|
|
|
- public Result<List<WholesaleNotice>> getNotice(Long wholesaleId,String platform) {
|
|
|
|
|
- List<WholesaleNotice> list = wholesaleNoticeService.list(Wrappers.lambdaQuery(WholesaleNotice.class)
|
|
|
|
|
|
|
+ public Result<Page<WholesaleNotice>> getNotice(Long wholesaleId, String platform, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
|
|
|
|
|
+ Page<WholesaleNotice> page = wholesaleNoticeService.page(new Page<>(start, limit), Wrappers.lambdaQuery(WholesaleNotice.class)
|
|
|
.eq(WholesaleNotice::getWholesaleId, wholesaleId)
|
|
.eq(WholesaleNotice::getWholesaleId, wholesaleId)
|
|
|
- .eq(WholesaleNotice::getPlatform, platform)
|
|
|
|
|
- .eq(WholesaleNotice::getStatus, true)
|
|
|
|
|
|
|
+ .like(StringUtil.isNotBlank(platform), WholesaleNotice::getPlatform, platform)
|
|
|
|
|
+ .eq(WholesaleNotice::getStatus, Boolean.TRUE)
|
|
|
.orderByDesc(WholesaleNotice::getId));
|
|
.orderByDesc(WholesaleNotice::getId));
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(list);
|
|
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(page);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|