Browse Source

👎 增加所有租户商城的自动取消订单和自动确认收货

sj
Loki 2 years ago
parent
commit
6264571059
  1. 14
      yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/ShopException.java
  2. 6
      yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
  3. 22
      yudao-server/src/main/resources/application-local.yaml
  4. 2
      yudao-server/src/main/resources/application-prod.yaml
  5. 4
      zsw-bxg/src/main/java/co/yixiang/api/BusinessException.java
  6. 4
      zsw-bxg/src/main/java/co/yixiang/api/DaoException.java
  7. 4
      zsw-bxg/src/main/java/co/yixiang/api/UnAuthenticatedException.java
  8. 11
      zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java
  9. 10
      zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java
  10. 20
      zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java
  11. 18
      zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java
  12. 5
      zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java
  13. 8
      zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java
  14. 6
      zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java
  15. 18
      zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java
  16. 12
      zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java
  17. 8
      zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java
  18. 22
      zsw-bxg/src/main/java/co/yixiang/app/modules/services/CreatShareProductService.java
  19. 8
      zsw-bxg/src/main/java/co/yixiang/app/modules/services/OrderSupplyService.java
  20. 9
      zsw-bxg/src/main/java/co/yixiang/app/modules/shop/rest/BxgIndexController.java
  21. 14
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java
  22. 6
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java
  23. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserRechargeController.java
  24. 4
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/UserAddressController.java
  25. 6
      zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/UserLevelController.java
  26. 9
      zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java
  27. 38
      zsw-bxg/src/main/java/co/yixiang/job/AutoReceiptJob.java
  28. 47
      zsw-bxg/src/main/java/co/yixiang/job/OrderCancalJob.java
  29. 6
      zsw-bxg/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java
  30. 8
      zsw-bxg/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java
  31. 7
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java
  32. 10
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserServiceImpl.java
  33. 12
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java
  34. 8
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java
  35. 8
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java
  36. 12
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStorePinkServiceImpl.java
  37. 8
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java
  38. 12
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java
  39. 2
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java
  40. 5
      zsw-bxg/src/main/java/co/yixiang/modules/canvas/rest/StoreCanvasController.java
  41. 25
      zsw-bxg/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java
  42. 17
      zsw-bxg/src/main/java/co/yixiang/modules/category/rest/StoreCategoryController.java
  43. 6
      zsw-bxg/src/main/java/co/yixiang/modules/entry/service/impl/YxStoreEntryServiceImpl.java
  44. 7
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java
  45. 4
      zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeiXinSubscribeService.java
  46. 15
      zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java
  47. 8
      zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeixinTemplateService.java
  48. 5
      zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java
  49. 102
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  50. 6
      zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java
  51. 9
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java
  52. 6
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRelationServiceImpl.java
  53. 21
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java
  54. 6
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrValueMapper.java
  55. 6
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java
  56. 13
      zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java
  57. 6
      zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java
  58. 4
      zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java
  59. 6
      zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java
  60. 4
      zsw-bxg/src/main/java/co/yixiang/modules/user/rest/MemberController.java
  61. 7
      zsw-bxg/src/main/java/co/yixiang/modules/user/rest/SystemUserLevelController.java
  62. 4
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java
  63. 4
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserRechargeServiceImpl.java
  64. 8
      zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserSignServiceImpl.java
  65. 6
      zsw-bxg/src/main/java/co/yixiang/tools/rest/UploadController.java
  66. 8
      zsw-bxg/src/main/java/co/yixiang/utils/QrCodeutil.java

14
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/YshopException.java → yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/ShopException.java

@ -19,40 +19,40 @@ import lombok.EqualsAndHashCode;
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class YshopException extends RuntimeException{
public class ShopException extends RuntimeException{
private static final long serialVersionUID = -2470461654663264392L;
private Integer errorCode;
private String message;
public YshopException() {
public ShopException() {
super();
}
public YshopException(String message) {
public ShopException(String message) {
super(message);
this.errorCode = ApiCode.FAIL.getCode();
this.message = message;
}
public YshopException(Integer errorCode, String message) {
public ShopException(Integer errorCode, String message) {
super(message);
this.errorCode = errorCode;
this.message = message;
}
public YshopException(ApiCode apiCode) {
public ShopException(ApiCode apiCode) {
super(apiCode.getMessage());
this.errorCode = apiCode.getCode();
this.message = apiCode.getMessage();
}
public YshopException(String message, Throwable cause) {
public ShopException(String message, Throwable cause) {
super(message, cause);
}
public YshopException(Throwable cause) {
public ShopException(Throwable cause) {
super(cause);
}

6
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java

@ -6,7 +6,7 @@ import cn.hutool.extra.servlet.ServletUtil;
import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
@ -223,8 +223,8 @@ public class GlobalExceptionHandler {
return CommonResult.error(ex.getCode(), ex.getMessage());
}
@ExceptionHandler(value = YshopException.class)
public ApiResult<?> yshopException(YshopException ex){
@ExceptionHandler(value = ShopException.class)
public ApiResult<?> yshopException(ShopException ex){
log.info("[YshopException]",ex);
return ApiResult.fail(ex.getErrorCode(),ex.getMessage());
//return CommonResult.error(ex.getErrorCode(), ex.getMessage());

22
yudao-server/src/main/resources/application-local.yaml

@ -42,53 +42,53 @@ spring:
test-on-return: false
datasource:
master:
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
slave: # 模拟从库,可根据自己需要修改
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
bxg: # 农场数据源
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
erp: # 进销存
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:p6spy:mysql://192.168.10.250:3306/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
farm: # 农场数据源
url: jdbc:p6spy:mysql://192.168.10.250:3306/zsw-farm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:p6spy:mysql://192.168.10.250:3306/zsw-farm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
# datasource:
# master:
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# slave: # 模拟从库,可根据自己需要修改
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# bxg: # 农场数据源
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
# url: jdbc:p6spy:mysql://localhost:3306/vue_pro_bxg?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# erp: # 进销存
# url: jdbc:p6spy:mysql://localhost/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
# url: jdbc:p6spy:mysql://localhost/vue_pro_erp?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
# farm: # 农场数据源
# url: jdbc:p6spy:mysql://localhost/zsw-farm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
# url: jdbc:p6spy:mysql://localhost/zsw-farm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# username: root
# password: 123456
@ -120,7 +120,7 @@ spring:
jobStore:
# JobStore 实现类。可见博客:https://blog.csdn.net/weixin_42458219/article/details/122247162
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
isClustered: true # 是集群模式
isClustered: false # 是集群模式
clusterCheckinInterval: 15000 # 集群检查频率,单位:毫秒。默认为 15000,即 15 秒
misfireThreshold: 60000 # misfire 阀值,单位:毫秒。
# 线程池相关配置

2
yudao-server/src/main/resources/application-prod.yaml

@ -81,7 +81,7 @@ spring:
# Quartz 配置项,对应 QuartzProperties 配置类
spring:
quartz:
auto-startup: false # 本地开发环境,尽量不要开启 Job
auto-startup: true # 本地开发环境,尽量不要开启 Job
scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName
job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。
wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true

4
zsw-bxg/src/main/java/co/yixiang/api/BusinessException.java

@ -10,14 +10,14 @@ package co.yixiang.api;
import cn.iocoder.yudao.framework.common.exception.ApiCode;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
/**
* 业务异常
* @author hupeng
* @date 2020-04-30
*/
public class BusinessException extends YshopException {
public class BusinessException extends ShopException {
private static final long serialVersionUID = -2303357122330162359L;
public BusinessException(String message) {

4
zsw-bxg/src/main/java/co/yixiang/api/DaoException.java

@ -10,14 +10,14 @@ package co.yixiang.api;
import cn.iocoder.yudao.framework.common.exception.ApiCode;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
/**
* DAO异常
* @author hupeng
* @date 2020-04-30
*/
public class DaoException extends YshopException {
public class DaoException extends ShopException {
private static final long serialVersionUID = -6912618737345878854L;
public DaoException(String message) {

4
zsw-bxg/src/main/java/co/yixiang/api/UnAuthenticatedException.java

@ -9,14 +9,14 @@
package co.yixiang.api;
import cn.iocoder.yudao.framework.common.exception.ApiCode;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
/**
* 认证异常
* @author hupeng
* @date 2020-04-30
*/
public class UnAuthenticatedException extends YshopException {
public class UnAuthenticatedException extends ShopException {
public UnAuthenticatedException(String message) {
super(message);
}

11
zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreBargainController.java

@ -12,7 +12,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.activity.param.BargainShareParam;
@ -36,7 +36,6 @@ import co.yixiang.modules.activity.vo.YxStoreBargainUserQueryVo;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api;
@ -122,7 +121,7 @@ public class AppStoreBargainController {
@ApiOperation(value = "砍价详情",notes = "砍价详情",response = YxStoreBargainQueryVo.class)
public ApiResult<BargainVo> getYxStoreBargain(@PathVariable Long id){
if(ObjectUtil.isNull(id)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
Long uid = LocalUser.getUidByToken();
return ApiResult.ok(storeBargainService.getDetail(id,uid));
@ -260,11 +259,11 @@ public class AppStoreBargainController {
Long bargainId = Long.valueOf(param.getBargainId());
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isBlank(siteUrl)){
throw new YshopException("未配置h5地址");
throw new ShopException("未配置h5地址");
}
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isBlank(apiUrl)){
throw new YshopException("未配置api地址");
throw new ShopException("未配置api地址");
}
YxUser userInfo = LocalUser.getUser();
Map<String,Object> map = Maps.newHashMap();
@ -291,7 +290,7 @@ public class AppStoreBargainController {
List<YxStoreBargainUserQueryVo> yxStoreBargainUserQueryVos = storeBargainUserService
.bargainUserList(uid,page,limit);
if(yxStoreBargainUserQueryVos.isEmpty()) {
throw new YshopException("暂无参与砍价");
throw new ShopException("暂无参与砍价");
}
return ApiResult.ok(yxStoreBargainUserQueryVos);
}

10
zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreCombinationController.java

@ -11,7 +11,7 @@ package co.yixiang.app.modules.activity.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.activity.param.PinkCancelParam;
import co.yixiang.app.modules.activity.param.PinkShareParam;
@ -107,7 +107,7 @@ public class AppStoreCombinationController {
@ApiOperation(value = "拼团产品详情",notes = "拼团产品详情")
public ApiResult<StoreCombinationVo> detail(@PathVariable Long id){
if(ObjectUtil.isNull(id)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
// Long uid = LocalUser.getUser().getUid();
Long uid = LocalUser.getUidByToken(); //不传token则返回uid是0
@ -131,7 +131,7 @@ public class AppStoreCombinationController {
@ApiOperation(value = "拼团明细",notes = "拼团明细")
public ApiResult<PinkInfoVo> pink(@PathVariable Long id){
if(ObjectUtil.isNull(id)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
Long uid = LocalUser.getUser().getUid();
return ApiResult.ok(storePinkService.pinkInfo(id,uid));
@ -147,11 +147,11 @@ public class AppStoreCombinationController {
public ApiResult<Object> poster(@Validated @RequestBody PinkShareParam param){
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
throw new YshopException("未配置h5地址");
throw new ShopException("未配置h5地址");
}
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
throw new YshopException("未配置api地址");
throw new ShopException("未配置api地址");
}
YxUser userInfo = LocalUser.getUser();
Map<String,Object> map = Maps.newHashMap();

20
zsw-bxg/src/main/java/co/yixiang/app/modules/activity/rest/AppStoreSeckillController.java

@ -8,35 +8,23 @@
*/
package co.yixiang.app.modules.activity.rest;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.app.common.bean.LocalUser;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.constant.ShopConstants;
import co.yixiang.modules.activity.service.YxStoreSeckillService;
import co.yixiang.modules.activity.service.dto.SeckillTimeDto;
import co.yixiang.modules.activity.vo.SeckillConfigVo;
import co.yixiang.modules.activity.vo.StoreSeckillVo;
import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo;
import co.yixiang.modules.product.service.YxStoreProductRelationService;
import co.yixiang.modules.shop.domain.YxSystemGroupData;
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.utils.OrderUtil;
import co.yixiang.utils.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.common.value.qual.StringVal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -44,11 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* <p>
@ -91,7 +75,7 @@ public class AppStoreSeckillController {
@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit){
if (StrUtil.isBlank(time) || !NumberUtil.isNumber(time)){
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
return ApiResult.resultPage(yxStoreSeckillService.getList(page, limit, Integer.valueOf(time)),limit);

18
zsw-bxg/src/main/java/co/yixiang/app/modules/auth/rest/LetterAppAuthController.java

@ -13,7 +13,7 @@ import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.enums.SmsTypeEnum;
import co.yixiang.app.common.util.JwtToken;
import co.yixiang.app.common.util.SmsUtils;
@ -153,7 +153,7 @@ public class LetterAppAuthController {
.eq(YxUser::getPassword,SecureUtil.md5(loginDTO.getPassword())),false);
if(yxUser == null) {
throw new YshopException("账号或者密码不正确");
throw new ShopException("账号或者密码不正确");
}
String token = JwtToken.makeToken(yxUser.getUid(),yxUser.getUsername());
@ -182,16 +182,16 @@ public class LetterAppAuthController {
public ApiResult<Map<String, Object>> loginVerify(@Validated @RequestBody LoginVerifyParam loginVerifyParam, HttpServletRequest request) {
String code = redisUtil.getY("code_" + loginVerifyParam.getAccount());
if(code == null){
throw new YshopException("请先获取验证码");
throw new ShopException("请先获取验证码");
}
if (!StrUtil.equals(code, loginVerifyParam.getCaptcha())) {
throw new YshopException("验证码错误");
throw new ShopException("验证码错误");
}
YxUser yxUser = userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getUsername,loginVerifyParam.getAccount()));
if(yxUser == null) {
throw new YshopException("账号不存在");
throw new ShopException("账号不存在");
}
String token = JwtToken.makeToken(yxUser.getUid(),yxUser.getUsername());
@ -221,21 +221,21 @@ public class LetterAppAuthController {
public ApiResult<Boolean> updatePassword(@Validated @RequestBody UpdatePasswordParam updatePasswordParam, HttpServletRequest request) {
String code = redisUtil.getY("code_" + updatePasswordParam.getAccount());
if(code == null){
throw new YshopException("请先获取验证码");
throw new ShopException("请先获取验证码");
}
if (!StrUtil.equals(code, updatePasswordParam.getCaptcha())) {
throw new YshopException("验证码错误");
throw new ShopException("验证码错误");
}
YxUser yxUser = userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getUsername,updatePasswordParam.getAccount()));
if(yxUser == null) {
throw new YshopException("账号不存在,数据错误");
throw new ShopException("账号不存在,数据错误");
}
yxUser.setPassword(SecureUtil.md5(updatePasswordParam.getPassword()));
boolean b = userService.updateById(yxUser);
if (!b) {
throw new YshopException("修改失败");
throw new ShopException("修改失败");
}
String bearerToken = request.getHeader("Authorization");
String[] tokens = bearerToken.split(" ");

5
zsw-bxg/src/main/java/co/yixiang/app/modules/coupon/rest/CouponController.java

@ -11,12 +11,11 @@ package co.yixiang.app.modules.coupon.rest;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.modules.activity.service.YxStoreCouponIssueService;
import co.yixiang.modules.activity.service.YxStoreCouponService;
import co.yixiang.modules.activity.service.YxStoreCouponUserService;
@ -101,7 +100,7 @@ public class CouponController {
public ApiResult<Boolean> receive(@Validated @RequestBody YxStoreCouponQueryParam param){
Long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getCouponId())){
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
Integer couponId = Integer.valueOf(param.getCouponId());
couponIssueService.issueUserCoupon(couponId,uid);

8
zsw-bxg/src/main/java/co/yixiang/app/modules/evaluation/rest/AppStoreEvaluationController.java

@ -9,18 +9,16 @@
package co.yixiang.app.modules.evaluation.rest;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.evaluation.param.YxStoreEvaluationRelationQueryParam;
import co.yixiang.app.modules.product.param.YxStoreProductRelationQueryParam;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.utils.EntryDTO;
import co.yixiang.utils.EvaluationDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -82,7 +80,7 @@ public class AppStoreEvaluationController {
public ApiResult<Boolean> collectAdd(@Validated @RequestBody YxStoreEvaluationRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
yxEvaluationRelationService.addEvaluationRelation(Long.valueOf(param.getId()),uid);
return ApiResult.ok();
@ -99,7 +97,7 @@ public class AppStoreEvaluationController {
public ApiResult<Boolean> collectDel(@Validated @RequestBody YxStoreEvaluationRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
yxEvaluationRelationService.delEvaluationRelation(Long.valueOf(param.getId()),
uid);

6
zsw-bxg/src/main/java/co/yixiang/app/modules/manage/rest/ShoperController.java

@ -11,7 +11,7 @@ package co.yixiang.app.modules.manage.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.modules.order.param.OrderDeliveryParam;
import co.yixiang.app.modules.order.param.OrderRefundParam;
import co.yixiang.logging.aop.log.AppLog;
@ -112,11 +112,11 @@ public class ShoperController {
@ApiOperation(value = "订单详情",notes = "订单详情")
public ApiResult<YxStoreOrderQueryVo> orderDetail(@PathVariable String key){
if(StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,null);
if(ObjectUtil.isNull(storeOrder)){
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
return ApiResult.ok(storeOrderService.handleOrder(storeOrder));
}

18
zsw-bxg/src/main/java/co/yixiang/app/modules/order/rest/AppStoreOrderController.java

@ -12,7 +12,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.order.param.*;
@ -153,7 +153,7 @@ public class AppStoreOrderController {
YxStoreOrder order = storeOrderService.createOrder(yxUser, key, param);
if (ObjectUtil.isNull(order)) {
throw new YshopException("订单生成失败");
throw new ShopException("订单生成失败");
}
String orderId = order.getOrderId();
@ -192,11 +192,11 @@ public class AppStoreOrderController {
YxStoreOrderQueryVo storeOrder = storeOrderService
.getOrderInfo(param.getUni(), uid);
if (ObjectUtil.isNull(storeOrder)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(storeOrder.getPaid())) {
throw new YshopException("该订单已支付");
throw new ShopException("该订单已支付");
}
String orderId = storeOrder.getOrderId();
@ -261,11 +261,11 @@ public class AppStoreOrderController {
public ApiResult<YxStoreOrderQueryVo> detail(@PathVariable String key) {
Long uid = LocalUser.getUser().getUid();
if (StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key, uid);
if (ObjectUtil.isNull(storeOrder)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
storeOrder = creatShareProductService.handleQrcode(storeOrder, "");
@ -408,10 +408,10 @@ public class AppStoreOrderController {
Long uid = LocalUser.getUser().getUid();
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(param.getId(), uid);
if (ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (orderInfo.getStatus() != 0) {
throw new YshopException("订单不能取消");
throw new ShopException("订单不能取消");
}
if (orderInfo.getPaid() == 1) {
BigDecimal bigDecimal = new BigDecimal("100");
@ -434,7 +434,7 @@ public class AppStoreOrderController {
Long uid = LocalUser.getUser().getUid();
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(param.getId(), uid);
if (ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
storeOrderService.deleteOrder(param.getId(), uid);
return ApiResult.ok();

12
zsw-bxg/src/main/java/co/yixiang/app/modules/product/rest/AppStoreProductController.java

@ -13,7 +13,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.product.param.CollectDelFootParam;
@ -145,11 +145,11 @@ public class AppStoreProductController {
// 海报
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
throw new YshopException("未配置h5地址");
throw new ShopException("未配置h5地址");
}
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
throw new YshopException("未配置api地址");
throw new ShopException("未配置api地址");
}
String sepa = File.separator;
String text ;
@ -211,7 +211,7 @@ public class AppStoreProductController {
public ApiResult<Boolean> collectAdd(@Validated @RequestBody YxStoreProductRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
productRelationService.addRroductRelation(Long.valueOf(param.getId()),uid,param.getCategory());
return ApiResult.ok();
@ -228,7 +228,7 @@ public class AppStoreProductController {
public ApiResult<Boolean> collectDel(@Validated @RequestBody YxStoreProductRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
productRelationService.delRroductRelation(Long.valueOf(param.getId()),
uid,param.getCategory());
@ -245,7 +245,7 @@ public class AppStoreProductController {
@ApiOperation(value = "删除足跡",notes = "删除足跡")
public ApiResult<Boolean> collectDelFoot(@Validated @RequestBody CollectDelFootParam param){
if (CollectionUtil.isEmpty(param.getIds())){
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
productRelationService.collectDelFoot(param.getIds());
return ApiResult.ok();

8
zsw-bxg/src/main/java/co/yixiang/app/modules/services/AppAuthService.java

@ -15,7 +15,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.util.IpUtil;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.AppFromEnum;
@ -136,7 +136,7 @@ public class AppAuthService {
String appId = systemConfigService.getData(ShopKeyUtils.getWxAppAppId());
String secret = systemConfigService.getData(ShopKeyUtils.getWxAppSecret());
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
throw new YshopException("请先配置小程序");
throw new ShopException("请先配置小程序");
}
log.info("appId:{},secret:{}",appId,secret);
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
@ -206,7 +206,7 @@ public class AppAuthService {
} catch (WxErrorException e) {
e.printStackTrace();
log.error(e.getMessage());
throw new YshopException(e.toString());
throw new ShopException(e.toString());
}
}
@ -290,7 +290,7 @@ public class AppAuthService {
} catch (WxErrorException e) {
e.printStackTrace();
log.error(e.getMessage());
throw new YshopException(e.toString());
throw new ShopException(e.toString());
}
}

22
zsw-bxg/src/main/java/co/yixiang/app/modules/services/CreatShareProductService.java

@ -15,7 +15,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.AppFromEnum;
@ -89,11 +89,11 @@ public class CreatShareProductService {
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(storeOrder.getShippingType())){
String mapKey = systemConfigService.getData(SystemConfigConstants.TENGXUN_MAP_KEY);
if(StrUtil.isBlank(mapKey)) {
throw new YshopException("请配置腾讯地图key");
throw new ShopException("请配置腾讯地图key");
}
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
throw new YshopException("未配置api地址");
throw new ShopException("未配置api地址");
}
//生成二维码
// String name = storeOrder.getVerifyCode()+"_yshop.jpg";
@ -135,7 +135,7 @@ public class CreatShareProductService {
}
} catch (IOException e) {
log.error(e.getMessage());
throw new YshopException(e.getMessage());
throw new ShopException(e.getMessage());
}
if(StrUtil.isNotBlank(from) && AppFromEnum.APP.getValue().equals(from)){
@ -282,7 +282,7 @@ public class CreatShareProductService {
.getBargainUserInfo(bargainId,uid);
if(ObjectUtil.isNull(storeBargainQueryVo) || ObjectUtil.isNull(storeBargainUser)) {
throw new YshopException("数据不存在");
throw new ShopException("数据不存在");
}
//用户可以砍掉的金额 好友砍价之前获取可以砍价金额
double coverPrice = NumberUtil.sub(storeBargainUser.getBargainPrice()
@ -352,7 +352,7 @@ public class CreatShareProductService {
}
} catch (IOException e) {
log.error(e.getMessage());
throw new YshopException(e.getMessage());
throw new ShopException(e.getMessage());
}
if(ObjectUtil.isNull(attachmentT)){
try {
@ -453,7 +453,7 @@ public class CreatShareProductService {
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage());
throw new YshopException("生成失败");
throw new ShopException("生成失败");
}
}else{
spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir();
@ -477,11 +477,11 @@ public class CreatShareProductService {
Long uid = userInfo.getUid();
YxStorePink storePink = storePinkService.getById(pinkId);
if(ObjectUtil.isNull(storePink)) {
throw new YshopException("拼团不存在");
throw new ShopException("拼团不存在");
}
YxStoreCombination storeCombination = storeCombinationService.getById(storePink.getCid());
if(ObjectUtil.isNull(storeCombination)) {
throw new YshopException("拼团产品不存在");
throw new ShopException("拼团产品不存在");
}
@ -544,7 +544,7 @@ public class CreatShareProductService {
} catch (IOException e) {
log.error(e.getMessage());
throw new YshopException(e.getMessage());
throw new ShopException(e.getMessage());
}
if(ObjectUtil.isNull(attachmentT)){
try {
@ -651,7 +651,7 @@ public class CreatShareProductService {
} catch (Exception e) {
log.error(e.getMessage());
throw new YshopException(e.getMessage());
throw new ShopException(e.getMessage());
}
}else{
spreadUrl = apiUrl + "/api/file/" + attachmentT.getSattDir();

8
zsw-bxg/src/main/java/co/yixiang/app/modules/services/OrderSupplyService.java

@ -11,7 +11,7 @@ package co.yixiang.app.modules.services;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.enums.AppFromEnum;
import co.yixiang.enums.BillDetailEnum;
import co.yixiang.enums.OrderInfoEnum;
@ -108,7 +108,7 @@ public class OrderSupplyService {
public Map<String,Object> check(Long uid,String key, ComputeOrderParam param){
Map<String,Object> map = Maps.newHashMap();
if(StrUtil.isBlank(key)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid);
if(ObjectUtil.isNotNull(storeOrder)){
@ -129,10 +129,10 @@ public class OrderSupplyService {
YxStoreBargainUser storeBargainUser = storeBargainUserService
.getBargainUserInfo(bargainId,uid);
if(storeBargainUser == null) {
throw new YshopException("砍价失败");
throw new ShopException("砍价失败");
}
if(OrderInfoEnum.BARGAIN_STATUS_3.getValue().equals(storeBargainUser.getStatus())) {
throw new YshopException("砍价已支付");
throw new ShopException("砍价已支付");
}
}

9
zsw-bxg/src/main/java/co/yixiang/app/modules/shop/rest/BxgIndexController.java

@ -11,10 +11,9 @@ package co.yixiang.app.modules.shop.rest;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.io.resource.ClassPathResource;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.ProductEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.activity.service.YxStoreBargainService;
import co.yixiang.modules.activity.service.YxStoreCombinationService;
import co.yixiang.modules.activity.service.YxStoreSeckillService;
@ -40,16 +39,13 @@ import co.yixiang.utils.FileUtil;
import co.yixiang.utils.RedisUtils;
import co.yixiang.utils.ShopKeyUtils;
import co.yixiang.utils.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.HttpStatus;
@ -59,7 +55,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@ -183,7 +178,7 @@ public class BxgIndexController {
return ApiResult.ok(jsonObject);
} catch (Exception e) {
log.error(e.getMessage());
throw new YshopException("无数据");
throw new ShopException("无数据");
}
}

14
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppStoreAfterSalesController.java

@ -3,7 +3,7 @@ package co.yixiang.app.modules.user.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.logging.aop.log.AppLog;
@ -88,7 +88,7 @@ public class AppStoreAfterSalesController {
public ApiResult<StoreAfterSalesVo> detail(@PathVariable String key, @PathVariable Long id) {
Long uid = LocalUser.getUser().getUid();
if (StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
StoreAfterSalesVo storeInfo = storeAfterSalesService.getStoreInfoByOrderCodeAndAfterIdAndUid(key, id, uid);
storeAfterSalesService.handleSales(storeInfo);
@ -105,14 +105,14 @@ public class AppStoreAfterSalesController {
public ApiResult<List<StoreAfterSalesVo>> detail(@PathVariable String key) {
Long uid = LocalUser.getUser().getUid();
if (StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
List<StoreAfterSalesVo> storeInfo = storeAfterSalesService.getStoreInfoByOrderCodeAndUid(key, uid);
storeInfo.forEach(item ->
storeAfterSalesService.handleSales(item)
);
if (ObjectUtil.isNull(storeInfo)) {
throw new YshopException("售后订单不存在");
throw new ShopException("售后订单不存在");
}
return ApiResult.ok(storeInfo);
}
@ -127,7 +127,7 @@ public class AppStoreAfterSalesController {
public ApiResult<Boolean> revoke(@PathVariable String key, @PathVariable Long id) {
Long uid = LocalUser.getUser().getUid();
if (StrUtil.isEmpty(key)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
Boolean revoke = storeAfterSalesService.revoke(key, uid, id);
return ApiResult.ok(revoke);
@ -152,7 +152,7 @@ public class AppStoreAfterSalesController {
public ApiResult<Boolean> addLogisticsInformation(@RequestParam String code, @RequestParam String name, @RequestParam String postalCode, @RequestParam String orderCode) {
Long uid = LocalUser.getUser().getUid();
if (StrUtil.isEmpty(code) || StrUtil.isEmpty(name) || StrUtil.isEmpty(postalCode)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
Boolean revoke = storeAfterSalesService.addLogisticsInformation(code, name, postalCode, orderCode);
return ApiResult.ok(revoke);
@ -168,7 +168,7 @@ public class AppStoreAfterSalesController {
public ApiResult<Boolean> deleteAfterSalesOrder(@RequestParam String orderCode, @RequestParam Long id) {
Long uid = LocalUser.getUser().getUid();
if (StrUtil.isEmpty(orderCode) || ObjectUtil.isEmpty(id)) {
throw new YshopException("参数错误");
throw new ShopException("参数错误");
}
Boolean revoke = storeAfterSalesService.deleteAfterSalesOrder(orderCode, id);
return ApiResult.ok(revoke);

6
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserBillController.java

@ -11,7 +11,7 @@ package co.yixiang.app.modules.user.rest;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.app.modules.services.CreatShareProductService;
@ -119,11 +119,11 @@ public class AppUserBillController {
YxUser yxUser = LocalUser.getUser();
String siteUrl = systemConfigService.getData(SystemConfigConstants.SITE_URL);
if(StrUtil.isEmpty(siteUrl)){
throw new YshopException("未配置h5地址!");
throw new ShopException("未配置h5地址!");
}
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
throw new YshopException("未配置api地址!");
throw new ShopException("未配置api地址!");
}
String spreadUrl = creatShareProductService.getSpreadUrl(from,yxUser,siteUrl,apiUrl,path);

4
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/AppUserRechargeController.java

@ -10,7 +10,7 @@ package co.yixiang.app.modules.user.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.user.param.RechargeParam;
import co.yixiang.enums.ShopCommonEnum;
@ -103,7 +103,7 @@ public class AppUserRechargeController {
map.put("type",param.getFrom());
YxSystemGroupData systemGroupData = systemGroupDataService.getById(param.getRecharId());
if(systemGroupData == null) {
throw new YshopException("充值方案不存在");
throw new ShopException("充值方案不存在");
}
JSONObject jsonObject = JSON.parseObject(systemGroupData.getValue());

4
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/UserAddressController.java

@ -11,7 +11,7 @@ package co.yixiang.app.modules.user.rest;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.app.common.util.CityTreeUtil;
@ -147,7 +147,7 @@ public class UserAddressController {
@ApiOperation(value = "地址详情",notes = "地址详情")
public ApiResult<YxUserAddressQueryVo> addressDetail(@PathVariable String id){
if(StrUtil.isBlank(id) || !NumberUtil.isNumber(id)){
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
return ApiResult.ok(userAddressService.getDetail(Long.valueOf(id)));
}

6
zsw-bxg/src/main/java/co/yixiang/app/modules/user/rest/UserLevelController.java

@ -12,7 +12,7 @@ package co.yixiang.app.modules.user.rest;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.modules.user.service.YxSystemUserLevelService;
@ -64,7 +64,7 @@ public class UserLevelController {
@ApiOperation(value = "获取等级任务",notes = "获取等级任务")
public ApiResult<Object> getTask(@PathVariable String id){
if(StrUtil.isBlank(id) || !NumberUtil.isNumber(id)){
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
Long uid = LocalUser.getUser().getUid();
return ApiResult.ok(systemUserTaskService.getTaskList(Integer.valueOf(id),uid));
@ -82,7 +82,7 @@ public class UserLevelController {
if(res){
return ApiResult.ok("升级成功!");
}else{
throw new YshopException("还不符合升级条件哦!");
throw new ShopException("还不符合升级条件哦!");
}
}

9
zsw-bxg/src/main/java/co/yixiang/app/modules/wechat/rest/controller/WxMaUserController.java

@ -13,11 +13,10 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.app.modules.wechat.rest.param.BindPhoneParam;
import co.yixiang.app.modules.wechat.rest.param.WxPhoneParam;
import co.yixiang.constant.ShopConstants;
import co.yixiang.logging.aop.log.AppLog;
import cn.iocoder.yudao.framework.security.core.annotations.AuthCheck;
import co.yixiang.modules.shop.service.YxSystemConfigService;
@ -83,14 +82,14 @@ public class WxMaUserController {
public ApiResult<Map<String,Object>> phone(@Validated @RequestBody WxPhoneParam param) {
YxUser user = LocalUser.getUser();
if(StrUtil.isNotBlank(user.getPhone())){
throw new YshopException("您的账号已经绑定过手机号码");
throw new ShopException("您的账号已经绑定过手机号码");
}
//读取redis配置
String appId = systemConfigService.getData(ShopKeyUtils.getWxAppAppId());
String secret = systemConfigService.getData(ShopKeyUtils.getWxAppSecret());
if (StrUtil.isBlank(appId) || StrUtil.isBlank(secret)) {
throw new YshopException("请先配置小程序");
throw new ShopException("请先配置小程序");
}
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
String phone = "";
@ -107,7 +106,7 @@ public class WxMaUserController {
userService.updateById(user);
} catch (Exception e) {
e.printStackTrace();
throw new YshopException("绑定失败");
throw new ShopException("绑定失败");
}
Map<String,Object> map = new LinkedHashMap<>();
map.put("phone",phone);

38
zsw-bxg/src/main/java/co/yixiang/job/AutoReceiptJob.java

@ -2,6 +2,10 @@ package co.yixiang.job;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantExportReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.service.YxStoreOrderService;
@ -9,26 +13,42 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@Component("autoReceiptJob")
public class AutoReceiptJob implements JobHandler {
@Autowired
private YxStoreOrderService storeOrderService;
@Autowired
private TenantService tenantService;
@Override
public String execute(String param) throws Exception {
// 每隔30分钟查询7天之前的订单 ,准备自动收获
List<YxStoreOrder> orders = storeOrderService.list(new LambdaQueryWrapper<YxStoreOrder>()
.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue())
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_1.getValue())
.apply("TIMESTAMPDIFF(day,create_time,CURRENT_DATE) > 7 ")
);
orders.forEach(yxStoreOrder -> {
storeOrderService.takeOrder(yxStoreOrder.getOrderId(),null);
List<TenantDO> tenants = tenantService.getTenantList(new TenantExportReqVO());
AtomicReference<Integer> num = new AtomicReference<>(0);
tenants.forEach(tenantDO -> {
TenantContextHolder.setTenantId(tenantDO.getId());
// 每隔30分钟查询7天之前的订单 ,准备自动收获
// 测试环境3分钟 TIMESTAMPDIFF(minute,pay_time,{0}) > 3
// 线上环境7天 TIMESTAMPDIFF(dat,pay_time,{0}) > 7
List<YxStoreOrder> orders = storeOrderService.list(new LambdaQueryWrapper<YxStoreOrder>()
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
.eq(YxStoreOrder::getStatus, OrderInfoEnum.STATUS_1.getValue())
.apply("TIMESTAMPDIFF(dat,pay_time,{0}) > 7 ",LocalDateTime.now())
);
num.updateAndGet(v -> v + orders.size());
orders.forEach(yxStoreOrder -> {
storeOrderService.takeOrder(yxStoreOrder.getOrderId(), null);
});
TenantContextHolder.setTenantId(null);
});
return StrUtil.format("自动收货订单{}条",orders.size());
return StrUtil.format("合计处理{}个租户,自动收货订单{}条", tenants.size(), num);
}
}

47
zsw-bxg/src/main/java/co/yixiang/job/OrderCancalJob.java

@ -3,7 +3,12 @@ package co.yixiang.job;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantExportReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.OrderStatusEnum;
import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.service.YxStoreOrderService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -14,29 +19,51 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/**
* 订单自动取消
*/
@Component("orderCancal")
@Component("orderCancalJob")
@Slf4j
public class OrderCancalJob implements JobHandler {
@Autowired
private YxStoreOrderService storeOrderService;
@Autowired
private TenantService tenantService;
@Override
public String execute(String param) throws Exception {
// 每隔30分钟 查找30分钟之前 未支付的订单
List<YxStoreOrder> orders = storeOrderService.list(new LambdaQueryWrapper<YxStoreOrder>()
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
.lt(YxStoreOrder::getCreateTime, LocalDateTimeUtil.offset(LocalDateTime.now(),-30, ChronoUnit.MINUTES))
);
//
orders.forEach(yxStoreOrder -> {
storeOrderService.cancelOrder(yxStoreOrder.getOrderId(),null);
List<TenantDO> tenants = tenantService.getTenantList(new TenantExportReqVO());
AtomicReference<Integer> num = new AtomicReference<>(0);
tenants.forEach(tenantDO -> {
TenantContextHolder.setTenantId(tenantDO.getId());
// 每隔30分钟 查找30分钟之前 未支付的订单
// 测试环境3分钟
List<YxStoreOrder> orders = storeOrderService.list(new LambdaQueryWrapper<YxStoreOrder>()
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
.eq(YxStoreOrder::getStatus, OrderStatusEnum.STATUS_0.getValue())
.le(YxStoreOrder::getCreateTime, LocalDateTimeUtil.offset(LocalDateTime.now(),-30, ChronoUnit.MINUTES))
);
num.updateAndGet(v -> v + orders.size());
//
orders.forEach(yxStoreOrder -> {
storeOrderService.cancelOrder(yxStoreOrder.getOrderId(),null);
});
TenantContextHolder.setTenantId(null);
});
return StrUtil.format("取消订单{}条",orders.size());
return StrUtil.format("合计处理{}个租户,取消订单{}条",tenants.size(),num);
}
}

6
zsw-bxg/src/main/java/co/yixiang/modules/activity/rest/StoreBargainController.java

@ -9,7 +9,7 @@
package co.yixiang.modules.activity.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStoreBargain;
import co.yixiang.modules.activity.service.YxStoreBargainService;
@ -61,10 +61,10 @@ public class StoreBargainController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREBARGAIN_ALL','YXSTOREBARGAIN_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreBargain resources){
if(resources.getBargainMinPrice().compareTo(resources.getBargainMaxPrice()) >= 0){
throw new YshopException("单次砍最低价不能高于单次砍最高价");
throw new ShopException("单次砍最低价不能高于单次砍最高价");
}
if(resources.getMinPrice().compareTo(resources.getPrice()) >= 0){
throw new YshopException("允许砍到最低价不能高于砍价金额");
throw new ShopException("允许砍到最低价不能高于砍价金额");
}
if(ObjectUtil.isNull(resources.getId())){
return new ResponseEntity<>(yxStoreBargainService.save(resources),HttpStatus.CREATED);

8
zsw-bxg/src/main/java/co/yixiang/modules/activity/rest/StoreCouponController.java

@ -7,7 +7,7 @@ package co.yixiang.modules.activity.rest;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.enums.CouponEnum;
import co.yixiang.event.TemplateBean;
import co.yixiang.event.TemplateEvent;
@ -84,7 +84,7 @@ public class StoreCouponController {
public ResponseEntity create(@Validated @RequestBody YxStoreCoupon resources){
if(CouponEnum.TYPE_1.getValue().equals(resources.getType())
&& StrUtil.isEmpty(resources.getProductId())){
throw new YshopException("请选择商品");
throw new ShopException("请选择商品");
}
// if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) {
// throw new YshopException("优惠券金额不能高于最低消费金额");
@ -99,7 +99,7 @@ public class StoreCouponController {
public ResponseEntity giveOut(@Validated @RequestBody CouponGive couponGive){
Long couponId = couponGive.getCouponId();
if (couponGive.getUserIds().isEmpty()){
throw new YshopException("未选择任何会员");
throw new ShopException("未选择任何会员");
}
couponGive.getUserIds().forEach(yxUser -> {
//用户的券记录
@ -132,7 +132,7 @@ public class StoreCouponController {
public ResponseEntity update(@Validated @RequestBody YxStoreCoupon resources){
if(CouponEnum.TYPE_1.getValue().equals(resources.getType())
&& StrUtil.isEmpty(resources.getProductId())){
throw new YshopException("请选择商品");
throw new ShopException("请选择商品");
}
// if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) {
// throw new YshopException("优惠券金额不能高于最低消费金额");

7
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java

@ -12,7 +12,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
@ -36,7 +36,6 @@ import co.yixiang.modules.activity.vo.BargainCountVo;
import co.yixiang.modules.activity.vo.BargainVo;
import co.yixiang.modules.activity.vo.TopCountVo;
import co.yixiang.modules.activity.vo.YxStoreBargainQueryVo;
import co.yixiang.modules.hotList.domain.YxStoreHotList;
import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.product.service.YxStoreProductService;
@ -121,7 +120,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
public void decStockIncSales(int num, Long bargainId) {
int res = yxStoreBargainMapper.decStockIncSales(num,bargainId);
if(res == 0) {
throw new YshopException("砍价产品库存不足");
throw new ShopException("砍价产品库存不足");
}
}
@ -311,7 +310,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
.one();
if(storeBargain == null) {
throw new YshopException("砍价已结束");
throw new ShopException("砍价已结束");
}
// 获取运费模板名称
String storeFreePostage = systemConfigService.getData("store_free_postage");

10
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainUserServiceImpl.java

@ -10,7 +10,7 @@ package co.yixiang.modules.activity.service.impl;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.OrderInfoEnum;
@ -92,10 +92,10 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
public void bargainCancel(Long bargainId, Long uid) {
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
if(ObjectUtil.isNull(storeBargainUser)) {
throw new YshopException("数据不存在");
throw new ShopException("数据不存在");
}
if(!OrderInfoEnum.BARGAIN_STATUS_1.getValue().equals(storeBargainUser.getStatus())){
throw new YshopException("状态错误");
throw new ShopException("状态错误");
}
yxStoreBargainUserMapper.deleteById(storeBargainUser.getId());
}
@ -148,11 +148,11 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
public void setBargain(Long bargainId, Long uid) {
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
if(storeBargainUser != null) {
throw new YshopException("你已经参与了");
throw new ShopException("你已经参与了");
}
YxStoreBargain storeBargain = storeBargainService.getById(bargainId);
if(storeBargain == null) {
throw new YshopException("砍价商品不存在");
throw new ShopException("砍价商品不存在");
}
YxStoreBargainUser yxStoreBargainUser = YxStoreBargainUser
.builder()

12
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java

@ -13,7 +13,7 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
@ -30,7 +30,6 @@ import co.yixiang.modules.activity.service.YxStorePinkService;
import co.yixiang.modules.activity.service.dto.PinkAllDto;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDto;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
import co.yixiang.modules.activity.service.dto.YxStorePinkDto;
import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper;
import co.yixiang.modules.activity.service.mapper.YxStorePinkMapper;
import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper;
@ -42,17 +41,14 @@ import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.service.YxStoreProductAttrService;
import co.yixiang.modules.product.service.YxStoreProductAttrValueService;
import co.yixiang.modules.product.service.YxStoreProductReplyService;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.modules.product.service.dto.FromatDetailDto;
import co.yixiang.modules.product.service.dto.ProductFormatDto;
import co.yixiang.modules.product.service.dto.ProductResultDto;
import co.yixiang.modules.product.service.impl.YxStoreProductServiceImpl;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.template.domain.YxShippingTemplates;
import co.yixiang.modules.template.service.YxShippingTemplatesService;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.RedisUtils;
@ -128,7 +124,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
.ge(YxStoreCombination::getStopTime,now)
.one();
if(storeCombination == null){
throw new YshopException("拼团不存在或已下架");
throw new ShopException("拼团不存在或已下架");
}
//获取商品sku
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(storeCombination.getProductId());
@ -331,7 +327,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
YxStoreCombination yxStoreCombination = new YxStoreCombination();
BeanUtil.copyProperties(resources,yxStoreCombination,"images");
if(resources.getImages().isEmpty()) {
throw new YshopException("请上传轮播图");
throw new ShopException("请上传轮播图");
}
yxStoreCombination.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
@ -398,7 +394,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
.orElse(0);
if(stock < 0) {
throw new YshopException("活动库存不能低于0");
throw new ShopException("活动库存不能低于0");
}
return ProductResultDto.builder()

8
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponIssueServiceImpl.java

@ -10,7 +10,7 @@ package co.yixiang.modules.activity.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -76,17 +76,17 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
YxStoreCouponIssueQueryVo couponIssueQueryVo = yxStoreCouponIssueMapper
.selectOne(id);
if(ObjectUtil.isNull(couponIssueQueryVo)) {
throw new YshopException("领取的优惠劵已领完或已过期");
throw new ShopException("领取的优惠劵已领完或已过期");
}
Long count = this.couponCount(id,uid);
if(count > 0) {
throw new YshopException("已领取过该优惠劵");
throw new ShopException("已领取过该优惠劵");
}
if(couponIssueQueryVo.getRemainCount() <= 0
&& CouponEnum.PERMANENT_0.getValue().equals(couponIssueQueryVo.getIsPermanent())){
throw new YshopException("抱歉优惠卷已经领取完了");
throw new ShopException("抱歉优惠卷已经领取完了");
}
storeCouponUserService.addUserCoupon(uid,couponIssueQueryVo.getCid());

8
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCouponUserServiceImpl.java

@ -9,10 +9,9 @@
package co.yixiang.modules.activity.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.constant.ShopConstants;
@ -50,9 +49,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -243,7 +239,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
public void addUserCoupon(Long uid, Integer cid) {
YxStoreCoupon storeCoupon = storeCouponService.getById(cid);
if(storeCoupon == null) {
throw new YshopException("优惠劵不存在");
throw new ShopException("优惠劵不存在");
}
//现在的日期向后偏移,得到优惠券的使用截止期期
// Date now = new Date();

12
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStorePinkServiceImpl.java

@ -11,7 +11,7 @@ package co.yixiang.modules.activity.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.constant.ShopConstants;
@ -119,7 +119,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
.gt(YxStorePink::getStopTime,new Date())
.one();
if(pink == null) {
throw new YshopException("拼团不存在或已经取消");
throw new ShopException("拼团不存在或已经取消");
}
PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(pink);
@ -130,7 +130,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
int count = pinkUserDto.getCount();
if(count < 1){
this.pinkComplete(uidAll,idAll,uid,pinkT);
throw new YshopException("拼团已完成,无法取消");
throw new ShopException("拼团已完成,无法取消");
}
//如果团长取消拼团,团队还有人,就把后面的人作为下一任团长
YxStorePink nextPinkT = null;
@ -196,10 +196,10 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
public PinkInfoVo pinkInfo(Long id, Long uid) {
YxStorePink pink = this.getPinkUserOne(id);
if(ObjectUtil.isNull(pink)) {
throw new YshopException("拼团不存在");
throw new ShopException("拼团不存在");
}
if( OrderInfoEnum.PINK_REFUND_STATUS_1.getValue().equals(pink.getIsRefund())){
throw new YshopException("订单已退款");
throw new ShopException("订单已退款");
}
int isOk = 0;//判断拼团是否完成
@ -247,7 +247,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
YxStoreCombinationQueryVo storeCombinationQueryVo = yxStoreCombinationMapper.getCombDetail(pink.getCid());
if(ObjectUtil.isNull(storeCombinationQueryVo)) {
throw new YshopException("拼团不存在或已下架");
throw new ShopException("拼团不存在或已下架");
}
YxUserQueryVo userInfo = userService.getYxUserById(uid);

8
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java

@ -14,7 +14,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.constant.ShopConstants;
@ -209,7 +209,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
.one();
if(storeSeckill == null){
throw new YshopException("秒杀产品不存在或已下架");
throw new ShopException("秒杀产品不存在或已下架");
}
//获取商品sku
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(storeSeckill.getProductId());
@ -482,7 +482,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
YxStoreSeckill yxStoreSeckill = new YxStoreSeckill();
BeanUtil.copyProperties(resources,yxStoreSeckill,"images");
if(resources.getImages().isEmpty()) {
throw new YshopException("请上传轮播图");
throw new ShopException("请上传轮播图");
}
yxStoreSeckill.setStock(resultDTO.getStock());
@ -550,7 +550,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
.orElse(0);
if(stock < 0) {
throw new YshopException("库存不能低于0");
throw new ShopException("库存不能低于0");
}
return ProductResultDto.builder()

12
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java

@ -11,7 +11,7 @@ package co.yixiang.modules.activity.service.impl;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -75,16 +75,16 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
public void userExtract(YxUser userInfo, UserExtParam param) {
BigDecimal extractPrice = userInfo.getBrokeragePrice();
if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) {
throw new YshopException("提现佣金不足");
throw new ShopException("提现佣金不足");
}
double money = Double.valueOf(param.getMoney());
if( extractPrice.compareTo(BigDecimal.valueOf(money)) < 0) {
throw new YshopException("提现佣金不足");
throw new ShopException("提现佣金不足");
}
if(money <= 0) {
throw new YshopException("提现佣金大于0");
throw new ShopException("提现佣金大于0");
}
double balance = NumberUtil.sub(extractPrice.doubleValue(),money);
@ -114,13 +114,13 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
if(PayTypeEnum.ALI.getValue().equals(param.getExtractType())){
if(StrUtil.isEmpty(param.getAlipayCode())){
throw new YshopException("请输入支付宝账号");
throw new ShopException("请输入支付宝账号");
}
userExtract.setAlipayCode(param.getAlipayCode());
mark = "使用支付宝提现"+param.getMoney()+"元";
}else if(PayTypeEnum.WEIXIN.getValue().equals(param.getExtractType())){
if(StrUtil.isEmpty(param.getWeixin())){
throw new YshopException("请输入微信账号");
throw new ShopException("请输入微信账号");
}
mark = "使用微信提现"+param.getMoney()+"元";
}

2
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/mapper/YxStoreBargainMapper.java

@ -25,7 +25,7 @@ import java.util.List;
*/
@Repository
public interface YxStoreBargainMapper extends CoreMapper<YxStoreBargain> {
@Update("update yx_store_bargain set stock=stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_bargain set stock=stock+#{num}, sales = sales - IF(sales >= #{num}, #{num},sales)" +
" where id=#{bargainId}")
int incStockDecSales(@Param("num") int num, @Param("bargainId") Long bargainId);

5
zsw-bxg/src/main/java/co/yixiang/modules/canvas/rest/StoreCanvasController.java

@ -10,8 +10,7 @@ package co.yixiang.modules.canvas.rest;
import java.util.Arrays;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.constant.ShopConstants;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.mp.config.BxgConstans;
@ -70,7 +69,7 @@ public class StoreCanvasController {
StringBuilder url = new StringBuilder();
if (ShopCommonEnum.STORE_MODE_1.getValue().toString().equals(mode)) { //存在走本地
if(StrUtil.isBlank(localUrl)){
throw new YshopException("本地上传,请先登陆系统配置后台/移动端API地址");
throw new ShopException("本地上传,请先登陆系统配置后台/移动端API地址");
}
LocalStorageDto localStorageDTO = localStorageService.create(name, file);
if ("".equals(url.toString())) {

25
zsw-bxg/src/main/java/co/yixiang/modules/cart/service/impl/YxStoreCartServiceImpl.java

@ -10,7 +10,7 @@ package co.yixiang.modules.cart.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -42,7 +42,6 @@ import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.utils.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
@ -119,18 +118,18 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
.eq(YxStoreCart::getId, cartId)
.one();
if (cart == null) {
throw new YshopException("购物车不存在");
throw new ShopException("购物车不存在");
}
if (cartNum <= 0) {
throw new YshopException("库存错误");
throw new ShopException("库存错误");
}
//普通商品库存
int stock = productService.getProductStock(cart.getProductId()
, cart.getProductAttrUnique(), "");
if (stock < cartNum) {
throw new YshopException("该产品库存不足" + cartNum);
throw new ShopException("该产品库存不足" + cartNum);
}
if (cartNum == cart.getCartNum()) {
@ -387,12 +386,12 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.one();
if (product == null) {
throw new YshopException("该产品已下架或删除");
throw new ShopException("该产品已下架或删除");
}
int stock = productService.getProductStock(productId, productAttrUnique, ProductTypeEnum.PINK.getValue());
if (stock < cartNum) {
throw new YshopException(product.getStoreName() + "库存不足" + cartNum);
throw new ShopException(product.getStoreName() + "库存不足" + cartNum);
}
//秒杀
} else if (seckillId != null && seckillId > 0) {
@ -401,12 +400,12 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.one();
if (product == null) {
throw new YshopException("该产品已下架或删除");
throw new ShopException("该产品已下架或删除");
}
int stock = productService.getProductStock(productId, productAttrUnique, ProductTypeEnum.SECKILL.getValue());
if (stock < cartNum) {
throw new YshopException(product.getStoreName() + "库存不足" + cartNum);
throw new ShopException(product.getStoreName() + "库存不足" + cartNum);
}
//砍价
} else if (bargainId != null && bargainId > 0) {
@ -417,10 +416,10 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
.ge(YxStoreBargain::getStopTime, now)
.one();
if (yxStoreBargain == null) {
throw new YshopException("该产品已下架或删除");
throw new ShopException("该产品已下架或删除");
}
if (yxStoreBargain.getStock() < cartNum) {
throw new YshopException("该产品库存不足");
throw new ShopException("该产品库存不足");
}
} else {
@ -429,12 +428,12 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.one();
if (product == null) {
throw new YshopException("该产品已下架或删除");
throw new ShopException("该产品已下架或删除");
}
int stock = productService.getProductStock(productId, productAttrUnique, "");
if (stock < cartNum) {
throw new YshopException(product.getStoreName() + "库存不足" + cartNum);
throw new ShopException(product.getStoreName() + "库存不足" + cartNum);
}
}

17
zsw-bxg/src/main/java/co/yixiang/modules/category/rest/StoreCategoryController.java

@ -9,9 +9,8 @@
package co.yixiang.modules.category.rest;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.exception.BadRequestException;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.aop.ForbidSubmit;
import co.yixiang.modules.category.domain.YxStoreCategory;
@ -87,12 +86,12 @@ public class StoreCategoryController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreCategory resources){
if(resources.getPid() != null && resources.getPid() > 0 && StrUtil.isBlank(resources.getPic())) {
throw new YshopException("子分类图片必传");
throw new ShopException("子分类图片必传");
}
boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid());
if(!checkResult) {
throw new YshopException("分类最多能添加2级哦");
throw new ShopException("分类最多能添加2级哦");
}
return new ResponseEntity<>(yxStoreCategoryService.save(resources),HttpStatus.CREATED);
@ -106,17 +105,17 @@ public class StoreCategoryController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECATEGORY_ALL','YXSTORECATEGORY_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCategory resources){
if(resources.getPid() != null && resources.getPid() > 0 && StrUtil.isBlank(resources.getPic())) {
throw new YshopException("子分类图片必传");
throw new ShopException("子分类图片必传");
}
if(resources.getId().equals(resources.getPid())){
throw new YshopException("自己不能选择自己哦");
throw new ShopException("自己不能选择自己哦");
}
boolean checkResult = yxStoreCategoryService.checkCategory(resources.getPid());
if(!checkResult) {
throw new YshopException("分类最多能添加2级哦");
throw new ShopException("分类最多能添加2级哦");
}
yxStoreCategoryService.saveOrUpdate(resources);
@ -148,7 +147,7 @@ public class StoreCategoryController {
.eq(YxStoreCategory::getPid,id)
.count();
if(count > 0) {
throw new YshopException("请先删除子分类");
throw new ShopException("请先删除子分类");
}
Long countP = yxStoreProductService.lambdaQuery()
@ -156,7 +155,7 @@ public class StoreCategoryController {
.count();
if(countP > 0) {
throw new YshopException("当前分类下有商品不可删除");
throw new ShopException("当前分类下有商品不可删除");
}
}
}

6
zsw-bxg/src/main/java/co/yixiang/modules/entry/service/impl/YxStoreEntryServiceImpl.java

@ -8,7 +8,7 @@
*/
package co.yixiang.modules.entry.service.impl;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
@ -19,8 +19,6 @@ import co.yixiang.modules.entry.service.YxStoreEntryService;
import co.yixiang.modules.entry.service.dto.YxStoreEntryDto;
import co.yixiang.modules.entry.service.dto.YxStoreEntryQueryCriteria;
import co.yixiang.modules.entry.service.mapper.YxStoreEntryMapper;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.utils.EntryDTO;
import co.yixiang.utils.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -109,7 +107,7 @@ public class YxStoreEntryServiceImpl extends BaseServiceImpl<YxStoreEntryMapper,
wrapper.eq(YxStoreEntry::getIsDel, CommonEnum.DEL_STATUS_0.getValue()).eq(YxStoreEntry::getEntryName,name);
YxStoreEntry yxStoreEntry=yxStoreEntryMapper.selectOne(wrapper);
if (yxStoreEntry==null){
throw new YshopException("没有这个词条");
throw new ShopException("没有这个词条");
}
EntryDTO entryDTO=new EntryDTO();
//取出需要的属性

7
zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationRelationServiceImpl.java

@ -1,7 +1,7 @@
package co.yixiang.modules.evaluation.service.impl;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
@ -17,7 +17,6 @@ import co.yixiang.modules.user.service.YxUserService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
@ -77,7 +76,7 @@ public class YxEvaluationRelationServiceImpl extends BaseServiceImpl<YxEvaluatio
@Override
public void addEvaluationRelation(long evaluationId, long uid) {
if(isEvaluationRelation(evaluationId,uid)){
throw new YshopException("已收藏");
throw new ShopException("已收藏");
}
YxStoreEvaluationRelation storeEvaluationRelation=YxStoreEvaluationRelation.builder()
.evaluationId(evaluationId)
@ -98,7 +97,7 @@ public class YxEvaluationRelationServiceImpl extends BaseServiceImpl<YxEvaluatio
.eq(YxStoreEvaluationRelation::getUid,uid)
.one();
if (evaluationRelation == null){
throw new YshopException("已取消");
throw new ShopException("已取消");
}
this.removeById(evaluationRelation.getId());
}

4
zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeiXinSubscribeService.java

@ -3,7 +3,7 @@ package co.yixiang.modules.mp.service;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
@ -291,7 +291,7 @@ public class WeiXinSubscribeService {
.eq(YxWechatTemplate::getTempkey,key)
.one();
if (yxWechatTemplate == null) {
throw new YshopException("请后台配置key:" + key + "订阅消息id");
throw new ShopException("请后台配置key:" + key + "订阅消息id");
}
if(ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())){
return "";

15
zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java

@ -10,10 +10,9 @@ package co.yixiang.modules.mp.service;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import co.yixiang.api.BusinessException;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.enums.AppFromEnum;
import co.yixiang.enums.BillDetailEnum;
import co.yixiang.enums.OrderInfoEnum;
@ -30,7 +29,6 @@ import co.yixiang.modules.user.service.dto.WechatUserDto;
import co.yixiang.modules.mp.config.WxPayConfiguration;
import co.yixiang.utils.IpUtil;
import co.yixiang.utils.RedisUtils;
import co.yixiang.utils.ShopKeyUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
@ -39,7 +37,6 @@ import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -80,14 +77,14 @@ public class WeixinPayService {
if(BillDetailEnum.TYPE_3.getValue().equals(attach)){
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(orderId,null);
if(ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if(orderInfo.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
throw new YshopException("该订单已支付");
throw new ShopException("该订单已支付");
}
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
throw new YshopException("该支付无需支付");
throw new ShopException("该支付无需支付");
}
uid = orderInfo.getUid().intValue();
@ -101,7 +98,7 @@ public class WeixinPayService {
}
if(userRecharge.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) {
throw new YshopException("该订单已支付");
throw new ShopException("该订单已支付");
}
uid = userRecharge.getUid();
payPrice = bigDecimal.multiply(userRecharge.getPrice()).intValue();
@ -110,7 +107,7 @@ public class WeixinPayService {
YxUser yxUser = userService.getById(uid);
if(yxUser == null) {
throw new YshopException("用户错误");
throw new ShopException("用户错误");
}

8
zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeixinTemplateService.java

@ -8,15 +8,11 @@
*/
package co.yixiang.modules.mp.service;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponMapper;
import co.yixiang.modules.mp.config.BxgConstans;
import co.yixiang.modules.mp.config.WxMaConfiguration;
import co.yixiang.modules.mp.config.WxMpConfiguration;
import co.yixiang.modules.mp.domain.YxWechatTemplate;
import co.yixiang.modules.shop.service.YxSystemConfigService;
@ -294,7 +290,7 @@ public class WeixinTemplateService {
.eq(YxWechatTemplate::getTempkey,key)
.one();
if (yxWechatTemplate == null) {
throw new YshopException("请后台配置key:" + key + "模板消息id");
throw new ShopException("请后台配置key:" + key + "模板消息id");
}
if(ShopCommonEnum.IS_STATUS_0.getValue().equals(yxWechatTemplate.getStatus())){

5
zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java

@ -12,7 +12,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.OrderInfoEnum;
@ -56,7 +56,6 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -346,7 +345,7 @@ public class StoreOrderController {
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
if (!expressInfo.isSuccess()) {
// throw new BadRequestException(expressInfo.getReason());
throw new YshopException(expressInfo.getReason());
throw new ShopException(expressInfo.getReason());
}
return new ResponseEntity<>(expressInfo, HttpStatus.OK);
}

102
zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java

@ -15,7 +15,7 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.api.BusinessException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
@ -39,7 +39,6 @@ import co.yixiang.modules.cart.domain.YxStoreCart;
import co.yixiang.modules.cart.service.YxStoreCartService;
import co.yixiang.modules.cart.service.mapper.StoreCartMapper;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import co.yixiang.modules.category.domain.YxStoreCategory;
import co.yixiang.modules.category.service.YxStoreCategoryService;
import co.yixiang.modules.order.domain.YxExpress;
import co.yixiang.modules.order.domain.YxStoreOrder;
@ -110,7 +109,6 @@ import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@ -227,12 +225,12 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
cartIds, ShopConstants.ZSW_ONE_NUM);
List<YxStoreCartQueryVo> list = new ArrayList<>();
if (ObjectUtil.isNotEmpty(cartGroup.get("invalidProductList"))) {
throw new YshopException("有失效的商品请重新提交");
throw new ShopException("有失效的商品请重新提交");
};
cartGroup.get("cartList").forEach(item->{
YxStoreBrandCart yxStoreBrandCart=(YxStoreBrandCart)item;
if (ObjectUtil.isEmpty(yxStoreBrandCart.getValidProductList())) {
throw new YshopException("请提交购买的商品");
throw new ShopException("请提交购买的商品");
}
list.addAll(yxStoreBrandCart.getValidProductList());
});
@ -327,7 +325,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
Long uid = userInfo.getUid();
CacheDto cacheDTO = this.getCacheOrderInfo(uid, key);
if (ObjectUtil.isNull(cacheDTO)) {
throw new YshopException("订单已过期,请刷新当前页面");
throw new ShopException("订单已过期,请刷新当前页面");
}
BigDecimal payPrice = cacheDTO.getPriceGroup().getTotalPrice();
@ -369,11 +367,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
if (StrUtil.isNotBlank(couponId) && !ShopConstants.ZSW_ZERO.equals(couponId)) {//使用优惠券
YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId), uid);
if (couponUser == null) {
throw new YshopException("使用优惠劵失败");
throw new ShopException("使用优惠劵失败");
}
if (couponUser.getUseMinPrice().compareTo(payPrice) > 0) {
throw new YshopException("不满足优惠劵的使用条件");
throw new ShopException("不满足优惠劵的使用条件");
}
payPrice = NumberUtil.sub(payPrice, couponUser.getCouponPrice());
couponPrice = couponUser.getCouponPrice();
@ -443,15 +441,15 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
YxUserAddress userAddress = null;
if (OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(Integer.valueOf(param.getShippingType()))) {
if (StrUtil.isEmpty(param.getAddressId())) {
throw new YshopException("请选择收货地址");
throw new ShopException("请选择收货地址");
}
userAddress = userAddressService.getById(param.getAddressId());
if (ObjectUtil.isNull(userAddress)) {
throw new YshopException("地址选择有误");
throw new ShopException("地址选择有误");
}
} else { //门店
if (StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) {
throw new YshopException("请填写姓名和电话");
throw new ShopException("请填写姓名和电话");
}
userAddress = new YxUserAddress();
userAddress.setRealName(param.getRealName());
@ -560,7 +558,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
boolean res = this.save(storeOrder);
if (!res) {
throw new YshopException("订单生成失败");
throw new ShopException("订单生成失败");
}
//使用了积分扣积分
@ -649,14 +647,14 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
String serviceScore) {
if (ObjectUtil.isEmpty(orderCartInfo)) {
throw new YshopException("评价产品不存在");
throw new ShopException("评价产品不存在");
}
Long count = productReplyService.count(Wrappers.<YxStoreProductReply>lambdaQuery()
.eq(YxStoreProductReply::getOid, orderCartInfo.getOid())
.eq(YxStoreProductReply::getProductId, orderCartInfo.getProductId()));
if (count > 0) {
throw new YshopException("该产品已评价");
throw new ShopException("该产品已评价");
}
@ -697,20 +695,20 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null);
if (ObjectUtil.isNull(orderQueryVo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
YxUserQueryVo userQueryVo = userService.getYxUserById(orderQueryVo.getUid());
if (ObjectUtil.isNull(userQueryVo)) {
throw new YshopException("用户不存在");
throw new ShopException("用户不存在");
}
if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderQueryVo.getRefundStatus())) {
throw new YshopException("订单已经退款了哦!");
throw new ShopException("订单已经退款了哦!");
}
if (orderQueryVo.getPayPrice().compareTo(price) < 0) {
throw new YshopException("退款金额不正确");
throw new ShopException("退款金额不正确");
}
YxStoreOrder storeOrder = new YxStoreOrder();
@ -798,7 +796,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Override
public void orderCheck(String orderId) {
if (StringUtils.isEmpty(orderId)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
YxStoreOrder storeOrder=yxStoreOrderService.lambdaQuery()
.eq(YxStoreOrder::getOrderId,orderId).one();
@ -819,21 +817,21 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void orderDelivery(String orderId, String deliveryId, String deliveryName, String deliveryType) {
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId, null);
if (ObjectUtil.isNull(orderQueryVo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (!OrderInfoEnum.STATUS_5.getValue().equals(orderQueryVo.getStatus()) ||
OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) {
throw new YshopException("订单状态错误");
throw new ShopException("订单状态错误");
}
if (!OrderInfoEnum.REFUND_STATUS_0.getValue().equals(orderQueryVo.getRefundStatus())) {
throw new YshopException("订单退款中或已退款");
throw new ShopException("订单退款中或已退款");
}
YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper<YxExpress>().eq(YxExpress::getName, deliveryName));
if (ObjectUtil.isNull(expressQueryVo)) {
throw new YshopException("请后台先添加快递公司");
throw new ShopException("请后台先添加快递公司");
}
// //判断拼团产品--现允许未成团单独发货
@ -890,17 +888,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void updateDelivery(String orderId, String deliveryId, String deliveryName, String deliveryType) {
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId, null);
if (ObjectUtil.isNull(orderQueryVo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (!OrderInfoEnum.STATUS_1.getValue().equals(orderQueryVo.getStatus()) ||
OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) {
throw new YshopException("订单状态错误");
throw new ShopException("订单状态错误");
}
YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper<YxExpress>().eq(YxExpress::getName, deliveryName));
if (ObjectUtil.isNull(expressQueryVo)) {
throw new YshopException("请后台先添加快递公司");
throw new ShopException("请后台先添加快递公司");
}
@ -926,7 +924,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void editOrderPrice(String orderId, String price) {
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null);
if (ObjectUtil.isNull(orderQueryVo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
@ -936,7 +934,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderQueryVo.getPaid())) {
throw new YshopException("订单状态错误");
throw new ShopException("订单状态错误");
}
@ -983,7 +981,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void deleteOrder(String orderId, Long uid) {
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid);
if (ObjectUtil.isNull(order)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
//更新订单状态
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>();
@ -1005,7 +1003,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void cancelOrder(String orderId, Long uid) {
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid);
if (ObjectUtil.isNull(order)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
this.regressionIntegral(order, 0);
@ -1034,11 +1032,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void removeOrder(String orderId, Long uid) {
YxStoreOrderQueryVo order = getOrderInfo(orderId, (long) uid);
if (order == null) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
order = handleOrder(order);
if (!OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) {
throw new YshopException("该订单无法删除");
throw new ShopException("该订单无法删除");
}
yxStoreOrderMapper.deleteById(order.getId());
@ -1060,7 +1058,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void takeOrder(String orderId, Long uid) {
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid);
if (ObjectUtil.isNull(order)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
order = handleOrder(order);
if (!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) {
@ -1102,25 +1100,25 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue()));
if (order == null) {
throw new YshopException("核销的订单不存在或未支付或已退款");
throw new ShopException("核销的订单不存在或未支付或已退款");
}
if (uid != null) {
boolean checkStatus = systemStoreStaffService.checkStatus(uid, order.getStoreId());
if (!checkStatus) {
throw new YshopException("您没有当前店铺核销权限");
throw new ShopException("您没有当前店铺核销权限");
}
}
if (!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) {
throw new YshopException("订单已经核销");
throw new ShopException("订单已经核销");
}
if (order.getCombinationId() != null && order.getCombinationId() > 0
&& order.getPinkId() != null && order.getPinkId() > 0) {
YxStorePink storePink = storePinkService.getById(order.getPinkId());
if (!OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePink.getStatus())) {
throw new YshopException("拼团订单暂未成功无法核销");
throw new ShopException("拼团订单暂未成功无法核销");
}
}
@ -1163,17 +1161,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void orderApplyRefund(String explain, String Img, String text, String orderId, Long uid) {
YxStoreOrderQueryVo order = getOrderInfo(orderId, uid);
if (order == null) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())) {
throw new YshopException("订单已退款");
throw new ShopException("订单已退款");
}
if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) {
throw new YshopException("正在申请退款中");
throw new ShopException("正在申请退款中");
}
if (OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) {
throw new YshopException("订单当前无法退款");
throw new ShopException("订单当前无法退款");
}
YxStoreOrder storeOrder = new YxStoreOrder();
@ -1706,18 +1704,18 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public String aliPay(String orderId) throws Exception {
AlipayConfig alipay = alipayService.find();
if (ObjectUtil.isNull(alipay)) {
throw new YshopException("请先配置支付宝");
throw new ShopException("请先配置支付宝");
}
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, null);
if (ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
throw new YshopException("该订单已支付");
throw new ShopException("该订单已支付");
}
if (orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
throw new YshopException("该支付无需支付");
throw new ShopException("该支付无需支付");
}
TradeVo trade = new TradeVo();
trade.setOutTradeNo(orderId);
@ -1736,17 +1734,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void yuePay(String orderId, Long uid) {
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, uid);
if (ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
throw new YshopException("该订单已支付");
throw new ShopException("该订单已支付");
}
YxUserQueryVo userInfo = userService.getYxUserById(uid);
if (userInfo.getNowMoney().compareTo(orderInfo.getPayPrice()) < 0) {
throw new YshopException("余额不足");
throw new ShopException("余额不足");
}
userService.decPrice(uid, orderInfo.getPayPrice());
@ -1766,22 +1764,22 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public void integralPay(String orderId, Long uid) {
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, uid);
if (ObjectUtil.isNull(orderInfo)) {
throw new YshopException("订单不存在");
throw new ShopException("订单不存在");
}
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
throw new YshopException("该订单已支付");
throw new ShopException("该订单已支付");
}
orderInfo = handleOrder(orderInfo);
orderInfo.getCartInfo().forEach(cart -> {
if (cart.getProductInfo().getIsIntegral() == 0) {
throw new YshopException("该商品不为积分商品");
throw new ShopException("该商品不为积分商品");
}
});
YxUser userInfo = userService.getById(uid);
if (userInfo.getIntegral().compareTo(orderInfo.getPayIntegral()) < 0) {
throw new YshopException("积分不足");
throw new ShopException("积分不足");
}
//扣除积分

6
zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java

@ -10,7 +10,7 @@ package co.yixiang.modules.product.rest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ShopCommonEnum;
@ -21,12 +21,10 @@ import co.yixiang.modules.category.domain.YxStoreCategory;
import co.yixiang.modules.category.service.YxStoreCategoryService;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationMapper;
import co.yixiang.modules.hotList.domain.YxStoreHotList;
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListMapper;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.domain.YxStoreProductAttrResult;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.domain.YxStoreProductRelation;
import co.yixiang.modules.product.service.YxStoreProductAttrResultService;
import co.yixiang.modules.product.service.YxStoreProductAttrValueService;
import co.yixiang.modules.product.service.YxStoreProductRuleService;
@ -166,7 +164,7 @@ public class StoreProductController {
//此商品关联有评测
if(count > 0) {
//不能删除
throw new YshopException("当前商品已绑定评测,不能被删除");
throw new ShopException("当前商品已绑定评测,不能被删除");
}
// Long count1 = yxStoreHotListMapper
// .selectCount(Wrappers.<YxStoreHotList>lambdaQuery()

9
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java

@ -12,11 +12,10 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.api.BusinessException;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ProductTypeEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.product.domain.YxStoreProductAttr;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.service.YxStoreProductAttrResultService;
@ -97,7 +96,7 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
if(productFormatDto.getPinkStock()>productFormatDto.getStock() || productFormatDto.getSeckillStock()>productFormatDto.getStock()){
// throw new BadRequestException("活动商品库存不能大于原有商品库存");
throw new YshopException("活动商品库存不能大于原有商品库存");
throw new ShopException("活动商品库存不能大于原有商品库存");
}
List<String> stringList = new ArrayList<>(productFormatDto.getDetail().values());
Collections.sort(stringList);
@ -151,7 +150,7 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
*/
private void clearProductAttr(Long productId) {
if(ObjectUtil.isNull(productId)) {
throw new YshopException("产品不存在");
throw new ShopException("产品不存在");
}
yxStoreProductAttrMapper.delete(Wrappers.<YxStoreProductAttr>lambdaQuery()
@ -197,7 +196,7 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
res = yxStoreProductAttrValueMapper.decStockIncSales(num,productId,unique);
}
if(res == 0) {
throw new YshopException("商品库存不足");
throw new ShopException("商品库存不足");
}
}

6
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductRelationServiceImpl.java

@ -8,7 +8,7 @@
*/
package co.yixiang.modules.product.service.impl;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
@ -80,7 +80,7 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
@Override
public void addRroductRelation(long productId,long uid,String category) {
if(isProductRelation(productId,uid)) {
throw new YshopException("已收藏");
throw new ShopException("已收藏");
}
YxStoreProductRelation storeProductRelation = YxStoreProductRelation.builder()
.productId(productId)
@ -103,7 +103,7 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
.eq(YxStoreProductRelation::getType,category)
.one();
if(productRelation == null) {
throw new YshopException("已取消");
throw new ShopException("已取消");
}
this.removeById(productRelation.getId());
}

21
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

@ -14,7 +14,7 @@ import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.constant.ShopConstants;
@ -27,11 +27,9 @@ import co.yixiang.enums.SortEnum;
import co.yixiang.enums.SpecTypeEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper;
import co.yixiang.modules.category.service.YxStoreCategoryService;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationMapper;
import co.yixiang.modules.hotList.domain.YxStoreHotList;
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListMapper;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.YxStoreBrandService;
@ -58,7 +56,6 @@ import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.store.service.YxStoreBrandService;
import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
import co.yixiang.modules.store.vo.YxStoreBrandVo;
import co.yixiang.modules.template.domain.YxShippingTemplates;
@ -172,18 +169,18 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
//先处理商品库存,活动商品也要处理,因为共享库存
int product = storeProductMapper.decStockIncSales(num, productId);
if (product == 0) {
throw new YshopException("共享商品库存不足");
throw new ShopException("共享商品库存不足");
}
//处理商品外层显示的库存
if (ProductTypeEnum.COMBINATION.getValue().equals(type)) {
int combinationRes = storeProductMapper.decCombinationStockIncSales(num, productId, activityId);
if (combinationRes == 0) {
throw new YshopException("拼团商品库存不足");
throw new ShopException("拼团商品库存不足");
}
} else if (ProductTypeEnum.SECKILL.getValue().equals(type)) {
int seckillRes = storeProductMapper.decSeckillStockIncSales(num, productId, activityId);
if (seckillRes == 0) {
throw new YshopException("秒杀商品库存不足");
throw new ShopException("秒杀商品库存不足");
}
}
//todo 处理砍价库存
@ -589,7 +586,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
.eq(YxEvaluation::getProduct,id));
//此商品关联有评测
if(count > 0) {
throw new YshopException("当前商品已绑定评测,不能被下架");
throw new ShopException("当前商品已绑定评测,不能被下架");
}
// Long count1 = yxStoreHotListMapper
// .selectCount(Wrappers.<YxStoreHotList>lambdaQuery()
@ -623,7 +620,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
YxStoreProduct yxStoreProduct = new YxStoreProduct();
BeanUtil.copyProperties(storeProductDto, yxStoreProduct, "sliderImage");
if (storeProductDto.getSliderImage().isEmpty()) {
throw new YshopException("请上传轮播图");
throw new ShopException("请上传轮播图");
}
yxStoreProduct.setConfig(storeProductDto.getConfig());
yxStoreProduct.setIsHotList(storeProductDto.getIsHotList());
@ -840,7 +837,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
.orElse(0);
if (stock < 0) {
throw new YshopException("库存不能低于0");
throw new ShopException("库存不能低于0");
}
return ProductResultDto.builder()
@ -977,11 +974,11 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
.map(FromatDetailDto::getDetail)
.forEach(i -> {
if (i == null || i.isEmpty()) {
throw new YshopException("请至少添加一个规格值哦");
throw new ShopException("请至少添加一个规格值哦");
}
String str = ArrayUtil.join(i.toArray(), ",");
if (str.contains("-")) {
throw new YshopException("规格值里包含'-',请重新添加");
throw new ShopException("规格值里包含'-',请重新添加");
}
});

6
zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductAttrValueMapper.java

@ -29,7 +29,7 @@ public interface StoreProductAttrValueMapper extends CoreMapper<YxStoreProductAt
* @param unique
* @return
*/
@Update("update yx_store_product_attr_value set stock=stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_product_attr_value set stock=stock+#{num}, sales=sales- IF(sales >= #{num}, #{num},sales)" +
" where product_id=#{productId} and `unique`=#{unique}")
int incStockDecSales(@Param("num") Integer num,@Param("productId") Long productId,
@Param("unique") String unique);
@ -43,7 +43,7 @@ public interface StoreProductAttrValueMapper extends CoreMapper<YxStoreProductAt
* @return
*/
@Update("update yx_store_product_attr_value set stock=stock+#{num}, pink_stock=pink_stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_product_attr_value set stock=stock+#{num}, pink_stock=pink_stock+#{num}, sales = sales - IF(sales >= #{num}, #{num},sales)" +
" where product_id=#{productId} and `unique`=#{unique}")
int incCombinationStockDecSales(@Param("num") Integer num,@Param("productId") Long productId,
@Param("unique") String unique);
@ -56,7 +56,7 @@ public interface StoreProductAttrValueMapper extends CoreMapper<YxStoreProductAt
* @param unique
* @return
*/
@Update("update yx_store_product_attr_value set stock=stock+#{num},seckill_stock=seckill_stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_product_attr_value set stock=stock+#{num},seckill_stock=seckill_stock+#{num}, sales = sales - IF(sales >= #{num}, #{num},sales)" +
" where product_id=#{productId} and `unique`=#{unique}")
int incSeckillStockDecSales(@Param("num") Integer num,@Param("productId") Long productId,
@Param("unique") String unique);

6
zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java

@ -42,7 +42,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
* @param productId
* @return
*/
@Update("update yx_store_product set stock=stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_product set stock=stock+#{num}, sales = sales - IF(sales >= #{num}, #{num},sales)" +
" where id=#{productId}")
int incStockDecSales(@Param("num") Integer num,@Param("productId") Long productId);
@ -78,7 +78,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
* @param productId
* @param activityId
*/
@Update("update yx_store_combination set stock=stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_combination set stock=stock+#{num}, sales = sales - IF(sales >= #{num}, #{num},sales)" +
" where id=#{activityId} and stock >= #{num}")
void incCombinationStockIncSales(@Param("num") Integer num, @Param("productId") Long productId,@Param("activityId") Long activityId);
@ -89,7 +89,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
* @param activityId
* @return
*/
@Update("update yx_store_seckill set stock=stock+#{num}, sales=sales-#{num}" +
@Update("update yx_store_seckill set stock=stock+#{num}, sales = sales - IF(sales >= #{num}, #{num},sales)" +
" where id=#{activityId} and stock >= #{num}")
void incSeckillStockIncSales(@Param("num") Integer num, @Param("productId") Long productId,@Param("activityId") Long activityId);

13
zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java

@ -2,7 +2,7 @@ package co.yixiang.modules.sales.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -17,7 +17,6 @@ import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import co.yixiang.modules.mp.service.WeixinPayService;
import co.yixiang.modules.order.domain.YxStoreOrder;
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.service.impl.YxStoreOrderServiceImpl;
import co.yixiang.modules.order.service.mapper.StoreOrderCartInfoMapper;
import co.yixiang.modules.order.service.mapper.StoreOrderMapper;
@ -277,10 +276,10 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
public Boolean revoke(String key, Long uid, Long id) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getUserId, uid).eq(StoreAfterSales::getId, id).eq(StoreAfterSales::getOrderCode, key));
if (storeAfterSales == null) {
throw new YshopException("未查询到售后订单信息");
throw new ShopException("未查询到售后订单信息");
}
if (storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_2.getValue()) || storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_3.getValue())) {
throw new YshopException("订单不能撤销");
throw new ShopException("订单不能撤销");
}
storeAfterSales.setSalesState(1);
@ -311,7 +310,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
public Boolean addLogisticsInformation(String code, String name, String postalCode, String orderCode) {
StoreAfterSales storeAfterSales = baseMapper.selectOne(Wrappers.<StoreAfterSales>lambdaQuery().eq(StoreAfterSales::getOrderCode, orderCode));
if (!storeAfterSales.getState().equals(AfterSalesStatusEnum.STATUS_1.getValue())) {
throw new YshopException("当前状态不能添加物流信息!");
throw new ShopException("当前状态不能添加物流信息!");
}
storeAfterSales.setShipperCode(code);
storeAfterSales.setDeliverySn(postalCode);
@ -408,13 +407,13 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
*/
private void checkOrder(YxStoreOrder yxStoreOrder) {
if (yxStoreOrder == null) {
throw new YshopException("未查询到订单信息");
throw new ShopException("未查询到订单信息");
}
if (!yxStoreOrder.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())
|| !yxStoreOrder.getRefundStatus().equals(OrderInfoEnum.REFUND_STATUS_0.getValue())
|| yxStoreOrder.getStatus() < OrderInfoEnum.STATUS_0.getValue()) {
throw new YshopException("订单状态不能售后");
throw new ShopException("订单状态不能售后");
}
}

6
zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java

@ -7,7 +7,7 @@ package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.exception.BadRequestException;
import co.yixiang.logging.aop.log.Log;
@ -86,7 +86,7 @@ public class SystemGroupDataController {
yxSeckillTime.forEach(item -> {
Map map = JSONUtil.toBean(item.getValue(), Map.class);
if (Objects.nonNull(jsonObject.getInteger("time")) && jsonObject.getInteger("time").equals(map.get("time"))) {
throw new YshopException("已存在相同时间配置,不能同时开启同一时间点");
throw new ShopException("已存在相同时间配置,不能同时开启同一时间点");
}
});
}
@ -118,7 +118,7 @@ public class SystemGroupDataController {
Map map = JSONUtil.toBean(item.getValue(), Map.class);
if (jsonObject.getInteger("time").equals(map.get("time"))) {
// throw new BadRequestException("不能同时开启同一时间点");
throw new YshopException("已存在相同时间配置,不能同时开启同一时间点");
throw new ShopException("已存在相同时间配置,不能同时开启同一时间点");
}
});

4
zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java

@ -10,7 +10,7 @@ package co.yixiang.modules.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -306,7 +306,7 @@ public class BxgMenuServiceImpl extends BaseServiceImpl<BxgMenuMapper, Menu> imp
if(StringUtils.isNotBlank(resources.getComponentName())&&resources.getType()!=1&& !resources.getIFrame()){
Long menuCount = this.lambdaQuery().eq(Menu::getComponentName,resources.getComponentName()).count();
if(menuCount > 1) {
throw new YshopException("请保持菜单组件名称唯一");
throw new ShopException("请保持菜单组件名称唯一");
}
menu1 = this.getOne(new LambdaQueryWrapper<Menu>()
.eq(Menu::getComponentName,resources.getComponentName()));

6
zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java

@ -11,7 +11,7 @@ package co.yixiang.modules.template.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import co.yixiang.api.BusinessException;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -75,7 +75,7 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl<YxShippingTe
public void addAndUpdate(Integer id,ShippingTemplatesDto shippingTemplatesDto) {
if(ShopCommonEnum.ENABLE_1.getValue().equals(shippingTemplatesDto.getAppoint())
&& shippingTemplatesDto.getAppointInfo().isEmpty()){
throw new YshopException("请指定包邮地区");
throw new ShopException("请指定包邮地区");
}
YxShippingTemplates shippingTemplates = new YxShippingTemplates();
BeanUtil.copyProperties(shippingTemplatesDto,shippingTemplates);
@ -180,7 +180,7 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl<YxShippingTe
if(shippingTemplatesFrees.isEmpty()) {
throw new YshopException("请添加包邮区域");
throw new ShopException("请添加包邮区域");
}
yxShippingTemplatesFreeService.saveBatch(shippingTemplatesFrees);

4
zsw-bxg/src/main/java/co/yixiang/modules/user/rest/MemberController.java

@ -8,14 +8,12 @@
*/
package co.yixiang.modules.user.rest;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.aop.ForbidSubmit;
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.modules.user.service.YxSystemUserLevelService;
import co.yixiang.modules.user.service.YxUserLevelService;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.service.dto.UserMoneyDto;
import co.yixiang.modules.user.service.dto.YxUserQueryCriteria;
@ -40,8 +38,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
/**
* @author hupeng
* @date 2019-10-06

7
zsw-bxg/src/main/java/co/yixiang/modules/user/rest/SystemUserLevelController.java

@ -6,14 +6,13 @@
package co.yixiang.modules.user.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.aop.ForbidSubmit;
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
import co.yixiang.modules.user.service.YxSystemUserLevelService;
import co.yixiang.modules.user.service.dto.YxSystemUserLevelQueryCriteria;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Pageable;
@ -66,7 +65,7 @@ public class SystemUserLevelController {
.last("limit 1")
.one();
if (ObjectUtil.isNotEmpty(yxSystemUserLevel)){
throw new YshopException("已有相同等级会员卡");
throw new ShopException("已有相同等级会员卡");
}
return new ResponseEntity<>(yxSystemUserLevelService.save(resources),HttpStatus.CREATED);
}
@ -84,7 +83,7 @@ public class SystemUserLevelController {
.last("limit 1")
.one();
if (ObjectUtil.isNotEmpty(yxSystemUserLevel)&&yxSystemUserLevel.equals(resources)){
throw new YshopException("已有相同等级会员卡");
throw new ShopException("已有相同等级会员卡");
}
yxSystemUserLevelService.saveOrUpdate(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);

4
zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxSystemUserLevelServiceImpl.java

@ -9,7 +9,7 @@
package co.yixiang.modules.user.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -118,7 +118,7 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
//会员等级列表
List<YxSystemUserLevelQueryVo> list = this.getLevelListAndGrade(levelId);
if(list.isEmpty()) {
throw new YshopException("请后台设置会员等级");
throw new ShopException("请后台设置会员等级");
}
//任务列表

4
zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserRechargeServiceImpl.java

@ -12,7 +12,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@ -127,7 +127,7 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<UserRechargeMappe
@Override
public String addRecharge(YxUser user,String price,String paidPrice) {
if(StrUtil.isBlank(price) || StrUtil.isBlank(paidPrice)){
throw new YshopException("参数错误哦");
throw new ShopException("参数错误哦");
}
YxUserRecharge yxUserRecharge = new YxUserRecharge();

8
zsw-bxg/src/main/java/co/yixiang/modules/user/service/impl/YxUserSignServiceImpl.java

@ -11,7 +11,7 @@ package co.yixiang.modules.user.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.constant.ShopConstants;
import co.yixiang.dozer.service.IGenerator;
@ -80,12 +80,12 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
public int sign(YxUser yxUser) {
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.ZSW_SIGN_DAY_NUM);
if(ObjectUtil.isNull(list) || list.isEmpty()) {
throw new YshopException("请先配置签到天数");
throw new ShopException("请先配置签到天数");
}
boolean isDaySign = this.getToDayIsSign(yxUser.getUid());
if(isDaySign) {
throw new YshopException("已签到");
throw new ShopException("已签到");
}
int signNumber = 0; //积分
int userSignNum = yxUser.getSignNum(); //签到次数
@ -126,7 +126,7 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
.build();
boolean res = yxUserService.updateById(user);
if(!res) {
throw new YshopException("签到失败");
throw new ShopException("签到失败");
}
//插入流水

6
zsw-bxg/src/main/java/co/yixiang/tools/rest/UploadController.java

@ -6,8 +6,7 @@
package co.yixiang.tools.rest;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.constant.ShopConstants;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.mp.config.BxgConstans;
@ -16,7 +15,6 @@ import co.yixiang.tools.domain.QiniuContent;
import co.yixiang.tools.service.LocalStorageService;
import co.yixiang.tools.service.QiNiuService;
import co.yixiang.tools.service.dto.LocalStorageDto;
import co.yixiang.utils.RedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -65,7 +63,7 @@ public class UploadController {
StringBuilder url = new StringBuilder();
if (ShopCommonEnum.STORE_MODE_1.getValue().toString().equals(mode)) { //存在走本地
if(StrUtil.isBlank(localUrl)){
throw new YshopException("本地上传,请先登陆系统配置后台/移动端API地址");
throw new ShopException("本地上传,请先登陆系统配置后台/移动端API地址");
}
for (MultipartFile file : files) {
LocalStorageDto localStorageDTO = localStorageService.create(name, file);

8
zsw-bxg/src/main/java/co/yixiang/utils/QrCodeutil.java

@ -2,11 +2,9 @@ package co.yixiang.utils;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.EnableSpringUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.SystemConfigConstants;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import lombok.experimental.UtilityClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -24,7 +22,7 @@ public class QrCodeutil {
public String generateQrStr(String code){
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
throw new YshopException("未配置api地址");
throw new ShopException("未配置api地址");
}
return apiUrl + "/bxgApp/qrcode/image/"+code+".png";
}
@ -37,7 +35,7 @@ public class QrCodeutil {
public String generateQrUrlBase64(String code){
String apiUrl = systemConfigService.getData(SystemConfigConstants.API_URL);
if(StrUtil.isEmpty(apiUrl)){
throw new YshopException("未配置api地址");
throw new ShopException("未配置api地址");
}
String xcode = Base64.encode(code);

Loading…
Cancel
Save