Merge branch 'master' into Bulbasaur
This commit is contained in:
commit
0173ba814e
@ -116,7 +116,7 @@ PS:单独部署的话,数据库文件访问这里:https://gitee.com/beijing_
|
||||
|
||||
#### 移动端
|
||||
|
||||
<img src="https://pickmall.cn/assets/imgs/other/app.gif" alt="移动端功能展示" style="width:300px;" />
|
||||
<img src="https://pickmall.cn/assets/imgs/other/app.gif" alt="移动端功能展示" style="zoom:50%;" />
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
|
||||
@ -11,7 +12,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -57,6 +57,6 @@ public class DistributionGoodsBuyerController {
|
||||
if (distributionSelectedGoodsService.add(distributionGoodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -9,7 +10,6 @@ import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -47,7 +47,7 @@ public class FootprintController {
|
||||
if (footprintService.deleteByIds(ids)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "清空足迹")
|
||||
@ -56,7 +56,7 @@ public class FootprintController {
|
||||
if (footprintService.clean()) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前会员足迹数量")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -12,7 +13,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -81,7 +81,7 @@ public class MemberAddressBuyerController {
|
||||
if (memberAddressService.removeMemberAddress(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -79,9 +79,9 @@ public class MemberWalletBuyerController {
|
||||
//校验验证码
|
||||
if (verificationService.check(uuid, VerificationEnums.WALLET_PASSWORD)) {
|
||||
memberWalletService.setMemberWalletPassword(member, password);
|
||||
return ResultUtil.error(ResultCode.SUCCESS);
|
||||
throw new ServiceException(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -8,7 +9,6 @@ import cn.lili.modules.page.entity.dos.Feedback;
|
||||
import cn.lili.modules.page.service.FeedbackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -38,7 +38,7 @@ public class FeedbackBuyerController {
|
||||
if (feedbackService.save(feedback)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.sms.SmsUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.verification.enums.VerificationEnums;
|
||||
@ -13,7 +14,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -50,7 +50,7 @@ public class MemberBuyerController {
|
||||
if (verificationService.check(uuid, VerificationEnums.LOGIN)) {
|
||||
return ResultUtil.data(this.memberService.usernameLogin(username, password));
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class MemberBuyerController {
|
||||
// if(smsUtil.verifyCode(mobile,VerificationEnums.LOGIN,uuid,code)){
|
||||
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
|
||||
// }else {
|
||||
// return ResultUtil.error("验证码错误");
|
||||
// throw new ServiceException("验证码错误");
|
||||
// }
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class MemberBuyerController {
|
||||
if (result) {
|
||||
return ResultUtil.data(memberService.register(username, password, mobilePhone));
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_SMS_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ public class MemberBuyerController {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改密码")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.passport.connect;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.token.Token;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -16,7 +17,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -68,7 +68,7 @@ public class ConnectBuyerWebController {
|
||||
@GetMapping("/result")
|
||||
public ResultMessage<Object> callBackResult(String state) {
|
||||
if (state == null) {
|
||||
return ResultUtil.error(ResultCode.USER_CONNECT_LOGIN_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_CONNECT_LOGIN_ERROR);
|
||||
}
|
||||
return connectUtil.getResult(state);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.purchase;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -68,7 +69,7 @@ public class PurchaseBuyerController {
|
||||
if (purchaseOrderService.close(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -82,7 +83,7 @@ public class StoreBuyerController {
|
||||
if (storeService.applyFirstStep(storeCompanyDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "申请店铺第二步-填写银行信息")
|
||||
@ -91,7 +92,7 @@ public class StoreBuyerController {
|
||||
if (storeService.applySecondStep(storeBankDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "申请店铺第三步-填写其他信息")
|
||||
@ -100,7 +101,7 @@ public class StoreBuyerController {
|
||||
if (storeService.applyThirdStep(storeOtherInfoDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前登录会员的店铺信息-入驻店铺")
|
||||
|
@ -155,7 +155,7 @@ public class CartController {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.CART_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.CART_ERROR);
|
||||
throw new ServiceException(ResultCode.CART_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,10 +172,10 @@ public class CartController {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} catch (ServiceException se) {
|
||||
log.error(ResultCode.SHIPPING_NOT_APPLY.message(), se);
|
||||
return ResultUtil.error(ResultCode.SHIPPING_NOT_APPLY);
|
||||
throw new ServiceException(ResultCode.SHIPPING_NOT_APPLY);
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.CART_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.CART_ERROR);
|
||||
throw new ServiceException(ResultCode.CART_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public class CartController {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.CART_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.CART_ERROR);
|
||||
throw new ServiceException(ResultCode.CART_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,9 +232,9 @@ public class CartController {
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.ORDER_ERROR.message(), e);
|
||||
if (e.getMessage().equals(ResultCode.SHIPPING_NOT_APPLY.message())) {
|
||||
return ResultUtil.error(ResultCode.SHIPPING_NOT_APPLY);
|
||||
throw new ServiceException(ResultCode.SHIPPING_NOT_APPLY);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ORDER_ERROR);
|
||||
throw new ServiceException(ResultCode.ORDER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -16,7 +17,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
@ -66,11 +66,11 @@ public class OrderBuyerController {
|
||||
public ResultMessage<Object> receiving(@NotNull(message = "订单编号不能为空") @PathVariable("orderSn") String orderSn) {
|
||||
Order order = orderService.getBySn(orderSn);
|
||||
if (order == null) {
|
||||
return ResultUtil.error(ResultCode.ORDER_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.ORDER_NOT_EXIST);
|
||||
}
|
||||
//判定是否是待收货状态
|
||||
if (!order.getOrderStatus().equals(OrderStatusEnum.DELIVERED.name())) {
|
||||
return ResultUtil.error(ResultCode.ORDER_DELIVERED_ERROR);
|
||||
throw new ServiceException(ResultCode.ORDER_DELIVERED_ERROR);
|
||||
}
|
||||
orderService.complete(orderSn);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -82,7 +83,7 @@ public class OrderComplaintBuyerController {
|
||||
return ResultUtil.data(communicationVO);
|
||||
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消售后")
|
||||
@ -92,7 +93,7 @@ public class OrderComplaintBuyerController {
|
||||
if (orderComplaintService.cancel(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.common;
|
||||
|
||||
import cn.lili.common.aop.limiter.annotation.LimitPoint;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.sms.SmsUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.verification.enums.VerificationEnums;
|
||||
@ -46,7 +47,7 @@ public class SmsController {
|
||||
smsUtil.sendSmsCode(mobile, verificationEnums, uuid);
|
||||
return ResultUtil.success(ResultCode.VERIFICATION_SEND_SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_SMS_EXPIRED_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_EXPIRED_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class UploadController {
|
||||
newFile.setCreateBy(authUser.getUsername());
|
||||
newFile.setUserEnums(authUser.getRole().name());
|
||||
//如果是店铺,则记录店铺id
|
||||
if (authUser.getRole().equals(UserEnums.STORE.name())) {
|
||||
if (authUser.getRole().equals(UserEnums.STORE)) {
|
||||
newFile.setOwnerId(authUser.getStoreId());
|
||||
} else {
|
||||
newFile.setOwnerId(authUser.getId());
|
||||
@ -96,7 +96,7 @@ public class UploadController {
|
||||
fileService.save(newFile);
|
||||
} catch (Exception e) {
|
||||
log.error("文件上传失败", e);
|
||||
return ResultUtil.error(400, e.toString());
|
||||
throw new ServiceException(ResultCode.OSS_EXCEPTION);
|
||||
}
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ jasypt:
|
||||
|
||||
lili:
|
||||
system:
|
||||
isDemoSite: true
|
||||
isDemoSite: false
|
||||
statistics:
|
||||
# 在线人数统计 X 小时。这里设置48,即统计过去48小时每小时在线人数
|
||||
onlineMember: 48
|
||||
|
@ -13,7 +13,6 @@ import cn.lili.modules.message.service.StoreMessageService;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
@ -59,7 +58,7 @@ public class NoticeSendMessageListener implements RocketMQListener<MessageExt> {
|
||||
List<String> list = memberMapper.getAllMemberMobile();
|
||||
smsUtil.sendBatchSms(smsReachDTO.getSignName(), list, smsReachDTO.getMessageCode());
|
||||
//判断为发送部分用户
|
||||
} else if (smsReachDTO.getSmsRange().equals(RangeEnum.APPOINT.name())) {
|
||||
} else {
|
||||
smsUtil.sendBatchSms(smsReachDTO.getSignName(), smsReachDTO.getMobile(), smsReachDTO.getMessageCode());
|
||||
}
|
||||
break;
|
||||
|
@ -3,12 +3,15 @@ package cn.lili.common.elasticsearch;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.lili.config.elasticsearch.ElasticsearchProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.client.HttpAsyncResponseConsumerFactory;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
@ -16,6 +19,7 @@ import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||
import org.elasticsearch.client.indices.CreateIndexResponse;
|
||||
import org.elasticsearch.client.indices.GetIndexRequest;
|
||||
import org.elasticsearch.client.indices.PutMappingRequest;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
@ -24,6 +28,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* @author paulG
|
||||
@ -84,15 +91,251 @@ public abstract class BaseElasticsearchService {
|
||||
// Settings for this index
|
||||
request.settings(Settings.builder().put("index.number_of_shards", elasticsearchProperties.getIndex().getNumberOfShards()).put("index.number_of_replicas", elasticsearchProperties.getIndex().getNumberOfReplicas()));
|
||||
|
||||
//创建索引
|
||||
CreateIndexResponse createIndexResponse = client.indices().create(request, COMMON_OPTIONS);
|
||||
|
||||
createMapping(index);
|
||||
log.info(" whether all of the nodes have acknowledged the request : {}", createIndexResponse.isAcknowledged());
|
||||
log.info(" Indicates whether the requisite number of shard copies were started for each shard in the index before timing out :{}", createIndexResponse.isShardsAcknowledged());
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ElasticsearchException("创建索引 {" + index + "} 失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void createMapping(String index) throws Exception {
|
||||
String source =
|
||||
" {\n" +
|
||||
" \"properties\": {\n" +
|
||||
" \"_class\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"attrList\": {\n" +
|
||||
" \"type\": \"nested\",\n" +
|
||||
" \"properties\": {\n" +
|
||||
" \"name\": {\n" +
|
||||
" \"type\": \"keyword\"\n" +
|
||||
" },\n" +
|
||||
" \"type\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"value\": {\n" +
|
||||
" \"type\": \"keyword\"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"brandId\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true,\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"buyCount\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"releaseTime\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true, \n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"categoryPath\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true,\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"commentNum\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"goodsId\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"goodsName\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true, \n" +
|
||||
" \"analyzer\": \"ik_max_word\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"grade\": {\n" +
|
||||
" \"type\": \"float\"\n" +
|
||||
" },\n" +
|
||||
" \"highPraiseNum\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"id\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"intro\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"isAuth\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"marketEnable\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true, \n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"mobileIntro\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"point\": {\n" +
|
||||
" \"type\": \"long\"\n" +
|
||||
" },\n" +
|
||||
" \"price\": {\n" +
|
||||
" \"type\": \"float\"\n" +
|
||||
" },\n" +
|
||||
" \"salesModel\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"selfOperated\": {\n" +
|
||||
" \"type\": \"boolean\"\n" +
|
||||
" },\n" +
|
||||
" \"sellerId\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"sellerName\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true, \n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"shopCategoryPath\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fielddata\": true, \n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"sn\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"thumbnail\": {\n" +
|
||||
" \"type\": \"text\",\n" +
|
||||
" \"fields\": {\n" +
|
||||
" \"keyword\": {\n" +
|
||||
" \"type\": \"keyword\",\n" +
|
||||
" \"ignore_above\": 256\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n";
|
||||
|
||||
PutMappingRequest request = new PutMappingRequest(index)
|
||||
.source(source, XContentType.JSON);
|
||||
// AcknowledgedResponse putMappingResponse = client.indices().putMapping(request,
|
||||
// RequestOptions.DEFAULT);
|
||||
//
|
||||
// boolean acknowledged = putMappingResponse.isAcknowledged();
|
||||
// if (acknowledged) {
|
||||
// log.error("Succeed to put mapping");
|
||||
// }
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
AtomicReference response = new AtomicReference<AcknowledgedResponse>();
|
||||
client.indices().putMappingAsync(
|
||||
request,
|
||||
RequestOptions.DEFAULT,
|
||||
new ActionListener<AcknowledgedResponse>() {
|
||||
@Override
|
||||
public void onResponse(AcknowledgedResponse r) {
|
||||
response.set(r);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
latch.await(10, TimeUnit.SECONDS);
|
||||
Assertions.assertThat(((AcknowledgedResponse) response.get()).isAcknowledged()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description: 判断某个index是否存在
|
||||
*
|
||||
|
@ -260,6 +260,7 @@ public enum ResultCode {
|
||||
* OSS
|
||||
*/
|
||||
OSS_NOT_EXIST(80201,"OSS未配置"),
|
||||
OSS_EXCEPTION(80202,"文件上传失败,请稍后重试"),
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
@ -267,7 +268,17 @@ public enum ResultCode {
|
||||
VERIFICATION_SEND_SUCCESS(80301,"短信验证码,发送成功"),
|
||||
VERIFICATION_ERROR(80302,"验证失败"),
|
||||
VERIFICATION_SMS_ERROR(80303,"短信验证码错误,请重新校验"),
|
||||
VERIFICATION_SMS_EXPIRED_ERROR(80304,"验证码已失效,请重新校验")
|
||||
VERIFICATION_SMS_EXPIRED_ERROR(80304,"验证码已失效,请重新校验"),
|
||||
|
||||
/**
|
||||
* 配置错误
|
||||
*/
|
||||
ALIPAY_NOT_SETTING(80401,"支付宝支付未配置"),
|
||||
ALIPAY_EXCEPTION(80402,"支付宝支付错误,请稍后重试"),
|
||||
ALIPAY_PARAMS_EXCEPTION(80403,"支付宝参数异常"),
|
||||
WECHAT_PAY_NOT_SETTING(80402,"微信支付未配置"),
|
||||
|
||||
|
||||
|
||||
;
|
||||
private final Integer code;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.lili.common.exception;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -23,7 +22,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class GlobalControllerExceptionHandler {
|
||||
public class GlobalControllerExceptionHandler {
|
||||
|
||||
/**
|
||||
* 如果超过长度,则前后段交互体验不佳,使用默认错误消息
|
||||
@ -44,9 +43,9 @@ public class GlobalControllerExceptionHandler {
|
||||
|
||||
//如果是自定义异常,则获取异常,返回自定义错误消息
|
||||
if (e instanceof ServiceException) {
|
||||
ResultCode resultCode=((ServiceException) e).getResultCode();
|
||||
ResultCode resultCode = ((ServiceException) e).getResultCode();
|
||||
if (resultCode != null) {
|
||||
return ResultUtil.error(resultCode.code(), resultCode.message());
|
||||
throw new ServiceException(resultCode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +54,7 @@ public class GlobalControllerExceptionHandler {
|
||||
if (e != null && e.getMessage() != null && e.getMessage().length() < MAX_LENGTH) {
|
||||
errorMsg = e.getMessage();
|
||||
}
|
||||
return ResultUtil.error(400, errorMsg);
|
||||
throw new ServiceException(ResultCode.ERROR, errorMsg);
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ -64,7 +63,7 @@ public class GlobalControllerExceptionHandler {
|
||||
|
||||
log.error("全局异常[RuntimeException]:", e);
|
||||
|
||||
return ResultUtil.error(400, "服务器异常,请稍后重试");
|
||||
throw new ServiceException(ResultCode.ERROR, "服务器异常,请稍后重试");
|
||||
}
|
||||
|
||||
// /**
|
||||
@ -101,9 +100,9 @@ public class GlobalControllerExceptionHandler {
|
||||
BindException exception = (BindException) e;
|
||||
List<FieldError> fieldErrors = exception.getBindingResult().getFieldErrors();
|
||||
for (FieldError error : fieldErrors) {
|
||||
return ResultUtil.error(400,error.getDefaultMessage());
|
||||
throw new ServiceException(ResultCode.ERROR, error.getDefaultMessage());
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,4 +27,9 @@ public class ServiceException extends RuntimeException {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public ServiceException(ResultCode resultCode, String message) {
|
||||
this.resultCode = resultCode;
|
||||
this.msg = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司",mobile, params, "SMS_205755300");
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司", mobile, params, "SMS_205755300");
|
||||
break;
|
||||
}
|
||||
case UPDATE_PASSWORD: {
|
||||
@ -79,7 +79,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
cache.put(cacheKey(verificationEnums, memberMobile, uuid), code, 300L);
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司",mobile, params, "SMS_205755297");
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司", mobile, params, "SMS_205755297");
|
||||
break;
|
||||
}
|
||||
//如果不是有效的验证码手段,则此处不进行短信操作
|
||||
@ -112,7 +112,6 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
.setTemplateParam(JSONUtil.toJsonStr(param));
|
||||
try {
|
||||
SendSmsResponse response = client.sendSms(sendSmsRequest);
|
||||
System.out.println(response.getBody().getCode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -123,8 +122,9 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
|
||||
com.aliyun.dysmsapi20170525.Client client = this.createClient();
|
||||
|
||||
List<String> sign = mobile;
|
||||
List<String> sign = new ArrayList<String>();
|
||||
|
||||
sign.addAll(mobile);
|
||||
sign.replaceAll(e -> signName);
|
||||
|
||||
//手机号拆成多个小组进行发送
|
||||
@ -140,7 +140,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
signNameList.add(sign.subList((i * 100), endPoint));
|
||||
}
|
||||
|
||||
//发送短信
|
||||
// //发送短信
|
||||
for (int i = 0; i < mobileList.size(); i++) {
|
||||
SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest()
|
||||
.setPhoneNumberJson(JSONUtil.toJsonStr(mobileList.get(i)))
|
||||
@ -160,23 +160,24 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
public void addSmsSign(SmsSign smsSign) throws Exception {
|
||||
//设置参数添加短信签名
|
||||
com.aliyun.dysmsapi20170525.Client client = this.createClient();
|
||||
|
||||
System.out.println(smsSign.getBusinessLicense().substring(smsSign.getBusinessLicense().lastIndexOf(".") + 1));
|
||||
System.out.println(smsSign.getLicense().substring(smsSign.getLicense().lastIndexOf(".")));
|
||||
//营业执照
|
||||
AddSmsSignRequest.AddSmsSignRequestSignFileList signFileList0 = new AddSmsSignRequest.AddSmsSignRequestSignFileList()
|
||||
.setFileContents(Base64Utils.encode(smsSign.getBusinessLicense()))
|
||||
.setFileSuffix(smsSign.getBusinessLicense().substring(smsSign.getBusinessLicense().lastIndexOf(".") + 1));
|
||||
//授权委托书
|
||||
// AddSmsSignRequest.AddSmsSignRequestSignFileList signFileList1 = new AddSmsSignRequest.AddSmsSignRequestSignFileList()
|
||||
// .setFileContents(Base64Utils.encode(smsSign.getLicense()))
|
||||
// .setFileSuffix(smsSign.getLicense().substring(smsSign.getLicense().lastIndexOf(".") + 1));
|
||||
AddSmsSignRequest.AddSmsSignRequestSignFileList signFileList1 = new AddSmsSignRequest.AddSmsSignRequestSignFileList()
|
||||
.setFileContents(Base64Utils.encode(smsSign.getLicense()))
|
||||
.setFileSuffix(smsSign.getLicense().substring(smsSign.getLicense().lastIndexOf(".")) + 1);
|
||||
//添加短信签名
|
||||
AddSmsSignRequest addSmsSignRequest = new AddSmsSignRequest()
|
||||
.setSignName(smsSign.getSignName())
|
||||
.setSignSource(smsSign.getSignSource())
|
||||
.setRemark(smsSign.getRemark())
|
||||
.setSignFileList(java.util.Arrays.asList(
|
||||
signFileList0
|
||||
signFileList0,
|
||||
signFileList1
|
||||
));
|
||||
AddSmsSignResponse response = client.addSmsSign(addSmsSignRequest);
|
||||
if (!response.getBody().getCode().equals("OK")) {
|
||||
|
@ -17,10 +17,6 @@ public class ResultUtil<T> {
|
||||
* 正常响应
|
||||
*/
|
||||
private static final Integer SUCCESS = 200;
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
private static final Integer ERROR = 400;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,30 +40,6 @@ public class ResultUtil<T> {
|
||||
return this.resultMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器异常 追加状态码
|
||||
*
|
||||
* @param resultCode 返回码
|
||||
*/
|
||||
public ResultMessage<T> setErrorMsg(ResultCode resultCode) {
|
||||
this.resultMessage.setSuccess(false);
|
||||
this.resultMessage.setMessage(resultCode.message());
|
||||
this.resultMessage.setCode(resultCode.code());
|
||||
return this.resultMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器异常 追加状态码
|
||||
* @param code 状态码
|
||||
* @param msg 返回消息
|
||||
*/
|
||||
public ResultMessage<T> setErrorMsg(Integer code, String msg) {
|
||||
this.resultMessage.setSuccess(false);
|
||||
this.resultMessage.setMessage(msg);
|
||||
this.resultMessage.setCode(code);
|
||||
return this.resultMessage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
@ -95,20 +67,4 @@ public class ResultUtil<T> {
|
||||
public static <T> ResultMessage<T> success(ResultCode resultCode) {
|
||||
return new ResultUtil<T>().setSuccessMsg(resultCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败
|
||||
* @param resultCode 返回状态码
|
||||
*/
|
||||
public static <T> ResultMessage<T> error(ResultCode resultCode) {
|
||||
return new ResultUtil<T>().setErrorMsg(resultCode);
|
||||
}
|
||||
/**
|
||||
* 返回失败
|
||||
* @param code 状态码
|
||||
* @param msg 返回消息
|
||||
*/
|
||||
public static <T> ResultMessage<T> error(Integer code, String msg) {
|
||||
return new ResultUtil<T>().setErrorMsg(code, msg);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class VueCodeGenerator {
|
||||
try {
|
||||
result = generateClassData(path);
|
||||
} catch (Exception e) {
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.lili.modules.connect.util;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.cache.CachePrefix;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.token.Token;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -27,7 +28,6 @@ import cn.lili.modules.system.entity.dto.connect.dto.QQConnectSettingItem;
|
||||
import cn.lili.modules.system.entity.dto.connect.dto.WechatConnectSettingItem;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -83,12 +83,12 @@ public class ConnectUtil {
|
||||
token = connectService.unionLoginCallback(type, authUser, callback.getState());
|
||||
resultMessage = ResultUtil.data(token);
|
||||
} catch (ServiceException e) {
|
||||
resultMessage = ResultUtil.error(400,e.getMessage());
|
||||
throw new ServiceException(ResultCode.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
//否则录入响应结果,等待前端获取信息
|
||||
else {
|
||||
resultMessage = ResultUtil.error(400,response.getMsg());
|
||||
throw new ServiceException(ResultCode.ERROR, response.getMsg());
|
||||
}
|
||||
//缓存写入登录结果,300秒有效
|
||||
cache.put(CachePrefix.CONNECT_RESULT.getPrefix() + callback.getCode(), resultMessage, 300L);
|
||||
|
@ -601,7 +601,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
sku.setThumbnail(thumbnail);
|
||||
|
||||
//规格信息
|
||||
sku.setId(map.getOrDefault("id", "").toString());
|
||||
sku.setId(Convert.toStr(map.get("id"),"").toString());
|
||||
sku.setSn(Convert.toStr(map.get("sn")));
|
||||
sku.setWeight(Convert.toDouble(map.get("weight"), 0D));
|
||||
sku.setPrice(Convert.toDouble(map.get("price"), 0D));
|
||||
|
@ -115,7 +115,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
|
||||
@Override
|
||||
public Token usernameLogin(String username, String password) {
|
||||
Member member = this.findByUsername(username);
|
||||
Member member = this.findMember(username);
|
||||
//判断用户是否存在
|
||||
if (member == null || !member.getDisabled()) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
@ -131,7 +131,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
@Override
|
||||
public Token usernameStoreLogin(String username, String password) {
|
||||
|
||||
Member member = this.findByUsername(username);
|
||||
Member member = this.findMember(username);
|
||||
//判断用户是否存在
|
||||
if (member == null || !member.getDisabled()) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
@ -153,6 +153,18 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
return storeTokenGenerate.createToken(member.getUsername(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 传递手机号或者用户名
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
private Member findMember(String userName) {
|
||||
QueryWrapper<Member> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("username", userName).or().eq("mobile", userName);
|
||||
return memberMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Token autoRegister(ConnectAuthUser authUser) {
|
||||
|
||||
@ -344,7 +356,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getMobile()), "mobile", memberSearchVO.getMobile());
|
||||
//按照会员状态查询
|
||||
queryWrapper.eq(StringUtils.isNotBlank(memberSearchVO.getDisabled()), "disabled",
|
||||
memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name())?1:0);
|
||||
memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name()) ? 1 : 0);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return this.page(PageUtil.initPage(page), queryWrapper);
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import cn.lili.modules.message.entity.dto.SmsReachDTO;
|
||||
import cn.lili.modules.message.mapper.SmsReachMapper;
|
||||
import cn.lili.modules.message.service.SmsReachService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -40,7 +39,7 @@ public class SmsReachServiceImpl extends ServiceImpl<SmsReachMapper, SmsReach> i
|
||||
BeanUtil.copyProperties(smsReach,smsReachDTO);
|
||||
smsReachDTO.setMobile(mobile);
|
||||
this.save(smsReach);
|
||||
//发送订单变更mq消息
|
||||
//发送短信批量发送mq消息
|
||||
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(smsReachDTO), RocketmqSendCallbackBuilder.commonCallback());
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.lili.modules.message.serviceimpl;
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.sms.AliSmsUtil;
|
||||
@ -13,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -71,7 +69,6 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
|
||||
//查询签名状态
|
||||
for (SmsSign smsSign : list) {
|
||||
map = aliSmsUtil.querySmsSign(smsSign.getSignName());
|
||||
|
||||
smsSign.setSignStatus((Integer) map.get("SignStatus"));
|
||||
smsSign.setReason(map.get("Reason").toString());
|
||||
this.updateById(smsSign);
|
||||
|
@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -65,7 +64,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
|
||||
List<SmsTemplate> list = list(new LambdaQueryWrapper<SmsTemplate>().eq(SmsTemplate::getTemplateStatus, 0));
|
||||
//查询签名状态
|
||||
for (SmsTemplate smsTemplate : list) {
|
||||
map = aliSmsUtil.querySmsTemplate(smsTemplate.getTemplateName());
|
||||
map = aliSmsUtil.querySmsTemplate(smsTemplate.getTemplateCode());
|
||||
smsTemplate.setTemplateStatus((Integer) map.get("TemplateStatus"));
|
||||
smsTemplate.setReason(map.get("Reason").toString());
|
||||
smsTemplate.setTemplateCode(map.get("TemplateCode").toString());
|
||||
|
@ -24,6 +24,10 @@ public enum ArticleEnum {
|
||||
* 证照信息
|
||||
*/
|
||||
LICENSE_INFORMATION,
|
||||
/**
|
||||
* 店铺入驻
|
||||
*/
|
||||
STORE_REGISTER,
|
||||
/**
|
||||
* 其他文章
|
||||
*/
|
||||
|
@ -69,4 +69,12 @@ public interface ArticleService extends IService<Article> {
|
||||
*/
|
||||
@Cacheable(key = "#type")
|
||||
Article customGetByType(String type);
|
||||
|
||||
/**
|
||||
* 修改文章状态
|
||||
* @param id 文章ID
|
||||
* @param status 显示状态
|
||||
*/
|
||||
@CacheEvict(key = "#id")
|
||||
Boolean updateArticleStatus(String id,boolean status);
|
||||
}
|
@ -3,6 +3,7 @@ package cn.lili.modules.page.serviceimpl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
@ -78,4 +79,11 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateArticleStatus(String id, boolean status) {
|
||||
Article article=this.getById(id);
|
||||
article.setOpenStatus(status? SwitchEnum.OPEN.name():SwitchEnum.CLOSE.name());
|
||||
return this.updateById(article);
|
||||
}
|
||||
}
|
@ -71,7 +71,7 @@ public class AliPayPlugin implements Payment {
|
||||
CashierParam cashierParam = cashierSupport.cashierParam(payParam);
|
||||
//请求订单编号
|
||||
String outTradeNo = SnowFlake.getIdStr();
|
||||
|
||||
//准备支付参数
|
||||
AlipayTradeWapPayModel payModel = new AlipayTradeWapPayModel();
|
||||
payModel.setBody(cashierParam.getTitle());
|
||||
payModel.setSubject(cashierParam.getDetail());
|
||||
@ -86,7 +86,8 @@ public class AliPayPlugin implements Payment {
|
||||
AliPayRequest.wapPay(response, payModel, callbackUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY),
|
||||
notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("H5支付异常", e);
|
||||
throw new ServiceException(ResultCode.ALIPAY_EXCEPTION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -121,8 +122,11 @@ public class AliPayPlugin implements Payment {
|
||||
String orderInfo = AliPayRequest.appPayToResponse(payModel, notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY)).getBody();
|
||||
return ResultUtil.data(orderInfo);
|
||||
} catch (AlipayApiException e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
log.error("支付宝支付异常:", e);
|
||||
throw new ServiceException(ResultCode.ALIPAY_EXCEPTION);
|
||||
} catch (Exception e) {
|
||||
log.error("支付业务异常:", e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,9 +155,9 @@ public class AliPayPlugin implements Payment {
|
||||
JSONObject jsonObject = JSONObject.parseObject(resultStr);
|
||||
return ResultUtil.data(jsonObject.getJSONObject("alipay_trade_precreate_response").getString("qr_code"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("支付业务异常:", e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -169,6 +173,7 @@ public class AliPayPlugin implements Payment {
|
||||
model.setRefundAmount(refundLog.getTotalAmount() + "");
|
||||
model.setRefundReason(refundLog.getRefundReason());
|
||||
model.setOutRequestNo(refundLog.getOutOrderNo());
|
||||
//交互退款
|
||||
try {
|
||||
AlipayTradeRefundResponse alipayTradeRefundResponse = AliPayApi.tradeRefundToResponse(model);
|
||||
log.error("支付宝退款,参数:{},支付宝响应:{}", JSONUtil.toJsonStr(model), JSONUtil.toJsonStr(alipayTradeRefundResponse));
|
||||
@ -180,7 +185,8 @@ public class AliPayPlugin implements Payment {
|
||||
}
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("支付退款异常:", e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -192,9 +198,11 @@ public class AliPayPlugin implements Payment {
|
||||
if (StringUtils.isNotEmpty(refundLog.getPaymentReceivableNo())) {
|
||||
model.setTradeNo(refundLog.getPaymentReceivableNo());
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
log.error("退款时,支付参数为空导致异常:{}", refundLog);
|
||||
throw new ServiceException(ResultCode.ALIPAY_PARAMS_EXCEPTION);
|
||||
}
|
||||
try {
|
||||
//与阿里进行交互
|
||||
AlipayTradeCancelResponse alipayTradeCancelResponse = AliPayApi.tradeCancelToResponse(model);
|
||||
if (alipayTradeCancelResponse.isSuccess()) {
|
||||
refundLog.setIsRefund(true);
|
||||
@ -204,7 +212,7 @@ public class AliPayPlugin implements Payment {
|
||||
}
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("支付宝退款异常",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,8 +264,7 @@ public class AliPayPlugin implements Payment {
|
||||
log.info("支付回调通知:支付失败-参数:{}", map);
|
||||
}
|
||||
} catch (AlipayApiException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("支付回调通知异常");
|
||||
log.error("支付回调通知异常", e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -272,7 +279,7 @@ public class AliPayPlugin implements Payment {
|
||||
if (setting != null) {
|
||||
return JSONUtil.toBean(setting.getSettingValue(), AlipayPaymentSetting.class);
|
||||
}
|
||||
throw new ServiceException("支付未配置");
|
||||
throw new ServiceException(ResultCode.ALIPAY_NOT_SETTING);
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(JSONUtil.toJsonStr(response.getBody()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,10 +206,10 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,10 +269,10 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,14 +324,14 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(new JSONObject(response.getBody()).getStr("code_url"));
|
||||
} else {
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,10 +407,10 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import org.elasticsearch.search.SearchHit;
|
||||
import org.mybatis.spring.MyBatisSystemException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@ -61,6 +62,8 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
||||
private GoodsWordsService goodsWordsService;
|
||||
@Autowired
|
||||
private PromotionService promotionService;
|
||||
@Autowired
|
||||
private ElasticsearchRestTemplate elasticsearchRestTemplate;
|
||||
|
||||
@Override
|
||||
public void addIndex(EsGoodsIndex goods) {
|
||||
@ -149,7 +152,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
|
||||
public void initIndex(List<EsGoodsIndex> goodsIndexList) {
|
||||
//索引名称拼接
|
||||
String indexName = elasticsearchProperties.getIndexPrefix() + "_" + EsSuffix.GOODS_INDEX_NAME;
|
||||
// deleteIndexRequest(indexName);
|
||||
|
||||
//如果索引不存在,则创建索引
|
||||
if (!indexExist(indexName)) {
|
||||
createIndexRequest(indexName);
|
||||
|
@ -82,7 +82,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getKeyword())) {
|
||||
cache.incrementScore(HotWordsRedisKeyEnum.SEARCH_HOT_WORD.name(), searchDTO.getKeyword());
|
||||
}
|
||||
NativeSearchQueryBuilder searchQueryBuilder = createSearchQueryBuilder(searchDTO, pageVo, false);
|
||||
NativeSearchQueryBuilder searchQueryBuilder = createSearchQueryBuilder(searchDTO, pageVo, true);
|
||||
NativeSearchQuery searchQuery = searchQueryBuilder.build();
|
||||
log.info("searchGoods DSL:{}", searchQuery.getQuery());
|
||||
|
||||
@ -260,10 +260,14 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
//分页
|
||||
nativeSearchQueryBuilder.withPageable(pageable);
|
||||
}
|
||||
//查询参数非空判定
|
||||
if (searchDTO != null) {
|
||||
//过滤条件
|
||||
BoolQueryBuilder filterBuilder = QueryBuilders.boolQuery();
|
||||
//查询条件
|
||||
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
|
||||
|
||||
//对查询条件进行处理
|
||||
this.commonSearch(filterBuilder, queryBuilder, searchDTO, isAggregation);
|
||||
|
||||
// 未上架的商品不显示
|
||||
@ -279,6 +283,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
this.keywordSearch(filterBuilder, queryBuilder, searchDTO.getKeyword(), isAggregation);
|
||||
}
|
||||
|
||||
//如果是聚合查询
|
||||
if (isAggregation) {
|
||||
nativeSearchQueryBuilder.withQuery(filterBuilder);
|
||||
} else {
|
||||
@ -297,23 +302,36 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
return nativeSearchQueryBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询属性处理
|
||||
* @param filterBuilder
|
||||
* @param queryBuilder
|
||||
* @param searchDTO
|
||||
* @param isAggregation
|
||||
*/
|
||||
private void commonSearch(BoolQueryBuilder filterBuilder, BoolQueryBuilder queryBuilder, EsGoodsSearchDTO searchDTO, boolean isAggregation) {
|
||||
//品牌判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getBrandId())) {
|
||||
String[] brands = searchDTO.getBrandId().split("@");
|
||||
filterBuilder.must(QueryBuilders.termsQuery("brandId", brands));
|
||||
}
|
||||
//规格项判定
|
||||
if (searchDTO.getNameIds() != null && !searchDTO.getNameIds().isEmpty()) {
|
||||
filterBuilder.must(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.termsQuery("attrList.nameId", searchDTO.getNameIds()), ScoreMode.None));
|
||||
}
|
||||
//分类判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getCategoryId())) {
|
||||
filterBuilder.must(QueryBuilders.wildcardQuery("categoryPath", "*" + searchDTO.getCategoryId() + "*"));
|
||||
}
|
||||
//店铺分类判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getStoreCatId())) {
|
||||
filterBuilder.must(QueryBuilders.wildcardQuery("storeCategoryPath", "*" + searchDTO.getStoreCatId() + "*"));
|
||||
}
|
||||
//店铺判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getStoreId())) {
|
||||
filterBuilder.filter(QueryBuilders.termQuery("storeId", searchDTO.getStoreId()));
|
||||
}
|
||||
//属性判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getProp())) {
|
||||
String[] props = searchDTO.getProp().split("@");
|
||||
List<String> nameList = new ArrayList<>();
|
||||
@ -340,6 +358,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
searchDTO.getNotShowCol().put(ATTR_NAME_KEY, nameList);
|
||||
searchDTO.getNotShowCol().put(ATTR_VALUE_KEY, valueList);
|
||||
}
|
||||
//价格区间判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getPrice())) {
|
||||
String[] prices = searchDTO.getPrice().split("_");
|
||||
if(prices.length==0){
|
||||
@ -355,20 +374,33 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字查询处理
|
||||
* @param filterBuilder
|
||||
* @param queryBuilder
|
||||
* @param keyword
|
||||
* @param isAggregation
|
||||
*/
|
||||
private void keywordSearch(BoolQueryBuilder filterBuilder, BoolQueryBuilder queryBuilder, String keyword, boolean isAggregation) {
|
||||
List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
|
||||
//商品名字匹配
|
||||
filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.wildcardQuery("goodsName", "*" + keyword + "*"),
|
||||
ScoreFunctionBuilders.weightFactorFunction(10)));
|
||||
//属性匹配
|
||||
filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.wildcardQuery(ATTR_VALUE, "*" + keyword + "*"), ScoreMode.None),
|
||||
ScoreFunctionBuilders.weightFactorFunction(8)));
|
||||
|
||||
FunctionScoreQueryBuilder.FilterFunctionBuilder[] builders = new FunctionScoreQueryBuilder.FilterFunctionBuilder[filterFunctionBuilders.size()];
|
||||
filterFunctionBuilders.toArray(builders);
|
||||
FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(builders)
|
||||
.scoreMode(FunctionScoreQuery.ScoreMode.SUM)
|
||||
.setMinScore(2);
|
||||
//聚合搜索则将结果放入过滤条件
|
||||
if (isAggregation) {
|
||||
filterBuilder.must(functionScoreQueryBuilder);
|
||||
} else {
|
||||
}
|
||||
//否则放入查询条件
|
||||
else {
|
||||
queryBuilder.must(functionScoreQueryBuilder);
|
||||
}
|
||||
}
|
||||
|
@ -21,15 +21,17 @@ public class StoreCompanyDTO {
|
||||
@ApiModelProperty(value = "公司名称")
|
||||
private String companyName;
|
||||
|
||||
@Size(min = 2, max = 100)
|
||||
@NotBlank(message = "地址不能为空")
|
||||
@ApiModelProperty(value = "地址名称, ','分割")
|
||||
private String addressPath;
|
||||
private String storeAddressPath;
|
||||
|
||||
@Size(min = 2, max = 100)
|
||||
@NotBlank(message = "地址ID不能为空")
|
||||
@ApiModelProperty(value = "地址id,','分割 ")
|
||||
private String addressIdPath;
|
||||
private String storeAddressIdPath;
|
||||
|
||||
@NotBlank(message = "地址详情")
|
||||
@ApiModelProperty(value = "地址详情")
|
||||
private String storeAddressDetail;
|
||||
|
||||
@Size(min = 1, max = 200)
|
||||
@NotBlank(message = "公司地址不能为空")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -12,7 +13,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -48,7 +48,7 @@ public class DistributionManagerController {
|
||||
if (distributionService.retreat(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class DistributionManagerController {
|
||||
if (distributionService.resume(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class DistributionManagerController {
|
||||
if (distributionService.audit(id, status)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_AUDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_AUDIT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Brand;
|
||||
@ -15,7 +15,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -67,7 +66,7 @@ public class BrandManagerController {
|
||||
if (brandService.addBrand(brand)) {
|
||||
return ResultUtil.data(brand);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.BRAND_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@ -78,7 +77,7 @@ public class BrandManagerController {
|
||||
if (brandService.updateBrand(brand)) {
|
||||
return ResultUtil.data(brand);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.BRAND_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "后台禁用品牌")
|
||||
@ -91,7 +90,7 @@ public class BrandManagerController {
|
||||
if (brandService.brandDisable(brandId, disable)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_DISABLE_ERROR);
|
||||
throw new ServiceException(ResultCode.BRAND_DISABLE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -12,7 +13,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -67,22 +67,22 @@ public class CategoryManagerController {
|
||||
category1.setName(category.getName());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
// 非顶级分类
|
||||
if (category.getParentId() != null && !category.getParentId().equals("0")) {
|
||||
Category parent = categoryService.getById(category.getParentId());
|
||||
if (parent == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
if (category.getLevel() >= 4) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_BEYOND_THREE);
|
||||
throw new ServiceException(ResultCode.CATEGORY_BEYOND_THREE);
|
||||
}
|
||||
}
|
||||
if (categoryService.saveCategory(category)) {
|
||||
return ResultUtil.data(category);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.CATEGORY_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -90,7 +90,7 @@ public class CategoryManagerController {
|
||||
public ResultMessage<Category> updateCategory(CategoryVO category) {
|
||||
Category catTemp = categoryService.getById(category.getId());
|
||||
if (catTemp == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
//不能添加重复的分类名称
|
||||
Category category1 = new Category();
|
||||
@ -98,7 +98,7 @@ public class CategoryManagerController {
|
||||
category1.setId(category.getId());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NAME_IS_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NAME_IS_EXIST);
|
||||
}
|
||||
|
||||
categoryService.updateCategory(category);
|
||||
@ -113,13 +113,13 @@ public class CategoryManagerController {
|
||||
category.setParentId(id);
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_HAS_CHILDREN);
|
||||
throw new ServiceException(ResultCode.CATEGORY_HAS_CHILDREN);
|
||||
|
||||
}
|
||||
// 查询某商品分类的商品数量
|
||||
Integer count = goodsService.getGoodsCountByCategory(id);
|
||||
if (count > 0) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_HAS_GOODS);
|
||||
throw new ServiceException(ResultCode.CATEGORY_HAS_GOODS);
|
||||
}
|
||||
categoryService.delete(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
@ -134,7 +134,7 @@ public class CategoryManagerController {
|
||||
|
||||
Category category = categoryService.getById(id);
|
||||
if (category == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
categoryService.updateCategoryStatus(id, enableOperations);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||
@ -12,7 +13,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -55,7 +55,7 @@ public class CategoryParameterGroupManagerController {
|
||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARAMETER_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARAMETER_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@ -65,7 +65,7 @@ public class CategoryParameterGroupManagerController {
|
||||
if (categoryParameterGroupService.updateById(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARAMETER_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARAMETER_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数组")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Goods;
|
||||
@ -71,7 +72,7 @@ public class GoodsManagerController {
|
||||
if (Boolean.TRUE.equals(goodsService.updateGoodsMarketAble(goodsIds, GoodsStatusEnum.DOWN, reason))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_UNDER_ERROR);
|
||||
throw new ServiceException(ResultCode.GOODS_UNDER_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "管理员审核商品", notes = "管理员审核商品")
|
||||
@ -85,7 +86,7 @@ public class GoodsManagerController {
|
||||
if (goodsService.auditGoods(goodsIds, GoodsAuthEnum.valueOf(isAuth))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_AUTH_ERROR);
|
||||
throw new ServiceException(ResultCode.GOODS_AUTH_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +99,7 @@ public class GoodsManagerController {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "")) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_UPPER_ERROR);
|
||||
throw new ServiceException(ResultCode.GOODS_UPPER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.Parameters;
|
||||
@ -34,7 +35,7 @@ public class ParameterManagerController {
|
||||
if (parametersService.save(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PARAMETER_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.PARAMETER_SAVE_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -45,7 +46,7 @@ public class ParameterManagerController {
|
||||
if (parametersService.updateById(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PARAMETER_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.PARAMETER_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -14,7 +15,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -68,7 +68,7 @@ public class SpecificationManagerController {
|
||||
if (specificationService.updateSpecification(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.SPEC_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.SPEC_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ -80,7 +80,7 @@ public class SpecificationManagerController {
|
||||
if (specificationService.addSpecification(parameters) != null) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.SPEC_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.SPEC_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -10,7 +11,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -42,7 +42,7 @@ public class MemberAddressManagerController {
|
||||
if (memberAddressService.removeMemberAddress(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改会员收件地址")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -13,7 +14,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -57,7 +57,7 @@ public class MemberEvaluationManagerController {
|
||||
if (memberEvaluationService.updateStatus(id, status)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除评论")
|
||||
@ -67,7 +67,7 @@ public class MemberEvaluationManagerController {
|
||||
if (memberEvaluationService.delete(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -71,7 +72,7 @@ public class MemberManagerController {
|
||||
if (memberService.updateMemberStatus(memberIds, disabled)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -10,7 +11,6 @@ import cn.lili.modules.member.service.MemberNoticeLogService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -56,7 +56,7 @@ public class MemberNoticeLogManagerController {
|
||||
if (memberNoticeLogService.saveOrUpdate(memberNoticeLog)) {
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -11,7 +12,6 @@ import cn.lili.modules.member.service.MemberNoticeSenterService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -61,7 +61,7 @@ public class MemberNoticeSenterManagerController {
|
||||
if (memberNoticeSenterService.customSave(memberNoticeSenter)) {
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.ArticleCategory;
|
||||
@ -75,6 +76,6 @@ public class ArticleCategoryManagerController {
|
||||
if (articleCategoryService.deleteById(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.Article;
|
||||
@ -13,7 +14,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -46,8 +46,8 @@ public class ArticleManagerController {
|
||||
|
||||
@ApiOperation(value = "分页获取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", dataType = "String", paramType = "query"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", dataType = "String", paramType = "query")
|
||||
@ApiImplicitParam(name = "categoryId", value = "文章分类ID", paramType = "query"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", paramType = "query")
|
||||
})
|
||||
@GetMapping(value = "/getByPage")
|
||||
public ResultMessage<IPage<ArticleVO>> getByPage(ArticleSearchParams articleSearchParams) {
|
||||
@ -63,13 +63,27 @@ public class ArticleManagerController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path")
|
||||
@PutMapping("update/{id}")
|
||||
public ResultMessage<Article> update(@Valid Article article, @PathVariable("id") String id) {
|
||||
article.setId(id);
|
||||
return ResultUtil.data(articleService.updateArticle(article));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改文章状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, paramType = "path"),
|
||||
@ApiImplicitParam(name = "status", value = "操作状态", required = true, paramType = "query")
|
||||
})
|
||||
@PutMapping("update/status/{id}")
|
||||
public ResultMessage<Article> updateStatus(@PathVariable("id") String id,boolean status) {
|
||||
if(articleService.updateArticleStatus(id,status)){
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping(value = "/delByIds/{id}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -40,7 +41,7 @@ public class CustomWordsManagerController {
|
||||
if (customWordsService.addCustomWords(customWords)) {
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改自定义分词")
|
||||
@ -49,7 +50,7 @@ public class CustomWordsManagerController {
|
||||
if (customWordsService.updateCustomWords(customWords)) {
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除自定义分词")
|
||||
@ -59,7 +60,7 @@ public class CustomWordsManagerController {
|
||||
if (customWordsService.deleteCustomWords(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取自定义分词")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -52,7 +53,7 @@ public class SensitiveWordsManagerController {
|
||||
SensitiveWordsFilter.put(sensitiveWords.getSensitiveWord());
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改敏感词")
|
||||
@ -64,7 +65,7 @@ public class SensitiveWordsManagerController {
|
||||
SensitiveWordsFilter.put(sensitiveWords.getSensitiveWord());
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -47,7 +46,7 @@ public class SpecialManagerController {
|
||||
if (specialService.updateById(special)) {
|
||||
return ResultUtil.data(special);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除专题活动")
|
||||
@ -57,8 +56,7 @@ public class SpecialManagerController {
|
||||
if(specialService.removeSpecial(id)){
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页获取专题活动")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -58,7 +59,7 @@ public class VerificationSourceController {
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -69,7 +70,7 @@ public class VerificationSourceController {
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.token.Token;
|
||||
@ -74,7 +75,7 @@ public class AdminUserManagerController {
|
||||
adminUser.setPassword(null);
|
||||
return ResultUtil.data(adminUser);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/edit")
|
||||
@ -88,11 +89,11 @@ public class AdminUserManagerController {
|
||||
adminUserDB.setAvatar(adminUser.getAvatar());
|
||||
adminUserDB.setNickName(adminUser.getNickName());
|
||||
if (!adminUserService.updateById(adminUserDB)) {
|
||||
return ResultUtil.error(ResultCode.USER_EDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/admin/edit")
|
||||
@ -100,7 +101,7 @@ public class AdminUserManagerController {
|
||||
public ResultMessage<Object> edit(AdminUser adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
if (!adminUserService.updateAdminUser(adminUser, roles)) {
|
||||
return ResultUtil.error(ResultCode.USER_EDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
@ -143,7 +144,7 @@ public class AdminUserManagerController {
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
try {
|
||||
if (roles != null && roles.size() >= 10) {
|
||||
return ResultUtil.error(ResultCode.PERMISSION_BEYOND_TEN);
|
||||
throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN);
|
||||
}
|
||||
adminUserService.saveAdminUser(adminUser, roles);
|
||||
} catch (Exception e) {
|
||||
@ -157,7 +158,7 @@ public class AdminUserManagerController {
|
||||
public ResultMessage<Object> disable(@ApiParam("用户唯一id标识") @PathVariable String userId, Boolean status) {
|
||||
AdminUser user = adminUserService.getById(userId);
|
||||
if (user == null) {
|
||||
return ResultUtil.error(ResultCode.USER_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
user.setStatus(status);
|
||||
adminUserService.updateById(user);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -10,7 +11,6 @@ import cn.lili.modules.permission.entity.vo.DepartmentVO;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -51,7 +51,7 @@ public class DepartmentManagerController {
|
||||
if (departmentService.save(department)) {
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -60,7 +60,7 @@ public class DepartmentManagerController {
|
||||
if (departmentService.updateById(department)) {
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.entity.dos.DepartmentRole;
|
||||
import cn.lili.modules.permission.service.DepartmentRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -40,7 +40,7 @@ public class DepartmentRoleManagerController {
|
||||
departmentRoleService.updateByDepartmentId(departmentId, departmentRole);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CouponManagerController {
|
||||
if (couponService.add(couponVO) != null) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券")
|
||||
@ -74,7 +74,7 @@ public class CouponManagerController {
|
||||
if (couponService.updateCoupon(couponVO) != null) {
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券状态")
|
||||
@ -84,7 +84,7 @@ public class CouponManagerController {
|
||||
if (couponService.updateCouponStatus(Arrays.asList(split), PromotionStatusEnum.valueOf(promotionStatus))) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -15,7 +16,6 @@ import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -66,7 +66,7 @@ public class PintuanManagerController {
|
||||
if (pintuanService.openPintuan(pintuanId, new Date(startTime), new Date(endTime))) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public class PintuanManagerController {
|
||||
if (pintuanService.closePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_CLOSE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -32,7 +33,7 @@ public class PointsGoodsCategoryManagerController {
|
||||
if (pointsGoodsCategoryService.addCategory(pointsGoodsCategory)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -41,7 +42,7 @@ public class PointsGoodsCategoryManagerController {
|
||||
if (pointsGoodsCategoryService.updateCategory(pointsGoodsCategory)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ -50,7 +51,7 @@ public class PointsGoodsCategoryManagerController {
|
||||
if (pointsGoodsCategoryService.deleteCategory(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -12,7 +13,6 @@ import cn.lili.modules.promotion.service.PointsGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -46,7 +46,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.addPointsGoods(collect)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ -58,7 +58,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.updatePointsGoods(pointsGoods)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{ids}")
|
||||
@ -67,7 +67,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.updatePointsGoodsPromotionStatus(Arrays.asList(ids.split(",")), promotionStatus)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ -76,7 +76,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.deletePointsGoods(Arrays.asList(ids.split(",")))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -44,7 +45,7 @@ public class SeckillManagerController {
|
||||
if (seckillService.saveSeckill(seckillVO)) {
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -56,7 +57,7 @@ public class SeckillManagerController {
|
||||
if (seckillService.modifySeckill(seckillVO)) {
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.purchase;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseOrder;
|
||||
@ -64,7 +65,7 @@ public class PurchaseManagerController {
|
||||
if (purchaseOrderService.close(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "报价列表")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -15,7 +16,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.elasticsearch.ResourceNotFoundException;
|
||||
@ -99,7 +99,7 @@ public class NoticeMessageManagerController {
|
||||
if (result) {
|
||||
return ResultUtil.data(noticeMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
@ -125,7 +125,7 @@ public class NoticeMessageManagerController {
|
||||
return ResultUtil.data(messageTemplate);
|
||||
}
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.base.service.RegionService;
|
||||
@ -8,7 +9,6 @@ import cn.lili.modules.system.entity.dos.Region;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -59,7 +59,7 @@ public class RegionManagerController {
|
||||
if (regionService.updateById(region)) {
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public class RegionManagerController {
|
||||
if (regionService.save(region)) {
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -54,7 +55,7 @@ public class ServiceNoticeManagerController {
|
||||
if (serviceNoticeService.saveOrUpdate(serviceNotice)) {
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新服务订阅消息")
|
||||
@ -63,7 +64,7 @@ public class ServiceNoticeManagerController {
|
||||
if (serviceNoticeService.saveOrUpdate(serviceNotice)) {
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除服务订阅消息")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.setting;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.base.aspect.DemoSite;
|
||||
@ -98,7 +99,7 @@ public class SettingManagerController {
|
||||
return createSetting(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +188,7 @@ public class SettingManagerController {
|
||||
ResultUtil.data(new WechatPaymentSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatPaymentSetting.class));
|
||||
default:
|
||||
return ResultUtil.error(ResultCode.SETTING_NOT_TO_SET);
|
||||
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -59,7 +60,7 @@ public class WechatMPMessageManagerController {
|
||||
if (wechatMPMessageService.save(wechatMPMessage)) {
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
return new ResultUtil<WechatMPMessage>().setErrorMsg(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -68,7 +69,7 @@ public class WechatMPMessageManagerController {
|
||||
if (wechatMPMessageService.updateById(wechatMPMessage)) {
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
return new ResultUtil<WechatMPMessage>().setErrorMsg(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -10,7 +11,6 @@ import cn.lili.modules.message.service.WechatMessageService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -60,7 +60,7 @@ public class WechatMessageManageController {
|
||||
if (wechatMessageService.save(wechatMessage)) {
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -69,7 +69,7 @@ public class WechatMessageManageController {
|
||||
if (wechatMessageService.updateById(wechatMessage)) {
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -14,7 +15,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -63,7 +63,7 @@ public class BillManagerController {
|
||||
if (billService.complete(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -98,7 +99,7 @@ public class StoreManagerController {
|
||||
if (storeService.disable(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "开启店铺")
|
||||
@ -108,7 +109,7 @@ public class StoreManagerController {
|
||||
if (storeService.enable(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询一级分类列表")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -20,7 +21,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -66,7 +66,7 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintService.updateOrderComplain(orderComplainVO)) {
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加交易投诉对话")
|
||||
@ -81,7 +81,7 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintCommunicationService.addCommunication(communicationVO)) {
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改状态")
|
||||
@ -90,7 +90,7 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplainVO) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -111,6 +111,6 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplaintOperationParams) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.goods.entity.dos.CategoryParameterGroup;
|
||||
@ -12,7 +13,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -49,7 +49,7 @@ public class CategoryParameterGroupStoreController {
|
||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数组")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -13,7 +14,6 @@ import cn.lili.modules.goods.service.DraftGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -44,7 +44,7 @@ public class DraftGoodsStoreController {
|
||||
public ResultMessage<DraftGoodsVO> getDraftGoods(@PathVariable String id) {
|
||||
DraftGoodsVO draftGoods = draftGoodsService.getDraftGoods(id);
|
||||
if (!UserContext.getCurrentUser().getStoreId().equals(draftGoods.getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return ResultUtil.data(draftGoods);
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class DraftGoodsStoreController {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
draftGoodsVO.setStoreId(currentUser.getStoreId());
|
||||
} else if (draftGoodsVO.getStoreId() != null && !UserContext.getCurrentUser().getStoreId().equals(draftGoodsVO.getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
draftGoodsService.saveGoodsDraft(draftGoodsVO);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
@ -67,7 +67,7 @@ public class DraftGoodsStoreController {
|
||||
public ResultMessage<String> deleteDraftGoods(@PathVariable String id) {
|
||||
DraftGoods draftGoods = draftGoodsService.getById(id);
|
||||
if (!draftGoods.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
draftGoodsService.deleteGoodsDraft(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -61,7 +62,7 @@ public class GoodsGalleryController {
|
||||
if (goodsGalleryService.save(goodsGallery)) {
|
||||
return ResultUtil.data(goodsGallery);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改商品相册")
|
||||
@ -71,7 +72,7 @@ public class GoodsGalleryController {
|
||||
if (goodsGalleryService.updateById(goodsGallery)) {
|
||||
return ResultUtil.data(goodsGallery);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -22,7 +23,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -92,7 +92,7 @@ public class GoodsStoreController {
|
||||
if (tokenUser.getStoreId().equals(goods.getStoreId())) {
|
||||
return ResultUtil.data(goods);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增商品")
|
||||
@ -118,7 +118,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.DOWN, "商家下架")) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "上架商品", notes = "上架商品时使用")
|
||||
@ -128,7 +128,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "")) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除商品")
|
||||
@ -138,7 +138,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.deleteGoods(goodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置商品运费模板")
|
||||
@ -152,7 +152,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.freight(goodsId, freightPayer, templateId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据goodsId分页获取商品规格列表")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -14,7 +15,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -52,7 +52,7 @@ public class SpecificationStoreController {
|
||||
if (specificationService.addSpecification(parameters) != null) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -38,7 +39,7 @@ public class StoreUserController {
|
||||
member.setPassword(null);
|
||||
return ResultUtil.data(member);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CouponStoreController {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
Coupon coupon = couponService.getCouponDetailFromMongo(couponId);
|
||||
if (coupon == null || !coupon.getStoreId().equals(currentUser.getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class CouponStoreController {
|
||||
if (couponService.add(couponVO) != null) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ -84,7 +84,7 @@ public class CouponStoreController {
|
||||
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ -108,6 +108,6 @@ public class CouponStoreController {
|
||||
if (couponService.updateCouponStatus(Arrays.asList(split), PromotionStatusEnum.valueOf(promotionStatus))) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -72,7 +73,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.addPintuan(pintuan)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_ADD_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_ADD_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_ADD_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ -84,7 +85,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.modifyPintuan(pintuan)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_EDIT_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_EDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/open/{pintuanId}")
|
||||
@ -93,7 +94,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.openPintuan(pintuanId, new Date(startTime), new Date(endTime))) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -103,7 +104,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.closePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_CLOSE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{pintuanId}")
|
||||
@ -112,7 +113,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.deletePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_DELETE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_DELETE_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_DELETE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -9,7 +10,6 @@ import cn.lili.modules.store.service.FreightTemplateService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -61,6 +61,6 @@ public class FreightTemplateStoreController {
|
||||
if (freightTemplateService.removeFreightTemplate(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.settings;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.store.entity.dos.StoreDetail;
|
||||
@ -57,7 +58,7 @@ public class StoreSettingsController {
|
||||
if (storeDetailService.editStoreSetting(storeSettingDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改店铺库存预警数量")
|
||||
@ -68,7 +69,7 @@ public class StoreSettingsController {
|
||||
if (storeDetailService.updateStockWarning(stockWarning)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家退货收件地址")
|
||||
@ -85,6 +86,6 @@ public class StoreSettingsController {
|
||||
if (storeDetailService.editStoreAfterSaleAddressDTO(storeAfterSaleAddressDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -14,7 +15,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -71,6 +71,6 @@ public class BillStoreController {
|
||||
if (billService.check(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dto.StoreEvaluationQueryParams;
|
||||
@ -12,7 +13,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -55,6 +55,6 @@ public class MemberEvaluationStoreController {
|
||||
if (memberEvaluationService.reply(id, reply, replyImage)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -16,7 +17,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -69,7 +69,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintCommunicationService.addCommunication(communicationVO)) {
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改申诉信息")
|
||||
@ -79,7 +79,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintService.updateOrderComplain(orderComplainVO)) {
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintService.appeal(storeAppealVO)) {
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainById(storeAppealVO.getOrderComplaintId()));
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改状态")
|
||||
@ -99,7 +99,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplainVO) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user